Exemplo n.º 1
0
 public void ComplexCosCosh()
 {
     foreach (Complex x in TestUtilities.GenerateComplexValues(1.0E-2, 1.0E2, 10))
     {
         Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Cosh(x), ComplexMath.Cos(ComplexMath.I * x)));
         Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Cosh(-ComplexMath.I * x), ComplexMath.Cos(x)));
     }
 }
Exemplo n.º 2
0
 public void ComplexSinhCoshRelation()
 {
     foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-2, 1.0E2, 10))
     {
         Complex sinh = ComplexMath.Sinh(z);
         Complex cosh = ComplexMath.Cosh(z);
         Assert.IsTrue(TestUtilities.IsSumNearlyEqual(cosh * cosh, -sinh * sinh, 1));
     }
 }
Exemplo n.º 3
0
 public void ComplexCosCosh()
 {
     foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-3, 1.0E3, 16))
     {
         // Since sin(z) and cos(z) have factors that go like e^{\pm Im(z)}, they will blow up if the imaginary
         // part of z gets too big. We just skip over those problematic values.
         if (Math.Abs(z.Im) > Math.Log(Double.MaxValue) / 2.0)
         {
             continue;
         }
         Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Cosh(z), ComplexMath.Cos(ComplexMath.I * z)));
         Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Cosh(-ComplexMath.I * z), ComplexMath.Cos(z)));
     }
 }
Exemplo n.º 4
0
 public void ComplexHyperbolicTrigExtremeValues()
 {
     Assert.IsTrue(Complex.IsNaN(ComplexMath.Sinh(Double.NaN)));
     Assert.IsTrue(Complex.IsNaN(ComplexMath.Cosh(Double.NaN)));
     Assert.IsTrue(Complex.IsNaN(ComplexMath.Tanh(Double.NaN)));
 }