HP 50g Examples

Announcements of available shared folders

HP 50g Examples

Postby oliver » Tue Sep 13, 2011 4:44 am

Example RPL programs from chapter 2 ("RPL Programming Examples") of the HP-50g (or HP-49) Advanced User's Reference manual.

These are meant to be studied alongside the text in this manual, which can be downloaded from HP's website.
(Use of this manual is highly recommended. Its chapter 3 ("Full Command and Function Reference") is great (better) reference documentation for ND1.)

ND1 will run only a portion of the examples, and some examples needed adaptations to run.
More example programs will run on ND1 in the future, as compatibility features are added.

The examples themselves are of limited value in daily use, but make for nice study guides for someone who wants to learn RPL.

Here're annotations for the examples that appear in v1.0 of this shared folder.
Unchanged examples appear with their original all-capitals name. Adapted examples appear with a mixed-case name, and any adaptation (often minimal) is described.

FIB2: unchanged; takes an Integer as arg. Runs at greater speed than on the 50g, but note that ND1 has a built-in command fib that computes Fibonacci numbers much faster. There's also a command mobfib which can compute modular Fibonacci numbers for huge input values using modular matrix exponentiation.

fibt: this code is completely changed from the original FIBT, which uses low-level tick-based code to determine run-time. This code requires the Bench folder, and is much simplified over the original code.
With Bench downloaded, note that Bench.RPL is all you have to type to bench any RPL code sitting on level 1 of the stack.

PAD: unchanged; provide it a number as input arg, to see what it does. Note, there's a built-in command pad that's much faster than this and allows you to specify the padding character. You can use the built-in command to pad numbers with leading zeroes, for example.

%TileEx: added for convenience. Contains example data from the manual for the next command.

%TILE: unchanged; runs on the provided example data.

%MedianEx: added for convenience. Contains example data from the manual for the next command.

MEDIAN: unchanged; runs on the provided example data.

MULTI: unchanged. Can be used for intended purpose, but currently lacks the EXCO program from the manual, as ND1 does not yet support the underlying EXPAN and COLCT calls.

applyEx: added for convenience. Contains example data from the manual for the next command.

apply: has 5 small code changes in comparison to the original, in support of ND1's vector-list unification. These are documented in the code. Runs on the provided example data.

nBaseEx: added for convenience. Contains example data from the manual for the next command.

nBase: unchanged; runs on the provided example data.

NAMES: unchanged; helper program for the next program.

vfyEx1: added for convenience. Contains example data from the manual for the next command.

vfyEx2: added for convenience. Contains example data from the manual for the next command.

vfy: tiny change: in one line, tests for type 3 instead of 5, in support of ND1's vector-list unification; runs on the provided example data. Note, ex1 is meant to just leave the input on the stack, ex2 is meant to throw a (user-defined) error.

BerEx: added for convenience. Contains example data from the manual for the next command.

BER: unchanged; runs on the provided example data. Note, the Special Functions shared folder, has implementations for more Bessel functions, that run at far greater speed.

pieEx: added for convenience. Computes the statistics matrix requires for pie from pieData. Makes use of a hidden program defined in the same folder, .indexM, which indexes a given one-column matrix, adding one column. (This makes for a nice example to study by itself, although it's not from the manual. Even though the command is hidden and doesn't appear on a soft-key, you can edit its contents by recalling it by its name '.indexM'.)

pieData: added for convenience. Contains example data from the manual for the next command.

lineChart: added; runs on the provided example data for pie. Invoke this one before invoking pie, to work around an initialization issue with the pie chart function in versions of ND1, prior to v1.4.

pie: completely changed; simply invokes a built-in function unique to ND1; runs on the provided example data. Run lineChart before running this command, in versions of ND1 prior to v1.4.
oliver
Site Admin
 
Posts: 433
Joined: Sat May 01, 2010 2:11 pm

Return to Downloadable Folders / Shared Data

Who is online

Users browsing this forum: No registered users and 2 guests

cron