Electronics > Beginners
EE Pros: Is RPN still relevant?
Benta:
--- Quote ---It might be worth a bit of street cred on a new guy's work station down the road.
--- End quote ---
Actually, the street/lab cred comes when you whip out the HP-15C from your breast pocket, turn it on and do the calculation in 5 seconds, then return it to your pocket, while the PFY, nose down in his smartphone, is still searching for the calculator app.
TNorthover:
--- Quote from: orolo on March 04, 2017, 08:40:23 pm ---Taking a tuple is essentially the same as taking a couple of elements from the top of a stack. When one uses infix notation, one is implicitly currying the addition function, which is in fact stretching its algebraic definition.
--- End quote ---
That's a computation-theoretic view of what's going on, and even then it's one particular computational model. By taking the stack as the fundamental object you're baking in RPN or some equivalent. I don't think it's a model used by most mathematicians for their general work.
Infix expressions seem to naturally be some kind of tree structure over operations or formulae or whatever (it'll vary by context); and you could indeed use a stack to combine the components into a final one, but it doesn't seem necessary. Alternatively you could make some kind of tree-traversal your basis; some stack involvement is likely as an implementation detail simply because that's how computers work.
Edit: And maths itself is just logical formulae with no stack in sight, at its basis. ZF set theory and so on.
Benta:
@ orolo and TNorthover:
You're scaring people away from HP RPN calculators. Just sayin' ::)
bson:
RPN really excels when chaining calculations, and in fact promotes thinking like this instead of setting up formal expressions to be evaluated left to right. For example, you want to drive a small LED at 2mA, so you have a simple BJT: 12V supply, a resistor, the LED, and a BJT - and you just want a ballpark figure for Ib so you can size a resistor for it to interface to a 3.3V CMOS output.
So you start with the supply voltage 12V.
Subtract Vce(sat) for the transistor, say 0.25V.
Subtract Vf for the LED. Now you're left with the voltage over R.
Hmm, maybe we should also check the power dissipation of R?
So DUP it on the stack.
Divide the voltage on the stack by R, now we have Ic.
Calculate the power dissipation: dup, over, *, swap; now we have it in Y and Ic in X
Approximate Ie = Ic, and divide by min current gain for the BJT
Now we need the base resistor voltage: 3.3V, subtract 0.65 for Vbe
Divide this by the current in Y: swap, divide
Now we have the base resistor resistance in X, and the current limiting resistor dissipation in Y
As a result of doing this, you will have implicitly sanity checked every single step of the way.
No pen and paper needed to sit and write up expressions to type in on the calculator. In addition to the transcription stage you only get very limited partial results out of algebraic calculators.
bson:
When evaluating formal expressions on an RPN calculator you generally want to work your way from the innermost subexpression and out. This tends to be easier and less error prone than piling up partial values going left to right. Leave that task to compilers. Or get a calculator like the HP-50g HP Prime that has symbolic entry; this lets you enter your expression and check it for correctness before evaluating.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version