Computer Based Numerical & Statistical Techniques Lab
• Bi-Section Method Program Program 1. #include<stdio.h> #include<math.h> float f(float x) { return (x*x*x -4*x-9); } void bisect (float *x,float a,float b,int *itr) { *x= (a+b)/2; ++(*itr); printf(" interation no. %3d x=%7.5f\n",*itr,*x); } main() { int itr=0, maxitr; float x,a,b,aerr,x1; printf("Enter the value of a,b""allolwed error, maimum iteratio n\n"); scanf("%f%f%f%d",&a,&b,&aerr,&maxitr); bisect(&x,a,b,&itr); do { if(f(a)*f(x)<0) b=x; else a=x; bisect(&x1,a,b,&itr); if (fabs(x1-x)<aerr) { printf("after %d iteration ,root <169>""=%6.4f\n,itr,x1"); return 0; } x=x1; } while (itr< maxitr); printf("solution does not coverage,""iteration not sufficent "); return 1; } • Regula Falsi Method Program 2. #include <stdio.h...