Message Boards Message Boards

GROUPS:

How Row Reduce a matrix

Posted 11 days ago
256 Views
|
6 Replies
|
0 Total Likes
|

So I am trying to combine matrix "A" and matrix "B" into an augmented matrix and row reduce the augmented matrix. How can I accomplish that?

Clear[x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, 
  x15, x16, x17, x18, x19, x20, x21, x22, x23];
equation1 = 
  634.14 x1 + 97.54 x10 - 216.48 x11 - 486.49 x12 + 12.46 x13 + 
    649.97 x14 + 877.29 x15 - 755.88 x16 + 365.27 x17 - 442.49 x18 + 
    736.68 x19 + 268.69 x2 - 387.29 x20 + 742.82 x21 - 348.74 x22 + 
    98.25 x23 - 939.96 x3 - 313.98 x4 + 672.09 x5 + 348.98 x6 + 
    754.7 x7 - 535.21 x8 - 72.71 x9 == 102.79;
equation2 = 
  57.49 x1 + 336.13 x10 - 306.59 x11 - 151.18 x12 + 393.28 x13 - 
    229.18 x14 + 21.16 x15 - 878.84 x16 - 733.05 x17 + 567.96 x18 - 
    596.09 x19 - 343.58 x2 + 553.37 x20 - 741.77 x21 + 550.17 x22 + 
    269.73 x23 + 854.11 x3 + 84.37 x4 + 995.49 x5 - 521.77 x6 + 
    477.37 x7 - 865.91 x8 + 908.69 x9 == -762.13;
equation3 = 
  768.64 x1 - 866.74 x10 - 322.2 x11 - 315.52 x12 + 627.03 x13 + 
    392.89 x14 - 477.87 x15 + 936.09 x16 - 379.37 x17 - 681.48 x18 + 
    997.81 x19 - 55.4 x2 - 160.5 x20 + 737.81 x21 - 886.85 x22 - 
    291.88 x23 - 987.62 x3 + 324.21 x4 - 770.56 x5 - 878.62 x6 + 
    880.97 x7 + 832.53 x8 + 916.11 x9 == 767.06;
equation4 = 
  852.33 x1 + 93.77 x10 - 308.41 x11 - 939.14 x12 - 618.9 x13 + 
    573.08 x14 + 61. x15 - 462.59 x16 - 241.62 x17 - 675.85 x18 - 
    38.36 x19 - 990.88 x2 - 783.38 x20 - 296.37 x21 + 921.63 x22 - 
    649.89 x23 - 435.02 x3 + 288.33 x4 + 576.8 x5 + 511.03 x6 - 
    77.95 x7 - 564.5 x8 - 298.31 x9 == 112.21;
equation5 = 
  646.65 x1 - 840.26 x10 - 106.99 x11 - 445.78 x12 + 505.43 x13 + 
    191.41 x14 - 912.5 x15 - 520.01 x16 - 23.7 x17 + 903.8 x18 - 
    631.25 x19 - 525.66 x2 + 530.8 x20 + 431.07 x21 + 66.8 x22 + 
    303.66 x23 - 336.69 x3 - 69.38 x4 - 15.55 x5 - 641.89 x6 - 
    57.87 x7 + 696.96 x8 + 409.45 x9 == 214.6;
equation6 = -552.61 x1 + 912.29 x10 - 975.39 x11 - 870.38 x12 + 
    921.44 x13 - 698.54 x14 + 862.28 x15 + 329.94 x16 + 988.37 x17 + 
    374.54 x18 + 637.58 x19 - 441.51 x2 - 42.11 x20 - 138.73 x21 + 
    690.18 x22 + 917.89 x23 - 142.99 x3 + 343.93 x4 - 58.83 x5 + 
    965.62 x6 + 945.54 x7 + 295.82 x8 - 428.23 x9 == 788.16;
equation7 = 
  38.29 x1 + 403.04 x10 - 690.25 x11 - 235.05 x12 + 636.74 x13 - 
    146.01 x14 - 945.1 x15 + 178.11 x16 + 838.91 x17 + 921.68 x18 - 
    676.65 x19 + 183.46 x2 - 820.45 x20 + 414.96 x21 - 406.99 x22 - 
    222.9 x23 + 910.97 x3 - 374.53 x4 - 899.46 x5 - 774.27 x6 + 
    995.92 x7 + 551.71 x8 + 56.73 x9 == -514.84;
equation8 = 
 190.75 x1 + 238.13 x10 - 984.05 x11 - 531.96 x12 - 919.46 x13 + 
   412.37 x14 - 379.33 x15 + 24.95 x16 + 823.48 x17 - 811.69 x18 - 
   228.43 x19 + 152.52 x2 + 468.03 x20 - 472.1 x21 + 466.73 x22 - 
   722.04 x23 - 556.3 x3 + 232.74 x4 + 231.01 x5 + 422.89 x6 + 
   158.29 x7 + 534. x8 + 542.32 x9 == -233.44; equation9 = 
 870.91 x1 + 556. x10 - 366.9 x11 - 144.72 x12 - 472.31 x13 + 
   30.68 x14 - 969.56 x15 - 403.76 x16 + 476.46 x17 - 869.8 x18 - 
   458.33 x19 - 705.33 x2 - 157.96 x20 + 212.32 x21 - 612.48 x22 - 
   739.55 x23 - 892.3 x3 - 138.97 x4 + 201.55 x5 - 293.1 x6 - 
   189.66 x7 - 240.01 x8 - 
   346.22 x9 == -963.15; equation10 = -778.6 x1 + 385.63 x10 - 
   900.46 x11 + 28.64 x12 + 270.83 x13 + 434.3 x14 - 314.46 x15 - 
   669.93 x16 + 122.05 x17 + 7.24 x18 + 615.19 x19 - 946.84 x2 + 
   433.12 x20 + 779.5 x21 - 849.43 x22 - 334.84 x23 + 580. x3 - 
   493.3 x4 - 526.83 x5 - 665.79 x6 - 352.95 x7 + 219.66 x8 - 
   560.62 x9 == -95.48;
