Class VisualNumerics.math.Complex
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class VisualNumerics.math.Complex

java.lang.Object
   |
   +----VisualNumerics.math.Complex

public class Complex
extends Object
This class implements complex numbers. It provides the basic operations (addition, subtraction, multiplication, division) as well as a set of complex functions.

Variable Index

 o im
Imaginary part of the Complex.
 o INFINITY
Complex infinity.
 o re
Real part of the Complex.
 o suffix
String used in converting Complex to String.

Constructor Index

 o Complex()
Construct a Complex equal to zero.
 o Complex(Complex)
Construct a Complex equal to the argument.
 o Complex(double)
Construct a Complex with a zero imaginary part.
 o Complex(double, double)
Construct a Complex with real and imaginary parts given by the input arguments.

Method Index

 o abs(Complex)
Returns the absolute value (modulus) of a Complex, |z|.
 o acos(Complex)
Returns the inverse cosine (arc cosine) of a Complex.
 o add(Complex)
Adds a Complex and returns the sum, this += y.
 o add(Complex, Complex)
Returns the sum of two Complex's, x+y.
 o add(Complex, double)
Returns the sum of a Complex and a double, x+y.
 o add(double)
Adds a double and returns the sum, this += y.
 o add(double, Complex)
Returns the sum of a double and a Complex, x+y.
 o argument(Complex)
Returns the argument (phase) of a Complex, in radians.
 o asin(Complex)
 o conjugate(Complex)
Returns the complex conjugate of a Complex.
 o cos(Complex)
Returns the cosine of a Complex.
 o divide(Complex)
Divides by a Complex and returns the result, this /= y.
 o divide(Complex, Complex)
Returns Complex x divided by Complex y, x/y.
 o divide(Complex, double)
Returns a Complex divided by a double, x/y.
 o divide(double)
Divides by a double and returns the result, this /= y.
 o equals(Complex)
Compares this Complex with another.
 o equals(Object)
Compares this object against the specified object.
 o exp(Complex)
Returns the exponential of a Complex z, exp(z).
 o isInfinite(Complex)
Returns true if either component is an infinite value.
 o isNaN(Complex)
Returns true if either component is a Not-a-Number (NaN) value.
 o log(Complex)
Returns the logarithm of a Complex z, log(z).
 o multiply(Complex)
Multiplies by a Complex and returns the product, this *= y.
 o multiply(Complex, Complex)
Returns the product of two Complexs, x*y.
 o multiply(Complex, double)
Returns the product of a Complex and a double, x*y.
 o multiply(double)
Multiplies by a double and returns the product, this *= y.
 o multiply(double, Complex)
Returns the product of a double and a Complex, x*y.
 o negate(Complex)
Returns the negative of a Complex, -z.
 o pow(Complex, Complex)
Returns the Complex x raised to the Complex y power.
 o pow(Complex, double)
Returns the Complex z raised to the x power.
 o sin(Complex)
Returns the sine of a Complex.
 o sqrt(Complex)
Returns the square root of a Complex.
 o subtract(Complex)
Subtracts a Complex and returns the difference, this -= y.
 o subtract(Complex, Complex)
Returns the difference of two Complexes, x-y.
 o subtract(Complex, double)
Returns the difference of a Complex and a double, x-y.
 o subtract(double)
Subtracts a double and returns the difference, this -= y.
 o subtract(double, Complex)
Returns the difference of a double and a Complex, x-y.
 o tan(Complex)
 o toString()
Returns a String representation for the specified Complex.

Variables

 o INFINITY
  public final static Complex INFINITY
Complex infinity.
 o re
  public double re
Real part of the Complex.
 o im
  public double im
Imaginary part of the Complex.
 o suffix
  public static String suffix
String used in converting Complex to String. Default is "i", but sometimes "j" is desired. Note that this is set for the class, not for a particular instance of a Complex.

Constructors

 o Complex
  public Complex(Complex z)
