Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python's sympy struggling to solve simple equality

I have been solving a problem, and I have gotten to a pretty simple equality which I could solve on my calculator, but Sympy for some reason seems to struggle. These are in short the problematic lines of code:

import sympy 
V = sympy.symbols('V')
eq = sympy.Eq(1.0 - 1.0*sympy.exp(-0.00489945895346184*V), 0.98)
sol = sympy.solve(eq,V)

I get no errors or warnings, it just keeps trying to compute the solution.

Anyone able to run that? Any ideas what could be causing this issue?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks!

>Solution :

You need to use brackets when passing arguments to solve:

import sympy 
V = sympy.symbols('V')
eq = sympy.Eq(1.0 - 1.0*sympy.exp(-0.00489945895346184*V), 0.98)
sol = sympy.solve([eq],[V])

Best regards.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading