2 files modified
5 files added
New file |
| | |
| | | sandbox* |
| | | queens* |
New file |
| | |
| | | #! /usr/bin/env python |
| | | import sys |
| | | import math |
| | | |
| | | |
| | | x = float(sys.argv[1]) |
| | | y = float(sys.argv[2]) |
| | | |
| | | z = complex(x, y) |
| | | radius = abs(z) |
| | | theta = math.atan2(y, x) |
| | | theta_degree = math.degrees(theta) |
| | | |
| | | print("Kartesische Koordinate des Punktes:") |
| | | print(f" x = {x}; y = {y}") |
| | | print(f" r = {radius:.3f}; theta = {theta_degree:.3f}°") |
| | |
| | | print(absolute_frequency) |
| | | |
| | | relative_frequency = tuple( |
| | | (f[0], f[1]/experiments) for f in absolute_frequency |
| | | (freq[0], freq[1] / experiments) for freq in absolute_frequency |
| | | ) |
| | | |
| | | print(relative_frequency) |
| | | |
| | | relative_frequency = tuple( |
| | | (absolute_frequency[idx][0], absolute_frequency[idx][1] / experiments) for idx in range(1, 6 + 1) |
| | | ) |
New file |
| | |
| | | #! /usr/bin/env python |
| | | |
| | | from sys import stdin |
| | | |
| | | # read polynome from stdin |
| | | print(f"Input Coefficients line by line, last line is x0, Press Ctr+D to finish!") |
| | | lines = [] |
| | | for line in stdin: |
| | | koeffizient = line.strip() |
| | | if koeffizient[0] == "#": |
| | | continue |
| | | if len(koeffizient) > 0: |
| | | lines.append(float(koeffizient)) |
| | | else: |
| | | break |
| | | |
| | | a = lines[0:-1] |
| | | b = lines[-1] |
| | | b = float(b) |
| | | p = a[-1] |
| | | c = [p] |
| | | for ak in a[-2::-1]: |
| | | p = ak + (p * b) |
| | | c.insert(0, p) |
| | | |
| | | |
| | | p_b = c[0] |
| | | c = c[1:] |
| | | print(f"p(x) =", a) |
| | | print(f"p({b}) = {p_b}") |
| | | print(f"c(x) =", c) |
| | | |
New file |
| | |
| | | #! /usr/bin/env python |
| | | |
| | | """ |
| | | Usage: |
| | | python mecartor-projection <latitude> <longitude> |
| | | Example Bundestags Kooridnaten: 52°31'7.22" N 13°22'13.69" E |
| | | ./mecartor-projection.py 52.5186729836 13.3704687765 |
| | | x = 5.55928 |
| | | y = 18.86398 |
| | | """ |
| | | from math import log, tan, radians, pi |
| | | import sys |
| | | from typing import Final |
| | | |
| | | # Sternwarte Peterberg WGS84 (49° 34′ N, 7° 0′ E) |
| | | MAP_CENTER_LONGITUDE: Final[float] = radians(7) |
| | | |
| | | RADIUS: Final[float] = 50 # cm |
| | | |
| | | latitude = float(sys.argv[1]) # Degree |
| | | longitude = float(sys.argv[2]) # Degree |
| | | |
| | | # Hilfe-Variablen |
| | | lat = radians(latitude) |
| | | lon = radians(longitude) |
| | | # Kartesische Koordinaten |
| | | x: float = RADIUS * (lon - MAP_CENTER_LONGITUDE) |
| | | y: float = RADIUS * log(tan(pi/4) + lat/2) |
| | | |
| | | print(f"x = {x:.5f}") |
| | | print(f"y = {y:.5f}") |
| | |
| | | import turtle |
| | | import math |
| | | |
| | | num_of_petal = 60 |
| | | num_of_petal = 5 |
| | | petal_length = 100 |
| | | # winkel sind in Degree |
| | | alpha = 90 / num_of_petal |
| | | alpha = 90 / (num_of_petal-1) |
| | | beta = 2 * alpha |
| | | gamma = 180 - beta |
| | | |
| | | # abgeleitete Länge |
| | | side_length = petal_length * math.cos(math.radians(alpha)) |
| | | |
| | | start_angle = 0 |
| | | for petal in range(0, num_of_petal): |
| | | direction = petal * (360 / num_of_petal) |
| | | direction = petal * (360 / num_of_petal) + start_angle |
| | | turtle.home() |
| | | turtle.left(direction + alpha) |
| | | turtle.fd(side_length) |
New file |
| | |
| | | # Koefizient |
| | | 4 |
| | | 0 |
| | | 2 |
| | | 0 |
| | | 0 |
| | | -3 |
| | | 6 |
| | | # x0 = |
| | | 2 |