Removed linear handout
This commit is contained in:
parent
23f9d100ef
commit
f5fe2c3f96
@ -1,71 +0,0 @@
|
||||
% use [nosolutions] flag to hide solutions.
|
||||
% use [solutions] flag to show solutions.
|
||||
\documentclass[
|
||||
solutions,
|
||||
hidewarning,
|
||||
%singlenumbering
|
||||
]{../../resources/ormc_handout}
|
||||
\usepackage{../../resources/macros}
|
||||
|
||||
|
||||
%\usepackage{lua-visual-debug}
|
||||
|
||||
\usepackage{tikz-3dplot}
|
||||
\usetikzlibrary{
|
||||
quotes,
|
||||
angles,
|
||||
matrix,
|
||||
decorations.pathreplacing,
|
||||
calc,
|
||||
positioning,
|
||||
fit
|
||||
}
|
||||
\input{tikzset}
|
||||
|
||||
|
||||
\uptitlel{Advanced 2}
|
||||
\uptitler{Spring 2023}
|
||||
\title{Linear Algebra 101}
|
||||
\subtitle{Prepared by \githref{Mark} on \today}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
||||
\input{parts/0 notation}
|
||||
\input{parts/1 vectors}
|
||||
\input{parts/2 dotprod}
|
||||
\input{parts/3 matrices}
|
||||
|
||||
|
||||
|
||||
\section{Bonus}
|
||||
|
||||
\problem{}
|
||||
Show that the euclidean norm satisfies the triangle inequalty:
|
||||
$$
|
||||
||x+y|| \leq ||x|| + ||y||
|
||||
$$
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
Show that the eucidean norm satisfies the reverse triangle inequality:
|
||||
|
||||
$$
|
||||
||x-y|| \geq |~||x|| - ||y||~|
|
||||
$$
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
Prove the Cauchy-Schwartz inequality:
|
||||
|
||||
$$
|
||||
||x \cdot y|| \leq ||x||~||y||
|
||||
$$
|
||||
|
||||
\vfill
|
||||
|
||||
|
||||
\end{document}
|
@ -1,87 +0,0 @@
|
||||
\section{Notation and Terminology}
|
||||
|
||||
\definition{}
|
||||
\begin{itemize}
|
||||
\item $\mathbb{R}$ is the set of all real numbers.
|
||||
\item $\mathbb{R}^+$ is the set of positive real numbers. Zero is not positive.
|
||||
\item $\mathbb{R}^+_0$ is the set of positive real numbers and zero.
|
||||
\end{itemize}
|
||||
|
||||
Mathematicians are often inconsistent with their notation. Depending on the author, their mood, and the phase of the moon, $\mathbb{R}^+$ may or may not include zero. We will use the definitions above.
|
||||
|
||||
|
||||
\definition{}
|
||||
Consider two sets $A$ and $B$. The set $A \times B$ consists of all tuples $(a, b)$ where $a \in A$ and $b \in B$. \\
|
||||
For example, $\{1, 2, 3\} \times \{\heartsuit, \star\} = \{(1,\heartsuit), (1, \star), (2,\heartsuit), (2, \star), (3,\heartsuit), (3, \star)\}$ \\
|
||||
This is called the \textit{cartesian product}.
|
||||
|
||||
\vspace{4mm}
|
||||
|
||||
You can think of this as placing the two sets \say{perpendicular} to one another:
|
||||
|
||||
\begin{center}
|
||||
\begin{tikzpicture}[
|
||||
scale=1,
|
||||
bullet/.style={circle,inner sep=1.5pt,fill}
|
||||
]
|
||||
\draw[->] (-0.2,0) -- (4,0) node[right]{$A$};
|
||||
\draw[->] (0,-0.2) -- (0,3) node[above]{$B$};
|
||||
|
||||
\draw (1,0.1) -- ++ (0,-0.2) node[below]{$1$};
|
||||
\draw (2,0.1) -- ++ (0,-0.2) node[below]{$2$};
|
||||
\draw (3,0.1) -- ++ (0,-0.2) node[below]{$3$};
|
||||
|
||||
\draw (0.1, 1) -- ++ (-0.2, 0) node[left]{$\heartsuit$};
|
||||
\draw (0.1, 2) -- ++ (-0.2, 0) node[left]{$\star$};
|
||||
|
||||
\node[bullet] at (1, 1){};
|
||||
\node[bullet] at (2, 1) {};
|
||||
\node[bullet] at (3, 1) {};
|
||||
\node[bullet] at (1, 2) {};
|
||||
\node[bullet] at (2, 2) {};
|
||||
\node[bullet] at (3, 2) {};
|
||||
|
||||
|
||||
\draw[rounded corners] (0.5, 0.5) rectangle (3.5, 2.5) {};
|
||||
\node[above] at (2, 2.5) {$A \times B$};
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
\problem{}
|
||||
Let $A = \{0, 1\} \times \{0, 1\}$ \\
|
||||
Let $B = \{ a, b\}$ \\
|
||||
What is $A \times B$?
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
What is $\mathbb{R} \times \mathbb{R}$? \\
|
||||
\hint{Use the \say{perpendicular} analogy}
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
\definition{}
|
||||
$\mathbb{R}^n$ is the set of $n$-tuples of real numbers. \\
|
||||
In English, this means that an element of $\mathbb{R}^n$ is a list of $n$ real numbers: \\
|
||||
|
||||
\vspace{4mm}
|
||||
|
||||
Elements of $\mathbb{R}^2$ look like $(a, b)$, where $a, b \in \mathbb{R}$. \hfill \note{\textit{Note:} $\mathbb{R}^2$ is pronounced \say{arrgh-two.}}
|
||||
Elements of $\mathbb{R}^5$ look like $(a_1, a_2, a_3, a_4, a_5)$, where $a_n \in \mathbb{R}$. \\
|
||||
|
||||
$\mathbb{R}^1$ and $\mathbb{R}$ are identical.
|
||||
|
||||
\vspace{4mm}
|
||||
|
||||
Intuitively, $\mathbb{R}^2$ forms a two-dimensional plane, and $\mathbb{R}^3$ forms a three-dimensional space. \\
|
||||
$\mathbb{R}^n$ is hard to visualize when $n \geq 4$, but you are welcome to try.
|
||||
|
||||
\problem{}
|
||||
Convince yourself that $\mathbb{R} \times \mathbb{R}$ is $\mathbb{R}^2$. \\
|
||||
What is $\mathbb{R}^2 \times \mathbb{R}$?
|
||||
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
@ -1,88 +0,0 @@
|
||||
\section{Vectors}
|
||||
|
||||
\definition{}
|
||||
Elements of $\mathbb{R}^n$ are often called \textit{vectors}. \\
|
||||
As you may already know, we have a few operations on vectors:
|
||||
\begin{itemize}
|
||||
\item Vector addition: $[a_1, a_2] + [b_1, b_2] = [a_1+b_1, a_2+b_2]$
|
||||
\item Scalar multiplication: $x \times [a_1, a_2] = [xa_1, xa_2]$.
|
||||
\end{itemize}
|
||||
\note{
|
||||
The above examples are for $\mathbb{R}^2$, and each vector thus has two components. \\
|
||||
These operations are similar for all other $n$.
|
||||
}
|
||||
|
||||
\problem{}
|
||||
Compute the following or explain why you can't:
|
||||
\begin{itemize}
|
||||
\item $[1, 2, 3] - [1, 3, 4]$ \note{Subtraction works just like addition.}
|
||||
\item $4 \times [5, 2, 4]$
|
||||
\item $a + b$, where $a \in \mathbb{R}
|
||||
^5$ and $b \in \mathbb{R}^7$
|
||||
\end{itemize}
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
Consider $(2, -1)$ and $(3, 1)$ in $\mathbb{R}^2$. \\
|
||||
Can you develop geometric intuition for their sum and difference?
|
||||
|
||||
\begin{center}
|
||||
\begin{tikzpicture}[scale=1]
|
||||
|
||||
\draw[->]
|
||||
(0,0) coordinate (o) -- node[below left] {$(2, -1)$}
|
||||
(2, -1) coordinate (a)
|
||||
;
|
||||
|
||||
\draw[->]
|
||||
(a) -- node[below right] {$(3, 1)$}
|
||||
(5, 0) coordinate (b)
|
||||
;
|
||||
|
||||
\draw[
|
||||
draw = gray,
|
||||
text = gray,
|
||||
->
|
||||
]
|
||||
(o) -- node[above] {$??$}
|
||||
(b) coordinate (s)
|
||||
;
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
\definition{Euclidean Norm}
|
||||
A \textit{norm} on $\mathbb{R}^n$ is a map from $\mathbb{R}^n$ to $\mathbb{R}^+_0$ \\
|
||||
Usually, one thinks of a norm as a way of measuring \say{length} in a vector space. \\
|
||||
The norm of a vector $v$ is written $||v||$. \\
|
||||
|
||||
\vspace{2mm}
|
||||
|
||||
We usually use the \textit{Euclidean norm} when we work in $\mathbb{R}^n$. \\
|
||||
If $v \in \mathbb{R}^n$, the Euclidean norm is defined as follows: \\
|
||||
If $v = [v_1, v_2, ..., v_n]$,
|
||||
$$
|
||||
||v|| = \sqrt{v_1^2 + v_2^2 + ... + v_n^2}
|
||||
$$
|
||||
This is simply an application of the Pythagorean theorem.
|
||||
|
||||
\problem{}
|
||||
Compute the euclidean norm of
|
||||
\begin{itemize}
|
||||
\item $[2, 3]$
|
||||
\item $[-2, 1, -4, 2]$
|
||||
\end{itemize}
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
Show that $a \cdot a$ is $||a||^2$.
|
||||
|
||||
\vfill
|
||||
|
||||
\pagebreak
|
@ -1,93 +0,0 @@
|
||||
\section{Dot Products}
|
||||
|
||||
\definition{}
|
||||
We can also define the \textit{dot product} of two vectors.\footnotemark{} \\
|
||||
The dot product maps two elements of $\mathbb{R}^n$ to one element of $\mathbb{R}$:
|
||||
|
||||
\footnotetext{
|
||||
\textbf{Bonus content. Feel free to skip.}
|
||||
|
||||
Formally, we would say that the dot product is a map from $\mathbb{R}^n \times \mathbb{R}^n$ to $\mathbb{R}$. Why is this reasonable?
|
||||
|
||||
\vspace{2mm}
|
||||
|
||||
It's also worth noting that a function $f$ from $X$ to $Y$ can be defined as a subset of $X \times Y$, where for all $x \in X$ there exists a unique $y \in Y$ so that $(x, y) \in f$. Try to make sense of this definition.
|
||||
}
|
||||
|
||||
$$
|
||||
a \cdot b = \sum_{i = 1}^n a_ib_i = a_1b_1 + a_2b_2 + ... + a_nb_n
|
||||
$$
|
||||
|
||||
\problem{}
|
||||
Compute $[2, 3, 4, 1] \cdot [2, 4, 10, 12]$
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
Show that the dot product is
|
||||
\begin{itemize}
|
||||
\item Commutative
|
||||
\item Distributive $a \cdot (b + c) = a \cdot b + a \cdot c$
|
||||
\item Homogeneous: $x(a \cdot b) = xa \cdot b = a \cdot xb$ \\
|
||||
\note{$x \in \mathbb{R}$, and $a, b$ are vectors.}
|
||||
\item Positive definite: $a \cdot a \geq 0$, with equality iff $a = 0$ \\
|
||||
\note{$a \in \mathbb{R}^n$, and $0$ is the zero vector.}
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
|
||||
|
||||
|
||||
\problem{}
|
||||
Say you have two vectors, $a$ and $b$. Show that $a \cdot b$ = $||a||~||b||\cos(\alpha)$, \\
|
||||
where $\alpha$ is the angle between $a$ and $b$. \\
|
||||
\hint{What is $c$ in terms of $a$ and $b$?}
|
||||
\hint{The law of cosines is $a^2 + b^2 - 2ab\cos(\alpha) = c^2$}
|
||||
\hint{The length of $a$ is $||a||$}
|
||||
|
||||
|
||||
\begin{center}
|
||||
\begin{tikzpicture}[scale=1]
|
||||
|
||||
\draw[->]
|
||||
(0,0) coordinate (o) -- node[above left] {$a$}
|
||||
(1,2) coordinate (a)
|
||||
;
|
||||
|
||||
\draw[->]
|
||||
(o) -- node[below] {$b$}
|
||||
(3,0.5) coordinate (b)
|
||||
;
|
||||
|
||||
\draw[
|
||||
draw = gray,
|
||||
text = gray,
|
||||
-
|
||||
] (a) -- node[above] {$c$} (b);
|
||||
|
||||
\draw
|
||||
pic[
|
||||
"$\alpha$",
|
||||
draw = orange,
|
||||
text = orange,
|
||||
<->,
|
||||
angle eccentricity = 1.2,
|
||||
angle radius = 1cm
|
||||
]
|
||||
{ angle = b--o--a }
|
||||
;
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
If $a$ and $b$ are perpendicular, what must $a \cdot b$ be? Is the converse true?
|
||||
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
@ -1,284 +0,0 @@
|
||||
\section{Matrices}
|
||||
|
||||
\definition{}
|
||||
A \textit{matrix} is a two-dimensional array of numbers: \\
|
||||
$$
|
||||
A =
|
||||
\begin{bmatrix}
|
||||
1 & 2 & 3 \\
|
||||
4 & 5 & 6
|
||||
\end{bmatrix}
|
||||
$$
|
||||
The above matrix has two rows and three columns. It is thus a $2 \times 3$ matrix. \\
|
||||
\vspace{1mm}
|
||||
The order \say{first rows, then columns} is usually consistent in linear algebra. \\
|
||||
If you look closely, you may also find it in the next definition.
|
||||
|
||||
\definition{}<matvec>
|
||||
We can define the product of a matrix $A$ and a vector $v$:
|
||||
|
||||
$$
|
||||
Av =
|
||||
\begin{bmatrix}
|
||||
1 & 2 & 3 \\
|
||||
4 & 5 & 6
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
a \\ b \\ c
|
||||
\end{bmatrix}
|
||||
=
|
||||
\begin{bmatrix}
|
||||
1a + 2b + 3c \\
|
||||
4a + 5b + 6c
|
||||
\end{bmatrix}
|
||||
$$
|
||||
Note that each element of the resulting $2 \times 1$ matrix is the dot product of a row of $A$ with $v$:
|
||||
|
||||
$$
|
||||
Av =
|
||||
\begin{bmatrix}
|
||||
\text{---} r_1 \text{---} \\
|
||||
\text{---} r_2 \text{---}
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
| \\
|
||||
v \\
|
||||
| \\
|
||||
\end{bmatrix}
|
||||
=
|
||||
\begin{bmatrix}
|
||||
r_1 \cdot v \\
|
||||
r_2 \cdot v
|
||||
\end{bmatrix}
|
||||
$$
|
||||
|
||||
Naturally, a vector can only be multiplied by a matrix if the number of rows in the vector equals the number of columns in the matrix.
|
||||
|
||||
\problem{}
|
||||
Compute the following:
|
||||
|
||||
$$
|
||||
\begin{bmatrix}
|
||||
1 & 2 \\
|
||||
3 & 4 \\
|
||||
5 & 6
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
5 \\ 3
|
||||
\end{bmatrix}
|
||||
$$
|
||||
|
||||
\vfill
|
||||
|
||||
|
||||
\problem{}
|
||||
Say you multiply a size-$m$ vector $v$ by an $m \times n$ matrix $A$. \\
|
||||
What is the size of your result $Av$?
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
\definition{}
|
||||
We can also multiply a matrix by a matrix:
|
||||
|
||||
$$
|
||||
AB =
|
||||
\begin{bmatrix}
|
||||
1 & 2 \\
|
||||
3 & 4
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
10 & 20 \\
|
||||
100 & 200
|
||||
\end{bmatrix}
|
||||
=
|
||||
\begin{bmatrix}
|
||||
210 & 420 \\
|
||||
430 & 860
|
||||
\end{bmatrix}
|
||||
$$
|
||||
Note each element of the resulting matrix is dot product of a row of $A$ and a column of $B$:
|
||||
|
||||
$$
|
||||
AB =
|
||||
\begin{bmatrix}
|
||||
\text{---} r_1 \text{---} \\
|
||||
\text{---} r_2 \text{---}
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
| & | \\
|
||||
v_1 & v_2 \\
|
||||
| & | \\
|
||||
\end{bmatrix}
|
||||
=
|
||||
\begin{bmatrix}
|
||||
r_1 \cdot v_1 & r_1 \cdot v_2 \\
|
||||
r_2 \cdot v_1 & r_2 \cdot v_2 \\
|
||||
\end{bmatrix}
|
||||
$$
|
||||
|
||||
\begin{center}
|
||||
\begin{tikzpicture}
|
||||
|
||||
\begin{scope}[layer = nodes]
|
||||
\matrix[
|
||||
matrix of math nodes,
|
||||
left delimiter={[},
|
||||
right delimiter={]}
|
||||
] (A) at (0, 0){
|
||||
1 & 2 \\
|
||||
3 & 4 \\
|
||||
};
|
||||
|
||||
\matrix[
|
||||
matrix of math nodes,
|
||||
left delimiter={[},
|
||||
right delimiter={]}
|
||||
] (B) at (2, 0) {
|
||||
10 & 20 \\
|
||||
100 & 200 \\
|
||||
};
|
||||
|
||||
\node at (3.25, 0) {$=$};
|
||||
|
||||
\matrix[
|
||||
matrix of math nodes,
|
||||
left delimiter={[},
|
||||
right delimiter={]}
|
||||
] (C) at (4.5, 0) {
|
||||
210 & 420 \\
|
||||
430 & 860 \\
|
||||
};
|
||||
\end{scope}
|
||||
|
||||
\draw[rounded corners,fill=black!30!white,draw=none] ([xshift=-2mm,yshift=2mm]A-1-1) rectangle ([xshift=2mm,yshift=-2mm]A-1-2) {};
|
||||
|
||||
\draw[rounded corners,fill=black!30!white,draw=none] ([xshift=-3mm,yshift=2mm]B-1-1) rectangle ([xshift=3mm,yshift=-2mm]B-2-1) {};
|
||||
|
||||
\draw[rounded corners,fill=black!30!white,draw=none] ([xshift=-4mm,yshift=2mm]C-1-1) rectangle ([xshift=4mm,yshift=-2mm]C-1-1) {};
|
||||
|
||||
|
||||
\draw[rounded corners] ([xshift=-2mm,yshift=2mm]A-2-1) rectangle ([xshift=2mm,yshift=-2mm]A-2-2) {};
|
||||
|
||||
\draw[rounded corners] ([xshift=-3mm,yshift=2mm]B-1-2) rectangle ([xshift=3mm,yshift=-2mm]B-2-2) {};
|
||||
|
||||
\draw[rounded corners] ([xshift=-4mm,yshift=2mm]C-2-2) rectangle ([xshift=4mm,yshift=-2mm]C-2-2) {};
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
|
||||
\problem{}
|
||||
Compute the following matrix product. \\
|
||||
|
||||
$$
|
||||
\begin{bmatrix}
|
||||
1 & 2 \\
|
||||
3 & 4 \\
|
||||
5 & 6
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
9 & 8 & 7 \\
|
||||
6 & 5 & 4
|
||||
\end{bmatrix}
|
||||
$$
|
||||
|
||||
\vfill
|
||||
|
||||
|
||||
\problem{}
|
||||
Compute the following matrix product or explain why you can't.
|
||||
|
||||
$$
|
||||
\begin{bmatrix}
|
||||
1 & 2 & 3 \\
|
||||
4 & 5 & 6
|
||||
\end{bmatrix}
|
||||
\begin{bmatrix}
|
||||
10 & 20 \\
|
||||
30 & 40
|
||||
\end{bmatrix}
|
||||
$$
|
||||
|
||||
\vfill
|
||||
|
||||
|
||||
\problem{}
|
||||
If $A$ is an $m \times n$ matrix and $B$ is a $p \times q$ matrix, when does the product $AB$ exist?
|
||||
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
\problem{}
|
||||
Is matrix multiplication commutative? \\
|
||||
\note{Does $AB = BA$ for all $A, B$? \\ You only need one counterexample to show this is false.}
|
||||
|
||||
\vfill
|
||||
|
||||
|
||||
\definition{}
|
||||
Say we have a matrix $A$. The matrix $A^T$, pronounced \say{A-transpose}, is created by turning rows of $A$ into columns, and columns into rows:
|
||||
|
||||
$$
|
||||
\begin{bmatrix}
|
||||
1 & 2 & 3 \\
|
||||
4 & 5 & 6
|
||||
\end{bmatrix} ^ T
|
||||
=
|
||||
\begin{bmatrix}
|
||||
1 & 4 \\
|
||||
2 & 5 \\
|
||||
3 & 6
|
||||
\end{bmatrix}
|
||||
$$
|
||||
|
||||
\problem{}
|
||||
Compute the following:
|
||||
|
||||
\hfill
|
||||
$
|
||||
\begin{bmatrix}
|
||||
a & b \\
|
||||
c & d
|
||||
\end{bmatrix} ^ T
|
||||
$\hfill
|
||||
$
|
||||
\begin{bmatrix}
|
||||
1 \\
|
||||
3 \\
|
||||
3 \\
|
||||
7 \\
|
||||
\end{bmatrix} ^ T
|
||||
$\hfill
|
||||
$
|
||||
\begin{bmatrix}
|
||||
1 & 2 & 4 & 8 \\
|
||||
\end{bmatrix} ^ T
|
||||
$
|
||||
\hfill~
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
||||
|
||||
The \say{transpose} operator is often used to write column vectors in a compact way. \\
|
||||
Vertical arrays don't look good in horizontal text.
|
||||
|
||||
\problem{}
|
||||
Consider the vectors $a = [1, 4, 3]^T$ and $b = [9, 1, 4]^T$ \\
|
||||
\begin{itemize}
|
||||
\item Compute the dot product $a \cdot b$.
|
||||
\item Can you redefine the dot product using matrix multiplication?
|
||||
\end{itemize}
|
||||
\note{As you may have noticed, a vector is a special case of a matrix.}
|
||||
|
||||
\vfill
|
||||
|
||||
\problem{}
|
||||
A \textit{column vector} is an $m \times 1$ matrix. \\
|
||||
A \textit{row vector} is a $1 \times m$ matrix. \\
|
||||
We usually use column vectors. Why? \\
|
||||
\hint{How does vector-matrix multiplication work?}
|
||||
|
||||
|
||||
\vfill
|
||||
\pagebreak
|
@ -1,36 +0,0 @@
|
||||
\usetikzlibrary{arrows.meta}
|
||||
\usetikzlibrary{shapes.geometric}
|
||||
\usetikzlibrary{patterns}
|
||||
|
||||
% We put nodes in a separate layer, so we can
|
||||
% slightly overlap with paths for a perfect fit
|
||||
\pgfdeclarelayer{nodes}
|
||||
\pgfdeclarelayer{path}
|
||||
\pgfsetlayers{main,nodes}
|
||||
|
||||
% Layer settings
|
||||
\tikzset{
|
||||
% Layer hack, lets us write
|
||||
% later = * in scopes.
|
||||
layer/.style = {
|
||||
execute at begin scope={\pgfonlayer{#1}},
|
||||
execute at end scope={\endpgfonlayer}
|
||||
},
|
||||
%
|
||||
% Nodes
|
||||
main/.style = {
|
||||
draw,
|
||||
circle,
|
||||
fill = white
|
||||
},
|
||||
%
|
||||
% Paths
|
||||
path/.style = {
|
||||
line width = 4mm,
|
||||
draw = black,
|
||||
% Lengthen paths so they're
|
||||
% completely under nodes.
|
||||
line cap = rect,
|
||||
opacity = 0.3
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user