Translations
Example 1 Graph the conic section
and find the
coordinates of the center, foci and vertices.
Recall that the command, completesquare( ) is in the student package. The second argument in this command is used to specify the variable whose square isbeing completed. A square can be completed with respect to more than one variable. In the usual Maple way, variables are grouped together with curly brackets { } when more than one has to appear in the same argument of a command. We add, as a reminder, that the
commands lhs(eqn), and rhs(eqn) represent, respectively, the left hand side, and right hand side of the equation eqn.
> eq:=x^2+4*x+6*y^2-24*y+2=0;
> with(plots):
> implicitplot(eq,x=-8..4,y=-4..8); The plot range was adjusted with some care, by trial and error.
The plot looks almost like a circle when it first appears. Select (click) the plot window (a rectangular border will outline the plot) and
click the [1:1] button
in the Tool Bar to produce a graph with the same scale on the horizontal and vertical axes.
> with(student):
> eq1:=completesquare(eq,{x,y});
> eq2:=lhs(eq1)+26=rhs(eq1)+26;
> eq3:=lhs(eq2)/26=rhs(eq2)/26;
> a:=sqrt(26); b:=sqrt(13/3); c:=sqrt(a^2-b^2);
>
center:=[-2,2]; foci:=[-2+evalf(c),2],[-2-evalf(c),2];
vertices:=[-2+evalf(a),2],[-2-evalf(a),2];
Rotations
The transformation equations
and
give us the relationship between the xy-coordinate system and theXY-coordinate system obtained by rotating the xy-coordinate system through an angle
as shown in the figure where
is the angle from the positive x-axis to the X-axis, where the X-axis is displayed in red, and the Y-axis is displayed in green.
> with(plottools):with(plots):
>
display({line([-5,-1],[5,1],color=red),line([-1,5],[1,-5],color=green)},
view=[-5..5,-5..5],scaling=CONSTRAINED);
A point P in the plane which has coordinates (x,y) in the xy-coordinate system would have coordinates (X,Y) in the rotatedXY-coordinate system. These equations transform
(1)
into an equation of the form
(2)
A rotation is used to transform an equation of the form (1) into an equation of the form (2) where B=0. Then the equation can be identified, and its foci, vertices, etc., can be evaluated. Of course the graph of (1) is readily available without any of this work by using the implicitplot( ) command, but the foci,vertices, etc. can not be computed without an actual rotation. Recall that B=0 if
is chosen to satisfy
(3)
While it is tedious to show this result by hand, it is a pleasant, and interesting Maple exercise. (see Exercise 3 at the end of the chapter)
The so-called discriminant of a second degree equation is unchanged by a rotation, regardless of the angle
. That is to say, under a rotation,
Using this result, one can tell at a glance, whether an equation of the form (1) is an parabola, ellipse, or hyperbola, although one has to allow for certain degenerate possibilities. This result can be very useful, even when Maple's plotting tools are used to graph a second degree equation. Without a hint on where to look, it can sometime be very hard to find the complete graph.
A graph being viewed on a computer screen might be a parabola or half of a hyperbola. How do you know
? Fortunately, it is easy to know the basic type of curve before a plot is attempted.
To show that the discriminant is unchanged by a rotation is a tedious computation to do by hand, but it is another interesting Maple exercise. (See Exercise 2 at the end of the chapter.)
An unusually large number of unassigned letters appear in these two exercises, and manipulating expressions of this sort may be a new experience. Familiar commands like simplify( ) can be useless when so many letters are involved. For this reason, we introduce several new Maple commands for manipulating symbols. They are definitely needed in these two exercises, but they are also of more general interest and worth adding to our vocabulary.
The commands
collect( ), sort( ), and coeff( )
can be used to manipulate polynomial expressions in several
letters. When these commands are used on an expression
expr
, Maple views
expr
as a polynomial in certain specified variables. The command names speak for themselves, but the collect( ) command requires a little more attention. Actually Maple has two ways of collecting terms in a polynomial. Probably the most common way requires that the option
distributed
be inserted as a third argument in this command. This third argument is optional---if it is left out, its default setting leads to a different way of collecting terms. These commands, and options should all be looked up in the Help File.
In the next Maple session, we show by example how these commands can be used. This meandering Maple session has no other purpose.
> restart;
> ex:=(a*x+b*y+c)^2+(d*x+e*y+f)^2;
> ex1:=expand(ex);
> ex2:=collect(ex,{x,y},distributed);
> sort(ex2,[x,y]);
> ex2;
Look at the last two input-output groups. An unusual event has occurred! Can you see it? We will discuss this at the end of this Maple work session.
>
A:=coeff(ex2,x^2);
> B:=coeff(ex3,x*y);
Error, wrong number (or type) of parameters in function coeff
Maple cannot give us the coefficient of the $xy$ term. There are many ways to circumvent this problem. Rather than introduce more Maple commands, simply notice that op(2,ex2) is the second term in ex2. What we want is the first term of op(2,ex2). Consequently, the coefficient of the xy term in ex2, named xycoeff below, can be extracted as follows:
> xycoeff:=op(1,op(2,ex2));
The sort( ) command we used above has an unusual feature
. Notice how it fundamentally changed the structure of ex2. We did not have to reassign the value of ex2. The sort( ) command automatically changed ex2, so that the original form of ex2 was no longer available.
Maple calls such a command
"
destructive
''.
Exampe 2 Graph the conic section defined by the equation
and find the coordinates of its center, foci, and vertices.
This problem can be done in a somewhat more straight forward manner, at least initially, if it is done in a decimal environment. One simply evaluates
as a decimal . The transformation equations, which can then be set up in a straight forward manner, will naturally evaluate, along with all subsequent terms, to decimal expressions.
If a decimal environment is used, the term B, which should be zero, may turn out instead to be small nonzero number attributed to round off error.
This is the price one pays for using decimal approximations.
This small term B should be discarded in this case
.
The approach we use below, and the decimal approach are identical, once the transformation equations are set up. Our point of departure is to evaluate
, and
as algebraic numbers
. This can always be done as long as the coefficients of (1) are integers or rational numbers. You may recall doing problems like the following in trigonometry, or when you learned how to integrate functions involving radicals by using trigonometric substitutions. If r is a given rational number, then an expression, for example, like
, can be easily evaluated as an algebraic number, simply by drawing the appropriate right triangle, and applying the right triangle definitions of the trigonometric functions. Maple cannot evaluate
, and
directly as algebraic numbers, for the angle
defined by formula (3), but it can evaluate
in this manner. This is not surprising, considering the division by 2 in formula (3). We then use the identities
and
to evaluate
, and
as algebraic numbers.
These algebraic numbers may not be simple. If they are too complicated, just disregard this algebraic approach, evaluate
as a decimal, and do the entire problem in the straight forward decimal environment mentioned above. If the algebraic numbers are simple enough, however, it is an
interesting exercise to do the calculations in an
exact Maple environment
.
>
restart;
> eq:=2*x^2-y^2+4*x*y-2*x+3*y=6;
> with(plots):
> ex2;
> implicitplot(eq,x=-10..10,y=-10..10);
The region where this curve is located was easy to find. Imagine what might have happened, however, if the two branches of this hyperbola were far apart. It would be easy to lock in on only one branch of the hyperbola, miss the other branch, and decide that the curve must be a parabola.
To avoid such a mistake, it would be an easy matter to evaluate the discriminant
and decide, in advance, what type of conic section the equation represents
.
> alpha:=arctan(4/(1+2))/2;
> c:=simplify(cos(2*alpha),trig);
>
COS:=sqrt((1+c)/2); SIN:=sqrt((1-c)/2);
These are acceptable names as long as we use capital letter.
>
x:=COS*X-SIN*Y;y:=SIN*X+COS*Y;
> eq;
> ex1:=expand(eq);
> with(student):
> ex2:=completesquare(ex1,{X,Y});
> ex3:=lhs(ex2)-19/12=rhs(ex2)-19/12;
> ex4:=lhs(ex3)/(53/12)=rhs(ex3)/(53/12);
> a:=sqrt(53/36); b:=sqrt(53/24);
> c:=sqrt(a^2+b^2);
>
CENTER:=[sqrt(5)/30,2/sqrt(5)];
> p:=CENTER[1]; q:=CENTER[2];
>
F1:=[p+c,q];F2:=[p-c,q];
> V1:=[p+a,q];V2:=[p-a,q];
To compute the original (unrotated) coordinates of these points, we first set up a function so that we can compute these coordinates with less key board effort .
> coord:=unapply([x,y],X,Y);
> center:=coord(p,q);
> f1:=simplify(coord(F1[1],F1[2]));
> f2:=simplify(coord(F2[1],F2[2]));
> v1:=simplify(coord(V1[1],V1[2]));
> v2:=simplify(coord(V2[1],V2[2]));