FILTLAN 1.0a
Functions

Polynomial Interpolation

Functions

Vector NewtonPolynomial (const Vector &x, const Vector &y)
 Build a polynomial P(z) by Newton's divided differences and return the coefficient vector a.
Real NewtonPolynomialEvaluation (const Vector &a, const Vector &x, const Real z0)
 Evaluate P(z0), i.e. the value of P(z) at z=z0, where P(z) is a Newton polynomial defined by a and x.

Function Documentation

Vector NewtonPolynomial ( const Vector &  x,
const Vector &  y 
)

Build a polynomial P(z) by Newton's divided differences and return the coefficient vector a.

A Newton polynomial is in the form P(z) = a(1) + a(2)*(z-x(1)) + a(3)*(z-x(1))*(z-x(2)) + ... + a(n)*(z-x(1))*...*(z-x(n-1)), such that P(x(i)) = y(i) for i=1,...,n.

Parameters:
xis the input vector of the domain values.
yis the input vector of the range values.
Returns:
The vector a of coefficients.

All vectors a, x, and y are of the same length n.

Remarks:
If x(i)==x(j) for some i $\neq$j, then it is assumed that the derivative of P(z) is to be zero at x(i) and the Hermite polynomial interpolation is applied.
In general, if there are k x(i)'s with the same value x0, then the jth order derivative of P(z) is zero at z=x0 for j=1,...,k-1.
Real NewtonPolynomialEvaluation ( const Vector &  a,
const Vector &  x,
const Real  z0 
)

Evaluate P(z0), i.e. the value of P(z) at z=z0, where P(z) is a Newton polynomial defined by a and x.

The newton polynomial is P(z) = a(1) + a(2)*(z-x(1)) + a(3)*(z-x(1))*(z-x(2)) + ... + a(n)*(z-x(1))*...*(z-x(n-1)).

Remarks:
This routine also works for evluating the function value of a Hermite interpolating polynomial, which is in the same form as a Newton polynomial.
Returns:
The evaluated P(z0), i.e. the value of P(z) at z=z0.
 All Classes Files Functions Variables Typedefs