public void ComplexLogGammaRealLogGammaAgreement()
 {
     foreach (double x in TestUtilities.GenerateRealValues(1.0E-4, 1.0E4, 24))
     {
         Assert.IsTrue(TestUtilities.IsNearlyEqual(AdvancedComplexMath.LogGamma(x), AdvancedMath.LogGamma(x)));
     }
 }
 public void ComplexLogGammaConjugation () {
     foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-4, 1.0E4, 24)) {
         if (z.Re <= 0.0) continue;
         Console.WriteLine("z={0} lnG(z*)={1} lnG*(z)={2}", z, AdvancedComplexMath.LogGamma(z.Conjugate), AdvancedComplexMath.LogGamma(z).Conjugate);
         Assert.IsTrue(TestUtilities.IsNearlyEqual(
             AdvancedComplexMath.LogGamma(z.Conjugate),
             AdvancedComplexMath.LogGamma(z).Conjugate
         ));
     }
 }
 public void ComplexLogGammaConjugation()
 {
     foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-4, 1.0E4, 24))
     {
         Assert.IsTrue(TestUtilities.IsNearlyEqual(
                           AdvancedComplexMath.LogGamma(z.Conjugate),
                           AdvancedComplexMath.LogGamma(z).Conjugate
                           ));
     }
 }
 public void ComplexLogGammaComplexGammaAgreement()
 {
     foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-2, 1.0E2, 16))
     {
         Assert.IsTrue(TestUtilities.IsNearlyEqual(
                           ComplexMath.Exp(AdvancedComplexMath.LogGamma(z)),
                           AdvancedComplexMath.Gamma(z)
                           ));
     }
 }
 public void ComplexLogGammaRecurrance()
 {
     // Don't try for z << 1, because z + 1 won't retain enough digits to satisfy
     foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-2, 1.0E4, 24))
     {
         Assert.IsTrue(TestUtilities.IsNearlyEqual(
                           AdvancedComplexMath.LogGamma(z + 1.0),
                           AdvancedComplexMath.LogGamma(z) + ComplexMath.Log(z)
                           ));
     }
 }
Пример #6
0
 public void ComplexLogGammaSpecialValues()
 {
     Assert.IsTrue(TestUtilities.IsNearlyEqual(AdvancedComplexMath.LogGamma(-0.5), new Complex(Math.Log(2.0 * Math.Sqrt(Math.PI)), -Math.PI)));
     Assert.IsTrue(TestUtilities.IsNearlyEqual(AdvancedComplexMath.LogGamma(-1.5), new Complex(Math.Log(4.0 * Math.Sqrt(Math.PI) / 3.0), -2.0 * Math.PI)));
     Assert.IsTrue(TestUtilities.IsNearlyEqual(AdvancedComplexMath.LogGamma(-2.5), new Complex(Math.Log(8.0 * Math.Sqrt(Math.PI) / 15.0), -3.0 * Math.PI)));
 }