Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference

Skip Navigation LinksHome»Documentation»Reference»Extreme.Mathematics»Complex(T) Structure

ComplexT Structure

Extreme Optimization Numerical Libraries for .NET Professional
Represents a generic complex value.

Namespace:  Extreme.Mathematics
Assembly:  Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
Syntax

C#
VB
C++
F#
Copy
[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.

Constructors

  NameDescription
Public methodComplexT(T)
Constructs a complex number from a real number.
Public methodComplexT(T, T)
Constructs a complex number from its real and imaginary parts.
Public methodComplexT(T, T, Boolean) Obsolete.
Constructs a complex number from rectangular or polar elements.
Top
Properties

  NameDescription
Public propertyIm
Gets the imaginary part of the complex number.
Public propertyIsImaginary
Indicates whether a complex number is a pure imaginary number.
Public propertyIsReal
Indicates whether a complex number is, in fact, real.
Public propertyIsZero
Indicates whether a complex number is equal to zero.
Public propertyMagnitude
Gets the modulus or absolute value of a complex number.
Public propertyMagnitudeSquared
Returns the square of the modulus of a complex number.
Public propertyOneNorm
Returns the sum of the absolute values of the real and the imaginary part of the complex number.
Public propertyPhase
Gets the phase or argument of a complex number.
Public propertyRe
Gets the real part of the complex number.
Top
Methods

  NameDescription
Public methodStatic memberAbs
Returns the absolute value of a complex number.
Public methodStatic memberAcos(T)
Gets the inverse cosine of a real number.
Public methodStatic memberAcos(ComplexT)
Gets the inverse cosine of a complex number.
Public methodStatic memberAcosh
Gets the inverse hyperbolic cosine of a complex number.
Public methodStatic memberAdd(T, ComplexT)
Adds a complex number to a real number.
Public methodStatic memberAdd(ComplexT, T)
Adds a complex number to a real number.
Public methodStatic memberAdd(ComplexT, ComplexT)
Adds two complex numbers.
Public methodStatic memberArg
Returns the argument of a complex number.
Public methodStatic memberAsin(T)
Gets the inverse sine of a real number.
Public methodStatic memberAsin(ComplexT)
Gets the inverse sine of a complex number.
Public methodStatic memberAsinh
Gets the inverse hyperbolic sine of a complex number.
Public methodStatic memberAtan
Gets the inverse tangent of a complex number.
Public methodStatic memberAtanh
Gets the inverse hyperbolic tangent of a complex number.
Public methodConjugate
Returns the conjugate of this complex number.
Public methodStatic memberConjugate(ComplexT)
Returns the conjugate of a complex number.
Public methodStatic memberConjugateMultiply
Multiplies the Conjugate of a complex number and a second complex number.
Public methodStatic memberCos
Gets the cosine of a complex number.
Public methodStatic memberCosh
Gets the hyperbolic cosine of a complex number.
Public methodDeconstruct
Deconstructs a complex number into its real and complex parts.
Public methodStatic memberDecrement
Decrements the real part of a complex number by one.
Public methodStatic memberDivide(T, ComplexT)
Divides a real number by a complex number.
Public methodStatic memberDivide(ComplexT, T)
Divides a complex number by a real number.
Public methodStatic memberDivide(ComplexT, ComplexT)
Divides a complex number by another.
Public methodEquals(T)
Compares a complex number to a real number.
Public methodEquals(ComplexT)
Compares a complex number to another complex number.
Public methodEquals(Object)
Overridden. Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object).)
Public methodStatic memberExp
Returns e raised to the specified power.
Public methodStatic memberExpI
Evaluates the exponential function for an imaginary argument.
Public methodStatic memberFromPolar
Constructs a complex number from polar elements.
Public methodGetHashCode
Overridden. Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode.)
Public methodStatic memberGetImaginaryPart
Returns an array of Doubles that contains the imaginary parts of an array of complex numbers.
Public methodStatic memberGetRealPart
Returns an array of Doubles that contains the real parts of an array of complex numbers.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberImaginary
Constructs a complex number that has a purely imaginary value.
Public methodStatic memberIncrement
Increments the real part of a complex number by one.
Public methodStatic memberIsInfinity
Indicates whether a complex number is infinite.
Public methodStatic memberIsNaN
Indicates whether a complex number is undefined.
Public methodStatic memberLog(ComplexT)
Returns the natural logarithm of a complex number.
Public methodStatic memberLog(ComplexT, ComplexT)
Returns the logarithm of a complex number to the specified base.
Public methodStatic memberLog10
Returns the base 10 logarithm of a complex number.
Public methodStatic memberMultiply(T, ComplexT)
Multiplies a complex number and a real number.
Public methodStatic memberMultiply(ComplexT, T)
Multiplies a complex number and a real number.
Public methodStatic memberMultiply(ComplexT, ComplexT)
Multiplies two complex numbers.
Public methodStatic memberNegate
Negates a complex number.
Public methodStatic memberPlus
Applies the unary plus operator to a complex number.
Public methodStatic memberPow(ComplexT, T)
Returns a complex number raised to the specified power.
Public methodStatic memberPow(ComplexT, ComplexT)
Returns a complex number raised to the specified power.
Public methodStatic memberPow(ComplexT, Int32)
Returns a complex number raised to the specified integer power.
Public methodStatic memberReciprocal
Returns the reciprocal of a complex number.
Public methodStatic memberRootOfUnity
Returns a complex number that is the specified root of unity of the specified degree.
Public methodStatic memberSin
Gets the sine of a complex number.
Public methodStatic memberSinh
Gets the hyperbolic sine of a complex number.
Public methodStatic memberSqrt(T)
Returns the first square root of a real number.
Public methodStatic memberSqrt(ComplexT)
Returns the first square root of a complex number.
Public methodStatic memberSubtract(T, ComplexT)
Subtracts a complex number from a real number.
Public methodStatic memberSubtract(ComplexT, T)
Subtracts a real number from a complex number.
Public methodStatic memberSubtract(ComplexT, ComplexT)
Subtracts two complex numbers.
Public methodStatic memberTan
Gets the tangent of a complex number.
Public methodStatic memberTanh
Gets the hyperbolic tangent of a complex number.
Public methodToString
Converts the numeric value of this instance to its equivalent string representation.
(Overrides ValueTypeToString.)
Public methodToString(IFormatProvider)
Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
Public methodToString(String)
Converts the numeric value of this instance to its equivalent string representation using the specified format.
Public methodToString(String, IFormatProvider)
Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
Top
Operators

  NameDescription
