资源描述:
《数值分析作业(C语言编程实现).doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#includedoublef(doublex){doubleans;ans=exp(x);returnans;}voidmain(){doublea=1,b=3,error=0.0001,t[20][20],h,c;inti,j,k,m,n;h=b-a;t[0][0]=h*(f(a)+f(b))/2;k=1;while(1){t[0][k]=0;m=1;for(j=0;j2、(i-0.5)*h);t[0][k]=(t[0][k]+t[0][k-1])/2;for(j=1;j<=k;j++){c=1;for(n=0;n#includedoublef(dou
3、blet){doubleans;ans=pow(cos(t),1.0/3);returnans;}voidmain(){doublex=0,eslong=0.,x0;intN=20,i;printf("近似初值x0=%lf",x);for(i=0;i4、迭代失败");}#include#includedoublea=0,b=1,x,y=0,h=0.1,k1,k2,k3,k4;inti,N;doublef(doublet,doubles){doubleans;ans=1+t*t;returnans;}voidmain(){N=(b-a)/h;x=a;printf("初值为(x0,y0)=(%.8f,%.8f)",x,y);for(i=0;i5、2,y+h*k2/2);k4=f(x+h,y+h*k3);y=y+h*(k1+2*(k2+k3)+k4)/6;x=x+h;printf("第%d次输出结果为(x%d,y%d)=(%.8f,%.8f)",i+1,i+1,i+1,x,y);}}#includevoidmain(){doubledatax[4]={1.2,2.9,4.6,5.8},datay[10]={14.84,33.71,58.36,79.24},l[3],x=1.5,y;inti,j;y=0;for(i=0;i<=3;i++){l[i]=1
6、;for(j=0;jvoidmain(){doubledatay[9]={11.7,14.87,21.44,31.39,44.73,61.46,81.57,1
7、05.11,131.91};intm=2,i,j,k;doublep,data[9][4],a[3][4],datax[9]={1.2,2.3,3.4,4.5,5.6,6.7,7.8,8.9,10.0};for(i=0;i<9;i++)for(j=1;j<2*m+1;j++){data[i][j]=1;for(k=0;k8、][j]=a[i][j]+data[k][i+j];}}a[0][0]=9;a[0][m+1]=0;for(i=0;i<9;i++)a[0][m+1]=a[0][m+1]+datay[i];for(i=1;i