Complex class sealed

Representation of a complex number, i.e. a number which has both a real and imaginary part.

Implementations of arithmetic operations handle NaN and infinite values according to the rules for double, i.e. == is an equivalence relation for all instances that have a NaN in either real or imaginary part, e.g. the following are considered equal:

  • 1 + NaNi
  • NaN + i
  • NaN + NaNi

Note that this is in contradiction with the IEEE-754 standard for floating point numbers (according to which the test x == x must fail if x is NaN).

Implementers
Available extensions
Annotations
  • @immutable

Constructors

Complex.new(double real, [double imaginary])
Complex as a Cartesian with optional imaginary part.
const
factory
Complex.imag(double imaginary)
A pure imaginary number.
factory
Complex.polar([double r = 0.0, double phase = 0.0])
A Complex
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
imaginary double
The imaginary part.
no setter
isFinite bool
True if the real and imaginary parts are finite; otherwise, false.
no setter
isInfinite bool
True if the real and imaginary parts are positive infinity or negative infinity; otherwise, false.
no setter
isNaN bool
True if the real and imaginary parts are the double Not-a-Number value; otherwise, false.
no setter
real double
The real part.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

abs() double
Return the absolute value of this complex number. Returns NaN if either real or imaginary part is NaN and double.INFINITY if neither part is NaN, but at least one part is infinite.
acos() Complex

Available on T, provided by the ComplexTrigonometricX extension

Arccosine
argument() double
Compute the argument of this complex number.
asin() Complex

Available on T, provided by the ComplexTrigonometricX extension

Arcsine
atan() Complex

Available on T, provided by the ComplexTrigonometricX extension

Arctangent
conjugate() Complex
Return the conjugate of this complex number. The conjugate of a + bi is a - bi.
cos() Complex

Available on T, provided by the ComplexTrigonometricX extension

Cosine
cosh() Complex

Available on T, provided by the ComplexHyperbolicX extension

Hyperbolic cosine
exp() Complex
Compute the exponential function of this complex number.
log() Complex
Compute the natural logarithm of this complex number.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nthRoot(int n) List<Complex>

Available on T, provided by the ComplexRootsX extension

ComplexRootsX
pow(num x) Complex
Returns of value of this complex number raised to the power of x.
power<T extends Complex>(T x) Complex
Returns of value of this complex number raised to the power of x.
reciprocal() Complex
Returns the multiplicative inverse of this element.
sin() Complex

Available on T, provided by the ComplexTrigonometricX extension

Sine
sinh() Complex

Available on T, provided by the ComplexHyperbolicX extension

Hyperbolic sine
sqrt() Complex
Compute the square root of this complex number.
sqrt1z() Complex
Compute the square root of 1 - this^2 for this complex number.
tan() Complex

Available on T, provided by the ComplexTrigonometricX extension

Tangent
tanh() Complex

Available on T, provided by the ComplexHyperbolicX extension

Hyperbolic tangent
toString() String
A string representation of this object.
inherited

Operators

operator *(Object factor) Complex
Returns a Complex whose value is this * factor. Implements preliminary checks for NaN and infinity followed by the definitional formula:
operator +(Object addend) Complex
Returns a Complex whose value is (this + addend). Uses the definitional formula
operator -(Object subtrahend) Complex
Returns a Complex whose value is this - subtrahend. Uses the definitional formula
operator /(Object divisor) Complex
Returns a Complex whose value is (this / divisor). Implements the definitional formula
operator ==(Object other) bool
Test for equality with another object.
override
operator unary-() Complex
Negate operator. Returns a Complex whose value is -this. Returns NAN if either real or imaginary part of this complex number equals double.nan.

Constants

i → const Cartesian
The square root of -1. A number representing "0.0 + 1.0i"
infinity → const Cartesian
A complex number representing "+INF + INFi"
nan → const Cartesian
A complex number representing "NaN + NaNi"
one → const Cartesian
A complex number representing "1.0 + 0.0i"
zero → const Cartesian
A complex number representing "0.0 + 0.0i"