Ejemplo n.º 1
0
        public static Cplx Sqrt(Cplx x)
        {
            double rho   = Length(x);
            double theta = Math.Atan2(x.a, x.b);

            rho    = Math.Sqrt(rho);
            theta *= 0.5;
            x.a    = Math.Cos(theta) * rho;
            x.b    = Math.Sin(theta) * rho;
            return(x);
        }
Ejemplo n.º 2
0
        public static Cplx Pow(Cplx x, double y)
        {
            double rho   = Length(x);
            double theta = Math.Atan2(x.b, x.a);

            rho    = Math.Pow(rho, y);
            theta *= y;
            x.a    = Math.Cos(theta) * rho;
            x.b    = Math.Sin(theta) * rho;
            return(x);
        }
Ejemplo n.º 3
0
 public static bool IsNaN(Cplx x)
 {
     return(double.IsNaN(x.a) || double.IsNaN(x.b));
 }
Ejemplo n.º 4
0
 public static void GetArgument(Cplx x, out double rho, out double theta)
 {
     rho   = Length(x);
     theta = Math.Atan2(x.b, x.a);
 }
Ejemplo n.º 5
0
 public static double Length(Cplx x)
 {
     return(Math.Sqrt(x.a * x.a + x.b * x.b));
 }
Ejemplo n.º 6
0
 public static double SqrLength(Cplx x)
 {
     return(x.a * x.a + x.b * x.b);
 }