Oddity with fsolve, nSolve, etc.
01-11-2014, 01:06 AM
Post: #1
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
Oddity with fsolve, nSolve, etc.
In CAS view,

there appears to be a problem with displaying the zeros of functions with multiple roots, e.g., I ran into this oddity recently:

fsolve(x^3-3*x^2+4=0, x=-1.5..2.5)

nSolve(x^3-3*x^2+4=0, x=-1.5..2.5)

both return [-1 0. 2.] Here the solution 0. is clearly incorrect.

I also find it strange that both the wrong solution 0 and the double root 2 are displayed approximately as 0. and 2., whereas the single root of -1 is displayed exactly (as it should be).

BTW,

solve(x^3-3*x^2+4=0,x) returns {-1,2}, which is OK, but better would be {-1,2,2}. Same for zeros(x^3-3*x^2+4=0,x) returns [2 -1], but again, better would be [2 2 -1].
 « Next Oldest | Next Newest »

 Messages In This Thread Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014 01:06 AM RE: Oddity with fsolve, nSolve, etc. - Michael de Estrada - 01-11-2014, 02:31 AM RE: Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014, 02:37 AM RE: Oddity with fsolve, nSolve, etc. - Michael de Estrada - 01-11-2014, 02:44 AM RE: Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014, 02:48 AM RE: Oddity with fsolve, nSolve, etc. - Michael de Estrada - 01-11-2014, 03:14 AM RE: Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014, 03:05 AM RE: Oddity with fsolve, nSolve, etc. - Michael de Estrada - 01-11-2014, 04:00 AM RE: Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014, 03:35 AM RE: Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014, 04:10 AM RE: Oddity with fsolve, nSolve, etc. - Michael de Estrada - 01-11-2014, 04:30 AM RE: Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014, 05:10 AM

User(s) browsing this thread: 1 Guest(s)