I've been trying to use sympy.Symbol to implement a system where the 
numerical value of a symbolic quantity is only fixed when it is evaluated 
using evalf().
To accomplish this I've redefined _eval_evalf() to return the 
aforementioned value (a fixed 5.0 in the toy example below).

This works fine with basic algebraic operations and most SymPy functions. 
However, for some reason atan2 seems to behave differently and _eval_evalf 
is never called.
Is this a bug, or have I misunderstood the purpose of _eval_evalf?


import sympy
import sympy.functions as syf

class A(sympy.Symbol):
    def _eval_evalf(self, prec):
        print('*')
        return sympy.Float(5.0)

x = A('X')
y = A('Y')
print('polynomial:')
print((2*x-4+y).evalf())  # works fine
print('atan:')
print(syf.atan(y / x).evalf())  # works fine
print('beta:')
print(syf.beta(y, x).evalf())  # works fine
print('atan2:')
print(syf.atan2(y, x).evalf())  # prints "atan2(Y, X)", does not call 
A._eval_evalf

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/4480befb-c8d3-48f1-a1be-b5e8bd55a0be%40googlegroups.com.

Reply via email to