Author Topic: Why RPN?  (Read 14684 times)

0 Members and 1 Guest are viewing this topic.

Offline supergems

  • LV2 Member (Next: 40)
  • **
  • Posts: 38
  • Rating: +1/-14
    • View Profile
Why RPN?
« on: February 03, 2016, 08:49:31 am »

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Why RPN?
« Reply #1 on: February 03, 2016, 03:15:04 pm »
Wow, that's really weird.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Why RPN
« Reply #2 on: February 03, 2016, 04:32:28 pm »
So TI-OS doesn't follow order of operations the way we'd expect it to. :(
/e

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Why RPN?
« Reply #3 on: February 03, 2016, 04:52:37 pm »
Why? Deviding and multiplying have same level of importance and TIOS goes from left to right rather than right to left.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline supergems

  • LV2 Member (Next: 40)
  • **
  • Posts: 38
  • Rating: +1/-14
    • View Profile
Re: Why RPN?
« Reply #4 on: February 03, 2016, 04:56:37 pm »
You can use the acronym PEMDAS (Parentheses Exponents Multiplication Division Addition Subtraction) to remember order of operations: https://en.wikipedia.org/wiki/Order_of_operations.
For this reason I prefer RPN calculators. ;)

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Why RPN?
« Reply #5 on: February 03, 2016, 04:57:26 pm »
I learned that multiplication+devision are same level, same with addition+subtraction. And if those are combind you just go from left to right, so the TI is actually correct IMO

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Why RPN
« Reply #6 on: February 03, 2016, 05:02:43 pm »
##6/2(1+2) =\ 6/2(3) =\ 6/6 =\ 1##
##\frac{6}{2(1+2)} =\ \frac{6}{2(3)} =\ \frac{6}{6} =\ 1##

This is due to how their division works. It's a fraction, not the ÷ symbol. So its 6 over 2(1+2) not six divided by 2(1+2). The way that TI-OS does it there is wrong according to that.

##6÷2(1+2) =\ 6÷2(3) =\ 3(3) =\ 9##

If we aren't treating it as a fraction then it is correc according to standard order of operations.
« Last Edit: February 04, 2016, 01:54:45 pm by Eeems »
/e

Offline supergems

  • LV2 Member (Next: 40)
  • **
  • Posts: 38
  • Rating: +1/-14
    • View Profile
Re: Why RPN?
« Reply #7 on: February 03, 2016, 05:06:34 pm »
The problem is the interpretation of the arithmetic expression, for PEMDAS the correct order is 6/2(1+2) = 6/2*3 = 6/6 = 1.

Offline Ivoah

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +3/-0
    • View Profile
    • Codinghobbit
Re: Why RPN?
« Reply #8 on: February 03, 2016, 05:10:39 pm »
The problem is the interpretation of the arithmetic expression, for PEMDAS the correct order is 6/2(1+2) = 6/2*3 = 6/6 = 1.

As Sorunome said above, multiplication and division are on the same level and are evaluated left to right, same with addition and subtraction: https://www.mathsisfun.com/operation-order-pemdas.html
http://codinghobbit.no-ip.org
My Calcs:
TI-86 (now broken) $2
TI SR-56 - $0
TI-Nspire CX CAS - $152
TI-84+ Silver Edition - $56
TI-84+ Silver Edition - $0
TI-85 - $0
TI-73 Explorer VS - $10
ViewScreen - $3

Offline supergems

  • LV2 Member (Next: 40)
  • **
  • Posts: 38
  • Rating: +1/-14
    • View Profile
Re: Why RPN?
« Reply #9 on: February 03, 2016, 05:44:41 pm »
No, the interpretation is ambiguous for calculators!

https://en.wikipedia.org/wiki/Order_of_operations
Quote
Exceptions[edit]
There exist differing conventions concerning the unary operator − (usually read "minus"). In written or printed mathematics, the expression −3^2 is interpreted to mean 0 − (3^2) = −9,[1][5] but in some applications and programming languages, notably Microsoft Office Excel (and other spreadsheet applications) and the programming language bc, unary operators have a higher priority than binary operators, that is, the unary minus (negation or +/-) has higher precedence than exponentiation, so in those languages −32 will be interpreted as (−3)^2 = 9.[6] This does not apply to the binary minus operator −; for example while the formulas =-2^2 and =0+-2^2 return 4 in Microsoft Excel, the formula =0-2^2 returns −4. In cases where there is the possibility that the notation might be misinterpreted, a binary minus operation can be enforced by explicitly specifying a leading 0 (as in 0-2^2 instead of just -2^2), or parentheses can be used to clarify the intended meaning.

Similarly, there can be ambiguity in the use of the slash ('/') symbol in expressions such as 1/2x.[7] If one rewrites this expression as 1 ÷ 2 × x and then interprets the division symbol as indicating multiplication by the reciprocal, this becomes:

1 : 2 * x = 1 * (1/2) * x = (1/2)*x.

