scipy.integrate.
romb#
- scipy.integrate.romb(y, dx=1.0, axis=-1, show=False)[源代码]#
使用函数样本进行龙贝格积分。
- 参数:
- yarray_like
一个包含
2**k + 1
个函数等距样本的向量。- dxfloat, optional
采样间隔。默认为 1。
- axisint, optional
积分轴。默认为 -1(最后一个轴)。
- showbool, optional
当 y 是一个单维数组时,如果此参数为 True,则打印显示从样本进行理查森外推的表格。默认为 False。
- 返回:
- rombndarray
沿 axis 积分的结果。
另请参阅
quad
使用 QUADPACK 的自适应求积法
fixed_quad
固定阶高斯求积法
dblquad
二重积分
tplquad
三重积分
simpson
采样数据积分器
cumulative_trapezoid
采样数据的累积积分
示例
>>> from scipy import integrate >>> import numpy as np >>> x = np.arange(10, 14.25, 0.25) >>> y = np.arange(3, 12)
>>> integrate.romb(y) 56.0
>>> y = np.sin(np.power(x, 2.5)) >>> integrate.romb(y) -0.742561336672229
>>> integrate.romb(y, show=True) Richardson Extrapolation Table for Romberg Integration ====================================================== -0.81576 4.63862 6.45674 -1.10581 -3.02062 -3.65245 -2.57379 -3.06311 -3.06595 -3.05664 -1.34093 -0.92997 -0.78776 -0.75160 -0.74256 ====================================================== -0.742561336672229 # may vary