jhvc03
(Harvey Vargas)
1
I have a equation system with two variables. And the Mathematica gives a solution.
How can I call this solution a line down to do another calc.
This question is for automatization process I’m doing.
Solve[x + y == 2 && x - y == 1, {x, y}]
{{x → 3/2, y → 1/2}}
jbaldwin
(Jim Baldwin)
2
(* Original equation *)
sol = Solve[x + y == 2 && x - y == 1, {x, y}]
(* Use solution for another function of x and y *)
x + 7 y /. Flatten[sol]
jhvc03
(Harvey Vargas)
3
This is how I save it
sol = Solve[x + y == 2 && x - y == 1, {x, y}];
x = x /. Flatten[sol]
y = y /. Flatten[sol]
It says is an error
seebonk
(Douglas Kubler)
4
You’re missing a semicolon
sol = Solve[x + y == 2 && x - y == 1, {x, y}]; x = x /. Flatten[sol]; y = y /. Flatten[sol]
Undo the symbol damage with Clear["x"];Clear["y"];
Re-execute and your answers will be OK.