public void ComplexSinSinh() { foreach (Complex x in TestUtilities.GenerateComplexValues(1.0E-2, 1.0E2, 10)) { Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Sinh(x), -ComplexMath.I * ComplexMath.Sin(ComplexMath.I * x))); Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.I * ComplexMath.Sinh(-ComplexMath.I * x), ComplexMath.Sin(x))); } }
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)); } }
public void ComplexSinSinh() { 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.Sinh(z), -ComplexMath.I * ComplexMath.Sin(ComplexMath.I * z))); Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.I * ComplexMath.Sinh(-ComplexMath.I * z), ComplexMath.Sin(z))); } }
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))); }