I'm creating a template for differential equation solving. I'm trying to write a script that takes the output from the solution of the differential equation and write it as a new function to be used in Manipulate [ Plot[...] ]. However, when I do this, Plot will not recognize that I've set the output as a function. Can someone spot my mistake?
Code:
Eqn1 = D[f[t], {t, 2}] + \[Omega]^2*f[t] == 0;
Sol1 = DSolve[Eqn1, f[t], t];
IC1 = f[0] == \[Alpha];
IC2 = (D[f[t], {t, 1}] == \[Gamma]) /. t -> 0;
Sol2[t_] = Simplify[ DSolve[{Eqn1, IC1, IC2}, f[t], t] ];
x[t_] = Replace[ f[t], Sol2[t] ];
Manipulate[
Plot[
{
x[t]
},
{ t, 0, 10 }
(* Plot *)],
Style["", Bold, 14, FontFamily -> "Times"],
{{\[Alpha], -10, Style["\[Alpha]", 16, FontFamily -> "Times"]}, -10,
10, 0.01, ImageSize -> Medium, Appearance -> "Labeled"},
"",
Style["", Bold, 14, FontFamily -> "Times"],
{{\[Gamma], 0, Style["\[Gamma]", 16, FontFamily -> "Times"]}, -10,
10, 0.01, ImageSize -> Medium, Appearance -> "Labeled"},
"",
Style["", Bold, 14, FontFamily -> "Times"],
{{\[Omega], 1.0,
Style["\[Omega] [rad. \!\(\*SuperscriptBox[\(s\), \(-1\)]\)]", 16,
FontFamily -> "Times"]}, 0, 10, 0.01, ImageSize -> Medium,
Appearance -> "Labeled"},
ControlPlacement -> Left,
SaveDefinitions -> False,
TrackedSymbols :> {\[Alpha], \[Gamma], \[Omega]}
(* Manipulate *)]