I am working on an optimization problem using a Markov Chain Monte Carlo approach. I have a crude for mathematica implementation using for loops. However I really like to learn how to 1) transition from a procedural to functional approach to implementing the algorithm. Can anyone offer hints at how to optimize the notebook towards a more functional approach.
2) I'd also like to add a time dependent signal to the NDSolve function. However I am not quite sure how to do this, if I use the If statement, then I must add the If to each equation. This seems inefficient. Is there a better approach to adding time dependent factors to the ODE solver. Say I want to wait until steady state to add the signal?
I have attached the notebook with comments. If any more are needed please let me know. Thanks for your assistance and pointers!
Attachment: PM_MarkovDecay.nb, URL: ,