Mini Project -2
Ellipses

by Shirley Treadway

Introduction

One of the more important conic sections is called an ellipse. If it is located on the coordinate axes so that the center is at the origin it has a very nice equation, (x¤/a¤) + (y¤/b¤) = 1 or (x¤/b¤) + (y¤/a¤)= 1. There is a special relationship between a and b and another variable usually referred to as c, that is that a¤= b¤ + c¤.  There are two points on the x-axis that have coordinates (c,0) and (-c,0) or in the second case on the y-axis with coordinates (0,c) and (0,-c). We would like to investigate the relationship between the distances from any point on the ellipse, which we will refer to as P, and the two points, (c,0) and (-c,0) or (0,c) and (0,-c). As we construct our first ellipse, you'll will notice the what points have  "a" and have "b" as a part of their respective coordinates.

Investigate Ellipse (major axis--- x-axis)

** Activate the code below until you get to the first questions.

Needs["Graphics`Colors`"]

dist[{x1_,y1_},{x2_,y2_}] =
Sqrt[(x2 - x1)^2 + (y2 - y1)^2];
midpoint[{x1_,y1_},{x2_,y2_}] = 
{(x2+x1)/2,(y2+y1)/2};

Clear[x,y,t]
a= 4;
b = 2;
x[t_]= a Cos[t];
y[t_] = b Sin[t];
ellipse=ParametricPlot[{x[t],y[t]},{t,0,2 Pi},
                   PlotStyle->{{Thickness[0.005]}},
                    AspectRatio->Automatic,
                    PlotRange->{{-a-2,a+2},{-b-2,b+2}}];

{c1,c2} = c/.Solve[a^2 == b^2 + c^2,c]

Clear[c1plot,c2plot,c1label,c2label,c1val,c2val]

c1plot[t_]  := Graphics[{RGBColor[1,0,0],Line[{{c1,0},{x[t],y[t]}}]}]
c2plot[t_]  := Graphics[{Blue,Line[{{c2,0},{x[t],y[t]}}]}]
c1label[t_] := Graphics[Text["c1",
                        {c1,-.2}]]
c2label[t_] := Graphics[Text["c2",
                        {c2,-.2}]]

c1val[t_]   := Graphics[
               Text["= d(f1,p)" N[dist[{c1,0},{x[t],y[t]}]],
                    {- 3a/4,b + 3/4}]];
c2val[t_]   := Graphics[
               Text["= d(f2,p)"
                    N[dist[{c2,0},{x[t],y[t]}]],
                    {3a/4,b+3/4}]];
                    
ctotal[t_]   := Graphics[
                Text["= d(f1,p) + d(f2,p)" N[dist[{c2,0},{x[t],y[t]}] + 
                  dist[{c1,0},{x[t],y[t]}]],
                     {a/2,-b-1/2}]]

ppoint[t_] := Graphics[
                        {Maroon,PointSize[.02],Point[{x[t],y[t]}]}
                      ]
ppointlabel[t_] :=
              Graphics[
                        Text["p",{x[t]+.2,y[t]+.2}]
                      ]

plotall[t_] :=

Show[ellipse,c1plot[t],c2plot[t],
     c1label[t],c2label[t],c1val[t],c2val[t],
     ctotal[t],ppoint[t],ppointlabel[t],
     PlotRange->{{-a-5,a+5},{-b-5,b+5}}];

plotall[0];

plotall[Pi/4];

