-1

I am trying to solve this system

3.7 x1+51.5 x10+71.3 x11-84. x2-16. x3-57.7 x4+89.7 x5-54.9 x6-85.8 x7+57.8 x8-51.3 x9==-36.8 -86.3 x1+5.7 x10-0.2 x11-39.9 x2+52.6 x3-45.6 x4+78. x5+90.7 x6-86.2 x7-16.2 x8+43.5 x9==-67.4 -63.1 x1-67.7 x10+36. x11+54.3 x2-1.9 x3+39.1 x4-92.4 x5+57.6 x6-10.2 x7-27. x8-14.8 x9==50.2 70.3 x1+6.4 x10+36.3 x11-86.6 x2+93.3 x3+36. x4-4.4 x5+62.4 x6-39.9 x7-63.5 x8+55.9 x9==-43.1 -73.2 x1+69.9 x10-96.5 x11+29. x2+73.3 x3-40.3 x4-59.6 x5+69. x6+0.7 x7+1.6 x8-69.2 x9==-72.1 61.7 x1+89.1 x10-67.9 x11-93.4 x2+19.6 x3+25.6 x4+52.1 x5-48. x6-29.5 x7-53.4 x8+44.2 x9==-20.9 35.9 x1+97.8 x10+54.1 x11-7. x2+45.1 x3-49.4 x4+90.5 x5+62.2 x6-16.5 x7+15.6 x8+21. x9==53.7 43.7 x1-62.7 x10-55.2 x11+2.3 x2+9.6 x3+58.5 x4+83.1 x5-58.5 x6+16.1 x7-26.5 x8-0.7 x9==-88.5 -63.8 x1-53.2 x10+60. x11-20.7 x2-86.5 x3-42.1 x4-38.6 x5+60.1 x6+16.5 x7-53.7 x8-11.2 x9==45.5 74.5 x1+41.8 x10-51.5 x11+5.5 x2-90. x3+86. x4-98.6 x5+60.5 x6+80.7 x7-5.4 x8+42.9 x9==15.2 -51.6 x1-39. x10-7.7 x11-24.1 x2-4.7 x3-6.1 x4+19.1 x5-0.6 x6-75.6 x7+87.4 x8-22.4 x9==61.8

First???, I sorted my linear system from ( x1, x2, x3 ..... x11 ) manually.

Question -> is there a way to sort the system automatically

3.7 x1 - 84. x2 - 16. x3 - 57.7 x4 + 89.7 x5 - 54.9 x6 - 85.8 x7 + 57.8 x8 - 51.3 x9 + 51.5 x10 + 71.3 x11 == -36.8 -86.3 x1 - 39.9 x2 + 52.6 x3 - 45.6 x4 + 78. x5 + 90.7 x6 - 86.2 x7 - 16.2 x8 + 43.5 x9 + 5.7 x10 - 0.2 x11 == -67.4 -63.1 x1 + 54.3 x2 - 1.9 x3 + 39.1 x4 - 92.4 x5 + 57.6 x6 - 10.2 x7 - 27. x8 - 14.8 x9 - 67.7 x10 + 36. x11 == 50.2 70.3 x1 - 86.6 x2 + 93.3 x3 + 36. x4 - 4.4 x5 + 62.4 x6 - 39.9 x7 - 63.5 x8 + 55.9 x9 + 6.4 x10 + 36.3 x11 == -43.1 -73.2 x1 + 29. x2 + 73.3 x3 - 40.3 x4 - 59.6 x5 + 69. x6 + 0.7 x7 + 1.6 x8 - 69.2 x9 + 69.9 x10 - 96.5 x11 == -72.1 61.7 x1 - 93.4 x2 + 19.6 x3 + 25.6 x4 + 52.1 x5 - 48. x6 - 29.5 x7 - 53.4 x8 + 44.2 x9 + 89.1 x10 - 67.9 x11 == -20.9 35.9 x1 - 7. x2 + 45.1 x3 - 49.4 x4 + 90.5 x5 + 62.2 x6 - 16.5 x7 + 15.6 x8 + 21. x9 + 97.8 x10 + 54.1 x11 == 53.7 43.7 x1 + 2.3 x2 + 9.6 x3 + 58.5 x4 + 83.1 x5 - 58.5 x6 + 16.1 x7 - 26.5 x8 - 0.7 x9 - 62.7 x10 - 55.2 x11 == -88.5 -63.8 x1 - 20.7 x2 - 86.5 x3 - 42.1 x4 - 38.6 x5 + 60.1 x6 + 16.5 x7 - 53.7 x8 - 11.2 x9 - 53.2 x10 + 60. x11 == 45.5 74.5 x1 + 5.5 x2 - 90. x3 + 86. x4 - 98.6 x5 + 60.5 x6 + 80.7 x7 - 5.4 x8 + 42.9 x9 + 41.8 x10 - 51.5 x11 == 15.2 -51.6 x1 - 24.1 x2 - 4.7 x3 - 6.1 x4 + 19.1 x5 - 0.6 x6 - 75.6 x7 + 87.4 x8 - 22.4 x9 - 39. x10 - 7.7 x11 == 61.8


