public void PolyomnialFitsAtSamplePoints()
        {
            IInterpolation interpolation = new FloaterHormannRationalInterpolation(_t, _x);

            for (int i = 0; i < _x.Length; i++)
            {
                Assert.AreEqual(_x[i], interpolation.Interpolate(_t[i]), "A Exact Point " + i);
            }
        }
        public void SupportsLinearCase(int samples)
        {
            double[] x, y, xtest, ytest;
            LinearInterpolationCase.Build(out x, out y, out xtest, out ytest, samples);
            IInterpolation interpolation = new FloaterHormannRationalInterpolation(x, y);

            for (int i = 0; i < xtest.Length; i++)
            {
                Assert.AreEqual(ytest[i], interpolation.Interpolate(xtest[i]), 1e-14, "Linear with {0} samples, sample {1}", samples, i);
            }
        }
Esempio n. 3
0
        public void RationalFitsAtSamplePoints()
        {
            var t = new double[40];
            var x = new double[40];

            const double step = 10.0 / 39.0;

            for (int i = 0; i < t.Length; i++)
            {
                double tt = -5 + (i * step);
                t[i] = tt;
                x[i] = 1.0 / (1.0 + (tt * tt));
            }

            IInterpolation interpolation = new FloaterHormannRationalInterpolation(t, x);

            for (int i = 0; i < x.Length; i++)
            {
                Assert.AreEqual(x[i], interpolation.Interpolate(t[i]), "A Exact Point " + i);
            }
        }
        public void RationalFitsAtSamplePoints()
        {
            var t = new double[40];
            var x = new double[40];

            const double Step = 10.0 / 39.0;
            for (int i = 0; i < t.Length; i++)
            {
                double tt = -5 + (i * Step);
                t[i] = tt;
                x[i] = 1.0 / (1.0 + (tt * tt));
            }

            IInterpolation interpolation = new FloaterHormannRationalInterpolation(t, x);

            for (int i = 0; i < x.Length; i++)
            {
                Assert.AreEqual(x[i], interpolation.Interpolate(t[i]), "A Exact Point " + i);
            }
        }
 public void SupportsLinearCase(int samples)
 {
     double[] x, y, xtest, ytest;
     LinearInterpolationCase.Build(out x, out y, out xtest, out ytest, samples);
     IInterpolation interpolation = new FloaterHormannRationalInterpolation(x, y);
     for (int i = 0; i < xtest.Length; i++)
     {
         Assert.AreEqual(ytest[i], interpolation.Interpolate(xtest[i]), 1e-14, "Linear with {0} samples, sample {1}", samples, i);
     }
 }