Represents a generic complex value.
Namespace:
Extreme.Mathematics
Assembly:
Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
[SerializableAttribute]
public readonly struct Complex<T> : IEquatable<Complex<T>>,
IEquatable<T>, IComparable<Complex<T>>
<SerializableAttribute>
Public Structure Complex(Of T)
Implements IEquatable(Of Complex(Of T)), IEquatable(Of T),
IComparable(Of Complex(Of T))
[SerializableAttribute]
generic<typename T>
public value class Complex : IEquatable<Complex<T>>,
IEquatable<T>, IComparable<Complex<T>>
[<SealedAttribute>]
[<SerializableAttribute>]
type Complex<'T> =
struct
interface IEquatable<Complex<'T>>
interface IEquatable<'T>
interface IComparable<Complex<'T>>
end
Type Parameters
- T
The ComplexT type exposes the following members.
| Name | Description |
---|
 | ComplexT(T) |
Constructs a complex number from a real number.
|
 | ComplexT(T, T) |
Constructs a complex number from its real and imaginary
parts.
|
 | ComplexT(T, T, Boolean) | Obsolete.
Constructs a complex number from rectangular or
polar elements.
|
Top
| Name | Description |
---|
 | Im |
Gets the imaginary part of the complex number.
|
 | IsImaginary |
Indicates whether a complex number is a pure
imaginary number.
|
 | IsReal |
Indicates whether a complex number is, in fact,
real.
|
 | IsZero |
Indicates whether a complex number is equal to
zero.
|
 | Magnitude |
Gets the modulus or absolute value of a
complex number.
|
 | MagnitudeSquared |
Returns the square of the modulus of a complex
number.
|
 | OneNorm |
Returns the sum of the absolute values of the real and the imaginary part
of the complex number.
|
 | Phase |
Gets the phase or argument of a complex number.
|
 | Re |
Gets the real part of the complex number.
|
Top
| Name | Description |
---|
  | Abs |
Returns the absolute value of a complex
number.
|
  | Acos(T) |
Gets the inverse cosine of a real number.
|
  | Acos(ComplexT) |
Gets the inverse cosine of a complex number.
|
  | Acosh |
Gets the inverse hyperbolic cosine of a complex number.
|
  | Add(T, ComplexT) |
Adds a complex number to a real number.
|
  | Add(ComplexT, T) |
Adds a complex number to a real number.
|
  | Add(ComplexT, ComplexT) |
Adds two complex numbers.
|
  | Arg |
Returns the argument of a complex
number.
|
  | Asin(T) |
Gets the inverse sine of a real number.
|
  | Asin(ComplexT) |
Gets the inverse sine of a complex number.
|
  | Asinh |
Gets the inverse hyperbolic sine of a complex number.
|
  | Atan |
Gets the inverse tangent of a complex number.
|
  | Atanh |
Gets the inverse hyperbolic tangent of a complex number.
|
 | Conjugate |
Returns the conjugate of this complex number.
|
  | Conjugate(ComplexT) |
Returns the conjugate of a complex number.
|
  | ConjugateMultiply |
Multiplies the Conjugate of a complex number
and a second complex number.
|
  | Cos |
Gets the cosine of a complex number.
|
  | Cosh |
Gets the hyperbolic cosine of a complex number.
|
 | Deconstruct |
Deconstructs a complex number into its real and complex parts.
|
  | Decrement |
Decrements the real part of a complex number
by one.
|
  | Divide(T, ComplexT) |
Divides a real number by a complex number.
|
  | Divide(ComplexT, T) |
Divides a complex number by a real number.
|
  | Divide(ComplexT, ComplexT) |
Divides a complex number by another.
|
 | Equals(T) |
Compares a complex number to a real number.
|
 | Equals(ComplexT) |
Compares a complex number to another complex number.
|
 | Equals(Object) |
Overridden. Returns a value indicating whether this
instance is equal to a specified object.
(Overrides ValueTypeEquals(Object).) |
  | Exp |
Returns e raised to the specified power.
|
  | ExpI |
Evaluates the exponential function for an imaginary
argument.
|
  | FromPolar |
