Skip to article frontmatterSkip to article content

IVP systems

Few applications involve an initial-value problem with just a single dependent variable. Usually there are multiple unknowns and a system of equations to define them.

We now upgrade our IVP definition, Definition 6.1.1.

We use the terms IVP system and vector-valued IVP interchangeably; a system of scalar IVPs can be put into the form of (6.3.3) by appropriate definitions of u\mathbf{u} and f\mathbf{f}, as shown in Example 6.3.1.

6.3.1Numerical solutions

The generalization of any scalar IVP solver to handle systems is straightforward. Consider Euler’s method, which in system form becomes

ui+1=ui+hf(ti,ui),i=0,,n1. \begin{split} \mathbf{u}_{i+1} &= \mathbf{u}_i + h\,\mathbf{f}(t_i,\mathbf{u}_i), \qquad i=0,\ldots,n-1. \end{split}

The vector difference equation (6.3.4) is just Euler’s formula applied simultaneously to each component of the ODE system. Because operations such as addition and multiplication translate easily from scalars to vectors, Function 6.2.2 that we wrote for scalar IVPs works for systems as well. Practically speaking, the only changes that must be made are that the initial condition and the ODE function have to be coded to use vectors.

In the rest of this chapter we present methods as though they are for scalar equations, but their application to systems is taken for granted. The generalization of error analysis can be more complicated, but our statements about order of accuracy and other properties are true for systems as well as scalars. The codes are all written to accept systems.

6.3.2Transformation of high-order systems

Fortunately, the ability to solve first-order ODE systems implies the ability to solve systems of higher differential order, too. The reason is that there is a systematic way to turn a higher-order problem into a first-order one of higher dimension.

The trick illustrated in the preceding examples is always available. Suppose yy is a scalar dependent variable in the system. You should introduce a component of u\mathbf{u} for yy, yy', etc., up to but not including the highest derivative appearing anywhere for yy. This is done for each scalar variable in the original system. There should be one component of u\mathbf{u} for each scalar initial condition given. Many equations for the first-order system then come from the trivial relationships among all the lower derivatives. The remaining equations for the system come from the original, high-order equations. In the end, there must be as many scalar component equations as unknown first-order variables.

