Python Forum

Full Version: How to solve difficult non-linear equations?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm a beginner and trying to solve this system of non-linear equations, would appreciate any guidance. The attached image shows the system of equations I want to solve:
Image of equations

This is the code I tried:

from scipy.optimize import fsolve import math as m import numpy as np

def equations(p): x, y = p return ((3*(x2+y2))-1*(x*(x2+y2+2.25)*np.sinh((4*m.piym.e4)/466)+3*x*m.cosh((4*m.piym.e4)/466)+y*(x2+y2-2.25)*m.sin((4*m.pixm.e4)/466)+3*y*m.cos((4*m.pixm.e4)/466))-31.176, 6*(x2+y2)-1*((1+x2+y2)*((x2+y2+2.25)*m.cosh((4*m.piym.e4)/466)+3*x*m.sinh((4*m.piym.e4)/466))+(1-x2-y2)*((x2+y2-2.25)*m.cos((4*m.pixm.e4)/466)-3*y*m.sin((4*m.pixm.e4)/466))-42.35)

(x,y) = fsolve(equations,(1, 1))

print (equations((x, y)))
Which are your unknowns? R and T? The equations look linear in those. If the ns and the ks are the unknowns, surely you don't have enough equations?
Hello everyone, I understand that my question may not be very clear. I have tried to explain it here:
I have two non-linear equations with only two variables which are tedious to solve.
Please see this link for equations:

I'm having difficulty solving this system, is there any way to input this into a solver? I tried solving it manually but it becomes too complex.

Any help would be appreciated, I'm posting it here as a last desperate try to get some hint on how to go about it. Thank you so much.
def equations(p):
    x, y = p
    return ((3*(x**2+y**2))**-1*(x*(x**2+y**2+2.25)*np.sinh((4*m.pi*y*m.e4)/466)+3*x*m.cosh((4*m.pi*y*m.e4)/466)+y*(x**2+y**2-2.25)*m.sin((4*m.pi*x*m.e4)/466)+3*y*m.cos((4*m.pi*x*m.e4)/466))-31.176, 6*(x**2+y**2)**-1*((1+x**2+y**2)*((x**2+y**2+2.25)*m.cosh((4*m.pi*y*m.e4)/466)+3*x*m.sinh((4*m.pi*y*m.e4)/466))+(1-x**2-y**2)*((x**2+y**2-2.25)*m.cos((4*m.pi*x*m.e4)/466)-3*y*m.sin((4*m.pi*x*m.e4)/466))                         )-42.35))

x, y =  fsolve(equations, (1, 1))

print equations((x, y))
https://drive.google.com/file/d/19XznHHD...sp=sharing
Please see the link above, in the previous comment I made an oversight and mentioned a variable n2=0, instead it is 1.5.
Thanks