Shared2018-10-02-154131.sagewsOpen in CoCalc
Writing assignment Multi
X=matrix(10, 4, [6.5, 5.1, 4.7, 1, 10.9, 5.8, 8.8, 1, 3.2, 2.1, 15.1, 1, 8.7, 8.4, 12.2, 1, 2.1, 2.9, 10.6, 1, 2.3, 1.2, 3.5, 1, 7.2, 3.7, 9.7, 1, 7.0, 7.6, 5.9, 1, 13.1, 7.7, 20.8, 1, 8.2, 4.5, 7.9, 1])
X

[6.50000000000000 5.10000000000000 4.70000000000000 1.00000000000000] [10.9000000000000 5.80000000000000 8.80000000000000 1.00000000000000] [3.20000000000000 2.10000000000000 15.1000000000000 1.00000000000000] [8.70000000000000 8.40000000000000 12.2000000000000 1.00000000000000] [2.10000000000000 2.90000000000000 10.6000000000000 1.00000000000000] [2.30000000000000 1.20000000000000 3.50000000000000 1.00000000000000] [7.20000000000000 3.70000000000000 9.70000000000000 1.00000000000000] [7.00000000000000 7.60000000000000 5.90000000000000 1.00000000000000] [13.1000000000000 7.70000000000000 20.8000000000000 1.00000000000000] [8.20000000000000 4.50000000000000 7.90000000000000 1.00000000000000]
T=transpose(X)
T
[6.50000000000000 10.9000000000000 3.20000000000000 8.70000000000000 2.10000000000000 2.30000000000000 7.20000000000000 7.00000000000000 13.1000000000000 8.20000000000000] [5.10000000000000 5.80000000000000 2.10000000000000 8.40000000000000 2.90000000000000 1.20000000000000 3.70000000000000 7.60000000000000 7.70000000000000 4.50000000000000] [4.70000000000000 8.80000000000000 15.1000000000000 12.2000000000000 10.6000000000000 3.50000000000000 9.70000000000000 5.90000000000000 20.8000000000000 7.90000000000000] [1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000]
Y = matrix(10, 1, [85.1, 106.3, 50.2, 130.6, 54.8, 30.3, 79.4, 91.0, 135.4, 89.3])
Y
[85.1000000000000] [106.300000000000] [50.2000000000000] [130.600000000000] [54.8000000000000] [30.3000000000000] [79.4000000000000] [91.0000000000000] [135.400000000000] [89.3000000000000]
A=T*X
A
[596.380000000000 402.630000000000 759.640000000000 69.2000000000000] [402.630000000000 295.460000000000 520.580000000000 49.0000000000000] [759.640000000000 520.580000000000 1224.94000000000 99.2000000000000] [69.2000000000000 49.0000000000000 99.2000000000000 10.0000000000000]
B=T*Y
B
[6908.13000000000] [4878.10000000000] [9202.55000000000] [852.400000000000]
M=(A.inverse())*B
M
[ 3.98295856402388] [ 7.59666694645549] [0.802072495666959] [ 12.4976995423068]
F=transpose(M)
F
[ 3.98295856402388 7.59666694645549 0.802072495666959 12.4976995423068]
P=F*T
P
[80.8996723650197 107.030854141478 53.3074622193108 120.746725846678 51.3942151255476 33.5817583101427 77.0627721131336 102.845306007971 139.851900128600 85.6793337421213]
N=matrix(3,4,[9.8,6.2,3.9,1,3.8,6.7,14.5,1,8.1,3.0,10.0,1])
N
[9.80000000000000 6.20000000000000 3.90000000000000 1.00000000000000] [3.80000000000000 6.70000000000000 14.5000000000000 1.00000000000000] [8.10000000000000 3.00000000000000 10.0000000000000 1.00000000000000]
N*(transpose(F))
[101.758111270866] [90.1606618140203] [75.5703897069363]
X = transpose(matrix(10, 4, [6.5, 5.1, 4.7, 1, 10.9, 5.8, 8.8, 1, 3.2, 2.1, 15.1, 1, 8.7, 8.4, 12.2, 1, 2.1, 2.9, 10.6, 1, 2.3, 1.2, 3.5, 1, 7.2, 3.7, 9.7, 1, 7.0, 7.6, 5.9, 1, 13.1, 7.7, 20.8, 1, 8.2, 4.5, 7.9, 1]))
X
[6.50000000000000 10.9000000000000 3.20000000000000 8.70000000000000 2.10000000000000 2.30000000000000 7.20000000000000 7.00000000000000 13.1000000000000 8.20000000000000] [5.10000000000000 5.80000000000000 2.10000000000000 8.40000000000000 2.90000000000000 1.20000000000000 3.70000000000000 7.60000000000000 7.70000000000000 4.50000000000000] [4.70000000000000 8.80000000000000 15.1000000000000 12.2000000000000 10.6000000000000 3.50000000000000 9.70000000000000 5.90000000000000 20.8000000000000 7.90000000000000] [1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000]
L=X.rows()
L[3:3] = [((x*y) for (x,y,z,w) in X.columns())]
Xnew = matrix(L)
Xnew
[6.50000000000000 10.9000000000000 3.20000000000000 8.70000000000000 2.10000000000000 2.30000000000000 7.20000000000000 7.00000000000000 13.1000000000000 8.20000000000000] [5.10000000000000 5.80000000000000 2.10000000000000 8.40000000000000 2.90000000000000 1.20000000000000 3.70000000000000 7.60000000000000 7.70000000000000 4.50000000000000] [4.70000000000000 8.80000000000000 15.1000000000000 12.2000000000000 10.6000000000000 3.50000000000000 9.70000000000000 5.90000000000000 20.8000000000000 7.90000000000000] [33.1500000000000 63.2200000000000 6.72000000000000 73.0800000000000 6.09000000000000 2.76000000000000 26.6400000000000 53.2000000000000 100.870000000000 36.9000000000000] [1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000 1.00000000000000]
transpose(Xnew)
[6.50000000000000 5.10000000000000 4.70000000000000 33.1500000000000 1.00000000000000] [10.9000000000000 5.80000000000000 8.80000000000000 63.2200000000000 1.00000000000000] [3.20000000000000 2.10000000000000 15.1000000000000 6.72000000000000 1.00000000000000] [8.70000000000000 8.40000000000000 12.2000000000000 73.0800000000000 1.00000000000000] [2.10000000000000 2.90000000000000 10.6000000000000 6.09000000000000 1.00000000000000] [2.30000000000000 1.20000000000000 3.50000000000000 2.76000000000000 1.00000000000000] [7.20000000000000 3.70000000000000 9.70000000000000 26.6400000000000 1.00000000000000] [7.00000000000000 7.60000000000000 5.90000000000000 53.2000000000000 1.00000000000000] [13.1000000000000 7.70000000000000 20.8000000000000 100.870000000000 1.00000000000000] [8.20000000000000 4.50000000000000 7.90000000000000 36.9000000000000 1.00000000000000]
V=Xnew*(transpose(Xnew))
V
[596.380000000000 402.630000000000 759.640000000000 3769.19500000000 69.2000000000000] [402.630000000000 295.460000000000 520.580000000000 2630.33500000000 49.0000000000000] [759.640000000000 520.580000000000 1224.94000000000 4741.29700000000 99.2000000000000] [3769.19500000000 2630.33500000000 4741.29700000000 25602.5379000000 402.630000000000] [69.2000000000000 49.0000000000000 99.2000000000000 402.630000000000 10.0000000000000]
V.inverse()
[ 0.0988506487892504 0.0750256543960213 0.0101068676527365 -0.0164029183934547 -0.491501620001597] [ 0.0750256543960204 0.188741026657334 0.0206077972602928 -0.0227052977240743 -0.734254505599100] [ 0.0101068676527364 0.0206077972602928 0.00781509021307505 -0.00312231493291073 -0.122729659502290] [ -0.0164029183934546 -0.0227052977240744 -0.00312231493291074 0.00366126387348386 0.108324050927064] [ -0.491501620001594 -0.734254505599102 -0.122729659502291 0.108324050927064 3.95506524763297]
U=transpose(Y)*(transpose(Xnew))
U
[6908.13000000000 4878.10000000000 9202.55000000000 43749.6870000000 852.400000000000]
Pnew=U*(V.inverse())
Pnew
[ 5.28620555785938 9.40065147489452 1.05014710364325 -0.290895255484557 3.89112171606303]


