Added first exercise

gol
Daniel Knüttel 2018-10-24 16:29:18 +02:00
parent 0a1d4bcba7
commit d14a16f94c
1 changed files with 18 additions and 0 deletions

18
ex_01_01.py 100644
View 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))