Post Reply 
What's the difference in all the polynomial solve/root/zero functions?
09-07-2015, 04:59 AM
Post: #1
What's the difference in all the polynomial solve/root/zero functions?
Hello,

I am confused by why the Prime has so many different menu options for solving polynomial roots. They all seem conceptually identical to me.

Toolbox / CAS / Solve / Solve -> solve()
Toolbox / CAS / Solve / Zeros -> zeros()
Toolbox / CAS / Solve / Complex Solve -> csolve()
Toolbox / CAS / Solve / Complex Zeros -> cZeros()
Toolbox / CAS / Polynomial / Find Roots -> proot()

Although the syntax in the last (proot) is slightly different from the first four, and some return {} lists while others return [] vectors, all five functions yield identical answers when you feed them the polynomial

x^4 -1 = 0 -> {-1, i, 1, -i} or [-1 i 1 -i]

Can someone offer any insight into when you might need to select one over the others?
Find all posts by this user
Quote this message in a reply
09-07-2015, 06:35 AM
Post: #2
RE: What's the difference in all the polynomial solve/root/zero functions?
functions with c return complex answers regardless of complex mode (i checked in settings).
Find all posts by this user
Quote this message in a reply
09-07-2015, 03:25 PM
Post: #3
RE: What's the difference in all the polynomial solve/root/zero functions?
Interesting. I was just playing with that setting, and as you point out, when the i is not checked, solve() and zeros() do not return i or -i in their answer, while the c-versions do, and so does proot().

However, I did notice that if you run cZeros() without i checked, it will be checked after cZeros() runs. That function turns on the i option and doesn't reset it. The csolve() function doesn't commit that error.

But complex numbers aside, I'm still wondering what the conceptual difference is between solve(), zeros(), and proot().

"Solve this polynomial."
"Find the roots of this polynomial."
"Find the zeros of this polynomial."

In my mind at least those are all equivalent sentences, but perhaps there are times when they aren't equivalent?
Find all posts by this user
Quote this message in a reply
09-07-2015, 04:09 PM
Post: #4
RE: What's the difference in all the polynomial solve/root/zero functions?
solve and zeros are different in TI mode in Xcas, but not on the Prime (except for delimiters). Both are exact commands and can also solve equations that factor and reduce to polynomials. proot is always approx and strictly for polynomials.
I can not reproduce the complex mode switch you describe with cZeros.
Find all posts by this user
Quote this message in a reply
09-07-2015, 06:11 PM
Post: #5
RE: What's the difference in all the polynomial solve/root/zero functions?
(09-07-2015 04:09 PM)parisse Wrote:  solve and zeros are different in TI mode in Xcas, but not on the Prime (except for delimiters). Both are exact commands and can also solve equations that factor and reduce to polynomials. proot is always approx and strictly for polynomials.
I can not reproduce the complex mode switch you describe with cZeros.

Thanks for the insight, I very much appreciate the rapid response! I guess I need to learn more about Xcas.

Questions:
- What are some examples of expressions that factor into polynomials, that aren't already polynomials themselves?
- From the standpoint of user interface design, doesn't it seem confusing to have multiple menu options that all actually do the same thing and return the same answer? Perhaps it is just my slightly OCD nature getting in my way here.

To reproduce the complex mode switch in cZeros I perform the following:
0. In CAS mode
1. Shift-CAS
2. On page 1, ensure "Use i" is un-checked
3. Escape
4. Toolbox / Solve / Complex Zeros ->cZeros() is placed on command line
5. type in cZeros(x^4-1=0)
6. Enter. Answer is returned as [-1 i 1 -i]
7. Shift-CAS. "Use i" is now checked

Confirmed the behavior with both the HP Prime and the Virtual Prime emulator.
Find all posts by this user
Quote this message in a reply
09-07-2015, 07:44 PM
Post: #6
RE: What's the difference in all the polynomial solve/root/zero functions?
(09-07-2015 06:11 PM)ewjax Wrote:  Confirmed the behavior with both the HP Prime and the Virtual Prime emulator.

I can also confirm this behaviour with the HP Prime ver 8151

Cheers, Terje
Find all posts by this user
Quote this message in a reply
09-07-2015, 09:28 PM
Post: #7
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.] !!
Find all posts by this user
Quote this message in a reply
09-08-2015, 06:11 AM
Post: #8
RE: What's the difference in all the polynomial solve/root/zero functions?
I still can not reproduce the cZeros problem, it has probably already be fixed. I confirm the bug for fsolve(x^3-3*x^2+4,x,-5..5), will be fixed.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: