ex: Solved some other exercises, added code snippets, and more

This commit is contained in:
Samuel Ortion 2023-02-27 11:07:49 +01:00
parent c5030a634d
commit f8713f058f
17 changed files with 573 additions and 234 deletions

20
.vscode/aocp.code-snippets vendored Normal file
View File

@ -0,0 +1,20 @@
{
"My exercise environment": {
"scope": "latex,tex",
"prefix": "myexercise",
"body": [
"\\begin{myexercise}",
"\t$1",
"\\end{myexercise}"
],
},
"My answer environment": {
"scope": "latex,tex",
"prefix": "myanswer",
"body": [
"\\begin{myanswer}",
"\t$1",
"\\end{myanswer}"
],
},
}

View File

@ -2,5 +2,5 @@
JUNK="*.aux *.bbl *.bcf *.blg *.log *.out *.run.xml *.toc *.lof *.lot *.fls *.fdb_latexmk *.synctex* *.ptc *.ind *.ilg *.idx *.glo *.glsdefs *.glg *.gls" JUNK="*.aux *.bbl *.bcf *.blg *.log *.out *.run.xml *.toc *.lof *.lot *.fls *.fdb_latexmk *.synctex* *.ptc *.ind *.ilg *.idx *.glo *.glsdefs *.glg *.gls"
for item in $JUNK; do for item in $JUNK; do
find . -name "$item" -exec rm {} \; find . -name "$item" -exec rm {} \;
done done

View File

@ -3,12 +3,12 @@
%---------------------------------------- %----------------------------------------
\newcommand{\includechapters}[2]{% \newcommand{\includechapters}[2]{%
\foreach \i in {0, ..., #2} {% \foreach \i in {0, ..., #2} {%
\edef\FileName{content/chapters/#1/\i}% The % here are necessary to eliminate any \edef\FileName{content/chapters/#1/\i}% The % here are necessary to eliminate any
\IfFileExists{\FileName}{% spurious spaces that may get inserted \IfFileExists{\FileName}{% spurious spaces that may get inserted
\input{\FileName}% at these points \input{\FileName}% at these points
} }
} }
} }

View File