Public operatorStatic memberAddition(T, ComplexT)
Adds a complex number to a real number.
Public operatorStatic memberAddition(ComplexT, T)
Adds a complex number to a real number.
Public operatorStatic memberAddition(ComplexT, ComplexT)
Adds two complex numbers.
Public operatorStatic memberDecrement
Decrements the real part of a complex number by one.
Public operatorStatic memberDivision(T, ComplexT)
Divides a real number by a complex number.
Public operatorStatic memberDivision(ComplexT, T)
Divides a complex number by a real number.
Public operatorStatic memberDivision(ComplexT, ComplexT)
Divides a complex number by another.
Public operatorStatic memberEquality(T, ComplexT)
Compares a complex number and a real number for equality.
Public operatorStatic memberEquality(ComplexT, T)
Compares a complex number and a real number for equality.
Public operatorStatic memberEquality(ComplexT, ComplexT)
Compares two complex numbers for equality.
Public operatorStatic member(ComplexT to T)
Casts a complex number to a real number. The imaginary part must be zero.
Public operatorStatic memberExponent(ComplexT, T)
Represents the exponentiation operator.
Public operatorStatic memberExponent(ComplexT, ComplexT)
Represents the exponentiation operator.
Public operatorStatic memberExponent(ComplexT, Int32)
Represents the exponentiation operator.
Public operatorStatic memberExponentiation(ComplexT, T)
Represents the exponentiation operator.
Public operatorStatic memberExponentiation(ComplexT, ComplexT)
Represents the exponentiation operator.
Public operatorStatic memberExponentiation(ComplexT, Int32)
Represents the exponentiation operator.
Public operatorStatic member(T to ComplexT)
Implicitly casts a real number to a complex type.
Public operatorStatic member(ValueTupleT, T to ComplexT)
Implicitly casts a tuple of two real numbers to a complex type.
Public operatorStatic memberIncrement
Increments the real part of a complex number by one.
Public operatorStatic memberInequality(T, ComplexT)
Compares a complex number and a real number for inequality.
Public operatorStatic memberInequality(ComplexT, T)
Compares a complex number and a real number for inequality.
Public operatorStatic memberInequality(ComplexT, ComplexT)
Compares two complex numbers for inequality.
Public operatorStatic memberMultiply(T, ComplexT)
Multiplies a complex number and a real number.
Public operatorStatic memberMultiply(ComplexT, T)
Multiplies a complex number and a real number.
Public operatorStatic memberMultiply(ComplexT, ComplexT)
Multiplies two complex numbers.
Public operatorStatic memberSubtraction(T, ComplexT)
Subtracts a complex number from a real number.
Public operatorStatic memberSubtraction(ComplexT, T)
Subtracts a real number from a complex number.
Public operatorStatic memberSubtraction(ComplexT, ComplexT)
Subtracts two complex numbers.
Public operatorStatic memberUnaryNegation
Negates a complex number.
Public operatorStatic memberUnaryPlus
Applies the unary plus operator to a complex number.
Top
Fields

  NameDescription
Public fieldStatic memberI
Represents the square root of -1.
Public fieldStatic memberInfinity
Represents complex infinity.
Public fieldStatic memberNaN
Represents complex NaN, or Not a Number.
Public fieldStatic memberOne
Represents the complex number one.
Public fieldStatic memberZero
Represents the complex number zero.
Top
Remarks

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.

See Also

Reference

Extreme.Mathematics Namespace

Copyright (c) 2004-2023 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2023, Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo
are registered trademarks of Microsoft Corporation.