We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da7e4f8 commit 172914cCopy full SHA for 172914c
1 file changed
2019/complex_utils.py
@@ -1,7 +1,7 @@
1
"""
2
Small library for complex numbers
3
4
-from math import sqrt
+from math import sqrt, atan2
5
6
7
class ReturnTypeWrapper(type):
@@ -51,6 +51,12 @@ def __add__(self, no):
51
def __sub__(self, no):
52
return SuperComplex(self.real - no.real, self.imag - no.imag)
53
54
+ def phase(self):
55
+ return atan2(self.imag, self.real)
56
+
57
+ def amplitude(self):
58
+ return sqrt(self.imag ** 2 + self.real ** 2)
59
60
61
j = SuperComplex(1j)
62
0 commit comments