ru.tunegov.mathematic
Class Complex

java.lang.Object
  |
  +--java.lang.Number
        |
        +--ru.tunegov.mathematic.Complex
All Implemented Interfaces:
java.lang.Cloneable, ElementSet, java.io.Serializable

public class Complex
extends java.lang.Number
implements ElementSet

This is a non-visual component that represents complex number. The given class realizes main operations above complex numbers.

Since:
Mathematic 1.0
See Also:
Serialized Form

Field Summary
static Complex I
          Imaginary unit
 
Constructor Summary
Complex()
          Construct a Complex object.
Complex(double real)
          Construct a Complex object.
Complex(double real, double image)
          Construct a Complex object.
Complex(java.lang.String s)
          Construct a Complex object.
 
Method Summary
 ElementSet abs()
          Returns the absolute value of the given element.
 ElementSet add(Complex arg)
          Returns the sum of the given element with argument (result = this + arg).
 ElementSet add(Decimal arg)
          Returns the sum of the given element with argument (result = this + arg).
 ElementSet add(double arg)
          Returns the sum of the given element with argument (result = this + arg).
 ElementSet add(ElementSet arg)
          Returns the sum of the given element with argument (result = this + arg).
 MatrixElementSet add(MatrixElementSet arg)
          Returns the sum of the given element with argument (result = this + arg).
 java.lang.Object clone()
          Returns clone of this object.
 Complex conjugate()
          Returns the conjugate of the given element.
 ElementSet cos()
          Returns the cosine of the given element.
 ElementSet divide(Complex arg)
          Returns the quotient of the given element with argument (result = this / arg).
 ElementSet divide(Decimal arg)
          Returns the quotient of the given element with argument (result = this / arg).
 ElementSet divide(double arg)
          Returns the quotient of the given element with argument (result = this / arg).
 ElementSet divide(ElementSet arg)
          Returns the quotient of the given element with argument (result = this / arg).
 MatrixElementSet divide(MatrixElementSet arg)
          Returns the quotient of the given element with argument (result = this / arg).
 ElementSet divideInverse(Complex arg)
          Returns the quotient of the argument with given element (result = arg / this).
 ElementSet divideInverse(Decimal arg)
          Returns the quotient of the argument with given element (result = arg / this).
 ElementSet divideInverse(double arg)
          Returns the quotient of the argument with given element (result = arg / this).
 MatrixElementSet divideInverse(MatrixElementSet arg)
          Returns the quotient of the argument with given element (result = arg / this).
 double doubleValue()
          Returns the value of the specified number as a double.
 boolean equals(java.lang.Object obj)
          Compares two Objects for equality.
 ElementSet exp()
          Returns the number e raised to the this power.
 float floatValue()
          Returns the value of the specified number as a float.
 double getArgument()
          Returns the argument of a complex number.
 double getImage()
          Returns the imaginary part of a complex number.
 double getModule()
          Returns the module of a complex number.
 double getReal()
          Returns the real part of a complex number.
 int intValue()
          Returns the value of the specified number as a int.
 ElementSet inverse()
          Returns the inverse value of the given element.
 ElementSet log()
          Returns the logarithm of the given element.
 long longValue()
          Returns the value of the specified number as a long.
 ElementSet multiply(Complex arg)
          Returns the product of the given element with argument (result = this * arg).
 ElementSet multiply(Decimal arg)
          Returns the product of the given element with argument (result = this * arg).
 ElementSet multiply(double arg)
          Returns the product of the given element with argument (result = this * arg).
 ElementSet multiply(ElementSet arg)
          Returns the product of the given element with argument (result = this * arg).
 MatrixElementSet multiply(MatrixElementSet arg)
          Returns the product of the given element with argument (result = this * arg).
 ElementSet negate()
          Returns the negative of this element.
 ElementSet pow(double degree)
          Returns the given element raised to n-th degree.
 ElementSet root(int degree)
          Returns the root of n-th degree of given element.
 void setImage(double image)
          Sets the imaginary part of a complex number.
 void setReal(double real)
          Sets the real part of a complex number.
 ElementSet sin()
          Returns the sine of the given element.
 ElementSet sqrt()
          Returns the square root of the given element.
 ElementSet subtract(Complex arg)
          Returns the difference of the given element with argument (result = this - arg).
 ElementSet subtract(Decimal arg)
          Returns the difference of the given element with argument (result = this - arg).
 ElementSet subtract(double arg)
          Returns the difference of the given element with argument (result = this - arg).
 ElementSet subtract(ElementSet arg)
          Returns the difference of the given element with argument (result = this - arg).
 MatrixElementSet subtract(MatrixElementSet arg)
          Returns the difference of the given element with argument (result = this - arg).
 ElementSet subtractInverse(Complex arg)
          Returns the difference of the argument with given element (result = arg - this).
 ElementSet subtractInverse(Decimal arg)
          Returns the difference of the argument with given element (result = arg - this).
 ElementSet subtractInverse(double arg)
          Returns the difference of the argument with given element (result = arg - this).
 MatrixElementSet subtractInverse(MatrixElementSet arg)
          Returns the difference of the argument with given element (result = arg - this).
 ElementSet tan()
          Returns the tangent of the given element.
 java.lang.String toFormattedString(java.text.DecimalFormat df)
          Returns formatted string representing the given element.
 java.lang.String toString()
          Returns a String that represents the value of this object.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

I

public static final Complex I
Imaginary unit
Constructor Detail

Complex

public Complex()
Construct a Complex object.

Complex

public Complex(double real)
Construct a Complex object.
Parameters:
real - Real part of a complex number

Complex

public Complex(double real,
               double image)
Construct a Complex object.
Parameters:
real - Real part of a complex number
image - Imaginary part of a complex number

Complex

public Complex(java.lang.String s)
Construct a Complex object.
Parameters:
s - The string representation of a complex number
Method Detail

abs

public ElementSet abs()
Returns the absolute value of the given element.
Specified by:
abs in interface ElementSet
Returns:
The absolute value of the given element

add

public ElementSet add(double arg)
Returns the sum of the given element with argument (result = this + arg).
Specified by:
add in interface ElementSet
Parameters:
arg - The second argument
Returns:
The sum of the given element with argument

add

public ElementSet add(Complex arg)
Returns the sum of the given element with argument (result = this + arg).
Specified by:
add in interface ElementSet
Parameters:
arg - The second argument
Returns:
The sum of the given element with argument

add

public ElementSet add(Decimal arg)
Returns the sum of the given element with argument (result = this + arg).
Specified by:
add in interface ElementSet
Parameters:
arg - The second argument
Returns:
The sum of the given element with argument

add

public ElementSet add(ElementSet arg)
Returns the sum of the given element with argument (result = this + arg).
Specified by:
add in interface ElementSet
Parameters:
arg - The second argument
Returns:
The sum of the given element with argument

add

public MatrixElementSet add(MatrixElementSet arg)
Returns the sum of the given element with argument (result = this + arg).
Specified by:
add in interface ElementSet
Parameters:
arg - The second argument
Returns:
The sum of the given element with argument

clone

public java.lang.Object clone()
Returns clone of this object.
Specified by:
clone in interface ElementSet
Returns:
clone of this object

conjugate

public Complex conjugate()
Returns the conjugate of the given element.
Returns:
The conjugate of the given element

cos

public ElementSet cos()
Returns the cosine of the given element.
Specified by:
cos in interface ElementSet
Returns:
the cosine of the given element

divide

public ElementSet divide(double arg)
Returns the quotient of the given element with argument (result = this / arg).
Specified by:
divide in interface ElementSet
Parameters:
arg - The second argument
Returns:
The quotient of the given element with argument

divide

public ElementSet divide(Complex arg)
Returns the quotient of the given element with argument (result = this / arg).
Specified by:
divide in interface ElementSet
Parameters:
arg - The second argument
Returns:
The quotient of the given element with argument

divide

