1. Trang chủ
  2. » Luận Văn - Báo Cáo

the bisection method group 1

35 0 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

1.1 Introduction and description of the Bisection method.. 92.3 Algorithm corresponding to the Bisection method.. Introduction to the Bisection Method: This section provides an overview

Trang 1

HO CHI MINH CITY UNIVERSITY OF EDUCATIONDepartment of Mathematics and Informatics

THE BISECTION METHODGroup 1

Supervisor: Dr Pham Duy Khanh

HO CHI MINH CITY - 2024

Trang 2

1.1 Introduction and description of the Bisection method 4

1.2 The objectives of the report 4

1.3 The importance of the report’s contents 5

2 The Bisection Method72.1 Preliminaries 7

2.1.1 Intermediate Value Theorem 7

2.1.2 Rates of Convergence 8

2.1.3 Tolerance 8

2.2 The solution method for the Bisection method 9

2.3 Algorithm corresponding to the Bisection method 12

2.4 Flowcharts of the Bisection algorithm 17

2.5 Illustrative examples of the algorithms 20

2.6 Python program executing the algorithm 24

3 Discussion283.1 The report’s achievement and non-achievement 28

3.1.1 The report’s achievement 28

3.1.2 The report’s non-achievement 28

3.2 Further discussion 29

Trang 3

3.2.1 The problem of precision 293.2.2 The Signum function 303.2.3 Advantages and disadvantages of the Bisection method 31

Trang 4

This essay is the result of the collective effort and academic dedication of all membersof Group 1 We embarked on a challenging and intellectually stimulating journey inthe Introduction to Numerical Methods module, guided by Dr Pham Duy Khanh.This experience helped us expand our professional knowledge and develop personaland teamwork skills Above all, we would like to express our deepest gratitude to Dr.Pham Duy Khanh for your support and guidance throughout our learning process.

Despite our best efforts, we acknowledge that this essay may have some comings due to our limited knowledge and experience Therefore, we would greatlyappreciate any suggestions and comments from Dr Khanh Such feedback would serveas a valuable source of guidance, encouragement, and constructive criticism, helpingus to improve our report further.

short-Once again, we would like to express our deepest gratitude to Dr Khanh and wishyou happiness, health, and success in your teaching career and life!

Sincerely,Group 1.

Trang 5

Chapter 1Introduction

1.1Introduction and description of the Bisection method

In many cases, we need to find solutions of an equation For example, when findingcritical points of a function , we encounter the problem of solving the equationf f′

(x) =0 The examples and exercises so far were set up carefully so that solutions to thatequation could be found in a simple closed form But in practice this will not always

be the case, in fact it is almost never the case For example, finding the critical points

1.2The objectives of the report

The objectives of this report are:

Trang 6

1 Provide a clear and concise introduction to the Bisection method.

2 Present the mathematical foundation of the Bisection method including concepts,theorems, and proofs.

3 Show the solution method for the Bisection method.

4 Describe the algorithm to finding roots of polynomial equations by using theBisection method.

5 Provide illustrative examples of the algorithm in solving polynomial equations.6 Present a Python program executing the algorithm.

7 Evaluate the report’s achievement and non-achievement.8 Present further discussion related to this report.

1.3The importance of the report’s contents

Each of the report’s content is essential as:

1 Introduction to the Bisection Method: This section provides an overview of whatthe Bisection method is and clarifies the purpose and objectives of the report,making it easier for readers to understand the Bisection method in solving nu-merical problems.

2 Mathematical foundation: By discussing concepts, theorems, and proofs, this partequips readers with the necessary mathematical framework to for understand thelogic behind the Bisection method.

3 Solution method for the Bisection method: This section shows in detail how themethod narrows down the interval containing a root until it converges to anacceptable level of accuracy.

4 Algorithm for the Bisection Method: This part introduces the algorithm usingthe Bisection method, making it clearer how the method can be systematically

Trang 7

applied to find roots of polynomial equations Understanding the algorithm is cial for developing computational tools and software that automate the process,enhancing efficiency and accuracy.

