RPN logic question  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: RPN logic question (/thread239677.html) 
RPN logic question  Victor Quiros  02272013 Hi there. Someone posted this on Facebook: 61*0+2/2= . Most people answer 7, however being accustomed to RPN logic my answer is 5: 1 [enter] 0 [x] 2 [enter] 2 [/] [+] [6] [stack swap] []. At the beginning I was certain it was 5, but so many people answering 7 got me puzzled. I know there must be one valid answer only. Any thoughts? Thanks and cheers from the tropics.
Re: RPN logic question  Raymond Del Tondo  02272013 Just take a look at the wikipedia entry for "Operator precedence" which will clarify the problem;)
HTH
Ray Edited: 27 Feb 2013, 7:43 a.m.
Re: RPN logic question  fhub  02272013 Quote:Well, 1*0=0 (and 2/2=1), so in fact it's 60+1=7.
With your changed order you're calculating 61 instead of 6+1.
Franz
Re: RPN logic question  Johnny Bjoern Rasmussen  02272013 Five is the only true result.
Re: RPN logic question  Didier Lachieze  02272013 Without further details such as explicit operator precedence rules, other results can be valid.
For example, just enter the sequence of operations above on a chain mode calculator (such as the recent hp 20b) and you’ll got: 1.00 Edited: 27 Feb 2013, 8:48 a.m.
Re: RPN logic question  Walter B  02272013 I dare to disagree. With multiplications and divisions preceding additions and subtractions (I assume you were taught that common rule as well), seven is the solution.
d:)
Re: RPN logic question  fhub  02272013 Quote:I would say: back to school! ;)
Franz
Re: RPN logic question  fhub  02272013 Quote:No, there are no further details about operator precedence necessary, there are already clearly defined precedence rules in mathematics:
1) expressions in parentheses (...) Franz
Edited: 27 Feb 2013, 9:03 a.m.
Re: RPN logic question  Didier Lachieze  02272013 What I meant is that if you just have the list of operations: "61*0+2/2=" without an explicit statement telling you that you should apply operator precedence rules, then this can be considered as a chain mode sequence leading to different but still valid result.
Edited: 27 Feb 2013, 10:22 a.m.
Re: RPN logic question  Walter B  02272013 'Chain mode' is no proper calculation method, it's the name of a disease IMHO.
d:/
Re: RPN logic question  fhub  02272013 Quote:And what I meant is that you don't need an explicit statement about operator precedence rules, because there are implicit precedence rules for all mathematical expressions  you don't even have to mention them. ;)
Franz
Re: RPN logic question  Didier Lachieze  02272013 It's all about context. You're making the implicit assumption that this is a mathematical expression and that operator precedence rules should apply as defined and taught in schools. However nothing in the original post is telling you this is not an expression used in a different context where chain mode rules apply. Depending on the context 1+3x2=7 or 1+3x2=8 ...
Just look to the hp 20b/30b or others financial calculators with chain mode. Edited: 27 Feb 2013, 10:44 a.m.
Re: RPN logic question  C.Ret  02272013 Quote: In this specific case, most people are correct. Note that isn't the case for every situation.
Quote:
The RPN logic doesn't require you change the order of arguments or operations.
6 [ENTER^] 1 [ENTER^] 0 [ x ] [  ] 2 [ENTER^] [ / ] [ + ]
Quote: There is only one solution in the case this expression has to be interpreted with implicit standard rules of precedence.
If it is state that "chain computation" rules have to be applied, then the only expected result is 1. And the corresponding RPN sequence will be :
6 [ENTER^] 1 [  ] 0 [ x ] 2 [  ] 2 [ / ] In the hypothetic case where same exotic rules of interpretation are imposed, another RPN sequence may have to be applied… As can be seen on this short example, the power of RPN logic system is exactly that the user may adapt its computations to any rules and specific situations.
As a conclusion, RPN logic is not a proof from the correct logic in expression's (or equation's) interpretations. This is not the case with AOS or other CAS systems. That why RPN systems are still preferred by welltodo people, who exactly know how to get the correct answers in any specific circumstances. And the others systems are preferred by unskilled people who frenziedly hope that a sophisticate digital assistant will suffice in masking personal unawareness.
Edited: 27 Feb 2013, 10:47 a.m.
Re: RPN logic question  Harald  02272013 Quote:
A disease that is even taught at school sometimes. *shiver*
Re: RPN logic question  fhub  02272013 Quote:Could you please show me one serious example where a socalled 'chainmoderule' is (or should be) used??? (it's in fact as Walter said: 'chainmode' is a disease, the socalled 'ChainModeSyndrome' :)) Quote:WHAT??? Do you really want to say that the HP20b/30b use these completely wrong chainmode rule? [shock]
Franz
Re: RPN logic question  Didier Lachieze  02272013 Quote:Gene may have the background to provide such examples.
Quote:Yes, and Chain Mode is the default mode on these calculators. Algebraic and RPN are the two other modes supported. Edited: 27 Feb 2013, 10:57 a.m.
Re: RPN logic question  Victor Quiros  02272013 Thank you very much for this detailed, instructive answer. It really helped. Lesson learned. Cheers.
Re: RPN logic question  fhub  02272013 Quote:Oh my god, I would never have expected that HP would implement such a crap in any of their calculators. :( That's almost a reason for removing the HP20b/30b emulators from my calculator emulation package!
Franz
Re: RPN logic question  aurelio  02272013 Quote:
Saint words, Franz, saint words....
Re: RPN logic question  aurelio  02272013 math has its rules, and calculators (sure wonderful machines) are only tools, that we should use in the best way
Re: RPN logic question  Ethan Conner  02272013 I am going to buy a lottery ticket today.....Walter and Franz agree on something! Seriously though i have seen a couple of these problems on FB and it's scary how many people don't apply order of operations even when someone has explained this in their answer.
Re: RPN logic question  Manolo Sobrino  02272013 Quote: I'm getting a little bit tired of this... It really depends. If you are the kind of person that does the algebra on paper in order to get a closed result in terms of parameters (introducing adhoc ones if necessary), then (EOS) 'equation' algebraic makes a lot of sense. If you'd rather perform transformations with the values of all parameters as soon as you can, then RPN makes easier to get to the numerical answer. Usually in Physics the first strategy is encouraged, as your algebraic result is essential to the calculation of error propagation (in real life it is expected that you deal with uncertainties properly). Maybe I'm biased, but I think it's quite elegant: you get your numerical results just by plugging the required values, then again editing the last line for any change. Engineers (and freshmen... sorry, but you had it coming XD) tend to use the second approach as probably it is faster for a singletime, not too involved calculation... and a reasonable number of decimal places will do the job fairly well.
They're just different tools for different needs. Edited: 27 Feb 2013, 1:47 p.m.
Re: RPN logic question  Dieter  02272013 Simple answer: 6  1 * 0 + 2 / 2On the other hand, your key sequence... 1 [enter] 0 [x] 2 [enter] 2 [/] [+] [6] [stack swap] []...actually calculates... 6  ((1*0) + (2/2))q.e.d.
Dieter
Re: RPN logic question  Nick_S  02282013 Quote:Being accustomed to both RPN and the norms of infix operator precedence for multiplication and addition I calculated the answer as: 6 [enter] 1 [enter] 0 *  2 [enter] 2 / + = 7
Nick
Re: RPN logic question  Reth  02282013 If there is a logic that evaluates that expression to anything other than 7, so it must be called "crap" logic.
Re: RPN logic question  C.Ret  02282013 The good new is that any RPN calculators are ready to process any type of "crap" and "sandard" logics ! EDIT:
The good new is that any RPN calculators are ready to process any type of "crap" and "standard" logics ! Edited: 1 Mar 2013, 3:42 a.m. after one or more responses were posted
Re: RPN logic question  C.Ret  02282013 Hi, Nick, you can spare a really few keystroke, the last [ 2 ] doeasn't need to be input, the [ENTER^] key has kept a copy of the firt entry in the x: register. I agree, this is a really small economy, but "a keystroke is a keystroke" as we say it as home : "un sou est un sou".
Re: RPN logic question  Walter B  02282013 Quote:"Sand art" or "standard"?? How about measuring the quality of posts in "errors per line of text"?
d#/ Edited: 28 Feb 2013, 8:51 a.m.
Re: RPN logic question  Marcus von Cube, Germany  02282013 It looks like financial guys demand it. No wonder where the last crisis must have come from...
Re: RPN logic question  Reth  02282013 Are you going to walk after me and try to play smart? Thank God you're not a standup comedian, you'd be starving to death with that sense of humor.
Edited: 28 Feb 2013, 8:35 p.m.
Re: RPN logic question  Neil Hamilton (Ottawa)  02282013 We have a saying in English about the "pot calling the kettle black". It seems your house may be very much made of glass... This is a quote of you from another thread. In it I count 2 spelling errors.
Quote: Perhaps you yourself were rattled due to the quite deserved rebuke against your unreasonable and offensive post there. I am not sure what your issues are but they certain grow on others nerves  at least mine.
Re: RPN logic question  Les Bell  02282013 Quote: The only true response is, "What a silly way to write out a problem". I doubt any of us would write down such an algebraic expression without reducing some of the terms, using parentheses  even redundant parentheses where an ambiguity could arise  or even (possibly subconsciously) adding extra space on the paper to make clear the precedence. I routinely deal with much more complex calculations and equations with either pencilandpaper or LaTeX, and there's never any kind of ambiguity over algebraic precedence like in this problem  it's screamingly obvious. In the course of solving a realworld problem, we'd probably note the zero factor in the second term, and just write:
x = 6 + 2/2 I cringe when I see those silly Facebook posts  they're deliberately written without all the clues and cues people who actually work with numbers give ourselves to make sure things get done right. They're just a little trick by which highschoolers with a little mathematical nous can get to feel superior over their lessnumerate friends. Best,
 Les Re: RPN logic question  Kiyoshi Akima  02282013 There was also a grammatical error in the next sentence. It's an all too common error, so perhaps Reth thinks that if enough people make the error then it's okay.
Re: RPN logic question  Pete Wilson  03012013 Quote:
APL FTW!
Re: RPN logic question  Nick_S  03012013 Thanks for the reminder about the short cut for my HP15c. Here, it's a case of me using RPL since 1988 on a HP28S and HP48GX where the extra [enter] keystroke appears to be required. Nick
Edited: 1 Mar 2013, 3:35 a.m.
Re: RPN logic question  Walter B  03012013 Quote:Australian Pork Limited For The Worms?? Speach was invented for communication, wasn't it?
d:?
Re: RPN logic question  Paul Dale  03012013 We do arefmetik good here.
 Pauli
Re: RPN logic question  Walter B  03012013 I believe it  your symptoms look like another disease but at least not that AAS (American abbreviation syndrom).
d;)
Re: RPN logic question  C.Ret  03012013 Quote: Sorry, miss typed again. It was "Standard".
You right, I have to improve my english. Please continue to point me out any errors and typos. I only progress under pressure. Good teachers make better students ! Sorry again for my broken english and the numerous typos making my low quality posts hard to read or to understand.
Edited: 13 Mar 2013, 3:34 a.m.
Re: RPN logic question  aurelio  03012013 I think that for a lot of people, here on the MoHPC, english is not the mother tongue, so that I think that we must consider more important facts and ideas than grammar rules or spelling corrections. Different thoughts of course for a official printed document. I think that sometimes most of us on this Forum love to play with this matter like children. My 2 cents.
Edited: 1 Mar 2013, 5:02 a.m.
Re: RPN logic question  Reth  03012013 so you noticed my errors only? because i'm not native english speaker, true?
Re: RPN logic question  Reth  03012013 There was or there is? Is this an error, mr. English grammar expert?
Re: RPN logic question  Neil Hamilton (Ottawa)  03012013 No, it was not your spelling errors to which my comments were addressed. I would never cast stone at others spelling since mine is typically so atrocious  not to mention the fact that I, like others, simply cannot type accurately on an iPad or iPhone. It was more your inhospitable attitude I was referring to. I will second (third?, fourth?, ...) statements made in earlier posts by others that if you are not interested in a topic, have the good grace to ignore it and leave it to others to enjoy. I am sure we will all be much happier then.
Re: RPN logic question  Dieter  03012013 Quote:"Speach" ?) Do you remember your own post from yesterday, 8:44 a.m.? SCNR.
Regarding speech and communication, consider this quote of CharlesMaurice de TalleyrandPérigord: Dieter
Re: RPN logic question  Walter B  03012013 Point taken. Speech is one of my favourites ;) But speech was invented at a place far, far away and long, long before Taillerand abused it ...
d;)
Re: RPN logic question  Kiyoshi Akima  03012013 So, you are the only one allowed to point out mistakes in other people's posts? Just as you are the only one allowed to decide what subject matter is and isn't appropriate?
As for not being a native English speaker, neither am I.
Re: RPN logic question  Kiyoshi Akima  03012013 Quote:
It may or may not be, depending on whether you edit your post to correct the original error. Since I have no control over that, I merely confined my statement to the original post.
Re: RPN logic question  Reth  03012013 I apologise to you, Neil.
Re: RPN logic question  Reth  03012013 I only shared my view and gave my advise to the OP.
Edited: 1 Mar 2013, 10:28 p.m.
Re: RPN logic question  René Franquinet  03022013 Gentlemen (as I have not noticed a name of feminine origin),
I have enjoyed this forum topic very much as at the same time it contained very meaningless and meaningful elements. The extremes being language and mathematics, but as you know the latter cannot live without the former, I have enjoyed this standup comedian like discussion of a rather insignificant problem, whether it could be handled by RPN or by CAS or by a yet unnamed method. Re: RPN logic question  Neil Hamilton (Ottawa)  03022013 Accepted. However, I think it would be better directed at the OP of the 39GII thread than to me. I, like you, thoroughly enjoy RPN (and lately, RPL as well) and really can't understand a world that doesn't "see the light" as we do. I also own a 39GII, and though I really can't make much use of it because I keep stumbling over prefix/postfix, etc. (old RPN reflexes) I recognize that it is an incredible machine and enjoy reading about it. Will I ever replace my collection of backward machines? NEVER!, but I will continue to read about others none the less. As far as new vs. old, native compiled vs. emulator vs. simulator, they all have their uses and they all have merit. There are many opinions that this specific family or that specific series is by far the best. They all have their quirks and issues. Many have golden ideas. I would prefer to hear about as many of them as possible. (And for the record, I have a much maligned 35s which I quite like  even with its foibles  and be damned what others may say.) Just because David has arbitrarily decided that the world ended at HP48SX (with mention of a few "interesting laters models"  including the 42S, no less!) does not mean that this constantly evolving forum cannot examine and debate other machines we find interesting  including nonHP, such as my beloved (though overwhelming) WP34S, or even TI. I hope you will again come to embrace the diversity of this group and enjoy the wide variety it has to offer.
Best regards...
Re: RPN logic question  Les Koller  03082013 Doesn't matter what the calculator does, PEMDAS is always right. That's the accepted order and one we must all follow,
Re: RPN logic question  Victor Quiros  03122013 Here it is a suggestive article on this issue:
What Is the Answer to That Stupid Math Problem on Facebook?
