{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 1 36 0 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 1 14 0 0 0 0 0 0 0 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 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Warning" -1 7 1 {CSTYLE "" -1 -1 "Courier " 1 10 0 0 255 1 2 2 2 2 2 1 1 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 } {PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT 256 15 "Baseball Maplet" }} {PARA 256 "" 0 "" {TEXT 257 35 "Sylvain Muise\n" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 370 "This maplet constructs and displays a baseball field. You can control the dimensi ons of the field by specifying distances from home base to left field, center left field, center field, center right field, and right field. You can then specify a direction and original velocity of the basebal l as it leaves home plate, and the maplet will display the path of the ball. \n\n" }{TEXT 258 96 "To run this maplet, click the \"Execute-Wo rksheet\" button in the tool-bar menu (the !!! button)\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 99 "restart: with(plots): with(plottool s): with(LinearAlgebra): with(Maplets): with(Maplets[Elements]):" }} {PARA 7 "" 1 "" {TEXT -1 50 "Warning, the name changecoords has been r edefined\n" }}{PARA 7 "" 1 "" {TEXT -1 43 "Warning, the name arrow has been redefined\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5969 "#### ###################################################################### \n### Maple Code which computes the path of the baseball and displays \+ it ###\n############################################################## ############\n\n\n# maple procedure which figures out trajectory of ba seball, and draws the field along with the path of the ball. It finds \+ the equation of motion of the ball assuming that it is only under the \+ influence of the force of gravity towards the earth, no wind of fricti on effects.\nhit := proc(Mass, veloc, TH, PH,Left, Left_Center, Center , Right_Center, Right, thview, phview) \n local vel, m, p1, p2, p3, p 4, p5, p6, p7, p8, p9, p10, r, M, g, DE, DEx, DEy, DEz, diffeqs, funcs , initconds, sol, solx, soly, solz, T, zMax, xMax, yMax, plot1, n, i, \+ lines, left, left_center, center, right_center, right, left_center_lef t, left_center_right, right_center_left, right_center_right, conv:\n# \+ This part of the proc constructs the actual field, and defines all pol ygons of which it is made up.\n conv := 0.3048:\n left := conv * Lef t:\n left_center := conv * Left_Center:\n center := conv * Center:\n right_center := conv * Right_Center:\n right := conv * Right:\n le ft_center_left := conv * (Left + Left_Center) / 2:\n left_center_righ t := conv * (Left_Center + Center) / 2:\n right_center_left := conv * (Center + Right_Center) / 2:\n right_center_right := conv * (Right_C enter + Right) / 2:\n vel := veloc * 5 / 18: m := (28.35 * Mass) / 10 00:\n p1 := polygon([[0,0,0],[0,left,0], [left_center_left*cos(78.75* Pi/180), left_center_left*sin(78.75*Pi/180), 0], [left_center*cos(67 .5*Pi/180),left_center*sin(67.5*Pi/180),0], [left_center_right*cos(56. 25*Pi/180), left_center_right*sin(56.25*Pi/180), 0], [center*cos(45* Pi/180), center*sin(45*Pi/180), 0], [right_center_left*cos(33.75*Pi/18 0), right_center_left*sin(33.75*Pi/180), 0], [right_center*cos(22.5*Pi /180), right_center*sin(22.5*Pi/180), 0], [right_center_right*cos(11.2 5*Pi/180), right_center_right*sin(11.25*Pi/180), 0], [right, 0, 0], [0 ,0,0]], color=green):\n p2 := polygon([[0,0,0.01], [0,conv*120,0.01], [conv*120,conv*120,0.01], [conv*120,0,0.01], [0,0,0.01]], color=tan): \n p3 := polygon([[0, left, 0],[left_center_left*cos(78.75*Pi/180), l eft_center_left*sin(78.75*Pi/180), 0],[left_center_left*cos(78.75*Pi/1 80), left_center_left*sin(78.75*Pi/180), 9*conv],[0, left, 9*conv]], c olor=brown):\n p4 := polygon([[left_center_left*cos(78.75*Pi/180), le ft_center_left*sin(78.75*Pi/180), 0],[left_center_left*cos(78.75*Pi/18 0), left_center_left*sin(78.75*Pi/180), 9*conv], [left_center*cos(67.5 *Pi/180), left_center*sin(67.5*Pi/180), 9*conv], [left_center*cos(67.5 *Pi/180), left_center*sin(67.5*Pi/180), 0]], color=brown):\n p5 := po lygon([[left_center*cos(67.5*Pi/180), left_center*sin(67.5*Pi/180), 9* conv], [left_center*cos(67.5*Pi/180), left_center*sin(67.5*Pi/180), 0] , [left_center_right*cos(56.25*Pi/180), left_center_right*sin(56.25*Pi /180), 0], [left_center_right*cos(56.25*Pi/180), left_center_right*sin (56.25*Pi/180), 9*conv]], color=brown):\n p6 := polygon([[left_center _right*cos(56.25*Pi/180), left_center_right*sin(56.25*Pi/180), 0], [le ft_center_right*cos(56.25*Pi/180), left_center_right*sin(56.25*Pi/180) , 9*conv], [center*cos(45*Pi/180), center*sin(45*Pi/180), 9*conv], [ce nter*cos(45*Pi/180), center*sin(45*Pi/180), 0]], color=brown):\n p7 : = polygon([[center*cos(45*Pi/180), center*sin(45*Pi/180), 9*conv], [ce nter*cos(45*Pi/180), center*sin(45*Pi/180), 0], [right_center_left*cos (33.75*Pi/180), right_center_left*sin(33.75*Pi/180), 0], [right_center _left*cos(33.75*Pi/180), right_center_left*sin(33.75*Pi/180), 9*conv]] , color=brown):\n p8 := polygon([[right_center_left*cos(33.75*Pi/180) , right_center_left*sin(33.75*Pi/180), 0], [right_center_left*cos(33.7 5*Pi/180), right_center_left*sin(33.75*Pi/180), 9*conv], [right_center *cos(22.5*Pi/180), right_center*sin(22.5*Pi/180), 9*conv], [right_cent er*cos(22.5*Pi/180), right_center*sin(22.5*Pi/180), 0]], color=brown): \n p9 := polygon([[right_center*cos(22.5*Pi/180), right_center*sin(22 .5*Pi/180), 9*conv], [right_center*cos(22.5*Pi/180), right_center*sin( 22.5*Pi/180), 0], [right_center_right*cos(11.25*Pi/180), right_center_ right*sin(11.25*Pi/180), 0], [right_center_right*cos(11.25*Pi/180), ri ght_center_right*sin(11.25*Pi/180), 9*conv]], color=brown):\n p10 := \+ polygon([[right_center_right*cos(11.25*Pi/180), right_center_right*sin (11.25*Pi/180), 0], [right_center_right*cos(11.25*Pi/180), right_cente r_right*sin(11.25*Pi/180), 9*conv], [right, 0, 9*conv], [right, 0, 0]] , color=brown):\n# This part of the proc figures out the trajectory o f ball according to gravity.\n r := t -> Vector([x(t), y(t), z(t)]): \n g := 9.8:\n DE := m * (map(diff,r(t),t$2)) = [0,0,-m*g]:\n DEx : = lhs(DE)[1] = rhs(DE)[1]:\n DEy := lhs(DE)[2] = rhs(DE)[2]:\n DEz : = lhs(DE)[3] = rhs(DE)[3]:\n diffeqs := DEx, DEy, DEz:\n funcs := x( t), y(t), z(t):\n initconds := x(0) = 0, y(0) = 0, z(0) = 3*conv, D(x )(0) = vel * cos(PH*Pi/180) * cos(TH*Pi/180), D(y)(0) = vel * cos(PH*P i/180) * sin(TH*Pi/180), D(z)(0) = vel * sin(PH*Pi/180):\n sol := dso lve(\{diffeqs, initconds\},\{funcs\}, numeric):\n solx := s -> subs(s ol(s),x(t)):\n soly := s -> subs(sol(s),y(t)):\n solz := s -> subs(s ol(s),z(t)):\n T := fsolve('solz(t)=0',t,0..100):\n zMax := max(80,s olz(T/2)):\n xMax := max(right_center_right,solx(T),right,right_cente r_left,center,left_center_right,left_center,left_center_left,left):\n \+ yMax := max(left_center_left,soly(T),left,left_center,left_center_rig ht,center,right_center_left,right_center,right_center_right,right):\n \+ plot1 := spacecurve(['solx(t)', 'soly(t)', 'solz(t)'], t=0..T, color= red,thickness=7):\n n := 15:\n for i from 0 to n do\n lines[i] := line([solx(i*T/n), soly(i*T/n), 0], [solx(i*T/n), soly(i*T/n), solz(i *T/n)], color=black, thickness=4): \n end do:\n display([p1,p2,p3,p 4,p5,p6,p7,p8,p9,p10,plot1, seq(lines[i], i=0..n)],scaling=constrained , view=[0..xMax,0..yMax,0..zMax], orientation=[thview,phview]);\nend p roc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1681 "\n############### #########################\n### Maple code for Maplet Definition ###\n# #######################################\n\n\n# Maplet definition, defi nes all input text boxes and output plotter.\nbaseball := Maplet(\n# W indow definition\n Window('title' = Baseball, menubar=MB1, 'layout' = BL1),\n MenuBar[MB1](Menu(\"File\", MenuItem(\"Close\", Shutdown())) ),\n# layout definition\n BoxLayout[BL1](inset=0,\n# First column whi ch contains the plotter and two slider bars which control the viewpoin t.\n BoxColumn(inset=0, spacing=0,\n BoxRow(inset=0, spacing=0 ,\n Plotter[P1](hit(5,0,0,0,325,375,404,375,325,-52,55)),\n \+ Slider[PHVIEW](lower=-90,filled=true,majorticks=30,minorticks=10,o rientation=vertical,snapticks=false,upper=90,value=55)\n ),\n \+ Slider[THVIEW](lower=-180,filled=true,majorticks=30,minorticks=10,or ientation=horizontal,snapticks=false,upper=180,value=-52)\n ),\n# S econd column which holds all text fields used for entering data to the program\n BoxColumn(inset=0, spacing=0,\n \"Left Field (ft): \",\n TextField[LF](5,\"325\"),\n \"Center Left Field (ft): \",\n TextField[CLF](5,\"375\"),\n \"Center Field (ft):\",\n TextField[CF](5,\"404\"),\n \"Center Right Field (ft):\",\n TextField[CRF](5,\"375\"),\n \"Right Field (ft):\",\n \+ TextField[RF](5,\"325\"),\n \"Mass (Oz):\",\n TextField[MASS ](5,\"5\"),\n \"Velocity (kph):\",\n TextField[VELOCITY](5, \"125\"),\n \"Direction (0=RightField, 90=LeftField):\",\n T extField[THETA](5,\"45\"), \n \"Angle (0=Horiz, 90=Vert):\",\n \+ TextField[PHI](5,\"45\"),\n Button(\"Go\",Evaluate(P1 = 'hit(M ASS,VELOCITY,THETA,PHI,LF,CLF,CF,CRF,RF,THVIEW,PHVIEW)'))\n )\n ) \n):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "Display(baseball); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "1 0 1" 0 }{VIEWOPTS 1 1 0 3 4 1802 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }