计算方法实验(c语言_六项试验).doc
还剩
19页未读,
继续阅读
下载文档到电脑,马上远离加班熬夜!
亲,喜欢就下载吧,价低环保!
内容要点:
{printf("fold number\n");}nu++;}while (fabs(dx)>1e-6);return x;}结果???????361264081xx程序如下:#include #include #include #include #define N 100main(){int i;float *x;float c[12]={8.0,-3.0,2.0,20.0,4.0,11.0,-1.0,33.0,6.0,3.0,12.0,36.0};float *GauseSeidel(float *,int);x=GauseSeidel(c,3);for (i=0;i=N)while(1){epsilon=0;k++;for (i=0;i=MAX) {printf("the method is disconvergent"); return y;}for (i=0;i=0;i--){for (r=n-1;r>=i+1;r--)*(u+i*(n+1)+n)-=*(u+i*(n+1)+r)*x[r];x[i]=*(u+i*(n+1)+n)/(*(u+i*(n+1)+i));}return x;}结果3.用雅可比迭代法解方程组???????1632825321x程序如下:#include #include #include #include #define EPS 1e-6#define MAX 100float *Jacobi(float a[3][4],int n){float *x,*y,epsilon,s;int i,j,k=0;x=(float *)malloc(n*sizeof(float));y=(float *)malloc(n*sizeof(float));for (i=0;i
发表评论
暂无评论,赶快抢占沙发吧。