
×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center

×InformationFix Windows 10 Update Issues
Resolve Windows 10 related issues for your HP computers or printers by HP Windows 10 Support Center
 HP Community
 >
 Other Products
 >
 Calculators
 >
 HP Prime and RPN function issues
 Mark Topic as New
 Mark Topic as Read
 Float this Topic for Current User
 Bookmark
 Subscribe
 Mute
 Printer Friendly Page
Create an account on the HP Community to personalize your profile and ask a question
HP Prime and RPN function issues
03252018 10:31 AM  last edited on 03252018 05:48 PM by CheronZ
I have following problem: when I have defined a function with the functions app and I want to use it in RPN modus, not the desired X value is used but the value on the first stack level.
For instance: function F1(X)=X
First stack level : 5
F1(1) gives 5 as result and not 1
I find it problematic!
Is that a bug?
Thanks a lot for your answer.
03252018 08:19 PM  edited 03252018 08:27 PM
The problem is happening because you are using algebraic notation in RPN mode. Never do that. In RPN, function arguments are always taken from the stack, and are never put in parentheses after the function (because THAT is algebraic notation).
However, sometimes you have to tell Prime how many arguments to take from the stack. This is done by typing the desired COUNT of arguments (not the arguments themselves) after the function in parentheses. For example, if you want the F1 function to take ONE number off the stack as its argument, then type F1(1). This LOOKS like algebraic notation, but it's not; the "(1)" here doesn't mean "perform F1 on an argument of 1" but rather it means "take 1 number off the stack and perform F1 on it."
In RPN mode, FOO(3) doesn't mean "perform the FOO function on an argument of 3" but rather "perform the FOO function on the bottom 3 levels of the stack." And those 3 levels get "consumed" by the function and removed from the stack, of course.
Functions which always have the same number of arguments don't need to be told how many arguments to take off the stack, e.g. SIN works without needing to type SIN(1). But userdefined functions are unpredictable, so Prime needs you to type F1(1) if F1 has one argument.
Hope that made sense!
Suggestion: If you want to create userdefined functions for use in RPN mode, you can avoid the need to type the number of arguments by using the Define key (Shift xtthetan) instead of the Function app. For example, if you Define 'foo' to be 'X^2+1' then in RPN you can just type foo and it'll take its argument from the stack without you needing to type foo(1).
Disclaimer: I don't work for HP. I'm just another happy HP calculator user.
03262018 09:53 AM
Hi Joe,
Thanks a lot for your quick and good answer. I have understood it. I also tried another way which also works: I can enter 'F1(2)'  ENTER and then EVAL. But you are right, I should be very cautious when using RPN after having entered an algebraic equation.
Kind Regard.
Mathiopie
Didn't find what you were looking for? Ask the community