public ElementSet divide(Decimal arg)
Returns the quotient of the given element with argument (result = this / arg).
Specified by:
divide in interface ElementSet
Parameters:
arg - The second argument
Returns:
The quotient of the given element with argument

divide

public ElementSet divide(ElementSet arg)
Returns the quotient of the given element with argument (result = this / arg).
Specified by:
divide in interface ElementSet
Parameters:
arg - The second argument
Returns:
The quotient of the given element with argument

divide

public MatrixElementSet divide(MatrixElementSet arg)
Returns the quotient of the given element with argument (result = this / arg).
Specified by:
divide in interface ElementSet
Parameters:
arg - The second argument
Returns:
The quotient of the given element with argument

divideInverse

public ElementSet divideInverse(double arg)
Returns the quotient of the argument with given element (result = arg / this).
Specified by:
divideInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The quotient of the argument with given element

divideInverse

public ElementSet divideInverse(Complex arg)
Returns the quotient of the argument with given element (result = arg / this).
Specified by:
divideInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The quotient of the argument with given element

divideInverse

public ElementSet divideInverse(Decimal arg)
Returns the quotient of the argument with given element (result = arg / this).
Specified by:
divideInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The quotient of the argument with given element

divideInverse

public MatrixElementSet divideInverse(MatrixElementSet arg)
Returns the quotient of the argument with given element (result = arg / this).
Specified by:
divideInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The quotient of the argument with given element

doubleValue

public double doubleValue()
Returns the value of the specified number as a double. This may involve rounding.
Overrides:
doubleValue in class java.lang.Number
Returns:
the numeric value represented by this object after conversion to type double.

equals

public boolean equals(java.lang.Object obj)
Compares two Objects for equality.
Overrides:
equals in class java.lang.Object
Parameters:
obj - The reference object with which to compare
Returns:
true if this object is the same as the obj argument; false otherwise.

exp

public ElementSet exp()
Returns the number e raised to the this power.
Specified by:
exp in interface ElementSet
Returns:
the number e raised to the this power

floatValue

public float floatValue()
Returns the value of the specified number as a float. This may involve rounding.
Overrides:
floatValue in class java.lang.Number
Returns:
the numeric value represented by this object after conversion to type float.

getArgument

public double getArgument()
Returns the argument of a complex number.
Returns:
The argument of a complex number

getImage

public double getImage()
Returns the imaginary part of a complex number.
Returns:
The imaginary part of a complex number

getModule

public double getModule()
Returns the module of a complex number.
Returns:
The module of a complex number

getReal

public double getReal()
Returns the real part of a complex number.
Returns:
The real part of a complex number

intValue

public int intValue()
Returns the value of the specified number as a int. This may involve rounding.
Overrides:
intValue in class java.lang.Number
Returns:
the numeric value represented by this object after conversion to type int.

inverse

public ElementSet inverse()
Returns the inverse value of the given element.
Specified by:
inverse in interface ElementSet
Returns:
The inverse value of the given element

log

public ElementSet log()
Returns the logarithm of the given element.
Specified by:
log in interface ElementSet
Returns:
the logarithm of the given element

longValue

public long longValue()
Returns the value of the specified number as a long. This may involve rounding.
Overrides:
longValue in class java.lang.Number
Returns:
the numeric value represented by this object after conversion to type long.

multiply

public ElementSet multiply(double arg)
Returns the product of the given element with argument (result = this * arg).
Specified by:
multiply in interface ElementSet
Parameters:
arg - The second argument
Returns:
The product of the given element with argument

multiply

public ElementSet multiply(Complex arg)
Returns the product of the given element with argument (result = this * arg).
Specified by:
multiply in interface ElementSet
Parameters:
arg - The second argument
Returns:
The product of the given element with argument

multiply

public ElementSet multiply(Decimal arg)
Returns the product of the given element with argument (result = this * arg).
Specified by:
multiply in interface ElementSet
Parameters:
arg - The second argument
Returns:
The product of the given element with argument

multiply

