Is it possible to solve 3 equations with 2 unknowns in Python (Sympy)

  python, sympy

Currently using sympy to solve the following set of equations:

from sympy import symbols, Eq, nsolve, exp, log, cosh

eq1 = Eq(Vmax**2/Amax * log(cosh(Amax*4.82/Vmax)),40)
eq2 = Eq(Vmax**2/Amax * log(cosh(Amax*2.8/Vmax)),20)

solution = nsolve([eq1, eq2], [Amax, Vmax], [1, 1])

I get a solution using this technique. However I have a third equation and I would like to solve for the 2 unknowns using all 3 equations. Is it possible to solve for 2 unknowns with 3 equations in Sympy?

from sympy import symbols, Eq, nsolve, exp, log, cosh

eq1 = Eq(Vmax**2/Amax * log(cosh(Amax*4.82/Vmax)),40)
eq2 = Eq(Vmax**2/Amax * log(cosh(Amax*2.8/Vmax)),20)
eq3 = Eq(Vmax**2/Amax * log(cosh(Amax*1.65/Vmax)),10)

solution = nsolve([eq1, eq2, eq3], [Amax, Vmax], [1, 1])

Trying the code above gives a value error: ValueError: Could not find root within given tolerance. (0.181941547657103824541 > 2.16840434497100886801e-19) Try another starting point or tweak arguments.

Can anyone help out or suggest how I can get the values for the 2 unknowns using 3 equations?

Thanks!

Source: Python Questions

LEAVE A COMMENT