I understand now that analytical gradients are necessary. I reformulated my input as a symbolic SymPy function. However, I still don’t understand how to use the function inside the differential equation.
I modified the example code above code like so:
from sympy.abc import t
from sympy.printing.aesaracode import aesara_function
expr = t**2
input = aesara_function([t], [expr])
def freefall(y, t, p):
return 2.0 * p[1] - p[0] * y[0] + input(t)
This gives me the following errors:
TypeError: Bad input argument with name “t” to aesara function with name “/home/jaj/.conda/envs/pymc/lib/python3.10/site-packages/sympy/printing/aesaracode.py:509” at index 0 (0-based).
[…]
Expected an array-like object, but found a Variable: maybe you are trying to call a function on a (possibly shared) variable instead of a numeric array?
I also tried to formulate the model with sunode without success.
Is there some minimal example available making use of the ‘t’ parameter in an ODE model to get me started?
Best regards,
Jona