Options
All
  • Public
  • Public/Protected
  • All
Menu

Cubic interpolation between discrete points.

Cubic interpolation is fully defined when the ${f_i}$ function values at points ${x_i}$ are supplemented with ${f^'_i}$ function derivative values.

Different type of first derivative approximations are implemented, both local and non-local. Local schemes (Fourth-order, Parabolic, Modified Parabolic, Fritsch-Butland, Akima, Kruger) use only $f$ values near $x_i$ to calculate each $f^'_i$. Non-local schemes (Spline with different boundary conditions) use all ${f_i}$ values and obtain ${f^'_i}$ by solving a linear system of equations. Local schemes produce $C^1$ interpolants, while the spline schemes generate $C^2$ interpolants.

Hyman's monotonicity constraint filter is also implemented: it can be applied to all schemes to ensure that in the regions of local monotoniticity of the input (three successive increasing or decreasing values) the interpolating cubic remains monotonic. If the interpolating cubic is already monotonic, the Hyman filter leaves it unchanged preserving all its original features.

In the case of $C^2$ interpolants the Hyman filter ensures local monotonicity at the expense of the second derivative of the interpolant which will no longer be continuous in the points where the filter has been applied.

While some non-linear schemes (Modified Parabolic, Fritsch-Butland, Kruger) are guaranteed to be locally monotonic in their original approximation, all other schemes must be filtered according to the Hyman criteria at the expense of their linearity.

See R. L. Dougherty, A. Edelman, and J. M. Hyman, "Nonnegativity-, Monotonicity-, or Convexity-Preserving CubicSpline and Quintic Hermite Interpolation" Mathematics Of Computation, v. 52, n. 186, April 1989, pp. 471-494.

todo:

implement missing schemes (FourthOrder and ModifiedParabolic) and missing boundary conditions (Periodic and Lagrange).

test:

to be adapted from old ones.

warning

See the Interpolation class for information about the required lifetime of the underlying data.

Hierarchy

Implements

Index

Constructors

constructor

Properties

Private _coeffs

_extrapolate

_extrapolate: boolean = false

Protected _impl

_impl: Impl = null

Methods

aCoefficients

  • aCoefficients(): Real[]
  • Returns Real[]

allowsExtrapolation

  • allowsExtrapolation(): boolean
  • tells whether extrapolation is enabled

    Returns boolean

bCoefficients

  • bCoefficients(): Real[]
  • Returns Real[]

cCoefficients

  • cCoefficients(): Real[]
  • Returns Real[]

Protected checkRange

  • checkRange(x: Real, extrapolate: boolean): void

derivative

  • derivative(x: Real, allowExtrapolation?: boolean): Real
  • Parameters

    • x: Real
    • Default value allowExtrapolation: boolean = false

    Returns Real

disableExtrapolation

  • disableExtrapolation(b?: boolean): void
  • disable extrapolation in subsequent calls

    Parameters

    • Default value b: boolean = true

    Returns void

empty

  • empty(): boolean
  • Returns boolean

enableExtrapolation

  • enableExtrapolation(b?: boolean): void
  • enable extrapolation in subsequent calls

    Parameters

    • Default value b: boolean = true

    Returns void

f

  • f(x: Real, allowExtrapolation?: boolean): Real
  • Parameters

    • x: Real
    • Default value allowExtrapolation: boolean = false

    Returns Real

getExistingHelpers

  • getExistingHelpers(): any

isInRange

  • isInRange(x: Real): boolean

monotonicityAdjustments

  • monotonicityAdjustments(): boolean[]
  • Returns boolean[]

primitive

  • primitive(x: Real, allowExtrapolation?: boolean): Real
  • Parameters

    • x: Real
    • Default value allowExtrapolation: boolean = false

    Returns Real

primitiveConstants

  • primitiveConstants(): Real[]
  • Returns Real[]

secondDerivative

  • secondDerivative(x: Real, allowExtrapolation?: boolean): Real

update

  • update(): void

xMax

xMin