Tutorials › AP Calculus › Comparing Euler and Exact Logistic Predictions

Euler and Logistic Methods · Tutorial 598 of 999

Comparing Euler and Exact Logistic Predictions

Learn how to compare Euler and exact logistic predictions at matching times, calculate their errors, and judge a step size against a stated accuracy requirement.

Advanced 10 min read

What You'll Learn

  • Match Euler time points to values from the explicit logistic solution.
  • Calculate Euler estimates and exact logistic values for the same model.
  • Distinguish signed error, absolute error, and relative error.
  • Explain how Euler’s step-by-step defects contribute to the difference from the exact solution.
  • Compare step sizes using a numerical accuracy requirement.
  • Recognize why a smaller step often improves accuracy without guaranteeing a universal error pattern.

Why Compare Euler and Exact Logistic Predictions?

The Euler method gives a step-by-step estimate of a population governed by a differential equation. When an explicit solution is available, we can evaluate it at the same times as the Euler estimates and measure how closely the numerical method tracks the model’s exact prediction.

A useful comparison must be made at matching times. Comparing an Euler estimate at one time with an exact value at another would mix numerical error with the effect of elapsed time. Once the times agree, the difference measures the discrepancy between the two predictions for that model.

This comparison helps answer practical questions: Is a step size accurate enough for the purpose? Does halving the step noticeably improve the result? Is the Euler estimate above or below the exact prediction? The calculation also requires care: rounding intermediate steps too soon can distort the final error.

The Two Predictions at Matching Times

Consider the logistic differential equation

$$ \frac{dy}{dt}=r y\left(1-\frac{y}{K}\right), $$

where \(y(t)\) is population, \(r>0\) is the growth rate, and \(K>0\) is the carrying capacity. For an initial population \(y(0)=y_0\) with \(0<y_0<K\), its explicit solution is

$$ y(t)=\frac{K}{1+\left(\frac{K-y_0}{y_0}\right)e^{-rt}}. $$

For step size \(h>0\), Euler’s method starts with \(Y_0=y_0\) and repeatedly applies the current rate:

$$ Y_{n+1}=Y_n+h rY_n\left(1-\frac{Y_n}{K}\right). $$

Here \(Y_n\) is the Euler estimate at time \(t_n=nh\), while the exact value at that time is \(y(t_n)\). At a target time \(T\), choose \(h\) so that \(T=Nh\) for a whole number \(N\) of steps, or otherwise adjust the final step to land exactly at \(T\). Then compare \(Y_N\) with \(y(T)\).

Definition: At a matched time \(t_n\), the signed error is \(e_n=y(t_n)-Y_n\). The absolute error is \(|e_n|\). If \(y(t_n)\ne 0\), the relative error is \(\frac{|e_n|}{|y(t_n)|}\); the relative percent error is this ratio multiplied by \(100\%\).

With this signed-error convention, \(e_n>0\) means the Euler estimate is below the exact value, and \(e_n<0\) means it is above. The absolute error measures the size of the difference without regard to its direction.

Why the Errors Develop

The Euler update uses the rate at the beginning of each step to estimate the change over the whole step. To describe the difference from the exact solution, write the exact change over one step as the Euler-style change from the exact starting value, plus a remainder:

$$ y(t_{n+1})=y(t_n)+h f(y(t_n))+\tau_n, \qquad f(y)=r y\left(1-\frac{y}{K}\right), $$

This equation defines \(\tau_n=y(t_{n+1})-y(t_n)-h f(y(t_n))\), the one-step defect when the exact solution is used as the starting value. Subtract the Euler update \(Y_{n+1}=Y_n+h f(Y_n)\) from both sides:

$$ \begin{aligned} e_{n+1} &=y(t_{n+1})-Y_{n+1}\\ &=y(t_n)+h f(y(t_n))+\tau_n-Y_n-h f(Y_n)\\ &=e_n+h\bigl(f(y(t_n))-f(Y_n)\bigr)+\tau_n. \end{aligned} $$

This identity shows two sources of discrepancy: the existing error affects the next rate, and a new one-step defect is introduced. Consequently, the final difference is not merely one local error; errors from successive steps interact as the calculation proceeds. The earlier material on Euler error explains why, under suitable smoothness conditions, the global error commonly scales in proportion to the step size. The exact size and direction of the error still depend on the particular solution and the time being considered.

Worked Example: Four Euler Steps and the Exact Value

Worked Example: Four Euler Steps and the Exact Value

Use \(K=100\), \(r=0.5\), \(y(0)=20\), and \(h=0.25\) to estimate the population at \(t=1\). Compare the Euler estimate with the explicit logistic value and find the absolute error.

The step times are \(0,\ 0.25,\ 0.50,\ 0.75,\ 1.00\), so four updates reach the target. In this example, the Euler update is

$$ Y_{n+1}=Y_n+0.125Y_n\left(1-\frac{Y_n}{100}\right). $$

Starting from \(Y_0=20\), the first increment is

$$ 0.125(20)(1-0.20)=0.125(20)(0.80)=2, \qquad Y_1=20+2=22. $$

The second increment is

$$ 0.125(22)(1-0.22)=0.125(22)(0.78)=2.145, \qquad Y_2=22+2.145=24.145. $$

The third increment is

$$ 0.125(24.145)(1-0.24145) =0.125(24.145)(0.75855) =2.28939871875, $$

so \(Y_3=24.145+2.28939871875=26.43439871875\). The fourth increment is

$$ 0.125(26.43439871875)(1-0.2643439871875) =2.4308280453\text{ (approximately)}. $$

Thus the four increments sum to approximately \(8.8652267641\), and