cru-5 Illustrative Examples of the Algorithm: Through examples, we will demonstratethe practical application of the Bisection method algorithm and show how themethod can be operated manually.

6 A Python program executing the algorithm: This section provides readers with astep-by-step coding example to apply the theoretical understanding to practicalapplication.

7 The report’s achievement and non-achievement: This section presents a reflectiveoverview of our progress and challenges while completing the report It aims toprovide readers with insights into what has been achieved and what has not beenthrough our process.

8 Further discussion related to this report: We will discuss problems and remarksrelated to the Bisection method to help everyone gain a deeper understanding ofthis method.

Trang 8

Chapter 2

The Bisection Method

2.1.1Intermediate Value Theorem

Lemma 2.1.1 (Supremum axiom) Any nonempty subset A ⊆ R which is bounded

above has a supremumL ∈ R.

Theorem 2.1.2 (Intermediate Value Theorem) If f ∈ C[a, b] and k is any number

between f (a) and f ( )b , then there exists a numberc in (a, b)for whichf (c) = k.

Moreover, for n ∈ N∗, let bn= c +b − a

n ∈ [a, b Thus, the sequence { }] bn∞n=1

Trang 9

converges to c and thereforef (bn) → f c( ) On the other hand, sincebn∈ P , we have/f (bn) > m Consequently,

n=1to be compared with an arbitrary sequence {βn}∞n=1,in nearly every situation we use

βn= 1np,

for some numberp > 0 We are generally interested in the largest value ofpwithan= α + O(1/np).

Definition 2.1.4 In engineering and science, error is a deviation from an expected

or computed value Tolerance is the level of error that is acceptable for an ing application We say that a computer program has converged to a solution when ithas found a solution with an error smaller than the tolerance When computing roots

Trang 10

engineer-numerically, or conducting any other kind of numerical analysis, it is important toestablish both a metric for error and a tolerance that is suitable for a given engineer-ing/science application.[ ]3

2.2The solution method for the Bisection method

The Bisection technique is based on the Intermediate Value Theorem.

Suppose f is a continuous function defined on the interval[a, b], withf (a) and f ( )bof opposite sign The Intermediate Value Theorem implies that a number p exists in(a, b) with f (p) = 0 Although the procedure will work when there is more than oneroot in the interval (a, b), we assume for simplicity that the root in this interval isunique.

To begin, seta1= a and b1=b, and letp1be the midpoint of[a, b]; that is,

p1= a1+b1− a1

a1+ b1

2 .• If f (p1) = 0, thenp = p1, and we are done.

• If f (p1) = 0, thenf (p1)has the same sign as eitherf (a1) orf (b1).

– If f (p1) and f (a1) have the same sign,p ∈ (p1, b1) Seta2= p1andb2=b1.

– If f (p1) and f (a1) have opposite signs, p ∈ (a1, p1) Set a2=a1andb2= p1.

Then reapply the process to the interval[a2, b2], [a3, b3], and so on to [aN, bN], inwhich N is the maximum iteration we are desired to make to obtain the approximateroot p (Figure (4.1))

Trang 11

Figure 2.1:The illustration of the Bisection method

The Bisection method has the important property that it always converges to asolution, and for that reason it is often used as a starter for the more efficient methods.

Theorem 2.2.1 Suppose thatf ∈ C[a, b] and f (a)f (b) <0 The Bisection methodgenerates a sequence { }pn

Proof

Trang 12

For each n ≥ 1, we havebn− an= 1

n=1converges to p with rate of convergence O 12n

; that is

pn= p + O 12n

Moreover, to achieve an accuracy of|pn− p| ≤ ε,

it follows from (2.3) that

(b − a)12n≤ ε.Thus,

2n≥b − aε .

Logarithms to any base would suffice, but we will use base-10 logarithms becausethe tolerance is often given as a power of 10.

Trang 13

approximation error and that this bound might be quite conservative as the actualerror may be much smaller.

Example 2.2.3 Determine the number of iterations necessary to solve f (x) =x3+4x2− 10 = 0 with accuracy10−3using a1= 1and b1= 2.

