Imaginary<T> Structure

Represents a generic imaginary value.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
[SerializableAttribute]
public readonly struct Imaginary<T> : IEquatable<Imaginary<T>>, 
	IEquatable<Complex<T>>, IEquatable<T>, IComparable<Imaginary<T>>
Inheritance
Object  →  ValueType  →  Imaginary<T>
Implements
IComparable<Imaginary<T>>, IEquatable<Imaginary<T>>, IEquatable<Complex<T>>, IEquatable<T>

Type Parameters

T

Remarks

The imaginary value type represents a complex value made of a zero real part and an imaginary part of type T.

Imaginary numbers are a special kind of 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 imaginary structure provides methods for all the common operations on imaginary numbers. The Im returns the imaginary part of the imaginary number. 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 static methods are supplied.

Binary operations are defined between imaginary numbers and real, imaginary, and complex numbers. The type of the result depends on the combination of operands. For example, multiplying two imaginary numbers results in a real number.

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(Imaginary<T>) 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.

Constructors

Imaginary<T> Constructs an imaginary number from its imaginary part.

Properties

Im Gets the imaginary part of the complex number.
IsImaginary Indicates whether an imaginary number is a pure imaginary number.
IsReal Indicates whether an imaginary number is, in fact, real.
IsZero Indicates whether an imaginary number is equal to zero.
Magnitude Gets the magnitude, modulus or absolute value of an imaginary 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 imaginary number.
Phase Gets the phase or argument of an imaginary number.

Methods

Abs Returns the absolute value of an imaginary number.
Acos Gets the inverse cosine of an imaginary number.
Acosh Gets the inverse hyperbolic cosine of an imaginary number.
Add(T, Imaginary<T>) Adds an imaginary number to a real number.
Add(Imaginary<T>, T) Adds an imaginary number to a real number.
Add(Imaginary<T>, Imaginary<T>) Adds two imaginary numbers.
Arg Returns the argument of an imaginary number.
Asin Gets the inverse sine of an imaginary number.
Asinh Gets the inverse hyperbolic sine of an imaginary number.
Atan Gets the inverse tangent of an imaginary number.
Atanh Gets the inverse hyperbolic tangent of an imaginary number.
Cbrt Returns the first square root of an imaginary number.
Conjugate() Returns the conjugate of this imaginary number.
Conjugate(Imaginary<T>) Returns the conjugate of an imaginary number.
ConjugateMultiply Multiplies the Conjugate() of an imaginary number and a second imaginary number.
Cos Gets the cosine of an imaginary number.
Cosh Gets the hyperbolic cosine of an imaginary number.
Deconstruct Deconstructs an imaginary number into its real and complex parts.
Divide(T, Imaginary<T>) Divides a real number by an imaginary number.
Divide(Imaginary<T>, T) Divides an imaginary number by a real number.
Divide(Imaginary<T>, Imaginary<T>) Divides an imaginary number by another.
Equals(Complex<T>) Compares an imaginary number to a complex number.
Equals(T) Compares an imaginary number to a real number.
Equals(Imaginary<T>) Compares an imaginary number to another complex number.
Equals(Object) Overridden. Returns whether this instance is equal to a specified object.
(Overrides ValueType.Equals(Object))
Exp Returns e raised to the specified power.
Exp10 Returns 10 raised to the specified power.
Exp2 Returns 2 raised to the specified power.
ExpM1 Computes E raised to a given power and subtracts one.
GetHashCode Overridden. Returns the hash code for this instance.
(Overrides ValueType.GetHashCode())
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.
GetTypeGets the Type of the current instance.
(Inherited from Object)
IsInfinity Indicates whether an imaginary number is infinite.
IsNaN Indicates whether an imaginary number is undefined.
Log(Imaginary<T>) Returns the natural logarithm of an imaginary number.
Log(Imaginary<T>, Imaginary<T>) Returns the logarithm of an imaginary number to the specified base.
Log10 Returns the base 10 logarithm of an imaginary number.
Log2 Returns the base 2 logarithm of an imaginary number.
Multiply(T, Imaginary<T>) Multiplies an imaginary number and a real number.
Multiply(Imaginary<T>, T) Multiplies an imaginary number and a real number.
Multiply(Imaginary<T>, Imaginary<T>) Multiplies two imaginary numbers.
Negate Negates an imaginary number.
Plus Applies the unary plus operator to an imaginary number.
Pow(Imaginary<T>, T) Returns an imaginary number raised to the specified power.
Pow(Imaginary<T>, Imaginary<T>) Returns an imaginary number raised to the specified power.
Pow(Imaginary<T>, Int32) Returns an imaginary number raised to the specified integer power.
Reciprocal Returns the reciprocal of an imaginary number.
Sin Gets the sine of an imaginary number.
SinCos Gets the sine and cosine of an imaginary number.
Sinh Gets the hyperbolic sine of an imaginary number.
Sqrt Returns the first square root of an imaginary number.
Subtract(T, Imaginary<T>) Subtracts an imaginary number from a real number.
Subtract(Imaginary<T>, T) Subtracts a real number from an imaginary number.
Subtract(Imaginary<T>, Imaginary<T>) Subtracts two imaginary numbers.
Tan Gets the tangent of an imaginary number.
Tanh Gets the hyperbolic tangent of an imaginary number.
ToString() Converts the numeric value of this instance to its equivalent string representation.
(Overrides ValueType.ToString())
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.

