Working Within the Parameters

Graphing through the use of parameters

by Jim Mann, Sheldon H.S.

Mathematica 2.1 initializations

Off[General::spell1];
Off[Plot::plnr];
Needs["Graphics`Colors`"];

Note to instructors

Personally, the use of parameters is one of the subjects that I do not emphasize enough.  I know that I expect my students to deal with this subject when they are enrolled in my Physics course, however, parameters are not often covered in my Math courses.  Hence, I intend to use this notebook to help bridge the gap.

Introduction

In most of our previous experiences, we have considered two different types of variables, independent and dependent variables.  For example, when considering y=mx+b, we originally graphed it by putting in values of x (independent variable), and finding values of y (dependent variable).

Another method of graphing is by using a third variable, called a parameter.  We will now make the x and y-coordinates into functions of this third variable (t, for lack of a better choice).

When we use this parameter, t becomes the independent variable.  The functions x = x[t] and	y = y[t] define x and y as being dependent on t.  Different points are located by varying the value of t.

Now that we have the basic idea of what parameters are, let's look at some examples of how graphs we know and love can be put in terms of parameters.

Graphing a Line Using Parameters

While it is easier to simply view the graphing of a line in the way that we have done it previously, we will graph lines using a parameter.  This will enable you to get a better idea of how to change over to functions of this outside variable.

Enabling us to concentrate on the properties of the functions and graphs through the use of Mathematica will first require a definition of the plot function.

Clear[par,x,y,mi,ma]
par[x_,y_,mi_,ma_]:=ParametricPlot[{x,y},{t,mi,ma},
						AspectRatio->Automatic,
						PlotStyle->{Blue,
						Thickness[0.005]},
						AxesOrigin->{0,0}];

Now, just what does this whole mess boil down to????

This is a function for Mathematica which gives it the means which to plot using parametric functions as we will define them.

par[x_,y_,mi_,ma_] this is our plot function, working on four 
																			variables:
																		x_   this is our function x[t]
																		y_   this is our function y[t]
																		mi_  minimum value for t
																		ma_  maximum value for t
	The basics of parameters, and the Mathematica functions are 
	 in place,	so let's look at the graphs of some lines.

Examples of Lines

First, let's look at the graph of y=x from x = -2 to 2.  We want x and y equal to each other, so let's set them equal to the same thing, t.
                    x[t] = t
                    y[t] = t
Therefore, our instruction to Mathematica is:

par[t,t,-2,2];

A valid question would be:  How do we graph a line of slope not equal to 1 using parameters (i.e. y=mx)?

Think carefully before uncovering this answer

If you said that the slope should be in front of the x function, just as in y=mx, well..... that's not correct.  Think about the meaning of a line having slope m.  For each unit that we change "x", there should be a change of m units in "y".  Consequently, we should put the coefficient with y[t].  How about some examples:
               x[t] = t
               y[t] = 2t

par[t,2t,-2,2];

Yep, that gives us a slope of 2, but what if we put the coefficient with x[t].  Think about the answer before you activate the function.

par[2t,t,-2,2];

After looking at this graph, it should be obvious as to why the coefficient is with y[t].  At this point take some time to   graph some other lines.

What about y-intercepts?

After working with y=mx, our next step is to work with y=mx+b.  Again, the question is:  to affect the y-intercept, should we put the value with x[t] or y[t]?

To answer, we need to consider what we want out of a y-intercept in terms of the graph.

The y-intercept is the value of y when x=0, or it is the number of units that we add after finding mx in y=mx+b.  From the parametric point of view, it would be the number of units  that we would add after finding mt, which indicates that the y-intercept should be part of y[t].

Therfore, when we consider both slope and y-intercept, our two functions will look like:
 		             x[t] = t
 		             y[t] = mt + b (m=slope,b=y-intercept)
 Let's look at some examples:
 					   First, y=3x-2, from -3 to 3
 					          x[t] = t
 					          y[t] = 3t - 2

par[t,3t-2,-2,2];

Sure enough, we get a slope of 3, and a y-int of -2.  You should graph some functions of your own, considering combinations of slopes and y-intercepts with both postitive and negative values.

Parabolas

Looking at Parabolas and Parameters

