Programming Reference for VirtualLab Fusion
2025.1
|
This struct holds a complex number.
Operators ( \(a+b\), \(a-b\), \(a*b\), \(a/b\) and \(a^b\)) can be used. Passing \(a\) or \(b\) as double is supported.
More...
Public Member Functions | |
double | Abs () |
Returns absolute value of current Complex. | |
double | Arg () |
Returns the argument (phase) of this complex number. The resulting angle is in the range of [-Pi, Pi). | |
Complex (Complex c) | |
Copy constructor. | |
Complex (double Re) | |
Constructs a complex number with given real part. The imaginary part is zero. | |
Complex (double Re, double Im) | |
Constructs a complex number with given real and imaginary parts. | |
double | EvaluateFielQuantity (FieldQuantity quantityToEvaluate) |
public support method to evaluate a specific field quantity of the complex number | |
double | FilteredPhase (double maximumAmplitude=0, double artifactsThreshold=Globals.MinimumRelativeAmplitude) |
Gets the phase of the complex value. In contrast to the Arg()-method, this method corrects numerical artifacts in the phase. (1) The phase is zero if the amplitude of the complex number is less than threshold times maximum amplitude. (2) The phase value is -π if its imaginary part value {Im} satisfies t⋅Re < -Abs(Im) < 0. | |
bool | InputIsNumericalLarger (Complex cfForComparison) |
Method to perform numerical comparison of two complex number. First the amplitudes are compared. If they are equal the phase values are compared. | |
Complex | ModifyComplexPart (ComplexPart complexPart) |
Returns passed ComplexPart. | |
double | Norm () |
Returns the squared L2-norm of current Complex. | |
override string | ToString () |
Returns a System.String that represents this instance. | |
string | ToString (ComplexToStringConversionFormat format) |
Returns formatted string, by default: {Real} + {Imaginary} \(\cdot\)i. | |
string | ToString (int numberOfDigits, ComplexToStringConversionFormat? format=null) |
Returns formatted string, by default: {Real} + {Imaginary} \(\cdot\)i. | |
string | ToString (PhysicalUnit physicalUnit, ComplexToStringConversionFormat ComplexToStringFormat, int ComplexToStringConversionDigits) |
Returns formatted string, either. | |
Static Public Member Functions | |
static double | ArgDifference (Complex c1, Complex c2) |
Determine the reduced phase difference of two complex numbers. | |
static Complex | Conjugate (Complex z) |
Returns conjugate complex number of current Complex. | |
static Complex | Cos (Complex z) |
Returns cosine of complex number. | |
static Complex | Exp (Complex c) |
Returns exponential function of complex number. | |
static Complex | FromFieldQuantity (double value, FieldQuantity fieldQuantity) |
Creates a complex number from the given double value which is written into the given field quantity. | |
static ? ComplexToStringConversionFormat | GetComplexFormat (string numberString) |
Determines the way how a complex number is represented by a string (for example "a + ib" is the RealImaginary format, "a exp ib" is the AmplitudePhase format). | |
static bool | IsNaN (Complex number) |
Checks whether either the real or the imaginary is NaN (not a number). | |
static Complex | Log (Complex z) |
Returns natural logarithm of complex number. | |
static Complex | operator* (Complex z, double d) |
Multiplies complex number with real number. | |
static Complex | operator* (Complex z1, Complex z2) |
Multiplies two complex numbers. | |
static Complex | operator* (double d, Complex z) |
Multiplies real number with real number. | |
static Complex | operator+ (Complex z1, Complex z2) |
Adds two complex numbers. | |
static Complex | operator+ (Complex z1, double d) |
Adds a complex number and a real number. | |
static Complex | operator+ (double d, Complex z1) |
Adds a real number and a complex number. | |
static Complex | operator- (Complex z) |
Multiplies a complex number with -1. | |
static Complex | operator- (Complex z1, Complex z2) |
Subtracts two complex numbers. | |
static Complex | operator- (Complex z1, double d) |
Subtracts real number from complex number. | |
static Complex | operator- (double d, Complex z1) |
Subtracts complex number from real number. | |
static Complex | operator/ (Complex z, double d) |
Divides complex number by real number. | |
static Complex | operator/ (Complex z1, Complex z2) |
Divides complex number by complex number. | |
static Complex | operator/ (double d, Complex z1) |
Divides a real number by complex number. | |
static Complex | Parse (string pureNumberStr, ComplexToStringConversionFormat complexFormat) |
Parses an string which represents a complex number. | |
static Complex | Parse (string pureNumberStr, ComplexToStringConversionFormat complexFormat, NumberFormatInfo doubleFormat) |
Parses an string which represents a complex number. | |
static Complex | Polar (double abs, double arg) |
Returns complex number created by given absolute value and argument. | |
static Complex | Pow (Complex basis, Complex exponent) |
public power function of the complex class | |
static Complex | Sin (Complex z) |
Returns sine of complex number. | |
static Complex | Sqrt (Complex z) |
Return square root of complex number. | |
static bool | TryParse (string pureNumberStr, out Complex parsedValue, out ComplexToStringConversionFormat? usedConversionFormat, NumberFormatInfo doubleFormat=null) |
Tries to parse a string which represents a complex number. | |
Public Attributes | |
double | Im |
Imaginary part of stored complex number. | |
double | Re |
Real part of stored complex number. | |
Static Public Attributes | |
static readonly Complex | i |
The imaginary unit. | |
static readonly Complex | Zero |
A constant containing the neutral element for addition (= (0, 0)) | |
This struct holds a complex number.
Operators ( \(a+b\), \(a-b\), \(a*b\), \(a/b\) and \(a^b\)) can be used. Passing \(a\) or \(b\) as double is supported.
Complex | ( | double | Re, |
double | Im | ||
) |
Constructs a complex number with given real and imaginary parts.
Re | Real part. |
Im | Imaginary part. |
Complex | ( | double | Re | ) |
Constructs a complex number with given real part. The imaginary part is zero.
Re | Real part. |
double Abs | ( | ) |
Returns absolute value of current Complex.
double Arg | ( | ) |
Returns the argument (phase) of this complex number. The resulting angle is in the range of [-Pi, Pi).
Determine the reduced phase difference of two complex numbers.
c1 | complex number with phase minuend |
c2 | complex number with phase subtrahend |
Returns conjugate complex number of current Complex.
z | Complex number to conjugate. |
Returns cosine of complex number.
z | Complex number \(a\). |
double EvaluateFielQuantity | ( | FieldQuantity | quantityToEvaluate | ) |
public support method to evaluate a specific field quantity of the complex number
quantityToEvaluate | the field quantity which should be evaluated |
Returns exponential function of complex number.
c | Complex number \(a\). |
double FilteredPhase | ( | double | maximumAmplitude = 0 , |
double | artifactsThreshold = Globals::MinimumRelativeAmplitude |
||
) |
Gets the phase of the complex value. In contrast to the Arg()-method, this method corrects numerical artifacts in the phase. (1) The phase is zero if the amplitude of the complex number is less than threshold times maximum amplitude. (2) The phase value is -π if its imaginary part value {Im} satisfies t⋅Re < -Abs(Im) < 0.
maximumAmplitude | The maximum amplitude. If this optional parameter is not specified, the filtering step (1) is not done. |
artifactsThreshold | The artifacts threshold. 0.1 % is taken as default value. |
|
static |
Creates a complex number from the given double value which is written into the given field quantity.
value | The double value. |
fieldQuantity | The field quantity into which the value is written. |
|
static |
Determines the way how a complex number is represented by a string (for example "a + ib" is the RealImaginary format, "a exp ib" is the AmplitudePhase format).
numberString | The number string. |
null
if the format cannot be determined, e.g. for a real number.bool InputIsNumericalLarger | ( | Complex | cfForComparison | ) |
Method to perform numerical comparison of two complex number. First the amplitudes are compared. If they are equal the phase values are compared.
cfForComparison | The complex number which shall be used for comparison. |
|
static |
Checks whether either the real or the imaginary is NaN (not a number).
number | The complex number to check. |
Returns natural logarithm of complex number.
z | Complex number \(a\). |
Complex ModifyComplexPart | ( | ComplexPart | complexPart | ) |
Returns passed ComplexPart.
complexPart | ComplexPart to be applied on current Complex. |
double Norm | ( | ) |
Returns the squared L2-norm of current Complex.
Multiplies complex number with real number.
z | complex number |
d | real number |
Multiplies two complex numbers.
z1 | complex number |
z2 | complex number |
Multiplies real number with real number.
z | complex number |
d | real number |
Adds two complex numbers.
z1 | first complex number |
z2 | second complex number |
Adds a complex number and a real number.
z1 | complex number |
d | real number |
Adds a real number and a complex number.
d | real number |
z1 | complex number |
Multiplies a complex number with -1.
z | The complex number to negate. |
Subtracts two complex numbers.
z1 | complex number |
z2 | complex number |
Subtracts real number from complex number.
z1 | complex number |
d | real number |
Subtracts complex number from real number.
d | real number |
z1 | complex number |
Divides complex number by real number.
z | complex number |
d | real number |
Divides complex number by complex number.
z1 | complex number |
z2 | complex number |
Divides a real number by complex number.
d | real number |
z1 | complex number |
|
static |
Parses an string which represents a complex number.
pureNumberStr | The string to be converted. |
complexFormat | The format of the complex number. Valid formats are RealImaginary and AmplitudePhase. |
|
static |
Parses an string which represents a complex number.
pureNumberStr | The string to be converted. |
complexFormat | The format of the complex number. The SinusCosinus format is not supported. RealImaginary, AmplitudePhase. |
doubleFormat | The format of the double-numbers which form the real and imaginary part. |
System.ArgumentException | Current complex format is not supported! |
Exceptions.ComplexParseException | string is null-string or string is empty or Invalid complex number Format |
|
static |
Returns complex number created by given absolute value and argument.
abs | Absolute value. |
arg | Argument. |
public power function of the complex class
basis | the basis for the power operation |
exponent | the exponent for the power operation |
Returns sine of complex number.
z | Complex number \(a\). |
Return square root of complex number.
z | Complex number \(a\). |
override string ToString | ( | ) |
Returns a System.String that represents this instance.
string ToString | ( | ComplexToStringConversionFormat | format | ) |
Returns formatted string, by default: {Real} + {Imaginary} \(\cdot\)i.
format | Optional enum parameter specifying which format to use. Format can be either
|
string ToString | ( | int | numberOfDigits, |
ComplexToStringConversionFormat? | format = null |
||
) |
Returns formatted string, by default: {Real} + {Imaginary} \(\cdot\)i.
numberOfDigits | The number of digits to use for the conversion of the double parts of the complex number. |
format | Optional enum parameter specifying which format to use. Format can be either
|
string ToString | ( | PhysicalUnit | physicalUnit, |
ComplexToStringConversionFormat | ComplexToStringFormat, | ||
int | ComplexToStringConversionDigits | ||
) |
Returns formatted string, either.
physicalUnit | If the complex number contains/represents a physical unit the corresponding real and imaginary numbers (or amplitude) are returned in measures of the given physical unit. But the corresponding unit-description-string is not appended to the complex number. |
ComplexToStringConversionDigits | Digits for the conversion of the double numbers of the real and imaginary part (amplitude or phase) of the complex number. |
ComplexToStringFormat | Format of the complex number. |
|
static |
Tries to parse a string which represents a complex number.
pureNumberStr | The string to be converted. |
parsedValue | The parsed value if successful. |
doubleFormat | The format of the double-numbers which form the real and imaginary part. |
usedConversionFormat | Null if parsing failed. Otherwise the used ComplexToStringConversionFormat which was successful. |
True
if parsing was successful. System.ArgumentException | Current complex format is not supported! |
Exceptions.ComplexParseException | string is null-string or string is empty or Invalid complex number Format |