Get yourself the HP 49G+ Advanced User's Reference Manual (AUR) in pdf
for download.
Programming in UserRPL can still be very simple:
Having value for height, width and length on the stack, you can use this
program to have the resulting volume on stack level 1:
<< -> H W L << H W L * *>> >>
<< >> being keyed in by [Right Shift] [+]
and
-> by [Right Shift][0]
Have fun!
GeorgeBailey
or just << * * >>
inputting r and getting 2 pi r
<< 2 * pi * ->NUM @ ensure symbolic pi is numeric
>>
pi is [Left-Shift] [SPC]
I seriously question the need for a program in this case ;-)
By the way, you can download the AUR from hpcalc.org at
http://www.hpcalc.org/hp49/docs/misc/hp49gpaur.zip
with many programming examples.
Cheers,
George
Welcome. There are several different ways to accomplish this. In the
programs below, \-> is the RightShift 0 character.
If you want to enter L, H, and W on the stack and have the program
calculate the surface area of a rectangular box, the simplest approach
would be to define a function:
\<< \-> L H W '2*(L*W+L*H+H*W)' \>>
Or coming from a 42s, you might prefer a stack manipulation program:
\<< 3. DUPN * UNROT * + UNROT * + 2 * \>>
If you want the program to prompt the user for input, you could do
something like:
\<<
"Enter Length" "" INPUT STR\->
"Enter Height" "" INPUT STR\->
"Enter Width" "" INPUT STR\->
\-> L H W '2*(L*W+L*H+H*W)'
\>>
And finally if you want a form to fill in with tagged output:
\<<
"Surface Area of Box"
{ "Length:" "Height:" " Width:" }
{ 1. 0. }
{ 1 1 1 }
DUP
INFORM
IF
THEN
OBJ\-> DROP
\-> L H W '2*(L*W+L*H+H*W)'
END
"Area"
\->TAG
\>>
Hope this points you in the right direction.
-wes
EQNLIB (libraries 226 and 227) came with the calculator. For your
problems, use Plane Geometry and Solid Geometry. Enter in the known
values and the tell the calculator which variable to solve for.
Otherwise, read Chapter 21 on the 50g User's Guide (the PDF) for
information about UserRPL programming.
S.C.
<< Pi SWAP 2 ^ * EVAL>> ENTER
AREA STO
(There you store your program into AREA variable)
Then just put R on the stack and press the corresponding softkey to
execute the AREA program.
Another way:
<< -> R 'Pi*R^2' EVAL>> ENTER
ENTER
Again, just put R on the stack and press the corresponding softkey to
execute the AREA program.
> I have a HP 50g calculator, just want to write some simple program,
> like input R, the program calculates the circle area;
> input L, H, W, then the program can calculate the surface area, etc.
All things representable by formulas can be calculated directly
using the numeric solver (just as on the HP42S),
and you can save a set of your own equations,
then choose any one to solve (for any variable,
not just calculating one particular variable from the others);
for example, in RPN mode:
'A=\pi*R^2' 'CIRCA' STO
'A=(L*H+H*W+W*L)*2' 'BOXA' STO
\<< "Choose formula" 9 TVARS 1 CHOOSE
{ STEQ 30 MENU } IFT \>> 'MYEQS' STO
The 'MYEQS' program chooses any formula in the current directory,
then starts the menu-based solver (like that of the HP42S).
You can also just start the form-based numeric solver
(Right-shift NUM.SLV "Solve Equation")
and choose an equation using the form,
rather than using a program.
A slight expansion of the 'MYEQS' program could permit
navigating through a directory tree,
as well as picking equations from a single directory.
Solving equations like this
will store additional variables named in the formulas,
containing numeric data;
when you no longer need to save any such variables,
you can purge them all from the current directory,
plus any left-over "current equation(s)" and solver data using:
\<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO
Numeric values with attached "units" (e.g. 3.2_cm)
may be included in this "clean-up"
by expanding the list of object types to { 0 13 28 }
All of the above works in all HP48G/49G/50G series.
[r->] [OFF]
Greetings,
Calculate area of circle:
area = pi * r^2
On the HP 50:
<<
SQ 3.14159265359 *
"Area" ->TAG
>>
Store the program in a
variable named AREA:
1. Open program delimiters
with rt. shift << >>. Look
above the [+] key.
2. Type in the program.
3. Press [ENTER] to place
program on the stack.
4. Press the [ ' O] key. It
is the key with MTRW EQW
above it.
5. Type in AREA then [ENTER].
6. Press the [STO] key to
store the program.
7. To use the program enter
a number in stack level one
and then press the soft key
below the menu label AREA.
Example:
Input: 1: 5.00
Output: 1: Area:78.54
8. Go to [CONST] in the
MTH menu and then [3.14]
to get pi.
9. Enter 2 FIX to display
two places after the
decimal point.
Note: I'm using an hp 49g+
so if any keys are different
from your hp 50 I apologize
in advance.
Calculate surface area
of rectangular prism:
2*L*W + 2*L*H + 2*W*H
<<
3 DUPN * 2 * @ Face A
5 ROLLD * 2 * @ Face B
4 ROLLD * 2 * @ Face C
+ + "Area" ->TAG @ Area
>>
Note: @ begins a comment and
is not part of the program.
It is for documentation only.
Example:
Input: 3: 22 @ Length
2: 16 @ Width
1: 11 @ Height
Output: 1: Area:1,540.00
Regards,
Mark
Welcome. There are several different ways to accomplish this.
If you want to enter L, H, and W on the stack and have the program
calculate the surface area of a rectangular box, the simplest approach
would be to define a function:
\<< \-> L H W '2*(L*W+L*H+H*W)' \>>
where \<< and \>> are the program brackets, RightShift +, and \-> is
RightShift 0.
Or coming from a 42s, you might prefer a stack manipulation program:
\<< 3. DUPN * UNROT * + UNROT * + 2 * \>>
If you want the program to prompt the user for input, you could do
something like:
\<<
"Enter Length" "" INPUT STR\->
"Enter Height" "" INPUT STR\->
"Enter Width" "" INPUT STR\->
\-> L H W '2*(L*W+L*H+H*W)'
\>>
And finally if you want a form to fill in with tagged output:
\<<
"Surface Area of Box"
{ "Length:" "Height:" " Width:" }
{ 1. 0. }
{ 1 1 1 }
DUP
INFORM
IF
THEN
OBJ\-> DROP
\-> L H W '2*(L*W+L*H+H*W)'
"Area"
\->TAG
END
Try that:
« "SURFACE AREA OF BOX:" DUP
{ ":L:
:H:
:W: " { 1. 5. } V } INPUT
CLLCD 7. FREEZE
SWAP 1. DISP DUP 3. DISP
OBJ-> 3. DUPN * UNROT * + UNROT * + 2. * ":A: " OVER + 7. DISP
»
Cheers,
Reth
what's these ' \ ' slashes in the codes mean ? I cna't find in the 50G
user guide.
example:
\<< "Choose formula" 9 TVARS 1 CHOOSE
{ STEQ 30 MENU } IFT \>> 'MYEQS' STO
\<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO
<kx...@hotmail.com> wrote in message
news:4ab3be02-10f1-42ee...@z6g2000pre.googlegroups.com..
> what's these ' \ ' slashes in the codes mean ? I cna't find in the 50G
> user guide.
> example:
>
> \<< "Choose formula" 9 TVARS 1 CHOOSE
> { STEQ 30 MENU } IFT \>> 'MYEQS' STO
>
> \<< { 0 28 } TVARS { EQ Mpar } + PURGE \>> 'PGEQ' STO
They mark that what follows represents a special character which does
not appear in the ASCII alphabet.
"\<<" and "\>>" represent the symbols which look like "<<" and ">>" on
the hp50, and mark the beginning end ending of a program.
> what's these '\' backslashes [e.g. \<< \>> ] in the codes mean?
> I can't find in the 50G user guide.
To represent 8-bit characters which have no universal symbols,
so as to appear the same to everyone using all text editors, browsers,
newsgroup readers, email, and to the calculator itself
(when using Kermit or other text file transfer software),
as well as being able to type the programs on all computer keyboards.
Complete explanation and chart at:
http://groups.google.com/group/comp.sys.hp48/msg/52e9cc3ee2b369b8
Import/export programs for emulators such as Emu48:
http://groups.google.com/group/comp.sys.hp48/msg/4e7ed90b3cf11c42
[r->] [OFF]
The above also imports and exports
between calculators and plain text files on SD cards
(which in turn may be stored or edited using computers).
[r->] [OFF]
On 50g user's guide page 679:
"Units coefficient" { { "S.I. units" 1}
{ "E.S. units" 1.486} } 1 CHOOSE >> ---> save to 'CHP1'
Running this program, system will highlight choose box 'S.I
Units' (1st choice)
If I select 'S.I. Units' result is s2 1
S1 1
If I select 'E.S. Units' result is s2 1.486
S1 1
I made a small change in this program,
"Units coefficient" { { "S.I. units" 1}
{ "E.S. units" 1.486} } 2 CHOOSE >> ---> save to 'CHP1'
Running this program, system will highlight choose box 'E.S
Units' (2nd choice)
If I select 'S.I. Units' result is s2 1
S1 1
If I select 'E.S. Units' result is s2 1.486
S1 1
It seems to me : the corresponding coefficient of the system unit
selected is put on stack 2 (s2)
But why in the two examples, the stack 1 (s1) always show number '1' ,
this confuse me..???
<kx...@hotmail.com> wrote in message
news:bce72cb4-07b0-41a2...@k36g2000pri.googlegroups.com...
[about what's returned to stack by CHOOSE]
All commands (with their required inputs and results)
are fully explained in the Advanced Users Guide (AUR).
If CHOOSE is canceled, it returns only: 0
If you select a value and OK (or ENTER),
then it returns two things: value 1
The purpose of 1/0 is as a TRUE/FALSE test using IF...
(to act according to whether CHOOSE was canceled or not)
[r->] [OFF]