所以我一直在尝试在特定表达式上使用 Scipy 中的通用积分方法(四元法)在 numpy 上;但是,我收到以下错误
TypeError: unsupported operand type(s) for *: 'function' and 'float'
这是我要集成的功能(这里似乎没有 mathjax):
t*y(t) * J0(u_{i} * t/a) dt 从 0 到 a 的积分,其中 a 是 y(t) 的长度,J0 是零阶贝塞尔函数,u_{i} 是J0(u) = 0 的根
我的代码:
import numpy as np
import scipy.integrate as integrate
from scipy.special import *
y = np.load('dataset.npy') # 1000 pts long
a = 1000
roots = jn_zeros(0, 1000)
func = lambda t: t * jv(0, t * (roots/a) )
result = integrate.quad(func * y , 0, a)