Constructs a complex number from polar elements.
|
 | GetHashCode |
Overridden. Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode.) |
  | GetImaginaryPart |
Returns an array of Doubles that contains the imaginary
parts of an array of complex numbers.
|
  | GetRealPart |
Returns an array of Doubles that contains the real
parts of an array of complex numbers.
|
 | GetType | Gets the Type of the current instance. (Inherited from Object.) |
  | Imaginary |
Constructs a complex number that has a purely imaginary value.
|
  | Increment |
Increments the real part of a complex number
by one.
|
  | IsInfinity |
Indicates whether a complex number is
infinite.
|
  | IsNaN |
Indicates whether a complex number is
undefined.
|
  | Log(ComplexT) |
Returns the natural logarithm of a complex number.
|
  | Log(ComplexT, ComplexT) |
Returns the logarithm of a complex number
to the specified base.
|
  | Log10 |
Returns the base 10 logarithm of a complex number.
|
  | Multiply(T, ComplexT) |
Multiplies a complex number and a real number.
|
  | Multiply(ComplexT, T) |
Multiplies a complex number and a real number.
|
  | Multiply(ComplexT, ComplexT) |
Multiplies two complex numbers.
|
  | Negate |
Negates a complex number.
|
  | Plus |
Applies the unary plus operator to a complex number.
|
  | Pow(ComplexT, T) |
Returns a complex number raised to the specified
power.
|
  | Pow(ComplexT, ComplexT) |
Returns a complex number raised to the specified
power.
|
  | Pow(ComplexT, Int32) |
Returns a complex number raised to the specified
integer power.
|
  | Reciprocal |
Returns the reciprocal of a complex number.
|
  | RootOfUnity |
Returns a complex number that is the specified
root of unity of the specified degree.
|
  | Sin |
Gets the sine of a complex number.
|
  | Sinh |
Gets the hyperbolic sine of a complex number.
|
  | Sqrt(T) |
Returns the first square root of a real number.
|
  | Sqrt(ComplexT) |
Returns the first square root of a complex number.
|
  | Subtract(T, ComplexT) |
Subtracts a complex number from a real number.
|
  | Subtract(ComplexT, T) |
Subtracts a real number from a complex number.
|
  | Subtract(ComplexT, ComplexT) |
Subtracts two complex numbers.
|
  | Tan |
Gets the tangent of a complex number.
|
  | Tanh |
Gets the hyperbolic tangent of a complex number.
|
 | ToString |
Converts the numeric value of this instance to its
equivalent string representation.
(Overrides ValueTypeToString.) |
 | ToString(IFormatProvider) |
Converts the numeric value of this instance to its
equivalent string representation using the specified
culture-specific format information.
|
 | ToString(String) |
Converts the numeric value of this instance to its
equivalent string representation using the specified
format.
|
 | ToString(String, IFormatProvider) |
Converts the numeric value of this instance to its
equivalent string representation using the specified
format and culture-specific format information.
|
Top
| Name | Description |
---|
  | Addition(T, ComplexT) |
Adds a complex number to a real number.
|
  | Addition(ComplexT, T) |
Adds a complex number to a real number.
|
  | Addition(ComplexT, ComplexT) |
Adds two complex numbers.
|
  | Decrement |
Decrements the real part of a complex number
by one.
|
  | Division(T, ComplexT) |
Divides a real number by a complex number.
|
  | Division(ComplexT, T) |
Divides a complex number by a real number.
|
  | Division(ComplexT, ComplexT) |
Divides a complex number by another.
|
  | Equality(T, ComplexT) |
Compares a complex number and a real number for equality.
|
  | Equality(ComplexT, T) |
Compares a complex number and a real number for equality.
|
  | Equality(ComplexT, ComplexT) |
Compares two complex numbers for equality.
|
  | (ComplexT to T) |
Casts a complex number to a real number. The
imaginary part must be zero.
|
  | Exponent(ComplexT, T) |
Represents the exponentiation operator.
|
  | Exponent(ComplexT, ComplexT) |
