It's always fun to implement numerical algorithms, especially when a closed form solution exists. You're missing some roots, though... The fundamental theorem of algebra shows that a polynomial of degree n has exactly n roots, although some (or all) of them can be complex. Your cubic solver finds only the real roots.
By the way, for finding the roots of polynomials of higher degree, there's an iterative solver on CPAN (Math::Polynomial::Solve). You'll need it if you go higher than degree 5.
In reply to Re: solve cubic equations
by vrk
in thread solve cubic equations
by no_slogan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |