Example #1
0
 /**
  * <p>
  * Converts a complex number into polar notation.
  * </p>
  *
  * @param input Standard notation
  * @param output Polar notation
  */
 public static void convert(Complex_F32 input, ComplexPolar_F32 output)
 {
     output.r     = input.getMagnitude();
     output.theta = (float)Math.Atan2(input.imaginary, input.real);
 }
Example #2
0
 /**
  * Computes the N<sup>th</sup> root of a complex number in polar notation.  There are
  * N distinct N<sup>th</sup> roots.
  *
  * @param a Complex number
  * @param N The root's magnitude
  * @param k Specifies which root.  0 &le; k &lt; N
  * @param result Computed root
  */
 public static void root(ComplexPolar_F32 a, int N, int k, ComplexPolar_F32 result)
 {
     result.r     = (float)Math.Pow(a.r, 1.0f / N);
     result.theta = (a.theta + 2.0f * k * UtilEjml.F_PI) / N;
 }
Example #3
0
 /**
  * Computes the power of a complex number in polar notation
  *
  * @param a Complex number
  * @param N Power it is to be multiplied by
  * @param result Result
  */
 public static void pow(ComplexPolar_F32 a, int N, ComplexPolar_F32 result)
 {
     result.r     = (float)Math.Pow(a.r, N);
     result.theta = N * a.theta;
 }
Example #4
0
 /**
  * Division in polar notation.
  *
  * @param a Complex number in polar notation. Not modified.
  * @param b Complex number in polar notation. Not modified.
  * @param result Storage for output.
  */
 public static void divide(ComplexPolar_F32 a, ComplexPolar_F32 b, ComplexPolar_F32 result)
 {
     result.r     = a.r / b.r;
     result.theta = a.theta - b.theta;
 }
Example #5
0
 /**
  * Division in polar notation.
  *
  * @param a Complex number in polar notation. Not modified.
  * @param b Complex number in polar notation. Not modified.
  * @param result Storage for output.
  */
 public static void multiply(ComplexPolar_F32 a, ComplexPolar_F32 b, ComplexPolar_F32 result)
 {
     result.r     = a.r * b.r;
     result.theta = a.theta + b.theta;
 }
Example #6
0
 /**
  * <p>
  * Converts a complex number in polar notation into standard notation.
  * </p>
  *
  * @param input Standard notation
  * @param output Polar notation
  */
 public static void convert(ComplexPolar_F32 input, Complex_F32 output)
 {
     output.real      = input.r * (float)Math.Cos(input.theta);
     output.imaginary = input.r * (float)Math.Sin(input.theta);
 }