aboutsummaryrefslogtreecommitdiffstats
path: root/buch/papers/laguerre/scripts/integrand_exp.py
blob: e649b26f8e8740c6b7ba501816161ea18dcdef92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""Plot for integrand of gamma function with shifting terms."""

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])

    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([-1, -0.5, 0.0, 0.5, 1, 2, 3, 4, 4.5])
    e = np.exp(-t)
    r = t ** z * e

    fig, ax = plt.subplots(num=2, clear=True, constrained_layout=True, figsize=(4, 2.4))
    ax.semilogx(t, r)
    # ax.plot(t,np.exp(-t))
    ax.set_xlim(10 ** (-2), 20)
    ax.set_ylim(1e-3, 10)
    ax.set_xlabel(r"$x$")
    # ax.set_ylabel(r"$x^z e^{-x}$")
    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_exp.pgf")
    fig.savefig(f"{img_path}/integrand_exp.pdf")
    # plt.show()