# Using Manipulate to show the solution of an ODE by NDSolve and DSolve

I can't spot the error, can someone help me?

NumericalGenSol =
NDSolve[
{g/l* Sin[θ[t]] + (γ* θ'[t])/m + θ''[t] == f/(m l), θ[0] == α Degree, θ'[0] == β Degree},
θ[t], {t, 0, 10}];


AnalyticalGenSol is just alike NumericalGenSol just without Sin but only with $$\theta$$ and I used DSolve instead.

Manipulate[{NumericalGenSol, AnalyticalGenSol}, θ[t], {t, 0, 10}];
Plot[
{Evaluate[θ[t] /. NumericalGenSol], θ[t] /. AnalyticalGenSol}],
{t, 0, 10}, {α, 0, 90}, {β, 0, 90}
]


Any idea how I can combine in one manipulate plot?

• In your first codeline NumericalGenSol = ... there are several undefined parameters. That's why NDSolve doesn't evaluate! Commented Feb 28, 2019 at 18:12
• Sorry they are defined in the top? the error message is: Manipulate::vsform: Manipulate argument [Theta][t] does not have the correct form for a variable specification. Commented Feb 28, 2019 at 18:17
• Where to find the "top"? NDSolve only works for numerical problems. Commented Feb 28, 2019 at 18:20
• Ulrich means that you should include in your post all definitions necessary to run your code, otherwise we cannot run it on our machine and tinker with it to try and provide a solution to your problem. Commented Feb 28, 2019 at 18:27

If you define all the parameters and remove the excesses, the code can be like this

g = 9.8; l = 1; m = 1; f = 1; γ = .1;
sol =
ParametricNDSolveValue[
{g/l*Sin[θ[t]] + (γ*θ'[t])/m + θ''[t] ==f/(m l),
θ[0] == α , θ'[0] == β}, θ[t], {t, 0, 10}, {α, β}];

Manipulate[
Plot[
{sol[α, β],
Evaluate[θ[t] /.
DSolve[
{g/l*θ[t] + (γ*θ'[t])/m + θ''[t] == f/(m l),
θ[0] == α, θ'[0] == β},
θ, {t, 0, 10}]]},
{t, 0, 10}],
{α, 0, Pi/2},
{β, 0, Pi/2}]