Exploring Analyic Geometry with Mathematica® |
|||||
| Home | Contents | Commands | Packages | Explorations | Reference |
| Tour | Lines | Circles | Conics | Analysis | Tangents |
D2DConic2D
The package D2DConic2D provides functions for constructing various points, lines and line segments associated with conic curves.
Initialization
BeginPackage["D2DConic2D`", {"D2DCircle2D`", "D2DEllipse2D`", "D2DExpressions2D`", "D2DHyperbola2D`", "D2DLine2D`", "D2DParabola2D`", "D2DPoint2D`", "D2DSegment2D`", "D2DTransform2D`"}];
D2DConic2D::usage=
"D2DConic2D is a package for constructing geometry associated with conic curves.";
Asymptotes2D::usage=
"Asymptotes2D[hyperbola] constructs a list containing the two asymptote lines of a hyperbola.";
Directrices2D::usage=
"Directrices2D[conic] constructs a list containing the directrix line(s) of a conic curve (one for a parabola, two for ellipses and hyperbolas).";
Eccentricity2D::usage=
"Eccentricity2D[conic] computes the eccentricity of a conic curve (parabola, ellipse or hyperbola).";
FocalChords2D::usage=
"FocalChords2D[conic] constructs a list containing the focal chords (line segments) of a conic curve (one for a parabola, two for ellipses and hyperbolas).";
Foci2D::usage=
"Foci2D[conic] constructs a list containing the focus point(s) of a conic curve (one for a parabola, two for ellipses and hyperbolas).";
Vertices2D::usage=
"Vertices2D[conic] contructs a list containing the vertex point(s) of a conic curve (one for a parabola, two for ellipses and hyperbolas).";
Begin["`Private`"];
Scalars
Eccentricity
Format: Eccentricity2D[ellipse]
Computes the eccentricity of an ellipse.
Eccentricity2D[Ellipse2D[{h_,k_},a_,b_,theta_]] := Sqrt[a^2-b^2]/a;
Format: Eccentricity2D[hyperbola]
Computes the eccentricity of a hyperbola.
Eccentricity2D[Hyperbola2D[{h_,k_},a_,b_,theta_]] := Sqrt[a^2+b^2]/a;
Format: Eccentricity2D[parabola]
Computes the eccentricity of a parabola (e=1).
Eccentricity2D[Parabola2D[{h_,k_},f_,theta_]] := 1;
Point Construction
Focus Points
Format: Foci2D[ellipse]
Constructs a list containing the two focus points of an ellipse.
Foci2D[E1:Ellipse2D[{h_,k_},a_,b_,theta_]] :=
Module[{e=Eccentricity2D[E1]},
{Point2D[Rotate2D[{h+a*e,k},theta,{h,k}]],
Point2D[Rotate2D[{h-a*e,k},theta,{h,k}]]}];
Format: Foci2D[hyperbola]
Constructs a list containing the two focus points of a hyperbola.
Foci2D[H1:Hyperbola2D[{h_,k_},a_,b_,theta_]] :=
Module[{e=Eccentricity2D[H1]},
{Point2D[Rotate2D[{h+a*e,k},theta,{h,k}]],
Point2D[Rotate2D[{h-a*e,k},theta,{h,k}]]}];
Format: Foci2D[parabola]
Constructs a list containing the single focus point of a parabola.
Foci2D[Parabola2D[{h_,k_},f_,theta_]] :=
{Point2D[Rotate2D[{h+f,k},theta,{h,k}]]};
Vertex Points
Format: Vertices2D[ellipse]
Constructs a list containing the two vertex points of an ellipse.
Vertices2D[Ellipse2D[{h_,k_},a_,b_,theta_]] :=
{Point2D[Rotate2D[{h+a,k},theta,{h,k}]],
Point2D[Rotate2D[{h-a,k},theta,{h,k}]]};
Format: Vertices2D[hyperbola]
Constructs a list containing the two vertex points of a hyperbola.
Vertices2D[Hyperbola2D[{h_,k_},a_,b_,theta_]] :=
{Point2D[Rotate2D[{h+a,k},theta,{h,k}]],
Point2D[Rotate2D[{h-a,k},theta,{h,k}]]};
Format: Vertices2D[parabola]
Constructs a list containing the single vertex point of a parabola.
Vertices2D[Parabola2D[{h_,k_},f_,theta_]] := {Point2D[{h,k}]};
Line Construction
Asymptote Lines
Format: Asymptotes2D[hyperbola]
Constructs a list containing the two asymptote lines of a hyperbola.
Asymptotes2D[Hyperbola2D[{h_,k_},a_,b_,theta_]] :=
{Rotate2D[Line2D[b, a,-a*k-b*h],theta,{h,k}],
Rotate2D[Line2D[b,-a, a*k-b*h],theta,{h,k}]};
Directrix Lines
Format: Directrices2D[ellipse]
Constructs a list containing the two directrix lines of an ellipse.
Directrices2D::circular=
"The ellipse `1` is circular; it has no (finite) directrix lines.";
Directrices2D[E1:Ellipse2D[{h_,k_},a_,b_,theta_]] :=
Module[{e=Eccentricity2D[E1]},
If[IsZero2D[e],
Message[Directrices2D::circular,E1];{},
{Rotate2D[Line2D[1,0,-(h+a/e)],theta,{h,k}],
Rotate2D[Line2D[1,0,-(h-a/e)],theta,{h,k}]}] ];
Format: Directrices2D[hyperbola]
Constructs a list containing the two directrix lines of a hyperbola.
Directrices2D[H1:Hyperbola2D[{h_,k_},a_,b_,theta_]] :=
Module[{e=Eccentricity2D[H1]},
{Rotate2D[Line2D[1,0,-(h+a/e)],theta,{h,k}],
Rotate2D[Line2D[1,0,-(h-a/e)],theta,{h,k}]} ];
Format: Directrices2D[parabola]
Constructs a list containing the single directrix line of a parabola.
Directrices2D[Parabola2D[{h_,k_},f_,theta_]] :=
{Rotate2D[Line2D[1,0,-h+f],theta,{h,k}]};
Line Segment Construction
Focal Chords
Format: FocalChords2D[ellipse]
Constructs a list containing two line segments that are the focal chords of an ellipse.
FocalChords2D[E1:Ellipse2D[{h_,k_},a_,b_,theta_]] :=
Module[{e,l1,l2},
e=Eccentricity2D[E1];
l1=Segment2D[{h+a*e,k+b^2/a},{h+a*e,k-b^2/a}];
l2=Segment2D[{h-a*e,k+b^2/a},{h-a*e,k-b^2/a}];
Map[Rotate2D[#,theta,{h,k}]&,{l1,l2}] ];
Format: FocalChords2D[hyperbola]
Constructs a list containing two line segments that are the focal chords of a hyperbola.
FocalChords2D[H1:Hyperbola2D[{h_,k_},a_,b_,theta_]] :=
Module[{e,l1,l2},
e=Eccentricity2D[H1];
l1=Segment2D[{h+a*e,k+b^2/a},{h+a*e,k-b^2/a}];
l2=Segment2D[{h-a*e,k+b^2/a},{h-a*e,k-b^2/a}];
Map[Rotate2D[#,theta,{h,k}]&,{l1,l2}] ];
Format: FocalChords2D[parabola]
Constructs a list containing one line segment that is the single focal chord of the parabola.
FocalChords2D[Parabola2D[{h_,k_},f_,theta_]] :=
{Rotate2D[Segment2D[{h+f,k+2*f},{h+f,k-2*f}],theta,{h,k}]};
Epilogue
End[ ]; (* end of "`Private" *)
EndPackage[ ]; (* end of "D2DConic2D`" *)