RationalCubicSpline Type

This kind of generalized splines give much more pleasent results than cubic splines when interpolating, e.g., experimental data. A control parameter p can be used to tune the interpolation smoothly between cubic splines and a linear interpolation. But this doesn't mean smoothing of the data - the rational spline curve will still go through all data points.

            
             The basis functions for rational cubic splines are
            
               g1 = u
               g2 = t                     with   t = (x - x(i)) / (x(i+1) - x(i))
               g3 = u^3 / (p*t + 1)              u = 1 - t
               g4 = t^3 / (p*u + 1)
            
             A rational spline with coefficients a(i),b(i),c(i),d(i) is determined by
            
                      f(i)(x) = a(i)*g1 + b(i)*g2 + c(i)*g3 + d(i)*g4
            
             Choosing the smoothing parameter p:
             -----------------------------------
            
             Use the method
            
                  void MpRationalCubicSpline::SetSmoothing (double smoothing)
            
             to set the value of the smoothing paramenter. A value of p = 0
             for the smoothing parameter results in a standard cubic spline.
             A value of p with -1 < p < 0 results in "unsmoothing" that means
             overshooting oscillations. A value of p with p > 0 gives increasing
             smoothness. p to infinity results in a linear interpolation. A value
             smaller or equal to -1.0 leads to an error.
            
            
             Choosing the boundary conditions:
             ---------------------------------
            
             Use the method
            
                  void MpRationalCubicSpline::SetBoundaryConditions (int boundary,
                                   double b1, double b2)
            
             to set the boundary conditions. The following values are possible:
            
                  Natural
                      natural boundaries, that means the 2nd derivatives are zero
                      at both boundaries. This is the default value.
            
                  FiniteDifferences
                      use  finite difference approximation for 1st derivatives.
            
                  Supply1stDerivative
                      user supplied values for 1st derivatives are given in b1 and b2
                      i.e. f'(x_lo) in b1
                           f'(x_hi) in b2
            
                  Supply2ndDerivative
                      user supplied values for 2nd derivatives are given in b1 and b2
                      i.e. f''(x_lo) in b1
                           f''(x_hi) in b2
            
                  Periodic
                      periodic boundary conditions for periodic curves or functions.
                      NOT YET IMPLEMENTED IN THIS VERSION.
            
            
             If the parameters b1,b2 are omitted the default value is 0.0.
            
            
             Input parameters:
             -----------------
            
                  Vector x(lo,hi)  The abscissa vector
                  Vector y(lo,hi)  The ordinata vector
                                   If the spline is not parametric then the
                                   abscissa must be strictly monotone increasing
                                   or decreasing!
            
            
             References:
             -----------
               Dr.rer.nat. Helmuth Spaeth,
               Spline-Algorithmen zur Konstruktion glatter Kurven und Flaechen,
               3. Auflage, R. Oldenburg Verlag, Muenchen, Wien, 1983.

Constructors

Constructor Description

RationalCubicSpline()

Full Usage: RationalCubicSpline()

Instance members

Instance member Description

this.GetBoundaryConditions

Full Usage: this.GetBoundaryConditions

Parameters:
    b1 : byref<float> - First boundary condition parameter.
    b2 : byref<float> - Second boundary condition parameter.

Returns: BoundaryConditions The boundary condition.

Gets the boundary condition and the two condition parameters.

b1 : byref<float>

First boundary condition parameter.

b2 : byref<float>

Second boundary condition parameter.

Returns: BoundaryConditions

The boundary condition.

this.GetBoundaryConditions

Full Usage: this.GetBoundaryConditions

Returns: BoundaryConditions The boundary condition.

Gets the boundary condition and the two condition parameters.

Returns: BoundaryConditions

The boundary condition.

this.GetXOfU

Full Usage: this.GetXOfU

Parameters:
    u : float

Returns: float
Modifiers: abstract

u : float
Returns: float

this.GetYOfU

Full Usage: this.GetYOfU

Parameters:
    u : float

Returns: float
Modifiers: abstract

u : float
Returns: float

this.GetYOfX

Full Usage: this.GetYOfX

Parameters:
    u : float

Returns: float
Modifiers: abstract

u : float
Returns: float

this.Interpolate

Full Usage: this.Interpolate

Parameters:
Modifiers: abstract

x : IReadOnlyList<float>
y : IReadOnlyList<float>

this.SetBoundaryConditions

Full Usage: this.SetBoundaryConditions

Parameters:
    bnd : BoundaryConditions - The boundary condition. See remarks for the possible values.
    b1 : float -
    b2 : float -

Sets the boundary conditions.

                  Natural
                      natural boundaries, that means the 2nd derivatives are zero
                      at both boundaries. This is the default value.
            
                  FiniteDifferences
                      use  finite difference approximation for 1st derivatives.
            
                  Supply1stDerivative
                      user supplied values for 1st derivatives are given in b1 and b2
                      i.e. f'(x_lo) in b1
                           f'(x_hi) in b2
            
                  Supply2ndDerivative
                      user supplied values for 2nd derivatives are given in b1 and b2
                      i.e. f''(x_lo) in b1
                           f''(x_hi) in b2
            
                  Periodic
                      periodic boundary conditions for periodic curves or functions.
                      NOT YET IMPLEMENTED IN THIS VERSION.

bnd : BoundaryConditions

The boundary condition. See remarks for the possible values.

b1 : float

b2 : float

this.Smoothing

Full Usage: this.Smoothing

Set the value of the smoothing paramenter. A value of p = 0 for the smoothing parameter results in a standard cubic spline. A value of p with -1 < p < 0 results in "unsmoothing" that means overshooting oscillations. A value of p with p > 0 gives increasing smoothness. p to infinity results in a linear interpolation. A value smaller or equal to -1.0 leads to an error.

Static members

Static member Description

RationalCubicSpline.Differences(x, dx)

Full Usage: RationalCubicSpline.Differences(x, dx)

Parameters:

Calculate difference vector dx(i) from vector x(i) and assure that x(i) is strictly monotone increasing or decreasing. Can be called with both arguments the same vector in order to do it inplace!

x : IReadOnlyList<float>

Input vector.

dx : IVector<float>

Output vector.

RationalCubicSpline.InverseDifferences(x, dx)

Full Usage: RationalCubicSpline.InverseDifferences(x, dx)

Parameters:

Calculate inverse difference vector dx(i) from vector x(i) and assure that x(i) is strictly monotone increasing or decreasing. Can be called with both arguments the same vector in order to do it inplace!

x : IReadOnlyList<float>

Input vector.

dx : IVector<float>

Output vector.