Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: functionalserver.butterworth - Function Up: functionalserver - Tool Previous: functionalserver.evenpoly - Function


functionalserver.chebyshev - Function



Package utility
Module functionals
Tool functionalserver


Create a 1D Chebyshev polynomial function


Synopsis
chebyshev(order, params, xmin, xmax, ooimode, def)


Arguments

order in order of the polynomial
    Allowed: integer
    Default: 0
params in the Chebyshev coefficients
    Allowed: numeric
    Default: all 0
xmin in the minimum value of the interval of interest
    Allowed: numeric
    Default: -1
xmax in the maximum value of the interval of interest
    Allowed: numeric
    Default: -1
ooimode in the ``out-of-interval'' mode. This controls what gets returned when an input value to the function is outside the interval of interest.
    Allowed: 'constant'
    Default: a minimum match to the following values: 'constant' - the value of the def argument; 'zeroth' - the value of the zero-th order coefficient; 'extrapolate' - the function evaluated explicitly at the input value; 'cyclic' - the function evaluated at the input value after ``folding'' it into the interval of interest; 'edge' - the function evaluated at the nearest edge of the interval of interest
def in the default value to return for input values outside of the interval of interest when ooimode='constant'
    Allowed: numeric
    Default: 0


Returns
Functional


Description

This function creates a functional representing a Chebyshev series, a linear combination of so-called Chebyshev polynomials.


About Chebyshev Polynomials


Chebyshev polynomials are a special type of ultraspheric polynomials that are useful in such contexts as numerical analysis and circuit design. They form an orthogobnal set. A (type I) Chebyshev polynomial, Tn, is generated via the equation:

Tn(x) = cosn(arccos x) (1.1)

Through clever use of trigometric identities, one can express Tn as a real polynomial expression of the form

Tn(x) = $\displaystyle \sum_{i=0}^{n}$Citi (1.2)

The low order polynomials look like this:
T0 = 1 (1.3)
T1 = x (1.4)
T2 = 2x2 - 1 (1.5)
T3 = 4x3 - 3x (1.6)
T4 = 8x4 - 8x2 + 1 (1.7)
T5 = 16x5 - 20x3 + 5x (1.8)

Higher order polynomials satisfy the recurrance relation,

Tn + 1 = 2xTn - Tn - 1. (1.9)

A common use of Chebyshev polynomials is in approximating functions. In particular, any function that is approximated by a power series,

f (x) $\displaystyle \sim$ $\displaystyle \sum$Pixi, (1.10)

over the interval [-1, 1] can be approximated by a linear combination of Chebyshev polynomials:

f (x) $\displaystyle \sim$ $\displaystyle \sum$CiTi(x), (1.11)

where Ci is the set of so-called Chebyshev coefficients.

Approximating a function with Chebyshev polynomials has some important advantages. For one, if the function is well approximated by a converging power series, one can obtain an equally accurate estimate using fewer terms of the corresponding Chebyshev series. More important, though, is the property over the interval [-1, 1], each polynomial has a domain of [-1, 1]; thus, the series is nicely bounded. And because of this bounded property, approximations calculated from a Chebyshev series are less susceptible to machine rounding errors than the equivalent power series.


The ``Interval of Interest''


Of course, in most real applications of these polynomials, one doesn't want to be limited to the [-1, 1] interval; thus, it is necessary to map the actual interval of interest into [-1, 1] before evaluating the series. The chebyshev functional supports this automatically when one sets the xmin and xmax arguments to this function. The mapping of values within this interval into [-1, 1] is done as follows:

x$\scriptstyle \prime$ = x - (min + max)/2)/((max - min)/2) (1.12)

When the functional is evaluated via f(), the input values are first tranformed in the above way, and then the series is evaluated using the given coefficients. This is assuming the input value is within the interval of interest.

The behavior of the function when the value is outside the interval of interest is configurable via the ooimode. The choices are as follows:

constant
the value returned is the value set with the def argument.
zeroth
the value returned is the value of the zero-th order coefficient. Thus, if params=[3,1,1], 3 is returned.
extrapolate
the function is evaluated based on its coefficients just as it would be inside the interval. Thus, the function's range is not guaranteed to remain within the characteristic bounds of the Chebyshev interval. As the input value departs from the interval, the returned value diverges toward +/- infinity.
cyclic
the function is evaluated as if the range is cyclic, repeating the range values from its canonical domain. The period of the cycle will be equal to xmax - xmin. When the function is evaluated outside this interval, the input value will shifted an integer number of periods until it falls within the Chebyshev interval; the value returned is the polynomial evaluated at the shifted value.
edge
the value of the nearest edge of the interval of interest is returned.

The default out-of-interval mode is constant.



Example
- cheb := dfs.chebyshev(2, [2, 3, 4])
- cheb.state()
[type=9, order=2, ndim=1, npar=3, params=[2 3 4] , masks=[T T T] , 
mode=[interval=[-1 1] , default=0, intervalMode=constant]] 
- cheb.f([0, 0.5, 1, 2, 5])
[-2 1.5 9 0 0]  
- cheb := dfs.chebyshev(2, [2, 3, 4], xmin=0, xmax=2, ooimode='extrap')
[type=9, order=2, ndim=1, npar=3, params=[2 3 4] , masks=[T T T] , 
mode=[interval=[0 2] , default=0, intervalMode=extrapolate]] 
- cheb.state()
- cheb.f([0, 0.5, 1, 2, 5])
[3 -1.5 -2 9 138]





next up previous contents index
Next: functionalserver.butterworth - Function Up: functionalserver - Tool Previous: functionalserver.evenpoly - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15