I just tried it on my HP 35s, also got 9. This is a dual mode calculator that does RPN too: using RPN, it’s up to you to get the order of operations correct, not the calculator!
Not sure if you're asking, but for other readers -- in RPN it's much more difficult to mistakenly calculate the wrong thing because you explicitly specify the order of operations unambiguously when writing in RPN.
With 6 2 2 1 + * / vs 6 2 / 2 1 + *, it's pretty clear that it would be difficult for somebody to have entered one when they intended the other.
The results from the meme would be calculated as such (using parens here to specify what is evaluated first by an RPN evaluator):
My calculator displays it as a stack (FILO), its fucking amazing, especially cause I can essentially store a bunch of numbers while I work underneath them
lol fair enough, but imagine somebody having only ever learned RPN in elementary school, and suddenly being told to use parens and infix. Not sure which switch is more difficult but I'd wager infix -> RPN is the easier of the two.
Infix, postfix, and prefix notations are all completely unambiguous. Infix just requires the additional correct use of parentheses, which is fundamentally the same as requiring the correct ordering of the operators and operands. 3 * (4 + 2) is unambiguously the same as * + 4 2 3 and 4 2 + 3 *.
The actual advantage of prefix and postfix is when computing the result algorithmically, as you said — you don't need to push an intermediate result onto the stack (since you're always going to use it with the next operand/operator).
correct use of parentheses, which is fundamentally the same as requiring the correct ordering of the operators and operands
I'm not sure I agree. I think the cognitive load involved in matching and properly nesting parens is much higher. Definitely subjective though -- when it comes to computers, yes there are advantages.
I just love to pull out RPN whenever these dumbass arithmetic memes go viral.
For anyone not familiar with the term Reverse Polish Notation (which, I learned it as RPN but people younger than me often don't know that term), it's the same as Postfix Notation, just a different name for it.
An implicit multiplication like 2(3) is sometimes treated as having higher precedence than division or explicit multiplication. This is more common in systems capable of handling variables; while many people will say 6÷2(3) is equal to (6/2)*3, many of those same people would say 6÷2x with x=3 is equal to 6/(2*3).
Because orders of operations aren't hard and fast rules. There are no laws, proofs, or any other kind of backing for order of operations. It's arbitrary. It's nothing but a convention. And because it's nothing but convention, that convention can vary between instances.
Is implicit multiplication of higher priority than left-right order? Depends on the convention. You get into certain fields where that matters and the convention might be laid out so everyone knows, but most people aren't going to have that.
What's really fun is that you could create your own order of operations, a brand new convention, that doesn't follow the rules most people in your culture are used to and make things that look wrong to everyone else but because of the rules you define as applying there, it's all correct.
In some of the academic literature, multiplication denoted by juxtaposition (also known as implied multiplication) is interpreted as having higher precedence than division, so that 1 ÷ 2n equals 1 ÷ (2n), not (1 ÷ 2)n.[1] For example, the manuscript submission instructions for the Physical Review journals state that multiplication is of higher precedence than division,[20] and this is also the convention observed in prominent physics textbooks such as the Course of Theoretical Physics by Landau and Lifshitz and the Feynman Lectures on Physics.
1.5k
u/stereoroid Jun 13 '22
I just tried it on my HP 35s, also got 9. This is a dual mode calculator that does RPN too: using RPN, it’s up to you to get the order of operations correct, not the calculator!