Euler’s Method for Solving Differential Equations | 欧拉方法求解微分方程

📚 Euler’s Method for Solving Differential Equations | 欧拉方法求解微分方程

Many differential equations cannot be solved exactly, so we need numerical methods to approximate the solution. Euler’s Method is the simplest and most fundamental numerical technique for estimating the value of a function when only its derivative and an initial condition are known.

许多微分方程无法精确求解,因此我们需要数值方法去逼近解。欧拉方法是最简单、最基础的数值技术,用于在仅知道导数和一个初始条件时,估计函数的值。


1. The Basic Idea | 基本思想

Suppose we have a first-order differential equation of the form dy/dx = f(x, y), with the initial condition y(x₀) = y₀. We want to find y at some later point x = xₙ.

假设我们有一阶微分方程 dy/dx = f(x, y),初始条件为 y(x₀) = y₀。我们想要求出 y 在稍后某点 x = xₙ 处的值。

The key idea is to replace the smooth curve of the true solution by a sequence of short straight-line segments. Each segment follows the tangent direction given by the differential equation at the current point.

其核心思想是用一系列短的直线段替换真实解的平滑曲线。每一段都沿着微分方程在当前点所给出的切线方向前进。

This is exactly the same logic as linear approximation: for a small step Δx, the change in y is approximately the derivative times Δx.

这与线性逼近的逻辑完全相同:当步长 Δx 很小时,y 的变化量近似等于导数乘以 Δx。


2. The Euler Formula | 欧拉公式

Starting from the definition of the derivative, we can write:

dy/dx ≈ Δy / Δx

Rearranging gives the Euler update rule:

yₙ₊₁ = yₙ + h · f(xₙ, yₙ)

Here h = Δx is the step size, xₙ₊₁ = xₙ + h, and f(xₙ, yₙ) is the slope of the solution at the current point.

在这里 h = Δx 是步长,xₙ₊₁ = xₙ + h,而 f(xₙ, yₙ) 是解在当前点的斜率。

This formula tells us: take the current y value, add the approximate change in y over the interval. The approximate change is slope × step width.

这个公式告诉我们:取当前的 y 值,加上该区间内 y 的近似变化量。近似变化量等于斜率乘以步长宽度。


3. Step Size and Notation | 步长与记号

The step size h is usually chosen as a fixed positive number. If we want to move from x₀ to a target value X using n steps, then h = (X − x₀) / n.

步长 h 通常选为一个固定的正数。如果我们想从 x₀ 用 n 步移动到目标值 X,那么 h = (X − x₀) / n。

The points are labelled as follows:

  • x₀, x₁ = x₀ + h, x₂ = x₀ + 2h, …, xₙ = x₀ + nh
  • Corresponding approximations: y₀, y₁, y₂, …, yₙ

Each y value is an approximation, not the exact solution. The notation ŷ is sometimes used to distinguish approximation from exact solution, but in most exam papers yₙ is used directly.

每个 y 值都是近似值,而不是精确解。有时用 ŷ 来区分近似值与精确解,但大多数考试卷中直接使用 yₙ。


4. Worked Example: dy/dx = x + y | 实例解析:dy/dx = x + y

Let us apply Euler’s Method to the differential equation dy/dx = x + y, with y(0) = 1, using step size h = 0.5, to estimate y(1).

让我们对微分方程 dy/dx = x + y 应用欧拉方法,已知 y(0) = 1,取步长 h = 0.5,来估计 y(1)。

Here f(x, y) = x + y. We start at x₀ = 0, y₀ = 1.

这里 f(x, y) = x + y。我们从 x₀ = 0, y₀ = 1 开始。

Step 1: At (0, 1), slope = f(0, 1) = 0 + 1 = 1. So the change in y is approximately h × 1 = 0.5. Thus y₁ = 1 + 0.5 = 1.5, and x₁ = 0.5.

第 1 步:在 (0, 1) 处,斜率 = f(0, 1) = 0 + 1 = 1。因此 y 的变化量约为 h × 1 = 0.5。于是 y₁ = 1 + 0.5 = 1.5,x₁ = 0.5。

Step 2: At (0.5, 1.5), slope = f(0.5, 1.5) = 0.5 + 1.5 = 2.0. Change = 0.5 × 2.0 = 1.0. So y₂ = 1.5 + 1.0 = 2.5, and x₂ = 1.0.

