I have a numerical solution for a differential equation. I know that the gray dotted solution is unphysical. Is there a way I can tell mathematica to ignore the gray dotted solution (e.g. restrict the interpolating function to values between 0 and 1)? (Later on, I want to do operations on this solution, and I don't want the gray solution to contribute)
I tried to use WhenEvent
, but I get an error message.
sa = NDSolve[{3/2 (a'[t]/a[t])^2 +
a'[t]/a[t] vdot[t]/v[t] - ωa/8 vdot[t]^2 ==
1/4 ρ0/a[t]^3, a[todaya] == 1,
WhenEvent[a[t] > 1, "StopIntegration"]}, a, {t, EQfraca, todaya}]
aa = Plot[Evaluate[a[t] /. sa], {t, EQfraca, todaya},
PlotRange -> {{EQfraca, todaya}, {mina, maxa}}, Frame -> True,
PlotStyle -> {{Red, Thick}, {Gray, Dotted}},
FrameLabel -> {"t", "a (t)"}];
{}
button above the edit window. The edit window help button?
is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful $\endgroup$