コード例 #1
0
 public void IntegralCiCinRelation()
 {
     foreach (double x in TestUtilities.GenerateRealValues(1.0E-4, 1.0, 4))
     {
         Assert.IsTrue(TestUtilities.IsNearlyEqual(
                           AdvancedMath.EulerGamma + Math.Log(x) - AdvancedMath.IntegralCin(x),
                           AdvancedMath.IntegralCi(x)
                           ));
     }
     foreach (double x in TestUtilities.GenerateRealValues(1.0, 1.0E4, 4))
     {
         Assert.IsTrue(TestUtilities.IsNearlyEqual(
                           AdvancedMath.EulerGamma + Math.Log(x) - AdvancedMath.IntegralCi(x),
                           AdvancedMath.IntegralCin(x)
                           ));
     }
 }
コード例 #2
0
        public void IntegralCiSiIntegrals()
        {
            // these integrals are from Oldham et al, An Atlas of Functions

            // A & S 5.2.28
            Assert.IsTrue(TestUtilities.IsNearlyEqual(
                              FunctionMath.Integrate(t => AdvancedMath.IntegralCi(t) * Math.Exp(-t), Interval.FromEndpoints(0.0, Double.PositiveInfinity)),
                              -Math.Log(2.0) / 2.0
                              ));

            Assert.IsTrue(TestUtilities.IsNearlyEqual(
                              FunctionMath.Integrate(t => AdvancedMath.IntegralSi(t) * Math.Exp(-t), Interval.FromEndpoints(0.0, Double.PositiveInfinity)),
                              Math.PI / 4.0
                              ));

            /*
             * // the integral of [Ci(t)]^2 does not converge numerically
             * Assert.IsTrue(TestUtilities.IsNearlyEqual(
             *  FunctionMath.Integrate(t => MoreMath.Sqr(AdvancedMath.IntegralCi(t)), Interval.FromEndpoints(0.0, Double.PositiveInfinity)),
             *  Math.PI / 2.0
             * ));
             */
        }
コード例 #3
0
 public void IntegralCiSpecialCases()
 {
     Assert.IsTrue(Double.IsNegativeInfinity(AdvancedMath.IntegralCi(0.0)));
     Assert.IsTrue(Double.IsNaN(AdvancedMath.IntegralCi(Double.NaN)));
 }