ベッセル関数¶

In [1]:
import numpy as np
from scipy.special import jv, yv # ベッセル関数
import matplotlib.pyplot as plt
from scipy.signal import find_peaks # ピーク値を探す
import pandas as pd
In [2]:
import scienceplots
plt.style.use(['science', 'notebook'])
In [3]:
#plt.rcParams['font.family'] = 'Times New Roman' # font familyの設定
plt.rcParams['font.family'] = 'serif' # font familyの設定
plt.rcParams['mathtext.fontset'] = 'cm' # math fontの設定
In [4]:
# x: 変数
# n: ベッセル関数の次数
# m: 展開項数
def my_besselj(x, n): # 第1種ベッセル関数の級数展開
    eps= 1.0e-12# 収束判定条件
    a = 1.0
    z = x/2.0
    for i in range(n):
        a = a*z/(i+1)
    y = a
    i = 0
    while np.abs(a)>=eps:
       i = i+1
       a = -a*z*z/i/(i+n)
       y = y+a
    m = i
    return y, m
In [5]:
# x: 変数
# n: ベッセル関数の次数
# m: 展開項数
def besselj(x, n): # 第1種ベッセル関数の級数展開と漸近展開
    eps=1.0e-12# 収束判定条件
    a = 1.0
    if np.abs(x)<14.0: # 級数展開
       z = x/2.0
       for i in range(n):
          a = a*z/(i+1)
       y = a
       i = 0
       while np.abs(a)>=eps:
          i = i+1
          a = -a*z*z/i/(i+n)
          y = y+a
       m = i
    else: # 漸近展開
       za = 1.0
       zb = (4.0*n*n-1.0)/8.0/x
       an = za
       bn = zb
       i = 0
       i2 = 1
       while np.abs(zb)>=eps:
          i = i+1
          i1 = i2+1
          i2 = i1+1
          za = -zb*(4.0*n*n-(2.0*i1-1.0)*(2.0*i1-1.0))/i1/8.0/x
          zb =  za*(4.0*n*n-(2.0*i2-1.0)*(2.0*i2-1.0))/i2/8.0/x
          an = an+za
          bn = bn+zb
       m = i
       th = x-(2.0*n+1.0)*np.pi/4.0
       y = np.sqrt(2.0/np.pi/x)*(an*np.cos(th)-bn*np.sin(th))
    return y, m
In [6]:
x0, xmax, nx = 0.0, 30, 151
xx = np.linspace(x0, xmax, nx)
yy1 = np.empty(0)
yy2 = np.empty(0)
yy3 = np.empty(0)
print(f"{'x':>8s} {'m1':>3s} {'my_besselj':>10s}"\
      f" {'m2':>3s} {'besselj':>10s} {'scipy.special.jv':>15s}")
for i in range(nx):
    y1, m1 = my_besselj(xx[i], 0)
    y2, m2 = besselj(xx[i], 0)
    y3 = jv(0,xx[i]) # 第1種ベッセル関数
    print(f"{xx[i]:8.2f} {m1:3d} {y1:10.7f} {m2:3d}"\
          f" {y2:10.7f} {y3:15.11f}")
    yy1 = np.append(yy1, y1)
    yy2 = np.append(yy2, y2)
    yy3 = np.append(yy3, y3)
print("")
       x  m1 my_besselj  m2    besselj scipy.special.jv
    0.00   1  1.0000000   1  1.0000000   1.00000000000
    0.20   5  0.9900250   5  0.9900250   0.99002497224
    0.40   6  0.9603982   6  0.9603982   0.96039822666
    0.60   7  0.9120049   7  0.9120049   0.91200486350
    0.80   7  0.8462874   7  0.8462874   0.84628735275
    1.00   8  0.7651977   8  0.7651977   0.76519768656
    1.20   8  0.6711327   8  0.6711327   0.67113274426
    1.40   9  0.5668551   9  0.5668551   0.56685512037
    1.60   9  0.4554022   9  0.4554022   0.45540216764
    1.80  10  0.3399864  10  0.3399864   0.33998641104
    2.00  10  0.2238908  10  0.2238908   0.22389077914
    2.20  10  0.1103623  10  0.1103623   0.11036226692
    2.40  11  0.0025077  11  0.0025077   0.00250768330
    2.60  11 -0.0968050  11 -0.0968050  -0.09680495440
    2.80  12 -0.1850360  12 -0.1850360  -0.18503603336
    3.00  12 -0.2600520  12 -0.2600520  -0.26005195490
    3.20  12 -0.3201882  12 -0.3201882  -0.32018816966
    3.40  13 -0.3642956  13 -0.3642956  -0.36429559676
    3.60  13 -0.3917690  13 -0.3917690  -0.39176898370
    3.80  13 -0.4025564  13 -0.4025564  -0.40255641018
    4.00  14 -0.3971498  14 -0.3971498  -0.39714980986
    4.20  14 -0.3765571  14 -0.3765571  -0.37655705437
    4.40  14 -0.3422568  14 -0.3422568  -0.34225679000
    4.60  15 -0.2961378  15 -0.2961378  -0.29613781657
    4.80  15 -0.2404253  15 -0.2404253  -0.24042532729
    5.00  15 -0.1775968  15 -0.1775968  -0.17759677131
    5.20  16 -0.1102904  16 -0.1102904  -0.11029043979
    5.40  16 -0.0412101  16 -0.0412101  -0.04121010124
    5.60  16  0.0269709  16  0.0269709   0.02697088469
    5.80  17  0.0917026  17  0.0917026   0.09170256757
    6.00  17  0.1506453  17  0.1506453   0.15064525725
    6.20  17  0.2017472  17  0.2017472   0.20174722295
    6.40  18  0.2433106  18  0.2433106   0.24331060482
    6.60  18  0.2740434  18  0.2740434   0.27404336062
    6.80  18  0.2930956  18  0.2930956   0.29309560310
    7.00  18  0.3000793  18  0.3000793   0.30007927052
    7.20  19  0.2950707  19  0.2950707   0.29507069140
    7.40  19  0.2785962  19  0.2785962   0.27859623266
    7.60  19  0.2516018  19  0.2516018   0.25160183385
    7.80  20  0.2154078  20  0.2154078   0.21540780775
    8.00  20  0.1716508  20  0.1716508   0.17165080714
    8.20  20  0.1222153  20  0.1222153   0.12221530178
    8.40  21  0.0691573  21  0.0691573   0.06915726166
    8.60  21  0.0146230  21  0.0146230   0.01462299128
    8.80  21 -0.0392338  21 -0.0392338  -0.03923380318
    9.00  22 -0.0903336  22 -0.0903336  -0.09033361118
    9.20  22 -0.1367484  22 -0.1367484  -0.13674837076
    9.40  22 -0.1767716  22 -0.1767716  -0.17677157275
    9.60  22 -0.2089787  22 -0.2089787  -0.20897871837
    9.80  23 -0.2322760  23 -0.2322760  -0.23227602758
   10.00  23 -0.2459358  23 -0.2459358  -0.24593576445
   10.20  23 -0.2496171  23 -0.2496171  -0.24961706985
   10.40  24 -0.2433718  24 -0.2433718  -0.24337175071
   10.60  24 -0.2276350  24 -0.2276350  -0.22763504762
   10.80  24 -0.2032020  24 -0.2032020  -0.20320196711
   11.00  24 -0.1711903  24 -0.1711903  -0.17119030041
   11.20  25 -0.1329919  25 -0.1329919  -0.13299193686
   11.40  25 -0.0902145  25 -0.0902145  -0.09021450025
   11.60  25 -0.0446157  25 -0.0446157  -0.04461567409
   11.80  26  0.0019672  26  0.0019672   0.00196717331
   12.00  26  0.0476893  26  0.0476893   0.04768931080
   12.20  26  0.0907701  26  0.0907701   0.09077012317
   12.40  26  0.1295610  26  0.1295610   0.12956102652
   12.60  27  0.1626073  27  0.1626073   0.16260727175
   12.80  27  0.1887014  27  0.1887014   0.18870135478
   13.00  27  0.2069261  27  0.2069261   0.20692610238
   13.20  28  0.2166859  28  0.2166859   0.21668592226
   13.40  28  0.2177252  28  0.2177252   0.21772517873
   13.60  28  0.2101332  28  0.2101332   0.21013316137
   13.80  29  0.1943356  29  0.1943356   0.19433563522
   14.00  29  0.1710735   9  0.1710735   0.17107347611
   14.20  29  0.1413694   9  0.1413694   0.14136938466
   14.40  29  0.1064841   9  0.1064841   0.10648411849
   14.60  30  0.0678641   8  0.0678641   0.06786406832
   14.80  30  0.0270823   8  0.0270823   0.02708231459
   15.00  30 -0.0142245   8 -0.0142245  -0.01422447283
   15.20  31 -0.0544208   8 -0.0544208  -0.05442079684
   15.40  31 -0.0919362   8 -0.0919362  -0.09193622786
   15.60  31 -0.1253260   8 -0.1253260  -0.12532596402
   15.80  31 -0.1533257   7 -0.1533257  -0.15332574776
   16.00  32 -0.1748991   7 -0.1748991  -0.17489907398
   16.20  32 -0.1892749   7 -0.1892749  -0.18927494698
   16.40  32 -0.1959748   7 -0.1959748  -0.19597482879
   16.60  32 -0.1948279   7 -0.1948279  -0.19482785581
   16.80  33 -0.1859739   7 -0.1859739  -0.18597386535
   17.00  33 -0.1698543   7 -0.1698543  -0.16985425215
   17.20  33 -0.1471911   7 -0.1471911  -0.14719114677
   17.40  34 -0.1189559   7 -0.1189559  -0.11895585634
   17.60  34 -0.0863279   7 -0.0863279  -0.08632791550
   17.80  34 -0.0506464   7 -0.0506464  -0.05064644607
   18.00  34 -0.0133558   6 -0.0133558  -0.01335580572
   18.20  35  0.0240523   6  0.0240523   0.02405229241
   18.40  35  0.0600979   6  0.0600979   0.06009789204
   18.60  35  0.0933708   6  0.0933708   0.09337081628
   18.80  36  0.1225853   6  0.1225853   0.12258534436
   19.00  36  0.1466294   6  0.1466294   0.14662943966
   19.20  36  0.1646067   6  0.1646067   0.16460665908
   19.40  36  0.1758692   6  0.1758692   0.17586917809
   19.60  37  0.1800407   6  0.1800407   0.18004072743
   19.80  37  0.1770286   6  0.1770286   0.17702864315
   20.00  37  0.1670247   6  0.1670247   0.16702466434
   20.20  38  0.1504946   6  0.1504946   0.15049455643
   20.40  38  0.1281571   6  0.1281571   0.12815707345
   20.60  38  0.1009532   6  0.1009532   0.10095318521
   20.80  38  0.0700069   6  0.0700069   0.07000686745
   21.00  39  0.0365791   6  0.0365791   0.03657907100
   21.20  39  0.0020167   6  0.0020167   0.00201673882
   21.40  39 -0.0323011   6 -0.0323011  -0.03230108377
   21.60  39 -0.0650179   6 -0.0650179  -0.06501790416
   21.80  40 -0.0948531   6 -0.0948531  -0.09485305082
   22.00  40 -0.1206515   5 -0.1206515  -0.12065147570
   22.20  40 -0.1414282   5 -0.1414282  -0.14142816591
   22.40  41 -0.1564055   5 -0.1564055  -0.15640546714
   22.60  41 -0.1650419   5 -0.1650419  -0.16504191464
   22.80  41 -0.1670515   5 -0.1670515  -0.16705151191
   23.00  41 -0.1624128   5 -0.1624128  -0.16241278131
   23.20  42 -0.1513673   5 -0.1513673  -0.15136731788
   23.40  42 -0.1344080   5 -0.1344080  -0.13440799160
   23.60  42 -0.1122573   5 -0.1122573  -0.11225734890
   23.80  43 -0.0858372   5 -0.0858371  -0.08583714431
   24.00  43 -0.0562302   5 -0.0562303  -0.05623027417
   24.20  43 -0.0246366   5 -0.0246367  -0.02463667239
   24.40  43  0.0076751   5  0.0076750   0.00767504678
   24.60  44  0.0394182   5  0.0394183   0.03941826119
   24.80  44  0.0693393   5  0.0693393   0.06933931475
   25.00  44  0.0962666   5  0.0962668   0.09626678328
   25.20  44  0.1191571   5  0.1191571   0.11915710520
   25.40  45  0.1371349   5  0.1371348   0.13713480805
   25.60  45  0.1495256   5  0.1495258   0.14952578764
   25.80  45  0.1558825   5  0.1558824   0.15588238219
   26.00  46  0.1559994   5  0.1559993   0.15599931552
   26.20  46  0.1499201   5  0.1499200   0.14991995044
   26.40  46  0.1379328   5  0.1379327   0.13793267833
   26.60  46  0.1205578   5  0.1205577   0.12055766118
   26.80  47  0.0985246   5  0.0985245   0.09852452025
   27.00  47  0.0727417   5  0.0727419   0.07274191801
   27.20  47  0.0442604   5  0.0442603   0.04426029224
   27.40  48  0.0142286   5  0.0142293   0.01422926235
   27.60  48 -0.0161459   5 -0.0161486  -0.01614857358
   27.80  48 -0.0456662   5 -0.0456656  -0.04566560175
   28.00  48 -0.0731571   5 -0.0731570  -0.07315701055
   28.20  49 -0.0975453   5 -0.0975466  -0.09754657704
   28.40  49 -0.1178900   5 -0.1178886  -0.11788862895
   28.60  49 -0.1334015   5 -0.1334046  -0.13340455231
   28.80  49 -0.1435125   5 -0.1435124  -0.14351244102
   29.00  50 -0.1478412   5 -0.1478488  -0.14784876468
   29.20  50 -0.1462826   5 -0.1462813  -0.14628125361
   29.40  50 -0.1389054   5 -0.1389126  -0.13891255151
   29.60  51 -0.1260630   5 -0.1260746  -0.12607455379
   29.80  51 -0.1083183   5 -0.1083137  -0.10831371758
   30.00  51 -0.0863625   5 -0.0863680  -0.08636798358

In [7]:
df = pd.DataFrame({
    '$x$':xx,
    'my_besselj':yy1,
    'besselj':yy2,
    'scipy.special.jv':yy3,
})
df.style.format({"$x$":"{:.3f}"})
Out[7]:
  $x$ my_besselj besselj scipy.special.jv
0 0.000 1.000000 1.000000 1.000000
1 0.200 0.990025 0.990025 0.990025
2 0.400 0.960398 0.960398 0.960398
3 0.600 0.912005 0.912005 0.912005
4 0.800 0.846287 0.846287 0.846287
5 1.000 0.765198 0.765198 0.765198
6 1.200 0.671133 0.671133 0.671133
7 1.400 0.566855 0.566855 0.566855
8 1.600 0.455402 0.455402 0.455402
9 1.800 0.339986 0.339986 0.339986
10 2.000 0.223891 0.223891 0.223891
11 2.200 0.110362 0.110362 0.110362
12 2.400 0.002508 0.002508 0.002508
13 2.600 -0.096805 -0.096805 -0.096805
14 2.800 -0.185036 -0.185036 -0.185036
15 3.000 -0.260052 -0.260052 -0.260052
16 3.200 -0.320188 -0.320188 -0.320188
17 3.400 -0.364296 -0.364296 -0.364296
18 3.600 -0.391769 -0.391769 -0.391769
19 3.800 -0.402556 -0.402556 -0.402556
20 4.000 -0.397150 -0.397150 -0.397150
21 4.200 -0.376557 -0.376557 -0.376557
22 4.400 -0.342257 -0.342257 -0.342257
23 4.600 -0.296138 -0.296138 -0.296138
24 4.800 -0.240425 -0.240425 -0.240425
25 5.000 -0.177597 -0.177597 -0.177597
26 5.200 -0.110290 -0.110290 -0.110290
27 5.400 -0.041210 -0.041210 -0.041210
28 5.600 0.026971 0.026971 0.026971
29 5.800 0.091703 0.091703 0.091703
30 6.000 0.150645 0.150645 0.150645
31 6.200 0.201747 0.201747 0.201747
32 6.400 0.243311 0.243311 0.243311
33 6.600 0.274043 0.274043 0.274043
34 6.800 0.293096 0.293096 0.293096
35 7.000 0.300079 0.300079 0.300079
36 7.200 0.295071 0.295071 0.295071
37 7.400 0.278596 0.278596 0.278596
38 7.600 0.251602 0.251602 0.251602
39 7.800 0.215408 0.215408 0.215408
40 8.000 0.171651 0.171651 0.171651
41 8.200 0.122215 0.122215 0.122215
42 8.400 0.069157 0.069157 0.069157
43 8.600 0.014623 0.014623 0.014623
44 8.800 -0.039234 -0.039234 -0.039234
45 9.000 -0.090334 -0.090334 -0.090334
46 9.200 -0.136748 -0.136748 -0.136748
47 9.400 -0.176772 -0.176772 -0.176772
48 9.600 -0.208979 -0.208979 -0.208979
49 9.800 -0.232276 -0.232276 -0.232276
50 10.000 -0.245936 -0.245936 -0.245936
51 10.200 -0.249617 -0.249617 -0.249617
52 10.400 -0.243372 -0.243372 -0.243372
53 10.600 -0.227635 -0.227635 -0.227635
54 10.800 -0.203202 -0.203202 -0.203202
55 11.000 -0.171190 -0.171190 -0.171190
56 11.200 -0.132992 -0.132992 -0.132992
57 11.400 -0.090215 -0.090215 -0.090215
58 11.600 -0.044616 -0.044616 -0.044616
59 11.800 0.001967 0.001967 0.001967
60 12.000 0.047689 0.047689 0.047689
61 12.200 0.090770 0.090770 0.090770
62 12.400 0.129561 0.129561 0.129561
63 12.600 0.162607 0.162607 0.162607
64 12.800 0.188701 0.188701 0.188701
65 13.000 0.206926 0.206926 0.206926
66 13.200 0.216686 0.216686 0.216686
67 13.400 0.217725 0.217725 0.217725
68 13.600 0.210133 0.210133 0.210133
69 13.800 0.194336 0.194336 0.194336
70 14.000 0.171073 0.171073 0.171073
71 14.200 0.141369 0.141369 0.141369
72 14.400 0.106484 0.106484 0.106484
73 14.600 0.067864 0.067864 0.067864
74 14.800 0.027082 0.027082 0.027082
75 15.000 -0.014224 -0.014224 -0.014224
76 15.200 -0.054421 -0.054421 -0.054421
77 15.400 -0.091936 -0.091936 -0.091936
78 15.600 -0.125326 -0.125326 -0.125326
79 15.800 -0.153326 -0.153326 -0.153326
80 16.000 -0.174899 -0.174899 -0.174899
81 16.200 -0.189275 -0.189275 -0.189275
82 16.400 -0.195975 -0.195975 -0.195975
83 16.600 -0.194828 -0.194828 -0.194828
84 16.800 -0.185974 -0.185974 -0.185974
85 17.000 -0.169854 -0.169854 -0.169854
86 17.200 -0.147191 -0.147191 -0.147191
87 17.400 -0.118956 -0.118956 -0.118956
88 17.600 -0.086328 -0.086328 -0.086328
89 17.800 -0.050646 -0.050646 -0.050646
90 18.000 -0.013356 -0.013356 -0.013356
91 18.200 0.024052 0.024052 0.024052
92 18.400 0.060098 0.060098 0.060098
93 18.600 0.093371 0.093371 0.093371
94 18.800 0.122585 0.122585 0.122585
95 19.000 0.146629 0.146629 0.146629
96 19.200 0.164607 0.164607 0.164607
97 19.400 0.175869 0.175869 0.175869
98 19.600 0.180041 0.180041 0.180041
99 19.800 0.177029 0.177029 0.177029
100 20.000 0.167025 0.167025 0.167025
101 20.200 0.150495 0.150495 0.150495
102 20.400 0.128157 0.128157 0.128157
103 20.600 0.100953 0.100953 0.100953
104 20.800 0.070007 0.070007 0.070007
105 21.000 0.036579 0.036579 0.036579
106 21.200 0.002017 0.002017 0.002017
107 21.400 -0.032301 -0.032301 -0.032301
108 21.600 -0.065018 -0.065018 -0.065018
109 21.800 -0.094853 -0.094853 -0.094853
110 22.000 -0.120651 -0.120651 -0.120651
111 22.200 -0.141428 -0.141428 -0.141428
112 22.400 -0.156405 -0.156405 -0.156405
113 22.600 -0.165042 -0.165042 -0.165042
114 22.800 -0.167052 -0.167052 -0.167052
115 23.000 -0.162413 -0.162413 -0.162413
116 23.200 -0.151367 -0.151367 -0.151367
117 23.400 -0.134408 -0.134408 -0.134408
118 23.600 -0.112257 -0.112257 -0.112257
119 23.800 -0.085837 -0.085837 -0.085837
120 24.000 -0.056230 -0.056230 -0.056230
121 24.200 -0.024637 -0.024637 -0.024637
122 24.400 0.007675 0.007675 0.007675
123 24.600 0.039418 0.039418 0.039418
124 24.800 0.069339 0.069339 0.069339
125 25.000 0.096267 0.096267 0.096267
126 25.200 0.119157 0.119157 0.119157
127 25.400 0.137135 0.137135 0.137135
128 25.600 0.149526 0.149526 0.149526
129 25.800 0.155882 0.155882 0.155882
130 26.000 0.155999 0.155999 0.155999
131 26.200 0.149920 0.149920 0.149920
132 26.400 0.137933 0.137933 0.137933
133 26.600 0.120558 0.120558 0.120558
134 26.800 0.098525 0.098525 0.098525
135 27.000 0.072742 0.072742 0.072742
136 27.200 0.044260 0.044260 0.044260
137 27.400 0.014229 0.014229 0.014229
138 27.600 -0.016146 -0.016149 -0.016149
139 27.800 -0.045666 -0.045666 -0.045666
140 28.000 -0.073157 -0.073157 -0.073157
141 28.200 -0.097545 -0.097547 -0.097547
142 28.400 -0.117890 -0.117889 -0.117889
143 28.600 -0.133402 -0.133405 -0.133405
144 28.800 -0.143513 -0.143512 -0.143512
145 29.000 -0.147841 -0.147849 -0.147849
146 29.200 -0.146283 -0.146281 -0.146281
147 29.400 -0.138905 -0.138913 -0.138913
148 29.600 -0.126063 -0.126075 -0.126075
149 29.800 -0.108318 -0.108314 -0.108314
150 30.000 -0.086362 -0.086368 -0.086368
In [8]:
fig = plt.figure() # グラフ領域の作成
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlabel(r"$x$") # x軸のラベル設定
plt.ylabel(r"Bessel function of the first kind $J_0(x)$") # y軸のラベル設定
plt.plot(xx, yy3, '-', label="scipy.special.jv", color='tab:orange')
plt.plot(xx, yy1, 'o', label="series expansion", color='tab:blue')
plt.plot(xx, yy2, '.', label="series/asymptotic expansions", color='tab:red')
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True)
fig.savefig('p2_ex06_1.pdf')
No description has been provided for this image
In [9]:
fig = plt.figure() # グラフ領域の作成
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlabel(r"$x$") # x軸のラベル設定
plt.ylabel(r"Bessel function of the first kind $J_0(x)$") # y軸のラベル設定
plt.plot(xx[0:nx//3-1], yy1[0:nx//3-1], label="series expansion")
plt.plot(xx[nx//3:2*nx//3-1], yy2[nx//3:2*nx//3-1], label="series/asymptotic expansions")
plt.plot(xx[2*nx//3:nx], yy3[2*nx//3:nx], label="scipy.special.jv")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True)
fig.savefig('p2_ex06_2.pdf')
No description has been provided for this image
In [10]:
#yy1
In [11]:
locs, _ = find_peaks(yy1) # ピーク値
locs, _, xx[locs],yy1[locs]
Out[11]:
(array([ 35,  67,  98, 130]),
 {},
 array([ 7. , 13.4, 19.6, 26. ]),
 array([0.30007927, 0.21772518, 0.18004073, 0.15599937]))
In [12]:
locs_min, _ = find_peaks(-yy1) # ピーク値
locs_min, _, xx[locs_min],yy1[locs_min]
Out[12]:
(array([ 19,  51,  82, 114, 145]),
 {},
 array([ 3.8, 10.2, 16.4, 22.8, 29. ]),
 array([-0.40255641, -0.24961707, -0.19597483, -0.1670515 , -0.14784115]))
In [13]:
fig = plt.figure() # グラフ領域の作成
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlabel(r"$x$") # x軸のラベル設定
plt.ylabel(r"Bessel functions") # y軸のラベル設定
plt.ylim(-1.0, 2.0) # y軸範囲の設定
plt.plot(xx, yy1, label=r"$J_0(x)$")
plt.plot(xx[locs],yy1[locs], 'o', label=r"maximum peak of $J_0(x)$")
plt.plot(xx[locs_min],yy1[locs_min], 'o', label=r"minimum peak of $J_0(x)$")
plt.plot(xx, jv(1,xx), label=r"$J_1(x)$")
plt.plot(xx, jv(2,xx), label=r"$J_2(x)$")
plt.legend(ncol=1, loc='upper right', fancybox=False, frameon = True)
fig.savefig('p2_ex06_3.pdf')
No description has been provided for this image
In [14]:
fig = plt.figure() # グラフ領域の作成
plt.grid(color = "gray", linestyle="--")
plt.minorticks_on() # #補助目盛りをつける
plt.xlabel(r"$x$") # x軸のラベル設定
plt.ylabel(r"Bessel functions") # y軸のラベル設定
plt.ylim(-2.0, 1.0) # y軸範囲の設定
plt.plot(xx, yv(0,xx), label=r"$Y_0(x)$")
plt.plot(xx, yv(1,xx), label=r"$Y_1(x)$")
plt.plot(xx, yv(2,xx), label=r"$Y_2(x)$")
plt.legend(ncol=1, loc='lower right', fancybox=False, frameon = True)
fig.savefig('p2_ex06_4.pdf')
No description has been provided for this image