Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to solve eqn for c0. I want to do it with both replacement rules. I realize I could just use solve twice, once for subsCoke, and once for subsPepsi. I'm trying to do it in just one Sovle to learn how to use mathematicas functional style better.

eqn = c0/(c0 + cs) == Iunk/Is
subsCoke = {cO -> c0, cs -> 2, Iunk -> 0.3995, Is -> 0.7339};
subsPepsi = {c0 -> c0, cs -> 2, Iunk -> 0.3915, Is -> 0.7645};
Solve[eqn  /. {subsCoke, subsPepsi}, c0]
share|improve this question
1  
The usual way is to solve it once and then use the reprules: –  belisarius Mar 3 at 5:12
1  
As in eqn = c0/(c0 + cs) == Iunk/Is; s = Solve[eqn, c0][[1]]; subsCoke = {cO -> c0, cs -> 2, Iunk -> 0.3995, Is -> 0.7339}; subsPepsi = {c0 -> c0, cs -> 2, Iunk -> 0.3915, Is -> 0.7645}; {s /. subsCoke, s /. subsPepsi} –  belisarius Mar 3 at 5:13
add comment

1 Answer 1

up vote 1 down vote accepted

This is belisarius' comments combined into an answer

The usual way is to solve it once and then use the replacement rules:

eqn = c0/(c0 + cs) == Iunk/Is;
subsCoke = {cO -> c0, cs -> 2, Iunk -> 0.3995, Is -> 0.7339}; 
subsPepsi = {c0 -> c0, cs -> 2, Iunk -> 0.3915, Is -> 0.7645};

s = Solve[eqn, c0][[1]];
{s /. subsCoke, s /. subsPepsi}
{{c0 -> 2.38935}, {c0 -> 2.0992}}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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