aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/zeta/python
diff options
context:
space:
mode:
authorf1bi1n <109807532+f1bi1n@users.noreply.github.com>2022-08-15 20:21:26 +0200
committerGitHub <noreply@github.com>2022-08-15 20:21:26 +0200
commit13e80fa4f6ca5fb0551e2e3adca931d32091cab1 (patch)
tree2793c654e5d5f4556a32c7dfea915fd37c74f59b /buch/papers/zeta/python
parent2.Uerbarbeitung, bruch (diff)
parentMerge pull request #50 from ntobler/master (diff)
downloadSeminarSpezielleFunktionen-13e80fa4f6ca5fb0551e2e3adca931d32091cab1.tar.gz
SeminarSpezielleFunktionen-13e80fa4f6ca5fb0551e2e3adca931d32091cab1.zip
Merge branch 'master' into master
Diffstat (limited to '')
-rw-r--r--buch/papers/zeta/python/plot_zeta.py39
-rw-r--r--buch/papers/zeta/python/plot_zeta2.py31
-rw-r--r--buch/papers/zeta/python/primzahlfunktion.py24
3 files changed, 94 insertions, 0 deletions
diff --git a/buch/papers/zeta/python/plot_zeta.py b/buch/papers/zeta/python/plot_zeta.py
new file mode 100644
index 0000000..53097c5
--- /dev/null
+++ b/buch/papers/zeta/python/plot_zeta.py
@@ -0,0 +1,39 @@
+import numpy as np
+from mpmath import zeta
+import matplotlib.pyplot as plt
+from matplotlib import colors
+import matplotlib
+matplotlib.use("pgf")
+matplotlib.rcParams.update(
+ {
+ "pgf.texsystem": "pdflatex",
+ "font.family": "serif",
+ "font.size": 8,
+ "text.usetex": True,
+ "pgf.rcfonts": False,
+ "axes.unicode_minus": False,
+ }
+)
+
+print(zeta(-1))
+print(zeta(-1 + 2j))
+
+re_values = np.arange(-10, 5, 0.04)
+im_values = np.arange(-20, 20, 0.04)
+plot_matrix = np.zeros((len(im_values), len(re_values), 3))
+for im_i, im in enumerate(im_values):
+ print(im_i)
+ for re_i, re in enumerate(re_values):
+ z = complex(zeta(re + 1j*im))
+ h = (np.angle(z) + np.pi) / (2*np.pi)
+ v = np.abs(z)
+ s = 1.0
+ plot_matrix[im_i, re_i] = [h, s, v]
+
+log10_v = np.log10(plot_matrix[:, :, 2])
+log10_v += np.abs(np.min(log10_v))
+plot_matrix[:, :, 2] = (log10_v) / np.max(log10_v)
+plt.imshow(colors.hsv_to_rgb(plot_matrix), extent=[re_values.min(), re_values.max(), im_values.min(), im_values.max()])
+plt.xlabel("$\Re$")
+plt.ylabel("$\Im$")
+plt.savefig(f"zeta_color_plot.pgf")
diff --git a/buch/papers/zeta/python/plot_zeta2.py b/buch/papers/zeta/python/plot_zeta2.py
new file mode 100644
index 0000000..b730703
--- /dev/null
+++ b/buch/papers/zeta/python/plot_zeta2.py
@@ -0,0 +1,31 @@
+import numpy as np
+from mpmath import zeta
+import matplotlib.pyplot as plt
+import matplotlib
+matplotlib.use("pgf")
+matplotlib.rcParams.update(
+ {
+ "pgf.texsystem": "pdflatex",
+ "font.family": "serif",
+ "font.size": 8,
+ "text.usetex": True,
+ "pgf.rcfonts": False,
+ "axes.unicode_minus": False,
+ }
+)
+# const re plot
+re_values = [-1, 0, 0.5]
+im_values = np.arange(0, 40, 0.04)
+buf = np.zeros((len(re_values), len(im_values), 2))
+for im_i, im in enumerate(im_values):
+ print(im_i)
+ for re_i, re in enumerate(re_values):
+ z = complex(zeta(re + 1j*im))
+ buf[re_i, im_i] = [np.real(z), np.imag(z)]
+
+for i in range(len(re_values)):
+ plt.figure()
+ plt.plot(buf[i,:,0], buf[i,:,1], label=f"$\Re={re_values[i]}$")
+ plt.xlabel("$\Re$")
+ plt.ylabel("$\Im$")
+ plt.savefig(f"zeta_re_{re_values[i]}_plot.pgf")
diff --git a/buch/papers/zeta/python/primzahlfunktion.py b/buch/papers/zeta/python/primzahlfunktion.py
new file mode 100644
index 0000000..9434de9
--- /dev/null
+++ b/buch/papers/zeta/python/primzahlfunktion.py
@@ -0,0 +1,24 @@
+import matplotlib.pyplot as plt
+import numpy as np
+
+primzahlfunktion = [0, 0, 0, 0]
+x = [0, 1-1e-12, 1, 2-1e-12]
+x_last = 1
+value = 0
+for i in range(2, 30, 1):
+ new_value = value + 1
+ for j in range(2, i, 1):
+ if i % j == 0:
+ new_value = value
+ value = new_value
+ primzahlfunktion.append(new_value)
+ x_last += 1
+ x.append(x_last)
+ primzahlfunktion.append(new_value)
+ x.append(x_last + 1 - 1e-12)
+
+
+plt.rcParams.update({"pgf.texsystem": "pdflatex"})
+plt.plot(x, primzahlfunktion)
+plt.show()
+