HP Forums
Collect() does not work as should be - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Collect() does not work as should be (/thread-21692.html)



Collect() does not work as should be - amindanial - 05-03-2024 04:44 PM

When the following command is entered in the CAS view

collect(a*z^2+q*z+p*z^2+o+n*z+y,z)

I get:

a*z^2 +n*z+o+p+z^2+q*z+y

whereas that same command was entered in XCas, and the answer was

z*(z*(a+p)+n+q)+o+y

which is the correct one as per the manual of HP Prime.

My HP Prime model is:
SW version: 2.1.14730
Hardware Version: D
OS: V2.060.650


RE: Collect() does not work as should be - Albert Chan - 05-03-2024 06:45 PM

Hi, amindanial

Collect (factors) results depends on CAS setting.
If you have Simplify=Max, factors get "simplified" away.



We do have a bug, variable supplied not working (Simplify=Min)

> collect(x^2+3x+2)         → (x+1)*(x+2)
> collect(x^2+3x+2,x)      → x*(x+3)+2      ???


RE: Collect() does not work as should be - amindanial - 05-04-2024 03:21 AM

Thanks Albert for your clarification.
However, what is the bug you are talking about "We do have a bug, variable supplied not working"?


RE: Collect() does not work as should be - Albert Chan - 05-04-2024 03:37 AM

collect(x^2+3x+2) and collect(x^2+3x+2, x) should give the same answer (x+1)*(x+2)


RE: Collect() does not work as should be - amindanial - 05-04-2024 05:01 AM

"collect(x^2+3x+2) and collect(x^2+3x+2, x) should give the same answer (x+1)*(x+2)"
No, these two expressions don't give the same answer according to XCAS engine which is used by HP Prime as shown in the following screenshot.[attachment=13514]


RE: Collect() does not work as should be - Albert Chan - 05-04-2024 12:10 PM

XCas ans HP Prime use the same engine ... of course screenshot matched.
But is it right? How is collect(Poly, Var) supposed to work?

collect(Poly, Var) \(\;\overset{?}{=}\;\) poly2symb(symb2poly(Poly, Var), Var)

XCas help does not even show this optional Var form, only collect(Poly or LstPoly)
XCas manual did (optional α, not Var), but no example of what to expect.