Backward in time integration of numerical ODE

35 Views Asked by At

I have an array of size (n, 2, 2) that represent A( x(t), u(t) ), x[n] and u[n] been one dimensional arrays. I have the equation

p'(t) = A( x(t), u(t) ) p(t) , with the final condition been p(T) = p_T.

The x and u where generated by solving an optimization problem with timesteps been np.linspace(0,T,nt). Now I want to integrate the above equation, reading throught other answers it seems that the odeint from SciPy can handle the backward time integration out of the box.

Since for each pair ( x(t), u(t) ) I have the aforementioned (n, 2, 2) array, should I have to create an intepolation for the matrix A(x(t), u(t)) ? The griddata seems to be the right way of doing it, but I don´t know how to input the time, once the odeint function requires it.

My question is, in summary, given timesteps np.linspace(0,T,nt), x[n] and u[n] , and a calculated (nt, 2, 2) array that is derived from x and u, how can I pass the system to be integrated (backward in time, from T to 0) with the odeint function from scipy ?

0

There are 0 best solutions below