Complex class

A complex number of the form a + b*i.

Implemented types
Available Extensions
Annotations
  • @immutable

Constructors

Complex(num a, [num b = 0])
Creates a complex number from a real part a and an imaginary part b.
const
Complex.fromCartesian(num a, num b)
Creates a complex number from cartesian coordinates a and b.
const
factory
Complex.fromImaginary(num b)
Creates a complex number from an imaginary number b.
factory
Complex.fromPolar(num radius, num phase)
Creates a complex number from polar coordinates radius and phase.
factory
Complex.fromReal(num a)
Creates a complex number from a real number a.
factory

Properties

a num
Returns the real part of the number.
final
b num
Returns the imaginary part of the number.
final
hashCode int
The hash code for this object.
no setteroverride
imaginary num
Alternative way to access the imaginary part of the number.
no setter
isFinite bool
Tests if this complex number is finite.
no setter
isInfinite bool
Tests if this complex number is infinite.
no setter
isNaN bool
Tests if this complex number is not defined.
no setter
real num
Alternative way to access the real part of the number.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sign Complex
Returns the closest point on the unit circle.
no setter

Methods

abs() double
Returns the radius of this complex value in polar coordinates, also called the magnitude of the complex number.
acos() Complex
Computes the arc-cosine of this complex number.
acosh() Complex
Computes the hyperbolic arc-cosine of this complex number.
arg() double
Returns the phase of the value in polar coordinates.
asin() Complex
Computes the arc-sine of this complex number.
asinh() Complex
Computes the hyperbolic arc-sine of this complex number.
atan() Complex
Computes the arc-tangent of this complex number.
atanh() Complex
Computes the hyperbolic arc-tangent of this complex number.
ceil() Complex
Ceils the values of this complex number to integers.
closeTo(Complex other, num epsilon) bool
Tests if this object is close to another object.
override
conjugate() Complex
Returns the conjugate form of this number.
cos() Complex
Computes the cosine of this complex number.
cosh() Complex
Computes the hyperbolic cosine of this complex number.
exp() Complex
Computes the exponential function of this complex number.
floor() Complex
Floors the values of this complex number to integers.
log() Complex
Computes the natural logarithm of this complex number.
norm() num
Returns the squared magnitude.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pow(Object exponent) Complex
Computes the power of this complex number raised to exponent.
reciprocal() Complex
Returns the multiplicative inverse of this complex value.
roots(int n) List<Complex>
Computes the n-th roots of this complex number.
round() Complex
Rounds the values of this complex number to integers.
sin() Complex
Computes the sine of this complex number.
sinh() Complex
Computes the hyperbolic sine of this complex number.
sqrt() Complex
Computes the square root of this complex number.
square() Complex
Computes the square of this complex number.
tan() Complex
Computes the tangent of this complex number.
tanh() Complex
Computes the hyperbolic tangent of this complex number.
toString() String
A string representation of this object.
override
truncate() Complex
Truncates the values of this complex number to integers.

Operators

operator *(Object other) Complex
Returns the multiplication of this complex value and other.
operator +(Object other) Complex
Returns the sum of this complex value and other.
operator -(Object other) Complex
Returns the difference of this complex value and other.
operator /(Object other) Complex
Returns the division of this complex value and other.
operator ==(Object other) bool
The equality operator.
override
operator unary-() Complex
Returns the negated form of this number.

Static Methods

tryParse(String source) Complex?
Parses source as a Complex. Returns null in case of a problem.

Constants

i → const Complex
The imaginary number, that is i.
infinity → const Complex
The complex number with both real and imaginary part to be double.infinity.
nan → const Complex
The complex number with both real and imaginary part to be double.nan.
one → const Complex
The neutral multiplicative element, that is 1.
zero → const Complex
The neutral additive element, that is 0.