I have a set of coupled differential equations of functions which evolve (increase) monotonically:
NDSolve[{a'[t]=...,b'[t]=...,c'[t]=..., a[0]=a0, b[0]=b0, c[0]=c0},{a,b,c},{t,0,10},
Method -> {"EventLocator", "Event" -> a[t] == 1, "EventAction" :-> Print[t,b[t],c[t]]}]
is giving me what I want for any particular choice of a0, b0, c0, i.e. the values of t (let's call it t-threshhold), b, c when a[t] = 1.
What I want to do is scan across a range of {amin, amax, astep}, {bmin, bmax, bstep}, {cmin, cmax, cstep} and store the results.
Eventually I would like to generate a table of a0, b0, c0, and t-threshhold values.
Any idea on how I could do this? I am essentially struggling with meaningfully storing the result of the WhenEvent condition, and with scanning across initial values in NDSolve. Note that there are poles in a, b, c depending on the initial values, I want the solver to ignore this (to give me the t-threshhold value and then stop calculation at the t=tpole before moving on to the next set of initial conditions)
SowandReap. For instance: replace your EventAction with"EventAction" :> Sow[{t, b[t], c[t]}], and add aReapat the top, i.e.results = Reap@NDSolve[...]. Look up their usage in the docs to clarify, and see this tutorial: Collecting Expressions during Evaluation. – MarcoB Jun 10 '18 at 23:16SowandReaptechniques from this question, and combine them with the pure-function approach I gave you in this answer to your previous similar question. It seems to me that the problem of mapping over a list of initial conditions is solved there. If not, please provide a specific example of what does not work (i.e. complete equations; it can be a made-up system, but something that we can run). – MarcoB Jun 11 '18 at 15:56