# plotting – Producing animation with DSolve

I’m teaching an intro differential equations class and trying to teach my students about bifurcation diagrams. I’d like to give an animation which shows how a solution changes as we change a parameter. I have the following animation which gives the bifurcation diagram on the left and a vector field on the right. I would like to overlay the solution to the IVP
$$frac{dx}{dt} = frac{x(x-5)}{100} + s;; x(1)=1$$
on the vector field (planning to use `Show` once I have the solution).
I am struggling to get the solution using `Manipulate`.

My current code that is working and almost gives what I want is:

``````Export("bifurcation-ex.gif",
Animate(GraphicsRow({Show(
Plot(x /. Solve(0 == x*(x - 5)/100 + s, x), {s, -2, 1}),
ParametricPlot({S, t}, {t, -15, 20}, PlotStyle -> Red)),
VectorPlot({x, x*(x - 5)/100 + S}, {x, -20, 20}, {y, -2, 2})}),
{S, -2, 1, .1}, AnimationDirection -> ForwardBackward))
``````

The code which is problematic is

``````Manipulate(
soln = DSolve({x'(t) == x(t)*(x(t) - 5)/100 + s, x(0) == 1}, x(t), t);
Plot(x(t) /. soln, {t, -20, 20}, PlotRange -> {{-20, 20}, {-2, 2}}),
{s, -2, 1/16})
``````

It works fine when I first evaluate but when I try to move the slider to adjust the parameter $$s$$, I sometimes get a warning
`Solve: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information`. I looked at the documentation for Reduce, and I am confused at how to use it to get my desired result. Does anyone know how I can go about this? Thanks!

Posted on Categories Articles