Second????


I used 4 different ways to get my answers:

and I get the same answers.

1)-"Solve" command;.

1){{x1 -> 22.3934, x2 -> 16.3643, x3 -> -9.68272, x4 -> -18.3644, x5 -> -5.3851, x6 -> 3.75394, x7 -> -25.4234, x8 -> -7.91972, x9 -> -0.370032, x10 -> -6.33219, x11 -> -9.6342}}.

?????there is a way to get rid of this signs { X1->,x2->..... and leave it like the other solutions to later check them to each other, or add them (e X1->,x2-> to the other solutions)

2)-elementary row reduces operation;.

2){22.3934, 16.3643, -9.68272, -18.3644, -5.3851, 3.75394, -25.4234, \ -7.91972, -0.370032, -6.33219, -9.6342}.

3)- Gaussian Elimination;.

3){22.3934, 16.3643, -9.68272, -18.3644, -5.3851, 3.75394, -25.4234, \ -7.91972, -0.370032, -6.33219, -9.6342}.

4)- Cramer's Rule;.

4){22.3934, 16.3643, -9.68272, -18.3644, -5.3851, 3.75394, -25.4234, \ -7.91972, -0.370032, -6.33219, -9.6342}.

Why??? can it be fixed?? when I copy and paste my answer. I am getting this big number that I don't know if it is correct.

x1→22.3934326218678,x2→16.364282948118927,x3→-9.682723724768751,x4→-18.36442026953957,x5→-5.385103589281071,x6→3.753944241952868,x7→-25.42344303946928,x8→-7.919715886226232,x9→-0.3700321207038319,x10→-6.332186555792737,x11→-9.634195036427739}}

Cfede
  • 11
  • 3

2 Answers2

6

Your system:

sys = {3.7 x1 + 51.5 x10 + 71.3 x11 - 84. x2 - 16. x3 - 57.7 x4 + 
     89.7 x5 - 54.9 x6 - 85.8 x7 + 57.8 x8 - 51.3 x9 == -36.8,
   -86.3 x1 + 5.7 x10 - 0.2 x11 - 39.9 x2 + 52.6 x3 - 45.6 x4 + 
     78. x5 + 90.7 x6 - 86.2 x7 - 16.2 x8 + 43.5 x9 == -67.4,
   -63.1 x1 - 67.7 x10 + 36. x11 + 54.3 x2 - 1.9 x3 + 39.1 x4 - 
     92.4 x5 + 57.6 x6 - 10.2 x7 - 27. x8 - 14.8 x9 == 50.2,
   70.3 x1 + 6.4 x10 + 36.3 x11 - 86.6 x2 + 93.3 x3 + 36. x4 - 
     4.4 x5 + 62.4 x6 - 39.9 x7 - 63.5 x8 + 55.9 x9 == -43.1,
   -73.2 x1 + 69.9 x10 - 96.5 x11 + 29. x2 + 73.3 x3 - 40.3 x4 - 
     59.6 x5 + 69. x6 + 0.7 x7 + 1.6 x8 - 69.2 x9 == -72.1,
   61.7 x1 + 89.1 x10 - 67.9 x11 - 93.4 x2 + 19.6 x3 + 25.6 x4 + 
     52.1 x5 - 48. x6 - 29.5 x7 - 53.4 x8 + 44.2 x9 == -20.9,
   35.9 x1 + 97.8 x10 + 54.1 x11 - 7. x2 + 45.1 x3 - 49.4 x4 + 
     90.5 x5 + 62.2 x6 - 16.5 x7 + 15.6 x8 + 21. x9 == 53.7,
   43.7 x1 - 62.7 x10 - 55.2 x11 + 2.3 x2 + 9.6 x3 + 58.5 x4 + 
     83.1 x5 - 58.5 x6 + 16.1 x7 - 26.5 x8 - 0.7 x9 == -88.5,
   -63.8 x1 - 53.2 x10 + 60. x11 - 20.7 x2 - 86.5 x3 - 42.1 x4 - 
     38.6 x5 + 60.1 x6 + 16.5 x7 - 53.7 x8 - 11.2 x9 == 45.5,
   74.5 x1 + 41.8 x10 - 51.5 x11 + 5.5 x2 - 90. x3 + 86. x4 - 
     98.6 x5 + 60.5 x6 + 80.7 x7 - 5.4 x8 + 42.9 x9 == 15.2,
   -51.6 x1 - 39. x10 - 7.7 x11 - 24.1 x2 - 4.7 x3 - 6.1 x4 + 
     19.1 x5 - 0.6 x6 - 75.6 x7 + 87.4 x8 - 22.4 x9 == 61.8};

