ラゲルの多項式¶

In [1]:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
In [2]:
import scienceplots
#Warning : As of version 2.0.0, you need to add import scienceplots before setting the style (plt.style.use('science')).
plt.style.use(['science', 'notebook'])
# rcPramsを使ってTeXのフォントをデフォルトにする
plt.rcParams['font.family'] = 'Times New Roman' # font familyの設定
plt.rcParams['font.family'] = 'serif' # font familyの設定
plt.rcParams['mathtext.fontset'] = 'cm' # math fontの設定
In [3]:
np.set_printoptions(precision=5)
In [4]:
# n, m: 次数(整数)
# x: 変数(実数)
def lague(n, m, x):# ラゲルの多項式
    f1 = 1.0
    fla = f1
    if n != 0:
        f2 = float(1+m)-x
        fla = f2
        if n != 1:
            je = n-1
            for j in range(je):
                n1 = (j+1)+1
                c2 = x-float(2*n1+m-1)
                c1 = float(n1+m-1)
                f3 = (-c2*f2-c1*f1)/float(n1)
                f1 = f2
                f2 = f3
            fla = f3
    return fla
In [5]:
def dfactorial(n):# 再帰関数による階乗
    if n == 0:
        k = 1
    else:
        k = n*dfactorial(n-1)
    return k
In [6]:
def dfactorial2(n,m):# n!/m! (n>m)
    if n==0 or n==m:
       k = 1
    else:
       k = n*dfactorial2(n-1,m)
    return k
In [7]:
# m, n: ビームモードの次数
# t: 変数
def bmf(m ,n, t):# ビームモード
    if m==0 and n==0:
       f = 1.0
    else:
       x = 2.0*t*t
       f = 1.0/dfactorial2(n+m,n)
       f = np.sqrt(f)*(np.sqrt(2.0)*t)**m
       f = f*lague(n,m,x)
    f = f*np.exp(-t*t)
    return f
In [8]:
nx = 10# 計算点数
print(f"{'i':>10s} {'i!':>10s} {'i!/(i-2)!':>10s}")
for i in range(nx):
    k = dfactorial(i+2)
    k2 = dfactorial2(i+2,i) 
    print(f"{i+2:10.0f} {k:10.0f} {k2:10.0f}")
         i         i!  i!/(i-2)!
         2          2          2
         3          6          6
         4         24         12
         5        120         20
         6        720         30
         7       5040         42
         8      40320         56
         9     362880         72
        10    3628800         90
        11   39916800        110
In [9]:
x_min, x_max, n_x = 0.0, 4.0, 101
xx = np.linspace(x_min, x_max, n_x)
print(f"{'x':>8s} {'L0,0':>8s} {'L0,1':>8s} {'L0,2':>8s}")
for x in xx:
    print(f"{x:8.3f} {lague(0,0,x):8.3f} {lague(0,1,x):8.3f} {lague(0,2,x):8.3f}")
       x     L0,0     L0,1     L0,2
   0.000    1.000    1.000    1.000
   0.040    1.000    1.000    1.000
   0.080    1.000    1.000    1.000
   0.120    1.000    1.000    1.000
   0.160    1.000    1.000    1.000
   0.200    1.000    1.000    1.000
   0.240    1.000    1.000    1.000
   0.280    1.000    1.000    1.000
   0.320    1.000    1.000    1.000
   0.360    1.000    1.000    1.000
   0.400    1.000    1.000    1.000
   0.440    1.000    1.000    1.000
   0.480    1.000    1.000    1.000
   0.520    1.000    1.000    1.000
   0.560    1.000    1.000    1.000
   0.600    1.000    1.000    1.000
   0.640    1.000    1.000    1.000
   0.680    1.000    1.000    1.000
   0.720    1.000    1.000    1.000
   0.760    1.000    1.000    1.000
   0.800    1.000    1.000    1.000
   0.840    1.000    1.000    1.000
   0.880    1.000    1.000    1.000
   0.920    1.000    1.000    1.000
   0.960    1.000    1.000    1.000
   1.000    1.000    1.000    1.000
   1.040    1.000    1.000    1.000
   1.080    1.000    1.000    1.000
   1.120    1.000    1.000    1.000
   1.160    1.000    1.000    1.000
   1.200    1.000    1.000    1.000
   1.240    1.000    1.000    1.000
   1.280    1.000    1.000    1.000
   1.320    1.000    1.000    1.000
   1.360    1.000    1.000    1.000
   1.400    1.000    1.000    1.000
   1.440    1.000    1.000    1.000
   1.480    1.000    1.000    1.000
   1.520    1.000    1.000    1.000
   1.560    1.000    1.000    1.000
   1.600    1.000    1.000    1.000
   1.640    1.000    1.000    1.000
   1.680    1.000    1.000    1.000
   1.720    1.000    1.000    1.000
   1.760    1.000    1.000    1.000
   1.800    1.000    1.000    1.000
   1.840    1.000    1.000    1.000
   1.880    1.000    1.000    1.000
   1.920    1.000    1.000    1.000
   1.960    1.000    1.000    1.000
   2.000    1.000    1.000    1.000
   2.040    1.000    1.000    1.000
   2.080    1.000    1.000    1.000
   2.120    1.000    1.000    1.000
   2.160    1.000    1.000    1.000
   2.200    1.000    1.000    1.000
   2.240    1.000    1.000    1.000
   2.280    1.000    1.000    1.000
   2.320    1.000    1.000    1.000
   2.360    1.000    1.000    1.000
   2.400    1.000    1.000    1.000
   2.440    1.000    1.000    1.000
   2.480    1.000    1.000    1.000
   2.520    1.000    1.000    1.000
   2.560    1.000    1.000    1.000
   2.600    1.000    1.000    1.000
   2.640    1.000    1.000    1.000
   2.680    1.000    1.000    1.000
   2.720    1.000    1.000    1.000
   2.760    1.000    1.000    1.000
   2.800    1.000    1.000    1.000
   2.840    1.000    1.000    1.000
   2.880    1.000    1.000    1.000
   2.920    1.000    1.000    1.000
   2.960    1.000    1.000    1.000
   3.000    1.000    1.000    1.000
   3.040    1.000    1.000    1.000
   3.080    1.000    1.000    1.000
   3.120    1.000    1.000    1.000
   3.160    1.000    1.000    1.000
   3.200    1.000    1.000    1.000
   3.240    1.000    1.000    1.000
   3.280    1.000    1.000    1.000
   3.320    1.000    1.000    1.000
   3.360    1.000    1.000    1.000
   3.400    1.000    1.000    1.000
   3.440    1.000    1.000    1.000
   3.480    1.000    1.000    1.000
   3.520    1.000    1.000    1.000
   3.560    1.000    1.000    1.000
   3.600    1.000    1.000    1.000
   3.640    1.000    1.000    1.000
   3.680    1.000    1.000    1.000
   3.720    1.000    1.000    1.000
   3.760    1.000    1.000    1.000
   3.800    1.000    1.000    1.000
   3.840    1.000    1.000    1.000
   3.880    1.000    1.000    1.000
   3.920    1.000    1.000    1.000
   3.960    1.000    1.000    1.000
   4.000    1.000    1.000    1.000
