scipy.integrate.quad 是如何取点的 发表于 2021-09-16 | 分类于 软件使用 | 评论数: 探究 scipy.integrate.quad 取点的方式 import numpy as npfrom scipy import integrateimport matplotlib.pyplot as pltnodes = []def foo(x): nodes.append(x) return np.exp(x) + np.sin(10*x)**2 + np.exp(x)**100result = integrate.quad(foo, -1, 1, epsrel=1e-125, limit=2, full_output=1)n = np.linspace(1, len(nodes), len(nodes))print(len(nodes))print(len(nodes)/21)print(result[2]['neval'])plt.plot(n, nodes, '*')plt.grid()plt.title('limit = 2')plt.xlabel(r"$i$")plt.ylabel("position of $i$th node")plt.savefig('fig.png') code Reference scipy.integrate.quad wikipedia: QUADPACK wikipedia: Adaptive quadrature