case class Complex(re: Double, im: Double = 0.0) extends Fractional[Complex] with Ordered[Complex] with Product with Serializable
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'. -------------------------------------------------------------------------
- re
the real part (e.g., 2.1)
- im
the imaginary part (e.g., 3.2)
- Alphabetic
- By Inheritance
- Complex
- Product
- Equals
- Ordered
- Comparable
- Fractional
- Numeric
- Ordering
- PartialOrdering
- Equiv
- Serializable
- Serializable
- Comparator
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
Complex(re: Double, im: Double = 0.0)
- re
the real part (e.g., 2.1)
- im
the imaginary part (e.g., 3.2)
Type Members
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
!=~(c: Complex): Boolean
Return whether two complex numbers are not nearly equal.
Return whether two complex numbers are not nearly equal.
- c
compare this with c
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
*(c: Complex): Complex
Multiply two complex numbers.
Multiply two complex numbers.
- c
multiply 'this' times c
-
def
+(c: Complex): Complex
Add two complex numbers.
Add two complex numbers.
- c
add complex c to this
-
def
-(c: Complex): Complex
Subtract two complex numbers.
Subtract two complex numbers.
- c
subtract c from this
-
def
/(c: Complex): Complex
Divide two complex numbers.
Divide two complex numbers.
- c
divide this by c
-
def
<(that: Complex): Boolean
- Definition Classes
- Ordered
-
def
<=(that: Complex): Boolean
- Definition Classes
- Ordered
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
=~(c: Complex): Boolean
Return whether two complex numbers are nearly equal.
Return whether two complex numbers are nearly equal.
- c
compare this with c
-
def
>(that: Complex): Boolean
- Definition Classes
- Ordered
-
def
>=(that: Complex): Boolean
- Definition Classes
- Ordered
-
def
abs: Complex
Return the absolute value of 'this' complex number.
-
def
abs(x: Complex): Complex
- Definition Classes
- Numeric
-
def
angle: Double
Return the angle of the complex number as a vector in the 're'-'im' plane.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bar: Complex
Return the complex conjugate: if z = (a + bi) then z.bar = (a - bi).
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
compare(d: Complex): Int
Compare 'this' complex number with that complex number 'd'.
Compare 'this' complex number with that complex number 'd'.
- d
that complex number
- Definition Classes
- Complex → Ordered
-
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 >).
- c
the first complex number to compare
- d
the second complex number to compare
- Definition Classes
- Complex → Ordering → Comparator
-
def
compareTo(that: Complex): Int
- Definition Classes
- Ordered → Comparable
-
def
div(c: Complex, d: Complex): Complex
- Definition Classes
- Complex → Fractional
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
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'.
- c
the complex number to compare with this
- Definition Classes
- Complex → Equals → Comparator → AnyRef → Any
-
def
equiv(x: Complex, y: Complex): Boolean
- Definition Classes
- Ordering → PartialOrdering → Equiv
-
def
fromInt(n: Int): Complex
Create a complex number from an
Int
.Create a complex number from an
Int
.- n
the integer used to create the complex number
- Definition Classes
- Complex → Numeric
-
def
fromLong(n: Long): Complex
Create a complex number from a
Long
.Create a complex number from a
Long
.- n
the long used to create the complex number
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
gt(x: Complex, y: Complex): Boolean
- Definition Classes
- Ordering → PartialOrdering
-
def
gteq(x: Complex, y: Complex): Boolean
- Definition Classes
- Ordering → PartialOrdering
-
def
hashCode(): Int
Must also override hashCode to be be compatible with equals.
Must also override hashCode to be be compatible with equals.
- Definition Classes
- Complex → AnyRef → Any
- val im: Double
-
def
in(set: Set[Complex]): Boolean
Determine whether 'this' is in the given set.
-
def
in(lim: (Complex, Complex)): Boolean
Determine whether 'this' is within the given bounds
Determine whether 'this' is within the given bounds
- lim
the given (lower, upper) bounds
-
def
isIm: Boolean
Determine whether 'this' complex number is purely imaginary (no real part).
-
def
isInfinity: Boolean
Determine whether 'this' number "is Infinite".
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isNaN: Boolean
Determine whether 'this' number "is Not a Number".
-
def
isRe: Boolean
Determine whether 'this' complex number is real (no imaginary part).
-
def
lt(x: Complex, y: Complex): Boolean
- Definition Classes
- Ordering → PartialOrdering
-
def
lteq(x: Complex, y: Complex): Boolean
- Definition Classes
- Ordering → PartialOrdering
-
def
max(c: Complex): Complex
Return the maximum of 'this' and 'c' complex numbers.
Return the maximum of 'this' and 'c' complex numbers.
- c
that complex number to compare with this
-
def
max(x: Complex, y: Complex): Complex
- Definition Classes
- Ordering
-
def
min(c: Complex): Complex
Return the minimum of 'this' and 'c' complex numbers.
Return the minimum of 'this' and 'c' complex numbers.
- c
that complex number to compare with this
-
def
min(x: Complex, y: Complex): Complex
- Definition Classes
- Ordering
-
def
minus(c: Complex, d: Complex): Complex
- Definition Classes
- Complex → Numeric
-
implicit
def
mkNumericOps(lhs: Complex): FractionalOps
- Definition Classes
- Fractional → Numeric
-
implicit
def
mkOrderingOps(lhs: Complex): Complex.Ops
- Definition Classes
- Ordering
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def near_eq(c: Complex, d: Complex): Boolean
-
def
negate(c: Complex): Complex
- Definition Classes
- Complex → Numeric
-
def
not_in(set: Set[Complex]): Boolean
Determine whether 'this' is not in the given set.
-
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
- lim
the given (lower, upper) bounds
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
on[U](f: (U) ⇒ Complex): Ordering[U]
- Definition Classes
- Ordering
-
def
one: Complex
- Definition Classes
- Numeric
-
def
parseString(str: String): Option[Complex]
Parse the string to create a complex number.
-
def
plus(c: Complex, d: Complex): Complex
- Definition Classes
- Complex → Numeric
-
def
polar: (Double, Double)
Return the complex number in polar coordinates (radius, angle).
- 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.
- val re: Double
-
def
reverse: Ordering[Complex]
- Definition Classes
- Ordering → PartialOrdering
-
def
reversed(): Comparator[Complex]
- Definition Classes
- Comparator
-
def
setFormat(newFormat: String): Unit
Set the format to the 'newFormat'.
Set the format to the 'newFormat'.
- newFormat
the new format String
-
def
signum(x: Complex): Int
- Definition Classes
- Numeric
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
thenComparing[U <: Comparable[_ >: U]](arg0: Function[_ >: Complex, _ <: U]): Comparator[Complex]
- Definition Classes
- Comparator
-
def
thenComparing[U](arg0: Function[_ >: Complex, _ <: U], arg1: Comparator[_ >: U]): Comparator[Complex]
- Definition Classes
- Comparator
-
def
thenComparing(arg0: Comparator[_ >: Complex]): Comparator[Complex]
- Definition Classes
- Comparator
-
def
thenComparingDouble(arg0: ToDoubleFunction[_ >: Complex]): Comparator[Complex]
- Definition Classes
- Comparator
-
def
thenComparingInt(arg0: ToIntFunction[_ >: Complex]): Comparator[Complex]
- Definition Classes
- Comparator
-
def
thenComparingLong(arg0: ToLongFunction[_ >: Complex]): Comparator[Complex]
- Definition Classes
- Comparator
-
def
times(c: Complex, d: Complex): Complex
- Definition Classes
- Complex → Numeric
- def toComplex: Complex
-
def
toComplex(c: Complex): Complex
Convert 'this' complex number to a
Complex
.Convert 'this' complex number to a
Complex
.- c
that complex number to convert
- def toDouble: Double
-
def
toDouble(c: Complex): Double
Convert 'this' complex number to a
Double
.Convert 'this' complex number to a
Double
.- c
that complex number to convert
- Definition Classes
- Complex → Numeric
- def toFloat: Float
-
def
toFloat(c: Complex): Float
Convert 'this' complex number to a
Float
.Convert 'this' complex number to a
Float
.- c
that complex number to convert
- Definition Classes
- Complex → Numeric
- def toInt: Int
-
def
toInt(c: Complex): Int
Convert 'this' complex number to an
Int
.Convert 'this' complex number to an
Int
.- c
that complex number to convert
- Definition Classes
- Complex → Numeric
- def toLong: Long
-
def
toLong(c: Complex): Long
Convert 'this' complex number to a
Long
.Convert 'this' complex number to a
Long
.- c
that complex number to convert
- Definition Classes
- Complex → Numeric
-
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".
- Definition Classes
- Complex → AnyRef → Any
-
def
toString2: String
Convert 'this' complex number to a String of the form "(a, b)".
-
def
tryCompare(x: Complex, y: Complex): Some[Int]
- Definition Classes
- Ordering → PartialOrdering
-
def
unary_-(): Complex
Compute the unary minus (-).
-
val
val1: Double
General alias for the parts of a complex number
-
val
val2: Double
General alias for the parts of a complex number
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
zero: Complex
- Definition Classes
- Numeric
-
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.
- r
the power/exponent
- def ↑(r: Double): Complex
- def ∈(set: Set[Complex]): Boolean
- def ∈(lim: (Complex, Complex)): Boolean
- def ∉(set: Set[Complex]): Boolean
- def ∉(lim: (Complex, Complex)): Boolean
- def ≈(c: 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.
- d
that complex number
-
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.
- d
that complex number
-
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.
- d
that complex number
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated