资源预览内容
第1页 / 共4页
第2页 / 共4页
第3页 / 共4页
第4页 / 共4页
亲,该文档总共4页全部预览完了,如果喜欢就下载吧!
资源描述
Gaussian elimination with complete pivotingTo keep the Gaussian elimination method smooth operation,We must ensure that the pivot elementandcan not too small in each 0)1(akkkakkk)1( operation.So the selection of appropriate pivot elements in every step of elimination.,the maximum absolute value or the major elements as the pivot element,this improved Gaussian elimination method named Gauss pivot element elimination. There have 3 methods to select pivot element,Gaussian elimination with partial pivoting、scaled partial pivoting、complete pivoting.Through access to some data,I introduce the Gaussian elimination with complete pivoting briefly.Complete pivoting at the th step searches all the kentries,to find the entry to the largest magnitude.Both row ),()1(kjkiakijand column interchanges are performed to bring this entry to the pivot position.The specific steps:axaxaxaaxaxaxaaxaxaxannnnnnnnnnnnn)0(1,)0(2)0(21)0(1)0(1, 2)0(22)0(221)0(21)0(1, 1)0(12)0(121)0(11,LMLLThe th elimination,find all(i=k,k+1,n; j=k,k+1n),the is kakij)1( Lak)1( the pivot element.aakijk)1()1(maxBoth row and column interchanges are performed to bring this entry to the pivot position.Move to (k,k).Until the n-1 step, the ak)1( original equation into the same equations on triangular solution:,)1(1,)1()2(1, 3)2(33)2(33)1(1, 2)1(23)1(232)1(22)0(1, 1)0(13)0(132)0(121)0(11axaaxaxaaxaxaxaaxaxaxaxannnnnnnnnnnnnnnnMLLLBackward substitution:Backward substitution is the solution of triangular systems .If,then0)1(annn . 1 , 2,1,11)1()1(1,)1()1(1,)1(,LnininijjiijiniiiiinnnnnnnxaaaxaaxAlgorithm:function x=Gauss(A,b) B=A,b; n=length(A); x=zeros(n,2); for i=1:n x(i,1)=i; %x 第一列数字 i 代表 x(i) end for i=1:n-1 m,p=max(abs(B(i:n,i:n);%求绝对值最大系数所在行号和列号l,q=max(m); if m=0; disp(A 奇异) returnend if p(q)+i-1i %行变换 pm=p(q)+i-1; C(i:n+1)=B(i,i:n+1); B(i,i:n+1)=B(pm,i:n+1); B(pm,i:n+1)=C(i:n+1); end if q+i-1i %列变换 q=q+i-1; D(1:n)=B(1:n,q); B(1:n,q)=B(1:n,i); B(1:n,i)=D(1:n); E(1:2)=x(q,:);%调换解的顺序 x(q,:)=x(i,:); x(i,:)=E(1:2); end for k=i+1:n %消元 am=B(k,i)/B(i,i); B(k,i:n+1)=B(k,i:n+1)-am*B(i,i:n+1); end end x(n,2)=B(n,n+1)/B(n,n); for i=n-1:-1:1 %回代 xx(i+1:n)=x(i+1:n,2); x(i,2)=(B(i,n+1)-B(i,i+1:n)*xx(i+1:n)/B(i,i); end for i=1:n-1 % 调换解的顺序 u,r=min(x(i:n,1); if r+i-1i r=r+i-1; xf(1:2)=x(i,1:2); x(i,1:2)=x(r,1:2); x(r,1:2)=xf(1:2); end end end For example P89,Exercises2 A=1.19 2.11 -100 1;14.2 -0.122 12.2 -1;0 100 -99.9 1;15.3 0.110 -13.1 - 1;b=1.12;3.44;2.15;4.16; x=Gauss(A,b)x =1.0000 0.17682.0000 0.01273.0000 -0.02074.0000 -1.1826
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号