aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/laguerre/scripts/targets.py
diff options
context:
space:
mode:
authorPatrik Müller <patrik.mueller@ost.ch>2022-07-15 16:24:48 +0200
committerPatrik Müller <patrik.mueller@ost.ch>2022-07-15 16:24:48 +0200
commit7a8795dcb555a551fd09a3c9b15002675e30891f (patch)
tree4913f47695788cc05778a4326ba5ca44b6eb0046 /buch/papers/laguerre/scripts/targets.py
parentFirst version of section 'Gauss Quadratur', fix to gamma_approx.py when z=0 (diff)
downloadSeminarSpezielleFunktionen-7a8795dcb555a551fd09a3c9b15002675e30891f.tar.gz
SeminarSpezielleFunktionen-7a8795dcb555a551fd09a3c9b15002675e30891f.zip
Change image scripts to PDF format, update Makefile, add complex plane plot
Diffstat (limited to '')
-rw-r--r--buch/papers/laguerre/scripts/targets.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/buch/papers/laguerre/scripts/targets.py b/buch/papers/laguerre/scripts/targets.py
index 73d6e03..206b3a1 100644
--- a/buch/papers/laguerre/scripts/targets.py
+++ b/buch/papers/laguerre/scripts/targets.py
@@ -10,24 +10,33 @@ def find_best_loc(N=200, a=1.375, b=0.5, ns=None):
bests = []
step = 1 / (N - 1)
x = np.linspace(step, 1 - step, N + 1)
- gamma = scipy.special.gamma(x)[:, None]
+ gamma = scipy.special.gamma(x)
for n in ns:
zeros, weights = np.polynomial.laguerre.laggauss(n)
est = np.ceil(b + a * n)
targets = np.arange(max(est - 2, 0), est + 3)
- glag = [
- ga.eval_laguerre_gamma(x, target=target, x=zeros, w=weights, func="shifted")
- for target in targets
- ]
- gamma_lag = np.stack(glag, -1)
- rel_error = np.abs(ga.calc_rel_error(gamma, gamma_lag))
+ rel_error = []
+ for target in targets:
+ gamma_lag = ga.eval_laguerre_gamma(x, target=target, x=zeros, w=weights, func="shifted")
+ rel_error.append(np.abs(ga.calc_rel_error(gamma, gamma_lag)))
+ rel_error = np.stack(rel_error, -1)
best = np.argmin(rel_error, -1) + targets[0]
bests.append(best)
return np.stack(bests, 0)
if __name__ == "__main__":
+ import matplotlib as mpl
import matplotlib.pyplot as plt
+
+ mpl.rcParams.update(
+ {
+ "mathtext.fontset": "stix",
+ "font.family": "serif",
+ "font.serif": "TeX Gyre Termes",
+ }
+ )
+
N = 200
ns = np.arange(2, 13)
@@ -45,4 +54,5 @@ if __name__ == "__main__":
ax.set_yticklabels(ns)
ax.set_xlabel(r"$z$")
ax.set_ylabel(r"$n$")
- fig.savefig(f"{ga.img_path}/targets.pgf")
+ # fig.savefig(f"{ga.img_path}/targets.pgf")
+ fig.savefig(f"{ga.img_path}/targets.pdf")