質問編集履歴
3
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -108,4 +108,48 @@
|
|
108
108
|
87
|
109
109
|
|
110
110
|
ValueError: setting an array element with a sequence.
|
111
|
-
```
|
111
|
+
```
|
112
|
+
|
113
|
+
```python
|
114
|
+
from scipy.special import kv
|
115
|
+
import matplotlib.pyplot as plt
|
116
|
+
from scipy.integrate import quad
|
117
|
+
import numpy as np
|
118
|
+
import math
|
119
|
+
from math import gamma
|
120
|
+
|
121
|
+
xs = np.linspace(0, 50, 10000)
|
122
|
+
f = lambda z: kv(5/3,z)
|
123
|
+
F = [quad(f,x,np.inf)[0]*x for x in xs]
|
124
|
+
|
125
|
+
a = gamma(1/3)
|
126
|
+
G = [(4*math.pi/np.sqrt(3)/a)*(x/2)**(1/3) for x in xs]
|
127
|
+
H = [((math.pi/2)**(1/2))*(x**(1/2))*(math.exp(-x))for x in xs]
|
128
|
+
|
129
|
+
|
130
|
+
def A(x):
|
131
|
+
if x <= 5.0*1e-3:
|
132
|
+
return (4*math.pi/np.sqrt(3)/a)*(x/2)**(1/3)
|
133
|
+
elif 5.0*1-3 < x < 30:
|
134
|
+
return quad(f,x,np.inf)[0]*x
|
135
|
+
elif 30 <= x:
|
136
|
+
return ((math.pi/2)**(1/2))*(x**(1/2))*(math.exp(-x))
|
137
|
+
|
138
|
+
y = [A(i) for i in xs]
|
139
|
+
|
140
|
+
fig = plt.figure()
|
141
|
+
ax = fig.add_subplot(1,1,1)
|
142
|
+
ax.grid()
|
143
|
+
ax.plot(xs,y)
|
144
|
+
ax.set_xlim(1e-3, 5*1e1)
|
145
|
+
ax.set_ylim(1e-3, 1e0)
|
146
|
+
ax.set_yscale('log')
|
147
|
+
ax.set_xscale('log')
|
148
|
+
ax.set_title('log')
|
149
|
+
ax.set_xlabel('x')
|
150
|
+
ax.set_ylabel('')
|
151
|
+
plt.show()
|
152
|
+
```
|
153
|
+
|
154
|
+
のようにすると、
|
155
|
+
途中できれたものが出てくる
|
2
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
条件によって変化するF(x)を
|
1
|
+
条件によって変化するF(x)をプロットしたいがエラーが出てしまう。
|
2
2
|
|
3
3
|

|
4
4
|
|
1
誤字修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
条件によって変化するF(x)を指導の下、いじってみたら、違うエラーが出てしまう。
|
2
2
|
|
3
|
-

|
4
4
|
|
5
5
|
```python
|
6
6
|
from scipy.special import kv
|