% % This is the file webeqtst.tex that is distributed with the AeB Bundle % \documentclass{article} \usepackage{amsmath} \usepackage{graphicx} \usepackage[tight,designi]{web} % dvipsone, dvips, pdftex, dvipdfm \usepackage{exerquiz} \usepackage[def=lmacs_aeb,js=lmacs_aeb]{lmacs} \begin{document} \maketitle \tableofcontents \section{Introduction} The \textsf{lmacs} is designed to clean up the preamble of a source file. For this file, we have \begin{verbatim} \usepackage[def=lmacs_aeb,js=lmacs_aeb]{lmacs} \end{verbatim} The preamble definitions are in the file \texttt{lmacs\_aeb.def} and a document JavaScript is imported with the file \texttt{lmacs\_aeb.js}. \medskip\noindent We'll test the JavaScript first, press this button: \pushButton[\CA{Press Me}\A{\JS{% makeAlert("Hooray for the lmacs package!") }}]{alertBtn}{}{11bp} \medskip\noindent The next section is taken from the file \texttt{webeqtst.tex}. The problem environment is defined in the file \texttt{lmacs\_aeb.def}, other definitions and customizations can be found in that file. \medskip\noindent Though I am using the \textsf{web} and \textsf{exerquiz} package, lmacs does not require them; \textsf{lmacs} is a general purpose package for inputting local definitions. \section{Online Exercises} A well-designed sequences of exercises can be of aid to the student. The \texttt{exercise} environment makes it easy to produce electronic exercises. By using the \texttt{forpaper} option, you can also make a paper version of your exercises. \begin{exercise} Evaluate the integral \(\displaystyle\int x^2 e^{2x}\,dx\). \begin{solution} We evaluate by \texttt{integration by parts}:\normalsize \begin{alignat*}{2} \int x^2 e^{2x}\,dx & = \tfrac12 x^2 e^{2x} - \int x e^{2x}\,dx &&\quad \text{$u=x^2$, $dv=e^{2x}\,dx$}\\& = \tfrac12 x^2 e^{2x} - \Bigl[\tfrac12 x e^{2x}-\int \tfrac12 e^{2x}\,dx\Bigr] &&\quad \text{integration by parts}\\& = \tfrac12 x^2 e^{2x} - \tfrac12 x e^{2x} + \tfrac12\int e^{2x}\,dx &&\quad \text{$u=x^2$, $dv=e^{2x}\,dx$}\\& = \tfrac12 x^2 e^{2x} - \tfrac12 x e^{2x} + \tfrac14 e^{2x} &&\quad \text{integration by parts}\\& = \tfrac14(2x^2-2x+1)e^{2x} &&\quad \text{simplify!} \end{alignat*} \end{solution} \end{exercise} In the preamble of this document, we defined a \texttt{problem} environment with its own counter. Here is an example of it. \begin{problem} Is $F(t)=\sin(t)$ an antiderivative of $f(x)=\cos(x)$? Explain your reasoning. \begin{solution} The answer is yes. The definition states that $F$ is an antiderivative of $f$ if $F'(x)=f(x)$. Note that $$ F(t)=\sin(t) \implies F'(t) = \cos(t) $$ hence, $F(x) = \cos(x) = f(x)$. \end{solution} \end{problem} \begin{problem} Is $F(t)=\sin(t)$ an antiderivative of $f(x)=\cos(x)$? Explain your reasoning. \begin{solution} The answer is yes. The definition states that $F$ is an antiderivative of $f$ if $F'(x)=f(x)$. Note that $$ F(t)=\sin(t) \implies F'(t) = \cos(t) $$ hence, $F(x) = \cos(x) = f(x)$. \end{solution} \end{problem} \noindent By modifying the \texttt{exercise} environment, you can also create an \texttt{example} environment. The one defined in the preamble of this document has no associated counter. \begin{example} Give an example of a set that is \textit{clopen}. \begin{solution} The real number line is both closed and open in the usual topology of the real line.% \end{solution} \end{example} There is a \texttt*-option with the \texttt{exercise} environment, using it signals the presence of a multiple part exercise question. The following exercise illustrates this option. \begin{exercise}*\label{ex:parts} Suppose a particle is moving along the $s$-axis, and that its position at any time $t$ is given by $s=t^2 - 5t + 1$. \begin{parts} \item[h]\label{item:part} Find the velocity, $v$, of the particle at any time $t$. \begin{solution} Velocity is the rate of change of position with respect to time. In symbols: $$ v = \frac{ds}{dt} $$ For our problem, we have $$ v = \frac{ds}{dt} =\frac d{dt}(t^2 - 5t + 1) = 2t-5. $$ The velocity at time $t$ is given by $\boxed{v=2t-5}$. \end{solution} \item Find the acceleration, $a$, of the particle at any time $t$. \begin{solution} Acceleration is the rate of change of velocity with respect to time. Thus, $$ a = \frac{dv}{dt} $$ For our problem, we have $$ a = \frac{dv}{dt} =\frac d{dt}(2t-5)=2. $$ The acceleration at time $t$ is constant: $\boxed{a=2}$. \end{solution} \end{parts} \end{exercise} References can be made to a particular part of an exercise; for example, ``see \hyperref[item:part]{Exercise~\ref*{ex:parts}(\ref*{item:part})}.'' Part (a) is in \textcolor{webblue}{blue}; the solutions for that part is ``hidden''. This is a new option for the \texttt{exercise} environment. There is now an option for listing multipart question in tabular form. This problem style does not obey the \texttt{solutions\-after} option. \begin{exercise}* Simplify each of the following expressions in the complex number system. \textit{Note}: $\bar z$ is the conjugate of $z$; $\operatorname{Re} z$ is the real part of $z$ and $\operatorname{Im} z$ is the imaginary part of $z$. \begin{parts}[2] \item $i^2$ \begin{solution} $i^2 = -1$ \end{solution} & \item $i^3$ \begin{solution} $i^3 = i i^2 = -i$\end{solution} \\ \item $z+\bar z$ \begin{solution} $z+\bar z=\operatorname{Re} z$\end{solution} & \item[h] $1/z$ \begin{solution} $\displaystyle\frac 1z=\frac 1z\frac{\bar z}{\bar z}=\frac z{z\bar z}=\frac z{|z|^2}$ \end{solution} \end{parts} \end{exercise} \end{document}