In graphing parabolas using parametric equations, we will again be forced to consider (think about) what we want out of our x and y coordinates.  All of which is working toward graphing any parabola in standard form [(y-k)=4p(x-h)¤ or (x-h)=4p(y-k)¤] using parametric equations.

Let's start with a simple parabola y = x¤.  In building the parametric equations, look at a specific example:  if the x-cooordinate were 2, the y-coordinate would be 2¤ (or 4). Consequently, as functions of t they should look like:
          x[t] = t
          y[t] = t¤

par[t,t^2,-2,2];

What if we wanted to graph x = y¤?

Think before you open this answer

For this graph, we need to reverse the roles of x and y.  Therefore, we need to exchange the functions to get the desired parabola:
          x[t] = t¤
          y[t] = t

par[t^2,t,-2,2];

Again, by carefully considering our parametric equations, we were able to obtain the correct graph.

Making changes in the Parabola

Once we have these two "basic" parabolic equations, we can make three types of changes to the graph:  1) change the coordinates of the vertex (h,k), 2) change the width of the parabola (adjust 4p), and 3) change the direction by multiplying by -1.

Changing the vertex

In the parabolas that were previously graphed in this  section, we located the vertex at (0,0).  Now, we want to change the values of h and k to "move" the vertex.
     Let's take the example y=(x-1)¤:  Remember that t¤ should be in y[t].  The remaining important question would be:  which function should the 1 be with?  How do we structure the parametric functions to make this so?

Answer and graph 1

The equations should be set up as:

x[t] = t+1
	       y[t] = t¤

One rationale would be to consider that when y[t]=0  (hence, t=0), we want x[t]=1 (t+1).

Let's see if it works:

par[t+1,t^2,-2,2];

Great!!  Now, how would we get the graph of the parabola with the equation (x+3)=(y-2)¤.  Experiment with different functions for x[t] and y[t] to graph it correctly.

Answer and graph 2

If we learned a lesson from Problem 1, it should have been that we put the value of h with x[t], and the value k with y[t].     The trick here is that we need to square t before subtracting 3.  (Also, remember this parabola is in the form x=y¤).
        x[t] = t¤-3
        y[t] = t+2

par[(t)^2-3,t+2,-3,3];

Changing the width of the Parabola

In the standard equation of a parabola, the width of the parabola is determined by the value of 4p.  By adjusting this value, we can make the parabola wider or narrower.  Once again, the challenge is to change the functions x[t] and y[t].

What would be the parametric functions that would correspond to the parabola y=2x¤?

Answer and graph

This parabola is narrow, in that we want the value of y to increase twice as much as it would in y=x¤.  Therefore, our functions should look as such:
               x[t] = t
               y[t] = 2t¤

par[t,2t^2,-2,2];

Multiplying y by a coefficient (greater than 1) gives us a "narrow" parabola.  What should we do to get a "wide" parabola?

Answer and graph 2

There are two approches we could take to accomplish this goal.  One, would be to multiply x by a coefficient greater that one.  The other, would be to multiply y by a coefficient less   than one.  Either will work efficetively.  Here is an example done by the first method.  Experiment on your own using both  methods.

par[2t,t^2,2,-2];

Changing the direction of the parabola

Thus far, we have only worked with parabolas that open in the positive direction.  In terms of our parametric funcitons, how would we make changes to get a parabola that opens in the negative direction.

The question is whether to put the negative with the  squared function.  The answer is yes, because we want to square the value first, then multiply by the negative.  Consequently, the parabola x=-y¤ would be:
               x[t] = -t¤
               y[t] = t

par[-t^2,t,-2,2];

The same idea would work when attempting to get a parabola that opens down.

par[t,-t^2,-2,2];

Putting it all together

For our final parabolic trick, we will now put together all three of the changes we have discussed into one graph.  Let's graph (y-2)=-3(x+3)¤.  The parametric funcitons will be:
          x[t] = t - 3
          y[t] = -t¤ + 2

par[t-3,-3t^2+2,-1,1];

This gives us the desired direction, width, and vertex location.  You should now experiment on your own to see if you can create the appropriate functions to graph what you desire.

Circles

