The Complex
class is used to represent and operate on complex numbers. Internally, a complex number is represented as two double precision floating point numbers (Double). Externally, two forms are supported:
a+bi = 2.1+3.2i via: Complex ("2.1+3.2i"), 'toString'
(a, b) = (2.1, 3.2) via: create ("(2.1, 3.2)"), 'toString2'
Note: 'i * i = -1'.
Value parameters
- im
-
the imaginary part (e.g., 3.2)
- re
-
the real part (e.g., 2.1)
Attributes
- Companion
- object
- Graph
-
- Supertypes
Members list
Type members
Inherited classlikes
Attributes
- Inherited from:
- Fractional
- Supertypes
Attributes
- Inherited from:
- Numeric
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Inherited from:
- Ordering
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Multiply two complex numbers.
Multiply two complex numbers.
Value parameters
- c
-
multiply 'this' times c
Attributes
Add two complex numbers.
Add two complex numbers.
Value parameters
- c
-
add complex c to this
Attributes
Subtract two complex numbers.
Subtract two complex numbers.
Value parameters
- c
-
subtract c from this
Attributes
Divide two complex numbers.
Divide two complex numbers.
Value parameters
- c
-
divide this by c
Attributes
Return whether two complex numbers are nearly equal.
Return whether two complex numbers are nearly equal.
Value parameters
- c
-
compare this with c
Attributes
Return the absolute value of 'this' complex number.
Return the absolute value of 'this' complex number.
Attributes
Return the angle of the complex number as a vector in the 're'-'im' plane.
Return the angle of the complex number as a vector in the 're'-'im' plane.
Attributes
Return the complex conjugate: if z = (a + bi) then z.bar = (a - bi).
Return the complex conjugate: if z = (a + bi) then z.bar = (a - bi).
Attributes
Compare two complex numbers (negative for <, zero for ==, positive for >).
Compare two complex numbers (negative for <, zero for ==, positive for >).
Value parameters
- c
-
the first complex number to compare
- d
-
the second complex number to compare
Attributes
Compare 'this' complex number with that complex number 'd'.
Compare 'this' complex number with that complex number 'd'.
Value parameters
- d
-
that complex number
Attributes
Override equals to determine whether 'this' complex number equals complex 'c'.
Override equals to determine whether 'this' complex number equals complex 'c'.
Value parameters
- c
-
the complex number to compare with this
Attributes
- Definition Classes
-
Equals -> Comparator -> Any
Create a complex number from a Double
.
Create a complex number from a Double
.
Value parameters
- x
-
the double used to create the complex number
Attributes
Create a complex number from an Int
.
Create a complex number from an Int
.
Value parameters
- n
-
the integer used to create the complex number
Attributes
Create a complex number from a Long
.
Create a complex number from a Long
.
Value parameters
- n
-
the long used to create the complex number
Attributes
Must also override hashCode to be be compatible with equals.
Must also override hashCode to be be compatible with equals.
Attributes
- Definition Classes
-
Any
Determine whether 'this' is within the given bounds
Determine whether 'this' is within the given bounds
Value parameters
- lim
-
the given (lower, upper) bounds
Attributes
Determine whether 'this' is in the given set.
Determine whether 'this' is in the given set.
Value parameters
- lim
-
the given set of values
Attributes
Determine whether 'this' complex number is purely imaginary (no real part).
Determine whether 'this' complex number is purely imaginary (no real part).
Attributes
Determine whether 'this' number "is Infinite".
Determine whether 'this' number "is Infinite".
Attributes
Determine whether 'this' number "is Not a Number".
Determine whether 'this' number "is Not a Number".
Attributes
Determine whether 'this' complex number is real (no imaginary part).
Determine whether 'this' complex number is real (no imaginary part).
Attributes
Return the maximum of 'this' and 'c' complex numbers.
Return the maximum of 'this' and 'c' complex numbers.
Value parameters
- c
-
that complex number to compare with this
Attributes
Return the minimum of 'this' and 'c' complex numbers.
Return the minimum of 'this' and 'c' complex numbers.
Value parameters
- c
-
that complex number to compare with this
Attributes
Determine whether 'this' is not within the given bounds
Determine whether 'this' is not within the given bounds
Value parameters
- lim
-
the given (lower, upper) bounds
Attributes
Determine whether 'this' is not in the given set.
Determine whether 'this' is not in the given set.
Value parameters
- lim
-
the given set of values
Attributes
Parse the string to create a complex number.
Parse the string to create a complex number.
Attributes
Return the complex number in polar coordinates (radius, angle).
Return the complex number in polar coordinates (radius, angle).
Attributes
Return the radius of the complex number as a vector in the 're'-'im' plane.
Return the radius of the complex number as a vector in the 're'-'im' plane.
Attributes
Set the format to the 'newFormat'.
Set the format to the 'newFormat'.
Value parameters
- newFormat
-
the new format String
Attributes
Convert 'this' complex number to a Complex
.
Convert 'this' complex number to a Complex
.
Value parameters
- c
-
that complex number to convert
Attributes
Convert 'this' complex number to a Double
.
Convert 'this' complex number to a Double
.
Value parameters
- c
-
that complex number to convert
Attributes
Convert 'this' complex number to a Float
.
Convert 'this' complex number to a Float
.
Value parameters
- c
-
that complex number to convert
Attributes
Convert 'this' complex number to an Int
.
Convert 'this' complex number to an Int
.
Value parameters
- c
-
that complex number to convert
Attributes
Convert 'this' complex number to a Long
.
Convert 'this' complex number to a Long
.
Value parameters
- c
-
that complex number to convert
Attributes
Convert 'this' complex number to a String of the form "a+bi".
Convert 'this' complex number to a String of the form "a+bi".
Attributes
- Definition Classes
-
Any
Convert 'this' complex number to a String of the form "(a, b)".
Convert 'this' complex number to a String of the form "(a, b)".
Attributes
Raise a complex to the 'r'-th power (a double) using polar coordinates.
Raise a complex to the 'r'-th power (a double) using polar coordinates.
Value parameters
- r
-
the power/exponent
Attributes
Compare 'this' complex number with that complex number 'd' for inequality.
Compare 'this' complex number with that complex number 'd' for inequality.
Value parameters
- d
-
that complex number
Attributes
Compare 'this' complex number with that complex number 'd' for less than or equal to.
Compare 'this' complex number with that complex number 'd' for less than or equal to.
Value parameters
- d
-
that complex number
Attributes
Inherited methods
Attributes
- Definition Classes
-
Ordering -> PartialOrdering -> Equiv
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Inherited from:
- Ordering
Attributes
- Inherited from:
- Product
Attributes
- Inherited from:
- Product
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Comparator
Attributes
- Inherited from:
- Ordering
Implicits
Inherited implicits
Attributes
- Definition Classes
-
Fractional -> Numeric
- Inherited from:
- Fractional
Attributes
- Inherited from:
- Ordering