Your variables:

vars = Variables@sys[[All, 1]]
(* {x1, x10, x11, x2, x3, x4, x5, x6, x7, x8, x9} *)

The matrix to solve:

cf = Coefficient[#, vars] & /@ sys[[All, 1]];

solve it:

ls = LinearSolve[cf, sys[[All, 2]]];

check:

cf.ls - sys[[All, 2]] // Chop
(* {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} *)

The result:

Thread[vars -> ls]
(*
{x1 -> 22.3934, x10 -> -6.33219, x11 -> -9.6342, x2 -> 16.3643, 
 x3 -> -9.68272, x4 -> -18.3644, x5 -> -5.3851, x6 -> 3.75394, 
 x7 -> -25.4234, x8 -> -7.91972, x9 -> -0.370032}
*)
Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
  • so, this system has a solution?? but how can I check my solutions using different methods – Cfede Mar 24 '16 at 12:33
  • If I compare my solution with yours, the system gave me False. My solution using equationsSolve = Solve[Equations, {x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11}] Solution {{x1 -> 22.3934, x2 -> 16.3643, x3 -> -9.68272, x4 -> -18.3644, x5 -> -5.3851, x6 -> 3.75394, x7 -> -25.4234, x8 -> -7.91972, x9 -> -0.370032, x10 -> -6.33219, x11 -> -9.6342}} and when I check both equationsSolve == Thread[vars -> ls]. I get " False ". I think it may be something with the curky braket, or the order of the solutions – Cfede Mar 24 '16 at 13:01
1

To hold me short; I solve your system with Solve and RowReduce. In the second try I set a Precision and you can see what effect it has.

sys = {3.7 x1 + 51.5 x10 + 71.3 x11 - 84. x2 - 16. x3 - 57.7 x4 + 
     89.7 x5 - 54.9 x6 - 85.8 x7 + 57.8 x8 - 
     51.3 x9 == -36.8, -86.3 x1 + 5.7 x10 - 0.2 x11 - 39.9 x2 + 
     52.6 x3 - 45.6 x4 + 78. x5 + 90.7 x6 - 86.2 x7 - 16.2 x8 + 
     43.5 x9 == -67.4, -63.1 x1 - 67.7 x10 + 36. x11 + 54.3 x2 - 
     1.9 x3 + 39.1 x4 - 92.4 x5 + 57.6 x6 - 10.2 x7 - 27. x8 - 
     14.8 x9 == 50.2, 
   70.3 x1 + 6.4 x10 + 36.3 x11 - 86.6 x2 + 93.3 x3 + 36. x4 - 
     4.4 x5 + 62.4 x6 - 39.9 x7 - 63.5 x8 + 
     55.9 x9 == -43.1, -73.2 x1 + 69.9 x10 - 96.5 x11 + 29. x2 + 
     73.3 x3 - 40.3 x4 - 59.6 x5 + 69. x6 + 0.7 x7 + 1.6 x8 - 
     69.2 x9 == -72.1, 
   61.7 x1 + 89.1 x10 - 67.9 x11 - 93.4 x2 + 19.6 x3 + 25.6 x4 + 
     52.1 x5 - 48. x6 - 29.5 x7 - 53.4 x8 + 44.2 x9 == -20.9, 
   35.9 x1 + 97.8 x10 + 54.1 x11 - 7. x2 + 45.1 x3 - 49.4 x4 + 
     90.5 x5 + 62.2 x6 - 16.5 x7 + 15.6 x8 + 21. x9 == 53.7, 
   43.7 x1 - 62.7 x10 - 55.2 x11 + 2.3 x2 + 9.6 x3 + 58.5 x4 + 
     83.1 x5 - 58.5 x6 + 16.1 x7 - 26.5 x8 - 
     0.7 x9 == -88.5, -63.8 x1 - 53.2 x10 + 60. x11 - 20.7 x2 - 
     86.5 x3 - 42.1 x4 - 38.6 x5 + 60.1 x6 + 16.5 x7 - 53.7 x8 - 
     11.2 x9 == 45.5, 
   74.5 x1 + 41.8 x10 - 51.5 x11 + 5.5 x2 - 90. x3 + 86. x4 - 
     98.6 x5 + 60.5 x6 + 80.7 x7 - 5.4 x8 + 42.9 x9 == 
    15.2, -51.6 x1 - 39. x10 - 7.7 x11 - 24.1 x2 - 4.7 x3 - 6.1 x4 + 
     19.1 x5 - 0.6 x6 - 75.6 x7 + 87.4 x8 - 22.4 x9 == 61.8};

vars = Variables@sys[[All, 1]];
{b1, m1} = CoefficientArrays@sys   

sol1 = Solve[sys, vars]
(* {{x1 -> 22.3934, x10 -> -6.33219, x11 -> -9.6342, x2 -> 16.3643, 
  x3 -> -9.68272, x4 -> -18.3644, x5 -> -5.3851, x6 -> 3.75394, 
  x7 -> -25.4234, x8 -> -7.91972, x9 -> -0.370032}} *)

rrsol1 = RowReduce[Transpose[Join[Transpose[-m1], {b1}]]][[All, -1]]
(* {22.3934, -6.33219, -9.6342, 16.3643, -9.68272, -18.3644, -5.3851, \
3.75394, -25.4234, -7.91972, -0.370032} *)

Now we check the results:

sys /. sol1
(* {{True, True, True, True, True, False, True, True, True, False, True}} *)

sys /. Thread[vars -> rrsol1]
(* {True, True, True, True, True, False, True, True, True, False, True} *)

They are not all true. Now I set a Precision and solve the same once more (you can choose a higher Precision, if necessarily).

sys2 = SetPrecision[sys, 8];
{b2, m2} = CoefficientArrays@sys2;

   sol2 = Solve[sys2, vars]
(* {{x1 -> 22.39343, x10 -> -6.332187, x11 -> -9.634195, x2 -> 16.364283,
   x3 -> -9.682724, x4 -> -18.364420, x5 -> -5.385104, x6 -> 3.753944,
   x7 -> -25.42344, x8 -> -7.919716, x9 -> -0.3700321}}*)

rrsol2 = RowReduce[Transpose[Join[Transpose[-m2], {b2}]]][[All, -1]]
(* {22.3934, -6.33219, -9.63420, 16.36428, -9.68272, -18.3644, -5.38510, \
3.75394, -25.4234, -7.91972, -0.370032} *)

sys /. sol2
(* {{True, True, True, True, True, True, True, True, True, True, True}} *)

sys /. Thread[vars -> rrsol2]
{True, True, True, True, True, True, True, True, True, True, True}
  • Hello, How can I delete one of the Curly bracket for my sulution if my output is {{x1 -> 22.3934, x2 -> 16.3643, x3 -> -9.68272, x4 -> -18.3644, x5 -> -5.3851, x6 -> 3.75394, x7 -> -25.4234, x8 -> -7.91972, x9 -> -0.370032, x10 -> -6.33219, x11 -> -9.6342}} and I need to get this solution {x1 -> 22.3934, x2 -> 16.3643, x3 -> -9.68272, x4 -> -18.3644, x5 -> -5.3851, x6 -> 3.75394, x7 -> -25.4234, x8 -> -7.91972, x9 -> -0.370032, x10 -> -6.33219, x11 -> -9.6342} – Cfede Mar 24 '16 at 12:57
  • @Cfede {{x1 -> 22.3934, x2 -> 16.3643, x3 -> -9.68272, x4 -> -18.3644, x5 -> -5.3851, x6 -> 3.75394, x7 -> -25.4234, x8 -> -7.91972, x9 -> -0.370032, x10 -> -6.33219, x11 -> -9.6342}} //Flatten` –  Mar 24 '16 at 13:09
  • there is a way to sorted the solution like this //{{x1 -> , x2 -> , x3 -> x4 -> , x5 ->, x6 -> , x7 ->, x8 -> , x9 ->, x10 -> , x11 -> }} – Cfede Mar 24 '16 at 18:46
  • @Cfede brute force; with the solution sol2: list = Flatten@sol2; Join[Delete[list, {{2}, {3}}], list[[2 ;; 3]]] –  Mar 24 '16 at 20:01
  • Hello, I am trying to get this values {x1 -> 22.39343, x10 -> -6.332187, x11 -> -9.634195, x2 -> 16.364283, x3 -> -9.682724, x4 -> -18.364420, x5 -> -5.385104, x6 -> 3.753944, x7 -> -25.42344, x8 -> -7.919716, x9 -> -0.3700321} . in this form {x1, x10, x11, x2, x3, x4, x5, x6, x7, x8, x9}to compare with my other solutions like this ({22.3934, -6.33219, -9.6342, 16.3643, -9.68272, -18.3644, -5.3851,
    3.75394, -25.4234, -7.91972, -0.370032}).... How can I do that from (x->) to (x)
    – Cfede Mar 25 '16 at 00:00
  • @Cfede You have this form in rrsol2 or solX = vars /. Solve[sys2, vars] if you wish to do it with Solve. –  Mar 25 '16 at 08:50