Left-to-right or from within the innermost parentheses? This brochure contained a simplified version of the flow chart, having the same flaw. It was the last time HP used this flow chart as far as I know , although the algorithm it depicts is perfectly valid in the later RPL calculators with virtually unlimited stack length.
Nowhere is it mentioned explicitly that sometimes wrong answers are given without warning. And conflicting information is given about the number of intermediate results that are preserved on the 4-level stack in various manuals.
In the opinion of the author of this RPN Tutorial this failure by HP to mention the obvious limitation of the 4-level stack and its consequences explicitly has done the acceptance of RPN more harm than good. Purely looking at the workings of the stack of RPN calculators and not at their programming capabilities a few RPN variants can be discerned. Both the bottom and the top of the stack may vary. Bottom of the stack: 1. Classical RPN 2. Entry RPN B. Top of the stack: 1. So Entry RPN is more forgiving, because you cannot do it wrong!
The height of the stack is important to know for all users because a small stack always leaves open the possibility of stack overflow, while in manual operation a very large stack is virtually immune to this error. Items 5. The other difference at the top of the stack that might be important is the presence or absence of top copy on pop , which is only present in small stack models.
In calculators with an very large stack you can somewhat emulate this behaviour by pressing Enter several times to replicate the constant number into the stack. The stack size should be evident from the documentation. But if you don't have that information you could do the following test. In an article in HP Solve 27 p. The use of an unnumbered command line called entry line in the HP Prime while keying in a new number, which allows to edit the number conveniently.
When you press ENTER or a function key the number or the result is placed in stack level 1, and the command line disappears. So the lowest stack level called X in classical RPN alternates between the command line and level 1 of the stack.
In RPL calculators the command line has more advanced uses that are beyond the scope of this tutorial. SWAP is not always available as a primary key function. These calculators have the optional use of an 8-level stack and have classical behaviour of the ENTER key.
The additional stack levels are called A, B, C and D. A very special case are the first RPN calculators produced by HP, the tabletop models of series and They had a 3-level stack and would qualify as Classical RPN according to the first test.
But the RPN was quite different. More on this on the pages of the Museum of HP Calculators. The results of two-number operations went into this same accumulator , but results of one-number functions went into the x keyboard register. Intermediate results were pushed automatically into the z temporary register, but there was no automatic stack drop. Fortunately the contents of all three registers were visible in the display.
With this technique nearly every complicated calculation can be done on a 4-level stack RPN-calculator. In this way you get the order of the numbers right without using x y , so you save one keystroke. These four numbers can either be newly keyed-in numbers, or intermediate results from calculations or any combination thereof, but the total may never exceed four! Keeping these two rules in mind a simple counting technique suffices to recognize calculations that cannot be done using only the 4-level stack.
When you always start calculations from within the innermost set of parentheses such situations will rarely arise. By Hans Klaver Last modified: 18 March First key-in the base number, which is designated by the y in y x. Key-in the exponent , which is designated by the x in y x. Press the y x button to calculate the power. The first number 4 on a 4-level stack is not lost!
Now there are two stack levels free for new numbers. There is no key for e , so calculate e 1. Now we have e — 1. LAST x. LAST x —. CL x It is also possible to swap rows in the stack. First enter 5 and then 10, so that 10 is on the bottom row and 5 is right above it. From that point, press the swap button. On the calculator at alcula. We will do basic arithmetic operations.
To do addition, the order of numbers will not matter because we will end up with the same sum. The 10 and the 5 will disappear from the stack and 15 will be left on the bottom row.
To do subtraction, the order in which we input the numbers does matter. That will give us 5. If we did , we would have To do multiplication, just like with addition, the order does not matter because it does not affect the product. To do division, we must do it in order as well. That will give us 2 on the bottom stack. To do exponential functions, put the base first into the calculator, and then the power to which the base is raised. The base will be in the second row right above the power.
Then press the exponent key. On the HP 48G, this looks like a y raised to the x power. On the calculator from alcula. The bottom row will show Computing the number e to a specific power is also done the same way. For many, learning a new style of entry was a small price to pay to be able to evaluate arbitrary expressions on a calculator. Once the technology to produce algebraic compilers could fit into a pocket calculator, most RPN users had decided that RPN was more efficient and consistent for the user as well as for the calculator.
Also, because subexpressions are evaluated as they are entered, entry errors are more obvious with RPN. On an algebraic calculator, omitting an opening parenthesis, may not lead to a calculation error until much later when an entire subexpression is evaluated. Another advantage to RPN is consistency between machines. Early algebraic models had differing limits of the complexity of the expressions they could evaluate. For example, TI catalogs from the late 70's listed how many levels of parentheses and pending operations each model could handle.
Even today if you begin to use an algebraic calculator, you need to determine just "how algebraic" it really is. If you've recently acquired your first RPN calculator and it didn't come with a manual, this section will get you started. Do you remember how you originally learned to do math? Most of us were taught to write down the numbers we wanted to add and then add them like:. RPN works the same way. Take your new calculator and key in The result of 37 will immediately be displayed.
Try it! This also works for more than two numbers. Note that you didn't press ENTER after the 2nd and 3rd numbers because the operation key makes it clear that you are finished keying these numbers. Many functions require only one number.
On an RPN calculator, you still enter the number and then press the operation key and see the result. Many calculators that claim to be algebraic use the same method since it takes less keystrokes than real algebraic syntax.
For example, to compute the sine of 10 press 1 0 SIN and read the result. To compute e 5 press 5 e x. Just remember that RPN calculators perform mathematical operations immediately when you press the operation keys so the number s must be entered first. There are no "pending operations" or precedence in RPN calculators. You now know how to use your calculator in the most basic way.
0コメント