Exploring Analyic Geometry with Mathematica®

Home Contents Commands Packages Explorations Reference
Tour Lines Circles Conics Analysis Tangents

Technical Notes

Computation Levels
Names
Descarta2D Objects
Descarta2D Packages
Descarta2D Functions
Descarta2D Documentation

This chapter provides an overview of how Descarta2D is implemented using Mathematica. Descarta2D is an object-oriented application, which means that it provides a collection of objects (e.g. points, lines, etc.) and a set of methods that compute on these objects. The programs that comprise Descarta2D are organized into a small number of Mathematica packages that specify the behavior of the objects.

Computation Levels [Top]

Mathematica provides support for both symbolic and numerical computations. Descarta2D takes advantage of these capabilities to provide the following four levels of computation:

   Symbolic.  At the symbolic level, sizes, angles and coefficients are expressed as variables and general formulas may be derived.

   Analytic.  At the analytic level variables are replaced with exact numerical quantities that are not approximated by floating point numbers. Mathematical functions such as square roots and trigonometric functions are carried without evaluation.

   Numerical.  At the numerical level numbers and functions are replaced with floating point representations that are approximations carried to any number of decimal places in Mathematica. Often, the accuracy is determined by the floating point hardware available in the computer and is sufficient for such computations.

   Approximation.  At the approximation level iterative algorithms are used to converge to an approximation of a value. Generally, the tolerance of the approximation can be controlled to approach the floating point precision of the computer hardware or better.

Depending on the complexity of the problem, Descarta2D often provides a choice of the level of computation undertaken for a particular geometric investigation.

Names [Top]

In Mathematica symbolic names containing upper case letters are considered different than names using corresponding lower case letters (i.e. Mathematica is case-sensitive with respect to the interpretation of symbolic names). Mathematica uses the convention that system-defined names always begin with upper case letters or the dollar sign symbol and recommends that user-defined symbols begin with lower case letters to avoid naming conflicts. Descarta2D follows the same naming conventions as Mathematica. Descarta2D symbolic names begin with upper case letters; user symbolic names may contain upper case or lower case letters, but, generally, the first letter is advised to be lower case to prevent conflicts with built-in Mathematica functions and Descarta2D functions. In order to prevent conflicts with the names of Descarta2D functions, this chapter provides suggestions for naming Descarta2D objects to encourage consistency and clear understanding when using Descarta2D. Following these conventions will avoid most naming conflicts.

All Descarta2D function names are fully spelled out English words and each name has the ending 2D appended. If more than one word is used (for example, TangentConics2D, or FocalLength2D), then the first letter of each word is upper case.

Descarta2D adheres to several syntactic conventions for consistency and ease of use. Functions that return (construct) a Descarta2D object, such as Point2D, will always have the form

objectName[arg"notes_1.gif",arg"notes_2.gif",...].

For example, Point2D[point,point] returns the midpoint of two given points. Functions that return a list of objects are generally plural, such as Points2D, TangentLines2D and Foci2D.

If Descarta2D detects invalid input when constructing an object, it generally displays an error message and returns the $Failed symbol. Descarta2D functions that return a list of objects will generally return an empty list, instead of the $Failed symbol (indicating that no objects can be constructed).

Descarta2D Objects [Top]

"notes_3.gif"

Reserved names in Descarta2D (objects).

"notes_4.gif"

Descarta2D object hierarchy.

In Descarta2D an object is a textual representation of a mathematical concept. Each object is represented using a Mathematica expression whose head is the name of the object and whose parameters are the arguments of the expression. Table [notes:tbl01] is a list of the object names built into Descarta2D. The objects are organized into a hierarchy as shown in Figure [notes:fig01]. The hierarchy also includes meta-objects, objects that have no implementation, but serve to organize the Descarta2D objects. Meta-objects are shown in italic font. The following sections provide detailed descriptions of each object provided by Descarta2D. Each section provides the name of the object, the syntax of the Mathematica expression for the object, names typically used to refer to the object, a description of the object (using a mathematical equation when appropriate) and restrictions on the arguments of the object. All objects have the restriction that their arguments cannot involve complex numbers. The Line2D and Quadratic2D objects are listed twice in Figure [notes:fig01] because they can be interpreted to represent geometry or polynomials.

Arc2D

"notes_5.gif"

Standard representation of an Arc2D.

Arc2D[{"notes_6.gif","notes_7.gif"},{"notes_8.gif","notes_9.gif"},B] is the standard representation of an arc in Descarta2D as illustrated in Figure [notes:fig02]. The first and second arguments are the coordinates of the start and end points of the arc, respectively. The third argument is a positive scalar, B, representing the bulge factor of the arc. The bulge factor is the ratio of the arc's height, H, to half the chord length, D/2; so B=2H/D. The arc is traversed counter-clockwise from "notes_10.gif" to "notes_11.gif".

