您的当前位置:首页正文

牛顿插值 c 语言程序

来源:一二三四网
#include #include int main() {

double *x,*y,*data,temp1,temp2; int number; int t,time; double insert; clrscr();

printf(\" input the data you want:: \"); scanf(\"%d\

x=(double *)malloc(number*sizeof(double)); y=(double *)malloc(number*sizeof(double)); data=(double *)malloc(number*sizeof(double));

for(t=0;tprintf(\"input the x and y::\");

scanf(\"%lf,%lf\ x[t]=temp1; y[t]=temp2; data[t]=temp2; }

for(t=1;tfor(time=number-1;time>=t;time--) { data[time]=(data[time]-data[time-1])/(x[time]-x[time-t]);

} }

printf(\"\\n\");

printf(\"please input the inset data you want ::\\n\"); scanf(\"%lf\

temp2=0;

for(t=0;ttemp1=1;

for (time=0;timetemp2+=temp1*data[t]; }

printf(\"the insert y is ::%lf\ }

因篇幅问题不能全部显示,请点此查看更多更全内容

Top