Rain Catchers, Elevators, and Rockets

Off[NIntegrate::ploss];
Off[NIntegrate::ncvb];
Off[FindRoot::"regex"];
Off[NIntegrate::"slwcon"];Clear[antidifferentiate];
antidifferentiate[fnc_,tind_,to_,tf_,fncic_]:=Module[{f,t},rules={DiracDelta[q_]->0,DiracDelta[t-q_]->0,DiracDelta[q_-t]->0,DiracDelta[t+q_]->0,DiracDelta[q_+t]->0,DiracDelta[0.`]->0,DiracDelta'[q_]->0,DiracDelta'[t-q_]->0,DiracDelta'[q_-t]->0,DiracDelta'[t+q_]->0,DiracDelta'[q_+t]->0,DiracDelta'[0.`]->0};periodic=0;f[t_]=fnc/.tind->t/.rules;F[t_]=(∫_to^t)f[s]\[DifferentialD]s+fncic;fpp[t_]=(∂_t)f[t]/.rules;fppvalues=Table[fpp[t],{t,to,tf,((tf-to)/1000)}];fvalues=Table[f[t],{t,to,tf,((tf-to)/1000)}];Fvalues=Table[F[t],{t,to,tf,((tf-to)/1000)}];Fmax=Max[Fvalues];Fmin=Min[Fvalues];fmaxt=Max[fvalues];fmint=Min[fvalues];fmin=fmint;fmax=fmaxt;start={};roots={};Do[If[Sign[fvalues[[k]]]≠Sign[fvalues[[k+1]]],roots=Append[roots,to+(((tf-to) k)/(1000.`))]],{k,2,1000}];steprat=0.05`;hrange=If[Fmax≤0,{1.2` Fmin,0.2` (Fmax-Fmin)},If[Fmin≥0,{-0.2` (Fmax-Fmin),1.2` Fmax},{Fmin-0.2` (Fmax-Fmin),Fmax+0.2` (Fmax-Fmin)}]];frange=If[fmax≤0,{1.2` fmin,0.2` (fmax-fmin)},If[fmin≥0,{-0.2` (fmax-fmin),1.2` fmax},{fmin-0.2` (fmax-fmin),fmax+0.2` (fmax-fmin)}]];ta=0;size=12;If[Length[roots]≠0,If[Abs[roots[[Length[roots]]]-tf]≤0.00001` Max[Abs[{Fmax,Fmin}]],roots=Append[roots,tf+0.00001` (tf-to)],roots=Append[roots,tf];roots=Append[roots,tf+0.00001` (tf-to)]];If[Abs[roots[[1]]-to]≤0.00001` Max[Abs[{Fmax,Fmin}]],roots=Prepend[roots,to-0.00001` (tf-to)],roots=Prepend[roots,to];roots=Prepend[roots,to-0.00001` (tf-to)]];,roots=Append[roots,tf];roots=Append[roots,tf+0.00001` (tf-to)];roots=Prepend[roots,to];roots=Prepend[roots,to-0.00001` (tf-to)]];n=Length[roots];roots=Sort[N[roots]];For[k=1,k<Length[roots]-1,k++,If[roots[[k]]==roots[[k+1]],roots=Delete[roots,k]]];k=1;While[k≤Length[roots],If[roots[[k]]<to-0.00001` (tf-to)||roots[[k]]>tf+0.00001` (tf-to),roots=Delete[roots,k],k++]];Manipulate[Clear[p1,p2];lim=1;While[ta>roots[[lim+2]],lim=lim+1];p1t=Plot[F[t],{t,to,If[ta==roots[[lim+1]],ta-((tf-to)/1000),ta]},PlotRange->{{to-0.01` (tf-to),tf+0.01` (tf-to)},hrange},AspectRatio->(1/2),PlotStyle->{RGBColor[0.246098`,0.671885`,0.199222`],Dashing[{}]},ImageSize->{64 size,((64 size)/2)},PlotRegion->{{0,1},{0,1}},AxesLabel->{"t","Q"},Prolog->Flatten[{RGBColor[0.246098`,0.671885`,0.199222`],Text["Q",{ta+0.05` (tf-to),0.5` F[ta]},{0,1}],Thickness[0.01`],Arrow[{{ta,0},{ta,F[ta]}}],Text["\!\(\*SubscriptBox[\(Q\), \(0\)]\)",{to+0.05` (tf-to),0.5` F[to]},{0,1}],Arrow[{{to-0.01` (tf-to),0},{to-0.01` (tf-to),F[to]}}],Thickness[0.015`],Table[{If[f[roots[[k]]+((tf-to)/1000)]>0,RGBColor[1,0,0],RGBColor[0,0,1]],Arrow[{{roots[[k]],F[roots[[k]]]},{roots[[k]],F[roots[[k+1]]]}}],RGBColor[0,0,0],Thickness[0.003`],Dashing[{0.01`,0.02`}],Line[{{roots[[k]],F[roots[[k+1]]]},{roots[[k+1]],F[roots[[k+1]]]}}]},{k,1,lim}],If[f[ta-((tf-to)/1000)]>0,RGBColor[1,0,0],RGBColor[0,0,1]],Arrow[{{roots[[lim+1]],F[roots[[lim+1]]]},{roots[[lim+1]],F[ta]}}],Thickness[0.003`],RGBColor[0,0,0],Dashing[{0.01`,0.02`}],Line[{{roots[[lim+1]],F[ta]},{ta,F[ta]}}],Dashing[{}],BaseStyle->{FontSize->11},BaseStyle->{FontSize->11}},1]];p1=Show[p1t,ImageSize->{64 size,((64 size)/2)},PlotRegion->{{0,1},{0,1}},AspectRatio->(1/2)];p2t={};Manipulate[If[f[roots[[k]]+((tf-to)/1000)]>0,fillcolor=RGBColor[1,0,0],fillcolor=RGBColor[0,0,1]];pinter=Plot[f[t],{t,roots[[k]],roots[[k+1]]},PlotRange->{{to,tf},frange},ImageSize->{64 size,((64 size)/2)},AspectRatio->(1/2),PlotStyle->{RGBColor[0,0,0],Thickness[0.008`]},Filling->{1->{0,fillcolor}}];p2t=Append[p2t,pinter],{k,1,lim}];If[f[ta-((tf-to)/1000)]>0,fillcolor=RGBColor[1,0,0],fillcolor=RGBColor[0,0,1]];pinter2=Plot[f[t],{t,roots[[lim+1]],If[ta==roots[[lim+1]],ta+((tf-to)/1000),ta]},PlotRange->{{to,tf},frange},PlotStyle->{RGBColor[0,0,0],Thickness[0.008`]},ImageSize->{64 size,((64 size)/2)},AspectRatio->(1/2),Filling->{1->{0,fillcolor}}];p2t=Append[p2t,pinter2];pint=Plot[f[t],{t,to,tf},PlotRange->{{to,tf},frange},ImageSize->{64 size,((64 size)/2)},AspectRatio->(1/2),PlotStyle->{RGBColor[0,0,0],Thickness[0.008`]},AxesLabel->{"t","dQ/dt"},Epilog->{Thickness[0.01`],RGBColor[0,0,0],Arrow[{{ta,0},{ta,f[ta]}}],Text["(dQ/dt)",{ta+0.05` (tf-to),((f[ta])/2)},{0,1}],BaseStyle->{FontSize->11}}];p2t=Prepend[p2t,pint];p2=Show[p2t,ImageSize->{64 size,((64 size)/2)},AspectRatio->(1/2),PlotRegion->{{0,1},{0,1}}];Show[GraphicsRow[{p2,p1}],ImageSize->{64 size,((64 size)/4)},AspectRatio->(1/2),PlotRegion->{{0,1},{0,1}}],{ta,to,If[periodic==1,tf-steprat (tf-to),tf],((tf-to)/25)}]]

Introduction

OBJECTIVE: Gain an appreciation for the importance of the Fundamental Theorem of Calculus and the Mean Value Theorem in practical applications.

The purpose of this module is to show the wide applicability of some of the basic ideas in calculus of single variable functions. What do flood control, riding an elevator, and launching a model rocket have in common? We can describe all of these, using calculus. In addition to gaining a better understanding and appreciation for the Fundamental Theorem of Calculus and the Mean Value Theorem, you will also see the importance of finding the areas between the graphs of functions and identifying extreme values. Let's get started.

Technology Guidelines

NOTE:  If you have just finished a module, restart Mathematica or Quit Kernel under the Evaluation pull-down menu before executing a new module.
TO OPEN CELLS, click on the arrow to the left of the cell or put your cursor on the right cell bracket and double click. To open all cells, highlight the bracket on the far right and select Grouping under the Cell pull-down menu and select Open All Subgroups.
TO STOP AN EXECUTION
Select the Evaluation pull-down menu and click on Abort Evaluation.
ORDER OF EXECUTION
Execute cells in the order given. Do not skip any Input cells within a given notebook.
SAVING NOTEBOOKS
You can save anytime to any directory you choose, and it is wise to save often. However, before you do your final save to reduce the size of your file, it is a good idea to delete all your output by selecting the Delete All Output selection under the Cell pull-down menu.
EXPERIENCING MAJOR PROBLEMS
Save if appropriate, then shut down Mathematica and start it up again.

Part I: Rain Catchers

Background

Property owners are required by law to ensure that water running off their properties during a storm does not do harm to their neighbors. This can often be a challenge for cities, towns, and municipalities where large flows of water can run over public properties and in streets and roadways, presenting a potential threat to private property owners. As a result, public as well as private entities have to take measures to control storm runoff. Numerous examples of such efforts can be found in and around the Los Angeles basin in California.

In this module, you will explore how one would go about designing a detention basin to collect runoff water from a rainstorm and release it at a controlled flow rate.

Here Comes the Rain

During a severe 24-hour storm, water flows out of a drainage channel at the rate given by ((dQ)/dt)=10000(t^2)(e^(-t/2)), where t is hours and ((dQ)/dt)is cubic feet per hour. Plot the flow rate function and determine what the maximum flow rate is and when it occurs.

Clear[Q];
Q'[t_]=10000(t^2)Exp[-t/2]

Plot[Q'[t],{t,0,24},AxesLabel->{"t (hr)","Q' ((ft^3)/hr)"},PlotStyle->{RGBColor[0,0,1]}]

Q''[t_]=D[Q'[t],t]//Simplify

soln=Solve[Q''[t]==0,t]

Q'[4]//N

The maximum flow rate occurs at t = 4 hours and is 21653.6 cubic feet per hour. This is confirmed by the graph of Q'(t), and by checking to see that the second derivative of Q(t) at t = 4 hours is negative.

D[Q'[t],{t,2}]/.t->4//N

Imagine that you have been asked to design a storm drain detention basin to catch and hold all of the water that flows out the drainage channel during this severe 24-hour storm. How much water would the detention basin have to hold?

The total amount of water that flows out of the drainage channel during the 24-hour storm is the area under the graph of Q'[t]. You can show this area.

Plot[Q'[t],{t,0,24},
AxesLabel->{"t(hr)","Q' ((ft^3)/hr)"},Filling->{1->{0,RGBColor[1,0,0]}}]

The definite integral gives the area under the graph, which is the total amount of water that flows out of the drainage channel during the 24-hour storm.

Q[24]=(∫_0^24)Q'[t]\[DifferentialD]t//N

The detention basin must be able to hold about 160,000 cubic feet of water. To get an idea of how much water this is, think of a cube with this much volume. The length of each side would have to be (160000^(1/3))ft or

(160000^(1/3))//N

What is the average flow rate during the storm? You can calculate the average flow rate two different ways. In the first, calculate the average value of the flow rate function between t=0 and t=24 hours.

(OverBar[Q])'=(1/(24-0))(∫_0^24)Q'[t]\[DifferentialD]t//N

In the second, take the total amount of water that flows out of the pipe during the 24-hour period and divide it by 24 hours. That is, (OverBar[Q])'=((ΔQ)/(Δt))=((Q(24)-Q(0))/(24-0)), where Q(0)=0.

Q[0]=0;
(OverBar[Q])'=((Q[24]-Q[0])/(24-0))

Therefore, the average flow is 6663.18 ((ft^3)/hr). The fact that the two values for the average flow rate are the same should not be surprising since (∫_0^24)Q'(t)dt=Q(24)-Q(0)=ΔQ by the Fundamental Theorem of Calculus, Part II.

At what time(s) during the 24-hour event does the flow rate equal the average rate of flow? (You may ignore the error messages here.)

Solve[Q'[t]==(OverBar[Q])',t]

\[MathematicaIcon] About Mathematica

Only the positive values for t make sense since Q'[t]is only defined for t ≥ 0.

If the detention basin is empty at t = 0, find a function that gives the total amount of water Q in the basin as a function of time during the 24 hours, and graph the function.

Q[t_]=(∫_0^t)Q'[u]\[DifferentialD]u+Q[0] //Simplify            (*from the Fundamental Theorem of Calculus, Part 1*)

Plot[Q[t],{t,0,24},AxesLabel->{"t(hr)","Q ((ft^3))"},PlotStyle->{RGBColor[0,1,0]}]

Watch it Fill

We can watch the water accumulate in the detention basin using the command, antidifferentiate[ f[t], t, a, b, f[a] ], which was designed specially for this demonstration. The arguments of the function are: f[t], the rate of change function, t, the independent variable, a, the beginning time, b, the ending time, and f[a], the initial value of f[t]. 

Move the slider at the top of the graph to watch the water accumulate.

antidifferentiate[Q'[t],t,0,24,0]

If the reservoir were to fill at a constant rate over the 24-hour period, what would the constant fill rate be? It would, of course, be the average rate of flow, (OverBar[Q])'=6663.18 ((ft^3)/hr), that we calculated above. This is true because we know from the definition of the average value of a function that (OverBar[Q])'×((Subscript[t, f])-(Subscript[t, i])) = (∫_(Subscript[t, i])^(Subscript[t, f]))Q'dt. Move the slider at the top of the graph to watch the reservoir fill at the average rate instead of the actual.

antidifferentiate[(OverBar[Q])',t,0,24,0]

The Mean Value Theorem: Integral Form

For some additional insight, let's plot the constant average-rate-of-change function together with the actual-rate-of-change function.

Plot[{Q'[t],(OverBar[Q])'},{t,0,24},PlotStyle->{{RGBColor[0,0,1]},{RGBColor[1,0,0]}},PlotRange->All,AxesLabel->{"t","Q'(t) & (OverBar[Q'])"}]

The integral form of the Mean Value Theorem assures us that since Q'[t]is continuous on the 24-hour interval, there will be at least one time where the average rate of flow, (OverBar[Q])', will equal the instantaneous rate of flow, Q'[t]. In this case, there are actually two. Do you see these two times on the preceding graph? What are these times? (We calculated them above.)

The Mean Value Theorem: Derivative Form

Let's plot the amount of water in the detention basin as functions of time for the two flow-rate functions shown in the graph above.

(Subscript[Q, 2])[0]=0;
(Subscript[Q, 2])[t_]=(OverBar[Q])'*t+(Subscript[Q, 2])[0]

Plot[{Q[t],(Subscript[Q, 2])[t]},{t,0,24},PlotStyle->{{RGBColor[0,0,1]},{RGBColor[1,0,0]}},AxesLabel->{"t","Q(t) & (Subscript[Q, 2])(t)"}]

In this case, the average rate of flow over the 24-hour interval is the slope of the secant line between the to points (0, 0) and (24, 159916). The derivative form of the Mean Value Theorem tells us that since Q(t) is continuous on the interval [0, 24] and differentiable on (0, 24), there will be at least one time where the instantaneous flow rate, Q'(t), will equal the average flow rate, ((Δ Q)/(Δ t)).  (Note that by the Fundamental Theorem of Calculus, Part 2

((Δ Q)/(Δ t))=((Q(24)-Q(0))/(24-0))=(1/(24-0))(∫_0^24)Q'(t)dt=(OverBar[Q])'. 

This is why we call the slope of the secant line the average rate of change: ((Δ Q)/(Δ t))=(OverBar[Q])' truly is the average of the rate of change function over the interval.) 

There are actually two points where Q'(t)=(OverBar[Q])'. Do you see them in the graph above? To highlight them further, let's draw the tangents to the curve at the two points. First, we define a new function, L[ t, a ], that gives the equation of the line tangent to Q(t) at t=a; that is, it gives the linearization of Q(t) at the point (a, Q(a)).

Clear[L,a];
L[t_,a_]=(Q[a]+Q'[a]*(t-a))//Simplify

Note that for a specific value of a, the L[ t, a ] command gives a linear function. For example,

L[t,2]//N//Expand

Recall that in a preceding calculation we found the values of t where the average rate of change equals the instantaneous rate of change. We repeat the calculation here. (You may ignore the error messages here.)

a=Solve[Q'[t]==(OverBar[Q])',t]

Now we find the equations of the tangent lines at the two points in the domain where Q'(t)=(OverBar[Q])' and graph them together with Q(t) and (Subscript[Q, 2])(t).

tangent1=L[t,a[[2,1,2]]]//Simplify

tangent2=L[t,a[[3,1,2]]]//Simplify

Plot[{Q[t],(Subscript[Q, 2])[t],tangent1,tangent2},{t,0,24},PlotStyle->{{RGBColor[0,0,1]},{RGBColor[1,0,0]},{RGBColor[0,0,0]},{RGBColor[0,0,0]}},AxesLabel->{"t","Q(t) & (Subscript[Q, 2])(t)"}]

Let's zoom in a little.

Plot[{Q[t],(Subscript[Q, 2])[t],tangent1,tangent2},{t,0,11},PlotStyle->{{RGBColor[0,0,1]},{RGBColor[1,0,0]},{RGBColor[0,0,0]},{RGBColor[0,0,0]}},AxesLabel->{"t","Q(t) & (Subscript[Q, 2])(t)"}]

We see that the tangents at the two points are parallel to the secant line. That is, Q'(t)=((Δ Q)/(Δ t))= (OverBar[Q])' at these two points.

Let's Drain the Dam Thing

Now that we have a full detention basin, we need to figure out how to drain it. The design includes a pump that is capable of pumping 5000 ((ft^3)/hr)out of the basin. This rate of outflow is acceptable and won't flood our neighbors. The pump doesn't start until the amount of water in the reservoir reaches 50,000 cubic feet, and then it runs until the reservoir is empty. Let's find a function to describe how the water accumulates in the basin under these conditions. First, we determine when the pump will kick on.

ton=Solve[Q[t]==50000,t]     (*This command won't work, but don't give up!*)

The Solve[ ] command doesn't work for this function, so we resort to the FindRoot[ ] command. From the graph of Q(t), it appears that the water will reach 50000 cubic feet at about 4 hours, so we use this as a starting value in the FindRoot[ ] command.

ton=FindRoot[Q[t]==50000,{t,4}]

\[MathematicaIcon] About Mathematica

Now we can form the rate-of-fill function and graph it. First, we define the rate of inflow and the rate of outflow and graph each of them.

inflowrate[t_]=10000(t^2)Exp[-t/2]

The outflow rate function is piecewise defined since its value is 0 for t < 3.92 and 5000 for t ≥ 3.92. In Mathematica, the HeavisideTheta[ ] function, which is similar to the UnitStep[ ] command works well for constructing piecewise defined functions because Mathematica integrates the HeavisideTheta[ ] function correctly. The HeavisideTheta[ ] function has a value of 0 for t < 0 and 1 for t > 0. See how it works to define the outflow rate function in the next cell.

outflowrate[t_]=5000*HeavisideTheta[t-ton[[1,2]]]

\[MathematicaIcon] About Mathematica

Plot[{inflowrate[t],outflowrate[t]},{t,0,48},AxesLabel->{"t (hr)","rates ((ft^3)/hr)"},PlotRange->All,PlotStyle->{{RGBColor[1,0,1]},{RGBColor[0,1,0]}}]

The rate at which water accumulates is represented as the difference between the two curves, that is, (inflowrate[t] - outflowrate[t]). The accumulated water can be represented as the signed area between the two graphs. 

First, let's figure out when the reservoir stops filling and begins to drain. This will occur when the outflow rate of 5000 (ft^3)/hr exceeds the inflow rate. In the graph above, it is the point where the two curves cross near t=12 hours.

FindRoot[Q'[t]==5000,{t,12}]

Let's plot the curves with the net inflow area colored red and the net outflow area colored blue.

p1=Plot[{inflowrate[t],outflowrate[t]},{t,0,10.9652`},PlotRange->All,AxesLabel->{"t(hr)","rates ((ft^3)/hr)"},PlotStyle->{{Thickness[0.01`],RGBColor[1,0,1]},{Thickness[0.01`],RGBColor[0,1,0]}},Filling->{1->{{2},RGBColor[1,0,0]}},Filling->{1->{2}}]

p2=Plot[{inflowrate[t],outflowrate[t]},{t,10.9652`,40},AxesLabel->{"t(hr)","rates ((ft^3)/hr)"},AxesOrigin->{0,0},PlotStyle->{{Thickness[0.01`],RGBColor[1,0,1]},{Thickness[0.01`],RGBColor[0,1,0]}},Filling->{1->{{2},RGBColor[0,0,1]}},Filling->{1->{2}}]

Show[p1,p2]

The red area in the preceding graph represents the amount of water that has accumulated in the reservoir, and the blue area represents the net amount that has drained out of the reservoir. From the preceding graph, can you estimate when the basin will stop filling, when it will start draining, and when it will be empty?

Let's form a function to describe the rate at which water accumulates in the basin and graph it.

Clear[Q];
Q'[t_]=inflowrate[t]-outflowrate[t]

Plot[Q'[t],{t,0,48},AxesLabel->{"t (hr)","Q'((ft^3)/hr)"},PlotStyle->{RGBColor[0,0,1]}]

Can you tell any better from the preceding graph when the basin will stop filling, when it will start draining, and when it will be empty?

You can use the antidifferentate[ ] command to watch the basin fill and drain. Move the slider at the top of the graph to animate the graphics.

antidifferentiate[Q'[t],t,0,48,0]

It appears that the reservoir will be fully drained at about 36 hours after the storm begins or 12 hours after the storm ends. This occurs when the graph of Q[t] crosses the t axis and when the blue area is equal to the red area on the graph of Q'[t]. Let's try it. Change the ending time to 36 hours in the command above, and execute it again.

How much water does the detention basin have to hold if we include the pump in the design?

You Try It: Calculus Has its Ups and Downs on Elevators

The following function describes the velocity of an elevator during a 12-second trip from the ground floor to the eighth floor, which is the top floor of the building. In this case, Q[t] represents the height of the elevator above the ground floor and Q'[t] the velocity schedule over the 12-second time interval. At first, we go through the steps with you (except step 10), and then we ask you to do one on your own.

First, we define a function that works well in Mathematica for piecewise defined functions because Mathematica integrates it correctly. It uses the HeavisideTheta[t ] function, which has a value of 0 for t < 0 and 1 for t > 0. The function onoff[t, a, b], defined in the next cell, is equal to 1 for a ≤ t < b, and is 0 otherwise. You will see how it works to define a piecewise function for the velocity of the elevator.

Clear[a,b,t];
onoff[t_,a_,b_]=HeavisideTheta[t-a]-HeavisideTheta[t-b]

Clear[Q];
Q'[t_]=6*t*onoff[t,0,2]+12*onoff[t,2,10]+(72-6*t)*onoff[t,10,12]

Plot[Q'[t],{t,0,12},PlotStyle->{RGBColor[0,0,1]},PlotRange->All,AxesLabel->{"t","velocity"}]

Use the function Q'[t] to perform the following tasks.

1.  Form a Q[t_] function that represents the height of the elevator above the ground floor, and graph the function.

Q[t_]=(∫_0^t)Q'[u]\[DifferentialD]u

Plot[Q[t],{t,0,12},PlotStyle->{RGBColor[1,0,0]},AxesLabel->{"t(sec)","height above ground (ft)"}]

2.  If each story of the building is the same height, determine the height of the building. (Be careful. The elevator stops at the bottom of the top floor.)

heightofeachfloor=Q[12]/7//N

heightofbuilding=8*heightofeachfloor

3.  Determine the average velocity of the elevator during the 12-second trip.

vavg=(1/(12-0))(∫_0^12)Q'[t]\[DifferentialD]t

4.  Plot Q'[t] and the constant average-velocity function on the same graph.

Plot[{Q'[t],vavg},{t,0,12},PlotRange->All,AxesLabel->{"t(sec)","Q'(t) & (Subscript[v, avg])(ft/sec)"},PlotStyle->{{RGBColor[0,0,1]},{RGBColor[1,0,0]}}]

5.  Determine the times when the instantaneous velocity is equal to the average velocity over the 12-second interval. (Solve[ ] won't work here.)

FindRoot[Q'[t]==10,{t,1.5}]

FindRoot[Q'[t]==10,{t,10.5}]

6.  Use the special function antidifferentiate[ ] to depict the motion of the elevator as it travels to the top floor. This command will generate some errors for this function, but you can still manipulate the graphs generated.

antidifferentiate[Q'[t],t,0,12,0]

7.  Plot a graph of the height of the elevator if it were to travel to the eighth floor at a constant speed that is equal to its average speed during the actual trip, and then superimpose this graph on the actual graph of Q[t].

Qlin[t_]=vavg*t

p1=Plot[{Q[t],Qlin[t]},
{t,0,12},PlotStyle->{RGBColor[0,0,1],RGBColor[1,0,0]},AxesLabel->{"t(sec)","height(ft)"}]

8. Find the linearizations of Q[t] at the two times when the instantaneous velocity is equal to the average velocity, and superimpose the graphs of the two tangent lines on the graph found in step 7 above. (They should be parallel to the secant line between the two points on the graph of Q[t] at the beginning and end of the trip.)

L[t_,a_]:=Q[a]+Q'[a]*(t-a);

tangent1=L[t,1.66667]//Expand

tangent2=L[t,10.33333]//Expand

p2=Plot[{tangent1,tangent2},{t,0,12},AxesLabel->{"t(sec)","height(ft)"}]

Show[p2,p1]

9.  Plot the acceleration of the elevator during the trip, and describe the sensations you would feel if you were riding in the elevator as it travels from the ground floor to the top floor of the building.

Plot[Q''[t],{t,0,12},AxesLabel->{"t(sec)","acc(ft/(sec^2))"},PlotStyle->{RGBColor[1,0,0]}]

10. Assuming that the elevator always accelerates and decelerates at 6 (ft/(sec^2))and cruises at 12 (ft/sec), determine how long it would take the elevator to start at one floor, travel to the next floor, and stop there. Hint: The elevator does not reach cruising speed. It accelerates at 6 ft/(sec^2) for the first half of the trip and then decelerates at -6 ft/(sec^2) during the second half of the trip. Therefore, the velocity versus time function will be an isosceles triangle, and the area of this triangle is the height of one floor. From this you can figure out the duration of the trip. Answer: It takes 3.38 seconds to start at one floor and stop at the next.

11. Make up your own velocity schedule for the elevator and repeat steps 1 through 9. Here is one we made up where the elevator travels to the top floor and waits there for a three seconds, and then, after everybody gets off, the cable breaks.

Clear[Q];
Q'[t_]=6*t*onoff[t,0,2]+12*onoff[t,2,10]+(72-6*t)*onoff[t,10,12]-32*(t-15)*HeavisideTheta[t-15]

Plot[Q'[t],{t,0,18},PlotStyle->{RGBColor[0,0,1],Thickness[0.01`]},PlotRange->All,AxesLabel->{"t","velocity"}]

You Try It: Launching a Model Rocket

When a model rocket is launched, the propellant burns for a few seconds, accelerating the rocket upward. The acceleration increases during this period because the mass of the rocket decreases as it burns fuel while the upward thrust of the engine and the downward pull of gravity remain essentially constant. After burnout, the rocket coasts upward for a while and then begins to fall, all the while accelerating downward at a rate equal to g (i.e., 32 (ft/(sec^2))). A small explosive charge pops out a parachute shortly after the rocket starts down. The parachute slows the rocket to keep it from breaking when it lands. The following function describes the rate of change of velocity of the rocket (i.e., its acceleration) during the flight. In this case, Q[t] represents the velocity of the rocket, and Q'[t] represents its acceleration.

onoff[t_,timeon_,timeoff_]=HeavisideTheta[t-timeon]-HeavisideTheta[t-timeoff]

Clear[Q];
Q'[t_]=(95*t)*onoff[t,0,2]-32*onoff[t,2,10.8]+69.3 (E^(-0.8664(-10.8+t)))*HeavisideTheta[t-10.8]

Plot[Q'[t],{t,0,16},PlotStyle->{Thickness[0.01`],RGBColor[0,0,1]},PlotRange->All,AxesLabel->{"t","acceleration"}]

Use the function Q'[t] to perform the following tasks.

1.  Determine the average acceleration between t = 0 and t = 15 seconds, and superimpose a graph of the constant average-acceleration function onto the graph of the actual-acceleration function.

2.  Determine the times between t = 0 and t = 15 seconds, if any, where the instantaneous acceleration is equal to the average acceleration over that same time interval. If there are no times where the instantaneous acceleration is equal to the average acceleration, explain why this does not contradict the Mean Value Theorem.

3.  Given that the initial velocity of the rocket is 0, form a function that gives the velocity of the rocket as a function of time, and graph it. Use the graph to estimate when the rocket reaches its maximum height, and when it lands. You may have to adjust the domain over which you plot Q[t] to answer the last question.

Q[t_]=(∫_0^t)Q'[u]\[DifferentialD]u

Plot[Q[t],{t,0,30},PlotRange->All,PlotStyle->{Thickness[0.01`],RGBColor[0,0,1]},AxesLabel->{"t","velocity"}]

4.  Find the maximum velocity and the minimum velocity of the rocket during the trip.

5.  The antidifferentiate[ ] command has trouble here, but if we redefine Q'[t] to be the velocity function, and use it to construct Q[t], which will now represent the height of the rocket above the ground, it will work. To assign the current Q[t] function to Q'[t], give Q[t] in a temporary name (e.g., temp=Q[t]), and then Clear[Q] and redefine Q'[t_] (e.g., Q'[t_]=temp).

temp=Q[t];
Clear[Q];
Q'[t_]=Rationalize[temp];
Q[t_]=(∫_0^t)Q'[u]\[DifferentialD]u

Plot[Q'[t],{t,0,30},PlotStyle->{Thickness[0.01`],RGBColor[0,0,1]},AxesLabel->{"t","height"},PlotRange->All]

6.  Use antidifferentiate[ ] to study the velocity and height functions as the rocket flies. This command will generate some errors for this function, but you can still manipulate the graphs generated.

antidifferentiate[Q'[t],t,0,35,0.0]

8.  Determine how high the rocket goes and when it lands. To answer the latter question, you may have to adjust the time limits in the antidifferentiate[ ] command in the preceding cell.

9.  Determine the average velocity of the rocket between the time that it is at its maximum height and when it lands. Also, find the time or times in the same interval of time that the average velocity is equal to the instantaneous velocity.

10.  On the velocity graph, superimpose a graph of the constant average velocity over the interval described in step 9, and indicate on the graph the time or times that the instantaneous velocity is equal to the average velocity over the interval.

11.  Find the linearizations of Q[t] at the times that the average velocity over the interval described in step 7 is equal to the instantaneous velocity. Also find the equation of the secant line on the graph of Q[t], between the times that the rocket is at its maximum height and when it lands. Then superimpose the graphs of these lines (the secant and tangent lines) on the graph of Q[t].

\[MathematicaIcon] About Mathematica

The error message that appears when you execute the Solve[ ] command warns you that whenever Mathematica uses inverse functions to solve an equation, some solutions may not be provided. A good example of this is the equation sin x=1. Mathematica will use the inverse sine function to solve this equation, giving x = (π/2) (with the same warning message). We all know, however, that the equation actually has infinitely many solutions. They are x = (4n+1)(π/2), where n can be any integer. You might try using Mathematica to solve sin x=1. Go Back.

FindRoot[Q[t] = = 50000, {t, 4}] searches for a numerical solution to the equation Q[t] = = 50000, starting with t=4. To find out more about the FindRoot[ ] command, pull down the Help menu, select the Help Browser, and type FindRoot. Go Back.

In Mathematica, for a unit step function, the HeavisideTheta[t ] function is preferred to the UnitStep[t] command when it comes to integrating the function. This function has a value of 0 when the value of the independent variable is less than 0, and its value is 1 when the value of the independent variable is greater than 0. To learn more about the HeavisideTheta or UnitStep command, pull down the Help menu, select the Help Browser, and type the command. Go Back.