|
楼主 |
发表于 2005-9-19 01:30:37
|
显示全部楼层
<>include<stdio.h>///////////////// 适合第一题<BR>#include<math.h><BR>#define N 1000<p></p></P>
<>double f(double x)<BR>{ return pow(x,-2);}<p></p></P>
<>double zhongzhi(double a,double h,int n1)<BR>{double m=0.0;<BR> int k;<BR> for(k=0;k<=n1;k++)<BR> m=m+f((k*h+a+(k+1)*h+a)/2);<BR>return m;}<p></p></P>
<P><BR>double pow1(int k,int r)<BR>{ <BR>int f=1,i;<BR>for(i=0;i<r;i++)<BR>f*=k;<BR>return f;<BR>}<BR> <BR>double longbg(double a,double b,double e )<BR>{ long int n=1;<BR>int i,j,p,q;<BR>double h=0.0,m1=0.0,g[N][N]={0};<BR> h=b-a; <BR>g[0][0]=h/2*(f(a)+f(b)); <BR>for(i=1;i<N;i++)<BR> { g[0]=(double)1/2*g[i-1][0]+h/2*zhongzhi(a,h,n-1); <p></p></P>
<P> <BR> for(j=1;j<=i;j++)<BR> <BR> g[j]=pow1(4,j)/(pow1(4,j)-1)*g[j-1]-1/(pow1(4,j)-1)*g[i-1][j-1];<BR> <BR> <BR> <BR> n*=2;<BR> <BR> h=(double)(b-a)/n;<BR> <p></p></P>
<P> <BR> <BR> if(fabs(g-g[i-1][i-1])<e) break; <BR> p=i;q=j;<BR> <BR> }<BR>/* printf("龙贝格矩阵为:\n");<BR> for(i=0;i<=p;i++){<BR> printf("\n");<BR> for(j=0;j<=i;j++)<BR> printf(" %.7lf",g[j]);}<BR> <BR> printf("\n满意 积分的值为 :%.7lf\n",g[p][q-1]);*/<BR>m1=g[p][q-1];<BR> return m1;<BR>}<p></p></P>
<P>void main()<BR>{<BR>int i,n2;<p></p></P>
<P><BR>double a,b,h=0.0,e=0.0,len=0.0,T=0.0;<p></p></P>
<P>printf("请输入所满意积分的下界和误差极限:A,e:");<BR>scanf("%lf%lf",&a,&e);<BR>printf("输入DVD 的个数N2和 类别 len:\n");<BR>scanf("%d %lf",&n2,&len);<BR> printf("所输入的日期 初始点为=%lf 分周期 为 = %d",a,n2); <p></p></P>
<P>b=a+len;<BR>for(i=1;i<=n2;i++)<BR>{T=T+longbg(a,b,e);<BR> a=b;<BR> b=a+len;<BR>if(f(b)<e)break;<BR>}<BR>printf(" 所求的满意度常积分为: %lf",T);<p></p></P>
<P><STRONG> </STRONG><STRONG>只是部分:</STRONG><p></p></P>
<P>MODEL:<BR>SETS:<BR> demand/1..100/:d;<BR> supply/1..1000/;<BR> link(demand,supply):c,x,a;<BR>endsets<BR>data:<BR>d=<BR>enddata<p></p></P>
<P><a href="http://www.shumo.com/bbs/mailta=@if(#gt#0,1/c,0" target="_blank" >a=@if(#gt#0,1/c,0</A>);<p></p></P>
<P><a href="http://www.shumo.com/bbs/mailtmin=@sum(days" target="_blank" >min=@sum(days</A>: start);<BR> @for(days(J):<BR> @sum(days(I) | I #le# 5:<BR> start(@wrap(J+I+2,7))) >= required(J));<BR>end</P>
<P><p></p> </P>[em01][em01][em01][em01][em01][em01][em01][em01] |
|