So I've been trying to use the general integration method (quad) from Scipy on numpy on a specific expression; however, I get the following error
TypeError: unsupported operand type(s) for *: 'function' and 'float'
Here is the function I'm trying to integrate (seems like theres no mathjax here):
integral from 0 to a of t*y(t) * J0(u_{i} * t/a) dt where a is the length of y(t), J0 is a zeroth-order Bessel Function and u_{i} is the roots of J0(u) = 0
My code:
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)