Thursday, August 6, 2015

HP 41C vs HP 50g Guide (for Starters)

HP 41C vs HP 50g Guide (for Starters)

Generally, HP 41C and HP 50g programming languages are somewhat similar, as long as you operate the HP 50g in RPN mode.  Here are some key differences to keep in mind:

* There are no LBL (label) or GTO (go to) commands with the HP 50g. 

* Subroutines are typically in the beginning of the main program, stored, and are called when necessary.

* Variables start with a letter, can be almost any length, and can contain various types of objects.  Variable names are surrounded by single quotes ( ‘ ‘ ).  Store and recall the contents of the variables like normal.  For the HP 50g, undefined variables are used as CAS (computer algebraic system) algebraic objects.   Erase the variable by typing in the variable as such
variable’,  and execute the PURGE function.

* There is no ASTO/ARCL command.  Strings are designated with double quotes. 

* DSE and ISG are replaced with FOR loops.  In general, a FOR loop for the HP 50g is:

starting_number  ending_number  FOR variable
commands
NEXT

* There are no line numbers in the HP 50g programming language.  For comparisons, and IF-THEN-ELSE-END structure is used.  The ELSE portion is optional.

IF  y  x   (==, ≠, <, > , ≤, ≥)
THEN (do these commands if the test is true)
ELSE (do these commands if the test is false)
END

* Programs begin and end with double arrow symbols.   and .   So do subroutines.

For further information on programming the HP 50g, which was posted in October 2013, please check out the tutorial series, which starts here:



List of Commands that work exactly the same on the HP 41C and HP 50g:

+
CHS
FS?
%
-
CLΣ
FS?C
%CH
*
DEG
GRAD
SCI
/
ENG
HMS+
SF
ABS
FC?
HMS-
SIGN
ACOS
FC?C
MOD
SIN
ASIN
FIX
LOG
TAN

Basic Statistics Functions

The commands MEAN, SDEV, Σ+, Σ-, and CLΣ related to the date matrix ΣDAT.  

Base Conversions

The HP 50g has four base conversion (integer) modes:  OCT (Octal), DEC (Decimal), HEX (Hexadecimal), and BIN (Binary). The 41C only has two:  OCT and DEC.   Base integers are designated with a hashtag and lower case indicator at the end of the integer.  For example:  #827o,   #52d, #A36h, and #1101b.   The indicators are:  o for Octal, d for Decimal, h for Hexadecimal, and b for Binary.

Before converting base types, the number needs to be converted to a real number format using the command B→R.   The change modes.  Convert back to base by using R→B. 

List of commands that have the same functions, but different names:

HP 41C
HP 50g
HP 41C
HP 50g
1/X
INV
FACT
!
10↑X
ALOG
CLD
CLLCD
BEEP/TONE
Frequency (in HZ),
Time (in seconds), BEEP
INT
IP
D-R
D→R
HMS
→HMS
R-D
R→D
HR
HMS→
E↑X
EXP
PI
π
E↑X-1
EXPM
SQRT
LN1+X
LNP1
X↑2
SQ
SIZE*
MEM
Y↑X
^
X<>Y
SWAP
X=Y?
== 
LASTX*
LASTARG
X≠Y?
ST+
STO+
X>Y?
<   (y<x)
ST-
STO-
X<Y?
>  (y>x)
ST*
STO*
X>=Y?
≤   (y≤x)
ST/
STO/
X<=Y?
≥  (y≥x)


* SIZE has a different function for the HP 50g: returning the dimension of a list, matrix, or string.

* LASTARG returns all the arguments last used by a command, not just the last used x-argument. (Level 1).

Note: This should cover most of the basic differences between the HP 41C and HP 50g.   If I am missing something or something needs correction, please let me know in the comments.  Thank you!


Sources:   Hewlett Packard. “Owner’s Handbook and Programming Guide” 1979.  Printed March 1980.

Eddie



This blog is property of Edward Shore – 2015.

No comments:

Post a Comment

HP Prime and Casio fx-CG50: Trapezoid Midsegment, Height, Area

HP Prime and Casio fx-CG50:  Trapezoid Midsegment, Height, Area The program TRAPEZ calculates the following: Midsegment leng...