In the argument sequence of a function an arc is shown as arc, as in Radius2D[arc]. arc[0] gives the coordinates of the start point, arc[1] gives the coordinates of the end point and Bulge2D[arc] gives the bulge factor. Suggested symbolic names for an Arc2D include the series: (a1, a2, ), (A1, A2, ) and (arc1, arc2, ).

The parametric equations of an Arc2D using parameter t are

x(t) = "notes_12.gif"
y(t) = "notes_13.gif"

where (h,k) is the center point of the arc, and β is the angular span of the arc. Both the center point and the angular span are functions of the defining points and the bulge factor as described in the "Arcs" chapter. Values of t in the range 0≤t≤1 generate coordinates on the complete span of the arc. Arc2D[{"notes_14.gif","notes_15.gif"},{"notes_16.gif","notes_17.gif"},B][t] returns the coordinates of a point on an arc at parameter t. The expression Arc2D[{"notes_18.gif","notes_19.gif"},{"notes_20.gif","notes_21.gif"},B][{"notes_22.gif","notes_23.gif"}] when used in a plotting command, such as Sketch2D, will cause the portion of the arc between parameters "notes_24.gif" and "notes_25.gif" to be plotted.

Circle2D

"notes_26.gif"

Standard representation of a Circle2D.

Circle2D[{h,k},r] is the standard representation of a circle in Descarta2D as illustrated in Figure [notes:fig03]. The center of the circle is given as a coordinate list, {h,k}, and the radius is the positive scalar, r. The equation of the circle is

"notes_27.gif"

In the argument sequence of a function, a Circle2D is shown as circle or cir, as in Radius2D[circle] or Radius2D[cir]. The function Coordinates2D[circle] gives the center point coordinates of a circle and Radius2D[circle] gives the radius, r. Suggested symbolic names for a Circle2D include the series: (c1, c2, ), (C1, C2, ) and (cir1, cir2, ).

The parametric equations of a Circle2D using parameter θ are

x(θ) = h+rcosθ
y(θ) = k+rsinθ.

Values of θ in the range 0≤θ<2π generate coordinates on the complete circumference of the circle. Circle2D[{h,k},r][θ] returns the coordinates of the point on a circle at parameter θ. The expression Circle2D[{h,k},r][θ][{"notes_28.gif","notes_29.gif"}] when used in a plotting command, such as Sketch2D, will cause the arc of the circle between parameters "notes_30.gif" and "notes_31.gif" to be plotted.

Conic Arc

"notes_32.gif"

Standard representation of a ConicArc2D.

ConicArc2D[{x"notes_33.gif",y"notes_34.gif"},{x"notes_35.gif",y"notes_36.gif"},{x"notes_37.gif",y"notes_38.gif"},ρ] is the standard representation of a conic arc in Descarta2D as illustrated in Figure [notes:fig04]. The first and third arguments are the coordinates of the start and end points of the conic arc, respectively. The second argument is the coordinates of the apex point of the conic arc (the apex point is the intersection point of the tangent lines at the start and end points). The fourth argument, ρ, is a scalar representing the projective discriminant of the conic arc. Values of ρ in the range 0<ρ<1/2 are elliptical arcs; values in the range 1/2<ρ<1 are hyperbolic arcs; and the value 1/2 is a parabolic arc.

In an argument sequence, a ConicArc2D is shown as cnarc, as in Rho2D[cnarc]. The function Coordinates2D[cnarc,Apex2D] returns the coordinates of the apex point of a conic arc and Rho2D[cnarc] gives the value of ρ. ConicArc2D[{x"notes_39.gif",y"notes_40.gif"},{x"notes_41.gif",y"notes_42.gif"},{x"notes_43.gif",y"notes_44.gif"},ρ][t] with t=0 gives the coordinates of the start point and with t=1 gives the coordinates of the end point. Suggested symbolic names for a ConicArc2D include the series: (ca1, ca2, ), (CA1, CA2, ) and (cnarc1, cnarc2, ).

The parametric equations of a ConicArc2D using parameter t are

x(t) = "notes_45.gif"
y(t) = "notes_46.gif"

where "notes_47.gif", "notes_48.gif" and "notes_49.gif". Values of t in the range 0≤t≤1 generate coordinates on the complete span of the conic arc. The expression

ConicArc2D[{x"notes_50.gif",y"notes_51.gif"},{x"notes_52.gif",y"notes_53.gif"},{x"notes_54.gif",y"notes_55.gif"},ρ][{"notes_56.gif","notes_57.gif"}]

