Back to Contents!
Next: Dealing with Data... Up: Working with Maple Previous: Linear models

Quadratic and polynomial models


The idea for this week is to provide you with examples of how to use Maple to produce plots and then use the plots to draw conclusions. You will also do some exercises which emphasize how plots relate to equations and vice versa. Throughout the course, you will be asked to interpret your result about a problem by plotting it and then thinking critically about what you've drawn and what it tells you about a real situation. The previous problems were about linear relationships. Linear relationships cover an enormous number of situations, but the world is a complicated place, so straight lines are far from complete in describing things. After linear functions and graphs, quadratic ones are the next simplest. A quadratic expression is one of the form y = ax² + bx + c for some fixed values of a, b, and c. Some examples are y = 3x² - 5, y = x² + x + 1, etc. One of the advantages of a computer-assisted approach to math is that the techniques for handling the more complicated quadratic equations are pretty much the same as for the simple linear ones.

Quadratic functions are especially important in physics problems which involve the motion of a body which undergoes a constant acceleration, as we shall see in the next section. More exotic polynomials arise much less frequently than do linear and quadratic ones, but it is useful to understand the general nature of the graphs of cubics, quartics, and higher-order polynomials. Remember that Maple makes dealing with these higher-order equations as easy as dealing with lines. However, polynomials seem more complicated if we try to "predict" what change to expect in a graphical representation of a polynomial expression. For example, consider the graph of a cubic polynomial below. At first, all the coefficients (the factors that multiply each power of x) are set to zero. Can you predict what the shape will be as the coefficients are changed to non-zero values? The answer is yes, but it takes some thinking to do it. Give it try by using the sliders to change the value of each coefficient. To learn about what we're getting at in this section, you should try to predict what change in the graph will occur for a given change of a coefficient, then try it out to see if your prediction is correct.

Do exercises 1-4, 1-5, and 1-6 to gain experience with quadratics and higher-order polynomials.

Circles and the distance formula

You have been exploring quadratic and other polynomial functions. The graphs of quadratic polynomials are parabolas, which are very important in geometry and physics. Another important family of curves in geometry and physics consists of circles in the plane. What is the equation of a circle? We start by thinking about the geometric definition of a circle. It's round, because every point on the circle is the same distance from the center. So, we can use the formula for the distance between two points (x1,y1) and (x2,y2) that is derived using the Pythagorean theorem:

The equation of a circle should therefore express the fact that each point (x, y) is the same distance from the center. Let's assume for the moment that the center of the circle is at the origin (0,0). From the distance formula above, you can see that the distance of any point (x,y) from the origin is given by so, to make each point of our drawing lie an equal distance from the center, the equation of the circle of radius r centered at the origin should be x2+y2 = r2.

To get a graph of the circle in Maple, for the moment, we have to solve our equation for y, which gives us that either [Maple Math] or [Maple Math] . The graph of the positive square root will give us the top of the circle and the negative one will give us the bottom. We'll plot this for r=2 (so [Maple Math] ):

> plot({sqrt(4-x^2),-sqrt(4-x^2)},x=-2..2,thickness=2);

[Maple Plot]

This comes up elliptical rather than circular because Maple (unless you tell it otherwise) draws graphs in a way that fills up the plot window as much as possible. And since the plot window is wider than it is tall, circles come out looking like elliipses. Another way to see this is to notice that the distance scales on the x and y axes are different. We can fix this by using an "option" to the plot command, as follows:

> plot({sqrt(4-x^2),-sqrt(4-x^2)},x=-2..2,thickness=2,scaling=constrained);

[Maple Plot]

And that looks much better.

We can use Maple's "seq" command to get a whole family of circles with various radii, all centered at the origin, as follows:

> plot({seq(sqrt(r^2-x^2),r=1..8), seq(-sqrt(r^2-x^2),r=1..8)},x=-8..8,thickness=2,scaling=constrained);

[Maple Plot]

With this idea of a sequence of plots, it makes sense to ask if you can show the plots in the sequence one after the other, soa s to "animate" the picture. This can be done, and to do it you need to "read in" the display command as follows:

> with(plots,display);

[Maple Math]

In general, the display command is used to show several plots together in the same picture. In this example, we'll display the sequence of plots together with the option "insequence=true", which is the indication that you want to produce an animated picture. We'll talk about other ways to produce animations later:

> display([seq(plot({sqrt(r^2-x^2),-sqrt(r^2-x^2)}, x=-r..r,thickness=2),r=1..16)],scaling=constrained,insequence=true);

[Maple Plot]

You might also want to draw circles centered at points other than the origin. Using the distance formula, it's not too difficult to show that the equation of the circle of radius r centered at the point (a,b) is [Maple Math] . (You should stop to check that the formula for circles with center at the origin we gave above is a special case of this one). If we solve this for y, we get that the top half and bottom half of the circle are given by: [Maple Math] and [Maple Math] respectively. Here are a couple of examples:

The circle of radius 3 centered at (-2,1) is

> plot({1+sqrt(9-(x+2)^2),1-sqrt(9-(x+2)^2)}, x=-5..2,scaling=constrained,thickness=2);

[Maple Plot]

And, for instance, we can animate a sequence of circles of radius 1 with centers on the line x=y as follows:

> display([seq(plot({p+sqrt(1-(x-p)^2), p-sqrt(1-(x-p)^2)},x=p-1..p+1,thickness=2),p=-8..8)],scaling=constrained, thickness=2,insequence=true);

[Maple Plot]



Next: Dealing with Data... Up: Working with Maple Previous: Linear models


larryg@upenn5.hep.upenn.edu
Fri Mar 4 09:58:36 EST 1994
subsubsection1_1_1_2.html