What is Reverse Polish Notation (AKA Postfix Notation)? Why is it Important?

Поділитися
Вставка
  • Опубліковано 28 лют 2024
  • This is the first in two videos about the Shunting-Yard Algorithm. This famous algorithm converts infix notation math expressions to postfix (or reverse polish notation) expressions. But why would it do that? What is the point? Let's find out.
    ---
    Let Me Explain T-shirt: teespring.com/gary-explains-l...
    Twitter: / garyexplains
    Instagram: / garyexplains
    #garyexplains
  • Наука та технологія

КОМЕНТАРІ • 28

  • @shanehebert396
    @shanehebert396 3 місяці тому +8

    Back when I was in engineering school, HP calculators were the rage. The HP-28C was released but I couldn't afford one then. When the -28S was released, I saved up my money and bought one and was very happy with it... but then the -48SX was released just a couple months after I got the -28S. Luckily for me, HP had a trade-in program so I got the -48SX. It has been a good calculator. It still sits on my desk and I use it occasionally to this day. I remember writing all kinds of programs for it... teachers usually had the stance of "if you can write a program to do it, you probably understand the problem well enough".

  • @bendono
    @bendono 3 місяці тому +4

    When I was in high school in the mid 90s I had a HP48G calculator. It was RPN, which quickly became my preference. I still have it today.

  • @jeraldgooch6438
    @jeraldgooch6438 3 місяці тому +3

    HP introduced the HP35 as the “ electronic slide rule” in about ‘73, while is was studying engineering. With much scrimping and saving I was able to buy on late that year. The RPN was diff at first but very soon became second nature. That device made a huge difference in that I was more able to focus on understanding the material rather than the mechanics of the computations.
    Thanks for the video!

  • @jk-mm5to
    @jk-mm5to 3 місяці тому +3

    Still have my HP 48 and I love Droid 48. Rpl is an easy stack language.

  • @SurfinScientist
    @SurfinScientist 3 місяці тому +3

    That is why HP used to have RPN calculators.

  • @G4GUO
    @G4GUO 3 місяці тому +2

    My first computer was a Wireless World Comp 80 kit which used BURP (Basic Using Reverse Polish).

  • @lv_woodturner3899
    @lv_woodturner3899 3 місяці тому

    I have an HP 32SII which may be almost 30 years old. It is now my the calculator I use in my shop. It took awhile to get used to HP's RPN but once learned, it was easy to use. No parenthesis.
    This was an interesting explanation of RPN. I did not know the terms Infix or Postfix before so a lot to be learnt in this video.

  • @user-dp3vz9tq6e
    @user-dp3vz9tq6e 3 місяці тому +1

    I first came across RPN back in the early 80;s when I had a fig-Forth implementation on my Dragon 32 computer. The 6809 was a great processor for running RPN as it had SSP & USP as well as X & Y index registers...... Happy days

  • @randreas69
    @randreas69 3 місяці тому +2

    Got myself the HP-48 SX at school. The Droid48 app for Androids gets my friends a chuckle, "oh you're on top of things"..

    • @petermainwaringsx
      @petermainwaringsx 3 місяці тому

      I must try that for the nostalga.

    • @randreas69
      @randreas69 3 місяці тому

      @@petermainwaringsx Not only my life my everything, uh I'll add to it the nostalgia. My real machine got overheated by all the example files. I've made two fractals per battery change.

  • @antinatalope
    @antinatalope 3 місяці тому

    Can't program in forth without RPN. And considering forth is one of the three best languages to work in, I'm super grateful for it.

  • @muddyexport5639
    @muddyexport5639 3 місяці тому +1

    Thanks! Fun example.

  • @danielcookeb90
    @danielcookeb90 3 місяці тому

    Hi Gary, very interesting. First time hearing infix and post/polish fix.
    Is there a danger with these systems of someone interpreting these completely wrongly? Or a way of seeing code and knowing its one system and not the other. Clearly no "brackets " is a big giveaway?
    Love your knowledge and desire to up-skill. Thanks for all you do.👍👍

  • @mrhickman53
    @mrhickman53 3 місяці тому

    While I had gotten through college with a slide rule I receive a Sinclair calculator from my younger brother who could not abide by Reverse Polish Notation RPN. However, I was sold immediately. A few years later, when I obtained my first computer with the CPM operating system I purchased an interpreter for SL5, a dialect of Forth, which is a computer language built around RPN. Forth dominated my next 10-15 years of programming. Even today, I use the GNU Galculator in RPN mode. Fossils like me will pass on eventually, leaving the world to the infix crowd.
    The primary drawback of postfix, or RPN, is the software writer must pay attention to the order of the parameters pushed to the stack. A lot of POP, SWAP and ROTATE actions are in one's future if the order of pushing is not carefully considered.

    • @GaryExplains
      @GaryExplains  3 місяці тому

      That is what the shunting yard algorithm deals with very neatly.

  • @johng7rwf419
    @johng7rwf419 3 місяці тому

    Used RPN when I wrote Forth programs for safety systems in the 1980's...

  • @Chalisque
    @Chalisque 3 місяці тому

    In some sense, postfix is how a CPU evaluates things. Consider
    load r1, [100]
    load r2,[200]
    add r3,r1,r2
    so the operation instruction comes _after_ the instructions to fetch the operands.

    • @GaryExplains
      @GaryExplains  3 місяці тому

      With a RISC CPU, yes. That is in fact one of the main features of RISC CPUs.

  • @test40323
    @test40323 3 місяці тому

    CSC101...that brings me down memory lane. :-)

  • @taipo101
    @taipo101 3 місяці тому

    The Sinclair scientific had rpn back in 1978s

  • @petermainwaringsx
    @petermainwaringsx 3 місяці тому

    I'd forgotten about RPN.

  • @byronwatkins2565
    @byronwatkins2565 3 місяці тому

    How about 1 2 3 + * ?

    • @GaryExplains
      @GaryExplains  3 місяці тому

      That would be 2+3, and then 5 * 1, so 5.

    • @GaryExplains
      @GaryExplains  3 місяці тому

      But yes, now looking back (as I am preparing the next video) the way that the shunting yard algorithm would convert 1+2*3 is 1 2 3 * +
      But not 1 2 3 + * as you wrote.

  • @christiantheophanegasore3786
    @christiantheophanegasore3786 2 місяці тому

    HP vs texas instruments calculator in sciences school!😂

  • @tonifasth
    @tonifasth 3 місяці тому

    The answer in your thumbnail is 42...I mean 7. 😂