List of usage examples for org.apache.commons.math.complex Complex conjugate
public Complex conjugate()
From source file:com.discursive.jccook.math.ComplexNumbers.java
public static void main(String[] args) { Complex a = new Complex(2, 3); Complex b = new Complex(4, 5); Complex c = new Complex(0.3, 2); Complex e = new Complex(4, 4); Complex sum = a.add(b);/*from ww w . j a v a 2 s.com*/ Complex d = c.divide(sum); Complex f = e.multiply(d.conjugate()); System.out.println("D is: " + ComplexFormat.formatComplex(d)); System.out.println("F is: " + ComplexFormat.formatComplex(f)); double realF = f.getReal(); double imD = d.getImaginary(); double answer = realF / imD; System.out.println("Answer: " + NumberFormat.getInstance().format(answer)); }
From source file:geogebra.common.kernel.geos.GeoVec2D.java
/** * c = conjugate(a) Michael Borcherds 2010-02-07 * // w w w . j ava 2 s . com * @param a * a * @param c * c */ final public static void complexConjugate(GeoVec2D a, GeoVec2D c) { Complex out = new Complex(a.x, a.y); out = out.conjugate(); c.x = out.getReal(); c.y = out.getImaginary(); c.setMode(Kernel.COORD_COMPLEX); }