6.3.3Exercises

  1. ✍ Rewrite the given higher order problems as first-order systems.

    (a) y3y+3yy=t,y(0)=1,y(0)=2,y(0)=3y'''-3y''+3 y' -y = t, \: y(0) = 1, \: y'(0) = 2, \: y''(0) = 3

    (b) y+4(x21)y+y=0,y(0)=2,y(0)=1y'' + 4 (x^2-1)y' + y = 0, \: y(0) = 2, \: y'(0) = -1

    (c) For a given constant aa,

    x+ax(x2+y2)3/2=0,y+ay(x2+y2)3/2=0,\begin{split} x'' + \frac{a x}{(x^2+y^2)^{3/2}} &= 0,\\ y'' + \frac{a y}{(x^2+y^2)^{3/2}} &= 0, \end{split}

    with initial values x(0)=1x(0) = 1, x(0)=y(0)=0x'(0)=y(0) = 0, y(0)=3y'(0)=3

    (d) y(4)y=et,y(0)=0,y(0)=0,y(0)=1,y(0)=0y^{(4)} -y = e^{-t}, \: y(0) = 0, \: y'(0) = 0, \: y''(0) = 1,\: y'''(0) = 0

    (e) yy+yy=t,y(0)=1,y(0)=2,y(0)=3y'''-y''+y'-y = t, \: y(0) = 1, \: y'(0) = 2, \: y''(0) = 3

  2. ✍ Write the given IVP as a system. Then do two steps of Euler’s method by hand (perhaps with a calculator) with the indicated step size hh. Using the given exact solution, compute the error after the second step.

    (a) y+4y=4t,y(0)=1,y(0)=1;y^(t)=t+cos(2t),h=0.1y''+ 4y = 4t, \: y(0) = 1,\: y'(0) = 1; \: \hat{y}(t) = t+\cos (2t),\: h=0.1

    (b) y4y=4t,y(0)=2,y(0)=1;y^(t)=e2t+e2tt,h=0.1y''- 4y = 4t, \: y(0) = 2,\: y'(0) = -1; \: \hat{y}(t) = e^{2t} + e^{-2t}-t,\: h=0.1

    (c) 2x2y+3xyy=0,y(2)=1,y(2)=1/2,y^(x)=2/x,h=1/82 x^2 y'' +3xy' - y = 0, \: y(2) = 1, \: y'(2) = -1/2, \: \hat{y}(x) = 2/x, h = 1/8

    (d) 2x2y+3xyy=0,y(1)=4,y(1)=1,y^(x)=2(x1/2+x1),h=1/42 x^2 y'' +3xy' - y = 0,\: y(1) = 4, \: y'(1) = -1, \: \hat{y}(x) = 2(x^{1/2} + x^{-1}), h=1/4

  3. ⌨ Solve the following IVPs using Function 6.2.2 using n=1000n=1000 steps. Plot the solution and its first derivative together on one plot, and plot the error in each component as functions of time on another.

    (a) y+4y=4t,0<t<2π,y(0)=1,y(0)=1;y^(t)=t+cos(2t)y''+ 4y = 4t, \: 0< t< 2\pi, \: y(0) = 1,\: y'(0) = 1; \: \hat{y}(t) = t+\cos (2t)

    (b) y+9y=sin(2t),0<t<2π,y(0)=2,y(0)=1y''+ 9y = \sin(2t), \: 0< t< 2\pi, \: y(0) = 2,\: y'(0) = 1; y^(t)=(1/5)sin(3t)+2cos(3t)+(1/5)sin(2t)\quad \hat{y}(t) = (1/5) \sin(3t) + 2 \cos (3t)+ (1/5) \sin (2t)

    (c) y4y=4t0<t<1.5,y(0)=2,y(0)=1;y^(t)=e2t+e2tty''- 4y = 4t \: 0< t< 1.5, \: y(0) = 2,\: y'(0) = -1; \: \hat{y}(t) = e^{2t} + e^{-2t}-t

    (d) y+4y+4y=t,0<t<4,y(0)=1,y(0)=3/4;y^(t)=(3t+5/4)e2t+(t1)/4y''+ 4y'+ 4y = t, \: 0< t< 4, \: y(0) = 1,\: y'(0) = 3/4; \: \hat{y}(t) = (3t+5/4)e^{-2t} + (t-1)/4

    (e) x2y+5xy+4y=0,1<x<e2,y(1)=0,y(1)=2,y^(x)=(2/x2)lnxx^2 y'' +5xy' + 4y = 0,\: 1<x<e^2, \: y(1) = 0, \: y'(1) = 2, \: \hat{y}(x) = (2/x^2) \ln x

    (f) x2y+5xy+4y=0,1<x<e2,y(1)=1,y(1)=1,y^(x)=x2(1+lnx)x^2 y'' +5xy' + 4y = 0,\: 1<x<e^2, \: y(1) = 1, \: y'(1) = -1, \: \hat{y}(x) = x^{-2}( 1 + \ln x)

    (g) 2x2y+3xyy=0,2<x<20,y(2)=1,y(2)=1/2,y^(x)=2/x2 x^2 y'' +3xy' - y = 0,\: 2<x<20, \: y(2) = 1, \: y'(2) = -1/2, \: \hat{y}(x) = 2/x

    (h) 2x2y+3xyy=0,1<x<16,y(1)=4,y(1)=1,y^(x)=2(x1/2+x1)2 x^2 y'' +3xy' - y = 0,\: 1<x<16, \: y(1) = 4, \: y'(1) = -1, \: \hat{y}(x) = 2(x^{1/2} + x^{-1})

    (i) x2yxy+2y=0,1<x<eπ,y(1)=3,y(1)=4x^2 y'' -xy' + 2y = 0,\: 1<x<e^{\pi}, \: y(1) = 3, \: y'(1) = 4; y^(x)=x[3cos(lnx)+sin(lnx)]\quad \hat{y}(x) = x \left[ 3 \cos \left( \ln x \right)+\sin \left( \ln x \right) \right]

    (j) x2y+3xy+4y=0,eπ/12<x<eπ,y(eπ/12)=0,y(eπ/12)=6x^2 y'' + 3xy' + 4y = 0,\: e^{\pi/12} < x < e^{\pi}, \: y(e^{\pi/12}) = 0, \: y'(e^{\pi/12}) = -6; y^(x)=x1[3cos(3lnx)+sin(3lnx)]\quad \hat{y}(x) = x^{-1} \left[ 3 \cos \left( 3 \ln x \right)+\sin \left( 3 \ln x \right) \right]

  4. ⌨ A disease that is endemic to a population can be modeled by tracking the fraction of the population that is susceptible to infection, v(t)v(t), and the fraction that is infectious, w(t)w(t). (The rest of the population is considered to be recovered and immune.) A typical model is the SIR model (see Britton (2003))

    dvdt=0.2(1v)3vw,dwdt=(3v1)w.\frac{dv}{dt} = 0.2(1-v) - 3vw, \qquad \frac{dw}{dt} = (3v-1)w.

    Starting with v(0)=0.95v(0) = 0.95 and w(0)=0.05w(0) = 0.05, use solve to find the long-term steady values of v(t)v(t) and w(t)w(t). Plot both components of the solution as functions of time.

  5. ⌨ In each case below, use solve to solve the given ODE for 0t100\le t \le 10 with the given initial conditions. Plot the results together as curves in the phase plane (that is, with xx and yy as the axes of the plot), using aspect_ratio=1 in the plot command.

    (a)

    x(t)=4y+x(1x2y2),y(t)=4x+y(1x2y2),\begin{split} x'(t) & = - 4y + x(1-x^2-y^2),\\ y'(t) & = 4x + y(1-x^2-y^2), \end{split}

    with [x(0),y(0)]=[0.1,0][x(0),y(0)]=[0.1,0] and [x(0),y(0)]=[0,1.9][x(0),y(0)]=[0,1.9].

    (b)

    x(t)=4y14x(1x2y2)(4x2y2),y(t)=4x14y(1x2y2)(4x2y2),\begin{split} x'(t) & = - 4y - \tfrac{1}{4}x(1-x^2-y^2)(4-x^2-y^2),\\ y'(t) & = 4x - \tfrac{1}{4}y(1-x^2-y^2)(4-x^2-y^2), \end{split}

    with [x(0),y(0)]=[0.95,0][x(0),y(0)]=[0.95,0], [0,1.05][0,1.05], and [2.5,0][-2.5,0].

  6. ⌨ The FitzHugh–Nagumo equations are a simple model of the repeated firing of a neuron. They are given by

    dv1dt=v1(v11)(v1a)v2+I,dv2dt=ϵ(v1γv2).\begin{split} \frac{d v_1}{dt} &= - v_1(v_1-1)(v_1-a) - v_2 + I, \\ \frac{d v_2}{dt} &= \epsilon ( v_1 - \gamma v_2). \end{split}

    Assume v1(0)=0.5v_1(0) = 0.5, v2(0)=0.1v_2(0) = 0.1, a=0.1a = 0.1, ϵ=0.008\epsilon = 0.008, γ=1\gamma = 1. For each value of II below, find and plot the solution using solve for 0t6000\le t \le 600. The solutions are highly sensitive to II, and you need to change the requested absolute and relative error tolerances to 10-9. In each case the solution quickly approaches a periodic oscillation.

    (a) I=0.05527,I = 0.05527,\quad (b) I=0.05683,I = 0.05683,\quad (c) I=0.0568385,I = 0.0568385,\quad (d) I=0.05740I = 0.05740.

    This exploration was carried out by Baer and Erneux Baer & Erneux (1986).

References
  1. Britton, N. F. (2003). Essential Mathematical Biology. Springer.
  2. Baer, S. M., & Erneux, T. (1986). Singular Hopf Bifurcation to Relaxation Oscillations. SIAM Journal on Applied Mathematics, 46(5), 721–739. 10.1137/0146047