Posts

Gauss Jordon Forward Interpolation Formula Using C programming

Gauss Jordon Forward Interpolation Formula Using C programming : #include<stdio.h> #include<conio.h> int main() {     int n,i,j,k;     printf("Enter the Number of Equations");     scanf("%d",&n);     float a[n][2*n],c;     for(i=1;i<=n;i++)     {          for(j=1;j<=2*n;j++)          {              if(j<=n)              {                  printf("Enter the x[%d][%d] : ",i,j);                  scanf("%f",&a[i][j]);              }                  else if(j>n&&(j-n==i))                     a[i][j]=1;         ...
Lagrange's Interpolation Formula : #include<stdio.h> int main() {     int i,j,n,o;     printf("Enter the value of n");     scanf("%d",&n);     float x[n],y[n],u,d,w,r;     for(i=0;i<n;i++)         {     printf("Enter the value of x[%d]",i);          scanf("%f",&x[i]);         }         for(i=0;i<n;i++)         {     printf("Enter the value of y[%d]",i);          scanf("%f",&y[i]);         }     r=0;     printf("Enter the number whose approximate value you want");     scanf("%f",&w);     for(i=0;i<n;i++)     {         u=d=1;         for(j=0;j<n;j++)         {           ...

Newton Backward Interpolation Formula

Newton Backward Interpolation Formula : #include<stdio.h> int main() {     int n,i,j;     printf("Enter the value of Number of inputs");     scanf("%d",&n);     float x[n],y[n][n],a; for(i=1;i<=n;i++)      {         printf("Enter the value of x[%d] : ",i);         scanf("%f",&x[i]);      } for(i=1;i<=n;i++)     {         printf("Enter the value of y[%d] : ",i);         scanf("%f",&y[i][1]);     } printf("Enter the value of X whose approximate value you want");     scanf("%f",&a);       int pc;       pc=n; for(i=2;i<=pc;i++)       {     for(j=1;j<n;j++)           {               y[j][i]=y[j+1][i-1]-y[j][i-1];       ...

Newton Forward Interpolation Method

Newton Forward Interpolation Method : #include<stdio.h> int main() {     int n,i,j;     printf("Enter the value of Number of inputs");     scanf("%d",&n);     float x[n],y[n][n],a; for(i=1;i<=n;i++)      {         printf("Enter the value of x[%d] : ",i);         scanf("%f",&x[i]);      } for(i=1;i<=n;i++)     {         printf("Enter the value of y[%d] : ",i);         scanf("%f",&y[i][1]);     } printf("Enter the value of X whose approximate value you want");     scanf("%f",&a);       int pc;       pc=n; for(i=2;i<=pc;i++)       {     for(j=1;j<n;j++)           {               y[j][i]=y[j+1][i-1]-y[j][i-1];         ...

Newton Raphson Method usng C Programming

Newton Raphson Method usng C Programming: #include<stdio.h> #include<math.h> #define e 0.001 #define f(x)  (x*x*x*x-x-10) #define df(x) (4*x*x*x-1) int main() {     int i;     float x0,x1,f1;     i=0;     printf("Enter the value of x0");     scanf("%f",&x0);     do     {         x1=x0-((f(x0))/(df(x0)));         f1=f(x1);         x0=x1;         i++;         printf("The Number of Iteration is %d and Value of Function is %f and value of x is %f\n",i,f1,x0);     }     while(fabs(f1)>e);     return 0; }
Regular Falsi Method Using C Programming: #include<stdio.h> #include<math.h> #define f(x) (2*x-(log(x)/log(10))-7) int main() {     float a,b,xn,x;     int i,p;     printf("Enter the value of A and B");     scanf("%f %f",&a,&b);     printf("Enter the Number of Iteration");     scanf("%d",&p);     for(i=1;i<=p;i++)     {      xn=((a*f(b))-(b*f(a)))/(f(b)-f(a));     printf("\nOutput is : %f ",xn);     if(f(a)>0)     {        if(f(xn)>0)             {a=xn;             b=b;}        else             {b=xn;             a=a;}     }      if(f(a)<0)     {        if(f(xn)<0)     ...
Image
C Programming For Runge Kutta Method: #include<stdio.h> #define f(x,y) ((x)+(y*y)) int main() {     int n,i;     float x0,y0,h,k1,k2,k3,k4,k;     printf("Enter the value of x0,y0 and h");     scanf("%f",&x0);     scanf("%f",&y0);     scanf("%f",&h);     printf("Enter the Number of Iteration");     scanf("%d",&n);     for(i=0;i<n;i++)     {    {                k1=h*(f(x0,y0));                k2=h*(f(x0+h/2,y0+k1/2));                k3=h*(f(x0+h/2,y0+k2/2));                k4=h*(f(x0+h,y0+k3));                k=(k1+2*k2+2*k3+k4)/6;                printf("The Output is %f",y0+k);     }...