diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7f63fb1..96512c1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,8 +10,21 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -21,6 +34,9 @@
+
+
+
+
+
+
+
+
+
+
@@ -62,12 +89,14 @@
}
+
+
-
-
+
+
@@ -75,12 +104,12 @@
-
+
-
+
@@ -89,7 +118,7 @@
-
+
@@ -97,12 +126,12 @@
-
+
-
+
@@ -111,7 +140,7 @@
-
+
@@ -119,12 +148,12 @@
-
+
-
+
@@ -133,7 +162,7 @@
-
+
@@ -141,12 +170,12 @@
-
+
-
+
@@ -155,7 +184,7 @@
-
+
@@ -163,12 +192,12 @@
-
+
-
+
@@ -179,11 +208,11 @@
-
-
-
-
-
+
+
+
+
+
@@ -212,28 +241,34 @@
+
+
+
+
+
+
+
+
-
-
-
-
- file://$PROJECT_DIR$/ha_08/loosen_janniclas_1540907_09.py
- 63
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/_crashkurs/aletoric.py b/_crashkurs/aletoric.py
new file mode 100644
index 0000000..d7dd4bd
--- /dev/null
+++ b/_crashkurs/aletoric.py
@@ -0,0 +1,48 @@
+import random as rnd
+import matplotlib.pyplot as plt
+import numpy as np
+
+
+def dice(n=1, d=6):
+ eyes = 0
+ sides = range(1, d + 1)
+ for roll in range(n):
+ eyes += rnd.choice(sides)
+ return eyes
+
+
+rnd.seed(rnd.random())
+
+rolls = 1000
+d_dice = 6
+n_dices = 6
+
+total_sum = 0
+results = [0 for i in range(0, d_dice * n_dices + 1 + n_dices)]
+for a in range(rolls):
+ val = dice(n_dices, d_dice)
+ total_sum += val
+ results[val] += 1
+avg = total_sum / rolls
+
+fig, ax = plt.subplots()
+
+ax.plot(
+ np.array(range(0, d_dice * n_dices + 1 + n_dices)),
+ np.array(results),
+ color="red"
+)
+
+ax.plot(
+ np.array(range(0, d_dice * n_dices + 1 + n_dices)),
+ np.array([avg for i in range(0, d_dice * n_dices + 1 + n_dices)]),
+ color="blue"
+)
+
+ax.set_xlabel("Summierte Augenzahl")
+ax.set_ylabel("Vorkommen")
+ax.set_title("Verteilung")
+plt.show()
+
+for b in range(0, d_dice * n_dices + 1 + n_dices):
+ print(f"Summe: {b}, Vorkommen: {results[b]}")
diff --git a/_crashkurs/animate.gif b/_crashkurs/animate.gif
new file mode 100644
index 0000000..9f04025
Binary files /dev/null and b/_crashkurs/animate.gif differ
diff --git a/_crashkurs/dialog.py b/_crashkurs/dialog.py
new file mode 100644
index 0000000..58f9c70
--- /dev/null
+++ b/_crashkurs/dialog.py
@@ -0,0 +1,3 @@
+print("Hey.")
+answer = input("How are you?")
+print(f"I feel like {answer} too.")
\ No newline at end of file
diff --git a/_crashkurs/epsilon.py b/_crashkurs/epsilon.py
new file mode 100644
index 0000000..a122ad1
--- /dev/null
+++ b/_crashkurs/epsilon.py
@@ -0,0 +1,16 @@
+import sys
+
+
+def float_eps_equal(val, should_val):
+ """
+ True: gdw. Wert und der Zielwert liegen weniger als die maximale Fehler aneinander.
+ """
+ eps = sys.float_info.epsilon
+ return abs(val - should_val) <= eps
+
+
+calc = 1.1 - 1
+if float_eps_equal(calc, 0.1):
+ print(True)
+else:
+ print(False)
diff --git a/_crashkurs/eval.py b/_crashkurs/eval.py
new file mode 100644
index 0000000..e3a1ec3
--- /dev/null
+++ b/_crashkurs/eval.py
@@ -0,0 +1,38 @@
+import matplotlib.pyplot as plt
+import matplotlib.animation as ani
+import random as rnd
+
+
+def update(frame):
+ participants = rnd.randint(1, 50)
+ answers = ["good", "good", "good", "okay", "okay", "bad"]
+ for participant in range(participants):
+ answer = rnd.choice(answers)
+ evals[answer] += 1
+ print(evals)
+ ax_evals.clear()
+ pie_update = ax_evals.pie(
+ evals.values(),
+ labels=evals.keys()
+ )
+ return (pie_update,)
+
+
+evals = {
+ "good": 1,
+ "okay": 1,
+ "bad": 1
+}
+
+fig_evals, ax_evals = plt.subplots()
+ax_evals.pie(
+ evals.values(),
+ labels=evals.keys()
+)
+ax_evals.set(title="Evaluations")
+
+animate = ani.FuncAnimation(fig_evals, update, frames=200, interval=20)
+animate.save('animate.gif', writer='pillow')
+plt.show()
+
+
diff --git a/_crashkurs/image.py b/_crashkurs/image.py
new file mode 100644
index 0000000..e0014f2
--- /dev/null
+++ b/_crashkurs/image.py
@@ -0,0 +1,85 @@
+import threading
+import time
+
+import numpy as np
+from PIL import Image
+
+pool = []
+conv_counter = 0
+
+
+def image_convolution(data, conv_matrix):
+ global conv_counter, pool
+ y_data_pixels, x_data_pixels, _ = data.shape
+ for y_data in range(1, y_data_pixels - 1):
+ t = threading.Thread(target=image_convolution_row, args=(data, conv_matrix, y_data))
+ pool.append(t)
+ t.start()
+ while any(t.is_alive() for t in pool):
+ time.sleep(1)
+ print(f"Loading with {len(pool)} threads on convolution {conv_counter}...")
+ for thread in pool:
+ thread.join()
+ pool = []
+ conv_counter += 1
+
+
+def image_convolution_row(data, conv_matrix, y_data):
+ y_data_pixels, x_data_pixels, _ = data.shape
+ for x_data in range(1, x_data_pixels - 1):
+ t = threading.Thread(target=image_convolution_pixel, args=(data, conv_matrix, y_data, x_data))
+ pool.append(t)
+ t.start()
+
+
+def image_convolution_pixel(data, conv_matrix, y_data, x_data):
+ for color in range(3):
+ new_val = 0
+ for y_conv in range(0, 3):
+ for x_conv in range(0, 3):
+ # new_val += conv_matrix[y_conv, x_conv] * data[y_data + y_conv - 1, x_data + x_conv - 1]
+ continue
+ global grid_new
+ new_val = max(0, min(new_val, 255))
+ grid_new[y_data, x_data, color] = new_val
+
+
+image = Image.open("koko.jpg")
+
+grid = np.array(image, dtype=np.uint8)
+grid_new = np.zeros(grid.shape)
+y_pixels, x_pixels, _ = grid.shape
+
+convolutions = [
+ np.array([
+ [0, 1, 0],
+ [0, 0, 0],
+ [0, -1, 0]
+ ]),
+ np.array([
+ [1, 0, 0],
+ [0, 0, 0],
+ [0, 0, -1]
+ ]),
+ np.array([
+ [0, 0, 0],
+ [1, 0, -1],
+ [0, 0, 0]
+ ]),
+ np.array([
+ [0, 0, 1],
+ [0, 0, 0],
+ [-1, 0, 0]
+ ])
+]
+
+for y in range(y_pixels):
+ for x in range(x_pixels):
+ grid[y][x] = (grid[y][x] - (256 / 2)) % 256
+
+for convolution in convolutions:
+ image_convolution(grid, convolution)
+ grid = grid_new
+
+image = Image.fromarray(grid)
+image.show()
diff --git a/_crashkurs/koko.jpg b/_crashkurs/koko.jpg
new file mode 100644
index 0000000..5046d1d
Binary files /dev/null and b/_crashkurs/koko.jpg differ
diff --git a/_crashkurs/object.py b/_crashkurs/object.py
new file mode 100644
index 0000000..73a1c94
--- /dev/null
+++ b/_crashkurs/object.py
@@ -0,0 +1,40 @@
+class Tier:
+ age = 0
+
+ def __init__(self, age):
+ self.age = age
+
+
+class Katzenartig(Tier):
+
+ def schnurren(self):
+ print("Brrrr Brrrr Brrrr")
+
+
+class Hauskatze(Katzenartig, Tier):
+
+ def __init__(self, age, name):
+ self.name = name
+ Tier.__init__(self, age)
+
+ def miau(self):
+ print("Miau Miau Miau")
+
+
+class Grosskatze(Katzenartig, Tier):
+
+ def __init__(self, age):
+ Tier.__init__(self, age)
+
+ def roar(self):
+ print("Roar Roar Roar")
+
+
+prinz = Hauskatze(11, "Prinz")
+tiger = Grosskatze(5)
+
+print(prinz.__class__.__mro__)
+print(tiger.__class__.__mro__)
+
+prinz.schnurren()
+tiger.schnurren()
\ No newline at end of file
diff --git a/_crashkurs/race.py b/_crashkurs/race.py
new file mode 100644
index 0000000..4a5acb1
--- /dev/null
+++ b/_crashkurs/race.py
@@ -0,0 +1,54 @@
+import random
+import threading
+import time
+
+import matplotlib.pyplot as plt
+
+
+def add(wait=0.0):
+ global glob
+
+ tmp = glob
+ time.sleep(wait)
+
+ LOCK_console.acquire()
+ print(f"{tmp} <- {tmp + 1}")
+ LOCK_console.release()
+
+ results.append(tmp + 1)
+ glob = tmp + 1
+
+
+glob = 0
+n = 100
+
+LOCK_console = threading.Lock()
+LOCK_glob = threading.Lock()
+
+threads = []
+results = []
+for i in range(n):
+ rnd = random.randint(0, 1) / random.randint(1, 100)
+ threads.append(threading.Thread(target=add, args=(rnd,)))
+ threads[i].start()
+
+while len(threads) != 0:
+ thread = threads.pop()
+ thread.join()
+
+fig, ax = plt.subplots()
+ax.plot(
+ range(n),
+ results
+)
+
+ax.set(
+ xlabel="Thread",
+ ylabel="Value",
+ title="Race-Condition: Increment",
+ ylim=(0, 100)
+)
+ax.grid(True)
+
+plt.show()
+print(f"{0} + {n} = {n} =? {glob}")
diff --git a/_crashkurs/thread.py b/_crashkurs/thread.py
new file mode 100644
index 0000000..bb48e13
--- /dev/null
+++ b/_crashkurs/thread.py
@@ -0,0 +1,50 @@
+import random as rnd
+import threading
+import time
+import matplotlib.pyplot as plt
+
+def racer(number, seed):
+ rnd.seed(seed)
+ start = time.time()
+ duration = rnd.randint(1, 10)
+ time.sleep(duration)
+ end = time.time()
+ results[number] = f"Racer {number} in {end - start}"
+
+
+n = 20
+threads = []
+results = {}
+total_start = time.time()
+
+for car in range(n):
+ rand = rnd.random()
+ threads.append(threading.Thread(target=racer, args=(car, rand)))
+ threads[car].start()
+
+for car in range(n):
+ threads[car].join()
+
+fig, ax = plt.subplots()
+
+"""
+ax.plot(
+ [car for car in range(n)],
+ [results[car] for car in range(n)]
+)
+"""
+
+ax.bar(
+ [car for car in range(n)],
+ [results[car] for car in range(n)]
+)
+
+ax.set(
+ xlabel="Racer",
+ ylabel="Zeit",
+ title="Rennen",
+)
+
+ax.grid(True)
+
+plt.show()
diff --git a/_crashkurs/types.py b/_crashkurs/types.py
new file mode 100644
index 0000000..9073172
--- /dev/null
+++ b/_crashkurs/types.py
@@ -0,0 +1,19 @@
+name = "Jan-Niclas"
+surname = "Loosen"
+age = 22
+
+me = {
+ "name" : name,
+ "surname" : surname,
+ "age" : age
+}
+job = "Programmierer"
+me["job"] = job
+
+try:
+ for key in me.keys():
+ print(f"Der Wert von {key} entspricht {me[key]}.")
+
+
+except Exception as exc:
+ print(exc)
\ No newline at end of file
diff --git a/_pruefung/.idea/.gitignore b/_pruefung/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/_pruefung/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/_pruefung/.idea/_pruefung.iml b/_pruefung/.idea/_pruefung.iml
new file mode 100644
index 0000000..4c94235
--- /dev/null
+++ b/_pruefung/.idea/_pruefung.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/_pruefung/.idea/modules.xml b/_pruefung/.idea/modules.xml
new file mode 100644
index 0000000..7b69d73
--- /dev/null
+++ b/_pruefung/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/_pruefung/.idea/vcs.xml b/_pruefung/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/_pruefung/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/_pruefung/begriffe.txt b/_pruefung/begriffe.txt
new file mode 100644
index 0000000..d63267b
--- /dev/null
+++ b/_pruefung/begriffe.txt
@@ -0,0 +1,25 @@
+BEGRIFFLICHKEITEN
+
+La-Place-Operator: Summe der 2. Partiellen Ableitungen
+La-Place-Faltung: Approximation des La-Place-Operators (2D)
+
+Aleatorischer und Epistemischer Zufall
+
+Scatter, Gather, GatherAll, Broadcast, Reduction
+
+Stellenwertsysteme (Binär, Dezimal, Oktal, Hexadezimal)
+
+Festkommazahlen, Fließkommazahlen (Vorzeichen, Exponent bzw. Charakterstik, Mantisse)
+
+Kondition: || f(x) - gf(gx) || <= || f(x) - f(gx) || + || f(x) - gf(gx) ||
+Erster teil der Ungleichung muss akzeptiert werden. Wenn gf = f (also das Programm ungestört), dann:
+
+Absolute Konditionszahl: || f(gx) - f(x) || <= k * || gx - x || (wobei k die Konditionszahl)
+Relative Konditionszahl: || f(gx) - f(x) || / || f(x) ||<= rk * || gx - x || / || x || (wobei rk die relative Konditionszahl)
+Je kleiner die Konditionszahl, desto besser ist ein Problem gestellt
+
+SISD: Single-Instruction-Single-Date vs. SIMD: Single-Instruction-Multiple-Data
+Instruction-Fetch, Instruction-Decode, Instruction-Execution, Memory, Storage-Write-Back
+
+Kompilierung: Preprocessor -> Compiler zu Assembler File -> Assembler zu Binärdatei (Objekt Datei) -> Linker zu Executable (Bibliotheken einfügen)
+
diff --git a/_pruefung/codings.cpp b/_pruefung/codings.cpp
new file mode 100644
index 0000000..2687f63
--- /dev/null
+++ b/_pruefung/codings.cpp
@@ -0,0 +1,24 @@
+#include "iostream"
+#include "string"
+
+template
+T f(T x) {
+ return x * x;
+}
+
+template
+void input(std::string message, X &target) {
+ std::cout << message;
+ std::cin >> target;
+}
+
+int main() {
+ std::string lang = "C";
+ std::string version = "++";
+ lang = lang + version;
+ std::cout << "Hello World, said by " << lang << "!" << std::endl;
+ int x = 0;
+ input("x = ", x);
+ std::cout << "f(x) = " << f(x) << std::endl;
+ return 0;
+}
\ No newline at end of file
diff --git a/_pruefung/codings.exe b/_pruefung/codings.exe
new file mode 100644
index 0000000..0bf3456
Binary files /dev/null and b/_pruefung/codings.exe differ
diff --git a/_pruefung/pointers.cpp b/_pruefung/pointers.cpp
new file mode 100644
index 0000000..7ecf324
--- /dev/null
+++ b/_pruefung/pointers.cpp
@@ -0,0 +1,7 @@
+#include "iostream"
+
+int main() {
+ int a = 0;
+ int* x = &a;
+ std::cout << x << std::endl ;
+}
diff --git a/_pruefung/pointers.exe b/_pruefung/pointers.exe
new file mode 100644
index 0000000..4304bdf
Binary files /dev/null and b/_pruefung/pointers.exe differ
diff --git a/ext_02/exercise.r b/ext_02/exercise.r
index 651c4f3..aad667c 100644
--- a/ext_02/exercise.r
+++ b/ext_02/exercise.r
@@ -39,5 +39,6 @@ weekdays <- weekdays(seq(as.Date("19-02-2024"), by="days", length.out = 7));
calc <- sapply(weekdays, function(y) sum(doomsdays == y));
count <- calc[2];
-x <- 2*(1:5);
-print(x);
\ No newline at end of file
+x <- (0:100)
+y <- cbind(x,x)
+print(x[(1:100) / 2])
\ No newline at end of file