Euler’s Method — Question 1

PDF ↗

Question 1

Consider y′=t−y,y(0)=1.y'=t-y,\qquad y(0)=1. For a step hh, explicit Euler uses tn+1=tn+ht_{n+1}=t_n+h and Yn+1=Yn+hf(tn,Yn)Y_{n+1}=Y_n+h f(t_n,Y_n), where YnY_n approximates y(tn)y(t_n). Use exact arithmetic in intermediate steps unless rounding is explicitly requested.

Tasks

  1. Starting at t0=0t_0=0, use h=1/4h=1/4 to compute every Euler value through t=1t=1. Include the slope used on each step.

  2. Find the exact solution and the signed endpoint error Y4−y(1)Y_4-y(1), reporting its numerical value to six decimal places.

  3. Draw the Euler polygon and the exact solution on [0,1][0,1]. Explain what the slope of each straight segment represents.

  4. A program obtains Y1=0.8125Y_1=0.8125 by evaluating t−yt-y at (t1,Y0)(t_1,Y_0). Identify the error and show the correct first update. Is that program implementing the stated Euler formula?

Original worksheet page 1: question and worked solution for 2-9-001
Show solutionHide solution

Question 1 – Solution

Strategy. Evaluate each slope at the current numerical point, then move both time and the approximation to the next node.

Step 1: Compute the four updates. The recurrence is Yn+1=Yn+(tn−Yn)/4Y_{n+1}=Y_n+(t_n-Y_n)/4. Its exact values are ntnYnf(tn,Yn)001−111/43/4−1/221/25/8−1/833/419/325/324181/128not needed\begin{array}{c|c|c|c} n&t_n&Y_n&f(t_n,Y_n)\\\hline 0&0&1&-1\\ 1&1/4&3/4&-1/2\\ 2&1/2&5/8&-1/8\\ 3&3/4&19/32&5/32\\ 4&1&81/128&\text{not needed} \end{array} Thus Y4=81/128=0.6328125\boxed{Y_4=81/128=0.6328125}.

Step 2: Check against the exact IVP. Solving y′+y=ty'+y=t with integrating factor ete^t gives y=t−1+2e−t,Y4−y(1)=81128−2e≈−0.102946.\boxed{y=t-1+2e^{-t}},\qquad \boxed{Y_4-y(1)=\frac{81}{128}-\frac 2e\approx-0.102946}. The exact formula has y(0)=1y(0)=1 and derivative 1−2e−t=t−y1-2e^{-t}=t-y, so it is the correct comparison solution.

See the diagram in the original worksheet below.

Step 3: Interpret the polygon. On [tn,tn+1][t_n,t_{n+1}], the Euler segment has slope f(tn,Yn)f(t_n,Y_n). It is tangent to the solution through the numerical point (tn,Yn)(t_n,Y_n), which generally differs from the original exact solution after the first step. The polygon is continuous but usually has corners at its nodes.

Step 4: Diagnose the time index. The correct first update is 1+(1/4)(0−1)=0.751+(1/4)(0-1)=0.75. The program instead uses 1+(1/4)(1/4−1)=0.81251+(1/4)(1/4-1)=0.8125, mixing the new time with the old state. It is not the stated explicit Euler method, which requires both arguments from the same current node.

Original worksheet page 2: question and worked solution for 2-9-001

Original worksheet layout. Use Enlarge or open the PDF for a closer view.