A bit of context: I am writing an RK4 ODE solver for Stan, because the existing RK45 and bdf variable-step solvers are incompatible with the ODE I am trying to solve, i.e. :
There is a component (call this comp.A) in the ODE which is dependent on a non-time dependent component (call this comp.B) calculated in the previous time step, as such, comp.B is brought forward by inclusion in the state space (call this X) using an ad-hoc numerical gradient scheme with some step-size h, i.e. pseudo-code:
dXdt[t, comp.B.index] = (comp.B[t+1] - comp.B[t])/h
I see that both RK45(.) and bdf(.) functions takes in functions as arguments, but I cannot find in the documentation how to declare and pass function handles to a different function? Can someone please direct me to the right resource?
Thank you for your time,