# A note on graphs

As a followup to my previous post on functions, I’d like to talk about graphs.  More specifically, ways of visualizing functions.  As before, we’ll go by cases, though this time we are somewhat limited by having only two dimensions to depict a function.

Real valued functions of one real variable: These are what we all started with in high school, and unfortunately all most people will ever see (though maybe also some parametric graphs).  When someone says “graph” this is typically what they mean.

This happens to be a graph of the function $f(x) = x^2 + \sin{4x}$, displayed from x = -2 to +2.  To make a graph like this by hand, one would go to x = 0, figure out that f(0) = 0, then put a single dot at the point (0,0).  Then we would move to, say, x = 1, see that f(1) = 1+sin(4), and put another dot there.  We repeat this process ad infinitum, and get a picture.  If we wanted to make this by computer, we ask MATLAB to make a vector with, in this case, 100 elements, looking like

x = (-2.00, -1.95, -1.90, … , 1.85, 1.90, 1.95, 2.00).

Then, since MATLAB enjoys doing arithmetic a vector at a time, we calculate a new vector y = x.^2+sin(4*x), and then plot x and y by typing plot(x,y).  The computer then plots all the points in the vectors, and connects them to create the smoothish line above.

Real valued functions of two real variables: These are the objects of study in multivariable calculus, and I will stop explaining everything so much.  Suffice it to say that we plot the height of a function above the point (x,y), so we can start creating things that look like surfaces:

This guy looks pretty wild (if I do say so myself), but we’re just getting started. For interest’s sake, it is the graph of

$f(x,y) = x^2 + y^2 + \sin(4x) + \sin(4y).$

Notice that neither function we have plotted has had any self intersections, and each has been a proper function.  It passes the “vertical line test”, to borrow a phrase no one uses outside of calc 1.  If we want spheres and donuts, we can’t let the vertical line test stop us.

Parameterizations of a line in the plane: Above, it cost us one dimension for each variable in the domain, and one more for the range, meaning we’ll have to be clever to draw the graph of a real valued function of 3 or more variables.  However, with parametric plots, we will use precisely as many dimensions as are in the range.  First, a parametrization of a line in the plane can be thought of intuitively as telling a line how to sit in the plane.

The above is the graph u(t) = (sin(3t),sin(8t)).  As mentioned, it won’t be possible to realize the above curves as a traditional graph, but I should say that it is easy to realize any traditional graph as a parametric graph.  For example, the graph of y = sin(x) is given parametrically by u(t) = (t,sin(t)).

Functions of one real variable into three space: This is very useful, and gets you used to the idea that we are really just telling a line where to perch.  I’ve animated this graph, rather than using shadows, to give a sense of depth.

The above is the plot u(t) = (cos(t)sin(.2t),sin(t)sin(.2t),cos(.2t)).  I chose this because the curve would sit on the surface of the sphere.  It is late, and the post is long, so I will give just one more example for now.

Functions of two variables into three space:  These are much more general surfaces then we saw earlier.  Again, we can think of the maps as telling the plane how to sit in three space.

The above is a torus, which is generated using the parameterization

$u(s,t) = \cos(s)(2+\cos(t)),\sin(s)(2+\cos(t)),\sin(t)).$

By adding sin(5s) to the z coordinate, you can get the following, rather more complicated looking graph:

Hopefully sometime in the future I’ll talk about more exotic techniques of graphing.