In [10]:
print(f"{'x':>8s} {'L1,0':>8s} {'L1,1':>8s} {'L1,2':>8s}")
l1 = np.empty([3,len(xx)])
for j in range(len(xx)):
    for i in range(3):
        l1[i,j] = lague(1,i,xx[j])
    print(f"{xx[j]:8.3f} {l1[0,j]:8.3f} {l1[1,j]:8.3f} {l1[2,j]:8.3f}")
       x     L1,0     L1,1     L1,2
   0.000    1.000    2.000    3.000
   0.040    0.960    1.960    2.960
   0.080    0.920    1.920    2.920
   0.120    0.880    1.880    2.880
   0.160    0.840    1.840    2.840
   0.200    0.800    1.800    2.800
   0.240    0.760    1.760    2.760
   0.280    0.720    1.720    2.720
   0.320    0.680    1.680    2.680
   0.360    0.640    1.640    2.640
   0.400    0.600    1.600    2.600
   0.440    0.560    1.560    2.560
   0.480    0.520    1.520    2.520
   0.520    0.480    1.480    2.480
   0.560    0.440    1.440    2.440
   0.600    0.400    1.400    2.400
   0.640    0.360    1.360    2.360
   0.680    0.320    1.320    2.320
   0.720    0.280    1.280    2.280
   0.760    0.240    1.240    2.240
   0.800    0.200    1.200    2.200
   0.840    0.160    1.160    2.160
   0.880    0.120    1.120    2.120
   0.920    0.080    1.080    2.080
   0.960    0.040    1.040    2.040
   1.000    0.000    1.000    2.000
   1.040   -0.040    0.960    1.960
   1.080   -0.080    0.920    1.920
   1.120   -0.120    0.880    1.880
   1.160   -0.160    0.840    1.840
   1.200   -0.200    0.800    1.800
   1.240   -0.240    0.760    1.760
   1.280   -0.280    0.720    1.720
   1.320   -0.320    0.680    1.680
   1.360   -0.360    0.640    1.640
   1.400   -0.400    0.600    1.600
   1.440   -0.440    0.560    1.560
   1.480   -0.480    0.520    1.520
   1.520   -0.520    0.480    1.480
   1.560   -0.560    0.440    1.440
   1.600   -0.600    0.400    1.400
   1.640   -0.640    0.360    1.360
   1.680   -0.680    0.320    1.320
   1.720   -0.720    0.280    1.280
   1.760   -0.760    0.240    1.240
   1.800   -0.800    0.200    1.200
   1.840   -0.840    0.160    1.160
   1.880   -0.880    0.120    1.120
   1.920   -0.920    0.080    1.080
   1.960   -0.960    0.040    1.040
   2.000   -1.000    0.000    1.000
   2.040   -1.040   -0.040    0.960
   2.080   -1.080   -0.080    0.920
   2.120   -1.120   -0.120    0.880
   2.160   -1.160   -0.160    0.840
   2.200   -1.200   -0.200    0.800
   2.240   -1.240   -0.240    0.760
   2.280   -1.280   -0.280    0.720
   2.320   -1.320   -0.320    0.680
   2.360   -1.360   -0.360    0.640
   2.400   -1.400   -0.400    0.600
   2.440   -1.440   -0.440    0.560
   2.480   -1.480   -0.480    0.520
   2.520   -1.520   -0.520    0.480
   2.560   -1.560   -0.560    0.440
   2.600   -1.600   -0.600    0.400
   2.640   -1.640   -0.640    0.360
   2.680   -1.680   -0.680    0.320
   2.720   -1.720   -0.720    0.280
   2.760   -1.760   -0.760    0.240
   2.800   -1.800   -0.800    0.200
   2.840   -1.840   -0.840    0.160
   2.880   -1.880   -0.880    0.120
   2.920   -1.920   -0.920    0.080
   2.960   -1.960   -0.960    0.040
   3.000   -2.000   -1.000    0.000
   3.040   -2.040   -1.040   -0.040
   3.080   -2.080   -1.080   -0.080
   3.120   -2.120   -1.120   -0.120
   3.160   -2.160   -1.160   -0.160
   3.200   -2.200   -1.200   -0.200
   3.240   -2.240   -1.240   -0.240
   3.280   -2.280   -1.280   -0.280
   3.320   -2.320   -1.320   -0.320
   3.360   -2.360   -1.360   -0.360
   3.400   -2.400   -1.400   -0.400
   3.440   -2.440   -1.440   -0.440
   3.480   -2.480   -1.480   -0.480
   3.520   -2.520   -1.520   -0.520
   3.560   -2.560   -1.560   -0.560
   3.600   -2.600   -1.600   -0.600
   3.640   -2.640   -1.640   -0.640
   3.680   -2.680   -1.680   -0.680
   3.720   -2.720   -1.720   -0.720
   3.760   -2.760   -1.760   -0.760
   3.800   -2.800   -1.800   -0.800
   3.840   -2.840   -1.840   -0.840
   3.880   -2.880   -1.880   -0.880
   3.920   -2.920   -1.920   -0.920
   3.960   -2.960   -1.960   -0.960
   4.000   -3.000   -2.000   -1.000
