% SIMIODE-TeacherStudent-Template.tex and simiode.cls for LaTeX2e
% Version 22 November 2016.
% 
% This template is to be used with the  class file "simiode.cls". 
%  
% The latest version of this class and template files 
% can be found at
% 
%       <http://www.SIMIODE.org> in the Author section.
%
% A "Quick Start Guide" appears below.
%
% This file must be processed with version LaTeX2e or higher.
% Appreciation to Mark Frantz, IUPUI; John Thoo, Yuba College; and Eric Sullivan, Carroll College.
%
\documentclass{simiode}
%
% With this version of the tex file and the associated SIMIODE.cls file you can produce BOTH a Student Version and a Teacher Version of your modeling scenario or technique narrative.
%
% Student Version contains the title STUDENT VERSION along with the NAME OF SCENARIO, with no abstract, no keywords, no tags, no author identifiers, and no COMMENTS section. The Student Version contains only the STATEMENT of the modeling scenario only with appropriate figures, data, instructions, and perhaps a bibliography appropriate for student resourcing, but nothing in the bibliography which would "give away" the nature of the modeling scenario, etc.
%
%The Teacher Version contains the material in the Student Version, namely the title NAME OF SCENARIO, now headed with   TEACHER VERSION, but also full author  identification, abstract, key words, tag words, and, following the STATEMENT, a section of COMMENTS which can be discussion of presentation  ideas, "solutions," techniques, etc.
%
% Authors can prepare a full Teacher Version using the notions immediately below  to create a pdf for review, but in review please eliminate all information about the author as we use a double-blind referee system. Such information will be restored when accepted and published in SIMIODE at www.simiode.org.
%
%***********   Toggle the following line to turn the teacher version on (1) or off (0). ***********
%
\def\TeacherEdition{1} % Toggle this line's value.
\newcommand{\teacher}[1]{\ifnum\TeacherEdition=1 #1 \fi}
%
% The \teacher{ } command wraps any text that will appear only in the teacher version of
% the document. See this file for examples. This has been done for you in the document below.   
% Rename the pdf after you compile each final version.
%
\usepackage{amsmath,amssymb}
\usepackage{color}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{url}
%
\renewcommand{\baselinestretch}{1.3}
%
% NOTE regarding macros %%
%
% Any macros defined for your paper should be contained in 
% the top matter. Likewise, any environment definitions such 
% as \newtheorem or \newenvironment should also go in the 
% top matter. 
% 
% Do not \input your macros as separate files within your 
% final version because more files make it harder for the 
% editors and users to keep track of and/or modify and 
% append your paper.
%
% Top matter is above and the beginning of the document below.
%

\usepackage{enumerate}

\begin{document}

\newpage
%
% You only need to change the NAME OF SCENARIO in the next line and delete the footnote. 
% See above for instructions on toggling from Teacher Version to Student Version.
%
\title{\ifnum\TeacherEdition=1 TEACHER VERSION %\footnote{DELETE THIS FOOTNOTE BEFORE SUBMISSION.  In the \TeX \, source code there is a toggle/option to produce a Teacher Version or a Student Version by ``carving'' out with  $\backslash$teacher\{\} that material which should only appear in the Teacher version. See the source code.}
 \else STUDENT VERSION \fi\\Modeling Indoor Temperature\\{\large After Thanos Attacks}}



\markboth{Modeling Indoor Temperature}{After Thanos Attacks}

\author{Tracy Weyand\\
Rose-Hulman Institute of Technology\\
Terre Haute  IN 47803 USA\\
weyand@rose-hulman.edu
}

\makeStitlePDFLaTex


\begin{abstract}
Students will analyze temperature variations in a room using Newton's Cooling Law. In this model, the only influence on the indoor temperature is the (oscillating) outdoor temperature (as we assume the heating/cooling system is broken).  The main goal of this project is for students to set up a model and then analyze how changing parameters in the model affects the solution.  In particular, they will analyze long-term behavior. Therefore, it is highly recommended that this project make use of technology (such as Mathematica or Maple).
%Offer an abstract which describes what the students will do and learn, including technical descriptions of mathematics, area of application, and outcomes expected for the scenario. This should help the teacher decide if the material is suitable for a given class.   This will appear in Teacher Version only.
\end{abstract}


\section*{SCENARIO DESCRIPTION}

After Thanos made half the population vanish \cite{Avengers}, weather patterns on Earth became much more stable to the point that, for modeling purposes, we can assume there is no change in the overall day-to-day weather pattern. We will assume in this model that 24 hours later, the weather will be identical to what it is now. Hence, we can model the outdoor temperature by a periodic function.



\section*{Pre-Activity}

\begin{enumerate}
\item \label{periodic} What is a periodic function? List at least three examples of periodic functions.
\item \label{period} What is the period of a periodic function? Find the period for each function you listed in question \ref{periodic}.
\item We assume that the temperature 24 hours from now is identical to the temperature right now. What property does the temperature $T(t)$ have (in terms of questions \ref{periodic} and \ref{period})? How can you express this mathematically?
\item Does this make sense in the long-term (for example, 100 days later)? How could the model be changed to make more sense in the long-term? \\
\emph{Note: Lucky for us, this is reasonable for a few days and (as you'll soon see) that's all we really need.}
\end{enumerate}


\section*{Main Activity}

As the outdoor temperature is periodic, we can write it as
\begin{equation}\label{eq: T1}
T(t) = a + b\cos(\omega t) + c\sin(\omega t)
\end{equation}
 where $t$ is time in hours. The first week we return to class in January, the lowest temperature of 35$^\circ$F occurs at 4 A.M. and the highest temperature of $55^\circ$F occurs at 4 P.M. each day.\\
\begin{enumerate}
\setcounter{enumi}{4}
\item \label{outdoor period} What is the smallest positive number $\omega$ that could be used in your model so that the temperature 24 hours later is identical to what it is now?
\item \label{outdoor} Use the high and low temperatures (and times) to solve for $a,b$, and $c$.\\

 \textit{Suggestion:} Take $t=0$ to be midnight, and assume that 
\begin{equation}\label{eq: T2}
T(t )= a + d\cos(\omega\beta-\omega t).
\end{equation}
 \phantom{s}\vspace{-.4cm}
 \begin{itemize}
 \item What is the smallest positive value of $\beta$ that makes the function have a maximum/minimum when it is supposed to?
 \item What values for $a$ and $d$ make the function have the correct maximum/minimum value?
 \item Use the identity 
 \[\cos(\omega\beta-\omega t) = \cos(\omega\beta)\cos(\omega t) + \sin(\omega\beta)\sin(\omega t)\] to rewrite $T(t)$ in \eqref{eq: T2} into its original form \eqref{eq: T1} (i.e. from this identity, you can now find $b$ and $c$).
 \end{itemize}   
\end{enumerate}



\noindent Suppose that the furnace in your residence hall breaks at midnight one night. We are going to look at the temperature in your room, $y(t)$, over the next few days while the furnace is being repaired.


\begin{enumerate}
\setcounter{enumi}{6}
\item Since the furnace is off, the only influence on your room temperature is the ``surrounding" outdoor temperature. 
\begin{enumerate}
\item \label{start} Assume that it was $75^\circ$F in your room when the furnace broke. Using Newton's Cooling Law and the equation you found for the outdoor temperature $T(t)$ (in the form of \eqref{eq: T1} above), write an initial-value problem to model the temperature in your room.\\
 \textit{Suggestion:} Let $t=0$ be midnight the night the furnace goes out.
\item \label{sign} Should the proportionality constant $k$ in (the differential equation form of) Newton's Cooling Law be positive or negative? Explain your reasoning.
\item Assume that $|k| = 0.4$ (and use the sign of $k$ from question \ref{sign}). Solve your initial-value problem from \ref{start} with this proportionality constant; you may use technology. 
\item Graph the solution $y(t)$.
\item You have medication in your room that is supposed to be kept above $45^\circ$F. Do you need to worry? Make some observations and discuss the ability of your solved solution to reflect reality.
\item Describe the long-term behavior in words. At what time(s) is the temperature in your room the highest? Lowest? \emph{Be precise.}
\end{enumerate}


\item Use technology to solve the same initial-value problem, but assume that the temperature in the room when the furnace broke was
\begin{enumerate}
\item $80^\circ$F
\item $70^\circ$F
\item $65^\circ$F
\end{enumerate}
Plot all three solutions on the same graph. What do you notice? %How long before the indoor temperature ``settle" into a pattern?

\item \label{proportionality} Use technology to solve the same initial-value problem (assuming the room was initially $75^\circ$F), but assume that the proportionality constant is
\begin{enumerate}
\item $|k| = 0.1$
\item $|k| = 0.6$
\item $|k| = 0.9$
\end{enumerate}
(using the sign from question \ref{sign}). 
\begin{enumerate}[i]
\item Plot all three solutions on the same graph. What do you notice?
\item Physically, the proportionality constant is related to how well the building is insulated. Does a lower or higher value of $|k|$ correspond to a well-insulated building? Justify your conclusion.
\end{enumerate}

\end{enumerate}
 

%Below is a set of References which appears in the Student Version. Note, there is a second set of References one can use for the Teacher Version.

\begin{thebibliography}{98}

\bibitem{Avengers} {\it Avengers: Infinity War}. 2018. Directed by Anthony Russo and Joe Russo, Marvel Studios.

\end{thebibliography}



\teacher{
\section*{NOTES FOR TEACHERS}

This project was adapted from Application 1.5 (``Indoor Temperature Oscillations") by Edwards and Penney \cite{EdPe}. The logic and science behind the theme is a bit far fetched, but was enjoyed by my students. You can easily remove all references to Thanos if you prefer. 

I gave this as an out-of-class group project. On average, it took about 3-4 hours for a group (of two or three students) to complete the project and write a formal, typed final submission. This can be shortened drastically by 
\begin{itemize}
\item leaving room under each question and expecting students to write solutions directly on this activity (rather than typing up a final report) and/or
\item removing the emphasis on periodic functions. I found that students struggled with this concept the most, and questions \ref{outdoor period} and \ref{outdoor} were the most time-consuming by far. The function $T(t)$ (representing the outdoor temperature) could be given. Some or all of the questions from the pre-activity could also be skipped in this case.
\end{itemize}
If both of these are done, that would  shorten this to a reasonable 50 minute in-class group activity.

The initial-value problems can be solved by hand (as they are first-order linear differential equations), but this would be time consuming for students who might not be able to quickly recognize how changing one parameter will effect the final solution. I highly recommend allowing students to use technology on this activity, as my intent is that the main goal is not in the solution technique, but rather in the set-up of the model and analysis of the solution.\\

\underline{\large Expected Solutions:}
\begin{enumerate}
\item A \emph{periodic function} is one that repeats itself at regular intervals (or periods). Some examples include $\sin(t), \cos(2t)$, and the constant function $1$.
\item The \emph{period} of a periodic function is the smallest interval length on which the function repeats itself. The period of $\sin(t)$ is $2\pi$, the period of $\cos(2t)$ is $\pi$, and the period of $1$ is zero.
\item The temperature is periodic with period 24.
\[T(t) = T(t+24)\]
\item This does not make sense in the long-term as the seasons change. One hundred days later, it is spring and the temperature should be warmer. The problem would make more sense in the long-term if we took the period to be 365 days. Then the temperature on January 1 this year is the same would be the same as it was on January 1 last year (which is reasonable), but the temperature on June 1 (during both years) is different from this temperature.
\item 
\begin{align*}
&T(t) = a + b\cos(\omega t) + c\sin(\omega t) = T(t+24) = a + b\cos(\omega (t+24)) + c\sin(\omega (t+24))\\
& \rightarrow b\cos(\omega t) + c\sin(\omega t) = b\cos(\omega t + 24\omega) + c\sin(\omega t + 24\omega)\\
& \rightarrow \cos(\omega t) = \cos(\omega t + 24\omega) \mbox{ and } \sin(\omega t) = \sin(\omega t + 24\omega)\\
&\rightarrow 24\omega = 2\pi\qquad \to\qquad \omega = \dfrac{\pi}{12}
 \end{align*}
\item The min/max of $T(t)$ is at $t=4$ and $t=16$ (taking $t=0$ to be midnight). Then
\begin{align*}
&T'(t) = d\omega\sin(\omega\beta - \omega t)\qquad \to \qquad T'(4) = T'(16) = 0 \\
& \rightarrow \sin\left(\dfrac{\pi(\beta-4)}{12}\right) = \sin\left(\dfrac{\pi (\beta-16)}{12}\right) = 0\\
&\rightarrow \dfrac{\beta-4}{12} = n \qquad \mbox{and} \qquad \dfrac{\beta-16}{12} = m \,\,\, \mbox{ where $n$ and $m$ are integers}\\
&\rightarrow \beta - 4 = 12n \qquad \mbox{and } \beta-16 = 12m\\
&\rightarrow \beta = 12n+4 \qquad \mbox{and } \beta = 12m+16\\
&\rightarrow \beta = 16 \qquad (n=1 \mbox{ and } m=0)
\end{align*}
\begin{align*}
&T(t) = a + d\cos\left(\dfrac{\pi(16-t)}{12}\right)\\
&T(4) = a + d\cos(\pi) = a-d = 35\\
&T(16) = a+ d\cos(0) = a+d = 55\\
&\rightarrow \mbox{(Adding the two equations above) } 2a = 90 \to a = 45 \mbox{ and then } d = 10
\end{align*}
\begin{align*}
T(t) &= 45 + 10\cos\left(\dfrac{\pi(16-t)}{12}\right) = 45 + 10\left(\cos\left(\dfrac{16\pi}{12}\right)\cos\left(\dfrac{\pi t}{12}\right) + \sin\left(\dfrac{16\pi}{12}\right)\sin\left(\dfrac{\pi t}{12}\right)\right)\\
&=45 -5\cos\left(\dfrac{\pi t}{12}\right) -5\sqrt{3}\sin\left(\dfrac{\pi t}{12}\right) \qquad (b = -5 \mbox{ and } c = -5\sqrt{3})
\end{align*}
\item 
\begin{enumerate}
\item \[y'(t) = k(y(t) -T(t)) = k\left(y(t) - 45 + 5\cos\left(\dfrac{\pi t}{12}\right) + 5\sqrt{3}\sin\left(\dfrac{\pi t}{12}\right)\right), \,\,\, T(0)=75\]
\item Negative because the temperature outside is (initially) colder than the room so the room should be cooling. Since $y(0)>T(0)$ but $T'(0)<0$, we need $k$ negative so that the derivative is negative (initially).
\item
\[y'(t) = -0.4\left(y(t) - 45 + 5\cos\left(\dfrac{\pi t}{12}\right) + 5\sqrt{3}\sin\left(\dfrac{\pi t}{12}\right)\right), \,\,\, T(0)=75\]
\begin{align*}
T(t) =& \left(75-\dfrac{15(40\sqrt{3}\pi+75\pi^2+1536)}{25\pi^2+576}\right)e^{-2t/5} \\
&+\dfrac{15\left(40\sqrt{3}\pi\cos\left(\dfrac{\pi t}{12}\right)+75\pi^2-40\pi\sin\left(\dfrac{\pi t}{12}\right)-192\sqrt{3}\sin\left(\dfrac{\pi t}{12}\right)-192\cos\left(\dfrac{\pi t}{12}\right)+1728\right)}{25\pi^2+576}
\end{align*}
\item Graph of $y(t)$ over the first two days.

\begin{center}\
\includegraphics[scale=.87]{2DayGraph}
\end{center}

\item Yes; your room will drop below $45^\circ$F within about 3.72 hours (i.e 3:43am that first day) and will remain below $45^\circ$F for about 10 hours.

\item The indoor temperature will, essentially, mirror the outdoor temperature oscillations. However, there is a slight time delay as it will take time for the room temperature to rise or fall with the outdoor temperature. From a zoomed in version of the graph on the second day (shown below), we can see that the low temperature (of about $36^\circ$F) is reached just after 6am (rather than 4am) and the high temperature (of about $53^\circ$F) is reached shortly after 6pm (rather than 4pm). Hence, there is about a $1^\circ$F temperature difference and 2 hour delay.

\begin{center}
\includegraphics[scale=.87]{SecondDayGraph} 
\end{center}

\end{enumerate}

\item Eventually, they are essentially identical. The temperature starting out warmer in the room only has an effect initially, which makes sense physically. As seen in the graph below, they are nearly identical after 10 hours.

\begin{center}
\includegraphics[scale=.87]{InitialValueVariance}
\end{center}

\item In all cases, the indoor temperature is oscillatory. However, the better insulated the building is, the less amplitude (variance) those oscillations will have. The lower the value of $|k|$, the better insulated the building, as the outdoor temperature has less effect on the indoor temperature in this case, as shown on the graph for question \ref{proportionality}, which can be seen below. This makes sense because a low proportionality constant means the derivative (i.e., rate of change) is smaller (in magnitude).

\begin{center}
\includegraphics[scale=.87]{ParameterVariation}
\end{center}

\end{enumerate}

%This is a set of COMMENTS about the scenario, for the teacher only. It might include a ``solution" or a  number of solution strategies. However, the main narrative should be about how to use the scenario in teaching, e.g., what are prerequisites, how long might one devote to it, what resources for students could be expected to be used, what  issues which cause students difficult or ease should be expected to come up, discussion of technology use, pointers to other files, etc.  This set of COMMENTS might have its own  pointers to data sets, supplementary files,  videos, etc. for student and teacher  use, the material for students could be something the teacher might use with discretion. There could be an extended bibliography \cite{Gause1934,Hutchinson1978a}  for additional teacher resources, analyses,  data, etc.



\begin{thebibliography}{99}


\bibitem{Avengers} {\it Avengers: Infinity War}. 2018. Directed by Anthony Russo and Joe Russo, Marvel Studios.

\bibitem{EdPe} Edwards, C.~H. and Penney, D.~E. 2008.  {\it Differential Equations: Computing and Modeling\/}. Fourth Edition. Upper Saddle River, NJ: Pearson Prentice Hall.%

\end{thebibliography}

}

\end{document}
