# Show that the Bisection Method converges to...

by GTdan
Tags: bisection, converges, method
 P: 70 1. The function defined by f(x)=$$\sin(\pi*x)$$has zeros at every integer x. Show that when -12 c. 1, if a+b=2 2. Bisection Method An interval $$[a_{n+1},b_{n+1}]$$containing an approximation to a root of f(x)=0 is constructed from an interval $$[a_{n},b_{n}]$$ containing the root by first letting $$p_{n}=a_{n}+\frac{(b_{n}-a_{n})}{2}$$ Then set $$a_{n+1}=a_{n}$$ and $$b_{n+1}=p_{n}$$ if $$f(a_{n})*f(p_{n})<0$$ and $$a_{n+1}=p_{n}$$ and $$b_{n+1}=b_{n}$$ otherwise. 3. I attempted to randomly choose numbers for a and b to satisfy the relations a+b<2 , -1
 P: 70 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