In [11]:
df = pd.DataFrame({
    '$x$':xx,
    '$L_{1,0}(x)$':l1[0,:],
    '$L_{1,1}(x)$':l1[1,:],
    '$L_{1,2}(x)$':l1[2,:],
})
df.style.format({"$x$":"{:.2f}"})
Out[11]:
  $x$ $L_{1,0}(x)$ $L_{1,1}(x)$ $L_{1,2}(x)$
0 0.00 1.000000 2.000000 3.000000
1 0.04 0.960000 1.960000 2.960000
2 0.08 0.920000 1.920000 2.920000
3 0.12 0.880000 1.880000 2.880000
4 0.16 0.840000 1.840000 2.840000
5 0.20 0.800000 1.800000 2.800000
6 0.24 0.760000 1.760000 2.760000
7 0.28 0.720000 1.720000 2.720000
8 0.32 0.680000 1.680000 2.680000
9 0.36 0.640000 1.640000 2.640000
10 0.40 0.600000 1.600000 2.600000
11 0.44 0.560000 1.560000 2.560000
12 0.48 0.520000 1.520000 2.520000
13 0.52 0.480000 1.480000 2.480000
14 0.56 0.440000 1.440000 2.440000
15 0.60 0.400000 1.400000 2.400000
16 0.64 0.360000 1.360000 2.360000
17 0.68 0.320000 1.320000 2.320000
18 0.72 0.280000 1.280000 2.280000
19 0.76 0.240000 1.240000 2.240000
20 0.80 0.200000 1.200000 2.200000
21 0.84 0.160000 1.160000 2.160000
22 0.88 0.120000 1.120000 2.120000
23 0.92 0.080000 1.080000 2.080000
24 0.96 0.040000 1.040000 2.040000
25 1.00 0.000000 1.000000 2.000000
26 1.04 -0.040000 0.960000 1.960000
27 1.08 -0.080000 0.920000 1.920000
28 1.12 -0.120000 0.880000 1.880000
29 1.16 -0.160000 0.840000 1.840000
30 1.20 -0.200000 0.800000 1.800000
31 1.24 -0.240000 0.760000 1.760000
32 1.28 -0.280000 0.720000 1.720000
33 1.32 -0.320000 0.680000 1.680000
34 1.36 -0.360000 0.640000 1.640000
35 1.40 -0.400000 0.600000 1.600000
36 1.44 -0.440000 0.560000 1.560000
37 1.48 -0.480000 0.520000 1.520000
38 1.52 -0.520000 0.480000 1.480000
39 1.56 -0.560000 0.440000 1.440000
40 1.60 -0.600000 0.400000 1.400000
41 1.64 -0.640000 0.360000 1.360000
42 1.68 -0.680000 0.320000 1.320000
43 1.72 -0.720000 0.280000 1.280000
44 1.76 -0.760000 0.240000 1.240000
45 1.80 -0.800000 0.200000 1.200000
46 1.84 -0.840000 0.160000 1.160000
47 1.88 -0.880000 0.120000 1.120000
48 1.92 -0.920000 0.080000 1.080000
49 1.96 -0.960000 0.040000 1.040000
50 2.00 -1.000000 0.000000 1.000000
51 2.04 -1.040000 -0.040000 0.960000
52 2.08 -1.080000 -0.080000 0.920000
53 2.12 -1.120000 -0.120000 0.880000
54 2.16 -1.160000 -0.160000 0.840000
55 2.20 -1.200000 -0.200000 0.800000
56 2.24 -1.240000 -0.240000 0.760000
57 2.28 -1.280000 -0.280000 0.720000
58 2.32 -1.320000 -0.320000 0.680000
59 2.36 -1.360000 -0.360000 0.640000
60 2.40 -1.400000 -0.400000 0.600000
61 2.44 -1.440000 -0.440000 0.560000
62 2.48 -1.480000 -0.480000 0.520000
63 2.52 -1.520000 -0.520000 0.480000
64 2.56 -1.560000 -0.560000 0.440000
65 2.60 -1.600000 -0.600000 0.400000
66 2.64 -1.640000 -0.640000 0.360000
67 2.68 -1.680000 -0.680000 0.320000
68 2.72 -1.720000 -0.720000 0.280000
69 2.76 -1.760000 -0.760000 0.240000
70 2.80 -1.800000 -0.800000 0.200000
71 2.84 -1.840000 -0.840000 0.160000
72 2.88 -1.880000 -0.880000 0.120000
73 2.92 -1.920000 -0.920000 0.080000
74 2.96 -1.960000 -0.960000 0.040000
75 3.00 -2.000000 -1.000000 0.000000
76 3.04 -2.040000 -1.040000 -0.040000
77 3.08 -2.080000 -1.080000 -0.080000
78 3.12 -2.120000 -1.120000 -0.120000
79 3.16 -2.160000 -1.160000 -0.160000
80 3.20 -2.200000 -1.200000 -0.200000
81 3.24 -2.240000 -1.240000 -0.240000
82 3.28 -2.280000 -1.280000 -0.280000
83 3.32 -2.320000 -1.320000 -0.320000
84 3.36 -2.360000 -1.360000 -0.360000
85 3.40 -2.400000 -1.400000 -0.400000
86 3.44 -2.440000 -1.440000 -0.440000
87 3.48 -2.480000 -1.480000 -0.480000
88 3.52 -2.520000 -1.520000 -0.520000
89 3.56 -2.560000 -1.560000 -0.560000
90 3.60 -2.600000 -1.600000 -0.600000
91 3.64 -2.640000 -1.640000 -0.640000
92 3.68 -2.680000 -1.680000 -0.680000
93 3.72 -2.720000 -1.720000 -0.720000
94 3.76 -2.760000 -1.760000 -0.760000
95 3.80 -2.800000 -1.800000 -0.800000
96 3.84 -2.840000 -1.840000 -0.840000
97 3.88 -2.880000 -1.880000 -0.880000
98 3.92 -2.920000 -1.920000 -0.920000
99 3.96 -2.960000 -1.960000 -0.960000
100 4.00 -3.000000 -2.000000 -1.000000
In [12]:
fig = plt.figure() # グラフ領域の作成
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlabel(r"$x$") # x軸のラベル設定
plt.ylabel(r"$L_{1,i}(x)$") # y軸のラベル設定
plt.plot(xx, l1[0,:], label=r"$L_{1,0}(x)$")
plt.plot(xx, l1[1,:], label=r"$L_{1,1}(x)$")
plt.plot(xx, l1[2,:], label=r"$L_{1,2}(x)$")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True)
fig.savefig('p2_ex09_1.pdf')
No description has been provided for this image
In [13]:
print(f"{'x':>8s} {'L2,0':>8s} {'L2,1':>8s} {'L2,2':>8s}")
l2 = np.empty([3,len(xx)])
for j in range(len(xx)):
    for i in range(3):
        l2[i,j] = lague(2,i,xx[j])
    print(f"{xx[j]:8.3f} {l2[0,j]:8.3f} {l2[1,j]:8.3f} {l2[2,j]:8.3f}")
       x     L2,0     L2,1     L2,2
   0.000    1.000    3.000    6.000
   0.040    0.921    2.881    5.841
   0.080    0.843    2.763    5.683
   0.120    0.767    2.647    5.527
   0.160    0.693    2.533    5.373
   0.200    0.620    2.420    5.220
   0.240    0.549    2.309    5.069
   0.280    0.479    2.199    4.919
   0.320    0.411    2.091    4.771
   0.360    0.345    1.985    4.625
   0.400    0.280    1.880    4.480
   0.440    0.217    1.777    4.337
   0.480    0.155    1.675    4.195
   0.520    0.095    1.575    4.055
   0.560    0.037    1.477    3.917
   0.600   -0.020    1.380    3.780
   0.640   -0.075    1.285    3.645
   0.680   -0.129    1.191    3.511
   0.720   -0.181    1.099    3.379
   0.760   -0.231    1.009    3.249
   0.800   -0.280    0.920    3.120
   0.840   -0.327    0.833    2.993
   0.880   -0.373    0.747    2.867
   0.920   -0.417    0.663    2.743
   0.960   -0.459    0.581    2.621
   1.000   -0.500    0.500    2.500
   1.040   -0.539    0.421    2.381
   1.080   -0.577    0.343    2.263
   1.120   -0.613    0.267    2.147
   1.160   -0.647    0.193    2.033
   1.200   -0.680    0.120    1.920
   1.240   -0.711    0.049    1.809
   1.280   -0.741   -0.021    1.699
   1.320   -0.769   -0.089    1.591
   1.360   -0.795   -0.155    1.485
   1.400   -0.820   -0.220    1.380
   1.440   -0.843   -0.283    1.277
   1.480   -0.865   -0.345    1.175
   1.520   -0.885   -0.405    1.075
   1.560   -0.903   -0.463    0.977
   1.600   -0.920   -0.520    0.880
   1.640   -0.935   -0.575    0.785
   1.680   -0.949   -0.629    0.691
   1.720   -0.961   -0.681    0.599
   1.760   -0.971   -0.731    0.509
   1.800   -0.980   -0.780    0.420
   1.840   -0.987   -0.827    0.333
   1.880   -0.993   -0.873    0.247
   1.920   -0.997   -0.917    0.163
   1.960   -0.999   -0.959    0.081
   2.000   -1.000   -1.000    0.000
   2.040   -0.999   -1.039   -0.079
   2.080   -0.997   -1.077   -0.157
   2.120   -0.993   -1.113   -0.233
   2.160   -0.987   -1.147   -0.307
   2.200   -0.980   -1.180   -0.380
   2.240   -0.971   -1.211   -0.451
   2.280   -0.961   -1.241   -0.521
   2.320   -0.949   -1.269   -0.589
   2.360   -0.935   -1.295   -0.655
   2.400   -0.920   -1.320   -0.720
   2.440   -0.903   -1.343   -0.783
   2.480   -0.885   -1.365   -0.845
   2.520   -0.865   -1.385   -0.905
   2.560   -0.843   -1.403   -0.963
   2.600   -0.820   -1.420   -1.020
   2.640   -0.795   -1.435   -1.075
   2.680   -0.769   -1.449   -1.129
   2.720   -0.741   -1.461   -1.181
   2.760   -0.711   -1.471   -1.231
   2.800   -0.680   -1.480   -1.280
   2.840   -0.647   -1.487   -1.327
   2.880   -0.613   -1.493   -1.373
   2.920   -0.577   -1.497   -1.417
   2.960   -0.539   -1.499   -1.459
   3.000   -0.500   -1.500   -1.500
   3.040   -0.459   -1.499   -1.539
   3.080   -0.417   -1.497   -1.577
   3.120   -0.373   -1.493   -1.613
   3.160   -0.327   -1.487   -1.647
   3.200   -0.280   -1.480   -1.680
   3.240   -0.231   -1.471   -1.711
   3.280   -0.181   -1.461   -1.741
   3.320   -0.129   -1.449   -1.769
   3.360   -0.075   -1.435   -1.795
   3.400   -0.020   -1.420   -1.820
   3.440    0.037   -1.403   -1.843
   3.480    0.095   -1.385   -1.865
   3.520    0.155   -1.365   -1.885
   3.560    0.217   -1.343   -1.903
   3.600    0.280   -1.320   -1.920
   3.640    0.345   -1.295   -1.935
   3.680    0.411   -1.269   -1.949
   3.720    0.479   -1.241   -1.961
   3.760    0.549   -1.211   -1.971
   3.800    0.620   -1.180   -1.980
   3.840    0.693   -1.147   -1.987
   3.880    0.767   -1.113   -1.993
   3.920    0.843   -1.077   -1.997
   3.960    0.921   -1.039   -1.999
   4.000    1.000   -1.000   -2.000
