Complex

scalation.mathstat.Complex
See theComplex companion object
case class Complex(re: Double, im: Double) extends Fractional[Complex], Ordered[Complex]

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
trait Product
trait Equals
trait Ordered[Complex]
trait Comparable[Complex]
trait Fractional[Complex]
trait Numeric[Complex]
trait Ordering[Complex]
trait PartialOrdering[Complex]
trait Equiv[Complex]
trait Serializable
trait Comparator[Complex]
class Object
trait Matchable
class Any
Show all

Members list

Type members

Inherited classlikes

class FractionalOps(lhs: T)

Attributes

Inherited from:
Fractional
Supertypes
class NumericOps
class Object
trait Matchable
class Any
class NumericOps(lhs: T)

Attributes

Inherited from:
Numeric
Supertypes
class Object
trait Matchable
class Any
class OrderingOps(lhs: T)

Attributes

Inherited from:
Ordering
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def *(c: Complex): Complex

Multiply two complex numbers.

Multiply two complex numbers.

Value parameters

c

multiply 'this' times c

Attributes

def *(d: Double): Complex
def +(c: Complex): Complex

Add two complex numbers.

Add two complex numbers.

Value parameters

c

add complex c to this

Attributes

def +(d: Double): Complex
def -(c: Complex): Complex

Subtract two complex numbers.

Subtract two complex numbers.

Value parameters

c

subtract c from this

Attributes

def -(d: Double): Complex
def /(c: Complex): Complex

Divide two complex numbers.

Divide two complex numbers.

Value parameters

c

divide this by c

Attributes

def /(d: Double): Complex
def =~(c: Complex): Boolean

Return whether two complex numbers are nearly equal.

Return whether two complex numbers are nearly equal.

Value parameters

c

compare this with c

Attributes

def abs: Complex

Return the absolute value of 'this' complex number.

Return the absolute value of 'this' complex number.

Attributes

def angle: Double

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

def bar: Complex

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

def compare(c: Complex, d: Complex): Int

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

infix def compare(d: Complex): Int

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

inline def div(c: Complex, d: Complex): Complex
infix override def equals(c: Any): Boolean

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
def fromDouble(x: Double): Complex

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

def fromInt(n: Int): Complex

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

def fromLong(n: Long): Complex

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

override def hashCode: Int

Must also override hashCode to be be compatible with equals.

Must also override hashCode to be be compatible with equals.

Attributes

Definition Classes
Any
def in(lim: (Complex, Complex)): Boolean

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

def in(set: Set[Complex]): Boolean

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

def isIm: Boolean

Determine whether 'this' complex number is purely imaginary (no real part).

Determine whether 'this' complex number is purely imaginary (no real part).

Attributes

def isInfinity: Boolean

Determine whether 'this' number "is Infinite".

Determine whether 'this' number "is Infinite".

Attributes

def isNaN: Boolean

Determine whether 'this' number "is Not a Number".

Determine whether 'this' number "is Not a Number".

Attributes

def isRe: Boolean

Determine whether 'this' complex number is real (no imaginary part).

Determine whether 'this' complex number is real (no imaginary part).

Attributes

infix def max(c: Complex): Complex

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

infix def min(c: Complex): Complex

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

inline def minus(c: Complex, d: Complex): Complex
inline def near_eq(c: Complex, d: Complex): Boolean
inline def negate(c: Complex): Complex
def not_in(lim: (Complex, Complex)): Boolean

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

def not_in(set: Set[Complex]): Boolean

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

def parseString(str: String): Option[Complex]

Parse the string to create a complex number.

Parse the string to create a complex number.

Attributes

def plus(c: Complex, d: Complex): Complex
def polar: (Double, Double)

Return the complex number in polar coordinates (radius, angle).

Return the complex number in polar coordinates (radius, angle).

Attributes

inline def pow(c: Complex, r: Double): Complex
def radius: Double

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

def setFormat(newFormat: String): Unit

Set the format to the 'newFormat'.

Set the format to the 'newFormat'.

Value parameters

newFormat

the new format String

Attributes

inline def times(c: Complex, d: Complex): Complex

Convert 'this' complex number to a Complex.

Convert 'this' complex number to a Complex.

Value parameters

c

that complex number to convert

Attributes

def toDouble(c: Complex): Double

Convert 'this' complex number to a Double.

Convert 'this' complex number to a Double.

Value parameters

c

that complex number to convert

Attributes

def toDouble: Double
def toFloat(c: Complex): Float

Convert 'this' complex number to a Float.

Convert 'this' complex number to a Float.

Value parameters

c

that complex number to convert

Attributes

def toFloat: Float
def toInt(c: Complex): Int

Convert 'this' complex number to an Int.

Convert 'this' complex number to an Int.

