You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now it returns awful responses for 3+ degree polynomials where WA sometimes can return a neat set. We should somehow check if some constants could be those roots (say, check a few integer, a few rational, a few variables, etc.)
The cause is narrow: the solver read a polynomial equation only by its degree — gather monomials, apply Cardano at three, Ferrari at four, nothing above four. It never looked for a factorization, and expanded away one handed to it. So an equation whose factors are written on its face went through the general formula anyway:
Your suggestion here — "check if some constants could be those roots" — is what the fix does, in the form of dividing out the rational roots and letting the existing formulas answer what is left.
One thing the report understates. Sweeping 572 polynomials with known roots turned up ten that were not merely ugly but incomplete:
x^5 - 2x^3 - x^2 + 2 = 0 = (x - 1)(x^2 - 2)(x^2 + x + 1)
was { 1, sqrt(2), -sqrt(2) } <- the pair (-1 ± i*sqrt(3))/2 missing
now all five
Above degree four the whole equation went to the numeric solver, which searches the real axis, so a complex conjugate pair could go missing with nothing to indicate it. After the fix none of the 572 is short of a root, and none gains a value that is not one.
Also faster, since a formula is no longer evaluated and then simplified away: 160 ms → 9 ms on the cubic above, 160 ms → 1 ms on x^3 - 6x^2 + 11x - 6 = 0.
Two-term polynomials a*x^n + b are deliberately left to the existing inversion of x^n = -b/a, which gives nicer roots than splitting would (x^3 - 8 as (-1/2 ± i*sqrt(3)/2)*2 rather than (-2 ∓ sqrt(-12))/2). The remaining rough edge there — x^6 - 1 answering a root as 1/2 + i*sin(5/3*pi) — is filed as #743.
Activity
MomoDeve commentedon Nov 1, 2020
what about Rational root theorem? For many simple cases we can go through all factors of the free term of polynomial to find exact roots
Pin the roots the split turns out to recover
Rafael-SOWNet commentedon Aug 5, 2026
Investigated and fixed in #742.
The cause is narrow: the solver read a polynomial equation only by its degree — gather monomials, apply Cardano at three, Ferrari at four, nothing above four. It never looked for a factorization, and expanded away one handed to it. So an equation whose factors are written on its face went through the general formula anyway:
Your suggestion here — "check if some constants could be those roots" — is what the fix does, in the form of dividing out the rational roots and letting the existing formulas answer what is left.
One thing the report understates. Sweeping 572 polynomials with known roots turned up ten that were not merely ugly but incomplete:
Above degree four the whole equation went to the numeric solver, which searches the real axis, so a complex conjugate pair could go missing with nothing to indicate it. After the fix none of the 572 is short of a root, and none gains a value that is not one.
Also faster, since a formula is no longer evaluated and then simplified away: 160 ms → 9 ms on the cubic above, 160 ms → 1 ms on
x^3 - 6x^2 + 11x - 6 = 0.Two-term polynomials
a*x^n + bare deliberately left to the existing inversion ofx^n = -b/a, which gives nicer roots than splitting would (x^3 - 8as(-1/2 ± i*sqrt(3)/2)*2rather than(-2 ∓ sqrt(-12))/2). The remaining rough edge there —x^6 - 1answering a root as1/2 + i*sin(5/3*pi)— is filed as #743.Solve a polynomial through its factors rather than by its degree (#272)…
Only invert an equation whose variable occurs once (#744) (#745)
Pin three accepted proposals that are already implemented (#246, #214, …