\documentclass[leqno,11pt]{article}
 \setlength{\textheight}{10.4in}
 \setlength{\topmargin}{-1in}
 \setlength{\headheight}{0in}
 \setlength{\topsep}{0in}
 \setlength{\marginparwidth}{0in}
 \setlength{\marginparsep}{0in}
 \setlength{\oddsidemargin}{0in}
 \setlength{\evensidemargin}{0in}
 \setlength{\textwidth}{6.4in}
 \setlength{\parskip}{4pt}
 \setlength{\parindent}{0pt}
 \newif\ifsolutions
 \solutionsfalse
\usepackage{quiz}
\usepackage{alltt}
\usepackage{../email}
\usepackage{hyperref}
\usepackage{graphicx}
\begin{document}
\section*{Quiz 9}
\rule{\textwidth}{0.5ex}
{\Large\bf Extra Credit Problem 1}. {\bf Piecewise Continuous Inputs}

Consider a passenger SUV on a short trip from Salt Lake City to Evanston, on the Wyoming border. The route is I-80 E, 75 miles through Utah. Google maps estimates 1 hour and 11 minutes driving time. The table below shows the distances, time, road segment and average speed with total trip time 1 hour and 38 minutes. Cities enroute reduce the freeway speed by 10 mph, the trip time effect not shown in the table.

%% http://www.motorists.org/speed-limits/state-chart


%Segments for Utah and Wyoming
%
%
%
%Utah
%
%Google map data
%
%Freeway I-80 E to Evanston is 65 mph except for some 45-55 mph segments
%
%Parley's Way Walmart to Kimball Junction, 18.1 miles, 20 min, 65 mph limit
%
%Kimball Junction to Wanship, 11.3 miles, 12 min, 55 mph limit
%
%Wanskip to Coalville, 9.1 miles, 13 min, 70 mph limit
%
%Coalville to Echo Dam interchange, 5.7 miles, 7 min, 70 mph limit
%
%Echo Dam to speed limit change sign, 16.5 miles, 18 min, 70 mph limit
%
%Speed sign to Evanston, Wyoming, 39 miles, 36 min,75 mph
%


