【发布时间】:2020-10-13 09:23:38
【问题描述】:
我在 Python 中计算积分时遇到问题。
所以,我已经定义了函数:
def function_f(x):
if x>=0 and x<=1:
return ((1/3)**x)
else:
return 0
我知道用这个代码计算简单的(没有平方):
from scipy import integrate
integrate.quad((function_f), 0, 1)
但问题是我需要从这个函数的平方计算积分,所以我需要从 (function_f)^2 获得积分。
希望您对我如何做到这一点有一些建议。
【问题讨论】:
标签: python python-3.x function integral