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 non-linear systems with something like solve-fsolve-nsolve(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.

Please give your example problem.

Generally, it will look like this. fsolve([x^2+y-2,x+y^2-2],[x,y]) You can give it a range by doing 0..1 for example for your intial guess.

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+y-2,x+y^2-2],[x,y],[0..1,0..1])?

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,x-y],[x,y],[0..1,0..1]) which should give us x=0.739085133215 and y=0.739085133215

Try

[x=0 .. 1 , y=0 .. 1] as the second argument to fsolve.

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/(y-0.1495645628)-24.52151/(y^2)=

39.8344274/(x-0.1495645628)-24.52151/(x^2)

and

39.8344274/(y-0.1495645628)-24.52151/(y^2)=

39.8344274*ln((x-0.1495645628)/(y-0.1495645628))/(x-y)-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.5-0.2, but with fsolve even if i put ranges like 1.665-1.667 and 0.22-0,24 or initial guess 1.5-0.2

I cant get it

It's slow but it works in Xcas, e.g.

Code:

fsolve([39.8344274/(y-0.1495645628)-24.52151/(y^2)=39.8344274/(x-0.1495645628)-24.52151/(x^2),39.8344274/(y-0.1495645628)-24.52151/(y^2)=39.8344274*ln((x-0.1495645628)/(y-0.1495645628))/(x-y)-24.52151/(x*y)],[x,y],[1.6,0.2])

The reason is probably because I compute symbolically the inverse of the jacobian, perhaps it would be faster if done at each Newton iteration step, once x and y have values.

For multi-dimensional systems, you can not provide intervals as guesses, this work only for 1-dimension equation where you can start a bisection.

Then why the intervals worked for fsolve([cos(x)-x,x-y],[x=0..1,y=0..1]?

Anyway I tried single values this way:

fsolve([39.8344274/(y-0.1495645628)-24.52151/(y^2)=39.8344274/(x-0.1495645628)-24.52151/(x^2),39.8344274/(y-0.1495645628)-24.52151/(y^2)=39.8344274*ln((x-0.1495645628)/(y-0.1495645628))/(x-y)-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

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,x-y],[x=0..1,y=0..1]), the solver probably restarted from a random point, after an initial try with an invalid guess.

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 ?

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.

Can i get the modified code for my real calc too? By the way thanks for the patience!!!

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).