Safe Haskell | Safe |
---|---|

Language | Haskell98 |

Generate lists of basis functions with respect to interpolation nodes and generate functions from coefficients with respect to these bases.

A basis function is one where all but one features are zero. E.g. in a linear basis a basis function is one at one node, and zero at all the other interpolation nodes.

You need the basis functions for setting up the matrix for a linear least-squares solver for curve fitting. The solver computes some coefficients and in a second step you convert these coefficients to the piecewise interpolation function.

## Synopsis

- linear :: Num b => [a] -> [T a b]
- hermite1 :: Num b => [a] -> [T a (b, b)]
- cubicLinear :: Fractional a => [a] -> [T a (a, a)]
- cubicParabola :: Fractional a => [a] -> [T a (a, a)]
- coefficientsToLinear :: [a] -> [b] -> T a b
- coefficientsToHermite1 :: [a] -> [b] -> T a (b, b)
- coefficientsToCubicLinear :: Fractional a => [a] -> [a] -> T a (a, a)
- coefficientsToCubicParabola :: Fractional a => [a] -> [a] -> T a (a, a)

# Interpolation basis functions

cubicLinear :: Fractional a => [a] -> [T a (a, a)] Source #

Cubic interpolation where the derivative at a node is set to the slope of the two adjacent nodes.

cubicParabola :: Fractional a => [a] -> [T a (a, a)] Source #

Cubic interpolation where the derivative at a node is set to the slope of the parabola through the current and the two adjacent nodes.

# Construct functions from the coefficients with respect to a basis

coefficientsToLinear :: [a] -> [b] -> T a b Source #

`coefficientsToLinear nodes coefficients`

creates an interpolation function for `nodes`

,
where the `coefficients`

correspond to the basis functions
constructed with `Basis.linear nodes`

.

coefficientsToHermite1 :: [a] -> [b] -> T a (b, b) Source #

coefficientsToCubicLinear :: Fractional a => [a] -> [a] -> T a (a, a) Source #

coefficientsToCubicParabola :: Fractional a => [a] -> [a] -> T a (a, a) Source #