Skip to main content
added 250 characters in body
Source Link
Artes
  • 58.2k
  • 13
  • 161
  • 251

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

Edit

Instead of specifying how many variables there are we can just use this :

Column@Apply[List, #, {2}] & @ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

enter image description here

or

Column@ Apply[Composition[Part[#, 2] &, List], Solve[x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}], {2}] 

enter image description here

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

Instead of specifying how many variables there are we can just use this :

Column@Apply[List, #, {2}] & @ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

enter image description here

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

Edit

Instead of specifying how many variables there are we can just use this :

Column@Apply[List, #, {2}] & @ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

enter image description here

or

Column@ Apply[Composition[Part[#, 2] &, List], Solve[x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}], {2}] 

enter image description here

added 102 characters in body
Source Link
Artes
  • 58.2k
  • 13
  • 161
  • 251

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 
{ {-3, -5, (-37)^(1/3)}, {-3, -5, -37^(1/3)}, {-3, -5, -(-1)^(2/3) 37^(1/3)}, 

Instead of specifying how many variables there are we can just use this :

Column@Apply[List, #, {2,}] 0,& -(@ Solve[ x^2 + y == 4 && x -3)^(1/3) y },== {2, 0,&& 3^(1/3)x^3 + y - z^3 }== 5, {2x, 0y, (-1)^(2/3) 3^(1/3) } z}] 

enter image description here

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 
{ {-3, -5, (-37)^(1/3)}, {-3, -5, -37^(1/3)}, {-3, -5, -(-1)^(2/3) 37^(1/3)}, 
 {2, 0, -(-3)^(1/3) }, {2, 0, 3^(1/3) }, {2, 0, (-1)^(2/3) 3^(1/3) } } 

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

Instead of specifying how many variables there are we can just use this :

Column@Apply[List, #, {2}] & @ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 

enter image description here

added 535 characters in body
Source Link
Artes
  • 58.2k
  • 13
  • 161
  • 251

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 
{ {-3, -5, (-37)^(1/3)}, {-3, -5, -37^(1/3)}, {-3, -5, -(-1)^(2/3) 37^(1/3)}, 
 {2, 0, -(-3)^(1/3) }, {2, 0, 3^(1/3) }, {2, 0, (-1)^(2/3) 3^(1/3) } } 

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

It would be better to use the following :

{#[[1, 2]], #[[2, 2]]} & /@ Solve[x^2 + y == 4 && x - y == 2, {x, y}] 
{{-3, -5}, {2, 0}} 

Since in general given a system of equations may have more than only one solution.

Another more general approach is to use Table, because of different number of variables. For example when we have 3 variables in a system :

x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5 

We could write :

Table[ #[[a, 2]], {a, 3}] & /@ Solve[ x^2 + y == 4 && x - y == 2 && x^3 + y - z^3 == 5, {x, y, z}] 
{ {-3, -5, (-37)^(1/3)}, {-3, -5, -37^(1/3)}, {-3, -5, -(-1)^(2/3) 37^(1/3)}, 
 {2, 0, -(-3)^(1/3) }, {2, 0, 3^(1/3) }, {2, 0, (-1)^(2/3) 3^(1/3) } } 
Source Link
Artes
  • 58.2k
  • 13
  • 161
  • 251
Loading