Operators

Addition(Complex<T>, Imaginary<T>) Adds an imaginary number to a complex number.
Addition(T, Imaginary<T>) Adds an imaginary number to a real number.
Addition(Imaginary<T>, T) Adds an imaginary number to a real number.
Addition(Imaginary<T>, Complex<T>) Adds an imaginary number to a complex number.
Addition(Imaginary<T>, Imaginary<T>) Adds two complex numbers.
Division(Complex<T>, Imaginary<T>) Divides a complex number by an imaginary number.
Division(T, Imaginary<T>) Divides a real number by an imaginary number.
Division(Imaginary<T>, T) Divides an imaginary number by a real number.
Division(Imaginary<T>, Complex<T>) Divides an imaginary number by a complex number.
Division(Imaginary<T>, Imaginary<T>) Divides an imaginary number by another.
Equality(T, Imaginary<T>) Compares an imaginary number and a real number for equality.
Equality(Imaginary<T>, T) Compares an imaginary number and a real number for equality.
Equality(Imaginary<T>, Imaginary<T>) Compares two complex numbers for equality.
Explicit(Complex<T> to Imaginary<T>) Casts a complex number to an imaginary number. The real part is set to zero.
Explicit(Imaginary<T> to T) Casts an imaginary number to a real number. The imaginary part must be zero.
Exponent(Imaginary<T>, T) Represents the exponentiation operator.
Exponent(Imaginary<T>, Imaginary<T>) Represents the exponentiation operator.
Exponent(Imaginary<T>, Int32) Represents the exponentiation operator.
Exponentiation(Imaginary<T>, T) Represents the exponentiation operator.
Exponentiation(Imaginary<T>, Imaginary<T>) Represents the exponentiation operator.
Exponentiation(Imaginary<T>, Int32) Represents the exponentiation operator.
Implicit(T to Imaginary<T>) Implicitly casts a real number to a complex type.
Implicit(Imaginary<T> to Complex<T>) Implicitly converts an imaginary number to a complex number.
Inequality(T, Imaginary<T>) Compares an imaginary number and a real number for inequality.
Inequality(Imaginary<T>, T) Compares an imaginary number and a real number for inequality.
Inequality(Imaginary<T>, Imaginary<T>) Compares two complex numbers for inequality.
Multiply(Complex<T>, Imaginary<T>) Multiplies an imaginary number and a complex number.
Multiply(T, Imaginary<T>) Multiplies an imaginary number and a real number.
Multiply(Imaginary<T>, T) Multiplies an imaginary number and a real number.
Multiply(Imaginary<T>, Complex<T>) Multiplies an imaginary number and a complex number.
Multiply(Imaginary<T>, Imaginary<T>) Multiplies two complex numbers.
Subtraction(Complex<T>, Imaginary<T>) Subtracts an imaginary number from a complex number.
Subtraction(T, Imaginary<T>) Subtracts an imaginary number from a real number.
Subtraction(Imaginary<T>, T) Subtracts a real number from an imaginary number.
Subtraction(Imaginary<T>, Complex<T>) Subtracts a complex number from an imaginary number.
Subtraction(Imaginary<T>, Imaginary<T>) Subtracts two complex numbers.
UnaryNegation(Imaginary<T>) Negates an imaginary number.
UnaryPlus(Imaginary<T>) Applies the unary plus operator to an imaginary number.

Fields

I Represents the square root of -1.
Infinity Represents complex infinity.
NaN Represents complex NaN, or Not a Number.
Zero Represents the complex number zero.

See Also