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
- Known subtypes
-
This inner class defines comparison operators available for T.
This inner class defines comparison operators available for T.
It can't extend AnyVal because it is not a top-level class or a member of a statically accessible object.
Attributes
- Inherited from:
- Ordering
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Multiply two complex numbers, this * c.
Multiply two complex numbers, this * c.
Value parameters
- c
-
multiply this times c
Attributes
Add two complex numbers, this + c.
Add two complex numbers, this + c.
Value parameters
- c
-
add complex c to this
Attributes
Subtract two complex numbers, this - c.
Subtract two complex numbers, this - c.
Value parameters
- c
-
subtract c from this
Attributes
Divide two complex numbers, this / c.
Divide two complex numbers, this / c.
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 number to the 'r'-th power (a double) using polar coordinates.
Raise a complex number to the 'r'-th power (a double) using polar coordinates.
Value parameters
- r
-
the power/exponent
Attributes
Raise a complex number to the 'r'-th power (a rational number) using polar coordinates. Extended to handle a negative base.
Raise a complex number to the 'r'-th power (a rational number) using polar coordinates. Extended to handle a negative base.
Value parameters
- r
-
the power/exponent
Attributes
- See also
-
pow_in CommonFunctions.
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
Returns true if this is less than that
Returns true if this is less than that
Attributes
- Inherited from:
- Ordered
Returns true if this is less than or equal to that.
Returns true if this is less than or equal to that.
Attributes
- Inherited from:
- Ordered
Returns true if this is greater than that.
Returns true if this is greater than that.
Attributes
- Inherited from:
- Ordered
Returns true if this is greater than or equal to that.
Returns true if this is greater than or equal to that.
Attributes
- Inherited from:
- Ordered
Result of comparing this with operand that.
Result of comparing this with operand that.
Attributes
- Inherited from:
- Ordered
Returns true if x == y in the ordering.
Returns true if x == y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering -> Equiv
- Inherited from:
- Ordering
Returns true if x > y in the ordering.
Returns true if x > y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns true if x >= y in the ordering.
Returns true if x >= y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns whether or not the other ordering is the opposite ordering of this one.
Returns whether or not the other ordering is the opposite ordering of this one.
Equivalent to other == this.reverse.
Implementations should only override this method if they are overriding reverse as well.
Attributes
- Inherited from:
- Ordering
Returns true if x < y in the ordering.
Returns true if x < y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns true if x <= y in the ordering.
Returns true if x <= y in the ordering.
Attributes
- Definition Classes
-
Ordering -> PartialOrdering
- Inherited from:
- Ordering
Returns x if x >= y, otherwise y.
Returns x if x >= y, otherwise y.
Attributes
- Inherited from:
- Ordering
Returns x if x <= y, otherwise y.
Returns x if x <= y, otherwise y.
Attributes
- Inherited from:
- Ordering
Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:
Given f, a function from U into T, creates an Ordering[U] whose compare function is equivalent to:
def compare(x:U, y:U) = Ordering[T].compare(f(x), f(y))
Attributes
- Inherited from:
- Ordering
Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.
Creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else the result of others compare function.
Value parameters
- other
-
an Ordering to use if this Ordering returns zero
Attributes
- Example
-
case class Pair(a: Int, b: Int) val pairOrdering = Ordering.by[Pair, Int](_.a) .orElse(Ordering.by[Pair, Int](_.b)) - Inherited from:
- Ordering
Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:
Given f, a function from T into S, creates an Ordering[T] whose compare function returns the result of this Ordering's compare function, if it is non-zero, or else a result equivalent to:
Ordering[S].compare(f(x), f(y))
This function is equivalent to passing the result of Ordering.by(f) to orElse.
Attributes
- Example
-
case class Pair(a: Int, b: Int) val pairOrdering = Ordering.by[Pair, Int](_.a) .orElseBy[Int](_.b) - Inherited from:
- Ordering
An iterator over the names of all the elements of this product.
An iterator over the names of all the elements of this product.
Attributes
- Inherited from:
- Product
An iterator over all the elements of this product.
An iterator over all the elements of this product.
Attributes
- Returns
-
in the default implementation, an
Iterator[Any] - Inherited from:
- Product
Returns the opposite ordering of this one.
Returns the opposite ordering of this one.
Implementations overriding this method MUST override isReverseOf as well if they change the behavior at all (for example, caching does not require overriding it).
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
Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).
Returns whether a comparison between x and y is defined, and if so the result of compare(x, y).
Attributes
- Inherited from:
- Ordering
Implicits
Inherited implicits
Attributes
- Definition Classes
-
Fractional -> Numeric
- Inherited from:
- Fractional
This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.
This implicit method augments T with the comparison operators defined in scala.math.Ordering.Ops.
Attributes
- Inherited from:
- Ordering