Problem with square brackets in fSolve
09-08-2023, 08:56 AM
Post: #1
 rawi Member Posts: 171 Joined: Nov 2019
Problem with square brackets in fSolve
I wanted to solve a system of 2 equations with X and Y as unknowns. Whenever I opened the square brackets a +/- sign was included that could not be removed. So it looked different to the examples in the manual.
So I went to CAS menue (not in CAS mode) and Numerical Solve so there was CAS.fsolve() on the screen. Then I pressed Help.
There were two examples. The second example was
fsolve([x²+y-2,x+y²-2],[x,y],[0,0])
I pressed Example and highlighted the second example. When I copied it I got:
CAS.fsolve([x²+y-2 x+y²-2 +/-],[x y +/-],[0 0 +/-])
Pressing Enter gives message: Error: Syntax Error

It seems that the elements in the square brackets are interpreted as elements of a matrix. How can I use the fSove function for more than one equation?

Thank you very much for your help!
09-08-2023, 11:29 AM
Post: #2
 Didier Lachieze Senior Member Posts: 1,632 Joined: Dec 2013
RE: Problem with square brackets in fSolve
(09-08-2023 08:56 AM)rawi Wrote:  How can I use the fSolve function for more than one equation?

The simplest way is to use fsolve in CAS mode.

If you want to use it in HOME , then CAS.fsolve("[x²+y-2,x+y²-2],[x,y],[0,0]") or CAS("fsolve([x^2+y-2,x+y^2-2],[x,y],[0,0])") will work.
09-08-2023, 04:17 PM
Post: #3
 rawi Member Posts: 171 Joined: Nov 2019
RE: Problem with square brackets in fSolve
Hi Didier,

thank you very much for your fast and helpful answer. In CAS mode it works fine. I tried in home mode and there I got again the message "Error: Syntax Error".

In CAS mode the +/- before the closing of the square bracket that is generated as soon a square bracket is opened disappear when pressing Enter. In home mode it does not disappear.
And I think it strange that this is a problem to be solved in CAS mode as it is a strictly numeric problem.

But I am glad that I now know how to do it. Thank you once more!
 « Next Oldest | Next Newest »