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); }
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); }
public static bool IsNaN(Cplx x) { return(double.IsNaN(x.a) || double.IsNaN(x.b)); }
public static void GetArgument(Cplx x, out double rho, out double theta) { rho = Length(x); theta = Math.Atan2(x.b, x.a); }
public static double Length(Cplx x) { return(Math.Sqrt(x.a * x.a + x.b * x.b)); }
public static double SqrLength(Cplx x) { return(x.a * x.a + x.b * x.b); }