% https://git.betalupi.com/Mark/latex-packages
% use [nosolutions] flag to hide solutions.
% use [solutions] flag to show solutions.
% Last built with version 1.1.0
\documentclass[
	solutions
]{ormc_handout}

\usepackage{pdfpages}
\usepackage{sliderule}

% Args:
% x, top scale y, label
\newcommand{\slideruleind}[3]{
	\draw[
		line width=1mm,
		draw=black,
		opacity=0.3,
		text opacity=1
	]
		({#1}, {#2 + 1})
		--
		({#1}, {#2 - 1.1})
		node [below] {#3};
}

\begin{document}

	\maketitle
		<Intermediate 2>
		<Summer 2022>
		{Slide Rules}
		{
			Prepared by Mark on \today
		}

	\vspace{1cm}

	\begin{minipage}{6cm}
		Dad says that anyone who can't use
		a slide rule is a cultural illiterate
		and should not be allowed to vote.

		\vspace{1ex}

		\textit{Have Space Suit -- Will Travel, 1958}
	\end{minipage}
	\hfill

	\section{Logarithms}

	\definition{}<logdef>
	The \textit{logarithm} is the inverse of the exponent. That is, if $b^p = c$, then $\log_b{c} = p$. \\
	In other words, $\log_b{c}$ asks the question ``what power do I need to raise $b$ to to get $c$?'' \\

	\medskip

	In both $b^p$ and $\log_b{c}$, the number $b$ is called the \textit{base}.


	\problem{}
	Evaluate the following by hand:

	\begin{enumerate}
		\item $\log_{10}{(1000)}$
		\vfill
		\item $\log_2{(64)}$
		\vfill
		\item $\log_2{(\frac{1}{4})}$
		\vfill
		\item $\log_x{(x)}$ for any $x$
		\vfill
		\item $log_x{(1)}$ for any $x$
		\vfill
	\end{enumerate}

	\pagebreak


	\definition{}
	There are a few ways to write logarithms:
	\begin{itemize}
		\item[] $\log{x} = \log_{10}{x}$
		\item[] $\lg{x} = \log_{10}{x}$
		\item[] $\ln{x} = \log_e{x}$
	\end{itemize}

	\definition{}
	The \textit{domain} of a function is the set of values it can take as inputs. \\
	The \textit{range} of a function is the set of values it can produce.

	\medskip

	For example, the domain and range of $f(x) = x$ is $\mathbb{R}$, all real numbers. \\
	The domain of $f(x) = |x|$ is $\mathbb{R}$, and its range is $\mathbb{R}^+ \cup \{0\}$, all positive real numbers and 0. \\

	\medskip

	Note that the domain and range of a function are not always equal.

	\problem{}<expdomain>
	What is the domain of $f(x) = 5^x$? \\
	What is the range of $f(x) = 5^x$?
	\vfill

	\problem{}<logdomain>
	What is the domain of $f(x) = \log{x}$? \\
	What is the range of $f(x) = \log{x}$?
	\vfill

	\pagebreak


	\problem{}<logids>
	Prove the following identities: \\

	\begin{enumerate}[itemsep=2mm]
		\item $\log_b{(b^x)} = x$
		\item $b^{\log_b{x}} = x$
		\item $\log_b{(xy)} = \log_b{(x)} + \log_b{(y)}$
		\item $\log_b{(\frac{x}{y})} = \log_b{(x)} - \log_b{(y)}$
		\item $\log_b{(x^y)} = y \log_b{(x)}$
	\end{enumerate}

	\vfill

	\begin{instructornote}
		A good intro to the following sections is the linear slide rule:

		\begin{center}
			\begin{tikzpicture}[scale=1]
				\linearscale{2}{1}{}
				\linearscale{0}{0}{}

				\slideruleind
					{5}
					{1}
					{2 + 3 = 5}
		\end{tikzpicture}
		\end{center}

		Take two linear rulers, offset one, and you add. \\
		If you do the same with a log scale, you multiply! \\
		\vspace{1ex}
		Note that the slide rules above start at 0.

		\linehack{}

		After assembling the paper slide rule, you can make a visor with some transparent tape. Wrap a strip around the slide rule, sticky side out, and stick it to itself to form a ring. Cover the sticky side with another layer of tape, and trim the edges to make them straight. Use the edge of the visor to read your slide rule!
	\end{instructornote}

	\pagebreak

	\section{Introduction}

	Mathematicians, physicists, and engineers needed to quickly solve complex equations even before computers were invented.

	\medskip

	The \textit{slide rule} is an instrument that uses the logarithm to solve this problem. Before you continue, cut out and assemble your slide rule.

	\medskip

	There are four scales on your slide rule, each labeled with a letter on the left side:

	\def\sliderulewidth{13}
	\begin{center}
	\begin{tikzpicture}[scale=1]
		\tscale{0}{9}{T}
		\kscale{0}{8}{K}
		\abscale{0}{7}{A}

		\abscale{0}{5.5}{B}
		\ciscale{0}{4.5}{CI}
		\cdscale{0}{3.5}{C}

		\cdscale{0}{2}{D}
		\lscale{0}{1}{L}
		\sscale{0}{0}{S}
	\end{tikzpicture}
	\end{center}

	Each scale's ``generating function'' is on the right:
	\begin{itemize}
		\item T: $\tan$
		\item K: $x^3$
		\item A,B: $x^2$
		\item CI: $\frac{1}{x}$
		\item C, D: $x$
		\item L: $\log_{10}(x)$
		\item S: $\sin$
	\end{itemize}

	Once you understand the layout of your slide rule, move on to the next page.

	\pagebreak

	\section{Multiplication}

	We'll use the C and D scales of your slide rule to multiply. \\

	Say we want to multiply $2 \times 3$. First, move the \textit{left-hand index} of the C scale over the smaller number, $2$:

	\def\sliderulewidth{10}
	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{\cdscalefn(2)}{1}{C}
		\cdscale{0}{0}{D}
	\end{tikzpicture}
	\end{center}

	Then we'll find the second number, $3$ on the C scale, and read the D scale under it:

	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{\cdscalefn(2)}{1}{C}
		\cdscale{0}{0}{D}

		\slideruleind
			{\cdscalefn(6)}
			{1}
			{6}

	\end{tikzpicture}
	\end{center}

	Of course, our answer is 6.

	\problem{}
	What is $1.15 \times 2.1$? \\
	Use your slide rule.

	\begin{solution}
		\begin{center}
			\begin{tikzpicture}[scale=1]
				\cdscale{\cdscalefn(1.15)}{1}{C}
				\cdscale{0}{0}{D}

				\slideruleind
					{\cdscalefn(1.15)}
					{1}
					{1.15}

				\slideruleind
					{\cdscalefn(1.15) + \cdscalefn(2.1)}
					{1}
					{2.415}

			\end{tikzpicture}
			\end{center}
	\end{solution}

	\vfill

	Note that your answer isn't exact. $1.15 \times 2.1 = 2.415$, but an answer accurate within two decimal places is close enough for most practical applications. \\

	\pagebreak

	Look at your C and D scales again. They contain every number between 1 and 10, but no more than that.
	What should we do if we want to calculate $32 \times 210$? \\

	\problem{}
	Using your slide rule, calculate $32 \times 210$. \\
	%\hint{$32 = 3.2 \times 10^1$}

	\begin{solution}
		\begin{center}
		\begin{tikzpicture}[scale=1]
			\cdscale{\cdscalefn(2.1)}{1}{C}
			\cdscale{0}{0}{D}

			\slideruleind
				{\cdscalefn(2.1)}
				{1}
				{2.1}

			\slideruleind
				{\cdscalefn(2.1) + \cdscalefn(3.2)}
				{1}
				{6.72}

		\end{tikzpicture}
		\end{center}

			Placing the decimal point correctly is your job. \\
			$10^1 \times 10^2 = 10^3$, so our final answer is $6.72 \times 10^3 = 672$.
	\end{solution}

	\vfill

	%This method of writing numbers is called \textit{scientific notation}. In the form $a \times 10^b$, $a$ is called the \textit{mantissa}, and $b$, the \textit{exponent}. \\

	%You may also see expressions like $4.3\text{e}2$. This is equivalent to $4.3 \times 10^2$, but is more compact.


	\problem{}
	Compute the following:
	\begin{enumerate}
		\item $1.44 \times 52$
		\item $0.38 \times 1.24$
		\item $\pi \times 2.35$
	\end{enumerate}

	\begin{solution}
		\begin{enumerate}
			\item $1.44 \times 52 = 74.88$
			\item $0.38 \times 1.24 = 0.4712$
			\item $\pi \times 2.35 = 7.382$
		\end{enumerate}
	\end{solution}

	\vfill
	\pagebreak

	\problem{}<provemult>
	Note that the numbers on your C and D scales are logarithmically spaced.

	\def\sliderulewidth{13}
	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{0}{1}{C}
		\cdscale{0}{0}{D}
	\end{tikzpicture}
	\end{center}

	Why does our multiplication procedure work? \\
	%\hint{See \ref{logids}}

	\vfill
	\pagebreak

	Now we want to compute $7.2 \times 5.5$:

	\def\sliderulewidth{10}
	\begin{center}
	\begin{tikzpicture}[scale=0.8]
		\cdscale{\cdscalefn(5.5)}{1}{C}
		\cdscale{0}{0}{D}

		\slideruleind
			{\cdscalefn(5.5)}
			{1}
			{5.5}

		\slideruleind
			{\cdscalefn(5.5) + \cdscalefn(7.2)}
			{1}
			{???}

	\end{tikzpicture}
	\end{center}

	No matter what order we go in, the answer ends up off the scale. There must be another way. \\

	\medskip

	Look at the far right of your C scale. There's an arrow pointing to the $10$ tick, labeled \textit{right-hand index}. Move it over the \textit{larger} number, $7.2$:

	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{\cdscalefn(7.2) - \cdscalefn(10)}{1}{C}
		\cdscale{0}{0}{D}

		\slideruleind
			{\cdscalefn(7.2)}
			{1}
			{7.2}

	\end{tikzpicture}
	\end{center}

	Now find the smaller number, $5.5$, on the C scale, and read the D scale under it:

	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{\cdscalefn(7.2) - \cdscalefn(10)}{1}{C}
		\cdscale{0}{0}{D}


		\slideruleind
			{\cdscalefn(7.2)}
			{1}
			{7.2}

		\slideruleind
			{\cdscalefn(3.96)}
			{1}
			{3.96}

	\end{tikzpicture}
	\end{center}

	Our answer should be about $7 \times 5 = 35$, so let's move the decimal point: $5.5 \times 7.2 = 39.6$. We can do this by hand to verify our answer. \\

	\medskip

	\iftrue
		\problem{}
		Why does this work?

	\else
		Why does this work? \\

		\medskip

		Consider the following picture, where I've put two D scales next to each other:

		\begin{center}
		\begin{tikzpicture}[scale=0.7]
			\cdscale{\cdscalefn(7.2) - \cdscalefn(10)}{1}{C}
			\cdscale{0}{0}{}
			\cdscale{-10}{0}{}

			\draw[
				draw=black,
			]
				(0, 0)
				--
				(0, -0.3)
				node [below] {D};

			\draw[
				draw=black,
			]
				(-10, 0)
				--
				(-10, -0.3)
				node [below] {D};

			\slideruleind
				{-10 + \cdscalefn(7.2)}
				{1}
				{7.2}

			\slideruleind
				{\cdscalefn(7.2)}
				{1}
				{7.2}

			\slideruleind
				{\cdscalefn(3.96)}
				{1}
				{3.96}

		\end{tikzpicture}
		\end{center}

		\medskip

		The second D scale has been moved to the right by $(\log{10})$, so every value on it is $(\log{10})$ smaller than it should be.

		\medskip

		\medskip
		In other words, the answer we get from reverse multiplication is the following: $\log{a} + \log{b} - \log{10}$. \\
		This reduces to $\log{(\frac{a \times b}{10})}$, which explains the misplaced decimal point in $7.2 \times 5.5$.
	\fi

	\vfill
	\pagebreak

	\problem{}
	Compute the following using your slide rule:
	\begin{enumerate}
		\item $9 \times 8$
		\item $15 \times 35$
		\item $42.1 \times 7.65$
		\item $6.5^2$
	\end{enumerate}

	\begin{solution}
		\begin{enumerate}
			\item $9 \times 8 = 72$
			\item $15 \times 35 = 525$
			\item $42.1 \times 7.65 = 322.065$
			\item $6.5^2 = 42.25$
		\end{enumerate}
	\end{solution}

	\vfill
	\pagebreak

	\section{Division}

	Now that you can multiply, division should be easy. All you need to do is work backwards. \\
	Let's look at our first example again: $3 \times 2 = 6$.

	\medskip

	We can easily see that $6 \div 3 = 2$

	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{\cdscalefn(2)}{1}{C}
		\cdscale{0}{0}{D}

		\slideruleind
			{\cdscalefn(6)}
			{1}
			{Align here}

		\slideruleind
			{\cdscalefn(2)}
			{1}
			{2}
	\end{tikzpicture}
	\end{center}

	and that $6 \div 2 = 3$:
	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{\cdscalefn(3)}{-3}{C}
		\cdscale{0}{-4}{D}


		\slideruleind
			{\cdscalefn(6)}
			{-3}
			{Align here}

		\slideruleind
			{\cdscalefn(3)}
			{-3}
			{3}

	\end{tikzpicture}
	\end{center}

	If your left-hand index is off the scale, read the right-hand one. \\
	Consider $42.25 \div 6.5 = 6.5$:

	\begin{center}
	\begin{tikzpicture}[scale=1]
		\cdscale{\cdscalefn(6.5) - \cdscalefn(10)}{1}{C}
		\cdscale{0}{0}{D}


		\slideruleind
			{\cdscalefn(4.225)}
			{1}
			{Align here}

		\slideruleind
			{\cdscalefn(6.5)}
			{1}
			{6.5}

	\end{tikzpicture}
	\end{center}

	Place your decimal points carefully.

	\vfill
	\pagebreak

	\problem{}
	Compute the following using your slide rule. \\

	\begin{enumerate}
		\item $135 \div 15$
		\item $68.2 \div 0.575$
		\item $(118 \times 0.51) \div 6.6$
	\end{enumerate}

	\begin{solution}
		\begin{enumerate}
			\item $135 \div 15 = 9$
			\item $68.2 \div 0.575 = 118.609$
			\item $(118 \times 0.51) \div 6.6 = 9.118$
		\end{enumerate}
	\end{solution}

	\vfill
	\pagebreak



	\section{Squares, Cubes, and Roots}

	Now, take a look at scales A and B, and note the label on the right: $x^2$. If C, D are $x$, A and B are $x^2$, and K is $x^3$.

	\medskip

	Finding squares of numbers up to ten is straightforward: just read the scale. \\
	Square roots are also easy: find your number on B and read its pair on C. \\


	\def\sliderulewidth{13}
	\begin{center}
	\begin{tikzpicture}[scale=1]
		\abscale{0}{1}{B}
		\cdscale{0}{0}{C}
	\end{tikzpicture}
	\end{center}

	\problem{}
	Compute the following.
	\begin{enumerate}
		\item $1.5^2$
		\item $3.1^2$
		\item $7^3$
		\item $\sqrt{14}$
		\item $\sqrt[3]{150}$
	\end{enumerate}

	\begin{solution}
		\begin{enumerate}
			\item $1.5^2 = 2.25$
			\item $3.1^2 = 9.61$
			\item $7^3 = 343$
			\item $\sqrt{14} = 3.74$
			\item $\sqrt[3]{150} = 5.313$
		\end{enumerate}
	\end{solution}

	\vfill
	\problem{}
	Compute the following.
	\begin{enumerate}
		\item $42^2$
		\item $\sqrt{200}$
		\item $\sqrt{2000}$
		\item $\sqrt{0.9}$
		\item $\sqrt[3]{0.12}$
	\end{enumerate}

	\begin{solution}
		\begin{enumerate}
			\item $42^2 = 1,764$
			\item $\sqrt{200} = 14.14$
			\item $\sqrt{2000} = 44.72$
			\item $\sqrt{0.9} = 0.948$
			\item $\sqrt[3]{0.12} = 0.493$
		\end{enumerate}
	\end{solution}


	\vfill
	\pagebreak

	\section{Inverses}

	Try finding $1 \div 32$ using your slide rule. \\
	The procedure we learned before doesn't work!

	\medskip

	This is why we have the CI scale, or the ``C Inverse'' scale.

	\problem{}
	Figure out how the CI scale works and compute the following:
	\begin{enumerate}[itemsep=1mm]
		\item $\frac{1}{7}$
		\item $\frac{1}{120}$
		\item $\frac{1}{\pi}$
	\end{enumerate}

	\vfill
	\pagebreak

	\section{Logarithms Base 10}

	When we take a logarithm, the resulting number has two parts: the \textit{characteristic} and the \textit{mantissa}. \\
	The characteristic is the integral (whole-numbered) part of the answer, and the mantissa is the fractional part (what comes after the decimal). \\

	\medskip

	For example, $\log_{10}{18} = 1.255$, so in this case the characteristic is $1$ and the mantissa is $0.255$.

	\problem{}
	Approximate the following logs without a slide rule. Find the exact characteristic, and approximate the mantissa.
	\begin{enumerate}
		\item $\log_{10}{20}$
		\item $\log_{2}{18}$
	\end{enumerate}

	\begin{solution}
		\begin{enumerate}
			\item $\log_{10}{20} = 1.30$
			\item $\log_{2}{18} = 4.17$
		\end{enumerate}
	\end{solution}

	\vfill

	Now, find the L scale on your slide rule. As you can see on the right, its generating function is $\log_{10}{x}$.

	\problem{}
	Compute the following logarithms using your slide rule. \\
	You'll have to find the characteristic yourself, but your L scale will give you the mantissa. \\
	Don't forget your log identities!

	\begin{enumerate}
		\item $\log_{10}{20}$
		\item $\log_{10}{15}$
		\item $\log_{10}{150}$
		\item $\log_{10}{0.024}$
	\end{enumerate}

	\begin{solution}
		Careful with number 4.

		\begin{enumerate}
			\item $\log_{10}{20} = 1.30$
			\item $\log_{10}{15} = 1.176$
			\item $\log_{10}{150} = 2.176$
			\item $\log_{10}{0.024} = -1.6197$
		\end{enumerate}
	\end{solution}

	\vfill
	\pagebreak

	%\problem{}
	%Find the following.
	%\begin{enumerate}[itemsep=2mm]
	%	\item $\frac{118 \times 0.51}{6.6}$
	%	\item $\sqrt{33.8} \times \sqrt[3]{226}$
	%	\item $\frac{\sqrt{152}}{\sqrt[3]{4.95}}$
	%	\item $\frac{\sqrt{96 \times 250}}{\sqrt{7 \times 0.88}}$
	%	\item The area of a circle with radius $1.47$
	%	\item The circumference of a circle with radius $31.4$
	%	\item The radius of a circle with area $6\pi$
	%	\item $\log_{10}{17.38}$
	%\end{enumerate}
	%\vfill
	%\pagebreak

	\section{Logarithms in Any Base}

	Our slide rule easily computes logarithms in base 10, but we can also use it to find logarithms in \textit{any} base.

	\proposition{}<logcob>
	This is usually called the \textit{change-of-base} formula:

	\[
		\log_{b}{a} = \frac{\log_c{a}}{\log_c{b}}
	\]

	\problem{}
	Using log identities, prove \ref{logcob}.

	\vfill

	\problem{}
	Approximate the following:
	\begin{enumerate}
		\item $\log_{2}{56}$
		\item $\log_{5.2}{26}$
		\item $\log_{12}{500}$
		\item $\log_{43}{134}$
	\end{enumerate}

	\begin{solution}
		\begin{enumerate}
			\item $\log_{2}{56} = 5.81$
			\item $\log_{5.2}{26} = 1.97$
			\item $\log_{12}{500} = 2.50$
			\item $\log_{43}{134} = 1.30$
		\end{enumerate}
	\end{solution}




	% Make sure the slide rule is on an odd page,
	% so that double-sided printing won't require
	% students to tear off problems.
	\checkoddpage
	\ifoddpage
		\vfill
		\pagebreak
		\vspace*{\fill}
		\begin{center}
		{
			\Large
			\textbf{This page unintentionally left blank.}
		}
		\end{center}
		\vspace{\fill}
		\pagebreak
	\else
		\vfill
		\pagebreak
	\fi

	% Slide rule files

	\includepdf[
		pages=1,
		fitpaper=true
	]{resources/rule.pdf}

\end{document}