Added first exercise
This commit is contained in:
parent
0a1d4bcba7
commit
d14a16f94c
18
ex_01_01.py
Normal file
18
ex_01_01.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import cmath
|
||||
import math
|
||||
|
||||
if( __name__ == "__main__"):
|
||||
log = cmath.log(-16)
|
||||
sqrt = cmath.sqrt(-16)
|
||||
print("logarithm:", log)
|
||||
print("\tabsolute value:", abs(log))
|
||||
print("square root:", sqrt)
|
||||
print("\tabsolute value:", abs(sqrt))
|
||||
|
||||
# rotate (7, 3) counter-clockwise (math. positive) arount (0, 0)
|
||||
c = 7 + 3j
|
||||
c_prime = c * cmath.exp(1j * math.radians(30))
|
||||
|
||||
print("Rotated (7,3) by 30 degs:", "({}, {})".format(c_prime.real, c_prime.imag))
|
Loading…
Reference in New Issue
Block a user