<filename>sample-homework.tex
%%%%%%%%%%%%%%%%%%%%%%%
% PHY 280 Homework Style Sheet
% Adapted from <NAME>'s great work: https://github.com/jdavis/latex-homework-template/blob/master/homework.tex
%
% Make sure that mathhomework.sty is in your working directory!
%
%%%%%%%%%%%%%%%%%%%%%%%


\documentclass{article}
\usepackage{mathhomework}
\usepackage{enumitem}


%%%%%% Edit these variables %%%%%%

\hmwkAuthor{<NAME>.\ Jankowski} 		% Put your name here

\hmwkNumber{1} 					% What Homework number is this? 

\hmwkDueDate{September 4, 2016} 	% When is this due?

\hmwkClass{Math Methods}			% Put the name of the Class here!
 
%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\maketitle
\thispagestyle{empty}
\pagebreak
\setcounter{page}{1}

%%%%%%%%% Homework Problems Go  Below Here %%%%%%%%%%%%%%
%
% Enclose homework problems in the homeworkProblem environment
% 
% Use \solution to mark the problem solution
%
% Use \part to start a seperate part of the problem
%
% Use \pagebreak to start a new page.  
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The package already has the amsmath extensions built in. To create a 
% multi-line equation, use the align* environment: 
%
% \begin{align*}		
%	y &= x^2+2 \\		<----- Note the &= and the \\ 
%	x &= 6	  \\		<----- On every line that needs to be aligned. 
%    \text{This is aligned text!} & \\  <----- You can align text too!
%      \Aboxed{y &= 38} \\ <--- Use \Aboxed for boxed answers!
% \end{align*}		
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{homeworkProblem}
Differentiate: 
\begin{enumerate}[label={\bf \alph*)}]  %<--- from \usepackage{enumitem} Allows you to modify enumerated lists, this one creates boldface letters.
\item $(2+x)e^{-x^2}$
\item $x^{\sin x}$
\end{enumerate}

% Use \solution to mark where the solution goes!
\solution 

Use the Product Rule, Quotient Rule and Chain Rule to compute the derivatives. 

% The \part command will auto letter each section. If you want a different label, use \part[Different Label]
\part

% The \deriv{}{} command typesets the derivative operator!
\begin{align*}
\deriv{}{x} (2+x)e^{-x^2} &= e^{-x^2}\deriv{}{x} (2+x) + (2+x)\deriv{}{x} e^{-x^2} \\
 &= e^{-x^2} + (2+x)(-2x)e^{-x^2}\\
\Aboxed{{} &=-(2x^2+4x-1)e^{-x^2}} %<--- For boxed equations with a blank left side, use \Aboxed{ {} &= equation}
\end{align*}

\part 

% You can use the \text{} command to typeset text. This sets \LaTeX\ to text mode, so don't forget to use $ ... $ for equations in the \text{} command.
\begin{align*}
\deriv{}{x} x^{\sin(x)}&=\\
\text{Recall that $x^{\sin(x)} = e^{\ln(x^{\sin(x)})}$, so:}\\  %<----- \text{Recall that $x^{\sin(x)} = e^{\ln(x^{\sin(x)})}$, so:}\\ don't forget $! 
&= \deriv{}{x} e^{\ln(x^{\sin(x)})}=\deriv{}{x}e^{\sin(x)\ln(x)}\\
\text{Set $u=\sin(x)\ln(x)$:}\\
&=e^u\deriv{}{x}\sin(x)\ln(x)\\
&=e^u\left(\ln(x)\deriv{}{x}\sin(x)+\sin(x)\deriv{}{x}\ln(x)\right)\\
&=e^u\left(\ln(x)\cos(x)+\frac{\sin(x)}{x}\right)\\
&=x^{\sin(x)}\left(\ln(x)\cos(x)+\frac{\sin(x)}{x}\right)\\
\Aboxed{{} &=x^{\sin(x)}\ln(x)\cos(x)+x^{\sin(x)-1}\sin(x)}
\end{align*}


\end{homeworkProblem}

\pagebreak

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Non sequential homework problems - \begin{homeworkProblem}[number]
%
% Don't be too fancy, you can't put anything but a number there. \begin{homeworkProblem}[12.34] will fail. 
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Jump to problem 18
\begin{homeworkProblem}[18]
    Evaluate $\displaystyle\sum_{k=1}^{5} k^2$ and $\sum_{k=1}^{5} (k - 1)^2$. %<--- Use \displaystyle for larger symbols in text mode

    Find $\displaystyle\deriv{}{x} (x^4 + 3x^2 - 2)$ and $\dpderiv[2]{}{\alpha} \log\left|\frac{\alpha^2-7}{x}\right|$. 
\end{homeworkProblem}

% Continue counting to 19
\begin{homeworkProblem}
Here is my code: 
\begin{lstlisting}[language=Python]
```
This calculates the logarithm of a user-supplied number
<NAME>, 2017
```
import numpy as np

UserInput = input('Please enter x')
if number <= 0:
	print('Choose a number greater than zero!') # Who would do this?
else:
	print('Log({}) = {:4f}'.format(UserInput, np.log(UserInput)))	
\end{lstlisting}
\end{homeworkProblem}

% Go back to where we left off
\begin{homeworkProblem}[3]
    Evaluate the integrals
    $\dint_0^1 (1 - x^2) \dx$ %<--- \dint makes a bigger integral sign. 
    and
    $\int_1^{\infty} \frac{1}{x^2} \dx$.
\end{homeworkProblem}

\end{document}