コード例 #1
0
        public void FitsAtSamplePoints()
        {
            var it = CubicSplineInterpolation.InterpolateAkima(_t, _y);

            for (int i = 0; i < _y.Length; i++)
            {
                Assert.AreEqual(_y[i], it.ValueAt(_t[i]), "A Exact Point " + i);
            }
        }
コード例 #2
0
 public void FewSamples()
 {
     Assert.AreEqual(
         CubicSplineInterpolation.InterpolateAkima(new[] { 1.0, 2.0, 3.0, 4.0, 5.0 }, new[] { 2.0, 2.0, 2.0, 2.0, 2.0 })
         .ValueAt(1.0), 2.0);
 }
コード例 #3
0
        /// <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>
        public void FitsAtArbitraryPoints(double t, double x, double maxAbsoluteError)
        {
            var it = CubicSplineInterpolation.InterpolateAkima(_t, _y);

            Assert.AreEqual(x, it.ValueAt(t), maxAbsoluteError, "Interpolation at {0}", t);
        }