예제 #1
0
        /// <returns>A complex point from a given string</returns>
        public static ComplexPoint GetPointFromString(string input)
        {
            string[] @params = input.Split(new char[] { ' ', 'i', '+', '(', ')' }
                                           , StringSplitOptions.RemoveEmptyEntries);
            ComplexPoint c = new ComplexPoint(double.Parse(@params[0]), double.Parse(@params[1]));

            return(c);
        }
예제 #2
0
        /// <returns> A n-degree of a colex point </returns>
        public static ComplexPoint Pow(ComplexPoint c, double exponent)
        {
            double x = c.Re;
            double y = c.Im;

            double modulus  = Math.Pow(x * x + y * y, exponent * 0.5);
            double argument = Math.Atan2(y, x) * exponent;

            c.Re = (double)(modulus * System.Math.Cos(argument));
            c.Im = (double)(modulus * System.Math.Sin(argument));

            return(c);
        }