@ -8,60 +8,58 @@
\begin{myexercise}{4}{18} \begin{myexercise}{4}{18}
Let $F_n$ be the $n$-th Fibonacci number, defined by the recursion relation Let $F_n$ be the $n$-th Fibonacci number, defined by the recursion relation
\[ \[
\begin{cases} \begin{cases}
F_0 = 1, \\ F_0 = 1, \\
F_1 = 1, \\ F_1 = 1, \\
F_n = F_{n-1} + F_{n-2}, \quad n \geq 2. F_n = F_{n-1} + F_{n-2}, \quad n \geq 2.
\end{cases} \end{cases}
\] \]
Let $\phi = \frac{1+\sqrt{5}}{2}$ be the golden ratio. Let $\phi = \frac{1+\sqrt{5}}{2}$ be the golden ratio.
We have We have
\begin{equation} \begin{equation}
F_n \leq \phi^{n-1} F_n \leq \phi^{n-1}
\label{eq:fibo_leq_golden_ratio} \label{eq:fibo_leq_golden_ratio}
\end{equation} \end{equation}
$\forall n \in \mathbb{N}$. $\forall n \in \mathbb{N}$.
Prove that, in addition to Eq. \ref{eq:fibo_leq_golden_ratio}, $F_n \geq \phi^{n-2}$. Prove that, in addition to Eq. \ref{eq:fibo_leq_golden_ratio}, $F_n \geq \phi^{n-2}$.
\begin{myanswer} \begin{myanswer}
Let $P(n)$ be the assertion that $F_n \geq \phi^{n-2}$. Let $P(n)$ be the assertion that $F_n \geq \phi^{n-2}$.
We proceed by recursion on $n$. We proceed by recursion on $n$.
\begin{equation} \begin{equation}
1 + \phi = \phi^2 1 + \phi = \phi^2
\label{eq:golden_ratio_squared} \label{eq:golden_ratio_squared}
\end{equation} \end{equation}
\emph{Initiation} For $n = 0$: $\phi^{0-2} = \phi^{-2} = \frac{1}{\phi^2}$. As $\phi^2 > 1$ . $\frac{1}{\phi^2} < 1$, so $P(0)$ is true. \emph{Initiation} For $n = 0$: $\phi^{0-2} = \phi^{-2} = \frac{1}{\phi^2}$. As $\phi^2 > 1$ . $\frac{1}{\phi^2} < 1$, so $P(0)$ is true.
For $n = 1$: For $n = 1$:
$\phi^{1-2} = \phi^{-1} = \frac{1}{\phi}$. As $\phi > 1$, $\frac{1}{\phi} < 1$, so $P(1)$ is true. $\phi^{1-2} = \phi^{-1} = \frac{1}{\phi}$. As $\phi > 1$, $\frac{1}{\phi} < 1$, so $P(1)$ is true.
\emph{Heredity} \emph{Heredity}
Let $P(n)$ and $P(n-1)$ be true. We have to prove $P(n+1)$. Let $P(n)$ and $P(n-1)$ be true. We have to prove $P(n+1)$.
\begin{align*} \begin{align*}
P(n) \wedge P(n-1) & \Leftrightarrow F_n \geq \phi^{n-2} \wedge F_{n-1} \geq \phi^{n-1-2}\\ P(n) \wedge P(n-1) & \Leftrightarrow F_n \geq \phi^{n-2} \wedge F_{n-1} \geq \phi^{n-1-2}\\
& \Leftrightarrow F_{n} + F_{n-1} \geq \phi^{n-2} + \phi^{n-3} \\ & \Leftrightarrow F_{n} + F_{n-1} \geq \phi^{n-2} + \phi^{n-3} \\
& \Leftrightarrow F_n + F_{n-1} \geq \phi^{n-3} (1 + \phi) \\ & \Leftrightarrow F_n + F_{n-1} \geq \phi^{n-3} (1 + \phi) \\
& \Leftrightarrow F_n + F_{n-1} \geq \phi^{n-3} \phi^2 \qquad \text{using Eq. \ref{eq:golden_ratio_squared}} \\ & \Leftrightarrow F_n + F_{n-1} \geq \phi^{n-3} \phi^2 \qquad \text{using Eq. \ref{eq:golden_ratio_squared}} \\
& \Leftrightarrow F_n + F_{n-1} \geq \phi^{n-1} \\ & \Leftrightarrow F_n + F_{n-1} \geq \phi^{n-1} \\
& \Leftrightarrow F_{n+1} \geq \phi^{n+1-2} \\ & \Leftrightarrow F_{n+1} \geq \phi^{n+1-2} \\
& \Leftrightarrow P(n+1) & \Leftrightarrow P(n+1)
\end{align*} \end{align*}
\emph{Conclusion} $P(0)$ and $P(1)$ are true. $P(n) \wedge P(n-1)$ true implies $P(n+1)$ true. So $P(n)$ is true for all $n \in \mathbb{N}$. \emph{Conclusion} $P(0)$ and $P(1)$ are true. $P(n) \wedge P(n-1)$ true implies $P(n+1)$ true. So $P(n)$ is true for all $n \in \mathbb{N}$.
\end{myanswer} \end{myanswer}
\end{myexercise} \end{myexercise}
\begin{myexercise}{5}{19} \begin{myexercise}{5}{19}
A prime number is an integer $> 1$ that has no exact divisors other than $1$ and itself. A prime number is an integer $> 1$ that has no exact divisors other than $1$ and itself.
@ -71,17 +69,17 @@ Using this definition and mathematical induction, prove that every integer $> 1$
Let $P(n)$ be the assertion that $n$ can be written as a product of prime numbers or is a prime. Let $P(n)$ be the assertion that $n$ can be written as a product of prime numbers or is a prime.
\begin{proof} \begin{proof}
Let $N > 1$ be the smallest integer such that $P(N)$ is false. Let $N > 1$ be the smallest integer such that $P(N)$ is false.
As $\forall N' < N$, $N' > 1$, $P(N')$ is true. As $\forall N' < N$, $N' > 1$, $P(N')$ is true.
We have either of the following assertions: We have either of the following assertions:
\begin{itemize} \begin{itemize}
\item $N$ is a prime number; \item $N$ is a prime number;
\item there exists $m$ and $n$ below $N$ such that, $m \times n = N$. \item there exists $m$ and $n$ below $N$ such that, $m \times n = N$.
As $m$ and $n$ are below $N$, they satisfies $P$, so they are either primes or a product of primes. So $mn = N$ is also a product of primes. As $m$ and $n$ are below $N$, they satisfies $P$, so they are either primes or a product of primes. So $mn = N$ is also a product of primes.
\end{itemize} \end{itemize}
We have a contradiction, and $P(N)$ must be true. We have a contradiction, and $P(N)$ must be true.
\end{proof} \end{proof}
\end{myanswer} \end{myanswer}
@ -115,156 +113,297 @@ T_n = \frac{1}{2} n (n + 1)
\end{equation} \end{equation}
\begin{proof} \begin{proof}
Let us prove the formula. Let us prove the formula.
Let $P(n)$ be the proposition that Eq. \ref{eq:ex7_half_factor_n_n+1} is correct for $T_n$. Let $P(n)$ be the proposition that Eq. \ref{eq:ex7_half_factor_n_n+1} is correct for $T_n$.
By recursion on $n$ By recursion on $n$
\emph{Initiation} \emph{Initiation}
For $n = 1$, $1^2 = 1$ and $\frac{1}{2} 1 \times (1+1) = 1$, so $P(n)$ is true. For $n = 1$, $1^2 = 1$ and $\frac{1}{2} 1 \times (1+1) = 1$, so $P(n)$ is true.
\emph{Heredity} \emph{Heredity}
Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true. Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true.
\begin{align*} \begin{align*}
P(n) & \Leftrightarrow T_n = \frac{1}{2} n(n+1) \\ P(n) & \Leftrightarrow T_n = \frac{1}{2} n(n+1) \\
& \Leftrightarrow \sum_{i=0}^n (-1)^i (n-i)^2 = \frac{1}{2} n(n+1) & \Leftrightarrow \sum_{i=0}^n (-1)^i (n-i)^2 = \frac{1}{2} n(n+1)
\end{align*} \end{align*}
\unfinished \unfinished
\end{proof} \end{proof}
\end{myanswer} \end{myanswer}
\end{myexercise} \end{myexercise}
\begin{myexercise}{8}{19} \begin{myexercise}{8}{19}
(a) Prove the following theorem of Nicomachus by induction: (a) Prove the following theorem of Nicomachus by induction:
$1^3 = 1$, $2^3 = 3 + 5$, $3^3 = 7 + 9 + 11$, $4^3 = 13 + 15 + 17 + 19$, etc. $1^3 = 1$, $2^3 = 3 + 5$, $3^3 = 7 + 9 + 11$, $4^3 = 13 + 15 + 17 + 19$, etc.
(b) Use this result to prove the remarkable formula $1^3 + 2^3 + \dots + n^3 = (1 + 2 + \dots + n)^2$ (b) Use this result to prove the remarkable formula $1^3 + 2^3 + \dots + n^3 = (1 + 2 + \dots + n)^2$
\begin{myanswer} \begin{myanswer}
(a) The theorem states the following: (a) The theorem states the following:
For all $n \in \mathbb{N}$ we have For all $n \in \mathbb{N}$ we have
\[ \[
n^3 = \sum_{i = 1}^n | n (n - 1) - 1 + 2i| n^3 = \sum_{i = 1}^n | n (n - 1) - 1 + 2i|
\] \]
\begin{proof} \begin{proof}
We proceed by recursion on $n$. We proceed by recursion on $n$.
Let $P(n)$ be the proposition ``$n^3 = \sum_{i = 1}^n | n (n - 1) - 1 + 2i|$''. Let $P(n)$ be the proposition ``$n^3 = \sum_{i = 1}^n | n (n - 1) - 1 + 2i|$''.
\emph{Initiation} For $n = 1$, $1^3 = 1^2$, so $P(1)$ is true. \emph{Initiation} For $n = 1$, $1^3 = 1^2$, so $P(1)$ is true.
\emph{Heredity} Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true. \emph{Heredity} Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true.
\begin{align*} \begin{align*}
P(n) \Leftrightarrow n^3 &= \sum_{i = 1}^n n (n - 1) - 1 + 2i \\ P(n) \Leftrightarrow n^3 &= \sum_{i = 1}^n n (n - 1) - 1 + 2i \\
% &\Leftrightarrow (n+1)^3 &= \sum_{i = 1}^n n^2 - n - 1 + 2i \\ % &\Leftrightarrow (n+1)^3 &= \sum_{i = 1}^n n^2 - n - 1 + 2i \\
\end{align*} \end{align*}
\end{proof} \end{proof}
\unfinished \unfinished
(b) (b)
\begin{theorem}[Formula of Nicomachus] \begin{theorem}[Formula of Nicomachus]
The sum of the cubes of the first $n$ natural numbers is equal to the square of the sum of the first $n$ natural numbers. The sum of the cubes of the first $n$ natural numbers is equal to the square of the sum of the first $n$ natural numbers.
\end{theorem} \end{theorem}
\begin{equation} \begin{equation}
\sum_{k=1}^n k^3 = \left(\sum_{k=1}^n k \right)^2 \sum_{k=1}^n k^3 = \left(\sum_{k=1}^n k \right)^2
\end{equation} \end{equation}
\begin{proof} \begin{proof}
Let $P(n)$ be the proposition ``$\sum_{k=1}^n k^3 = \left(\sum_{k=1}^n k \right)^2$''. Let $P(n)$ be the proposition ``$\sum_{k=1}^n k^3 = \left(\sum_{k=1}^n k \right)^2$''.
$P(n) \Longleftrightarrow \sum_{k=1}^n k^3 = \left(\frac{n(n+1)}{2}\right)^2$ $P(n) \Longleftrightarrow \sum_{k=1}^n k^3 = \left(\frac{n(n+1)}{2}\right)^2$
because $\sum_{i=1}^n i = \frac{n(n+1)}{2}$. because $\sum_{i=1}^n i = \frac{n(n+1)}{2}$.
We want to prove that: $\sum_{k=1}^{n+1} k^3 = \left(\frac{(n+1)(n+2)}{2}\right)^2$ We want to prove that: $\sum_{k=1}^{n+1} k^3 = \left(\frac{(n+1)(n+2)}{2}\right)^2$
\begin{align*} \begin{align*}
\sum_{k=1}^{n+1} k^3 &= \frac{n^2 (n+1)^2}{2^2} + (n+1)^3 \\ \sum_{k=1}^{n+1} k^3 &= \frac{n^2 (n+1)^2}{2^2} + (n+1)^3 \\
&= (n+1)^2 \left(\frac{n^2}{4} + n + 1\right) \\ &= (n+1)^2 \left(\frac{n^2}{4} + n + 1\right) \\
&= (n+1)^2 \cdot \frac{n^2 + 4n + 4}{4} \\ &= (n+1)^2 \cdot \frac{n^2 + 4n + 4}{4} \\
&= \frac{(n+1)^2(n+2)^2}{2^2} \\ &= \frac{(n+1)^2(n+2)^2}{2^2} \\
& \Updownarrow \\ & \Updownarrow \\
& P(n+1) & P(n+1)
\end{align*} \end{align*}
\emph{Conclusion} \emph{Conclusion}
$P(1)$ is true because $1^3 = 1$ and $\left(\frac{1(1+1)}{2}\right)^2 = 1$. $P(1)$ is true because $1^3 = 1$ and $\left(\frac{1(1+1)}{2}\right)^2 = 1$.
$P(n)$ true implies $P(n+1)$ true, so $P(n)$ is true for all $n \in \mathbb{N}_+$. $P(n)$ true implies $P(n+1)$ true, so $P(n)$ is true for all $n \in \mathbb{N}_+$.
\end{proof} \end{proof}
\end{myanswer} \end{myanswer}
\end{myexercise} \end{myexercise}
\begin{myexercise}{9}{19} \begin{myexercise}{9}{19}
Prove by induction that if $0 < a < 1$ then $(1 - a)^n \geq 1 - na$. Prove by induction that if $0 < a < 1$ then $(1 - a)^n \geq 1 - na$.
\begin{myanswer} \begin{myanswer}
We proceed by recursion on $n$. We proceed by recursion on $n$.
Let $P(n)$ be the proposition ``$(1 - a)^n \geq 1 - na$''. Let $P(n)$ be the proposition ``$(1 - a)^n \geq 1 - na$''.
\emph{Initiation} For $n = 0$, \emph{Initiation} For $n = 0$,
$(1 - a)^n = 1 = 1 - na$, so $P(0)$ is true. $(1 - a)^n = 1 = 1 - na$, so $P(0)$ is true.
\emph{Heredity} Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true. \emph{Heredity} Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true.
We want to prove that $(1 - a)^{n+1} \geq 1 - (n+1)a$. We want to prove that $(1 - a)^{n+1} \geq 1 - (n+1)a$.
\begin{align*} \begin{align*}
P(n) \Leftrightarrow (1-a)^n &\geq 1-na \\ P(n) \Leftrightarrow (1-a)^n &\geq 1-na \\
(1-a)^n (1-a) & \geq (1 - na) (1-a) \qquad \text{$1-a > 0 $} \\ (1-a)^n (1-a) & \geq (1 - na) (1-a) \qquad \text{$1-a > 0 $} \\
(1-a)^{n+1} & \geq 1 - na - a + na \\ (1-a)^{n+1} & \geq 1 - na - a + na \\
& \geq 1 - (n+1)a - a \\ & \geq 1 - (n+1)a - a \\
& \geq 1 - (n+1)a \qquad \text{because $a > 0$} & \geq 1 - (n+1)a \qquad \text{because $a > 0$}
& \Rightarrow P(n+1) & \Rightarrow P(n+1)
\end{align*} \end{align*}
\emph{Conclusion} \emph{Conclusion}
$P(1)$ is true. $P(1)$ is true.
$P(n)$ true implies $P(n+1)$ true, so $P(n)$ is true for all $n \in \mathbb{N}_+$. $P(n)$ true implies $P(n+1)$ true, so $P(n)$ is true for all $n \in \mathbb{N}_+$.
\end{myanswer} \end{myanswer}
\end{myexercise} \end{myexercise}
% \begin{myexercise}{10}{19} % \begin{myexercise}{10}{19}
% Prove by induction that if $n \geq 10$ then $2^n > n^3$. % Prove by induction that if $n \geq 10$ then $2^n > n^3$.
% \begin{myanswer} % \begin{myanswer}
% We proceed by recursion on $n$. % We proceed by recursion on $n$.
% Let $P(n)$ be the proposition ``$2^n > n^3$''. % Let $P(n)$ be the proposition ``$2^n > n^3$''.
% \emph{Initiation} For $n = 10$, % \emph{Initiation} For $n = 10$,
% $2^{10} = 1024 > 1000 = 10^3$, so $P(10)$ is true. % $2^{10} = 1024 > 1000 = 10^3$, so $P(10)$ is true.
% \emph{Heredity} Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true. % \emph{Heredity} Suppose $P(n)$ true, let us prove that $P(n+1)$ is also true.
% We want to prove that $2^{n+1} > (n+1)^3$. % We want to prove that $2^{n+1} > (n+1)^3$.
% \begin{align*} % \begin{align*}
% P(n) \Leftrightarrow 2^n &> n^3 \\ % P(n) \Leftrightarrow 2^n &> n^3 \\
% 2^n \times 2 &> n^3 \times 2 \qquad \text{because $2 > 0$} \\ % 2^n \times 2 &> n^3 \times 2 \qquad \text{because $2 > 0$} \\
% 2^{n+1} &> n^3 + n^3 \\ % 2^{n+1} &> n^3 + n^3 \\
% \end{align*} % \end{align*}
% $n^3 = n^2 \times n$ % $n^3 = n^2 \times n$
% \emph{Conclusion} % \emph{Conclusion}
% $P(10)$ is true. % $P(10)$ is true.
% $P(n)$ true implies $P(n+1)$ true, so $P(n)$ is true for all integer $n \geq 10$. % $P(n)$ true implies $P(n+1)$ true, so $P(n)$ is true for all integer $n \geq 10$.
% \end{myanswer} % \end{myanswer}
% \end{myexercise} % \end{myexercise}
% Dirty false proof... To be continued % Dirty false proof... To be continued
\subsection{Numbers, Powers and Logarithms}
\begin{myexercise}{1}{25}
What is the smallest positive rational number?
\begin{myanswer}
The smallest positive rational number is 0.
\end{myanswer}
\end{myexercise}
\begin{myexercise}{2}{25}
Is $1 + 0.23999999999...$ a decimal expansion?
\begin{myanswer}
0.23999999999... is not a decimal number as it has an infinite decimal expansion.
The decimal expansion of $1 + 0.23999999999...$ is in the form
\[
1 \cdot 10^0 + 2 \cdot 10^{-1} + 3 \cdot 10^{-2} + 9 \cdot 10^{-3} + \sum_{i=1}^{\infty} 9 \cdot 10^{-3-i}
\]
\textit{Nota bene}: This surely does not answer the question...
\end{myanswer}
\end{myexercise}
\begin{myexercise}{3}{25}
What is $(-3)^{-3}$?
\begin{myanswer}
\[
(-3)^{-3} = \frac{1}{(-3)^3} = \frac{1}{(-3)(-3)(-3)} = -\frac{1}{27}
\]
\end{myanswer}
\end{myexercise}
\begin{myexercise}{4}{25}
What is $(0.125)^{-2/3}$?
\begin{equation}
b^{p/q} = \sqrt[q]{b^p}
\end{equation}
\begin{myanswer}
\begin{align*}
0.125^{-2/3} &= \left(\frac{1}{8}\right)^{-2/3} \\
&= 8^{2/3} \\
&= \sqrt[3]{8^2} \\
&= \sqrt[3]{64} \\
&= 4
\end{align*}
\end{myanswer}
\end{myexercise}
\begin{myexercise}{5}{25}
Defining real numbers in terms of binary expansion.
\begin{myanswer}
\[
x = \sum_{i=0}^{\infty} a_i \cdot 2^{-i}
\]
\end{myanswer}
\end{myexercise}
\begin{myexercise}{6}{25}
Let $x = m + 0.d_1d_2\dots$ and $y = n + 0.e_1e_2\dots$.
Give a rule for determining whether $x = y$, $x < y$, $x > y$ based on the decimal representation.
\begin{myanswer}
\begin{algorithm}[H]
\begin{algorithmic}[1]
\Procedure {LowerGreaterEqual} {$X$, $Y$}
\Comment{$X$ and $Y$ are arrays of decimal of numbers $x$ and $y$ respectively.}
\State $i \gets 0$
\While {$i < X.length$ and $i < Y.length$}
\If{$X[i] == Y[i]$}
\State $i \gets i+1$
\ElsIf {$X[i] > Y[i]$}
\State \Return \texttt{GREATER}
\Else
\State \Return \texttt{LOWER}
\EndIf
\EndWhile
\If{$X.length > Y.length$}
\State \Return \texttt{GREATER}
\ElsIf{$X.length < Y.length$}
\State \Return \texttt{LOWER}
\Else
\State \Return \texttt{EQUALS}
\EndIf
\EndProcedure
\end{algorithmic}
\caption{Greater, Lower or Equal Decimal representation}
\end{algorithm}
\end{myanswer}
\end{myexercise}
\begin{myexercise}{7}{25}
Given that $x$ and $y$ are integers. \textit{Prove} the laws of exponents, from definition given by Eq. \ref{eq:rule-of-exponents-2} from Eq. \ref{eq:rule-of-exponents}.
\begin{eqnarray}
b^0 = 1, & b^n = b^{n-1} b \quad \text{ if $n > 0$}, & b^n = b^{n+1} / b \quad \text{ if $n < 0$}.
\label{eq:rule-of-exponents}
\end{eqnarray}
\begin{eqnarray}
b^{x+y} = b^x b^y, & (b^x)^y = b^{xy},
\label{eq:rule-of-exponents-2}
\end{eqnarray}
\begin{myanswer}
We will prove this in $\Reals$
Let us recall the following formula:
\begin{equation}
b^x = e^{x \ln b}
\end{equation}
and
\begin{equation}
\exp(x + y) = \exp(x) \exp(y)
\end{equation}
Thus it comes:
\begin{align*}
b^{x + y} &= e^{(x + y) \ln b} \\
&= e^{x \ln b + y \ln b} \\
&= e^{x \ln b} e^{y \ln b} \\
&= b^x b^y
\end{align*}
Similarly for $(a^x)^y$:
\begin{align*}
(a^x)^y &= e^{y \ln (a^x)} \\
&= e^{xy \ln a} \\
&= a^{xy}
\end{align*}
\end{myanswer}
\end{myexercise}

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="612" height="792" viewBox="0 0 612 792">
<defs>
<g>
<g id="glyph-0-0">
</g>
<g id="glyph-0-1">
<path d="M 6.828125 -4.5 L 6.640625 -6.75 L 0.546875 -6.75 L 0.359375 -4.5 L 0.609375 -4.5 C 0.75 -6.109375 0.890625 -6.4375 2.40625 -6.4375 C 2.578125 -6.4375 2.84375 -6.4375 2.9375 -6.421875 C 3.15625 -6.375 3.15625 -6.265625 3.15625 -6.046875 L 3.15625 -0.78125 C 3.15625 -0.453125 3.15625 -0.3125 2.109375 -0.3125 L 1.703125 -0.3125 L 1.703125 0 C 2.109375 -0.03125 3.125 -0.03125 3.59375 -0.03125 C 4.046875 -0.03125 5.078125 -0.03125 5.484375 0 L 5.484375 -0.3125 L 5.078125 -0.3125 C 4.03125 -0.3125 4.03125 -0.453125 4.03125 -0.78125 L 4.03125 -6.046875 C 4.03125 -6.234375 4.03125 -6.375 4.21875 -6.421875 C 4.328125 -6.4375 4.59375 -6.4375 4.78125 -6.4375 C 6.296875 -6.4375 6.4375 -6.109375 6.578125 -4.5 Z M 6.828125 -4.5 "/>
</g>
<g id="glyph-0-2">
<path d="M 5.328125 0 L 5.328125 -0.3125 C 4.8125 -0.3125 4.5625 -0.3125 4.5625 -0.609375 L 4.5625 -2.515625 C 4.5625 -3.375 4.5625 -3.671875 4.25 -4.03125 C 4.109375 -4.203125 3.78125 -4.40625 3.203125 -4.40625 C 2.359375 -4.40625 1.921875 -3.8125 1.765625 -3.453125 L 1.75 -3.453125 L 1.75 -6.921875 L 0.3125 -6.8125 L 0.3125 -6.5 C 1.015625 -6.5 1.09375 -6.4375 1.09375 -5.9375 L 1.09375 -0.75 C 1.09375 -0.3125 0.984375 -0.3125 0.3125 -0.3125 L 0.3125 0 L 1.453125 -0.03125 L 2.5625 0 L 2.5625 -0.3125 C 1.890625 -0.3125 1.78125 -0.3125 1.78125 -0.75 L 1.78125 -2.59375 C 1.78125 -3.625 2.5 -4.1875 3.125 -4.1875 C 3.765625 -4.1875 3.875 -3.65625 3.875 -3.078125 L 3.875 -0.75 C 3.875 -0.3125 3.765625 -0.3125 3.09375 -0.3125 L 3.09375 0 L 4.21875 -0.03125 Z M 5.328125 0 "/>
</g>
<g id="glyph-0-3">
<path d="M 4.140625 -1.1875 C 4.140625 -1.28125 4.0625 -1.3125 4 -1.3125 C 3.921875 -1.3125 3.890625 -1.25 3.875 -1.171875 C 3.53125 -0.140625 2.625 -0.140625 2.53125 -0.140625 C 2.03125 -0.140625 1.640625 -0.4375 1.40625 -0.8125 C 1.109375 -1.28125 1.109375 -1.9375 1.109375 -2.296875 L 3.890625 -2.296875 C 4.109375 -2.296875 4.140625 -2.296875 4.140625 -2.515625 C 4.140625 -3.5 3.59375 -4.46875 2.359375 -4.46875 C 1.203125 -4.46875 0.28125 -3.4375 0.28125 -2.1875 C 0.28125 -0.859375 1.328125 0.109375 2.46875 0.109375 C 3.6875 0.109375 4.140625 -1 4.140625 -1.1875 Z M 3.484375 -2.515625 L 1.109375 -2.515625 C 1.171875 -4 2.015625 -4.25 2.359375 -4.25 C 3.375 -4.25 3.484375 -2.90625 3.484375 -2.515625 Z M 3.484375 -2.515625 "/>
</g>
<g id="glyph-0-4">
<path d="M 3.59375 -1.28125 C 3.59375 -1.796875 3.296875 -2.109375 3.171875 -2.21875 C 2.84375 -2.546875 2.453125 -2.625 2.03125 -2.703125 C 1.46875 -2.8125 0.8125 -2.9375 0.8125 -3.515625 C 0.8125 -3.875 1.0625 -4.28125 1.921875 -4.28125 C 3.015625 -4.28125 3.078125 -3.375 3.09375 -3.078125 C 3.09375 -2.984375 3.203125 -2.984375 3.203125 -2.984375 C 3.34375 -2.984375 3.34375 -3.03125 3.34375 -3.21875 L 3.34375 -4.234375 C 3.34375 -4.390625 3.34375 -4.46875 3.234375 -4.46875 C 3.1875 -4.46875 3.15625 -4.46875 3.03125 -4.34375 C 3 -4.3125 2.90625 -4.21875 2.859375 -4.1875 C 2.484375 -4.46875 2.078125 -4.46875 1.921875 -4.46875 C 0.703125 -4.46875 0.328125 -3.796875 0.328125 -3.234375 C 0.328125 -2.890625 0.484375 -2.609375 0.75 -2.390625 C 1.078125 -2.140625 1.359375 -2.078125 2.078125 -1.9375 C 2.296875 -1.890625 3.109375 -1.734375 3.109375 -1.015625 C 3.109375 -0.515625 2.765625 -0.109375 1.984375 -0.109375 C 1.140625 -0.109375 0.78125 -0.671875 0.59375 -1.53125 C 0.5625 -1.65625 0.5625 -1.6875 0.453125 -1.6875 C 0.328125 -1.6875 0.328125 -1.625 0.328125 -1.453125 L 0.328125 -0.125 C 0.328125 0.046875 0.328125 0.109375 0.4375 0.109375 C 0.484375 0.109375 0.5 0.09375 0.6875 -0.09375 C 0.703125 -0.109375 0.703125 -0.125 0.890625 -0.3125 C 1.328125 0.09375 1.78125 0.109375 1.984375 0.109375 C 3.125 0.109375 3.59375 -0.5625 3.59375 -1.28125 Z M 3.59375 -1.28125 "/>
</g>
<g id="glyph-0-5">
<path d="M 5.328125 0 L 5.328125 -0.3125 C 4.640625 -0.3125 4.5625 -0.375 4.5625 -0.875 L 4.5625 -4.40625 L 3.09375 -4.296875 L 3.09375 -3.984375 C 3.78125 -3.984375 3.875 -3.921875 3.875 -3.421875 L 3.875 -1.65625 C 3.875 -0.78125 3.390625 -0.109375 2.65625 -0.109375 C 1.828125 -0.109375 1.78125 -0.578125 1.78125 -1.09375 L 1.78125 -4.40625 L 0.3125 -4.296875 L 0.3125 -3.984375 C 1.09375 -3.984375 1.09375 -3.953125 1.09375 -3.078125 L 1.09375 -1.578125 C 1.09375 -0.796875 1.09375 0.109375 2.609375 0.109375 C 3.171875 0.109375 3.609375 -0.171875 3.890625 -0.78125 L 3.890625 0.109375 Z M 5.328125 0 "/>
</g>
<g id="glyph-0-6">
<path d="M 8.109375 0 L 8.109375 -0.3125 C 7.59375 -0.3125 7.34375 -0.3125 7.328125 -0.609375 L 7.328125 -2.515625 C 7.328125 -3.375 7.328125 -3.671875 7.015625 -4.03125 C 6.875 -4.203125 6.546875 -4.40625 5.96875 -4.40625 C 5.140625 -4.40625 4.6875 -3.8125 4.53125 -3.421875 C 4.390625 -4.296875 3.65625 -4.40625 3.203125 -4.40625 C 2.46875 -4.40625 2 -3.984375 1.71875 -3.359375 L 1.71875 -4.40625 L 0.3125 -4.296875 L 0.3125 -3.984375 C 1.015625 -3.984375 1.09375 -3.921875 1.09375 -3.421875 L 1.09375 -0.75 C 1.09375 -0.3125 0.984375 -0.3125 0.3125 -0.3125 L 0.3125 0 L 1.453125 -0.03125 L 2.5625 0 L 2.5625 -0.3125 C 1.890625 -0.3125 1.78125 -0.3125 1.78125 -0.75 L 1.78125 -2.59375 C 1.78125 -3.625 2.5 -4.1875 3.125 -4.1875 C 3.765625 -4.1875 3.875 -3.65625 3.875 -3.078125 L 3.875 -0.75 C 3.875 -0.3125 3.765625 -0.3125 3.09375 -0.3125 L 3.09375 0 L 4.21875 -0.03125 L 5.328125 0 L 5.328125 -0.3125 C 4.671875 -0.3125 4.5625 -0.3125 4.5625 -0.75 L 4.5625 -2.59375 C 4.5625 -3.625 5.265625 -4.1875 5.90625 -4.1875 C 6.53125 -4.1875 6.640625 -3.65625 6.640625 -3.078125 L 6.640625 -0.75 C 6.640625 -0.3125 6.53125 -0.3125 5.859375 -0.3125 L 5.859375 0 L 6.984375 -0.03125 Z M 8.109375 0 "/>
</g>
<g id="glyph-0-7">
<path d="M 4.6875 -2.140625 C 4.6875 -3.40625 3.703125 -4.46875 2.5 -4.46875 C 1.25 -4.46875 0.28125 -3.375 0.28125 -2.140625 C 0.28125 -0.84375 1.3125 0.109375 2.484375 0.109375 C 3.6875 0.109375 4.6875 -0.875 4.6875 -2.140625 Z M 3.875 -2.21875 C 3.875 -1.859375 3.875 -1.3125 3.65625 -0.875 C 3.421875 -0.421875 2.984375 -0.140625 2.5 -0.140625 C 2.0625 -0.140625 1.625 -0.34375 1.359375 -0.8125 C 1.109375 -1.25 1.109375 -1.859375 1.109375 -2.21875 C 1.109375 -2.609375 1.109375 -3.140625 1.34375 -3.578125 C 1.609375 -4.03125 2.078125 -4.25 2.484375 -4.25 C 2.921875 -4.25 3.34375 -4.03125 3.609375 -3.59375 C 3.875 -3.171875 3.875 -2.59375 3.875 -2.21875 Z M 3.875 -2.21875 "/>
</g>
<g id="glyph-0-8">
<path d="M 3.5625 -6.328125 C 3.5625 -6.703125 3.1875 -7.03125 2.65625 -7.03125 C 1.96875 -7.03125 1.109375 -6.5 1.109375 -5.4375 L 1.109375 -4.296875 L 0.328125 -4.296875 L 0.328125 -3.984375 L 1.109375 -3.984375 L 1.109375 -0.75 C 1.109375 -0.3125 1 -0.3125 0.34375 -0.3125 L 0.34375 0 L 1.46875 -0.03125 C 1.875 -0.03125 2.34375 -0.03125 2.734375 0 L 2.734375 -0.3125 L 2.53125 -0.3125 C 1.796875 -0.3125 1.78125 -0.421875 1.78125 -0.78125 L 1.78125 -3.984375 L 2.90625 -3.984375 L 2.90625 -4.296875 L 1.75 -4.296875 L 1.75 -5.453125 C 1.75 -6.328125 2.21875 -6.8125 2.65625 -6.8125 C 2.6875 -6.8125 2.84375 -6.8125 2.984375 -6.734375 C 2.875 -6.703125 2.6875 -6.5625 2.6875 -6.3125 C 2.6875 -6.09375 2.84375 -5.890625 3.125 -5.890625 C 3.40625 -5.890625 3.5625 -6.09375 3.5625 -6.328125 Z M 3.5625 -6.328125 "/>
</g>
<g id="glyph-0-9">
<path d="M 5.25 0 L 5.25 -0.3125 C 4.5625 -0.3125 4.46875 -0.375 4.46875 -0.875 L 4.46875 -6.921875 L 3.046875 -6.8125 L 3.046875 -6.5 C 3.734375 -6.5 3.8125 -6.4375 3.8125 -5.9375 L 3.8125 -3.78125 C 3.53125 -4.140625 3.09375 -4.40625 2.5625 -4.40625 C 1.390625 -4.40625 0.34375 -3.421875 0.34375 -2.140625 C 0.34375 -0.875 1.3125 0.109375 2.453125 0.109375 C 3.09375 0.109375 3.53125 -0.234375 3.78125 -0.546875 L 3.78125 0.109375 Z M 3.78125 -1.171875 C 3.78125 -1 3.78125 -0.984375 3.671875 -0.8125 C 3.375 -0.328125 2.9375 -0.109375 2.5 -0.109375 C 2.046875 -0.109375 1.6875 -0.375 1.453125 -0.75 C 1.203125 -1.15625 1.171875 -1.71875 1.171875 -2.140625 C 1.171875 -2.5 1.1875 -3.09375 1.46875 -3.546875 C 1.6875 -3.859375 2.0625 -4.1875 2.609375 -4.1875 C 2.953125 -4.1875 3.375 -4.03125 3.671875 -3.59375 C 3.78125 -3.421875 3.78125 -3.40625 3.78125 -3.21875 Z M 3.78125 -1.171875 "/>
</g>
<g id="glyph-0-10">
<path d="M 5.328125 0 L 5.328125 -0.3125 C 4.8125 -0.3125 4.5625 -0.3125 4.5625 -0.609375 L 4.5625 -2.515625 C 4.5625 -3.375 4.5625 -3.671875 4.25 -4.03125 C 4.109375 -4.203125 3.78125 -4.40625 3.203125 -4.40625 C 2.46875 -4.40625 2 -3.984375 1.71875 -3.359375 L 1.71875 -4.40625 L 0.3125 -4.296875 L 0.3125 -3.984375 C 1.015625 -3.984375 1.09375 -3.921875 1.09375 -3.421875 L 1.09375 -0.75 C 1.09375 -0.3125 0.984375 -0.3125 0.3125 -0.3125 L 0.3125 0 L 1.453125 -0.03125 L 2.5625 0 L 2.5625 -0.3125 C 1.890625 -0.3125 1.78125 -0.3125 1.78125 -0.75 L 1.78125 -2.59375 C 1.78125 -3.625 2.5 -4.1875 3.125 -4.1875 C 3.765625 -4.1875 3.875 -3.65625 3.875 -3.078125 L 3.875 -0.75 C 3.875 -0.3125 3.765625 -0.3125 3.09375 -0.3125 L 3.09375 0 L 4.21875 -0.03125 Z M 5.328125 0 "/>
</g>
<g id="glyph-0-11">
<path d="M 5.1875 -2.15625 C 5.1875 -3.421875 4.21875 -4.40625 3.078125 -4.40625 C 2.296875 -4.40625 1.875 -3.9375 1.71875 -3.765625 L 1.71875 -6.921875 L 0.28125 -6.8125 L 0.28125 -6.5 C 0.984375 -6.5 1.0625 -6.4375 1.0625 -5.9375 L 1.0625 0 L 1.3125 0 L 1.671875 -0.625 C 1.8125 -0.390625 2.234375 0.109375 2.96875 0.109375 C 4.15625 0.109375 5.1875 -0.875 5.1875 -2.15625 Z M 4.359375 -2.15625 C 4.359375 -1.796875 4.34375 -1.203125 4.0625 -0.75 C 3.84375 -0.4375 3.46875 -0.109375 2.9375 -0.109375 C 2.484375 -0.109375 2.125 -0.34375 1.890625 -0.71875 C 1.75 -0.921875 1.75 -0.953125 1.75 -1.140625 L 1.75 -3.1875 C 1.75 -3.375 1.75 -3.390625 1.859375 -3.546875 C 2.25 -4.109375 2.796875 -4.1875 3.03125 -4.1875 C 3.484375 -4.1875 3.84375 -3.921875 4.078125 -3.546875 C 4.34375 -3.140625 4.359375 -2.578125 4.359375 -2.15625 Z M 4.359375 -2.15625 "/>
</g>
<g id="glyph-0-12">
<path d="M 3.625 -3.796875 C 3.625 -4.109375 3.3125 -4.40625 2.890625 -4.40625 C 2.15625 -4.40625 1.796875 -3.734375 1.671875 -3.3125 L 1.671875 -4.40625 L 0.28125 -4.296875 L 0.28125 -3.984375 C 0.984375 -3.984375 1.0625 -3.921875 1.0625 -3.421875 L 1.0625 -0.75 C 1.0625 -0.3125 0.953125 -0.3125 0.28125 -0.3125 L 0.28125 0 L 1.421875 -0.03125 C 1.8125 -0.03125 2.28125 -0.03125 2.6875 0 L 2.6875 -0.3125 L 2.46875 -0.3125 C 1.734375 -0.3125 1.71875 -0.421875 1.71875 -0.78125 L 1.71875 -2.3125 C 1.71875 -3.296875 2.140625 -4.1875 2.890625 -4.1875 C 2.953125 -4.1875 2.984375 -4.1875 3 -4.171875 C 2.96875 -4.171875 2.765625 -4.046875 2.765625 -3.78125 C 2.765625 -3.515625 2.984375 -3.359375 3.203125 -3.359375 C 3.375 -3.359375 3.625 -3.484375 3.625 -3.796875 Z M 3.625 -3.796875 "/>
</g>
<g id="glyph-0-13">
<path d="M 2.46875 0 L 2.46875 -0.3125 C 1.796875 -0.3125 1.765625 -0.359375 1.765625 -0.75 L 1.765625 -4.40625 L 0.375 -4.296875 L 0.375 -3.984375 C 1.015625 -3.984375 1.109375 -3.921875 1.109375 -3.4375 L 1.109375 -0.75 C 1.109375 -0.3125 1 -0.3125 0.328125 -0.3125 L 0.328125 0 L 1.421875 -0.03125 C 1.78125 -0.03125 2.125 -0.015625 2.46875 0 Z M 1.90625 -6.015625 C 1.90625 -6.296875 1.6875 -6.546875 1.390625 -6.546875 C 1.046875 -6.546875 0.84375 -6.265625 0.84375 -6.015625 C 0.84375 -5.75 1.078125 -5.5 1.375 -5.5 C 1.71875 -5.5 1.90625 -5.765625 1.90625 -6.015625 Z M 1.90625 -6.015625 "/>
</g>
<g id="glyph-0-14">
<path d="M 4.8125 -0.890625 L 4.8125 -1.453125 L 4.5625 -1.453125 L 4.5625 -0.890625 C 4.5625 -0.3125 4.3125 -0.25 4.203125 -0.25 C 3.875 -0.25 3.84375 -0.703125 3.84375 -0.75 L 3.84375 -2.734375 C 3.84375 -3.15625 3.84375 -3.546875 3.484375 -3.921875 C 3.09375 -4.3125 2.59375 -4.46875 2.109375 -4.46875 C 1.296875 -4.46875 0.609375 -4 0.609375 -3.34375 C 0.609375 -3.046875 0.8125 -2.875 1.0625 -2.875 C 1.34375 -2.875 1.53125 -3.078125 1.53125 -3.328125 C 1.53125 -3.453125 1.46875 -3.78125 1.015625 -3.78125 C 1.28125 -4.140625 1.78125 -4.25 2.09375 -4.25 C 2.578125 -4.25 3.15625 -3.859375 3.15625 -2.96875 L 3.15625 -2.609375 C 2.640625 -2.578125 1.9375 -2.546875 1.3125 -2.25 C 0.5625 -1.90625 0.3125 -1.390625 0.3125 -0.953125 C 0.3125 -0.140625 1.28125 0.109375 1.90625 0.109375 C 2.578125 0.109375 3.03125 -0.296875 3.21875 -0.75 C 3.265625 -0.359375 3.53125 0.0625 4 0.0625 C 4.203125 0.0625 4.8125 -0.078125 4.8125 -0.890625 Z M 3.15625 -1.390625 C 3.15625 -0.453125 2.4375 -0.109375 1.984375 -0.109375 C 1.5 -0.109375 1.09375 -0.453125 1.09375 -0.953125 C 1.09375 -1.5 1.5 -2.328125 3.15625 -2.390625 Z M 3.15625 -1.390625 "/>
</g>
<g id="glyph-0-15">
<path d="M 5.25 1.9375 L 5.25 1.625 C 4.578125 1.625 4.46875 1.625 4.46875 1.171875 L 4.46875 -4.40625 L 4.25 -4.40625 L 3.875 -3.5 C 3.75 -3.78125 3.34375 -4.40625 2.546875 -4.40625 C 1.390625 -4.40625 0.34375 -3.4375 0.34375 -2.140625 C 0.34375 -0.890625 1.3125 0.109375 2.46875 0.109375 C 3.15625 0.109375 3.5625 -0.3125 3.78125 -0.609375 L 3.78125 1.171875 C 3.78125 1.625 3.671875 1.625 3.015625 1.625 L 3.015625 1.9375 L 4.125 1.90625 Z M 3.8125 -1.359375 C 3.8125 -1.03125 3.640625 -0.75 3.421875 -0.515625 C 3.296875 -0.375 2.96875 -0.109375 2.5 -0.109375 C 1.78125 -0.109375 1.171875 -1 1.171875 -2.140625 C 1.171875 -3.328125 1.859375 -4.15625 2.609375 -4.15625 C 3.40625 -4.15625 3.8125 -3.296875 3.8125 -2.765625 Z M 3.8125 -1.359375 "/>
</g>
</g>
</defs>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-1" x="107.243" y="8.369"/>
<use xlink:href="#glyph-0-2" x="114.436026" y="8.369"/>
<use xlink:href="#glyph-0-3" x="119.975254" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-4" x="127.716225" y="8.369"/>
<use xlink:href="#glyph-0-5" x="131.641505" y="8.369"/>
<use xlink:href="#glyph-0-6" x="137.180733" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-7" x="148.797171" y="8.369"/>
<use xlink:href="#glyph-0-8" x="153.778491" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-7" x="160.144618" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-9" x="165.404892" y="8.369"/>
<use xlink:href="#glyph-0-9" x="170.94412" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-10" x="179.800907" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-5" x="185.061181" y="8.369"/>
<use xlink:href="#glyph-0-6" x="190.600409" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-11" x="198.620334" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-3" x="204.438516" y="8.369"/>
<use xlink:href="#glyph-0-12" x="208.861928" y="8.369"/>
<use xlink:href="#glyph-0-4" x="212.767283" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-13" x="220.010122" y="8.369"/>
<use xlink:href="#glyph-0-4" x="222.779736" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-14" x="230.022575" y="8.369"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-4" x="238.321454" y="8.369"/>
<use xlink:href="#glyph-0-15" x="242.246735" y="8.369"/>
<use xlink:href="#glyph-0-5" x="247.507009" y="8.369"/>
<use xlink:href="#glyph-0-14" x="253.046236" y="8.369"/>
<use xlink:href="#glyph-0-12" x="258.027556" y="8.369"/>
<use xlink:href="#glyph-0-3" x="261.932911" y="8.369"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,13 @@
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\begin{document}
\begin{figure}
\centering
\includegraphics[scale=1]{sum_odd_numbers_to_square}
\setcounter{figure}{2}
\caption{The sum of odd numbers is a square}
\end{figure}
\end{document}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="199.621" height="199.621" viewBox="0 0 199.621 199.621">
<defs>
<g>
<g id="glyph-0-0">
</g>
<g id="glyph-0-1">
<path d="M 2.9375 -6.375 C 2.9375 -6.625 2.9375 -6.640625 2.703125 -6.640625 C 2.078125 -6 1.203125 -6 0.890625 -6 L 0.890625 -5.6875 C 1.09375 -5.6875 1.671875 -5.6875 2.1875 -5.953125 L 2.1875 -0.78125 C 2.1875 -0.421875 2.15625 -0.3125 1.265625 -0.3125 L 0.953125 -0.3125 L 0.953125 0 C 1.296875 -0.03125 2.15625 -0.03125 2.5625 -0.03125 C 2.953125 -0.03125 3.828125 -0.03125 4.171875 0 L 4.171875 -0.3125 L 3.859375 -0.3125 C 2.953125 -0.3125 2.9375 -0.421875 2.9375 -0.78125 Z M 2.9375 -6.375 "/>
</g>
<g id="glyph-0-2">
<path d="M 2.890625 -3.515625 C 3.703125 -3.78125 4.28125 -4.46875 4.28125 -5.265625 C 4.28125 -6.078125 3.40625 -6.640625 2.453125 -6.640625 C 1.453125 -6.640625 0.6875 -6.046875 0.6875 -5.28125 C 0.6875 -4.953125 0.90625 -4.765625 1.203125 -4.765625 C 1.5 -4.765625 1.703125 -4.984375 1.703125 -5.28125 C 1.703125 -5.765625 1.234375 -5.765625 1.09375 -5.765625 C 1.390625 -6.265625 2.046875 -6.390625 2.40625 -6.390625 C 2.828125 -6.390625 3.375 -6.171875 3.375 -5.28125 C 3.375 -5.15625 3.34375 -4.578125 3.09375 -4.140625 C 2.796875 -3.65625 2.453125 -3.625 2.203125 -3.625 C 2.125 -3.609375 1.890625 -3.59375 1.8125 -3.59375 C 1.734375 -3.578125 1.671875 -3.5625 1.671875 -3.46875 C 1.671875 -3.359375 1.734375 -3.359375 1.90625 -3.359375 L 2.34375 -3.359375 C 3.15625 -3.359375 3.53125 -2.6875 3.53125 -1.703125 C 3.53125 -0.34375 2.84375 -0.0625 2.40625 -0.0625 C 1.96875 -0.0625 1.21875 -0.234375 0.875 -0.8125 C 1.21875 -0.765625 1.53125 -0.984375 1.53125 -1.359375 C 1.53125 -1.71875 1.265625 -1.921875 0.984375 -1.921875 C 0.734375 -1.921875 0.421875 -1.78125 0.421875 -1.34375 C 0.421875 -0.4375 1.34375 0.21875 2.4375 0.21875 C 3.65625 0.21875 4.5625 -0.6875 4.5625 -1.703125 C 4.5625 -2.515625 3.921875 -3.296875 2.890625 -3.515625 Z M 2.890625 -3.515625 "/>
</g>
<g id="glyph-0-3">
<path d="M 4.46875 -2 C 4.46875 -3.1875 3.65625 -4.1875 2.578125 -4.1875 C 2.109375 -4.1875 1.671875 -4.03125 1.3125 -3.671875 L 1.3125 -5.625 C 1.515625 -5.5625 1.84375 -5.5 2.15625 -5.5 C 3.390625 -5.5 4.09375 -6.40625 4.09375 -6.53125 C 4.09375 -6.59375 4.0625 -6.640625 3.984375 -6.640625 C 3.984375 -6.640625 3.953125 -6.640625 3.90625 -6.609375 C 3.703125 -6.515625 3.21875 -6.3125 2.546875 -6.3125 C 2.15625 -6.3125 1.6875 -6.390625 1.21875 -6.59375 C 1.140625 -6.625 1.125 -6.625 1.109375 -6.625 C 1 -6.625 1 -6.546875 1 -6.390625 L 1 -3.4375 C 1 -3.265625 1 -3.1875 1.140625 -3.1875 C 1.21875 -3.1875 1.234375 -3.203125 1.28125 -3.265625 C 1.390625 -3.421875 1.75 -3.96875 2.5625 -3.96875 C 3.078125 -3.96875 3.328125 -3.515625 3.40625 -3.328125 C 3.5625 -2.953125 3.59375 -2.578125 3.59375 -2.078125 C 3.59375 -1.71875 3.59375 -1.125 3.34375 -0.703125 C 3.109375 -0.3125 2.734375 -0.0625 2.28125 -0.0625 C 1.5625 -0.0625 0.984375 -0.59375 0.8125 -1.171875 C 0.84375 -1.171875 0.875 -1.15625 0.984375 -1.15625 C 1.3125 -1.15625 1.484375 -1.40625 1.484375 -1.640625 C 1.484375 -1.890625 1.3125 -2.140625 0.984375 -2.140625 C 0.84375 -2.140625 0.5 -2.0625 0.5 -1.609375 C 0.5 -0.75 1.1875 0.21875 2.296875 0.21875 C 3.453125 0.21875 4.46875 -0.734375 4.46875 -2 Z M 4.46875 -2 "/>
</g>
<g id="glyph-0-4">
<path d="M 4.75 -6.078125 C 4.828125 -6.1875 4.828125 -6.203125 4.828125 -6.421875 L 2.40625 -6.421875 C 1.203125 -6.421875 1.171875 -6.546875 1.140625 -6.734375 L 0.890625 -6.734375 L 0.5625 -4.6875 L 0.8125 -4.6875 C 0.84375 -4.84375 0.921875 -5.46875 1.0625 -5.59375 C 1.125 -5.65625 1.90625 -5.65625 2.03125 -5.65625 L 4.09375 -5.65625 C 3.984375 -5.5 3.203125 -4.40625 2.984375 -4.078125 C 2.078125 -2.734375 1.75 -1.34375 1.75 -0.328125 C 1.75 -0.234375 1.75 0.21875 2.21875 0.21875 C 2.671875 0.21875 2.671875 -0.234375 2.671875 -0.328125 L 2.671875 -0.84375 C 2.671875 -1.390625 2.703125 -1.9375 2.78125 -2.46875 C 2.828125 -2.703125 2.953125 -3.5625 3.40625 -4.171875 Z M 4.75 -6.078125 "/>
</g>
<g id="glyph-0-5">
<path d="M 3.65625 -3.171875 L 3.65625 -2.84375 C 3.65625 -0.515625 2.625 -0.0625 2.046875 -0.0625 C 1.875 -0.0625 1.328125 -0.078125 1.0625 -0.421875 C 1.5 -0.421875 1.578125 -0.703125 1.578125 -0.875 C 1.578125 -1.1875 1.34375 -1.328125 1.125 -1.328125 C 0.96875 -1.328125 0.671875 -1.25 0.671875 -0.859375 C 0.671875 -0.1875 1.203125 0.21875 2.046875 0.21875 C 3.34375 0.21875 4.5625 -1.140625 4.5625 -3.28125 C 4.5625 -5.96875 3.40625 -6.640625 2.515625 -6.640625 C 1.96875 -6.640625 1.484375 -6.453125 1.0625 -6.015625 C 0.640625 -5.5625 0.421875 -5.140625 0.421875 -4.390625 C 0.421875 -3.15625 1.296875 -2.171875 2.40625 -2.171875 C 3.015625 -2.171875 3.421875 -2.59375 3.65625 -3.171875 Z M 2.421875 -2.40625 C 2.265625 -2.40625 1.796875 -2.40625 1.5 -3.03125 C 1.3125 -3.40625 1.3125 -3.890625 1.3125 -4.390625 C 1.3125 -4.921875 1.3125 -5.390625 1.53125 -5.765625 C 1.796875 -6.265625 2.171875 -6.390625 2.515625 -6.390625 C 2.984375 -6.390625 3.3125 -6.046875 3.484375 -5.609375 C 3.59375 -5.28125 3.640625 -4.65625 3.640625 -4.203125 C 3.640625 -3.375 3.296875 -2.40625 2.421875 -2.40625 Z M 2.421875 -2.40625 "/>
</g>
</g>
</defs>
<path fill="none" stroke-width="0.3985" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 170.080563 -0.0015625 M -0.00146875 28.346094 L 170.080563 28.346094 M -0.00146875 56.69375 L 170.080563 56.69375 M -0.00146875 85.041406 L 170.080563 85.041406 M -0.00146875 113.389063 L 170.080563 113.389063 M -0.00146875 141.732813 L 170.080563 141.732813 M -0.00146875 170.072656 L 170.080563 170.072656 M -0.00146875 -0.0015625 L -0.00146875 170.080469 M 28.346187 -0.0015625 L 28.346187 170.080469 M 56.693844 -0.0015625 L 56.693844 170.080469 M 85.0415 -0.0015625 L 85.0415 170.080469 M 113.389156 -0.0015625 L 113.389156 170.080469 M 141.732906 -0.0015625 L 141.732906 170.080469 M 170.07275 -0.0015625 L 170.07275 170.080469 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="0.79701" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 170.080563 -0.0015625 L 170.080563 170.080469 L -0.00146875 170.080469 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="1.19553" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="1.19553" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 28.346187 -0.0015625 L 28.346187 28.346094 L -0.00146875 28.346094 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="1.19553" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 56.693844 -0.0015625 L 56.693844 56.69375 L -0.00146875 56.69375 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="1.19553" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 85.0415 -0.0015625 L 85.0415 85.041406 L -0.00146875 85.041406 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="1.19553" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 113.389156 -0.0015625 L 113.389156 113.389063 L -0.00146875 113.389063 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="1.19553" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 141.732906 -0.0015625 L 141.732906 141.732813 L -0.00146875 141.732813 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<path fill="none" stroke-width="1.19553" stroke-linecap="butt" stroke-linejoin="miter" stroke="rgb(0%, 0%, 0%)" stroke-opacity="1" stroke-miterlimit="10" d="M -0.00146875 -0.0015625 L 170.080563 -0.0015625 L 170.080563 170.080469 L -0.00146875 170.080469 L -0.00146875 -0.0015625 " transform="matrix(1, 0, 0, -1, 14.771, 184.85)"/>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-1" x="26.454" y="173.887"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-2" x="54.8" y="145.541"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-3" x="83.146" y="117.194"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-4" x="111.493" y="88.848"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-5" x="139.839" y="60.501"/>
</g>
<g fill="rgb(0%, 0%, 0%)" fill-opacity="1">
<use xlink:href="#glyph-0-1" x="165.695" y="32.155"/>
<use xlink:href="#glyph-0-1" x="170.6763" y="32.155"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

