Euler’s Method | 欧拉方法

📚 Euler’s Method | 欧拉方法

Many differential equations that model real-world phenomena cannot be solved analytically using elementary functions. In such cases, numerical methods provide approximate solutions by stepping through the independent variable. Euler’s method, named after Leonhard Euler, is the simplest and most intuitive numerical procedure for solving first-order ordinary differential equations. It lays the foundation for more advanced techniques and is a central topic in IB Mathematics analysis and approaches, as well as applications and interpretation courses. Understanding Euler’s method not only strengthens your grasp of differential equations but also develops computational thinking and appreciation for the balance between accuracy and efficiency.

许多描述现实世界现象的微分方程无法用初等函数解析求解。此时,数值方法通过逐步推进自变量来给出近似解。以莱昂哈德·欧拉命名的欧拉方法是求解一阶常微分方程最简单、最直观的数值方法。它为更高级的技巧奠定了基础,也是IB数学分析与方法和应用与解释课程的核心主题。理解欧拉方法不仅能加深你对微分方程的认识,还能培养计算思维,让你体会精度与效率之间的权衡。

1. Introduction to Numerical Methods | 数值方法简介

When faced with an initial value problem (IVP) of the form dy/dx = f(x, y), y(x₀) = y₀, we often first try to find an explicit solution through integration or known techniques. However, many equations, such as dy/dx = e⁻ˣ² or the logistic equation with varying parameters, resist closed-form solutions. Numerical methods step in to construct a table of approximate y-values at discrete x-points. They transform a continuous problem into a discrete recursive process, enabling computations by hand or with a spreadsheet. The goal is to obtain a sequence y₁, y₂, … that approximates the true solution y(x₁), y(x₂), … at equally spaced steps of size h.

当面对形如 dy/dx = f(x, y),y(x₀) = y₀ 的初值问题(IVP)时,我们通常会先尝试通过积分或已知方法求显式解。然而,许多方程,例如 dy/dx = e⁻ˣ² 或带有变化参数的逻辑斯谛方程,都无法用封闭形式求解。数值方法介入其中,在离散的 x 点处构建近似 y 值的表格。它们将连续问题转化为离散的递推过程,方便手算或使用电子表格完成。目标是得到一个序列 y₁, y₂, …,在等步长 h 的各点处逼近真实解 y(x₁), y(x₂), …。

2. The Concept of Euler’s Method | 欧拉方法的基本概念

Euler’s method approximates the solution curve by a sequence of short line segments. Starting from the known initial point (x₀, y₀), we use the differential equation to determine the slope at that point, namely f(x₀, y₀). We then take a small step of length h along the tangent line, arriving at a new point (x₁, y₁). Repeating this process generates a polygonal path that follows the direction field. The method is essentially a first-order Taylor approximation: it assumes that the slope stays approximately constant over each tiny interval. This simplicity makes it an excellent teaching tool and a starting point for understanding more sophisticated solvers.

欧拉方法用一系列短线段来近似解曲线。从已知初始点 (x₀, y₀) 出发,我们利用微分方程确定该点处的斜率,即 f(x₀, y₀)。然后沿着切线方向走一小步,步长为 h,到达新点 (x₁, y₁)。重复这一过程就生成了一条跟随方向场的折线。该方法本质上是一阶泰勒近似:它假设在每个微小区间上斜率大体保持恒定。这种简单性使其成为优秀的教学工具和理解更精密求解器的起点。

3. Derivation of Euler’s Formula | 欧拉公式的推导

Consider the initial value problem dy/dx = f(x, y), with y(x₀) = y₀. By the definition of the derivative, for a small increment h we have:

y(x₀ + h) − y(x₀) / h ≈ dy/dx at x₀

Multiplying by h and using the given derivative gives y(x₀ + h) ≈ y(x₀) + h·f(x₀, y(x₀)). This suggests the recursive rule:

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

Starting with the initial condition at n = 0, we can compute y₁, y₂, and so forth. The formula is extremely easy to implement, requiring only the evaluation of the function f at each step. Notice that the method is explicit: y₍ₙ₊₁₎ appears only on the left-hand side, allowing direct computation without solving equations.

考虑初值问题 dy/dx = f(x, y),且 y(x₀) = y₀。根据导数的定义,对于很小的增量 h,我们有:

y(x₀ + h) − y(x₀) / h ≈ 在 x₀ 处的 dy/dx