第 2 步:在 (0.5, 1.5) 处,斜率 = f(0.5, 1.5) = 0.5 + 1.5 = 2.0。变化量 = 0.5 × 2.0 = 1.0。所以 y₂ = 1.5 + 1.0 = 2.5,x₂ = 1.0。

Therefore Euler’s Method gives y(1) ≈ 2.5 for this example.

因此在这个例子中,欧拉方法给出 y(1) ≈ 2.5。


5. Tabulating the Approximation | 用表格进行近似计算

For a clear and organised solution, especially in exams, always construct a table. The table below shows the calculation above in full.

为了清晰、有条理地解题,尤其是在考试中,一定要列表。下表完整展示了上述计算过程。

n xₙ yₙ f(xₙ, yₙ) = xₙ + yₙ h · f(xₙ, yₙ) yₙ₊₁
0 0 1 1 0.5 1.5
1 0.5 1.5 2.0 1.0 2.5

Always label columns and show the formula yₙ₊₁ = yₙ + h · f(xₙ, yₙ) at the top of your table. This helps examiners follow your method.

始终要标清列名,并在表格顶部写出公式 yₙ₊₁ = yₙ + h · f(xₙ, yₙ)。这能帮助阅卷人看清你的方法。


6. Error Analysis | 误差分析

Euler’s Method is a first-order method. This means that for one step, the local error is proportional to h². Over a fixed interval, the global error is proportional to h.

欧拉方法是一阶方法。这意味着对单步而言,局部误差与 h² 成正比。在固定区间上,全局误差与 h 成正比。

If we halve the step size, the error typically becomes about half as large. In other words:

如果我们把步长减半,误差通常也会减小到大约一半。也就是说:

Global error ≈ C · h

where C is a constant that depends on the differential equation and the interval.

其中 C 是一个依赖于微分方程和区间的常数。

Two types of error exist: truncation error (from cutting off the Taylor series) and round-off error (from computing with limited decimal places). Truncation error dominates when h is not too small.

存在两类误差:截断误差(来自截断泰勒级数)和舍入误差(来自有限小数位计算)。当 h 不太小时,截断误差占主导。


7. Stability and Choosing h | 稳定性与步长选择

Choosing h is a trade-off. A smaller h gives better accuracy but requires more steps, which means more computation and potentially more round-off error.

选择 h 是一个权衡。较小的 h 能带来更高的精度,但需要更多步数,这意味着更多计算量,也可能引入更多舍入误差。

Euler’s Method can become unstable if h is too large, particularly when the derivative involves steep or rapidly changing slopes. In such cases the numerical solution may oscillate wildly or grow without bound.

如果 h 过大,欧拉方法可能变得不稳定,尤其是当导数包含陡峭或快速变化的斜率时。在这种情况下,数值解可能会剧烈振荡或无界增长。

As a general rule, try reducing h by half and comparing the results. If the two approximations differ significantly, choose a smaller h. If they are close, the solution has probably converged.

一般的做法是:尝试把 h 减半并比较结果。如果两个近似值差异很大,就选择更小的 h;如果它们很接近,则解很可能已经收敛。


8. Improved Euler Method (Heun’s Method) | 改进欧拉法(休恩法)

To improve accuracy without using a very small h, we can average two slopes instead of using only the slope at the left endpoint. This is called the Improved Euler Method or Heun’s Method.

为了不用非常小的 h 也能提高精度,我们可以取两个斜率的平均值,而不是只用左端点的斜率。这被称为改进欧拉法或休恩法。

The algorithm is:

k₁ = f(xₙ, yₙ)

k₂ = f(xₙ + h, yₙ + h · k₁)

yₙ₊₁ = yₙ + (h / 2) · (k₁ + k₂)

This method is second-order, so its global error is proportional to h². It requires two slope evaluations per step, but the gain in accuracy is usually worth the extra work.

该方法是二阶方法,因此其全局误差与 h² 成正比。它每步需要计算两次斜率,但精度上的提升通常值得额外的计算量。

In A-Level exams, Euler’s Method is the main requirement, but candidates are sometimes asked to comment on how to improve accuracy. Mentioning Heun’s Method can earn credit.

在 A-Level 考试中,欧拉方法是主要要求,但也可能要求考生说明如何提高精度。提到休恩法可以获得分数。


9. Comparison: Euler’s Method vs Analytical Solution | 欧拉法与解析解对比

Consider the same example dy/dx = x + y, y(0) = 1. This equation has an exact solution. Separating variables is not straightforward, but using the integrating factor method gives:

