how to solve 3 nonlinear equations in python

Viewed 5142

I have the following system of 3 nonlinear equations that I need to solve:

-xyt + HF = 0

-2xzt + 4yzt - xyt + 4z^2t - M1F = 0

-2xt + 2yt + 4zt - 1 = 0

where x, HF, and M1F are known parameters. Therefore, y,z, and t are the parameters to be calculated.

Attemp to solve the problem:

def equations(p):
    y,z,t = p
    f1 = -x*y*t + HF
    f2 = -2*x*z*t + 4*y*z*t - x*y*t + 4*t*z**2 - M1F
    f3 = -2*x*t + 2*y*t + 4*z*t - 1
    return (f1,f2,f3)

y,z,t = fsolve(equations)

print equations((y,z,t))

But the thing is that if I want to use scipy.optimize.fsolve then I should input an initial guess. In my case, I do not have any initial conditions.

Is there another way to solve 3 nonlinear equations with 3 unknowns in python?

Edit:

It turned out that I have a condition! The condition is that HF > M1F, HF > 0, and M1F > 0.

1 Answers
Related