Represents the exponentiation operator.
|
  | Exponent(ComplexT, Int32) |
Represents the exponentiation operator.
|
  | Exponentiation(ComplexT, T) |
Represents the exponentiation operator.
|
  | Exponentiation(ComplexT, ComplexT) |
Represents the exponentiation operator.
|
  | Exponentiation(ComplexT, Int32) |
Represents the exponentiation operator.
|
  | (T to ComplexT) |
Implicitly casts a real number to a complex type.
|
  | (ValueTupleT, T to ComplexT) |
Implicitly casts a tuple of two real numbers to a complex type.
|
  | Increment |
Increments the real part of a complex number
by one.
|
  | Inequality(T, ComplexT) |
Compares a complex number and a real number
for inequality.
|
  | Inequality(ComplexT, T) |
Compares a complex number and a real number
for inequality.
|
  | Inequality(ComplexT, ComplexT) |
Compares two complex numbers for inequality.
|
  | Multiply(T, ComplexT) |
Multiplies a complex number and a real number.
|
  | Multiply(ComplexT, T) |
Multiplies a complex number and a real number.
|
  | Multiply(ComplexT, ComplexT) |
Multiplies two complex numbers.
|
  | Subtraction(T, ComplexT) |
Subtracts a complex number from a real number.
|
  | Subtraction(ComplexT, T) |
Subtracts a real number from a complex number.
|
  | Subtraction(ComplexT, ComplexT) |
Subtracts two complex numbers.
|
  | UnaryNegation |
Negates a complex number.
|
  | UnaryPlus |
Applies the unary plus operator to a complex number.
|
Top
Top
The complex value type represents a complex value
made of real and imaginary parts of type T.
Complex numbers arise in algebra in the solution of
quadratic equations. The equation x2= –R.One
does not have any real solutions. However, if we define
a new number, i as the square root of -R.One, then we
have two solutions: i and -i.
This, in turn, gives rise to an entirely new class
of numbers of the form a + ib with a and
b real, and i defined as above. These are
the complex numbers.
The complex structure provides methods for all
the common operations on complex numbers. The Re
property returns the real element of the complex number,
while Im returns the imaginary part.
Because the complex numbers don't have a natural ordering,
only equality and inequality operators are available.
Overloaded versions of the major arithmetic operators
are provided for languages that support them. For languages
that don't support operator overloading, equivalent
methods are supplied.
When performing binary operations, if one of the
operands is a complex, then the other operand is
required to be either of type complex or .
Prior to performing the operation, if the other operand is
not a complex, it is converted to complex.
If the operation produces a numeric
result, the type of the result is complex.
Exceptions to this are methods that return a real
property of a complex number: Phase,
Magnitude, MagnitudeSquared and
Abs(ComplexT). These methods return a T
value.
If T is a floating-point type, then operations including the assignment
operators, do not throw exceptions. Instead, in exceptional
situations, the result of a floating-point operation is
zero, Infinity, or NaN,
as described below:
-
If the result of a complex floating-point operation is too
small for the destination format, the result of the
operation is zero.
-
If the magnitude of the complex result of a floating-point
operation is too large for the destination format, the
result of the operation is Infinity.
Directed infinities are currently not supported.
-
If a complex floating-point operation is invalid, the result
of the operation is NaN.
-
If one or both operands of a complex floating-point operation
are NaN, the result of the operation is
NaN.
Many elementary functions have been extended to the complex domain.
These are implemented by static methods.
Some of these functions are multi-valued. If there is one real argument,
then any symmetry or anti-symmetry about the origin is preserved. For example,
the inverse sine function satisfies asin(-x) == -asin(x) for
-1 <= x <= 1. The Asin(ComplexT)
method satisfies this relationship for any real value of x.
For complex arguments, the identity Conjugate(f(x)) == f(Conjugate(x))
is preserved. The branch cuts for all complex functions defined here are along either
the real or the imaginary axis. Along the branch cuts, the functions have different
values depending on whether the zero element is normal (positive) zero or
negative zero.
The real and imaginary parts of complex
numbers are real numbers.
Reference