The html and plain ASCII docs were generated from the tex sources (via tth and htmstrip and some "handwork") and aren't as "nice" as the pdf doc. The pdf docs should be preferred :-)

Documentation for PowerPlot with Table

Aaron Wallace 1

November 20, 2001

Abstract

[Version: PowerPlot Light with Table 1.37] PowerPlot is an extremly fast and handy replacement for the built in plotter of the HP48. It's fast and easy to use. To customize and speed up the use the settings can be altered from outside the plotter too :-) PowerPlot should work on the G and S series. It was tested thoroughly on a GX Rev. R and flies on Emu48 too ;-)

Contents

1  Disclaimer
2  Plotting Equations
3  The Main Menu
4  The Options Screen
5  Hotkeys in the Main Menu
6  Commands
7  Table
8  FAQ
    8.1  How are ``userRPL'' equations `translated' in PowerPlot?
    8.2  How does PowerPlot determine which variable to use for finding extrema or POI if I do have multiple variable names?
    8.3  Are there limitations of PowerPlot compared to the built in plotter?
    8.4  Does PowerPlot show discontinuities?
    8.5  Does PowerPlot use any of my user flags?
    8.6  Sometimes the ROOT utility acts strange. It will send me somewhere way off the screen and say ``out of domain''. What's wrong?
    8.7  Why does ISECT no work if tracing a flat line?
    8.8  Why do POI and EXTRM not work for functions with 3rd-party math commands in them such as Erable's J.1?
    8.9  How do I fix the options if they get messed up somehow if they are hidden?
    8.10  What compatibility issues are there with other HP48 programs?
    8.11  How can I setup a custom PPL menu?
9  Newton's method of finding roots
10  Newton's method fails

1  Disclaimer

PowerPlot is freeware for the HP48 Graphing Calculator. It is to be distributed widely and freely. While PowerPlot is completely free to all, I would appreciate it if you would visit my webpage and sign my guestbook. This helps me get a feel for who is using my program and is a good opportunity and mechanism for the users to give me suggestions. The URL for my HP48 software (and a link to the guestbook) is: http://leviathan.orblivion.com/hp48/. The newest version of PowerPlot can always be found at my homepage or at http://www.hpcalc.org.

Please note that this plotter is written in system RPL and Saturn assembly language. As is true with any ml/sysrpl application, this plotter can potentially cause a warmstart or memory loss. I am not responsible for any adverse effects that this plotter can potentially cause. If you encounter any problems, please email me immediately so that someone else does not make the same mistake. I will either fix the bug immediately, or add it to a list of known problems until I get the chance to fix it. The source code for this plotter is available upon request for private use only. If you want the [partly] commented source and development directory or if you find a bug, please email me at awallace@utdallas.edu or ICQ me (18236839).

2  Plotting Equations

Functions can be plotted directly from the stack in two ways. The function(s) can be in a list (multiple functions) or without a list (single function). Here is the stack syntax:

1: 'eq' PLOT

-OR-

1: {'eq1' 'eq2' ... 'eqn'} PLOT

PowerPlot will accept both expressions and equations as valid input. If you enter an equation, it will only graph the right side and will completely ignore the left side.

3  The Main Menu

The main menu includes the following options:

ZOOM
Invokes the ZOOM prompt. Press the DROP key ( < -) to backspace if needed. Negative (-) numbers indicate ZOOM OUT and positive numbers indicate ZOOM IN. Acceptable entries include real numbers (+/-) or simple expressions involving only the following operators (+,-,/,*). You can also use the EEX key for exponent entry and the +/- key for RPN negation. Press ENTER to exit the ZOOM GUI and replot using the new zoom parameters or press ON (CANCEL) to cancel the ZOOM GUI and return to the main menu. Please note that when you zoom in/out, your plot parameters will not change permanantly. This means that all zoom factors are with respect to the original window settings.
TRACE
2 Invokes the trace function. The cursor initializes to the center of the LCD (whatever x coord that is).

LEFT/RIGHT directional arrows
move the cursor one pixel to the left/right.
UP/DOWN directional arrows
are used to scroll through the equations if there are multiple equations.
SPC key
invokes the ``Jump to location'' prompt. You can enter a x-coord and it will ``jump'' to that (x, f(x)) provided that the x-coord given is within the range (xmin £ coord £ xmax). If the x-coord is outside of the range, the f(x) value will be displayed and you will be returned to the ``jump to location'' prompt again. This prompt can be exited by pressing ON (CANCEL) or ENTER which will return to the trace application. One of the useful features included in this tracer is the ability to scroll the viewable window up or down when you trace off the viewable screen. This feature is not unlimited, so there is a ``top'' and ``bottom''.
ENTER key
puts the coordinates of the current point to the stack.
NXT key
invokes the softmenu 3 for ROOT, ISECT, EXTRM, and POI. See details on individual commands below.

ROOT
This root function has been rewritten to be anywhere from 2 to 10 times faster than the built-in ROOT command. For the root finder to work properly, you need to place the cursor near the root you want to find. Since this implementation finding roots is based on Newton's method, it will not be able to accurately find a root that lies at a local extrema. It may also find the incorrect root if the guess is not reasonable.
ISECT
Finds the intersection of two functions. ISECT will find the nearest intersection of the function being traced and the function immediately following it in the list of functions. Uses the ROOT routine so same ``rules'' apply.
EXTRM
Finds the nearest local extrema to the cursor. Be wary, if you are a calculus student, that this routine does NOT check to see if the function's slope changes sign. It only checks to see where d/dx[f(x)]=0. Uses ROOT routine.
POI
Finds the nearest point of inflection to the cursor. Calculus students be warned that this routine does not check to make sure the sign of the concavity changes on either side of the POI. It only checks to see where f¢¢(x) = 0. Uses ROOT routine.
DISMISS
Dismisses the softmenu.
STACK
Returns to the stack, but leaves the plotter HALTed until the CONT(inue) key is pressed. Failure to return to the plotter before ending the current plot can have unpredictable effects. It is strongly advised that you do NOT warmstart the calc or start any other major application while the plotter is suspended.
HELP
Invokes hotkeys listing.
OPTS
This invokes the options screen. When you exit the options screen by pressing ENTER, the equations will be re-graphed automatically. If you exit by pressing ON, the changes you have been made will be canceled and you will be returned to the main menu. Please note that if you have used the ZOOM, the zoom factor will be nullified and you will see the region that you specified in the options screen. See ``The Options Screen'' for more details.
EXIT
When you get tired of plotting or you want to plot something else. ON (CANCEL) can also be used to exit the plotter.

4  The Options Screen

The parameters are stored in the hidden (null) directory so that they do not clutter the HOME dir. Anytime you lose you memory, your plot options will return to the default settings. The following options are available:

XMIN
This is the smallest (left-most) x-coordinate to be plotted. Default is -6.5.
XMAX
This is the largest (right-most) x-coordinate to be plotted. Default is 6.5.
YMIN
This is the smallest (bottom-most) y-coordinate in the visible display. Default is -3.2.
YMAX
This is the largest (top-most) y-coordinate in the visible display. Default is 3.2.
STEP
This specifies the increment. By putting a '1' here, you get ``full precision''. Putting a '2' here will plot at ``half precision'' which means a calculation will be made at every-other pixel. Higher numbers mean faster (but less accurate) graphs. Any integer under 11 is valid.
CONNECT
When checked, the plotted points will be connected with a line.
AUTOZOOM
4 When checked, the plotter uses the built-in autozoom function to select the plot window.

5  Hotkeys in the Main Menu

MTH
Pressing the MTH key at the main menu will re-draw the graph(s) ``on-the-fly'' with the opposite angle mode (deg/rad).
PRG
Pressing the PRG key at the main menu will toggle the CONNECT flag.
CST
Pressing the CST key at the main menu will toggle the AUTOSCALE flag.
UP
Pressing the up directional key at the main menu will display the current domain.
LEFT
Pressing the left directional key at the main menu will shift the domain to the left.
DOWN
Pressing the down directional key at the main menu will shift the domain to the default [-6.5,6.5].
RIGHT
Pressing the right directional key at the main menu will shift the domain to the right.
EVAL
Invokes the table (section 7) of values program from inside PowerPlot.
1, 2, ... 3 number keys
These will set the STEP to 1, 2, ... 3 respectively.

6  Commands

PLOT
Starts plotting the equation(s) on the stack (in a list).
TABLE
Invokes Table program. See the table section 7 for details.
OPTS
Invokes the options screen.
FIXOPTS
If any of the options become corrupted for any reason (or if PowerPlot is behaving strangely) run this to set the options back to default.
- > ASCL
Takes a real number (preferably 1 or 0) off the stack and sets the AUTOSCALE flag accordingly. Anything that is not a '1' is interpreted as a FALSE.
- > CONNECT
Takes a real number (preferably 1 or 0) off the stack and sets the CONNECT flag accordingly. Anything that is not a '1' is interpreted as a FALSE.
- > STEP
Takes a real number off the stack and sets the STEP to that value. The number must be between [1,10] to be valid.
- > YMAX
Takes a real number off the stack and sets the YMAX to that value. The number must be greater than the value of YMIN to be valid.
- > YMIN
Takes a real number off the stack and sets the YMIN to that value. The number must be less than the value of YMAX to be valid.
- > XMAX
Takes a real number off the stack and sets the XMAX to that value. The number must be greater than the value of XMIN to be valid.
- > XMIN
Takes a real number off the stack and sets the XMIN to that value. The number must be less than the value of XMAX to be valid.
HOTKEYS
Displays a list of the hotkeys accessible from inside the plotter.
VERS
Displays the version of PowerPlot that is installed.

7  Table

The Table routine generates a table of values for a function or several functions. The stack syntax is:

3: 'EQUATION'           3: SIN(X)
2: %START           2: 0
1: %STEP           1: .1
-OR-
3: {'EQ1' 'EQ2' ...}           3: {COS(X) SIN(X) TAN(X)}
2: %START           2: 0
1: %STEP          1: .1

UP/DOWN directional arrows
to scroll down and up pagewise by 8 values.
LEFT/RIGHT directional arrows
to move between functions.
ENTER
will push the (x,f(x)) for all currently displayed values in a list to the stack when you exit the Table. They will be tagged with the corresponding function.
1, 2, ... 8 number keys
will push the first, second ... to eigth (x,(f(x)) value to the stack
SPC
brings up a prompt for a X value to jump to.
+/-
brings up a prompt for a new STEP increment.
CST
(I-key) toggles between the real and complex part of the y-value.
MTH
(RADiant key) toggles between RADian and DEGree mode.

Note that all values are calculated with full precision always, but due to the relative small size of the screen only 10 digits are shown for the X-value, while the F(X)-value will be shown to the full precision.

Imaginary number inputs are accepted. When there's a mark * besides the y-value there's a complex part of that value.

You also can use algebraics to specify the STEP width or the JumpTo position. For example 'Pi/3' would be a possible input!

8  FAQ

8.1  How are ``userRPL'' equations `translated' in PowerPlot?

