Under very unusual circumstances, I ended up teaching calculus this summer (1996). My students were not very wealthy and could not be expected to purchase graphing calculators, but the textbook we used expected them to be available. I wrote this applet to be a sort of "super graphing calculator" that could be used by my students in the computer lab we had available. (The lab had version 2.0 Netscape which ran the applet very well.)

To use the applet, you enter a function in the horizontal text window near the top of the screen. When you have entered it correctly, click on "Compile" in the upper right hand corner. This will turn your function into a form that my program can easily compute and plot. (The program converts first into postfix, then into simple quads of the form + 25 57 62 which is interpreted as "add the contents of location 25 to the contents of location 57 and store the result in location 62".)

If you enter a function incorrectly and try to "Compile" it it will say "Bad Function" in the text areal below and to the right of the "Evaluate Function on the X below left" button. This usually happens to me because I enter a function without a capital letter - for example, if I type ln(x) instead of Ln(x). It can also happen because you allow two operators to be together. Thus, e^-x is illegal. You must do e^(-x). The one exception to this is the absolute value operator (a pair of |) which can be entered next to an operator. Thus x*|x| is ok as is Sin|x| without use of parentheses in either case.

The program will accept decimal constants, the operators +-*/^ (^ means exponentiation, which actually works properly for integer exponents - that is, it will compute (-1.2)^3 instead of bombing - as well as working for non-integer exponents), and a large set of functions whose names all start with capital letters. It also includes built-in constants e (for the base of natural logarithms) and p (for pi). The functions are Acos (ArcCosine), Acosh (ArcCosHyperbolic), Asin (ArcSine), Asinh (ArcSinHyperbolic), Atan (ArcTangent), Atanh (ArcTanHyperbolic), Cbrt (Cube Root), Ceil (Ceiling function), Cos (Cosine), Cosh (CosHyperbolic), Cot (CoTangent), Csc (CoSecant), Ln (Natural Logarithm), Log (Log base 10), Sec (Secant), Sin (Sine), Sinh (SineHyperbolic), Sqrt (Square Root), Tan (Tangent), and Tanh (TangentHyperbolic).

The applet allows up to 10 functions (numbered 0-9) to be plotted at once. To do another function, simply click on the function choice selector in the upper left and pick a number between 0 and 9. Then enter a new function, compile it, ... You may choose different colors for the functions and, in addition, you can enter a function defined differently on different intervals by using multiple functions for the different parts of the definition, the same color for each, and setting a different domain for each subpart. (The domain is set about 1/3 of the way down on the left side.) If you decide that you want a particular function not to appear in your plot, you can click on the Active switch and the function will still be there, still compiled, but it will not be plotted.

There are also some special buttons for doing things like evaluating your function at a special value, zooming in and out, moving the plot left or right or up or down, resetting the domain, computing an approximate integral over a range (and highlighting the integral in yellow on the graph), plotting the approximate integral and derivative of the function, drawing interpolating lines, drawing axes, drawing a grid and choosing how many grid lines to draw, starting the plot when you are ready to see it, and drawing approximate tangent lines at an x-value you click on.

You may also edit the four boxes that set the range where the function
will be shown. (The
boxes are at the lower right (x maximum), lower left
(top box y minimum, bottom x minimum), and upper left (y maximum) of the
plotting area.)

I hope you find it useful and, even more, I would love to have all
kinds of feedback - errors and also suggestions of things that you would
add, remove, ... I cannot promise to fix or follow all recommendations,
but I really need to hear from you. I also grant the usual kind of usage
- that is, you may use the program and the source code but you must always
include my name and the original source code as a matter of copyright and
you may not charge for any product directly derived from and using my program
without my express permission. My email address is
lziegler@csbsju.edu

Lynn Ziegler, Department of Computer Science, College of St. Benedict/St. John's University, P.O. Box 3000, Collegeville, MN 56320.

Click here for source code for the main applet (the gui stuff).

Click here for source code for the class which controls the drawing area.

Click
here for source code for the class defining a function along with its
postfix, quads, plotting color, ... .