l. We have prepared a graph of an ellipse with values for a and for b that we have chosen. For the first program we let a= 4 and b = 2. What points on the graph have values related to these two?
 2.  We have used the formula for the distance between two points to determine the distance between  P and (c1,o) and P and (c2,0). The program we have written with Mathematica will give these distances and their sum in each case as the point moves around the ellipse. Please activate the "Table" command(below this text--it will move point P around  the ellipse) and scroll through each graph to investigate the values of  the distance from P to (c1,0) and the distance from P to (c2,0) as P changes location from `/2 to 2 ` in increments of `/4. In each case, please give the value of the sum of the two distances on your Investigation Sheet. 
 3. Does this number have any similarity to any other given value?

Table[plotall[theta],{theta,0,2Pi,Pi/4}];

4. Now let's look to see if this is just a special case or if this observation is true for all ellipses. So that our graphs are manageable let me suggest that you go back to the beginning and 
let a =5 and b = 3é3.

5. Repeat the activations from above for these values of a and record these values on the Investigation Sheet. Be sure to also use the "Table" command too. 

6. What similarity do you see this time? Is it the same as last?

7. If you wish try again with new values of a and b go ahead-- but be sure to make a larger than b.

Investigate  Ellipse  (major axis---y-axis)

l. Now let's look at another ellipse. Notice that this time we have changed our code to say that x(t)= b Cos[t] and y(t)= a Sin[t]. Activate all of the commands below down through the "ellipse" command.
How is this ellipse different than the ones above?
2. What points have special relationships with the values of a and b?

dist[{x1_,y1_},{x2_,y2_}] =
Sqrt[(x2 - x1)^2 + (y2 - y1)^2];
midpoint[{x1_,y1_},{x2_,y2_}] = 
{(x2+x1)/2,(y2+y1)/2};

Clear[x,y,t]
a= 4;
b = 2;
x[t_]= b Cos[t];
y[t_] = a Sin[t];
ellipse=ParametricPlot[{x[t],y[t]},{t,0,2 Pi},
                   PlotStyle->{{Thickness[0.005]}},
                    AspectRatio->Automatic,
                    PlotRange->{{-a-2,a+2},{-b-2,b+2}}];

3. Activate the Plotall command for 0 and also for `/4. Be sure to take note of the differences between this and those in the first set of exercises.

4. Please activate the "Table" command(below this text) and scroll through each graph to investigate the values of  the distance from P to (0,c1) and the distance from P to (0,c2).  This will give the values of points on around the circle to 2 `. In each case, please give the value of the sum of the two distances on your Investigation Sheet. 
 5. Does this number have any similarity to any other given value?

{c1,c2} = c/.Solve[a^2 == b^2 + c^2,c]

Clear[c1plot,c2plot,c1label,c2label,c1val,c2val]

c1plot[t_]  := Graphics[{RGBColor[1,0,0],Line[{{0,c1},{x[t],y[t]}}]}]
c2plot[t_]  := Graphics[{Blue,Line[{{0,c2},{x[t],y[t]}}]}]
c1label[t_] := Graphics[Text["c1",
                        {-.2,c1}]]
c2label[t_] := Graphics[Text["c2",
                        {0,c2}]]

c1val[t_]   := Graphics[
               Text["= d(f1,p)" N[dist[{0,c1},{x[t],y[t]}]],
                    {3a/4,a+3/2}]];
c2val[t_]   := Graphics[
               Text["= d(f2,p)"
                    N[dist[{0,c2},{x[t],y[t]}]],
                    {-3a/4,a+3/ 2}]];
                    
ctotal[t_]   := Graphics[
                Text["= d(f1,p) + d(f2,p)" N[dist[{0,c2},{x[t],y[t]}] + 
                  dist[{0,c1},{x[t],y[t]}]],
                     {a/3,-a-3/2}]]

ppoint[t_] := Graphics[
                        {Maroon,PointSize[.02],Point[{x[t],y[t]}]}
                      ]
ppointlabel[t_] :=
              Graphics[
                        Text["p",{x[t]+.2,y[t]+.2}]
                      ]

plotall[t_] :=

Show[ellipse,c1plot[t],c2plot[t],
     c1label[t],c2label[t],c1val[t],c2val[t],
     ctotal[t],ppoint[t],ppointlabel[t],
     PlotRange->{{-a-5,a+5},{-b-5,b+5}}];

plotall[0];

plotall[Pi/4];

Table[plotall[theta],{theta,0,7Pi/4,Pi/4}];

6. Now let's look to see if this is just a special case or if this observation is true for all ellipses. So that our graphs are manageable let me again suggest that you go back to the beginning 
 and let a =5 and b = 3é3.

7. Repeat the activations from above for these values of a and b and  record these values on the Investigation Sheet. Be sure to also use the "Table" command too. 

8. What similarity do you see this time? Is it the same as last?

9. If you wish try again with new values of a and b go ahead-- but be sure to make a larger than b.

10. In summary write a short paragraph that contrasts the two different cases of ellipses, noting the vertices(intersections with the axes) and the focii(c1,c2).

11. Please construct your very own definition of an ellipse based on 
our computer investigation.