|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectnumericalMethods.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
Tn(cos t) = cos(nt).
The Chebyshev polynomials satisfy the recursion formulas
T0(x)
|
=
|
1
|
T1(x)
|
=
|
x
|
Tn+2(x)
|
=
|
2x Tn+1(x) - Tn(x)
|
They are orthogonal over the interval [-1,1] with weight
function (1 - x2)-1/2. More precisely,
0,
|
if m≠n
|
|
∫-11
(1 - x2)-1/2
Tn(x) Tm(x) dx =
|
π/2,
|
if m=n≠0 .
|
&pi,
|
if m=n=0
|
The Chebyshev polynomials also satisfy a discrete orthogonality
relation. If xj = cos(π(2j-1)/2n),
j=1,… n, are the n zeroes of
Tn(x), then
| 0, |
if m≠k
| |
&sumj=1n
Tm(xj)
Tk(xj) =
|
π/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 cj, j=0,… n-1 be
defined by
cj = (2/n) ∑k=1n
f(xk) Tj(xk)
.
Then
f(x) ≈ c0/2
+ ∑j=1n-1 cj Tj(x).
This approximation is exact for the zeros xj
of Tn.
| 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 cj. |
static void |
fit(double[] c,
DoubleParametrized p,
DoubleValued v)
Calculates the coefficients cj, 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 |
public static void fit(double[] c,
DoubleParametrized p,
DoubleValued v)
cj, 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.
c - a double array. When the method returns, it
holds the coefficients cj, 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.
public static double evaluate(double[] c,
double x)
throws java.lang.IllegalArgumentException
cj. The x-value at which
the series is to be evaluated has to be in the range -1
≤ x ≤ 1IllegalArgumentException
is thrown. Note that the coefficient of T0
is c0/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.
c - a double array holding the coefficents
cj.x - a double. The x-value at which the
series is to be evaluated. Must be in the range -1 ≤
x ≤ 1.
java.lang.IllegalArgumentException - if x is not in the
range -1 ≤ x ≤ 1.
public static void integrate(double[] c,
double[] cInt)
integate(c, cInt, factor) with double factor = 1.0.
public static void integrate(double[] c,
double[] cInt,
double factor)
throws java.lang.IllegalArgumentException
c[j] of a Chebyshev series
approximating some function f(x), calculates the
coefficients cInt[j] of a Chebyshev series approximating
factor × ∫ f(x)dxx =
0 is 0.
The arrays c and cInt must have the same
length, which must be at least 2.
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)dxfactor - a double with which the integral is
multiplied. Useful in the case of a change of variable.
java.lang.IllegalArgumentException - if
c.length ≠ cInt.length.public static void divideByX(double[] c)
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[n-1]
= 0.0, where n = c.length.
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||