From fde57297b3efbef28d09a532e1b3895d2b2ad917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20M=C3=BCller?= Date: Thu, 14 Jul 2022 15:03:28 +0200 Subject: Correct Makefile, add text to gamma.tex, separate python-scripts for each image --- buch/papers/laguerre/scripts/estimates.py | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 buch/papers/laguerre/scripts/estimates.py (limited to 'buch/papers/laguerre/scripts/estimates.py') diff --git a/buch/papers/laguerre/scripts/estimates.py b/buch/papers/laguerre/scripts/estimates.py new file mode 100644 index 0000000..207bbd2 --- /dev/null +++ b/buch/papers/laguerre/scripts/estimates.py @@ -0,0 +1,39 @@ +if __name__ == "__main__": + import matplotlib.pyplot as plt + import numpy as np + + import gamma_approx as ga + import targets + + N = 200 + ns = np.arange(2, 13) + step = 1 / (N - 1) + x = np.linspace(step, 1 - step, N + 1) + + bests = targets.find_best_loc(N, ns=ns) + mean_m = np.mean(bests, -1) + + intercept, bias = np.polyfit(ns, mean_m, 1) + fig, axs = plt.subplots( + 2, num=1, sharex=True, clear=True, constrained_layout=True, figsize=(4.5, 3.6) + ) + xl = np.array([ns[0] - 0.5, ns[-1] + 0.5]) + axs[0].plot(xl, intercept * xl + bias, label=r"$\hat{m}$") + axs[0].plot(ns, mean_m, "x", label=r"$\overline{m}$") + axs[1].plot( + ns, ((intercept * ns + bias) - mean_m), "-x", label=r"$\hat{m} - \overline{m}$" + ) + axs[0].set_xlim(*xl) + axs[0].set_xticks(ns) + axs[0].set_yticks(np.arange(np.floor(mean_m[0]), np.ceil(mean_m[-1]) + 0.1, 2)) + # axs[0].set_title("Schätzung von Mittelwert") + # axs[1].set_title("Fehler") + axs[-1].set_xlabel(r"$n$") + for ax in axs: + ax.grid(1) + ax.legend() + fig.savefig(f"{ga.img_path}/estimates.pgf") + + print(f"Intercept={intercept:.6g}, Bias={bias:.6g}") + predicts = np.ceil(intercept * ns[:, None] + bias - np.real(x)) + print(f"Error: {np.mean(np.abs(bests - predicts))}") -- cgit v1.2.1 From 7a8795dcb555a551fd09a3c9b15002675e30891f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20M=C3=BCller?= Date: Fri, 15 Jul 2022 16:24:48 +0200 Subject: Change image scripts to PDF format, update Makefile, add complex plane plot --- buch/papers/laguerre/scripts/estimates.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'buch/papers/laguerre/scripts/estimates.py') diff --git a/buch/papers/laguerre/scripts/estimates.py b/buch/papers/laguerre/scripts/estimates.py index 207bbd2..21551f3 100644 --- a/buch/papers/laguerre/scripts/estimates.py +++ b/buch/papers/laguerre/scripts/estimates.py @@ -1,10 +1,19 @@ if __name__ == "__main__": + import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import gamma_approx as ga import targets + mpl.rcParams.update( + { + "mathtext.fontset": "stix", + "font.family": "serif", + "font.serif": "TeX Gyre Termes", + } + ) + N = 200 ns = np.arange(2, 13) step = 1 / (N - 1) @@ -32,7 +41,8 @@ if __name__ == "__main__": for ax in axs: ax.grid(1) ax.legend() - fig.savefig(f"{ga.img_path}/estimates.pgf") + # fig.savefig(f"{ga.img_path}/estimates.pgf") + fig.savefig(f"{ga.img_path}/estimates.pdf") print(f"Intercept={intercept:.6g}, Bias={bias:.6g}") predicts = np.ceil(intercept * ns[:, None] + bias - np.real(x)) -- cgit v1.2.1 From 5da2fa5a5e6a2fa2b8a23745b8c300d15a06669d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20M=C3=BCller?= Date: Sat, 23 Jul 2022 15:19:20 +0200 Subject: Restruct paper, correct typos, add positive conclusion, add more citations and references, small changes to plots --- buch/papers/laguerre/scripts/estimates.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'buch/papers/laguerre/scripts/estimates.py') diff --git a/buch/papers/laguerre/scripts/estimates.py b/buch/papers/laguerre/scripts/estimates.py index 21551f3..1acd7f7 100644 --- a/buch/papers/laguerre/scripts/estimates.py +++ b/buch/papers/laguerre/scripts/estimates.py @@ -15,7 +15,7 @@ if __name__ == "__main__": ) N = 200 - ns = np.arange(2, 13) + ns = np.arange(1, 13) step = 1 / (N - 1) x = np.linspace(step, 1 - step, N + 1) -- cgit v1.2.1