8.0.0.5. Function Interpolation
|
(packages/libnum/interpolator.lsh) |
This defines a class for approximating scalar functions by interpolating
between a number of control points. This provides a variety of
interpolation methods, including, linear, polynomial, cubinc spline, and
Akima splines. Methods are available for computing integrals and first
and second derivatives. The class implementation uses GSL's
interpolation functions. Example of use:
;; create cubic spline interpolator
(defparameter z (new interpolator 2 [0 1 2 3 4] [0 5 2 8 1]))
= ::interpolator:82b15b8
? (==> z eval 0.5)
= 3.6317
? (==> z eval 1)
= 5
? (==> z derivative 1)
= -1.0357
= 8.0179
? (==> z derivative2 1)
= -18.1071
? (==> z integral 0 1)
= 3.2545
? (delete z)
8.0.0.5.0. interpolator
|
(packages/libnum/interpolator.lsh) |
The interpolator class.
8.0.0.5.1. (new interpolator type xarray yarray)
|
[CLASS] (packages/libnum/interpolator.lsh) |
Create a new interpolator object. Argument type
determines the type of interpolation to be performed: 0: linear, 1:
polynomial, 2: cubic spline, 3: cubic spline with periodic boundary
conditions, 4: akima spline, 5: akima spline with periodic BC.
xarray and yarray are idx1
of doubles that contain the abscissa and ordinate of each control point.
The values in xarray must sorted by
increasing value (no check is performed). Different types of
interpolation require a different minimum number of points to function
properly (e.g. Akima requires 5).
8.0.0.5.2. (==> interpolator eval x)
|
[MSG] (packages/libnum/interpolator.lsh) |
evaluate interpolated function at abscissa x
8.0.0.5.3. (==> interpolator derivative x)
|
[MSG] (packages/libnum/interpolator.lsh) |
evaluate first derivative of interpolated function at abscissa
x
8.0.0.5.4. (==> interpolator derivative2 x)
|
[MSG] (packages/libnum/interpolator.lsh) |
evaluate 2nd derivative of interpolated function at abscissa
x
8.0.0.5.5. (==> interpolator integral a b)
|
[MSG] (packages/libnum/interpolator.lsh) |
evaluate integral of interpolated function between abscissas
a and b .