List of usage examples for org.apache.commons.math3.complex Complex getImaginary
public double getImaginary()
From source file:uk.ac.diamond.scisoft.analysis.utils.Faddeeva.java
/** * Compute the Dawson function for a complex argument * /*from w w w .j av a2 s .c o m*/ * @param z * @param relerr * @return Dawson(z) = sqrt(pi)/2 * exp(-z^2) * erfi(z) */ public static Complex Dawson(Complex z, double relerr) { return C(Dawson_i(C(z.getReal(), z.getImaginary()), relerr)); }
From source file:uk.ac.diamond.scisoft.analysis.utils.Faddeeva.java
/** * Compute the Faddeeva or scaled complementary error function * @param z// w w w. j a v a2 s . co m * @param relerr * @return w(z) = exp(-z^2) erfc(-iz) */ public static Complex w(Complex z, double relerr) { return C(w_i(C(z.getReal(), z.getImaginary()), relerr)); }
From source file:uk.ac.diamond.scisoft.analysis.utils.FaddeevaTest.java
private static final double cimag(Complex z) { return z.getImaginary(); }
From source file:uk.me.berndporr.iirj.Biquad.java
public void setTwoPole(Complex pole1, Complex zero1, Complex pole2, Complex zero2) { double a0 = 1; double a1;// w w w. jav a 2 s . c om double a2; if (pole1.getImaginary() != 0) { a1 = -2 * pole1.getReal(); a2 = pole1.abs() * pole1.abs(); } else { a1 = -(pole1.getReal() + pole2.getReal()); a2 = pole1.getReal() * pole2.getReal(); } double b0 = 1; double b1; double b2; if (zero1.getImaginary() != 0) { b1 = -2 * zero1.getReal(); b2 = zero1.abs() * zero1.abs(); } else { b1 = -(zero1.getReal() + zero2.getReal()); b2 = zero1.getReal() * zero2.getReal(); } setCoefficients(a0, a1, a2, b0, b1, b2); }
From source file:uk.me.berndporr.iirj.MathSupplement.java
public static Complex adjust_imag(Complex c) { if (Math.abs(c.getImaginary()) < 1e-30) return new Complex(c.getReal(), 0); else/*from w ww . j ava 2 s . c o m*/ return c; }
From source file:uk.me.berndporr.iirj.MathSupplement.java
public static Complex addmul(Complex c, double v, Complex c1) { return new Complex(c.getReal() + v * c1.getReal(), c.getImaginary() + v * c1.getImaginary()); }
From source file:uk.me.berndporr.iirj.MathSupplement.java
public static Complex recip(Complex c) { double n = 1.0 / (c.abs() * c.abs()); return new Complex(n * c.getReal(), n * c.getImaginary()); }