{VERSION 6 0 "IBM INTEL NT" "6.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 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 1 18 0 0 0 0 0 0 0 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 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Tim es" 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 "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 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 {PARA 256 "" 0 "" {TEXT 256 45 "Calculus Exploration 5: Motion in 1 Dimension" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT 257 59 "The following is the Maple code for the \+ 1-D Motion Maplet. " }{TEXT -1 0 "" }{TEXT 258 228 "In this exploratio n, you should use the 1-D Motion Maplet to investigate position, veloc ity, and acceleration functions, i.e. s(t), v(t), and a(t), for motion in 1 dimension with with both constant and nonconstant acceleration. \+ " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 10 "1-D Motion" }}{EXCHG {PARA 0 "" 0 "" {TEXT 259 36 "Click in red ar ea and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9792 "# Original Author: Douglas Meade\n# Modified to the current ve rsion by John Pais, 10-02-05\nrestart:\nLinMotionEval := proc( EXPR, S , V, A, t, T, old_str )\n local str, val1, val2;\n val1 := eval( EXP R, [ s=S, v=V, a=A ] );\n val2 := eval( val1, t = T );\n str := spri ntf( \"%a = %a, when %a = %a\", EXPR, val2, t, T );\n return str\nend proc:\nLinMotionSolve := proc( EQN, S, V, A, t, old_str )\n local eq n, sol, str;\n eqn := eval( EQN, [ s=S, v=V, a=A ] );\n sol := solve ( eqn, t );\n str := sprintf( \"%a, for %a=%a\", EQN, t, \{sol\});\n \+ return str\nend proc:\nLinMotionPlot := proc( S, V, A, t, T, Y, EXEC \+ )\n local p_list, c_list, s_list, ls_list, cmd;\n p_list := NULL;\n \+ c_list := NULL;\n s_list := NULL;\n ls_list := NULL;\n if S[2] the n\n p_list := p_list, S[1];\n c_list := c_list, S[3];\n if S[ 4]='POINT' then\n s_list := s_list, S[4];\n ls_list := ls_li st, 'SOLID';\n else\n s_list := s_list, 'LINE';\n ls_list := ls_list, S[4];\n end if\n end if;\n if V[2] then\n p_list \+ := p_list, V[1];\n c_list := c_list, V[3];\n if V[4]='POINT' the n\n s_list := s_list, V[4];\n ls_list := ls_list, 'SOLID';\n else\n s_list := s_list, 'LINE';\n ls_list := ls_list, V [4];\n end if\n end if;\n if A[2] then\n p_list := p_list, A[1 ];\n c_list := c_list, A[3];\n if A[4]='POINT' then\n s_lis t := s_list, A[4];\n ls_list := ls_list, 'SOLID';\n else\n \+ s_list := s_list, 'LINE';\n ls_list := ls_list, A[4];\n end \+ if\n end if;\n cmd := sprintf( \"plot( %a, %a=%a, view=[%a,%a], colo r=%a, style=%a, linestyle=%a )\",\n [p_list], t, T, \+ T, Y, [c_list], [s_list], [ls_list] );\n if EXEC then\n return par se( cmd, statement )\n else\n return cmd\n end if\nend proc:\n_CO LORS := ['blue', 'cyan', 'brown', 'gold', 'green', 'khaki', \n 'magenta', 'maroon', 'orange', 'pink', 'plum', 're d',\n 'sienna', 'tan', 'turquoise', 'violet', 'wheat', \+ 'yellow']:\n_STYLES := ['SOLID', 'POINT','DOT','DASHDOT']:\nuse Maplet s, Maplets:-Elements in\n\nLinMotion := Maplet(\n\n################ wi ndow layout ################\n Window(\n 'title' = \"Analysis of Motion in 1 Dimension\",\n BoxRow(\n 'hscroll' = as _needed,\n 'vscroll' = as_needed,\n [ # c 1 - plot w indow and control\n [ # r 1\n Plotter['PL1']( 'hei ght' = 400,\n plot( -4.9*t^2+5*t+12, t=0..5, color=blue, view=[0..5,0..15] ) )\n ], # r 1\n [ # \+ r 2\n GridLayout(\n [ # c 1\n [ # \+ r 1\n \"Horizontal axis\",\n TextField['t0'] ( 'value' = 0, 'width' = 4 ),\n \" <= \",\n \+ TextField['t']( 'value' = \"t\", 'width' = 4, editable=false,\n \+ 'onchange' = Action(Evaluate('t2'='sprintf(\"% s =\",t)'),\n Evaluat e( 'v' = 'diff(s,t)' ),\n \+ Evaluate( 'a' = 'diff(v,t)' ) ) ),\n \" <= \",\n \+ TextField['t1']( 'value' = 5, 'width' = 4 )\n ], # r 1\n [ # r 2\n \"Vertical axis\",\n \+ TextField['y0']( 'value' =0, 'width' = 4 ),\n \" <= \",\n TextField['y']( 'value' = \"s\", 'width' = 4, e ditable=false ),\n \" <= \",\n TextField['y1 ']( 'value' = 15, 'width' = 4 )\n ] # r 2\n ] \+ # c 1\n )\n ], # r 2\n\n######################## ####### Interchanged row 4 and row 3\n [ # r 4\n \+ Button( \"Display Functions and Plot\",\n 'onclick' \+ =\n Evaluate('PL1'\n \+ = 'LinMotionPlot( [s,s_plot,s_color,s_style], [v,v_plot,v_color,v_sty le], [a,a_plot,a_color,a_style], t, t0..t1, y0..y1, true )')\n \+ ),\n Button( \"Reset to Original Functions\",\n \+ 'onclick' = 'reset'\n ),\n Bu tton( \"Exit\",\n Shutdown()\n )\n \+ ], # r 4\n\n###############################\n\n [ \+ # r 3 - plot command\n BoxLayout( 'border' = true, 'caption ' = \"Plot Commands\",\n [\n [\n T extBox['plot_cmds']( 4..50 )\n ],\n [\n \+ Button( \"Show plot command\",\n 'onclick' = 'show_cmd'\n ),\n Button( \"Clear p lot commands\",\n 'onclick' = SetOption( 'plot_cm ds' = \" \" )\n )\n ]\n ]\n \+ )\n ] # r 3\n\n###############################\n\n ],\n [ # c 2 - pos, vel, acc\n [ # r 1 - po sition\n BoxLayout( 'border' = true, 'caption' = \"Position \",\n [\n [\n \"s(t) =\",\n \+ TextField['s']( 'value' = \"-4.9*t^2+5*t+12\",\n \+ 'onchange' = Action(Evaluate( 'v' = 'diff(s,t)' ),\n \+ Evaluate( 'a' = 'diff(v ,t)' ) ),\n 'width' = 30 )\n \+ ],\n [\n CheckBox['s_plot']( 'value' = 'true' , 'caption' = \"Include in plot\" ),\n \"Color:\",\n \+ ComboBox['s_color']( 'blue', _COLORS ),\n \"Styl e:\",\n ComboBox['s_style']( 'SOLID', _STYLES )\n \+ ]\n ]\n )\n ], # r 1\n [ \+ # r 2 - velocity\n BoxLayout( 'border' = true, 'caption' = \+ \"Velocity\",\n [\n [\n \"v(t) =\" ,\n TextField['v']( 'value' = \"-9.8*t+5\",\n \+ 'onchange' = Evaluate( 'a' = 'diff(v,t)' ),\n \+ 'width' = 30 )\n ],\n [ \n CheckBox['v_plot']( 'value' = 'false', 'caption' = \"I nclude in plot\" ),\n \"Color:\",\n ComboBox ['v_color']( 'red', _COLORS ),\n \"Style:\",\n \+ ComboBox['v_style']( 'SOLID', _STYLES )\n ]\n \+ ]\n )\n ], # r 2\n [ # r 3 - accelerati on\n BoxLayout( 'border' = true, 'caption' = \"Acceleration \",\n [\n [\n \"a(t) =\",\n \+ TextField['a']( 'value' = \"-9.8\", 'width' = 30 )\n \+ ],\n [\n CheckBox['a_plot']( 'value' = 'fal se', 'caption' = \"Include in plot\" ),\n \"Color:\",\n \+ ComboBox['a_color']( 'magenta', _COLORS ),\n \+ \"Style:\",\n ComboBox['a_style']( 'SOLID', ['SOLID', 'PO INT','DOT','DASH','DASHDOT'] )\n ]\n ]\n \+ )\n ], # r 3\n [ # r 4 - evaluate or solve\n \+ BoxLayout( 'border' = true, 'caption' = \n \"Ev aluate functions s, v, a and/or solve equation involving s, v, a.\",\n [\n [\n \"Enter function (use s, \+ v, a)\",\n TextField['expr']( 'value' = \"\", 'width' = 5 ),\n \"enter \",\n TextField['t2']( 'value' = \"t = \", width=3, editable=false ),\n TextField['t_va lue']( 'value' = \"\", 'width' = 10 )\n ],\n############## ##### Reorganized this section\n [Button( \"Evaluate funct ion at given value\",\n 'onclick' = 'eval_expr'\n )],\n\n [\n \"Enter equat ion to be solved (use s, v, a)\",\n TextField['eqn']( 'va lue' = \"\", 'width' = 20 )\n ],\n [Button( \"A ttempt to solve equation\",\n 'onclick' = 'solve_ eqn'\n )],\n\n\n [\n TextB ox['results']( 4..50, \"\",\n 'editab le' = false )#, 'quotedtext' = true )\n ],\n [ \n Button( \"Clear results\",\n \+ 'onclick' = SetOption( 'results' = '\"\"' )\n \+ )\n ]\n ]\n )\n ] # e nd r 4\n ] # end c 2\n )\n ),\n\n############### # action definitions ################\n Action['reset'](\n \+ SetOption( 't0' = 0 ),\n SetOption( 't1' = 5 ),\n Set Option( 'y0' =0 ),\n SetOption( 'y1' = 15 ),\n SetOption ( 's' = \"-4.9*t^2+5*t+12\" ),\n SetOption( 'v' = \"-9.8*t+5 \" ),\n SetOption( 'a' = \"-9.8\" ),\n SetOption( 's_pl ot' = true ),\n SetOption( 'v_plot' = false ),\n SetOpti on( 'a_plot' = false ),\n SetOption( 's_color' = \"blue\" ),\n \+ SetOption( 'v_color' = \"red\" ),\n SetOption( 'a_color' = \"magenta\" ),\n SetOption( 's_style' = \"SOLID\" ),\n \+ SetOption( 'v_style' = \"SOLID\" ),\n SetOption( 'a_style' = \+ \"SOLID\" ),\n SetOption( 'plot_cmds' = \" \" ),\n SetOp tion( 'expr' = \"\" ),\n SetOption( 't_value' = \"\" ),\n \+ SetOption( 'eqn' = \"\" ),\n SetOption( 'results' = \"\" ),\n ##########################\n #SetOption( 't' = \"t\" ), #Removed - caused error on reset\n ########################## \n SetOption( 't2' = \"t = \" ),\n NULL \n \+ ),\n Action['show_cmd'](\n Evaluate( 'plot_cmds' \n = 'LinMotionPlot( [s,s_plot,s_color,s_style],\n \+ [v,v_plot,v_color,v_style],\n \+ [a,a_plot,a_color,a_style],\n \+ t, t0..t1, y0..y1, false )' )\n \+ ),\n Action['eval_expr'](\n Evaluate( 'r esults'\n = 'LinMotionEval( expr, s, v, a, t, t_val ue )' )\n ),\n Action['solve_eqn'](\n \+ Evaluate( 'results'\n = 'LinMotionSolve( eqn, s, \+ v, a, t )' )\n )\n):\n\nend use:\nMaplets:-Displa y(LinMotion);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}} {MARK "3 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }