From 735ab2fc2517acf41056a8ea5e88f5244e55958d Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 6 Jan 2025 15:32:17 -0800 Subject: [PATCH] auto-update(nvim): 2025-01-06 15:32:17 --- .../by-course/math-8/course-notes/dvd.typ | 8 +- .../by-course/pstat-120a/course-notes/dvd.typ | 282 ++++++++++++++++++ .../pstat-120a/course-notes/main.typ | 121 ++++++++ 3 files changed, 408 insertions(+), 3 deletions(-) create mode 100644 documents/by-course/pstat-120a/course-notes/dvd.typ create mode 100644 documents/by-course/pstat-120a/course-notes/main.typ diff --git a/documents/by-course/math-8/course-notes/dvd.typ b/documents/by-course/math-8/course-notes/dvd.typ index 15ea80c..d6ff3d2 100644 --- a/documents/by-course/math-8/course-notes/dvd.typ +++ b/documents/by-course/math-8/course-notes/dvd.typ @@ -45,10 +45,12 @@ if loc.page() == 1 { return } - box(stroke: (bottom: 0.7pt), inset: 0.2em)[#text( + box(stroke: (bottom: 0.7pt), inset: 0.4em)[#text( font: "New Computer Modern", )[ - #author #h(1fr)#title + *#author* --- #datetime.today().display("[day] [month repr:long] [year]") + #h(1fr) + *#title* ]] }), paper: paper-size, @@ -86,7 +88,7 @@ #if author != none [#text(16pt)[by #author]] #v(1.2em, weak: true) #if subtitle != none [#text(12pt, weight: 500)[#( - datetime.today().display("[month repr:long] [day], [year]") + datetime.today().display("[day] [month repr:long] [year]") )]] ] diff --git a/documents/by-course/pstat-120a/course-notes/dvd.typ b/documents/by-course/pstat-120a/course-notes/dvd.typ new file mode 100644 index 0000000..d6ff3d2 --- /dev/null +++ b/documents/by-course/pstat-120a/course-notes/dvd.typ @@ -0,0 +1,282 @@ +#import "@preview/ctheorems:1.1.2": * +#import "@preview/showybox:2.0.1": 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", + 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") + set par(first-line-indent: 0em) + + if it.numbering != none { + text(rgb("#2196F3"), weight: 500)[#sym.section] + + text(rgb("#2196F3"))[#counter(heading).display() ] + } + it.body + } + + 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)) + #v(1.8em, weak: true) + #if author != none [#text(16pt)[by #author]] + #v(1.2em, weak: true) + #if subtitle != none [#text(12pt, weight: 500)[#( + datetime.today().display("[day] [month repr:long] [year]") + )]] + + ] + + if abstract != none [ + #v(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, + first-line-indent: 1em, + ) + + 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: [#h(0.1em).#h(0.2em) \ ], + 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 = 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 problem = problem-style("problem", "Problem") + +#let theorem-style = builder-thmbox( + color: colors.at(6), + shadow: (offset: (x: 3pt, y: 3pt), color: luma(70%)), +) + +#let theorem = theorem-style("theorem", "Theorem") +#let lemma = theorem-style("lemma", "Lemma") +#let corollary = theorem-style("corollary", "Corollary") + +#let definition-style = builder-thmline(color: colors.at(8)) + +#let definition = definition-style("definition", "Definition") +#let proposition = definition-style("proposition", "Proposition") +#let remark = definition-style("remark", "Remark") +#let observation = definition-style("observation", "Observation") + +#let example-style = builder-thmline(color: colors.at(16)) + +#let example = example-style("example", "Example").with(numbering: none) + +#let proof(body, name: none) = { + thmtitle[Proof] + if name != none { + [ #thmname[#name]] + } + thmtitle[.] + body + h(1fr) + $square$ +} diff --git a/documents/by-course/pstat-120a/course-notes/main.typ b/documents/by-course/pstat-120a/course-notes/main.typ new file mode 100644 index 0000000..998e025 --- /dev/null +++ b/documents/by-course/pstat-120a/course-notes/main.typ @@ -0,0 +1,121 @@ +#import "./dvd.typ": * + +#show: dvdtyp.with( + title: "Probability and Statistics", + author: "Youwen Wu", +) + +#outline() + += Lecture 1 + +== Preliminaries + +#definition("Statistics")[ + The science dealing with the collection, summarization, analysis, and + interpretation of data. +] + +== Set theory for dummies + +A terse introduction to elementary set theory and the basic operations upon +them. + +#definition[Set][ + A collection of elements. +] + +#example[Examples of sets][ + + Trivial set: ${1}$ + + Empty set: $emptyset$ + + $A = {a,b,c}$ +] + +We can construct sets using set-builder notation (also sometimes called set comprehension). + +$ {"expression with" x | "conditions on" x} $ + +#example("Set builder notation")[ + + The set of all even integers: ${2n | n in ZZ}$ + + The set of all perfect squares in $RR$: ${x^2 | x in NN}$ +] + +We also have notation for working with sets: + +With arbitrary sets $A$, $B$, $Omega$: + ++ $a in A$ ($a$ is a member of the set $A$) ++ $a in.not A$ ($a$ is not a member of the set $A$) ++ $A subset.eq Omega$ (Set theory: $A$ is a subset of $Omega$) (Stats: $A$ is a sample space in $Omega$) ++ $A subset Omega$ (Proper subset: $A != Omega$) ++ $A^c$ or $A'$ (read "complement of $A$") ++ $A union B$ (Union of $A$ and $B$. Gives a set with both the elements of $A$ and $B$) ++ $A sect B$ (Intersection of $A$ and $B$. Gives a set consisting of the elements in *both* $A$ and $B$) ++ $A \\ B$ (Set difference. The set of all elements of $A$ that are not also in $B$) ++ $A times B$ (Cartesian product. Ordered pairs of $(a,b)$ $forall a in A$, $forall b in B$) + +We can also write a few of these operations precisely as set comprehensions. + ++ $A subset Omega => A = {a | a in Omega, forall a in A}$ ++ $A union B = {x | x in A or x in B}$ (here $or$ is the logical OR) ++ $A sect B = {x | x in A and x in B}$ (here $and$ is the logical AND) ++ $A \\ B = {a | a in A and a in.not B}$ ++ $A times B = {(a,b) | forall a in A, forall b in B}$ + +Convince yourself that these definitions are equivalent to the previous ones. + +#example[The real plane][ + The real plane $RR^2$ can be defined as a Cartesian product of $RR$ with itself. + + $ RR^2 = RR times RR $ +] + +Check your intuition that this makes sense. Why do you think $RR^n$ was chosen as the notation for $n$ dimensional spaces in $RR$? + +#remark[Disjoint sets][ + If $A sect B$ = $emptyset$, then we say that $A$ and $B$ are *disjoint*. +] + +#theorem[Properties of set operations][ + + DeMorgan's Laws: + + $(A union B)' = A' sect B'$ + + $(A sect B)' = A' union B'$ +] + +#remark[Generalized DeMorgan's][ + + $(union_i A_i)' = sect_i A_i'$ + + $(sect_i A_i)' = union_i A_i'$ +] + +=== Sizes of infinity + +#definition("Cardinality")[ + Let $N(A)$ be the number of elements in $A$. $N(A)$ is called the _cardinality_ of $A$. +] + +Sets are either finite or infinite. Finite sets have a fixed finite cardinality. + +Infinite sets can be either _countably infinite_ or _uncountably infinite_. + +When a set is countably infinite, its cardinality is $aleph_0$ (here $aleph$ is +the Hebrew letter aleph and read "aleph null"). + +When a set is uncountably infinite, its cardinality is greater than $aleph_0$. + +#example("Countable sets")[ + + The natural numbers $NN$. + + The rationals $QQ$. + + The natural numbers $ZZ$. +] + +#example("Uncountable sets")[ + + The real numbers $RR$. + + The real numbers in the interval $[0,1]$. +] + +#remark[Bijection][ + If a set is countably infinite, then it has a bijection with $ZZ$. This means + every set with cardinality $aleph_0$ has a bijection to $ZZ$. +] + +