Search:

Submit Article

# FUNCTION TABULATED AT EQUAL INTERVAL USING BACKWARD DIFFERENCE BETWEEN TABLE VALUE

Posted By: Adelchi Fischer     Category: C Programming     Views: 3691

## Code for FUNCTION TABULATED AT EQUAL INTERVAL USING BACKWARD DIFFERENCE BETWEEN TABLE VALUE in C Programming

```#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float x[10],y[10][10],sum,p,u,temp,temp1;
int i,n,j,k=0,f,m;
float fact(int);
clrscr();
printf("\nhow many record you will be enter: ");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("\n\nenter the value of x%d: ",i);
scanf("%f",&x[i]);
printf("\n\nenter the value of f(x%d): ",i);
scanf("%f",&y[k][i]);
}
printf("\n\nEnter X for finding f(x): ");
scanf("%f",&p);

for(i=1;i<n;i++)
{
for(j=i;j<n;j++)
{
y[i][j]=y[i-1][j]-y[i-1][j-1];
}
}
printf("\n_______________________________________________________________\n");
printf("\n  x(i)    y(i)");

for(i=1;i<n;i++)
{
printf("   y%d(i)",i);
}
printf("\n_______________________________________________________________\n");

for(i=0;i<n;i++)
{
printf("\n %.4f",x[i]);
for(j=0;j<=i;j++)
{
printf("  ");
printf("%.4f",y[j][i]);
}
printf("\n");
}

i=0;
do
{
if(x[i]==p)
k=1;
else
i++;
}while(k != 1);
f=i;
n=f+1;
sum=0;
for(i=1;i<n;i++)
{
sum = sum + (y[i][f]/i);
}
sum = sum/(x[1]-x[0]);
printf("\n\n f(%.2f) = %f ",p,sum);
getch();
}

/*______________________________________         OUT PUT______________________________________how many record you will be enter: 7enter the value of x0: 1.0enter the value of f(x0): 2.7183enter the value of x1: 1.2enter the value of f(x1): 3.3201enter the value of x2: 1.4enter the value of f(x2): 4.0552enter the value of x3: 1.6enter the value of f(x3): 4.9530enter the value of x4: 1.8enter the value of f(x4): 6.0496enter the value of x5: 2.0enter the value of f(x5): 7.3891enter the value of x6: 2.2enter the value of f(x6): 9.0250Enter X for finding f(x): 2.2_______________________________________________________________  x(i)    y(i)   y1(i)   y2(i)   y3(i)   y4(i)   y5(i)   y6(i)_______________________________________________________________ 1.0000  2.7183 1.2000  3.3201  0.6018 1.4000  4.0552  0.7351  0.1333 1.6000  4.9530  0.8978  0.1627  0.0294 1.8000  6.0496  1.0966  0.1988  0.0361  0.0067 2.0000  7.3891  1.3395  0.2429  0.0441  0.0080  0.0013 2.2000  9.0250  1.6359  0.2964  0.0535  0.0094  0.0014  0.0001 f(2.20) = 9.022895*/```
Share:

 Adelchi Fischer author of FUNCTION TABULATED AT EQUAL INTERVAL USING BACKWARD DIFFERENCE BETWEEN TABLE VALUE is from Frankfurt, Germany. View All Articles

 Please enter your CommentComment should be atleast 30 Characters.Please put code inside [Code] your code [/Code]. No Comment Found, Be the First to post comment!