chapter 2 a survey of simple methods and tools
DESCRIPTION
Chapter 2 A Survey of Simple Methods and Tools. 2.1 Horner ’ s Rule and Nested Multiplication. Nested Multiplication For example. Horner ’ s rule for polynomial evaluation. 多項式最高次項的係數. 多項式的係數. Horner ’ s rule for polynomial derivative evaluation. Polynomial first derivative: For example:. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/1.jpg)
1
Chapter 2 Chapter 2 A Survey of A Survey of
Simple Methods Simple Methods and Toolsand Tools
![Page 2: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/2.jpg)
2
2.1 Horner’s Rule and Nested 2.1 Horner’s Rule and Nested MultiplicationMultiplication
Nested MultiplicationNested Multiplication
For exampleFor example
![Page 3: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/3.jpg)
3
Horner’s rule for polynomial Horner’s rule for polynomial evaluationevaluation
多項式的係數
多項式最高次項的係數
![Page 4: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/4.jpg)
4
Horner’s rule for polynomial Horner’s rule for polynomial derivative evaluationderivative evaluation
Polynomial first derivative:Polynomial first derivative:
For example:For example:
![Page 5: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/5.jpg)
5
Horner’s rule for polynomial Horner’s rule for polynomial derivative evaluationderivative evaluation
![Page 6: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/6.jpg)
6
A more efficient A more efficient implementation of Horner’s implementation of Horner’s
rulerule If the intermediate values in tIf the intermediate values in t
he computation of he computation of pp((xx)) are sa are saved, then the subsequent coved, then the subsequent computation of the derivative cmputation of the derivative can be done more cheaply.an be done more cheaply.
DefineDefine
So thatSo that ThenThen
and, in particular,and, in particular,
DefineDefine
Therefore Therefore
Since Since
注意 bk亦為 x的函數
![Page 7: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/7.jpg)
7
![Page 8: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/8.jpg)
8
2.2 Difference Approximations to the 2.2 Difference Approximations to the Derivative—Derivative—one-sideone-side difference difference
The definition of the derivative:The definition of the derivative:
Taylor’s Theorem:Taylor’s Theorem:
So that we haveSo that we have
Thus the error is roughly proportional to Thus the error is roughly proportional to hh.. Can we do better?Can we do better?
![Page 9: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/9.jpg)
9
2.2 Difference Approximations to the 2.2 Difference Approximations to the Derivative—Derivative—centeredcentered difference difference
Consider the two Taylor expansions:Consider the two Taylor expansions:
![Page 10: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/10.jpg)
10
Example 2.1Example 2.1
![Page 11: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/11.jpg)
11
Further illustrate these differences in Further illustrate these differences in accuracyaccuracy
Let’s continue computing with the same Let’s continue computing with the same example, but take more and smaller values example, but take more and smaller values of of hh..
Let Let
with the corresponding errorswith the corresponding errors
1at )(' find to,)(finction Given xxfexf x
![Page 12: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/12.jpg)
12
![Page 13: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/13.jpg)
13
Nearly 4
Error increase. why?
![Page 14: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/14.jpg)
14
Rounding Error Rounding Error
Let denote the function computation as Let denote the function computation as actually done on the computer.actually done on the computer.
Define as the error between Define as the error between the function as computed in the function as computed in infinite infinite precisionprecision and as and as actually computedactually computed on the on the machine.machine.
The approximate derivative that we The approximate derivative that we compute is constructed with , not compute is constructed with , not ff..
DefineDefine
![Page 15: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/15.jpg)
15
Rounding ErrorRounding Error
We haveWe have
which we write aswhich we write as
![Page 16: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/16.jpg)
16
Rounding ErrorRounding Error
![Page 17: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/17.jpg)
17
Nearly 4
![Page 18: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/18.jpg)
18
![Page 19: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/19.jpg)
19
2.3 Application: 2.3 Application: Euler’s Method for Euler’s Method for Initial Value Initial Value
ProblemsProblems General form:General form:
One-side difference (Eq. 2.1)One-side difference (Eq. 2.1)
Euler’s methodEuler’s method
![Page 20: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/20.jpg)
20
![Page 21: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/21.jpg)
21
Example 2.2Example 2.2
![Page 22: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/22.jpg)
22
![Page 23: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/23.jpg)
23
![Page 24: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/24.jpg)
24
![Page 25: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/25.jpg)
25
![Page 26: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/26.jpg)
26
2.4 Linear Interpolation2.4 Linear Interpolation
Given a set of nodesGiven a set of nodes xxkk, if for all , if for all kk, then we , then we say the function say the function pp interpolates the function interpolates the function ff at t at these nodes.hese nodes.
Linear interpolation: using a straight line to appLinear interpolation: using a straight line to approximate a given functionroximate a given function
For example: the equation of a straight line that For example: the equation of a straight line that passes through the two points passes through the two points
![Page 27: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/27.jpg)
27
f(x0)
f(x1)
x0 x1
p1(x)
x
![Page 28: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/28.jpg)
28
The accuracy of linear The accuracy of linear interpolationinterpolation
![Page 29: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/29.jpg)
29
Example 2.3Example 2.3
f (0.1) f (0.2)
![Page 30: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/30.jpg)
30
![Page 31: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/31.jpg)
31
Piecewise linear Piecewise linear interpolationinterpolation
Example 4.2Example 4.2
![Page 32: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/32.jpg)
32
)(log1
)(" ),(log1
)('
)(log)( and loglog
222
2
ex
xfex
xf
xxfdx
du
u
e
dx
ud aa
![Page 33: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/33.jpg)
33
![Page 34: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/34.jpg)
34
2.5 Application: the trapezoid 2.5 Application: the trapezoid rulerule
Define the integration of interest as Define the integration of interest as II((f f ):):
![Page 35: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/35.jpg)
35
![Page 36: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/36.jpg)
36
Error analysisError analysis
Apply the Integral Mean Value TheoremApply the Integral Mean Value Theorem
thusthus
![Page 37: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/37.jpg)
37
The The nn-subinterval trapezoid -subinterval trapezoid rulerule
![Page 38: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/38.jpg)
38
![Page 39: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/39.jpg)
39
This theorem tells us:This theorem tells us:– The numerical approximation will converge to The numerical approximation will converge to
the exact valuethe exact value
– How fast this convergence occurs How fast this convergence occurs h h 22
![Page 40: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/40.jpg)
40
Example 2.5Example 2.5
![Page 41: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/41.jpg)
41
![Page 42: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/42.jpg)
42
Example 2.6Example 2.6
![Page 43: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/43.jpg)
43
The stability of the trapezoid The stability of the trapezoid rulerule
We conclude that the trapezoid rule is a stable numerical method.We conclude that the trapezoid rule is a stable numerical method. In fact, almost all methods for numerically approximating integrals In fact, almost all methods for numerically approximating integrals
are stable.are stable.
The double prime on the summation symbol means that The double prime on the summation symbol means that the first and last terms are multiplied by ½.the first and last terms are multiplied by ½.
![Page 44: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/44.jpg)
44
2.6 Solution of tri-diagonal linear 2.6 Solution of tri-diagonal linear systemssystems
![Page 45: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/45.jpg)
45
If If AA is tri-diagonal, then is tri-diagonal, then
For example:For example:
![Page 46: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/46.jpg)
46
Make a notational simplification: Make a notational simplification:
wherewhere Then the augmented matrix Then the augmented matrix
corresponding to the system iscorresponding to the system is
![Page 47: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/47.jpg)
47
Gaussian eliminationGaussian elimination The elimination stepThe elimination step
wherewhere
The backward solution stepThe backward solution step
![Page 48: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/48.jpg)
48
Example 2.7Example 2.7
![Page 49: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/49.jpg)
49
After a single pass through the first loop:After a single pass through the first loop:
We cannot continue the process, for we would We cannot continue the process, for we would have to divide by zero in the next step.have to divide by zero in the next step.
However, the solution of the system indeed exist:However, the solution of the system indeed exist:
![Page 50: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/50.jpg)
50
Diagonal dominance for tri-Diagonal dominance for tri-diagonal matricesdiagonal matrices
For exampleFor example
![Page 51: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/51.jpg)
51
2.7 Application: 2.7 Application: Simple Two-point Boundary Value Simple Two-point Boundary Value
ProblemsProblems Two-point boundary value problem (BVP)Two-point boundary value problem (BVP)
![Page 52: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/52.jpg)
52
Use Taylor expansions similar to (2.2) and (2.3) (just Use Taylor expansions similar to (2.2) and (2.3) (just take more terms) to derive an approximation to the take more terms) to derive an approximation to the second derivative, by adding them. Then we getsecond derivative, by adding them. Then we get
This is a tri-diagonal system of linear equations.This is a tri-diagonal system of linear equations.
![Page 53: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/53.jpg)
53
In matrix-vector formIn matrix-vector form
It is diagonally dominant, so we can apply It is diagonally dominant, so we can apply the algorithm developed in the precious the algorithm developed in the precious section to produce solutions.section to produce solutions.
![Page 54: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/54.jpg)
54
Example 2.8Example 2.8
![Page 55: Chapter 2 A Survey of Simple Methods and Tools](https://reader031.vdocuments.mx/reader031/viewer/2022020111/56812b0a550346895d8eed2c/html5/thumbnails/55.jpg)
55