# Implement an IntervalSlider

I do not know how to incorporate an IntervalSlider in the code below in order to change the two instances of the t-domain (in the NDSolve and ParametricPlot commands). My code is an excerpt from a phase plane plotter. I have tried to use the example from the Documentation but to no avail. Can someone show how this can be done?

DynamicModule[{g = {}, p = {}, dx, dy, sol, x0, y0},
dx := 1 - x y;  dy = x - y^3;
sol[{dx_, dy_}, {x0_, y0_}] := {u[t], v[t]} /.
Quiet@First@
NDSolve[{u'[t] == dx /. {x -> u[t], y -> v[t]},
v'[t] == dy /. {x -> u[t], y -> v[t]}, u == x0, v == y0,
WhenEvent[Abs[v[t]] > 2, "StopIntegration"]}, {u, v}, {t, -10, 10},
Method -> "StiffnessSwitching"];
Column[{
Dynamic@ClickPane[
Show[
Quiet@
ParametricPlot[g, {t, -10, 10},
PlotRange -> {{-2, 2}, {-2, 2}}, Axes -> None, Frame -> True,
ImageSize -> 450, PlotStyle -> Black],
Graphics[{PointSize[Large], Point[p]}]],
(AppendTo[g, sol[{dx, dy}, #]]; AppendTo[p, #]) &]
}]
]

• I want the IntervalSlider to change the t-values -10 and 10 in the two instances of {t,-10,10} – Stephen Aug 2 '17 at 13:49

DynamicModule[
{g = {}, p = {}, dx, dy, sol, x0, y0, td = {-10, 10}}
, dx := 1 - x y; dy = x - y^3
; sol[{dx_, dy_}, {x0_, y0_}] := {u[t], v[t]} /. Quiet@First@
NDSolve[{u'[t] == dx /. {x -> u[t], y -> v[t]},
v'[t] == dy /. {x -> u[t], y -> v[t]}, u == x0, v == y0,
WhenEvent[Abs[v[t]] > 2, "StopIntegration"]}, {u, v}, {t, -10,
10}, Method -> "StiffnessSwitching"
]
; Column[
{ ClickPane[  Dynamic@Show[Quiet @ ParametricPlot[
g, {t, ##}, PlotRange -> {{-2, 2}, {-2, 2}}, Axes -> None
, Frame -> True, ImageSize -> 450, PlotStyle -> Black
] & @@  td, Graphics[{PointSize[Large], Point[p]}]], (AppendTo[g,
sol[{dx, dy}, #]]; AppendTo[p, #]) &]

, IntervalSlider[Dynamic@td, {-10, 10}, Method -> "Push"]
}]] • excellent solution! – Stephen Aug 2 '17 at 13:58
• What is the role of & @@ td that follows the ParametricPlot command? – Stephen Aug 2 '17 at 20:35
• @Stephen Take a look at Apply. Shortly foo[##]& @@ {b, a, r} evaluates to foo[b, a, r]. – Kuba Aug 2 '17 at 21:02