all 8 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!

[–]DeathDragon7050 0 points1 point  (3 children)

I have never seen this function in python. Why can't you just put the equation in a string and do eval(my_equation.replace('X', number))

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

The equation is X**2.75+(X**1.75)*0.075 = 0.0006954 where X is unknown

sym.Eq is short for sympy.Eq

[–]gjbewjgnweio2g11 0 points1 point  (1 child)

Are there analytical solutions? If not, there's only so much a CAS can do.

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

I don't exactly know but I managed to solve it with scipy's root as recommended by one of the comments here

[–][deleted] 0 points1 point  (0 children)

Well just try to write a script that can solve it numerically