public void GetValue_ZeroAlphaExpOfMinusX_BenchmarkResult( [Values(100, 125)] int order) { var gaussLaguerreConstantAbscissasIntegrator = new GaussLaguerreConstAbscissaIntegrator(order); var numericalIntegrator = gaussLaguerreConstantAbscissasIntegrator.Create(); numericalIntegrator.FunctionToIntegrate = (x, k) => Math.Exp(-x); // i.e. \int_0^\infty e^{-2*x} = 1/2 double expected = 0.5; double actual = numericalIntegrator.GetValue(); Assert.That(actual, Is.EqualTo(expected).Within(1E-6), String.Format("1-dimensional integrator {0}.", numericalIntegrator.Factory.Name)); }
public void GetValue_One_BenchmarkResult( [Values(5, 10, 22)] int alpha, [Values(100, 125)] int order) { var gaussLaguerreConstantAbscissasIntegrator = new GaussLaguerreConstAbscissaIntegrator(alpha, order); var numericalIntegrator = gaussLaguerreConstantAbscissasIntegrator.Create(); numericalIntegrator.FunctionToIntegrate = (x, k) => 1.0; double expected = GetFaculty(alpha); // see for example § 21.6.2 "Taschenbuch der Mathematik", Bronstein, Semendjajew, Musiol, Mühlig, 1995 double actual = numericalIntegrator.GetValue(); Assert.That(actual, Is.EqualTo(expected).Within(1E-7).Percent, String.Format("1-dimensional integrator {0}.", numericalIntegrator.Factory.Name)); }