跳到主要内容

数值方法

AQA A-Level 数学知识点 9

本主题的视频课程 打开视频页面
7:16

数值方法

I 部分是数值方法,用于处理无法用代数方法求解的方程和积分。连续函数的符号变化可以用来确定根的位置。迭代法和 Newton–Raphson 法可以逐步改进估计值。梯形法则则根据数值表估算定积分。

英文讲解 · 可切换中英文字幕

9.1

范围与先修条件

English

AQA A-level Mathematics 7357, section I (Numerical methods), version 1.3 (first assessment 2018). Original teaching notes.

Prerequisites: differentiation (section G) and definite integrals (section H).

These are original teaching examples, not official AQA material.

词汇 训练
English 中文 拼音
numerical method/njuːˈmerɪkl ˈmeθəd/ 数值方法 shù zhí fāng fǎ
9.2

Numerical methods 数值方法

English

When algebra cannot finish the job

Try to solve $x^3-x-1=0$ by factorising. It does not factorise, and there is no simple formula you can use. Or try to find $\int_0^1e^{-x^2}\,dx$ exactly: no one can, with the functions in this course. Engineers and computers meet problems like these every day. A numerical method gives an answer that is as accurate as you need, step by step. Every numerical answer should come with a check.

The curve y equals x cubed minus x minus 1 crossing the x-axis once, near 1.3247
A root that algebra cannot reach
Method What it does Rule
Sign change locates a root $f$ continuous and $f(a)$, $f(b)$ of opposite signs
Iteration 迭代 refines a root $x_{n+1}=g(x_n)$
Newton–Raphson 牛顿迭代 refines a root fast $x_{n+1}=x_n-\dfrac{f(x_n)}{f'(x_n)}$
Trapezium rule 梯形法则 estimates an integral $\frac h2\left[y_0+2(y_1+\dots+y_{n-1})+y_n\right]$

Locating a root by a change of sign

If $f$ is continuous 连续 on $[a,b]$, and $f(a)$ and $f(b)$ have opposite signs, then the graph must cross the axis between them. So there is a root in $(a,b)$.

Three panels: x cubed minus x minus 1 changes sign between 1 and 2 and has a root; 1 over x changes sign with no root because of the jump; x minus 1 squared has a root with no sign change
When a sign change works and when it misleads

Worked example. $f(x)=x^3-x-1$. Then $f(1)=-1<0$ and $f(2)=5>0$. $f$ is a polynomial, so it is continuous. So there is a root between 1 and 2.

When a sign change misleads.

  • A change but no root. $f(x)=\frac1x$ has $f(-1)=-1$ and $f(1)=1$. But the graph jumps at $x=0$ (an asymptote). $f$ is not continuous there, so the rule does not apply.
  • A root but no change. $f(x)=(x-1)^2$ has $f(0)=f(2)=1$. The repeated root at $x=1$ only touches the axis.
  • Two roots in one interval. Two sign changes cancel, so $f(a)$ and $f(b)$ can have the same sign even though two roots lie between them.

Bisection

Bisection 二分法 halves the interval each time. Find the midpoint, test its sign, and keep the half whose ends have opposite signs.

Interval Midpoint $m$ $f(m)$ Keep
$[1,2]$ $1.5$ $0.875$ $[1,1.5]$
$[1,1.5]$ $1.25$ $-0.297$ $[1.25,1.5]$
$[1.25,1.5]$ $1.375$ $0.225$ $[1.25,1.375]$
$[1.25,1.375]$ $1.3125$ $-0.0515$ $[1.3125,1.375]$

Each step halves the uncertainty. It is slow but it never fails, as long as $f$ is continuous.

Left: bisection on f(x) = x² − 2 with interval marks closing in on the root. Right: two trapezium strips on y = x² from 0 to 2
Bisection keeps the half with a sign change; two trapezia give 3, above the true 8/3, for this convex curve

Proving a root to a given accuracy

To show that a root is $1.3247$ to 4 decimal places, test the two rounding boundaries, $1.32465$ and $1.32475$.

$$f(1.32465)=-0.00029<0,\qquad f(1.32475)=0.00014>0.$$

There is a sign change and $f$ is continuous, so the root lies in $(1.32465,1.32475)$. Every number in that interval rounds to $1.3247$.

Common mistake. Testing $1.3247$ and $1.3248$. That shows a root between them, but the root could be $1.32478$, which rounds to $1.3248$.

Fixed-point iteration

Rearrange $f(x)=0$ into the form $x=g(x)$. Then start with $x_0$ and repeat $x_{n+1}=g(x_n)$.

Worked example. $x^3-x-1=0$ can be written $x=\sqrt[3]{x+1}$. With $x_0=1$:

$$x_1=1.2599,\quad x_2=1.3123,\quad x_3=1.3224,\quad x_4=1.3243,\quad\dots\to1.3247.$$

On a graph, the iteration moves between the curve $y=g(x)$ and the line $y=x$. When the steps go one way, it is a staircase diagram 阶梯图. When they spiral round the root, it is a cobweb diagram 蛛网图 (this happens when $g'(x)<0$).

Convergence. The same equation can also be written $x=x^3-1$. From $x_0=1.5$ this gives $2.375$, $12.40$, $1904$: it diverges. If $|g'(\alpha)|<1$ at a fixed point $\alpha$ and $g'$ is continuous near $\alpha$, the iteration converges 收敛 for starting values sufficiently close to $\alpha$.

Rearrangement $\lvert g'(1.3247)\rvert$ From $x_0=1.5$
$g(x)=\sqrt[3]{x+1}$ $0.19<1$ converges to $1.3247$
$g(x)=x^3-1$ $5.26>1$ $2.375$, $12.40$, $1904$: diverges

A limit $L$ must satisfy $L=g(L)$. Check it in the original equation.

Left: a staircase from x0 = 1 moving between y = cube root of (x + 1) and y = x towards the root 1.3247. Right: Newton–Raphson on y = x² − 2 from x0 = 2, the tangents meeting the x-axis at 1.5 and then 1.4167
Iteration climbs a staircase into the root where the curve meets y = x; each Newton–Raphson tangent lands on the axis at the next, better estimate

The Newton–Raphson method

Start at $x_0$. Draw the tangent to $y=f(x)$ there. Where it meets the $x$-axis is the next estimate:

The tangent to x cubed minus x minus 1 at x0 equals 1.5 meets the axis at x1 equals 1.3478, close to the root 1.3247
One Newton–Raphson step
$$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.$$

Worked example: $\sqrt2$. $f(x)=x^2-2$, $f'(x)=2x$, $x_0=2$:

$$2\;\to\;1.5\;\to\;1.4166667\;\to\;1.4142157\;\to\;1.4142136.$$

The number of correct digits roughly doubles each step.

Worked example. Use Newton–Raphson on $f(x)=x^3-x-1$ with $x_0=1.5$. Here $f'(x)=3x^2-1$.

$$x_1=1.5-\frac{0.875}{5.75}=1.347826,\qquad x_2=1.325200,\qquad x_3=1.324718.$$

Then the sign-change check, $f(1.32465)<0<f(1.32475)$, confirms $1.3247$ to 4 d.p. Three steps did the work of about fourteen bisection steps.

When Newton–Raphson fails.

Situation What happens
$f'(x_0)=0$ division by zero: the tangent is flat and never meets the axis
$f'(x_0)$ close to 0 the next estimate jumps a long way off
start near a different root it finds the wrong root
on $x^3-x-1$, start $x_0=\frac1{\sqrt3}$ $f'=0$: there is no next estimate

The trapezium rule

Split the area into $n$ strips of width $h=\frac{b-a}n$. Join the tops with straight lines, so that each strip is a trapezium:

The area under a curve split into four trapezium strips of equal width h
Each strip of width $h$ is a trapezium; their areas add up to estimate the integral.
$$\int_a^by\,dx\approx\frac h2\left[y_0+2(y_1+y_2+\dots+y_{n-1})+y_n\right].$$

The two end heights count once, and every middle height counts twice.

Worked example. Estimate $\int_0^2x^2\,dx$ with 2 strips. $h=1$ and the heights are $0,1,4$:

$$\tfrac12\left[0+2(1)+4\right]=3.$$

The exact value is $\frac83=2.667$, so this is an overestimate.

More strips, a smaller error.

Strips $h$ Estimate Error
2 1 $3$ $0.333$
4 0.5 $0.25[0+2(0.25+1+2.25)+4]=2.75$ $0.083$
8 0.25 $2.6875$ $0.021$

Each time $h$ halves, the error falls by about a factor of 4.

Over or under? It depends on how the curve bends, not on whether it rises or falls.

Convex, $f''>0$ Concave, $f''<0$
the chords lie above the curve the chords lie below the curve
the trapezium rule overestimates: $x^2$ on $[0,2]$ the trapezium rule underestimates: $\sqrt x$ on $[1,4]$

For $\sqrt x$ on $[1,4]$ with 3 strips: $\frac12\left[1+2(1.4142+1.7321)+2\right]=4.646$, below the exact $\frac{14}3=4.667$.

Rectangles as bounds. For an increasing function, rectangles using the left-hand heights give a lower bound, and right-hand heights give an upper bound. The true area lies between them.

Practice

  1. Show that $x^3+2x-5=0$ has a root between 1 and 2.
  2. Does $\tan x$ have a root in $(1,2)$? Explain.
  3. Write down an interval that proves a root is $2.718$ to 3 d.p.
  4. Use $x_{n+1}=\sqrt{2x_n+3}$ with $x_0=2$ to find $x_1$, $x_2$ and $x_3$. Which equation does the limit solve?
  5. Apply one step of Newton–Raphson to $f(x)=x^3-5$ from $x_0=2$.
  6. Use the trapezium rule with 4 strips to estimate $\int_0^1\frac1{1+x}\,dx$. Is it an over- or underestimate?

Answers.

  1. $f(1)=-2<0$, $f(2)=7>0$; $f$ is continuous, so there is a root in $(1,2)$.
  2. No: the zeros of $\tan x$ are integer multiples of $\pi$, none of which lies in $(1,2)$. The sign-change test does not apply across the asymptote at $x=\frac\pi2$.
  3. $(2.7175,2.7185)$.
  4. $2.6458$, $2.8795$, $2.9596$ (converging to 3); the limit solves $x^2-2x-3=0$.
  5. $x_1=2-\frac{3}{12}=1.75$.
  6. $h=0.25$: $0.125\left[1+2(0.8+0.6667+0.5714)+0.5\right]=0.697$; $\frac1{1+x}$ is convex, so it is an overestimate of $\ln2=0.693$.

Key points

  • A sign change locates a root only if $f$ is continuous.
  • To prove a root to $k$ decimal places, test the two rounding boundaries.
  • Iteration $x_{n+1}=g(x_n)$ converges locally if $|g'(\alpha)|<1$ at the fixed point $\alpha$, $g'$ is continuous near $\alpha$, and the starting value is sufficiently close.
  • Newton–Raphson is fast but fails where $f'(x_n)=0$ or from a bad start.
  • Trapezium rule: ends once, middles twice, times $\frac h2$; it overestimates for convex curves.
探索

求根与数值积分。

若一个连续函数在两个端点处符号相反,则其间必有一根。

对比模型与已解案例,并说明其中一处变化。

词汇 训练
English 中文 拼音
iteration/ˌɪtəˈreɪʃn/ 迭代 dié dài
Newton–Raphson/ˈnjuːtn ˈræfsn/ 牛顿迭代 niú dùn dié dài
trapezium rule/trəˈpiːzɪəm ruːl/ 梯形法则 tī xíng fǎ zé
continuous/kənˈtɪnjuːəs/ 连续 lián xù
bisection/baɪˈsekʃn/ 二分法 èr fēn fǎ
staircase diagram/ˈsteəkeɪs ˈdaɪəɡræm/ 阶梯图 jiē tī tú
cobweb diagram/ˈkɒbweb ˈdaɪəɡræm/ 蛛网图 zhū wǎng tú
converges/kənˈvɜːdʒɪz/ 收敛 shōu liǎn

该知识点的互动课程

逐步完成,配合即时检查练习。

更多 AQA A-Level 数学 知识点

登录或创建账户

IGCSE, A-Level & AP