equation11 = 
 236.42 x1 - 15.5 x10 + 525.42 x11 - 177.3 x12 + 899.17 x13 + 
   622.3 x14 - 238.89 x15 + 292.48 x16 + 561.03 x17 + 29.5 x18 - 
   406.12 x19 + 343.69 x2 - 703.95 x20 - 443. x21 - 142.38 x22 - 
   208.98 x23 + 54.93 x3 + 206.79 x4 - 787.09 x5 - 151.16 x6 - 
   986.95 x7 + 273.85 x8 + 522.39 x9 == 155.73; equation12 = 
 680.18 x1 + 708.45 x10 - 664.91 x11 - 946.99 x12 - 392.22 x13 + 
   92.91 x14 - 63.53 x15 + 703.83 x16 - 320.08 x17 - 268.2 x18 + 
   422.39 x19 - 419.69 x2 - 420.1 x20 + 172.18 x21 + 328.86 x22 - 
   870.12 x23 - 982.71 x3 - 480.25 x4 - 825.52 x5 - 248.07 x6 + 
   652.84 x7 - 942.37 x8 - 244.09 x9 == 802.85;
equation13 = 
  50.63 x1 - 486.19 x10 - 346.43 x11 + 194.1 x12 + 791.08 x13 - 
    356.58 x14 + 566.14 x15 + 952.08 x16 - 602.24 x17 - 695.1 x18 - 
    928.78 x19 + 257.52 x2 - 542.2 x20 + 787.83 x21 + 519.67 x22 - 
    239.3 x23 + 253.41 x3 + 858.31 x4 + 775.11 x5 - 33.93 x6 + 
    949.52 x7 - 501.49 x8 - 932.67 x9 == 756.75;
equation14 =
 -282.05 x1 + 422.61 x10 + 768.42 x11 + 221.72 x12 - 283. x13 + 
   951.33 x14 + 5.37 x15 + 786.37 x16 - 20.16 x17 + 591.71 x18 + 
   821.73 x19 + 988.3 x2 + 720.57 x20 - 636.77 x21 + 583.91 x22 + 
   190.09 x23 - 70. x3 - 582.82 x4 - 584.18 x5 - 927.73 x6 - 
   66.66 x7 + 334.4 x8 - 314.91 x9 == -777.53; equation15 = 
 347.84 x1 + 342.35 x10 + 672.1 x11 + 403.15 x12 + 961.69 x13 + 
   428.25 x14 + 183.05 x15 + 855.27 x16 - 835.89 x17 - 169.98 x18 - 
   492.42 x19 + 108.05 x2 + 663.31 x20 + 26.26 x21 + 916.49 x22 - 
   176.56 x23 - 772.21 x3 + 188.46 x4 - 883.49 x5 + 244.16 x6 - 
   880.37 x7 + 0.84 x8 + 233.13 x9 == -275.74;
equation16 = -689. x1 + 44.41 x10 - 94.25 x11 - 712.75 x12 - 
   365.06 x13 - 80.49 x14 - 161.44 x15 + 242.22 x16 + 90.75 x17 - 
   986.12 x18 - 819.92 x19 - 296.6 x2 - 58.88 x20 - 372.61 x21 + 
   272.23 x22 + 66.93 x23 + 360.46 x3 - 976.77 x4 - 776.85 x5 + 
   897.3 x6 - 47.97 x7 - 234.66 x8 - 711.09 x9 == 786.52; equation17 =
  983.17 x1 + 863.82 x10 + 371.05 x11 - 719.86 x12 - 415.52 x13 - 
   589.89 x14 + 12.68 x15 - 88.53 x16 - 980.51 x17 - 178.96 x18 - 
   937.55 x19 - 257.57 x2 + 347.72 x20 + 212.37 x21 + 33.56 x22 + 
   851.85 x23 - 9.23 x3 - 634.54 x4 + 573.32 x5 + 281.41 x6 + 
   915.45 x7 - 140.7 x8 - 
   540.64 x9 == -68.35; equation18 = -518.67 x1 - 934.33 x10 + 
   399.3 x11 - 185.26 x12 + 740.53 x13 + 213.06 x14 + 158.16 x15 + 
   659.67 x16 + 216.62 x17 - 993.05 x18 + 89.73 x19 - 619.61 x2 + 
   603.47 x20 + 812.34 x21 + 488.95 x22 - 461.56 x23 - 587.24 x3 + 
   399.91 x4 - 837.61 x5 + 964.37 x6 - 255. x7 + 628.13 x8 - 
   231.17 x9 == 758.41;
equation19 = 
  333.16 x1 + 779.73 x10 - 559.82 x11 - 781.88 x12 - 465.08 x13 - 
    367.24 x14 - 742.58 x15 + 432.99 x16 + 215.89 x17 + 218.75 x18 + 
    230.71 x19 - 324.23 x2 - 545.6 x20 - 283.21 x21 + 676.47 x22 + 
    18.24 x23 - 475.34 x3 + 886.15 x4 - 887.09 x5 - 398.95 x6 - 
    660.04 x7 - 89.91 x8 + 264.35 x9 == 891.45;
