示例#1
0
        public void FitsAtSamplePoints()
        {
            var ip = new PiecewiseConstantInterpolation(_t, _y);

            for (int i = 0; i < _y.Length; i++)
            {
                Assert.AreEqual(_y[i], ip.ValueAt(_t[i]), "A Exact Point " + i);
            }
        }
        public void TestPiecewiseConstantInterpolation()
        {
            Random r = new Random(Environment.TickCount);

            TearDown();
            var interpolation = new PiecewiseConstantInterpolation();

            interpolation.Initialize(_times, _rates);
            for (int i = 0; i < 10; ++i)
            {
                double time       = i + r.Next(-10000, 10000) / 10000;
                double interpRate = interpolation.ValueAt(time, true);
                Debug.WriteLine($"interpolatedRate : {interpRate} Time: {time}");
            }
        }