diff --git a/Advanced/Tropical Polynomials/macros.typ b/Advanced/Tropical Polynomials/macros.typ index 7156bf9..db144b1 100644 --- a/Advanced/Tropical Polynomials/macros.typ +++ b/Advanced/Tropical Polynomials/macros.typ @@ -1,4 +1,5 @@ #import "@preview/cetz:0.3.1" +#import "handout.typ": * // Shorthand, we'll be using these a lot. #let tp = sym.plus.circle @@ -35,3 +36,34 @@ ), ) } + +/// Adds extra padding to an equation. +/// Used as follows: +/// +/// #eqmbox($ +/// f(x) = -2(x #tp 2)(x #tp 8) +/// $) +/// +/// 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, + ), + ) +} + +#let dotline(a, b) = { + cetz.draw.line( + a, + b, + stroke: ( + dash: "dashed", + thickness: 0.5mm, + paint: ored, + ), + ) +} diff --git a/Advanced/Tropical Polynomials/parts/01 polynomials.typ b/Advanced/Tropical Polynomials/parts/01 polynomials.typ index 82f6cf3..6000de5 100644 --- a/Advanced/Tropical Polynomials/parts/01 polynomials.typ +++ b/Advanced/Tropical Polynomials/parts/01 polynomials.typ @@ -72,36 +72,9 @@ Draw a graph of the tropical polynomial $f(x) = x^2 #tp 1x #tp 4$. \ import cetz.draw: * let step = 0.75 - line( - (0, 0), - (4 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0, 1 * step), - (7 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0, 4 * step), - (8 * step, 4 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - + dotline((0, 0), (4 * step, 8 * step)) + dotline((0, 1 * step), (7 * step, 8 * step)) + dotline((0, 4 * step), (8 * step, 4 * step)) line((0, 0), (1 * step, 2 * step), (3 * step, 4 * step), (7.5 * step, 4 * step), stroke: 1mm + oblue) }) @@ -161,35 +134,9 @@ Graph $f(x) = -2x^2 #tp x #tp 8$. \ import cetz.draw: * let step = 0.75 - line( - (0, 0), - (8 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0.5 * step, 0), - (4 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0, 4 * step), - (8 * step, 4 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) + dotline((0, 0), (8 * step, 8 * step)) + dotline((0.5 * step, 0), (4 * step, 8 * step)) + dotline((0, 4 * step), (8 * step, 4 * step)) line((0.5 * step, 0), (1 * step, 1 * step), (4 * step, 4 * step), (7.5 * step, 4 * step), stroke: 1mm + oblue) }) @@ -201,23 +148,15 @@ Find a factorization of $f$ in the form $a(x #tp r)(x#tp s)$. #solution([ We (tropically) factor out $-2$ to get - #align( - center, - box( - inset: 3mm, - $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 - - #align( - center, - box( - inset: 3mm, - $f(x) = -2(x #tp 2)(x #tp 8)$, - ), - ) + #eqnbox($ + f(x) = -2(x #tp 2)(x #tp 8) + $) ]) #v(1fr) @@ -269,35 +208,9 @@ Graph $f(x) = 1x^2 #tp 3x #tp 5$. import cetz.draw: * let step = 0.75 - line( - (0, 1 * step), - (3.5 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0, 4 * step), - (8 * step, 4 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0, 3 * step), - (5 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) + dotline((0, 1 * step), (3.5 * step, 8 * step)) + dotline((0, 5 * step), (8 * step, 5 * step)) + dotline((0, 3 * step), (5 * step, 8 * step)) line((0, 1 * step), (2 * step, 5 * step), (7.5 * step, 5 * step), stroke: 1mm + oblue) }) @@ -308,13 +221,9 @@ Graph $f(x) = 1x^2 #tp 3x #tp 5$. Find a factorization of $f$ in the form $a(x #tp r)(x#tp s)$. #solution( - align( - center, - box( - inset: 3mm, - $f(x) = 1x^2 #tp 3 x #tp 5 = 1(x #tp 2)^2$, - ), - ), + eqnbox($ + f(x) = 1x^2 #tp 3 x #tp 5 = 1(x #tp 2)^2 + $), ) #v(1fr) @@ -343,35 +252,9 @@ Graph $f(x) = 2x^2 #tp 4x #tp 4$. import cetz.draw: * let step = 0.75 - line( - (0, 2 * step), - (3 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0, 4 * step), - (5 * step, 8 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) - - line( - (0, 4 * step), - (8 * step, 4 * step), - stroke: ( - dash: "dashed", - thickness: 0.5mm, - paint: ored, - ), - ) + 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) }),