Generating Graphing Calculator Graphs

The graphs on my graphing calculator pages were all generated using Mathematica and a package, written by myself, which defines a function called CalculatorPlot. The sole purpose of CalculatorPlot is to generate graphs resembling those of a graphing calculator. Mathematica's built in Plot function uses an adaptive procedure which is much more clever than any graphing calculator.

CalculatorPlot

The approach to graphing a function taken by the average graphing calculator is fairly straightforward. Suppose that you're graphing over the interval [-10,10] and you're screen is 127 pixels wide. Just break the interval up into 127 equal pieces, plug the midpoint of each sub-interval into the function, and plot the corresponding pixel. The collection of pixels plotted may not be connected, so just connect the dots. Mathematica has a much more clever approach, but the above can be easily emulated using ListPlot. If f is a function of x or an expression involving x and you want to use PlotPoints number of pixels to graph f over the interval [x_min,x_max], then just use the following command:
ListPlot[
   Table[
      {N[x],N[f]},{x,x_min,x_max,(x_max-x_min)/(PlotPoints - 1)}
   ],
   PlotJoined->True
]
Of course, a number of formatting options should be set correctly to get the graph to look as close as possible. CalculatorPlot takes care of all that.

Using CalculatorPlot

Feel free to download and use CalculatorPlot. Usage should be straightforward to those familiar with Mathematica. CalculatorPlot accepts all the usual Graphics options and those of ListPlot. There are a few nonstandard options settings however.
CalculatorPlot[f[x], x]
This form will plot f[x] in the standard [-10,10]x[-10,10] viewing rectangle.

CalculatorPlot[f[x], {x, xmin, xmax}, PlotRange->{ymin, ymax}]
The default viewing rectangle can be changed in the usual way

CalculatorPlot[f[x], x, PlotPoints->100]
The PlotPoints option changes the number of points from the default 127

Why circumvent Mathematica's wonderful graphing capabilities?

Good question. The only reason is pedagogical. When I first came to teach at Washington and Lee, I found that many of my students had and used graphing calculators, but I did not have access to a calculator with a projector screen. So I started making overheads to use in class with Mathematica. This worked fairly well, except when I wanted to illustrate how a graphing calculator made mistakes. Mathematica either avoided the mistake, or if it made a mistake, the result still looked different. I wanted to practice my Mathematic programming anyway, so I wrote the CalculatorPlot package.


[UNCA| Math Dept. | Mark's Home] -- [Top | Graphs | Statement] -- [Download CalculatorPlot]