两边同乘 h 并代入已知导数,得到 y(x₀ + h) ≈ y(x₀) + h·f(x₀, y(x₀))。这就引出了递推公式:

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

从 n = 0 的初始条件出发,我们可以依次计算出 y₁, y₂ 等。该公式极易于实施,每一步只需计算函数 f 的值。注意该方法是显式的:y₍ₙ₊₁₎ 仅出现在左边,无需解方程即可直接计算。


4. Geometrical Interpretation | 几何解释

Geometrically, Euler’s method follows the tangent line from the current point to approximate the curve over the next step. If we plot the true solution and the Euler approximation, the latter appears as a broken line that diverges gradually from the true curve. At each grid point, the local slope f(xₙ, yₙ) is drawn, and the next point lies on that tangent. The error incurred over a single step is called the local truncation error, while the accumulated deviation over many steps is the global error. The method’s geometrical nature helps visualise why smaller step sizes lead to more accurate results: the tangents better cling to the curve when the steps are short.

从几何上看,欧拉方法沿着当前点的切线前进,以此近似下一步的曲线。如果画出真实解和欧拉近似,后者表现为一条逐渐偏离真实曲线的折线。在每个网格点,绘制局部斜率 f(xₙ, yₙ),下一个点就位于该切线上。单步产生的误差称为局部截断误差,而多步累积的偏差称为全局误差。这一几何直观有助于理解为何步长越小结果越精确:步长越短,切线越贴近曲线。


5. Algorithm and Step-by-Step Procedure | 算法与分步过程

The Euler algorithm can be summarised in a few simple steps. First, identify the differential equation in the form dy/dx = f(x, y) and the initial condition (x₀, y₀). Choose a step size h and the number of steps N. Then, for n = 0, 1, 2, …, N − 1, do the following:

  • Compute the slope: k₁ = f(xₙ, yₙ).
  • Update x: x₍ₙ₊₁₎ = xₙ + h.
  • Update y: y₍ₙ₊₁₎ = yₙ + h·k₁.

Record the values in a table for further analysis. It is often convenient to set up a spreadsheet with columns for n, xₙ, yₙ, f(xₙ, yₙ), and the next y. The algorithm can be adapted for systems of equations or higher-order equations by rewriting them as a system of first-order ODEs.

欧拉算法可以归纳为几个简单步骤。首先,将微分方程整理成 dy/dx = f(x, y) 的形式,并确定初始条件 (x₀, y₀)。选取步长 h 和步数 N。然后,对 n = 0, 1, 2, …, N − 1 执行以下操作:

  • 计算斜率:k₁ = f(xₙ, yₙ)。
  • 更新 x:x₍ₙ₊₁₎ = xₙ + h。
  • 更新 y:y₍ₙ₊₁₎ = yₙ + h·k₁。

将数值记录在表格中以便后续分析。在电子表格中设置列,分别记录 n、xₙ、yₙ、f(xₙ, yₙ) 及下一个 y 会非常方便。该算法可通过将高阶方程写成一阶 ODE 系统,来应用于方程组或高阶方程。


6. Example 1: A Simple Differential Equation | 例1:一个简单的微分方程

Take the IVP dy/dx = x + y, with y(0) = 1. The exact solution is y = 2eˣ − x − 1. Let us apply Euler’s method with step size h = 0.1 to approximate y(0.5). We start at x₀ = 0, y₀ = 1.

  • Step 0: f(0,1)=0+1=1 → y₁ = 1 + 0.1×1 = 1.1, x₁=0.1.
  • Step 1: f(0.1,1.1)=0.1+1.1=1.2 → y₂ = 1.1 + 0.1×1.2 = 1.22, x₂=0.2.
  • Step 2: f(0.2,1.22)=1.42 → y₃ = 1.22 + 0.142 = 1.362, x₃=0.3.
  • Step 3: f(0.3,1.362)=1.662 → y₄ = 1.362 + 0.1662 = 1.5282, x₄=0.4.
  • Step 4: f(0.4,1.5282)=1.9282 → y₅ = 1.5282 + 0.19282 = 1.72102, x₅=0.5.

The exact y(0.5) = 2e⁰·⁵ − 0.5 − 1 ≈ 2×1.64872 − 1.5 = 1.79744. Our Euler estimate of 1.72102 has an error of about 0.076. Decreasing h reduces this error, as we shall see.

