【发布时间】:2021-05-24 10:08:41
【问题描述】:
from scipy import integrate
def g(y,x,a):
return x*y**2 + a
a= 13
integrate.dblquad(g, 0, 2, lambda x: 0, lambda x: x, args=(a))
TypeError Traceback(最近一次调用最后一次) 在 5个= 13 6 ----> 7 积分.dblquad(g, 0, 2, lambda x: 0, lambda x: x, args=(a))
~\anaconda3\lib\site-packages\scipy\integrate\quadpack.py in dblquad(func, a, b, gfun, hfun, args, epsabs, epsrel) 第599章 600 --> 601 返回 nquad(func, [temp_ranges, [a, b]], args=args, 602 opts={“epsabs”:epsabs,“epsrel”:epsrel}) 603
~\anaconda3\lib\site-packages\scipy\integrate\quadpack.py in nquad(func, range, args, opts, full_output) 824 其他: 825 opts = [opt if callable(opt) else _OptFunc(opt) for opt in opts] --> 826 返回 _NQuad(func, 范围, opts, full_output).integrate(*args) 827 828
TypeError: * 之后的集成()参数必须是可迭代的,而不是 int
【问题讨论】:
-
使用
args=(a,)创建一个1元组
标签: python scipy arguments integrate