Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​Numerics.​Complex
Assembly: System.Runtime.Numerics
Implemented Interfaces
- ISignedNumber`1 (Inherits: INumberBase<​Complex>IEquatable<​Complex>IFormattableIParsable<​Complex>ISpanFormattableISpanParsable<​Complex>IUtf8SpanFormattableIUtf8SpanParsable<​Complex>IAdditionOperators<​Complex, Complex, Complex>IAdditiveIdentity<​Complex, Complex>IDecrementOperators<​Complex>IDivisionOperators<​Complex, Complex, Complex>IEqualityOperators<​Complex, Complex, bool>IIncrementOperators<​Complex>IMultiplicativeIdentity<​Complex, Complex>IMultiplyOperators<​Complex, Complex, Complex>ISubtractionOperators<​Complex, Complex, Complex>IUnaryNegationOperators<​Complex, Complex>IUnaryPlusOperators<​Complex, Complex>)
Represents a complex number.
Fields and Constants
public static readonly
Complex
ImaginaryOne
Returns a new <see cref="T:System.Numerics.Complex" /> instance with a real number equal to zero and an imaginary number equal to one.
public static readonly
Complex
Infinity
Represents infinity as a complex number.
public static readonly
Complex
NaN
Represents a complex instance that is not a number (NaN).
public static readonly
Complex
One
Returns a new <see cref="T:System.Numerics.Complex" /> instance with a real number equal to one and an imaginary number equal to zero.
public static readonly
Complex
Zero
Returns a new <see cref="T:System.Numerics.Complex" /> instance with a real number equal to zero and an imaginary number equal to zero.
Properties
public
double
Imaginary
Gets the imaginary component of the current <see cref="T:System.Numerics.Complex" /> object.
public
double
Magnitude
Gets the magnitude (or absolute value) of a complex number.
public
double
Phase
Gets the phase of a complex number.
public
double
Real
Gets the real component of the current <see cref="T:System.Numerics.Complex" /> object.
Methods
public static
double
Abs​(Complex value)
Gets the absolute value (or magnitude) of a complex number.
Returns The absolute value of <paramref name="value" /> .
value
A complex number.
public static
Complex
Acos​(Complex value)
Returns the angle that is the arc cosine of the specified complex number.
Returns The angle, measured in radians, which is the arc cosine of <paramref name="value" /> .
value
A complex number that represents a cosine.
public static
Complex
Add​(double left,
Complex right)
Adds a double-precision real number to a complex number and returns the result.
Returns The sum of <paramref name="left" /> and <paramref name="right" /> .
left
The double-precision real value to add.
right
The complex value to add.
public static
Complex
Add​(Complex left,
double right)
Adds a complex number to a double-precision real number and returns the result.
Returns The sum of <paramref name="left" /> and <paramref name="right" /> .
left
The complex value to add.
right
The double-precision real value to add.
public static
Complex
Add​(Complex left,
Complex right)
Adds two complex numbers and returns the result.
Returns The sum of <paramref name="left" /> and <paramref name="right" /> .
left
The first complex number to add.
right
The second complex number to add.
public static
Complex
Asin​(Complex value)
Returns the angle that is the arc sine of the specified complex number.
Returns The angle that is the arc sine of <paramref name="value" /> .
value
A complex number.
public static
Complex
Atan​(Complex value)
Returns the angle that is the arc tangent of the specified complex number.
Returns The angle that is the arc tangent of <paramref name="value" /> .
value
A complex number.
public static
Complex
Conjugate​(Complex value)
Computes the conjugate of a complex number and returns the result.
Returns The conjugate of <paramref name="value" /> .
value
A complex number.
public static
Complex
Cos​(Complex value)
Returns the cosine of the specified complex number.
Returns The cosine of <paramref name="value" /> .
value
A complex number.
public static
Complex
Cosh​(Complex value)
Returns the hyperbolic cosine of the specified complex number.
Returns The hyperbolic cosine of <paramref name="value" /> .
value
A complex number.
public static
Complex
CreateChecked​(TOther value)
Creates an instance of the current type from a value, throwing an overflow exception for any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> .
value
The value that's used to create the instance of <typeparamref name="TSelf" /> .
public static
Complex
CreateSaturating​(TOther value)
Creates an instance of the current type from a value, saturating any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> , saturating if <paramref name="value" /> falls outside the representable range of <typeparamref name="TSelf" /> .
value
The value that's used to create the instance of <typeparamref name="TSelf" /> .
public static
Complex
CreateTruncating​(TOther value)
Creates an instance of the current type from a value, truncating any values that fall outside the representable range of the current type.
Returns An instance of <typeparamref name="TSelf" /> created from <paramref name="value" /> , truncating if <paramref name="value" /> falls outside the representable range of <typeparamref name="TSelf" /> .
value
The value that's used to create the instance of <typeparamref name="TSelf" /> .
public static
Complex
Divide​(double dividend,
Complex divisor)
Divides one double-precision real number by a complex number and returns the result.
Returns The quotient of the division.
dividend
The double-precision real number to be divided.
divisor
The complex number to divide by.
public static
Complex
Divide​(Complex dividend,
double divisor)
Divides one complex number by a double-precision real number and returns the result.
Returns The quotient of the division.
dividend
The complex number to be divided.
divisor
The double-precision real number to divide by.
public static
Complex
Divide​(Complex dividend,
Complex divisor)
Divides one complex number by another and returns the result.
Returns The quotient of the division.
dividend
The complex number to be divided.
divisor
The complex number to divide by.
public
bool
Equals​(Complex value)
Returns a value that indicates whether the current instance and a specified complex number have the same value.
Returns <see langword="true" /> if this complex number and <paramref name="value" /> have the same value; otherwise, <see langword="false" /> .
value
The complex number to compare.
public
bool
Equals​(object obj)
Returns a value that indicates whether the current instance and a specified object have the same value.
Returns <see langword="true" /> if the <paramref name="obj" /> parameter is a <see cref="T:System.Numerics.Complex" /> object or a type capable of implicit conversion to a <see cref="T:System.Numerics.Complex" /> object, and its value is equal to the current <see cref="T:System.Numerics.Complex" /> object; otherwise, <see langword="false" /> .
obj
The object to compare.
public static
Complex
Exp​(Complex value)
Returns <see langword="e" /> raised to the power specified by a complex number.
Returns The number <see langword="e" /> raised to the power <paramref name="value" /> .
value
A complex number that specifies a power.
public static
Complex
FromPolarCoordinates​(double magnitude,
double phase)
Creates a complex number from a point's polar coordinates.
Returns A complex number.
magnitude
The magnitude, which is the distance from the origin (the intersection of the x-axis and the y-axis) to the number.
phase
The phase, which is the angle from the line to the horizontal axis, measured in radians.
public
int
GetHashCode​()
Returns the hash code for the current <see cref="T:System.Numerics.Complex" /> object.
Returns A 32-bit signed integer hash code.
public static
bool
IsComplexNumber​(Complex value)
Determines if a value represents a complex value.
Returns <see langword="true" /> if <paramref name="value" /> is a complex number; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsEvenInteger​(Complex value)
Determines if a value represents an even integral number.
Returns <see langword="true" /> if <paramref name="value" /> is an even integer; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsFinite​(Complex value)
Determines whether the specified complex number is finite.
Returns <see langword="true" /> if both, the real and imaginary parts are finite (zero, subnormal or normal); otherwise, <see langword="false" /> .
value
A complex number.
public static
bool
IsImaginaryNumber​(Complex value)
Determines if a value represents an imaginary number.
Returns <see langword="true" /> if <paramref name="value" /> is an imaginary number; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsInfinity​(Complex value)
Returns a value indicating whether the specified complex number evaluates to infinity.
Returns <see langword="true" /> if either, the real or imaginary part are <see cref="F:System.Double.PositiveInfinity" /> or <see cref="F:System.Double.NegativeInfinity" /> ; otherwise, <see langword="false" /> .
value
A complex number.
public static
bool
IsInteger​(Complex value)
Determines if a value represents an integral value.
Returns <see langword="true" /> if <paramref name="value" /> is an integer; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsNaN​(Complex value)
Returns a value that indicates whether the specified complex instance is not a number (NaN).
Returns <see langword="true" /> if the specified value is not finite or infinite; otherwise, <see langword="false" /> .
value
A complex number.
Returns <see langword="true" /> if <paramref name="value" /> is negative; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsNegativeInfinity​(Complex value)
Determines if a value is negative infinity.
Returns <see langword="true" /> if <paramref name="value" /> is negative infinity; otherwise, <see langword="false" /> .
value
The value to be checked.
Returns <see langword="true" /> if <paramref name="value" /> is normal; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsOddInteger​(Complex value)
Determines if a value represents an odd integral number.
Returns <see langword="true" /> if <paramref name="value" /> is an odd integer; otherwise, <see langword="false" /> .
value
The value to be checked.
Returns <see langword="true" /> if <paramref name="value" /> is positive; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsPositiveInfinity​(Complex value)
Determines if a value is positive infinity.
Returns <see langword="true" /> if <paramref name="value" /> is positive infinity; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
bool
IsRealNumber​(Complex value)
Determines if a value represents a real number.
Returns <see langword="true" /> if <paramref name="value" /> is a real number; otherwise, <see langword="false" /> .
value
The value to be checked.
Returns <see langword="true" /> if <paramref name="value" /> is subnormal; otherwise, <see langword="false" /> .
value
The value to be checked.
public static
Complex
Log​(Complex value)
Returns the natural (base <see langword="e" /> ) logarithm of a specified complex number.
Returns The natural (base <see langword="e" /> ) logarithm of <paramref name="value" /> .
value
A complex number.
public static
Complex
Log​(Complex value,
double baseValue)
Returns the logarithm of a specified complex number in a specified base.
Returns The logarithm of <paramref name="value" /> in base <paramref name="baseValue" /> .
value
A complex number.
baseValue
The base of the logarithm.
public static
Complex
Log10​(Complex value)
Returns the base-10 logarithm of a specified complex number.
Returns The base-10 logarithm of <paramref name="value" /> .
value
A complex number.
public static
Complex
MaxMagnitude​(Complex x,
Complex y)
Compares two values to compute which is greater.
Returns <paramref name="x" /> if it is greater than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x
The value to compare with <paramref name="y" /> .
y
The value to compare with <paramref name="x" /> .
public static
Complex
MinMagnitude​(Complex x,
Complex y)
Compares two values to compute which is lesser.
Returns <paramref name="x" /> if it is less than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x
The value to compare with <paramref name="y" /> .
y
The value to compare with <paramref name="x" /> .
public static
Complex
Multiply​(double left,
Complex right)
Returns the product of a double-precision real number and a complex number.
Returns The product of the <paramref name="left" /> and <paramref name="right" /> parameters.
left
The double-precision real number to multiply.
right
The complex number to multiply.
public static
Complex
Multiply​(Complex left,
double right)
Returns the product of a complex number and a double-precision real number.
Returns The product of the <paramref name="left" /> and <paramref name="right" /> parameters.
left
The complex number to multiply.
right
The double-precision real number to multiply.
public static
Complex
Multiply​(Complex left,
Complex right)
Returns the product of two complex numbers.
Returns The product of the <paramref name="left" /> and <paramref name="right" /> parameters.
left
The first complex number to multiply.
right
The second complex number to multiply.
public static
Complex
Negate​(Complex value)
Returns the additive inverse of a specified complex number.
Returns The result of the <see cref="P:System.Numerics.Complex.Real" /> and <see cref="P:System.Numerics.Complex.Imaginary" /> components of the <paramref name="value" /> parameter multiplied by -1.
value
A complex number.
public static
Complex
Parse​(ReadOnlySpan<​char> s,
Globalization.​NumberStyles style,
IFormatProvider? provider)
Parses a span of characters into a value.
Returns The result of parsing <paramref name="s" /> .
s
The span of characters to parse.
style
A bitwise combination of number styles that can be present in <paramref name="s" /> .
provider
An object that provides culture-specific formatting information about <paramref name="s" /> .
public static
Complex
Parse​(ReadOnlySpan<​char> s,
IFormatProvider? provider)
Parses a span of characters into a value.
Returns The result of parsing <paramref name="s" /> .
s
The span of characters to parse.
provider
An object that provides culture-specific formatting information about <paramref name="s" /> .
public static
Complex
Parse​(string s,
Globalization.​NumberStyles style,
IFormatProvider? provider)
Parses a string into a value.
Returns The result of parsing <paramref name="s" /> .
s
The string to parse.
style
A bitwise combination of number styles that can be present in <paramref name="s" /> .
provider
An object that provides culture-specific formatting information about <paramref name="s" /> .
public static
Complex
Parse​(string s,
IFormatProvider? provider)
Parses a string into a value.
Returns The result of parsing <paramref name="s" /> .
s
The string to parse.
provider
An object that provides culture-specific formatting information about <paramref name="s" /> .
public static
Complex
Pow​(Complex value,
double power)
Returns a specified complex number raised to a power specified by a double-precision floating-point number.
Returns The complex number <paramref name="value" /> raised to the power <paramref name="power" /> .
value
A complex number to be raised to a power.
power
A double-precision floating-point number that specifies a power.
public static
Complex
Pow​(Complex value,
Complex power)
Returns a specified complex number raised to a power specified by a complex number.
Returns The complex number <paramref name="value" /> raised to the power <paramref name="power" /> .
value
A complex number to be raised to a power.
power
A complex number that specifies a power.
public static
Complex
Reciprocal​(Complex value)
Returns the multiplicative inverse of a complex number.
Returns The reciprocal of <paramref name="value" /> .
value
A complex number.
public static
Complex
Sin​(Complex value)
Returns the sine of the specified complex number.
Returns The sine of <paramref name="value" /> .
value
A complex number.
public static
Complex
Sinh​(Complex value)
Returns the hyperbolic sine of the specified complex number.
Returns The hyperbolic sine of <paramref name="value" /> .
value
A complex number.
public static
Complex
Sqrt​(Complex value)
Returns the square root of a specified complex number.
Returns The square root of <paramref name="value" /> .
value
A complex number.
public static
Complex
Subtract​(double left,
Complex right)
Subtracts one complex number from a double-precision real number and returns the result.
Returns The result of subtracting <paramref name="right" /> from <paramref name="left" /> , as a complex number.
left
The double-precision real value to subtract from (the minuend).
right
The complex value to subtract (the subtrahend).
public static
Complex
Subtract​(Complex left,
double right)
Subtracts one double-precision real number from a complex number and returns the result.
Returns The result of subtracting <paramref name="right" /> from <paramref name="left" /> , as a complex number.
left
The complex value to subtract from (the minuend).
right
The double-precision real value to subtract (the subtrahend).
public static
Complex
Subtract​(Complex left,
Complex right)
Subtracts one complex number from another and returns the result.
Returns The result of subtracting <paramref name="right" /> from <paramref name="left" /> .
left
The value to subtract from (the minuend).
right
The value to subtract (the subtrahend).
public static
Complex
Tan​(Complex value)
Returns the tangent of the specified complex number.
Returns The tangent of <paramref name="value" /> .
value
A complex number.
public static
Complex
Tanh​(Complex value)
Returns the hyperbolic tangent of the specified complex number.
Returns The hyperbolic tangent of <paramref name="value" /> .
value
A complex number.
public
string
ToString​()
Converts the value of the current complex number to its equivalent string representation in Cartesian form.
Returns The string representation of the current instance in Cartesian form.
public
string
ToString​(IFormatProvider? provider)
Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified culture-specific formatting information.
Returns The string representation of the current instance in Cartesian form, as specified by <paramref name="provider" /> .
provider
An object that supplies culture-specific formatting information.
public
string
ToString​(string format)
Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format for its real and imaginary parts.
Returns The string representation of the current instance in Cartesian form.
format
A standard or custom numeric format string.
public
string
ToString​(string format,
IFormatProvider provider)
Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format and culture-specific format information for its real and imaginary parts.
Returns The string representation of the current instance in Cartesian form, as specified by <paramref name="format" /> and <paramref name="provider" /> .
format
A standard or custom numeric format string.
provider
An object that supplies culture-specific formatting information.
public
bool
TryFormat​(Span<​char> destination,
Int32& charsWritten,
ReadOnlySpan<​char> format = null,
IFormatProvider? provider = null)
public
bool
TryFormat​(Span<​byte> utf8Destination,
Int32& bytesWritten,
ReadOnlySpan<​char> format = null,
IFormatProvider? provider = null)
public static
bool
TryParse​(ReadOnlySpan<​char> s,
Globalization.​NumberStyles style,
IFormatProvider? provider,
Complex& result)
public static
bool
TryParse​(ReadOnlySpan<​char> s,
IFormatProvider? provider,
Complex& result)
public static
bool
TryParse​(string s,
Globalization.​NumberStyles style,
IFormatProvider provider,
Complex& result)
protected
void
Finalize​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object