Successful puttering in mathematics requires some way of visualizing the equations you are playing with. It’s all very well to slap around some equation using just a pencil and paper, but there’s a lot of information to be gained from actually looking at the beast. So a good graphing program is an essential part of the putterer’s toolkit.
Mac OS X users are blessed with a built-in graphing program called Grapher. It’s easy to use, surprisingly powerful, and best of all, free. Its one weakness lies in its documentation – you’ve got to wade through pages of help and sample files in order to figure out what it can and can’t do. For people who are already intimidated by mathematics, this can prove to be an insurmountable obstacle. Therefore I thought my first series of blog entries would be a basic user’s guide to Grapher.
1. Starting Grapher
Go to the Applications folder -> Utilities -> Grapher.app. Start it up, and you will be rewarded with this window (click on image to expand):
At the top is a button allowing you to select 2D versus 3D graphs, and on the left is a list showing what types of “graph paper” are available. You can click on any item in the list, and the right window will show a preview of what that particular graph paper looks like.
Click 2D and Default. When you click Open, you’ll be rewarded with a blank worksheet:
Grapher’s worksheet has three panes: the equation editor on the top, where you will enter your equation; the equation list on the left, which keeps track of the different equations that are being displayed; and the graph area itself.
2. Entering Equations
Entering equations is very intuitive with Grapher – just type them into the equation editor much as you would write them on paper. Division is handled with the “/” key, exponentiation with the “^” key. Multiplication uses the “*” key, although you can often leave it out, e.g., 5x instead of 5*x. Regular order of operations applies.
There are, however, a few quirks to keep in mind. When you have finished typing in an exponent, you have to hit the right arrow key in order to signal to Grapher that the exponent is finished. Otherwise any subsequent typing will be considered as part of the exponent. The same principle applies to denominators – when finished with the denominator, hit the right arrow key to let Grapher know that the rest of the equation is not part of the denominator.
If you type in a parenthesis, Grapher will automatically insert a pair of parentheses, with the expectation that you will start typing your expression in the middle. This is useful for keeping track of nested parentheses, but is sometimes confusing for those of us who are used to entering parentheses one at a time. By the way, Grapher does not recognize square brackets when nesting parentheses – so restrain yourself and just use the rounded ones.
More complicated expressions can be entered with the help of the Equation Palette. This will be covered in subsequent blog posts.
3. Explicit Equations
Explicit equations have the form y = f(x), where the y is all by itself on the left hand side of the “=”, and there is some function of x on the right. For example: y=x^2/(1-x). If you type in that equation and hit enter, Grapher immediately draws a plot and enters the new equation into the equation list:
4. Zoom and Point Probe
You can change the scale of your plot by clicking the Zoom In and Zoom Out buttons in the main menu bar. For example, for this equation we suspect that there is another branch somewhere, so we zoom out to gain perspective:
Sure enough, a second branch of the equation appears. Note that the axes of the plot were automatically adjusted.
To further explore our plot, we can use the Point Probe. Simply click on a portion of the curve that is of interest, and crosshairs will appear, with the x and y coordinates of the crosshairs displayed at the bottom of the screen. Note that the Point Probe always “locks on” to the nearest curve. In this plot, I would like to see where the maximum of the second branch is:
This is very useful for estimating the zeros of functions, or the locations of local minima/maxima.
5. Implicit Equations
Grapher handles implicit equations (i.e., those where the x’s and y’s are mixed together) with equal aplomb. To add a new equation to the existing worksheet, you can go to the menu and choose Equation -> New Equation, or you can hit Command-Option-N. Then type an implicit equation into the equation editor, e.g., x^2/4+y^2/1 = 1. The astute putterer will recognize this as the equation of a 2×1 ellipse, and Grapher confirms:
6. Multiple Equations/Selecting
Note that there are now two equations in the Equation List. If you click on the ellipse equation, it gets selected and the other function is greyed out; if you click on the first equation, it gets selected and the ellipse gets greyed out. If you get tired of looking at a particular equation, you can uncheck the check box to its left, and its graph will temporarily disappear.
6. Polar equations
While Grapher has polar graph paper, you can plot polar equations equally well on the default axes. In fact, you can plot them simultaneously with rectangular equations. Just remember to use “r” and “θ” instead of “y” and “x”, and Grapher will immediately understand that this equation is in polar coordinates. Note that “θ” can be entered by typing in the word “theta”; Grapher will automatically convert it to the theta symbol. Note that that the default range for theta is 0 to 2π.
7. Built-in Functions
Grapher also has a number of built-in functions:
These include trigonometric functions such as sine and cosine, inverse trigonometric functions, hyperbolic functions, e, and ln. Grapher also includes more exotic functions such as the gamma function, erf, and Bessel functions. For an overview of Grapher’s built-in function capabilities, go to the menu under Help -> Show Built-In Definitions.
8. Saving Your Work
You can save the entire worksheet for later use via the File -> Save menu; Grapher will store it in a .gcx file. A second option is to right-click on the graph and select the Copy As option; this lets you copy just the graph part to Mac OS’ clipboard as either a TIFF, PDF, or EPS file (equations will not be included). Ordinarily I prefer to save the whole worksheet, but Copy As can be useful for quickly grabbing a graph and pasting it somewhere (e.g., email or tutoring software) for a student to see.
I hope this introductory tutorial on Grapher – Getting Started was useful. Stay tuned for the next installment: Grapher – Using Parameters.