Show that the Bisection Method converges to

Click For Summary

Homework Help Overview

The discussion revolves around the Bisection Method applied to the function f(x) = sin(πx), specifically examining its convergence properties under certain conditions for the parameters a and b. Participants explore the behavior of the method when varying these parameters within defined intervals.

Discussion Character

  • Exploratory, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • Participants discuss their attempts to apply the Bisection Method with various values for a and b, questioning the convergence results they observe. There are inquiries about the impact of floating point precision on the method's effectiveness and how to adjust parameters to achieve the expected convergence.

Discussion Status

The discussion is ongoing, with participants sharing their code implementations and graphical results. Some have identified issues related to floating point precision and are exploring potential adjustments to their approach. There is no explicit consensus yet, but suggestions for improving the algorithm's termination criteria have been made.

Contextual Notes

Participants are working under the constraints of the problem's requirements, including specific ranges for a and b, and are navigating the challenges posed by the lack of a defined tolerance in the original problem statement.

GTdan
Messages
39
Reaction score
0
1. The function defined by f(x)=[tex]\sin(\pi*x)[/tex]has zeros at every integer x. Show that when -1<a<0 and 2<b<3, the Bisection method converges to

a. 0, if a+b<2
b. 2, if a+b>2
c. 1, if a+b=2


2. Bisection Method

An interval [tex][a_{n+1},b_{n+1}][/tex]containing an approximation to a root of f(x)=0 is constructed from an interval [tex][a_{n},b_{n}][/tex] containing the root by first letting

[tex]p_{n}=a_{n}+\frac{(b_{n}-a_{n})}{2}[/tex]

Then set
[tex]a_{n+1}=a_{n}[/tex] and [tex]b_{n+1}=p_{n}[/tex] if [tex]f(a_{n})*f(p_{n})<0[/tex]

and

[tex]a_{n+1}=p_{n}[/tex] and [tex]b_{n+1}=b_{n}[/tex] otherwise.

3. I attempted to randomly choose numbers for a and b to satisfy the relations a+b<2 , -1<a<0, and 2<b<3. I picked a=-0.5 and b=2.5 and went through many iterations of the Bisection method to see if p[n] converged to zero. It didn't. I'm not sure if I am approaching the problem correctly. Can someone give me a good head start with this?
 
Last edited:
Physics news on Phys.org
Ok, I thought that maybe I wasn't doing enough iterations. So to avoid hours of number crunching I wrote the bisection method in True Basic code and made it print out the results so I could graph it. It worked for parts (a) and (b) because when I graph p vs n, p converges to 0 for part (a) and 2 for part (b). Strangely enough, when I do the same for part (c) it converges to 0 instead of 1. Can anyone tell me why?

I did the same as before:
For part (a) I used a=- 0.75 and b= 2.5
part (b) a= -0.25 and b= 2.5
part (c) a=-0.5 and b=2.5

Here is the code and graphs of all 3 parts:

Code
program Bisection

option nolet
input prompt "a: ":aa
input prompt "b: ":bb
input prompt "TOL: ":tol
print "Enter file name for saving data (enter it as filename.dat)"
input prompt "(AND make sure there isn't already a file with that name): ": file$
open #23: name file$, access output, create newold, org text
nn=log((bb-aa)/tol)/log(2)
kk=1
print "a", "b", "f*f", "p", "k"
print #23: "a", "b", "f*f", "p", "k"
do while kk<nn
pp=aa+(bb-aa)/2
ff=sgn(sin(Pi*pp))*sgn(sin(Pi*aa))
print aa, bb, ff, pp, kk
print #23: aa, bb, ff, pp, kk
if ff<0 then
bb=pp
else
aa=pp
end if
kk=kk+1
loop
pp=aa+(bb-aa)/2
print aa, bb, ff, pp, kk
print #23: aa, bb, ff, pp, kk
end

Graphs

http://home.comcast.net/~dannyrod/parta.jpg
http://home.comcast.net/~dannyrod/partb.jpg
http://home.comcast.net/~dannyrod/partc.jpg
 
Last edited by a moderator:
Your general problem here is that floating point numbers are not exact. In the a=-0.5, b=2.5 case your first midpoint is at 1.0. In an ideal world the value of the function SHOULD be exactly zero there. But it is not. So it tries for another midpoint either to the right or left of 1.0 - which one depends on roundoff error. It should have actually STOPPED at 1.0. How can you fix it?
 
Oh ok. Thanks. Maybe if I set a and b so that it doesn't equal 1 exactly, it will converge like it's supposed to. I'll try it and let you know. Thanks
 
That will work - but it's not a complete solution. Your current algorithm doesn't have any way to terminate. Since you can't generally expect to find an x value such that f(x)=0.0 EXACTLY, one easy way out is to pick a small number d and stop if f(x)<d. Also you probably want to terminate if |a-b|<e for some other small number e.
 
Last edited:
Well I have it set so that the while loop terminates within a tolerance:

nn=log((bb-aa)/tol)/log(2)
kk=1
.
.
do while kk<nn


You input tolerance at the beginning and it gives you nn, an approximate number of iterations. I have it set so that once kk > nn, the loop stops. The problem usually gives a tolerance, but since this problem didn't, I chose a really small tolerance so I could be as accurate as possible.
 
Ah, ok. As long as you see what the problem is in this particular case.
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K