AForge.Math.Complex.Tan C# (CSharp) Method

Tan() public static method

Calculates Tangent value of the complex number.
public static Tan ( Complex a ) : Complex
a Complex A instance.
return Complex
        public static Complex Tan(Complex a)
        {
            Complex result = Zero;

            if (a.Im == 0.0)
            {
                result.Re = System.Math.Tan(a.Re);
                result.Im = 0.0;
            }
            else
            {
                double real2 = 2*a.Re;
                double imag2 = 2*a.Im;
                double denom = System.Math.Cos(real2) + System.Math.Cosh(real2);

                result.Re = System.Math.Sin(real2)/denom;
                result.Im = System.Math.Sinh(imag2)/denom;
            }

            return result;
        }