/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 11.08.0 ] */ /* [wxMaxima: title start ] Motion Along A Straight Line, Part I: Position->Velocity->Acceleration [wxMaxima: title end ] */ /* [wxMaxima: comment start ] Chapter 3 Technology Application Project [wxMaxima: comment end ] */ /* [wxMaxima: section start ] Introduction [wxMaxima: section end ] */ /* [wxMaxima: comment start ] OBJECTIVE: To apply special Maxima functions to analyze position, velocity, and acceleration simultaneously. Note: There are no executable commands in this Introduction section. Structural engineers must design high-rise buildings to withstand earthquakes. When a high-rise building moves back and forth during an earthquake, the motion of any single floor is also back and forth along a straight, horizontal line. For earthquake design, the engineer must be able to completely describe the position, velocity, and acceleration of each of the floors as functions of time, and understand the relationships among these three functions. This provides the engineer with some of the information and understanding that is needed for the seismic design of the structure in a high- rise building. (In physics and engineering, the study of motion is called kinematics and falls in the realm of mechanics.) This module includes three specially designed Maxima commands that present dramatic animated visualizations of the derivative relations among the position, velocity, and acceleration. In addition to the seismic vibration of each floor in a building, a variety of other motions are investigated including constant velocity, constant acceleration, harmonic oscillation, and decaying oscillation. You can also use the specialized Maxima commands to study other motions that are of interest to you. To measure position along a line, we select a fixed point on the line as a reference point or origin, and we scale the line in appropriate units (e.g., meters, feet, or miles). A distance and a direction specify a position on the line. One direction from the reference point is taken as positive and the other direction as negative. Distance is measured using the units of scale along the line. Before looking at the vibrations of a building shaken by an earthquake, let's consider some other motions. This module uses three specially designed functions: velocity ( fnc, var, interval, periodic, fileprefix ), acceleration( fnc, var, time_interval, periodic, fileprefix ), posvelacc( fnc, var, time_interval, periodic, fileprefix ). [wxMaxima: comment end ] */ /* [wxMaxima: comment start ] NOTE: The special commands velocity( ), acceleration( ), and posvelacc( ) are not built-in Maxima functions and are only available in this module. The arguments for all three functions are: fnc: a list of position functions var: the variable used in the fnc list functions (usually t) interval: a list of time intervals of the form [x1,xn] over which the motion occurs (one interval for each function in the fnc list) periodic: a flag to indicate whether the motion is periodic or not. fileprefix: this is a string that will be placed at the beginning of the filename for the animated GIF file. In the Parts that follow you will see examples of how these functions are used. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] Technology Guidelines [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] NOTE: If you have just finished a document, restart Maxima before executing a new document. This can be done by choosing "Restart" from the Maxima menu. TO OPEN OR CLOSE CELLS Click on the arrow at the top of the cell bracket. TO STOP AN EXECUTION Click on STOP button from the toolbar. ORDER OF EXECUTION Execute commands in the order given. Do not skip any Maxima Input lines within a given document. Alternatively, you can execute the entire worksheet by selecting the "Evaluate All Cells" command from the "Cell" drop down menu or simply press Ctrl-r. SAVING WORKSHEETS You can save anytime to any directory you choose, and it is wise to save often. EXPERIENCING MAJOR PROBLEMS Save if appropriate, and then shut down Maxima and start it up again. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] Special Functions [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] The code that follows defines the three special functions that are used in this worksheet. You do not have to understand the code to do this worksheet, however, you will need to execute it in order to define the special functions that are used later. You can execute the code by placing the cursor anywhere in the input cell and then pressing Enter. After you execute the code in the next cell, proceed to Part I of the worksheet. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ load(draw)$ numer:true$ ratprint:false$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ velocity (fnc, var, interval, periodic, fileprefix) := block( intlen: length(interval), fnclen: length(fnc), if intlen#fnclen then block( print("The number of functions and number of intervals do not match. Try again."), return()), t_o: interval[1][1], t_f: interval[intlen][2], d1: diff(fnc, t, 1), d2: diff(fnc, t, 2), fmax: subst(t_o,var,fnc[1]), fmin: subst(t_o,var,fnc[1]), d1max: subst(t_o,var,d1[1]), d1min: subst(t_o,var,d1[1]), d2max: subst(t_o,var,d2[1]), d2min: subst(t_o,var,d2[1]), k: 1, for i: 1 thru 500 do block( tcurr: i*(t_f-t_o)/500, if tcurr>=interval[k][2] then k: k+1, if k<=fnclen then block( curr: subst(tcurr,var,fnc[k]), if curr>fmax then fmax: curr, if currd1max then d1max: curr, if curr= interval[k][2]) then k: k+1), draw( terminal = animated_gif, delay = 1, file_name = sconcat(fileprefix,"v_pos_time"), pos_time), vel_time: [], d1plot: [], ymargin: (d1max-d1min)*(marginpercent/100), ymin: d1min-ymargin, ymax: d1max+ymargin, k: 1, for i: t_o thru tend step inc do block( if(k<=fnclen) then block( arrow2: vector([i, 0],[0,subst(i,var,d1[k])]), for j: 1 thru k do block( if interval[j][2]i) then block( d1plot: append(d1plot,[explicit(d1[j],var,interval[j][1],i)]))), vel_time: append(vel_time, [gr2d( nticks=80, color=red, line_width=1, line_type=dots, d1plot, color=red, head_length=0.5, head_angle=15, line_width=3, line_type=solid, arrow2, xrange=[xmin, xmax], yrange=[ymin, ymax], title="velocity vs. time")])), if ( i+inc >= interval[k][2]) then k: k+1), draw( terminal = animated_gif, delay = 1, file_name = sconcat(fileprefix,"v_vel_time"), vel_time), objmot: [], ymargin: (fmax-fmin)*(marginpercent/100), ymin: fmin-ymargin, ymax: fmax+ymargin, k: 1, for i: t_o thru tend step inc do block( if(k<=fnclen) then block( point1: points([[(t_f-t_o)/2, subst(i,var,fnc[k])]]), arrow: vector([(t_f-t_o)/2, subst(i,var,fnc[k])],[0,subst(i,var,d1[k])]), objmot: append(objmot, [gr2d( nticks=80, color=red, head_length=0.5, head_angle=15, line_width=3, arrow, color=black, point_type=circle, point1, xtics=false, xrange=[xmin, xmax], yrange=[ymin, ymax], title="objects motion")])), if ( i+inc >= interval[k][2]) then k: k+1), draw( terminal = animated_gif, delay = 1, file_name = sconcat(fileprefix,"v_obj_mot"), objmot))$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ acceleration (fnc, var, interval, periodic, fileprefix) := block( intlen: length(interval), fnclen: length(fnc), if intlen#fnclen then block( print("The number of functions and number of intervals do not match. Try again."), return()), t_o: interval[1][1], t_f: interval[intlen][2], d1: diff(fnc, t, 1), d2: diff(fnc, t, 2), fmax: subst(t_o,var,fnc[1]), fmin: subst(t_o,var,fnc[1]), d1max: subst(t_o,var,d1[1]), d1min: subst(t_o,var,d1[1]), d2max: subst(t_o,var,d2[1]), d2min: subst(t_o,var,d2[1]), k: 1, for i: 1 thru 500 do block( tcurr: i*(t_f-t_o)/500, if tcurr>=interval[k][2] then k: k+1, if k<=fnclen then block( curr: subst(tcurr,var,fnc[k]), if curr>fmax then fmax: curr, if currd1max then d1max: curr, if currd2max then d2max: curr, if curr= interval[k][2]) then k: k+1), draw( terminal = animated_gif, delay = 1, file_name = sconcat(fileprefix,"a_vel_time"), vel_time), acc_time: [], d2plot: [], ymargin: (d2max-d2min)*(marginpercent/100), ymin: d2min-ymargin, ymax: d2max+ymargin, k: 1, for i: t_o thru tend step inc do block( if(k<=fnclen) then block( arrow2: vector([i, 0],[0,subst(i,var,d2[k])]), for j: 1 thru k do block( if interval[j][2]i) then block( d2plot: append(d2plot,[explicit(d2[j],var,interval[j][1],i)]))), acc_time: append(acc_time, [gr2d( nticks=80, color=green, line_width=1, line_type=dots, d2plot, color=green, head_length=0.5, head_angle=15, line_width=3, line_type=solid, arrow2, xrange=[xmin, xmax], yrange=[ymin, ymax], title="acceleration vs. time")])), if ( i+inc >= interval[k][2]) then k: k+1), draw( terminal = animated_gif, delay = 1, file_name = sconcat(fileprefix,"a_acc_time"), acc_time), objmot: [], ymargin: (fmax-fmin)*(marginpercent/100), ymin: fmin-ymargin, ymax: fmax+ymargin, k: 1, for i: t_o thru tend step inc do block( if(k<=fnclen) then block( point1: points([[(t_f-t_o)/2, subst(i,var,fnc[k])]]), arrow: vector([(t_f-t_o)/2, subst(i,var,fnc[k])],[0,subst(i,var,d2[k])]), objmot: append(objmot, [gr2d( nticks=80, color=green, head_length=0.5, head_angle=15, line_width=3, arrow, color=black, point_type=circle, point1, xtics=false, xrange=[xmin, xmax], yrange=[ymin, ymax], title="objects motion")])), if ( i+inc >= interval[k][2]) then k: k+1), draw( terminal = animated_gif, delay = 1, file_name = sconcat(fileprefix,"a_obj_mot"), objmot))$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ posvelacc (fnc, var, interval, periodic, fileprefix) := block( intlen: length(interval), fnclen: length(fnc), if intlen#fnclen then block( print("The number of functions and number of intervals do not match. Try again."), return()), t_o: interval[1][1], t_f: interval[intlen][2], d1: diff(fnc, t, 1), d2: diff(fnc, t, 2), k: 1, for i: 1 thru 500 do block( tcurr: i*(t_f-t_o)/500, if tcurr>=interval[k][2] then k: k+1, if k<=fnclen then block( curr: subst(tcurr,var,fnc[k]), if curr>fmax then fmax: curr, if currd1max then d1max: curr, if currd2max then d2max: curr, if curr= interval[k][2]) then k: k+1), draw( terminal = animated_gif, delay = 1, file_name = sconcat(fileprefix,"pva"), pva))$ /* [wxMaxima: input end ] */ /* [wxMaxima: section start ] Part I: Constant Velocity [wxMaxima: section end ] */ /* [wxMaxima: comment start ] Section 3.3 Suppose that you drive your car along a straight road at a constant speed of 60 mph for 4 hours and then turn around and come back at the same speed. Let's take the reference point to be your starting position, and the direction your car travels during the first four hours as the positive direction. The position of your car during the trip is given by the piecewise function s(t) = 60*t for t<=4 and 480-60*t for t>4. Note that s is typically used to represent the position function. Now we plot this piecewise function over the duration of the trip. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ s: [60*t, 480-60*t]; sinterval: [[0,4],[4,8]]; slen: length(s)$ t_o: sinterval[1][1]$ t_f: sinterval[slen][2]$ splot: []$ smax: subst(t_o,t,s[1])$ smin: subst(t_o,t,s[1])$ k: 1$ for i: 1 thru 500 do block( tcurr: i*(t_f-t_o)/500, if (tcurr>=sinterval[k][2] and k+1<=slen) then k: k+1, if k<=slen then block( curr: subst(tcurr,t,s[k]), if curr>smax then smax: curr, if curr=vinterval[k][2] and k+1<=vlen) then k: k+1, if k<=vlen then block( curr: subst(tcurr,t,v[k]), if curr>vmax then vmax: curr, if curr=sinterval[k][2] and k+1<=slen) then k: k+1, if k<=slen then block( curr: subst(tcurr,t,s[k]), if curr>smax then smax: curr, if curr=vinterval[k][2] and k+1<=vlen) then k: k+1, if k<=vlen then block( curr: subst(tcurr,t,v[k]), if curr>vmax then vmax: curr, if curr Velocity -> Position, which treats some of the same motion problems that are in this module, but the other way around. [wxMaxima: comment end ] */ /* [wxMaxima: subsect start ] You Try It - Linear Rate of Change and Extreme Values [wxMaxima: subsect end ] */ /* [wxMaxima: comment start ] Section 3.3, 4.4 The motion in Part II provides an example of a situation where the derivative of a function, i.e., the velocity, is a linear function. Write a brief response to each of the following questions. 1. On what interval is v = ds/dt positive? On what interval is it negative? 2. On the interval where v = ds/dt is positive, what can you say about the value of s? 3. What can you say about the value of s on the interval where v = ds/dt is negative? 4. At t=4 seconds, the function s reaches its maximum value of 256 feet. What happens to the derivative, v = ds/dt, at this point? 5. What does the value of v = ds/dt do as t increases? How is this related to the value of a = dv/dt = (d^2 s)/dt^2 and the concavity of the graph of s over the interval of motion? 6. Over the 8-second interval, what are the largest and smallest values of s and at what times to they occur? [wxMaxima: comment end ] */ /* [wxMaxima: section start ] Part III: Oscillations [wxMaxima: section end ] */ /* [wxMaxima: comment start ] Section 3.4, Simple Harmonic Motion If you hang a mass from a spring, it will eventually come to rest in an equilibrium position, where the weight of the mass is balanced by the tension in the spring. Now pull the mass down slightly and let it go. It will oscillate (move up and down) about the equilibrium position. If there were no air resistance and/or friction in the mass and spring it would oscillate forever with the same amplitude and frequency. Since the motion is periodic, it is not surprising that the periodic trig functions can be used to describe such a motion. For example, if the amplitude of the vibration is 2 centimeters and the period of the oscillations is 4*%pi/3 seconds, then the motion is described by the following function. NOTE: The commands in this worksheet generate a lot of graphics, which may fill up your computer's memory. Before proceeding with this Part, you should pull down the Cell menu at the top of the screen and select "Remove All Output" (From Worksheet). Then you will have to return to the place in the worksheet where you left off. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ s: [-2*cos(3*t/2)]; sinterval: [[0,8*%pi/3]]; slen: length(s)$ t_o: sinterval[1][1]$ t_f: sinterval[slen][2]$ splot: []$ smax: subst(t_o,t,s[1])$ smin: subst(t_o,t,s[1])$ k: 1$ for i: 1 thru 500 do block( tcurr: i*(t_f-t_o)/500, if (tcurr>=sinterval[k][2] and k+1<=slen) then k: k+1, if k<=slen then block( curr: subst(tcurr,t,s[k]), if curr>smax then smax: curr, if curr=vinterval[k][2] and k+1<=vlen) then k: k+1, if k<=vlen then block( curr: subst(tcurr,t,v[k]), if curr>vmax then vmax: curr, if curr=ainterval[k][2] and k+1<=alen) then k: k+1, if k<=alen then block( curr: subst(tcurr,t,a[k]), if curr>amax then amax: curr, if curr 0 and a > 0 b) v > 0 and a < 0 c) v < 0 and a < 0 d) v < 0 and a > 0 With up taken as the positive direction, specify the direction the object is moving and whether it is speeding up or slowing down. [wxMaxima: comment end ] */ /* [wxMaxima: section start ] Part IV: Decaying Oscillations [wxMaxima: section end ] */ /* [wxMaxima: comment start ] Chapter 3, Section 4 If you wish, you can quit here. The next two Parts, IV and V, are just for fun. A more realistic model for oscillations of real objects is to account for the loss of energy, which results in a decay in the amplitude of the oscillations. In mechanical systems, this energy loss is usually due to friction (objects rubbing against one another in some way). For the motion of the mass hanging from a spring, a more realistic position function has an amplitude that decays exponentially. NOTE: The commands in this worksheet generate a lot of graphics, which may fill up your computer's memory. Before proceeding with this Part, you should pull down the Cell menu at the top of the screen and select "Remove All Output" (From Worksheet). Then you will have to return to the place in the worksheet where you left off. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ s: [-2*%e^(-t/5)*cos(t)]; sinterval: [[0,6*%pi]]; slen: length(s)$ t_o: sinterval[1][1]$ t_f: sinterval[slen][2]$ splot: []$ smax: subst(t_o,t,s[1])$ smin: subst(t_o,t,s[1])$ k: 1$ for i: 1 thru 500 do block( tcurr: i*(t_f-t_o)/500, if (tcurr>=sinterval[k][2] and k+1<=slen) then k: k+1, if k<=slen then block( curr: subst(tcurr,t,s[k]), if curr>smax then smax: curr, if curr=vinterval[k][2] and k+1<=vlen) then k: k+1, if k<=vlen then block( curr: subst(tcurr,t,v[k]), if curr>vmax then vmax: curr, if curr=ainterval[k][2] and k+1<=alen) then k: k+1, if k<=alen then block( curr: subst(tcurr,t,a[k]), if curr>amax then amax: curr, if curr=sinterval[k][2] and k+1<=slen) then k: k+1, if k<=slen then block( curr: subst(tcurr,t,s[k]), if curr>smax then smax: curr, if curr=vinterval[k][2] and k+1<=vlen) then k: k+1, if k<=vlen then block( curr: subst(tcurr,t,v[k]), if curr>vmax then vmax: curr, if curr=ainterval[k][2] and k+1<=alen) then k: k+1, if k<=alen then block( curr: subst(tcurr,t,a[k]), if curr>amax then amax: curr, if curr