v2 - Update to types, and cleaned deprecated functions
Added:
from(value)
Creates a new Complex number from provided value.
Parameters:
value: string . Value of real and imaginary parts.
Returns: Complex.
Updated:
new(real, imaginary)
Creates a new Complex number.
Parameters:
real: float . Real part of the complex number. default=0.
imaginary: float . Imaginary part of the complex number. default=0.
Returns: Complex.
from_polar_coordinates(magnitude, phase)
Create a complex number from polar coordinates.
Parameters:
magnitude: float, default=0.0, The magnitude, which is the distance from the origin (the intersection of the x-axis and the y-axis) to the number.
phase: float, default=0.0, The phase, which is the angle from the line to the horizontal axis, measured in radians.
Returns: Complex.
zero()
Complex number "0+0i".
Returns: Complex.
one()
Complex number "1+0i".
Returns: Complex.
imaginary_one()
Complex number "0+1i".
Returns: Complex.
nan()
Complex number with `float(na)` parts.
Returns: Complex.
is_complex(this)
Checks that its a valid complex number.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_nan(this)
Checks that its empty "na" complex number.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_real(this)
Checks that the complex_number is real.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_real_non_negative(this)
Checks that the complex_number is real and not negative.
Parameters:
this: Complex Source complex number.
Returns: bool.
is_zero(this)
Checks that the complex_number is zero.
Parameters:
this: Complex Source complex number.
Returns: bool.
equals(this, other, eps)
Compares two complex numbers:
Parameters:
this: Complex . Source complex number.
other: Complex . Target complex number
eps: float . Precision value, default=1e-15.
Returns: boolean value representing the equality.
to_string(this, format)
Converts complex number to a string format, in the form: "a+bi"
Parameters:
this: Complex . Source complex number..
format: string, formating to apply.
Returns: string. In "a+bi" format
Removed: set_real(), set_imaginary(), get_real(), get_imaginary()