Hello,
I want to integrate an ODE with odeint and numba.
I am using numba with spi.odeint and I run into a numba-type problem.
I define the vector field:
# vector field
@nba.jit(nopython=True)
def vf(vec, t):
y,x = vec
vecpoint = np.zeros(2)
vecpoint[ 0] = y * np.cos(x+y) # y' = y cos(x+y)
vecpoint[ 1] = 1.0 # x' = 1
return vecpoint
and then I want to define a small function that does the integration, with a given initial conditions:
def shoot(x0):
vecs = np.linspace(0., 30., 500) # integration form t = 0 to 30
vecx0 = np.zeros(2)
vecx0[0] = x0
v = spi.odeint(vf, vecx0, vecs)
return v
Then, when I run:
shoot(1.0)
I get an Typing error, basically Numba says it does not know the type of v = spi.odeint(vf, vecx0, vecs)
How can I go around this ?
Many thanks !
sebastien