JSci.maths.polynomials
Class RealLagrangeBasis

java.lang.Object
  extended byJSci.maths.polynomials.RealLagrangeBasis
All Implemented Interfaces:
PolynomialBasis
Direct Known Subclasses:
ChebychevBasis

public class RealLagrangeBasis
extends java.lang.Object
implements PolynomialBasis

The Lagrange Basis for real polynomials. For a given set of sampling points {x_1, ..., x_n}, the corresponding Lagrange polynomials are L_k = \kronecker_kj \forall j=1..n. The explicit form is L_k= \prod_{j=0, j\neq k}^n \frac{t-t_j}{t_k-t_j}


Field Summary
protected  int _dim
           
protected  double[] _samplingsX
           
 
Constructor Summary
protected RealLagrangeBasis()
           
  RealLagrangeBasis(double[] samplings)
          Creates a new RealLagrangeBasis object.
  RealLagrangeBasis(Field.Member[] samplings)
          Creates a new instance of LagrangeBasis for given sampling points
 
Method Summary
protected  void buildBasis()
           
 int dimension()
          The dimension ( # of sampling points)
 Polynomial getBasisVector(int k)
          The basis vector as described above
 Field.Member[] getSamplingPoints()
          The sampling points used in constructor
 RealPolynomial superposition(double[] c)
          Same as above, but type-safe.
 Polynomial superposition(Field.Member[] coeff)
          Make a superposition of basis-vectors for a given set of coefficients.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_samplingsX

protected double[] _samplingsX

_dim

protected int _dim
Constructor Detail

RealLagrangeBasis

public RealLagrangeBasis(Field.Member[] samplings)
Creates a new instance of LagrangeBasis for given sampling points


RealLagrangeBasis

public RealLagrangeBasis(double[] samplings)
Creates a new RealLagrangeBasis object.

Parameters:
samplings -

RealLagrangeBasis

protected RealLagrangeBasis()
Method Detail

getBasisVector

public Polynomial getBasisVector(int k)
The basis vector as described above

Specified by:
getBasisVector in interface PolynomialBasis
Parameters:
k -

dimension

public int dimension()
The dimension ( # of sampling points)

Specified by:
dimension in interface PolynomialBasis
Returns:
the dimension

getSamplingPoints

public Field.Member[] getSamplingPoints()
The sampling points used in constructor

Specified by:
getSamplingPoints in interface PolynomialBasis
Returns:
the sampling points

superposition

public Polynomial superposition(Field.Member[] coeff)
Make a superposition of basis-vectors for a given set of coefficients. Due to the properties of a lagrange base, the result is the interpolating polynomial with values coeff[k] at sampling point k

Specified by:
superposition in interface PolynomialBasis
Parameters:
coeff - in this case the values of the interpolation problem
Returns:
the interpolating polynomial

superposition

public RealPolynomial superposition(double[] c)
Same as above, but type-safe.


buildBasis

protected void buildBasis()