

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: INNER  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +numericalMethods.calculus.functionApproximation.ChebyshevApproximation
A class that provides static methods related to the approximation of functions with Chebyshev polynomials.
The Chebyshev polynomial of degree n
is defined by
T_{n}(cos t) = cos(nt)
.
The Chebyshev polynomials satisfy the recursion formulas
T_{0}(x)

=

1

T_{1}(x)

=

x

T_{n+2}(x)

=

2x T_{n+1}(x)  T_{n}(x)

They are orthogonal over the interval [1,1]
with weight
function (1  x^{2})^{1/2}
. More precisely,
0 ,

if m≠n


∫_{1}^{1}
(1  x^{2})^{1/2}
T_{n}(x) T_{m}(x) dx =

π/2 ,

if m=n≠0 .

&pi ,

if m=n=0

The Chebyshev polynomials also satisfy a discrete orthogonality
relation. If x_{j} = cos(π(2j1)/2n)
,
j=1,… n
, are the n
zeroes of
T_{n}(x)
, then
0, 
if m≠k
 
&sum_{j=1}^{n}
T_{m}(x_{j})
T_{k}(x_{j}) =

π/2 ,

if m=k≠0 .

π ,

if m=k=0

Suppose f(x)
is a continuous function on the interval
[0,1]
. Let the n
coefficients c_{j}
, j=0,… n1
be
defined by
c_{j} = (2/n) ∑_{k=1}^{n}
f(x_{k}) T_{j}(x_{k})
.
Then
f(x) ≈ c_{0}/2
+ ∑_{j=1}^{n1} c_{j} T_{j}(x).
This approximation is exact for the zeros x_{j}
of T_{n}.
 See Also:
 "Numerical Recipes in C, chapters 5.8–5.9"
Method Summary
static void
divideByX(double[] c)
Called with coefficients c[j]
of a Chebyshev series which
sums to a function f(x)
with f(0) = 0
,
returns with c
holding the coefficients of the Chebyshev
expansion of f(x)/x
.
static double
evaluate(double[] c,
double x)
Evaluates the Chebyshev series with coefficients
c_{j}
.
static void
fit(double[] c,
numericalMethods.function.DoubleParametrized p,
numericalMethods.function.DoubleValued v)
Calculates the coefficients c_{j}
, with n =
c.length
, for the function implemented by p
and
v
.
static void
integrate(double[] c,
double[] cInt)
Simply calls integate(c, cInt, factor)
with double factor = 1.0
.
static void
integrate(double[] c,
double[] cInt,
double factor)
Given the coefficients c[j]
of a Chebyshev series
approximating some function f(x)
, calculates the
coefficients cInt[j]
of a Chebyshev series approximating
factor × ∫ f(x)dx
.
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail
fit
public static void fit(double[] c,
numericalMethods.function.DoubleParametrized p,
numericalMethods.function.DoubleValued v)
 Calculates the coefficients
c_{j}
, with n =
c.length
, for the function implemented by p
and
v
. The arguments p
and v
may
(and usually will) be the same object.
 Parameters:
c
 a double
array. When the method returns, it
holds the coefficients c_{j}
, where n = c.length
.p
 an object implementing the interface
DoubleParametrized
.
Only the method
setDoubleParameter(double x)
is called with 1 ≤ x ≤ 1
.v
 an object implementing the interface DoubleValued
.
Only the method getDoubleValue()
is called.
evaluate
public static double evaluate(double[] c,
double x)
throws java.lang.IllegalArgumentException
 Evaluates the Chebyshev series with coefficients
c_{j}
. The x
value at which
the series is to be evaluated has to be in the range 1
≤ x ≤ 1
. Otherwise, an
IllegalArgumentException
is thrown. Note that the coefficient of T_{0}
is c_{0}/2
. This makes this method compatible
with the method fit
.
The recursion formula for the Chebyshev
polynomials is utilized to calculate the series without having to
calculate each Chebyshev polynomial individually.
 Parameters:
c
 a double
array holding the coefficents
c_{j}
.x
 a double
. The x
value at which the
series is to be evaluated. Must be in the range 1 ≤
x ≤ 1
. Returns:
 the sum of the
Chebyshev series.
 Throws:
java.lang.IllegalArgumentException
 if x
is not in the
range 1 ≤ x ≤ 1
.
integrate
public static void integrate(double[] c,
double[] cInt)
 Simply calls
integate(c, cInt, factor)
with double factor = 1.0
.
integrate
public static void integrate(double[] c,
double[] cInt,
double factor)
throws java.lang.IllegalArgumentException
 Given the coefficients
c[j]
of a Chebyshev series
approximating some function f(x)
, calculates the
coefficients cInt[j]
of a Chebyshev series approximating
factor × ∫ f(x)dx
. The
constant of integration is chosen so that the value at x =
0
is 0
.
The arrays c
and cInt
must have the same
length, which must be at least 2
.
 Parameters:
c
 a double
array of length at least 2. Holds the
coefficients of a Chebyshev series approximating some function
f(x)
.cInt
 a double
array of the same length as
c
. After the method returns, it holds the
coeffiecents of a Chebyshev series approximating
factor × * ∫ f(x)dx
.factor
 a double
with which the integral is
multiplied. Useful in the case of a change of variable. Throws:
java.lang.IllegalArgumentException
 if
c.length ≠ cInt.length
.
divideByX
public static void divideByX(double[] c)
 Called with coefficients
c[j]
of a Chebyshev series which
sums to a function f(x)
with f(0) = 0
,
returns with c
holding the coefficients of the Chebyshev
expansion of f(x)/x
. Hence, when it returns, c[n1]
= 0.0
, where n = c.length
.
 Parameters:
c
 a double
array of length at least 1, holding the
coefficients of a Chebyshev series which sums to a function
f(x)
with f(0) = 0
. When the method
returns, c
holds the coefficients of the
Chebyshev expansion of f(x)/x.
Overview
Package
Class
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: INNER  FIELD  CONSTR  METHOD
DETAIL: FIELD  CONSTR  METHOD