System of nonlinear equations

05052014, 04:34 PM
Post: #1




System of nonlinear equations
Hi,
I tried to solve a system of non linear and non polynomial equations and I managed to solve it with the Solve App and in Advanced graph mode, looking for intersections in the grap or in num mode(using Trace when I was nearby). I wanted to know if there was a way to solve nonlinear systems with something like solvefsolvensolve(i think I got the syntax wrong), maybe specifing for example 1..7 for x and 2..4 for y rather than putting one number, like you do in the Solve App. 

05052014, 04:39 PM
Post: #2




RE: System of nonlinear equations
Please give your example problem.
Generally, it will look like this. fsolve([x^2+y2,x+y^22],[x,y]) You can give it a range by doing 0..1 for example for your intial guess. TW Although I work for HP, the views and opinions I post here are my own. 

05052014, 04:47 PM
Post: #3




RE: System of nonlinear equations
I tried your system(my original problem is a bit more complex, I guess its fine to try with simple systems), how do i give the range? Because we have both x and y, should I give 2 ranges in this way : fsolve([x^2+y2,x+y^22],[x,y],[0..1,0..1])?


05052014, 04:52 PM
Post: #4




RE: System of nonlinear equations
Wait I thought I saw y^(2) while it was y^2, I need to solve non linear non polynomial systems then lets change with: fsolve([cos(x)x,xy],[x,y],[0..1,0..1]) which should give us x=0.739085133215 and y=0.739085133215


05052014, 05:11 PM
Post: #5




RE: System of nonlinear equations
Try
[x=0 .. 1 , y=0 .. 1] as the second argument to fsolve. 

05052014, 05:54 PM
Post: #6




RE: System of nonlinear equations
Thanks a lot, it works for that system, but I tried it with my problem and even with an accurate range i cant get my solution :/
my system is: 39.8344274/(y0.1495645628)24.52151/(y^2)= 39.8344274/(x0.1495645628)24.52151/(x^2) and 39.8344274/(y0.1495645628)24.52151/(y^2)= 39.8344274*ln((x0.1495645628)/(y0.1495645628))/(xy)24.52151/(x*y) the solution i am aiming for is x=1.66649546538 and y=0.238068203637, which i can get in graph mode or with the solve app giving an inital guess value like 1.50.2, but with fsolve even if i put ranges like 1.6651.667 and 0.220,24 or initial guess 1.50.2 I cant get it 

05052014, 07:10 PM
Post: #7




RE: System of nonlinear equations
It's slow but it works in Xcas, e.g.
Code:
For multidimensional systems, you can not provide intervals as guesses, this work only for 1dimension equation where you can start a bisection. 

05062014, 12:57 PM
Post: #8




RE: System of nonlinear equations
Then why the intervals worked for fsolve([cos(x)x,xy],[x=0..1,y=0..1]?
Anyway I tried single values this way: fsolve([39.8344274/(y0.1495645628)24.52151/(y^2)=39.8344274/(x0.1495645628)24.52151/(x^2),39.8344274/(y0.1495645628)24.52151/(y^2)=39.8344274*ln((x0.1495645628)/(y0.1495645628))/(xy)24.52151/(x*y)],[x,y],[0.8,0.25]) and I got my solution(why did you say it was slow, it was quite fast), and for some unknown reasons its important that i put an accurate y value, for example if i put 1.66 and 0.2 i doesnt work, while it works with 0.8 and 0.25 

05062014, 01:42 PM
(This post was last modified: 05062014 01:49 PM by parisse.)
Post: #9




RE: System of nonlinear equations
Didi you try on emulator or real calc? With inversion of jacobian after substitution (new code) it takes about 1/100s on the emulator.
The starting point is important for iterative methods: sometimes it converges, sometimes not... For fsolve([cos(x)x,xy],[x=0..1,y=0..1]), the solver probably restarted from a random point, after an initial try with an invalid guess. 

05062014, 03:06 PM
(This post was last modified: 05062014 03:06 PM by Gabriel.)
Post: #10




RE: System of nonlinear equations
I tried with my real calc, if its 1/100 why did you say it was slow? its very fast(i can count seconds not 1/10 s or 1/100 s xD). You are right for the starting point, there must be some mathematical reason behind it.
One last thing, when I put these equations in advanced graph app for a graphic solution, it takes some time to plot the graph, like it plots a curved stripe/area and then it gets reduced till its a one dimension curve...its because they are complex non linear implicit functions ? 

05062014, 03:37 PM
Post: #11




RE: System of nonlinear equations
1/100s is on the emulator with the modified code (the original code takes about 100* more time). I don't know for the graph app.


05062014, 03:51 PM
Post: #12




RE: System of nonlinear equations
Can i get the modified code for my real calc too? By the way thanks for the patience!!!


05062014, 05:39 PM
Post: #13




RE: System of nonlinear equations
No, but you can test it in inside Xcas (test version 1.1.1) today (windows and linux 64 bits) or tomorrow (mac and linux 32 bits).


« Next Oldest  Next Newest »

User(s) browsing this thread: