From 56cc6c1fbae271c16c78935384b52e047cdd6f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20M=C3=BCller?= Date: Thu, 19 May 2022 16:11:27 +0200 Subject: Error correction & add gamma integrand plot --- buch/papers/laguerre/scripts/integrand.py | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 buch/papers/laguerre/scripts/integrand.py (limited to 'buch/papers/laguerre/scripts/integrand.py') diff --git a/buch/papers/laguerre/scripts/integrand.py b/buch/papers/laguerre/scripts/integrand.py new file mode 100644 index 0000000..89b9256 --- /dev/null +++ b/buch/papers/laguerre/scripts/integrand.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# -*- coding:utf-8 -*- +"""Plot for integrand of gamma function with shifting terms.""" + +import os +from pathlib import Path + +import matplotlib.pyplot as plt +import numpy as np + +EPSILON = 1e-12 +xlims = np.array([-3, 3]) + +root = str(Path(__file__).parent) +img_path = f"{root}/../images" +os.makedirs(img_path, exist_ok=True) + +t = np.logspace(*xlims, 1001)[:, None] +z = np.arange(-5, 5)[None] + 0.5 + + +r = t ** z + +fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(6, 4)) +ax.semilogx(t, r) +ax.set_xlim(*(10.**xlims)) +ax.set_ylim(1e-3, 40) +ax.set_xlabel(r"$t$") +ax.set_ylabel(r"$t^z$") +ax.grid(1, "both") +labels = [f"$z={zi:.1f}$" for zi in np.squeeze(z)] +ax.legend(labels, ncol=2, loc="upper left") +fig.savefig(f"{img_path}/integrands.pdf") +# plt.show() -- cgit v1.2.1 From 161adb15af8d10ccf6090a43a4c89b0d05c6ecda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20M=C3=BCller?= Date: Sat, 28 May 2022 16:16:52 +0200 Subject: Add introduction, integrand plot and reason why shifting evalutaion of gamma-func --- buch/papers/laguerre/scripts/integrand.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'buch/papers/laguerre/scripts/integrand.py') diff --git a/buch/papers/laguerre/scripts/integrand.py b/buch/papers/laguerre/scripts/integrand.py index 89b9256..43fc1bf 100644 --- a/buch/papers/laguerre/scripts/integrand.py +++ b/buch/papers/laguerre/scripts/integrand.py @@ -16,19 +16,33 @@ img_path = f"{root}/../images" os.makedirs(img_path, exist_ok=True) t = np.logspace(*xlims, 1001)[:, None] -z = np.arange(-5, 5)[None] + 0.5 - +z = np.array([-4.5, -2, -1, -0.5, 0.0, 0.5, 1, 2, 4.5]) r = t ** z fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(6, 4)) ax.semilogx(t, r) -ax.set_xlim(*(10.**xlims)) +ax.set_xlim(*(10.0 ** xlims)) ax.set_ylim(1e-3, 40) ax.set_xlabel(r"$t$") ax.set_ylabel(r"$t^z$") ax.grid(1, "both") labels = [f"$z={zi:.1f}$" for zi in np.squeeze(z)] ax.legend(labels, ncol=2, loc="upper left") -fig.savefig(f"{img_path}/integrands.pdf") -# plt.show() +fig.savefig(f"{img_path}/integrands.pgf") + +z2 = np.array([-1, -0.5, 0.0, 0.5, 1, 2, 3, 4, 4.5]) +r2 = t**z2 * np.exp(-t) + +fig2, ax2 = plt.subplots(num=2, clear=True, constrained_layout=True, figsize=(6, 4)) +ax2.semilogx(t, r2) +# ax2.plot(t,np.exp(-t)) +ax2.set_xlim(10**(-2), 20) +ax2.set_ylim(1e-3, 10) +ax2.set_xlabel(r"$t$") +ax2.set_ylabel(r"$t^z e^{-t}$") +ax2.grid(1, "both") +labels = [f"$z={zi:.1f}$" for zi in np.squeeze(z2)] +ax2.legend(labels, ncol=2, loc="upper left") +fig2.savefig(f"{img_path}/integrands_exp.pgf") +plt.show() -- cgit v1.2.1 From 6149839224755c21225d2decddeae12207c2cbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20M=C3=BCller?= Date: Tue, 31 May 2022 16:31:25 +0200 Subject: Add rule of thumb, analyse integrand, correct mistake in integration SLP<->LP --- buch/papers/laguerre/scripts/integrand.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'buch/papers/laguerre/scripts/integrand.py') diff --git a/buch/papers/laguerre/scripts/integrand.py b/buch/papers/laguerre/scripts/integrand.py index 43fc1bf..0cf43d1 100644 --- a/buch/papers/laguerre/scripts/integrand.py +++ b/buch/papers/laguerre/scripts/integrand.py @@ -20,29 +20,30 @@ t = np.logspace(*xlims, 1001)[:, None] z = np.array([-4.5, -2, -1, -0.5, 0.0, 0.5, 1, 2, 4.5]) r = t ** z -fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(6, 4)) +fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(5, 3)) ax.semilogx(t, r) ax.set_xlim(*(10.0 ** xlims)) ax.set_ylim(1e-3, 40) -ax.set_xlabel(r"$t$") -ax.set_ylabel(r"$t^z$") +ax.set_xlabel(r"$x$") +ax.set_ylabel(r"$x^z$") ax.grid(1, "both") -labels = [f"$z={zi:.1f}$" for zi in np.squeeze(z)] -ax.legend(labels, ncol=2, loc="upper left") +labels = [f"$z={zi: 3.1f}$" for zi in np.squeeze(z)] +ax.legend(labels, ncol=2, loc="upper left", fontsize="small") fig.savefig(f"{img_path}/integrands.pgf") z2 = np.array([-1, -0.5, 0.0, 0.5, 1, 2, 3, 4, 4.5]) -r2 = t**z2 * np.exp(-t) +e = np.exp(-t) +r2 = t ** z2 * e -fig2, ax2 = plt.subplots(num=2, clear=True, constrained_layout=True, figsize=(6, 4)) +fig2, ax2 = plt.subplots(num=2, clear=True, constrained_layout=True, figsize=(5, 3)) ax2.semilogx(t, r2) # ax2.plot(t,np.exp(-t)) -ax2.set_xlim(10**(-2), 20) +ax2.set_xlim(10 ** (-2), 20) ax2.set_ylim(1e-3, 10) -ax2.set_xlabel(r"$t$") -ax2.set_ylabel(r"$t^z e^{-t}$") +ax2.set_xlabel(r"$x$") +ax2.set_ylabel(r"$x^z e^{-x}$") ax2.grid(1, "both") -labels = [f"$z={zi:.1f}$" for zi in np.squeeze(z2)] -ax2.legend(labels, ncol=2, loc="upper left") +labels =[f"$z={zi: 3.1f}$" for zi in np.squeeze(z2)] +ax2.legend(labels, ncol=2, loc="upper left", fontsize="small") fig2.savefig(f"{img_path}/integrands_exp.pgf") -plt.show() +# plt.show() -- cgit v1.2.1 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/integrand.py | 74 ++++++++++++------------------- 1 file changed, 29 insertions(+), 45 deletions(-) (limited to 'buch/papers/laguerre/scripts/integrand.py') diff --git a/buch/papers/laguerre/scripts/integrand.py b/buch/papers/laguerre/scripts/integrand.py index 0cf43d1..f31f194 100644 --- a/buch/papers/laguerre/scripts/integrand.py +++ b/buch/papers/laguerre/scripts/integrand.py @@ -2,48 +2,32 @@ # -*- coding:utf-8 -*- """Plot for integrand of gamma function with shifting terms.""" -import os -from pathlib import Path - -import matplotlib.pyplot as plt -import numpy as np - -EPSILON = 1e-12 -xlims = np.array([-3, 3]) - -root = str(Path(__file__).parent) -img_path = f"{root}/../images" -os.makedirs(img_path, exist_ok=True) - -t = np.logspace(*xlims, 1001)[:, None] - -z = np.array([-4.5, -2, -1, -0.5, 0.0, 0.5, 1, 2, 4.5]) -r = t ** z - -fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(5, 3)) -ax.semilogx(t, r) -ax.set_xlim(*(10.0 ** xlims)) -ax.set_ylim(1e-3, 40) -ax.set_xlabel(r"$x$") -ax.set_ylabel(r"$x^z$") -ax.grid(1, "both") -labels = [f"$z={zi: 3.1f}$" for zi in np.squeeze(z)] -ax.legend(labels, ncol=2, loc="upper left", fontsize="small") -fig.savefig(f"{img_path}/integrands.pgf") - -z2 = np.array([-1, -0.5, 0.0, 0.5, 1, 2, 3, 4, 4.5]) -e = np.exp(-t) -r2 = t ** z2 * e - -fig2, ax2 = plt.subplots(num=2, clear=True, constrained_layout=True, figsize=(5, 3)) -ax2.semilogx(t, r2) -# ax2.plot(t,np.exp(-t)) -ax2.set_xlim(10 ** (-2), 20) -ax2.set_ylim(1e-3, 10) -ax2.set_xlabel(r"$x$") -ax2.set_ylabel(r"$x^z e^{-x}$") -ax2.grid(1, "both") -labels =[f"$z={zi: 3.1f}$" for zi in np.squeeze(z2)] -ax2.legend(labels, ncol=2, loc="upper left", fontsize="small") -fig2.savefig(f"{img_path}/integrands_exp.pgf") -# plt.show() +if __name__ == "__main__": + import os + from pathlib import Path + + import matplotlib.pyplot as plt + import numpy as np + + EPSILON = 1e-12 + xlims = np.array([-3, 3]) + + root = str(Path(__file__).parent) + img_path = f"{root}/../images" + os.makedirs(img_path, exist_ok=True) + + t = np.logspace(*xlims, 1001)[:, None] + + z = np.array([-4.5, -2, -1, -0.5, 0.0, 0.5, 1, 2, 4.5]) + r = t ** z + + fig, ax = plt.subplots(num=1, clear=True, constrained_layout=True, figsize=(4, 2.4)) + ax.semilogx(t, r) + ax.set_xlim(*(10.0 ** xlims)) + ax.set_ylim(1e-3, 40) + ax.set_xlabel(r"$x$") + # ax.set_ylabel(r"$x^z$") + ax.grid(1, "both") + labels = [f"$z={zi: 3.1f}$" for zi in np.squeeze(z)] + ax.legend(labels, ncol=2, loc="upper left", fontsize="small") + fig.savefig(f"{img_path}/integrand.pgf") -- 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/integrand.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'buch/papers/laguerre/scripts/integrand.py') diff --git a/buch/papers/laguerre/scripts/integrand.py b/buch/papers/laguerre/scripts/integrand.py index f31f194..e970721 100644 --- a/buch/papers/laguerre/scripts/integrand.py +++ b/buch/papers/laguerre/scripts/integrand.py @@ -6,9 +6,18 @@ if __name__ == "__main__": import os from pathlib import Path + import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np + mpl.rcParams.update( + { + "mathtext.fontset": "stix", + "font.family": "serif", + "font.serif": "TeX Gyre Termes", + } + ) + EPSILON = 1e-12 xlims = np.array([-3, 3]) @@ -30,4 +39,4 @@ if __name__ == "__main__": ax.grid(1, "both") labels = [f"$z={zi: 3.1f}$" for zi in np.squeeze(z)] ax.legend(labels, ncol=2, loc="upper left", fontsize="small") - fig.savefig(f"{img_path}/integrand.pgf") + fig.savefig(f"{img_path}/integrand.pdf") -- cgit v1.2.1