With this interpretation 1/2x is equal to (1/2)x.[1][8] However, in some of the academic literature, implied multiplication is interpreted as having higher precedence than division, so that 1/2x equals 1/(2x), not (1/2)x. For example, the manuscript submission instructions for the Physical Review journals state that multiplication is of higher precedence than division with a slash,[9] 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.[nb 1] Wolfram Alpha changed in early 2013 to treat implied multiplication the same as explicit multiplication. Formerly, implied multiplication without parentheses was assumed to bind more strongly than explicit multiplication. 2x/2x, 2·x/2·x, and 2(x)/2(x) now all yield x2.[10] Newer Texas Instruments calculators (TI-83 or later) also yield x2 in all three cases.[11]

[10] http://www.wolframalpha.com/input/?i=2x%2F2x,+2*x%2F2*x,+2(x)%2F2(x)+
[11] https://epsstore.ti.com/OA_HTML/csksxvm.jsp?nSetId=103110
« Last Edit: February 03, 2016, 05:58:34 pm by supergems »

Offline TravisE

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 182
  • Rating: +33/-0
    • View Profile
    • ticalc.org
Re: Why RPN?
« Reply #10 on: February 03, 2016, 10:00:24 pm »
I was confused at first trying to figure out where 9 came from; I thought that they were treating 2(3) as some weird sort of implied division, which is something I've never heard of. :P

I do believe there are some differences in interpretation—even math notation isn't perfect. (And it does seem to make sense to me for implied multiplication to have higher precedence, even though that's not usually included in PEMDAS.) In my experience, calculators usually had a list of operations in the printed manual (you know, back in the old days when they actually came with these dead tree things called “books” ;)), which varied from calculator to calculator.

The moral, it seems, is when dealing with subtraction and division, better be safe than sorry and use extra parentheses when in doubt. Or RPN, of course.
6 1 2 + 2 * / → 1
6 2 / 1 2 + * → 9
No ambiguity there!
ticalc.org staff member—http://www.ticalc.org/

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Why RPN?
« Reply #11 on: February 04, 2016, 09:22:37 am »
No, the interpretation is ambiguous for calculators!
It may be ambiguous for calculators, but it certainly is the case that multiplication and division (the same class, just inverse operations) are the same level and are performed in the order in which they are read (left-to-right for much of the world). Following that comes addition and subtraction (again,inverse operations of the same class). It goes:

Parentheses (Includes [], (), and other structural notation, always at the top)
...
Pentation
Tetration
Exponentiation
Multiplication, Division (left to right)
Addition, Subtraction (left to right)

There are other operations higher than exponents, and those would ascend the chain as expected. Multiplication is repeated adding, exponents are repeated multiplication, tetration is repeated exponentiation, pentation is repeated tetration,and the hyperoperations continue up. Subtraction and Division are binary operators that are neither associative nor commutative and aren't really on the list, they are just special inverse operations that many people are familiar with.

Offline martinot

  • LV0 Newcomer (Next: 5)
  • Posts: 2
  • Rating: +0/-0
    • View Profile
Re: Why RPN?
« Reply #12 on: February 24, 2018, 09:47:23 am »
An expression like 1/2x is interpreted as 1/(2x) by TI-82, but as (1/2)x by TI-83.

There can be ambiguity in the use of the slash symbol / in expressions such as 1/2x. If one rewrites this expression as 1 ÷ 2x and then interprets the division symbol as indicating multiplication by the reciprocal, this becomes: 1 ÷ 2 × x = 1 × ½ × x = ½ × x.

With this interpretation 1 ÷ 2x is equal to (1 ÷ 2)x. However, 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 ÷ 2x equals 1 ÷ (2x), not (1 ÷ 2)x.

For example, the manuscript submission instructions for the Physical Review journals state that multiplication is of higher precedence than division with a slash, 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.

For this reason I agree that pure chain mode infix, RPN and text book algebraic entry on calculators/apps are much more defind and clear.

With ”command mode algebraic” entry you never know exactly what you will get.
« Last Edit: February 24, 2018, 11:08:46 am by martinot »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Why RPN?
« Reply #13 on: February 24, 2018, 10:31:47 am »
Being older and wiser than I was in my last response, I maintain that RPN is the clear winner for performance, especially in an interpreted programming language, but infix is better for organization for humans.

Also @martinot, please edit your post instead of double posting.

Offline martinot

  • LV0 Newcomer (Next: 5)
  • Posts: 2
  • Rating: +0/-0
    • View Profile
Re: Why RPN?
« Reply #14 on: February 24, 2018, 11:15:53 am »
Being older and wiser than I was in my last response, I maintain that RPN is the clear winner for performance, especially in an interpreted programming language, but infix is better for organization for humans.

Also @martinot, please edit your post instead of double posting.

I think it depends. Chain logic infix (as in four bangers or old calculators) is not always consequent and easy to use for some calculations.

If you do more advanced, or simpler calculations, it could be easier (and faster) with RPN, but I do agree that it needs to be understood first (not natural for a beginner).

I think that text book algebraic notation is probably the easiset entry for most people who is not accustomed to calculatots, but accustomed to mathematics.

Yes, I merged the comments to the first post, but could not find the ”delete”-button? Hade to empty the second post (or put in a ”.” as empty post was not allowed).