Python Forum
How to solve difficult non-linear equations?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to solve difficult non-linear equations?
#1
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)))
Reply
#2
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?
Reply
#3
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))
Reply
#4
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  difficult string conversion need help Pir8Radio 3 1,000 Nov-27-2022, 06:15 PM
Last Post: Gribouillis
  SOlving LInear Equations in Python(Symoy, NUmpy) - Coefficient Problem quest 3 1,691 Jan-30-2022, 10:53 PM
Last Post: quest
Heart how to solve complex equations in python HoangF 3 2,733 Dec-26-2021, 07:04 PM
Last Post: HoangF
Question Help with code to solve polynomials equations hiviera 1 1,762 Jul-31-2021, 01:56 AM
Last Post: hiviera
  creating simplex tableau pivot program easy or difficult for a beginner in Python? alex_0 2 2,538 Mar-31-2021, 03:39 AM
Last Post: Larz60+
  Solve system of equations Sancho_Pansa 19 8,706 Oct-27-2020, 08:15 AM
Last Post: Sancho_Pansa
  How to solve equations, with groups of variables and or constraints? ThemePark 0 1,645 Oct-05-2020, 07:22 PM
Last Post: ThemePark
  Solve a system of linear equations with binary variables lopeslimagabriel 3 2,443 Sep-24-2020, 07:09 AM
Last Post: scidam
  Programming Difficult math in Python Huntern 6 4,691 Oct-17-2019, 06:32 AM
Last Post: Huntern
  Very difficult challenge for me cristfp 1 2,717 Apr-01-2019, 08:45 PM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020