I'm trying to use NDSolve with Manipulate but have difficulty doing so. I think the difficulty is because when using Manipulate, non-numerical boundary conditions are called in NDSolve, which I'm then trying to assign numerical value to in Manipulate. I tried using a delay tag with NDSolve, but that did not seem to solve the issue. Does anyone know a way to use symbolic boundary conditions in NDSolve, using a delay tag, which will work when called in Manipulate?
The diff. eq. works with numerical boundary conditions:
Eqn1 = D[f1[t], t, t] + f1[t] == (1 + f1[t]/100)^-1;
IC11 = f1[0] == 1;
IC12 = (D[f1[t], {t, 1}] == 0) /. { t -> 0 };
Sol1 := Simplify[
NDSolve[
{Eqn1, IC11, IC12},
f1[t],
{t, 0, 100}]
]
x1[t_] = Simplify[
Replace[
f1[t],
Sol1
]
][[1]];
Plot[
x1[t],
{t, 0, 100}
]
However, this method does not work:
Eqn2 = D[f2[t], t, t] + f2[t] == (1 + f2[t]/100)^-1;
IC21 = f2[0] == \[Alpha];
IC22 = (D[f2[t], {t, 1}] == \[Beta]) /. { t -> 0 };
Sol2 := Simplify[
NDSolve[
{Eqn2, IC21, IC22},
f2[t],
{t, 0, 100}]
]
x2[\[Alpha]_, \[Beta]_, t_] := Replace[
f2[t],
Sol2
][[1]]
Manipulate[
Plot[
{
x2[\[Alpha], \[Beta], t]
},
{t, tmin, tmax},
PlotRange -> { {tmin, tmax}, Automatic },
{{\[Alpha], 1, ""}, -0.5, 1, .001, ImageSize -> Medium, Appearance -> "Labeled"},
{{\[Beta], 0, ""}, -0.5, 1, .001, ImageSize -> Medium, Appearance -> "Labeled"},
{{tmin, 0, ""}, 0, 0, .001, ImageSize -> Medium, Appearance -> "Labeled"},
{{tmax, 100, ""}, 10, 1000, .001, ImageSize -> Medium, Appearance -> "Labeled"},
TrackedSymbols :> {\[Alpha], \[Beta], tmin, tmax},
]
Any thoughts?