Update cetz & ci
This commit is contained in:
@ -26,7 +26,7 @@ jobs:
|
||||
|
||||
- name: "Download Typstyle"
|
||||
run: |
|
||||
wget -q "https://github.com/Enter-tainer/typstyle/releases/download/v0.12.14/typstyle-x86_64-unknown-linux-musl"
|
||||
wget -q "https://github.com/Enter-tainer/typstyle/releases/download/v0.13.17/typstyle-x86_64-unknown-linux-musl"
|
||||
chmod +x typstyle-x86_64-unknown-linux-musl
|
||||
|
||||
- name: Check typst formatting
|
||||
@ -62,7 +62,7 @@ jobs:
|
||||
# more control anyway.
|
||||
- name: "Download Typst"
|
||||
run: |
|
||||
wget -q "https://github.com/typst/typst/releases/download/v0.12.0/typst-x86_64-unknown-linux-musl.tar.xz"
|
||||
wget -q "https://github.com/typst/typst/releases/download/v0.13.1/typst-x86_64-unknown-linux-musl.tar.xz"
|
||||
tar -xf "typst-x86_64-unknown-linux-musl.tar.xz"
|
||||
mv "typst-x86_64-unknown-linux-musl/typst" .
|
||||
rm "typst-x86_64-unknown-linux-musl.tar.xz"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
= Floats
|
||||
#definition()
|
||||
@ -33,72 +33,66 @@ Another way we can interpret a bit string is as a _signed floating-point decimal
|
||||
Floats represent a subset of the real numbers, and are interpreted as follows: \
|
||||
#note([The following only applies to floats that consist of 32 bits. We won't encounter any others today.])
|
||||
|
||||
#align(
|
||||
center,
|
||||
box(
|
||||
inset: 2mm,
|
||||
cetz.canvas({
|
||||
import cetz.draw: *
|
||||
#align(center, box(inset: 2mm, cetz.canvas({
|
||||
import cetz.draw: *
|
||||
|
||||
let chars = (
|
||||
`0`,
|
||||
`b`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
)
|
||||
let chars = (
|
||||
`0`,
|
||||
`b`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`_`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
`0`,
|
||||
)
|
||||
|
||||
let x = 0
|
||||
for c in chars {
|
||||
content((x, 0), c)
|
||||
x += 0.25
|
||||
}
|
||||
let x = 0
|
||||
for c in chars {
|
||||
content((x, 0), c)
|
||||
x += 0.25
|
||||
}
|
||||
|
||||
let y = -0.4
|
||||
line((0.3, y), (0.65, y))
|
||||
content((0.45, y - 0.2), [s])
|
||||
let y = -0.4
|
||||
line((0.3, y), (0.65, y))
|
||||
content((0.45, y - 0.2), [s])
|
||||
|
||||
line((0.85, y), (2.9, y))
|
||||
content((1.9, y - 0.2), [exponent])
|
||||
line((0.85, y), (2.9, y))
|
||||
content((1.9, y - 0.2), [exponent])
|
||||
|
||||
line((3.10, y), (9.4, y))
|
||||
content((6.3, y - 0.2), [fraction])
|
||||
}),
|
||||
),
|
||||
)
|
||||
line((3.10, y), (9.4, y))
|
||||
content((6.3, y - 0.2), [fraction])
|
||||
})))
|
||||
|
||||
- The first bit denotes the sign of the float's value
|
||||
We'll label it $s$. \
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz-plot:0.1.0": plot, chart
|
||||
#import "@preview/cetz:0.4.2"
|
||||
#import "@preview/cetz-plot:0.1.2": chart, plot
|
||||
|
||||
= Integers and Floats
|
||||
|
||||
@ -44,19 +44,11 @@ This allows us to improve the average error of our linear approximation:
|
||||
{
|
||||
let domain = (0, 1)
|
||||
|
||||
plot.add(
|
||||
f1,
|
||||
domain: domain,
|
||||
label: $log(1+x)$,
|
||||
style: (stroke: ogrape),
|
||||
)
|
||||
plot.add(f1, domain: domain, label: $log(1+x)$, style: (
|
||||
stroke: ogrape,
|
||||
))
|
||||
|
||||
plot.add(
|
||||
f2,
|
||||
domain: domain,
|
||||
label: $x$,
|
||||
style: (stroke: oblue),
|
||||
)
|
||||
plot.add(f2, domain: domain, label: $x$, style: (stroke: oblue))
|
||||
},
|
||||
)
|
||||
})
|
||||
@ -90,19 +82,11 @@ This allows us to improve the average error of our linear approximation:
|
||||
{
|
||||
let domain = (0, 1)
|
||||
|
||||
plot.add(
|
||||
f1,
|
||||
domain: domain,
|
||||
label: $log(1+x)$,
|
||||
style: (stroke: ogrape),
|
||||
)
|
||||
plot.add(f1, domain: domain, label: $log(1+x)$, style: (
|
||||
stroke: ogrape,
|
||||
))
|
||||
|
||||
plot.add(
|
||||
f2,
|
||||
domain: domain,
|
||||
label: $x$,
|
||||
style: (stroke: oblue),
|
||||
)
|
||||
plot.add(f2, domain: domain, label: $x$, style: (stroke: oblue))
|
||||
},
|
||||
)
|
||||
})
|
||||
@ -120,16 +104,13 @@ We won't bother with this---we'll simply leave the correction term as an opaque
|
||||
|
||||
#v(1fr)
|
||||
|
||||
#note(
|
||||
type: "Note",
|
||||
[
|
||||
"Average error" above is simply the area of the region between the two graphs:
|
||||
$
|
||||
integral_0^1 abs( #v(1mm) log(1+x)_2 - (x+epsilon) #v(1mm))
|
||||
$
|
||||
Feel free to ignore this note, it isn't a critical part of this handout.
|
||||
],
|
||||
)
|
||||
#note(type: "Note", [
|
||||
"Average error" above is simply the area of the region between the two graphs:
|
||||
$
|
||||
integral_0^1 abs(#v(1mm) log(1+x)_2 - (x+epsilon) #v(1mm))
|
||||
$
|
||||
Feel free to ignore this note, it isn't a critical part of this handout.
|
||||
])
|
||||
|
||||
|
||||
#pagebreak()
|
||||
@ -149,12 +130,11 @@ $
|
||||
Let $E$ and $F$ be the exponent and float bits of $x_f$. \
|
||||
We then have:
|
||||
$
|
||||
log_2(x_f)
|
||||
&= log_2 ( 2^(E-127) times (1 + (F) / (2^23)) ) \
|
||||
&= E - 127 + log_2(1 + F / (2^23)) \
|
||||
& approx E-127 + F / (2^23) + epsilon \
|
||||
&= 1 / (2^23)(2^23 E + F) - 127 + epsilon \
|
||||
&= 1 / (2^23)(x_i) - 127 + epsilon
|
||||
log_2(x_f) & = log_2 ( 2^(E-127) times (1 + (F) / (2^23)) ) \
|
||||
& = E - 127 + log_2(1 + F / (2^23)) \
|
||||
& approx E-127 + F / (2^23) + epsilon \
|
||||
& = 1 / (2^23)(2^23 E + F) - 127 + epsilon \
|
||||
& = 1 / (2^23)(x_i) - 127 + epsilon
|
||||
$
|
||||
])
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
|
||||
// Shorthand, we'll be using these a lot.
|
||||
@ -7,35 +7,31 @@
|
||||
#let tm = sym.times.circle
|
||||
|
||||
#let graphgrid(inner_content) = {
|
||||
align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
cetz.canvas({
|
||||
import cetz.draw: *
|
||||
let x = 5.25
|
||||
align(center, box(inset: 3mm, cetz.canvas({
|
||||
import cetz.draw: *
|
||||
let x = 5.25
|
||||
|
||||
grid(
|
||||
(0, 0), (x, x), step: 0.75,
|
||||
stroke: luma(100) + 0.3mm
|
||||
)
|
||||
grid(
|
||||
(0, 0),
|
||||
(x, x),
|
||||
step: 0.75,
|
||||
stroke: luma(100) + 0.3mm,
|
||||
)
|
||||
|
||||
if (inner_content != none) {
|
||||
inner_content
|
||||
}
|
||||
if (inner_content != none) {
|
||||
inner_content
|
||||
}
|
||||
|
||||
mark((0, x + 0.5), (0, x + 1), symbol: ">", fill: black, scale: 1)
|
||||
mark((x + 0.5, 0), (x + 1, 0), symbol: ">", fill: black, scale: 1)
|
||||
mark((0, x + 0.5), (0, x + 1), symbol: ">", fill: black, scale: 1)
|
||||
mark((x + 0.5, 0), (x + 1, 0), symbol: ">", fill: black, scale: 1)
|
||||
|
||||
line(
|
||||
(0, x + 0.25),
|
||||
(0, 0),
|
||||
(x + 0.25, 0),
|
||||
stroke: 0.75mm + black,
|
||||
)
|
||||
}),
|
||||
),
|
||||
)
|
||||
line(
|
||||
(0, x + 0.25),
|
||||
(0, 0),
|
||||
(x + 0.25, 0),
|
||||
stroke: 0.75mm + black,
|
||||
)
|
||||
})))
|
||||
}
|
||||
|
||||
/// Adds extra padding to an equation.
|
||||
@ -48,23 +44,16 @@
|
||||
/// Note that there are newlines between the $ and content,
|
||||
/// this gives us display math (which is what we want when using this macro)
|
||||
#let eqnbox(eqn) = {
|
||||
align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
eqn,
|
||||
),
|
||||
)
|
||||
align(center, box(
|
||||
inset: 3mm,
|
||||
eqn,
|
||||
))
|
||||
}
|
||||
|
||||
#let dotline(a, b) = {
|
||||
cetz.draw.line(
|
||||
a,
|
||||
b,
|
||||
stroke: (
|
||||
dash: "dashed",
|
||||
thickness: 0.5mm,
|
||||
paint: ored,
|
||||
),
|
||||
)
|
||||
cetz.draw.line(a, b, stroke: (
|
||||
dash: "dashed",
|
||||
thickness: 0.5mm,
|
||||
paint: ored,
|
||||
))
|
||||
}
|
||||
|
@ -1,21 +1,18 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "../macros.typ": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
= Tropical Polynomials
|
||||
|
||||
#definition()
|
||||
A _polynomial_ is an expression formed by adding and multiplying numbers and a variable $x$. \
|
||||
Every polynomial can be written as
|
||||
#align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
$
|
||||
c_0 + c_1 x + c_2 x^2 + ... + c_n x^n
|
||||
$,
|
||||
),
|
||||
)
|
||||
#align(center, box(
|
||||
inset: 3mm,
|
||||
$
|
||||
c_0 + c_1 x + c_2 x^2 + ... + c_n x^n
|
||||
$,
|
||||
))
|
||||
for some nonnegative integer $n$ and coefficients $c_0, c_1, ..., c_n$. \
|
||||
The _degree_ of a polynomial is the largest $n$ for which $c_n$ is nonzero.
|
||||
|
||||
@ -43,15 +40,12 @@ In this section, we will analyze tropical polynomials:
|
||||
#definition()
|
||||
A _tropical_ polynomial is a polynomial that uses tropical addition and multiplication. \
|
||||
In other words, it is an expression of the form
|
||||
#align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
$
|
||||
c_0 #tp (c_1 #tm x) #tp (c_2 #tm x^2) #tp ... #tp (c_n #tm x^n)
|
||||
$,
|
||||
),
|
||||
)
|
||||
#align(center, box(
|
||||
inset: 3mm,
|
||||
$
|
||||
c_0 #tp (c_1 #tm x) #tp (c_2 #tm x^2) #tp ... #tp (c_n #tm x^n)
|
||||
$,
|
||||
))
|
||||
where all exponents represent repeated tropical multiplication.
|
||||
|
||||
#pagebreak() // MARK: page
|
||||
@ -66,7 +60,7 @@ Draw a graph of the tropical polynomial $f(x) = x^2 #tp 1x #tp 4$. \
|
||||
#if_no_solutions(graphgrid(none))
|
||||
|
||||
#solution([
|
||||
$f(x) = min(2x , 1+x, 4)$, which looks like:
|
||||
$f(x) = min(2x, 1+x, 4)$, which looks like:
|
||||
|
||||
#graphgrid({
|
||||
import cetz.draw: *
|
||||
@ -90,15 +84,12 @@ Draw a graph of the tropical polynomial $f(x) = x^2 #tp 1x #tp 4$. \
|
||||
#problem()
|
||||
Now, factor $f(x) = x^2 #tp 1x #tp 4$ into two polynomials with degree 1. \
|
||||
In other words, find $r$ and $s$ so that
|
||||
#align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
$
|
||||
x^2 #tp 1x #tp 4 = (x #tp r)(x #tp s)
|
||||
$,
|
||||
),
|
||||
)
|
||||
#align(center, box(
|
||||
inset: 3mm,
|
||||
$
|
||||
x^2 #tp 1x #tp 4 = (x #tp r)(x #tp s)
|
||||
$,
|
||||
))
|
||||
|
||||
we will call $r$ and $s$ the _roots_ of $f$.
|
||||
|
||||
@ -159,15 +150,19 @@ Find a factorization of $f$ in the form $a(x #tp r)(x#tp s)$.
|
||||
#solution([
|
||||
We (tropically) factor out $-2$ to get
|
||||
|
||||
#eqnbox($
|
||||
f(x) = -2(x^2 #tp 2x #tp 10)
|
||||
$)
|
||||
#eqnbox(
|
||||
$
|
||||
f(x) = -2(x^2 #tp 2x #tp 10)
|
||||
$,
|
||||
)
|
||||
|
||||
|
||||
by the same process as the previous problem, we get
|
||||
#eqnbox($
|
||||
f(x) = -2(x #tp 2)(x #tp 8)
|
||||
$)
|
||||
#eqnbox(
|
||||
$
|
||||
f(x) = -2(x #tp 2)(x #tp 8)
|
||||
$,
|
||||
)
|
||||
])
|
||||
|
||||
#v(1fr)
|
||||
@ -236,11 +231,11 @@ Graph $f(x) = 1x^2 #tp 3x #tp 5$.
|
||||
#problem()
|
||||
Find a factorization of $f$ in the form $a(x #tp r)(x#tp s)$.
|
||||
|
||||
#solution(
|
||||
eqnbox($
|
||||
#solution(eqnbox(
|
||||
$
|
||||
f(x) = 1x^2 #tp 3 x #tp 5 = 1(x #tp 2)^2
|
||||
$),
|
||||
)
|
||||
$,
|
||||
))
|
||||
|
||||
#v(1fr)
|
||||
|
||||
@ -263,23 +258,21 @@ Graph $f(x) = 2x^2 #tp 4x #tp 4$.
|
||||
|
||||
#if_no_solutions(graphgrid(none))
|
||||
|
||||
#solution(
|
||||
graphgrid({
|
||||
import cetz.draw: *
|
||||
let step = 0.75
|
||||
#solution(graphgrid({
|
||||
import cetz.draw: *
|
||||
let step = 0.75
|
||||
|
||||
dotline((0, 2 * step), (3 * step, 8 * step))
|
||||
dotline((0, 4 * step), (5 * step, 8 * step))
|
||||
dotline((0, 4 * step), (8 * step, 4 * step))
|
||||
dotline((0, 2 * step), (3 * step, 8 * step))
|
||||
dotline((0, 4 * step), (5 * step, 8 * step))
|
||||
dotline((0, 4 * step), (8 * step, 4 * step))
|
||||
|
||||
line(
|
||||
(0, 2 * step),
|
||||
(1 * step, 4 * step),
|
||||
(7.5 * step, 4 * step),
|
||||
stroke: 1mm + oblue,
|
||||
)
|
||||
}),
|
||||
)
|
||||
line(
|
||||
(0, 2 * step),
|
||||
(1 * step, 4 * step),
|
||||
(7.5 * step, 4 * step),
|
||||
stroke: 1mm + oblue,
|
||||
)
|
||||
}))
|
||||
|
||||
|
||||
#problem()
|
||||
@ -325,7 +318,7 @@ Find a formula for $B$ in terms of $a$, $b$, and $c$. \
|
||||
|
||||
#solution([
|
||||
If we want to factor $a(x^2 #tp (b-a)x #tp (c-a))$, we need to find $r$ and $s$ so that
|
||||
- $min(r,s) = b-a$, and
|
||||
- $min(r, s) = b-a$, and
|
||||
- $r + s = c - a$
|
||||
|
||||
#v(2mm)
|
||||
@ -341,9 +334,8 @@ Find a formula for $B$ in terms of $a$, $b$, and $c$. \
|
||||
|
||||
*Case 2:* If $b > (a + c #sym.div) 2$, then
|
||||
$
|
||||
accent(f, macron)(x)
|
||||
&= a x^2 #tp ((a+c)/2)x #tp c \
|
||||
&= a(x #tp (c-a)/2)^2
|
||||
accent(f, macron)(x) & = a x^2 #tp ((a+c)/2)x #tp c \
|
||||
& = a(x #tp (c-a)/2)^2
|
||||
$
|
||||
has the same graph as $f$, and thus $B = (a+c) #sym.div 2$
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "../macros.typ": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
= Tropical Cubic Polynomials
|
||||
|
||||
@ -131,15 +131,12 @@ Using the last three problems, find formulas for $B$ and $C$ in terms of $a$, $b
|
||||
#problem()
|
||||
What are the roots of the following polynomial?
|
||||
|
||||
#align(
|
||||
center,
|
||||
box(
|
||||
inset: 3mm,
|
||||
$
|
||||
3 x^6 #tp 4 x^5 #tp 2 x^4 #tp x^3 #tp x^2 #tp 4 x #tp 5
|
||||
$,
|
||||
),
|
||||
)
|
||||
#align(center, box(
|
||||
inset: 3mm,
|
||||
$
|
||||
3 x^6 #tp 4 x^5 #tp 2 x^4 #tp x^3 #tp x^2 #tp 4 x #tp 5
|
||||
$,
|
||||
))
|
||||
|
||||
#solution([
|
||||
We have
|
||||
@ -169,9 +166,8 @@ Find a formula for each $C_i$ in terms of $c_0, c_1, ..., c_n$.
|
||||
|
||||
#solution([
|
||||
$
|
||||
A_j
|
||||
&= min_(l<=j<k)( (a_l - a_k) / (k-l) (k-j) + a_k ) \
|
||||
&= min_(l<=j<k)( a_l (k-j) / (k-l) + a_k (j-l) / (k-l) )
|
||||
A_j & = min_(l<=j<k)( (a_l - a_k) / (k-l) (k-j) + a_k ) \
|
||||
& = min_(l<=j<k)( a_l (k-j) / (k-l) + a_k (j-l) / (k-l) )
|
||||
$
|
||||
|
||||
#v(2mm)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
= Wallpaper Symmetries
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
= Mirror Symmetry
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
= Rotational Symmetry
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
#let pat(img, sol) = {
|
||||
problem()
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
= The Signature-Cost Theorem
|
||||
|
||||
@ -7,23 +7,20 @@
|
||||
First, we'll associate a _cost_ to each type of symmetry in orbifold notation:
|
||||
|
||||
#v(4mm)
|
||||
#align(
|
||||
center,
|
||||
table(
|
||||
stroke: (1pt, 1pt),
|
||||
align: center,
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Symbol*], [*Cost*], [*Symbol*], [*Cost*],
|
||||
[#sym.circle.small], [2], [#sym.times or #sym.convolve], [1],
|
||||
[#sym.diamond.stroked.small`2`], [1/2], [#sym.convolve`2`], [1/4],
|
||||
[#sym.diamond.stroked.small`3`], [2/3], [#sym.convolve`3`], [1/3],
|
||||
[#sym.dots], [#sym.dots], [#sym.dots], [#sym.dots],
|
||||
[#sym.diamond.stroked.small`n`],
|
||||
[$(n-1) / n$],
|
||||
[#sym.convolve`n`],
|
||||
[$(n-1) / (2n)$],
|
||||
),
|
||||
)
|
||||
#align(center, table(
|
||||
stroke: (1pt, 1pt),
|
||||
align: center,
|
||||
columns: (auto, auto, auto, auto),
|
||||
[*Symbol*], [*Cost*], [*Symbol*], [*Cost*],
|
||||
[#sym.circle.small], [2], [#sym.times or #sym.convolve], [1],
|
||||
[#sym.diamond.stroked.small`2`], [1/2], [#sym.convolve`2`], [1/4],
|
||||
[#sym.diamond.stroked.small`3`], [2/3], [#sym.convolve`3`], [1/3],
|
||||
[#sym.dots], [#sym.dots], [#sym.dots], [#sym.dots],
|
||||
[#sym.diamond.stroked.small`n`],
|
||||
[$(n-1) / n$],
|
||||
[#sym.convolve`n`],
|
||||
[$(n-1) / (2n)$],
|
||||
))
|
||||
|
||||
|
||||
We then calculate the total "cost" of a signature by adding up the costs of each component.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
#show: handout.with(
|
||||
title: [Warm-Up: Big-Tac-Toe],
|
||||
@ -75,16 +75,13 @@ How does your strategy change? \
|
||||
#if extra_boards {
|
||||
pagebreak()
|
||||
|
||||
align(
|
||||
center,
|
||||
grid(
|
||||
stroke: none,
|
||||
align: center,
|
||||
columns: (1fr, 1fr),
|
||||
rows: (1fr, 1fr, 1fr),
|
||||
btt(0.35), btt(0.35),
|
||||
btt(0.35), btt(0.35),
|
||||
btt(0.35), btt(0.35),
|
||||
),
|
||||
)
|
||||
align(center, grid(
|
||||
stroke: none,
|
||||
align: center,
|
||||
columns: (1fr, 1fr),
|
||||
rows: (1fr, 1fr, 1fr),
|
||||
btt(0.35), btt(0.35),
|
||||
btt(0.35), btt(0.35),
|
||||
btt(0.35), btt(0.35),
|
||||
))
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
|
||||
#show: handout.with(
|
||||
@ -43,61 +43,56 @@ Now, consider the set of six-sided dice below:
|
||||
- Die $E$: $0, 5, 5, 5, 5, 5$
|
||||
On average, which die beats each of the others? Draw a diagram.
|
||||
|
||||
#solution(
|
||||
align(
|
||||
center,
|
||||
cetz.canvas({
|
||||
import cetz.draw: *
|
||||
#solution(align(center, cetz.canvas({
|
||||
import cetz.draw: *
|
||||
|
||||
let s = 0.8 // Scale
|
||||
let t = 13pt * s // text size
|
||||
let radius = 0.3 * s
|
||||
let s = 0.8 // Scale
|
||||
let t = 13pt * s // text size
|
||||
let radius = 0.3 * s
|
||||
|
||||
// Points
|
||||
let a = (-2 * s, 0.2 * s)
|
||||
let b = (0 * s, 2 * s)
|
||||
let c = (2 * s, 0.2 * s)
|
||||
let d = (1.2 * s, -2.1 * s)
|
||||
let e = (-1.2 * s, -2.1 * s)
|
||||
// Points
|
||||
let a = (-2 * s, 0.2 * s)
|
||||
let b = (0 * s, 2 * s)
|
||||
let c = (2 * s, 0.2 * s)
|
||||
let d = (1.2 * s, -2.1 * s)
|
||||
let e = (-1.2 * s, -2.1 * s)
|
||||
|
||||
set-style(
|
||||
stroke: (thickness: 0.6mm * s),
|
||||
mark: (
|
||||
end: (
|
||||
symbol: ">",
|
||||
fill: black,
|
||||
offset: radius + (0.025 * s),
|
||||
width: 1.2mm * s,
|
||||
length: 1.2mm * s,
|
||||
),
|
||||
),
|
||||
)
|
||||
set-style(
|
||||
stroke: (thickness: 0.6mm * s),
|
||||
mark: (
|
||||
end: (
|
||||
symbol: ">",
|
||||
fill: black,
|
||||
offset: radius + (0.025 * s),
|
||||
width: 1.2mm * s,
|
||||
length: 1.2mm * s,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
line(a, b)
|
||||
line(b, c)
|
||||
line(c, d)
|
||||
line(d, e)
|
||||
line(e, a)
|
||||
line(a, c)
|
||||
line(b, d)
|
||||
line(c, e)
|
||||
line(d, a)
|
||||
line(e, b)
|
||||
line(a, b)
|
||||
line(b, c)
|
||||
line(c, d)
|
||||
line(d, e)
|
||||
line(e, a)
|
||||
line(a, c)
|
||||
line(b, d)
|
||||
line(c, e)
|
||||
line(d, a)
|
||||
line(e, b)
|
||||
|
||||
circle(a, radius: radius, fill: oblue, stroke: none)
|
||||
circle(b, radius: radius, fill: oblue, stroke: none)
|
||||
circle(c, radius: radius, fill: oblue, stroke: none)
|
||||
circle(d, radius: radius, fill: oblue, stroke: none)
|
||||
circle(e, radius: radius, fill: oblue, stroke: none)
|
||||
circle(a, radius: radius, fill: oblue, stroke: none)
|
||||
circle(b, radius: radius, fill: oblue, stroke: none)
|
||||
circle(c, radius: radius, fill: oblue, stroke: none)
|
||||
circle(d, radius: radius, fill: oblue, stroke: none)
|
||||
circle(e, radius: radius, fill: oblue, stroke: none)
|
||||
|
||||
content(a, text(fill: white, size: t, [*A*]))
|
||||
content(b, text(fill: white, size: t, [*B*]))
|
||||
content(c, text(fill: white, size: t, [*C*]))
|
||||
content(d, text(fill: white, size: t, [*D*]))
|
||||
content(e, text(fill: white, size: t, [*E*]))
|
||||
}),
|
||||
),
|
||||
)
|
||||
content(a, text(fill: white, size: t, [*A*]))
|
||||
content(b, text(fill: white, size: t, [*B*]))
|
||||
content(c, text(fill: white, size: t, [*C*]))
|
||||
content(d, text(fill: white, size: t, [*D*]))
|
||||
content(e, text(fill: white, size: t, [*E*]))
|
||||
})))
|
||||
|
||||
#v(1fr)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
#show: handout.with(
|
||||
title: [Warm-Up: What's an AST?],
|
||||
@ -18,59 +18,56 @@ You may detach the string as you hang the painting, but it must be re-attached o
|
||||
|
||||
#v(2mm)
|
||||
|
||||
#align(
|
||||
center,
|
||||
cetz.canvas({
|
||||
import cetz.draw: *
|
||||
let s = 2.5
|
||||
#align(center, cetz.canvas({
|
||||
import cetz.draw: *
|
||||
let s = 2.5
|
||||
|
||||
|
||||
line(
|
||||
(0 * s, 1 * s),
|
||||
(2 * s, 1 * s),
|
||||
(2 * s, 0 * s),
|
||||
(0 * s, 0 * s),
|
||||
close: true,
|
||||
stroke: (thickness: 0.8mm),
|
||||
)
|
||||
line(
|
||||
(0 * s, 1 * s),
|
||||
(2 * s, 1 * s),
|
||||
(2 * s, 0 * s),
|
||||
(0 * s, 0 * s),
|
||||
close: true,
|
||||
stroke: (thickness: 0.8mm),
|
||||
)
|
||||
|
||||
line(
|
||||
(0.1 * s, 1 * s),
|
||||
(0.5 * s, 1.5 * s),
|
||||
(1.5 * s, 1.5 * s),
|
||||
(1.9 * s, 1 * s),
|
||||
stroke: (thickness: 0.5mm, dash: "dotted"),
|
||||
)
|
||||
line(
|
||||
(0.1 * s, 1 * s),
|
||||
(0.5 * s, 1.5 * s),
|
||||
(1.5 * s, 1.5 * s),
|
||||
(1.9 * s, 1 * s),
|
||||
stroke: (thickness: 0.5mm, dash: "dotted"),
|
||||
)
|
||||
|
||||
circle((0.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
|
||||
circle((1.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
|
||||
circle((0.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
|
||||
circle((1.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
|
||||
|
||||
line(
|
||||
(0.66 * s, 0.66 * s),
|
||||
(0.66 * s, 0.35 * s),
|
||||
(0.60 * s, 0.1 * s),
|
||||
)
|
||||
line(
|
||||
(0.66 * s, 0.66 * s),
|
||||
(0.66 * s, 0.35 * s),
|
||||
(0.60 * s, 0.1 * s),
|
||||
)
|
||||
|
||||
line(
|
||||
(0.72 * s, 0.1 * s),
|
||||
(0.66 * s, 0.35 * s),
|
||||
)
|
||||
line(
|
||||
(0.72 * s, 0.1 * s),
|
||||
(0.66 * s, 0.35 * s),
|
||||
)
|
||||
|
||||
line(
|
||||
(0.66 * s, 0.575 * s),
|
||||
(0.6 * s, 0.475 * s),
|
||||
(0.525 * s, 0.575 * s),
|
||||
)
|
||||
line(
|
||||
(0.66 * s, 0.575 * s),
|
||||
(0.6 * s, 0.475 * s),
|
||||
(0.525 * s, 0.575 * s),
|
||||
)
|
||||
|
||||
line(
|
||||
(0.66 * s, 0.575 * s),
|
||||
(0.72 * s, 0.475 * s),
|
||||
(0.795 * s, 0.575 * s),
|
||||
)
|
||||
line(
|
||||
(0.66 * s, 0.575 * s),
|
||||
(0.72 * s, 0.475 * s),
|
||||
(0.795 * s, 0.575 * s),
|
||||
)
|
||||
|
||||
circle((0.66 * s, 0.66 * s), radius: 0.07 * s, fill: white)
|
||||
}),
|
||||
)
|
||||
circle((0.66 * s, 0.66 * s), radius: 0.07 * s, fill: white)
|
||||
}))
|
||||
|
||||
#solution([
|
||||
Say we have a left nail and a right nail. The path of the string is as follows:
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
#show: handout.with(
|
||||
title: [Warm-Up: Passing Balls],
|
||||
@ -78,32 +78,25 @@ Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4
|
||||
|
||||
let i = 1
|
||||
for p in pts {
|
||||
circle(
|
||||
p,
|
||||
radius: radius * s,
|
||||
fill: if i == 1 {
|
||||
ored
|
||||
} else if i == 2 {
|
||||
ogreen
|
||||
} else if i == 3 {
|
||||
oorange
|
||||
} else if i == 4 {
|
||||
oblue
|
||||
} else { white },
|
||||
)
|
||||
circle(p, radius: radius * s, fill: if i == 1 {
|
||||
ored
|
||||
} else if i == 2 {
|
||||
ogreen
|
||||
} else if i == 3 {
|
||||
oorange
|
||||
} else if i == 4 {
|
||||
oblue
|
||||
} else { white })
|
||||
|
||||
content(
|
||||
p,
|
||||
text(
|
||||
fill: if i <= 4 {
|
||||
white
|
||||
} else {
|
||||
black
|
||||
},
|
||||
size: t,
|
||||
[*#i*],
|
||||
),
|
||||
)
|
||||
content(p, text(
|
||||
fill: if i <= 4 {
|
||||
white
|
||||
} else {
|
||||
black
|
||||
},
|
||||
size: t,
|
||||
[*#i*],
|
||||
))
|
||||
i = i + 1
|
||||
}
|
||||
}),
|
||||
@ -118,32 +111,25 @@ Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4
|
||||
let l = calc.rem(((i - 1) * 5), 12) + 1
|
||||
|
||||
|
||||
circle(
|
||||
p,
|
||||
radius: radius * s,
|
||||
fill: if l == 1 {
|
||||
ored
|
||||
} else if l == 2 {
|
||||
ogreen
|
||||
} else if l == 3 {
|
||||
oorange
|
||||
} else if l == 4 {
|
||||
oblue
|
||||
} else { white },
|
||||
)
|
||||
circle(p, radius: radius * s, fill: if l == 1 {
|
||||
ored
|
||||
} else if l == 2 {
|
||||
ogreen
|
||||
} else if l == 3 {
|
||||
oorange
|
||||
} else if l == 4 {
|
||||
oblue
|
||||
} else { white })
|
||||
|
||||
content(
|
||||
p,
|
||||
text(
|
||||
fill: if l <= 4 {
|
||||
white
|
||||
} else {
|
||||
black
|
||||
},
|
||||
size: t,
|
||||
[*#l*],
|
||||
),
|
||||
)
|
||||
content(p, text(
|
||||
fill: if l <= 4 {
|
||||
white
|
||||
} else {
|
||||
black
|
||||
},
|
||||
size: t,
|
||||
[*#l*],
|
||||
))
|
||||
i = i + 1
|
||||
}
|
||||
}),
|
||||
@ -158,32 +144,25 @@ Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4
|
||||
let l = calc.rem(((i - 1) * 5), 12) + 1
|
||||
|
||||
|
||||
circle(
|
||||
p,
|
||||
radius: radius * s,
|
||||
fill: if l == 1 {
|
||||
oblue
|
||||
} else if l == 2 {
|
||||
oorange
|
||||
} else if l == 3 {
|
||||
ored
|
||||
} else if l == 4 {
|
||||
ogreen
|
||||
} else { white },
|
||||
)
|
||||
circle(p, radius: radius * s, fill: if l == 1 {
|
||||
oblue
|
||||
} else if l == 2 {
|
||||
oorange
|
||||
} else if l == 3 {
|
||||
ored
|
||||
} else if l == 4 {
|
||||
ogreen
|
||||
} else { white })
|
||||
|
||||
content(
|
||||
p,
|
||||
text(
|
||||
fill: if l <= 4 {
|
||||
white
|
||||
} else {
|
||||
black
|
||||
},
|
||||
size: t,
|
||||
[*#l*],
|
||||
),
|
||||
)
|
||||
content(p, text(
|
||||
fill: if l <= 4 {
|
||||
white
|
||||
} else {
|
||||
black
|
||||
},
|
||||
size: t,
|
||||
[*#l*],
|
||||
))
|
||||
i = i + 1
|
||||
}
|
||||
}),
|
||||
|
@ -1,5 +1,5 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
#show: handout.with(
|
||||
title: [Warm-Up: What's an AST?],
|
||||
@ -24,51 +24,48 @@ respecting the order of operations $[and, times, div, +, -]$.
|
||||
|
||||
#v(2mm)
|
||||
|
||||
#align(
|
||||
center,
|
||||
cetz.canvas({
|
||||
import cetz.draw: *
|
||||
#align(center, cetz.canvas({
|
||||
import cetz.draw: *
|
||||
|
||||
// spell:off
|
||||
content((0, 0), $+$, name: "r")
|
||||
content((-0.5, -1), $3$, name: "a")
|
||||
content((0.5, -1), $div$, name: "b")
|
||||
content((-0.3, -2), $times$, name: "ba")
|
||||
content((1.3, -2), $and$, name: "bb")
|
||||
content((-0.8, -3), $9$, name: "baa")
|
||||
content((0.2, -3), $8$, name: "bab")
|
||||
content((0.8, -3), $5$, name: "bba")
|
||||
content((1.8, -3), $6$, name: "bbb")
|
||||
// spell:on
|
||||
// spell:off
|
||||
content((0, 0), $+$, name: "r")
|
||||
content((-0.5, -1), $3$, name: "a")
|
||||
content((0.5, -1), $div$, name: "b")
|
||||
content((-0.3, -2), $times$, name: "ba")
|
||||
content((1.3, -2), $and$, name: "bb")
|
||||
content((-0.8, -3), $9$, name: "baa")
|
||||
content((0.2, -3), $8$, name: "bab")
|
||||
content((0.8, -3), $5$, name: "bba")
|
||||
content((1.8, -3), $6$, name: "bbb")
|
||||
// spell:on
|
||||
|
||||
// Zero-sized arrows are a hack for offset.
|
||||
set-style(
|
||||
stroke: (thickness: 0.3mm),
|
||||
mark: (
|
||||
start: (
|
||||
symbol: "|",
|
||||
offset: 0.25,
|
||||
width: 0mm,
|
||||
length: 0mm,
|
||||
),
|
||||
end: (
|
||||
symbol: "|",
|
||||
offset: 0.25,
|
||||
width: 0mm,
|
||||
length: 0mm,
|
||||
),
|
||||
// Zero-sized arrows are a hack for offset.
|
||||
set-style(
|
||||
stroke: (thickness: 0.3mm),
|
||||
mark: (
|
||||
start: (
|
||||
symbol: "|",
|
||||
offset: 0.25,
|
||||
width: 0mm,
|
||||
length: 0mm,
|
||||
),
|
||||
)
|
||||
end: (
|
||||
symbol: "|",
|
||||
offset: 0.25,
|
||||
width: 0mm,
|
||||
length: 0mm,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
// spell:off
|
||||
line("r", "a")
|
||||
line("r", "b")
|
||||
line("b", "ba")
|
||||
line("b", "bb")
|
||||
line("ba", "baa")
|
||||
line("ba", "bab")
|
||||
line("bb", "bba")
|
||||
line("bb", "bbb")
|
||||
// spell:on
|
||||
}),
|
||||
)
|
||||
// spell:off
|
||||
line("r", "a")
|
||||
line("r", "b")
|
||||
line("b", "ba")
|
||||
line("b", "bb")
|
||||
line("ba", "baa")
|
||||
line("ba", "bab")
|
||||
line("bb", "bba")
|
||||
line("bb", "bbb")
|
||||
// spell:on
|
||||
}))
|
||||
|
@ -1,24 +1,21 @@
|
||||
#import "@local/handout:0.1.0": *
|
||||
#import "@preview/cetz:0.3.1"
|
||||
#import "@preview/cetz:0.4.2"
|
||||
|
||||
#show: handout.with(
|
||||
title: [Warm-Up: Wild Tic-Tac-Toe],
|
||||
by: "Mark",
|
||||
)
|
||||
|
||||
#let ttt = align(
|
||||
center,
|
||||
cetz.canvas({
|
||||
import cetz.draw: *
|
||||
let s = 0.7 // scale
|
||||
#let ttt = align(center, cetz.canvas({
|
||||
import cetz.draw: *
|
||||
let s = 0.7 // scale
|
||||
|
||||
set-style(stroke: (thickness: 0.5mm * s))
|
||||
line((-1 * s, 3 * s), (-1 * s, -3 * s))
|
||||
line((1 * s, 3 * s), (1 * s, -3 * s))
|
||||
line((3 * s, -1 * s), (-3 * s, -1 * s))
|
||||
line((3 * s, 1 * s), (-3 * s, 1 * s))
|
||||
}),
|
||||
)
|
||||
set-style(stroke: (thickness: 0.5mm * s))
|
||||
line((-1 * s, 3 * s), (-1 * s, -3 * s))
|
||||
line((1 * s, 3 * s), (1 * s, -3 * s))
|
||||
line((3 * s, -1 * s), (-3 * s, -1 * s))
|
||||
line((3 * s, 1 * s), (-3 * s, 1 * s))
|
||||
}))
|
||||
|
||||
|
||||
#problem()
|
||||
|
Reference in New Issue
Block a user