/// <summary> /// Verifies that at points other than the provided sample points, the interpolation matches the one computed by Maple as a reference. /// </summary> /// <param name="t">Sample point.</param> /// <param name="x">Sample value.</param> /// <param name="maxAbsoluteError">Maximum absolute error.</param> /// <remarks> /// Maple: /// with(CurveFitting); /// evalf(subs({x=-2.4},Spline([[-2,1],[-1,2],[0,-1],[1,0],[2,1]], x, degree=3, endpoints=Matrix(2,13,{(1,3)=1,(1,13)=-5,(2,10)=1,(2,13)=-1}))),20); /// </remarks> public void FixedSecondDerivativeFitsAtArbitraryPoints(double t, double x, double maxAbsoluteError) { var it = CubicSplineInterpolation.InterpolateBoundaries(_t, _y, SplineBoundaryCondition.SecondDerivative, -5.0, SplineBoundaryCondition.SecondDerivative, -1.0); Assert.AreEqual(x, it.ValueAt(t), maxAbsoluteError, "Interpolation at {0}", t); }
public void FixedSecondDerivativeFitsAtSamplePoints() { var it = CubicSplineInterpolation.InterpolateBoundaries(_t, _y, SplineBoundaryCondition.SecondDerivative, -5.0, SplineBoundaryCondition.SecondDerivative, -1.0); for (int i = 0; i < _y.Length; i++) { Assert.AreEqual(_y[i], it.ValueAt(_t[i]), "A Exact Point " + i); } }