In [14]:
df = pd.DataFrame({
    '$x$':xx,
    '$L_{2,0}(x)$':l2[0,:],
    '$L_{2,1}(x)$':l2[1,:],
    '$L_{2,2}(x)$':l2[2,:],
})
df.style.format({"$x$":"{:.2f}"})
Out[14]:
  $x$ $L_{2,0}(x)$ $L_{2,1}(x)$ $L_{2,2}(x)$
0 0.00 1.000000 3.000000 6.000000
1 0.04 0.920800 2.880800 5.840800
2 0.08 0.843200 2.763200 5.683200
3 0.12 0.767200 2.647200 5.527200
4 0.16 0.692800 2.532800 5.372800
5 0.20 0.620000 2.420000 5.220000
6 0.24 0.548800 2.308800 5.068800
7 0.28 0.479200 2.199200 4.919200
8 0.32 0.411200 2.091200 4.771200
9 0.36 0.344800 1.984800 4.624800
10 0.40 0.280000 1.880000 4.480000
11 0.44 0.216800 1.776800 4.336800
12 0.48 0.155200 1.675200 4.195200
13 0.52 0.095200 1.575200 4.055200
14 0.56 0.036800 1.476800 3.916800
15 0.60 -0.020000 1.380000 3.780000
16 0.64 -0.075200 1.284800 3.644800
17 0.68 -0.128800 1.191200 3.511200
18 0.72 -0.180800 1.099200 3.379200
19 0.76 -0.231200 1.008800 3.248800
20 0.80 -0.280000 0.920000 3.120000
21 0.84 -0.327200 0.832800 2.992800
22 0.88 -0.372800 0.747200 2.867200
23 0.92 -0.416800 0.663200 2.743200
24 0.96 -0.459200 0.580800 2.620800
25 1.00 -0.500000 0.500000 2.500000
26 1.04 -0.539200 0.420800 2.380800
27 1.08 -0.576800 0.343200 2.263200
28 1.12 -0.612800 0.267200 2.147200
29 1.16 -0.647200 0.192800 2.032800
30 1.20 -0.680000 0.120000 1.920000
31 1.24 -0.711200 0.048800 1.808800
32 1.28 -0.740800 -0.020800 1.699200
33 1.32 -0.768800 -0.088800 1.591200
34 1.36 -0.795200 -0.155200 1.484800
35 1.40 -0.820000 -0.220000 1.380000
36 1.44 -0.843200 -0.283200 1.276800
37 1.48 -0.864800 -0.344800 1.175200
38 1.52 -0.884800 -0.404800 1.075200
39 1.56 -0.903200 -0.463200 0.976800
40 1.60 -0.920000 -0.520000 0.880000
41 1.64 -0.935200 -0.575200 0.784800
42 1.68 -0.948800 -0.628800 0.691200
43 1.72 -0.960800 -0.680800 0.599200
44 1.76 -0.971200 -0.731200 0.508800
45 1.80 -0.980000 -0.780000 0.420000
46 1.84 -0.987200 -0.827200 0.332800
47 1.88 -0.992800 -0.872800 0.247200
48 1.92 -0.996800 -0.916800 0.163200
49 1.96 -0.999200 -0.959200 0.080800
50 2.00 -1.000000 -1.000000 0.000000
51 2.04 -0.999200 -1.039200 -0.079200
52 2.08 -0.996800 -1.076800 -0.156800
53 2.12 -0.992800 -1.112800 -0.232800
54 2.16 -0.987200 -1.147200 -0.307200
55 2.20 -0.980000 -1.180000 -0.380000
56 2.24 -0.971200 -1.211200 -0.451200
57 2.28 -0.960800 -1.240800 -0.520800
58 2.32 -0.948800 -1.268800 -0.588800
59 2.36 -0.935200 -1.295200 -0.655200
60 2.40 -0.920000 -1.320000 -0.720000
61 2.44 -0.903200 -1.343200 -0.783200
62 2.48 -0.884800 -1.364800 -0.844800
63 2.52 -0.864800 -1.384800 -0.904800
64 2.56 -0.843200 -1.403200 -0.963200
65 2.60 -0.820000 -1.420000 -1.020000
66 2.64 -0.795200 -1.435200 -1.075200
67 2.68 -0.768800 -1.448800 -1.128800
68 2.72 -0.740800 -1.460800 -1.180800
69 2.76 -0.711200 -1.471200 -1.231200
70 2.80 -0.680000 -1.480000 -1.280000
71 2.84 -0.647200 -1.487200 -1.327200
72 2.88 -0.612800 -1.492800 -1.372800
73 2.92 -0.576800 -1.496800 -1.416800
74 2.96 -0.539200 -1.499200 -1.459200
75 3.00 -0.500000 -1.500000 -1.500000
76 3.04 -0.459200 -1.499200 -1.539200
77 3.08 -0.416800 -1.496800 -1.576800
78 3.12 -0.372800 -1.492800 -1.612800
79 3.16 -0.327200 -1.487200 -1.647200
80 3.20 -0.280000 -1.480000 -1.680000
81 3.24 -0.231200 -1.471200 -1.711200
82 3.28 -0.180800 -1.460800 -1.740800
83 3.32 -0.128800 -1.448800 -1.768800
84 3.36 -0.075200 -1.435200 -1.795200
85 3.40 -0.020000 -1.420000 -1.820000
86 3.44 0.036800 -1.403200 -1.843200
87 3.48 0.095200 -1.384800 -1.864800
88 3.52 0.155200 -1.364800 -1.884800
89 3.56 0.216800 -1.343200 -1.903200
90 3.60 0.280000 -1.320000 -1.920000
91 3.64 0.344800 -1.295200 -1.935200
92 3.68 0.411200 -1.268800 -1.948800
93 3.72 0.479200 -1.240800 -1.960800
94 3.76 0.548800 -1.211200 -1.971200
95 3.80 0.620000 -1.180000 -1.980000
96 3.84 0.692800 -1.147200 -1.987200
97 3.88 0.767200 -1.112800 -1.992800
98 3.92 0.843200 -1.076800 -1.996800
99 3.96 0.920800 -1.039200 -1.999200
100 4.00 1.000000 -1.000000 -2.000000
In [15]:
fig = plt.figure() # グラフ領域の作成
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlabel(r"$x$") # x軸のラベル設定
plt.ylabel(r"$L_{2,i}(x)$") # y軸のラベル設定
plt.plot(xx, l2[0,:], label=r"$L_{2,0}(x)$")
plt.plot(xx, l2[1,:], label=r"$L_{2,1}(x)$")
plt.plot(xx, l2[2,:], label=r"$L_{2,2}(x)$")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True)
fig.savefig('p2_ex09_2.pdf')
No description has been provided for this image

