Beispiel #1
0
        public void DefiniteIntegral()
        {
            IInterpolation ip = LinearSpline.Interpolate(_t, _y);

            Assert.That(ip.Integrate(-4.0, -3.0), Is.EqualTo(-0.5));
            Assert.That(ip.Integrate(-3.0, -2.0), Is.EqualTo(0.5));
            Assert.That(ip.Integrate(-2.0, -1.0), Is.EqualTo(1.5));
            Assert.That(ip.Integrate(-1.0, 0.0), Is.EqualTo(0.5));
            Assert.That(ip.Integrate(0.0, 1.0), Is.EqualTo(-0.5));
            Assert.That(ip.Integrate(1.0, 2.0), Is.EqualTo(0.5));
            Assert.That(ip.Integrate(2.0, 3.0), Is.EqualTo(1.5));
            Assert.That(ip.Integrate(3.0, 4.0), Is.EqualTo(2.5));
            Assert.That(ip.Integrate(0.0, 4.0), Is.EqualTo(4.0));
            Assert.That(ip.Integrate(-3.0, -1.0), Is.EqualTo(2.0));
            Assert.That(ip.Integrate(-3.0, 4.0), Is.EqualTo(6.5));
            Assert.That(ip.Integrate(0.5, 1.5), Is.EqualTo(0.0));
            Assert.That(ip.Integrate(-2.5, -1.0), Is.EqualTo(1.875));
        }