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 even attached libraries or programs.
Here we'll explore a simple aplet, then an aplet called
PolySides and examine how it was constructed.
A simple way to illustrate the aplet concept is to explore the equation
SIN(X^2)/X. Select the Function aplet, press [SYMB], and enter the
equation:
Fig 1: Equation in Symbolic View
Now press [PLOT] to see the plot using the default plot parameters:
Fig 2: The Plot View
Use the box option under {ZOOM} to look at a smaller area of the plot:
Fig 3: Zoom on a Smaller Area
You can see the plot scale by pressing [shift][PLOT] to see the plot
setup view:
Fig 4: Plot Setup View
At this point, you have an aplet that's completely dedicated to your
interest in the function SIN(X^2)/X, and the aplet can be saved under
a unique name, or transmitted to another HP 38G or computer.
When the aplet is restarted on the original or another HP 38G, all
modes and scales are set just the way they were saved.
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 38G in a single operation
from the [LIB] catalog.
Click here to download the PolySides aplet.
Once loaded, PolySides appears in the
aplet library:
Fig 5: Polysides in Library Catalog
We are now just a single keystroke away from exploring our problem.
To begin the exploration, press {START}, and the motivation for
the lesson is displayed first:
Fig 6: Starting Polysides
After the introduction has been read and a key pressed, the next
step is to enter the radius of the circle to be approximated:
Fig 7: Entering the Radius
After the radius has been entered, the properties of the circle
are displayed:
Fig 8: Circle Properties
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:
Fig 9: Note View Page 1
Fig 10: Note View Page 2
To see a sketch of the problem, press [SKETCH]:
Fig 11: Sketch View
So far we 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):
Fig 12: The Polysides View Menu
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 our circle, move the highlight down
to Perimeter and press {OK}. The split plot/table view is presented
automatically:
Fig 13: Perimeter Approximation
This is one of the HP 38G's split views, showing the plot and
numeric view 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. By pressing
the left or right arrow keys, the cursors for the plot and numeric
view move 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:
Fig 14: Perimeter Approximation
To see the equation, just press [SYMB]:
Fig 15: Equation for Perimeter
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}:
Fig 16: EquationWriter view of Perimeter Equation
Notice that after the introduction there is no fixed order of
events. You can interchange between any of the views at any time
or press [HOME] at any time to do a short calculation. Part of
the design 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:
Fig 17: Numeric View with Cursor at 57
Now you can look at a summary of a 57 sided polygon by selecting
Polygon Props (for Polygon Properties) from the[VIEWS] choices:
Fig 18: Selecting Polygon Properties
Press {OK} to select this choice. Since the cursor was last on
X=57, the number of sides defaults to 57:
Fig 19: Specifying the Number of Sides
After accepting (or altering) the number of sides, the polygon
data is displayed:
Fig 20: Displaying the Side Length
Fig 21: Displaying the Perimeter
Fig 22: Displaying the Area
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 required 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:
Fig 23: The Polysides View Menu
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 48 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 by pressing [shift] [PLOT] to
display the plot setup view).
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 calculator. The equations
are:
The programs are listed below. (Note that the translation codes
used are the same as translate code 3 on the HP 48.)
.Poly1 (Start)
.Poly2 (Side Lengths)
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 download into the HP 38G requires the use of
System RPL programming beyond the built-in user programming language.
Here's the basic steps for building an aplet:
In general, the user of the aplet should determine the flow of
control, so that you can explore a problem freely. The PolySides
aplet provides a little extra guidance by using the program .Poly1
attached to the "Start" prompt in VIEWS. .Poly1
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. In general, the user
should be able to navigate freely amongst the choices in VIEWS
or the various views, or go HOME and back.
The global variables A-Z, Z0-Z1, etc. 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.
Back to James Donnelly's web site.Introduction
When an aplet is being designed, it's important to remember two
very important guiding principles of the HP 38G design:
Using Built-in Aplets
When the HP 38G is first turned on, the built-in aplets look somewhat
"empty", because there's no equation, note, or sketch.
When you add a little bit of information, these aplets come alive.
You can save an aplet at any time, so it's easy to start one
project, change mid-stream to another, then come back to the first.
Exploring the PolySides Aplet
Building the PolySides Aplet
F1(X)=2*R*SIN(180/X) Side length
F2(X)=X*2*R*SIN(180/X) Perimeter
F3(X)=.5*X*R^2*SIN(360/X) Area
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/or selected entries 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 which view should be displayed after the program is executed.
The SETVIEWS command for PolySides looks like this:
SETVIEWS
"Start";".Poly1";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.One trick of SETVIEWS
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.
ERASE: Clear the display
DISP 1;"Explore how a regular": Display the motivation for the aplet
DISP 2;"polygon begins to":
DISP 3;"approximate a circle":
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 circle radius
" 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 STD display format, 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.
IF R\<=0 THEN 1\|>R END: Ensure a reasonable value for R
CHECK 1: Select equation F1
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
1\|>NumStep: and increase in steps of 1
.Poly3 (Perimeter)
IF R\<=0 THEN 1\|>R END:
UNCHECK 1:
CHECK 2: Select equation F2
UNCHECK 3:
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";"ENTER NUMBER OF SIDES";X: Sides prompt
ERASE: Clear the display
Standard\|>Format: Set STD format
DISP 1;" " X " Sided Polygon": Display the screen title
2\|>Digits: Fixed\|>Format: Set FIX 2 format
DISP 3;"Approximating circle": Display circle radius and polygon side length
DISP 4;"of radius " R:
DISP 5;"Side length= " F1(X):
DISP 7;"Press any key
":FREEZE: Wait for a key press
ERASE: Clear the display
Standard\|>Format: Set STD format
DISP 1;" " X " Sided Polygon": Display the screen title
Fixed\|>Format: Set FIX 2 format
DISP 3;"Polygon perimeter=": Display the perimeter & circumference
DISP 4;" " F2(X):
DISP 5;"Circle circumference=":
DISP 6;" " s*\pi*R:
DISP 7;"Press any key
":FREEZE: Wait for a key press
ERASE: Clear the display
Standard\|>Format: Set STD format
DISP 1;" " X " Sided Polygon": Display the screen title
Fixed\|>Format: Set FIX 2 format
DISP 3;"Polygon area=": Display the areas
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 STD display format, clear the display
Building Your Own Aplets
Basic Steps
Flow of Control
Shared Variables
Back to the HP 38G page.
Back to the main calculator page.