rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

ratsimp/algebraic doesn't simplify expand(p^2)/p where p=x+sqrt(2) #313

Open rtoy opened 5 months ago

rtoy commented 5 months ago

Imported from SourceForge on 2024-07-02 16:26:33 Created by macrakis on 2022-12-04 17:41:16 Original: https://sourceforge.net/p/maxima/bugs/4055


p: x+sqrt(2)$
p2: expand(p^2)$
p2p: p2/p$
ratsimp(p2p),algebraic => unchanged  << disappointing
gcd(p2,p),algebraic => 1             << disappointing
factor(p2p),algebraic => unchanged   << disappointing
divide(p2,p) => [p,0]  << even with algebraic:false  << GOOD!!
gfactor(p2p) => p      << pleasant undocumented surprise!

Sometimes divide works but gfactor doesn't:

qa:x+sqrt(2)$
qb:x-sqrt(2)$
qab: expand(qa*qb)$
ratsimp(qab/qa),algebraic => unchanged
gcd(qab,qa),algebraic => 1
factor(qab/qa),algebraic  => unchanged
divide(qab,qa) => [qb,0]       << Good
gfactor(qab/qa) => unchanged   << ??? Why did it work for the other example?

Since divide works, I'd have expected that gcd/algebraic and ratsimp/algebraic would also work.

Maxima 5.45.1 SBCL 2.0.0 Windows 10

rtoy commented 5 months ago

Imported from SourceForge on 2024-07-02 16:26:34 Created by macrakis on 2022-12-05 15:20:03 Original: https://sourceforge.net/p/maxima/bugs/4055/#5858


With gcd:subres or gcd:red, these examples work fine.