DERIVE for Windows version 5.05 DfW file saved on 30 Sep 2002
dist(c1, c2):=VECTOR(((c1 - loci1)^2 + (c2 - loci2)^2), i, 1, 3)
c1:=
c2:=
hCross:=APPROX(5354838709677419/2000000000000000)
loc:=[-2, 0; -3, 0; 3, 3]
vCross:=APPROX(10277777777777777/5000000000000000)
x0:=
y0:=
CTextObjD{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman Times New Roman;}{\f1\froman\fcharset0 Times New Roman;}{\f2\fmodern\fcharset2 DfW5 Printer;}}
{\colortbl ;\red0\green0\blue128;\red255\green0\blue0;}
\viewkind4\uc1\pard\qc\b\f0\fs24 Equations for Curves
\par Passing through a Given Set of Points
\par \pard\b0
\par
\par NOTE: \cf1 While working with this example we recommend that you open a \f1 2D-\f0 plot window and choose the \f1 menu \f0 option Window>Tile Vertically. That way you will be able to work through the lesson and see the graphics side by side.\b
\par \pard\qc\cf0
\par \pard Example:
\par \b0
\par \tab A large department store chain has three stores with locations that are rather far apart. A coordinate system is placed on a map and the locations of the stores are given as coordinates relative to this system. \cf2\f1 Simplify\f0 the following \f1 expression \f0 to generate three random locations on the coordinate system (\f1 o\f0 f course in a real application the coordinates would be determined and not random.)\cf0 \f2
\par }
CExpnObj8User'VECTOR([RANDOM(8)-4,RANDOM(8)-4],i,1,3):{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman Times New Roman;}{\f1\froman\fcharset0 Times New Roman;}{\f2\fmodern\fcharset2 DfW5 Printer;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\cf1\f0\fs24 Assign the result of this \f1 simplification\f0 to a variable called loc.\cf0 \f1 \cf1\f0 Then plot the points \f1 in\f0 the \f1 2D-\f0 plot window. \f1 (Use the Options > Display command to choose large p\f0 oints that \f1 are not \f0 con\f1 nected.)\cf0\f2
\par }
F{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman Times New Roman;}{\f1\froman\fcharset0 Times New Roman;}{\f2\fmodern\fcharset2 DfW5 Printer;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\f0\fs24 Assuming that the distribution center is to be at a new location, where would be the best place to put the center. If we do not need to consider access roads and the like, it would make sense to place \f1 it in \f0 the center of a circle that passes through the three store locations. Can you "eyeball" such a location? What is it? What is the distance to each store? You can check this using the following formula. \cf1 Simply type and \f1 simplify \f0 dist(\i c\i0 1,\i c\i0 2) where (\i c\i0 1,\i c\i0 2) is replaced by your guess for the location.\f2
\par }
8PUserNdist(c1,c2):=VECTOR(SQRT((c1-loc SUB i SUB 1)^2+(c2-loc SUB i SUB 2)^2),i,1,3){\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1 Times New Roman;}{\f1\fmodern\fprq1\fcharset2 DfW5 Printer;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\pard\cf1\f0\fs24 Since our goal is to have all of the distances equal (the radius of the circle), this is not such an easy job. So, let's have algebra give us a hand! First we recall the equation for the center of a circle. Suppose that the radius of the circle is \i r\i0 and that the center is at (\i c\i0 1,\i c\i0 2) then the equation is:\f1
\par }
8User(x-c1)^2+(y-c2)^2=r^2$o{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1 Times New Roman;}{\f1\fmodern\fprq1\fcharset2 DfW5 Printer;}{\f2\fmodern\fprq1\fcharset0 Times New Roman;}}
{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;}
\viewkind4\uc1\pard\cf1\f0\fs24 Substitute your guesses for the center and radius into the above formula and plot the result. Be sure that you have checked the plot option, "Approximate Before Plotting" prior to attempting to plot the circle. How good were your choices?
\par \cf2\f1
\par \f0 Now it is time to do some algebra. First\f2 , we \f0 expand the equation of a circle given above.\f1
\par }
`{
Simp(User)~jth?#x^2-2*c1*x+y^2-2*c2*y+c1^2+c2^2=r^2Z{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1 Times New Roman;}{\f1\fmodern\fprq1\fcharset0 Times New Roman;}{\f2\fmodern\fprq1\fcharset2 DfW5 Printer;}}
{\colortbl ;\red0\green0\blue0;\red255\green0\blue0;}
\viewkind4\uc1\pard\cf1\f0\fs24 Note that if we substitute values for \i x\i0 and \i y\i0 we have an equation with three unknowns: \i c\i0 1, \i c\i0 2, and \i r\i0 . Thus, if we know the location of three points on the circle, we have three equations in three unknowns. \cf2\f1 Simplify\f0 the following expression to see the three equations.\cf1 \f2
\par }
8 Sub(User)iVECTOR(loc SUB i SUB 1^2-2*c1*loc SUB i SUB 1+loc SUB i SUB 2^2-2*c2*loc SUB i SUB 2+c1^2+c2^2=r^2,i,1,3)a{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1 Times New Roman;}{\f1\fmodern\fprq1\fcharset2 DfW5 Printer;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\pard\cf1\f0\fs24 After you have obtained the three equations you can solve them for \i c\i0 1, \i c\i0 2, and \i r\i0 by evaluating the following expression.\f1
\par }
8 ,UserSOLVE(result,{c1,c2,r})8{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1 Times New Roman;}{\f1\fmodern\fprq1\fcharset0 Times New Roman;}{\f2\fmodern\fprq1\fcharset2 DfW5 Printer;}}
{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;}
\viewkind4\uc1\pard\cf1\f0\fs24 Substitute for \i result\i0 the three equations in \i c\i0 1, \i c\i0 2, and \i r\i0 that you obtained by \f1 simplifying\f0 #5 above. Note that you will see more than one set of answers. How do you choose which set to use? Now substitue the correct values for \i c\i0 1, \i c\i0 2,\i \i0 and \i r\i0 into equation #4 and plot the result. Note that the circle passes through the three points.\cf2
\par
\par \b Extensions:
\par
\par \b0 The method used to locate the distribution center can be used in other circumstances. First of all, we are not confined to finding the center and radius of a circle. We can find a curve that passes through a given number of points. Consider the equation for a parabola.\f2
\par }
8User
y=a*x^2+b*x+c{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fmodern\fprq1 Times New Roman;}{\f1\fmodern\fprq1\fcharset0 Times New Roman;}{\f2\fmodern\fprq1\fcharset2 DfW5 Printer;}}
{\colortbl ;\red0\green0\blue0;\red255\green0\blue0;}
\viewkind4\uc1\pard\cf1\f0\fs24 In this equation there are three parameters that need to be found in order to completely define the parameters. That means that if we know three points: (\i x\i0 0, \i y\i0 0), (\i x\i0 1, \i y\i0 1), and (\i x\i0 2, \i y\i0 2), we can find the equation for the parabola passing through these points.
\par
\par \ul Exercise\ulnone
\par \cf2 1) Generate three points at random and assign the result to a variable called \i pts\i0 . Plot the three points.
\par 2) Substitu\f1 t\f0 e these three points into the equation of the parabola to obtain three equations in the three unknowns: \i a\i0 , \i b\i0 , and \i c\i0 .
\par 3) Solve the equations for \i a\i0 , \i b\i0 , and \i c.
\par \i0 4) Plot the parabola.
\par \cf1
\par Finally, we end this discussion with a more general result.
\par
\par \cf2 5) Show that if we have a polynomial of degree \i n\i0 , then if we know \i n\i0 +1 points lying on the graph of the polynomial, we can find the equation of the polynomial.\cf1
\par
\par The general result stated in 5) and proven by you leads us to a final
\par
\par \ul Exercise\ulnone
\par \cf2 6) Generate a random integer between 3 and 7. Call the result \i n, \i0 Write the general\f1 \f0 equation of a polynomial of degree \i n\i0 .
\par 7) Generate \i n\i0 +1 random points and save the result in a variable called \i pts.\i0
\par 8) Use these points to write \i n\i0 +1 equations involving the parameters for the polynomial expression from 6)
\par 9) Solve the equations for the parameters, substitute into the polynomial equation, and plot the result.
\par \cf1\f2
\par \f0\fs20 Carl Leinbach: leinbach@cs.gettysburg.edu \f2\fs24
\par }