2.3Algorithm corresponding to the Bisection method

The Algorithm to find a solution tof (x) = 0given the continuous functionfon theinterval [a, b], wheref (a) and f (b)have opposite signs is as follows:

Trang 14

Algorithm 1 The Bisection method for finding a root

INPUT endpoints a, b; tolerance ; maximum number of iterationsN0.

OUTPUT approximate solutionpor message of failure.

Step 1 Seti = 1;F A = f (a).

Step 2 While i ≤ N0do Steps 3–6.

Step 3 Set p = a + (b − a) 2/ ; (Computepi.)F P = f (p).

else setb = p (F Ais unchanged.)

Step 7 OUTPUT ‘Method failed after N0iterations,N0=, N0;’(The procedure was unsuccessful.)

Remark 2.3.1 When using a computer to generate approximations, it is good practice

to set an upper bound on the number of iterations This eliminates the possibility ofentering an infinite loop, a situation that can arise when the sequence diverges (andalso when the program is incorrectly coded) This was done in Step 2 of Algorithmwhere the boundN0was set and the procedure terminated ifi > N0.

Remark 2.3.2 Note that to start the Bisection Algorithm, an interval[a, b]must befound with f (a) · f b) < At each step the length of the interval known to contain( 0a zero of f is reduced by a factor of 2; hence it is advantageous to choose the initialinterval [a, b] as small as possible For example, if f (x) = 2x3−x2+ x − 1, we haveboth

f(−4) · (4) < 0 andf f(0) · (1) < 0,f

so the Bisection Algorithm could be used on[−4, 4]or on[0 1], Starting the BisectionAlgorithm on [0, 1] instead of [−4, 4] will reduce by 3 the number of iterations requiredto achieve a specified accuracy.

Trang 15

Other stopping procedures can be applied in Step 4 of the above Algorithm or inany of the iterative techniques, we can select a toleranceϵ > 0and generatep1, , pN

until one of the following conditions is met:

|pN− pN −1|

Remark 2.3.3 Unfortunately, difficulties can arise using any of these stopping criteria.

For example, there are sequences { }pn∞

n=0with the property that the differences pn−pn−1converge to zero while the sequence itself diverges It is also possible forf (pn)tobe close to zero while pndiffers significantly from p

We will consider the two following examples to demonstrate these difficulties Inparticular, example (2.3.4) illustrates the problem when using the stopping criterion(2.5) while example (2.3.5) illustrates the problem when using the stopping criterion(2.7)

Example 2.3.4 Let {pn} be the sequence defined by pn=Pnk=1

k Show that { }pndiverges even though limn→∞(pn−pn−1) = 0.

Note that

pn− pn−1=1n.As n goes to infinity, it can be seen that

n→∞(pn− pn−1) = lim

1n= 0.Suppose by contradiction that pn= Pn

1 converges Then pnis a Cauchy quence, that means for allε > 0, there is N ∈ Nsuch that

se-|pn+p− pn| < ε, n ≥ N, p ∈ N.∀ ∀

Trang 16

Choose ε =1

2, there is N ∈ N such that|p2N− pN| <1

2,which is absurbed as

|p2N− pN| = 1N + 1+

1N + 2+ +

12N+ +

 =N2N=

12.Hence, {pn} diverges even though limn→∞(pn−pn−1) = 0.

Example 2.3.5 Let f (x) = (x−1)10, p = 1, and pn= 1+1

1 +1n− 1

= 1n

.Letting n goes to infinity, we have

1 −

1 +1

By setting this less than10−3, we find thatn > 1000 This verifies the statementthat

|p − pn| < 10−3

Trang 17

requires thatn > 1000.

Thus, both the statements given in the problem are true For the first part, as nincreases, the functionf (pn)reduces and eventually goes to zero which is certainly lessthan 10−3 For the second part, the difference betweenp and pnwill be less than10−3

only whennis more than 1000 as we found out from the calculation.

Remark 2.3.6 Without additional knowledge aboutf or p, inequality (2.6)is thebest stopping criterion to apply because it comes closest to testing relative error.

Algorithm 2 The Bisection method using stopping criterion (2.6)

INPUT endpoints a, b; tolerance ; maximum number of iterationsN0.

OUTPUT approximate solutionpor message of failure.

Step 1 Seti = 1;F A = f (a); p = a;q = a.

Step 2 While i ≤ N0do Steps 3–6.

Step 3 Set q = p; (Setpi−1)

p = a + (b − a)/2; (Compute pi.)F P = f (p).

Step 4 IfF P = 0then

OUTPUT p; (Procedure completed successfully.)else:

Ifp = 0:If|p − q|

p < T OL then

OUTPUT p; (Procedure completed successfully)

STOP.else pass.

Step 5 Seti = i + 1.

Step 6 If F A F P >· 0 then set a = p; (Computeai, bi.)F A=F P

else setb = p (F Ais unchanged.)

Step 7 OUTPUT ‘Method failed after N0iterations,N0=, N0;’(The procedure was unsuccessful.)

STOP.

Trang 18

2.4Flowcharts of the Bisection algorithm

To provide a clear understanding of the process involved in the bisection method, wehave created two following flowcharts that outline the steps involved in Algorithms ( )1and ( ) This illustration simplifies the operational flow, making it easier to grasp the2step-by-step procedure of these algorithms.

Trang 19

Figure 2.2:Flowchart for Algorithm ( )1

Trang 20

Figure 2.3:Flowchart for Algorithm ( )2

Trang 21

2.5Illustrative examples of the algorithms

First, we will consider an example illustrate the Algorithm ( ), which use1b − a

2 < T OLas a stopping criterion.

Example 2.5.1 Show thatf (x) = x3+ 4x2− 10 = 0 has a root in [1 2], , and usethe Bisection method to determine an approximation to the root that is accurate to atleast within10−4.

Trang 22

2 = 0.125 ≥ 10

f (1.25).f(1 375) < 0,.we consider the interval[1 25 1 , 375]for the forth iteration.

Continue like this manner, we obtain this table:

Trang 23

Table 2.1:The results after performing 14 iterations

After performing 14 iterations, we see thatb14− a14

Trang 24

of [1, 2] we have f (1.5) = 2.37500 > This indicates that as0|p1− p0|

|p1| =13≥ 10

f (1).f(1.5) = −11 87500 < 0 ,we should select the interval[1 1, 5]for our second iteration.• For the second iteration, we note that the midpoint of[1 1, 5]is

p2= 1 ,25

then we havef (1.25) = − 79687 <1 0 Next, since|p2− p1|

|p2| =15≥ 10

|p3| =111≥ 10

f (1.25).f(1 375) < 0,.we consider the interval[1 25 1 , 375]for the forth iteration.

Continue like this manner, until the thirdteenth iteration, we have |p13− p12||p13| =8 94212 10 −5 < 10−4, then the algorithm ( ) with the termination condition (2.4)2prints outp13= 1.365112305as the approximate root of the equationf (x) = 0.

Trang 25

In conclusion, the process of doing algorithm (1) and ( ) are the same, but result2in a slight difference approximation of the root.

2.6Python program executing the algorithm

Python program executing the algorithm( )1

Trang 26

Steps for the abvove Python program

Link for verification: https://bit.ly/48ZQjbk

Trang 27

Python program executing the algorithm( )2

Trang 28

Steps for the above Python program

Link for verification: https://bit.ly/3IA1JrJ

Trang 29

Chapter 3Discussion

3.1The report’s achievement and non-achievement

3.1.1The report’s achievement

Through this report, we have accomplished our goals, which are mentioned in section(1.2): The objectives section of the report.

Remarkably, beside the algorithm introduced in [1] usingb − a

and then illustrate the examples and the Python programs executing both algorithms.

3.1.2The report’s non-achievement

However, this report has two main shortcomings.

The first one is that we have yet to find how to input the functionf (x)into a Python

Ngày đăng: 08/08/2024, 18:22