Getting value from TensorVariable in DifferentialEquation

Thanks for your message, junpenglao!

My SIR-function is a little bit more complex than a normal one.

def SIR(y, t, p):
ds = -p[0] * y[0] * (y[2] + alpha * y[3]) / N
de = p[0] * y[0] * (y[2] + alpha * y[3]) / N - y[1] / D_e
di = p[1] * y[1] / D_e - y[2] / D_q - y[2] / D_i
da = (1 - p[1]) * y[1] / D_e - y[3] / D_i
dh = y[2] / D_q - y[4] / D_h
return [ds, de, di, da, dh]

The question is still simple. I would like to read an element of array arr using correct corresponding time index, meaning arr[t].

However, t is not an integer but a TensorVariable which is the reason why I want to convert it into integer. When i am using t.eval(), for example on line
ds = -p[0] * y[0] * (y[2] + alpha * y[3]) / N + t.eval()
I get an error MissingInputError: Undeclared input

It seems like I am reading uninitialized value…