考虑初值问题 dy/dx = x + y,且 y(0) = 1。精确解为 y = 2eˣ − x − 1。我们取步长 h = 0.1,用欧拉方法近似 y(0.5)。从 x₀ = 0, y₀ = 1 开始。

  • 第0步:f(0,1)=0+1=1 → y₁ = 1 + 0.1×1 = 1.1, x₁=0.1。
  • 第1步:f(0.1,1.1)=0.1+1.1=1.2 → y₂ = 1.1 + 0.1×1.2 = 1.22, x₂=0.2。
  • 第2步:f(0.2,1.22)=1.42 → y₃ = 1.22 + 0.142 = 1.362, x₃=0.3。
  • 第3步:f(0.3,1.362)=1.662 → y₄ = 1.362 + 0.1662 = 1.5282, x₄=0.4。
  • 第4步:f(0.4,1.5282)=1.9282 → y₅ = 1.5282 + 0.19282 = 1.72102, x₅=0.5。

精确值 y(0.5) = 2e⁰·⁵ − 0.5 − 1 ≈ 2×1.64872 − 1.5 = 1.79744。我们的欧拉估计值 1.72102 约有 0.076 的误差。减小步长将降低该误差,下文会看到。


7. Example 2: Logistic Growth Model | 例2:逻辑斯谛增长模型

Consider the logistic differential equation dP/dt = 0.8P(1 − P/1000) with initial population P(0) = 100. This models population growth with a carrying capacity of 1000. There is an analytic solution, but it is instructive to apply Euler’s method. With h = 0.5 (time in years), we compute:

  • t₀=0, P₀=100 → slope = 0.8×100×(1 − 0.1) = 72.
  • P₁ = 100 + 0.5×72 = 136, t₁=0.5.
  • t₁=0.5, P₁=136 → slope = 0.8×136×(1 − 0.136) ≈ 93.97.
  • P₂ = 136 + 0.5×93.97 = 182.985, t₂=1.0.

Continuing this process yields an S-shaped curve. The method captures the qualitative behaviour well, but quantitative accuracy demands smaller h, especially near the inflection point where the derivative changes rapidly.

考虑逻辑斯谛微分方程 dP/dt = 0.8P(1 − P/1000),初始人口 P(0) = 100。该模型描述具有环境容纳量 1000 的人口增长。虽然存在解析解,但应用欧拉方法依然很有启发性。取 h = 0.5(时间单位:年),我们计算:

  • t₀=0, P₀=100 → 斜率 = 0.8×100×(1 − 0.1) = 72。
  • P₁ = 100 + 0.5×72 = 136, t₁=0.5。
  • t₁=0.5, P₁=136 → 斜率 = 0.8×136×(1 − 0.136) ≈ 93.97。
  • P₂ = 136 + 0.5×93.97 = 182.985, t₂=1.0。

继续此过程会得到一条 S 形曲线。该方法很好地捕捉了定性行为,但若要获得定量准确性,则需要更小的步长,特别是在导数快速变化的拐点附近。


8. Error Analysis: Local and Global Errors | 误差分析:局部误差与全局误差

The local truncation error in one step of Euler’s method is the error introduced by the approximation that assumes constant derivative over the interval. Using Taylor’s theorem, the true solution satisfies y(xₙ₊₁) = y(xₙ) + h·y'(xₙ) + (h²/2)·y”(ξₙ) for some ξₙ between xₙ and xₙ₊₁. Since Euler’s method omits the (h²/2)·y” term, the local error per step is approximately proportional to h². Therefore, if we halve the step size, the local error reduces by a factor of four. However, the global error after N = (b−a)/h steps accumulates, leading to an overall error roughly proportional to h. This makes Euler’s method a first-order method: converge rate is O(h).

欧拉方法单步的局部截断误差是因近似假设导数在区间上恒定而引入的误差。运用泰勒定理,真实解满足 y(xₙ₊₁) = y(xₙ) + h·y'(xₙ) + (h²/2)·y”(ξₙ),其中 ξₙ 位于 xₙ 与 xₙ₊₁ 之间。由于欧拉方法省略了 (h²/2)·y” 项,每一步的局部误差大致与 h² 成正比。因此,若步长减半,局部误差将降为原来的四分之一。然而,经过 N = (b−a)/h 步后的全局误差会累积,导致总误差大致与 h 成正比。这使得欧拉方法为一阶方法:收敛速率为 O(h)。


9. Effect of Step Size on Accuracy | 步长对精度的影响

The step size h is a crucial parameter. To illustrate, let us revisit Example 1 and compute y(0.5) using different step sizes:

Step Size h Euler Approximation y(0.5) Absolute Error
0.5 2.0 0.203
0.1 1.721 0.076
0.05 1.761 0.037
0.01 1.791 0.006

The error decreases roughly linearly with h, consistent with a first-order method. In IB investigations, students often explore this relationship by plotting log(error) against log(h) to estimate the order of the method.

步长 h 是一个关键参数。为举例说明,我们回到例1,用不同步长计算 y(0.5):

步长 h 欧拉近似值 y(0.5) 绝对误差
0.5 2.0 0.203
0.1 1.721 0.076
0.05 1.761 0.037
0.01 1.791 0.006

误差随 h 的减小大致线性下降,这与一阶方法一致。在 IB 的探究中,学生常常通过绘制 log(误差) 对 log(h) 的图形来估计方法的阶数。


10. Advantages and Limitations | 优点与局限性

Euler’s primary advantage is its conceptual clarity and ease of implementation. It requires only one function evaluation per step and works directly from the direction field. This makes it ideal for quick sketches and introductory lessons. However, its low order of accuracy means that very small step sizes are needed for precise results, which increases computational cost and round-off error. Additionally, Euler’s method can exhibit instability for certain stiff equations, where the solution contains rapidly decaying components. For more demanding problems, higher-order methods like the improved Euler method (Heun’s method) or the classical Runge-Kutta method are preferred.

欧拉方法的主要优势在于概念清晰且易于实施。每一步只需计算一次函数值,并直接从方向场出发。这使其非常适合于快速勾画和入门教学。然而,其低阶精度意味着要得到精确结果需要非常小的步长,这会增加计算成本并放大舍入误差。此外,欧拉方法对于某些刚性问题(解中含有快速衰减成分)可能表现出不稳定性。对于要求更高的问题,通常会优先选用改进欧拉方法(海恩法)或经典龙格-库塔法等高阶方法。


11. Beyond Euler: Improved Methods | 超越欧拉:改进方法

To enhance Euler’s method, we can incorporate slope information from within the interval. The improved Euler method (also called Heun’s method) uses an average of the slope at the beginning and the slope at the end of the step predicted by Euler. Its formula is:

y₍ₙ₊₁₎ = yₙ + (h/2)[f(xₙ, yₙ) + f(xₙ₊₁, yₙ + h f(xₙ, yₙ))]

This method has local error O(h³) and global error O(h²), making it a second-order method. The popular fourth-order Runge-Kutta method (RK4) provides even greater accuracy with four slope evaluations per step, yielding global error O(h⁴). These methods are natural extensions studied in numerical analysis and often touched upon in IB explorations.

为进一步完善欧拉方法,我们可以引入区间内部的斜率信息。改进欧拉方法(亦称海恩法)采用了初始斜率和由欧拉预测的区间末端斜率的平均值。其公式为:

y₍ₙ₊₁₎ = yₙ + (h/2)[f(xₙ, yₙ) + f(xₙ₊₁, yₙ + h f(xₙ, yₙ))]

该方法的局部误差为 O(h³),全局误差为 O(h²),因此是二阶方法。广泛使用的四阶龙格-库塔法(RK4)每步使用四次斜率计算,能达到 O(h⁴) 的全局误差,精度更高。这些方法都是数值分析中的自然延伸,在 IB 的探究作业中也经常涉及。


12. Applications in IB Mathematics and Beyond | 在IB数学及更广领域的应用

In the IB curriculum, Euler’s method appears in the context of calculus and differential equations, often assessed through questions that require setting up a table of approximations and interpreting the results. Students might use their graphical calculators or spreadsheets to implement the method and investigate the relationship between step size and accuracy. Beyond the syllabus, Euler’s method is the progenitor of countless numerical solvers used in physics, engineering, biology, and finance. Simulating planetary orbits, modelling the spread of a virus, or pricing financial derivatives all rely on the fundamental idea of stepping through differential equations—an idea whose seed was planted by Euler over 250 years ago.

在 IB 课程中,欧拉方法出现在微积分与微分方程的内容里,常以要求学生建立近似值表格并解读结果的题目进行考查。学生可以使用图形计算器或电子表格来实现该方法,并探究步长与精度之间的关系。超纲来看,欧拉方法是物理学、工程学、生物学和金融学中无数数值求解器的鼻祖。模拟行星轨道、建立病毒传播模型或金融衍生品定价,都依赖着通过微分方程逐步推进的基本思想——而这一思想的种子早在 250 多年前便由欧拉种下。

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