예제 #1
0
        public static Complex Gamma(Complex z, int order = 10)
        {
            // ∫[0,∞] t^-z e^-t dt.

            var integral = Complex.Zero;

            double dt = 1.0 / order;
            double t  = 0;

            for (int n = 0; n <= order; ++n)
            {
                integral += Complex.Pow(t, z) * Functions.Exp(-t);
                t        += dt;
            }

            return(integral);
        }
예제 #2
0
        /// <summary>
        /// Returns e raised to the power specified by a complex number.
        /// </summary>
        /// <param name="value">A complex number that specifies a power.</param>
        /// <returns>The number e raised to the power value.</returns>
        public static Complex Exp(Complex value)
        {
            double e = Functions.Exp(value.A);

            return(new Complex(e * Functions.Cos(value.B), e * Functions.Sin(value.B)));
        }