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.
equation-solving core-language
New contributor
add a comment |
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.
equation-solving core-language
New contributor
Usex[1],x[2],x[1,1]
(orx[1],x[2],x[11]
) instead ofx1,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 ofx11
by usingSolve[system, {x1, x2}, {x11}]
, if you want to.
– Αλέξανδρος Ζεγγ
2 days ago
add a comment |
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.
equation-solving core-language
New contributor
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
equation-solving core-language
New contributor
New contributor
edited 2 days ago
Αλέξανδρος Ζεγγ
3,4161927
3,4161927
New contributor
asked 2 days ago
Jose Castellanos
283
283
New contributor
New contributor
Usex[1],x[2],x[1,1]
(orx[1],x[2],x[11]
) instead ofx1,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 ofx11
by usingSolve[system, {x1, x2}, {x11}]
, if you want to.
– Αλέξανδρος Ζεγγ
2 days ago
add a comment |
Usex[1],x[2],x[1,1]
(orx[1],x[2],x[11]
) instead ofx1,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 ofx11
by usingSolve[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
add a comment |
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}} *)
Thank you so much!
– Jose Castellanos
2 days ago
add a comment |
up vote
3
down vote
SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution
{{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}
add a comment |
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!
add a comment |
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}} *)
Thank you so much!
– Jose Castellanos
2 days ago
add a comment |
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}} *)
Thank you so much!
– Jose Castellanos
2 days ago
add a comment |
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}} *)
Solve
will return the solutions in the order requested:
solution = Solve[system, {x1, x2, x11}]
(* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)
answered 2 days ago
Michael E2
143k11192462
143k11192462
Thank you so much!
– Jose Castellanos
2 days ago
add a comment |
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
add a comment |
up vote
3
down vote
SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution
{{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}
add a comment |
up vote
3
down vote
SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution
{{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}
add a comment |
up vote
3
down vote
up vote
3
down vote
SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution
{{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}
SortBy[#, {StringLength @ SymbolName[#[[1]]] &}] & /@ solution
{{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}}
answered 2 days ago
kglr
171k8193398
171k8193398
add a comment |
add a comment |
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!
add a comment |
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!
add a comment |
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!
Try also this:
solution /. {a_, b_, c_} -> {a, c, b}
(* {{x1 -> 2574/161, x2 -> 71/161, x11 -> 1094/161}} *)
Have fun!
answered 2 days ago
Alexei Boulbitch
21k2369
21k2369
add a comment |
add a comment |
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.
Jose Castellanos is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Use
x[1],x[2],x[1,1]
(orx[1],x[2],x[11]
) instead ofx1,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 usingSolve[system, {x1, x2}, {x11}]
, if you want to.– Αλέξανδρος Ζεγγ
2 days ago