public void TestPredictLogisticWithPredictNext() { double[] logistic = new double[1000]; logistic[0] = 0.1; for (int n = 1; n < 1000; n++) { logistic[n] = 4.0 * logistic[n - 1] * (1.0 - logistic[n - 1]); } ChaosAnalysis analysis = new ChaosAnalysis(); TimeSpan sampleTime = new TimeSpan(0, 0, 1); analysis.LoadSampledData(logistic, DateTime.Now, sampleTime); Assert.IsTrue(analysis.CalculateMeasures(true, false, true)); logistic[0] = logistic[logistic.Length - 1]; double error = 0.0; for (int n = 1; n < 1000; n++) { logistic[n] = 4.0 * logistic[n - 1] * (1.0 - logistic[n - 1]); double[] result; if (n == 1) { result = analysis.Predict(1, analysis.latest); } else { result = analysis.PredictNext(1, analysis.latest); } analysis.AddDataPointRelative(logistic[n], sampleTime); double diff = logistic[n] - result[0]; error += diff * diff; } error = Math.Sqrt(error / 1000); Assert.AreEqual(0.00403954, error, 0.001); }