3using System.Reflection;
16 private Complex value;
34 this.value =
new Complex(Re, Im);
43 set => this.value = value;
57 get {
return associatedField; }
76 else if (Obj is
double d)
100 if (Obj is Complex z)
102 else if (Obj is
double d)
123 object Obj = E.AssociatedObjectValue;
125 if (Obj is Complex z)
126 return this.value == z;
127 else if (Obj is
double d)
128 return this.value == d;
136 return this.value.GetHashCode();
163 if (DesiredType.GetTypeInfo().IsAssignableFrom(typeof(Complex).GetTypeInfo()))
168 else if (this.value.Imaginary == 0)
170 double d = this.value.Real;
172 if (DesiredType == typeof(
byte))
174 if (d >=
byte.MinValue && d <=
byte.MaxValue)
180 else if (DesiredType == typeof(decimal))
185 else if (DesiredType == typeof(
double))
190 else if (DesiredType == typeof(
short))
192 if (d >=
short.MinValue && d <=
short.MaxValue)
198 else if (DesiredType == typeof(
int))
200 if (d >=
int.MinValue && d <=
int.MaxValue)
206 else if (DesiredType == typeof(
long))
208 if (d >=
long.MinValue && d <=
long.MaxValue)
214 else if (DesiredType == typeof(sbyte))
216 if (d >= sbyte.MinValue && d <= sbyte.MaxValue)
222 else if (DesiredType == typeof(
float))
227 else if (DesiredType == typeof(ushort))
229 if (d >= ushort.MinValue && d <= ushort.MaxValue)
235 else if (DesiredType == typeof(uint))
237 if (d >= uint.MinValue && d <= uint.MaxValue)
243 else if (DesiredType == typeof(ulong))
245 if (d >= ulong.MinValue && d <= ulong.MaxValue)
251 else if (DesiredType.GetTypeInfo().IsAssignableFrom(typeof(Complex).GetTypeInfo()))
Base class for all types of elements.
abstract object AssociatedObjectValue
Associated object value.
Base class for all types of field elements.
Class managing a script expression.
static bool TryConvert(object Value, Type DesiredType, out object Result)
Tries to convert an object Value to an object of type DesiredType .
static string ToString(double Value)
Converts a value to a string, that can be parsed as part of an expression.
override bool Equals(object obj)
Compares the element to another. If elements are equal.
override ICommutativeRingWithIdentityElement One
Returns the identity element of the commutative ring with identity.
Complex Value
Complex value.
override IAbelianGroupElement Add(IAbelianGroupElement Element)
Tries to add an element to the current element.
override IField AssociatedField
Associated Field.
override IGroupElement Negate()
Negates the element.
ComplexNumber(double Re, double Im)
Complex-valued number.
ComplexNumber(Complex Value)
Complex-valued number.
override object AssociatedObjectValue
Associated object value.
override string ToString()
override IRingElement Invert()
Inverts the element, if possible.
override IAbelianGroupElement Zero
Returns the zero element of the group.
override int GetHashCode()
Calculates a hash code of the element. Hash code.
override bool TryConvertTo(Type DesiredType, out object Value)
Converts the value to a .NET type.
override ICommutativeRingElement Multiply(ICommutativeRingElement Element)
Tries to multiply an element to the current element.
Pseudo-field of Complex numbers, as an approximation of the field of real numbers.
Basic interface for all types of abelian group elements.
Basic interface for all types of commutative ring elements.
Basic interface for all types of commutative ring with identity elements.
Basic interface for all types of elements.
Basic interface for all types of group elements.
Basic interface for all types of ring elements.
Basic interface for all types of fields.