Exemplo n.º 1
0
        public void NaturalFitsAtArbitraryPointsWithMaple(double t, double x, double maxAbsoluteError)
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x);

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

            var actual = interpolation.DifferentiateAll(t);

            Assert.AreEqual(x, actual.Item1, maxAbsoluteError, "Interpolation as by-product of differentiation at {0}", t);
        }
Exemplo n.º 2
0
        public void FixedSecondDerivativeFitsAtArbitraryPointsWithMaple(double t, double x, double maxAbsoluteError)
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x, SplineBoundaryCondition.SecondDerivative, -5.0, SplineBoundaryCondition.SecondDerivative, -1.0);

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

            var actual = interpolation.DifferentiateAll(t);

            Assert.AreEqual(x, actual.Item1, maxAbsoluteError, "Interpolation as by-product of differentiation at {0}", t);
        }
Exemplo n.º 3
0
        public void NaturalFitsAtSamplePoints()
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x);

            for (int i = 0; i < _x.Length; i++)
            {
                Assert.AreEqual(_x[i], interpolation.Interpolate(_t[i]), "A Exact Point " + i);

                var actual = interpolation.DifferentiateAll(_t[i]);
                Assert.AreEqual(_x[i], actual.Item1, "B Exact Point " + i);
            }
        }
Exemplo n.º 4
0
        public void FixedSecondDerivativeFitsAtSamplePoints()
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x, SplineBoundaryCondition.SecondDerivative, -5.0, SplineBoundaryCondition.SecondDerivative, -1.0);

            for (int i = 0; i < _x.Length; i++)
            {
                Assert.AreEqual(_x[i], interpolation.Interpolate(_t[i]), "A Exact Point " + i);

                var actual = interpolation.DifferentiateAll(_t[i]);
                Assert.AreEqual(_x[i], actual.Item1, "B Exact Point " + i);
            }
        }
Exemplo n.º 5
0
        public void FixedFirstDerivativeFitsAtArbitraryPointsWithMaple(double t, double x, double maxAbsoluteError)
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x, SplineBoundaryCondition.FirstDerivative, 1.0, SplineBoundaryCondition.FirstDerivative, -1.0);

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

            var actual = interpolation.DifferentiateAll(t);
            Assert.AreEqual(x, actual.Item1, maxAbsoluteError, "Interpolation as by-product of differentiation at {0}", t);
        }
Exemplo n.º 6
0
        public void NaturalFitsAtSamplePoints()
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x);

            for (int i = 0; i < _x.Length; i++)
            {
                Assert.AreEqual(_x[i], interpolation.Interpolate(_t[i]), "A Exact Point " + i);

                var actual = interpolation.DifferentiateAll(_t[i]);
                Assert.AreEqual(_x[i], actual.Item1, "B Exact Point " + i);
            }
        }
Exemplo n.º 7
0
        public void NaturalFitsAtArbitraryPointsWithMaple(double t, double x, double maxAbsoluteError)
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x);

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

            var actual = interpolation.DifferentiateAll(t);
            Assert.AreEqual(x, actual.Item1, maxAbsoluteError, "Interpolation as by-product of differentiation at {0}", t);
        }
Exemplo n.º 8
0
        public void FixedSecondDerivativeFitsAtSamplePoints()
        {
            IInterpolation interpolation = new CubicSplineInterpolation(_t, _x, SplineBoundaryCondition.SecondDerivative, -5.0, SplineBoundaryCondition.SecondDerivative, -1.0);

            for (int i = 0; i < _x.Length; i++)
            {
                Assert.AreEqual(_x[i], interpolation.Interpolate(_t[i]), "A Exact Point " + i);

                var actual = interpolation.DifferentiateAll(_t[i]);
                Assert.AreEqual(_x[i], actual.Item1, "B Exact Point " + i);
            }
        }