Menu
Sign up Sign in

AI HL · AHL 9

Differential Equations

AHL 9.6

Euler's method for coupled systems

AHL 9.6

Euler's method for coupled systems

Target: I can write Euler's method for a coupled system dx/dt = f₁(t, x, y), dy/dt = f₂(t, x, y). (+3 more)

By the end of this section

Key points

Coupled systems

  • Two variables that depend on each other can be written as dx/dt = f₁(t, x, y) and dy/dt = f₂(t, x, y).
  • Examples: two competing species, or salt in two connected tanks. Each rate depends on both quantities, and sometimes on t.
  • Euler's method moves t forward in steps of h and updates both variables together.

The formulas

  • t(n+1) = t(n) + h
  • x(n+1) = x(n) + h × f₁(t(n), x(n), y(n))
  • y(n+1) = y(n) + h × f₂(t(n), x(n), y(n))
  • Both new values use the old x(n) and y(n). Never put the new x into the y formula.

Setting it out

  • Write the three formulas with the right-hand sides put in.
  • Check the first row by hand. Make a table of t, x and y with the start values in row 0.
  • Count the steps: from t = 0 to t = 0.5 with h = 0.1 is 5 steps.
  • Keep full calculator values and round at the end, to 3 significant figures. Use radians for sin and cos of t.

On the calculator

Euler's method for a coupled system

  • Put t in column A, x in column B and y in column C. Row 1 holds the start values.
  • In row 2, the t cell adds h to the t above.
  • The x cell and the y cell each add h times their own gradient. Both gradients use the old t, x and y cells from row 1.
  • Fill down to the row where t has the value you need, and read x and y from that row.

Screenshot and video to come

Explore: Euler's method for a coupled system

Choose a system and a step length h. Each Next takes one Euler step for x and y together. The left picture shows x and y against t, and the right picture shows the path of (x, y). Tick the box to compare with the true solution.

x (ink) and y (teal) against t

The path in the x-y plane

Step length h


txy
t
x
y
Euler minus true

Press Next to take the first step.

  1. Work out the first step by hand from the starting values, then press Next to check. In the formula for y, did you use the old x or the new x?
  2. In rabbits and foxes, what does y do just after x reaches its peak? Find that moment in both pictures.
  3. Tick the true solution and run to the end with h = 0.2, then 0.05. What happens to the path in the x-y plane? Is the true path closed?
  4. Choose the linear system. Does x oscillate? Do the swings grow or shrink? What does that say about the eigenvalues of the matrix?

Worked examples

Problems like the ones in class. Pick one, try it, then open the working.
A system with t in it

Variables \(x\) and \(y\) satisfy \(\dfrac{dx}{dt}=3y+t\) and \(\dfrac{dy}{dt}=t-2x\), with \(x(0)=1\) and \(y(0)=0.5\). Use Euler's method with \(h=0.1\) to estimate \(y\) when \(t=0.5\).

Working
  1. Write the formulas

    \(t_{n+1}=t_n+0.1\), \(x_{n+1}=x_n+0.1(3y_n+t_n)\), \(y_{n+1}=y_n+0.1(t_n-2x_n)\)

    One formula for each variable, and t goes up by h. Every right-hand side uses the old t, x and y.

  2. The first step

    \(x_1=1+0.1(1.5)=1.15\), \(y_1=0.5+0.1(−2)=0.3\)

    Both gradients are found at the start (0, x₀, y₀). Do not use the new x in the y formula.

  3. txy010.50.11.150.30.21.250.080.31.294−0.150.41.279−0.37880.51.2054−0.5946
    Run the table

    From the calculator: (0.1, 1.15, 0.3), (0.2, 1.25, 0.08), (0.3, 1.294, −0.15), (0.4, 1.279, −0.3788), (0.5, 1.2054, −0.5946)

    Each row gives t, x and y. The row at t = 0.5 is the fifth step.

  4. The answer

    \(x(0.5)\approx 1.205\), \(y(0.5)\approx -0.595\)

    The question asks for y, so read the y column. Both values come from the same row.

Video walkthrough coming
Two species

The numbers of rabbits \(x\) and foxes \(y\) (in hundreds) at time \(t\) years satisfy \(\dfrac{dx}{dt}=x(1-0.5y)\) and \(\dfrac{dy}{dt}=y(0.4x-0.6)\), with \(x(0)=3\) and \(y(0)=1\). Use Euler's method with \(h=0.1\) to estimate the number of rabbits when \(t=0.5\).

Working
  1. Write the formulas

    \(t_{n+1}=t_n+0.1\), \(x_{n+1}=x_n+0.1(x_n(1-0.5y_n))\), \(y_{n+1}=y_n+0.1(y_n(0.4x_n-0.6))\)

    One formula for each variable, and t goes up by h. Every right-hand side uses the old t, x and y.

  2. The first step

    \(x_1=3+0.1(1.5)=3.15\), \(y_1=1+0.1(0.6)=1.06\)

    Both gradients are found at the start (0, x₀, y₀). Do not use the new x in the y formula.

  3. txy0310.13.151.060.23.2981.130.33.44151.21120.43.57731.30530.53.70151.4138
    Run the table

    From the calculator: (0.1, 3.15, 1.06), (0.2, 3.298, 1.13), (0.3, 3.4415, 1.2112), (0.4, 3.5773, 1.3053), (0.5, 3.7015, 1.4138)

    Each row gives t, x and y. The row at t = 0.5 is the fifth step.

  4. The answer

    \(x(0.5)\approx 3.702\), \(y(0.5)\approx 1.414\)

    The question asks for rabbits, which is x. The answer is in hundreds.

Video walkthrough coming
Trig and exponential terms

Variables \(x\) and \(y\) satisfy \(\dfrac{dx}{dt}=2y+e^{-t}\) and \(\dfrac{dy}{dt}=x\cos t-y\), with \(x(0)=1\) and \(y(0)=0\). Use Euler's method with \(h=0.1\) to estimate \(y\) when \(t=0.5\). Work in radians.

Working
  1. Write the formulas

    \(t_{n+1}=t_n+0.1\), \(x_{n+1}=x_n+0.1(2y_n+e^{-t_n})\), \(y_{n+1}=y_n+0.1(x_n\cos t_n-y_n)\)

    One formula for each variable, and t goes up by h. Every right-hand side uses the old t, x and y.

  2. The first step

    \(x_1=1+0.1(1)=1.1\), \(y_1=0+0.1(1)=0.1\)

    Both gradients are found at the start (0, x₀, y₀). Do not use the new x in the y formula.

  3. txy0100.11.10.10.21.21050.19950.31.33220.29810.41.4660.39560.51.61210.4911
    Run the table

    From the calculator: (0.1, 1.1, 0.1), (0.2, 1.2105, 0.1995), (0.3, 1.3322, 0.2981), (0.4, 1.466, 0.3956), (0.5, 1.6121, 0.4911)

    Each row gives t, x and y. The row at t = 0.5 is the fifth step.

  4. The answer

    \(x(0.5)\approx 1.612\), \(y(0.5)\approx 0.491\)

    Radians, because t is a time and no degree sign is given. Check the first row by hand before trusting the table.

Video walkthrough coming