# Manipulate with DSolve and Plot

I try to draw a graph:


ClearAll[k, r, n]
k = 20
r = .8

Manipulate[
psol = DSolve[{p'[t] == r*p[t] (1 - p[t]/k), p[0] == n}, p[t], t];
Plot[ psol[t] , {t, -10, 10} ], {n, 0, 1}]



but I get an error:

Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.

The message is warning that inverse functions are being used by Solve, so some solutions may not be found

You can ignore it if you want

ClearAll[k, r, n]
k = 20
r = .8
Manipulate[
psol=Quiet[DSolve[{p'[t]==r*p[t] (1-p[t]/k),p[0]==n},p[t],t]];
Plot[p[t]/.psol,{t,-10,10}],
{{n,0,"n"},0,1,Appearance->"Labeled"}
]


Or it might be better to turn off that one messaage

Manipulate[
psol=DSolve[{p'[t]==r*p[t] (1-p[t]/k),p[0]==n},p[t],t];
Plot[p[t]/.psol,{t,-10,10}],{{n,0,"n"},0,1,Appearance->"Labeled"}
,Initialization:>
{
k=20;
r=.8;
Off[Solve::ifun]
}
]


see ref/message/Solve/ifun for more information on this message

• You can still use Quiet[] to turn off a single message locally: Quiet[Solve[y == x Exp[x], x], Solve::ifun]. – J. M.'s discontentment Nov 5 '17 at 20:57
• If plotting the solution is the only goal, you could just use NDSolve. – aardvark2012 Nov 6 '17 at 10:22
• Rather than repeatedly evaluating DSolve, move that to the Initialization: Manipulate[ Plot[sol[n, t], {t, -10, 10}, PlotRange -> {0, 20}], {{n, 0}, 0, 1, 0.01, Appearance -> "Labeled"}, Initialization :> {k = 20; r = 4/5; sol[n_, t_] = p[t] /. DSolve[{p'[t] == r*p[t] (1 - p[t]/k), p[0] == n}, p, t][[1]] // Quiet}] – Bob Hanlon Dec 5 '17 at 20:11