各种数值积分幻灯片.ppt

#include stdio.h double func(double x) { double y; y=x; return(y); } double hermite_gauss(int n) { double s; int i,k; static double x[]={0.26356031972,1.41340305911,3.59642577104, 7.08581000586,12.64080084428}; static double w[]={0.52175561058,0.39866681108,0.07594244968, 0.00361175868,0.00002336997}; s=0.0; for(i=0;in;i++) s=s+w[i]*func(x[i]); return(s); } main() { double s; int n; clrscr(); printf(input n=); scanf(%d,n); s=hermite_gauss(5); printf(s=%lf\n,s); } 程序运行结果: input n=5↙ s= 1.000000 5.7

文档评论(0)

1亿VIP精品文档

相关文档