JSci.maths.polynomials
Class PolynomialMath

java.lang.Object
  extended by JSci.maths.polynomials.PolynomialMath

public class PolynomialMath
extends java.lang.Object

Author:
b.dietrich

Constructor Summary
PolynomialMath()
           
 
Method Summary
static Complex evalPolynomial(Complex[] coeff, Complex t)
          Same as above for complex numbers
static double evalPolynomial(double[] coeff, double t)
          Eval a polynomial by Horner's schema
static ComplexSquareMatrix getFrobeniusMatrix(Polynomial p)
          Get the (complex) frobenius matrix for a given polynomial.
static Complex[] getNullPoints(Polynomial p)
          Calculate the null points of a given polynomial by solving the eigenvalue problem for the frobenius matrix This is not yet implemented (depends on a QR- decomposition)
static Complex[] interpolateLagrange(Complex[][] samplingPoints)
          Get the coefficients of the interpolation polynomial Caveat: this method is brute-force, slow and not very stable.
static Complex interpolateLagrange(Complex[][] samplingPoints, Complex t)
          Interpolate a value by given sampling points.
static double[] interpolateLagrange(double[][] samplingPoints)
          Get the coefficients of the interpolation polynomial Caveat: this method is brute-force, slow and not very stable.
static double interpolateLagrange(double[][] samplingPoints, double t)
          Interpolate a value by given sampling points.
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)
          Normalize a given complex polynomial, i.e.
static ComplexPolynomial toComplex(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
 

Constructor Detail

PolynomialMath

public PolynomialMath()
Method Detail

getFrobeniusMatrix

public static ComplexSquareMatrix getFrobeniusMatrix(Polynomial p)
Get the (complex) frobenius matrix for a given polynomial. The eigenvalues of this frobenius matrix are the null values of the polynomial

Parameters:
p - the polynomial
Returns:
the Frobenius matrix

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 -

getNullPoints

public static Complex[] getNullPoints(Polynomial p)
Calculate the null points of a given polynomial by solving the eigenvalue problem for the frobenius matrix This is not yet implemented (depends on a QR- decomposition)

Parameters:
p - the polynomial
Returns:
(unordered) list of null points.

evalPolynomial

public static double evalPolynomial(double[] coeff,
                                    double t)
Eval a polynomial by Horner's schema

Parameters:
coeff -
t -

evalPolynomial

public static Complex evalPolynomial(Complex[] coeff,
                                     Complex t)
Same as above for complex numbers

Parameters:
coeff -
t -

interpolateLagrange

public static double[] interpolateLagrange(double[][] samplingPoints)
Get the coefficients of the interpolation polynomial Caveat: this method is brute-force, slow and not very stable. It shouldn't be used for more than appr. 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 double interpolateLagrange(double[][] samplingPoints,
                                         double t)
Interpolate a value by given sampling points. Caveat: this method is brute-force, slow and not very stable. It shouldn't be used for more than appr. 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 Complex[] interpolateLagrange(Complex[][] samplingPoints)
Get the coefficients of the interpolation polynomial Caveat: this method is brute-force, slow and not very stable. It shouldn't be used for more than appr. 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 Complex interpolateLagrange(Complex[][] samplingPoints,
                                          Complex t)
Interpolate a value by given sampling points. Caveat: this method is brute-force, slow and not very stable. It shouldn't be used for more than appr. 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 ComplexPolynomial normalize(ComplexPolynomial p)
Normalize a given complex polynomial, i.e. divide by the leading coefficient.

Parameters:
p -

toComplex

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