Debian Codegraph @

texmf-dist/doc/latex/ou-tma/SampleTMA.tex

raw
1 \documentclass[a4paper,12pt]{article}
2 % Load the ou-tma package with a common set of options
3 \usepackage[pdfbookmark,roman,cleveref]{ou-tma}
4 % [roman] numbers questions in the form 1(ii)(c)
5 % the default, [alph] numbers in the form 1(b)(iii)
6
7 % Define who is answering this TMA
8 \myname{Peter McFarlane}% Obviously your own name
9 \mypin{A1234567} % Your actual OU personal identity number
10 % find it on Student Home if you are unsure
11
12 % Define which module and TMA is being answered.
13 \mycourse{\LaTeX 101} % normally your module, like: \mycourse{M208}
14 \mytma{sample} % normally your TMA number: \mytma{01} or \mytma{02}...
15 \date{30 Sep, 2025} % If you want a specific date to appear, use this
16 % otherwise the data of compilation is used.
17
18 % Three extra packages used during the descriptions in this text.
19 \usepackage[most]{tcolorbox}
20 \usepackage{cancel}
21 \usepackage{xcolor}
22 \renewcommand{\CancelColor}{\color{red}}
23
24 % Setup stuff for the noteboxes used for descriptions in this text.
25 \tcbset{
26 notebox/.style={
27 colback=cyan!10,
28 colframe=cyan!30,
29 width=0.5\linewidth,
30 arc=3mm,
31 auto outer arc,
32 boxrule=3pt,
33 enhanced,
34 }
35 }
36 \newtcolorbox{notebox}[1][]{notebox,#1,
37 before=\begin{center},
38 after=\end{center},}
39
40 \begin{document}
41 \maketitle
42
43 \hfill\fbox{Update for 2025/09/30 v1.21}
44
45 %% Notes for the latest update
46 \begin{notebox}[width=\linewidth]
47
48 This document is provided as an example of how to use the \textsf{ou-tma} package.
49
50 With the 7\nth\,April 2025 version of the package there has been an update to the name of the package. Gone is \cancel{\textsf{tma}} and in comes \textsf{ou-tma}. The reason for the change is twofold. Firstly there are many internal changes to make the package more in line with the conventions of the \LaTeX3\ project, and secondly the introduction of the package into the CTAN archive.
51
52 In presenting to the CTAN archive, the regular stylesheet has been wrapped up in a \LaTeX\ document file---a \verb|.dtx| file. The beauty of the \verb|.dtx| file is that the \verb|.sty| and source for it's documentation ship together in a single file. A second simple \verb|.ins| file is also needed to extract the \verb|.sty|, but that is unlikely to change and can be created simply on the fly if needed.
53
54 To use the options start your document with:
55 \begin{verbatim}
56 \documentclass[a4paper,12pt]{article}
57 \usepackage[OPTION]{ou-tma}
58
59 \myname{...}
60 \mypin{...}
61 \mycourse{...}
62 \mytma{...}
63 \date{...}
64 \begin{document}
65 \maketitle
66 ...
67 \end{verbatim}
68
69 Where \textsf{OPTION} is one of the following
70 \begin{itemize}
71 \item {[roman]}
72 \item {[alph]} \emph{Default}
73 \item {[cleveref]}
74 \item {[pdfbookmark]}
75 \item {[legacy]}
76 \end{itemize}
77
78 See the \verb|ou-tma.pdf| file for further details of available options.
79
80 \end{notebox}
81
82 \pagebreak
83
84 \begin{notebox}
85 As we begin this example, we can use a new command \verb|\setquestionstring| to change the default `Q 1', `Q 2', etc to something else. In this case we will use \verb|\setquestionstring{Question}| to make the questions separators display as `Question 1', `Question 2', etc.
86 \end{notebox}
87 \setquestionstring{Question}
88
89 \begin{question}
90 \qpart % (i)
91 We have $1=10^0$ and $1+2+3+4=10^1$. Prove that there are no other powers of ten which are the sum of the first $n$ integers.
92
93 We have:
94 \begin{gather*}
95 \sum_{i=1}^n i=\frac{(n)(n+1)}{2}
96 \intertext{Let}
97 \frac{(n)(n+1)}{2}=10^x\\
98 \Rightarrow (n)(n+1)=2^{x+1}5^x
99 \end{gather*}
100
101 Now, either $n$ is odd, or $n+1$ is odd.
102
103 Consider the case where $n$ is odd:\\
104 By the Fundamental Theorem of Arithmetic, $n$ can only have the prime factors 2 or 5. Since it is odd, it can only be a perfect power of 5. Now, $n+1$ also can only have the prime factors of 2 or 5. If $n$ is divisible by 5, then $n+1$ is not divisible by 5. Therefore $n+1$ is a perfect power of 2. Therefore:
105 \begin{gather*}
106 n=5^x\qquad \text{and}\qquad n+1=2^{x+1}\\
107 \Rightarrow x=0
108 \intertext{(for any higher $x$, $5^x\gg 2^{x+1}$)}\\
109 \Rightarrow n=1
110 \end{gather*}
111
112 Now consider the case where $n+1$ is odd:\\
113 By similar arguments to above, $n+1$ must be a perfect power of 5 and $n$ must be a perfect power of 2.
114 \begin{gather*}
115 n=2^{x+1}\qquad \text{and}\qquad n+1=5^{x}\\
116 \Rightarrow x=1
117 \intertext{(for any higher $x$, $5^x\gg 2^{x+1}$)}\\
118 \Rightarrow n=4
119 \end{gather*}
120
121 Therefore $n=1$ and $n=4$ are the only solutions to the original problem. \hfill \qed\\[1cm]
122
123 \qpart[3] % forced to (iii) skipping (ii)
124 \qsubpart % (iii)(a)
125 Show that:
126 \begin{gather*}
127 \sum_{x=1}^{n}x(x+1)=\frac{n(n+1)(n+2)}{3}\\
128 \end{gather*}
129
130
131 Let
132 \begin{gather*}
133 f(n)=\frac{n(n+1)(n+2)}{3}\\
134 \end{gather*}
135
136 Now, adding the n+1 term to the above
137 \begin{gather}\notag
138 \begin{aligned}
139 f(n)+(n+1)(n+2)&=\frac{n(n+1)(n+2)}{3}+(n+1)(n+2)\\
140 &=\frac{\left(n^3+3n^2+2n+\right)}{3}+n^2+3n+2\\
141 &=\frac{\left(n^3+6n^2+11n+6\right)}{3}\\
142 &=\frac{\left((n+1)(n+2)(n+3)\right)}{3}\\
143 &=f(n+1)
144 \end{aligned}
145 \end{gather}
146
147 Therefore, if $f(n)$ is valid, then so is $f(n+1)$.
148
149 Since $1\times2=2=\frac{1\times2\times3}{3}=f(1)$, then $f(n)$ is valid for all $n\geq1$. \hfill \qed\\[1cm]
150
151 \qsubpart (iii)(b)
152 Show that:
153 \begin{gather*}
154 \sum_{x=1}^{n}x^4=\frac{n(n+1)(2n+1)(3n^2+3n-1)}{30}\\
155 \end{gather*}
156
157
158 Let
159 \begin{gather*}
160 f(n)=\frac{n(n+1)(2n+1)(3n^2+3n-1)}{30}\\
161 \end{gather*}
162
163 Now, adding the n+1 term to the above
164 \begin{align}
165 f(n)+(n+1)^4&=\frac{n(n+1)(2n+1)(3n^2+3n-1)}{30}+(n+1)^4\notag \\
166 &=\frac{1}{30}(6n^5+15n^4+10n^3-n)+(n^4+4n^3+6n^2+4n+1)\notag \\
167 &=\frac{1}{30}(6n^5+15n^4+10n^3-n+30n^4+120n^3+180n^2+120n+30)\notag \\
168 &=\frac{1}{30}(6n^5+45n^4+130n^3+180n^2+119n+30)\label{a}
169 \end{align}
170
171 Now,
172 \begin{align}
173 f(n+1)&=\frac{(n+1)\big((n+1)+1\big)\big(2(n+1)+1\big)\big(3(n+1)^2+3(n+1)-1\big)}{30}\notag \\
174 &=\frac{1}{30}(n+1)(n+2)(2n+3)(3n^2+9n+5)\notag \\
175 &=\frac{1}{30}(6n^5+45n^4+130n^3+180n^2+119n+30)\label{b}
176 \end{align}
177
178 Comparing equation~\eqref{a} with equation~\eqref{b} we see that
179 \begin{gather}\notag
180 f(n)+(n+1)^4=f(n+1)
181 \end{gather}
182
183 Therefore, if $f(n)$ is valid, then so is $f(n+1)$.
184
185 Since $1^4=1=\frac{1\times2\times3\times5}{30}=f(1)$, then $f(n)$ is valid for all $n\geq1$.\hfill \qed
186
187 \end{question} % End of question 1
188
189 \begin{notebox}
190 \centering
191 Note that by using\\ \verb|\begin{question}[3]|\\ at this point, we can skip question 2 from the numbering.
192 \end{notebox}
193
194 \begin{question}[3]
195 Find the general solution of the equation
196 \begin{equation}
197 \label{e}
198 3\deriv{^2y}{x^2}+4\deriv{y}{x}+y=x^2
199 \end{equation}
200 The auxillary equation is
201 \begin{equation}
202 3\lambda^2+4\lambda+1=0
203 \end{equation}
204 which factorises to
205 \begin{equation}
206 (\lambda+1)(3\lambda+1)=0
207 \end{equation}
208 and so has solutions
209 \begin{equation}
210 \lambda=-1 \mbox{\ and\ }\lambda=-\frac{1}{3}
211 \end{equation}
212 As both roots are real and distinct, the complementary function is
213 \begin{equation}
214 \label{d}
215 y_c=C\e^{-x}+D\e^{-\frac{1}{3}x}
216 \end{equation}
217 Now, let us find the particular integral. As the right hand side of equation \ref{e} is $x^2$, our trial solution is the polynomial
218 \begin{equation}
219 y_p=px^2+qx+r
220 \end{equation}
221 \begin{equation}
222 \Rightarrow \deriv{y_p}{x}=2px+q
223 \end{equation}
224 \begin{equation}
225 \Rightarrow \deriv{^2y_p}{x^2}=2p
226 \end{equation}
227 Substituting the trial particular integral into equation \ref{e}
228 \begin{equation}
229 6p+8px+4q+px^2+qx+r=x^2
230 \end{equation}
231 \begin{equation}
232 \Rightarrow px^2+(8p+q)x+(6p+4q+r)=x^2
233 \end{equation}
234 \begin{equation}
235 \Rightarrow p=1,\ \ q=-8,\ \ r=26
236 \end{equation}
237 Thus the particular integral is
238 \begin{equation}
239 \label{c}
240 y_p=x^2-8x+26
241 \end{equation}
242 and combining equation \ref{d} with equation \ref{c}, by the rule of superposition, we get the general solution of equation \ref{e} to be
243 \begin{equation}
244 y=C\e^{-x}+D\e^{-\frac{1}{3}x}+x^2-8x+26
245 \end{equation}
246
247 \end{question}
248
249 % End of whole document, all questions should be included before this point.
250 \end{document}
251