How to put the variable in a certain order after using “Solve[]”











up vote
5
down vote

favorite












I have this code:



eq1 = 4 x1 + 5 x2 - 9 x11 == 5;
eq2 = 5 x1 - 3 x2 + 3 x11 == 99;
eq3 = 2 x1 + 5 x2 - 4 x11 == 7;
system = {eq1, eq2, eq3};
solution = Solve[system]


and the output is:



{{x1 -> 2574/161, x11 -> 1094/161, x2 -> 71/161}}


I would like the output to go in order i.e. x1, x2, and then x11, but I cannot figure out how.










share|improve this question









New contributor




Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    – AccidentalFourierTransform
    2 days ago










  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
    – Chris K
    2 days ago










  • BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    – Αλέξανδρος Ζεγγ
    2 days ago

















up vote
5
down vote

favorite












I have this code:



eq1 = 4 x1 + 5 x2 - 9 x11 == 5;
eq2 = 5 x1 - 3 x2 + 3 x11 == 99;
eq3 = 2 x1 + 5 x2 - 4 x11 == 7;
system = {eq1, eq2, eq3};
solution = Solve[system]


and the output is:



{{x1 -> 2574/161, x11 -> 1094/161, x2 -> 71/161}}


I would like the output to go in order i.e. x1, x2, and then x11, but I cannot figure out how.










share|improve this question









New contributor




Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    – AccidentalFourierTransform
    2 days ago










  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
    – Chris K
    2 days ago










  • BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    – Αλέξανδρος Ζεγγ
    2 days ago















up vote
5
down vote

favorite









up vote
5
down vote

favorite











I have this code:



eq1 = 4 x1 + 5 x2 - 9 x11 == 5;
eq2 = 5 x1 - 3 x2 + 3 x11 == 99;
eq3 = 2 x1 + 5 x2 - 4 x11 == 7;
system = {eq1, eq2, eq3};
solution = Solve[system]


and the output is:



{{x1 -> 2574/161, x11 -> 1094/161, x2 -> 71/161}}


I would like the output to go in order i.e. x1, x2, and then x11, but I cannot figure out how.










share|improve this question









New contributor




Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have this code:



eq1 = 4 x1 + 5 x2 - 9 x11 == 5;
eq2 = 5 x1 - 3 x2 + 3 x11 == 99;
eq3 = 2 x1 + 5 x2 - 4 x11 == 7;
system = {eq1, eq2, eq3};
solution = Solve[system]


and the output is:



{{x1 -> 2574/161, x11 -> 1094/161, x2 -> 71/161}}


I would like the output to go in order i.e. x1, x2, and then x11, but I cannot figure out how.







equation-solving core-language






share|improve this question









New contributor




Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









Αλέξανδρος Ζεγγ

3,4161927




3,4161927






New contributor




Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









Jose Castellanos

283




283




New contributor




Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Jose Castellanos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    – AccidentalFourierTransform
    2 days ago










  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
    – Chris K
    2 days ago










  • BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    – Αλέξανδρος Ζεγγ
    2 days ago




















  • Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    – AccidentalFourierTransform
    2 days ago










  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
    – Chris K
    2 days ago










  • BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    – Αλέξανδρος Ζεγγ
    2 days ago


















Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
– AccidentalFourierTransform
2 days ago




Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
– AccidentalFourierTransform
2 days ago












Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Chris K
2 days ago




Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– Chris K
2 days ago












BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
– Αλέξανδρος Ζεγγ
2 days ago






BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
– Αλέξανδρος Ζεγγ
2 days ago












3 Answers
3






active

oldest

votes

















up vote
12
down vote



accepted










Solve will return the solutions in the order requested:



solution = Solve[system, {x1, x2, x11}]
(* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)





share|improve this answer





















  • Thank you so much!
    – Jose Castellanos
    2 days ago


















up vote
3
down vote













SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution 



{{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}







share|improve this answer




























    up vote
    1
    down vote













    Try also this:



    solution /. {a_, b_, c_} -> {a, c, b}

    (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)


    Have fun!






    share|improve this answer





















      Your Answer





      StackExchange.ifUsing("editor", function () {
      return StackExchange.using("mathjaxEditing", function () {
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      });
      });
      }, "mathjax-editing");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "387"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      Jose Castellanos is a new contributor. Be nice, and check out our Code of Conduct.










       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f185878%2fhow-to-put-the-variable-in-a-certain-order-after-using-solve%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      12
      down vote



      accepted










      Solve will return the solutions in the order requested:



      solution = Solve[system, {x1, x2, x11}]
      (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)





      share|improve this answer





















      • Thank you so much!
        – Jose Castellanos
        2 days ago















      up vote
      12
      down vote



      accepted










      Solve will return the solutions in the order requested:



      solution = Solve[system, {x1, x2, x11}]
      (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)





      share|improve this answer





















      • Thank you so much!
        – Jose Castellanos
        2 days ago













      up vote
      12
      down vote



      accepted







      up vote
      12
      down vote



      accepted






      Solve will return the solutions in the order requested:



      solution = Solve[system, {x1, x2, x11}]
      (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)





      share|improve this answer












      Solve will return the solutions in the order requested:



      solution = Solve[system, {x1, x2, x11}]
      (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered 2 days ago









      Michael E2

      143k11192462




      143k11192462












      • Thank you so much!
        – Jose Castellanos
        2 days ago


















      • Thank you so much!
        – Jose Castellanos
        2 days ago
















      Thank you so much!
      – Jose Castellanos
      2 days ago




      Thank you so much!
      – Jose Castellanos
      2 days ago










      up vote
      3
      down vote













      SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution 



      {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}







      share|improve this answer

























        up vote
        3
        down vote













        SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution 



        {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}







        share|improve this answer























          up vote
          3
          down vote










          up vote
          3
          down vote









          SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution 



          {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}







          share|improve this answer












          SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution 



          {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          kglr

          171k8193398




          171k8193398






















              up vote
              1
              down vote













              Try also this:



              solution /. {a_, b_, c_} -> {a, c, b}

              (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)


              Have fun!






              share|improve this answer

























                up vote
                1
                down vote













                Try also this:



                solution /. {a_, b_, c_} -> {a, c, b}

                (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)


                Have fun!






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Try also this:



                  solution /. {a_, b_, c_} -> {a, c, b}

                  (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)


                  Have fun!






                  share|improve this answer












                  Try also this:



                  solution /. {a_, b_, c_} -> {a, c, b}

                  (* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)


                  Have fun!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 days ago









                  Alexei Boulbitch

                  21k2369




                  21k2369






















                      Jose Castellanos is a new contributor. Be nice, and check out our Code of Conduct.










                       

                      draft saved


                      draft discarded


















                      Jose Castellanos is a new contributor. Be nice, and check out our Code of Conduct.













                      Jose Castellanos is a new contributor. Be nice, and check out our Code of Conduct.












                      Jose Castellanos is a new contributor. Be nice, and check out our Code of Conduct.















                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f185878%2fhow-to-put-the-variable-in-a-certain-order-after-using-solve%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Сан-Квентин

                      8-я гвардейская общевойсковая армия

                      Алькесар