AixLib.Utilities.Math.Functions.splineDerivatives

# .AixLib.Utilities.Math.Functions.splineDerivatives

Function to compute the derivatives for cubic hermite spline interpolation

## Information

This function computes the derivatives at the support points xi that can be used as input for evaluating a cubic hermite spline.

If `ensureMonotonicity=true`, then the support points yi need to be monotone increasing (or decreasing), and the computed derivatives di are such that the cubic hermite is monotone increasing (or decreasing). The algorithm to ensure monotonicity is based on the method described in Fritsch and Carlson (1980) for ρ = ρ2.

This function is typically used with AixLib.Utilities.Math.Functions.interpolate which is used to evaluate the cubic spline. Because in many applications, the shape of the spline depends on parameters which will no longer change once the initialisation is complete, this function computes and returns the derivatives so that they can be stored by the calling model to avoid repetitive computations.

#### References

F.N. Fritsch and R.E. Carlson, Monotone piecewise cubic interpolation. SIAM J. Numer. Anal., 17 (1980), pp. 238-246.

#### Interface

>     function splineDerivatives
>       extends Modelica.Icons.Function;
>       input Real x[:] "Support point, strictly increasing";
>       input Real y[size(x, 1)] "Function values at x";
>       input Boolean ensureMonotonicity = isMonotonic(y, strict = false) "Set to true to ensure monotonicity of the cubic hermite";
>       output Real d[size(x, 1)] "Derivative at the support points";
>     end splineDerivatives;

## Revisions

- January 26, 2016 by Michael Wetter:
  Corrected documentation.
- September 29, 2011 by Michael Wetter:
  Added special case for one data point and two data points.
- September 27, 2011 by Michael Wetter:
  First implementation.

Generated at 2026-05-12T20:19:03Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos