Reputation: 59
I have been trying to swap from using Pint.py for units to using the Sympy units system. I have examples of both code working in the image. I need help please, converting the Sympy expresion to a floating point number. I have tried evalf() and simplify() but neither change the expression at all.
The first image is using Sympy units, the second is Pint units, which is giving the correct output.
Upvotes: 0
Views: 1424
Reputation: 19115
SymPy will not evaluate a function having an argument with a unit. So for evaluation do x.subs(u.deg, pi/180).subs(u.rad, 1).evalf() -> 2.8*Wb
in whatever units are being used for theta. This feels clunky. Trig functions should probably do this automatically upon a request to evaluate. This has been raised as an issue.
Upvotes: 1