Subroutines for solving cubic, quartic and quintic equations

Here you can download subroutines for solving cubic, quartic or quintic equations:

cubic:      a x3 + b x2 + c x + d = 0
quartic:      a x4 + b x3 + c x2 + d x + e = 0
quintic:      a x5 + b x4 + c x3 + d x2 + e x + f  = 0

The program quartic.f (quartic.c) contains the subroutine cubic and quartic and a main program for testing these subroutines. The solutions of quartic.f including the complex solutions can be checked with the program quartchk.f.

Quintic equations can be solved with a hybrid algorithm: 1.) the first root which is always real, is obtained by the numerical Newton-method; 2.) the remaining four roots a calculated analytically by quartic. FORTRAN code: quintic.f (quintic.c); quintchk.f


Applications:

| T. Kraska | computational site | 1st Workshop on Global Phase Diagrams | Related sites |