Download presentation
Presentation is loading. Please wait.
1
Chapter 2 A Survey of Simple Methods and Tools
2
2.1 Horner’s Rule and Nested Multiplication
For example
3
Horner’s rule for polynomial evaluation
多項式最高次項的係數 多項式的係數
4
Horner’s rule for polynomial derivative evaluation
Polynomial first derivative: For example:
5
Horner’s rule for polynomial derivative evaluation
6
A more efficient implementation of Horner’s rule
If the intermediate values in the computation of p (x) are saved, then the subsequent computation of the derivative can be done more cheaply. Define So that Then and, in particular, Define Therefore Since 注意bk亦為x的函數
8
2.2 Difference Approximations to the Derivative—one-side difference
The definition of the derivative: Taylor’s Theorem: So that we have Thus the error is roughly proportional to h. Can we do better?
9
2.2 Difference Approximations to the Derivative—centered difference
Consider the two Taylor expansions:
10
Example 2.1
11
Further illustrate these differences in accuracy
Let’s continue computing with the same example, but take more and smaller values of h. Let with the corresponding errors
13
Nearly 4 Error increase. why?
14
Rounding Error Let denote the function computation as actually done on the computer. Define as the error between the function as computed in infinite precision and as actually computed on the machine. The approximate derivative that we compute is constructed with , not f. Define
15
Rounding Error We have which we write as
16
Rounding Error
17
Nearly 4
19
2.3 Application: Euler’s Method for Initial Value Problems
General form: One-side difference (Eq. 2.1) Euler’s method
21
Example 2.2
26
2.4 Linear Interpolation Given a set of nodes xk, if for all k, then we say the function p interpolates the function f at these nodes. Linear interpolation: using a straight line to approximate a given function For example: the equation of a straight line that passes through the two points
28
The accuracy of linear interpolation
29
Example 2.3 f (0.2) f (0.1)
31
Piecewise linear interpolation
Example 4.2
34
2.5 Application: the trapezoid rule
Define the integration of interest as I(f ):
36
Error analysis Apply the Integral Mean Value Theorem thus
37
The n-subinterval trapezoid rule
39
This theorem tells us: The numerical approximation will converge to the exact value How fast this convergence occurs h 2
40
Example 2.5
42
Example 2.6
43
The stability of the trapezoid rule
We conclude that the trapezoid rule is a stable numerical method. In fact, almost all methods for numerically approximating integrals are stable.
44
2.6 Solution of tri-diagonal linear systems
45
If A is tri-diagonal, then
For example:
46
Make a notational simplification:
where Then the augmented matrix corresponding to the system is
47
Gaussian elimination The elimination step where
The backward solution step
48
Example 2.7
49
After a single pass through the first loop:
We cannot continue the process, for we would have to divide by zero in the next step. However, the solution of the system indeed exist:
50
Diagonal dominance for tri-diagonal matrices
For example
51
2.7 Application: Simple Two-point Boundary Value Problems
Two-point boundary value problem (BVP)
52
Use Taylor expansions similar to (2. 2) and (2
Use Taylor expansions similar to (2.2) and (2.3) (just take more terms) to derive an approximation to the second derivative, by adding them. Then we get This is a tri-diagonal system of linear equations.
53
In matrix-vector form It is diagonally dominant, so we can apply the algorithm developed in the precious section to produce solutions.
54
Example 2.8
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.