/* carry through a Program to find the beginnings of an comparison f(x)=0 using Bisection Method */ # allow in<stdio.h> #let in<conio.h> # allow<math.h> vacuity start(int n, shove along a,float b); float f(float x); void main() { int n; float a,b; clrscr(); printf( raise the add together of iterations:); scanf(%d,&n); printf( give in the interval(a,b):); scanf(%f %f,&a,&b); root(n,a,b); getch(); } void root(int n,float a,float b) { int i; float m; for(i=1;i<n+1;i++) { m=(a+b)/2; if(f(m)*f(a)<0) b=m; else a=m; } printf( Roots is m=%f,a,b,m); } float f(float x) { float y=x*x*(x-5)*(x+1); return(y); } OUTPUT Enter the number of iterations: 3 Enter the interval (a, b): 0 1 Roots ar m=0.875000 /* Write a Program to find the simple / multiple roots of f(x)=0 using Newton-Raphson method */ #let in<stdio.h> # include<conio.h> #include<math.
h> float eps; void iter(int n,float x); float f(float x); float df(float x); void main() { int n; float a; clrscr(); printf( Enter number of iterations ); scanf(%d,&n); printf( hallucination margin ); scanf(%E,&eps); printf(Enter the initial estimation ); scanf(%f,&a); iter(n,a); getch(); } void iter(int n,float x) { int i; i=0; for(i=1;i<=n;i++) { x=x-(f(x)/df(x)); if(fabs(f(x))<=eps) lay off; } printf( Number of iteration=%d,i); printf( the root is %f,x); } float f(float x) { return(x*exp(x)-2); } float df(float x) { return(exp( x)*(x+1)); } OUTPUT Enter the number of! iterations: 5 ERROR permissiveness: 0.001 Enter the initial appraisal:0 1 Number of iterations=6 The root is 0.853003 /* Write a Program to find the roots of constitution of non-linear algebraical equations using Newtons method */ #include<stdio.h> #include<conio.h> #include<math.h> float fun1(float,float); float...If you want to get a expert essay, order it on our website: OrderCustomPaper.com
If you want to get a full essay, visit our page: write my paper
No comments:
Post a Comment