Orbital library

## orbital.math Interface Complex

All Superinterfaces:
Arithmetic, Normed, Scalar
All Known Subinterfaces:
Integer, Rational, Real

`public interface Complexextends Scalar`

Representation of a complex number a + i*b∈C.

Complex numbers are a field that is a superset of RC. They are isomorph to a special polynomial ring, CR[i] / (i2 = -1) = R[X] / (X2+1).

Since complex numbers are a field, they are also an `Euclidean ring`. However, because fields are (in a way) "degenerate" Euclidean rings, they do not extend the `Euclidean` interface. The Euclidean quotient and remainder operations would not perform very interesting calculations, and the Euclidean quotient would fully coincide with ordinary division in a field.

Complex numbers are not like real numbers. They are not ordered.

Author:
André Platzer
See Also:
`ValueFactory.complex(Real, Real)`, `ValueFactory.complex(double, double)`, `ValueFactory.cartesian(Real, Real)`, `ValueFactory.cartesian(double, double)`, `ValueFactory.polar(Real, Real)`, `ValueFactory.polar(double, double)`
Invariants:
(¬super ∧ ¬(this is Comparable)) ∨ abnormal(¬ Comparable)
Stereotype:
data-type

Field Summary
`static Predicate` `hasType`
Checks whether the given number is a proper complex, i.e.
`static Predicate` `isa`
Checks whether the given number is in the set of complex numbers.

Fields inherited from interface orbital.math.Arithmetic
`numerical`

Method Summary
` Complex` `add(Complex b)`
adds two Complexes returning a third as a result
` Real` `arg()`
Returns the principal angle (argument) component of a polar complex.
` Complex` `conjugate()`
Returns the complex conjugated z = z* = z'.
` Complex` `divide(Complex b)`
divides two complex numbers.
` boolean` `equals(java.lang.Object o)`
Compares two complex numbers for equality.
` int` `hashCode()`
Returns a hash code value for the object.
` Real` `im()`
Get the imaginar component.
` boolean` `isInfinite()`
Whether this complex number is infinite.
` boolean` `isNaN()`
Whether this complex number is NaN.
` Complex` `multiply(Complex b)`
multiplies two Complexes returning a third as a result
` Real` `norm()`
Returns the absolute |z|.
` Complex` `power(Complex x)`
power of complex numbers.
` Real` `re()`
Get the real component.
` Complex` `subtract(Complex b)`
subtracts two Complexes returning a third as a result

Methods inherited from interface orbital.math.Arithmetic
`add, divide, equals, inverse, isOne, isZero, minus, multiply, one, power, scale, subtract, toString, valueFactory, zero`

Field Detail

### isa

`static final Predicate isa`
Checks whether the given number is in the set of complex numbers. return whether v is complex, real, rational or an integer.

### hasType

`static final Predicate hasType`
Checks whether the given number is a proper complex, i.e. it is in the set of complexes and not a subset. return whether v∈C\R is complex, but not real.

Method Detail

### equals

`boolean equals(java.lang.Object o)`
Compares two complex numbers for equality.

Two complex numbers z, z' ∈ C are equal iff re z = re z' ∧ im z = im z'. This is a component-wise equality.

Overrides:
`equals` in class `java.lang.Object`
Preconditions:
true
Postconditions:
RES ⇔ Complex.isa(o) ∧ re() = o.re() ∧ im() = o.im()

### hashCode

`int hashCode()`
Returns a hash code value for the object.

Overrides:
`hashCode` in class `java.lang.Object`
Preconditions:
true
Postconditions:
RES == re().hashCode() ^ im().hashCode()

### re

`Real re()`
Get the real component.

Returns:
ℜ(z) = re z = re (a + ib) = a = (z+z) / 2
See Also:
`im()`

### im

`Real im()`
Get the imaginar component.

Returns:
ℑ(z) = im z = im (a + ib) = b = (z-z) / (2i)
See Also:
`re()`

### norm

`Real norm()`
Returns the absolute |z|.

It is |z|2 = z*z = re(z)2+im(z)2. and |x*y| = |x|*|y|, |z-1| = |z|-1.

Also called length, magnitude or modulus.

Specified by:
`norm` in interface `Normed`
Returns:
the absolute |z| = √re(z)2+im(z)2.
See Also:
`arg()`

### arg

`Real arg()`
Returns the principal angle (argument) component of a polar complex. But adding 2kπ to the principle angle will be an angle as well.

Returns:
the angle φ of r*eiφ. The angle ∠ φ in radians is measured counter-clockwise from the real axis. Value will be in range [-π,π] and is not yet in the correct sector!
See Also:
`norm()`

### conjugate

`Complex conjugate()`
Returns the complex conjugated z = z* = z'.

Conjugation is an involutive field-automorphism that is identical on R.

Returns:
the complex number a - i*b.

### isInfinite

`boolean isInfinite()`
Whether this complex number is infinite.

Returns:
whether the real or imaginary part is infinite.
See Also:
`Double.isInfinite(double)`

### isNaN

`boolean isNaN()`
Whether this complex number is NaN.

Returns:
whether the real or imaginary part is NaN.
See Also:
`Double.isNaN(double)`

### add

`Complex add(Complex b)`
adds two Complexes returning a third as a result

### subtract

`Complex subtract(Complex b)`
subtracts two Complexes returning a third as a result

### multiply

`Complex multiply(Complex b)`
multiplies two Complexes returning a third as a result

### divide

`Complex divide(Complex b)`
divides two complex numbers.

### power

`Complex power(Complex x)`
power of complex numbers.

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.