You are on page 1of 36

2 :

:
:
91

Applied Numerical Analysis, C. Gerald & P. Wheatley, 2003



) (




) (
.

ax bx c 0
2

b b 4ac
x
2a
2

?y

2
3

1
Q AR
n

Qn
f ( y)
known
S

-1 ) :(Direct

-2 ):(Iterative


. .
:

: ) (

: .
. 6 7 x

.

:
.



.
.
.
.
:
.

)(Error Definition
)P :(exact

P* :
|*E(abs)=|P-P

E(rel)=|P-P*|/P , P#0
)(Error Resources

- - -
-

* P P t t
:

5 10 t

*P P
P

0.03
5 10 t
P 3.50, P 3.47
3.5
8.57 103 5 102 t 2
*

P 3.50, P* 3.11 t 2


Solution of non Linear Equation

)(Bisection or Halving the Interval



)X=g(x


Given f(x)=0.0
Guess x1, x2 so that F(x1)* F(x2)<0
REPEAT if not
SET X3=(x1+x2)/2
IF
;F(x1)* F(x3)<0
SET x2=x3
ELSE SET
x1=x3
ENDIF
UNTIL (|X1-X2|<tolerance value) or f(x3)=0

k :

x2 x1
k


.
.

x2 x0 x1
.

xk xk 1
xk 1 xk
) . f ( xk
) f ( xk ) f ( xk 1

X=g(x) or Fixed-Point Method

f ( x) x g ( x)
if (r , f (r ) 0) r g (r ) 0 r : fixed point of g
Example : f ( x) x 2 2 x 3 0
first type : x g1 ( x) 2 x 3
x0 4 x1 3.31662 x2 3.10375
x3 3.03439 x4 3.01144 x5 3.00381

3
( x 2)
x0 4 x1 1.5 x2 6 x3 0.375

second type : x g 2 ( x)

x4 1.263158 x5 0.919355 ...x8 1.00305

third type : x g ( x)
3

2
x0 4 x1 6.5 x2 19.625
x3 191.070

x0 g ( x0 ) 1 x0 .


| |x3-x2|<|x2-x1 ). (


tg

f x0
x0 x1

x1 x0

, tg f x0 f x0

if f ( x0 ) 0 : x0 root & xn guess

xn x0 n , f ( x0 ) f xn n 0 viaTaylor Series
f xn
f xn ..... 0 n
f xn
2!

n2

n2
2!

f x0
x0 x1

f x0
f xn
xn 1 xn
f x0
f xn

n 1 n 2

f ( x0 ) f ( xn ) n f xn

f 0

f ( xn ) n 2 f

x0 xn

1 f 2
f
x
2! f xn

n 1
x x f ( xn )
2! f xn
n
n 1
f xn

.
F(x)=3x+sin(x)-ex


.

:

f1 x1 , x2 ,....., xn 0

f 2 x1 , x2 ,....., xn 0

f x , x ,....., x 0
n
n 1 2

-1 -
0/018 0/001 3 2
.
2

2
by 3
1
1
3
Q AR S by
S
2
n
n
b
y

2
3

2
3

2y
y
y
y

0.8538 0.0
2
2
1
y
y

3 0.018

2 0.001

-2 300 1 0/1
. -.
2.51
e e
1
2 log

8.667 104 , Re 424413


,

Re f 3.7 D D
f

1
2.51
8.667 104

2 log


424413 f
3.7
f

1
2.51
8.667 104
2 log

0.0

3.7
f
424413 f

5.91405 106

1
2 log
0.00023424 0.0

f
f



. : .
:
.
av 2 bv c

f1 f 0 1 f 2
f1 f 0 ah12
, b
a
2
h1 1
h1
h2 / h1

2c
b b 2 4ac

c f0
xr x0


Given the points x2,x0,x1 in increasing value,
1.
Evaluate the corresponding function values f2, f0, f1.
2.
Find the coefficients of the parabola determined by the three points.
3.
Compute the two roots of the parabolic equation.
4.
Choose the root closest to x0 and label it xr.
5.
IF xr > x0 THEN rearrange x0,xr,x1 into x2,x0,x1
6.
ELSE rearrange x2,xr,x0 into x2,x0,x1
IF |f(xr)|<TOL, THEN return (xr).
7.
8.
ELSE go to 1.
( ) . 1 0 *

f ( x) 3x sin( x) e x


Interpolating Polynomials
: xi , yi .
) Pn (x
) f(x
x.
) f(x ) Pn (x
x f
. ) f(x
.



.

2 x
.

.
Linear interpolation ---- 2 points
Quadratic interpolation ---- 3 points
Cubic interpolation ---- 4 points
*
)(


.


.

3 2 .

x o , y o , x 1 , y 1 ,..., x n , y n

n+1
n .
.
. :
-

Pn (x) a 0 a1x a 2 x 2 ... a n x n


a0 , an ) n+1(
.

x o , y o , x 1 , y 1 ,..., x n , y n

n+1
n+1 .
:
) (

:
x o , f o , x 1 , f 1 , x 2 , f 2 , x 3 , f 3
:
) (x x1 )(x x 2 )(x x 3
) (x x 0 )(x x 2 )(x x 3
P3 (x)
f0
f1
) (x 0 x1 )(x 0 x 2 )(x 0 x 3
) (x1 x 0 )(x1 x 2 )(x1 x 3
) (x x 0 )(x x1 )(x x 3
) (x x 0 )(x x1 )(x x 2
f2
f3
) (x 2 x 0 )(x 2 x1 )(x 2 x 3
) (x 3 x 0 )(x 3 x1 )(x 3 x 2

:

.

) Pn (x) b 0 b1 (x x 0 ) b 2 (x x 0 )(x x1 ) ... b n (x x 0 )(x x1 )...(x x n 1

b0 , bn
.
[x 0 , f0 ] ) Pn (x :
b0 f 0

) Pn (x) b 0 b1 (x x 0 ) b 2 (x x 0 )(x x1 ) ... b n (x x 0 )(x x1 )...(x x n 1

] [x1 , f1

) Pn (x :
f1 f 0
x1 x 0

b1

[x 2 , f 2 ] ) Pn (x
b2 :
f1 f 0
f 2 f1

x x1 x1 x 0
b2 2
x2 x0

f f
f 2 f1
1 0
x 2 x1 x1 x 0
f f
.
1 0
x2 x0
x1 x 0

Pn (x) b 0 b1 (x x 0 ) b 2 (x x 0 )(x x1 ) ... b n (x x 0 )(x x1 )...(x x n 1 )

first divided difference


second divided difference
:

f1 f 0
b1 f[x1 , x 0 ]
x1 x 0
f1 f 0
f 2 f1

x 2 x1 x1 x 0 f[x 2 , x1 ] f[x1 , x 0 ]

b 2 f[x 2 , x1 , x 0 ]
x2 x0
x2 x0

) Pn (x) b 0 b1 (x x 0 ) b 2 (x x 0 )(x x1 ) ... b n (x x 0 )(x x1 )...(x x n 1

] b1 f[x1 , x 0 ] f[x 0 , x1

] b 2 f[x 2 , x1 , x 0 ] f[x 0 , x1 , x 2

.
bn :
] b n f[x 0 , x1 , x 2 ,...., x n

)Pn (x
:
Pn (x) f 0 f[x 0 , x1 ](x x 0 ) f[x 0 , x1 , x 2 ](x x 0 )(x x1 ) ...
) f[x 0 , x1 ,..., x n ](x x 0 )(x x1 )...(x x n 1

Pn (x) f 0 f[x 0 , x1 ](x x 0 ) f[x 0 , x1 , x 2 ](x x 0 )(x x1 ) ...


) f[x 0 , x1 ,..., x n ](x x 0 )(x x1 )...(x x n 1

x o , y o , x 1 , y 1 ,..., x n , y n


x ) (x 0 x1 x 2 ..... x n
x h

.

) Pn (x
.

Pn (x) f 0 f[x 0 , x1 ](x x 0 ) f[x 0 , x1 , x 2 ](x x 0 )(x x1 ) ...


f[x 0 , x1 ,..., x n ](x x 0 )(x x1 )...(x x n 1 )

:finite differnces
:forward finite differences -1
f[x 0 , x1 ]

f1 f 0
1
1
(f1 f 0 ) f 0
x1 x 0 h
h

f[x 0 , x1 , x 2 ]

f[x1 , x 2 ] f[x 0 , x1 ]
1
1
2 ( f1 f 0 ) 2 2 f 0
2h
2h
2h

.....
.....
f[x 0 , x1 , x 2 ,..., x n ]

1
n

f0
n
n!h

2f 0

f 0

n+1
:

x i , y i , x i 1 , y i 1 ,..., x i n , y i n

fi
2fi
Pn (x) fi
(x x i )
(x x i )(x x i 1 ) ...
2
h
2!h
n fi
) (x x i )(x x i 1 )...(x x i n 1

n
n!h

- Newton-Gregory
forward formula ) f(x .
)f(x
xi xi .

f i
2fi
Pn (x) f i
(x x i )
(x x i )(x x i 1 ) ...
2
h
2!h
n fi

(x x i )(x x i 1 )...(x x i n 1 )
n!h n

f(x)
: -

f i
2fi
f (x) P2 (x) f i
(x x i )
(x x i )(x x i 1 )
2
h
2!h

2
df f 2 f

fi
i 2i x
(x i x i 1 )
2
dx
h
h
2!h

df
f i 2 f i
2fi

2 xi
(x i x i 1 )

2
dx
h
h
2!h
i
df
f i 2 f i
f i 1 f i f i 2 f i 1 (f i 1 f i )

2 (x i x i 1 )

dx
h
2h
h
2h
i
df
4f 3f i f i 2

i 1
2h
dx i

3
.
4 5
x=4.1

22

3.2

17.8

2.7

14.2

38.3

4.8

51.7

5.6

You might also like