public final class PolynomialRoot
extends java.lang.Object
Stand-alone utility functions.
TODO: Need a unit test for this class.
Constructor and Description |
---|
PolynomialRoot() |
Modifier and Type | Method and Description |
---|---|
static double |
findMinimumPositiveRoot2(double qea,
double qeb,
double qec)
Find the smallest positive real root of a second-order (quadratic) equation.
|
static double |
findMinimumPositiveRoot3(double cea,
double ceb,
double cec,
double ced,
double absTol,
double relTol)
Find the smallest positive real root of a third-order (cubic) equation.
|
public static final double findMinimumPositiveRoot2(double qea, double qeb, double qec)
Equation is a*x^2 + b*x + c = 0.
qea
- Coefficient `a`.qeb
- Coefficient `b`.qec
- Coefficient `c`.public static final double findMinimumPositiveRoot3(double cea, double ceb, double cec, double ced, double absTol, double relTol)
Equation is a*x^3 + b*x^2 + c*x + d = 0.
TODO: Switch from bracketing solution, to one based on algebraic solution to cubic equation. Expect to have to tune up the roots it gives, using NR, just to account for numerical issues. But still may be more direct, maybe faster.
cea
- Coefficient `a`.ceb
- Coefficient `b`.cec
- Coefficient `c`.ced
- Coefficient `d`.absTol
- The size of residual at which end search.relTol
- The fractional difference in bracket on x, at which end search.