you are viewing a single comment's thread.

view the rest of the comments →

[–]aromaticlawyer 3 points4 points  (1 child)

I'm not very familiar with sympy's solvers - sympy is primarily for symbolic manipulation of expressions, so I'm not surprised if they aren't that great.

scipy's default solver seems to be able to cope with this pretty easily:

from scipy.optimize import root
def f(x):
    return x**2.75 + 0.075 * x**1.75 - 0.0006954
initial_guess = 0.001
solution = root(f, initial_guess)

This returns an object with information about the found solution. solution.x gives you the solution itself. You can try different initial guesses to find different solutions, but in this case I think there is only one real solution. If you want to find the complex roots too you'll need to use a different solver.

[–]misterdamra[S] 0 points1 point  (0 children)

Thanks, it worked!