ビームモード¶

In [16]:
print(f"{'x':>8s} {'F0,0':>8s} {'F0,1':>8s} {'F0,2':>8s} {'F0,3':>8s} {'F0,4':>8s}")
mm = 5
f0 = np.empty((mm,n_x))
f1 = np.empty((mm,n_x))
f2 = np.empty((mm,n_x))
f3 = np.empty((mm,n_x))
for j in range(n_x):
    for i in range(mm):
        f0[i,j] = bmf(0,i,xx[j])
        f1[i,j] = bmf(1,i,xx[j])
        f2[i,j] = bmf(2,i,xx[j])
        f3[i,j] = bmf(3,i,xx[j])
    print(f"{xx[j]:8.3f} {f0[0,j]:8.3f} {f0[1,j]:8.3f} {f0[2,j]:8.3f} {f0[3,j]:8.3f} {f0[4,j]:8.3f}")
       x     F0,0     F0,1     F0,2     F0,3     F0,4
   0.000    1.000    1.000    1.000    1.000    1.000
   0.040    0.998    0.995    0.992    0.989    0.986
   0.080    0.994    0.981    0.968    0.956    0.943
   0.120    0.986    0.957    0.929    0.902    0.875
   0.160    0.975    0.925    0.876    0.829    0.783
   0.200    0.961    0.884    0.810    0.739    0.671
   0.240    0.944    0.835    0.733    0.636    0.546
   0.280    0.925    0.780    0.646    0.523    0.411
   0.320    0.903    0.718    0.552    0.404    0.272
   0.360    0.878    0.651    0.453    0.281    0.135
   0.400    0.852    0.579    0.350    0.160    0.005
   0.440    0.824    0.505    0.248    0.044   -0.113
   0.480    0.794    0.428    0.147   -0.064   -0.214
   0.520    0.763    0.350    0.049   -0.160   -0.296
   0.560    0.731    0.272   -0.042   -0.243   -0.356
   0.600    0.698    0.195   -0.126   -0.310   -0.392
   0.640    0.664    0.120   -0.201   -0.360   -0.406
   0.680    0.630    0.047   -0.266   -0.393   -0.397
   0.720    0.595   -0.022   -0.319   -0.407   -0.368
   0.760    0.561   -0.087   -0.361   -0.405   -0.320
   0.800    0.527   -0.148   -0.391   -0.386   -0.259
   0.840    0.494   -0.203   -0.408   -0.353   -0.187
   0.880    0.461   -0.253   -0.414   -0.308   -0.109
   0.920    0.429   -0.297   -0.409   -0.252   -0.028
   0.960    0.398   -0.335   -0.393   -0.190    0.050
   1.000    0.368   -0.368   -0.368   -0.123    0.123
   1.040    0.339   -0.394   -0.335   -0.053    0.186
   1.080    0.311   -0.415   -0.294    0.015    0.238
   1.120    0.285   -0.430   -0.248    0.081    0.277
   1.160    0.260   -0.440   -0.198    0.141    0.301
   1.200    0.237   -0.445   -0.145    0.194    0.309
   1.240    0.215   -0.446   -0.091    0.239    0.303
   1.280    0.194   -0.442   -0.036    0.274    0.282
   1.320    0.175   -0.435    0.018    0.299    0.249
   1.360    0.157   -0.425    0.070    0.313    0.206
   1.400    0.141   -0.411    0.119    0.317    0.155
   1.440    0.126   -0.396    0.164    0.310    0.098
   1.480    0.112   -0.378    0.205    0.294    0.039
   1.520    0.099   -0.359    0.242    0.270   -0.021
   1.560    0.088   -0.339    0.273    0.238   -0.078
   1.600    0.077   -0.318    0.299    0.200   -0.130
   1.640    0.068   -0.297    0.320    0.158   -0.176
   1.680    0.059   -0.276    0.336    0.112   -0.214
   1.720    0.052   -0.255    0.346    0.064   -0.242
   1.760    0.045   -0.235    0.352    0.016   -0.261
   1.800    0.039   -0.215    0.354   -0.031   -0.269
   1.840    0.034   -0.195    0.352   -0.077   -0.268
   1.880    0.029   -0.177    0.346   -0.120   -0.257
   1.920    0.025   -0.160    0.337   -0.160   -0.238
   1.960    0.021   -0.143    0.325   -0.195   -0.210
   2.000    0.018   -0.128    0.311   -0.226   -0.177
   2.040    0.016   -0.114    0.296   -0.252   -0.139
   2.080    0.013   -0.101    0.279   -0.273   -0.097
   2.120    0.011   -0.089    0.262   -0.288   -0.053
   2.160    0.009   -0.078    0.244   -0.299   -0.008
   2.200    0.008   -0.069    0.225   -0.306    0.036
   2.240    0.007   -0.060    0.207   -0.308    0.078
   2.280    0.006   -0.052    0.189   -0.306    0.118
   2.320    0.005   -0.045    0.172   -0.301    0.154
   2.360    0.004   -0.039    0.155   -0.292    0.186
   2.400    0.003   -0.033    0.140   -0.281    0.213
   2.440    0.003   -0.028    0.125   -0.269    0.236
   2.480    0.002   -0.024    0.111   -0.254    0.253
   2.520    0.002   -0.020    0.098   -0.239    0.266
   2.560    0.001   -0.017    0.086   -0.222    0.274
   2.600    0.001   -0.015    0.076   -0.205    0.278
   2.640    0.001   -0.012    0.066   -0.189    0.278
   2.680    0.001   -0.010    0.057   -0.172    0.274
   2.720    0.001   -0.008    0.050   -0.156    0.267
   2.760    0.000   -0.007    0.043   -0.141    0.258
   2.800    0.000   -0.006    0.036   -0.126    0.246
   2.840    0.000   -0.005    0.031   -0.112    0.233
   2.880    0.000   -0.004    0.026   -0.099    0.218
   2.920    0.000   -0.003    0.022   -0.087    0.203
   2.960    0.000   -0.003    0.019   -0.076    0.187
   3.000    0.000   -0.002    0.016   -0.067    0.171
   3.040    0.000   -0.002    0.013   -0.058    0.156
   3.080    0.000   -0.001    0.011   -0.050    0.140
   3.120    0.000   -0.001    0.009   -0.043    0.126
   3.160    0.000   -0.001    0.007   -0.036    0.112
   3.200    0.000   -0.001    0.006   -0.031    0.099
   3.240    0.000   -0.001    0.005   -0.026    0.087
   3.280    0.000   -0.000    0.004   -0.022    0.076
   3.320    0.000   -0.000    0.003   -0.018    0.066
   3.360    0.000   -0.000    0.003   -0.015    0.057
   3.400    0.000   -0.000    0.002   -0.013    0.049
   3.440    0.000   -0.000    0.002   -0.010    0.042
   3.480    0.000   -0.000    0.001   -0.009    0.036
   3.520    0.000   -0.000    0.001   -0.007    0.030
   3.560    0.000   -0.000    0.001   -0.006    0.026
   3.600    0.000   -0.000    0.001   -0.005    0.021
   3.640    0.000   -0.000    0.001   -0.004    0.018
   3.680    0.000   -0.000    0.000   -0.003    0.015
   3.720    0.000   -0.000    0.000   -0.002    0.012
   3.760    0.000   -0.000    0.000   -0.002    0.010
   3.800    0.000   -0.000    0.000   -0.002    0.008
   3.840    0.000   -0.000    0.000   -0.001    0.007
   3.880    0.000   -0.000    0.000   -0.001    0.005
   3.920    0.000   -0.000    0.000   -0.001    0.004
   3.960    0.000   -0.000    0.000   -0.001    0.003
   4.000    0.000   -0.000    0.000   -0.000    0.003
