用C语言实现解线性方程组的高斯消去法

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

2009.72009.7【】C,TurboC.【】;C;,,[1],,,,.C.1.(GaussElimination):A;(BackwardSubstitution).:(1);(2);(3)[2].n:a11x1+a12x2+…+a1nxn=d1a21x1+a22x2+…+a2nxn=d2……an1x1+an2x2+…+annxn=dn(1):A×X=[aij]n×n·[xi]n×1=[di]n×1(2):2x1-3x2+5x3=10圯Row14x1+5x2+7x3=20圯Row23x1-6x2+9x3=30圯Row圯3(3):-42×(R1)+(R2)→R2-32×(R1)+(R3)→R3:2x1-3x2+5x3=10圯Row111x2-3x3=0圯Row2-32x2+32x3=15圯Row3(4):3233×11133×(2)+(R3):2x1-3x2+5x3=10圯Row111x2-3x3=0圯Row2+2422x3=15圯Row3(5):Row3:x3=15242223(6)Row2:x2=3×x311(7)Row1:x1=(-5x3+3x2)2(8)2.a11a12a13a21a22a23a31a32a3333d1d2d333(9):-a21a11R1+R2圯R2′(10)-a31a11R1+R3圯R3′(11):a11a12a130a22′a23′0a32′a3333′d1d2′d333′(12):-a′32a22R1+R3圯R3′(13):a11a12a130a22′a23′00a3333″d1d2′d333″(14):x3=d3″a33(15)x2=d2′-a23′·x3a22″(16)x1=d1-a13·x3-a12·x2a11(17)3.n:(1)n-1,j=1,ton-1;(2)j+1n,i=j+1ton;(3)n,k=1,n.aik=aik-aijajj(18)di=di-bj·aijajj(19):xn=bnann(20)j=n-11xj=bj(21)Fork=ntoj+1xj=xj-ajk·bk(22)xj=xjajj(23)4.nC#include<stdio.h>C◎(,226007)←R1←R2←R3←R1←R2←R3←R1←R2←R3ZHUANTIYANJIU1042009.72009.7,lim(x→x0)(x→∞)f′(x)g′(x),lim(x→x0)(x→∞)f(x)g(x).,,.limx→∞x+sinxx=limx→∞1+sinxxxx=1+limx→∞sinxx=1.3.7limx→1x3-3x+2x3-x2-x+1.limx→1x3-3x+2x3-x2-x+1=limx→13x2-33x3-2x-1=limx→16x6x-2=limx→166=1.,limx→16x6x-2,.,,,.limx→1x3-3x+2x3-x2-x+1=limx→13x2-33x3-2x-1=limx→16x6x-2=32.,,,,.,,.【】[1].[J].,2008,24(5):11-13.[2],.[M].:,2007(8).[3].4[M].:,2005.#include<stdlib.h>#include<math.h>#definedim10//10,doublea[dim+1][dim+1],b[dim+1],x[dim+1];//mprint(int,int,double[][dim+1],double[]);main(){intn,i,j,k;doubletemp;printf(“\n”);scanf(“%d”,&n);if(n>dim){printf(“:%d\n”,dim);exit(0);}printf(“:”);for(i=1;i<=n;++i){for(j=1;j<=n;++j){printf(“a[%d,%d]”,i,j);scanf(“%lf”,&a[i][j]);}printf(“b[%d]”,i);scanf(“%lf”,&b[i]);}mprint(n,n,a,b);///**/for(j=1;j<=n-1;j++){for(i=j+1;i<=n;i++){temp=a[i][j]/a[j][j];for(k=1;k<=n;k++)a[i][k]=a[i][k]-temp*a[j][k];b[i]=b[i]-temp*b[j];}mprint(n,n,a,b);//}/**/x[n]=b[n]/a[n][n];for(j=n-1;j>=1;j--){x[j]=b[j];for(k=n;k>=j+1;k--)x[j]=x[j]-x[k]*a[j][k];x[j]=x[j]/a[j][j];}for(j=1;j<=n;j++)printf(“x[%d]=%10.5e\n”,j,x[j]);}/**/mprint(intm,intn,doublea[dim+1][dim+1],doubleb[dim+1]){inti,j;for(i=1;i<=m;i++)for(j=1;j<=n;j++)printf(“%10.5e”,a[i][j]);//printf(“\n”);}5.,,10,C,,:、-.【】[1],,.Matlab[J].,2001(4):302~303.[2].[M].:,1998(7).(103)ZHUANTIYANJIU105

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功