1、1实验题目用下列方法解线性方程组 9237.1648.5047.621.98.42371. 3755.0. 321x并比较计算结果精度(1)顺序消元法;(2 ) 列主元消元法2 实验代码1.顺序消元法#includeusing namespace std;#define N 4/方程阶数void main()double aNN=1.1348,3.8326,1.1651,3.4017,0.5301,1.7875,2.5330,1.5435,3.4129,4.9317,8.7643,1.3142,1.2371,4.9998,10.6721,0.0147;double bN=9.5342,6.39
2、41,18.4231,16.9237;double mNN;double xN;int k,i,j;/消元计算,将方程组约化为三角形方程组for(k=0;k=0;i-) xi=bi;for(j=i+1;j#includeusing namespace std;#define N 4/方程阶数void display(double (*a)N,double *b)for(int i=0;ifabs(max)max=aik; l=i;if(fabs(max)*100000=0;i-)xi=bi;for(j=i+1;jN;j+)xi-=aij*xj;xi/=aii;/输出方程组的解cout“方程的解依次为“endl;for(i=0;iN;i+)cout“x“i+1“=“xiendl;3 实验结果及分析1.顺序消元法2.列主元消元法