Beispiel #1
0
        public void CoefficientsTest()
        {
            QuadraticThruZeroInterpolator target = new QuadraticThruZeroInterpolator(standards());

            double[] actual;
            actual = target.Coefficients();
            Assert.AreEqual(3, actual.Length);
            Assert.AreEqual(0, actual[0]);
            Assert.AreEqual(-3, actual[1]);
            Assert.AreEqual(2, actual[2]);
        }
Beispiel #2
0
        public void QuadraticThruZeroCalculateTest()
        {
            //y = 0.0804x2 + 1.9256x
            //R2 = 0.9212
            QuadraticThruZeroInterpolator target = (QuadraticThruZeroInterpolator)Interpolator.Create(CurveFits.QuadraticThruZero, standards());

            Assert.AreEqual("0.9212", target.RSquared().ToString("0.0000"));
            //passes thru origin
            Assert.AreEqual("0.000", target.Calculate(0).ToString("0.000"));
            Assert.AreEqual("222.7", target.Calculate(42).ToString("0.0"));
        }