mirror of
https://github.com/NotXia/unibo-ai-notes.git
synced 2025-12-15 19:12:22 +01:00
Add margin notes
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
\documentclass[11pt]{article}
|
\documentclass[11pt]{article}
|
||||||
\usepackage[margin=3cm]{geometry}
|
\usepackage[margin=3cm, lmargin=2cm, rmargin=4cm]{geometry}
|
||||||
\usepackage{graphicx}
|
\usepackage{graphicx, xcolor}
|
||||||
\usepackage{amsmath, amsfonts, amssymb, amsthm, mathtools}
|
\usepackage{amsmath, amsfonts, amssymb, amsthm, mathtools}
|
||||||
\usepackage{hyperref}
|
\usepackage{hyperref}
|
||||||
\usepackage[nameinlink]{cleveref}
|
\usepackage[nameinlink]{cleveref}
|
||||||
@ -21,8 +21,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
\setlist[description]{labelindent=\parindent} % Indents `description`
|
\setlist[description]{labelindent=\parindent} % Indents `description`
|
||||||
|
\renewcommand*{\marginfont}{\color{gray}\footnotesize}
|
||||||
|
|
||||||
\newtheorem{example}{Example}[section]
|
\newtheorem{example}{Example}[section]
|
||||||
|
\newtheoremstyle{definition}{}{}{}{}{\bfseries}{.}{ }{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}
|
||||||
|
\theoremstyle{definition}
|
||||||
|
\newtheorem*{definition}{Def}
|
||||||
|
|
||||||
|
\newcommand{\ubar}[1]{\text{\b{$#1$}}}
|
||||||
|
\renewcommand{\vec}[1]{\text{\textbf{#1}}}
|
||||||
|
\newcommand{\nullvec}[0]{\bar{\vec{0}}}
|
||||||
|
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
@ -47,5 +55,10 @@
|
|||||||
\pagenumbering{arabic}
|
\pagenumbering{arabic}
|
||||||
|
|
||||||
\input{sections/_finite_numbers.tex}
|
\input{sections/_finite_numbers.tex}
|
||||||
|
\newpage
|
||||||
|
\input{sections/_linear_algebra.tex}
|
||||||
|
\newpage
|
||||||
|
\input{sections/_linear_systems.tex}
|
||||||
|
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
@ -5,16 +5,16 @@
|
|||||||
\subsection{Sources of error}
|
\subsection{Sources of error}
|
||||||
|
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[Measure error]
|
\item[Measure error] \marginnote{Measure error}
|
||||||
Precision of the measurement instrument.
|
Precision of the measurement instrument.
|
||||||
|
|
||||||
\item[Arithmetic error]
|
\item[Arithmetic error] \marginnote{Arithmetic error}
|
||||||
Propagation of rounding errors in each step of an algorithm.
|
Propagation of rounding errors in each step of an algorithm.
|
||||||
|
|
||||||
\item[Truncation error]
|
\item[Truncation error] \marginnote{Truncation error}
|
||||||
Approximating an infinite procedure into a finite number of iterations.
|
Approximating an infinite procedure into a finite number of iterations.
|
||||||
|
|
||||||
\item[Inherent error]
|
\item[Inherent error] \marginnote{Inherent error}
|
||||||
Caused by the finite representation of the data (floating-point).
|
Caused by the finite representation of the data (floating-point).
|
||||||
\begin{figure}[h]
|
\begin{figure}[h]
|
||||||
\centering
|
\centering
|
||||||
@ -32,11 +32,13 @@ Let $x$ be a value and $\hat{x}$ its approximation. Then:
|
|||||||
\item[Absolute error]
|
\item[Absolute error]
|
||||||
\begin{equation}
|
\begin{equation}
|
||||||
E_{a} = \hat{x} - x
|
E_{a} = \hat{x} - x
|
||||||
|
\marginnote{Absolute error}
|
||||||
\end{equation}
|
\end{equation}
|
||||||
Note that, out of context, the absolute error is meaningless.
|
Note that, out of context, the absolute error is meaningless.
|
||||||
\item[Relative error]
|
\item[Relative error]
|
||||||
\begin{equation}
|
\begin{equation}
|
||||||
E_{a} = \frac{\hat{x} - x}{x}
|
E_{a} = \frac{\hat{x} - x}{x}
|
||||||
|
\marginnote{Relative error}
|
||||||
\end{equation}
|
\end{equation}
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
@ -56,17 +58,16 @@ where:
|
|||||||
\item starting from an index $i$, not all $d_j$ ($j \geq i$) are equal to $\beta-1$
|
\item starting from an index $i$, not all $d_j$ ($j \geq i$) are equal to $\beta-1$
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
%
|
%
|
||||||
\Cref{eq:finnum_b_representation} can be represented using the normalized scientific notation as:
|
\Cref{eq:finnum_b_representation} can be represented using the normalized scientific notation as: \marginnote{Normalized scientific notation}
|
||||||
\begin{equation}
|
\begin{equation}
|
||||||
x = \pm (0.d_1d_2\dots) \beta^p
|
x = \pm (0.d_1d_2\dots) \beta^p
|
||||||
\end{equation}
|
\end{equation}
|
||||||
where $0.d_1d_2\dots$ is the \textbf{mantissa} and $\beta^p$ the \textbf{exponent}.
|
where $0.d_1d_2\dots$ is the \textbf{mantissa} and $\beta^p$ the \textbf{exponent}. \marginnote{Mantissa\\Exponent}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\subsection{Floating-point}
|
\subsection{Floating-point}
|
||||||
|
A floating-point system $\mathcal{F}(\beta, t, L, U)$ is defined by the parameters: \marginnote{Floating-point}
|
||||||
A floating-point system $\mathcal{F}(\beta, t, L, U)$ is defined by the parameters:
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item $\beta$: base
|
\item $\beta$: base
|
||||||
\item $t$: precision (number of digits in the mantissa)
|
\item $t$: precision (number of digits in the mantissa)
|
||||||
@ -109,6 +110,7 @@ Given a floating-point system $\mathcal{F}(\beta, t, L, U)$, the representation
|
|||||||
\item[Approximation]
|
\item[Approximation]
|
||||||
if $p \in [L, U]$ but $d_i$ may not be 0 for $i>t$.
|
if $p \in [L, U]$ but $d_i$ may not be 0 for $i>t$.
|
||||||
In this case, the representation is obtained by truncating or rounding the value.
|
In this case, the representation is obtained by truncating or rounding the value.
|
||||||
|
\marginnote{Truncation\\Rounding}
|
||||||
|
|
||||||
\item[Underflow]
|
\item[Underflow]
|
||||||
if $p < L$. In this case, the values is approximated as 0.
|
if $p < L$. In this case, the values is approximated as 0.
|
||||||
@ -119,7 +121,7 @@ Given a floating-point system $\mathcal{F}(\beta, t, L, U)$, the representation
|
|||||||
|
|
||||||
|
|
||||||
\subsubsection{Machine precision}
|
\subsubsection{Machine precision}
|
||||||
Machine precision $\varepsilon_{\text{mach}}$ determines the accuracy of a floating-point system.
|
Machine precision $\varepsilon_{\text{mach}}$ determines the accuracy of a floating-point system. \marginnote{Machine precision}
|
||||||
Depending on the approximation approach, machine precision can be computes as:
|
Depending on the approximation approach, machine precision can be computes as:
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[Truncation] $\varepsilon_{\text{mach}} = \beta^{1-t}$
|
\item[Truncation] $\varepsilon_{\text{mach}} = \beta^{1-t}$
|
||||||
@ -144,7 +146,7 @@ In alternative, $\varepsilon_{\text{mach}}$ can be defined as the smallest repre
|
|||||||
\subsubsection{IEEE standard}
|
\subsubsection{IEEE standard}
|
||||||
IEEE 754 defines two floating-point formats:
|
IEEE 754 defines two floating-point formats:
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[Single precision] Stored in 32 bits. Represents the system $\mathcal{F}(2, 24, -128, 127)$.
|
\item[Single precision] Stored in 32 bits. Represents the system $\mathcal{F}(2, 24, -128, 127)$. \marginnote{float32}
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\small
|
\small
|
||||||
\begin{tabular}{|c|c|c|}
|
\begin{tabular}{|c|c|c|}
|
||||||
@ -154,7 +156,7 @@ IEEE 754 defines two floating-point formats:
|
|||||||
\end{tabular}
|
\end{tabular}
|
||||||
\end{center}
|
\end{center}
|
||||||
|
|
||||||
\item[Double precision] Stored in 64 bits. Represents the system $\mathcal{F}(2, 53, -1024, 1023)$.
|
\item[Double precision] Stored in 64 bits. Represents the system $\mathcal{F}(2, 53, -1024, 1023)$. \marginnote{float64}
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\small
|
\small
|
||||||
\begin{tabular}{|c|c|c|}
|
\begin{tabular}{|c|c|c|}
|
||||||
@ -187,6 +189,7 @@ A floating-point operation causes a small rounding error:
|
|||||||
\end{equation}
|
\end{equation}
|
||||||
%
|
%
|
||||||
Although, some operations may be subject to the \textbf{cancellation} problem which causes information loss.
|
Although, some operations may be subject to the \textbf{cancellation} problem which causes information loss.
|
||||||
|
\marginnote{Cancellation}
|
||||||
\begin{example}
|
\begin{example}
|
||||||
Given $x = 1$ and $y = 1 \cdot 10^{-16}$, we want to compute $x + y$ in $\mathcal{F}(10, 16, U, L)$.\\
|
Given $x = 1$ and $y = 1 \cdot 10^{-16}$, we want to compute $x + y$ in $\mathcal{F}(10, 16, U, L)$.\\
|
||||||
\begin{equation*}
|
\begin{equation*}
|
||||||
|
|||||||
Reference in New Issue
Block a user