diff --git a/documents/by-course/math-8/pset-1/2vd.typ b/documents/by-course/math-8/pset-1/2vd.typ deleted file mode 100644 index 06deb27..0000000 --- a/documents/by-course/math-8/pset-1/2vd.typ +++ /dev/null @@ -1,341 +0,0 @@ -#import "@preview/ctheorems:1.1.3": * -#import "@preview/showybox:2.0.3": showybox - -#let colors = ( - rgb("#9E9E9E"), - rgb("#F44336"), - rgb("#E91E63"), - rgb("#9C27B0"), - rgb("#673AB7"), - rgb("#3F51B5"), - rgb("#2196F3"), - rgb("#03A9F4"), - rgb("#00BCD4"), - rgb("#009688"), - rgb("#4CAF50"), - rgb("#8BC34A"), - rgb("#CDDC39"), - rgb("#FFEB3B"), - rgb("#FFC107"), - rgb("#FF9800"), - rgb("#FF5722"), - rgb("#795548"), - rgb("#9E9E9E"), -) - -#let dvdtyp( - title: "", - subtitle: "", - author: "", - abstract: none, - bibliography: none, - paper-size: "a4", - date: "today", - body, -) = { - set document(title: title, author: author) - - set std.bibliography(style: "springer-mathphys", title: [References]) - - show: thmrules - - set page( - numbering: "1", - number-align: center, - header: locate(loc => { - if loc.page() == 1 { - return - } - box(stroke: (bottom: 0.7pt), inset: 0.4em)[#text( - font: "New Computer Modern", - )[ - *#author* --- #datetime.today().display("[day] [month repr:long] [year]") - #h(1fr) - *#title* - ]] - }), - paper: paper-size, - // The margins depend on the paper size. - margin: ( - left: (86pt / 216mm) * 100%, - right: (86pt / 216mm) * 100%, - ), - ) - - - set heading(numbering: "1.") - show heading: it => { - set text(font: "Libertinus Serif") - - block[ - #if it.numbering != none { - text(rgb("#2196F3"), weight: 500)[#sym.section] - - text(rgb("#2196F3"))[#counter(heading).display() ] - } - #it.body - #v(0.5em) - ] - } - - set text(font: "New Computer Modern", lang: "en") - - show math.equation: set text(weight: 400) - - - // Title row. - align(center)[ - #set text(font: "Libertinus Serif") - #block(text(weight: 700, 26pt, title)) - - - #if subtitle != none [#text(12pt, weight: 500)[#( - subtitle - )]] - - #if author != none [#text(16pt)[#smallcaps(author)]] - #v(1.2em, weak: true) - - #if date == "today" { - datetime.today().display("[day] [month repr:long] [year]") - } else { - date - } - - ] - - if abstract != none [ - #v(2.2em) - #set text(font: "Libertinus Serif") - #pad(x: 14%, abstract) - #v(1em) - ] - - set outline(fill: repeat[~.], indent: 1em) - - show outline: set heading(numbering: none) - show outline: set par(first-line-indent: 0em) - - show outline.entry.where(level: 1): it => { - text(font: "Libertinus Serif", rgb("#2196F3"))[#strong[#it]] - } - show outline.entry: it => { - h(1em) - text(font: "Libertinus Serif", rgb("#2196F3"))[#it] - } - - - // Main body. - set par( - justify: true, - spacing: 0.65em, - first-line-indent: 2em, - ) - - body - - // Display the bibliography, if any is given. - if bibliography != none { - show std.bibliography: set text(footnote-size) - show std.bibliography: set block(above: 11pt) - show std.bibliography: pad.with(x: 0.5pt) - bibliography - } -} - -#let thmtitle(t, color: rgb("#000000")) = { - return text( - font: "Libertinus Serif", - weight: "semibold", - fill: color, - )[#t] -} -#let thmname(t, color: rgb("#000000")) = { - return text(font: "Libertinus Serif", fill: color)[(#t)] -} - -#let thmtext(t, color: rgb("#000000")) = { - let a = t.children - if (a.at(0) == [ ]) { - a.remove(0) - } - t = a.join() - - return text(font: "New Computer Modern", fill: color)[#t] -} - -#let thmbase( - identifier, - head, - ..blockargs, - supplement: auto, - padding: (top: 0.5em, bottom: 0.5em), - namefmt: x => [(#x)], - titlefmt: strong, - bodyfmt: x => x, - separator: [. \ ], - base: "heading", - base_level: none, -) = { - if supplement == auto { - supplement = head - } - let boxfmt(name, number, body, title: auto, ..blockargs_individual) = { - if not name == none { - name = [ #namefmt(name)] - } else { - name = [] - } - if title == auto { - title = head - } - if not number == none { - title += " " + number - } - title = titlefmt(title) - body = [#pad(top: 2pt, bodyfmt(body))] - pad( - ..padding, - showybox( - width: 100%, - radius: 0.3em, - breakable: true, - padding: (top: 0em, bottom: 0em), - ..blockargs.named(), - ..blockargs_individual.named(), - [ - #title#name#titlefmt(separator)#body - ], - ), - ) - } - - let auxthmenv = thmenv( - identifier, - base, - base_level, - boxfmt, - ).with(supplement: supplement) - - return auxthmenv.with(numbering: "1.1") -} - -#let styled-thmbase = thmbase.with( - titlefmt: thmtitle, - namefmt: thmname, - bodyfmt: thmtext, -) - -#let builder-thmbox(color: rgb("#000000"), ..builderargs) = styled-thmbase.with( - titlefmt: thmtitle.with(color: color.darken(30%)), - bodyfmt: thmtext.with(color: color.darken(70%)), - namefmt: thmname.with(color: color.darken(30%)), - frame: ( - body-color: color.lighten(92%), - border-color: color.darken(10%), - thickness: 1.5pt, - inset: 1.2em, - radius: 0.3em, - ), - ..builderargs, -) - -#let builder-thmline( - color: rgb("#000000"), - ..builderargs, -) = styled-thmbase.with( - titlefmt: thmtitle.with(color: color.darken(30%)), - bodyfmt: thmtext.with(color: color.darken(70%)), - namefmt: thmname.with(color: color.darken(30%)), - frame: ( - body-color: color.lighten(92%), - border-color: color.darken(10%), - thickness: (left: 2pt), - inset: 1.2em, - radius: 0em, - ), - ..builderargs, -) - -#let problem-style = builder-thmbox( - color: colors.at(11), - shadow: (offset: (x: 2pt, y: 2pt), color: luma(70%)), -) - -#let exercise = problem-style("item", "Exercise") -#let problem = exercise - -#let theorem-style = builder-thmbox( - color: colors.at(6), - shadow: (offset: (x: 3pt, y: 3pt), color: luma(70%)), -) - -#let example-style = builder-thmbox( - color: colors.at(16), - shadow: (offset: (x: 3pt, y: 3pt), color: luma(70%)), -) - -#let theorem = theorem-style("item", "Theorem") -#let lemma = theorem-style("item", "Lemma") -#let corollary = theorem-style("item", "Corollary") - -#let definition-style = builder-thmline(color: colors.at(8)) - -// #let definition = definition-style("definition", "Definition") -#let proposition = definition-style("item", "Proposition") -#let remark = definition-style("item", "Remark") -#let observation = definition-style("item", "Observation") - -// #let example-style = builder-thmline(color: colors.at(16)) - -#let example = example-style("item", "Example") - -#let proof(body, name: none) = { - v(0.5em) - [_Proof_] - if name != none { - [ #thmname[#name]] - } - [.] - body - h(1fr) - - // Add a word-joiner so that the proof square and the last word before the - // 1fr spacing are kept together. - sym.wj - - // Add a non-breaking space to ensure a minimum amount of space between the - // text and the proof square. - sym.space.nobreak - - $square.stroked$ - v(0.5em) -} - -#let fact = thmplain( - "item", - "Fact", - titlefmt: content => [*#content.*], - namefmt: content => [_(#content)._], - separator: [], - inset: 0pt, - padding: (bottom: 0.5em, top: 0.5em), -) -#let abuse = thmplain( - "item", - "Abuse of Notation", - titlefmt: content => [*#content.*], - namefmt: content => [_(#content)._], - separator: [], - inset: 0pt, - padding: (bottom: 0.5em, top: 0.5em), -) -#let definition = thmplain( - "item", - "Definition", - titlefmt: content => [*#content.*], - namefmt: content => [_(#content)._], - separator: [], - inset: 0pt, - padding: (bottom: 0.5em, top: 0.5em), -) diff --git a/documents/by-course/math-8/pset-1/main.typ b/documents/by-course/math-8/pset-1/main.typ index f1b07bf..25132d5 100644 --- a/documents/by-course/math-8/pset-1/main.typ +++ b/documents/by-course/math-8/pset-1/main.typ @@ -1,6 +1,6 @@ -#import "./dvd.typ": * +#import "@youwen/zen:0.1.0": * -#show: dvdtyp.with( +#show: zen.with( title: "Homework 1", author: "Youwen Wu", ) diff --git a/documents/by-course/math-8/pset-3/main.typ b/documents/by-course/math-8/pset-3/main.typ new file mode 100644 index 0000000..c810b99 --- /dev/null +++ b/documents/by-course/math-8/pset-3/main.typ @@ -0,0 +1,278 @@ +#import "@youwen/zen:0.1.0": * +#import "@preview/mitex:0.2.5": * + +#show: zen.with( + title: "Homework 3", + author: "Youwen Wu", +) + +#set heading(numbering: none) + +#set par(first-line-indent: 0pt, spacing: 1em) + +#let nonzero = $ZZ_(!=0)$ + +Problems: + +1.5: $hash$ 3cdefgh, 4de, 6de, 7ab, 9, 10, 11, 12a + +1.6: $hash$ 1bd, 4abcd, 6abefik + +2.1: $hash$ 4, 5, 6abcd, 8, 11ab, 14ab, 15abcd + += 1.5 + +*3c.* + +If $x^2$ is not divisible by 4, then $x$ is odd. + +#proof[ + Suppose $x$ is not odd. We seek to show that $x^2$ is divisible by $4$. + + Then $x$ is even and $exists k in ZZ_(!=0), x = 2k$. Thus + $x^2 = 4k^2$, which implies $4 | x^2$. So $x$ is not odd implies $x^2$ is + divisible by 4, and therefore the contrapositive (which is our original + statement) is also true. +] + +*3d.* + +If $x y$ is even, then either $x$ or $y$ is even. + +#proof[ + Suppose that $not (x "or" y" is even")$. In other words, $x$ and $y$ are both + odd. We seek to show that $x y$ is odd. + + Then $exists j,k in ZZ_(n!=0), x = 2j + 1, y = 2k + 1$. So $x y = 4 j k + 2j + + 2k + 1 = 2 (2 j k + j + k) + 1$ where $2 j k + j + k$ is an integer so $x y$ + is odd. This is the contrapositive, so the original statement is also true. +] + +*3e.* + +If $x + y$ is even, then $x$ and $y$ have the same parity. + +#proof[ + Suppose $x$ and $y$ had different parities. We seek to show that $x + y$ is + odd. + + Without loss of generality, let us inspect the case where $x$ is odd. Then + $y$ must be even and + $ + exists j,k in ZZ_(!=0), x = 2j + 1, y = 2k \ + x + y = 2j + 1 + 2k = 2(j + k) + 1 = 2n + 1, n in ZZ_(n!=0) + $ + Repeat the same reasoning for when $x$ is even and $y$ is odd. We've shown + that $x$ and $y$ having different parities implies that $x + y$ is odd. + Therefore the contrapositive is also true. +] + +*3f.* + +If $x y$ is odd, then both $x$ and $y$ are odd. + +#proof[ + Suppose that both $x$ and $y$ are odd was not true, in other words $x$ or $y$ + are even (here or is the logical $or$). We seek to show that this implies $x y +$ is even. Then we have two cases: either $x$ or + $y$, but not both, are even, and the case where $x$ and $y$ are both even. + + We look at the first case, without loss of generality, assume $x$ is even and + $y$ is odd. Then + + $ + exists j,k in ZZ_(!= 0), x = 2j, y = 2k + 1 \ + x y = 2j(2k + 1) = 4 j k + 2j = 2(2 j k + j) = 2n, n in ZZ_(!=0) + $ + + So $x$ and $y$ having different parities implies $x y$ is even. The argument holds identically when instead $y$ is even and $x$ is odd. Now we turn our attention to the case when $x$ and $y$ are both even. Then + + $ + exists j,k in ZZ_(!=0), x = 2j, y = 2k \ + x y = 2j dot 2k = 4 j k = 2 (2 j k) = 2n, n in ZZ_(!=0) + $ + + So this also implies that $x y$ is even. Therefore $x$ or $y$ being even indeed + implies $x y$ is also even, and the contrapositive is also true. +] + +*3g.* + +If 8 does not divide $x^2 - 1$, then $x$ is even. + +#proof[ + Suppose that $x$ is odd. We seek to show that 8 does in fact divide $x^2 - 1$. + + $ + exists k in nonzero, x = 2k + 1 \ + x^2 - 1 = 4k^2 + 4k = 4(k^2 + k) + $ + Now we need to see if it's divisible by 8. First consider the unique case $k = 0$, where $x^2 - 1 = 0$. Clearly $8 | 0$ so 8 does divide $x^2-1$. + + Now we consider all other values. Notice that for all other possible values + of $k$, $k^2 + k$ is greater than 1. We see this by noting that $k^2 + k$ is + a quadratic with its absolute minima at $k = 1/2$, therefore we can check the + two non-zero integers closest to this value. For $k = 1$, $k^2 + k = 2$. + Since we already checked $k=-1$, let's check $k=-2$, which gives $k^2 + k = + 2$. For all values of $k$ greater than 1 or less than $-2$, $k^2 + k$ must be + greater than 2 (because it's a quadratic). + + Therefore $4(k^2 + k)$ can be written as $8n$ for some integer $n$, so 8 + indeed divides $x^2 - 1$ for all possible $k$, and the contrapositive is also + true. +] + +*3h.* + +If $x$ does not divide $y z$, then $x$ does not divide $z$. + +#proof[ + Assume $x$ does divide $z$. We seek to show that $x$ does divide $y z$. If $x + | z$ then $exists k in nonzero, k x = z$. So $y z$ can be written as $y k x$. + But this shows $exists j in nonzero, j x = y z$, namely $j = y k$, which + means $x | y z$, and the contrapositive is also true. +] + +*4d.* + +If $(x+1)(x-1) < 0$, then $x < 1$. + +#proof[ + Suppose that $x >= 1$. We seek to show that $(x+1)(x-1) >= 0$. Expanding out + factors, + $ + (x+1)(x-1) = x^2 - 1>= 0 + $ + This quadratic is zero at exactly $x = 1$ and positive for all $x > 1$. So + it's true for all possible values of $x$. Therefore our original statement is + also true. +] + +*4e.* + +If $x(x-4) > -3$, then $x < 1$ or $x > 3$. + +#proof[ + Suppose that $x >= 1$ and $x <= 3$. We seek to show $x(x-4) <= -3$. Expanding + out factors, + + $ + x(x-4) = x^2 - 4x > -3 + $ + + This quadratic has its stationary point at $x = 2$. Let's check its value at $x += 1$ and $x = 3$. + + At $x = 1$, $x(x-4) = -3$. So for all values greater than 1 until $x = 2$, $x^2 - 4x$ is less than $-3$. Our inequality is satisfied. + + At $x = 3$, $x(x-4) = -3$ again. So for all values less than 3 until $x = 2$, + $x^2 - 4x$ is less than $-3$. Our inequality is satisfied for both $x >=1$ + and $x <=3$, so $x^2 -4x > -3$ is true for all possible $x$ and the + contrapositive is also true. +] + +*6d.* + +If $a - b$ is odd, then $a + b$ is odd. + +#proof[ + Suppose, seeking a contradiction, that if $a - b$ is even, then $a + b$ is odd. + + Then $exists k in nonzero, a - b = 2k$. Which means we can write $a + b = 2k + + 2b$. But we can factor this as $2(k + b)$ and so $a + b = 2n, n in + nonzero$, implying it is even. However we assumed that $a + b$ should be odd, + a contradiction. Therefore $a - b$ must be odd. +] + +*6e.* + +If $a < b$ and $a b < 3$, then $a = 1$. + +#proof[ + Suppose, seeking a contradiction, that $a >= b$ and $a b >= 3$ implies $a = + 1$. Consider the specific cases $a = b$, $a b = 3$. Then $a = 3/a$, and $a = + plus.minus sqrt(3)$. However we assumed $a = 1$ is implied, a contradiction. + Therefore we must have $a < b$ and $a b < 3$. +] + +*7a.* + +$a c$ divides $b$ and $b$ divides $b + 3$ if and only if $a = 2$ and $b = 3$. + +We first show the result left to right, namely, $a c | b c => a | b$. + +$ + exists k in nonzero, k a c = b c \ + k a = b +$ + +which is the definition of $a | b$. + +Now we show the right to left direction, namely, $a | b => a c | b c$. + +$ + exists k in nonzero, k a = b \ + k a dot c = b dot c +$ + +So $a c | b c$ by the definition of divisibility. Therefore the biconditional +is true, as we have shown both directions. + +*7b.* + +The right to left direction is very easy in this case. By directly plugging in $a = 2$, $b = 3$, we see that $2 + 1 | 3$ and $3 | 3 + 3$. To show the left to right case, + +*9.* + +#proof[ + Suppose that instead $n/(n+1) <= n/(n+2)$. We can be assured the following + operations do not flip the inequality as $n$ cannot be negative. + $ + n(n+2) <= n(n+1) \ + n + 2 <= n + 1 \ + 2 <= 1 + $ + So $n/(n+1) > n/(n+2)$. +] + +*10.* + +#proof[ + Suppose that $sqrt(5)$ was rational. That is, $sqrt(5) = p/q$ for nonzero + integers $p$ and $q$. Additionally, assume that $p/q$ is in its most reduced + form, that is, $p$ and $q$ share no common factors besides 1. Then + + $ + p^2 = 5q \ + $ + implies that + $ 5 | p^2 $ + We need to show that $5 | p^2 => 5 | p$. + + By the fundamental theorem of arithmetic, $p^2$ has 5 as one of its unique + prime factors. If 5 was not a factor of $p$, then $p^2 = p dot p$ would not + have 5 in its factors either. So 5 is a factor of $p$ and thus $5 | p$. Note + that 5 appears at least twice amongst the prime factors of $p^2$. Then $5q$ + should also have at least two 5s in its prime factorization. Then $q$ has at + least one 5 in its prime factorization. However we assumed that $p$ and $q$ + share no common factors besides 1, so this is a contradiction. Therefore + $sqrt(5)$ is not rational. +] + +*11.* + +#proof[ + We say that two numbers $x$ and $y$ are within $1/2$ unit from one another if + $|x - y| < 1/2$. Consider the distance between $z$, and $y$, if it is within + $1/2$, then we are done. Otherwise $z - y >= 1/2$. + + We know that + $ (1 - z) + x + (y-x) + (z-y) = 1 $ + because this is the length of all the line segments partitioned by $x,y,z$, + which is the interval 1. If $(z - y) >= 1/2$, then everything else must be + less than $1/2$. So the maximum value of $y-x$, the distance between $x$ and + $y$, is less than $1/2$. Therefore either $y$ and $z$ are within $1/2$ unit + of each other or $y$ and $x$ are. +] + +*12a.* diff --git a/documents/by-course/math-8/pset-3/package.nix b/documents/by-course/math-8/pset-3/package.nix new file mode 100644 index 0000000..7879e7e --- /dev/null +++ b/documents/by-course/math-8/pset-3/package.nix @@ -0,0 +1,37 @@ +{ + pkgs, + typstPackagesCache, + typixLib, + cleanTypstSource, + flakeSelf, + ... +}: +let + src = cleanTypstSource ./.; + commonArgs = { + typstSource = "main.typ"; + + fontPaths = [ + # Add paths to fonts here + # "${pkgs.roboto}/share/fonts/truetype" + ]; + + virtualPaths = [ + # Add paths that must be locally accessible to typst here + # { + # dest = "icons"; + # src = "${inputs.font-awesome}/svgs/regular"; + # } + ]; + + XDG_CACHE_HOME = typstPackagesCache; + SOURCE_DATE_EPOCH = builtins.toString flakeSelf.lastModified; + }; + +in +typixLib.buildTypstProject ( + commonArgs + // { + inherit src; + } +)