vec_math
Class RecursivePolynom

java.lang.Object
  extended by vec_math.RecursivePolynom
All Implemented Interfaces:
Function
Direct Known Subclasses:
Chebyshev, Legendre

public abstract class RecursivePolynom
extends Object
implements Function

A recursive polynom, like Chebyshev or Legendre, are defined by a minimum and maximum of the parameter space plus the coefficients.


Nested Class Summary
static class RecursivePolynom.Constant
          The zero-order recursive polynom is a constant.
static class RecursivePolynom.Linear
          The first-order recursive polynom is linear.
 
Field Summary
private  double[] coef
          The coefficients, order is defined by length of array.
private  double pmax
          The maximum parameter value.
private  double pmin
          The minimum parameter.
 
Constructor Summary
protected RecursivePolynom(double[] c, double min, double max)
          Constructs a new recursive polynom.
 
Method Summary
 double evaluate(double p)
          On evaluation, we first calculate the normalized parameter, then start the recusion with 1 and n until the order is reached.
protected  double getCoefficient(int o)
          Returns the coefficient of order i1.
 int getOrder()
          Returns the order of the polynom.
protected  double normalize(double p)
           
protected abstract  double recursion(int o, double normalized, double xminus1, double xminus2)
          The recursion formular to get to the polynomial value of the specified order, using the two last polynoms.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pmin

private double pmin
The minimum parameter.


pmax

private double pmax
The maximum parameter value.


coef

private double[] coef
The coefficients, order is defined by length of array.

Constructor Detail

RecursivePolynom

protected RecursivePolynom(double[] c,
                           double min,
                           double max)
Constructs a new recursive polynom. Need at least an order of two.

Method Detail

evaluate

public double evaluate(double p)
On evaluation, we first calculate the normalized parameter, then start the recusion with 1 and n until the order is reached.

Specified by:
evaluate in interface Function

normalize

protected double normalize(double p)

getOrder

public int getOrder()
Returns the order of the polynom.


getCoefficient

protected double getCoefficient(int o)
Returns the coefficient of order i1.


recursion

protected abstract double recursion(int o,
                                    double normalized,
                                    double xminus1,
                                    double xminus2)
The recursion formular to get to the polynomial value of the specified order, using the two last polynoms. This recursion order suffices for Chebyshev and Legendre.


toString

public String toString()
Overrides:
toString in class Object