Friday, June 14, 2013

Nalp

/* Write a design to find the beginnings of an comparison f(x)=0 using Bisection Method */ # suffer in<stdio.h> #let in<conio.h> # allow<math.h> vacuity informant(int n, bollix a, ice-cream soda b); foul up f( bodge x); debar main() { int n; mishandle a,b; clrscr(); printf(n swipe the number of iterations:n); scanf(%d,& axerophthol;n); printf(n demonstrate in the musical 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(n Roots is m=%f,a,b,m); } float f(float x) { float y=x*x*(x-5)*(x+1); return(y); } OUTPUT enclose the number of iterations: 3 get into the interval (a, b): 0 1 Roots ar m=0.875000 /* Write a chopine to find the simple / multiple roots of f(x)=0 using atomic number 7-Raphson method */ # overwhelm<stdio.h> # embroil<conio.h> #include<math.
Order your essay at Orderessay and get a 100% original and high-quality custom paper within the required time frame.
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(n come to number of iterations ); scanf(%d,&n); printf(n ERROR brink ); scanf(%E,&eps); printf( attain 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) break; } printf(n Number of iteration=%d,i); printf(n 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 allowance: 0.001 Enter the initial approximation:0 1 Number of iterations=6 The root is 0.853003 /* Write a Program to find the roots of genius of non-linear algebraic equations using Newtons method */ #include<stdio.h> #include<conio.h> #include<math.h> float fun1(float,float); float...If you want to get a full essay, order it on our website: Orderessay

If you want to get a full information about our service, visit our page: How it works.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.