ComplexNumber
ComplexNumber class to perform complex operations. You can take a look at the source code here.
Installation
pip install complex-number
Usage example
from complex_number import ComplexNumber
import math
z1 = Complex(1, 2) # real, imag
z2 = Complex.from_polar(2, math.pi) # modulus, argument
print(z1)
z2.print(4) # set precision (defaults to 2)
z2.print_polar(4) # set precision (defaults to 2)
print(z1.real)
z1.real = 5
print(z1.imag)
z1.imag = -3
print(z1.modulus)
z1.modulus = 4
print(z1.argument)
z1.argument = math.pi / 2
Math operations
print(z1 + z2)
z1 += z2
print(z1 - z2)
z1 -= z2
print(z1 * z2)
z1 *= z2
print(z1 / z2)
z1 /= z2
print(z1 ** 3)
z1 **= 3
print(z1.root()) # defaults to 2
print(z1.root(3)) # returns a tuple of ComplexNumbers with all solutions
print(+z1)
print(-z1)
Additional Operations
print(z1.conjugate())
print(z1.polar()) # returns dictionary with the keys: modulus and argument.
print(ComplexNumber.to_cartesian(modulus=2, argument=math.pi)) # returns tuple with real and imag part.
Check for Equality
print(z1 == z2) # true if real and imag parts are both equal to each other
Metadata
Release files for complex-number 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| complex_number-0.1.4.tar.gz | 8.3 kB | Without provenance | Details |
Release files / complex_number-0.1.4.tar.gz
| Download URL | complex_number-0.1.4.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6369b9f867a3f5e583274173a84dc9cf26c4b835d8ea0b17ee49dcf72c8835a
|
|
BLAKE2b-256 checksum How to use checksums |
9ff22173dbd056ce1225b4bf474d5d8fa7996ade50ec1f0ce5bf250b714101ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for complex-number 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.