org.jscience.mathematics.analysis.polynomials
Class PolynomialMathUtils

java.lang.Object
  extended by org.jscience.mathematics.analysis.polynomials.PolynomialMathUtils

public final class PolynomialMathUtils
extends java.lang.Object

DOCUMENT ME!


Method Summary
static Complex evalPolynomial(ComplexPolynomial p, Complex t)
          Evaluates a polynomial by Horner's scheme.
static double evalPolynomial(DoublePolynomial p, double t)
          Evaluates a polynomial by Horner's scheme.
static ExactComplex evalPolynomial(ExactComplexPolynomial p, ExactComplex t)
          Evaluates a polynomial by Horner's scheme.
static ExactReal evalPolynomial(ExactRealPolynomial p, ExactReal t)
          Evaluates a polynomial by Horner's scheme.
static ComplexPolynomial interpolateLagrange(Complex[][] samplingPoints)
          Interpolates a polynomial.
static DoublePolynomial interpolateLagrange(double[][] samplingPoints)
          Interpolates a polynomial.
static int maxDegree(Polynomial p1, Polynomial p2)
          Get the maximum degree of two polynomials
static int minDegree(Polynomial p1, Polynomial p2)
          Get the minimal degree of two polynomials
static ComplexPolynomial normalize(ComplexPolynomial p)
          Normalizes a given complex polynomial, i.e. divide by the leading coefficient.
static DoublePolynomial normalize(DoublePolynomial p)
          Normalizes a given real polynomial, i.e. divide by the leading coefficient.
static ExactComplexPolynomial normalize(ExactComplexPolynomial p)
          Normalize a given complex polynomial, i.e. divide by the leading coefficient.
static ExactRealPolynomial normalize(ExactRealPolynomial p)
          Normalizes a given real polynomial, i.e. divide by the leading coefficient.
static AbstractComplexSquareMatrix toCompanionMatrix(ComplexPolynomial p)
           
static AbstractDoubleSquareMatrix toCompanionMatrix(DoublePolynomial p)
          Returns the companion matrix of a given polynomial.
static RingMatrix toCompanionMatrix(ExactComplexPolynomial p)
           
static RingMatrix toCompanionMatrix(ExactRealPolynomial p)
          Returns the companion matrix of a given polynomial.
static ComplexPolynomial toComplex(Polynomial p)
          Try to cast a Polynomial to a complex polynomial
static ExactComplexPolynomial toExactComplexPolynomial(Polynomial p)
          Try to cast a Polynomial to a complex polynomial
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toCompanionMatrix

public static AbstractDoubleSquareMatrix toCompanionMatrix(DoublePolynomial p)
Returns the companion matrix of a given polynomial. The eigenvalues of the companion matrix are the roots of the polynomial.

Parameters:
p - the polynomial
Returns:
the companion matrix

toCompanionMatrix

public static RingMatrix toCompanionMatrix(ExactRealPolynomial p)
Returns the companion matrix of a given polynomial. The eigenvalues of the companion matrix are the roots of the polynomial.

Parameters:
p - the polynomial
Returns:
the companion matrix

toCompanionMatrix

public static AbstractComplexSquareMatrix toCompanionMatrix(ComplexPolynomial p)

toCompanionMatrix

public static RingMatrix toCompanionMatrix(ExactComplexPolynomial p)

maxDegree

public static int maxDegree(Polynomial p1,
                            Polynomial p2)
Get the maximum degree of two polynomials

Parameters:
p1 -
p2 -

minDegree

public static int minDegree(Polynomial p1,
                            Polynomial p2)
Get the minimal degree of two polynomials

Parameters:
p1 -
p2 -

evalPolynomial

public static double evalPolynomial(DoublePolynomial p,
                                    double t)
Evaluates a polynomial by Horner's scheme.

Parameters:
p -
t -

evalPolynomial

public static ExactReal evalPolynomial(ExactRealPolynomial p,
                                       ExactReal t)
Evaluates a polynomial by Horner's scheme.

Parameters:
p -
t -

evalPolynomial

public static Complex evalPolynomial(ComplexPolynomial p,
                                     Complex t)
Evaluates a polynomial by Horner's scheme.

Parameters:
p -
t -

evalPolynomial

public static ExactComplex evalPolynomial(ExactComplexPolynomial p,
                                          ExactComplex t)
Evaluates a polynomial by Horner's scheme.

Parameters:
p -
t -

interpolateLagrange

public static DoublePolynomial interpolateLagrange(double[][] samplingPoints)
Interpolates a polynomial. Caveat: this method is brute-force, slow and not very stable. It shouldn't be used for more than approx. 10 points. Remember the strong variations of higher degree polynomials.

Parameters:
samplingPoints - an array[2][n] where array[0] denotes x-values, array[1] y-values

interpolateLagrange

public static ComplexPolynomial interpolateLagrange(Complex[][] samplingPoints)
Interpolates a polynomial. Caveat: this method is brute-force, slow and not very stable. It shouldn't be used for more than approx. 10 points. Remember the strong variations of higher degree polynomials.

Parameters:
samplingPoints - an array[2][n] where array[0] denotes x-values, array[1] y-values

normalize

public static DoublePolynomial normalize(DoublePolynomial p)
Normalizes a given real polynomial, i.e. divide by the leading coefficient.

Parameters:
p -

normalize

public static ExactRealPolynomial normalize(ExactRealPolynomial p)
Normalizes a given real polynomial, i.e. divide by the leading coefficient.

Parameters:
p -

normalize

public static ComplexPolynomial normalize(ComplexPolynomial p)
Normalizes a given complex polynomial, i.e. divide by the leading coefficient.

Parameters:
p -

normalize

public static ExactComplexPolynomial normalize(ExactComplexPolynomial p)
Normalize a given complex polynomial, i.e. divide by the leading coefficient.

Parameters:
p -
Returns:
DOCUMENT ME!

toComplex

public static ComplexPolynomial toComplex(Polynomial p)
Try to cast a Polynomial to a complex polynomial


toExactComplexPolynomial

public static ExactComplexPolynomial toExactComplexPolynomial(Polynomial p)
Try to cast a Polynomial to a complex polynomial

Parameters:
p - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
java.lang.IllegalArgumentException - DOCUMENT ME!