Struct Complex
Structure defining a complex number.
Implements
Namespace: BRIDGES.Arithmetic.Numbers
Assembly: BRIDGES.dll
Syntax
public struct Complex : IDotProduct<Complex, Complex>, INorm<Complex>, IMetric<Complex>, IGroupAction<Complex, double>, IGroupAction<Complex, Real>
Constructors
| Improve this Doc View SourceComplex(Complex)
Declaration
public Complex(Complex complex)
Parameters
Type | Name | Description |
---|---|---|
Complex | complex | Complex number to deep copy. |
Complex(Double, Double)
Initialises a new instance of Complex structure by defining it real and imaginary parts.
Declaration
public Complex(double real, double imaginary)
Parameters
Type | Name | Description |
---|---|---|
Double | real | Value of the real part. |
Double | imaginary | Value of the imaginary part. |
Properties
| Improve this Doc View SourceArgument
Gets the argument of this Complex number.
Declaration
public readonly double Argument { get; }
Property Value
Type | Description |
---|---|
Double |
ImaginaryOne
Gets a new instance of the Complex structure equal to the unit imaginary element : (0.0, 1.0)
.
Declaration
public static readonly Complex ImaginaryOne { get; }
Property Value
Type | Description |
---|---|
Complex | The new Complex number equal to imaginary one. |
ImaginaryPart
Gets or sets the imaginary component of this Complex number.
Declaration
public double ImaginaryPart { get; set; }
Property Value
Type | Description |
---|---|
Double |
Modulus
Gets the modulus of this Complex number.
Declaration
public readonly double Modulus { get; }
Property Value
Type | Description |
---|---|
Double |
One
Gets a new instance of the Complex structure equal to the multiplicative neutral element : (0.0, 1.0)
.
Declaration
public static readonly Complex One { get; }
Property Value
Type | Description |
---|---|
Complex | The new Complex number equal to one. |
RealPart
Gets or sets the real component of this Complex number.
Declaration
public double RealPart { get; set; }
Property Value
Type | Description |
---|---|
Double |
Zero
Gets a new instance of the Complex structure equal to the additive neutral element : (0.0, 1.0)
.
Declaration
public static readonly Complex Zero { get; }
Property Value
Type | Description |
---|---|
Complex | The new Complex number equal to zero. |
Methods
| Improve this Doc View SourceAdd(Complex, Complex)
Computes the addition of two Complex numbers.
Declaration
public static Complex Add(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the addition. |
Complex | right | Complex number for the addition. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Add(Complex, Real)
Declaration
public static Complex Add(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the addition. |
Real | right | Real number for the addition. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Add(Real, Complex)
Declaration
public static Complex Add(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number for the addition. |
Complex | right | Complex number for the addition. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Conjugate(Complex)
Gets the conjugate value of a Complex number.
Declaration
public static Complex Conjugate(Complex complex)
Parameters
Type | Name | Description |
---|---|---|
Complex | complex | Complex number from which the conjugate is computed. |
Returns
Type | Description |
---|---|
Complex | The new Complex number, conjugate of the initial one. |
DistanceTo(Complex)
Computes the distance of this element to another element.
Declaration
public double DistanceTo(Complex other)
Parameters
Type | Name | Description |
---|---|---|
Complex | other |
Returns
Type | Description |
---|---|
Double | The value of the distance between the two elements. |
Divide(Complex, Complex)
Computes the division of two Complex numbers.
Declaration
public static Complex Divide(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to divide. |
Complex | right | Complex number to divide with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
Divide(Complex, Real)
Declaration
public static Complex Divide(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to divide. |
Real | right | Real number to divide with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
Divide(Complex, Double)
Computes the scalar division of a Complex number with a
Declaration
public static Complex Divide(Complex operand, double divisor)
Parameters
Type | Name | Description |
---|---|---|
Complex | operand | Complex number to divide. |
Double | divisor |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the scalar division. |
Divide(Real, Complex)
Declaration
public static Complex Divide(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number to divide. |
Complex | right | Complex number to divide with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
DotProduct(Complex)
Declaration
public Complex DotProduct(Complex other)
Parameters
Type | Name | Description |
---|---|---|
Complex | other | Right Complex for number the dot product. |
Returns
Type | Description |
---|---|
Complex | The value of the dot product of the two elements. |
Equals(Complex)
Structure defining a complex number.
Declaration
public bool Equals(Complex other)
Parameters
Type | Name | Description |
---|---|---|
Complex | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Structure defining a complex number.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
FromPolarCoordinates(Double, Double)
Gets a new Complex number by defining its polar coordinates.
Declaration
public static Complex FromPolarCoordinates(double modulus, double argument)
Parameters
Type | Name | Description |
---|---|---|
Double | modulus | Value of the modulus. |
Double | argument | Value of the argument (in radians). |
Returns
Type | Description |
---|---|
Complex | The new Complex number. |
GetHashCode()
Structure defining a complex number.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Inverse(Complex)
Computes the inverse of the given Complex number.
Declaration
public static Complex Inverse(Complex operand)
Parameters
Type | Name | Description |
---|---|---|
Complex | operand | Complex from which the inverse is computed. |
Returns
Type | Description |
---|---|
Complex | The new Complex number, inverse of the initial one. |
Multiply(Complex, Complex)
Computes the multiplication of two Complex numbers.
Declaration
public static Complex Multiply(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the multiplication. |
Complex | right | Complex number for the multiplication. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Multiply(Complex, Real)
Declaration
public static Complex Multiply(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the multiplicaion. |
Real | right | Real number for the multiplicaion. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Multiply(Complex, Double)
Computes the right scalar multiplication of a Complex number with a
Declaration
public static Complex Multiply(Complex operand, double factor)
Parameters
Type | Name | Description |
---|---|---|
Complex | operand | Complex number to multiply. |
Double | factor |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the right scalar multiplication. |
Multiply(Real, Complex)
Declaration
public static Complex Multiply(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number for the multiplicaion. |
Complex | right | Complex number for the multiplicaion. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Multiply(Double, Complex)
Computes the left scalar multiplication of a Complex number with a
Declaration
public static Complex Multiply(double factor, Complex operand)
Parameters
Type | Name | Description |
---|---|---|
Double | factor | |
Complex | operand | Complex number to multiply. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the left scalar multiplication. |
Norm()
Computes the norm of this element.
Declaration
public double Norm()
Returns
Type | Description |
---|---|
Double | The value of the norm. |
Opposite(Complex)
Computes the opposite of the given Complex number.
Declaration
public static Complex Opposite(Complex operand)
Parameters
Type | Name | Description |
---|---|---|
Complex | operand | Complex number from which the opposite is computed. |
Returns
Type | Description |
---|---|
Complex | The new Complex number, opposite of the initial one. |
Subtract(Complex, Complex)
Computes the subtraction of two Complex numbers.
Declaration
public static Complex Subtract(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to subtract. |
Complex | right | Complex number to subtract with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
Subtract(Complex, Real)
Declaration
public static Complex Subtract(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to subtract. |
Real | right | Real number to subtract with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
Subtract(Real, Complex)
Declaration
public static Complex Subtract(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number to subtract. |
Complex | right | Complex number to subtract with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
ToString()
Structure defining a complex number.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |
Operators
| Improve this Doc View SourceAddition(Complex, Complex)
Computes the addition of two Complex numbers.
Declaration
public static Complex operator +(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the addition. |
Complex | right | Complex number for the addition. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Addition(Complex, Real)
Declaration
public static Complex operator +(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the addition. |
Real | right | Real number for the addition. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Addition(Complex, Double)
Computes the right addition of a Complex number with a
Declaration
public static Complex operator +(Complex left, double right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the addition. |
Double | right |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Addition(Real, Complex)
Declaration
public static Complex operator +(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number for the addition. |
Complex | right | Complex number for the addition. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Addition(Double, Complex)
Computes the left addition of a Complex number with a
Declaration
public static Complex operator +(double left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Double | left | |
Complex | right | Complex number for the addition. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the addition. |
Division(Complex, Complex)
Computes the division of two Complex numbers.
Declaration
public static Complex operator /(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to divide. |
Complex | right | Complex number to divide with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
Division(Complex, Real)
Declaration
public static Complex operator /(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to divide. |
Real | right | Real number to divide with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
Division(Complex, Double)
Computes the division of a Complex number with a
Declaration
public static Complex operator /(Complex left, double right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to divide. |
Double | right |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
Division(Real, Complex)
Declaration
public static Complex operator /(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number to divide. |
Complex | right | Complex number to divide with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
Division(Double, Complex)
Computes the division of a
Declaration
public static Complex operator /(double left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Double | left | |
Complex | right | Complex number to divide with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the division. |
Explicit(Real to Complex)
Declaration
public static explicit operator Complex(Real real)
Parameters
Type | Name | Description |
---|---|---|
Real | real | Real number to convert. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the conversion. |
Explicit(Double to Complex)
Converts a
Declaration
public static explicit operator Complex(double number)
Parameters
Type | Name | Description |
---|---|---|
Double | number |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the conversion. |
Explicit(ValueTuple<Double, Double> to Complex)
Converts a
Declaration
public static explicit operator Complex(ValueTuple<double, double> pair)
Parameters
Type | Name | Description |
---|---|---|
ValueTuple<Double, Double> | pair |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the conversion. |
Multiply(Complex, Complex)
Computes the multiplication of two Complex numbers.
Declaration
public static Complex operator *(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the multiplication. |
Complex | right | Complex number for the multiplication. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Multiply(Complex, Real)
Declaration
public static Complex operator *(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the multiplicaion. |
Real | right | Real number for the multiplicaion. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Multiply(Complex, Double)
Computes the right multiplication of a Complex number with a
Declaration
public static Complex operator *(Complex left, double right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number for the multiplicaion. |
Double | right |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Multiply(Real, Complex)
Declaration
public static Complex operator *(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number for the multiplicaion. |
Complex | right | Complex number for the multiplicaion. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Multiply(Double, Complex)
Computes the left multiplication of a
Declaration
public static Complex operator *(double left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Double | left | |
Complex | right | Complex number for the multiplicaion. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the multiplication. |
Subtraction(Complex, Complex)
Computes the subtraction of two Complex numbers.
Declaration
public static Complex operator -(Complex left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to subtract. |
Complex | right | Complex number to subtract with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
Subtraction(Complex, Real)
Declaration
public static Complex operator -(Complex left, Real right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to subtract. |
Real | right | Real number to subtract with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
Subtraction(Complex, Double)
Computes the subtraction of a Complex number with a
Declaration
public static Complex operator -(Complex left, double right)
Parameters
Type | Name | Description |
---|---|---|
Complex | left | Complex number to subtract. |
Double | right |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
Subtraction(Real, Complex)
Declaration
public static Complex operator -(Real left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Real | left | Real number to subtract. |
Complex | right | Complex number to subtract with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
Subtraction(Double, Complex)
Computes the subtraction of a
Declaration
public static Complex operator -(double left, Complex right)
Parameters
Type | Name | Description |
---|---|---|
Double | left | |
Complex | right | Complex number to subtract with. |
Returns
Type | Description |
---|---|
Complex | The new Complex number resulting from the subtraction. |
UnaryNegation(Complex)
Computes the opposite of the given Complex number.
Declaration
public static Complex operator -(Complex operand)
Parameters
Type | Name | Description |
---|---|---|
Complex | operand | Complex number from which the opposite is computed. |
Returns
Type | Description |
---|---|
Complex | The new Complex number, opposite of the initial one. |
Explicit Interface Implementations
| Improve this Doc View SourceIGroupAction<Complex, Real>.Divide(Real)
Computes the right scalar division of the current element.
Declaration
Complex IGroupAction<Complex, Real>.Divide(Real divisor)
Parameters
Type | Name | Description |
---|---|---|
Real | divisor |
Returns
Type | Description |
---|---|
Complex | The new element resulting from the scalar dividion. |
IGroupAction<Complex, Real>.Multiply(Real)
Computes the right scalar multiplication of the current element.
Declaration
Complex IGroupAction<Complex, Real>.Multiply(Real factor)
Parameters
Type | Name | Description |
---|---|---|
Real | factor |
Returns
Type | Description |
---|---|
Complex | The new element resulting from the scalar multiplication. |
IGroupAction<Complex, Double>.Divide(Double)
Computes the right scalar division of the current element.
Declaration
Complex IGroupAction<Complex, double>.Divide(double divisor)
Parameters
Type | Name | Description |
---|---|---|
Double | divisor |
Returns
Type | Description |
---|---|
Complex | The new element resulting from the scalar dividion. |
IGroupAction<Complex, Double>.Multiply(Double)
Computes the right scalar multiplication of the current element.
Declaration
Complex IGroupAction<Complex, double>.Multiply(double factor)
Parameters
Type | Name | Description |
---|---|---|
Double | factor |
Returns
Type | Description |
---|---|
Complex | The new element resulting from the scalar multiplication. |