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.

My code:

Clear[r1, r2]; 
par[r1_, r2_] := r1 r2 / (r1 + r2); 
Reduce[{5 par[r2, 32000]/(r1 + par[r2, 32000]) == 1.8 && par[r1, r2] == 5000}, {r1, r2}]

with this result:

enter image description here

I checked it a dozen times, but I can't see why MMA doesn't give me a value for r1. So, like I always do when I'm desperate :-), I quit and restarted MMA. Copied and pasted my input. And ecco!:

enter image description here

Any idea what could have caused the first result?

share|improve this question
the same input giving different answers implies that there is some (invisible) state that's different, so I think all we need here is a seer :) –  acl Aug 6 '12 at 13:52
@acl - maybe a feature request for version 9? :-). It sometimes happens that there are dependencies I've overlooked, but here there's just r1 and r2, and I cleared those! I can't get it. –  stevenvh Aug 6 '12 at 13:55

2 Answers 2

up vote 6 down vote accepted

One possible cause for the error is a previous (and wrong) definition of par[ ]. For example:

par[r1, r2] := 5000;
Clear[r1, r2];
par[r1_, r2_] := r1 r2/(r1 + r2);
Reduce[{5 par[r2, 32000]/(r1 + par[r2, 32000]) == 1.8 &&  par[r1, r2] == 5000}, {r1, r2}]

Mathematica graphics


 par[r1, r2] := {};

Has the same effect :)

share|improve this answer
Looks good, er, I mean bad, you know what I mean. I checked the history of that notebook, and it has a previous definition for par[], but it's basically the same (only written as 1/(1/r1 + 1/r2) ) –  stevenvh Aug 6 '12 at 15:17
@stevenvh Do you have notebooks with a built-in history? You're testing a development version I must assume, since mine hasn't got that capability. I can rewrite an existing line of code leaving no trace of the original one, while the results of its execution are still alive. –  Sjoerd C. de Vries Aug 6 '12 at 15:23
@Sjoerd - I mean, I had saved the notebook before restarting MMA, and since I never delete previous calculations all my IN[]s and Out[]s were still there, only without the references. That's how the first function doesn't show In[] and Out[], while the one after restarting does. Version 8, but that's what MMA has always done, isn't it? –  stevenvh Aug 6 '12 at 15:28
@stevenvh I don't think many mma share your notebook usage habits. Starting a new cell for each and every new calculation even if you only want to re-execute a calculation because you changed some variables? Even if some of the output are high memory density plots? Nah. –  Sjoerd C. de Vries Aug 6 '12 at 19:33
@Verbeia And that solves partially the lacking of multiple undos by enforcing habits and discipline. Now, if I only could remember where I parked my car today ... –  belisarius Aug 8 '12 at 6:20

If you replace the number 1.8 with it's rational value 9/5 you get an answer without warnings:

Clear[r1, r2];
par[r1_, r2_] := r1 r2/(r1 + r2);
Reduce[{5 par[r2, 32000]/(r1 + par[r2, 32000]) == 9/5 && 
   par[r1, r2] == 5000}, {r1, r2}]

% // N

With the output:

r1 == 4000000/333 && r2 == 4000000/467
r1 == 12012. && r2 == 8565.31

share|improve this answer
This still doesn't answer the question of what caused the first output shown... –  J. M. Aug 6 '12 at 13:28
@J.M. I coudn't reproduce the first output. –  Peter Breitfeld Aug 6 '12 at 13:39
@Peter - thanks. Maybe I should have said I'm an engineer, and for engineers the result is 12000 and 8600; we don't care that much about 10 significant digits :-). (For quick calculations in my head pi is often 3. Go figure.) –  stevenvh Aug 6 '12 at 13:52

Your Answer


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.