\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumerate}
\usepackage{ifthen}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{color}


\setlength{\unitlength}{0.1in}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0.0in}
\setlength{\headsep}{0.0in}
\setlength{\topskip}{0.0in}
\setlength{\textheight}{9.5in}
\setlength{\textwidth}{7.5in}

\newcommand{\comp}{ \,{\scriptstyle \stackrel{\circ}{}}\, } 
\newcommand{\nullset}{\mathrm{O}\!\!\!\!\big/\,}
\newcommand{\divides}{\,\Big|\,}
\newcommand{\varspace}[2]{\mbox{\parbox[c][#1]{#2}{\hfill}}}
\newcommand{\myspace}{\varspace{0.35in}{0.35in}}

\newcommand{\ALPHA}{\checkmark} 

\newcommand{\force}{{$\mbox{\;}$}}

\begin{document}

%\pagestyle{empty}

\noindent
{\bf Math 1030 Workshop \#5 (Due: July 27${}^{\mathrm{th}}$, 2013)} \hfill
{\bf Name: \underline{\Large\sc\color{red} \quad Answer Key \quad }}

\vspace{0.05in}

\noindent
Please turn in a paper copy and {\bf SHOW YOUR WORK!}

\vspace{0.05in}

\begin{enumerate}
   \item Consider the function 
$\displaystyle{ f(x) = \left\{ \begin{array}{cc}
 \displaystyle -0.2x^2+x+3       & x \leq -1  \Large\strut \\
 \displaystyle (x-0.2)^2 e^{-0.3(x-0.2)^2} & -1 < x < 2 \Large\strut \\
 \displaystyle  2x^3-10.6x^2+18x-9  & x \geq 2  \Large\strut
 \end{array} \right. }$

Be careful! Wolfram Alpha may have trouble with this function. You might want to deal with it one piece at a time.

\vspace{0.1in}

$f(x)$ defined in {\sc Alpha}:

\verb|Piecewise[{{-0.2x^2+x+3,x<=-1},{(x-0.2)^2e^(-0.3(x-0.2)^2),-1<x<2},{2x^3-10.6x^2+18x-9,x>=2}}]| \href{https://www.wolframalpha.com/input/?i=Piecewise%5B%7B%7B-0.2x%5E2%2Bx%2B3%2Cx%3C%3D-1%7D%2C%7B%28x-0.2%29%5E2e%5E%28-0.3%28x-0.2%29%5E2%29%2C-1%3Cx%3C2%7D%2C%7B2x%5E3-10.6x%5E2%2B18x-9%2Cx%3E%3D2%7D%7D%5D}{\ALPHA}

\vspace{0.1in}

We are (eventually) asked to find the minimum and maximum when $-2 \leq x \leq 3$, so let's plot this function on that interval:

\verb|plot Piecewise[{{-0.2x^2+x+3,x<=-1},{(x-0.2)^2e^(-0.3(x-0.2)^2),-1<x<2},{2x^3-10.6x^2+18x-9,x>=2}}]|\\ \force \hfill \verb|where -2 < x < 3| \href{https://www.wolframalpha.com/input/?i=plot+Piecewise%5B%7B%7B-0.2x%5E2%2Bx%2B3%2Cx%3C%3D-1%7D%2C%7B%28x-0.2%29%5E2e%5E%28-0.3%28x-0.2%29%5E2%29%2C-1%3Cx%3C2%7D%2C%7B2x%5E3-10.6x%5E2%2B18x-9%2Cx%3E%3D2%7D%7D%5D+where+-2+%3C+x+%3C+3}{\ALPHA}

\vspace{0.1in}

If we can't remember the ``Piecewise'' command (or just don't want to deal with it), we can instead look at the graphs of all three formulas together and just ``ignore'' the parts that aren't relevant:

\verb|plot -0.2x^2+x+3, (x-0.2)^2e^(-0.3(x-0.2)^2), 2x^3-10.6x^2+18x-9 where -2 < x < 3|
\href{https://www.wolframalpha.com/input/?i=plot%20-0.2x%5E2%2Bx%2B3%2C%20(x-0.2)%5E2e%5E(-0.3(x-0.2)%5E2)%2C%202x%5E3-10.6x%5E2%2B18x-9%20where%20-2%20%3C%20x%20%3C%203&t=crmtb01}{\ALPHA}

\vspace{0.1in}

We need to find critical points. These are points where the derivative is undefined or equal to zero. First of all, the derivative cannot be defined at $x=-1$ and $x=2$ since $f(x)$ is discontinuous at these points (see the graph) -- this isn't surprising since we {\it usually} (but not always) have a critical point anywhere our piecewise defined function switches formulas.

Next, we would like to find the derivative, but {\sc Alpha} has trouble differentiating piecewise defined functions (and doing anything with them). So instead of tackling the entire function at once, we will deal with it one piece at a time.

\vspace{0.1in}

\verb|derivative -0.2x^2+x+3| \href{https://www.wolframalpha.com/input/?i=derivative+-0.2x%5E2%2Bx%2B3}{\ALPHA}

We find that this derivative has a root at $x=2.5$. Since this point occurs when $x > -1$, it lies outside of the domain of definition for the first formula. So we don't get any critical points from this formula.

\verb|derivative (x-0.2)^2e^(-0.3(x-0.2)^2)| \href{https://www.wolframalpha.com/input/?i=derivative+%28x-0.2%29%5E2e%5E%28-0.3%28x-0.2%29%5E2%29}{\ALPHA}

We find that this derivative has roots at $x=-1.62574$, $0.2$, and $2.02574$ (click ``Approximate forms''). However, this formula is only valid for $-1<x < 2$, so we must discard $x=-1.62574$ and $x=2.02574$. So we get one new critical point: $x=0.2$.

\verb|derivative 2x^3-10.6x^2+18x-9| \href{https://www.wolframalpha.com/input/?i=derivative+2x%5E3-10.6x%5E2%2B18x-9}{\ALPHA}

We find that this derivative has 2 roots: $x=1.41866$ and $x=2.11468$. However, $x=1.41866 < 2$ and so this point is outside the domain where the third formula is used (i.e. $x \geq 2$). On the other hand, $x=2.11468 \geq 2$ so this gives us yet another critical point.

   \begin{enumerate}
   \item Find all of the critical points of $f(x)$.
             \qquad $x =$ \underline{\quad $-1, \quad 0.2, \quad 2, \quad \mbox{and} \quad 2.11468$ \quad}

\vspace{0.1in}

   \item Restricting our attention to the interval $[-2,3]$...
   

When we look at the graph is it obvious that the minimum occurs where the second formula dips down (at the critical point $x=0.2$). The maximum seems to occur at the endpoint $x=3$. Plugging $x=0.2$ into the second formula and $x=3$ into the third formula will then yield the minimum and maximum values.

Alternatively, we could plug in all of the critical points along with the end points $x=-2$ and $x=3$ and see which values are the biggest and smallest --- this is essentially what we'd need to do if we didn't have a reliable graph. [{\it Note:} Technically, we would also need to check right \& left hand limits at each point of discontinuity. The extreme value theorem doesn't apply directly since our function isn't continuous. Typically, we won't worry about these technicalities and just rely on the graph.]  I will plug in all critical points, end points, and take ``limits'' where formulas switch (by ``limits'' I mean plug in ends of intervals of definition. For example: the second formula isn't defined for $x=-1$ and $x=2$, but we can limit to these inputs, so I'll plug them in anyway)\dots

\vspace{0.1in}

\verb|-0.2x^2+x+3 at x=[-2,-1]| \href{https://www.wolframalpha.com/input/?i=-0.2x%5E2%2Bx%2B3+at+x%3D%5B-2%2C-1%5D}{\ALPHA}

\vspace{0.1in}

This gives us $f(-2)=0.2$ and $f(-1)=1.8$ (using the first formula).

\vspace{0.1in}

\verb|(x-0.2)^2e^(-0.3(x-0.2)^2) at x=[-1,0.2,2]| \href{https://www.wolframalpha.com/input/?i=%28x-0.2%29%5E2e%5E%28-0.3%28x-0.2%29%5E2%29+at+x%3D%5B-1%2C0.2%2C2%5D}{\ALPHA}

\vspace{0.1in}

This gives us $\displaystyle \lim\limits_{x \to -1^+} f(x)=0.934862$, $f(0.2)=0$, and $\displaystyle \lim\limits_{x \to 2^-} f(x) = 1.22578$.

\vspace{0.1in}

\verb|2x^3-10.6x^2+18x-9 at x=[2,2.11468,3]| \href{https://www.wolframalpha.com/input/?i=2x%5E3-10.6x%5E2%2B18x-9+at+x%3D%5B2%2C2.11468%2C3%5D}{\ALPHA}

\vspace{0.1in}

This gives us $f(2)=0.6$, $f(2.11468)=0.575557$, and $f(3)=3.6$.

\vspace{0.1in}

Considering all of these outputs, $f(0.2)=0$ is the smallest and $f(3)=3.6$ is the largest. Thus we have found our minimum and maximum for $f(x)$ when $-2 \leq x \leq 3$.

\vspace{0.1in}

         The maximum value of $f(x)$ is \underline{\quad 3.6 \quad}. This occurs when $x=$ \underline{\quad 3 \quad}.

   \vspace{0.1in}

         The minimum value of $f(x)$ is \underline{\quad 0 \quad}. This occurs when $x=$ \underline{\quad 0.2 \quad}.
   \end{enumerate}

% \vspace{0.1in}

 \item Green Villa Resort (located in Greenville, NC) uses golf carts to transport their guests around the grounds. Their carts cost \$2,000. They have noticed that a cart typically requires \$100 of repairs and maintenance during the its first year of operation, then \$360 during its second year, and then \$660 during its third year. 
  
Use Excel to find a power model for the {\bf average} annual repair costs. Then model the average annual cost of operating a golf cart using a function of the form: $\displaystyle{A(t) = \frac{C}{t} + Rt^r}$ where $C$ is the cost of purchasing the cart and $Rt^r$ models the repair costs. 
            
Notice that the average repair cost for year 1 is \$100 (given). The average repair cost per year for a cart that is only kept 2 years is $\dfrac{\$100+\$360}{2} = \$230$. Finally, the average repair cost per year for a cart kept only 3 years is $\displaystyle \frac{\$100+\$360+\$660}{3} = \$373.33$. So we should make a table in Excel with the following data:

\vspace{-0.1in}

\force \hspace{2in}
\begin{tabular}{|c|c|c|c|} \hline
Years Owned & 1 & 2 & 3 \\ \hline
Average Repair Cost & \$100 & \$230 & \$373.33 \\ \hline 
\end{tabular}

If we highlight this data, create a scatter plot, and add a ``power'' trendline. We find that $y = 100.04x^{1.1993}$ best fits this data. [Forgetting to average the yearly costs and using \$100, \$360, \$660 yields the (incorrect) model: $y=102.2x^{1.7317}$.]

\vspace{-0.1in}

\[  A(t) = \frac{2000}{t} + 100.4t^{1.1993} \]

We need to find the minimum value of $A(t)$. So we take it's derivative and find critical points.

\vspace{0.1in}

\verb|derivative 2000/t + 100.4t^1.1993| \href{https://www.wolframalpha.com/input/?i=derivative%202000%2Ft%20%2B%20100.4t%5E1.1993&t=crmtb01}{\ALPHA}

\vspace{0.1in}

We can see that $A'(t)$ is not defined at $t=0$ (but we should only consider $t>0$). We have a root at $t=3.58831$.
Looking at the plot where $1 \leq t \leq 6$ we see\dots

\vspace{0.1in}

\verb|plot 2000/t + 100.4t^1.1993 on [1,6]| \href{https://www.wolframalpha.com/input/?i=plot+2000%2Ft+%2B+100.4t%5E1.1993+on+%5B1%2C6%5D}{\ALPHA}

\vspace{0.1in}

The graph confirms that our critical point $t=3.58831$ is indeed the minimum.
            
\vspace{0.1in}

             When \underline{\quad $t=3.58831$ \quad}, $A(t)$ is minimized. [Keep 5 decimal places.]
             
\vspace{0.1in}

Let's plug this value into $A(t)$\dots

\vspace{0.1in}

\verb|2000/t + 100.4t^1.1993 at t=3.58831| \href{https://www.wolframalpha.com/input/?i=2000%2Ft+%2B+100.4t%5E1.1993+at+t%3D3.58831}{\ALPHA}

\vspace{0.1in}

We find that $C(3.58831) = \$1,022.11$. Also, $3.58831$ is $3$ years and $0.58831 \times 12 = 7.05972$ months.

\vspace{0.1in}

            Green Villa should replace its golf carts every \underline{\quad 3 \quad} years and \underline{\quad 8 \quad} months. \\
            {}[Round up to the next whole month.]
            
\vspace{0.05in}

            If they do this, their average annual cost (per cart) should be \$ \underline{\quad \$1,022.11 \quad}.                       

 \vspace{0.1in}

   \item Jonas manages an office which uses a lot of paper. He can get paper for \$3 a ream and has found that his average storage cost is \$0.05 per ream per year (base inventory costs on average inventory making all of the standard assumptions). Finally, Jonas pays \$30 every time he places an order. Let $C(x)$ be his annual cost function (for paper).
   
In general we have, 

\vspace{-0.2in}

\begin{eqnarray*}
 \mbox{annual cost} & = & \mbox{Base Cost} + \mbox{Shipping Cost} + \mbox{Storage Cost}\\
                                     & = & (\mbox{\# of items})(\mbox{price per item}) + (\mbox{shipping per order})(\mbox{\# of orders}) + (\mbox{ave. inv.})(\mbox{inv. per item per yr.}) \\
                                     & = & (\mbox{\# of items})(\mbox{price per item}) + (\mbox{shipping per order})\left(\frac{\mbox{\# of items}}{x}\right) + \left(\frac{x}{2}\right)(\mbox{inv. per item per yr.}) 
\end{eqnarray*}
             
   \begin{enumerate}
      \item If Jonas needs 1,000 reams each year, \quad $C(x)= 3(1000) + 30 \left(\dfrac{1000}{x}\right) + 0.05\left(\dfrac{x}{2}\right)$.

             \vspace{0.05in}

Let's plot the cost function on the interval: $1 \leq x \leq 1000$ and compute its derivative to find critical points.

\vspace{0.05in}

\verb|plot 3(1000)+30(1000/x)+0.05(x/2) on [1,1000]| \href{https://www.wolframalpha.com/input/?i=plot+3%281000%29%2B30%281000%2Fx%29%2B0.05%28x%2F2%29+on+%5B1%2C1000%5D}{\ALPHA}

\vspace{0.05in}

\verb|derivative 3(1000)+30(1000/x)+0.05(x/2)| \href{https://www.wolframalpha.com/input/?i=derivative+3%281000%29%2B30%281000%2Fx%29%2B0.05%28x%2F2%29}{\ALPHA}

\vspace{0.05in}

All of the critical points lie outside of the domain $1 \leq x \leq 1000$, so the minimum must occur at an endpoint. Specifically at $x=1000$. 

\vspace{0.05in}

\verb|3(1000)+30(1000/x)+0.05(x/2) at x=1000| \href{https://www.wolframalpha.com/input/?i=3%281000%29%2B30%281000%2Fx%29%2B0.05%28x%2F2%29+at+x%3D1000}{\ALPHA}

\vspace{0.1in}

             His {\bf ideal} EOQ is \underline{\quad 1,000 \quad} and his {\bf ideal} minimum annual cost is \underline{\quad \$3,055.00 \quad}.
   
             \vspace{0.05in}

      \item If Jonas needs 10,000 reams each year, \quad $C(x)= 3(10000) + 30 \left(\dfrac{10000}{x}\right) + 0.05\left(\dfrac{x}{2}\right)$.

             \vspace{0.05in}

Let's plot the cost function on the interval: $1 \leq x \leq 10000$ and compute its derivative to find critical points.

\vspace{0.05in}

\verb|plot 3(10000)+30(10000/x)+0.05(x/2) on [1,10000]| \href{https://www.wolframalpha.com/input/?i=plot+3%2810000%29%2B30%2810000%2Fx%29%2B0.05%28x%2F2%29+on+%5B1%2C10000%5D}{\ALPHA}

\vspace{0.05in}

\verb|derivative 3(10000)+30(10000/x)+0.05(x/2)| \href{https://www.wolframalpha.com/input/?i=derivative+3%2810000%29%2B30%2810000%2Fx%29%2B0.05%28x%2F2%29}{\ALPHA}

\vspace{0.05in}

The only critical point within our domain (i.e. $1 \leq x \leq 10000$) is $x = 3464.1$. From the plot, it is obvious that this is the location of our minimum.

\vspace{0.05in}

\verb|3(10000)+30(10000/x)+0.05(x/2) at x=3464.1| \href{https://www.wolframalpha.com/input/?i=3%2810000%29%2B30%2810000%2Fx%29%2B0.05%28x%2F2%29+at+x%3D3464.1}{\ALPHA}

\vspace{0.1in}

             His {\bf ideal} EOQ is \underline{\quad 3,464.1 \quad} and his {\bf ideal} minimum annual cost is \underline{\quad \$30,173.20 \quad}.
   
             \vspace{0.05in}

   \item Suppose that Jonas needs 5,000 reams each year. In addition, he found out that he gets a discount if he places a large order. For orders of 1,000 reams or more, he pays \$2.75 per ream. However, the paper company makes large deliveries in their ``big truck'', so the shipping cost jumps to \$200 and Jonas also figured that his inventory costs jump up to \$0.15 per ream (based on average inventory).

             \vspace{0.05in}

             $\displaystyle{C(x) = \left\{ \begin{array}{ccc} 
                   3(5000) +   30\left(\frac{5000}{x}\right) + 0.05\left(\frac{x}{2}\right) & & x<1000 \varspace{0.3in}{0.01in} \\
             2.75(5000) + 200\left(\frac{5000}{x}\right) + 0.15\left(\frac{x}{2}\right) & & x\geq 1000 \varspace{0.3in}{0.01in} \end{array} \right.}$ 

             \vspace{0.05in}

\verb|plot Piecewise[{{3(5000)+30(5000/x)+0.05(x/2),x<1000},|\\ \force \hfill \verb|{2.75(5000)+200(5000/x)+0.15(x/2),x>=1000}}] on [1,5000]| \href{https://www.wolframalpha.com/input/?i=plot+Piecewise%5B%7B%7B3%285000%29%2B30%285000%2Fx%29%2B0.05%28x%2F2%29%2Cx%3C1000%7D%2C%7B2.75%285000%29%2B200%285000%2Fx%29%2B0.15%28x%2F2%29%2Cx%3E%3D1000%7D%7D%5D+on+%5B1%2C5000%5D}{\ALPHA}

             \vspace{0.05in}

From the plot it is apparent that the minimum occurs when $x\geq 1000$, so we can discard the first formula and just focus on the second one. We need to find this formula's critical points.

             \vspace{0.05in}

\verb|derivative 2.75(5000)+200(5000/x)+0.15(x/2)| \href{https://www.wolframalpha.com/input/?i=derivative+2.75%285000%29%2B200%285000%2Fx%29%2B0.15%28x%2F2%29}{\ALPHA}

             \vspace{0.05in}

The only critical point of relevance is $x=3651.48$ (notice that this lies within our second formula's domain: $1000 \leq x \leq 5000$). Our minimum must occur at either this critical point or one of the endpoints (for the second graph). Let's plug all of these in\dots

\vspace{0.05in}

\verb|2.75(5000)+200(5000/x)+0.15(x/2) at x=[1000,3651.48,5000]| \href{https://www.wolframalpha.com/input/?i=2.75%285000%29%2B200%285000%2Fx%29%2B0.15%28x%2F2%29+at+x%3D%5B1000%2C3651.48%2C5000%5D}{\ALPHA}

\vspace{0.05in}

The lowest output is 14,297.7 which corresponds to the critical point.

\vspace{0.05in}

             His {\bf ideal} EOQ is \underline{\quad 3651.48 \quad}. His {\bf ideal} minimum annual cost is \underline{\quad \$14,297.70 \quad}.

   \end{enumerate}

\end{enumerate}


\end{document}



