Message Boards Message Boards

0
|
6002 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

calling variable that holds a previous output.

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}}

POSTED BY: Harvey Vargas
3 Replies
Posted 11 years ago

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.

POSTED BY: Douglas Kubler

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

POSTED BY: Harvey Vargas
Posted 11 years ago
(* 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]
POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract