org.apache.commons.math.analysis.polynomials
Class PolynomialsUtils

java.lang.Object
  extended by org.apache.commons.math.analysis.polynomials.PolynomialsUtils

public class PolynomialsUtils
extends java.lang.Object

A collection of static methods that operate on or return polynomials.

Since:
2.0
Version:
$Revision: 760901 $ $Date: 2009-04-01 10:29:18 -0400 (Wed, 01 Apr 2009) $

Nested Class Summary
private static interface PolynomialsUtils.RecurrenceCoefficientsGenerator
          Interface for recurrence coefficients generation.
 
Field Summary
private static java.util.ArrayList<BigFraction> CHEBYSHEV_COEFFICIENTS
          Coefficients for Chebyshev polynomials.
private static java.util.ArrayList<BigFraction> HERMITE_COEFFICIENTS
          Coefficients for Hermite polynomials.
private static java.util.ArrayList<BigFraction> LAGUERRE_COEFFICIENTS
          Coefficients for Laguerre polynomials.
private static java.util.ArrayList<BigFraction> LEGENDRE_COEFFICIENTS
          Coefficients for Legendre polynomials.
 
Constructor Summary
private PolynomialsUtils()
          Private constructor, to prevent instantiation.
 
Method Summary
private static PolynomialFunction buildPolynomial(int degree, java.util.ArrayList<BigFraction> coefficients, PolynomialsUtils.RecurrenceCoefficientsGenerator generator)
          Get the coefficients array for a given degree.
private static void computeUpToDegree(int degree, int maxDegree, PolynomialsUtils.RecurrenceCoefficientsGenerator generator, java.util.ArrayList<BigFraction> coefficients)
          Compute polynomial coefficients up to a given degree.
static PolynomialFunction createChebyshevPolynomial(int degree)
          Create a Chebyshev polynomial of the first kind.
static PolynomialFunction createHermitePolynomial(int degree)
          Create a Hermite polynomial.
static PolynomialFunction createLaguerrePolynomial(int degree)
          Create a Laguerre polynomial.
static PolynomialFunction createLegendrePolynomial(int degree)
          Create a Legendre polynomial.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHEBYSHEV_COEFFICIENTS

private static final java.util.ArrayList<BigFraction> CHEBYSHEV_COEFFICIENTS
Coefficients for Chebyshev polynomials.


HERMITE_COEFFICIENTS

private static final java.util.ArrayList<BigFraction> HERMITE_COEFFICIENTS
Coefficients for Hermite polynomials.


LAGUERRE_COEFFICIENTS

private static final java.util.ArrayList<BigFraction> LAGUERRE_COEFFICIENTS
Coefficients for Laguerre polynomials.


LEGENDRE_COEFFICIENTS

private static final java.util.ArrayList<BigFraction> LEGENDRE_COEFFICIENTS
Coefficients for Legendre polynomials.

Constructor Detail

PolynomialsUtils

private PolynomialsUtils()
Private constructor, to prevent instantiation.

Method Detail

createChebyshevPolynomial

public static PolynomialFunction createChebyshevPolynomial(int degree)
Create a Chebyshev polynomial of the first kind.

Chebyshev polynomials of the first kind are orthogonal polynomials. They can be defined by the following recurrence relations:

  T0(X)   = 1
  T1(X)   = X
  Tk+1(X) = 2X Tk(X) - Tk-1(X)
 

Parameters:
degree - degree of the polynomial
Returns:
Chebyshev polynomial of specified degree

createHermitePolynomial

public static PolynomialFunction createHermitePolynomial(int degree)
Create a Hermite polynomial.

Hermite polynomials are orthogonal polynomials. They can be defined by the following recurrence relations:

  H0(X)   = 1
  H1(X)   = 2X
  Hk+1(X) = 2X Hk(X) - 2k Hk-1(X)
 

Parameters:
degree - degree of the polynomial
Returns:
Hermite polynomial of specified degree

createLaguerrePolynomial

public static PolynomialFunction createLaguerrePolynomial(int degree)
Create a Laguerre polynomial.

Laguerre polynomials are orthogonal polynomials. They can be defined by the following recurrence relations:

        L0(X)   = 1
        L1(X)   = 1 - X
  (k+1) Lk+1(X) = (2k + 1 - X) Lk(X) - k Lk-1(X)
 

Parameters:
degree - degree of the polynomial
Returns:
Laguerre polynomial of specified degree

createLegendrePolynomial

public static PolynomialFunction createLegendrePolynomial(int degree)
Create a Legendre polynomial.

Legendre polynomials are orthogonal polynomials. They can be defined by the following recurrence relations:

        P0(X)   = 1
        P1(X)   = X
  (k+1) Pk+1(X) = (2k+1) X Pk(X) - k Pk-1(X)
 

Parameters:
degree - degree of the polynomial
Returns:
Legendre polynomial of specified degree

buildPolynomial

private static PolynomialFunction buildPolynomial(int degree,
                                                  java.util.ArrayList<BigFraction> coefficients,
                                                  PolynomialsUtils.RecurrenceCoefficientsGenerator generator)
Get the coefficients array for a given degree.

Parameters:
degree - degree of the polynomial
coefficients - list where the computed coefficients are stored
generator - recurrence coefficients generator
Returns:
coefficients array

computeUpToDegree

private static void computeUpToDegree(int degree,
                                      int maxDegree,
                                      PolynomialsUtils.RecurrenceCoefficientsGenerator generator,
                                      java.util.ArrayList<BigFraction> coefficients)
Compute polynomial coefficients up to a given degree.

Parameters:
degree - maximal degree
maxDegree - current maximal degree
generator - recurrence coefficients generator
coefficients - list where the computed coefficients should be appended


Copyright (c) 2003-2009 Apache Software Foundation