In [17]:
fig1 = plt.figure(figsize=(8, 6)) # グラフ領域の作成
plt.subplot(2, 2, 1) # 左上側の図
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlim(0.0, 4.0) # x軸範囲の設定
plt.xticks(fontsize=8)
plt.xlabel(r"$t$", fontsize=8) # x軸のラベル設定
plt.ylim(-0.5, 1.0) # y軸範囲の設定
plt.yticks(fontsize=8)
plt.ylabel(r"$F_{0,n}(t)$", fontsize=8) # y軸のラベル設定
plt.plot(xx, f0[0][:], label=r"$F_{0,0}$")
plt.plot(xx, f0[1][:], label=r"$F_{0,1}$")
plt.plot(xx, f0[2][:], label=r"$F_{0,2}$")
plt.plot(xx, f0[3][:], label=r"$F_{0,3}$")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True, fontsize=8)

plt.subplot(2, 2, 2)
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlim(0.0, 4.0) # x軸範囲の設定
plt.xticks(fontsize=8)
plt.xlabel(r"$t$", fontsize=8) # x軸のラベル設定
plt.ylim(-0.5, 1.0) # y軸範囲の設定
plt.yticks(fontsize=8)
plt.ylabel(r"$F_{1,n}(t)$", fontsize=8) # y軸のラベル設定
plt.plot(xx, f1[0][:], label=r"$F_{1,0}$")
plt.plot(xx, f1[1][:], label=r"$F_{1,1}$")
plt.plot(xx, f1[2][:], label=r"$F_{1,2}$")
plt.plot(xx, f1[3][:], label=r"$F_{1,3}$")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True, fontsize=8)

