What's the difference in all the polynomial solve/root/zero functions?
09-07-2015, 09:28 PM
Post: #7
 Helge Gabert Senior Member Posts: 467 Joined: Dec 2013
RE: What's the difference in all the polynomial solve/root/zero functions?
There are some subtle differences.

Take, for example, the polynomial (x-2)^2*(x+1) with roots {2,2,-1}.

solve((x-2)^2*(x+1)=0,x) returns {-1,2} in a list as integers
zeros((x-2)^2*(x+1),x) returns [2,-1] in a vector as integers

and proot((x-2)^2*(x+1),x) returns all three roots [-1. 2. 2.] in a vector as reals.

proot also takes a vector with the coefficients as an argument, which can be nice, e.g.,
proot([1 -3 0 4]) returns the same solution as above.

I say it is good to have choices! And for fun, try solving this polynomial (in expanded form) with fsolve between, say, -5 and 5,

fsolve(x^3-3*x^2+4,x,-5..5) returns [-1. 0. 2.] !!
 « Next Oldest | Next Newest »

 Messages In This Thread What's the difference in all the polynomial solve/root/zero functions? - ewjax - 09-07-2015, 04:59 AM RE: What's the difference in all the polynomial solve/root/zero functions? - parisse - 09-07-2015, 06:35 AM RE: What's the difference in all the polynomial solve/root/zero functions? - ewjax - 09-07-2015, 03:25 PM RE: What's the difference in all the polynomial solve/root/zero functions? - parisse - 09-07-2015, 04:09 PM RE: What's the difference in all the polynomial solve/root/zero functions? - ewjax - 09-07-2015, 06:11 PM RE: What's the difference in all the polynomial solve/root/zero functions? - Terje Vallestad - 09-07-2015, 07:44 PM RE: What's the difference in all the polynomial solve/root/zero functions? - Helge Gabert - 09-07-2015 09:28 PM RE: What's the difference in all the polynomial solve/root/zero functions? - parisse - 09-08-2015, 06:11 AM

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