public class Complex extends Object
Complex
class represents a complex number.
Complex numbers are immutable: their values cannot be changed after they
are created.
It includes methods for addition, subtraction, multiplication, division,
conjugation, and other common functions on complex numbers.
For additional documentation, see Section 9.9 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Constructor and Description 

Complex(double real,
double imag)
Initializes a complex number from the specified real and imaginary parts.

Modifier and Type  Method and Description 

double 
abs()
Returns the absolute value of this complex number.

Complex 
conjugate()
Returns the complex conjugate of this complex number.

Complex 
cos()
Returns the complex cosine of this complex number.

Complex 
divides(Complex that)
Returns the result of dividing the specified complex number into
this complex number.

Complex 
exp()
Returns the complex exponential of this complex number.

double 
im()
Returns the imaginary part of this complex number.

static void 
main(String[] args)
Unit tests the
Complex data type. 
Complex 
minus(Complex that)
Returns the result of subtracting the specified complex number from
this complex number.

double 
phase()
Returns the phase of this complex number.

Complex 
plus(Complex that)
Returns the sum of this complex number and the specified complex number.

double 
re()
Returns the real part of this complex number.

Complex 
reciprocal()
Returns the reciprocal of this complex number.

Complex 
scale(double alpha)
Returns the product of this complex number and the specified scalar.

Complex 
sin()
Returns the complex sine of this complex number.

Complex 
tan()
Returns the complex tangent of this complex number.

Complex 
times(Complex that)
Returns the product of this complex number and the specified complex number.

Complex 
times(double alpha)
Deprecated.
Replaced by
scale(double) . 
String 
toString()
Returns a string representation of this complex number.

public Complex(double real, double imag)
real
 the real partimag
 the imaginary partpublic String toString()
public double abs()
public double phase()
public Complex plus(Complex that)
that
 the other complex number(this + that)
public Complex minus(Complex that)
that
 the other complex number(this  that)
public Complex times(Complex that)
that
 the other complex number(this * that)
public Complex scale(double alpha)
alpha
 the scalar(alpha * this)
@Deprecated public Complex times(double alpha)
scale(double)
.alpha
 the scalar(alpha * this)
public Complex conjugate()
public Complex reciprocal()
(1 / this)
public double re()
public double im()
public Complex divides(Complex that)
that
 the other complex number(this / that)
public Complex exp()
public Complex sin()
public Complex cos()
public Complex tan()
public static void main(String[] args)
Complex
data type.args
 the commandline arguments