▼
Posts: 18
Threads: 6
Joined: Aug 2013
I'd appreciate comments on a few things I can't figure out how to do on the Prime that were very easy on the HP48/49:
1) How do I use STO> from within RPN mode?
2) How do I quickly create a function that will take items off the stack as inputs? For example, I'm trying to use DEFINE to accept a,b,c off the stack and output both solutions of a quadratic.
3) In a related question, how do I use stack values from within programs? I know I can use INPUT, but I'd rather use previous results from the stack as inputs.
This is a great calculator, I hope that RPN gets better support in a future release.
Thanks for the help.
▼
Posts: 19
Threads: 5
Joined: Sep 2013
Hi Bruce
see in archive 21 :
HP Prime - RPN stack access from programs?
and for the parms in RPN :
Re: Prime B->R()
Message #4 Posted by Tim Wessman on 20 Sept 2013, 11:50 a.m., Report post,
in response to message #3 by kris223
You specify the argument count inside the paren for commands that accept multiple variants of input. B->R(3) for example. An empty value means the lowest or default number.
TW
Didier.
Posts: 709
Threads: 104
Joined: Nov 2005
Quote:
I'd appreciate comments on a few things I can't figure out how to do on the Prime that were very easy on the HP48/49:
1) How do I use STO> from within RPN mode?
2) How do I quickly create a function that will take items off the stack as inputs? For example, I'm trying to use DEFINE to accept a,b,c off the stack and output both solutions of a quadratic.
3) In a related question, how do I use stack values from within programs? I know I can use INPUT, but I'd rather use previous results from the stack as inputs.
This is a great calculator, I hope that RPN gets better support in a future release.
Thanks for the help.
1. Use the single quote delimeter -- [Shift] [()] -- to specify a variable name. So typing something like:
45 'MYVAR' STO
They key-press for STO is [Shift] [EEX]
2. Either write a program, or create a CAS program. Here's how to make it a program
[Shift][1] to open the program editor, and create a new program (call it QUADSOL)
EXPORT QUADSOL(a,b,c)
BEGIN
LOCAL d;
d:=(b^2-4*a*c)^(1/2);
RETURN({(-b+d)/(2*a), (-b-d)/(2*a)});
END;
Use: QUADSOL(1,2,1) produces {-1,-1}
3. For now, programming is limited to HPPPL (HP Prime Programming Language) aka HP Basic. Hopefully HP will add RPN programming.
▼
Posts: 1,665
Threads: 142
Joined: Jan 2009
Wow. I just got this calculator, and cannot for the life of me figure out how to store a value. I've tried to replicate your example, but it keeps giving me an error. So for now, I can't do much in rpn mode.
Edit. I figured it out. I needed to first define the variable "MYVAR" before I could store anything in it. This wasn't necessary with my HP 50g.
Edited: 10 Oct 2013, 8:50 p.m.
▼
Posts: 1,665
Threads: 142
Joined: Jan 2009
OK, so now I have another problem. I successfully created a real variable "MYVAR" and stored a value in it. Now I wish to un-create this variable, so I enter the CAS screen and type "purge(myvar)" and get the message "No such variable myvar" I also tried with all caps to no avail. what gives ?
▼
Posts: 1,278
Threads: 44
Joined: Jul 2007
Only way to remove variables at the moment is through UI (vars->user->select it [BKSP]). Prime is not meant to replicate a 48 with directory structure, extensive variable usage and so on at the moment. While I suspect it will move in that direction, the ability to organize variables, programs, and so on just really isn't the same right now. Since all variables must exist prior to parse time in the numeric side of the system, removing variables programatically causes all sorts of potential problems.
If your myvar was a CAS variable, then yes it would have worked just fine in the CAS exclusive purge command.
TW
▼
Posts: 1,665
Threads: 142
Joined: Jan 2009
Thanks Tim.
I guess my problem is that I'm used to the HP 48SX and HP 50g, and the Prime is more an extension of the HP 38, which I've never owned. In fact, my progression goes all the way back to the HP 28C and 28S, and all my programming has been in RPL.
BTW, I've already somehow managed to lock this beast up while monkeying around with the spreadsheet, and needed to do a hard reset with a paper clip.
Edit: I tried what you suggested, but it did not purge the variable.
Edited: 11 Oct 2013, 11:08 a.m.
Posts: 1,665
Threads: 142
Joined: Jan 2009
Paging Tim Wessman
Quote:
Only way to remove variables at the moment is through UI (vars->user->select it [BKSP]).
This does not work. All it does is erase the variable name in the command line. It does not purge it. If it is possible to create named variables, then it should also be possible to remove them.
▼
Posts: 1,216
Threads: 75
Joined: Jun 2011
Quote:
Tim Wessman: "Only way to remove variables at the moment is through UI (vars->user->select it [BKSP])."
This does not work. All it does is erase the variable name in the command line. It does not purge it.
It took me also a few trials, but Tim's method DOES work!
The problem is that you MUST NOT select the variable (you want to purge) in this menu with the mouse (in the emulator), because then it gets copied to the commandline and the menu disappears and so of course BKSP doesn't work anymore!
If you open this menu vars->user, then you have to navigate to the variable (which you want to purge) with the CURSOR keys (and just select it but NOT press ENTER or click with the mouse on it), and then press BKSP - this in fact removes/purges the variable.
BTW, for Tim: If you define a variable by varname:=value, then IMO it would be nice if you could remove the variable again by varname:= (i.e. without any value) - this is the usual method in some other CAS and/or math programs.
Franz
Edited: 13 Oct 2013, 4:57 a.m.
▼
Posts: 1,665
Threads: 142
Joined: Jan 2009
Thanks Franz.
The confusion was that since I only had one user variable it was selected as soon as I pushed the user soft button on the touchscreen. So all I needed to do at that point was to push the backspace key. As soon as I did this, the user button disappeared, since I no longer had any user defined variables. When I pushed the variable name on the touchscreen I was actually entering it on the command line as you stated, such that it could no longer be purged.
Posts: 18
Threads: 6
Joined: Aug 2013
Thanks for the response. I've tried the basic program, but now I can't seem to get a key assignment to work. If I write:
KEY K_Neg(A,B,C)
BEGIN
RETURN {((-B+¡î(B©÷-4*A*C))/(2*A)),((-B-¡î(B©÷-4*A*C))/(2*A))};
END;
and then put 3 values on the stack, hit Shift-Help (for 1U) and then the +/- key, it doesn't run the program, just negates the value on level 1 of the stack.
Any ideas?
|