The way the equations are handled by the plotter allows you to include constants in your equations. If a variable is not defined in user memory, it will be treated as the independent variable regardless of name (X, Y, Z, etc.). This means that if neither X or Y are defined, they will be treated as the same (independent) variable.

8.2  How does PowerPlot determine which variable to use for finding extrema or POI if I do have multiple variable names?

PowerPlot will select the first variable it finds in the expression as the variable of differentiation. However, the extrema you see will not correspond to where the function will put the cursor because the drawing routine will treat any variable as the independent variable, whereas the extrema and POI functions will make a distinction between the two. Solution: call the independent variable the same thing (it can be x or y or any global identifier of any number of characters).

8.3  Are there limitations of PowerPlot compared to the built in plotter?

Yes, there are some differences. The built in plotter can handle programs and also can plot equations where units are included. Don't use this type of equations or programs in PowerPlot as you'll get ``arbitrary'' plots which don't make sense.

8.4  Does PowerPlot show discontinuities?

Yes, PowerPlot will display discontinuities. There are some conditions for them to show up, however. A discontinuity will be reflected in the graph if the plotter uses that exact x value as a point to plot. At default window settings, that would be at every .1 from -6.5 to 6.5 (assuming full res).

8.5  Does PowerPlot use any of my user flags?

PowerPlot makes use of one of the user flags. Not to worry, any flags used will be restored to their original setting. However, in the event that the plotter does not exit properly, some flags may be changed. Specifically, the user flag number 1 is utilized when the plotter is running.

