ODE bifurcation example

A few days ago I wrote about bifurcation for a discrete system. This post looks at a continuous example taken from the book Exploring ODEs.

We’ll consider solutions to the differential equation

y'' = 2\left( \frac{t}{150}-2\right)y  - 4y^3

for two different initial conditions: y(0) = 0.02, y‘(0) = 0 and y(0) = 0.05, y‘(0) = 0.

We’ll solve the ODE with both initial conditions for 0 ≤ t ≤ 600 with the following Python code.

    from scipy import linspace
    from scipy.integrate import solve_ivp
    import matplotlib.pyplot as plt

    def ode(t, z):
        y, yp = z
        return [yp, 2*(-2 + t/150)*y - 4*y**3]

    a, b = 0, 600
    t = linspace(a, b, 900)

    sol1 = solve_ivp(ode, [a, b], [0.02, 0], t_eval=t)
    sol2 = solve_ivp(ode, [a, b], [0.05, 0], t_eval=t)

First let’s look at the solutions for 0 ≤ t ≤ 200.

Here’s the code that produced the plots.

    plt.subplot(211)
    plt.plot(sol1.t[:300], sol1.y[0][:300])
    plt.subplot(212)
    plt.plot(sol2.t[:300], sol2.y[0][:300])
    plt.show()

Note that the vertical scales of the two plots are different in order to show both solutions relative to their initial value for y. The latter solution starts out 2.5x larger, and essentially stays 2.5x larger. The two solutions are qualitatively very similar.

Something unexpected happens if we continue the solutions for larger values of t.

Here’s the code that produced the plots.

    plt.subplot(211)
    plt.plot(sol1.t, sol1.y[0])
    plt.ylim([-1,1])
    plt.subplot(212)
    plt.plot(sol2.t, sol2.y[0])
    plt.ylim([-1,1])
    plt.show()

Now the vertical scales of the two plots are the same. The solutions hit a bifurcation point around t = 300.

More differential equations posts