Construct a Complex equal to the argument.
Parameters:
z - A Complex object.
 o Complex
  public Complex(double re,
                 double im)
Construct a Complex with real and imaginary parts given by the input arguments.
Parameters:
re - A double value equal to the real part of the Complex object.
im - A double value equal to the imaginary part of the Complex object.
 o Complex
  public Complex(double re)
Construct a Complex with a zero imaginary part.
Parameters:
re - A double value equal to the real part of the Complex object.
 o Complex
  public Complex()
Construct a Complex equal to zero.

Methods

 o toString
  public String toString()
Returns a String representation for the specified Complex.
Returns:
A String representation for this object.
Overrides:
toString in class Object
 o isNaN
  public static boolean isNaN(Complex z)
Returns true if either component is a Not-a-Number (NaN) value.
Parameters:
z - A Complex object.
Returns:
True if either component of the Complex object is NaN; false, otherwise.
 o isInfinite
  public static boolean isInfinite(Complex z)
Returns true if either component is an infinite value.
Parameters:
z - A Complex object.
Returns:
True if either component of the Complex object is NaN; false, otherwise.
 o equals
  public boolean equals(Complex z)
Compares this Complex with another.
Parameters:
z - A Complex object.
Returns:
True if the real and imaginary parts of this object are equal to their counterparts in the argument; false, otherwise.
 o equals
  public boolean equals(Object obj)
Compares this object against the specified object.

Note: To be useful in hashtables this method considers two NaN double values to be equal. This is not according to IEEE specification

Parameters:
obj - the object to compare with
Returns:
True if the objects are the same; false otherwise.
Overrides:
equals in class Object
 o negate
  public static Complex negate(Complex z)
Returns the negative of a Complex, -z.
Parameters:
z - A Complex object.
Returns:
A Complex object equal to the negative of the argument.
 o conjugate
  public static Complex conjugate(Complex z)
Returns the complex conjugate of a Complex.
Parameters:
z - A Complex object.
Returns:
The complex conjugate of the argument.
 o add
  public static Complex add(Complex x,
                            Complex y)
Returns the sum of two Complex's, x+y.
Parameters:
x - A Complex object.
y - A Complex object.
Returns:
The sum of the arguments.
 o add
  public static Complex add(double x,
                            Complex y)
Returns the sum of a double and a Complex, x+y.
Parameters:
x - A double value.
y - A Complex object.
Returns:
A Complex object equal to the sum of the arguments.
 o add
  public static Complex add(Complex x,
                            double y)
Returns the sum of a Complex and a double, x+y.
Parameters:
x - A Complex object.
y - A double value.
Returns:
A Complex object equal to the sum of the arguments.
 o add
  public Complex add(Complex y)
Adds a Complex and returns the sum, this += y.
Parameters:
y - A Complex object.
Returns:
This object augmented by the argument.
 o add
  public Complex add(double y)
Adds a double and returns the sum, this += y.
Parameters:
y - A double value.
Returns:
This object augmented by the argument.
 o subtract
  public static Complex subtract(Complex x,
                                 Complex y)
Returns the difference of two Complexes, x-y.
Parameters:
x - A Complex object.
y - A Complex object.
Returns:
The difference between the input arguments.
 o subtract
  public static Complex subtract(double x,
                                 Complex y)
Returns the difference of a double and a Complex, x-y.
Parameters:
x - A double value.
y - A Complex object.
Returns:
The difference between the input arguments.
 o subtract
  public static Complex subtract(Complex x,
                                 double y)
Returns the difference of a Complex and a double, x-y.
Parameters:
x - A Complex object.
y - A double value.
Returns:
A Complex object equal to the difference between the arguments.
 o subtract
  public Complex subtract(Complex y)
Subtracts a Complex and returns the difference, this -= y.
Parameters:
y - A Complex object.
Returns:
This object less the input argument.
 o subtract
  public Complex subtract(double y)
