maspack.util
Class CubicSolver

java.lang.Object
  extended by maspack.util.CubicSolver

public class CubicSolver
extends java.lang.Object

Finds the roots of a cubic equation on a specified interval. Adopted from utility code provided by Robert Bridson's graphics group. Also, a good guide to the structure of cubics and their solution is the paper "A new approach to solving the cubic: Cardan's solution revealed", by RWD Nickalls.


Field Summary
static double PREC
           
static double RTOL
           
 
Constructor Summary
CubicSolver()
           
 
Method Summary
static double cuberoot(double x)
           
static int getRoots(double[] roots, double a, double b, double c, double d)
           
static int getRoots(double[] roots, double a, double b, double c, double d, double x0, double x1)
           
static int getRootsAlgebraic(double[] roots, double a, double b, double c, double d)
           
static int getRootsAlgebraic(double[] roots, double a, double b, double c, double d, double x0, double x1)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RTOL

public static double RTOL

PREC

public static double PREC
Constructor Detail

CubicSolver

public CubicSolver()
Method Detail

getRoots

public static int getRoots(double[] roots,
                           double a,
                           double b,
                           double c,
                           double d)

getRoots

public static int getRoots(double[] roots,
                           double a,
                           double b,
                           double c,
                           double d,
                           double x0,
                           double x1)

cuberoot

public static double cuberoot(double x)

getRootsAlgebraic

public static int getRootsAlgebraic(double[] roots,
                                    double a,
                                    double b,
                                    double c,
                                    double d)

getRootsAlgebraic

public static int getRootsAlgebraic(double[] roots,
                                    double a,
                                    double b,
                                    double c,
                                    double d,
                                    double x0,
                                    double x1)