equation20 = 
 913.14 x1 + 578.23 x10 + 544.77 x11 - 281.47 x12 + 45.8 x13 + 
   818.8 x14 - 27.56 x15 - 853.88 x16 - 734.34 x17 - 887.11 x18 - 
   426.76 x19 - 105.89 x2 - 286.53 x20 - 485.57 x21 - 762.6 x22 + 
   137.72 x23 - 270.55 x3 + 179.56 x4 + 109.98 x5 + 300.58 x6 - 
   578.92 x7 + 135.87 x8 + 270.43 x9 == 863.38; equation21 = 
 244.79 x1 + 891.92 x10 - 208.48 x11 - 199.29 x12 + 25.62 x13 + 
   510.89 x14 + 300.53 x15 + 953.35 x16 + 960. x17 + 341.88 x18 - 
   780.57 x19 - 772.53 x2 - 347.5 x20 + 328.68 x21 - 946.35 x22 + 
   877.18 x23 + 475.96 x3 - 991.6 x4 - 636.24 x5 + 37.6 x6 - 
   233.62 x7 + 851.72 x8 - 65.36 x9 == -932.19;
equation22 = -728.22 x1 + 571.07 x10 + 523.25 x11 - 47.01 x12 - 
    214.58 x13 + 35.19 x14 + 642.52 x15 - 125.15 x16 + 374.71 x17 - 
    116.44 x18 + 705.87 x19 - 355.76 x2 + 308.85 x20 + 275.03 x21 + 
    401.73 x22 + 424.5 x23 + 382.19 x3 - 804.71 x4 + 448.04 x5 - 
    606.38 x6 + 675.33 x7 - 360.01 x8 - 136.95 x9 == -562.9;
equation23 = 
  516.12 x1 - 189.52 x10 - 543.08 x11 - 610.05 x12 - 906.02 x13 - 
    388.31 x14 - 294.28 x15 + 377.96 x16 - 433.34 x17 + 96.14 x18 - 
    118.19 x19 - 577.27 x2 - 842.95 x20 - 124.59 x21 - 400.7 x22 + 
    695.05 x23 - 207.36 x3 + 919.4 x4 + 705.66 x5 + 921.18 x6 - 
    16.24 x7 + 783.9 x8 + 599.5 x9 == -805.68;
system23 = {equation1, equation2, equation3, equation4, equation5, 
   equation6, equation7, equation8, equation9, equation10, 
   equation11, equation12, equation13, equation14, equation15, 
   equation16, equation17, equation18, equation19, equation20, 
   equation21, equation22, equation23};
mSystem = 
  Normal@CoefficientArrays[
    system23, {x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13,
      x14, x15, x16, x17, x18, x19, x20, x21, x22, x23}];
B = -mSystem[[1]];
A = mSystem[[2]];
Column[{TraditionalForm@DisplayForm[GridBox[{{"\!\(\*
StyleBox[\"\[Piecewise]\",\nFontWeight->\"Plain\"]\)", 
        Column[system23]}}]],
   Row[{"\!\(\*
StyleBox[\"A\",\nFontSlant->\"Italic\"]\) = ", MatrixForm[A], "; \!\(\*
StyleBox[\"X\",\nFontSlant->\"Italic\"]\) = ", 
     MatrixForm[{x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, 
       x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23}], 
     "; \!\(\*
StyleBox[\"B\",\nFontSlant->\"Italic\"]\) = ", MatrixForm[B]}]
   }];
system1 = matrixToSystem[A, B];
RowReduce[A, B]
6 Replies

Ok, so I was able to figure out how to create an augment matrix. the issue that I am having now is that I want to put the matrix in row echelon form, but I don't want to use the RowReduce function because it solves the matrix. I want to display the matrix in the triangular form before solving the matrix. The code is below:

Clear[x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, 
  x15, x16, x17, x18, x19, x20, x21, x22, x23];
equation1 = 
  634.14 x1 + 97.54 x10 - 216.48 x11 - 486.49 x12 + 12.46 x13 + 
    649.97 x14 + 877.29 x15 - 755.88 x16 + 365.27 x17 - 442.49 x18 + 
    736.68 x19 + 268.69 x2 - 387.29 x20 + 742.82 x21 - 348.74 x22 + 
    98.25 x23 - 939.96 x3 - 313.98 x4 + 672.09 x5 + 348.98 x6 + 
    754.7 x7 - 535.21 x8 - 72.71 x9 == 102.79;
equation2 = 
  57.49 x1 + 336.13 x10 - 306.59 x11 - 151.18 x12 + 393.28 x13 - 
    229.18 x14 + 21.16 x15 - 878.84 x16 - 733.05 x17 + 567.96 x18 - 
    596.09 x19 - 343.58 x2 + 553.37 x20 - 741.77 x21 + 550.17 x22 + 
    269.73 x23 + 854.11 x3 + 84.37 x4 + 995.49 x5 - 521.77 x6 + 
    477.37 x7 - 865.91 x8 + 908.69 x9 == -762.13;
equation3 = 
  768.64 x1 - 866.74 x10 - 322.2 x11 - 315.52 x12 + 627.03 x13 + 
    392.89 x14 - 477.87 x15 + 936.09 x16 - 379.37 x17 - 681.48 x18 + 
    997.81 x19 - 55.4 x2 - 160.5 x20 + 737.81 x21 - 886.85 x22 - 
    291.88 x23 - 987.62 x3 + 324.21 x4 - 770.56 x5 - 878.62 x6 + 
    880.97 x7 + 832.53 x8 + 916.11 x9 == 767.06;
equation4 = 
  852.33 x1 + 93.77 x10 - 308.41 x11 - 939.14 x12 - 618.9 x13 + 
    573.08 x14 + 61. x15 - 462.59 x16 - 241.62 x17 - 675.85 x18 - 
    38.36 x19 - 990.88 x2 - 783.38 x20 - 296.37 x21 + 921.63 x22 - 
    649.89 x23 - 435.02 x3 + 288.33 x4 + 576.8 x5 + 511.03 x6 - 
    77.95 x7 - 564.5 x8 - 298.31 x9 == 112.21;
equation5 = 
  646.65 x1 - 840.26 x10 - 106.99 x11 - 445.78 x12 + 505.43 x13 + 
    191.41 x14 - 912.5 x15 - 520.01 x16 - 23.7 x17 + 903.8 x18 - 
    631.25 x19 - 525.66 x2 + 530.8 x20 + 431.07 x21 + 66.8 x22 + 
    303.66 x23 - 336.69 x3 - 69.38 x4 - 15.55 x5 - 641.89 x6 - 
    57.87 x7 + 696.96 x8 + 409.45 x9 == 214.6;
equation6 = -552.61 x1 + 912.29 x10 - 975.39 x11 - 870.38 x12 + 
    921.44 x13 - 698.54 x14 + 862.28 x15 + 329.94 x16 + 988.37 x17 + 
    374.54 x18 + 637.58 x19 - 441.51 x2 - 42.11 x20 - 138.73 x21 + 
    690.18 x22 + 917.89 x23 - 142.99 x3 + 343.93 x4 - 58.83 x5 + 
    965.62 x6 + 945.54 x7 + 295.82 x8 - 428.23 x9 == 788.16;
equation7 = 
  38.29 x1 + 403.04 x10 - 690.25 x11 - 235.05 x12 + 636.74 x13 - 
    146.01 x14 - 945.1 x15 + 178.11 x16 + 838.91 x17 + 921.68 x18 - 
    676.65 x19 + 183.46 x2 - 820.45 x20 + 414.96 x21 - 406.99 x22 - 
    222.9 x23 + 910.97 x3 - 374.53 x4 - 899.46 x5 - 774.27 x6 + 
    995.92 x7 + 551.71 x8 + 56.73 x9 == -514.84;
equation8 = 
 190.75 x1 + 238.13 x10 - 984.05 x11 - 531.96 x12 - 919.46 x13 + 
   412.37 x14 - 379.33 x15 + 24.95 x16 + 823.48 x17 - 811.69 x18 - 
   228.43 x19 + 152.52 x2 + 468.03 x20 - 472.1 x21 + 466.73 x22 - 
   722.04 x23 - 556.3 x3 + 232.74 x4 + 231.01 x5 + 422.89 x6 + 
   158.29 x7 + 534. x8 + 542.32 x9 == -233.44; equation9 = 
 870.91 x1 + 556. x10 - 366.9 x11 - 144.72 x12 - 472.31 x13 + 
   30.68 x14 - 969.56 x15 - 403.76 x16 + 476.46 x17 - 869.8 x18 - 
   458.33 x19 - 705.33 x2 - 157.96 x20 + 212.32 x21 - 612.48 x22 - 
   739.55 x23 - 892.3 x3 - 138.97 x4 + 201.55 x5 - 293.1 x6 - 
   189.66 x7 - 240.01 x8 - 
   346.22 x9 == -963.15; equation10 = -778.6 x1 + 385.63 x10 - 
   900.46 x11 + 28.64 x12 + 270.83 x13 + 434.3 x14 - 314.46 x15 - 
   669.93 x16 + 122.05 x17 + 7.24 x18 + 615.19 x19 - 946.84 x2 + 
   433.12 x20 + 779.5 x21 - 849.43 x22 - 334.84 x23 + 580. x3 - 
   493.3 x4 - 526.83 x5 - 665.79 x6 - 352.95 x7 + 219.66 x8 - 
   560.62 x9 == -95.48;
equation11 = 
 236.42 x1 - 15.5 x10 + 525.42 x11 - 177.3 x12 + 899.17 x13 + 
   622.3 x14 - 238.89 x15 + 292.48 x16 + 561.03 x17 + 29.5 x18 - 
   406.12 x19 + 343.69 x2 - 703.95 x20 - 443. x21 - 142.38 x22 - 
   208.98 x23 + 54.93 x3 + 206.79 x4 - 787.09 x5 - 151.16 x6 - 
   986.95 x7 + 273.85 x8 + 522.39 x9 == 155.73; equation12 = 
 680.18 x1 + 708.45 x10 - 664.91 x11 - 946.99 x12 - 392.22 x13 + 
   92.91 x14 - 63.53 x15 + 703.83 x16 - 320.08 x17 - 268.2 x18 + 
   422.39 x19 - 419.69 x2 - 420.1 x20 + 172.18 x21 + 328.86 x22 - 
   870.12 x23 - 982.71 x3 - 480.25 x4 - 825.52 x5 - 248.07 x6 + 
   652.84 x7 - 942.37 x8 - 244.09 x9 == 802.85;
equation13 = 
  50.63 x1 - 486.19 x10 - 346.43 x11 + 194.1 x12 + 791.08 x13 - 
    356.58 x14 + 566.14 x15 + 952.08 x16 - 602.24 x17 - 695.1 x18 - 
    928.78 x19 + 257.52 x2 - 542.2 x20 + 787.83 x21 + 519.67 x22 - 
    239.3 x23 + 253.41 x3 + 858.31 x4 + 775.11 x5 - 33.93 x6 + 
    949.52 x7 - 501.49 x8 - 932.67 x9 == 756.75;
equation14 =
 -282.05 x1 + 422.61 x10 + 768.42 x11 + 221.72 x12 - 283. x13 + 
   951.33 x14 + 5.37 x15 + 786.37 x16 - 20.16 x17 + 591.71 x18 + 
   821.73 x19 + 988.3 x2 + 720.57 x20 - 636.77 x21 + 583.91 x22 + 
   190.09 x23 - 70. x3 - 582.82 x4 - 584.18 x5 - 927.73 x6 - 
   66.66 x7 + 334.4 x8 - 314.91 x9 == -777.53; equation15 = 
 347.84 x1 + 342.35 x10 + 672.1 x11 + 403.15 x12 + 961.69 x13 + 
   428.25 x14 + 183.05 x15 + 855.27 x16 - 835.89 x17 - 169.98 x18 - 
   492.42 x19 + 108.05 x2 + 663.31 x20 + 26.26 x21 + 916.49 x22 - 
   176.56 x23 - 772.21 x3 + 188.46 x4 - 883.49 x5 + 244.16 x6 - 
   880.37 x7 + 0.84 x8 + 233.13 x9 == -275.74;
equation16 = -689. x1 + 44.41 x10 - 94.25 x11 - 712.75 x12 - 
   365.06 x13 - 80.49 x14 - 161.44 x15 + 242.22 x16 + 90.75 x17 - 
   986.12 x18 - 819.92 x19 - 296.6 x2 - 58.88 x20 - 372.61 x21 + 
   272.23 x22 + 66.93 x23 + 360.46 x3 - 976.77 x4 - 776.85 x5 + 
   897.3 x6 - 47.97 x7 - 234.66 x8 - 711.09 x9 == 786.52; equation17 =
  983.17 x1 + 863.82 x10 + 371.05 x11 - 719.86 x12 - 415.52 x13 - 
   589.89 x14 + 12.68 x15 - 88.53 x16 - 980.51 x17 - 178.96 x18 - 
   937.55 x19 - 257.57 x2 + 347.72 x20 + 212.37 x21 + 33.56 x22 + 
   851.85 x23 - 9.23 x3 - 634.54 x4 + 573.32 x5 + 281.41 x6 + 
   915.45 x7 - 140.7 x8 - 
   540.64 x9 == -68.35; equation18 = -518.67 x1 - 934.33 x10 + 
   399.3 x11 - 185.26 x12 + 740.53 x13 + 213.06 x14 + 158.16 x15 + 
   659.67 x16 + 216.62 x17 - 993.05 x18 + 89.73 x19 - 619.61 x2 + 
   603.47 x20 + 812.34 x21 + 488.95 x22 - 461.56 x23 - 587.24 x3 + 
   399.91 x4 - 837.61 x5 + 964.37 x6 - 255. x7 + 628.13 x8 - 
   231.17 x9 == 758.41;
equation19 = 
  333.16 x1 + 779.73 x10 - 559.82 x11 - 781.88 x12 - 465.08 x13 - 
    367.24 x14 - 742.58 x15 + 432.99 x16 + 215.89 x17 + 218.75 x18 + 
    230.71 x19 - 324.23 x2 - 545.6 x20 - 283.21 x21 + 676.47 x22 + 
    18.24 x23 - 475.34 x3 + 886.15 x4 - 887.09 x5 - 398.95 x6 - 
    660.04 x7 - 89.91 x8 + 264.35 x9 == 891.45;
equation20 = 
 913.14 x1 + 578.23 x10 + 544.77 x11 - 281.47 x12 + 45.8 x13 + 
   818.8 x14 - 27.56 x15 - 853.88 x16 - 734.34 x17 - 887.11 x18 - 
   426.76 x19 - 105.89 x2 - 286.53 x20 - 485.57 x21 - 762.6 x22 + 
   137.72 x23 - 270.55 x3 + 179.56 x4 + 109.98 x5 + 300.58 x6 - 
   578.92 x7 + 135.87 x8 + 270.43 x9 == 863.38; equation21 = 
 244.79 x1 + 891.92 x10 - 208.48 x11 - 199.29 x12 + 25.62 x13 + 
   510.89 x14 + 300.53 x15 + 953.35 x16 + 960. x17 + 341.88 x18 - 
   780.57 x19 - 772.53 x2 - 347.5 x20 + 328.68 x21 - 946.35 x22 + 
   877.18 x23 + 475.96 x3 - 991.6 x4 - 636.24 x5 + 37.6 x6 - 
   233.62 x7 + 851.72 x8 - 65.36 x9 == -932.19;
equation22 = -728.22 x1 + 571.07 x10 + 523.25 x11 - 47.01 x12 - 
    214.58 x13 + 35.19 x14 + 642.52 x15 - 125.15 x16 + 374.71 x17 - 
    116.44 x18 + 705.87 x19 - 355.76 x2 + 308.85 x20 + 275.03 x21 + 
    401.73 x22 + 424.5 x23 + 382.19 x3 - 804.71 x4 + 448.04 x5 - 
    606.38 x6 + 675.33 x7 - 360.01 x8 - 136.95 x9 == -562.9;
equation23 = 
  516.12 x1 - 189.52 x10 - 543.08 x11 - 610.05 x12 - 906.02 x13 - 
    388.31 x14 - 294.28 x15 + 377.96 x16 - 433.34 x17 + 96.14 x18 - 
    118.19 x19 - 577.27 x2 - 842.95 x20 - 124.59 x21 - 400.7 x22 + 
    695.05 x23 - 207.36 x3 + 919.4 x4 + 705.66 x5 + 921.18 x6 - 
    16.24 x7 + 783.9 x8 + 599.5 x9 == -805.68;
system23 = {equation1, equation2, equation3, equation4, equation5, 
   equation6, equation7, equation8, equation9, equation10, 
   equation11, equation12, equation13, equation14, equation15, 
   equation16, equation17, equation18, equation19, equation20, 
   equation21, equation22, equation23};
mSystem = 
  Normal@CoefficientArrays[
    system23, {x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13,
      x14, x15, x16, x17, x18, x19, x20, x21, x22, x23}];
B = -mSystem[[1]];
A = mSystem[[2]];
Column[{TraditionalForm@DisplayForm[GridBox[{{"\!\(\*
StyleBox[\"\[Piecewise]\",\nFontWeight->\"Plain\"]\)", 
       Column[system23]}}]],
  Row[{"\!\(\*
StyleBox[\"A\",\nFontSlant->\"Italic\"]\) = ", MatrixForm[A], "; \!\(\*
StyleBox[\"X\",\nFontSlant->\"Italic\"]\) = ", 
    MatrixForm[{x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, 
      x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23}], 
    "; \!\(\*
StyleBox[\"B\",\nFontSlant->\"Italic\"]\) = ", MatrixForm[B]}]
  }]
system1 = matrixToSystem[A, B];
Augment23 = Transpose[Join[Transpose[A], {B}]];
MatrixForm[Augment23]
Posted 10 days ago

What is the definition of matrixToSystem?

I was able to figure it out with the following code:

Clear[x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, 
  x15, x16, x17, x18, x19, x20, x21, x22, x23];
equation1 = 
  634.14 x1 + 97.54 x10 - 216.48 x11 - 486.49 x12 + 12.46 x13 + 
    649.97 x14 + 877.29 x15 - 755.88 x16 + 365.27 x17 - 442.49 x18 + 
    736.68 x19 + 268.69 x2 - 387.29 x20 + 742.82 x21 - 348.74 x22 + 
    98.25 x23 - 939.96 x3 - 313.98 x4 + 672.09 x5 + 348.98 x6 + 
    754.7 x7 - 535.21 x8 - 72.71 x9 == 102.79;
equation2 = 
  57.49 x1 + 336.13 x10 - 306.59 x11 - 151.18 x12 + 393.28 x13 - 
    229.18 x14 + 21.16 x15 - 878.84 x16 - 733.05 x17 + 567.96 x18 - 
    596.09 x19 - 343.58 x2 + 553.37 x20 - 741.77 x21 + 550.17 x22 + 
    269.73 x23 + 854.11 x3 + 84.37 x4 + 995.49 x5 - 521.77 x6 + 
    477.37 x7 - 865.91 x8 + 908.69 x9 == -762.13;
equation3 = 
  768.64 x1 - 866.74 x10 - 322.2 x11 - 315.52 x12 + 627.03 x13 + 
    392.89 x14 - 477.87 x15 + 936.09 x16 - 379.37 x17 - 681.48 x18 + 
    997.81 x19 - 55.4 x2 - 160.5 x20 + 737.81 x21 - 886.85 x22 - 
    291.88 x23 - 987.62 x3 + 324.21 x4 - 770.56 x5 - 878.62 x6 + 
    880.97 x7 + 832.53 x8 + 916.11 x9 == 767.06;
equation4 = 
  852.33 x1 + 93.77 x10 - 308.41 x11 - 939.14 x12 - 618.9 x13 + 
    573.08 x14 + 61. x15 - 462.59 x16 - 241.62 x17 - 675.85 x18 - 
    38.36 x19 - 990.88 x2 - 783.38 x20 - 296.37 x21 + 921.63 x22 - 
    649.89 x23 - 435.02 x3 + 288.33 x4 + 576.8 x5 + 511.03 x6 - 
    77.95 x7 - 564.5 x8 - 298.31 x9 == 112.21;
equation5 = 
  646.65 x1 - 840.26 x10 - 106.99 x11 - 445.78 x12 + 505.43 x13 + 
    191.41 x14 - 912.5 x15 - 520.01 x16 - 23.7 x17 + 903.8 x18 - 
    631.25 x19 - 525.66 x2 + 530.8 x20 + 431.07 x21 + 66.8 x22 + 
    303.66 x23 - 336.69 x3 - 69.38 x4 - 15.55 x5 - 641.89 x6 - 
    57.87 x7 + 696.96 x8 + 409.45 x9 == 214.6;
equation6 = -552.61 x1 + 912.29 x10 - 975.39 x11 - 870.38 x12 + 
    921.44 x13 - 698.54 x14 + 862.28 x15 + 329.94 x16 + 988.37 x17 + 
    374.54 x18 + 637.58 x19 - 441.51 x2 - 42.11 x20 - 138.73 x21 + 
    690.18 x22 + 917.89 x23 - 142.99 x3 + 343.93 x4 - 58.83 x5 + 
    965.62 x6 + 945.54 x7 + 295.82 x8 - 428.23 x9 == 788.16;
equation7 = 
  38.29 x1 + 403.04 x10 - 690.25 x11 - 235.05 x12 + 636.74 x13 - 
    146.01 x14 - 945.1 x15 + 178.11 x16 + 838.91 x17 + 921.68 x18 - 
    676.65 x19 + 183.46 x2 - 820.45 x20 + 414.96 x21 - 406.99 x22 - 
    222.9 x23 + 910.97 x3 - 374.53 x4 - 899.46 x5 - 774.27 x6 + 
    995.92 x7 + 551.71 x8 + 56.73 x9 == -514.84;
equation8 = 
 190.75 x1 + 238.13 x10 - 984.05 x11 - 531.96 x12 - 919.46 x13 + 
   412.37 x14 - 379.33 x15 + 24.95 x16 + 823.48 x17 - 811.69 x18 - 
   228.43 x19 + 152.52 x2 + 468.03 x20 - 472.1 x21 + 466.73 x22 - 
   722.04 x23 - 556.3 x3 + 232.74 x4 + 231.01 x5 + 422.89 x6 + 
   158.29 x7 + 534. x8 + 542.32 x9 == -233.44; equation9 = 
 870.91 x1 + 556. x10 - 366.9 x11 - 144.72 x12 - 472.31 x13 + 
   30.68 x14 - 969.56 x15 - 403.76 x16 + 476.46 x17 - 869.8 x18 - 
   458.33 x19 - 705.33 x2 - 157.96 x20 + 212.32 x21 - 612.48 x22 - 
   739.55 x23 - 892.3 x3 - 138.97 x4 + 201.55 x5 - 293.1 x6 - 
   189.66 x7 - 240.01 x8 - 
   346.22 x9 == -963.15; equation10 = -778.6 x1 + 385.63 x10 - 
   900.46 x11 + 28.64 x12 + 270.83 x13 + 434.3 x14 - 314.46 x15 - 
   669.93 x16 + 122.05 x17 + 7.24 x18 + 615.19 x19 - 946.84 x2 + 
   433.12 x20 + 779.5 x21 - 849.43 x22 - 334.84 x23 + 580. x3 - 
   493.3 x4 - 526.83 x5 - 665.79 x6 - 352.95 x7 + 219.66 x8 - 
   560.62 x9 == -95.48;
equation11 = 
 236.42 x1 - 15.5 x10 + 525.42 x11 - 177.3 x12 + 899.17 x13 + 
   622.3 x14 - 238.89 x15 + 292.48 x16 + 561.03 x17 + 29.5 x18 - 
   406.12 x19 + 343.69 x2 - 703.95 x20 - 443. x21 - 142.38 x22 - 
   208.98 x23 + 54.93 x3 + 206.79 x4 - 787.09 x5 - 151.16 x6 - 
   986.95 x7 + 273.85 x8 + 522.39 x9 == 155.73; equation12 = 
 680.18 x1 + 708.45 x10 - 664.91 x11 - 946.99 x12 - 392.22 x13 + 
   92.91 x14 - 63.53 x15 + 703.83 x16 - 320.08 x17 - 268.2 x18 + 
   422.39 x19 - 419.69 x2 - 420.1 x20 + 172.18 x21 + 328.86 x22 - 
   870.12 x23 - 982.71 x3 - 480.25 x4 - 825.52 x5 - 248.07 x6 + 
   652.84 x7 - 942.37 x8 - 244.09 x9 == 802.85;
equation13 = 
  50.63 x1 - 486.19 x10 - 346.43 x11 + 194.1 x12 + 791.08 x13 - 
    356.58 x14 + 566.14 x15 + 952.08 x16 - 602.24 x17 - 695.1 x18 - 
    928.78 x19 + 257.52 x2 - 542.2 x20 + 787.83 x21 + 519.67 x22 - 
    239.3 x23 + 253.41 x3 + 858.31 x4 + 775.11 x5 - 33.93 x6 + 
    949.52 x7 - 501.49 x8 - 932.67 x9 == 756.75;
equation14 =
 -282.05 x1 + 422.61 x10 + 768.42 x11 + 221.72 x12 - 283. x13 + 
   951.33 x14 + 5.37 x15 + 786.37 x16 - 20.16 x17 + 591.71 x18 + 
   821.73 x19 + 988.3 x2 + 720.57 x20 - 636.77 x21 + 583.91 x22 + 
   190.09 x23 - 70. x3 - 582.82 x4 - 584.18 x5 - 927.73 x6 - 
   66.66 x7 + 334.4 x8 - 314.91 x9 == -777.53; equation15 = 
 347.84 x1 + 342.35 x10 + 672.1 x11 + 403.15 x12 + 961.69 x13 + 
   428.25 x14 + 183.05 x15 + 855.27 x16 - 835.89 x17 - 169.98 x18 - 
   492.42 x19 + 108.05 x2 + 663.31 x20 + 26.26 x21 + 916.49 x22 - 
   176.56 x23 - 772.21 x3 + 188.46 x4 - 883.49 x5 + 244.16 x6 - 
   880.37 x7 + 0.84 x8 + 233.13 x9 == -275.74;
equation16 = -689. x1 + 44.41 x10 - 94.25 x11 - 712.75 x12 - 
   365.06 x13 - 80.49 x14 - 161.44 x15 + 242.22 x16 + 90.75 x17 - 
   986.12 x18 - 819.92 x19 - 296.6 x2 - 58.88 x20 - 372.61 x21 + 
   272.23 x22 + 66.93 x23 + 360.46 x3 - 976.77 x4 - 776.85 x5 + 
   897.3 x6 - 47.97 x7 - 234.66 x8 - 711.09 x9 == 786.52; equation17 =
  983.17 x1 + 863.82 x10 + 371.05 x11 - 719.86 x12 - 415.52 x13 - 
   589.89 x14 + 12.68 x15 - 88.53 x16 - 980.51 x17 - 178.96 x18 - 
   937.55 x19 - 257.57 x2 + 347.72 x20 + 212.37 x21 + 33.56 x22 + 
   851.85 x23 - 9.23 x3 - 634.54 x4 + 573.32 x5 + 281.41 x6 + 
   915.45 x7 - 140.7 x8 - 
   540.64 x9 == -68.35; equation18 = -518.67 x1 - 934.33 x10 + 
   399.3 x11 - 185.26 x12 + 740.53 x13 + 213.06 x14 + 158.16 x15 + 
   659.67 x16 + 216.62 x17 - 993.05 x18 + 89.73 x19 - 619.61 x2 + 
   603.47 x20 + 812.34 x21 + 488.95 x22 - 461.56 x23 - 587.24 x3 + 
   399.91 x4 - 837.61 x5 + 964.37 x6 - 255. x7 + 628.13 x8 - 
   231.17 x9 == 758.41;
equation19 = 
  333.16 x1 + 779.73 x10 - 559.82 x11 - 781.88 x12 - 465.08 x13 - 
    367.24 x14 - 742.58 x15 + 432.99 x16 + 215.89 x17 + 218.75 x18 + 
    230.71 x19 - 324.23 x2 - 545.6 x20 - 283.21 x21 + 676.47 x22 + 
    18.24 x23 - 475.34 x3 + 886.15 x4 - 887.09 x5 - 398.95 x6 - 
    660.04 x7 - 89.91 x8 + 264.35 x9 == 891.45;
equation20 = 
 913.14 x1 + 578.23 x10 + 544.77 x11 - 281.47 x12 + 45.8 x13 + 
   818.8 x14 - 27.56 x15 - 853.88 x16 - 734.34 x17 - 887.11 x18 - 
   426.76 x19 - 105.89 x2 - 286.53 x20 - 485.57 x21 - 762.6 x22 + 
   137.72 x23 - 270.55 x3 + 179.56 x4 + 109.98 x5 + 300.58 x6 - 
   578.92 x7 + 135.87 x8 + 270.43 x9 == 863.38; equation21 = 
 244.79 x1 + 891.92 x10 - 208.48 x11 - 199.29 x12 + 25.62 x13 + 
   510.89 x14 + 300.53 x15 + 953.35 x16 + 960. x17 + 341.88 x18 - 
   780.57 x19 - 772.53 x2 - 347.5 x20 + 328.68 x21 - 946.35 x22 + 
   877.18 x23 + 475.96 x3 - 991.6 x4 - 636.24 x5 + 37.6 x6 - 
   233.62 x7 + 851.72 x8 - 65.36 x9 == -932.19;
equation22 = -728.22 x1 + 571.07 x10 + 523.25 x11 - 47.01 x12 - 
    214.58 x13 + 35.19 x14 + 642.52 x15 - 125.15 x16 + 374.71 x17 - 
    116.44 x18 + 705.87 x19 - 355.76 x2 + 308.85 x20 + 275.03 x21 + 
    401.73 x22 + 424.5 x23 + 382.19 x3 - 804.71 x4 + 448.04 x5 - 
    606.38 x6 + 675.33 x7 - 360.01 x8 - 136.95 x9 == -562.9;
equation23 = 
  516.12 x1 - 189.52 x10 - 543.08 x11 - 610.05 x12 - 906.02 x13 - 
    388.31 x14 - 294.28 x15 + 377.96 x16 - 433.34 x17 + 96.14 x18 - 
    118.19 x19 - 577.27 x2 - 842.95 x20 - 124.59 x21 - 400.7 x22 + 
    695.05 x23 - 207.36 x3 + 919.4 x4 + 705.66 x5 + 921.18 x6 - 
    16.24 x7 + 783.9 x8 + 599.5 x9 == -805.68;
system23 = {equation1, equation2, equation3, equation4, equation5, 
   equation6, equation7, equation8, equation9, equation10, 
   equation11, equation12, equation13, equation14, equation15, 
   equation16, equation17, equation18, equation19, equation20, 
   equation21, equation22, equation23};
TraditionalForm[
  DisplayForm[GridBox[{{"\[Piecewise]", Column[system23]}}]]];
mSystem = 
  Normal@CoefficientArrays[
    system23, {x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13,
      x14, x15, x16, x17, x18, x19, x20, x21, x22, x23}];
B = -mSystem[[1]];
A = mSystem[[2]];
times1Style@
  Column[{TraditionalForm@
     DisplayForm[GridBox[{{"\[Piecewise]", Column[system23]}}]],
    Row[{"\!\(\*
StyleBox[\"A\",\nFontSlant->\"Italic\"]\) = ", MatrixForm[A], "; \!\(\*
StyleBox[\"b\",\nFontWeight->\"Bold\"]\) = ", MatrixForm[B]}]
    }];
Ainv = Inverse[A];
X = Ainv.B;
RowEchelonForm[matrix_] := Module[{m = matrix},
   Quiet[UpperTriangularize[LUDecomposition[m][[1]]]]
   ];
MatrixToSystem[matrix_?(MatrixQ[#, NumericQ] &), 
   vector_?(VectorQ[#, NumericQ] &)] := 
  Module[{matrixA = matrix, vectorB = vector, vectorX, m, n, lhs},
   m = Dimensions[matrixA][[1]];
   n = Dimensions[matrixA][[2]];
   vectorX = Array[Subscript["x", #] &, {n}];
   lhs = matrixA.vectorX;
   (* system *)
   Array[lhs[[#]] == vectorB[[#]] &, {m}]
   ];
system1 = MatrixToSystem[A, B];
Augment23 = Transpose[Join[Transpose[A], {B}]];
MatrixForm[Augment23]
refAugment23 = Rationalize@RowEchelonForm[Augment23];
refA = refAugment23[[All, 1 ;; -2]];
refB = refAugment23[[All, -1]];
refSystem23 = MatrixToSystem[refA, refB];
Row[{"REF: ", 
   DisplayForm[GridBox[{{"\[Piecewise]", Column[N@refSystem23]}}]]}];

Now my issue is combining the identity matrix to Augment23:

Augmented23 = Transpose[Join[IdentityMatrix[23], {Augment23}]];
MatrixForm[Augmented23]

Maybe LUDecomposition can be used to do what you want.

What is LUDecomposition? I'm fairly new to Mathematica so I'm still trying to get used to the syntax.

Hi WIlly,

WolframU has a very nice free course on linear algebra.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract