SymPy automatically defines evaluation based on mpmath function names.
I think you can get around it by defining an empty _eval_evalf(self,
prec) function.

Aaron Meurer

On Sat, Sep 6, 2014 at 1:50 PM, Duane Nykamp <[email protected]> wrote:
> I really like the evaluate=False flag on parse_expr.  But, since log(0.1)
> automatically evaluates to a float, I'm trying to create an unevaluated
> version of log.  However, I'm getting strange results where log is
> implicitly defined.
>
> As shown below, once I define a function log that does nothing, sympy
> somehow implicitly defines it to be the usual log function.
>
> Am I missing how this works or is this aberrant behavior?
>
> My eventual plan is to have log.doit() return the original sympy function.
>
> If I call the function something else, like llog, then I don't run into the
> behavior.  But, I'm not sure how to make printers display my llog function
> as log.
>
> Thanks,
> Duane
>
>
>
> In [1]: from sympy import Function
>
> In [2]: log
> ---------------------------------------------------------------------------
> NameError                                 Traceback (most recent call last)
> <ipython-input-2-9a115ebc25a0> in <module>()
> ----> 1 log
>
> NameError: name 'log' is not defined
>
> In [3]: class log(Function):
>    ...:     pass
>    ...:
>
> In [4]: log
> Out[4]: __main__.log
>
> In [5]: log(0.1)
> Out[5]: -2.30258509299405
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/5df457b7-7ffc-4285-b9b5-b8ddce3f91ca%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6J%3DO17caMhyLaB%2BaqOy_fw-012vVDg7A4_B9QSLA7bXMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to