From d14a16f94ce8a6a2a7829cd0ff62514122f6463b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kn=C3=BCttel?= Date: Wed, 24 Oct 2018 16:29:18 +0200 Subject: [PATCH] Added first exercise --- ex_01_01.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ex_01_01.py diff --git a/ex_01_01.py b/ex_01_01.py new file mode 100644 index 0000000..89985f8 --- /dev/null +++ b/ex_01_01.py @@ -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))