Menu
Sign up Sign in

AI HL · AHL 9

Differential Equations

AHL 9.12

Euler's method for a coupled system: graphs and phase portraits

AHL 9.12

Euler's method for a coupled system: graphs and phase portraits

Target: I can write the Euler recurrence relations for a coupled linear system. (+4 more)

By the end of this section

Key points

The recurrences

  • Always write them down. For \(\dot x=ax+by,\ \dot y=cx+dy\) and step length h: \(x_{n+1}=x_n+h(ax_n+by_n)\), \(y_{n+1}=y_n+h(cx_n+dy_n)\), \(t_n=hn\).
  • Both new values use the old x and the old y. Do not put the new x into the y line.
  • The starting row is \(t_0=0\) with the given x and y.

Two graphs from one table

  • x against t: a scatter plot with column t across and column x up. It shows how x changes with time.
  • y against x: a scatter plot with column x across and column y up. This is the phase portrait. Time is not on the axes.
  • Label what you can read: the t-intercept, the first minimum point, and where the spiral crosses the axes.

Describing the output

  • x oscillates and the swings grow: oscillation with growing amplitude. The phase portrait is a spiral going out (unstable focus, \(p>0\)).
  • x oscillates and the swings shrink: oscillation with decreasing amplitude. The phase portrait is a spiral going in (stable focus, \(p<0\)).
  • Check with the eigenvalues. The real part p decides whether the swings grow or shrink.
  • Euler's method is an approximation. For a neutral focus the exact curves are closed, but Euler's points drift slowly outwards.

On the calculator

Euler's method in a spreadsheet

  • Make three columns: t, x and y. Type the starting values in the first row.
  • In the second row type the recurrence for each column: the new t is the old t plus 0.1, and the new x and y use the old x and old y.
  • Fill the second row down as far as you need.

Screenshot and video to come

Scatter plot of x against t

  • Add a data and statistics page. Put t on the horizontal axis and x on the vertical axis.
  • Adjust the window until you can see the whole curve, then read the intercept and the minimum from the table or the plot.

Screenshot and video to come

Phase portrait of y against x

  • On a scatter plot put x on the horizontal axis and y on the vertical axis.
  • The points trace the solution curve. Check whether it spirals in or out.

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.
x against t from Euler's method

The differential equations \(\dfrac{dx}{dt}=2x - 3y,\ \dfrac{dy}{dt}=3x - y\) have \(x=1\) and \(y=0\) when \(t=0\). Use Euler's method with a step length of 0.1 to sketch a graph of x against t for \(0\le t\le5\). Label the first t-intercept and the first minimum point.

Working
  1. The recurrences

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

    Always write these down. Each new x and y uses the old x and the old y.

  2. The first rows

    n = 0: \(t=0,\ x=1,\ y=0\); n = 1: \(t=0.1,\ x=1.2,\ y=0.3\); n = 2: \(t=0.2,\ x=1.35,\ y=0.63\)

    By hand: \(x_1=1+0.1(2(1)-3(0))=1.2\), \(y_1=0+0.1(3(1)-0)=0.3\). Then \(x_2=1.35\).

  3. On the calculator

    From the calculator: a spreadsheet with columns t, x and y, filled down to \(t=5\)

    Type the starting values in row 1 and the recurrences in row 2, then fill down.

  4. Plot x against t

    From the calculator: scatter plot of x against t. It crosses the t-axis at about \(t=0.86\) and has a minimum at about \((1.6,\ -3.96)\)

    Read the intercept from the table, where x changes sign, and the minimum from the lowest value.

  5. 12345−40−20204060tx(1.6, −3.96)
    Sketch and describe

    An oscillation with growing amplitude

    x swings above and below zero and each swing is bigger.

Video walkthrough coming
The phase portrait from Euler output

For the same system \(\dfrac{dx}{dt}=2x - 3y,\ \dfrac{dy}{dt}=3x - y\) with \(x=1,\ y=0\) when \(t=0\), sketch the phase portrait of y against x for \(0\le t\le4\) using Euler's method with step length 0.1.

Working
  1. The same table

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

    The columns \(x_n\) and \(y_n\) are the same as before. Only the plot changes.

  2. Plot y against x

    From the calculator: scatter plot with \(x_n\) on the horizontal axis and \(y_n\) on the vertical axis

    Time does not appear on the axes. Each point is one row of the table.

  3. Read the shape

    From the calculator: a spiral out from \((1,0)\). It crosses the y-axis at about \(y=2\) and the negative x-axis at about \(x=-2.8\)

    The curve goes round the origin and gets further from it each time.

  4. −40−30−20−101020−15−10−55101520xystart
    Direction

    y increases at the start, so the spiral is anticlockwise

    Add arrowheads. Euler's method gives the direction as well.

Video walkthrough coming
Describing a spiral from the output

For the system \(\dfrac{dx}{dt}=-x - 4y,\ \dfrac{dy}{dt}=2x\) with \(x=4,\ y=1\) when \(t=0\), use Euler's method with step length 0.1 to sketch x against t and y against x for \(0\le t\le10\). Describe what you see.

Working
  1. The recurrences

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

    Same method: spreadsheet, fill down to \(t=10\).

  2. 246810−6−4−2246tx(0.9, −4.13)
    x against t

    From the calculator: x oscillates about 0 and the swings get smaller. First t-intercept about \(t=0.38\), first minimum about \((0.9,\ -4.13)\)

    An oscillation with decreasing amplitude.

  3. −6−4−2246−4−3−2−11234xystart
    y against x

    From the calculator: a spiral going in towards \((0,0)\), anticlockwise

    Each loop is smaller than the one before.

  4. Check with the eigenvalues

    \(\lambda=-0.5\pm2.78i\)

    The real part is negative, so the origin is a stable focus. The output agrees.

Video walkthrough coming