Ejemplo n.º 1
0
        /// <summary>
        /// Calculates the cosecant of the specified complex number.
        /// </summary>
        /// <param name="complex">A <see cref="Complex"/> instance.</param>
        /// <returns>The cosecant of <paramref name="complex"/>.</returns>
        public static Complex Csc(this Complex complex)
        {
            Complex result = Complex.Zero;

            var sinr      = ArithMath.Sin(complex.Real);
            var sinhi     = ArithMath.Sinh(complex.Imaginary);
            var denom     = sinr * sinr + sinhi * sinhi;
            var Real      = (sinr * ArithMath.Cosh(complex.Imaginary)) / denom;
            var Imaginary = (-ArithMath.Cos(complex.Real) * sinhi) / denom;

            return(new Complex(Real, Imaginary));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculates the secant of the specified complex number.
        /// </summary>
        /// <param name="complex">A <see cref="Complex"/> instance.</param>
        /// <returns>The secant of <paramref name="complex"/>.</returns>
        public static Complex Sec(this Complex complex)
        {
            Complex result = Complex.Zero;

            var cosr      = ArithMath.Cos(complex.Real);
            var sinhi     = ArithMath.Sinh(complex.Imaginary);
            var denom     = cosr * cosr + sinhi * sinhi;
            var Real      = (cosr * (float)ArithMath.Cosh(complex.Imaginary)) / denom;
            var Imaginary = ((float)ArithMath.Sin(complex.Real) * sinhi) / denom;

            return(new Complex(Real, Imaginary));
        }