$$
\begin{array}{|c|c|c|l|c|}
\hline
\mbox{Miles} & \mbox{Minutes} & \mbox{Speed mph} & \mbox{Road Segment} &\mbox{Posted limit mph} \\
\hline
18.1 & 20 & 54.3 & \mbox{Parley's Walmart to Kimball} & 65 \\ \hline
11.3 & 12 & 56.5 & \mbox{Kimball to Wanship} & 65-55\\ \hline
9.1 & 11 & 49.6 & \mbox{Wanship to Coalville} & 70 \\ \hline
5.7 & 6 & 57 & \mbox{Coalville to Echo Dam} & 70 \\ \hline
16.5 & 16 & 61.9 & \mbox{Echo Dam to 75 mph sign} & 70 \\ \hline
39 & 33 & 70.9 & \mbox{75 mph sign to Evanston} & 75 \\ \hline
\end{array}
$$
%18.1 / (20/60);
%11.3 / (12/60);
%9.1 / (11/60);
%5.7 / (6/60);
%16.5 / (16/60);
%39. /(32/60);
%%
%                              54.3
%                              56.5
%                          49.63636364
%                              57.0
%                          61.87500000
%                          70.90909091

The {\bf velocity function} for the SUV is approximated by
\def\VPC{V_{\mbox{pc}}}
$$
\VPC{}(t) = \left\{
\begin{array}{ccl}
\mbox{Speed mph} & \mbox{Time interval minutes} & \mbox{Road segment} \\
\hline \\
54.3 & 0<t<20 & \mbox{Parley's Walmart to Kimball}  \\
56.5 & 20 < t < 32 & \mbox{Kimball to Wanship}\\
49.6 & 32 < t < 43 &\mbox{Wanship to Coalville}  \\
57.0 & 43 < t < 49 &\mbox{Coalville to Echo Dam}  \\
61.9 & 49 < t < 65 & \mbox{Echo Dam to 75 mph sign}  \\
70.1 & 65 < t < 98 &\mbox{75 mph sign to Evanston}  \\
\end{array}
\right.
$$


The velocity function $\VPC{}(t)$ is piecewise continuous, because it has the general form
$$f(t) = \left\{ \begin{array}{cc}
f_1(t) & t_1 < t < t_2 \\
f_2(t) & t_2 < t < t_3 \\
 \vdots & \vdots \\
f_n(t) & t_n < t < t_{n+1} \\
\end{array}\right.
$$
where functions $f_1,f_2, \ldots, f_n$ are {\bf continuous on the whole real line $-\infty < t < \infty$}. We don't define $f(t)$ at division points, because of many possible ways to make the definition. As long as these values are not used, then it will make no difference. Both right and left hand limits exist at a division point. For Laplace theory, we like the definition $f(0)=\lim_{h\to 0+} f(h)$, which allows the parts rule $\L(f'(t))=s\L(f(t))-f(0)$.

\rule{\textwidth}{0.5ex}
{\Large\bf The Problem}. The SUV travels from $t=0$ to $t=\frac{98}{60}=1.6$ hours. The odometer {\sf trip meter reading} $x(t)$ is in miles (assume $x(0)=0$). The function $\VPC{}(t)$ is an approximation to the {\sf speedometer reading}. Laplace's method can solve the approximation model
$$\frac{dx}{dt} = \VPC{}(60t),\quad x(0)=0,\quad \mbox{$x$ in miles, $t$ in hours},$$
obtaining $x(t)=\int_0^t \VPC(60w)dw$, the same result as the method of quadrature.
Show the details. Then display the piecewise linear continuous trip meter reading $x(t)$.

\ifsolutions
{\bf Solution}.

{\bf Method of Quadrature}. The meaning of the differential equation is that $x'(t)$ is piecewise continuous.
We want $x(t)$ to be continuous, because it is the odometer trip meter reading.
But $x'(t)$ cannot be continuous, if we require $\frac{dx}{dt} = \VPC{}(60t)$,
because the right side is piecewise defined and discontinuous at division points.

{\bf Theorem} (Fundamental Theorem of Calculus)\\
{\sf If $f'(x)$ is piecewise continuous and $f(x)$ is continuous on $a\le x \le b$, then $\int_a^b f'(x)dx = f(b)-f(a)$.

The theorem implies that the method of quadrature works for the equation
$x'(t)=\VPC{}(60t)$. The quadrature method gives the correct
answer
$$x(t) = \int_0^t \VPC{}(60w)dw.$$

Another plan is to
split $x'(t)=\VPC{}(60t)$ into 6 simple equations, $x'=54.3$,
$x(0)=0$ on $0\le t <20$ being the first equation. The next equation
is $x'=56.5$, $x(20)=x_0$, on $20<t<32$. To make $x(t)$ continuous,
we must choose $x_0=1086$, which is the value at the division point
$t=20$ assumed by the first problem ($x'=54.3$, $x(0)=0$ on $0\le t
<20$). This tedious process has to be continued for all 6 segments.
The result is that $x(t)$ is {\bf piecewise linear} between division points.

{\bf Laplace's Method}. The piecewise continuous input $\VPC{}(60t)$ is of exponential order,
because it is zero after $t=98/60$. Laplace theory says it has a Laplace transform
$\L(\VPC{}(60t))$. Assuming a continuous solution $x(t)$, with $x'(t)$ piecewise continuous, then the equation to be satisfied is
$$s\L(x(t))-x(0) = \L(x'(t)) = \L(\VPC{}(60t)).$$
The {\bf Laplace integral theorem} implies
$$\L(x(t)) = \frac{1}{s}\L(\VPC{}(60t)) =  \L\left(\int_0^t \VPC{}(60w)dw\right).$$
Lerch's theorem then implies that the symbol $\L$ cancel from each side, giving the odometer
trip meter reading in terms of the integral of the piecewise continuous input $\VPC{}(60t)$:
$$ x(t) = \int_0^t \VPC{}(60w)dw.$$
We'll use technology to program and evaluate the integral, even though it can be done by hand.
The plan is to plot the trip meter reading, then comment on the slow and fast segments
of the route, by using a clever plot involving the average speed. The last display is the piecewise linear trip meter reading $x(t)$.

\subsection*{Maple}
\begin{verbatim}
 Xpc:=t->piecewise(t<0,0,
 t < 20 ,54.3, t < 32, 56.5, t < 43, 49.6,  t < 49, 57.0,
 t < 65 ,61.9, t < 98, 70.9, 0.0);
 X:=t->int(Xpc(60*w),w=0..t);
 plot(X(t),t=0..98/60); # Almost a straight line.
\end{verbatim}


\includegraphics[scale=0.5]{figures/distance-x-of-t-evanston.png}

\begin{center}
\bf Odometer Trip Meter Reading versus Time in Hours \\
The flat spot means the SUV is stationary.\end{center}

\subsection*{Average Speed}

Define the average value of a function $f(w)$ on $a\le w \le b$ by $\frac{1}{b-a}\int_a^b f(w)dw$.
Then the average speed in the example is
$$\frac{\int_0^{98/60} \VPC{}(60w)dw }{98/60} = 61.04$$

\subsection*{A Clever Plot}

An average driver would try to maintain $61$ mph. The clever plot will create a graphic of $x(t)-61t$ on interval $0\le t \le T_1$, where $T_1$ is the $75$ mile trip time at $61$ mph.

\begin{verbatim}
# Maple code
Xpc:=t->piecewise(t<0,0, t < 20 ,54.3, t < 32, 56.5,
 t < 43, 49.6,  t < 49, 57.0, t < 65 ,61.9, t < 98, 70.9, 0.0);
 X:=t->int(Xpc(60*w),w=0..t);
 AVEspeed:=X(98/60)/(98/60); # AVEspeed = 61.04 mph
 T1:=solve(AVEspeed*t=98,t);  # T1 = 1.6 hours
 plot(X(t)-AVEspeed*t,t=0..T1);
\end{verbatim}

\includegraphics[scale=0.7]{figures/clever-plot-evanston.png}

We see from the graphic that segments of the road cause a slowdown of up to 6 mph, but for a brief interval it is possible to exceed the average speed, due to 70 and 75 mph speed limits.

\begin{verbatim}
# Maple code for piecewise linear display
X:=t->int(Xpc(60*w),w=0..t);convert(X(t),piecewise,t):evalf(%,4);
\end{verbatim}

\medskip

Trip meter at time $t$ =
                    $\cases{ 0.0&$t\leq  0.0$\cr  54.30\,t&$t\leq  0.3333$\cr  56.50\,t- 0.7333&$t\leq  0.5333$\cr  49.60\,t+ 2.947&$t\leq  0.7167$\cr  57.0\,t- 2.357&$t\leq  0.8167$\cr  61.90\,t- 6.358&$t\leq  1.083$\cr  70.90\,t- 16.11&$t\leq  1.633$\cr  99.70&$ 1.633<t$\cr}$

\fi
\end{document}
\endinput 
