【文件属性】:
文件名称:泊松分布函数求和故事的源程序
文件大小:563B
文件格式:C
更新时间:2014-04-09 17:12:08
c yuyan
比较有挑战的数学题目!
#include "math.h"
#include "stdio.h"
main()
{
int k,i,j;
double p,a,b,m,last=0,h;
printf("put in k,p\n");
scanf("%d",&k);
scanf("%lf",&p);
printf("p=%lf\n it is right",p);
printf("k=%d\n it is right",k);
for(j=0;j<=k;j++)
{for(i=1,h=1;i<=j;i++)
{h=h*i ; }
a=pow(p,j);
b=exp(-p);
printf("h=%lf\n",h);
printf("a=%lf\n",a);
printf("b=%lf\n",b);
m=a*b/h;
printf("m=%lf\n",m);
last+= m; printf("last=%lf\n",last);
}
printf("last=%lf\n",last);
printf(" it is right to come here");
getch();
}