public ElementSet multiply(ElementSet arg)
Returns the product of the given element with argument (result = this * arg).
Specified by:
multiply in interface ElementSet
Parameters:
arg - The second argument
Returns:
The product of the given element with argument

multiply

public MatrixElementSet multiply(MatrixElementSet arg)
Returns the product of the given element with argument (result = this * arg).
Specified by:
multiply in interface ElementSet
Parameters:
arg - The second argument
Returns:
The product of the given element with argument

negate

public ElementSet negate()
Returns the negative of this element.
Specified by:
negate in interface ElementSet
Returns:
the negative of this element

pow

public ElementSet pow(double degree)
Returns the given element raised to n-th degree.
Specified by:
pow in interface ElementSet
Parameters:
degree - The degree of power
Returns:
The given element raised to n-th degree

root

public ElementSet root(int degree)
Returns the root of n-th degree of given element.
Specified by:
root in interface ElementSet
Parameters:
degree - The degree of root
Returns:
The root of n-th degree of the given element

setImage

public void setImage(double image)
Sets the imaginary part of a complex number.
Parameters:
image - The imaginary part of a complex number

setReal

public void setReal(double real)
Sets the real part of a complex number.
Parameters:
real - The real part of a complex number

sin

public ElementSet sin()
Returns the sine of the given element.
Specified by:
sin in interface ElementSet
Returns:
The sine of the given element

sqrt

public ElementSet sqrt()
Returns the square root of the given element.
Specified by:
sqrt in interface ElementSet
Returns:
The square root of the given element

subtract

public ElementSet subtract(double arg)
Returns the difference of the given element with argument (result = this - arg).
Specified by:
subtract in interface ElementSet
Parameters:
arg - The second argument
Returns:
The difference of the given element with argument

subtract

public ElementSet subtract(Complex arg)
Returns the difference of the given element with argument (result = this - arg).
Specified by:
subtract in interface ElementSet
Parameters:
arg - The second argument
Returns:
The difference of the given element with argument

subtract

public ElementSet subtract(Decimal arg)
Returns the difference of the given element with argument (result = this - arg).
Specified by:
subtract in interface ElementSet
Parameters:
arg - The second argument
Returns:
The difference of the given element with argument

subtract

public ElementSet subtract(ElementSet arg)
Returns the difference of the given element with argument (result = this - arg).
Specified by:
subtract in interface ElementSet
Parameters:
arg - The second argument
Returns:
The difference of the given element with argument

subtract

public MatrixElementSet subtract(MatrixElementSet arg)
Returns the difference of the given element with argument (result = this - arg).
Specified by:
subtract in interface ElementSet
Parameters:
arg - The second argument
Returns:
The difference of the given element with argument

subtractInverse

public ElementSet subtractInverse(double arg)
Returns the difference of the argument with given element (result = arg - this).
Specified by:
subtractInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The difference of the argument with given element

subtractInverse

public ElementSet subtractInverse(Complex arg)
Returns the difference of the argument with given element (result = arg - this).
Specified by:
subtractInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The difference of the argument with given element

subtractInverse

public ElementSet subtractInverse(Decimal arg)
Returns the difference of the argument with given element (result = arg - this).
Specified by:
subtractInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The difference of the argument with given element

subtractInverse

public MatrixElementSet subtractInverse(MatrixElementSet arg)
Returns the difference of the argument with given element (result = arg - this).
Specified by:
subtractInverse in interface ElementSet
Parameters:
arg - The first argument
Returns:
The difference of the argument with given element

tan

public ElementSet tan()
Returns the tangent of the given element.
Specified by:
tan in interface ElementSet
Returns:
The tangent of the given element

toFormattedString

public java.lang.String toFormattedString(java.text.DecimalFormat df)
Returns formatted string representing the given element.
Specified by:
toFormattedString in interface ElementSet
Parameters:
df - Formatter
Returns:
The formatted string representing the given element

toString

public java.lang.String toString()
Returns a String that represents the value of this object.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the receiver