Find real roots of cubic and quadratic polynomials
solvcui a b c d
solvcui e f g
solvqui a b c
Description
solvcui finds the real roots of a cubic polynomial of the form
ax³ + bx² + cx + d = 0 (first syntax)
or
x³ + ex² + fx + g = 0 (second syntax)
solvqui finds the real roots of a quadratic polynomial of the form
ax² + bx + c = 0
Both commands use formulae designed to minimize roundoff error. No output is displayed to the screen, but the roots are returned as scalars in ascending order in r(x1), r(x2) and (for solvcui) r(x3); see help return. Complex roots return missing. The commands are immediate, all their arguments are numbers; see help immed.
Examples
. solvcui 2 -7 7 -2
. solvcui -6 11 -6
. solvqui 1 -9 20
Maintainer
David A. Harrison Intensive Care National Audit & Research Centre david@icnarc.org
Also see
Online: help for return, immed