plt.subplot(2, 2, 3)
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlim(0.0, 4.0) # x軸範囲の設定
plt.xticks(fontsize=8)
plt.xlabel(r"$t$", fontsize=8) # x軸のラベル設定
plt.ylim(-0.5, 1.0) # y軸範囲の設定
plt.yticks(fontsize=8)
plt.ylabel(r"$F_{2,n}(t)$", fontsize=8) # y軸のラベル設定
plt.plot(xx, f2[0][:], label=r"$F_{2,0}$")
plt.plot(xx, f2[1][:], label=r"$F_{2,1}$")
plt.plot(xx, f2[2][:], label=r"$F_{2,2}$")
plt.plot(xx, f2[3][:], label=r"$F_{2,3}$")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True, fontsize=8)

plt.subplot(2, 2, 4)
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlim(0.0, 4.0) # x軸範囲の設定
plt.xticks(fontsize=8)
plt.xlabel(r"$t$", fontsize=8) # x軸のラベル設定
plt.ylim(-0.5, 1.0) # y軸範囲の設定
plt.yticks(fontsize=8)
plt.ylabel(r"$F_{3,n}(t)$", fontsize=8) # y軸のラベル設定
plt.plot(xx, f3[0][:], label=r"$F_{3,0}$")
plt.plot(xx, f3[1][:], label=r"$F_{3,1}$")
plt.plot(xx, f3[2][:], label=r"$F_{3,2}$")
plt.plot(xx, f3[3][:], label=r"$F_{3,3}$")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True, fontsize=8)
plt.tight_layout()
fig1.savefig('p2_ex09_3.pdf')
plt.show()
No description has been provided for this image