Beispiel #1
0
 public void ComplexArcTrigInversion()
 {
     foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-4, 1.0E4, 32))
     {
         Complex asin = ComplexMath.Asin(z);
         Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Sin(asin), z));
         Complex acos = ComplexMath.Acos(z);
         Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Cos(acos), z));
         Assert.IsTrue(TestUtilities.IsSumNearlyEqual(asin, acos, Math.PI / 2.0));
     }
 }
Beispiel #2
0
        public void ComplexArcTrigReflection()
        {
            foreach (Complex z in TestUtilities.GenerateComplexValues(1.0E-3, 1.0E3, 32))
            {
                Complex asin  = ComplexMath.Asin(z);
                Complex masin = ComplexMath.Asin(-z);
                Assert.IsTrue(TestUtilities.IsNearlyEqual(masin, -asin));

                Complex acos  = ComplexMath.Acos(z);
                Complex macos = ComplexMath.Acos(-z);
                Assert.IsTrue(TestUtilities.IsSumNearlyEqual(acos, macos, Math.PI));
            }
        }
Beispiel #3
0
        public void ComplexArcTrigSpecialValues()
        {
            Assert.IsTrue(ComplexMath.Asin(Complex.Zero) == Complex.Zero);
            Assert.IsTrue(ComplexMath.Asin(Complex.One) == Math.PI / 2.0);
            Assert.IsTrue(ComplexMath.Asin(-Complex.One) == -Math.PI / 2.0);
            Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Asin(Complex.I), Complex.I * Math.Log(1.0 + Math.Sqrt(2.0))));
            Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Asin(-Complex.I), -Complex.I * Math.Log(1.0 + Math.Sqrt(2.0))));

            Assert.IsTrue(ComplexMath.Acos(Complex.Zero) == Math.PI / 2.0);
            Assert.IsTrue(ComplexMath.Acos(Complex.One) == Complex.Zero);
            Assert.IsTrue(ComplexMath.Acos(-Complex.One) == Math.PI);
            Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Acos(Complex.I), Math.PI / 2.0 - Complex.I * Math.Log(1.0 + Math.Sqrt(2.0))));
            Assert.IsTrue(TestUtilities.IsNearlyEqual(ComplexMath.Acos(-Complex.I), Math.PI / 2.0 + Complex.I * Math.Log(1.0 + Math.Sqrt(2.0))));
        }