org.cts.util
Class Complex

java.lang.Object
  extended by java.lang.Number
      extended by org.cts.util.Complex
All Implemented Interfaces:
Serializable

public final class Complex
extends Number

Complex number, arithmetics, and complex functions.

See Also:
taken from Hehl author hehl@tfh-berlin.de version 17-May-2005, Serialized Form

Field Summary
static Complex i
          Complex unit i.
static Complex ONE
           
 
Constructor Summary
Complex()
          Constructs complex number zero.
Complex(Complex z)
          Copy the complex number in parameter.
Complex(double re)
          Constructs a complex number with imaginary part zero.
Complex(double re, double im)
          Constructs a complex number from real part and imaginary part.
 
Method Summary
 double arg()
          Returns the argument of this complex number.
static Complex asin(Complex z)
          Computes complex arcsine.
static Complex atan(Complex z)
          Computes complex arctangent.
static Complex atanh(Complex z)
          Computes complex arctangent.
static double atanh(double x)
          Computes hyperbolic arctangent of a double using complex arithmetic.
 Complex axpb(Complex a, Complex b)
          Computes linear combination 'a times x plus b'.
 Complex axpb(double a, double b)
          Computes linear combination 'a times x plus b'.
 Complex conj()
          Returns the conjugate complex number.
static Complex cos(Complex z)
          Computes complex cosine.
static Complex cosh(Complex z)
          Computes hyperbolic cosine.
static Complex createComplexFromA(double phi)
          Returns a complex number with magnitude one and arbitrary argument.
static Complex createComplexFromRA(double radius, double phi)
          Returns a complex number from radius/magnitude and argument.
 Complex divideBy(Complex z)
          Computes fraction between this and the complex number z.
 double doubleValue()
           
 boolean equals(Object obj)
          Returns true if the object in parameter is equals to this.
static Complex exp(Complex z)
          Computes complex exponential.
 float floatValue()
           
 int hashcode()
           
 int hashCode()
          Returns the hash code for this Complex.
 double im()
          Returns the imaginary part of the complex number.
 int intValue()
           
 boolean isReal()
          Return true, if imaginary part of complex number is (numerically) zero.
static Complex ln(Complex z)
          Computes complex natural logarithm.
 long longValue()
           
 double mag()
          Return magnitude of complex number.
 Complex minus(Complex z)
          Provides difference of this and right hand side.
 Complex minus(double x)
          Provides difference of this and a real number.
 Complex plus(Complex z)
          Provides sum of this and right hand side.
 Complex plus(double x)
          Provides sum of this and a real number.
static Complex pow(Complex z)
          Computes complex power.
 double re()
          Returns the real part of the complex number.
static Complex sin(Complex z)
          Computes complex sine.
static Complex sinh(Complex z)
          Computes hyperbolic sine.
static Complex sqrt(Complex z)
          Computes complex square root.
static Complex tan(Complex z)
          Computes complex tangent.
static Complex tanh(Complex z)
          Computes hyperbolic tangent.
static double tanh(double x)
          Computes hyperbolic tangent of a double using complex arithmetic.
 Complex times(Complex z)
          Provides product of this and complex right hand side.
 Complex times(double x)
          Provides product of this and float right hand side.
 String toString()
          Returns string representation of this.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

i

public static final Complex i
Complex unit i. It holds i*i = -1.


ONE

public static final Complex ONE
Constructor Detail

Complex

public Complex(double re,
               double im)
Constructs a complex number from real part and imaginary part.

Parameters:
re - real part
im - imaginary part

Complex

public Complex()
Constructs complex number zero.


Complex

public Complex(double re)
Constructs a complex number with imaginary part zero.

Parameters:
re - real part

Complex

public Complex(Complex z)
Copy the complex number in parameter.

Parameters:
z - complex number
Method Detail

createComplexFromA

public static Complex createComplexFromA(double phi)
Returns a complex number with magnitude one and arbitrary argument.

Parameters:
phi - argument

createComplexFromRA

public static Complex createComplexFromRA(double radius,
                                          double phi)
Returns a complex number from radius/magnitude and argument.

Parameters:
radius - radius
phi - argument

equals

public boolean equals(Object obj)
Returns true if the object in parameter is equals to this.

Overrides:
equals in class Object
Parameters:
obj -

hashCode

public int hashCode()
Returns the hash code for this Complex.

Overrides:
hashCode in class Object

hashcode

public int hashcode()

re

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


im

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


conj

public Complex conj()
Returns the conjugate complex number.


isReal

