FileDocCategorySizeDatePackage
ComplexNumbers.javaAPI DocExample1629Wed May 18 09:39:00 BST 2005com.discursive.jccook.math

ComplexNumbers

public class ComplexNumbers extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.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 );
		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 ) );