when used in a plotting command, such as Sketch2D, will cause the portion of the conic arc between parameters "notes_58.gif" and "notes_59.gif" to be plotted.

Coordinates

Coordinates {x,y} are used to represent an (x,y) position in Descarta2D. In an argument sequence coordinates are shown as coords such as Point2D[coords], or in explicit forms such as {h,k} or {x,y} as in Point2D[{x,y}]. Suggested symbolic names for coordinates include the series: (c1, c2, ), (C1, C2, ) and (coords1, coords2, ).

Ellipse2D

"notes_60.gif"

Standard representation of an Ellipse2D.

Ellipse2D[{h,k},a,b,θ] is the standard representation of an ellipse in Descarta2D as illustrated in Figure [notes:fig05]. The first argument, {h,k}, is a list of coordinates representing the center of the ellipse. The second argument is a positive scalar, a, representing the length of the semi-major axis. The third argument is a positive scalar, b, representing the length of the semi-minor axis. In a valid ellipse, the length of the semi-major axis must be greater than the length of the semi-minor axis, a>b. The fourth argument, θ, is the angle of rotation of the ellipse measured from the +x-axis counter-clockwise to the major axis of the ellipse and is normalized to the range 0≤θ<π. The underlying equation of the (non-rotated) ellipse is

"notes_61.gif"

In an argument sequence, an ellipse is shown as ellipse, as in Angle2D[ellipse]. The function Coordinates2D[ellipse] returns the center point coordinates of an ellipse; the function

SemiMajorAxis2D[ellipse]

gives the length of the semi-major axis, a, and the function

SemiMinorAxis2D[ellipse]

gives the length of the semi-minor axis, b; and Angle2D[ellipse] gives the angle of rotation, θ. Suggested symbolic names for an Ellipse2D include the series: (e1, e2, ), (E1, E2, ) and (ell1, ell2, ).

The parametric equations of a (non-rotated) Ellipse2D using the parameter α are

x(α) = h+acosα
y(α) = k+bsinα.

Values of α in the range 0≤α<2π generate coordinates on the complete circumference of the ellipse. Ellipse2D[{h,k},a,b,θ][α] returns the coordinates of the point on an ellipse at parameter α. The expression Ellipse2D[{h,k},a,b,θ][{"notes_62.gif","notes_63.gif"}] when used in a plotting command, such as Sketch2D, will cause an arc of the ellipse between parameters "notes_64.gif" and "notes_65.gif" to be plotted.

Hyperbola2D

"notes_66.gif"

Standard representation of a Hyperbola2D.

Hyperbola2D[{h,k},a,b,θ] is the standard representation of a hyperbola in Descarta2D as illustrated in Figure [notes:fig06]. The first argument, {h,k}, is a list of coordinates representing the center of the hyperbola. The second argument is a positive scalar, a, representing the length of the semi-transverse axis. The third argument is a positive scalar, b, representing the length of the semi-conjugate axis. The fourth argument, θ, is the angle of rotation of the hyperbola measured from the +x-axis counter-clockwise to the transverse axis of the hyperbola and is normalized to the range 0≤θ<π. The underlying equation of the (non-rotated) hyperbola is

"notes_67.gif"

In an argument sequence, a hyperbola is shown as hyperbola, as in Angle2D[hyperbola]. The function Coordinates2D[hyperbola] returns the center point coordinates of a hyperbola; the function

SemiTransverseAxis2D[hyperbola]

gives the length of the semi-transverse axis, a, and the function

SemiConjugateAxis2D[hyperbola]

gives the length of the semi-conjugate axis, b; and Angle2D[hyperbola] gives the angle of rotation, θ. Suggested symbolic names for a Hyperbola2D include the series: (h1, h2, ), (H1, H2, ) and (hyp1, hyp2, ).

The parametric equations of a (non-rotated) Hyperbola2D using parameter t are

x(t) = h+acosh(st)
y(t) = k+bsinh(st)

where "notes_68.gif" and e is the eccentricity of the hyperbola. Values of t in the range -∞<t<∞ generate coordinates on the branch of the hyperbola opening to the right in the non-rotated position. Hyperbola2D[{h,k},a,b,θ][t] returns the coordinates of the point on a hyperbola at parameter t. The values t=±1 generate coordinates at the ends of the focal chord of the hyperbola. The expression Hyperbola2D[{h,k},a,b,θ][{"notes_69.gif","notes_70.gif"}] when used in a plotting command, such as Sketch2D, will cause an arc of the hyperbola between parameters "notes_71.gif" and "notes_72.gif" to be plotted. If "notes_73.gif", the arc will be on the right branch of the (non-rotated) hyperbola; if "notes_74.gif", the arc will be on the left branch of the (non-rotated) hyperbola.