考虑同一个例子 dy/dx = x + y,y(0) = 1。这个方程有精确解。虽然不能直接分离变量,但使用积分因子法可以得到:

y(x) = 2eˣ − x − 1

At x = 1, the exact value is y(1) = 2e − 2 ≈ 3.4366. Euler’s Method with h = 0.5 gave 2.5, which is an underestimate.

在 x = 1 处,精确值为 y(1) = 2e − 2 ≈ 3.4366。欧拉方法在 h = 0.5 时给出 2.5,这是一个低估。

If we halve the step size to h = 0.25, Euler’s Method gives approximately 2.9062. The error dropped from 0.9366 to 0.5304, roughly by half, confirming the first-order error behaviour.

如果把步长减半为 h = 0.25,欧拉方法给出约 2.9062。误差从 0.9366 降到 0.5304,大致减半,证实了一阶误差的行为。

This comparison shows that Euler’s Method is easy to apply but not very accurate for large h. It is best used for quick estimates or as a starting point for more advanced methods.

这种对比表明欧拉方法易于应用,但大步长时不够精确。它最适合用于快速估算,或作为更高级方法的起点。


10. Geometric Interpretation | 几何意义

Graphically, Euler’s Method constructs a polygonal curve that follows the direction field of the differential equation. The exact solution is a smooth curve, while the numerical approximation is a series of straight line segments.

在图形上,欧拉方法构造出一条沿着微分方程方向场的折线。精确解是一条光滑曲线,而数值近似是一系列直线段。

At each point (xₙ, yₙ), the slope of the next segment equals f(xₙ, yₙ). The segment is drawn from xₙ to xₙ₊₁, and then the slope is recalculated at the new point.

在每个点 (xₙ, yₙ) 处,下一段的斜率等于 f(xₙ, yₙ)。从 xₙ 到 xₙ₊₁ 画线段,然后在新点重新计算斜率。

If the true solution is curving upward (second derivative positive), Euler’s Method usually underestimates the value. If the true solution is curving downward, it usually overestimates.

如果真实解是向上弯曲的(二阶导数为正),欧拉方法通常会低估其值。如果真实解是向下弯曲的,它通常会高估。


11. Common Mistakes and Exam Tips | 常见错误与考试技巧

Below are the most frequent errors students make when using Euler’s Method, along with practical advice.

以下是学生在使用欧拉方法时最常犯的错误,以及实用建议。

  • Using the wrong formula: Remember yₙ₊₁ = yₙ + h · f(xₙ, yₙ). Do not include extra terms unless you are using an improved version.
  • 错误使用公式:记住 yₙ₊₁ = yₙ + h · f(xₙ, yₙ)。除非你用的是改进版方法,否则不要包含额外项。
  • Updating x incorrectly: Always add h to xₙ to get xₙ₊₁. Do not jump by 1 or by the target interval.
  • x 更新错误:始终用 xₙ 加上 h 得到 xₙ₊₁。不要按 1 或目标区间跳跃。
  • Forgetting the initial condition: The value y₀ at x₀ is given. Use it as the starting row of your table.
  • 忘记初始条件:x₀ 处的 y₀ 是已知的。把它作为表格的起始行。
  • Rounding too early: Keep at least 4 decimal places during the calculation, then round the final answer as required.
  • 过早四舍五入:计算过程中至少保留 4 位小数,最后再按题目要求取近似值。
  • Not checking the target x: Ensure that the number of steps n makes x₀ + n·h exactly equal to the required target value.
  • 未检查目标 x:确保步数 n 使得 x₀ + n·h 恰好等于所需的目标值。

12. Summary | 总结

Euler’s Method is a foundational numerical technique for approximating solutions to first-order differential equations. Its formula is simple, but it has first-order accuracy, meaning errors decrease linearly with step size.

欧拉方法是求解一阶微分方程近似解的基础数值技术。它的公式非常简单,但只有一阶精度,这意味着误差随步长线性减小。

To apply it successfully in exams, always set up a clear table, use the correct update rule, and choose a reasonable step size. For better accuracy, consider the Improved Euler Method.

要想在考试中成功应用它,请始终建立清晰的表格,使用正确的更新规则,并选择合理的步长。如需更高精度,可考虑改进欧拉法。

Mastering Euler’s Method provides essential intuition for numerical analysis and forms a bridge to more advanced techniques such as Runge–Kutta methods.

掌握欧拉方法能为数值分析提供重要的直觉,并为 Runge–Kutta 等更高级的方法架起桥梁。


Published by TutorHao | Mathematics Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading