from scipy.special import kv
import matplotlib.pyplot as plt
from scipy.integrate import quad
import numpy as np
import math
from math import gamma
xs = np.linspace(0, 50, 10000)
f = lambda z: kv(5/3,z)
F = [quad(f,x,np.inf)[0]*x for x in xs]
a = gamma(1/3)
G = [(4*math.pi/np.sqrt(3)/a)*(x/2)**(1/3) for x in xs]
H = [((math.pi/2)**(1/2))*(x**(1/2))*(math.exp(-x))for x in xs]
def A(x):
if x <= 5.0*1e-3:
return (4*math.pi/np.sqrt(3)/a)*(x/2)**(1/3)
elif 5.0*1-3 < x < 30:
return quad(f,x,np.inf)[0]*x
elif 30 <= x:
return ((math.pi/2)**(1/2))*(x**(1/2))*(math.exp(-x))
y = [A(i) for i in xs]
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.grid()
ax.plot(xs,y)
ax.set_xlim(1e-3, 5*1e1)
ax.set_ylim(1e-3, 1e0)
ax.set_yscale('log')
ax.set_xscale('log')
ax.set_title('log')
ax.set_xlabel('x')
ax.set_ylabel('')
plt.show()
上のように書くと
途中で切れてしまう。