【发布时间】:2012-08-27 00:15:40
【问题描述】:
我有一些我无法解决的问题:
#! /usr/bin/env python
import numpy as np
from scipy.interpolate import UnivariateSpline
from scipy.integrate import quad
import pylab as pl
x = ([0,10,20,30,40,50,60,70,...,4550,4560])
y = ([0,0,0,0,0,0,0,3,2,3,2,1,2,1,2,...,8,6,5,7,11,6,7,10,6,5,8,13,6,8,8,3])
s = UnivariateSpline(x, y, k=5, s=5)
xs = np.linspace(0, 4560, 4560)
ys = s(xs)
这是我对一些数据进行插值的代码。 另外,我绘制了这个函数。
但现在我想整合它(从零到无穷大)。
我试过了
results = integrate.quad(ys, 0, 99999)
但它没有工作。
您能给我一些提示(或解决方案)吗?谢谢
【问题讨论】:
-
您不需要在列表周围加上括号,
x = [0,10,...,4560]完全可以接受。
标签: python numpy integration scipy interpolation