Post Reply 
Oddity with fsolve, nSolve, etc.
01-11-2014, 01:06 AM
Post: #1
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].
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Oddity with fsolve, nSolve, etc. - Helge Gabert - 01-11-2014 01:06 AM



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