4
$\begingroup$

Say I have the following input:

Reduce[{t*c==50, t==5}]

the output:

t == 5. && c == 10.

Is there a way to create a variable x that gets assigned the value of c from the output without actually having to type x = 10?

$\endgroup$
  • 4
    $\begingroup$ x = c /. ToRules @ Reduce[...] $\endgroup$ – wxffles Sep 9 '14 at 21:00
2
$\begingroup$
out = Reduce[{t*c == 50, t == 5}];
x = Cases[out, c == y_ :> y, -1][[1]]
10
| improve this answer | |
$\endgroup$
0
$\begingroup$

With

eqs = {t*c == 50, t == 5};

then

x = Refine[c, Reduce[eqs]]

or (wxffles' comment)

x = c /. ToRules@Reduce[eqs]

or

x = c /. First@Solve[eqs]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.