Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Computational Physics - M. Jensen Episode 1 Part 6 doc
MIỄN PHÍ
Số trang
20
Kích thước
341.4 KB
Định dạng
PDF
Lượt xem
1320

Tài liệu đang bị lỗi

File tài liệu này hiện đang bị hỏng, chúng tôi đang cố gắng khắc phục.

Computational Physics - M. Jensen Episode 1 Part 6 doc

Nội dung xem thử

Mô tả chi tiết

6.2. ITERATION METHODS 89

6.2 Iteration methods

To solve an equation of the type f (x) = 0 means mathematically to find all numbers s

1

so that

f (s) = 0. In all actual calculations we are always limited by a given precision when doing

numerics. Through an iterative search of the solution, the hope is that we can approach, within a

given tolerance , a value x0 which is a solution to f (s) = 0 if

jx0 ￾ sj < ; (6.9)

and f (s) = 0. We could use other criteria as well like

x0 ￾ s

s

< ; (6.10)

and jf (x0)j <  or a combination of these. However, it is not given that the iterative process

will converge and we would like to have some conditions on f which ensures a solution. This

condition is provided by the so-called Lipschitz criterion. If the function f , defined on the

interval [a; b℄ satisfies for all x1 and x2 in the chosen interval the following condition

jf (x1) ￾ f (x2)j  k jx1 ￾ x2j ; (6.11)

with k a constant, then f is continuous in the interval [a; b℄. If f is continuous in the interval

[a; b℄, then the secant condition gives

f (x1) ￾ f (x2) = f

0

()(x1 ￾ x2); (6.12)

with x1; x2 within [a; b℄ and  within [x1; x2℄. We have then

jf (x1) ￾ f (x2)j  jf

0

()jj jx1 ￾ x2j : (6.13)

The derivative can be used as the constant k. We can now formulate the sufficient conditions for

the convergence of the iterative search for solutions to f (s) = 0.

1. We assume that f is defined in the interval [a; b℄.

2. f satisfies the Lipschitz condition with k < 1.

With these conditions, the equation f (x) = 0 has only one solution in the interval [a; b℄ and it

coverges after n iterations towards the solution s irrespective of choice for x0 in the interval [a; b℄.

If we let xn be the value of x after n iterations, we have the condition

js ￾ xnj =

k

1 ￾ k

jx1 ￾ x2j : (6.14)

The proof can be found in the text of Bulirsch and Stoer. Since it is difficult numerically to find

exactly the point where f (s) = 0, in the actual numerical solution one implements three tests of

the type

1

In the following discussion, the variable s is reserved for the value of x where we have

90 CHAPTER 6. NON-LINEAR EQUATIONS AND ROOTS OF POLYNOMIALS

1.

jxn ￾ sj < ; (6.15)

and

2.

jf (s)j < Æ; (6.16)

3. and a maximum number of iterations Nmaxiter in actual calculations.

6.3 Bisection method

This is an extremely simple method to code. The philosophy can best be explained by choosing

a region in e.g., Fig. 6.1 which is close to where f (E) = 0. In our case jEj  2:2. Choose a

region [a; b℄ so that a = 1:5 and b = 3. This should encompass the point where f = 0. Define

then the point

=

a + b

2

; (6.17)

and calculate f ( ). If f (a)f ( ) < 0, the solution lies in the region [a; ℄ = [a; (a + b)=2℄.

Change then b and calculate a new value for . If f (a)f ( ) > 0, the new interval is in

[ ; b℄ = [(a + b)=2; b℄. Now you need to change a and evaluate then a new value for . We

can continue to halve the interval till we have reached a value for which fulfils f ( ) = 0 to a

given numerical precision. The algorithm can be simply expressed in the following program

. . . . . .

f a = f ( a ) ;

fb = f ( b ) ;

/ / check i f your i n t e r v a l i s c o r r e c t , i f n o t r e t u r n t o main

i f ( f a fb > 0 ) {

c o u t < < ‘ ‘ \ n E r r o r , r o o t not i n i n t e r v a l '' < < e n d l ;

retu rn ;

}

f o r ( j = 1 ; j < = i t e r _ m a x ; j ++) {

c =( a+b ) / 2 ;

f c = f ( c )

/ / i f t h i s t e s t i s s a t i s f i e d , we have t h e r o o t c

i f ( ( abs ( a￾b ) < e p s i l o n ) | | f c < d e l t a ) ; retu rn t o main

i f ( f a f c < 0 ) {

b=c ; fb = f c ;

}

e l s e {

a=c ; f a = f c ;

}

}

. . . . .

Tải ngay đi em, còn do dự, trời tối mất!