Services » Archived - EOL (End-Of-Life) HP Calculators » HP 40gs (EOL) » HP 40gs Aplets

# HP 40gs Aplets

In building an aplet for the HP 40gs calculator, it´s important to remember two guiding principles of the HP 40gs design. First, the design recognises that in a classroom setting there is (and should be) a large discrepancy between the amount of information entered into a graphing calculator and the amount of information produced by the calculator. We sought to minimize the calculator input required of the student and the teacher and maximize the returned information. Secondly, we sought to exclude irrelevaht possibilities. By reducing irrelevant choices you focus the user´s attention on the subject of interest and avoid distractions from things that don´t matter. Many choices made during the design of the HP 40GS were based on this goal.

Aplets contain information and have views. The information in an aplet consists of every major piece required to produce the views: the equations, setup information, mode information, sketch or text annotations, and attached libraries or programs. In this article we´ll explore a simple aplet, then look at an aplet called Polysides and examine how it was constructed.

Using Built-in Aplets

When the HP 40GS is first turned on, the built-in aplets are empty. There´s no equation, note, or sketch. When the user adds this information, these aplets come alive. You can save an aplet at any time, so it´s easy to start one project, change in midstream to another, then come back to the first. (Because the appearance of the screens depends on the information you enter, the screens on your calculator may look different from the example screens in this article.

A simple way to illustrate the aplet concept is to explore the equation SIN(X2) / X. Select the function aplet, press SYMB, and enter the equation.

At this point, you have an aplet that´s completely dedicated to your interest in the function SIN(X2) / X, and the aplet can be saved under a unique name or transmitted to another HP 40GS or a computer. When the aplet is restarted on the original or another HP 40GS , aH modes and scales are set just the way they were saved.

Exploring the PolySides Aplet

The PolySides aplet is designed to explore how a regular polygon can approximate a circle as the number of sides increases. PolySides can be loaded from a disk or another HP 40GS in a single operation from the LIB catalog. Once loaded, PolySides appears in the aplet library.

We are now just a single keystroke away from exploying the aplet. To begin the exploration, press START. The motivation for the lesson is displayed first.

After the introduction has been read and a key pressed, the next step is to enter the radius of the circle to be approximated.

After the radius has been entered, the properties of the circle are displayed.

After the circle properties have been viewed, the note view of the aplet is displayed. The PAGE menu key switches between the pages of the note.

To see a sketch of the problem, press SKETCH.

So far we have seen a pretty complete summary of the lesson with less than a dozen keystrokes. Now we can begin to explore how may sides are needed to approximate a circle.

Our central point of departure for Polysides is VIEWS (as mentioned in the note view).

These choices let you determine what aspect of a polygon approximation to a circle you´d like to explore. To explore how the perimeter of the polygon approximates the circle, move the highlight down to Perimeter and press OK. The plottable view is presented automatically.

This is one of the HP 40GS split views, showing the plot and numeric views of the perimeter approximation at the same time. The variable X represents the number of sides, and the equation stored in F2 returns the perimeter as a function of X. Pressing the left or right arrowkey moves the cursors for the plot and numeric views simultaneously. When the cursor is at the left edge of the plot, the table on the right shows the rapid change of the perimeter from a triangle to a nonagon.

To see the equation, just press SYMB.

The symbolic view is where aplet equations are stored. The check mark beside F2 indicates that when a plot or numeric view is displayed, F2 will be used. Another view of the equation is available by pressing SHOW.

Notice that after the introduction there is no three order of events. You can change to any of the views at any time or press HOME at any time to do a short calculation. Part of the design philosophy of aplets is to let the student explore the lesson at will, without following any particular algorithm. Once you´ve explored the approximations to the perimeter and area, and perhaps explored the effect on side lengths, you may decide that a polygon with 57 sides yields a fair approximation to the circumference of a unit circle.

Now you can look at a summary of a 57-sided polygon by selecting Polygon Props (for polygon properties) from the VIEWS choices.

Press OK to select this choice. Since the cursor was last on X = 57, the number of sides defaults to 57.

After the user accepts (or alters) the number of sides, the polygon data is displayed.

Now we´ve observed that a 57-sided polygon does a fair job of approximating a unit circle. More explorations are possible. For instance, if the circle has a very large radius, how many more sides are requited for a polygon to closely approximate the circle´s area?

After the last polygon property screen has been acknowledged with a keystroke, the VIEWS menu is displayed.

This lets you start with another circle or go back to find a different approximation.

Notice that the keystrokes involved for the entire exploration have been oriented to the views. We haven´t entered a single bit of setup or scaling information beyond the radius of the circle being approximated. This is the goal of a well-formed aplet; more attention is directed to the lesson and less attention is directed to the mechanics of the calculator. You can imagine a teacher distributing this aplet in a classroom for part of a day´s lesson.

If you´re familiar with the HP 48G / GX calculators, you´ll notice that variables like EQ and PPAR have never been mentioned, even though we changed the equation and plot scaling parameters several times. Furthermore, we never went near an input form to set the scale manually (although we could have done so by pressing [shift] PLOT to display the plot setup view).

Building the PolySides Aplet

PolySides was constructed using the function aplet and five user programs attached with the SETVIEWS command.

Beginning with a reset function aplet, the equations, note, and sketch were entered directly on the adculator. The equations are:

* Side Length FL(X)=2*RISIN(180 / X)

* Perimeter F2(X)=X*2*R*SIN(IBO / X)

* Area F3(X)=.5*X*R2*SIN(360 / X)

Then five programs were entered, one for each entry in VIEWS. After the programs were entered, they were attached to the aplet with the SETVIEWS command. For convenience during aplet development, a separate program, SetPolyViews, was entered that contains the SETVIEWS command. SETVIEWS allows you to customize the VIEWS key with your own entries and selected enthes from the default VIEWS choices. SETVIEWS takes triplets of arguments. Each triplet contains the prompt that will appear in the VIEWS list, a program name, and a number corresponding to the view that should be displayed after the program is executed. The S ETVI EWS command for PolySides looks like this:

SETVIEWS "Start";".Polyl";8; "Side Lengths,";".Poly2";16; "Perimeter";".Poly3";16; "Area";".Poly4";16; "Polygon Props";".Poly5";7;

When Side Lengths is selected, the program. Poly2 is executed, then view number 16 is displayed. View number 7 is the VIEWS list, view number 8 is the notes view, and view number 16 is the split plot-table view. A SETVIEWS convention is that if a prompt is named Start or Reset, it is associated with the START or RESET menu key in the LIB catalog. The PolySides aplet takes advantage of this feature so that pressing START in the LIB catalog gets a student underway in a single keystroke.

The programs are listed below. (Note that the translation codes used are the same as translate code 3 on the HP 48G / GX.)

.Poly1 (Start)

ERASE: Clear the display DISP 1;"Explore how a regular": Display the DISP 2;"polygon begins to": motivation for DISP 3;"approximate a circle": the aplet DISP 4;"as the number of sides": DISP 5;"increases.": DISP 7;"Press any key...": FREEZE: IF R <=0 THEN 1 |>R END: INPUT R;"SET CIRCLE RADIUS"; Prompt for the " RADIUS:"; circle radius "FIRST ENTER THE CIRCLE RADIUS";R: ERASE: Clear the display 2 |>Digits: Fixed |>Format: Set FIX 2 display mode DISP 1;" Circle Properties": Display the screen title DISP 3;"Radius = " R: Display each property DISP 4;"Circumference = " 2* pi*R: DISP 5;"Area =" pi*R^2: DISP 7;"Press any key...": FREEZE: Wait for a key press Standard ?>format:erase Restore standard displayformat, clear the display

Programs .Poly2 through .Poly4 do similar jobs. Each validates the value for R (the radius), selects the appropriate equations in the symbolic view, calculates the plot scale parameters, and sets the initial values for the numeric view. Note that the plot scale is calculated to fit above the menu. The menu occupies 1 / 8 the display, so an adjustment of 1 / 8 the calculated vertical range is made to the vertical scale.

.Poly2 (Side Lengths)

IF R <=0 THEN 1 |>R END: Ensure a reasonable value for R CHECK 1: Select equation Fl UNCHECK 2: UNCHECK 3: 3 |>Xmin: Set the plot scale 67 |>Xmax: F1(Xmax) |>Ymin: F1(Xmin) |>Ymax: Ymin-.125*(Ymax-Ymin) |>ymin: Fit the plot above the menu 3 |>Numstart: Set the numeric view to begin at 1 and increase in 1 |>NumStep: Steps of 1

.Poly3 (Perimeter)

IF R <=0 THEN 1 |>R END: UNCHECK 1: CHECK 2: Select equation F2 XYNCHECK3 3 | >Xmin: 67 |>Xmax: F2(Xmin) |>Ymin: F2(Xmax) |>Ymax: Ymin-.125*(Ymax-Ymin) |>Ymin: 3 |>NumStart: 1 |>NumStep:

.Poly4 (Area)

IF R <=0 THEN 1 |>R END: UNCHECK 1: UNCHECK 2: CHECK 3: Select equation F3 3 | >Xmin: 67 |>Xmax: F3(xmin) |>ymin: F3(xmax) |>ymax: Ymin-.125*(Ymax-Ymin) |>Ymin: 3 |>NumStart: 1 |>NumStep:

.Poly5 (Polygon Properties)

INPUT X; "NUMBER OF SIDES";"SIDES";"INTER NUMBER OF SIDES";X: Sides prompt ERASE: Clear the display Standard |>format: Set standard format DISP 1;" "X" Sided Polygon": Display the screen title 2 |>Digits: Fixed |>Format: Set FIX 2 format DISP 3,"Approximating circle": Display circle DISP 4;"of radius " R: radius and polygon DISP 5;"Side length= " F1(x): side length

DISP 7;"Press any key...": FREEZE: Wait for a key press ERASE: Clear the display Standard |>format: Set standard format DISP 1;" "X" Sided Polygon": Display the screen

title

Fixed |>Format: Set FIX 2 format DISP 3;"Polygon perimeter=": Display the DISP 4;" " F2(X): perimeter and DISP 5;"Circle circumference=": circumference DISP 6;" "s* pi*R: DISP 7;´Press any key...": FREEZE: Wait for a key press ERASE: Clear the disptay Standard |>Format: Set standard format DISP 1;" "X" Sided Polygon": Display the screen title Fixed |>Format: Set FIX 2 format DISP 3;"Polygon area=": Display the area DISP 4;" " F3(X): DISP 5;"Circle area=": DISP 6;" " pi*R^2: DISP 7;"Press any key...": FREEZE: Wait for a key

press Standard |>Format: ERASE Restore standard

display format,

clear the display

Your own aplets can be as simple as the first example, somewhat more involved (like the PolySides aplet), or very involved, with more complex user programs. Creating a new base aplet that can be downloaded into the HP 40GS requires the use of System RPL programming beyond the built-in user programming language.

Basic Steps. The basic steps for building an Eiplet are:

* Pick an appropriate built-in base aplet-function, polar, parametric, etc.

* In each of the views, enter the information that applies. For instance, you world put your equations in the symbolic view, plot parameters in the plot setup view, and so on.

* Put a sketch of the problem in the sketch view and a description of the problem in the note view.

* For a fancier aplet, use SETVIEWS to attach user programs to the VIEWS key. Remember that it may be handy to have a separate program that stores the SETVIEWS command while you´re developing the aplet.

Flow of Control. In general, the user of the aplet should determine the flow of control, so that a problem can be explored freely. The Polysides aplet provides a little extra guidance by using the program.polyl attached to the start prompt in VIEWS. Polyl displays an initial screen, prompts for the circle radius, displays the circle´s properties, and finally exits to the note view as directed by the SETVIEWS command. hi general, the user should be able to navigate freely among the choices in VIEWS or the various views, or go home and come back. Shared Variables. The global variables A to Z, Zi to Zo, and so on are not stored within an aplet, so if an aplet depends on the value of a global variable it´s a good idea to have the program associated with Start in VIEWS set these values.

Updated On: 06.03.29

1. On 28-Jun-2012, Michaelnalsim wrote:
hello gerry if your still knoking around this is the site
and details,ring them if you need them in a hurry ,tell them myself-nalsimy told you to ring