Java has no builtin support for complex numbers. To add or subtract two complex numbers you just add or subtract the corresponding real and imaginary parts.
// subtracting two complex numbers:
(a + ib)  (c + id) = (ab) + i(bd)
// multiplying two complex numbers:
(a + ib) * (c + id) = (ac  bd) + i(bc + ad)
// dividing two complex numbers:
(a + ib) / (c + id) = ((ac + bd) + i(bc  ad)) / (c² + d²)
// or in practice:
double bottom = 1.d / (c*c + d*d);
double real = (ac + bd) *
bottom;
double imaginary = (bc  ad)
* bottom;
This page is posted 
http://mindprod.com/jgloss/complex.html  
Optional Replicator mirror

J:\mindprod\jgloss\complex.html  
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission.  
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[54.227.48.147] 
 
Feedback 
You are visitor number  