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

\usepackage{color}
\usepackage{amssymb}
\usepackage{hyperref}
\newcommand{\ALPHA}{\checkmark} 

\setlength{\unitlength}{0.1in}

\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{-0.4in}
\setlength{\headheight}{0.0in}
\setlength{\headsep}{0.0in}
\setlength{\topskip}{0.0in}
\setlength{\textheight}{9.4in}
\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{\force}{{$\mbox{\;}$}}

\begin{document}

%\pagestyle{empty}

\noindent
{\bf Math 1030 Workshop \#5 (Due: July 27${}^{\mathrm{th}}$, 2016)} \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 3x^3+9x^2+5x+3       & x \leq -1  \Large\strut \\
 \displaystyle (7x^4-6x)e^{-x^2} & -1 < x \leq 1 \Large\strut \\
 \displaystyle  x^2-5x+2\ln(x)  & x > 1  \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.05in}

\verb|piecewise[{ {3x^3+9x^2+5x+3,x<=-1}, {(7x^4-6x)e^(-x^2),-1<x<=1}, {x^2-5x+2 ln(x),x>1} }]| \href{https://www.wolframalpha.com/input/?i=piecewise%5B%7B+%7B3x%5E3%2B9x%5E2%2B5x%2B3,x%3C%3D-1%7D,+%7B(7x%5E4-6x)e%5E(-x%5E2),-1%3Cx%3C%3D1%7D,+%7Bx%5E2-5x%2B2+ln(x),x%3E1%7D+%7D%5D}{\ALPHA}

\vspace{0.05in}

To find critical points we need to look at $f(x)$ one piece at a time. Before doing this, let's note that $f(x)$ has a critical points at $x=-1$ and $x=1$. $f(x)$ switches formulas and is discontinuous there. This means that $f'(x)$ is undefined at $x = \pm 1$ so these are critical points.

\vspace{0.05in}

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

\vspace{0.05in}

Alpha let's us know that this formula has roots at $x=-5/3$ and $-1/3$. Notice that $-5/3 \approx -1.667 \leq -1$ but $-1/3 \approx -0.333 > -1$. This means that $x=-1/3$ is out of bounds for this formula (this formula is only valid for $x \leq -1$), so we throw $x=-1/3$  out.

\vspace{0.05in}

\verb|derivative (7x^4-6x)e^(-x^2)| \href{https://www.wolframalpha.com/input/?i=derivative+(7x%5E4-6x)e%5E(-x%5E2)}{\ALPHA}

\vspace{0.05in}

The middle formula's derivative has roots at $x \approx -1.23835$, $0.49781$, and $1.56091$. This formula is only valid for $-1<x \leq 1$, so we need to throw out $-1.23835$ and $1.56091$.

\vspace{0.05in}

\verb|derivative x^2-5x+2 ln(x)| \href{https://www.wolframalpha.com/input/?i=derivative+x%5E2-5x%2B2+ln(x)}{\ALPHA}

\vspace{0.05in}

The derivative of our final piece has roots at $x=1/2$ and $x=2$. Again, this formula is only valid for $x>1$ so we must throw out $x=1/2$.


   \begin{enumerate}
   \item Find all of the critical points of $f(x)$.
             \qquad $x =$ \underline{\qquad $-5/3 \approx -2.667$, $-1$, $0.49781$, $1$, and $2$ \qquad}

\vspace{0.1in}

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

\vspace{0.05in}

\verb|plot piecewise[{ {3x^3+9x^2+5x+3,x<=-1}, {(7x^4-6x)e^(-x^2),-1<x<=1},|\\
\force \hfill \verb|{x^2-5x+2 ln(x),x>1} }] on [-2,4]| \href{https://www.wolframalpha.com/input/?i=plot+piecewise%5B%7B+%7B3x%5E3%2B9x%5E2%2B5x%2B3,x%3C%3D-1%7D,+%7B(7x%5E4-6x)e%5E(-x%5E2),-1%3Cx%3C%3D1%7D,+%7Bx%5E2-5x%2B2+ln(x),x%3E1%7D+%7D%5D+on+%5B-2,4%5D}{\ALPHA}

\vspace{0.05in}

Looking at the plot we can see that the maximum value must occur at the first formula's peak (this occurs at its critical point at $x=-5/3 \approx -1.667$). The minimum value must occur at the third formula's valley (this occurs at its critical point at $x=2$). We just need to know the function's value at these points.

\vspace{0.05in}

\verb|piecewise[{ {3x^3+9x^2+5x+3,x<=-1}, {(7x^4-6x)e^(-x^2),-1<x<=1},|\\ \force \hfill \verb|{x^2-5x+2 ln(x),x>1} }] at x=-5/3| \href{https://www.wolframalpha.com/input/?i=piecewise%5B%7B+%7B3x%5E3%2B9x%5E2%2B5x%2B3,x%3C%3D-1%7D,+%7B(7x%5E4-6x)e%5E(-x%5E2),-1%3Cx%3C%3D1%7D,+%7Bx%5E2-5x%2B2+ln(x),x%3E1%7D+%7D%5D+at+x%3D-5%2F3}{\ALPHA}

\vspace{0.05in}
   
Or\dots \quad \verb|3x^3+9x^2+5x+3 at x=-5/3| \href{https://www.wolframalpha.com/input/?i=3x%5E3%2B9x%5E2%2B5x%2B3+at+x%3D-5%2F3}{\ALPHA}

\vspace{0.05in}

Either way, we get that $f(-5/3) = \dfrac{52}{9} \approx 5.77778$.

\verb|piecewise[{ {3x^3+9x^2+5x+3,x<=-1}, {(7x^4-6x)e^(-x^2),-1<x<=1},|\\ \force \hfill \verb|{x^2-5x+2 ln(x),x>1} }] at x=2| \href{https://www.wolframalpha.com/input/?i=piecewise%5B%7B+%7B3x%5E3%2B9x%5E2%2B5x%2B3,x%3C%3D-1%7D,+%7B(7x%5E4-6x)e%5E(-x%5E2),-1%3Cx%3C%3D1%7D,+%7Bx%5E2-5x%2B2+ln(x),x%3E1%7D+%7D%5D+at+x%3D2}{\ALPHA}

\vspace{0.05in}

Or\dots \verb|x^2-5x+2 ln(x) at x=2| \href{https://www.wolframalpha.com/input/?i=x%5E2-5x%2B2+ln(x)+at+x%3D2}{\ALPHA}

\vspace{0.05in}

Either way, we get that $f(2) = 2\ln(2) - 6 \approx -4.61371$.

\vspace{0.15in}

         The maximum value of $f(x)$ is \underline{\quad $52/9 \approx 5.77778$ \quad}. This occurs when $x=$ \underline{\quad $-5/3 \approx -1.66667$ \quad}.

\vspace{0.1in}

         The minimum value of $f(x)$ is \underline{\quad  $2\ln(2)-6 \approx -4.61371$ \quad}. This occurs when $x=$ \underline{\quad $2$ \quad}.
   \end{enumerate}

\vspace{0.05in}
 
\newpage

  \item Riverdale Highschool has an expensive copying machine. It could cost \$7,000 to replace their machine. They have recorded that they spent \$50 reparing the copier during its first year of operation. The next year it cost \$190 to fix their machine. The third year it cost \$350 to fix it. 

Use Excel to find a power model for the \underline{\bf average} annual repair costs. Then model the average annual cost of operating this copying machine using a function of the form: $\displaystyle{A(t) = \frac{C}{t} + Rt^r}$ where $C$ is the cost of purchasing the copier and $Rt^r$ models the repair costs. 
            
\vspace{0.05in}

First, we need to figure out our power model for repair costs. When $t=1$ we have that $Rt^r$ should be \$50. For $t=2$ our average repair costs are $\dfrac{\$50+\$190}{2} = \$120$ (per year). For $t=3$ we get $\dfrac{\$50+\$190+\$350}{3} \approx \$196.67$. After creating a table in Excel with\dots

\vspace{-0.15in}

\force \hfill
\begin{tabular}{|c|c|c|c|} \hline
$t=$ & 1 & 2 & 3 \\ \hline
$Rt^r=$ & 50 & 120 & 196.67 \\ \hline
\end{tabular}
\hfill \force

\dots{}insert a scatter plot. Then add a power trendline. Excel tells us that $y = 50.137x^{1.2483}$. Now we can write down our average annual cost function.

\vspace{-0.1in}

\hspace{2.25in}            $A(t) =$ \underline{\quad $\dfrac{7000}{t}+50.137t^{1.2483}$ \quad}
            
\vspace{0.05in}

To find the minimum of $A(t)$ let's find its critical points. Then create a graph and see what the function looks like.

\vspace{0.05in}

\verb|derivative 7000/t + 50.137 t^1.2483| \href{https://www.wolframalpha.com/input/?i=derivative+7000%2Ft+%2B+50.137+t%5E1.2483}{\ALPHA}

\vspace{0.05in}

\verb|plot 7000/t + 50.137 t^1.2483 on [0,20]| \href{https://www.wolframalpha.com/input/?i=plot+7000%2Ft+%2B+50.137+t%5E1.2483+on+%5B0,20%5D}{\ALPHA}

\vspace{0.05in}

Clearly we have a critical point at $t=0$ (where $A(t)$ is not continuous). But the only interesting critical point is at $t \approx 8.15054$.  Looking at the plot, this is definitely the location of $A(t)$'s minimum. Note that $0.15054(12) = 1.80648 \approx 2$ months. 

\vspace{0.05in}

\verb|7000/t + 50.137 t^1.2483 at t=8.15054| \href{https://www.wolframalpha.com/input/?i=7000%2Ft+%2B+50.137+t%5E1.2483+at+t%3D8.15054}{\ALPHA}

\vspace{0.1in}

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

            Riverdale should replace its copying machine after \underline{\quad 8 \quad} years and \underline{\quad 2 \quad} months of opertion. \\
            {}[Round up to the next whole month.]
            
\vspace{0.1in}

            If they do this, their average annual cost (for the copier) should be \$ \underline{\quad 1,546.84 \quad}.                       

 \vspace{0.1in}

   \item Stew's business uses specialty print cartridges for their photo ID printer each year. These cartridges cast \$150 a piece. Placing an order costs \$10. Stew's inventory cost is rather low. He estimates that it costs him \$0.10 per year per cartridge (based on average inventory with all of the standard assumptions). Let $C(x)$ be Stew's annual cost function for these cartridges.

             \vspace{0.1in}
             
   \begin{enumerate}
      \item If Stew needs 200 cartridges each year, \quad $C(x)=$ \underline{\quad $200(150)+10\left(\dfrac{200}{x}\right)+0.10\left(\dfrac{x}{2}\right)$ \quad}

\vspace{0.05in}

\verb|plot 200(150) + 10(200/x) + 0.10(x/2) on [1,150]| \href{https://www.wolframalpha.com/input/?i=plot+200(150)+%2B+10(200%2Fx)+%2B+0.10(x%2F2)+on+%5B1,150%5D}{\ALPHA}

\vspace{0.05in}

\verb|derivative 200(150) + 10(200/x) + 0.10(x/2)| \href{https://www.wolframalpha.com/input/?i=derivative+200(150)+%2B+10(200%2Fx)+%2B+0.10(x%2F2)}{\ALPHA}

\vspace{0.05in}

We see that $C(x)$ has critical points at $\pm 200$ (and $0$). Obviously, $x=200$ is the extreme end of our domain. Our function decreases all the way down to the end. That is where our minimum occurs. [By the way, here our ideal solution is also a practical solution.]

\vspace{0.05in}

\verb|200(150) + 10(200/x) + 0.10(x/2) at x=200| \href{https://www.wolframalpha.com/input/?i=200(150)+%2B+10(200%2Fx)+%2B+0.10(x%2F2)+at+x%3D200}{\ALPHA}

\vspace{0.05in}

We see that $C(200)=30,020$ is the minimum value of $C(x)$.

             \vspace{0.1in}

             His {\bf ideal} EOQ is \underline{\quad 200 \quad} and his {\bf ideal} minimum annual cost is \underline{\quad \$30,020 \quad}.
   
             \vspace{0.1in}

      \item If Stew needs 1,000 cartridges each year, \quad $C(x)=$ \underline{\quad $1000(150)+10\left(\dfrac{1000}{x}\right)+0.10\left(\dfrac{x}{2}\right)$ \quad}

\vspace{0.05in}

\verb|plot 1000(150) + 10(1000/x) + 0.10(x/2) on [1,1000]| \href{https://www.wolframalpha.com/input/?i=plot+1000(150)+%2B+10(1000%2Fx)+%2B+0.10(x%2F2)+on+%5B1,1000%5D}{\ALPHA}

\vspace{0.05in}

\verb|derivative 1000(150) + 10(1000/x) + 0.10(x/2)| \href{https://www.wolframalpha.com/input/?i=derivative+1000(150)+%2B+10(1000%2Fx)+%2B+0.10(x%2F2)}{\ALPHA}

\vspace{0.05in}

This time $C(x)$ has critical points at $\pm 447.214$ (and $0$). Looking at the graph, obviously the minimum occurs at $x=447.214$. We need to know the value of $C(x)$ at this point.

\vspace{0.05in}

\verb|1000(150) + 10(1000/x) + 0.10(x/2) at x=447.214| \href{https://www.wolframalpha.com/input/?i=1000(150)+%2B+10(1000%2Fx)+%2B+0.10(x%2F2)+at+x%3D447.214}{\ALPHA}

\vspace{0.05in}

We find that $C(447.214) \approx 150,045$. This is the minimum value of the cost function.

             \vspace{0.1in}

             His {\bf ideal} EOQ is \underline{\quad 447.214 \quad} and his {\bf ideal} minimum annual cost is \underline{\quad \$150,045 \quad}.
   
             \vspace{0.1in}

   \item Suppose that Stew needs 2,000 cartridges each year. In addition, he found out that he gets a discount if he places a large order. For orders of 300 or more, he pay \$135 per cartridge. However, there is an additional delivery fee for these large orders. Instead of \$10, it costs \$50 to place a large order. His inventory costs stay the same.

             \vspace{0.1in}

             $\displaystyle{C(x) = \left\{ \begin{array}{ccc} 2000(150)+10\left(\dfrac{2000}{x}\right)+0.10\left(\dfrac{x}{2}\right) & & x < 300 \vspace{0.05in} \\ 2000(135)+50\left(\dfrac{2000}{x}\right)+0.10\left(\dfrac{x}{2}\right) & & x \geq 300 \end{array} \right.}$ 

             \vspace{0.1in}

\verb|piecewise[{ {2000(150)+10(2000/x)+0.10(x/2),x<300}, {2000(135)+50(2000/x)+0.10(x/2),x>=300} }]| \href{https://www.wolframalpha.com/input/?i=piecewise%5B%7B+%7B2000(150)%2B10(2000%2Fx)%2B0.10(x%2F2),x%3C300%7D,+%7B2000(135)%2B50(2000%2Fx)%2B0.10(x%2F2),x%3E%3D300%7D+%7D%5D}{\ALPHA}

\vspace{0.05in}

Clearly, the minimum occurs after the price break. Let's focus on that part of the formula.

\vspace{0.05in}

\verb|plot 2000(135)+50(2000/x)+0.10(x/2) on [300,2000]| \href{https://www.wolframalpha.com/input/?i=plot+2000(135)%2B50(2000%2Fx)%2B0.10(x%2F2)+on+%5B300,2000%5D}{\ALPHA}

\vspace{0.05in}

It looks like the minimum occurs at this second formula's critical point (sound around 1400). Let's find its exact location.

\vspace{0.05in}

\verb|derivative 2000(135)+50(2000/x)+0.10(x/2)| \href{https://www.wolframalpha.com/input/?i=derivative+2000(135)%2B50(2000%2Fx)%2B0.10(x%2F2)}{\ALPHA}

\vspace{0.05in}

Apparently this critical point is $x \approx 1414.21$. We need to plug this in to find the corresponding ideal minimum cost.

\vspace{0.05in}

\verb|2000(135)+50(2000/x)+0.10(x/2) at x=1414.21| \href{https://www.wolframalpha.com/input/?i=2000(135)%2B50(2000%2Fx)%2B0.10(x%2F2)+at+x%3D1414.21}{\ALPHA}

\vspace{0.05in}

Here we find the value of $C(x)$ at $x=1414.21$ is $270141$.

\vspace{0.05in}

             His {\bf ideal} EOQ is \underline{\quad 1,414.21 \quad}. His {\bf ideal} minimum annual cost is \underline{\quad \$270,141 \quad}.

   \end{enumerate}

\end{enumerate}

\end{document}
