System.Numerics.Tests.ComplexTests.Cos_Basic C# (CSharp) Method

Cos_Basic() private method

private Cos_Basic ( double real, double imaginary ) : void
real double
imaginary double
return void
        public static void Cos_Basic(double real, double imaginary)
        {
            // The product formula: cos (x+iy) = cos(x)*cosh(y) - isin(x)sinh(y)
            // The verification formula: cos (z) = (Complex.Exp(i*z) + Complex.Exp(-i*z)) / 2
            // The verification formula is used not for the boundary values
            var complex = new Complex(real, imaginary);
            Complex temp = Complex.ImaginaryOne * complex;
            Complex expected = (Complex.Exp(temp) + Complex.Exp(-temp)) / 2;
            Cos_Advanced(real, imaginary, expected.Real, expected.Imaginary);
        }
ComplexTests