Namespaces

Types

Type Complex

Namespace MathNet.Numerics

Parent ValueType

Interfaces IFormattable, IEquatable<Complex>, IPrecisionSupport<T>

Complex numbers class.

The class Complex provides all elementary operations on complex numbers. All the operators +, -,*, /, ==, != are defined in the canonical way. Additional complex trigonometric functions such as Cosine, ... are also provided. Note that the Complex structures has two special constant values NaN andInfinity.

In order to avoid possible ambiguities resulting from aComplex(double, double) constructor, the static methodsWithRealImaginary and WithModulusArgumentare provided instead.

Complex x = Complex.FromRealImaginary(1d, 2d); Complex y = Complex.FromModulusArgument(1d, Math.Pi); Complex z = (x + y) / (x - y);

For mathematical details about complex numbers, please have a look at the

Methods

Properties

Public instance methods

Complex Add(Complex other)

Adds a complex number to this one.
Parameters
return Complex The result of the addition.
Complex other The other complex number to add.

Complex Divide(Complex divisor)

Divides this complex number by another.
Parameters
return Complex The result of the division.
Complex divisor The divisor.

bool Equals(Complex other)

Checks if two complex numbers are equal. Two complex numbers are equal if their corresponding real and imaginary components are equal.
Parameters
return bool Returns true if the two objects are the same object, or if their corresponding real and imaginary components are equal, false otherwise.
Complex other The complex number to compare to with.

Complex Exponential()

Exponential of this Complex (exp(x), E^x).
Parameters
return Complex The exponential of this complex number.

Complex Multiply(Complex multiplier)

Multiplies this complex number with this one.
Parameters
return Complex The result of the multiplication.
Complex multiplier The complex number to multiply.

Complex NaturalLogarithm()

Natural Logarithm of this Complex (Base E).
Parameters
return Complex The natural logarithm of this complex number.

Complex Power(Complex exponent)

Raise this Complex to the given value.
Parameters
return Complex The complex number raised to the given exponent.
Complex exponent The exponent.

Complex Root(Complex rootExponent)

Raise this Complex to the inverse of the given value.
Parameters
return Complex The complex raised to the inverse of the given exponent.
Complex rootExponent The root exponent.

Complex Square()

The Square (power 2) of this Complex
Parameters
return Complex The square of this complex number.

Complex SquareRoot()

The Square Root (power 1/2) of this Complex
Parameters
return Complex The square root of this complex number.

Complex Subtract(Complex other)

Subtracts a complex number from this one.
Parameters
return Complex The result of the subtraction.
Complex other The other complex number to subtract from this one.

Public static methods

bool TryParse(string value, Complex& result)

Parameters
return bool
string value
Complex& result

bool TryParse(string value, IFormatProvider formatProvider, Complex& result)

Parameters
return bool
string value
IFormatProvider formatProvider
Complex& result

Complex WithModulusArgument(double modulus, double argument)

Constructs a Complex from its modulus and argument.
Parameters
return Complex A new Complex from the given values.
double modulus Must be non-negative.
double argument Real number.

Complex WithRealImaginary(double real, double imaginary)

Constructs a Complex from its real and imaginary parts.
Parameters
return Complex A new Complex with the given values.
double real The value for the real component.
double imaginary The value for the imaginary component.

Public properties

double Argument get;

Gets argument of this Complex.
Argument always returns a value bigger than negative Pi and smaller or equal to Pi. If this Complex is zero, the Complex is assumed to be positive real with an argument of zero.
return double

Complex Conjugate get;

Gets the conjugate of this Complex.
The semantic of is such that// a, b of type Complex a.Conjugate = b;is equivalent to// a, b of type Complex a = b.Conjugate
return Complex

Complex I get;

Gets a value representing the imaginary unit number. This field is constant.
return Complex
Value:

double Imaginary get;

Gets the real imaginary component of the complex number.
return double
Value:

Complex Infinity get;

Gets a value representing the infinity value. This field is constant.
The semantic associated to this value is a Complex of infinite real and imaginary part. If you need more formal complex number handling (according to the Riemann Sphere and the extended complex plane C*, or using directed infinity) please check out the alternative Math.NET symbolics packages instead.
return Complex
Value:

bool IsI get;

Gets a value indicating whether the Complex is the imaginary unit.
return bool
Value:

bool IsInfinity get;

Gets a value indicating whether the provided Complex evaluates to an infinite value.
True if it either evaluates to a complex infinity or to a directed infinity.
return bool
Value:

bool IsNaN get;

Gets a value indicating whether the provided Complexevaluates to a value that is not a number.
return bool
Value:

bool IsOne get;

Gets a value indicating whether the Complex is one.
return bool
Value:

bool IsReal get;

Gets a value indicating whether the provided Complex is real.
return bool
Value:

bool IsRealNonNegative get;

Gets a value indicating whether the provided Complex is real and not negative, that is >= 0.
return bool
Value:

bool IsZero get;

Gets a value indicating whether whether the Complex is zero.
return bool
Value:

double Modulus get;

Gets or modulus of this Complex.
return double

double ModulusSquared get;

Gets the squared modulus of this Complex.
return double

Complex NaN get;

Gets a value representing not-a-number. This field is constant.
return Complex
Value:

Complex One get;

Gets a value representing the 1 value. This field is constant.
return Complex
Value:

double Real get;

Gets the real component of the complex number.
return double
Value:

Complex Sign get;

Gets the unity of this complex (same argument, but on the unit circle; exp(I*arg))
return Complex

Complex Zero get;

Gets a value representing the zero value. This field is constant.
return Complex
Value: