I want to find for which t any of these holds: x[t] + y[t] == 0.25, x[t] + y[t] == 0.5, x[t] + y[t] == 0.75.
I did it in two steps - firstly I solved differential equations then I used FindRoot.
But I guess there might be a method to do it in one step inside NDSolveValue.
Might be StepMonitor and EvaluationMonitor of any use here to catch whenever sum x[t] + y[t] reaches some required value?
Or can it be done by other means?
nds = NDSolveValue[{y'[t] + x[t] == 1, y[t] + 2 x'[t] == 1, y[0] == 0, x[0] == 0}, {x[t], y[t]}, {t, 0, 1}]; FindRoot[# + #2 == 0.25 & @@ nds, {t, 0.5}] FindRoot[# + #2 == 0.5 & @@ nds, {t, 0.5}] FindRoot[# + #2 == 0.75 & @@ nds, {t, 0.5}] {t -> 0.176619} {t -> 0.376373} {t -> 0.60538} (It should be assumed that differential equations do not have analytical solution of course.)