fsolve() bug?
|
01-10-2015, 03:52 AM
Post: #1
|
|||
|
|||
fsolve() bug?
fsolve([x+y=3,2*x+2*y=6,x-y=0],[x,y],[0,0]); --> invalid dimension
fsolve([x+y=3,2*x+2*y=6,x-y=0],[x,y]); --> [3/2, 3/2] fsolve([x+y=3,x-y=0],[x,y],[0,0]); --> [1.5, 1.5] fsolve() seems use a naive dimension check -- if the number of equations is not equal to the number of variables, then giving initial values results in invalid dimension. Graph 3D | QPI | SolveSys |
|||
01-10-2015, 07:37 AM
Post: #2
|
|||
|
|||
RE: fsolve() bug?
It is not a bug: fsolve is a numeric solver, you can not run an iterative method (explicitly called if you pass a guess as third argument) if the number of equations is not the same as the number of unknowns.
|
|||
01-10-2015, 11:18 AM
Post: #3
|
|||
|
|||
RE: fsolve() bug?
Hello,
Sorry to ask (I'm not a mathematician): (01-10-2015 07:37 AM)parisse Wrote: It is not a bug: fsolve is a numeric solver, you can not run an iterative method (explicitly called if you pass a guess as third argument) if the number of equations is not the same as the number of unknowns.I've always thought that's the basic principle of iterative methods: first guessing an approximation, then successively improving it until some exact-enough-measure is met. Greetings |
|||
01-10-2015, 02:51 PM
Post: #4
|
|||
|
|||
RE: fsolve() bug?
That's correct, and that's what fsolve does if you give a guess as third argument. If you do not give a guess, it might however solve the equation/system using a different method (for example a polynomial rooter for a polynomial equation).
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)