From 0b7acaf5ae5467c96df35c50eff6e38cf5962d56 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 24 Sep 2025 22:02:23 -0700 Subject: [PATCH] fmt --- .../Fast Inverse Root/parts/02 float.typ | 4 +- .../Fast Inverse Root/parts/03 approx.typ | 6 +-- .../Fast Inverse Root/parts/04 quake.typ | 6 +-- .../parts/00 arithmetic.typ | 49 ++++--------------- .../Tropical Polynomials/parts/02 cubic.typ | 2 +- src/Advanced/Wallpaper/parts/00 intro.typ | 4 +- src/Warm-Ups/Adders/main.typ | 8 +-- src/Warm-Ups/Partition Products/main.typ | 6 ++- 8 files changed, 31 insertions(+), 54 deletions(-) diff --git a/src/Advanced/Fast Inverse Root/parts/02 float.typ b/src/Advanced/Fast Inverse Root/parts/02 float.typ index 7fbcfd3..9aabdc2 100644 --- a/src/Advanced/Fast Inverse Root/parts/02 float.typ +++ b/src/Advanced/Fast Inverse Root/parts/02 float.typ @@ -31,7 +31,9 @@ Rewrite the following binary decimals in base 10: \ #definition(label: "floatbits") Another way we can interpret a bit string is as a _signed floating-point decimal_, or a `float` for short. \ 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.]) +#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: * diff --git a/src/Advanced/Fast Inverse Root/parts/03 approx.typ b/src/Advanced/Fast Inverse Root/parts/03 approx.typ index e950440..1040a2f 100644 --- a/src/Advanced/Fast Inverse Root/parts/03 approx.typ +++ b/src/Advanced/Fast Inverse Root/parts/03 approx.typ @@ -131,9 +131,9 @@ $ 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 \ + & = 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 $ ]) diff --git a/src/Advanced/Fast Inverse Root/parts/04 quake.typ b/src/Advanced/Fast Inverse Root/parts/04 quake.typ index 5e2d57f..2037228 100644 --- a/src/Advanced/Fast Inverse Root/parts/04 quake.typ +++ b/src/Advanced/Fast Inverse Root/parts/04 quake.typ @@ -156,9 +156,9 @@ float Q_rsqrt( float number ) { Using a calculator and some basic algebra, we can find the $epsilon$ this code uses: \ #note[Remember, #text[`0x5f3759df`] is $6240089$ in hexadecimal.] $ - (3 times 2^22) (127 - epsilon) &= 6240089 \ - (127 - epsilon) &= 126.955 \ - epsilon &= 0.0450466 + (3 times 2^22) (127 - epsilon) & = 6240089 \ + (127 - epsilon) & = 126.955 \ + epsilon & = 0.0450466 $ So, $0.045$ is the $epsilon$ used by Quake. \ diff --git a/src/Advanced/Tropical Polynomials/parts/00 arithmetic.typ b/src/Advanced/Tropical Polynomials/parts/00 arithmetic.typ index 81c4c6e..bb87316 100644 --- a/src/Advanced/Tropical Polynomials/parts/00 arithmetic.typ +++ b/src/Advanced/Tropical Polynomials/parts/00 arithmetic.typ @@ -26,9 +26,9 @@ $ #solution([ - Is tropical addition commutative?\ - Yes, $min(min(x,y),z) = min(x,y,z) = min(x,min(y,z))$ + Yes, $min(min(x, y), z) = min(x, y, z) = min(x, min(y, z))$ - Is tropical addition associative? \ - Yes, $min(x,y) = min(y,x)$ + Yes, $min(x, y) = min(y, x)$ - Is there a tropical additive identity? \ No. There is no $n$ where $x <= n$ for all real $x$ ]) @@ -117,7 +117,7 @@ Do tropical multiplicative inverses always exist? \ Is tropical multiplication distributive over addition? \ #note([Does $x #tm (y #tp z) = x #tm y #tp x #tm z$?]) -#solution([Yes, $x + min(y,z) = min(x+y, x+z)$]) +#solution([Yes, $x + min(y, z) = min(x+y, x+z)$]) #v(1fr) @@ -134,14 +134,7 @@ Fill the following tropical addition and multiplication tables table( columns: (col, col, col, col, col, col), align: center, - table.header( - [$#tp$], - [$1$], - [$2$], - [$3$], - [$4$], - [$#sym.infinity$], - ), + table.header([$#tp$], [$1$], [$2$], [$3$], [$4$], [$#sym.infinity$]), box(inset: 3pt, $1$), [], [], [], [], [], box(inset: 3pt, $2$), [], [], [], [], [], @@ -152,14 +145,7 @@ Fill the following tropical addition and multiplication tables table( columns: (col, col, col, col, col, col), align: center, - table.header( - [$#tm$], - [$0$], - [$1$], - [$2$], - [$3$], - [$4$], - ), + table.header([$#tm$], [$0$], [$1$], [$2$], [$3$], [$4$]), box(inset: 3pt, $0$), [], [], [], [], [], box(inset: 3pt, $1$), [], [], [], [], [], @@ -178,14 +164,7 @@ Fill the following tropical addition and multiplication tables table( columns: (col, col, col, col, col, col), align: center, - table.header( - [$#tp$], - [$1$], - [$2$], - [$3$], - [$4$], - [$#sym.infinity$], - ), + table.header([$#tp$], [$1$], [$2$], [$3$], [$4$], [$#sym.infinity$]), box(inset: 3pt, $1$), box(inset: 3pt, $1$), @@ -225,14 +204,7 @@ Fill the following tropical addition and multiplication tables table( columns: (col, col, col, col, col, col), align: center, - table.header( - [$#tm$], - [$0$], - [$1$], - [$2$], - [$3$], - [$4$], - ), + table.header([$#tm$], [$0$], [$1$], [$2$], [$3$], [$4$]), box(inset: 3pt, $0$), box(inset: 3pt, $0$), @@ -281,10 +253,9 @@ Adjacent parenthesis imply tropical multiplication #solution([ $ - (x #tp 2)(x #tp 3) - &= x^2 #tp 2x #tp 3x #tp (2 #tm 3) \ - &= x^2 #tp (2 #tp 3)x #tp (2 #tm 3) \ - &= x^2 #tp 2x #tp 5 + (x #tp 2)(x #tp 3) & = x^2 #tp 2x #tp 3x #tp (2 #tm 3) \ + & = x^2 #tp (2 #tp 3)x #tp (2 #tm 3) \ + & = x^2 #tp 2x #tp 5 $ Also, $f(1) = 2$ and $f(4) = 5$. diff --git a/src/Advanced/Tropical Polynomials/parts/02 cubic.typ b/src/Advanced/Tropical Polynomials/parts/02 cubic.typ index d3e5bd7..a28f7f2 100644 --- a/src/Advanced/Tropical Polynomials/parts/02 cubic.typ +++ b/src/Advanced/Tropical Polynomials/parts/02 cubic.typ @@ -166,7 +166,7 @@ Find a formula for each $C_i$ in terms of $c_0, c_1, ..., c_n$. #solution([ $ - A_j & = min_(l<=j= 4$. \ Thus, we're left with sequences that only contain 2 and 3. \ - #note([Note that two twos are the same as one four, but we exclude fours for simplicity.]) + #note( + [Note that two twos are the same as one four, but we exclude fours for simplicity.], + ) #v(2mm)