Value parameters

c

that complex number to convert

Attributes

def toInt: Int
def toLong(c: Complex): Long

Convert 'this' complex number to a Long.

Convert 'this' complex number to a Long.

Value parameters

c

that complex number to convert

Attributes

def toLong: Long
override def toString: String

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
def toString2: String

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

Compute the unary minus (-).

Compute the unary minus (-).

Attributes

def ~^(r: Double): Complex

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

def (r: Double): Complex
def (lim: (Complex, Complex)): Boolean
def (set: Set[Complex]): Boolean
def (lim: (Complex, Complex)): Boolean
def (set: Set[Complex]): Boolean
def (c: Complex): Boolean
def (d: Complex): Boolean

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

def (d: Complex): Boolean

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

def (d: Complex): Boolean

Compare 'this' complex number with that complex number 'd' for greater than or equal to.

Compare 'this' complex number with that complex number 'd' for greater than or equal to.

Value parameters

d

that complex number

Attributes

Inherited methods

def <(that: Complex): Boolean

Attributes

Inherited from:
Ordered
def <=(that: Complex): Boolean

Attributes

Inherited from:
Ordered
def >(that: Complex): Boolean

Attributes

Inherited from:
Ordered
def >=(that: Complex): Boolean

Attributes

Inherited from:
Ordered
def abs(x: Complex): Complex

Attributes

Inherited from:
Numeric
def compareTo(that: Complex): Int

Attributes

Inherited from:
Ordered
override def equiv(x: Complex, y: Complex): Boolean

Attributes

Definition Classes
Ordering -> PartialOrdering -> Equiv
Inherited from:
Ordering
override def gt(x: Complex, y: Complex): Boolean

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
override def gteq(x: Complex, y: Complex): Boolean

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def isReverseOf(other: Ordering[_]): Boolean

Attributes

Inherited from:
Ordering
override def lt(x: Complex, y: Complex): Boolean

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
override def lteq(x: Complex, y: Complex): Boolean

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def max[U <: Complex](x: U, y: U): U

Attributes

Inherited from:
Ordering
def min[U <: Complex](x: U, y: U): U

Attributes

Inherited from:
Ordering
def on[U](f: U => Complex): Ordering[U]

Attributes

Inherited from:
Ordering
def one: Complex

Attributes

Inherited from:
Numeric
def orElse(other: Ordering[Complex]): Ordering[Complex]

Attributes

Inherited from:
Ordering
def orElseBy[S](f: Complex => S)(implicit ord: Ordering[S]): Ordering[Complex]

Attributes

Inherited from:
Ordering
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
override def reverse: Ordering[Complex]

Attributes

Definition Classes
Ordering -> PartialOrdering
Inherited from:
Ordering
def reversed(): Comparator[Complex]

Attributes

Inherited from:
Comparator
def sign(x: Complex): Complex

Attributes

Inherited from:
Numeric
def thenComparing[U <: Comparable[_ >: U <: <FromJavaObject>]](x$0: Function[_ >: Complex <: <FromJavaObject>, _ <: U]): Comparator[Complex]

Attributes

Inherited from:
Comparator
def thenComparing[U <: <FromJavaObject>](x$0: Function[_ >: Complex <: <FromJavaObject>, _ <: U], x$1: Comparator[_ >: U <: <FromJavaObject>]): Comparator[Complex]

Attributes

Inherited from:
Comparator
def thenComparing(x$0: Comparator[_ >: Complex <: <FromJavaObject>]): Comparator[Complex]

Attributes

Inherited from:
Comparator
def thenComparingDouble(x$0: ToDoubleFunction[_ >: Complex <: <FromJavaObject>]): Comparator[Complex]

Attributes

Inherited from:
Comparator
def thenComparingInt(x$0: ToIntFunction[_ >: Complex <: <FromJavaObject>]): Comparator[Complex]

Attributes

Inherited from:
Comparator
def thenComparingLong(x$0: ToLongFunction[_ >: Complex <: <FromJavaObject>]): Comparator[Complex]

Attributes

Inherited from:
Comparator
def tryCompare(x: Complex, y: Complex): Some[Int]

Attributes

Inherited from:
Ordering
def zero: Complex

Attributes

Inherited from:
Numeric

Deprecated and Inherited methods

def signum(x: Complex): Int

Attributes

Deprecated
[Since version 2.13.0] use `sign` method instead
Inherited from:
Numeric

Concrete fields

val val1: Double
val val2: Double

Implicits

Inherited implicits

implicit override def mkNumericOps(lhs: Complex): FractionalOps

Attributes

Definition Classes
Fractional -> Numeric
Inherited from:
Fractional
implicit def mkOrderingOps(lhs: Complex): OrderingOps

Attributes

Inherited from:
Ordering