diff options
author | erik-loeffler <100943759+erik-loeffler@users.noreply.github.com> | 2022-08-15 09:54:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-15 09:54:10 +0200 |
commit | 504d47a5a03f60cd54425cfd97fbff750a3f9061 (patch) | |
tree | 74aef248a603bad26b825371af8526b008807950 /buch/papers/zeta/python/plot_zeta.py | |
parent | Merge pull request #3 from haddoucher/sturmliouville/erik-branch (diff) | |
parent | Merge pull request #49 from HeadAndToes/master (diff) | |
download | SeminarSpezielleFunktionen-504d47a5a03f60cd54425cfd97fbff750a3f9061.tar.gz SeminarSpezielleFunktionen-504d47a5a03f60cd54425cfd97fbff750a3f9061.zip |
Merge branch 'AndreasFMueller:master' into master
Diffstat (limited to 'buch/papers/zeta/python/plot_zeta.py')
-rw-r--r-- | buch/papers/zeta/python/plot_zeta.py | 39 |
1 files changed, 39 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") |