Mac OS X Grapher – Getting Started

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):

OpeningScreen

Grapher's opening screen (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:

BlankWorksheet

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:

ExplicitFn

Plot of y = x^2/(1-x)

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:

Zoom

Zoomed-out plot of y = x^2/(1-x) showing second branch

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:

Point Probe showing local maximum around (2,-4)

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:

Plot of x^2/4 + y^2/1 = 1

Plot of x^2/4 + y^2/1 = 1

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.  Plot of r = (theta)^.25Note that that the default range for theta is 0 to 2π.

7.  Built-in Functions

Grapher also has a number of built-in functions:

Plot of r = 1.5cos(4θ)

Plot of r = 1.5cos(4θ)

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.

This entry was posted in Grapher and tagged , , , , . Bookmark the permalink.

26 Responses to Mac OS X Grapher – Getting Started

  1. Pingback: Grapher: a hidden treasure | Truong's Weblog

  2. srinivasan n says:

    Good , can you please explain , to change the font size in axes numbering, changing font colors.
    Further , please explain , about animation>
    tanq

  3. Peter Nolan says:

    Hello,

    When I select Equation>New Point Set I get a simple plot so everything is fine. However when I click on “untitled set” In the left hand pane to rename the data set I cannot do so. I try all combinations of clicks with the mouse but nothing works.

    • theputterer says:

      Sorry, I was unable to duplicate what you’re describing with Grapher v. 2.0 running on Mac OS 10.5.8. Can only suggest trying the usual things:
      – restart grapher
      – restart your computer
      Best of luck.

      • Peter Nolan says:

        Hello Putterer,

        Many thanks for your kind reply. I have an iBook G4 that I bought in 2006 running under Mac OS X 10.4.11 so I only have Grapher 1.0 2005. It’s just possible that this was a problem with that version of Grapher. I will just accept that it is some kind of fault. Otherwise I have no problems getting round Grapher and I am dazzled by the colorful contour plots you display.
        I am hoping to buy a new Mac at some point when I can. Even iWeb on my iBook is out of date and there are many other problems as well because my iBook G4 doesn’t have the new Intel chips. I missed getting an Intel machine by only a few weeks and got saddled with what was then a machine that was just about to become obsolete. I’m running into all kinds of problems now not being able to, say, upgrade Grapher or iWeb on this iBook.
        Again many thanks for your reply and for the great account you have given of Grapher on this web site.

      • theputterer says:

        Thank you for the kind words, and good luck in your hunt for a new machine. 🙂

  4. Bruce says:

    Dear Putterer,
    In Grapher I want to view vectors in 3-D and at a loss how to do so. Example: v=[1;1;0] and w=[0;1;1]. Each vector will start at the origin [0;0;0] and go to either v or w. So arrow from [0;0;0] to point [1;1;0] for vector v. Any suggestions? Also any good resources for Grapher? Is frustrating close to zero documentation!
    Best,
    Bruce

    • theputterer says:

      I was unable to get Grapher to draw a single vector in 3D, although it could easily do a 3D vector field (go figure). However, found a workaround. Plot a line segment using a parametric equation, e.g., for your vector v:
      [x;y;z] = [0;0;0] + [1;1;0]*t, t=0…1
      You can change the color and thickness of this line, but unfortunately cannot add an arrow. However, you can add a dot at the end:
      [x;y;z] = [1;1;0]
      This puts a small marker (sphere or box) on the end of your line segment. If you squint, you can pretend it’s a vector. 🙂

      There’s very few comprehensive resources for Grapher. Other than the Help files and the Example files, I’ve found:
      http://guides.macrumors.com/Grapher
      http://macetprof.free.fr/MacEtProf/Grapher.html
      The latter is very thorough, but unfortunately in French. Lots of pictures and tables, though, so you can still glean some information from it.

      In general, when I want to learn something in Grapher I either putter around with it myself or google and see what comes up.

  5. Ben says:

    Hello putterer, I’m trying to use grapher in some flight dynamics applications. I have one major problem and that is every time I save it and close the window the format changes completely when I re-open it. By format i mean axis scale and origin positions. It takes me just as long to get back to how I wanted it as creating it in the first place. Have you had this problem/solved this problem? I’ve tried attaching my text boxes (about 20) to the ‘real field’ but this made grapher too slow to use.

    Nice work on the site by the way.

  6. Tommy says:

    Hello Putterer,
    I’m trying to make a spiral [r=theta] (in Polar-Coordinates),
    but I don’t know how to give the definition 0<theta<a*π [a∈N].

    Greetings from Germany

  7. Tommy says:

    Hello,
    how can I change the range of Theta (example: 0 < theta < a*pi)?
    -Tommy-

    • theputterer says:

      Hallo, Tommy! Grüße aus den Vereinigten Staaten!
      Your question was too complicated to answer in the Comments, so I made a little mini-post: Mac OS X Grapher – A Quick Note on Changing the Range of Theta in Polar Plots. HTH (hope this helps).

  8. Pierce says:

    How do you graph a limit in grapher? For example, I want to graph a function for which as x approaches some number is 5.

  9. Matthew Rainbow says:

    I am trying to make equation labels to put on my graphs, but do not seem to be able to put any mathematical symbols into text boxes, either from the Equation Palette, or from the Special Characters. Surely there must be some way to make nice equations in a Text box so you can label your graphs. I have also not found any function in Grapher that will automatically label your graphs. Any suggestions here would be greatly appreciated.

    • Matthew Rainbow says:

      Oh my Gosh, I just found by absolute sheer luck a way to answer my own question about creating equation labels for your graphs. Type an equation in the usual way as if you were going to graph it, drag across it to highlight it, and use Command-C to copy it., Then use Object>Insert Rectangle to draw a rectangle on your graph, CLICK on that rectangle to select it. Then hit Command-V to “paste”, and to my astonishment Grapher will suddenly “paste” a perfect copy of the equation in a NEW place on your graph (NOT in the rectangle you made, oddly enough). The resulting equation will have black anchor points around it which you can drag to make the equation smoothly and continuously change its height, width, etc. Works beautifully, but strangest way to do this that I can imagine. Am I missing something systematic here about how Grapher is supposed to work, or was this truly a discovery by sheer luck?

      Also, I found that some of the single characters from Special Characters can be entered into Text Boxes, but other large symbols that would tend to occupy several lines of text cannot.

      • Daniel says:

        I highlighted the input field for the equation, Command-C (copied), then used Object>insert text, then Command-V. You can drag it wherever you like.

  10. Matthew Rainbow says:

    Still another comment from me. The technique only seems to work in 2D view. As a matter of fact, I have just discovered to my new dismay that Grapher does not even enable the Insert Text or Insert Rectangle etc. functions when in 3D. Is that the case? Any way to create text boxes in 3D view

  11. Yves Barois says:

    English and French documentation, including a 83 pages “Instructions for Use – Grapher v. 1.1 to 2.3 “, “Mode d’emploi de Grapher v. 1.1 à 2.3” (15th december 2012 édition) is available for every one on website with a lot of new 2D 3D exemples.
    Use it and enjoy !
    YB24

  12. Tanishq Sharma says:

    howcome it doesn’t work if you type f(x) instead of y???????????

  13. Bradical says:

    Is there a way to do grph a piece of a function in Grapher with something like y=sinx when 1<x<4?

  14. Stephan says:

    I find your tutorials the most exhaustive ones about grapher. Can you explain how we can use the selection equation? I would like to plot: y=5 for all x0 but no matter how I fill the 2 conditional equation, grapher always complains about not parsable input.

    • Stephan says:

      I meant, I’d like to plot: y equals 5 for all x lesser than 0, y equals square(x) for all x less equal than 12 and y equals sin(x) for all x greater than 12.

  15. Peter says:

    Can Grapher graph multiple equations in the same 2D plot, with the different equations/curves in different colors? If so, how?

  16. Seyit says:

    Hey, im about to loosing my mind haha because I just want to plot a rectangle such as rect(t) (which should be the standard rectangle like in wikipedia) But I have absolutely no idea how to do this. Been searching on the internet for a while, still didn’t find anything tho. Can you pleeeeaaase help me? Would be such a good thing….

Leave a reply to Stephan Cancel reply