8.6  Sometimes the ROOT utility acts strange. It will send me somewhere way off the screen and say ``out of domain''. What's wrong?

The ROOT utility uses an algorithm called ``Newton's Method''. It's not exactly Newton's Method, since I don't take derivatives, but it uses ``non-calculus'' means of finding the slope. There is a detailed explanation (with diagrams!) which was written by myself for why Newton's Method has problems if a good guess is not supplied. You can read the explanations in the appendix .

8.7  Why does ISECT no work if tracing a flat line?

This is because of how Newton's Method works. A non-zero slope is needed to find an intersection point.

8.8  Why do POI and EXTRM not work for functions with 3rd-party math commands in them such as Erable's J.1?

The way you find an extrema or point of inflection is by taking the first and second derivative, respectively. The HP48's built-in symbolic derivative program does not recognise these functions and therefore it will not work.

8.9  How do I fix the options if they get messed up somehow if they are hidden?

There is a program used in the beta that will remain in the official release called ``FIXOPTS'' which will repair any errors in the options which are stored in the null directory. Should these options become corrupted for any reason, run ``FIXOPTS'' to reset all options to the default value.

8.10  What compatibility issues are there with other HP48 programs?

If you use Erable for symbolic math, be wary that Erable will sometimes insert strings containing long integers into an expression which is transparent to the user if a stack replacement is being used. PowerPlot will not accept strings inside an expression and will exit if one is found.