One of the more familiar uses of parameters you may have previously seen, is the graphing of circles.  The standard form of the equation of a circle is (x-h)¤+(y-k)¤=r¤, where (h,k) is the coordinates of the center of the circle.  In terms of parameters, we can look at a circle in this manner:
               x[t] = Cos[t]
               y[t] = Sin[t], t= [0, 2 Pi]

par[Cos[t],Sin[t],0,2 Pi];

Changes in the graph of a circle

We will consider two types of changes in the graph of a circle.  First, are changes in the radius of a circle.  Second, are changes in the location of the center.

Changing the radius

As before, we need to decide what needs to be done in order to change the radius of the circle.  We know that at t=0, the value of Cos[t] is 1, and the value of Sin[t] is 0.  Consequently, at t=0 we have the point (1,0).  Let's say we  want a radius of 3, can we get a value of Cos[t] that is 3?

Answer

Get real!  We know that Cosine has a range of [-1,1].  The way to get a radius of 3 is to first take the trig function, then multiply by 3:
               x[t] = 3 Cos[t]
               y[t] = 3 Sin[t]

par[3 Cos[t],3 Sin[t],0,2 Pi];

Work with other circles on your own.  (Question:  what would happen if you put negative coefficients with the Sin and Cos functions?)

Changing the center of the circle

If you remember how to move the vertex of a parabola, changing the center of a circle should be a piece of cake.  Use  the same line of reasoning.  Think about what you want to do to the Cos or Sin function to change the coordinates.  With this in mind, write the parametric functions for a circle of radius 1 with its center at (1,-2).

Answer

In standard form, this would look like (x-1)¤+(y+2)¤=1.  The parametric functions would be:
               x[t] = Cos[t] + 1
               y[t] = Sin[t] - 2

par[Cos[t]+1,Sin[t]-2,0,2 Pi];

Choose some values for the radius, and coordinates for the center.  After doing this, create the parametric funcitons for these values.  Adjust the functions until you get the graph to match these values.

Ellipses

After developing the parametric functions for a circle, it becomes an easy step to create the graph of an ellipse.  To do this, we need only to have a different coefficient with each of the trig functions.  An example is:
               x[t] = 2 Cos[t]
               y[t] = 3 Sin[t]

par[2 Cos[t], 3 Sin[t],0,2 Pi];

This gives us an ellipse with major axis = 6 (3 X 2),and minor axis = 4 (2 X 2).  Play with the fucntions, changing the coefficients to get ellipses with different shapes.  The only qualification is that the two coefficients must be different.  What would happen if the two coefficients were the same?

Moving the center of the ellipse

In changing the coordinates of the center of the ellipse, we can again use the example of the circle.  Therefore, how would define the parametric functions for an ellipse whose center is at (1,2), major axis = 4, and minor axis = 2?

Answer

The functions should be defined as:
               x[t] = Cos[t] + 1
               y[t] = 2 Cos[t] + 2

par[Cos[t]+1,2 Sin[t]+2,0,2 Pi];

The question of another solution to this problem may arise.  The answer is that there is another solution to this problem because it was not specified whether the major axis should be parllel to the x-axis or the y-axis.
     Again, using different centers, and different measures for  the major and minor axes, see if you can make the ellipse into any dimensions you choose.

Converting funcitons from polar coordinates to parameters

Any function that is written for polar coordinates can be converted to rectangular coordinates (hence, parametric functions) using the following:
               x[t] = r Cos[t]
               y[t] = r Sin[t]

The cardioid

One example of a cardioid is given by r=1+Sin[t].  We can define this function, and use the information from above to complete our parametric functions.

r=1+Sin[t];

par[r Cos[t],r Sin[t],0,2 Pi];

This looks like an upside-down heart.  What would you need to do to make the "heart" look correct.

Roses

Roses are created when there is a polar equation where r=Cos[qt] or Sin[qt].  The number of leaves in the rose is determined by the value of q.  After running the two examples below, experiment with several of your own (all you need to do is change the value of q).  Then see if you can find the relationship between q and the number of leaves.

3-leaved rose

par[Cos[t] Sin[3t],Sin[t] Sin[3t],0,2 Pi];

4-leaved rose

par[Cos[t] Sin[2t],Sin[t] Sin[2t],0,2 Pi];