transpose(Pnew*Xnew)
[81.4872940319212] [106.885437311445] [54.4507527466484] [120.399751852190] [51.6140498574794] [30.2028202266270] [79.1711894889912] [103.059752149994] [138.025886215761] [87.1030661189368]
N=matrix(3,4,[9.8,6.2,3.9,1,3.8,6.7,14.5,1,8.1,3.0,10.0,1])
N
[9.80000000000000 6.20000000000000 3.90000000000000 1.00000000000000] [3.80000000000000 6.70000000000000 14.5000000000000 1.00000000000000] [8.10000000000000 3.00000000000000 10.0000000000000 1.00000000000000]
transpose(N)
[9.80000000000000 3.80000000000000 8.10000000000000] [6.20000000000000 6.70000000000000 3.00000000000000] [3.90000000000000 14.5000000000000 10.0000000000000] [1.00000000000000 1.00000000000000 1.00000000000000]
L=transpose(N).rows()
L[3:3] = [((x*y) for (x,y,z,w) in transpose(N).columns())]
Nnew = matrix(L)
Nnew
[9.80000000000000 3.80000000000000 8.10000000000000] [6.20000000000000 6.70000000000000 3.00000000000000] [3.90000000000000 14.5000000000000 10.0000000000000] [60.7600000000000 25.4600000000000 24.3000000000000] [1.00000000000000 1.00000000000000 1.00000000000000]
Pnew*Nnew
[100.400753308398 94.7840075159123 78.3440574875653]