8.11  How can I setup a custom PPL menu?

To speed up the use and to allow to alter the settings of PPL easily outside the program you can add some PPL commands to your CST menu or assign those commands to a key (for further info see chapter 30 in the manual).

As an example for such a custom menu the file PPL_CUST.ASC is attached. Transfer the program with any terminal program via ASCII mode to your HP48 or type it in (refer to the character translation table in your manual). For example you can assign this menu (which this file yields) to the Right-Shifted Plot-key (key 8). To do so you will put the program on the stack and type 63.3 ASN. To assign the command PLOT to the Left-Shifted Plot-key you can type/press the following (soft-)keys: PLOT OBJ- > DROP 63.2 ASN [the command OBJ- > can be accessed via pressing the unshifted keys H (PRG) C (TYPE) A (OBJ- > )].

Alternative you could assign the program and/or the PLOT command to your CST menu. One advantage of the CST/USR idea is the shortcut ``APLOT'' which autoscales the plot range first before the plot is done. This saves the time to plot the graph twice with different ranges, but uses a ``good'' range already.

9  Newton's method of finding roots

Start with f(x) and x=some guess (denoted as k).

obtain slope m from
m = y
x
= f ¢(x)
point slope from
y-f(k)=m ·(x-k)
where x is going to be our new guess a. Then find the x-intercept of tangent line. m ( - k) =-f(k)
-k =-f(k)
=-f(k)+k where a is our new guess. a becomes k, repeat process. a continually gets closer to actual root.

a equals the actual root when f(a) @ 0 - we say ``close enough''.

10  Newton's method fails

Say you have the periodic function y=sin(x).

Let's assume k=[(-p)/2]+.15. By the formula the new guess a = [(-f(k))/m]+k where m=[(y)/(x)]=cos(k). a @ 5.2 but the closest root would have been x=0.

If you follow the procedure, you will likely find the root at x=2 p. Now consider an initial guess of k=[(-p)/2]+.001 ... a = 998.4 (!!!) oops! Newton's method fails.


Footnotes:

1PowerPlot is written and maintained by Aaron Wallace. Thanks to Peter Karp for helping test and debug PowerPlot. Thanks to Chris Wahlen for writing a fast assembly line routine. Thanks to Vasant Ram for supplying me with the necessary hardware for applications development.

2TRACE uses the current notation like STD, FIX, SCI

3The softmenu keys will work without having the softmenu ``up''. For example if you remember which key is used for ROOT, then you don't have to bring up the softmenu to use that function, just press the key (it would be the ``A'' key).

4Checking this will overwrite anything stored in 'EQ' since the built-in autozoom must store the equation. This will also modify/create PPAR and a variable 'X' (or whatever you are using). 'X' will automatically be PURGEd, but 'EQ' and 'PPAR' will not be removed. The AUTOZOOM routine uses the built in AUTOSCALE routines. AUTOZOOM only works with the variable X. It's a good idea to use X exclusively as the independent variable.