HP Forums
Non-trivial operations in RPN mode - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Non-trivial operations in RPN mode (/thread-3779.html)



Non-trivial operations in RPN mode - Marcio - 05-04-2015 08:09 PM

Hello,

I read the manual but it does not mention it'd be possible for commands to take more than 1 argument from the stack. Does anybody know how to do that? Or is RPN still limited to basic operations like cos(a), sin(b) etc?

Thanks

Marcio


RE: Non-trivial operations in RPN mode - Jonathan Cameron - 05-04-2015 08:13 PM

(05-04-2015 08:09 PM)Marcio Wrote:  I read the manual but it does not mention it'd be possible for commands to take more than 1 argument from the stack. Does anybody know how to do that? Or is RPN limited to basic operations like cos(a), sin(b) etc?

Include the number of arguments as an argument to the command in RPN mode:

1 [ENTER]
2 [ENTER]
cmd(2)

executes the 'cmd' command instructing it to take 2 numbers from the stack.

-Jonathan


RE: Non-trivial operations in RPN mode - Jonathan Cameron - 05-04-2015 08:15 PM

(05-04-2015 08:13 PM)Jonathan Cameron Wrote:  Include the number of arguments as an argument to the command in RPN mode:

1 [ENTER]
2 [ENTER]
cmd(2)

executes the 'cmd' command instructing it to take 2 numbers from the stack.

What I would like to know is how to create programmed functions that take a pre-determined number of parameters that you define in the function definition, so you do not need to tell the function how many arguments are needed.

-Jonathan


RE: Non-trivial operations in RPN mode - Marcio - 05-04-2015 08:23 PM

(05-04-2015 08:13 PM)Jonathan Cameron Wrote:  
(05-04-2015 08:09 PM)Marcio Wrote:  I read the manual but it does not mention it'd be possible for commands to take more than 1 argument from the stack. Does anybody know how to do that? Or is RPN limited to basic operations like cos(a), sin(b) etc?

Include the number of arguments as an argument to the command in RPN mode:

1 [ENTER]
2 [ENTER]
cmd(2)

executes the 'cmd' command instructing it to take 2 numbers from the stack.

-Jonathan

Brilliant! Thanks Jonathan. This way I can kinda 'emulate' the 50g inside the Prime, and at a small price of writing specific programs for the commands I use the most. Luckily, I can group them into a single program.

Very much appreciated. Made my day!

Marcio