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












5












$begingroup$


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











$endgroup$












  • $begingroup$
    Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    $endgroup$
    – AccidentalFourierTransform
    Nov 13 '18 at 2:17










  • $begingroup$
    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!
    $endgroup$
    – Chris K
    Nov 13 '18 at 2:39










  • $begingroup$
    BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    $endgroup$
    – Αλέξανδρος Ζεγγ
    Nov 13 '18 at 7:06


















5












$begingroup$


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











$endgroup$












  • $begingroup$
    Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    $endgroup$
    – AccidentalFourierTransform
    Nov 13 '18 at 2:17










  • $begingroup$
    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!
    $endgroup$
    – Chris K
    Nov 13 '18 at 2:39










  • $begingroup$
    BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    $endgroup$
    – Αλέξανδρος Ζεγγ
    Nov 13 '18 at 7:06
















5












5








5





$begingroup$


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











$endgroup$




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















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 7:08









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

4,1541929




4,1541929










asked Nov 13 '18 at 2:00









Jose CastellanosJose Castellanos

283




283












  • $begingroup$
    Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    $endgroup$
    – AccidentalFourierTransform
    Nov 13 '18 at 2:17










  • $begingroup$
    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!
    $endgroup$
    – Chris K
    Nov 13 '18 at 2:39










  • $begingroup$
    BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    $endgroup$
    – Αλέξανδρος Ζεγγ
    Nov 13 '18 at 7:06




















  • $begingroup$
    Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
    $endgroup$
    – AccidentalFourierTransform
    Nov 13 '18 at 2:17










  • $begingroup$
    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!
    $endgroup$
    – Chris K
    Nov 13 '18 at 2:39










  • $begingroup$
    BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
    $endgroup$
    – Αλέξανδρος Ζεγγ
    Nov 13 '18 at 7:06


















$begingroup$
Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
$endgroup$
– AccidentalFourierTransform
Nov 13 '18 at 2:17




$begingroup$
Use x[1],x[2],x[1,1] (or x[1],x[2],x[11]) instead of x1,x2,x11.
$endgroup$
– AccidentalFourierTransform
Nov 13 '18 at 2:17












$begingroup$
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!
$endgroup$
– Chris K
Nov 13 '18 at 2:39




$begingroup$
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!
$endgroup$
– Chris K
Nov 13 '18 at 2:39












$begingroup$
BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
$endgroup$
– Αλέξανδρος Ζεγγ
Nov 13 '18 at 7:06






$begingroup$
BTW, you can even suppress the output of x11 by using Solve[system, {x1, x2}, {x11}], if you want to.
$endgroup$
– Αλέξανδρος Ζεγγ
Nov 13 '18 at 7:06












3 Answers
3






active

oldest

votes


















12












$begingroup$

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









$endgroup$













  • $begingroup$
    Thank you so much!
    $endgroup$
    – Jose Castellanos
    Nov 13 '18 at 14:13



















3












$begingroup$

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



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







share|improve this answer









$endgroup$





















    1












    $begingroup$

    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









    $endgroup$













      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',
      autoActivateHeartbeat: false,
      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
      });


      }
      });














      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









      12












      $begingroup$

      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









      $endgroup$













      • $begingroup$
        Thank you so much!
        $endgroup$
        – Jose Castellanos
        Nov 13 '18 at 14:13
















      12












      $begingroup$

      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









      $endgroup$













      • $begingroup$
        Thank you so much!
        $endgroup$
        – Jose Castellanos
        Nov 13 '18 at 14:13














      12












      12








      12





      $begingroup$

      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









      $endgroup$



      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 Nov 13 '18 at 2:52









      Michael E2Michael E2

      146k11197468




      146k11197468












      • $begingroup$
        Thank you so much!
        $endgroup$
        – Jose Castellanos
        Nov 13 '18 at 14:13


















      • $begingroup$
        Thank you so much!
        $endgroup$
        – Jose Castellanos
        Nov 13 '18 at 14:13
















      $begingroup$
      Thank you so much!
      $endgroup$
      – Jose Castellanos
      Nov 13 '18 at 14:13




      $begingroup$
      Thank you so much!
      $endgroup$
      – Jose Castellanos
      Nov 13 '18 at 14:13











      3












      $begingroup$

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



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







      share|improve this answer









      $endgroup$


















        3












        $begingroup$

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



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







        share|improve this answer









        $endgroup$
















          3












          3








          3





          $begingroup$

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



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







          share|improve this answer









          $endgroup$



          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 Nov 13 '18 at 2:31









          kglrkglr

          179k9198410




          179k9198410























              1












              $begingroup$

              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









              $endgroup$


















                1












                $begingroup$

                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









                $endgroup$
















                  1












                  1








                  1





                  $begingroup$

                  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









                  $endgroup$



                  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 Nov 13 '18 at 12:50









                  Alexei BoulbitchAlexei Boulbitch

                  21.4k2470




                  21.4k2470






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Mathematica Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      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

                      Florida Star v. B. J. F.

                      Error while running script in elastic search , gateway timeout

                      Adding quotations to stringified JSON object values