@ -0,0 +1,25 @@
% Draw a 6 by 6 grid of squares, with thicker line on outer borders.
\documentclass[margin=0.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
% Draw grid
\draw (0, 0) grid (6, 6);
% Draw thicker lines on outer borders
\draw[thick] (0, 0) -- (6, 0) -- (6, 6) -- (0, 6) -- (0, 0);
% Draw for each square with bottom left corner at (0, 0) to (6, 6) the thicker border
\foreach \i in {0, 1, 2, 3, 4, 5, 6}
\draw[very thick] (0, 0) -- (\i, 0) -- (\i, \i) -- (0, \i) -- (0, 0);
% For each $i$-th odd number from 1 to 11, add a node at the top right corner of the $i$-th square
\foreach \i [evaluate={\x=int(\i*2+1);}] in {0, 1, 2, 3, 4, 5}
\node at (\i+0.5, \i+0.5) {$\x$};
\end{tikzpicture}
\end{document}

View File

@ -1 +1,7 @@
\chapter*{Introduction} \chapter*{Introduction}
This document gathers some random solution to the problem from the \textit{Art of Computer Programming} by Donald E. KNUTH.
It should not be considered as a reference, but as a personal attempt to solve some of the exercises, there for the answer should not consider the solution as correct unless he find it so.
The answer are presented with page numbers from the third edition of the AOCP.

3
tex/definitions.tex Normal file → Executable file
View File

@ -0,0 +1,3 @@
\DeclareMathOperator{\Reals}{\mathbb{R}}
\DeclareMathOperator{\Integers}{\mathbb{Z}}
\DeclareMathOperator{\Naturals}{\mathbb{N}}

View File

@ -1,5 +1,5 @@
% makeindex style file created by the glossaries package % makeindex style file created by the glossaries package
% for document 'main' on 2023-1-3 % for document 'main' on 2023-2-27
actual '?' actual '?'
encap '|' encap '|'
level '!' level '!'

Binary file not shown.

View File

@ -1,44 +1,23 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The LuaLaTeX Chameleon Book Template
% LaTeX Template
% Version 0.0.0 (2022-12-05)
%
% Authors:
% Samuel ORTION <samuel+dev@ortion.fr>
% Compiling this template:
% This template uses biber for its bibliography and makeindex for its index.
% When you first open the template, compile it from the command line with the
% commands below to make sure your LaTeX distribution is configured correctly:
%
% 1) lualatex main
% 2) makeindex main.idx -s indexstyle.ist
% 3) biber main
% 3) makeglossaries main
% 4) lualatex main
% 5) lualatex main
%
% License:
% MIT
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PREAMBLE % PREAMBLE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[ \documentclass[
11pt, 11pt,
fleqn, fleqn,
a4paper a4paper,
oneside
]{TheLuaChameleonBook} ]{TheLuaChameleonBook}
% Book PDF metadata % Book PDF metadata
\hypersetup{ \hypersetup{
pdftitle={The Art of Computer Programming Vol. 1 - Some Exercises}, pdftitle={The Art of Computer Programming Vol. 1 - Some Exercises},
pdfauthor={Samuel ORTION}, pdfauthor={Samuel ORTION},
pdfsubject={An Attempt to solve some of the exercises from the Book of Donald E. KNUTH}, pdfsubject={An Attempt to solve some of the exercises from the Book of Donald E. KNUTH},
pdfkeywords={computer science, mathematics, algorithmics}, pdfkeywords={computer science, mathematics, algorithmic},
pdfcreator={LaTeX}, pdfcreator={LaTeX},
} }
\definecolor{primarycolor}{RGB}{0, 128, 0} \definecolor{primarycolor}{RGB}{0, 128, 0}
@ -48,6 +27,7 @@
\makeindex \makeindex
\input{preamble.tex} \input{preamble.tex}
\input{definitions.tex}
\setcounter{tocdepth}{2} \setcounter{tocdepth}{2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -87,7 +67,7 @@
\noindent \texttt{\href{https://samuel.ortion.fr/}{samuel.ortion.fr}}\\ % URL \noindent \texttt{\href{https://samuel.ortion.fr/}{samuel.ortion.fr}}\\ % URL
\noindent Licensed under the Creative Commons Attribution-NonCommercial 4.0 License. \noindent Answers Licensed under the Creative Commons Attribution-NonCommercial 4.0 License.
% You may not use this file except in compliance with the License. You may obtain a copy of the License at \url{https://creativecommons.org/licenses/by-nc-sa/4.0}. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \textsc{``as is'' basis, without warranties or conditions of any kind}, either express or implied. See the License for the specific language governing permissions and limitations under the License.\\ % License information, replace this with your own license (if any) % You may not use this file except in compliance with the License. You may obtain a copy of the License at \url{https://creativecommons.org/licenses/by-nc-sa/4.0}. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \textsc{``as is'' basis, without warranties or conditions of any kind}, either express or implied. See the License for the specific language governing permissions and limitations under the License.\\ % License information, replace this with your own license (if any)
% \noindent \textit{First printing, October 2022} % Printing/edition date % \noindent \textit{First printing, October 2022} % Printing/edition date

View File

@ -2,65 +2,61 @@
\usepackage{xstring} \usepackage{xstring}
\newcommand{\unfinished}{ \newcommand{\unfinished}{
\textbf{\textcolor{orange!90}{to be continued...}} \textbf{\textcolor{orange!90}{to be continued...}}
} }
\newcommand{\unresolved}{ \newcommand{\unresolved}{
\textbf{\textcolor{red!90}{unresolved}} \textbf{\textcolor{red!90}{unresolved}}
} }
% Create a new environment {exercise} to refer to exercises from the KNUTH book. % Create a new environment {exercise} to refer to exercises from the KNUTH book.
% Add a TODO switch option to show unresolved exercises
\newenvironment{myexercise}[2] \newenvironment{myexercise}[2]
{ {
\addcontentsline{toc}{subsubsection}{Exercise #1} \addcontentsline{toc}{subsubsection}{Exercise #1}
\begin{minipage}{\textwidth} \begin{flushleft}
\begin{flushleft} {
{ \Large
\Huge \textbf{Exercise #1.} (p. #2)
\textbf{Exercise #1.} (p. #2) }
} \end{flushleft}
\end{flushleft}
} }
{ {
\end{minipage}
} }
% Create a new environment for big quote with `primarycolor' coloured quote sign % Create a new environment for big quote with `primarycolor' coloured quote sign
\newenvironment{myquote} \newenvironment{myquote}
{ {
\begin{minipage}{\textwidth} \begin{flushleft}
\begin{flushleft} {
{
\fontsize{75pt}{3pt}\selectfont \fontsize{75pt}{3pt}\selectfont
\textcolor{primarycolor}{\textquotedblleft} \textcolor{primarycolor}{\textquotedblleft}
} }
} }
{ {
\begin{flushright} \begin{flushright}
{ {
\textcolor{primarycolor}{\textquotedblright} \textcolor{primarycolor}{\textquotedblright}
} }
\end{flushright} \end{flushright}
\end{flushleft} \end{flushleft}
\end{minipage}
} }
\newenvironment{myanswer} \newenvironment{myanswer}
{ {
\begin{minipage}{\textwidth} \begin{itshape}
\begin{itshape} \begin{flushleft}
\begin{flushleft} {
{ \textbf{My Answer}:
\Large }
\textbf{My Answer}:
}
} }
{ {
\end{flushleft} \end{flushleft}
\end{itshape} \end{itshape}
\end{minipage}
} }
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{algpseudocodex}