14-15-2《几何与代数》
数学实验报告
学号: 姓名: 得分:
1. 实验一:利用MATLAB 用三种不同的方法求解线性方程组Ax b =。其中,常数项列
向量b 的分量是你的学号,系数矩阵为
110000001210000001310000001410000001510000001610000001710000001
8A ?? ? ? ? ? ?= ? ? ? ? ? ??
?
方法一:利用Cramer 法则求解;
方法二:作为矩阵方程求解; 方法三:利用Gauss 消元法求解。
一、利用Cramer 法则求解:
>>
a1=[1,1,0,0,0,0,0,0]';a2=[1,2,1,0,0,0,0,0]';a3=[0,1,3,1,0,0,0,0]';a4=[0,0,1,4,1,0,0,0]';a5=[0,0,0,1,5,1,0,0]';a6=[0,0,0,0,1,6,1,0]';a7=[0,0,0,0,0,1,7,1]';a8=[0,0,0,0,0,0,1,8]';b=[0;3;1;1;4;5;1;7]; D=det([a1,a2,a3,a4,a5,a6,a7,a8]),
D =10241 >> D1=det([b,a2,a3,a4,a5,a6,a7,a8]), D2=det([a1,b,a3,a4,a5,a6,a7,a8]), D3=det([a1,a2,b,a4,a5,a6,a7,a8]), D4=det([a1,a2,a3,b,a5,a6,a7,a8]), D5=det([a1,a2,a3,a4,b,a6,a7,a8]), D6=det([a1,a2,a3,a4,a5,b,a7,a8]), D7=det([a1,a2,a3,a4,a5,a6,b,a8]), D8=det([a1,a2,a3,a4,a5,a6,a7,b]),
D1 =-43060 D2 =43060 D3 =-12337 D4 =4192 D5 =5810 D6 =7722 D7 =-937 D8 =9078
>> x1=D1/D,x2=D2/D,x3=D3/D,x4=D4/D,x5=D5/D,x6=D6/D,x7=D7/D,x8=D8/D,