示例#1
0
 /** Divide two complex numbers, in-place */
 public Complex divi(Complex c, Complex result) {
   float d = c.re * c.re + c.im * c.im;
   float newre = (re * c.re + im * c.im) / d;
   float newim = (im * c.re - re * c.im) / d;
   result.re = newre;
   result.im = newim;
   return result;
 }
示例#2
0
 public Complex divi(float v, Complex result) {
   if (this == result) {
     re /= v;
     im /= v;
   } else {
     result.re = re / v;
     result.im = im / v;
   }
   return this;
 }
示例#3
0
 public Complex log() {
   float phase = arg();
   if (phase > Math.PI) phase -= 2.0f * Math.PI;
   return Complex.polar((float) Math.log(abs()), phase);
 }
示例#4
0
 public Complex powi(Complex z) {
   double ex = Math.pow(Math.E, z.real());
   return new Complex((float) (ex * Math.cos(z.imag())), (float) (ex * Math.sin(z.imag())));
 }