$$ Y_4=20+8.8652267641\approx28.8652267641. $$

Now evaluate the exact solution at \(t=1\). Since \(\frac{K-y_0}{y_0}=\frac{80}{20}=4\),

$$ y(1)=\frac{100}{1+4e^{-0.5}} \approx\frac{100}{1+2.4261226389} \approx29.1875133. $$

The signed error is \(29.1875133-28.8652267641\approx0.3222865\). The absolute error is therefore about \(0.3223\) population units. The positive signed error confirms that the Euler estimate is below the exact value. Both numbers refer to \(t=1\), so this is a valid matched-time comparison.

Worked Example: What Happens When the Step Size Changes?

Worked Example: What Happens When the Step Size Changes?

Keep the same logistic model and target time \(t=1\), but compare step sizes \(h=1\), \(h=0.5\), and \(h=0.25\). The exact value, calculated above, is approximately \(29.1875133\).

With \(h=1\), one update gives

$$ Y_1=20+1(0.5)(20)(0.80)=20+8=28. $$

The absolute error is \(|29.1875133-28|=1.1875133\), or approximately \(1.1875\) population units.

With \(h=0.5\), the first update is

$$ Y_1=20+0.5(0.5)(20)(0.80)=20+4=24. $$

The second update is

$$ Y_2=24+0.5(0.5)(24)(0.76) =24+4.56=28.56. $$

This reaches \(t=1\), and its absolute error is \(|29.1875133-28.56|=0.6275133\), or approximately \(0.6275\) population units.

For \(h=0.25\), the four-step result is \(28.8652267641\), with absolute error approximately \(0.3223\) population units. The results are:

Step sizeEuler estimate at \(t=1\)Absolute error
\(1\)\(28\)\(1.1875\)
\(0.5\)\(28.56\)\(0.6275\)
\(0.25\)\(28.8652\)\(0.3223\)

For this model and target time, halving the step size reduces the absolute error each time. It does not divide the error by exactly two: the ratios vary because Euler’s errors accumulate along a changing nonlinear trajectory.

Worked Example: Testing an Accuracy Requirement

Worked Example: Testing an Accuracy Requirement

Suppose the estimate at \(t=1\) must be within \(0.35\) population units of the exact logistic prediction for the same model. Which of the three step sizes in the comparison satisfies this requirement?

The requirement is that the absolute error be at most \(0.35\). For \(h=1\), the error is approximately \(1.1875\), and \(1.1875>0.35\), so this step size fails. For \(h=0.5\), the error is approximately \(0.6275\), and \(0.6275>0.35\), so this step size also fails. For \(h=0.25\), the error is approximately \(0.3223\), and \(0.3223<0.35\), so it meets the requirement.

Therefore, among these tested choices, \(h=0.25\) is adequate. This conclusion applies to the stated model, target time, and tolerance. It does not establish that the same step size is adequate for a different model or a different target time.

If an error requirement is given as a percentage instead, calculate relative percent error using the exact value as the denominator. For \(h=0.25\), for example, it is approximately

$$ \frac{0.3222865}{29.1875133}\times100\% \approx1.1042\%. $$

An absolute tolerance and a relative tolerance answer different questions. An absolute tolerance sets a fixed population-unit difference; a relative tolerance measures the discrepancy as a fraction of the exact prediction.

A Common Pitfall: Mixing Up the Increments and Their Sum

A multi-step Euler calculation should be checked by adding all of its increments to the starting value. In the four-step example, the increments are approximately \(2\), \(2.145\), \(2.28939871875\), and \(2.4308280453\). Their sum is approximately \(8.8652267641\), not \(6.8652267641\). Therefore the final estimate is \(20+8.8652267641\approx28.8652267641\).

A wrong calculation would report the increment sum as \(6.8652267641\) and then write \(20+6.8652267641=28.8652267641\). The addition is false: the left side is \(26.8652267641\). The correction is to sum the four increments carefully, then add that sum to \(Y_0\). A second check is to confirm that every update begins with the preceding estimate and that the final estimate is compared with the exact value at the same time.

Interpreting a Comparison Carefully

A numerical comparison is informative, but it has limits. The exact logistic value is exact for the stated differential-equation model; it is not automatically an exact description of a real population. Any mismatch between a real population and the model may be larger than the Euler error. Also, a single matched-time comparison measures accuracy at that time, not at every intermediate time.

Smaller steps often improve Euler accuracy for a smooth solution, consistent with the first-order global error behavior studied earlier. However, it is not safe to claim that the error must decrease monotonically for every step-size change and every target. The signed errors can change direction, and errors from separate steps can reinforce or partly cancel. When accuracy matters, compute the error at the target time for the chosen model, or compare against an explicit solution when one is available.

The practical procedure is straightforward: calculate the Euler estimate using the chosen step size, evaluate the exact formula at the matching time, subtract in a stated order, and compare the resulting absolute or relative error with the required tolerance. Keep enough digits during the intermediate steps, then round only the reported final values.

Check Your Understanding

Use matched times and keep signed and absolute error distinct as you answer.

  1. For \(K=100\), \(r=0.5\), and \(y(0)=20\), what time is reached after three Euler steps of size \(0.2\)?
  2. If the exact population is \(42\) and the Euler estimate is \(40.5\), what are the signed error and absolute error under the convention used here?
  3. Why must the exact logistic value and Euler estimate be evaluated at the same time before their difference is interpreted as numerical error?
  4. For the example with target time \(t=1\), which tested step sizes satisfy an absolute-error tolerance of \(0.65\) population units?
  5. Why does a smaller step size often improve Euler accuracy without guaranteeing that every particular error comparison will follow a perfectly regular pattern?

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon