public void FitsAtArbitraryPointsWithMaple(
            [Values(0.1, 0.4, 1.1, 3.2, 4.5, 10.0, -10.0)] double t,
            [Values(.487425, 1.6968, 3.081925, .9408, 7.265625, 592.5, 657.5)] double x,
            [Values(1e-15, 1e-15, 1e-15, 1e-15, 1e-14, 1e-10, 1e-9)] double maxAbsoluteError)
        {
            IInterpolation interpolation = new EquidistantPolynomialInterpolation(_tmin, _tmax, _x);

            Assert.AreEqual(x, interpolation.Interpolate(t), maxAbsoluteError, "Interpolation at {0}", t);
        }
        public void FitsAtSamplePoints()
        {
            IInterpolation interpolation = new EquidistantPolynomialInterpolation(_tmin, _tmax, _x);

            for (int i = 0; i < _x.Length; i++)
            {
                Assert.AreEqual(_x[i], interpolation.Interpolate(i), "A Exact Point " + i);
            }
        }
        public void PolynomialFitsAtArbitraryPointsWithMaple(
            [Values(-2.4, -0.9, -0.5, -0.1, 0.1, 0.4, 1.2, 10.0, -10.0)] double t,
            [Values(-4.5968, 1.65395, 0.21875, -0.84205, -1.10805, -1.1248, 0.5392, -4431.0, -5071.0)] double x,
            [Values(1e-14, 1e-15, 1e-15, 1e-15, 1e-15, 1e-15, 1e-15, 1e-9, 1e-9)] double maxAbsoluteError)
        {
            IInterpolation interpolation = new EquidistantPolynomialInterpolation(_t, _x);

            Assert.AreEqual(x, interpolation.Interpolate(t), maxAbsoluteError, "Interpolation at {0}", t);
        }
 public void SupportsLinearCase([Values(2, 4, 12)] int samples)
 {
     double[] x, y, xtest, ytest;
     LinearInterpolationCase.Build(out x, out y, out xtest, out ytest, samples);
     IInterpolation interpolation = new EquidistantPolynomialInterpolation(x, y);
     for (int i = 0; i < xtest.Length; i++)
     {
         Assert.AreEqual(ytest[i], interpolation.Interpolate(xtest[i]), 1e-12, "Linear with {0} samples, sample {1}", samples, i);
     }
 }
        public void PolynomialFitsAtArbitraryPointsWithMaple(double t, double x, double maxAbsoluteError)
        {
            IInterpolation interpolation = new EquidistantPolynomialInterpolation(_t, _x);

            Assert.AreEqual(x, interpolation.Interpolate(t), maxAbsoluteError, "Interpolation at {0}", t);
        }
 /// <summary>
 /// Create a polynomial interpolation based on equidistant sample points.
 /// </summary>
 /// <param name="leftBound">The leftmost (smallest) sample point t.</param>
 /// <param name="rightBound">The rightmost (biggest) sample point t.</param>
 /// <param name="values">The sample point values x(t). Supports both lists and arrays.</param>
 /// <returns>
 /// An interpolation scheme optimized for the given sample points and values,
 /// which can then be used to compute interpolations and extrapolations
 /// on arbitrary points.
 /// </returns>
 public static IInterpolationMethod CreateOnEquidistantPoints(
     double leftBound,
     double rightBound,
     IList<double> values
     )
 {
     EquidistantPolynomialInterpolation method = new EquidistantPolynomialInterpolation();
     method.Init(leftBound, rightBound, values);
     return method;
 }
예제 #7
0
        public void FitsAtArbitraryPointsWithMaple(double t, double x, double maxAbsoluteError)
        {
            IInterpolation interpolation = new EquidistantPolynomialInterpolation(Tmin, Tmax, _x);

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