Line2D

Line2D[A,B,C] is the standard representation of an infinite line Ax+By+C=0. At least one of the first two coefficients, A or B, must be non-zero. The parametric equations of a line using parameter t are

x(t)=ac+bt   and   y(t)=bc-at

where

"notes_75.gif"

The coordinates of the point on the line nearest the origin will be at parameter t=0 and other coordinates, parameterized by distance t, -∞<t<∞, along the line are given by Line2D[A,B,C][t]. The expression Line2D[A,B,C][{"notes_76.gif","notes_77.gif"}] when used in a plotting command, such as Sketch2D, will cause a segment of the line between parameters "notes_78.gif" and "notes_79.gif" to be plotted.

In an argument sequence, a Line2D object is shown as line or ln, as in Angle2D[line] or Angle2D[ln]. Suggested symbolic names for a Line2D include the series: (l1, l2, ), (L1, L2, ) and (ln1, ln2, ).

Parabola2D

"notes_80.gif"

Standard representation of a Parabola2D.

Parabola2D[{h,k},f,θ] is the standard representation of a parabola in Descarta2D as illustrated in Figure [notes:fig07]. The first argument, {h,k}, is a list of coordinates representing the vertex of the parabola. The second argument is a positive scalar, f, representing the focal length of the parabola. The third argument, θ, is the angle of rotation of the parabola measured from the +x-axis counter-clockwise to the axis of the parabola and is normalized to the range 0≤θ<2π. The underlying equation of the (non-rotated) parabola is

"notes_81.gif"

In an argument sequence, a parabola is shown as parabola, as in Angle2D[parabola]. The function Coordinates2D[parabola] returns the vertex point coordinates of the parabola; FocalLength2D[parabola] gives the focal length of the parabola; and Angle2D[parabola] gives the angle of rotation, θ. Suggested symbolic names for a Parabola2D include the series: (p1, p2, ), (P1, P2, ) and (pb1, pb2, ).

The parametric equations of a Parabola2D using parameter t are

"notes_82.gif"

Values of t in the range -∞<t<∞ generate coordinates on the parabola opening to the right in the non-rotated position. Parabola2D[{h,k},f,θ][t] returns the coordinates of the point on a parabola at parameter t. The values t=±1 generate coordinates at the ends of the focal chord of the parabola. The expression Parabola2D[{h,k},f,θ][{"notes_83.gif","notes_84.gif"}] when used in a plotting command, such as Sketch2D, will cause an arc of the parabola between parameters "notes_85.gif" and "notes_86.gif" to be plotted.

Point2D

Point2D[{x,y}] (which is the same as Point2D[coords]) is the standard representation of a point. The coordinates define the (x,y) position of the point. In an argument sequence, a point is shown as point or pt, as in Coordinates2D[point] and Coordinates2D[pt]. Suggested symbolic names for a Point2D include the series: (p1, p2, ), (P1, P2, ) and (pt1, pt2, ).

XCoordinate2D[point] and YCoordinate2D[point] return the x- and y-coordinate, respectively, of a point. Coordinates2D[point] returns the (x,y) coordinates of a point as a coordinate list.

Quadratic2D

Quadratic2D[A,B,C,D,E,F] is the standard representation of the quadratic

"notes_87.gif"

At least one of the first five coefficients must be non-zero. In general, the quadratic will represent a conic curve, but certain combinations of coefficients may represent degenerate conics (lines and points) or no locus at all. In an argument sequence, a Quadratic2D is shown as quad, as in Point2D[quad]. Suggested symbolic names for a Quadratic2D include the series: (q1, q2, ), (Q1, Q2, ) and (quad1, quad2, ). Descarta2D provides no parametric representation for a quadratic (the specific conics have parametric representations).

Segment2D

The form Segment2D[{"notes_88.gif","notes_89.gif"},{"notes_90.gif","notes_91.gif"}] is the standard representation of a line segment in Descarta2D. The coordinates {"notes_92.gif","notes_93.gif"} and {"notes_94.gif","notes_95.gif"} are the start and end coordinates, respectively, of the line segment.

In an argument sequence, a Segment2D is shown as lnseg, as in Angle2D[lnseg]. Suggested symbolic names for a Segment2D include the series: (l1, l2, ), (L1, L2, ) and (lnseg1, lnseg2, ).

The parametric equations of a Segment2D using parameter t are

