From e1f5d6267540ea8dc758696fb08cb7540362cf8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20M=C3=BCller?= Date: Mon, 18 Jul 2022 17:34:37 +0200 Subject: First complete draft of Laguerre chapter --- buch/papers/laguerre/scripts/gamma_approx.py | 1 + buch/papers/laguerre/scripts/rel_error_complex.py | 4 ++-- buch/papers/laguerre/scripts/rel_error_range.py | 2 +- buch/papers/laguerre/scripts/rel_error_shifted.py | 2 +- buch/papers/laguerre/scripts/targets.py | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) (limited to 'buch/papers/laguerre/scripts') diff --git a/buch/papers/laguerre/scripts/gamma_approx.py b/buch/papers/laguerre/scripts/gamma_approx.py index 9f9dae7..5b09e59 100644 --- a/buch/papers/laguerre/scripts/gamma_approx.py +++ b/buch/papers/laguerre/scripts/gamma_approx.py @@ -7,6 +7,7 @@ EPSILON = 1e-7 root = str(Path(__file__).parent) img_path = f"{root}/../images" fontsize = "medium" +cmap = "plasma" def _prep_zeros_and_weights(x, w, n): diff --git a/buch/papers/laguerre/scripts/rel_error_complex.py b/buch/papers/laguerre/scripts/rel_error_complex.py index 5be79be..4a714fa 100644 --- a/buch/papers/laguerre/scripts/rel_error_complex.py +++ b/buch/papers/laguerre/scripts/rel_error_complex.py @@ -24,9 +24,9 @@ if __name__ == "__main__": lag = ga.eval_laguerre_gamma(input, n=8, func="optimal_shifted").reshape(mesh.shape) rel_error = np.abs(ga.calc_rel_error(lanczos, lag)) - fig, ax = plt.subplots(clear=True, constrained_layout=True, figsize=(4, 2.4)) + fig, ax = plt.subplots(clear=True, constrained_layout=True, figsize=(3.5, 2.1)) _c = ax.pcolormesh( - x, y, rel_error, shading="gouraud", cmap="inferno", norm=mpl.colors.LogNorm() + x, y, rel_error, shading="gouraud", cmap=ga.cmap, norm=mpl.colors.LogNorm() ) cbr = fig.colorbar(_c, ax=ax) cbr.minorticks_off() diff --git a/buch/papers/laguerre/scripts/rel_error_range.py b/buch/papers/laguerre/scripts/rel_error_range.py index 43b5450..ece3b6d 100644 --- a/buch/papers/laguerre/scripts/rel_error_range.py +++ b/buch/papers/laguerre/scripts/rel_error_range.py @@ -21,7 +21,7 @@ if __name__ == "__main__": x = np.linspace(xmin + ga.EPSILON, xmax - ga.EPSILON, N) gamma = scipy.special.gamma(x) - fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(5, 2.5)) + fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(5, 2)) for n in ns: gamma_lag = ga.eval_laguerre_gamma(x, n=n, func="optimal_shifted") rel_err = ga.calc_rel_error(gamma, gamma_lag) diff --git a/buch/papers/laguerre/scripts/rel_error_shifted.py b/buch/papers/laguerre/scripts/rel_error_shifted.py index dc9d177..f53c89b 100644 --- a/buch/papers/laguerre/scripts/rel_error_shifted.py +++ b/buch/papers/laguerre/scripts/rel_error_shifted.py @@ -20,7 +20,7 @@ if __name__ == "__main__": x = np.linspace(step, 1 - step, N + 1) targets = np.arange(10, 14) gamma = scipy.special.gamma(x) - fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(5, 2.5)) + fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(5, 2.1)) for target in targets: gamma_lag = ga.eval_laguerre_gamma(x, target=target, n=n, func="shifted") rel_error = np.abs(ga.calc_rel_error(gamma, gamma_lag)) diff --git a/buch/papers/laguerre/scripts/targets.py b/buch/papers/laguerre/scripts/targets.py index 206b3a1..3bc7f52 100644 --- a/buch/papers/laguerre/scripts/targets.py +++ b/buch/papers/laguerre/scripts/targets.py @@ -42,8 +42,8 @@ if __name__ == "__main__": bests = find_best_loc(N, ns=ns) - fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(4, 2.4)) - v = ax.imshow(bests, cmap="inferno", aspect="auto", interpolation="nearest") + fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(3.5, 2.1)) + v = ax.imshow(bests, cmap=ga.cmap, aspect="auto", interpolation="nearest") plt.colorbar(v, ax=ax, label=r"$m^*$") ticks = np.arange(0, N + 1, N // 5) ax.set_xlim(0, 1) -- cgit v1.2.1