Subtracts a double and returns the difference, this -= y.
Parameters:
y - A double value.
Returns:
This object less the input argument.
 o multiply
  public static Complex multiply(double x,
                                 Complex y)
Returns the product of a double and a Complex, x*y.
Parameters:
x - A double value.
y - A Complex object.
Returns:
The product of the arguments.
 o multiply
  public static Complex multiply(Complex x,
                                 double y)
Returns the product of a Complex and a double, x*y.
Parameters:
x - A Complex object.
y - A double value.
Returns:
The product of the arguments.
 o multiply
  public Complex multiply(double y)
Multiplies by a double and returns the product, this *= y.
Parameters:
y - A double value.
Returns:
This object multiplied by the input argument.
 o multiply
  public static Complex multiply(Complex x,
                                 Complex y)
Returns the product of two Complexs, x*y.
Parameters:
x - A Complex object.
y - A Complex object.
Returns:
The product of the input arguments.
 o multiply
  public Complex multiply(Complex y)
Multiplies by a Complex and returns the product, this *= y.
Parameters:
y - A Complex object.
Returns:
This object multiplied by the input argument.
 o divide
  public static Complex divide(Complex x,
                               double y)
Returns a Complex divided by a double, x/y.
Parameters:
x - A Complex object.
y - A double value.
Returns:
The quotient of the input arguments.
 o divide
  public Complex divide(double y)
Divides by a double and returns the result, this /= y.
Parameters:
y - A double value.
Returns:
This object divided by the input argument.
 o divide
  public static Complex divide(Complex x,
                               Complex y)
Returns Complex x divided by Complex y, x/y.
Parameters:
x - A Complex object.
y - A Complex object.
Returns:
The quotient of the input arguments.
 o divide
  public Complex divide(Complex y)
Divides by a Complex and returns the result, this /= y.
Parameters:
y - A Complex object.
Returns:
This object divided by the input argument.
 o abs
  public static double abs(Complex z)
Returns the absolute value (modulus) of a Complex, |z|.
Parameters:
z - A Complex object.
Returns:
A double value equal to the absolute value of the argument.
 o argument
  public static double argument(Complex z)
Returns the argument (phase) of a Complex, in radians.
Parameters:
z - A Complex object.
Returns:
A double value equal to the argument or phase of a Complex.
 o sqrt
  public static Complex sqrt(Complex z)
Returns the square root of a Complex.
Parameters:
z - A Complex object.
Returns:
The square root of the input argument.
 o exp
  public static Complex exp(Complex z)
Returns the exponential of a Complex z, exp(z).
Parameters:
z - A Complex object.
Returns:
The exponential of the argument.
 o log
  public static Complex log(Complex z)
Returns the logarithm of a Complex z, log(z).
Parameters:
z - A Complex object.
Returns:
The logarithm of the argument.
 o sin
  public static Complex sin(Complex z)
Returns the sine of a Complex.
Parameters:
z - A Complex object.
Returns:
The sine of the argument.
 o cos
  public static Complex cos(Complex z)
Returns the cosine of a Complex.
Parameters:
z - A Complex object.
Returns:
The cosine of the argument.
 o tan
  public static Complex tan(Complex z)
 o asin
  public static Complex asin(Complex zinp)
 o acos
  public static Complex acos(Complex z)
Returns the inverse cosine (arc cosine) of a Complex.
Parameters:
z - A Complex object.
Returns:
The inverse cosine of the argument.
 o pow
  public static Complex pow(Complex z,
                            double x)
Returns the Complex z raised to the x power.
Parameters:
z - A Complex object.
x - A double value.
Returns:
A Complex object equal to zx.
 o pow
  public static Complex pow(Complex x,
                            Complex y)
Returns the Complex x raised to the Complex y power.
Parameters:
x - A Complex object.
y - A Complex object.
Returns:
A Complex object equal to xy.

All Packages  Class Hierarchy  This Package  Previous  Next  Index