{VERSION 2 3 "IBM INTEL NT" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 } {CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE " " -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 } 1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 4 4 0 0 0 0 0 0 -1 0 } {PSTYLE "Heading 3" 4 5 1 {CSTYLE "" -1 -1 "" 1 12 0 0 0 0 1 0 0 0 0 0 0 0 0 }0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 }{PSTYLE "Title" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }{PSTYLE "" 0 256 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 258 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 18 "" 0 "" {TEXT -1 15 "Designer Curves" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 25 "filename: Project_A99. mws" }}{PARA 0 "" 0 "" {TEXT -1 16 "updated: 10/1/99" }}{PARA 0 "" 0 " " {TEXT -1 31 "author: Arthur C. Heinricher" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 12 "Introduction" }} {PARA 0 "" 0 "" {TEXT -1 407 "A lot of this Calculus III class has bee n about approximating things. You saw that you could build polynomial s to approximate a given function f(x), these were called Taylor and/o r MacLaurin polynomials. They had the nice property that the function and some number of derivatives agreed at one point. They had the bad property that the function and some number of derivatives agree at ex actly one point. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 383 "In many applications, for example computer aided design, you need to design a curve that has a certain shape or satisfies some requirements at many different points. Taylor and MacLaurin don't h elp. Your job in this project is to explore the mathematical aspects of curve design. There are some ideas described in the next section \+ that can be the starting point for your work. " }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 27 "Ideas... to get y ou started" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 284 "The project is different from the labs in that there is no lis t of problems that completely the required work. Your work and your \+ report can take one or more of the ideas in this sections as a startin g point, but after that you are on your own. There are no \"right ans wers\" here. " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT 258 8 "Idea #1:" }{TEXT -1 314 " Most computer aided design (CA D) programs can draw, nice smooth curves through a specified set poin ts. How do they do it? One of the best methods for building curves with nice properties was developed by a man named Bezier. If you do \+ some reading on computer graphics, you are very likely to meet Bezier. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 309 "Yo ur project could start by describing how the method works, and why it \+ works. Your project could explore the mathematical properties of Be zier curves. You could write a program that would take as input a lis t of \"control points\", generate the associated curve, plot the curve , and test for smoothness. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 238 "Here is one specific problem you could s olve: Find a curve that connects the points in the following picture \+ but avoids each of the obstacles. Compute the length of your curve. \+ (If you were designing a pipe, the length is important.)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {INLPLOT "6,-%)POLYGONSG6$7U7$ \"\"!F(7$$!)(fqd\"!\"*$\"+sYm1D!#57$$!)yO$G'F,$\"+Wxzt\\F/7$$!*GqWS\"F ,$\"+a5\\itF/7$$!*SmQZ#F,$\"+#[t]j*F/7$$!*6g'>QF,$\"+/0dv6F,7$$!*XF1U& F,$\"+7U4p8F,7$$!*@?:D(F,$\"+'[E5a\"F,7$$!*5kMG*F,$\"+^el)o\"F,7$$!+;9 W[6F,$\"+0Tl4=F,7$$!+6g'>Q\"F,$\"+KI6->F,7$$!+st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)F,F\\cl7$$\"+/\"eD,)F,F`cl7$$\"+'*=W()zF,F`cl7$$\"+PP_izF,F\\cl7$$ \"+,m>QzF,Fhbl7$$\"+UT%[\"zF,Fdbl7$$\"+TY$G*yF,F`bl7$$\"+-_^syF,F\\bl7 $$\"+vi?ayF,Fhal7$$\"+,m>QyF,Fdal7$$\"+k'QZ#yF,F`al7$$\"+.Z/9yF,F\\al7 $$\"+oLG1yF,Fh`l7$$\"+gqd,yF,Fc`l7$$\"#yFeuF(7$FcfmFiel7$F`fmF[fl7$F]f mF]fl7$FjemF_fl7$FgemFafl7$FdemFcfl7$FaemFefl7$F^emFgfl7$F[emFifl7$Fhd mF[gl7$FedmF]gl7$FbdmF_gl7$F_dmF_gl7$F\\dmF]gl7$FicmF[gl7$FfcmFifl7$Fc cmFgfl7$F`cmFefl7$F]cmFcfl7$FjbmFafl7$FgbmF_fl7$FdbmF]fl7$FabmF[fl7$F^ bmFielFjamF[_l-%*AXESSTYLEG6#%$BOXG-%&TITLEG6#%FTwo~Obstacles~with~Fou r~Target~PointsG-%(SCALINGG6#%,CONSTRAINEDG-%%VIEWG6$;$!\"(F($\"#6F(;$ !\"&F($\"\"(F(" 2 620 369 369 2 0 1 0 2 9 0 2 1 1.000000 45.000000 45.000000 10030 10061 10056 10074 0 0 0 20010 0 12010 0 0 0 0 0 0 0 1 1 0 0 0 304 36 0 0 0 0 0 0 }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT 262 9 "Idea #2: " }{TEXT -1 197 "Explore ways to build polynom ials that pass through a specified list of points. You know that two \+ points determine one line. You also know (maybe) that there is exactl y one quadratic of the form " }{XPPEDIT 18 0 "y=a*x^2 +b*x + c" "/%\"y G,(*&%\"aG\"\"\"*$%\"xG\"\"#F'F'*&%\"bGF'F)F'F'%\"cGF'" }{TEXT -1 25 " that hits three points:" }}{PARA 0 "" 0 "" {TEXT -1 2 " " }}{PARA 256 "" 0 "" {TEXT -1 3 " " }{XPPEDIT 18 0 "P[0] = (x[0],y[0])" "/&% \"PG6#\"\"!6$&%\"xG6#F&&%\"yG6#F&" }{TEXT -1 6 ", " }{XPPEDIT 18 0 "P[1] = (x[1],y[1])" "/&%\"PG6#\"\"\"6$&%\"xG6#F&&%\"yG6#F&" }{TEXT -1 6 ", " }{XPPEDIT 18 0 "P[2] = (x[2],y[2])" "/&%\"PG6#\"\"#6$&% \"xG6#F&&%\"yG6#F&" }{TEXT -1 5 " , " }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 30 "and you can find formulas for " } {XPPEDIT 18 0 "a" "I\"aG6\"" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "b" "I\"b G6\"" }{TEXT -1 6 ", and " }{XPPEDIT 18 0 "c" "I\"cG6\"" }{TEXT -1 44 " in terms of the coordinates of the points. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 357 "What would you do if you had four (or five or twenty) points to hit? There is a standard appr oach to this problem due to the French mathematician Lagrange. You co uld study the method. Explain how the method works. Use the method t o solve some baxic approximation problems in calculus. Discuss what t he method does well and what the method does poorly. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 259 18 "Starting Point #3:" } }{PARA 0 "" 0 "" {TEXT -1 191 "If you and your partners are particular ly interested in another problem or topic that is related to the mathe matics you have been learning in the class, discuss the topic with the lecturer. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 17 "About Your Report" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 4 "The " } {TEXT 256 20 "final project report" }{TEXT -1 37 " is due on the last \+ day of the term, " }{TEXT 257 23 "October 14th at noon, " }{TEXT -1 23 " in my office. (SH202A)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 719 "The reports will be graded according to the sa me criteria used in evaluating the labs. Roughly half of the points a re for technical merit (is the mathematics correct? are your explanati ons of the mathematics accurate? did you show any creativity in your a pproach to the mathematical problems?) and the other half are for com munication (do you provide a clear and concise introduction and conclu sion? are the main technical points explained clearly? do you use cal culations and graphs well in your presentation? is the report interest ing?). In the end, one of the best ways for you to judge your own wor k is to READ it yourself! (If you find your writing confusing and dul l, then it is probably confusing and dull.)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 261 "You should have a \"rough draf t\" ready for review in your conference on Monday, October 11th. The \+ PLA (or TA) will check to see that you have a good outline of the work to be completed and that you have solved most of the technical proble ms you need to solve. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 260 10 "Important:" }{TEXT -1 60 " Even though this backgr ound is provided in Maple, you are " }{TEXT 261 3 "not" }{TEXT -1 193 " required to use Maple for any part of your project. If you have ano ther package or method that you wish to use to produce your report, yo u are very welcome to use the tools that you prefer. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 42 "Background Materi al: Approximating Things" }}{PARA 0 "" 0 "" {TEXT -1 185 "This sectio n contains some basic background on Lagrange and Bezier polynomials. \+ It also contains some graphing tools that you might find useful in pro ducing your final project report. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {SECT 1 {PARA 4 "" 0 "" {TEXT -1 18 "Bezier Polynomials" }}{PARA 0 "" 0 "" {TEXT -1 415 "This approach is probably the method most used in c omputer aided design (as well as most computer graphics) to generate c urves with nice properties. The functions are called Bezier polynomia ls because they were first studied and used by a man named de Castelja u (who was working for Citroen Automotive in France and they considere d his work a company secret... so Bezier published his work and he got the credit). " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 2 "A " }{TEXT 265 23 "cubic Bezier polynomial" }{TEXT -1 32 " is obtained by specifying four " }{TEXT 263 14 "control points" } {TEXT -1 2 ", " }{XPPEDIT 18 0 "P[0]" "&%\"PG6#\"\"!" }{TEXT -1 2 ", \+ " }{XPPEDIT 18 0 "P[1]" "&%\"PG6#\"\"\"" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "P[2]" "&%\"PG6#\"\"#" }{TEXT -1 6 ", and " }{XPPEDIT 18 0 "P[3] " "&%\"PG6#\"\"$" }{TEXT -1 239 ". The curve does not go through all four points, only the first and the last. The remaining two points c ontrol the slope at the endpoints. In fact, the slope of the cubic at the first endpoint is equal to the slope of the line joining " } {XPPEDIT 18 0 "P[0]" "&%\"PG6#\"\"!" }{TEXT -1 4 " to " }{XPPEDIT 18 0 "P[1]" "&%\"PG6#\"\"\"" }{TEXT -1 63 ". There is a similar propert y at the other end of the curve. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 39 " The curves are given parametrically: " }}{PARA 257 "" 0 "" {XPPEDIT 18 0 "x := c[0]*(1-t)^3+3*c[1]*t*(1-t)^2+ 3*c[2]*t^2*(1-t)+c[3]*t^3" ">%\"xG,**&&%\"cG6#\"\"!\"\"\"*$,&F*F*%\"tG !\"\"\"\"$F*F***F/F*&F'6#F*F*F-F*,&F*F*F-F.\"\"#F***F/F*&F'6#F4F*F-F4, &F*F*F-F.F*F**&&F'6#F/F**$F-F/F*F*" }{TEXT -1 2 " " }}{PARA 0 "" 0 " " {TEXT -1 3 "and" }}{PARA 258 "" 0 "" {TEXT -1 4 " " }{XPPEDIT 18 0 "y := d[0]*(1-t)^3+3*d[1]*t*(1-t)^2+3*d[2]*t^2*(1-t)+d[3]*t^3" ">%\" yG,**&&%\"dG6#\"\"!\"\"\"*$,&F*F*%\"tG!\"\"\"\"$F*F***F/F*&F'6#F*F*F-F *,&F*F*F-F.\"\"#F***F/F*&F'6#F4F*F-F4,&F*F*F-F.F*F**&&F'6#F/F**$F-F/F* F*" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 33 "In \+ these formulae, the constants " }{XPPEDIT 18 0 "c[j] " "&%\"cG6#%\"jG " }{TEXT -1 4 "and " }{XPPEDIT 18 0 "d[j]" "&%\"dG6#%\"jG" }{TEXT -1 59 " are the coordinates of the control points, so for example " } {XPPEDIT 18 0 "P[0] = (c[0],d[0])" "/&%\"PG6#\"\"!6$&%\"cG6#F&&%\"dG6# F&" }{TEXT -1 64 ". You can check that the curve has the following properties:" }}{PARA 0 "" 0 "" {TEXT -1 15 " (1) it hits " } {XPPEDIT 18 0 "P[0]" "&%\"PG6#\"\"!" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "P[3]" "&%\"PG6#\"\"$" }{TEXT -1 45 " (these are the endpoints of th e segment) at " }{XPPEDIT 18 0 "t=0" "/%\"tG\"\"!" }{TEXT -1 5 " and \+ " }{XPPEDIT 18 0 "t=1" "/%\"tG\"\"\"" }{TEXT -1 16 ", respectively. " }}{PARA 0 "" 0 "" {TEXT -1 20 " (2) the slope at " }{XPPEDIT 18 0 "P [0]" "&%\"PG6#\"\"!" }{TEXT -1 51 " is the same as the slope of the li ne segment from " }{XPPEDIT 18 0 "P[0]" "&%\"PG6#\"\"!" }{TEXT -1 4 " \+ to " }{XPPEDIT 18 0 "P[1]" "&%\"PG6#\"\"\"" }{TEXT -1 18 " and the slo pe at " }{XPPEDIT 18 0 "P[3]" "&%\"PG6#\"\"$" }{TEXT -1 51 " is the sa me as the slope of the line segment from " }{XPPEDIT 18 0 "P[2]" "&%\" PG6#\"\"#" }{TEXT -1 4 " to " }{XPPEDIT 18 0 "P[3]" "&%\"PG6#\"\"$" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 28 "The lengt hs of the segments " }{XPPEDIT 18 0 "P[0]" "&%\"PG6#\"\"!" }{TEXT -1 1 " " }{XPPEDIT 18 0 "P[1]" "&%\"PG6#\"\"\"" }{TEXT -1 10 " and and \+ " }{XPPEDIT 18 0 "P[2]*P[3]" "*&&%\"PG6#\"\"#\"\"\"&F$6#\"\"$F'" } {TEXT -1 47 " also have an effect on the shape of the curve." }}{PARA 0 "" 0 "" {TEXT -1 51 "The following procedures generate Brezier curve s. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 101 "bezX := proc(c0,c1,c2,c3,t) \n c0*(1-t)^3+3* c1*t*(1-t)^2 + 3*c2*t^2*(1-t) +c3*t^3\n end;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 101 "bezY := proc(d0,d1,d2,d3,t) \n d 0*(1-t)^3+3*d1*t*(1-t)^2 + 3*d2*t^2*(1-t) +d3*t^3\n end;" }}} {PARA 0 "" 0 "" {TEXT -1 68 "You can check one of the basic properties by computing the slope at " }{XPPEDIT 18 0 "t=0" "/%\"tG\"\"!" } {TEXT -1 2 " :" }{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "dX := diff(bezX(c0,c1,c2,c3,t),t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "dY := diff(bezY(d0,d1,d2,d3,t),t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "slope := subs(t=0,dY)/subs(t=0,dX);" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 264 34 "Example \+ #1: Plug in some numbers" }}{PARA 0 "" 0 "" {TEXT -1 95 "The followi ng curve connects (1,1) to (4,0) with control points in between to \"b end\" the curve:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "bezX(1,2 ,3,4,t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "bezY(1,1.5,1,0, t);" }}}{PARA 0 "" 0 "" {TEXT -1 3 " " }}{PARA 0 "" 0 "" {TEXT -1 108 "Now generate some plots. These will show the lines joining the c ontrol points as well as the Bezier curve. " }}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 29 "with(plots): with(plottools):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "leftline := line([0,1], [1,1.5], color=blue, \+ linestyle=1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "rightline \+ := line([3,1],[4,0],color=blue,linestyle=1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 76 "plotcurve2 := plot([bezX(0,1,3,4,t),bezY(1,1.5,1 ,0,t),t=0..1],\nthickness=2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 116 "display(\{leftline,rightline,plotcurve2\},view=[-1..5,-1..2],\n axes=boxed,title=`Bezier Curve with Control Points`);" }}}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 13 "More Examp les" }}{PARA 0 "" 0 "" {TEXT -1 99 "You can copy the code above and ch ange the number to see how the control points change the curve. " }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "leftline := line([0,0], [2,1 ], color=blue, linestyle=1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "rightline := line([3,0],[5,1],color=blue,linestyle=1):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 74 "plotcurve2 := plot([bezX(0,2 ,5,3,t),bezY(0,1,1,0,t),t=0..1], thickness=3):" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 99 "display(\{leftline,rightline,plotcurve2\},view =[-1..5,-1..2],\n axes=boxed,title=`Bezier Curve #2`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "leftline := line([1,0], [5,1], colo r=blue, linestyle=1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "ri ghtline := line([0,1],[4,0],color=blue,linestyle=1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 74 "plotcurve2 := plot([bezX(1,5,0,4,t),bezY( 0,1,1,0,t),t=0..1], thickness=3):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 99 "display(\{leftline,rightline,plotcurve2\},view=[-1..6 ,-1..2],\n axes=boxed,title=`Bezier Curve #3`);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 58 "leftline := line([0,0], [0,100], color=blue, linestyle=1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "rightline := line([2,0],[5,0],color=blue,linestyle=1):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 76 "plotcurve2 := plot([bezX(0,0,2,5,t),bezY(0,100,0 ,0,t),t=0..1], thickness=3):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "display(\{leftline,rightline,plotcurve2\},\n axes=boxed,title= `Bezier Curve #4`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 10 "A rc Length" }}{PARA 0 "" 0 "" {TEXT -1 145 "A little Calculus with Bezi er curves. These are parametric curves and so you can compute arc len gth the way you would for any parametric curve. " }}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 30 "dx := diff(bezX(1,2,3,4,t),t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "dy := diff(bezY(1,1.5,1,0,t),t);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "AL := Int(sqrt(dx^2+dy^2), t=0..1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "evalf(AL);" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 22 "Plotting the Obstacles" }}{PARA 0 "" 0 " " {TEXT -1 82 "This is the code used to generate the picture back at t he start of the worksheet. " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "with(plots): with(plottools):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "eq := (x-x0)^2/a^2 + (y-y0)^2/b^2 = 1;\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "a := 2: b := 2: x0 := -2; y0:=0;" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "ellA := ellipse([x0,y0], a , b, filled=true, color=blue):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "rectA :=rectangle([0.5,0],[4.9,2.5],color=blue):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "x[0] :=-6: x[1] := -2: x[2] := 0: x [3] := 8:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "y[0] := 0: y[1 ] := -3: y[2] := 3: y[3] := 0:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "for n from 0 to 3 do \n p[n] := disk([x[n],y[n]],0.2,color= red):\n od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 145 "display(\{ ellA,rectA,p[0],p[1],p[2],p[3]\},\n scaling=constrained,axes=boxed,vi ew=[-7..11,-5..7],\n title=`Two Obstacles with Four Target Points`); " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 20 "Lagrange Polynom ials" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 234 " Here is the basic approach to building Lagrange interpolating polynomi als. (Take a look in your book for more information.) You start by b uilding \"simple functions\" which have the property that each is +1 a t a one integer value for " }{XPPEDIT 18 0 "t" "I\"tG6\"" }{TEXT -1 29 " and 0 at each other integer " }{XPPEDIT 18 0 "t" "I\"tG6\"" } {TEXT -1 21 " in a certain range: " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "alpha[0] := (t-1)*(t-2)*(t-3)*(t-4)/((0-1)*(0-2)*(0-3 )*(0-4));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "alpha[1] := (t -0)*(t-2)*(t-3)*(t-4)/((1-0)*(1-2)*(1-3)*(1-4));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "alpha[2] := (t-0)*(t-1)*(t-3)*(t-4)/((2-0)*(2 -1)*(2-3)*(2-4));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "alpha[ 3] := (t-0)*(t-1)*(t-2)*(t-4)/((3-0)*(3-1)*(3-2)*(3-4));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "alpha[4] := (t-0)*(t-1)*(t-2)*(t-3) /((4-0)*(4-1)*(4-2)*(4-3));" }}}{PARA 0 "" 0 "" {TEXT -1 10 "Note that " }{XPPEDIT 18 0 "alpha[2](t)" "-&%&alphaG6#\"\"#6#%\"tG" }{TEXT -1 10 " is +1 at " }{XPPEDIT 18 0 "t=2" "/%\"tG\"\"#" }{TEXT -1 11 ", but 0 at " }{XPPEDIT 18 0 "t=0" "/%\"tG\"\"!" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "t=1" "/%\"tG\"\"\"" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "t=3" "/%\"t G\"\"$" }{TEXT -1 6 ", and " }{XPPEDIT 18 0 "t=4" "/%\"tG\"\"%" } {TEXT -1 1 ":" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "plot(alpha[ 2],t=-1..5,view=[-1..5,-1..1.5]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 41 "For any specified li st of five points, ( " }{XPPEDIT 18 0 "(x[j],y[j])" "6$&%\"xG6#%\"jG&% \"yG6#F&" }{TEXT -1 72 " ), you can now build a function that goes th rough these points. Do it:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 143 "lagX := proc(x0,x1,x2,x3,x4,t) \n x0*alpha[0] + x1*al pha[1] + x2*alpha[2]\n + x3*alpha[3] + x4*alpha[4]\n \+ end;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 144 "lagY := pro c(y0,y1,y2,y3,y4,t) \n y0*alpha[0] + y1*alpha[1] + y2*alph a[2] \n + y3*alpha[3] + y4*alpha[4]\n end;" }} }{PARA 0 "" 0 "" {TEXT -1 130 "Now specify the points: I'll use (-2,2 ), (-1, 1/10 ), ( 0, -1 ), ( 1, 0 ), and ( 2, 7 ) for the first examp le. Notice that the " }{XPPEDIT 18 0 "x" "I\"xG6\"" }{TEXT -1 22 " co ordinate goes into " }{TEXT 0 4 "lagX" }{TEXT -1 9 " and the " } {XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 22 " coordinate goes into " } {TEXT 0 4 "lagY" }{TEXT -1 3 ". " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "lX := lagX(-2,-1,0,1,2,t); lY := lagY(2,1/10,-1,0,7,t );" }}}{PARA 0 "" 0 "" {TEXT -1 67 "This is the parametric representat ion for the polynomial (you have " }{XPPEDIT 18 0 "x" "I\"xG6\"" } {TEXT -1 5 " and " }{XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 26 " as sep arate functions of " }{XPPEDIT 18 0 "t" "I\"tG6\"" }{TEXT -1 51 "). Yo u plot parametric curves inthe following way: " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "plot([lX,lY,t=-1..5]);" }}}{PARA 0 "" 0 "" {TEXT -1 45 "Notice that I added square brackets, put the " }{XPPEDIT 18 0 "x " "I\"xG6\"" }{TEXT -1 4 "and " }{XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 72 " coordinates inside the brackets along with the range fo r the parameter " }{XPPEDIT 18 0 "t" "I\"tG6\"" }{TEXT -1 2 ". " }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 84 "Just for \+ fun, you can put the interpolating points on the graph also. You need the " }{HYPERLNK 17 "plottools" 2 "plottools" "" }{TEXT -1 17 " libra ry and the " }{HYPERLNK 17 "disk" 2 "disk" "" }{TEXT -1 82 " command. \+ (I find that plotting points give you points that are too small to see .)" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "with(plottools):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "plotcurve := plot([lX,lY,t=- 1..4]):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "p1 := disk([-2,2 ], 0.05, color=red):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "p2 \+ := disk([-1,1/10], 0.05, color=red):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "p3 := disk([0,-1], 0.05, color=red):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "p4 := disk([1,0], 0.05, color=red): " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "p5 := disk([2,7], 0.05, color=red):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "display(\{pl otcurve,p1,p2,p3,p4,p5\},\n axes=normal,title=`Lagrange and 5 Points `);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 0 {PARA 5 "" 0 "" {TEXT -1 18 "Approximate arctan" }}{PARA 0 "" 0 "" {TEXT -1 204 "One more ex ample: The following tries to fit a polynomial to the arctan curve. \+ You should remember that Taylor had trouble doing this outside the int erval ( -1,1 ) . (Lagrange has its own problems...)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 68 "I'll try to streamline some of the work done for the last example. " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "x[0] := -3: x[1] := -1: x[2] := 0: x[3] := 4: x[ 4] := 6:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "for n from 0 to 4 do \n y[n] := arctan(x[n]):\n od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "lX := lagX(x[0],x[1],x[2],x[3],x[4],t): \nlY := lagY( y[0],y[1],y[2],y[3],y[4],t):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "for n from 0 to 4 do \n p[n] := disk([x[n],y[n]],0.05,color=r ed):\n od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "plotcurve := plot(arctan(x),x=-6..6,thickness=2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "plotpoly := plot([lX,lY,t=-2..4],color=black):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 118 "display(\{plotpoly,plotcurv e,p[0],p[1],p[2],p[3],p[4]\},\ntitle=`arctan(x) and Lagrange Polynomia l`,\nview=[-6..6,-2..2]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 42 "Not great... how could you make it \+ better?" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 " " }}}{MARK "12 4" 0 }{VIEWOPTS 1 1 0 1 1 1803 }