public boolean isReal()
Return true, if imaginary part of complex number is (numerically) zero. [MM] : for geodetic calculations, a value strictly lesser than 1.E-12 can be considered as null


mag

public double mag()
Return magnitude of complex number.


doubleValue

public double doubleValue()
Specified by:
doubleValue in class Number

floatValue

public float floatValue()
Specified by:
floatValue in class Number

longValue

public long longValue()
Specified by:
longValue in class Number

intValue

public int intValue()
Specified by:
intValue in class Number

arg

public double arg()
Returns the argument of this complex number.


plus

public Complex plus(Complex z)
Provides sum of this and right hand side.

Parameters:
z - right hand side
Returns:
sum of this and z

plus

public Complex plus(double x)
Provides sum of this and a real number.

Parameters:
x - the real number to add
Returns:
sum of this and x

minus

public Complex minus(Complex z)
Provides difference of this and right hand side.

Parameters:
z - right hand side
Returns:
difference of this and z

minus

public Complex minus(double x)
Provides difference of this and a real number.

Parameters:
x - the real number
Returns:
difference of this and x

times

public Complex times(Complex z)
Provides product of this and complex right hand side.

Parameters:
z - right hand side
Returns:
product of this and z

times

public Complex times(double x)
Provides product of this and float right hand side.

Parameters:
x - right hand side
Returns:
product of this and z

divideBy

public Complex divideBy(Complex z)
                 throws ArithmeticException
Computes fraction between this and the complex number z.

Parameters:
z - complex right hand side
Returns:
fraction of this and z
Throws:
ArithmeticException - if mag(z) == 0

axpb

public Complex axpb(double a,
                    double b)
Computes linear combination 'a times x plus b'.

Parameters:
a - real factor
b - real number
Returns:
a times this plus b

axpb

public Complex axpb(Complex a,
                    Complex b)
Computes linear combination 'a times x plus b'.

Parameters:
a - complex factor
b - complex number
Returns:
a times this plus b

sin

public static Complex sin(Complex z)
Computes complex sine.

Parameters:
z - complex argument
Returns:
complexer sine

cos

public static Complex cos(Complex z)
Computes complex cosine.

Parameters:
z - complex argument
Returns:
complexer cosine

tan

public static Complex tan(Complex z)
Computes complex tangent.

Parameters:
z - complex argument
Returns:
complex cosine

pow

public static Complex pow(Complex z)
Computes complex power.

Parameters:
z - complex argument
Returns:
complex power

sinh

public static Complex sinh(Complex z)
Computes hyperbolic sine.

Parameters:
z - complex argument
Returns:
hyperbolic sine

cosh

public static Complex cosh(Complex z)
Computes hyperbolic cosine.

Parameters:
z - complex argument
Returns:
hyperbolic cosine

tanh

public static Complex tanh(Complex z)
                    throws ArithmeticException
Computes hyperbolic tangent.

Parameters:
z - complex argument
Returns:
hyperbolic tangent
Throws:
ArithmeticException

tanh

public static double tanh(double x)
                   throws ArithmeticException
Computes hyperbolic tangent of a double using complex arithmetic.

Parameters:
x - double argument
Returns:
hyperbolic tangent
Throws:
ArithmeticException

atan

public static Complex atan(Complex z)
                    throws ArithmeticException
Computes complex arctangent.

Parameters:
z - complex argument
Returns:
complex arctangent
Throws:
ArithmeticException

exp

public static Complex exp(Complex z)
Computes complex exponential.

Parameters:
z - complex argument
Returns:
complex exponential

ln

public static Complex ln(Complex z)
Computes complex natural logarithm.

Parameters:
z - complex argument
Returns:
complex logarithm

sqrt

public static Complex sqrt(Complex z)
Computes complex square root.

Parameters:
z - complex argument
Returns:
complex square root

asin

public static Complex asin(Complex z)
Computes complex arcsine.

Parameters:
z - complex argument
Returns:
complex arcsine

atanh

public static Complex atanh(Complex z)
                     throws ArithmeticException
Computes complex arctangent.

Parameters:
z - complex argument
Returns:
complex arctangent
Throws:
ArithmeticException

atanh

public static double atanh(double x)
                    throws ArithmeticException
Computes hyperbolic arctangent of a double using complex arithmetic.

Parameters:
x - complex argument
Returns:
complex arctangent
Throws:
ArithmeticException

toString

public String toString()
Returns string representation of this.

Overrides:
toString in class Object


Copyright © 2014 IRSTV CNRS-FR-2488. All Rights Reserved.