(HP-41CX, Hewlett Packard 1983 and DM41X, SwissMicros 2020)

The POLY234 program calculates (!) the roots of 2nd, 3rd and 4th degree polynomials. Both real and complex roots can be calculated on the following basis:

Degree Polynomial expression Method of calcuation
2nd f(x) = x2 + a1x + a0 Quadratic formula
3rd f(x) = x3 + a2x2 + a1x + a0 Cardano’s formula
4th f(x) = x4 + a3x3 + a2x2 + a1x + a0 Ferrari’s formula

Another method of finding the roots of polynomials is through the Newton-Raphson method which is not part of this program. The reason being that finding roots by convergence is not deterministic and requires a different approach to programming.
Please note my default FIX 5 and European (flag 28) setting in below examples.

Examples: 2nd Degrees

Examples: 3rd Degrees

Examples: 4th Degrees

Program Listing
The listing of program POLY234 is given on the next page. The FIX 7 step in line 362 can sometimes lead to erroneous complex roots due to numerical limitations of the calculator’s mantissa. You may have to change it to FIX 6 when working with small and large coefficient values.

Registers, Labels and Flags

PDF format of program POLY234.
RAW/TXT format of program POLY234 (in zip file).

This program is copyright and is supplied without representation or warranty of any kind. The author assumes no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof

© 2006-2021 by Auke Hoekstra

Don`t copy text!