scipy是用于科学计算的包,本节主要是几个积分函数
————————————————————————————————————
import numpy as np
def main():
#积分
from scipy.integrate import quad,dblquad,nquad
print(quad(lambda x:np.exp(-x),0,np.inf)) #定积分
print(dblquad(lambda t,x:np.exp(-x*t)/t**3,0,np.inf,lambda x:1,lambda x:np.inf))
#二元积分
def f(x,y):
return x*y
def bound_y():
return[0,0.5]
def bound_x(y):
return[0,1-2*y]
print(nquad(f,[bound_x,bound_y])) #多元积分
if __name__=="__main__":
main()