Why is (a+b)/2 not recommended in the Bisection method?

In summary, the author is recommending not to use the (a+b)/2 formula while applying the bisection method, but I am unable to get the reason why it is asking to do so.
  • #1
CandidFlakes
3
0
TL;DR Summary
I am confused by two different explanation of bisection method in two different books.
doubt.png

The image attached above from a textbook, explains that we should refrain from using (a+b)/2 while applying Bisection method but I am unable to get the reason why it is asking to do so?
doubt.png

While the image above is from another textbook. This book uses (a+b)/2.
I am really confused by two different instructions. Please help me clear the confusion.
Thanks in advance!
 
Mathematics news on Phys.org
  • #2
The two methods are equivalent. In the first (5.1) they calculate ##m = a + \frac{b - a} 2##, which is the midpoint of the interval [a, b]. Then they check to see if f(a) and f(m) are of the same sign or not. If not, the function zero must be between a and m.

In the second method, they calculate ##c = \frac{a + b} 2##, the average of a and b. If you do the algebra you should see that m and c are equal for any given pair of values a and b. After c is calculated, they calculate f(a)f(c) and determine whether the sign of this product is positive or negative. If it's negative, f(a) and f(c) lie on opposite sides of the horizontal axis, so the function zero must be between a and c.
 
  • Like
Likes topsquark and CandidFlakes
  • #3
Mark44 said:
The two methods are equivalent. In the first (5.1) they calculate ##m = a + \frac{b - a} 2##, which is the midpoint of the interval [a, b]. Then they check to see if f(a) and f(m) are of the same sign or not. If not, the function zero must be between a and m.

In the second method, they calculate ##c = \frac{a + b} 2##, the average of a and b. If you do the algebra you should see that m and c are equal for any given pair of values a and b. After c is calculated, they calculate f(a)f(c) and determine whether the sign of this product is positive or negative. If it's negative, f(a) and f(c) lie on opposite sides of the horizontal axis, so the function zero must be between a and c.
doubt.png

Thanks so much!
But, in the book why are they mentioning that the formula (a+b)/2 gives "midpoint" of 0.7 for the interval [0.67,0.69]?
Also can you please give me a hint on how a+b overflows in extreme cases?
 
  • #4
CandidFlakes said:
But, in the book why are they mentioning that the formula (a+b)/2 gives "midpoint" of 0.7 for the interval [0.67,0.69]?
Because they are specifying 2-digit decimal arithmetic. The result of the addition of a and b is 1.36 in this case, which has to be rounded to two significant digits, namely 1.4. When it is divided by 2, you get .7, which isn't in the interval [.67, .69].
CandidFlakes said:
Also can you please give me a hint on how a+b overflows in extreme cases?
They're talking about finite-precision arithmetic. If you're dealing with 8-bit integers, the largest such integer is 255. If a = 130 and b = 140, then a + b results in an overflow. I.e., the sum can't be represented in 8 bits. I think that's what they're talking about.
 
  • Like
Likes FactChecker and CandidFlakes
  • #5
Mark44 said:
Because they are specifying 2-digit decimal arithmetic. The result of the addition of a and b is 1.36 in this case, which has to be rounded to two significant digits, namely 1.4. When it is divided by 2, you get .7, which isn't in the interval [.67, .69].

They're talking about finite-precision arithmetic. If you're dealing with 8-bit integers, the largest such integer is 255. If a = 130 and b = 140, then a + b results in an overflow. I.e., the sum can't be represented in 8 bits. I think that's what they're talking about.
Thanks so much!
 
  • #6
They have to be talking about very old or limited computers. With any common computer of the last few decades, a reasonable tolerance value will stop the computations long before the midpoint calculation has an error. Assuming that you are working with floating point 32 or 64 bit calculations, you can ignore their worry about the midpoint calculation.
 
  • Like
Likes Office_Shredder
  • #7
Amusingly, the only time I have ever had a bug because of an issue like overflow is when I wrote some code to multiply two integers to see if they were the same sign, and got an integer overflow.

This book is not a good source of learning good programming practice in 2022.
 

1. What is the bisection method and how does it work?

The bisection method is a numerical algorithm used to find the root of a function. It works by repeatedly dividing the interval in which the root is known to exist, until the root is narrowed down to a desired level of accuracy.

2. How accurate is the bisection method?

The accuracy of the bisection method depends on the chosen interval and the number of iterations. With each iteration, the interval is halved, resulting in a higher level of accuracy. However, the method may not converge if the function is not continuous or if there are multiple roots within the interval.

3. What are the advantages of using the bisection method?

The bisection method is relatively simple and easy to implement. It also guarantees convergence to a root, as long as the function is continuous and there is only one root within the chosen interval. Additionally, it is a robust method that can handle a wide range of functions.

4. Can the bisection method be used for complex functions?

Yes, the bisection method can be used for both simple and complex functions. However, the convergence may be slower for more complex functions with multiple roots.

5. Are there any limitations to using the bisection method?

One limitation of the bisection method is that it requires the function to be continuous. It also may not work well for functions with multiple roots within the chosen interval. Additionally, the method may take longer to converge compared to other numerical methods.

Similar threads

Replies
10
Views
1K
  • General Math
Replies
7
Views
1K
  • Other Physics Topics
Replies
4
Views
2K
  • General Math
Replies
15
Views
4K
Replies
7
Views
1K
Replies
5
Views
612
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
2
Views
2K
Replies
2
Views
748
Back
Top