/** 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; }
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; }
public Complex log() { float phase = arg(); if (phase > Math.PI) phase -= 2.0f * Math.PI; return Complex.polar((float) Math.log(abs()), phase); }
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()))); }