0% found this document useful (0 votes)
62 views4 pages

Method of Biseection

This document describes using the bisection method to find a positive root of the equation x3-3x+1.06=0 that lies between 0 and 1. It provides pseudocode that initializes the lower and upper bounds, calculates the midpoint, and iteratively narrows the bounds until the root is found. The output shows the method finding a root of approximately 0.34082 after 11 iterations, with discussions on the convergence of the method and comparing it to Newton's method.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views4 pages

Method of Biseection

This document describes using the bisection method to find a positive root of the equation x3-3x+1.06=0 that lies between 0 and 1. It provides pseudocode that initializes the lower and upper bounds, calculates the midpoint, and iteratively narrows the bounds until the root is found. The output shows the method finding a root of approximately 0.34082 after 11 iterations, with discussions on the convergence of the method and comparing it to Newton's method.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

METHOD OF BISECTION Problem Statement:- Solve the equation x3-3x+1.

06=0 using method of bisection to find 1 positive root which lies between 0 and 1. Algorithm: Input:- x0 is the initial assumption and x1 is the final assumption. internal variable I is assigned by 1. Output:- variable mid is the Approximate value of ROOT.bisect() is the given integral function. Data structure:- No data structure is used. Steps:1. Start 2. while(bisect(x0)*bisect(x1)>0) do 3. read x0, x1 4. Endwhile 5. for k=1 to 10 do 6. mid=(x0+x1)/2 7. if(bisect(mid)==0) then 8. ROOT=mid 9. else 10. if(bisect(mid)*bisect(x0)<0) then 11. x1=mid 12. else then 13. x0=mid 14. Endif 15. i=i+1 16. Endif 17. Endfor 18. Stop
Source code:#include<stdio.h> #include<conio.h>

float bisect(float x);

void main() { float x0,x1,mid; int i=1,k; char d; //clrscr(); printf("\t\t OUTPUT\n"); do { printf("\nENTER THE INITIAL ASSUMPTION: "); scanf("%f",&x0); printf("ENTER THE FINAL ASSUMPTION: "); scanf("%f",&x1); printf("\n"); printf("f(%1.1f)= %f\tf(%1.1f)= %f",x0,bisect(x0),x1,bisect(x1)); printf("\n"); } while(bisect(x0)*bisect(x1)>0); printf("\ni.e.,THE ROOT LIES BETWEEN (%1.1f,%1.1f)",x0,x1); for(k=1;k<=10;k++) { mid=(x0+x1)/2; if(bisect(mid)==0) { printf("\n\n\nTHE ROOT= %f",mid); break; } else {

if(bisect(mid)*bisect(x0)<0) x1=mid; else x0=mid; } i++; } printf("\nTHE NO. OF ITERATION: %d",i); printf("\nx0= %f\tx1= %f",x0,x1); printf("\nf(%1.4f)= %f\tf(%1.4f)= %f",x0,bisect(x0),x1,bisect(x1)); printf("\ni.e.,THE ROOT LIES BETWEEN (%f,%f)",x0,x1); printf("\n\n\nTHE APPROXIMATE VALUE OF THE ROOT= %3.5f",mid); getch(); } float bisect(float x) { return(x*x*x+3*x-1.06); }

Output:ENTER THE INITIAL ASSUMPTION: 0 ENTER THE FINAL ASSUMPTION: 1 f(0.0)= -1.060000 f(1.0)= 2.940000

i.e.,THE ROOT LIES BETWEEN (0.0,1.0) THE NO. OF ITERATION: 11 x0= 0.339844 x1= 0.340820 f(0.3408)= 0.002050

f(0.3398)= -0.001219

i.e.,THE ROOT LIES BETWEEN (0.339844,0.340820)

THE APPROXIMATE VALUE OF THE ROOT= 0.34082

Discussions: This iterative approach is surely convergent. To get a root of f(x) = 0, correct to p-significant figures, we are to go up to qth iteration so that xq and xq+1 (check) be same, up to p-significant figures. A comparison of the Bisection Method and the Newton-Raphson Method. The Newton-Raphson Method is often much faster than the Bisection Method. In the last example, we started with an interval of length 1. After 10 steps, the interval [a10, b10] has length 1/1024. Consequently every 10 steps of the Bisection Method will give us about 3 digits more accuracy - that is rather slow. (On the Newton-Raphson Method page, we did the same example, compare the speeds of convergence!)

You might also like