x(t) = "notes_96.gif"
y(t) = "notes_97.gif"

Values of t in the range 0≤θ≤1 generate coordinates over the complete length of the line segment. Segment2D[{"notes_98.gif","notes_99.gif"},{"notes_100.gif","notes_101.gif"}][t] returns the coordinates of the point on a line segment at parameter t. The parameter value t=0 generates the coordinates of the start point of the line segment and the value t=1 generates the end point coordinates. The expression Segment2D[{"notes_102.gif","notes_103.gif"},{"notes_104.gif","notes_105.gif"}][{"notes_106.gif","notes_107.gif"}] when used in a plotting command, such as Sketch2D, will cause a portion of the line segment between parameters "notes_108.gif" and "notes_109.gif" to be plotted.

Triangle2D

"notes_110.gif"

Standard representation of a Triangle2D.

Triangle2D[{"notes_111.gif","notes_112.gif"},{"notes_113.gif","notes_114.gif"},{"notes_115.gif","notes_116.gif"}], as illustrated in Figure [notes:fig08], is the standard representation of a triangle with vertex points "notes_117.gif", "notes_118.gif" and "notes_119.gif". The vertex points cannot be coincident or collinear. Coordinates2D[triangle,n] returns the coordinates of vertex n of a triangle, n=1,2,3.

In an argument sequence a Triangle2D is shown as triangle, as in Area2D[triangle]. Suggested symbolic names for a Triangle2D include the series: (t1, t2, ), (T1, T2, ) and (tri1, tri2, ).

Object Queries

Each object in Descarta2D responds to a set of special queries essential to the operation of Descarta2D. These special queries are listed below:

   IsDisplay2D  returns True if the object can be displayed using the Sketch2D command.

   Is2D  returns True if the object's head is in a given list.

   IsValid2D  returns True if the object is a Descarta2D object and each of its parameters is of the proper type and form.

   ObjectNames2D  returns a list of strings that are the names of all Descarta2D objects.

If you add a new object to Descarta2D, the object will need to respond properly to these queries if you desire that the object behave in an integrated manner. Refer to the source code listings to determine how each of these queries can be implemented.

Descarta2D Packages [Top]

A relatively small number of Mathematica packages (*.m files) provide support for all the Descarta2D functions. Your computer system must be set up to allow Mathematica to find these files before you can use any of the Descarta2D functions. In order to set up Mathematica to use the Descarta2D package files, you need copy the folder Descarta2D from the Descarta2D ZIP archive to the appropriate folder onto your hard drive. Descarta2D must be copied into a folder that Mathematica searches when loading packages. Typically, in a standard Mathematica installation, this will be the folder

c:\Program Files\Wolfram Research\Mathematica\3.0\AddOns\Applications\

although this directory path may be different for your installation of Mathematica. The master package file for Descarta2D will be loaded by issuing the command <<Descarta2D`. After this command is entered, Mathematica will automatically find and load all the packages as required to execute Descarta2D commands.

The package names are listed in Table [notes:tbl06]. Each package defines symbols that are then owned by the package. The definitions in each package provide either support for Descarta2D objects (such as Point2D, Line2D, Circle2D, etc.) or functions (such as Radius2D[circle] that returns the radius of a circle, or Line2D[point,point] that constructs a line between two points).

"notes_120.gif"

Reserved names in Descarta2D (packages).

Descarta2D Functions [Top]

Descarta2D provides geometric computing facilities by introducing a number of general functions and queries whose names are listed in Table [notes:tbl02] and [notes:tbl03].

Some Descarta2D functions require keywords. A complete list of keywords is listed in Table [notes:tbl04].

There are a number of low-level functions provided by Descarta2D that are useful for implementing new functions. These are listed in Table [notes:tbl05].

"notes_121.gif"

Reserved names in Descarta2D (general functions).

"notes_122.gif"

Reserved names in Descarta2D (general queries).

"notes_123.gif"

Reserved names in Descarta2D (keywords).

"notes_124.gif"

Reserved names in Descarta2D (low-level functions).

Descarta2D Documentation [Top]

This entire book, including the subject matter chapters, reference chapters and exploration notebooks, is provided in two formats. The first format provided is Adobe's Portable Document Format (PDF) and is useful for passive reading and printing of typeset renderings of the book identical to the printed version of the book. PDF files may be viewed and printed using Adobe's Acrobat Reader program that can be downloaded at no charge from Abode's web site, www.adobe.com.

The second format provided is Wolfram Research's Mathematica notebook format. Notebooks can be viewed interactively using Mathematica itself.


Copyright © 1999-2007 Donald L. Vossler, Descarta2D Publishing
www.Descarta2D.com