|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ProGAL.math.Polynomial
public class Polynomial
A representation of a variable sized polynomial. To find the roots of the
parabola f(x) = 2x^2 + 3x - 4, for instance, write
Polynomial parabola = new Polynomial(new double[]{2,3,4});
double[] roots = parabola.calcRoots();
or simply
double[] roots = Polynomial.calcRoots(2,3,4);
Currently this only works for polynomials of degree 2 and 3.
Field Summary | |
---|---|
double[] |
parameters
|
Method Summary | |
---|---|
double[] |
calcRoots()
Find the roots of the polynomial. |
static double[] |
calcRoots(double[] parameters)
Find the roots of the polynomial specified by the parameters. |
static double[] |
calcRoots(double a,
double b,
double c)
Find the roots of a second degree polynomial. |
static double[] |
calcRoots(double a,
double b,
double c,
double d)
Find the roots of a third degree polynomial. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final double[] parameters
Method Detail |
---|
public double[] calcRoots()
public static double[] calcRoots(double[] parameters)
parameters
- an array representing the coefficents of the polynomial
public static double[] calcRoots(double a, double b, double c)
a
- coefficient of the squared termb
- coefficient of the linear termc
- coefficient of the constant
public static double[] calcRoots(double a, double b, double c, double d)
a
- coefficient of the cubed termb
- coefficient of the squared termc
- coefficient of the linear termd
- coefficient of the constant term
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |