2

I am using sympy's atan2 and for certain values it isn't giving me the full numerical evaluation but giving me a (value + pi)

from sympy import atan2
print(atan2(0.0037, -0.056))

gives the following output:

-0.0659755361339305 + pi

I want the code to give the numberical value without the "+ pi", in this case 3.07402446387

mpmath's mpf function solves this issue but gives me error messages in other parts of my code. Is there another way of doing this?

GilMe
  • 23
  • 3
  • 1
    Try using the numerical conversion functions/methods of sympy; see [here](http://docs.sympy.org/dev/modules/evalf.html). Of course, you can always use the equivalent `numpy` function, which is probably faster. – Stelios Jun 29 '17 at 10:56

1 Answers1

2
from sympy import atan2
print(atan2(0.0037, -0.056).evalf())

Does excatly what you want.

from sympy import atan2
print(atan2(0.0037, -0.056).evalf(30))

Gives you the numerical result with 30 digits precision.

laolux
  • 1,445
  • 1
  • 17
  • 28