repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/ofurtumi/formleg
https://raw.githubusercontent.com/ofurtumi/formleg/main/h08/H8.typ
typst
#import "@templates/ass:0.1.1":* #show: doc => template( class: "TÖL301G", project: "Homework 8", doc ) #set heading(numbering: "1.a.") = DFA M == Is $1011 in L(M)$ This string is rejected, since $q_8$ does not have a $1$ transition into an accept state == Is $angle.l M, 1011 angle.r in A_"DFA"$ This combo of DFA and string is rejected since $M$ does not accept $1011$ == Is $angle.l M, 1010 angle.r in A_"DFA"$ Yes, this combo of DFA and string is accepted, we follow the states $q_0->q_2->q_5->q_8->q_5$ == Is $angle.l M angle.r in E_"DFA"$ No, $E_"DFA"$ rejects $M$ since we have shown that $M$ accepts atleast one string = Is $A$ decidable We know that we can change a regular expression into a DFA, lets define $R_"DFA"$ and $S_"DFA"$ as the DFA's for $R$ and $S$. We create a new DFA, $R'_"DFA"$ that is the complement of $R_"DFA"$, this DFA rejects all strings accepted by $R_"DFA"$. Now we create a final DFA $R' S_"DFA"$ which corresponds to the intersection of $R'_" eDFA"$ and $S_"DFA"$. Finally we put our new $R'S_"DFA"$ into $E_"DFA"$, if $E_"DFA"$ accepts then we have shown that $S$ is a sublanguage of $R$ and is therefore decidable. = Non negative integer pairs == show that $W$ is both infinate and countable We can show that $W$ is infinate and countable by creating a function $ f(a,b) = p^a q^b $ where $p$ and $q$ are prime numbers where $p != q$. This is possible because every integer can be factorized into a unique product of primes _(see the unique factorization theorem)._ == Show that $r(y) := S(y)$ is finite for all $y$ Given the rules of $S(y)$ that $x < y$ we have two possible situations: $ x_2 < y_2 $ $x$ has $x_2 + 1$ possible combos, in other words $y_2$, for where $x_2$ can be any integer between $0$ and $y_2 - 1$. $ x_2 = y_2 "and" x_1 < y_1 $ now $x$ only has $y_1$ possible combos since $x_2$ does not change. == Closed form #grid(columns: 2, [ For the rule $x_2 < y_2$ $x_2$ can take any value between $1$ and $y_2 - 1$, $x_1$ can take values between $0$ and $x_2 - 1$, this can be shown by the closed form $ sum^(y_2-1)_(i=1) i = (y_2(y_2 - 1)) / 2 $ ],[ For the rule $x_2 = y_2 "and" x_1 < y_1$ we have $y_1$ possible combos, this can be shown by the closed form $ sum^(y_1)_(i=1) i = y_1 $ ]) Combining these closed forms we get the closed form $ R(y) = (y_2(y_2 - 1)) / 2 + y_1 $
https://github.com/Steendly/typst-templates
https://raw.githubusercontent.com/Steendly/typst-templates/master/paper_base_formatting.typ
typst
#let project( title: "", subtitle: "", abstract: [], authors: (), body ) = { // Set the document's basic properties set document(author: authors.map(a => a.name), title: title) set text(font: "Liberation Sans", lang: "fr") set heading(numbering: "1.1.") set par(justify: true) // Title page align(center + horizon)[ #text(2em, weight: 700, title) ] // Subtitle page align(center + horizon)[ #block(text(1.5em, weight: 500, subtitle), above: 1em, below: 3em) ] // Link configuration show link: set text(fill: blue) show link: underline // List configuration set list(indent: 1.5em) // Author information pad( grid( columns: (1fr), gutter: 1em, ..authors.map(author => align(center)[ *#author.name* \ #author.email ]) ) ) pagebreak() // Abstract page align(center + horizon)[ #text(abstract) ] pagebreak() // Table of contents align(horizon + center, outline(depth: 3, indent: true)) pagebreak() // Heading configuration show heading.where(level: 1) : it => { pagebreak(weak: true) } show heading.where(level: 2): it => { let loc = it.location() let headings = query(selector(heading).before(loc), loc) if headings.len() == 0 or headings.at(-2).level != 1 { v(2em) it } else { it } } show heading.where(level: 3) : it => { v(1em) it } // Figure configuration show figure.caption: emph // Rect configuration set rect(stroke: none) // Main body set page(numbering: "1", number-align: center) counter(page).update(1) body } #let heading_1(title, subtitle: "") = { if subtitle == "" { hide(heading(title)) pagebreak(weak: true) align(center)[ #block(text(2em, weight: 700, title), above: 0.5em, stroke: black, inset: 1em, width: 100%) ] } else { hide(heading(title + " - " + subtitle)) pagebreak(weak: true) align(center + horizon)[ #text(2em, weight: 700, title) #block(text(1.5em, weight: 500, subtitle), above: 0.5em) ] } } #let heading_2(title, break_ordering: false) = { if break_ordering == false { hide(heading(title, level: 2)) } else { hide(heading(title, level: 1)) } pagebreak(weak: true) align(center)[ #block(text(2em, weight: 700, title), above: 0.5em, stroke: black, inset: 1em, width: 100%) ] } #let commented_text(content) = { text(content, orange) }
https://github.com/r8vnhill/keen-manual
https://raw.githubusercontent.com/r8vnhill/keen-manual/main/omp/init.typ
typst
BSD 2-Clause "Simplified" License
== Initialization The initialization phase of a genetic algorithm marks the beginning of its process to find solutions. This phase involves creating an initial group of individuals, each representing a potential solution. The population's size and the method of initializing these individuals are critical. Generally, initialization uses randomness to ensure a wide exploration of solutions, but if specific knowledge about the problem is available, a more targeted approach can be taken. Each individual is assessed for their fitness value after the population is created. This evaluation helps gauge the diversity and quality of solutions, setting the stage for the algorithm's evolution. For problems where optimal solutions are unclear, like the OMP, initialization might involve generating random binary strings for each individual. For example, in a population of 100 individuals, each might start with a 50-bit string. The Evolution Engine manages this process, overseeing initialization, evaluation, and evolution. It is configured through parameters like population size and the structure of individuals. Here's a Kotlin code example to illustrate the setup: ```kt // Define the population size. private const val POPULATION_SIZE = 100 // Configure and instantiate the Evolution Engine. val engine = evolutionEngine(::count, genotypeOf { chromosomeOf { booleans { size = CHROMOSOME_SIZE // Length of each individual's chromosome. trueRate = TRUE_RATE // Initial probability of a gene being `true`. } } }) { populationSize = POPULATION_SIZE // Set the population size. // Additional configurations can be added here. } ``` This code sets up the Evolution Engine with a fitness evaluation function and the genetic structure of the population, readying the algorithm for its evolutionary journey.
https://github.com/jneug/schule-typst
https://raw.githubusercontent.com/jneug/schule-typst/main/README.md
markdown
MIT License
<h1 align="center">🏫 Schule (v1.0.0)</h1> <h4 align="center"><a href="https://typst.app">Typst</a> Vorlagen für den Einsatz in der Schule.</h4> <div align="center"> <img src="docs/examples/ab.png" width="50%"> </div> **Schule** ist eine Sammlung von Vorlagen und Modulen zur Erstellung von Arbeitsmaterialien für die Schule. Das Paket ist als Port des LaTeX Pakets [arbeitsblatt](https://github.com/jneug/arbeitsblatt) entstanden. ## Changelog ### Unreleased Full rewrite of the template with some breaking changes to the api. ### v0.2.0 - *Breaking*: Version 0.2.0 unterstützt nur noch Typst 0.11 und aufwärts. #### Fixed - Fehler beim erstellen der Schattenfarbe für Shwoyboxen behoben, wenn die Strichfarbe auf `auto` eingestellt war. - `#container` hat nun als Standard abgerundete Ecken. ### v1.0.0 - Punkte im Erwartungshorizont von Klausuren lassen sich nun einzeln anzeigen: `#show: klausur.with(punkte-pro-erwartung: true)`
https://github.com/barddust/Kuafu
https://raw.githubusercontent.com/barddust/Kuafu/main/src/Analysis/rational.typ
typst
#import "/mathenv.typ": * = The rationals == Definition of Rationals #definition(name:"rational number")[ Let $a,b$ be integers, and $b != 0$. We define an _rational number_ as a ordered pair $(a,b)$. For another rational number $(c,d)$, we define: $ (a,b) = (c,d) <=> a d = c b $ We let $Q$ denote the set of all rationals. ] #remark[ The definition of rationals is similar as integers', both from ordered pairs. Here round parentheses are used still, just to tell there is not much difference between integers and rationals internally. ] == Addition #definition[ Give two rationals $(a,b)$ and $(c,d)$, we define the sum of two rationals by formula: $ (a,b) + (c,d) := (a d + b c, b d) $ ] #proposition(name: "Laws of addition for rationals")[ Let $x,y,z$ be rationals. Then - $x + y = y + x$; - $x + (y + z) = (x + y) + z$; - $x = y <=> x + z = y + z$. ] #proof[ Similar as before. ] == Multiplication #definition(name: "Multiplication of rational numbers")[ Give two rationals $(a,b)$ and $(c,d)$, we define the product of two rationals by formula: $ (a,b) times (c,d) := (a c , b d) $ ] #proposition(name: "Laws of multiplication for rationals")[ Let $x,y,z$ be rationals. $ x y = y x\ x (y z) = (x y) z\ (x + y) z = x z + y z\ x = y => x z = y z\ z != 0 and x z = y z => x = y\ $ ] #proof[ Similar as before. ] #definition(name: "Reciprocals of a rational number")[ Let $x = m/n$ be non-zero rational numbers, where $m,n in ZZ$. We define the _reciprocal_ $x^(-1)$ of $x$ by the formula $ x^(-1) := n / m $ ] #definition(name: "Quotient of rational numbers")[ Let $x,y$ be rationals, and $ y != 0$. We define the _quotient_ of $x$ and $y$ by the formula $ x\/y := x times y^(-1) $ Another notation for that quotient is $x / y$. ] #remark[ The quotient of two rational numbers is still a rational number. We now obtain one more useful tool to deal with numbers. ] == Ordering of Rational Numbers #definition(name: "Negation of rational numbers")[ Let $x = (a,b)$ be a rational number, we define the negation of $x$, written as $-x$, by the formula: $ -(a,b) := (-a, b) $ ] #definition(name: "Positive and negative rationals")[ Let $x = (a,b)$ be a rational. We say $x$ to be - zero iff $a = 0$ and $b != 0$; - _a positive rational number_ if $a > 0$ and $b > 0$; - _a negative rational number_ if $- x$ is positive. ] #proposition(name: "Trichotomy of rationals")[ Let $x$ be a rational number. Then exactly one of the following tree statements is true: $x$ is positive, $x = 0$, or $x$ is negative. ] #proof[ Let $x = (a,b)$ for some integers $a,b$. #noin[ _Step 1_. To show that at most one of three statements is true. ] By definition, if $x$ is positive, or negative, then $x$ cannot be zero. Suppose we have that $x$ is both positive and negative, then $-x$ is also positive, and hence $(a > 0 and b > 0) and (-a > 0 and b > 0)$, i.e., $ a > 0 and a < 0 $ By the trichotomy of integers, this is a contradiction. Therefore, at most one of these three is true. #noin[ _Step 2_. At least one of three statements is true. ] For contradiction, we let all these three be false. Since $x$ is not positive, $not(a >0 and b >0) <=> a <= 0 and b <=0$. Since $-x$ is positive, $not(-a > 0 and b > 0) <=> a >= 0 and b >= 0$. And hence there exists $e,f in NN$, such that $0 = a + e and a = 0 + f$, $ 0 = a + e &= 0 + f + e\ e + f &= 0 $ thus, $e = f = 0$, i.e., $a = 0$; this contradicts with the hypothesis that $x$ is not zero. Therefore, at least one of these three is true. In summary, exactly one of them is true. ] #definition(name: "Subtraction of rationals")[ Let $x,y$ be rational numbers. We define the _difference_ of $x,y$ by formula $ x - y := x + (-y) $ ] #definition(name: "Order of the rationals")[ Let $x,y$ be rationals. - $x > y$ iff $x - y$ is positive; - $x < y$ iff $x - y$ is negative; - $x >= y$ iff $x > y or x = y$; ] #proposition[ Let $x,y,z$ be rational numbers. + $x > y <=> y < x$; + $x < y and y < z => x < z$; + $x < y => x + z < y + z$; + $x < y and z > 0 => x z < y z$. + Exactly one of the three statements $x = y$, $x < y$, or $x > y$ is true; ] #proof[ Omitted. ] // == Gaps in the Rational Numbers // #proposition(name: "Interspersing of integers by rationals")[ // Let $x$ be a rational number. Then there exists an integer $n$ such that $n <= x < n +1$. In particular, there exists a natural number $N$ such that $N > x$. // ]
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/wedges-rebuild/decide.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #show: create-body-entry.with( title: "Decide: Launcher Rebuild", type: "decide", date: datetime(year: 2023, month: 11, day: 29), author: "<NAME>", witness: "<NAME>", ) We rated each option in the following categories: - Reliability from 0 to 5 - Ease of fabrication from 0 to 5 - Ease of tuning from 0 to 5 #decision-matrix( properties: ( (name: "Reliability"), (name: "Ease of fabrication"), (name: "Ease of tuning"), ), ("Rebuild Wedge to use plastic", 1, 3, 2), ("Add plastic to Existing Wedges", 3, 1, 3), ("Create plastic Flap to Aid Existing Wedges", 2, 2, 1), ) #admonition( type: "decision", )[ We ending up choosing to add plastic over our existing wedges. This will provide them with the rigidity they need to not break, while still covering the whole front length of the bot. ] = CAD Overview Our new wedge design is pretty simple. It involves a simple hinged piece that goes over our current ones. A piece of plastic will be cut out and put over the half cut to make sure that nothing gets through. #figure(image("./cad-iso.png", width: 60%), caption: "Isometric view") We plan to laser cut the plastic cover out of acetal, but we will not get access to a laser cutter in time to get it cut. For now we'll cut polycarbonate out by hand and use that. #image("./technical-drawing-1.png")
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas1/4_Stvrtok.typ
typst
#let V = ( "HV": ( ("", "Prechváľniji múčenicy", "Apóstoli slávniji, Christóvy učenicý Bohozvánniji, vselénnyja učítelije, obrítše Hóspoda Bóha, i čelovíkov chodátaja súšča, tomú Bohoľípno priľípístesja: i jáko Bóha tohó, i jáko čelovíka vsesoveršénna, v míre jávi propovídaste."), ("", "", "Apóstoli vsemúdriji, Christóvy učenicý Bohozvánniji, vselénnyja učítelije, vášimi molítvami, božéstvennym učénijem vnimáti ukripíte mjá, i stezéju ťísnoju pomohájte chodíti mí vsehdá, jáko da dospíju v prebyvánije rájskoje prostránňijšeje."), ("", "", "Petrá pervoprestóľnaho vospiváju, Pavla, Jákova, Andréa že i Filíppa, Símona, Varfoloméa že i Fomú, Matféa že i Joánna, Márka že i Lukú, blahovístija spisávšich, lík Bohoizbránnyj, so inými sedmijúdesjaťmi, jáko Slóva samovídcy i propovídniki."), ("", "Nebésnych činóv", "Cerkóvnyja cvíty preletájaj: jákože ptenéc výšňaho hňizdá ánheľskaho, Nikólae treblažénne, zovéši prísno k Bóhu o vsích ľúdech, íže v núždnych bidách i iskušénijich, i izbavľáješi molítvami tvojími."), ("", "", "Nebésnyja dobróty prochoďáj, strášnuju ónu razumíl jesí slávu, svjatúju svjatých. Ťímže i nám nebésnaja slovesá, prísno živótnych óňich zrínij javľáješi, svjaščénňijšij ótče."), ("", "", "Svjaščénnyja odéždy ukrašénije, ďilateľnymi soďílal jesí dobroďítelmi svitľíjšo, ótče Bohonóse. Ťímže i nám svjaščennoďíjstvuješi dívnaja slávnych čudés Christá rádi ľútych nás izbavľája."), ("Bohoródičen", "", "Prehrišénij pučínoju oburevájem, k tíchomu pristánišču pribíh, prečísťij molítvi tvojéj, Bohorodíteľnice, vzyváju tí: spasí mja, krípkuju tvojú desnícu prostérši rabú tvojemú, vseneporóčnaja."), ), "S": ( ("", "", "Apóstoľskaja vseslíčnaja civníca, svjatým Dúchom dvížima, mérzkija bisóv žértvy uprazdníla jésť, i jedínaho Hóspoda propovídavši, jazýki izbávi ot prélesti ídoľskija, i poklaňátisja naučí Tróici jedinosúščňij."), ("", "", "Petrá i Pavla sohlásno pochválim, Lukú, Matféja, Márka, Joánna, Andréja, Fomú, Varfoloméja, Símona kananíta, Jákova i Filíppa, i vés lík učeníčeskij dostójno da voschválim."), ("Múčeničen", "Podóben", "Prechváľniji múčenicy, vás ni zemľá potaíla jésť, no nébo priját vý, i otverzóšasja vám rájskija dvéri, i vnútr bývše dréva živótnaho naslaždájetesja: Christú molítesja, darováti dušám nášym mír i véliju mílosť."), ("Bohoródičen", "", "Rádujsja rádoste práďidov, apóstolov i múčenikov vesélije, i pokróv nás Ďívo, tvojích rabóv.") ), ) #let P = ( "1": ( ("", "", "Písň posľídňuju pojím vsí Bóhu, sotvóršemu dívnaja čudesá mýšceju vysókoju, i spásšemu Izráiľa, jáko proslávisja."), ("", "", "Kupiná ťa voobražáše Bohorodíteľnice: óhň bo nosíla jesí voístinnu nepostojánnyj, prebývši neopáľna. Ťímže ťá vírnymi hlásy pisnoslóvim prísno."), ("", "", "Obólksja v čelovíka Bóh Slóvo, iz tebé páče smýsla voplotísja, prečístaja. Ťím ťá vsjákoje dychánije slavoslóvit, i poklaňájetsja tebí, i po dólhu čtít."), ("", "", "Začalá jesí prečístaja, neizrečénnoje Slóvo, vsjá soderžáščeje zemnýja koncý, i sijé rodilá jesí: jehóže molí priľížno, pomílovati nás."), ("", "", "Jáže jedína bezľítnaho Bóha v ľíto róždši voploščénna, prečístaja Vladýčice, strástnyja mojejá duší vseľítnyja strásti iscilí."), ), "3": ( ("", "", "Da utverdítsja sérdce mojé v vóli tvojéj Christé Bóže, íže nad vodámi nébo utverždéj vtoróje, i osnovávyj na vodách zémľu vsesíľne."), ("", "", "Da obožít čelovíčestvo, Bóh býsť čelovík, iz tebé Ďívo čístaja, páče slóva i smýsla: sehó rádi ťá sohlásno vírniji ublažájem."), ("", "", "Íže jestestvóm neopísannyj, voplóščsja iz tebé napisásja, Bohoblahodátnaja čístaja: jehóže neprestánno molí, uščédriti, i prosvitíti dúšy blažáščich ťá."), ("", "", "Neplódstvovavšija mýsli mojejá neplódija vsjá otžení, i plodonósnu dobroďíteľmi dúšu mojú pokaží, presvjatája Bohoródice, vírnych pomóščnice."), ("", "", "Izbávi mjá preneporóčnaja vsjákaho obstojánija, i mnóhich soblázn zmijévych, víčnujuščaho ohňá i ťmý, jáže svít róždšaja nám nevečérnij."), ), "4": ( ("", "", "Dúchom províďa proróče Avvakúme, Slovesé voploščénije, propovídal jesí vopijá: vnehdá priblížitisja ľítom, poznáješisja, vnehdá prijití vrémeni, pokážešisja: sláva síľi tvojéj Hóspodi."), ("", "", "V prečístoje tvojé črévo vselísja Christós, vsesvjatája Vladýčice, oboží nás, plóť prijém oduševlénnu. Ťím ťá čístuju Máter pravoslávno vospivájem, Vladýčice, míru pomóščnice."), ("", "", "Svjatája Bohoródice, osvjatí nás, jáže presvjatáho róždšaja plótiju, upodóbitisja choťívša čelovíkom: i nebésnaho cárstvija vsích javí, prečístaja, pričástniki molítvami tvojími."), ("", "", "Ďívo Bohoródice, neskvérnaja síne, oskvérnšahosja prehrišéňmi očísti mjá nýňi ščedrót tvojích čístymi zarjámi, i dážď mí rúku pómošči, da zovú: sláva síľi tvojéj Hóspodi."), ("", "", "Cérkov osvjaščénnaja Bóhovi javílasja jesí, v ťá vséľšemusja Ďívo páče umá: tohó molí, hrichóv nášich skvérnu očístiti: jáko da chrámy pokážemsja, i žilíšča Dúchu."), ), "5": ( ("", "", "Tvój mír dážď nám Sýne Bóžij, inóho bo rázvi tebé Bóha ne znájem, ímja tvojé imenújem, jáko Bóh živých i mértvych jesí."), ("", "", "Mértva mjá soďíla inohdá vo Jedémi vkušénije lukávoje: živót že róždši čístaja, íže drévom drévle umerščvlénnaho oživotvorí, da ťá slavoslóvja vospiváju."), ("", "", "Spasí mja vsečístaja, ot bíd ľútych: vozdvíhni ot strastéj hnójnych, i izbávi mjá pľinénija i ozloblénija lukávych bisóv, ľubóviju čtúščaho ťá."), ("", "", "Óblak i ráj, i dvér svíta, trapézu i runó znájem ťá, i stámnu vnútr mánnu nosjášču, sládosť míra, čístaja Ďívo Máti."), ("", "", "Róždši preneporóčnaja Bóha Jemmanújila, čelovíka jávi za milosérdije bývšaho: sehó molí jáko čelovikoľúbca čístaja, uščédriti ľúdi sohríššyja."), ), "6": ( ("", "", "Jáko Jónu proróka, vozvedí Christé Bóže živót mój ot tlí, vopijú ti čelovikoľúbče, jáko žízň u tebé jésť, i netľínije, i síla."), ("", "", "Oskvernénnaho mjá mnóhimi hrichí, moľú ťa súščuju blahúju i neskvérnuju skíniju: omýj ot vsjákija skvérny, chodátajstvom tvojím."), ("", "", "Okormlénije mí búdi čístaja, v ľúťij pučíňi žitéjskich napástej oburevájemomu, i nastávi k spasíteľnomu pristánišču, i spasí mja."), ("", "", "Trevolnénija pómysl, i strastéj naviďínija, i hlubiná hrichóv, okajánnuju mojú dúšu oburevájut: pomozí mi svjatája Vladýčice."), ("", "", "Svjaščénija síň pronarečénnaja Maríje, oskvernénnuju slasťmí okajánnuju mojú dúšu osvjatí, i božéstvennyja slávy pričástnika mjá sotvorí."), ), "S": ( ("", "Hrób tvój Spáse", "Ďívo i pitáteľnice jedínomu ot Tróicy, rajú krásnyj, zemných spasénije, pokróvom tvojím spásáj blahočéstno vospivájuščich ťá: tý bo rodilá jesí vo prorócich hlahólavšaho, tý nosíla jesí soderžáščaho vsjáčeskaja, jáko Máti Christá Bóha."), ), "7": ( ("", "", "Súščym v peščí otrokóm tvojím Spáse, ne prikosnúsja, nižé stuží óhň. Tohdá trijé jáko jedíňimi ustý pojáchu i blahoslovľáchu, hlahóľušče: blahoslovén Bóh otéc nášich."), ("", "", "Beznačáľnaho Otcá Sýn vo črévo tvojé vselísja, priím načálo: jáko da nás izbávit jáko Bóh, ot lukávych načál ťmý, Bohorodíteľnice čístaja, kláňajuščichsja jemú."), ("", "", "Ispeščréna božéstvennymi dobroďíteľmi, čístaja Ďívo, rodilá jesí Slóvo, sobeznačáľnoje Otcú, dobroďíteľmi nebesá voístinnu pokrývšeje: jehóže molí prísno uščédriti nás."), ("", "", "Osvjatí náša pomyšlénija, utverdí vsích dúšy Máti Bóžija, tvoríti dóbri opravdánija, za milosérdije neizrečénnoje, voploščénnaho iz tebé Ďívo Slóva beznačáľnaho Otcá."), ("", "", "Umerščvlénnyj strasťmí mnóhimi preneporóčnaja, oživí úm mój, i Bohouhódnaja tvoríti ukripí mja, da veličáju ťá jáko zastúpnicu prísno christiján i upovánije."), ), "8": ( ("", "", "Jehóže užasájutsja ánheli, i vsjá vójinstva, jáko tvorcá i Hóspoda, pójte svjaščénnicy, proslávite ótrocy, blahoslovíte ľúdije, i prevoznosíte vo vsjá víki."), ("", "", "Izbavľájemsja preneporóčnaja, tvojími k Bóhu bďínnymi molítvami vsjáčeskich iskušénij, ťá Bohoródicu znájuščiji blahoslovénnuju i prerádovannuju."), ("", "", "Voploščájetsja bezplótnyj iz tebé Bohoľípno: jehóže molí prečístaja, strásti plóti tvojejá umertvíti, i oživíti mojú dúšu umerščvlénuju hrichí."), ("", "", "Isciľívšaho sokrušénije Adáma pérstnaho Spása róždšaja prečístaja i Bóha: jehóže molí, jázvy duší mojejá iscilíti, neiscíľno boľáščyja."), ("", "", "Vozstávi ležáščaho vo hlubiňí zól, i jáže nýňi borjúščyja mjá pobidí vrahí, sňídšyja bezmístnymi slasťmí dúšu mojú: ne prézri mené čístaja, no uščédri i spasí mja."), ), "9": ( ("", "", "Svitonósnyj óblak, vóňže vsích Vladýka, jáko dóžď s nebesé na runó sníde, i voplotísja nás rádi, býv čelovík, beznačáľnyj, veličájem vsí jáko Máter Bóha nášeho čístuju."), ("", "", "Svít božéstvennyj róždšaja, preneporóčnaja, ot Otcá vozsijávšij, omračénnuju mojú dúšu lesťmí žitijá, i bývšuju vrahóm posmích, uščédri, i svítu pokajánija spasíteľnaho spodóbi, čístaja."), ("", "", "Svitovídnyj ťá óblak, preneporóčnaja, Isáia zrjáše, iz nehóže vozsijá nám sólnce právednoje: tájno tvár prosvití: sehó rádi ťá víroju vospivájem dóbruju v ženách."), ("", "", "Hrichoľubív sýj v ľínosti živú, i sudíšča, čístaja, neumýtnaho trepéšču, na némže mjá sobľudí, tvojími svjatými moľbámi, Ďívo Bohonevísto, neosuždénaho: da jáko zastúpnicu ublažáju ťá prísno."), ("", "", "Trepéšču sudíšča Ďívo, i nezabýtnaho očesé tvojehó Sýna, soďílav mnóhi hrichí na zemlí. I sehó rádi tebí vopijú: vsemílostivaja Vladýčice, pomozí mi, i tohdášnija mjá núždy izmí neosuždénnaho čístaja."), ), ) #let U = ( "S1": ( ("", "", "Premúdriji vselénnyja lovcý, ot Bóha prijémšiji mílostivnoje, molíte i nýňi o nás vopijúščich: Hóspodi, spasí hrád tvój, i ot oderžáščich zól svobodí apóstol rádi dúši náša."), ("", "", "Trubý Christóvy blahohlásnyja, v písnech da počtím vírniji premúdryja apóstoly, kóni, vozmutívšyja bezbóžija móre, i privlékšyja jáko iz hlubiný čelovíki, k božéstvennomu spasénija pristánišču, blahodátiju Dúcha."), ("Bohoródičen", "", "Neoborímuju sťínu sťažávše vírniji Bohoródicu Maríju, prijidíte poklonímsja i pripadém k néj: derznovénije bo ímať k róždšemusja iz nejá, i mólitsja, i spasájet ot hňíva i smérti dúši náša."), ), "S2": ( ("", "", "Mréžeju slovésnoju pleténija rítorskaja, rýbarije tróstiju kréstnoju razvérhše, prosvitíša jazýki, blahočéstno sláviti ťá Bóha ístinnaho, ťímže tí písň ukrípľšemu ích vopijém: sláva Otcú, i Sýnu, sláva jedinosúščnomu Dúchu, sláva ťími prosvitívšemu mír."), ("", "", "Svít ot svíta bezľítno prosijáv, v ľíto plótiju na zemlí javísja, i mír prosvití, vámi vseblážénniji. Ťímže vsí učéňmi vášimi božéstvennymi prosvíščšesja, svjaščénnuju vášu pámjať počitájem apóstoli."), ("Múčeničen", "", "Múčeniki Christóvy mólim vsí ot ľubvé prišédše k ním s víroju: síji bo o nášem spáséniji prósjat, síji istočájut iscilénij blahodáť, síi polkí othoňájut bisóvskija, jáko sochránnicy víry."), ("Bohoródičen", "", "Upovánije Christiján, presvjatája Ďívo, jehóže rodilá jesí Bóha, páče umá i slóva, neprestánno molí o vospivájuščich ťá, podáti ostavlénije hrichóv nášich vsích i ispravlénije žitijá, víroju i ľubóviju prísno slávjaščym ťá."), ), "S3": ( ("", "", "Svitíla mýslennaja učenicý Spásovy svítliji, jáko óhň ozaríste vsejá zemlí ispolnénije božéstvennymi učéniji: ťímže moľúsja, jáže vo ťmí dúšu mojú prosvitíte, svitozárnymi lučámi vášimi vseblažénniji."), ("", "", "V Mírich živýj čúvstvenno svjatíteľu, jáko mírom razúmno duchóvnym javílsja jesí pomázan Ótče Nikólae, i míry čudés tvojích oblahouchál jesí, míro prisnotekúščeje prolivája, mírnymi tvojími blahouchájemi písňmi, i pámjatiju tvojéju."), ("Bohoródičen", "", "Prorócy ťá jásno provozvistíša otrokovíce, Máter Bóžiju: i apóstoli božéstvenniji v míri propovídaša, i mý virovachom. Ťímže vsí blahočestnomúdrenňi počitájušče vospivájem ťá, i Bohoródicu voístinnu prísno imenújem."), ), "K": ( "P1": ( "1": ( ("", "", "Tvojá pobidíteľnaja desníca Bohoľípno v kríposti proslávisja: tá vo bezsmértne, jáko vsemohúščaja, protívnyja sotré, Izráiľťanom púť hlubiný novosoďílavšaja."), ("", "", "Božéstvennymi prosvitívšesja zarjámi trisólnečnaho sijánija slávniji, položénijem narekóstesja voístinnu bózi, svitovídniji apóstoli: ťímže po dólhu vás víroju počitájem."), ("", "", "Božéstvennymi prosvitívšesja zarjámi trisólnečnaho sijánija slávniji, položénijem narekóstesja voístinnu bózi, svitovídniji apóstoli: ťímže po dólhu vás víroju počitájem."), ("", "", "Slóva jávľšahosja na zemlí za milosérdije debeľstvóm plóti, uhódniji služítelije, i jehó vsích poveľínij ispolnítelije víroju býste, prísno počitájetesja apóstoli."), ("", "", "Svítlymi lučámi presvjatáho Dúcha prísno blažénniji, vsehó mja prosvitíte, hrichóv ťmóju pokryvájemaho, i k pokajánija putí jávi nastávite."), ("Bohoródičen", "", "Jáže apóstolov rádosť Bohorodíteľnice vseneporóčnaja Vladýčice, jáko Máti bývši v ťích Bohoľípno hlahólavšemu, s nímiže molísja, ohňá hejénny izbáviti mjá."), ), "2": ( ("", "", "Písň pobídnuju pojím vsí Bóhu, sotvóršemu dívnaja čudesá mýšceju vysókoju, i spásšemu Izráiľa, jáko proslávisja."), ("", "", "Vincý ukrašájem právednymi, i prestólu blahodáti predstojá Nikólaje, íže písňmi ťá nýňi vinčavájuščija vírno, prísno spasáj molítvami tvojími."), ("", "", "Íže blahodáť prijém iscilénij vseblažénne Nikólaje, duší mojejá jázvy molítvami tvojími iscilí, i nachoďáščich iskušénij izbávi mjá, moľúsja."), ("", "", "Krípkoju Nikólaje tvojéju molítvoju, vserazsláblennuju dúšu mojú prehrišéňmi iscilí, i žitijá zloľútych izbávi mjá, moľúsja."), ("Bohoródičen", "", "Umá mojehó omračénije, vseneporóčnaja, svítom tvojím otžení, i ťmý véčnujuščija izbávi mjá, jáko da pojú vsehdá velíčija tvojá."), ), ), "P3": ( "1": ( ("", "", "Jedíne vídyj čelovíčeskaho suščestvá némošč, i mílostivno v né voobrážsja, prepojáši mjá s vysotý síloju, jéže vopíti tebí svjatýj: oduševlénnyj chráme neizrečénnyja slávy tvojejá čelovikoľúbče."), ("", "", "Íže jedín nevídimyj Bóh, vídim býsť voploščájem, i učenikí vás izbráv vo vsém míri, jehó ímja i prevoschoďáščuju slávu propovídajuščich, preblažénniji božéstvenniji apóstoli."), ("", "", "Íže jedín nevídimyj Bóh, vídim býsť voploščájem, i učenikí vás izbráv vo vsém míri, jehó ímja i prevoschoďáščuju slávu propovídajuščich, preblažénniji božéstvenniji apóstoli."), ("", "", "Tebí jedínomu sohriších Christé, tebí jedínomu bezzakónnovach, i dúšu zlými oskverních: tvojéju mílostiju očísti i spasí mja, imíjaj moľáščyja ťá, jedíne blahopremeníteľu Iisúse, premúdryja apóstoly tvojá."), ("", "", "Hórestej strástnych skvérn, i hóresti hrichóvnyja izbávite mjá jáko mílostiviji apóstoli, i pokajánijem oslaždájušče mojú mýsľ, jáko božéstvennuju nosjášče sládosť v sérdci vsechváľniji."), ("Bohoródičen", "", "S neveščéstvennymi služíteli, Ďívo neiskusobráčnaja, so vsími výšnimi sílami, s múčeniki i apóstoly, Christá, jehóže voplotíla jesí ot čístych krovéj tvojích: umolí spastísja rabóm tvojím."), ), "2": ( ("", "", "Da utverdítsja sérdce mojé v vóli tvojéj Christé Bóže, íže nad vodámi nébo utverždéj vtoróje, i osnovávyj na vodách zémľu vsesíľne."), ("", "", "Pervosvjaščénnikov udobrénije, blahouchánije božéstvennaho Dúcha, mirovónnymi tvojími molítvami zlosmrádnyja strásti otžení sérdca mojehó, Nikólaje múdre, ľubóviju moľúsja."), ("", "", "V ľínosti skončaváju mojú žízň okajánnyj, i bojúsja strášnaho tvojehó sudíšča Christé: na némže ne posramí mené, Nikolája chodátajstvy svjaščénnymi umolén byvája."), ("", "", "Preispeščrén božéstvennoju blahodátiju , svjatíteľu Nikólaje ótče, ot razlíčnych iskušénij i bíd spasí, pribihájuščyja v króv tvój prísno vseblažénne."), ("Bohoródičen", "", "Izbávi mjá ot vsích napástej, i ot mnóhich soblázn zmíjevych, i ot víčnaho ohňá i ťmý, vseneporóčnaja, jáže svít róždšaja nám nevečérnij."), ), ), "P4": ( "1": ( ("", "", "Hóru ťá blahodátiju Bóžijeju priosinénnuju, prozorlívyma Avvakúm usmotrív očíma, iz tebé izýti Izráilevu provozhlašáše svjatómu, vo spasénije náše i obnovlénije."), ("", "", "Móre bezbóžija i nevírstva vozmutívše, jaždénijem vášim, kóni Bohoizbránniji Christóvy apóstoli: vrahá potopíste mýslennaho, i potoplénnyja čelovíki izvlekóste ko spáséniju."), ("", "", "Móre bezbóžija i nevírstva vozmutívše, jaždénijem vášim, kóni Bohoizbránniji Christóvy apóstoli: vrahá potopíste mýslennaho, i potoplénnyja čelovíki izvlekóste ko spáséniju."), ("", "", "Prijátelišče Dúcha božéstvennych sijánij apóstoli, omračénnuju mojú dúšu, i prijátnu vsjáčeskich strastéj bývšuju, svítom pokajánija prosvitíte Bohoblažénniji božéstvenniji apóstoli."), ("", "", "Óblacy, íže vódu živótnuju odoždívšiji, izsóchšuju mojú dúšu bezdóždijem strastéj božéstvenňi napójte, i dobroďítelej vozrastíti klásy sotvoríte spasénija, apóstoli vsechváľniji."), ("Bohoródičen", "", "Prorócy, apóstoli prechváľniji, múčenicy, s Máteriju izbávitelevoju molítesja priľížno, jáko da izbávimsja ot hrichóv, i véčnyja múki, i iskušénij, i bíd, i skorbéj."), ), "2": ( ("", "", "Dúchom províďa proróče Avvakúme, slovesé voploščénije, propovídal jesí vopijá: vnehdá priblížitisja ľítom, poznáješisja, vnehdá prijití vrémeni, pokážešisja: sláva síľi tvojéj Hóspodi."), ("", "", "Jáko vsích poveľínij Bóžijich ispólniteľ, ótče svjatíteľu Nikólaje, sobľudáti pospiší nám molítvami tvojími, jáže na zemlí zakonopoložénija ko spaséniju vedúščaja, i izbávi vsích napástej nachoďáščich."), ("", "", "Tečénije tvojé skončáv prepodóbno o Chrisťí, putí náša isprávi, jáže k nemú ótče Bohonósne Nikólaje, jáko da ubižávše bezpútnaho blužénija, ko spasíteľnomu dostíhnem soveršéniju."), ("", "", "Íže vsjá kózni vrážija uspív, božéstvennymi bodrosťmí, Nikólaje premúdre, bďáščich, i Bóha vospivájuščich, i tebé chodátaja k nemú predlahájuščich, vsích nás ótče oblahodatí."), ("Bohoródičen", "", "Razumív prorók Dúchom Bóžijim, hóru ťá priosinénnuju prednapisáv čístaja, istájavšyja znójem mnóhich prehrišénij, tvojími blahoprijátnymi chodátajstvy Bohoródice nýňi prochladí, i blahodátiju ."), ), ), "P5": ( "1": ( ("", "", "Prosvitívyj sijánijem prišéstvija tvojehó Christé, i osvitívyj krestóm tvojím míra koncý, serdcá prosvití svítom tvojehó Bohorazúmija, pravoslávno pojúščich ťá."), ("", "", "Kápľuščyja sládosť i krásnoje vesélije, javístesja hóry vseslávniji apóstoli, hóresť vsjú vrážiju otémľušče, i vírnyja naslaždájušče."), ("", "", "Kápľuščyja sládosť i krásnoje vesélije, javístesja hóry vseslávniji apóstoli, hóresť vsjú vrážiju otémľušče, i vírnyja naslaždájušče."), ("", "", "Prišédša stránna Christá vo svojá razumíste, i ískrenno tomú priľipístesja. Ťímže ot čuždáho mjá izbávite vréda, božéstvenniji Slóva apóstoli."), ("", "", "Tájnyja duší mojejá iscilí jázvy, molítvami svjaščénno v míri propovídavšich božéstvennoje tvojé prišéstvije, i strásti ščédre, i jéže iz hróba voskresénije."), ("Bohoródičen", "", "So vsími bezplótnymi, jehóže voplotíla jesí Bóha Slóvo, páče slóva, Bohoródice Ďívo molí, ot bezslovésnych ďijánij i plotskích strastéj svobodítisja rabóm tvojím."), ), "2": ( ("", "", "Svítlyj nám vozsijáj svít prisnosúščnyj, útreňujuščym o suďbách zápovidej tvojích, Vladýko čelovikoľúbče Christé Bóže náš."), ("", "", "Vo dvorích Hospódnich nasaždén svjatíteľu ótče Nikólaje, i jáko plodovítaja máslina, blahodátiju umaščáješi nýňi vsích líca, jeléjem trudóv tvojích."), ("", "", "Moľbú nýňi sotvorí ótče Nikólaje, o rabích tvojích: jáko da ostavlénije sohrišénij prijímem, i ot oderžáščija skórbi izbávimsja, i vsjákija ťisnotý."), ("", "", "Tebé mólim Nikólaje, blaháho chodátaja ko Hóspodu: ne ostávi nás svjáte bez zastuplénija. no obýčnoju tvojéju molítvoju spasáj."), ("Bohoródičen", "", "Svitovídnyj Christóv chráme, otrokovíce Bohoblahodátnaja, molítvami tvojími, Otcú, i Sýnu, i Dúchu, i nás chrámy sotvorí, prepodóbnaja soďivájuščich."), ), ), "P6": ( "1": ( ("", "", "Obýde nás posľídňaja bézdna, ňísť izbavľájaj, vminíchomsja jáko óvcy zakolénija, spasí ľúdi tvojá, Bóže náš: tý bo kríposť nemoščstvújuščich i ispravlénije."), ("", "", "Mréžami slovésnymi ulovíste jazýki, k rázumu javlénnaho nazdánija čelovíkov, o Bohoblažénniji apóstoli: jehóže priľížno o míri molíte."), ("", "", "Mréžami slovésnymi ulovíste jazýki, k rázumu javlénnaho nazdánija čelovíkov, o Bohoblažénniji apóstoli: jehóže priľížno o míri molíte."), ("", "", "Dušé mojá smirénnaja, dušé okajánnaja, dušé nepokájannaja, pokájsja, i vozopíj Christú: sohriších, očísti mjá Vladýko čelovikoľúbče, molítvami apóstol tvojích, jáko preblahíj."), ("", "", "Íže drévle Izráiľu istočívyj vódu iz kámene vsesíľne, razriší mi omračénije Christé, i prinosíti tóki sléz sotvorí, molítvami apóstol tvojích, jáko mnohomílostiv, da vospiváju i veličáju tvojé blahoutróbije."), ("Bohoródičen", "", "Ďívo, iz tebé za bláhosť rodítisja blahoizvólivšaho umolí, jáko tvorcá i Bóha, spastí ot iskušéniji i napástej, na ťá presvjatája, vsehdá upovánije imúščich."), ), "2": ( ("", "", "Pror<NAME> podražája vopijú: živót mój bláže, svobodí iz tlí, i spasí mja, Spáse míra, zovúšča: sláva tebí."), ("", "", "Imíjaj mnóžestvo ščedrót Christé, mnóžestvo mojích zól otžení molítvami Nikolája, okormľája mojú žízň, volnámi hrichá oburevájemuju prísno."), ("", "", "Krípko vrahá poprál jesí múdre, jehóže sokrušáti i nás tvojími molítvami ukripí Nikólaje, tobóju predstátelem božéstvennym obohatívšichsja."), ("", "", "Íže Mírjanom býv pervosvjatíteľ ístinnyj, oblahoucháj náša čúvstva dušévnaja ótče Nikólaje, i vraždújuščyja na ný zlosmrádnyja strásti othoňáj prísno."), ("Bohoródičen", "", "Velíčija tebí čístaja, sotvorí Christós: jehóže molí prísno, vozvelíčiti v nás bohátyja jehó mílosti, Bohoblahodátnaja."), ), ), "P7": ( "1": ( ("", "", "Tebé úmnuju Bohoródice, péšč razsmotrjájem vírniji: jákože bo ótroki spasé trí prevoznosímyj, mír obnoví, vo črévi tvojém vsecíl, chváľnyj otcév Bóh, i preproslávlen."), ("", "", "Istóčnik životá Iisús Hospóď sýj, vás ostávi učenikí jákože ríki, vodámi napajájuščyja Bohorazúmija vsjú podsólnečnuju, i pojúščyja: chváľnyj otcév Bóh i preproslávlen."), ("", "", "Istóčnik životá Iisús Hospóď sýj, vás ostávi učenikí jákože ríki, vodámi napajájuščyja Bohorazúmija vsjú podsólnečnuju, i pojúščyja: chváľnyj otcév Bóh i preproslávlen."), ("", "", "Óhň mýslennyj v sérdci nosjášče, božéstvennuju blahodáť Christóvu, požhóste učenicý véšč bezbóžija. Ťímže véščnyja mojá strásti popalíte vopijúščaho: chváľnyj otcév Bóh, i preproslávlen."), ("", "", "Óhnennaho mučénija izbávi mjá Bóže, molítvami slávnych tvojích učeník, i ne otvérži mené ot licá tvojehó Hóspodi, v pokajániji vzyvájušča: chváľnyj otcév Bóh, i preproslávlen."), ("Bohoródičen", "", "Tletvórnych hrichóv i strastéj izmí mja Hóspodi, íže netľínno rodívyjsja ot Ďívy Bohomátere, vsím že netľínije dáruja, písnenno pojúščym: chváľnyj otcév Bóh, i preproslávlen."), ), "2": ( ("", "", "Súščym v peščí otrokóm tvojím Spáse, ne prikosnúsja, nižé stuží óhň. Tohdá trijé, jáko jedíňimi ustý pojáchu i blahoslovľáchu, hlahóľušče: blahoslovén Bóh otéc nášich."), ("", "", "Račíteľnoju molítvoju tvojéju múdre, sérdca mojehó utverdí hlézňi izvístno, na kámeni Bóžijich zápovidej presvítlych, spasája nepremínno Nikólaje, ot kovárstv pákostnych zlonačáľnaho vrahá."), ("", "", "Razrišénije nám mnóhich hrichóv isprosí, sitej žitéjskich i núždnych, i iskušénij vsjáčeskich nachoďáščich, svjaščénne Nikólaje, vsích vírnych zastúpniče, i svjatítelej osnovánije."), ("", "", "Íže sokrývyj ráb lukávyj talánt, jehóže v ďílanije blahovosprijém áz jésm: i bojúsja támošňaho sudíšča, na némže sudijé Bóže vsích, ne osudí mené, molénija rádi svjatáho Nikolája."), ("Bohoródičen", "", "Tebé vsesvjatája, prečístaja, rabí tvojí vsehdá, vo dní i v noščí mólim sokrušénnoju mýsliju, prosjášče izbavlénija hrichóv nášich, dáti tvojími molítvami, čístaja."), ), ), "P8": ( "1": ( ("", "", "V peščí ótrocy Izráilevy, jákože v horníľi, dobrótoju blahočéstija čisťíje zláta bleščáchusja, hlahóľušče: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte vo vsjá víki."), ("", "", "Jáko lučí sólnce velíkoje vás prostré vo vsjú vselénnuju, ozarjája víroju pojúščich apóstoli: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte jehó vo víki."), ("", "", "Jáko lučí sólnce velíkoje vás prostré vo vsjú vselénnuju, ozarjája víroju pojúščich apóstoli: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte jehó vo víki."), ("", "", "Jáko pástyrije súšče slovésniji, jáko áhncy pástyrja, jáko óvcy áhnca izbáviteľa nášeho Christá, bohovídcy apóstoli molíte neprestánno, ot mýslennaho mjá vólka izbáviti, i spasájemych části spodóbiti mjá."), ("", "", "Preokajánnaja dušé, stení i vozopíj Hóspodevi: sohriších páče vsích, i bezzakónnovach ľúťi: očísti i spasí mja jáko bludnícu, jáko mytarjá, jákože razbójnika ščédre, apóstolov molítvami blahoprijátnymi."), ("Bohoródičen", "", "So ánhely <NAME>, so apóstoly, i múčeniki, i so proróki umolí Christá, spastí vzyvájuščyja: blahoslovíte vsjá ďilá Hospódňa Hóspoda, pójte i prevoznosíte jehó vo víki."), ), "2": ( ("", "", "Jehóže užasájutsja ánheli, i vsjá vójinstva, jáko tvorcá i Hóspoda, pójte svjaščénnicy, proslávite ótrocy, blahoslovíte ľúdije, i prevoznosíte vo vsjá víki."), ("", "", "Na horí stojá božéstvennych dobroďítelej, koncém znájem čudés vysókich, Nikólaje, javílsja jesí pokazáňmi: ťímže vsják jazýk počitájet ťá vo vsjá víki."), ("", "", "Vkusív prepodóbne božéstvennyja sládosti, hóresť voznenavíďil jesí strastéj i slastéj: ot níchže nás izbávi moľá Christá, vostajúščyja bidý utolíti."), ("", "", "Jáko stólp nepokolebím, i utverždénije vírnych, prísno mjá koléblema žitéjskimi zlóbami, i bisóvskimi dochnovéniji, ukripí vseblažénne Nikólaje, molítvami tvojími."), ("Bohoródičen", "", "Uvračúj prečístaja strásti sérdca mojehó, róždšaja vsích vračá, i právednych části javí mja pričástnika, Ďívo, Christá umolívši."), ), ), "P9": ( "1": ( ("", "", "Óbraz čístaho roždestvá tvojehó, ohnepalímaja kupiná pokazá neopáľnaja: i nýňi na nás napástej svirípejuščuju uhasíti mólimsja péšč, da ťá Bohoródice neprestánno veličájem."), ("", "", "Božéstvenniji svjatáho Dúcha, i svitozárniji svitíľnicy pokazástesja, svitozarénijem čestnáho i premúdraho propovídanija blažénniji, prosvitíste vsjú vselénnuju, ťmú ídoľskuju othnávše."), ("", "", "Božéstvenniji svjatáho Dúcha, i svitozárniji svitíľnicy pokazástesja, svitozarénijem čestnáho i premúdraho propovídanija blažénniji, prosvitíste vsjú vselénnuju, ťmú ídoľskuju othnávše."), ("", "", "Božéstvennaho mýslennaho vinohráda lózije bývše, božéstvennoje hrózdije vozrastíste, istočájušče spasíteľnoje vinó slávniji apóstoli. Ťímže mjá ot pijánstva slastéj izbávite."), ("", "", "Trepéšču okajánnyj pomyšľája strášnoje óno Christé mój sudíšče tvojé, ďijáňmi bo stúdnymi i skvérnymi nýňi obložén jésm, i préžde sudá osuždén: ťímže mjá apóstol tvojích molítvami uščédri."), ("Bohoródičen", "", "Jedína čelovíki obožíla jesí, voploščénno Slóvo poróždši: jehóže molí so apóstoly i múčeniki prečístaja, Ďívo vseneporóčnaja, o nás víroju ublažájuščich i čtúščich ťá."), ), "2": ( ("", "", "Svitonósnyj óblak, vóňže vsích Vladýka, jáko dóžď s nebesé na runó sníde, i voplotísja nás rádi, býv čelovík, beznačáľnyj, veličájem vsí jáko Máter Bóha nášeho čístuju."), ("", "", "Jáko Christóva svjatíteľa, jáko svitozárnuju zvizdú, jáko čudés samoďíjstvennika, jáko istóčnika iscilénij, jáko súščym v skórbech pomóščnika, jáko izbáviteľa tepľíjša prizyvájuščym ťá v bidách ótče, voschvaľájem písňmi svjaščénnymi."), ("", "", "Ťá pástyrja velíkaho, i podražáteľa vo vsém načáľnaho pástyrja Christá, priľížno mólim Nikólaje: ot vysót svjaščénnych upasí rabý tvojá, i izbavľáj ot vsích žitéjskich napástej vsehdá."), ("", "", "Užé konéc približájetsja, čtó ľiníšisja, o dušé mojá? Počtó ne tščíšisja Bóhovi blahouhódno požíti? Potščísja i vozníkni próčeje, i vozopíj: čelovikoľúbče, uščédri mjá, Nikolája molítvami okormľája mojú žízň, jáko bláh."), ("Bohoródičen", "", "Jáže svít róždšaja božéstvennyj, omračénaho mjá vsími prilóhi lukávaho, i vo unýniji živúšča, i prohňívajušča Bóha, prosvití vseneporóčnaja, i nastávi k dóbrym ďílanijem, jáko viná súšči vsích dóbrych."), ), ), ), "ST": ( ("", "", "Apóstoli slávniji, prosvitívše vselénnuju, prísno Bóha molíte, spastísja dušám nášym."), ("", "", "Petrá i Pavla sohlásno pochválim: Lukú, Matféja, Márka, Joánna, Andréja, Fomú, Varfoloméja, Símona kananíta, Jákova i Filíppa, i vés lík učeníčeskij dostójno da voschválim."), ("Múčeničen", "", "Veselítesja múčenicy o Hóspoďi, jáko pódvihom dóbrym podvizástesja: protívistesja carém, i mučítelej pobidíste: ohňá i mečá ne ustrašístesja, i zviréj dívijich sňidájuščich ťilesá váša: Christú so ánhely písň vozsylájušče, s nebesé vincý prijáste: prosíte darováti míru mír, i dušám nášym véliju mílosť."), ("Bohoródičen", "", "Rádujsja Bohoródice Ďívo, rádujsja pochvaló vsejá vselénnyja, rádujsja prečístaja Máti Bóžija blshoslovénnaja."), ) ) #let L = ( "B": ( ("", "", "Sňídiju izvedé iz rajá vráh Adáma: krestóm že vvedé Christós vóň razbójnika, pomjaní mja Hóspodi, vopijúšča, jehdá priídeši vo cárstviji tvojém."), ("", "", "Koncý prosvitívše božéstvennymi lučámi učénij vášich, omračénije ľútaho bezbóžija razoríli jesté, i k svítu nezachodímomu prišédše, prísno blažími jesté."), ("", "", "Ótečeskuju ipostásnuju imívše premúdrosť, učenicý Christóvy, vsích vás umudrjájuščuju, bújstvom propovídanija mír umudríli jesté, i k rázumu božéstvennomu privedóste."), ("Múčeničen", "", "Múki preterpévše, jákože bezplótniji Christóvy stradálcy, i vsjá bezplótnyja vrahí krípko pobedíli jesté. ťím blážími jesté vo víki dostójno, vsechválniji."), ("", "", "Tróice poklonímsja, so Otcém Sýnu, i Dúchu právomu vírniji, nerazďíľňijj, i nerazlúčňij, i soprestóľňij jedínici, vopijúšče: svját, svját, svját jesí, Tróice vsečestnája."), ("", "", "Blažím ťá prečístaja, jákože proreklá jesí, Bóha vo vo plóti rodilá jesí, jehóže propovída lík apóstoľskij: s nímiže isprosí nám prehrišénij razrišénije, vsepítaja."), ) )
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Documentazione%20interna/Verbali/23-11-10/23-11-10.typ
typst
#import "/template.typ": * #show: project.with( date: "10/11/23", subTitle: "Organizzazione delle attività", docType: "verbale", authors: ( "<NAME>", ), timeStart: "14:00", timeEnd: "15:00", ); = Ordine del giorno - Retrospettiva sullo sprint terminato; - Divisione dei ruoli e formazione sottogruppi di lavoro; - Organizzazione attività da svolgere. == Retrospettiva In questo primo meeting di retrospettiva sono state analizzate le attività svolte dal gruppo durante la settimana e, in modo particolare, sono state discusse le nuove automazioni implementate con GitHub Actions (per la compilazione ed il caricamento automatico in repository e nel sito web dei file legati alla documentazione con i relativi changelog). \ Si è discusso del cambiamento attuato sulle tecnologie di markup per la stesura dei documenti, passando da LaTeX a Typst, strumento che risulta più comodo e immediato da usare.\ È stato analizzato il diario di bordo che verrà esposto lunedì 13 novembre, in particolar modo riguardo le difficoltà riscontrate.\ Nel fine settimana è importante che ciascun membro del gruppo pensi ad eventuali domande da aggiungere. == Divisione ruoli I ruoli all'interno del gruppo e le mansioni future sono state assegnate più specificatamente: \ - Antonio è responsabile, pertanto lunedì esporrà il diario di bordo; - Alessio è verificatore; - <NAME> e Riccardo sono amministratori; - Mattia e Rosario sono analisti. Il gruppo è stato inoltre suddiviso in tre sottogruppi: \ - tre membri del gruppo si impegneranno per implementare ulteriormente le automazioni e sistemare il repository; - due membri del gruppo si concentreranno sull'Analisi dei Requisiti; - due membri del gruppo miglioreranno la nostra analisi delle ore/ruoli in luce del giudizio del professor Vardanega il quale ha ritenuto il costo del progetto eccessivo. = Azioni da intraprendere - Inviare nuova mail al Proponente, poichè non si è ricevuta una risposta a quella precedente; - Proseguire il lavoro relativo all'Analisi dei Requisiti cosicché, la prossima settimana, si potrà chiedere al professor <NAME>li e delucidazioni sulla direzione data dal gruppo al lavoro; - Identificare le features da implementare per la futura realizzazione del PoC; - Iniziare lo studio e la sperimentazione delle tecnologie correlate necessarie allo sviluppo del PoC.
https://github.com/mitinarseny/invoice
https://raw.githubusercontent.com/mitinarseny/invoice/main/src/items.typ
typst
#import "./utils.typ": format_date, end_of_month #let items(service, ..additional_items) = [ == Items #let total = float(service.amount) #if "to" not in service.period { service.period.to = end_of_month(service.period.from) } #align(horizon, table( columns: (9fr, 2fr), align: (left, center), stroke: 0.4pt, table.header( [*Description*], [*Amount (USD)*] ), [ #eval(service.description, mode: "markup") for the period from *#format_date(service.period.from)* to *#format_date(service.period.to)* #if "contract" in service [ under the contract #if "ref" in service.contract [ _#service.contract.ref _ ] #if "dated" in service.contract [ dated #format_date(service.contract.dated) ] ] ], str(service.amount), ..for (description, amount) in additional_items.pos() { total += float(amount) ( eval(description, mode: "markup"), str(amount), ) }, table.cell(stroke: none, align(right)[*Total*]), [#total\*], table.cell(stroke: none, align(right)[*Including VAT*]), [Without VAT], table.cell(stroke: none, align(right)[*Total to pay*]), [#total\*], )) #text(size: 0.8em)[\* All payments made by the Company are net of and not subject to any withholding or deduction of any fees, taxes or duties, and must arrive to the Contractor's bank account in full, with consideration of the all bank fees and charges (including those of the bank-correspondent).] ]
https://github.com/fredguth/abnt-typst
https://raw.githubusercontent.com/fredguth/abnt-typst/main/README.md
markdown
# ABNT-Typst Um template de documento abnt para dissertações e teses. _em construção!_ ## Uso ```sh typst watch tese_abnt.typ --root . ``` ## Exemplo ![PDF exemplo](https://github.com/fredguth/abnt-typst/blob/main/tese_abnt.pdf) ## Estrutura Parte externa - [x] Capa (obrigatório) - [ ] Lombada (opcional) Parte interna Elementos pré-textuais - [x] Folha de rosto (obrigatório) - [ ] Errata (opcional) - [ ] Folha de aprovação (obrigatório) - [x] Dedicatória (opcional) - [x] Agradecimentos (opcional) - [x] Epígrafe (opcional) - [x] Resumo na língua vernácula (obrigatório) - [x] Resumo em língua estrangeira (obrigatório) - [ ] Lista de ilustrações (opcional) - [ ] Lista de tabelas (opcional) - [ ] Lista de abreviaturas e siglas (opcional) - [ ] Lista de símbolos (opcional) - [x] Sumário (obrigatório) Elementos textuais [^1] - [x] Introdução - [x] Desenvolvimento - [x] Conclusão Elementos pós-textuais - [x] Referências (obrigatório) - [ ] Glossário (opcional) - [ ] Apêndice (opcional) - [ ] Anexo (opcional) - [ ] Índice (opcional) [^1]: A nomenclatura dos títulos dos elementos textuais fica a critério do autor. - [NBR 10520:2002](http://www2.uesb.br/biblioteca/wp-content/uploads/2016/05/NBR-10520-CITA%C3%87%C3%95ES.pdf) - [NBR 14724:2011](http://site.ufvjm.edu.br/revistamultidisciplinar/files/2011/09/NBR_14724_atualizada_abr_2011.pdf) - [NBR 6027:2003](https://arquivos.info.ufrn.br/arquivos/201217724681f092705070edeef8a06d/NBR_6027_Sumario_apresentacao.pdf)
https://github.com/lkoehl/typst-boxes
https://raw.githubusercontent.com/lkoehl/typst-boxes/main/examples/slanted-colorbox.typ
typst
MIT License
#import "@dev/colorful-boxes:1.3.1": * #set page(paper: "a4", margin: 0.5cm, height: auto) #slanted-colorbox(title: lorem(5), color: "red")[ #lorem(50) ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10AC0.typ
typst
Apache License 2.0
#let data = ( ("MANICHAEAN LETTER ALEPH", "Lo", 0), ("MANICHAEAN LETTER BETH", "Lo", 0), ("MANICHAEAN LETTER BHETH", "Lo", 0), ("MANICHAEAN LETTER GIMEL", "Lo", 0), ("MANICHAEAN LETTER GHIMEL", "Lo", 0), ("MANICHAEAN LETTER DALETH", "Lo", 0), ("MANICHAEAN LETTER HE", "Lo", 0), ("MANICHAEAN LETTER WAW", "Lo", 0), ("MANICHAEAN SIGN UD", "So", 0), ("MANICHAEAN LETTER ZAYIN", "Lo", 0), ("MANICHAEAN LETTER ZHAYIN", "Lo", 0), ("MANICHAEAN LETTER JAYIN", "Lo", 0), ("MANICHAEAN LETTER JHAYIN", "Lo", 0), ("MANICHAEAN LETTER HETH", "Lo", 0), ("MANICHAEAN LETTER TETH", "Lo", 0), ("MANICHAEAN LETTER YODH", "Lo", 0), ("MANICHAEAN LETTER KAPH", "Lo", 0), ("MANICHAEAN LETTER XAPH", "Lo", 0), ("MANICHAEAN LETTER KHAPH", "Lo", 0), ("MANICHAEAN LETTER LAMEDH", "Lo", 0), ("MANICHAEAN LETTER DHAMEDH", "Lo", 0), ("MANICHAEAN LETTER THAMEDH", "Lo", 0), ("MANICHAEAN LETTER MEM", "Lo", 0), ("MANICHAEAN LETTER NUN", "Lo", 0), ("MANICHAEAN LETTER SAMEKH", "Lo", 0), ("MANICHAEAN LETTER AYIN", "Lo", 0), ("MANICHAEAN LETTER AAYIN", "Lo", 0), ("MANICHAEAN LETTER PE", "Lo", 0), ("MANICHAEAN LETTER FE", "Lo", 0), ("MANICHAEAN LETTER SADHE", "Lo", 0), ("MANICHAEAN LETTER QOPH", "Lo", 0), ("MANICHAEAN LETTER XOPH", "Lo", 0), ("MANICHAEAN LETTER QHOPH", "Lo", 0), ("MANICHAEAN LETTER RESH", "Lo", 0), ("MANICHAEAN LETTER SHIN", "Lo", 0), ("MANICHAEAN LETTER SSHIN", "Lo", 0), ("MANICHAEAN LETTER TAW", "Lo", 0), ("MANICHAEAN ABBREVIATION MARK ABOVE", "Mn", 230), ("MANICHAEAN ABBREVIATION MARK BELOW", "Mn", 220), (), (), (), (), ("MANICHAEAN NUMBER ONE", "No", 0), ("MANICHAEAN NUMBER FIVE", "No", 0), ("MANICHAEAN NUMBER TEN", "No", 0), ("MANICHAEAN NUMBER TWENTY", "No", 0), ("MANICHAEAN NUMBER ONE HUNDRED", "No", 0), ("MANICHAEAN PUNCTUATION STAR", "Po", 0), ("MANICHAEAN PUNCTUATION FLEURON", "Po", 0), ("MANICHAEAN PUNCTUATION DOUBLE DOT WITHIN DOT", "Po", 0), ("MANICHAEAN PUNCTUATION DOT WITHIN DOT", "Po", 0), ("MANICHAEAN PUNCTUATION DOT", "Po", 0), ("MANICHAEAN PUNCTUATION TWO DOTS", "Po", 0), ("MANICHAEAN PUNCTUATION LINE FILLER", "Po", 0), )
https://github.com/goshakowska/Typstdiff
https://raw.githubusercontent.com/goshakowska/Typstdiff/main/documentation/docs/index.md
markdown
# TypstDiff documentation For the source code visit [Gitlab](https://gitlab-stud.elka.pw.edu.pl/dferfeck/zprp-typstdiff). ## Documentation commands * `mkdocs new [dir-name]` - Create a new project. * `mkdocs serve` - Start the live-reloading docs server. * `mkdocs build` - Build the documentation site. * `mkdocs -h` - Print help message and exit. ## Project layout assets/ # Folder for examples files used to comparing with typstdiff example1/ # Files for example1 (check pdf for example) example2/ # Files for example2 (check pdf for example) dist/ # Folder for tar of package typstdiff documentation/ mkdocs.yml # The configuration file docs/ index.md # The documentation homepage about.md # About project bibliography.md # Sources used in the project project_configuration.md # Main information about project configuration user_how_to.md # User guide tests/ test_complex/ # Files used for tests in test_complex.py test_working_types/ # Files used for tests in test_typstdiff.py test_complex.py # Complex tests for groups and more nested typst test_typstdiff.py # Units tests for each of working type typstdiff/ # Main folder with tool's source files __init__.py comparison.py # Main Comparison class which compares typst documents and marks changes errors.py # Custom typstdiff exceptions file_converter.py # FileConverter class to convert files between typst and json, and compile typst documents to pdf main.py # Runs typstdiff, handles user arguments from console .gitignore design_propasal_z04.pdf pyproject.toml README.md tox.ini
https://github.com/EunTilofy/NumComputationalMethods
https://raw.githubusercontent.com/EunTilofy/NumComputationalMethods/main/Chapter2/Chapter2-2.typ
typst
#import "../template.typ": * #show: project.with( course: "Computing Method", title: "Computing Method - Chapter2", date: "2024.3.22", authors: "<NAME>, 3210106357", has_cover: false ) // #show: rest => columns(2, rest) *Problems:Exercise-2,9,10,14* #HWProb(name: "Exercise-2")[ 导出三弯矩方程组,并对 $s'(x_0), s'(x_n)$ 给定进行讨论。 ] #solution[ 记 $M_i = s''(x_i),i = 0, dots, n$, 将 $s(x)$ 在 $x_i$ 处展开得 $ s(x) = y_i + s'(x_i) (x - x_i) + (M_i) / 2 (x - x_i)^2 + (s'''(x_i))/6 (x - x_i)^3, x in [x_i, x_(i+1)] $ 对其求二阶导,得 $s''(x) = M_i + s'''(x_i) (x - x_i)$,取 $x = x_(i+1)$ 得 $s'''(x_i) = (M_(i+1) - M_i)/(x_(i+1) - x_i)$, 代回上式得 $ y_(i+1) - y_i = s'(x_i) (x_(i+1)-x_i) + ((M_i)/2 + (M_(i+1)-M_i)/6)(x_(i+1)-x_i)^2 \ arrow.double s'(x_i) = (y_(i+1)-y_i)/(x_(i+1)-x_i) - 1/6 (M_(i+1)+2M_i)(x_(i+1)-x_i) $ 同理可得 $ s'(x_i) = (y_(i-1)-y_i)/(x_(i-1)-x_i) - 1/6 (M_(i-1)+2M_i)(x_(i-1)-x_i) $ 设 $f[x_(i-1), x_i, x_(i+1)] = ((y_(i-1)-y_i)/(x_(i-1)-x_i) - (y_(i+1)-y_i)/(x_(i+1)-x_i))/(x_(i+1) - x_(i-1)), mu_i = (x_i-x_(i-1))/(x_(i+1)-x_(i-1)), lambda_i = (x_(i+1)-x_(i))/(x_(i+1)-x_(i-1)), i = 1, dots, n-1$。 所以有 $ mu_i M_(i-1) + 2M_i + lambda_i M_(i+1) = 6f[x_(i-1), x_i, x_(i+1)], $ 若给定条件,$s'(x_0) = beta_1, s'(x_n) = beta_2$,那么有 $ beta_1 = (y_1 - y_0)/(x_1 - x_0) - 1/6 (M_1 + 2M_0)(x_1 - x_0), \ beta_2 = (y_(n-1)-y_n)/(x_(n-1)-x_n)-1/6(M_(n-1)+2M_n)(x_(n-1)-x_n) $ 最后得到方程组 $ bmatrix( 1, 2, kk, kk, kk, kk, kk, kk; kk , 1,2,1, kk, kk, kk, kk; kk, kk, 1, 2, 1, kk, kk, kk; kk, kk, kk, dots.down, dots.down, dots.down, kk, kk; kk, kk, kk, kk, 1, 2, 1, kk; kk, kk, kk, kk, kk, 1, 2, 1; kk, kk, kk, kk, kk, kk, 1, 2 ) bmatrix( M_0;M_1;M_2;dots.v;M_(n-2);M_(n-1);M_n )= bmatrix( 6 (y_1 - y_0)/(x_1 - x_0)^2 - 6beta_1/(x_1 - x_0); 6 f[x_0, x_1, x_2]; 6 f[x_1, x_2, x_3]; dots.v; 6 f[x_(n-3), x_(n-2), x_(n-1)]; 6 f[x_(n-2), x_(n-1), x_n]; 6 (y_(n-1)-y_n)/(x_(n-1)-x_n)^2 - 6beta_2/(x_(n-1)-x_n) ) $ ] #HWProb(name: 9)[ 利用(2.37)式和 Newton 插值公式作两点三次 Hermite 插值多项式, 并求前一题的解。 ] #solution[ #tablex( columns: 5, auto-hlines: false, auto-vlines: false, (), vlinex(), (), (), (), $x_0$, $y_0$, [], [], [], $x_0$, $y_0$, $y'_0$, [], [], $x_1$, $y_1$, $f[x_0, x_1]$, $(y'_0-f[x_0, x_1])/(x_0 - x_1)$, [], $x_1$, $y_1$, $y'_1$, $(y'_1 - f[x_0, x_1])/(x_1 - x_0)$, $(y'_1+y'_0-2f[x_0, x_1])/(x_1 - x_0)^2$, ) 所以, $ f(x) = (y'_1+y'_0-2f[x_0, x_1])/(x_1 - x_0)^2 (x - x_0)^2(x-x_1) + (y'_0-f[x_0, x_1])/(x_0 - x_1) (x - x_0)^2 + y'_0 (x - x_0) + y_0 $ 代入 $y_0 = 1, y'_0 = 1/2, y_1 = 2, y'_1 = 1/2, x_0 = 0, x_1 = 1$,得 $ f(x) = -x^3 + 3/2 x^2 + 1/2 x + 1 $ ] #HWProb(name: 10)[ 给定数组 #tablem[ | $x$ | 75 | 76 | 77 | 78 | 79 | 80 | | --- | -- | -- | -- | -- | -- | -- | | $y$ | 2.768 | 2.833 | 2.903 | 2.979 | 3.062 | 3.153 ] #block[ #set enum(numbering: "(1)") + 作一分段线性插值函数; + 取第二类边界条件,作三次样条插值多项式; + 用两种插值函数分别计算 $x = 75.5$ 和 $x = 78.3$ 的函数值。 ] ] #solution[ #block[ #set enum(numbering: "(1)") (1) $I_5(x) = sum_(i=1)^5 y_i l_i (x)$,其中, $ l_0 (x) = cases(76 - x quad x in [75, 76], 0 quad "otherwise"), \ l_j (x) = cases(x - j - 74 quad x in [74 + j, 75 + j], 76 + j - x quad x in [75 + j, 76 + j], 0 quad "otherwise"), quad (j = 1, 2, 3, 4) \ l_5 (x) = cases(80 - x quad x in [79, 80], 0 quad "otherwise") $ \ (2) 取两端点处一阶导值为0,根据(2.62)得到方程组 $ cases( m_0 = m_5 = 0, 1/2 m_0 + 2m_1 + 1/2 m_2 = 0.015, 1/2 m_1 + 2m_2 + 1/2 m_3 = 0.018, 1/2 m_2 + 2m_3 + 1/2 m_4 = 0.014, 1/2 m_3 + 2m_4 + 1/2 m_5 = 0.016 ) $ 解得,$m_0 = 0, m_1 = 0.0058, m_2 = 0.0067, m_3 = 0.0036, m_4 = 0.0071, m_5 = 0$, 那么样条在区间 $[x_(i-1), x_i], i = 1, 2, 3, 4, 5$ 上的表达式为, $ s(x) = (1 + 2x - 2x_(i-1))(x-x_i)^2y_(i-1) + (1 -2x + 2x_i)(x-x_(i-1))^2y_i+\ (x-x_(i-1))(x-x_i)^2 m_(i-1) + (x-x_i)(x-x_(i-1))^2 m_(i) $ (3) $ I_5 (75.5) = 2.768 l_0 (75.5) + 2.833 l_1 (75.5) = 2.8005 \ I_5 (78.3) = 2.979 l_3 (78.3) + 3.062 l_4 (78.3) = 3.0039 $ $ s(75.5) = (1 + 2x - 2 times 75)(x-76)^2 times 2.768 + (1 -2x + 2 times 76)(x-75)^2 times 2.833 + (x-76)(x-75)^2 times 0.0058 = 2.799 \ s(78.3) = (1 + 2x - 2 times 78)(x-79)^2 times 2.979 + (1 - 2x + 2 times 79)(x-78)^2 times 3.062+\ (x-78)(x-79)^2 times 0.0036 + (x-79)(x-78)^2 0.0071 = 3.0034 $ ] ] #HWProb(name : 14)[ 称 $n$ 阶方阵 $Am = (a_(i j))$ 具有严格对角优势,若 $ abs(a_(i i)) > sum_(j = 1, j eq.not i)^n abs(a_(i j)), i = 1, 2, dots.c, n $ #block[ #set enum(numbering: "(1)") + 证明:具有严格对角优势的方阵必可逆; + 证明:方程组 (2.62) 存在唯一解。 ] ] #Proof[ #block[ #set enum(numbering: "(1)") (1) 设矩阵 $A$ 行严格对角占优,如果 $A$ 奇异,那么存在 $xm eq.not vb("0"), A xm = vb("0")$。所以, $ sum_(j=1)^n a_(i j) x_j = 0, i = 1, 2, dots, n $ 令 $i_0 = arg max_(1 leq i leq n) |x_i|$。则, $ abs(a_(i_0 i_0) x_(i_0)) = abs(-sum_(j=1,j eq.not i_0)^n a_(i_0, j)x_j) leq sum_(j=1, j eq.not i_0)^n abs(a_(i_0,j))abs(x_j) leq abs(x_(i_0)) sum_(j=1, j eq.not i_0)^n abs(a_(i_0, j)) $ 所以 $abs(x_(i_0)) ( abs(a_(i_0, i_0)) - sum_(j=1, j eq.not i_0)^n abs(a_(i_0, j))) leq 0 arrow.double abs(a_(i_0, i_0)) - sum_(j=1, j eq.not i_0)^n abs(a_(i_0, j)) leq 0$, 这与 $A$ 对角占优的假设相矛盾,因此 $A$ 必可逆。\ (2) 方程组(2.62)按行严格对角占优,根据(1),其矩阵必然可逆,所以此方程组必然存在唯一解。 ] ]
https://github.com/arthurcadore/eng-telecom-workbook
https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/COM_1/homework5/homework.typ
typst
MIT License
#import "@preview/klaro-ifsc-sj:0.1.0": report #import "@preview/codelst:2.0.1": sourcecode #show heading: set block(below: 1.5em) #show par: set block(spacing: 1.5em) #set text(font: "Arial", size: 12pt) #show: doc => report( title: "Conversão AD/DA através de PCM NRZ", subtitle: "Sistemas de Comunicação I", authors: ("<NAME>",), date: "01 de Maio de 2024", doc, ) = Introdução O objetivo deste trabalho é simular a conversão de um sinal analógico para digital através dos processos de amostragem e quantização. Em seguida a transmissão do sinal de maneira digital através de um canal de comunicação PCM (Pulse Code Modulation) com codificação não-retornante (NRZ). \ Por fim, a conversão do sinal de digital para analógico novamente no receptor, realizando a filtragem do sinal recebido para interpreta-lo corretamente, em seguida, novamente amostragem e quantização e finalmente a conversão da informação recebida novamente para um sinal analógico. Desta forma, poderemos compreender o funcionamento de um sistema de comunicação digital PCM NRZ e os efeitos da amostragem e quantização no sinal transmitido. = Fundamentação Teórica: - Amostragem e Quantização: A amostragem é o processo de capturar valores de um sinal analógico em intervalos regulares de tempo. A quantização é o processo de discretizar os valores amostrados em níveis de amplitude finitos. - Ruído AWGN: O ruído AWGN (Additive White Gaussian Noise) é um tipo de ruído que é adicionado ao sinal transmitido, simulando interferências e distorções no sinal. Utilizamos esse tipo de ruído por ser o mais aleatório possivel no espectro de frequência, simulando assim o ruído de um canal de comunicação real. - Ruído de Quantização: O ruído de quantização é o erro que ocorre devido a discretização dos valores amostrados. Quanto maior a quantidade de níveis de quantização, menor será o ruído de quantização, desta forma, devemos priorizar a quantização com alta taxa de bits, para evitar a distorção do sinal interpretado. - PCM (NRZ): O PCM (Pulse Code Modulation) é um método de modulação digital que consiste em amostrar e quantizar um sinal analógico, e transmitir a informação digitalizada através de um canal de comunicação. O NRZ (Non-Return-to-Zero) é um dos métodos codificação PCM que consiste em manter o sinal em nível alto ou baixo durante todo o período de bit, sem valores no zero. - Processo de Filtragem: A filtragem é o processo de atenuar frequências indesejadas do sinal recebido, para que o sinal possa ser interpretado corretamente. A filtragem é realizada através de um filtro passa-baixas, que atenua as frequências acima de uma determinada frequência de corte. - Conversão AD: A conversão AD (Analógico para Digital) é o processo de amostrar e quantizar um sinal analógico, transformando-o em um sinal digital. Utilizaremos este processo no inicio da simulação, para digitalizar o sinal analógico de entrada. - Conversão DA: A conversão DA (Digital para Analógico) é o processo de transformar um sinal digital em um sinal analógico. Utilizaremos esse processo no final da simulação, para transformar o sinal digital recebido em um sinal analógico. = Desenvolvimento e Resultados == Conversão AD Inicialmente, um sinal analógico foi criado para realizar o processo de conversão AD, para isso, foi escolhido um sinal senoidal de 80KHz com amplitude de 1V, neste ponto, é importante escolher um sinal bem comportado pois como conhecemos seu comportamento, podemos analisar melhor os efeitos da amostragem e quantização e qual resultado esperar no receptor após o processo de conversão D/A. Em seguida, o sinal foi amostrado com uma taxa de amostragem de $40*F(s)$ (ou seja, 3200KHz) e quantizado em 4 bits, gerando um sinal digital que será transmitido através do canal de comunicação PCM. A figura abaixo ilustra o processo de amostragem e quantização do sinal analógico: #figure( figure( image("./pictures/ad.png"), numbering: none, caption: [Sinal Senoidal sendo Amostrado e Quantizado] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Transmissão PCM NRZ Uma vez que o sinal analógico foi amostrado e quantizado, temos como saída um vetor de bits. Através deste vetor, podemos realizar sua tramissão através de um canal de comunicação PCM NRZ. O canal de comunicação PCM NRZ nada mais faz do que transmitir um nivel de amplitude especifico para cada valor de bit dado. Portanto, para a tramissão deste sinal, utilizamos $-5$ para 0 e $5$ para 1. A figura abaixo ilustra o sinal digital transmitido através do canal de comunicação PCM NRZ: #figure( figure( image("./pictures/supersample.png"), numbering: none, caption: [Sinal Digital Transmitido através do Canal PCM NRZ] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Ruído na Recepção: Uma vez o sinal sendo transmitido, é necessário adicionar um ruído AWGN para simular as interferências e distorções que ocorrem em um canal de comunicação real, para isso, geramos um ruído AWGN com uma amplitude de $0.1V$ e realizamos a soma com o sinal transmitido. \ O sinal resultante é o sinal recebido no receptor, este agora está com distorções na sua aplitude por conta das componentes adicionadas pelo ruído AWGN. Para ilustrar o sinal recebido e o ruído AWGN adicionado, temos a figura abaixo, note que a amplitude do sinal recebido foi distorcida pelo ruído AWGN: #figure( figure( image("./pictures/awgn.png"), numbering: none, caption: [Sinal Recebido com Ruído AWGN] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Reconstrução do sinal PCM O sinal PCM transmitido é então reconstruido no receptor, para isso, é utilizado um limiar, neste caso $0V$, para decidir qual o valor binário correspondente do sinal em relação ao sinal propriamente recebido. Uma vez recebido coletado, o sinal binário é superamostrado e filtrado, para que possamos visualizar o sinal corretamente com mais amostras para cada bit recebido. Abaixo temos a figura do sinal PCM reconstruido no receptor, note que abaixo do sinal PCM recebido e reconstruido há um plot do sinal transmitido antes de ser corrompido pelo ruído, para que possamos compara-los: #figure( figure( image("./pictures/rx.png"), numbering: none, caption: [Sinal PCM Reconstruido no Receptor] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Conversão DA: Uma vez com o trem de bits reconstruido, é necessário converter o sinal digital para analógico, para isso, realizamos um agrupamento dos bits de acordo com a ordem de transmissão. \ Para um cenário real, a taxa de quantização deve ser igual entre as partes e préviamente configurada, assim quando os bits forem recebidos o destinatário saberá como agrupa-los. Uma vez agrupados, definimos um limiar para cada nivel, no caso de 4bits, são $2^b $ niveis, portanto diferentes níveis possiveis para o sinal analógico na saída do D/A. Desta forma, mapeamos cada agrupamento de 4bits em sua correspondente amplitude de saída, e assim, reconstruindo o sinal analógico: #figure( figure( image("./pictures/da.png"), numbering: none, caption: [Sinal Analógico Reconstruido no Receptor] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) = Scripts e Códigos Utilizados == Conversão AD O código abaixo apresenta a etapa de conversão AD, onde um sinal senoidal é amostrado e quantizado, gerando um sinal digital que será transmitido através do canal de comunicação PCM NRZ. #sourcecode[```matlab close all; clear all; clc; pkg load signal; pkg load communications; % Altera o tamanho da fonte nos plots para 15 set(0, 'DefaultAxesFontSize', 20); % Definindo a amplitude do sinal senoidal A_signal = 1; % Definindo a frequência do sinal senoidal f_signal = 80000; % Definindo a frequência de amostragem fs = 40*f_signal; Ts = 1/fs; T = 1/f_signal; % Definindo o tempo inicial e final do sinal t_inicial = 0; t_final = 0.01; % Vetor de tempo t = [t_inicial:Ts:t_final]; % Criando o sinal senoidal signal = A_signal*cos(2*pi*f_signal*t); % Criando um trem de impulsos com período de 2T impulse_train = zeros(size(t)); impulse_train(mod(t, 1/fs) == 0) = 1; % Amostragem do sinal senoidal signal_sampled = signal .* impulse_train; % Quantidade de níveis desejada (tirando o 0) n=4; num_levels = 2^n; % Gerando os níveis de quantização automaticamente levels = linspace(-1, 1, num_levels); % Verifica se o vetor possui algum elemento com "0". % Se sim, remove o elemento e sai do loop for i = 1:length(levels) if levels(i) == 0 levels(i) = []; break; end end % Quantização do sinal com 2^n niveis quantized_signal = zeros(size(signal_sampled)); for i = 1:length(signal_sampled) for j = 1:length(levels) if signal_sampled(i) <= levels(j) quantized_signal(i) = levels(j); break; end end end % Plotando os sinais figure(1) subplot(411) plot(t,signal) grid on; xlim([0 3*T]) title('Sinal Senoidal (Dominio do tempo)') subplot(412) stem(t,impulse_train, 'MarkerFaceColor', 'b') grid on; xlim([0 3*T]) title('Trem de impulsos (Dominio do tempo)') subplot(413) stem(t,signal_sampled, 'LineStyle','none', 'MarkerFaceColor', 'b') grid on; xlim([0 3*T]) title('Sinal Senoidal Amostrado (Dominio do tempo)') subplot(414) stem(t,quantized_signal, 'LineStyle','none', 'MarkerFaceColor', 'b') xlim([0 3*T]) hold on; plot(t,signal, 'r') xlim([0 3*T]) grid on; title('Sinal Senoidal Amostrado e Quantizado (Dominio do tempo)') ```] == Transmissão PCM NRZ O código abaixo apresenta a etapa de transmissão do sinal digital através do canal de comunicação PCM NRZ, onde o sinal digital é transmitido com níveis de amplitude específicos para cada valor de bit. #sourcecode[```matlab % Desloca o vetor quantizado para 0 ou mais: min_value = min(quantized_signal); quantized_signal = quantized_signal - min_value; % Multiplica os valores quantizados para que sejam números inteiros % Número de intervalos entre os níveis num_intervals = num_levels - 1; % Multiplicando os valores quantizados para que sejam números inteiros quantized_signal_int = quantized_signal * num_intervals; % Convertendo valores quantizados inteiros para binário binary_signal = de2bi(quantized_signal_int, n); % Concatenando os valores binários em um único vetor binary_signal_concatenated = reshape(binary_signal.', 1, []); % Vetor de tempo t = linspace(0, 1, length(binary_signal_concatenated) * 2); % Repetindo cada valor do sinal repeated_signal = reshape(repmat(binary_signal_concatenated, 2, 1), 1, []); % ======================================================== % realizando a superamostragem do sinal com a função upper % Superamostragem n = 10; amplitude =5; repeated_signal_up = upsample(repeated_signal, n); filtr_tx = ones(1, n); filtered_signal = filter(filtr_tx, 1, repeated_signal_up)*2*amplitude-amplitude; % criando um novo vetor de t para o sinal filtrado t_super = linspace(0, 1, length(filtered_signal)); var_noise = 0.1; transmission_noise = sqrt(var_noise)*randn(1,length(filtered_signal)); % Gerando o sinal transmitido no meio de comunicação multiplicando o sinal de transmissão pelo ruído do meio. transmitted_signal = filtered_signal + transmission_noise; % Plotando o sinal figure(2) subplot(311) plot(t,repeated_signal, 'LineWidth', 2); ylim([-0.2, 1.2]); xlim([0, 50*T]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Binário como Onda Quadrada'); grid on; subplot(312) plot(t_super,filtered_signal, 'LineWidth', 2); xlim([0, 50*T]); ylim([-amplitude*1.2 , amplitude*1.2]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Binário como Onda Quadrada'); grid on; subplot(313) plot(t_super,transmitted_signal, 'LineWidth', 2); xlim([0, 50*T]); ylim([-amplitude*1.2 , amplitude*1.2]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Binário como Onda Quadrada'); grid on; ```] == Rúido na Recepção O código abaixo apresenta a etapa de adição de ruído AWGN ao sinal transmitido, simulando as interferências e distorções que ocorrem em um canal de comunicação real. #sourcecode[```matlab n = 10; amplitude =5; repeated_signal_up = upsample(repeated_signal, n); filtr_tx = ones(1, n); filtered_signal = filter(filtr_tx, 1, repeated_signal_up)*2*amplitude-amplitude; % criando um novo vetor de t para o sinal filtrado t_super = linspace(0, 1, length(filtered_signal)); var_noise = 0.1; transmission_noise = sqrt(var_noise)*randn(1,length(filtered_signal)); transmitted_signal = filtered_signal + transmission_noise; % Plotando o sinal figure(2) subplot(211) plot(t,repeated_signal, 'LineWidth', 2); ylim([-0.2, 1.2]); xlim([0, 50*T]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Binário como Onda Quadrada'); grid on; subplot(212) plot(t_super,filtered_signal, 'LineWidth', 2); xlim([0, 50*T]); ylim([-amplitude*1.2 , amplitude*1.2]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Binário como Onda Quadrada - Superamostrado'); grid on; figure(5) subplot(311) plot(t_super,transmission_noise, 'LineWidth', 2); xlim([0, 50*T]); ylim([-amplitude*1.2 , amplitude*1.2]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Ruidoso - AWGN'); grid on; subplot(312) plot(t_super,filtered_signal, 'LineWidth', 2); xlim([0, 50*T]); ylim([-amplitude*1.2 , amplitude*1.2]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Binário como Onda Quadrada'); grid on; subplot(313) plot(t_super,transmitted_signal, 'LineWidth', 2); xlim([0, 50*T]); ylim([-amplitude*1.2 , amplitude*1.2]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Transmitido no Meio de Transmissão'); grid on; ```] == Reconstrução do sinal PCM O código abaixo apresenta a etapa de reconstrução do sinal PCM no receptor, onde o sinal recebido é comparado com um limiar para decidir qual o valor binário correspondente do sinal. #sourcecode[```matlab % Definindo o limiar (valor que vai decidir se o sinal é 0 ou 1) limiar = 0; % amostrando o sinal recebido received_signal = transmitted_signal(n/2:n:end); % Verifica se o sinal recebido é maior ou menor que o limiar. % Se for maior, o sinal é 1, se for menor, o sinal é 0. received_binary = received_signal > limiar; % Vetor de tempo para o sinal recebido t_received = linspace(0, 1, length(t_super)/n); % Plotando o sinal figure(3) subplot(211) plot(t_received, received_signal); xlim([0, 50*T]); subplot(212) stem(t_received, received_binary); xlim([0, 50*T]); % Calculando a taxa de erro de bit num_erro = sum(xor(received_signal, received_binary)) taxa_erro = num_erro/length(t_super) ```] == Conversão DA O código abaixo apresenta a etapa de conversão DA, onde o sinal digital é convertido para analógico, reconstruindo o sinal original. #sourcecode[```matlab % Vetor de tempo para o sinal recebido t_received = linspace(0, 1, length(received_signal)); % Interpolando o sinal para restaurar a taxa de amostragem original received_signal_interp = interp(received_signal, n); % Filtrando o sinal interpolado para remover artefatos filtr_rx = ones(1, n); received_signal_filtered = filter(filtr_rx, 1, received_signal_interp) / n; % Plotando o sinal recuperado figure(4); subplot(211); plot(t_super, filtered_signal, 'LineWidth', 2, 'DisplayName', 'Sinal Original'); hold on; plot(t_received, received_signal_filtered(1:length(t_received)), '--', 'LineWidth', 2, 'DisplayName', 'Sinal Recuperado'); xlim([0, 50*T]); ylim([-amplitude*1.2 , amplitude*1.2]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Original e Sinal Recuperado'); legend; grid on; % Convertendo o sinal recuperado para o formato analógico received_analog_signal = received_signal_filtered(1:length(t_received)) * (2*amplitude) - amplitude; % Normalização da amplitude % Plotando o sinal analógico recuperado subplot(212); plot(t_received, received_analog_signal, 'LineWidth', 2); xlim([0, 50*T]); xlabel('Tempo'); ylabel('Amplitude'); title('Sinal Analógico Recuperado'); grid on; ```] = Conclusão A partir dos conceitos vistos e dos resultados obtidos podemos concluir que a amostragem e quantização são processos fundamentais para a conversão de um sinal analógico para digital, e que a transmissão de um sinal digital através de um canal de comunicação PCM NRZ é possível e eficiente. Além disso, a adição de ruído AWGN no sinal transmitido simula as interferências e distorções que ocorrem em um canal de comunicação real, e a reconstrução do sinal PCM no receptor é possível através da comparação do sinal recebido com um limiar. Por fim, a conversão do sinal digital para analógico é possível através da conversão dos valores binários em níveis de amplitude, e a filtragem do sinal recebido é necessária para remover artefatos e distorções. = Referências Bibliográficas Para o desenvolvimento deste relatório, foi utilizado o seguinte material de referência: - #link("https://www.researchgate.net/publication/287760034_Software_Defined_Radio_using_MATLAB_Simulink_and_the_RTL-SDR")[Software Defined Radio Using MATLAB & Simulink and the RTL-SDR, de <NAME>]
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/1%20-%20Candidatura/Analisi%20dei%20Rischi/Analisi%20dei%20Rischi.typ
typst
#block[ ERROR\_418 \ DOCUMENTAZIONE PROGETTO \ #block[ #figure( align(center)[#table( columns: 2, align: (col, row) => (left,left,).at(col), inset: 6pt, [Mail:], [<EMAIL>], [Redattori:], [<NAME>, <NAME>], [Verificatori:], [<NAME>, <NAME>, <NAME>], [Amministratori:], [<NAME>, <NAME>], [Destinatari:], [<NAME>, <NAME>], )] ) ] ] = Analisi dei rischi <analisi-dei-rischi> A ciascun rischio individuato si associano: - Impatto: può essere lieve, medio, grave. Esprime l’effetto generato dall’evento; - Probabilità: da 1 a 5. Esprime la probabilità del verificarsi del rischio; - Conseguenze: effetti collaterali a breve o medio termine che il rischio può comportare. = Rischi <rischi> == Comunicazione con il proponente <comunicazione-con-il-proponente> I contatti con il proponente potrebbero subire variazioni nella qualità e nella frequenza a causa di problematiche fuori dal controllo del gruppo. Questa situazione potrebbe causare un rallentamento significativo del lavoro, soprattutto durante l’analisi dei requisiti. - Impatto: grave; - Probabilità: 1; - Conseguenze: lo sviluppo potrebbe allontanarsi dalle linee guida o dalle aspettative del proponente, non rispettando quanto preventivato o pianificato. Tale rischio, comporterebbe dunque la produzione di un software non in linea con le richieste conducendo a perdite di tempo per analisi, progettazione e implementazione aggiuntive; - Mitigazione: - Pianificazione anticipata degli incontri di revisione dell’avanzamento; - Uso di strumenti asincroni per facilitare lo scambio di informazioni tra gruppo e proponente; - Programmazione di incontri periodici di aggiornamento, anche brevi. == \"Effetto sottomarino\" <effetto-sottomarino> Uno o più membri potrebbero, per motivi diversi, cessare la partecipazione attiva alle attività del gruppo. È necessario evitare che la durata di queste assenze impedisca il regolare svolgimento delle attività di progetto. - Impatto: medio; - Probabilità: 3; - Conseguenze: i partecipanti che si dovessero trovare in questa situazione rischierebbero di accentuare eventuali incomprensioni nel proprio lavoro senza la possibilità di confrontarsi con gli altri accorgendosi degli errori troppo tardi; - Mitigazione: - Mantenimento di un dialogo costante sulle problematiche interne al gruppo; - Segnalazione responsabile e preventiva di difficoltà o impedimenti da parte dei singoli membri. == Rallentamento delle attività <rallentamento-delle-attività> Tra le difficoltà principali durante lo sviluppo del progetto è la congiunzione tra gli impegni individuali e progettuali. Tale rischio può comportare un rallentamento nel completamento di attività e task assegnate comportando un generale ritardo nello sviluppo. - Impatto: grave; - Probabilità: 4 \(#emph[Probabilità aumentata nel periodo della sessione invernale];); - Conseguenze: attività non svolte o completate parzialmente determinerebbero uno slittamento della data di consegna e delle scadenze intermedie; - Mitigazione: - Organizzazione e suddivisione del monte ore con occhio di riguardo a precise date e scadenze; - Incontri e comunicazione costante con i membri del gruppo al fine di rendere note eventuali indisponibilità o impegni; - Uso di strumenti asincroni al fine di permettere a tutti i membri un’equa divisione del lavoro da svolgere nei momenti a loro più comodi, a patto di rispettare le linee guida del Way Of Working. == Utilizzo delle tecnologie <utilizzo-delle-tecnologie> Le tecnologie individuate o suggerite durante i processi di analisi e progettazione potrebbero risultare complesse da comprendere e/o integrare. - Impatto: medio; - Probabilità: 4; - Conseguenze: rallentamenti non preventivati che possono avere conseguenze a cascata sulle attività dipendenti; - Mitigazione: - Accurata pianificazione e stesura delle norme di progetto e Way Of Working; - Assicurarsi che ad ogni membro del gruppo sia chiaro il funzionamento delle tecnologie e delle norme concordate.
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/SK/casoslov/vecierne/postnaVecierenBezKnaza.typ
typst
#import "../../../style.typ": * #import "/SK/texts.typ": * #import "/SK/textsTmp.typ": * #import "../styleCasoslov.typ": * = Pôstna večiereň <X> #show: rest => columns(2, rest) #nacaloBezKnaza #zalm(103) #si #lettrine("Aleluja, aleluja, aleluja, sláva tebe, Bože.") #primText[(3x)] #ektenia(12) == Katizma <X> #note[Nasleduje predpísaná katizma:] #ektenia(3) == Pane ja volám <X> Pane, ja volám k tebe, \* vyslyš ma: Vyslyš ma, Pane. \* Pane, ja volám k tebe, \* vypočuj hlas môj. \* Keď volám k tebe. \* Vyslyš ma, Pane. Moja modlitba nech sa vznáša k tebe ako kadidlo \* a pozdvihnutie mojich rúk \* ako obeť večerná. \* Vyslyš ma, Pane. #include "../../zalmy/Z_PaneJaVolam.typ" #verse(( "Vyveď ma zo žalára, * aby som tvoje meno mohol velebiť.", "Spravodliví sa zhromaždia vôkol mňa, * keď mi priazeň prejavíš.", "Z hlbín volám k tebe, Pane; * Pane, vypočuj môj hlas.", "Nakloň svoj sluch * k mojej úpenlivej prosbe.", "Ak si budeš, Pane, neprávosť uchovávať v pamäti, * Pane, kto obstojí? * Ale u teba je odpustenie hriechov.", "Spolieham sa na teba, Pane. * Moja duša sa spolieha na tvoje slovo. * Moja duša dúfa v Pána.", "Väčšmi ako strážcovia vyčkávajú dennicu, * nech dúfa Izrael v Pána.", "Lebo u Pána je milosrdenstvo a hojné vykúpenie. * On sám vykúpi Izraela zo všetkých jeho neprávostí.", "Chváľte Pána, všetky národy. * Oslavujte ho, všetci ľudia.", "Lebo veľké je jeho milosrdenstvo voči nám * a pravda Pánova trvá na veky." )) == Svetlo tiché <X> #lettrine("Svetlo tiché svätej slávy * nesmrteľného, Otca nebeského, * svätého, blaženého, * Ježišu Kriste, * keď sme prišli k západu slnka * a videli žiaru večernú, * ospevujeme Otca i Syna, i Svätého Ducha, Boha. * Je dôstojné preľúbeznými hlasmi oslavovať teba, Synu Boží, * ktorý dávaš život celému svetu, * preto ťa celý vesmír velebí.") == Prokimen a čítania <X> #note[Berieme čítania s prokimenmi z pôstnej triódy:] == Večerný chválospev <X> #lettrine("Ráč nás, Pane, v tento večer * zachrániť od hriechu. – Velebíme ťa, Pane, Bože otcov našich. * Chválime a oslavujeme tvoje meno na veky. Amen. * Preukáž nám, Pane, svoje milosrdenstvo, * lebo dúfame v teba. * Blahoslavený si, Pane, * nauč nás svoje pravdy. * Blahoslavený si, Vládca, * daj nám porozumieť svojim pravdám. * Blahoslavený si, Svätý, * osvieť nás svojimi pravdami. * Pane, tvoje milosrdenstvo je večné, * nepohŕdaj dielom svojich rúk. * Tebe patrí chvála, * tebe patrí pieseň, * tebe, Otcu i Synu, i Svätému Duchu, * patrí sláva teraz i vždycky, i na veky vekov. Amen.") #ektenia(12) == Veršové slohy <X> #slohy(( "Oči dvíham k tebe, čo na nebesiach prebývaš. * Ako oči sluhov hľadia na ruky svojich pánov, ako oči služobníc hľadia na ruky svojej panej, * tak hľadia naše oči na Pána, nášho Boha, * kým sa nezmiluje nad nami.", "Zmiluj sa, Pane, nad nami, zmiluj sa nad nami, * lebo už máme dosť pohŕdania; * lebo naša duša má už dosť výsmechu boháčov * a pohŕdania pyšných." )) // == Simeonova modlitba <X> // #lettrine("Teraz prepustíš, Pane, svojho služobníka podľa svojho slova v pokoji, lebo moje oči uvideli tvoju spásu, ktorú si pripravil pred tvárou všetkých národov. Svetlo na osvietenie pohanov a slávu Izraela, tvojho ľudu.") #trojsvatePoOtcenas == Tropáre <X> #lettrine("Raduj sa, Bohorodička, <NAME>, milostiplná, Pán s tebou, * požehnaná si medzi ženami * a požehnaný je plod tvojho života, * lebo si porodila Krista, Spasiteľa a Vykupiteľa našich duší.") #note("(veľká poklona)") #secText[Sláva:] #lettrine("Krstiteľ Kristov, k tebe sa modlíme. * Spomeň si na nás všetkých, * aby sme boli zbavení svojich neprávostí, * lebo ty si dostal milosť orodovať za nás.") #note("(veľká poklona)") #secText[I teraz:] #lettrine("Svätí apoštoli, proroci a mučeníci * i všetci svätí, prihovárajte sa za nás, * aby sme boli zbavení bied a núdze, * lebo vo vás máme horlivých zástancov u Spasiteľa.") #note("(veľká poklona)") #lettrine("K tvojmu milosrdenstvu * sa utiekame, * Bohorodička Panna. * V súženiach zrak neodvráť * od našich prosieb * a od hrozieb zachráň nás. * Jediná prečistá, * jediná prečistá a požehnaná.") #note("(bez poklony)") #lettrine("Pane, zmiluj sa.") #primText([40x]) #lettrine("Pane, požehnaj.") #ektenia(3) #lettrine("Čestnejšia si ako cherubíni * a neporovnateľne slávnejšia ako serafíni, * bez porušenia si porodila Boha Slovo, * opravdivá Bohorodička, velebíme ťa.") Pane Ježišu Kriste, Bože náš, pre modlitby našich svätých otcov zmiluj sa nad nami. #efrem #trojsvatePoOtcenas #lettrine("Pane, zmiluj sa.") #note[(12x)] #lettrine("Presvätá Trojica, jednopodstatná mocnosť a nedeliteľné kráľovstvo, ty si darkyňou každého dobra, zhliadni v tomto čase aj na mňa hriešneho a umy ma od každej škvrny, osvieť môj rozum, aby som stále ospevoval, slávil a volal: „Jediný je svätý, iba jeden je Pán, Jež<NAME>, na slávu Boha Otca, amen.“") #lettrine("Nech je požehnané Pánovo meno od teraz až naveky.") #note("(trikrát)") #zalm(33) #lettrine("Dôstojné je velebiť teba, Bohorodička, * vždy blažená a nepoškvrnená, Matka nášho Boha.") #prepustenieSDostojneBezKnaza
https://github.com/RanolP/resume
https://raw.githubusercontent.com/RanolP/resume/main/modules/activity.typ
typst
#import "util.typ": * #let formatDuration(duration) = { let duration-in-weeks = if type(duration) == "duration" { duration.weeks() } else { duration } let year = calc.floor(duration-in-weeks / 4 / 12) let month = calc.rem(calc.floor(duration-in-weeks / 4), 12) [ #if year > 0 { str(year) + "년" } #if month != 0 { str(month) + "개월" } ] } #let activityList(entries, body-header: none, header: none) = { let total-duration-in-weeks = 0 for (from, to, ..) in entries { if type(to) != "datetime" { continue } total-duration-in-weeks += (to - from).weeks() } if body-header != none { body-header(formatDuration(total-duration-in-weeks)) } table( columns: (auto, 1fr), inset: 0pt, gutter: 15pt, stroke: none, table.header(table.cell(colspan: 2)[#header]), ..( entries.map(((from, to, title, body)) => { let row = ( align(center)[ #block(breakable: false)[ #text(size: 10pt, weight: 600)[ #{ from.display("[year].[month]") } #if type(to) == "datetime" { [ \~ #if to != datetime.today() { to.display("[year].[month]") } else { "Present" } \ #text(size: 8pt)[약 #formatDuration(to - from) ] ] } ] ] ], block(breakable: false)[ #pad(bottom: -4pt)[ #set text(size: 12pt, weight: 700) #set par(leading: 0.5em) #title ] #set text(size: 10pt) #body ], ) return row }), ).flatten(), ) } #let activityEntry(body, from: "#INVALID#", to: "", title: "#INVALID_TITLE#") = (from, to, title, body) #let workExpList(entries, body-header: none, header: none) = activityList( entries, body-header: body-header, header: header, ) #let workExpEntry( body, from: "#INVALID#", to: "", role: "#INVALID_ROLE#", organization: "#INVALID_COMPANY#", homepage: "", ) = activityEntry( body, from: from, to: to, title: [ #belonging(role, organization) #h(1fr) #if homepage != "" { show link: set text(fill: color.rgb("#1c7ed6")) show link: underline homepage } ], )
https://github.com/HPDell/typst-starter-journal-article
https://raw.githubusercontent.com/HPDell/typst-starter-journal-article/main/assets/basic.typ
typst
MIT License
#import "@preview/starter-journal-article:0.3.1": article, author-meta #set page(margin: 12pt, width: 6in, height: 5in) #show: article.with( title: "Artile Title", authors: ( "<NAME>": author-meta("UCL", email: "<EMAIL>"), "<NAME>": author-meta("TSU") ), affiliations: ( "UCL": "UCL Centre for Advanced Spatial Analysis, First Floor, 90 Tottenham Court Road, London W1T 4TJ, United Kingdom", "TSU": "Haidian District, Beijing, 100084, P. R. China" ), abstract: [#lorem(20)], keywords: ("Typst", "Template", "Journal Article") ) = Introduction #lorem(20)
https://github.com/elpekenin/access_kb
https://raw.githubusercontent.com/elpekenin/access_kb/main/typst/content/parts/front_page.typ
typst
#page[ #align(center + horizon)[ #image("../../images/UPCT-front.jpg", width: 70%) ] #align(center)[ #text(size: 25pt, weight: "bold")[Revisitando el diseño del teclado] ] #align(bottom + right)[ #text(weight: "bold", size: 13pt)[ Autor: <NAME> Director: <NAME> Máster Universitario en Ingeniería de Telecomunicación #datetime.today().display("[month repr:short]-[year]") ] ] // 0 to not render page number here #counter(page).update(0) ]
https://github.com/Tengs-Fan/Tengs-Penkwe
https://raw.githubusercontent.com/Tengs-Fan/Tengs-Penkwe/master/template.typ
typst
#import "./metadata.typ": * #import "@preview/fontawesome:0.1.0": * // const color #let awesomeColors = ( skyblue: rgb("#0395DE"), red: rgb("#DC3522"), nephritis: rgb("#27AE60"), concrete: rgb("#95A5A6"), darknight: rgb("#131A28"), ) #let regularColors = ( lightgray: rgb("#343a40"), darkgray: rgb("#212529"), ) #let color_darknight = rgb("#131A28") #let color_darkgray = rgb("333333") #let accentColor = awesomeColors.at(awesomeColor) /*************** Styles ***************/ #let beforeSectionSkip = 1pt #let beforeEntrySkip = 1pt #let beforeEntryDescriptionSkip = 1pt #let entryA1Style(str) = {text( size: 10pt, weight: "bold", str )} #let entryA2Style(str) = {align(right, text( weight: "medium", fill: accentColor, style: "oblique", str ))} #let entryB1Style(str) = {text( size: 9pt, fill: accentColor, weight: "medium", smallcaps(str) )} #let entryB2Style(str) = {align(right, text( size: 11pt, weight: "medium", fill: gray, style: "oblique", str ))} #let entryDescriptionStyle(str) = {text( size: 10pt, fill: regularColors.lightgray, { v(beforeEntryDescriptionSkip) str } )} #let letterHeaderNameStyle(str) = {text( weight: "bold", str )} #let letterHeaderAddressStyle(str) = {text( fill: gray, size: 0.9em, smallcaps(str) )} #let letterDateStyle(str) = {text( size: 0.9em, style: "italic", str )} #let letterSubjectStyle(str) = {text( fill: accentColor, weight: "bold", underline(str) )} #let footerStyle(str) = {text( size: 8pt, fill: rgb("#999999"), smallcaps(str) )} // layout utility #let justify_align(left_body, right_body) = { block[ #left_body #box(width: 1fr)[ #align(right)[ #right_body ] ] ] } #let justify_align_3(left_body, mid_body, right_body) = { block[ #box(width: 1fr)[ #align(left)[ #left_body ] ] #box(width: 1fr)[ #align(center)[ #mid_body ] ] #box(width: 1fr)[ #align(right)[ #right_body ] ] ] } #let letterSignature(path) = { linebreak() place(left, dx:-5%, dy:0%, image(path, width: 25%)) } /*************** Main Body Items ***************/ #let resume(author: (), date: "", body) = { set document( author: author.firstname + " " + author.lastname, title: "resume", ) set text( font: ("Vollkorn"), lang: "en", size: 12pt, fill: color_darknight, fallback: false ) set page( paper: "a4", margin: (left: 15mm, right: 15mm, top: 10mm, bottom: 10mm), footer: [ #set text(fill: gray, size: 9pt) #justify_align_3[ // #smallcaps[#date] ][ #smallcaps[ #author.firstname #author.lastname #sym.dot.c #"Résumé" ] ][ #counter(page).display() ] ], footer-descent: 0pt, ) // set paragraph spacing show par: set block(above: 0.75em, below: 0.75em) set par(justify: true) set heading( numbering: none, outlined: false, ) let name = { align(center)[ #pad(bottom: 5pt)[ #block[ #set text(size: 28pt, style: "normal", font: ("Vollkorn")) #text(weight: "thin")[#author.firstname] #text(weight: "bold")[#author.lastname] ] ] ] } let positions = { set text( size: 9pt, weight: "regular" ) align(center)[ #smallcaps[ #author.positions.join( text[#" "#sym.dot.c#" "] ) ] ] } let contacts = { set box(height: 11pt) let linkedin_icon = box(image("assets/icons/linkedin.svg")) let github_icon = box(image("assets/icons/square-github.svg")) let email_icon = box(image("assets/icons/square-envelope-solid.svg")) let phone_icon = box(image("assets/icons/square-phone-solid.svg")) let separator = box(width: 5pt) align(center)[ #block[ #align(horizon)[ #phone_icon #box[#text(author.phone)] #separator #email_icon #box[#link("mailto:" + author.email)[#author.email]] #separator #github_icon #box[#link("https://github.com/" + author.github)[#author.github]] #separator #linkedin_icon #box[ #link("https://www.linkedin.com/in/" + author.linkedin + "-<PASSWORD>")[#author.linkedin] ] ] ] ] } align(right)[#box[#image("./assets/Coop.svg", width:70%)]] name positions contacts body } // general style #let resume_section(title) = { set text( size: 16pt, weight: "regular" ) align(left)[ #smallcaps[ // #text[#title.slice(0, 3)]#strong[#text[#title.slice(3)]] #strong[#text[#title]] ] #box(width: 1fr, line(length: 100%)) ] } #let resume_item(body) = { set text(size: 10pt, style: "normal", weight: "light") set par(leading: 0.65em) body } #let resume_time(body) = { set text(weight: "medium", style: "oblique", size: 12pt, fill: accentColor) body } #let resume_degree(body) = { set text(size: 10pt, weight: "light") smallcaps[#body] } #let resume_organization(body) = { set text(size: 12pt, style: "normal", weight: "bold") body } #let resume_location(body) = { set text(size: 11pt, style: "italic", fill: gray, weight: "light") body } #let resume_position(body) = { set text(size: 10pt, weight: "regular") smallcaps[#body] } #let resume_category(body) = { set text(size: 11pt, weight: "bold") body } #let resume_gpa(numerator, denominator) = { set text(size: 12pt, style: "italic", weight: "light") text[Cumulative GPA: #box[#strong[#numerator] / #denominator]] } // sections specific components #let education_item(organization, degree, gpa, time_frame) = { set block(above: 0.7em, below: 0.7em) set pad(top: 5pt) pad[ #justify_align[ #resume_organization[#organization] ][ #gpa ] #justify_align[ #resume_degree[#degree] ][ #resume_time[#time_frame] ] ] } #let cvSection(title) = { let highlightText = title.slice(0,3) let normalText = title.slice(3) v(beforeSectionSkip) sectionTitleStyle(highlightText, color: accentColor) sectionTitleStyle(normalText, color: black) h(2pt) box(width: 1fr, line(stroke: 0.9pt, length: 100%)) } #let cvEntry( title: "Title", society: "Society", date: "Date", location: "Location", description: "Description", logo: "" ) = { let ifSocietyFirst(condition, field1, field2) = { return if condition {field1} else {field2} } let ifLogo(path, ifTrue, ifFalse) = { return if varDisplayLogo { if path == "" { ifFalse } else { ifTrue } } else { ifFalse } } let setLogoLength(path) = { return if path == "" { 0% } else { 4% } } let setLogoContent(path) = { return if logo == "" [] else {image(path, width: 100%)} } v(beforeEntrySkip) table( columns: (ifLogo(logo, 4%, 0%), 1fr), inset: 0pt, stroke: none, align: horizon, column-gutter: ifLogo(logo, 4pt, 0pt), setLogoContent(logo), table( columns: (1fr, auto), inset: 0pt, stroke: none, row-gutter: 6pt, align: auto, {entryA1Style(ifSocietyFirst(varEntrySocietyFirst, society, title))}, {resume_time(date)}, {entryB1Style(ifSocietyFirst(varEntrySocietyFirst, title, society))}, {entryB2Style(location)}, ) ) entryDescriptionStyle(description) } #let work_experience_item_header( company, location, position, time_frame ) = { set block(above: 0.7em, below: 0.7em) set pad(top: 5pt) pad[ #justify_align[ #resume_organization[#company] ][ #resume_location[#location] ] #justify_align[ #resume_position[#position] ][ #resume_time[#time_frame] ] ] } #let personal_project_item_header( name, location, position, start_time, ) = { set block(above: 0.7em, below: 0.7em) set pad(top: 5pt) pad[ #justify_align[ #resume_organization[#name] ][ #resume_time[#start_time] ] #justify_align[ #resume_position[#position] ][ #resume_location[#location] ] ] } #let skill_item(category, items) = { set block(above: 1.0em, below: 1.0em) grid( columns: (18fr, 80fr), gutter: 10pt, align(right)[ #resume_category[#category] ], align(left)[ #set text(size: 11pt, style: "normal", weight: "light") #items.join(", ") ], ) } #let volunteer_item_header( position, company, location, time_frame ) = { set block(above: 0.7em, below: 0.7em) set pad(top: 5pt) pad[ #justify_align[ #resume_organization[#company] ][ #resume_time[#time_frame] ] #justify_align[ #resume_position[#position] ][ #resume_location[#location] ] ] } #let layout(doc) = { set text( font: ("Vollkorn", "Font Awesome 6 Brands", "Font Awesome 6 Free"), weight: "regular", size: 9pt, ) set align(left) set page( paper: "a4", margin: ( left: 1.4cm, right: 1.4cm, top: .8cm, bottom: .4cm, ), ) doc } #let letterHeader( myAddress: "Your Address Here", recipientName: "<NAME> Here", recipientAddress: "Company Address Here", date: "Today's Date", subject: "Subject: Hey!" ) = { letterHeaderNameStyle(firstName + " " + lastName) v(1pt) letterHeaderAddressStyle(myAddress) v(1pt) align(right, letterHeaderNameStyle(recipientName)) v(1pt) align(right, letterHeaderAddressStyle(recipientAddress)) v(1pt) letterDateStyle(date) v(1pt) letterSubjectStyle(subject) linebreak(); linebreak() } #let letterFooter() = { place( bottom, table( columns: (1fr, auto), inset: 0pt, stroke: none, footerStyle([#firstName #lastName]), footerStyle([Cover Letter]), ) ) }
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/loading/yaml.typ
typst
--- yaml --- // Test reading YAML data #let data = yaml("/assets/data/yaml-types.yaml") #test(data.len(), 9) #test(data.null_key, (none, none)) #test(data.string, "text") #test(data.integer, 5) #test(data.float, 1.12) #test(data.mapping, ("1": "one", "2": "two")) #test(data.seq, (1,2,3,4)) #test(data.bool, false) #test(data.keys().contains("true"), true) #test(data.at("1"), "ok") --- yaml-invalid --- // Error: 7-30 failed to parse YAML (did not find expected ',' or ']' at line 2 column 1, while parsing a flow sequence at line 1 column 18) #yaml("/assets/data/bad.yaml")
https://github.com/shiki-01/typst
https://raw.githubusercontent.com/shiki-01/typst/main/school/mq/main.typ
typst
#import "../../lib/conf.typ": conf, come, desc, light #import "@preview/codelst:2.0.1": sourcecode #show: doc => conf( title: [名電クエスト 探求], date: [2024年4月18日 ~], doc, ) #align(center)[#text(20pt,)[*部活動内外交流SNS「ツナガロ」*]] = プランを考えたきっかけのできごとや思い 小・中学校と先輩・後輩がいなかったから、高校でできた先輩や後輩とかかわろうと思ってもうまく関われない → もっと気軽に話しかけられる場所が欲しい! = 顧客ターゲット 中~大規模の部活動 = 顧客課題 先輩は後輩にスキルの譲渡や交流のきっかけを\ 後輩からは先輩への質問など、相互の交流のきっかけが欲しい = 提供価値 交流できる = 解決策 - 発信のスタートのハードルを軽くする → 匿名でスタートできるようにする = 競合ビジネス - ほとんどが社内SNSばかり → 使わない機能や不要な料金を払うことに = かかるお金 1ユーザー 500 ~ 1000円を目指したい → 社内SNSとの差別化 = もらうお金 運用費+利益分\ 支払いは月額制、学校単位 or 部活単位 = サマリー つながりをもっと気軽に = タイトル 部活動内外交流SNS「ツナガロ」 = 仕様等 - firebase + sveltekit
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/复习/物理实验/0/temple/img/ctez/散点图.typ
typst
#import "@preview/cetz:0.2.2" #import cetz.plot #import cetz.plot #import cetz.draw: * #let 横轴长度=15 #let 纵轴长度=7.5 #let 横轴步长=5 #let 纵轴步长=5 #let 横轴脚注="x" #let 纵轴脚注="y" #let 表格地址="./1.csv" // #type(out_data.at(0).at(0)) #let 散点图=(表格地址,x,y,z,mark)=>{ let data=csv(表格地址) let out_data=data.slice(1) let i_=0 for i in out_data{ out_data.at(i_).at(0)=float(i.at(0)) out_data.at(i_).at(1)=float(i.at(1)) i_+=1 } return cetz.canvas( length:1cm, { import cetz.plot plot.plot( // color: "black", unit: 1cm, size: (10,10), x-tick-step: 10, y-tick-step: 纵轴步长, x-label: x, y-label: y, x-grid: true, y-grid: true, // color: black, // style: (color: black), legend: "legend.north", { plot.add( out_data, mark: mark, // stroke: black, // fill: white, // mark-style: (stroke: black, fill: white), // mark-size: 3mm, label: z, // size: 1.5mm, ) }) }) } #let 散点图1=散点图("./5.1.csv",[驱动电流 $(m A)$],[光功率当量],[光功率当量],"o") #let 横轴长度=50 #let 纵轴长度=75 #let 横轴步长=1 #let 纵轴步长=250 #let 散点图_2=(表格地址,x,y,z,mark)=>{ let data=csv(表格地址) let out_data=data.slice(1) let i_=0 for i in out_data{ out_data.at(i_).at(0)=float(i.at(0)) out_data.at(i_).at(1)=float(i.at(1)) i_+=1 } // scale(x: 10%) return cetz.canvas( // 缩放 // scale: 0.5, length:10cm, { import cetz.plot plot.plot( // color: "black", size: (1,1), colors: (black), x-tick-step: 横轴步长, y-tick-step: 纵轴步长, x-label: x, y-label: y, x-grid: true, y-grid: true, // color: black, // style: (color: black), legend: none, { plot.add( out_data, mark: mark, // stroke: black, // fill: white, // mark-style: (stroke: black, fill: white), mark-size: 0.02, label: z, // size: 1.5mm, ) }) }) } #let 散点图2=散点图_2("./5.1.csv",[驱动电流 $(m A)$],[输出电压$(m V) $],[],"o") // #散点图1 #let 横轴长度=50 #let 纵轴长度=75 #let 横轴步长=0.5 #let 纵轴步长=0.4 #let 散点图_3=(表格地址,x,y,z,mark)=>{ let data=csv(表格地址) let out_data=data.slice(1) let i_=0 for i in out_data{ out_data.at(i_).at(0)=float(i.at(0)) out_data.at(i_).at(1)=float(i.at(1)) i_+=1 } // scale(x: 10%) return cetz.canvas( // 缩放 // scale: 0.5, length:1cm, { import cetz.plot plot.plot( // color: "black", size: (10,10), colors: (black), x-tick-step: 横轴步长, y-tick-step: 纵轴步长, x-label: x, y-label: y, x-grid: true, y-grid: true, // color: black, // style: (color: black), legend: "legend.north", { plot.add( out_data, mark: mark, // stroke: black, // fill: white, // mark-style: (stroke: black, fill: white), mark-size: 0.25, label: z, // size: 1.5mm, ) }) }) } #let 散点图3=散点图_3("./6.2.csv",[距离 $("mm")$],[功率$(m w) $],[功率],"o") // #散点图1 #let 横轴长度=100 #let 纵轴长度=5000 #let 横轴步长=5 #let 纵轴步长=250 #let 散点图_4=(表格地址1,表格地址2,x,y,z,mark)=>{ let data1=csv(表格地址1) let data2=csv(表格地址2) let out_data=data1.slice(1) let i_=0 for i in out_data{ out_data.at(i_).at(0)=float(i.at(0)) out_data.at(i_).at(1)=float(i.at(1)) i_+=1 } let out_data2=data2.slice(1) let i_=0 for i in out_data2{ out_data2.at(i_).at(0)=float(i.at(0)) out_data2.at(i_).at(1)=float(i.at(1)) i_+=1 } // scale(x: 10%) return cetz.canvas( // 缩放 // scale: 0.5, length:1cm, { import cetz.plot plot.plot( // color: "black", size: (10,10), // colors: (black), x-tick-step: 横轴步长, y-tick-step: 纵轴步长, x-label: x, y-label: y, x-grid: true, y-grid: true, // color: black, // style: (color: black), legend: "legend.north", { plot.add( out_data, mark: mark, // stroke: black, // fill: white, // mark-style: (stroke: black, fill: white), mark-size: 0.10, label: $z=0.5$ // size: 1.5mm, ) plot.add( out_data2, mark: mark, // stroke: black, // fill: white, mark-style: (stroke: red, fill: rgb("#ff4032")), mark-size: 0.10, label: $z=1$, // size: 1.5mm, ) }) }) } #let 散点图4=散点图_4("./6.3.1.csv","./6.3.2.csv",[焦距 $(mu m)$],[光强],[光功率当量],"o") // #散点图1 #散点图3
https://github.com/CHHC-L/ciapo
https://raw.githubusercontent.com/CHHC-L/ciapo/master/examples/not-so-minimal-example.typ
typst
MIT License
#import "../template.typ": diapo, transition #show: diapo.with( title: "Elucidation of the mechanical energy", author: "<NAME>", date: "1759-04-19", // display-lastpage: false, // short-title: "The mechanical energy", ) = Introduction This is a small demo of the `diapo` package. == State of the art #lorem(20) #lorem(30) == Current work #lorem(20) #transition[ Transition slide \ Now some $cal(M) a t HH$ ] = Argument #grid(columns: (1fr, 1fr), column-gutter: 1em, lorem(40), align(horizon)[$ x_plus.minus = (-b plus.minus sqrt(b^2 - 4 a c) ) / (2 a) $] ) = Discussion #place(dx: 10cm, dy: -1cm)[ #rotate(30deg)[#text(fill: green)[_weird text_]] ] #align(center+horizon)[ #text(size: 50pt)[Big boring text] ] #pagebreak() #align(horizon)[ A new slide with content on the horizon, without a title, obtained by a simple `pagebreak()` call. ] = Sparse text Top text #v(1fr) Bottom text #transition(accent-color: navy)[We are about to conclude] = Conclusion - Fruits - Apple - Banana - Others - Vegetables - Carrot - Eggplant
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Physique_Ex_08_12_2023.typ
typst
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Physique Ex 08 12 2023", authors: ( "<NAME>", ), date: "7 Décembre, 2023", ) #set heading(numbering: "1.1.") === Exercice 21 p 315 <exercice-21-p-315> + D’après la première loi de la thermodynamique quand le système ne subit pas de variation énergétique au plan macroscopique. Pour le système $brace.l upright("eau") brace.r$ incompressible on a: $ Delta U_(i arrow.r f) eq W plus Q eq m c Delta theta eq m c lr((theta_f minus theta_i)) $ $W eq 0$ car le système de subit pas de travail non conservatif. + $ m c theta_f minus m c theta_i eq Delta U_(i arrow.r f) $ $ theta_f eq frac(Delta U_(i arrow.r f), m c) plus theta_i $ $ theta_f eq frac(4.2 times 10^4 upright("J"), 150 times 10^(minus 3) upright("kg") times 4.18 times 10^3 upright("J") upright("kg") ""^(minus 1) upright("°C") ""^(minus 1)) $ $ theta_f eq 67 upright("°C") $ === Exercice 27 p 316 <exercice-27-p-316> + D’après la première loi de la thermodynamique quand le système ne subit pas de variation énergétique au plan macroscopique. Pour le système $brace.l upright("eau contenue dans le ballon") brace.r$ incompressible on a: $ Delta U_1 eq W plus Q eq m c Delta theta eq m c lr((theta_f minus theta_i)) eq rho_(e a u) v_(e a u) c_(e a u) lr((theta_f minus theta_i)) $ $W eq 0$ car le système de subit pas de travail non conservatif. $ Delta U_1 eq 1000 upright("kg") ""^(minus 1) upright("m") ""^3 times 80.0 times 10^(minus 3) upright("m") ""^3 times 4.18 times 10^3 upright("J") upright("kg") ""^(minus 1) upright("°C") ""^(minus 1) lr((65.0 upright("°C") minus 17.0 upright("°C"))) $ $ Delta U_1 eq 1.61 times 10^7 upright("J") $ + $Delta U_(i arrow.r f) eq Q plus W$ or $W eq 0$ donc $Delta U_1 eq Q_1 gt 0$ c’est-à-dire l’eau reçoit de l’énergie. + $ upright("Energie") upright("J") eq upright("Puissance") upright("W") times upright("Temps (Durée)") upright("s") $ $ arrow.r.double Q_1 eq Delta U_1 eq P_(é l e c t r i q u e) times Delta t_1 $ + $ Delta t_1 eq frac(Delta U_1, P_(é l e c t r i q u e)) $ $ Delta t_1 eq frac(1.61 times 10^7 upright("J"), 1500 upright("W") eq 1.07 times 10^4 upright("s")) eq 2 h med 58 m i n med 20 s $ + $ Delta t_1 eq 2 h med 58 m i n med 20 s approx 3 h $ Par conséquent la durée de chauffe annoncée est correcte === Exercice 2p334 <exercice-2p334> + Modes de transfert thermique : - entre l’eau et le Soleil ” par rayonnement - entre l’eau et le sable ” par conduction - entre l’eau et l’air ” par convection + Pour le système $brace.l upright("eau du lac") brace.r$ : - entre l’eau et le Soleil $Q gt 0$ le système reçoit de l’énergie - entre l’eau et le sable $Q gt 0$ le système reçoit de l’énergie - entre l’eau et l’air $Q gt 0$ le système reçoit de l’énergie === Exercice 5 p334 <exercice-5-p334> + + $ phi.alt eq frac(theta_i minus theta_e, R_(T h)) $ $ R_(T h) eq frac(theta_i minus theta_e, phi.alt) eq frac(19 minus 10, 30) eq 0.30 upright("°C") upright("W") ""^(minus 1) $ === Exercice 21 p338 <exercice-21-p338> + #block[ #set enum(numbering: "a.", start: 1) + D’après la première loi de la thermodynamique quand le système ne subit pas de variation énergétique au plan macroscopique. Pour le système $brace.l upright("eau contenue dans le ballon") brace.r$ incompressible on a: $ Delta U_1 eq W plus Q eq m c Delta theta eq m c lr((theta_f minus theta_i)) eq rho_(e a u) v_(e a u) c_(e a u) lr((theta_f minus theta_i)) $ $W eq 0$ car le système de subit pas de travail non conservatif. $ Q eq 1000 times 0.200 times 4180 times lr((65 minus 15)) eq 4.2 times 10^7 upright("s") $ $ P_(é l e c t r i q u e) eq frac(W_(é l e c t r i q u e), Delta t) $ $ Delta t eq Q / P_(é l e c t r i q u e) eq frac(4.2 times 10^7, 2200) eq 1.90 times 10^4 upright("s") eq 5 h med 16 m i n med 40 s $ + $Delta t eq 5 h med 16 m i n med 40 s approx 5 h med 17 m i n$ Par conséquent la durée est conforme aux caractéristiques fournies par le fabriquant. ] + #block[ #set enum(numbering: "a.", start: 1) + $ R_(T h) eq frac(e, lambda S) eq frac(70 times 10^(minus 3), 0.036 times 2.9) eq 0.67 upright("°C") upright("W") ""^(minus 1) $ $ phi.alt eq frac(theta minus theta_e, R_(T h)) eq frac(65 minus 20, 0.67) eq 67 upright("W") $ + $Q_(upright("perdue")) eq phi.alt Delta t eq 67 times 24 eq 1.6 times 10^3 med upright(W) times upright(h)$ ] + $ C_r eq frac(1.6 times 10^3, 200 lr((65 minus 20))) eq 0.18 med upright("W") upright("°C") ""^(minus 1) upright("L") ""^(minus 1) upright("d") ""^(minus 1) $ ce qui est la valeur fournie par le fabriquant + $ C_(r m a x) eq 2 times V^(minus 0.4) eq 2 times 200^(minus 0.4) eq 0.24 upright("W") upright("°C") ""^(minus 1) upright("L") ""^(minus 1) upright("d") ""^(minus 1) gt 0.18 upright("W") upright("°C") ""^(minus 1) upright("L") ""^(minus 1) upright("d") ""^(minus 1) arrow.r.double C_r lt C_(r m a x) $ Par conséquent la réglementation est respectée.
https://github.com/chendaohan/rust_tutorials
https://raw.githubusercontent.com/chendaohan/rust_tutorials/main/books/4.变量的绑定与解构(variables).typ
typst
#set heading(numbering: "1.") #set text(size: 15pt) = 变量的命名(使用蛇形命名法) ```rs let image_path = "images/img.jpg"; // 自动推导变量类型 let image_path: &str = "images/img.jpg"; // 手动声明变量类型 ``` = 变量的可变性 在 Rust 中变量默认是不可变的,除非使用 `mut` 关键字,mut 是 mutable 的缩写,代码在对应项目的 `main()` 中。 = 下划线开头忽略未使用变量 代码在对应项目的 `underline()` 中。 = 变量的解构和遮蔽(shadowing) 代码在对应项目的 `deconstruction()` 中。 = 常量 - 常量不允许使用 mut。常量不仅仅默认不可变,而且自始至终不可变,因为常量在编译完成后,已经确定它的值。 - 常量使用 const 关键字而不是 let 关键字来声明,并且值的类型必须标注。 - 常量可以在任意作用域内声明,包括全局作用域,在声明的作用域内,常量在程序运行的整个过程中都有效。 ```rs const NAME: &str = "dream"; ```
https://github.com/Champitoad/typst-slides
https://raw.githubusercontent.com/Champitoad/typst-slides/main/birmingham.typ
typst
Creative Commons Zero v1.0 Universal
#import "@preview/polylux:0.3.1": * #import "@preview/xarrow:0.3.0": xarrow #import "theme/metropolis.typ": * #import "./svg-emoji/lib.typ": setup-emoji #import "flower.typ" #import "eg.typ": * #import "notations.typ": * #import "utils.typ": * /********** PREAMBLE **********/ #show: metropolis-theme.with() // Font config #set text(font: "Fira Sans", weight: "light", size: 20pt) #show math.equation: set text(font: "Fira Math", weight: "light") #set strong(delta: 100) #show link: underline.with(offset: 3pt) #show: setup-emoji // Layout config #set par(justify: true) #set list(spacing: 1.5em) // Useful shortcuts #let mt = spar($|->$) #let to = spar($->$) #let xrule(content) = spar(spacing: 1em, xarrow(sym: sym.arrow.r, irule(content))) // Theorem and definition environements #import "@preview/ctheorems:1.1.2": * #show: thmrules #let definition = thmbox( "definition", "Definition", fill: blue.lighten(90%), ).with(numbering: none) #let theorem = thmbox( "theorem", "Theorem", fill: red.lighten(90%), ).with(numbering: none) #let corollary = thmbox( "corollary", "Corollary", fill: green.lighten(90%), ).with(numbering: none) #let proof = thmproof("proof", "Proof") /********** CONTENT **********/ // #title-slide( // author: [<NAME>], // title: "The Flower Calculus", // date: datetime.today().display(), // extra: [ // SYCO 12, Birmingham // #set text(size: 18pt) // #v(1em) // Based on #link("https://arxiv.org/abs/2402.15174")[arXiv:2402.15174] // ] // ) #slide()[] #slide(title: [A change of viewpoint])[ // - Goal: intuitive *GUI* for _interactive theorem provers_ // // - Replace textual *proof* language (e.g. tactics) // // - Replace textual *statement* language (symbolic formulas) // #pause // - Methodology: // $ underbrace("Direct manipulation", #text(size: 24pt)[Proofs]) // "of" // underbrace(#text[ // #only("1-4")[Diagrams] // #only("5-")[Flowers #emoji.flower.hibiscus] // ], #text(size: 24pt)[Statements]) $ // #pause // - Focus on common heart of _all_ proof assistants: // #align(center)[ // #text(fill: purple)[Intuitionistic] #text(fill: eastern)[First-order] Logic // ] - #text(fill: red)[$or$] solved, but #text(fill: blue)[$#limp$] still *non-invertible*! #v(2em) #pause #align(center)[ #set text(size: 26pt) Key idea: #alert[*space*] is _polarized_, not *objects* ] #v(2em) #pause - (Peirce, 1896): *existential graphs (EGs)* for _classical_ logic #pause - @oostra_graficos_2010@minghui_graphical_2019: EGs for _intuitionistic_ logic #pause #thus *Flower calculus*: intuitionistic variant that is #alert[analytic] // #uncover("6")[ // #v(1em) // #align(center)[ // #text(fill: red)[*Disclaimer:* no _category theory_ in this talk!] // ] // ] ] // #slide(title: [Outline of this talk])[ // #metropolis-outline // ] #new-section-slide([*Classical Logic*: Existential Graphs]) #slide(title: [Existential Graphs #title-right[(Peirce, 1896)]])[ Three #alert[diagrammatic] proof systems for *classical* logic: #v(1em) #alternatives[ - *#sys[Alpha]:* _propositional_ logic ][ #halert[ - *#sys[Alpha]:* _propositional_ logic ] ] - *#sys[Beta]:* _first-order_ logic - *#sys[Gamma]:* _higher-order_ and _modal_ logics ] #slide(title: [The three icons of #sys[Alpha]])[ - *Sheet of assertion* #pause $ #uncover("2-")[$a$] #pause #uncover("3-")[$&#mt #text[$a$ is true]$] \ #pause #uncover("4-")[$&#mt top #text(size: 14pt)[(no assertion)]$] \ #pause $ - *Juxtaposition* $ #uncover("5-")[$G #juxt H$] #pause #uncover("6-")[$&#mt #text[$G #alert[and] H$ are true]$] #pause $ - *Cut* $ #uncover("7-")[$#cut(inv: true, $G$)$] #pause #uncover("8-")[$&#mt #text[$G$ is #alert[not] true]$] $ ] #slide(title: [Relationship with formulas])[ #set align(center) // #side-by-side(gutter: 2em)[ #grid( columns: (1fr, 1fr, 1fr), inset: 20pt, align: center, cut(inv: true, inset: 4mm, $$), grid.vline(), cut(inv: true, $#cut($A$) #cut($B$)$), grid.vline(), cut(inv: true, $A #h(5mm) #cut($B$)$), grid.hline(), $bot$, $A or B$, $A #limp B$, ) // ][ // #pause // - Juxtaposition is naturally: // - *variadic* // - *associative* // - *commutative* // #thus normal form for ${top, and, not}$-formulas // ] ] #slide(title: [Illative transformations])[ #set align(center) #set text(19pt) #let to = spar(spacing: 1.25em, $->$) #let frto = spar(spacing: 1.25em, $<->$) #v(-0.5em) Only 4 #alert[edition] principles! #pause #grid( columns: (auto, auto, auto, auto), inset: 15pt, align: center, uncover("2-")[*Iteration* (copy-paste)], grid.vline(), uncover("3-")[*Deiteration* (unpaste)], grid.vline(), uncover("4-")[*Insertion*], grid.vline(), uncover("5-")[*Deletion*], grid.hline(), uncover("2-")[ $ G #juxt #cfill($H$, phantom($G$)) #to G #juxt #cfill($H$, $G$) \ #sheet(inv: true)[$ G #juxt #cfill($H$, phantom($G$)) #to G #juxt #cfill($H$, $G$) $] $ ], uncover("3-")[ $ G #juxt #cfill($H$, $G$) #to G #juxt #cfill($H$, phantom($G$)) \ #sheet(inv: true)[$ G #juxt #cfill($H$, $G$) #to G #juxt #cfill($H$, phantom($G$)) $] $ ], uncover("4-")[ $ #sheet(inv: true)[$#to G$] $ ], grid.vline(), uncover("5-")[ $ G #to $ ], ) #uncover("6-")[ and a #alert[space] principle, the *Double-cut* law: $ #cut(inv: true, cut($G$)) #frto G #h(4em) #sheet(inv: true)[$ #cut(cut(inv: true, $G$)) #frto G $] $ ] ] #slide(title: [Example: _modus ponens_])[ $ #uncover("1-")[$a #juxt #cut(inv: true, $a #juxt #cut($b$)$)$] #uncover("2-")[$#xrule[Deit] a #juxt #cut(inv: true, $#phantom[a #juxt] #cut($b$)$)$] #uncover("3-")[$#xrule[Dcut] a #juxt b$] #uncover("4-")[$#xrule[Del] b$] $ ] #new-section-slide([*Intuitionistic Logic*: Flowers]) #slide(title: [The scroll])[ #set text(size: 18pt) #side-by-side(gutter: 2em, columns: (1fr, 2fr))[ #set align(center) #image("images/scroll.png", width: 80%) #uncover("2-")[ $ A and B #limp C and D $ ] #only("3-")[ #nscroll( fontsize: 20pt, outloop: (content: align(top)[$A #juxt B$], size: 2.2cm), inloops: ((:), (content: $C #juxt D$, size: 1.2cm)) ).content ] ][ #quote(block: true, attribution: [@peirce_prolegomena_1906[pp.~533-534]])[ #set text(size: 16pt) I thought I ought to take the general form of argument as the basal form of composition of signs in my diagrammatization; and this necessarily took the form of a “scroll”, that is [...] a curved line without contrary flexure and returning into itself after once crossing itself. ] #only("2-")[ #pause #v(1em) - "conditional de inesse" = *classical* implication ] #only("3-")[ #thus scroll $=$ two _nested cuts_ ] // #only("4-")[ // #v(1em) // - Icons of #sys[Alpha] #alert[deduced] from the scroll // ] #only("4-")[ #pause #v(1em) - Peirce also introduced #limp in logic! ~#text(size: 14pt)[@Lewis1920-LEWASO-4[p.~79]] ] ] ] #slide(title: [The $n$-ary scroll #title-right[@oostra_graficos_2010]])[ #set align(center) #uncover("4-")[ #alert[Continuity!] ] #only("5-")[ _Generalizes_ Peirce's *scroll* #only("6-")[and *cut*] ] #only("4", place(dx: 7.2cm, dy: 2.5cm, text(size: 50pt, sym.eq.not))) #only("5", place(dx: 18.7cm, dy: 2.5cm, text(size: 50pt, sym.eq.not))) #grid( columns: (1fr, 2fr, 1fr), inset: 10pt, align: center, uncover("2-")[ #only("2-3")[Classical] #only("4-")[Intuitionistic] #cut(inv: true, inset: -5pt, $#cut($b$) #h(5mm) #cut($c$)$) ], [ #only("1-3")[ #nscroll(outloop: (content: $a$, size: 3cm), inloops: ( (content: $b$), (content: $c$), (content: $d$), (content: $e$), (content: $f$), )).content ] #only("4", nscroll(outloop: (size: 3cm), inloops: ( (:), (content: $c$), (:), (content: $b$) )).content) #only("5", nscroll(outloop: (content: $a$, size: 3cm), inloops: ( (:), (content: $b$), (:), (:) )).content) #only("6", nscroll(outloop: (content: $a$, size: 3cm), inloops: ( )).content) ], uncover("2-")[ #only("2-4")[Classical] #only("5-")[Intuitionistic] #box(cut(inv: true, $a #h(5mm) #cut($b$)$)) ], [ #only("2-3")[$b or c$] #only("4-")[$not (not b and not c)$] ], [ #only("3")[$a #limp b or c or d or e or f$] #only("4", $ b or c $) #only("5", $ a #limp b $) #only("6", $ not a #eqdef a #limp bot $) ], [ #only("2-4")[$a #limp b$] #only("5-")[$not (a and not b)$] ] ) #only("1-3")[$ n = 5 $] #only("4")[$ n = 2 $] #only("5")[$ n = 1 $] #only("6")[$ n = 0 $] ] #slide(title: [Blooming #title-right[(Me, 2022)]])[ #set align(center) #let emoji_size = 35pt #v(-0.6em) #side-by-side(gutter: 0cm, columns: (auto, auto))[ #grid( columns: (1fr, 1.25fr), only("2-", image("images/cylinder.jpg", fit: "cover", width: 100%)), grid( columns: (auto), inset: 0.3em, only("2-", text(size: emoji_size, emoji.pistol)), v(0.1em), nscroll(outloop: (content: $a$, size: 2.75cm), inloops: ( (content: $b$), (content: $c$), (content: $d$), (content: $e$), (content: $f$), )).content, only("2-", text(size: emoji_size, font: "Noto Color Emoji", "☹️")), ) ) ][ #grid( columns: (1.25fr, 1fr), only("3-", grid( columns: (auto), inset: 0.3em, only("4-", text(size: emoji_size, emoji.flower)), v(0.1em), flower.one(( pistil: (content: $a$), petal_size: 3cm, petals: ((name: "p1", content: $b$), (name: "p2", content: $c$), (name: "p3", content: $d$), (name: "p4", content: $e$), (name: "p5", content: $f$)) )).content, only("4-", text(size: emoji_size, font: "Noto Color Emoji", emoji.face.happy)), )), only("4-", image("images/flower.jpg", fit: "cover", width: 100%)), ) ] #only("3")[ Turn *inloops* into #alert[petals]. ] #only("4")[ #link("https://en.wikipedia.org/wiki/Make_love,_not_war")[_"Make love, not war"_] ] ] #slide(title: [Corollaries])[ #quote(block: true, attribution: [Peirce, MS 514 (1909)~~~#text(size: 14pt)[@peirce_corolla]])[ The original "theorems" of geometry were those propositions that Euclid proved, while the *corollaries* were simple deductions from the theorems inserted by Euclid’s commentators and editors. They are said to have been marked the figure of a little garland (or #alert[corolla]), in the origin. ] #set align(center) #pause #v(1em) Petals = (possible) *corolla*-ries of pistil! ] // #new-section-slide([*Predicate Logic*: Gardens]) #let binder_color = fuchsia // #slide(title: [Lines of Identity])[ // #set align(center) // #set text(size: 19pt) // #only("1-3")[ // In #sys[Beta], *quantifiers* and *variables* are represented with #alert[lines].~~~#text(size: 18pt)[(cf. Alessandro's talk)] // ] // #only("4-")[ // #v(-0.65em) // #text(fill: red)[*Problem*]: no *De Morgan duality* in #alert[intuitionistic] logic // ] // #let dot = circle(radius: 5pt, fill: binder_color) // #let R(len: 10mm) = $R #only("2-", move(dx: 6pt, dot)) #line(length: len, stroke: 2pt + white) #h(0pt)$ // #let S = $#h(-2.5mm) #line(length: 10mm, stroke: 2pt + black) S$ // #grid( // columns: (40%, 40%), // column-gutter: 1em, // inset: 1em, // $P #only("2-", move(dx: 6pt, dot)) #line(length: 2cm, stroke: 2pt + black) Q$, // [ // #only("1-3")[ // $#cut(inv: true, inset: -7pt, $#R() #cut(inset: 0pt, S)$)$ // ] // #only("4")[ // #nscroll( // fontsize: 19pt, // outloop: (content: $#R(len: 25mm)$, size: 2.35cm), // inloops: ((:), (content: $#S$, size: 0.9cm), (:), (:)) // ).content // ] // ], // [ // #uncover("3-")[ // #v(-6mm) // $ exists x. P(x) and Q(x) $ // #set text(size: 18pt) // #alert[existential] graphs! // ] // ], // [ // #let big(op) = spar(spacing: 13pt, text(size: 28pt, op)) // #only("3", $&forall x. R(x) #limp S(x) \ big(tilde.equiv) &not exists x. R(x) and not S(x)$) // #only("4-", text(fill: red, $&forall x. R(x) #limp S(x) \ big(tilde.equiv.not) &not exists x. R(x) and not S(x)$)) // ], // ) // #only(2)[quantifier location $=$ #text(fill: binder_color)[*outermost* point]] // #only("3-")[quantifier type $=$ #text(fill: binder_color)[outermost point *polarity*]] // ] // #slide(title: [Intuitionistic quantification])[ // #set align(center) // #set text(size: 19pt) // #v(-1.4em) // #text(fill: olive)[*Solution*]: #alert[polarity-invariant] interpretation // #let dot = circle(radius: 5pt, fill: binder_color) // #let R(len: 10mm, color: white) = $R #move(dx: 5pt, dot) #line(length: len, stroke: 2pt + color) #h(-1mm)$ // #let S(color: black) = $#h(-2.5mm) #line(length: 10mm, stroke: 2pt + color) S$ // #let outloop_size = 2cm // #grid( // columns: (40%, 40%), // column-gutter: 1em, // inset: 1em, // [ // #only("1", nscroll( // fontsize: 19pt, // outloop: (size: outloop_size), // inloops: ((:), (content: $P #move(dx: 5pt, dot) #line(length: 60% * outloop_size, stroke: 2pt + black) Q$, size: 90% * outloop_size), (:), (:)) // ).content) // #only("2", cut(inv: true, inset: -3pt, nscroll(inv: false, // fontsize: 19pt, // outloop: (size: outloop_size), // inloops: ((:), (content: $P #move(dx: 5pt, dot) #line(length: 60% * outloop_size, stroke: 2pt + white) Q$, size: 90% * outloop_size), (:), (:)) // ).content)) // #only("3")[ // #v(-2em) // #move(dx: -2.2cm, flower.one(( // pistil: (size: 0.5cm), // angle: 1rad / 3, // petal_size: 5cm, // petals: ((:), (name: "p", content: $P #move(dx: 5pt, dot) #line(length: 60% * outloop_size, stroke: 2pt + black) Q$), (:), (:), (:)) // )).content) // #v(-2em) // ] // #only("4")[ // #flower.one(( // pistil: (size: 3.15cm, content: // move(dx: -2.2cm, flower.one(( // pistil: (color: white, size: 0.5cm), // angle: 1rad / 3, // petal_size: 5cm, // petals: ((:), (name: "p", content: $P #move(dx: 5pt, dot) #line(length: 60% * outloop_size, stroke: 2pt + black) Q$), (:), (:), (:)) // )).content) // ) // )).content // ] // ], // [ // #only("1", nscroll( // fontsize: 19pt, // outloop: (content: $#R(len: 25mm)$, size: outloop_size), // inloops: ((:), (content: $#S()$, size: 0.9cm), (:), (:)) // ).content) // #only("2", cut(inv: true, inset: -3pt, nscroll(inv: false, // fontsize: 19pt, // outloop: (content: $#R(len: 25mm, color: black)$, size: outloop_size), // inloops: ((:), (content: $#S(color: white)$, size: 0.9cm), (:), (:)) // ).content)) // #only("3")[ // #v(-2em) // #move(dx: -1.35cm, flower.one(( // pistil: (size: 1.25cm, content: $R #move(dx: 5pt, dot) #line(length: 1cm) #h(-9mm)$), // angle: 1rad / 3, // petal_size: 4cm, // petals: ((:), (name: "p", content: $#h(-18mm) #move(dy: -0.5mm, line(length: 1.6cm)) S$), (:), (:), (:)) // )).content) // #v(-2em) // ] // #only("4")[ // #v(-2em) // #flower.one(( // pistil: (size: 3.15cm, content: // move(dx: -1.35cm, flower.one(( // pistil: (color: white, size: 1.25cm, content: $R #move(dx: 5pt, dot) #line(length: 1cm) #h(-9mm)$), // angle: 1rad / 3, // petal_size: 4cm, // petals: ((:), (name: "p", content: $#h(-18mm) #move(dy: -0.5mm, line(length: 1.6cm)) S$), (:), (:), (:)) // )).content) // ) // )).content // #v(-2em) // ] // ], // [ // #only("1,3", $exists x. P(x) and Q(x)$) // #only("2,4", $not (exists x. P(x) and Q(x))$) // ], // [ // #only("1,3", $forall x. R(x) #limp S(x)$) // #only("2,4", $not (forall x. R(x) #limp S(x))$) // ], // ) // $forall$/$exists$ $=$ // #text(fill: binder_color)[* // #only("1-2")[outloop/inloop] // #only("3-4")[pistil/petal] // *] // ] // #slide(title: [Spaghetti statements])[ // #align(center)[ // #text(fill: red)[*Problem:*] cables _all over the place_ // ] // #image("images/quine_loi.png") // #quote(block: true, attribution: [@quine_loi[p.~70]])[ // [These diagrams are] too cumbersome to recommend themselves as a practical notation. // ] // ] #let binder(x) = text(fill: binder_color, x) #let var(x) = text(fill: purple, x) // #slide(title: [Gardens])[ // #set align(center) // #text(fill: olive)[*Solution:*] replace lines with #binder[binders] and #var[variables] // #grid( // columns: (40%, 40%), // column-gutter: 1em, // inset: 1em, // [ // #v(-2em) // #move(dx: -2.2cm, flower.one(( // pistil: (size: 0.5cm), // angle: 1rad / 3, // petal_size: 5cm, // petals: ((:), (name: "p", content: $#move(dx: 1.6cm, binder[$x$]) \ #move(dx: 0.1cm)[$P(#var($x$)) #juxt Q(#var[$x$])$]$), (:), (:), (:)) // )).content) // #v(-2em) // ], // [ // #v(-2em) // #move(dx: -1.35cm, flower.one(( // pistil: (size: 1.45cm, content: $#move(dx: 4.5mm, binder[$x$]) \ R(#var[$x$])$), // angle: 1rad / 3, // petal_size: 4cm, // petals: ((:), (name: "p", content: $S(#var[$x$])$), (:), (:), (:)) // )).content) // #v(-2em) // ], // $exists x. P(x) and Q(x)$, // $forall x. R(x) #limp S(x)$, // ) // #alert[garden] $=$ content of an area (binders + flowers) // ] #slide(title: [Gardens])[ #set align(center) $exists$/$forall$ $=$ #binder[binder] in petal/pistil #let var(x) = x #grid( columns: (40%, 40%), column-gutter: 1em, inset: 1em, [ #v(-2em) #move(dx: -2.2cm, flower.one(( pistil: (size: 0.5cm), angle: 1rad / 3, petal_size: 5cm, petals: ((:), (name: "p", content: $#move(dx: 1.6cm, binder[$x$]) \ #move(dx: 0.1cm)[$P(#var($x$)) #juxt Q(#var[$x$])$]$), (:), (:), (:)) )).content) #v(-2em) ], [ #v(-2em) #move(dx: -1.35cm, flower.one(( pistil: (size: 1.45cm, content: $#move(dx: 4.5mm, binder[$x$]) \ R(#var[$x$])$), angle: 1rad / 3, petal_size: 4cm, petals: ((:), (name: "p", content: $S(#var[$x$])$), (:), (:), (:)) )).content) #v(-2em) ], $exists x. P(x) and Q(x)$, $forall x. R(x) #limp S(x)$, ) #alert[garden] $=$ content of an area (binders + flowers) ] #new-section-slide([*Reasoning* with Flowers]) #slide(title: [Iteration and Deiteration])[ #set align(center) #let (source_color, sink_color) = (blue, red) #let source = circle(radius: 3pt, fill: source_color, stroke: none) #let sink = circle(radius: 3pt, fill: sink_color, stroke: none) Justify a #text(fill: sink_color)[target] flower by a #text(fill: source_color)[source] flower #grid( columns: (auto, auto), gutter: 1.5em, align: bottom, image("images/cross-pollination.png", height: 70%), image("images/self-pollination.png", height: 48%), [cross-pollination], [self-pollination], ) ] #let rebase = box.with(baseline: 50%) #slide(title: [Iteration and Deiteration])[ #set align(center) Works at *arbitrary* #alert[depth]! #let f1 = flower.one(( pistil: (content: only(1, $a$)), petals: ((:), (:), (name: "p1", content: only(4, $b$)), (:)) )).content #let f = rebase(flower.one(( pistil: (content: $b$, size: 1.5cm), petal_size: 8cm, petals: ((:), (name: "p", content: move(dy: -1cm, f1)), (:), (:)) )).content) #v(-2em) $ a #juxt #f $ #v(-2em) #only("1-2")[Cross-pollination] #only("3-4")[Self-pollination] ] #slide(title: [Insertion and Deletion])[ #set align(center) #v(-0.5em) Split in two: #let make_flower(n, color: flower.pistil_color) = { rebase(flower.empty(n, pistil: (size: 0.4cm, color: color), petal_size: 1.2cm).content) } #let make_with_petals(color: flower.pistil_color, petals) = { let pets = () let letters = ($a$, $b$, $c$, $d$, $e$, $f$, $g$, $h$) for i in range(petals.len()) { let petal = petals.at(i) if petal == 1 { pets.push((name: "foo", content: letters.at(i+1))) } else { pets.push((:)) } } rebase(flower.one(text_size: 12pt, ( pistil: (size: 0.4cm, color: color, content: letters.at(0)), petal_size: 1.2cm, petals: pets )).content) } #let grow_left = none #let grow_right = make_with_petals((1, 1, 1, 1, 1)) #let crop_left = flower.sheet(make_with_petals((1, 1, 1, 1, 1), color: white)) #let crop_right = flower.sheet(square(size: 2.2cm, stroke: none)) #let pull_left = make_with_petals((1, 1, 1, 1, 1)) #let pull_right = make_with_petals((0, 1, 1, 1, 1)) #let glue_left = flower.sheet(make_with_petals((0, 1, 1, 1, 1), color: white)) #let glue_right = flower.sheet(make_with_petals((1, 1, 1, 1, 1), color: white)) // #v(1em) #grid( columns: (1fr, 1fr), inset: 1em, align: center + horizon, [*Flower*], grid.vline(), [*Petal*], grid.hline(), $#grow_left &#xrule[grow] #grow_right \ #crop_left &#xrule[crop] #crop_right $, $#glue_left &#xrule[glue] #glue_right \ #pull_left &#xrule[pull] #pull_right $ ) #alert[Backward] reading:~~~~ $"conclusion" #xrule[#h(1cm)] "premiss"$ ] #slide(title: [Scrolling])[ #set align(center) Intuitionistic restriction of *double-cut* principle: $ a #xrule[epis] #move(dx: -1.2em, rebase(flower.one(( pistil: (size: 0.75cm), petals: ((:), (name: "p", content: $a$), (:), (:)) )).content)) $ ] #let make_flower = flower.one.with(text_size: 16pt) #slide(title: [Instantiation])[ #let ipis_left = rebase(make_flower(( pistil: (size: 0.9cm, color: white, content: $x #h(6pt) a(x)$), petals: ((name: "p1", content: $b(x)$), (name: "p2", content: $c(x)$), (name: "p3", content: $d(x)$), (name: "p4", content: $e(x)$), (name: "p5", content: $f(x)$)) )).content) #let ipis_right = rebase(make_flower(( pistil: (size: 0.9cm, color: white, content: $a(t)$), petals: ((name: "p1", content: $b(t)$), (name: "p2", content: $c(t)$), (name: "p3", content: $d(t)$), (name: "p4", content: $e(t)$), (name: "p5", content: $f(t)$)) )).content) #let ipet_left = rebase(make_flower(( pistil: (size: 0.9cm, content: $a$), petal_size: 3cm, petals: ((name: "p1", content: $x #h(6pt) b(x)$), (name: "p2", content: $c$), (name: "p3", content: $d$), (name: "p4", content: $e$), (name: "p5", content: $f$)) )).content) #let ipet_right = rebase(make_flower(( pistil: (size: 0.9cm, content: $a$), petal_size: 3cm, angle: -1/6 * calc.pi * 1rad, petals: ((name: "p1", content: $b(t)$), (name: "p2", content: $x #h(6pt) b(x)$), (name: "p3", content: $c$), (name: "p4", content: $d$), (name: "p5", content: $e$), (name: "p6", content: $f$)) )).content) $ #flower.sheet(ipis_left) &#xrule[ipis] #flower.sheet[ #v(0.5em) $#ipis_right #juxt #ipis_left$ ] \ #ipet_left &#xrule[ipet] #ipet_right $ ] #slide(title: [Abstraction])[ #let make_flower = flower.one.with(text_size: 16pt) #let ipis_left = rebase(make_flower(( pistil: (size: 0.9cm, content: $x #h(6pt) a(x)$), petals: ((name: "p1", content: $b(x)$), (name: "p2", content: $c(x)$), (name: "p3", content: $d(x)$), (name: "p4", content: $e(x)$), (name: "p5", content: $f(x)$)) )).content) #let ipis_right = rebase(make_flower(( pistil: (size: 0.9cm, content: $a(t)$), petals: ((name: "p1", content: $b(t)$), (name: "p2", content: $c(t)$), (name: "p3", content: $d(t)$), (name: "p4", content: $e(t)$), (name: "p5", content: $f(t)$)) )).content) #let ipet_left = rebase(make_flower(( pistil: (size: 0.9cm, content: $a$, color: white), petal_size: 3cm, petals: ((name: "p1", content: $x #h(6pt) b(x)$), (name: "p2", content: $c$), (name: "p3", content: $d$), (name: "p4", content: $e$), (name: "p5", content: $f$)) )).content) #let ipet_right = rebase(make_flower(( pistil: (size: 0.9cm, content: $a$, color: white), petal_size: 3cm, petals: ((name: "p1", content: $b(t)$), (name: "p3", content: $c$), (name: "p4", content: $d$), (name: "p5", content: $e$), (name: "p6", content: $f$)) )).content) #set align(center) $#ipis_right &#xrule[apis] #ipis_left$ #v(5pt) $#flower.sheet[ #v(0.5em) $#ipet_right &#xrule[apet] #ipet_left$ ]$ ] #slide(title: [Case reasoning])[ #set align(center) #let rflower(pistil_color) = scale(y: -100%, flower.one(( pistil: (color: pistil_color, size: 0.45cm), angle: 1/5 * calc.pi * 1rad, petals: ( (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), )) ).content) #v(-2.5em) $ rebase(#flower.one(( pistil: ( size: 3cm, color: aqua.lighten(50%), content: flower.one(( pistil: (size: 0.75cm, color: white), petals: ( (name: "1", color: red.lighten(5%)), (name: "1", color: red.lighten(20%)), (name: "1", color: red.lighten(35%)), (name: "1", color: red.lighten(50%)), (name: "1", color: red.lighten(65%)), ) )).content ), petal_size: 5cm, petals: ( (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), ) )).content) #xrule[srep] #move(dy: -4cm, scale(y: -100%, rebase(flower.one(( pistil: (size: 0.7cm, color: aqua.lighten(50%)), petal_size: 11cm, petals: ( (name: "p", content: rebase(move(dy: -0.9cm, scale(y: -100%, flower.one(stroke: none, ( pistil: (color: none, size: 1.3cm), // angle: 1/5 * calc.pi * 1rad, petals: ( (name: "1", content: rflower(red.lighten(5%))), (name: "1", content: rflower(red.lighten(20%))), (name: "1", content: rflower(red.lighten(35%))), (name: "1", content: rflower(red.lighten(50%))), (name: "1", content: rflower(red.lighten(65%))), ) )).content)))), (:), (:), (:)) )).content))) $ // #v(0.5em) // (color for emphasis, fill with any content/polarity) ] #slide(title: [Ex falso quodlibet])[ #v(-2.5em) $ rebase(#flower.one(( pistil: ( size: 3cm, color: aqua.lighten(50%), content: flower.one(( pistil: (size: 0.75cm, color: white), )).content ), petal_size: 5cm, petals: ( (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), (name: "1", color: aqua), ) )).content) #xrule[srep] #move(dy: -4cm, rotate(180deg, rebase(flower.one(( pistil: (size: 0.7cm, color: aqua.lighten(50%)), petal_size: 11cm, petals: ( (name: "p", content: rebase(move(dy: -0.9cm, flower.one(stroke: none, ( pistil: (color: none, size: 1.3cm), angle: 1/5 * calc.pi * 1rad, )).content))), (:), (:), (:)) )).content))) $ ] #slide(title: [QED])[ $ #rebase(flower.one(( pistil: (size: 1cm, content: $a$), petals: ((name: "p1", content: $$), (name: "p2", content: $c$), (name: "p3", content: $d$), (name: "p4", content: $e$), (name: "p5", content: $f$)) )).content) #xrule[epet] $ ] // #slide(title: [Example])[ // #let make_flower(f) = rebase(flower.one(f).content) // #alternatives[ // #make_flower(( // pistil: (size: 4cm, content: make_flower(( // pistil: (color: white, content: $x$), // petals: ((:), (name: "p2", content: $q(x)$), (:), (name: "p1", content: make_flower(( // pistil: (color: white, size: 0.8cm, content: $p(x)$), // )))) // ))), // petals: ((:), (name: "p", content: move(dy: -1cm, make_flower(( // pistil: (size: 2cm, content: $y #juxt p(y)$), // petals: ((:), (:), (name: "q", content: $q(y)$), (:)) // )))), (:), (:)) // )) // ] // ] #new-section-slide([*Metatheory*: Nature vs. Culture]) #slide(title: [Flowers as nested sequents])[ // #show math.equation: set text(font: "STIX Two Math") #let lbl(name) = [#h(1cm) (#name)] #side-by-side[ - *Sets* of variables $arrow(x)$ - *Multisets* of flowers $Phi$ - *Multisets* of petals $Delta$ #set align(center) #v(1em) $ phi, psi &eqq gamma csup Delta &#lbl[Flower] \ gamma, delta &eqq arrow(x) dot.c Phi &#lbl[Garden] \ \ Phi, Psi &eqq phi_1, dots, phi_n &#lbl[Bouquet] \ Gamma, Delta &eqq gamma_1; dots; gamma_n #h(0.8cm) &#lbl[Corolla] \ $ ][ $ arrow(x) dot.c Phi csup arrow(y_1) dot.c Psi_1; dots; arrow(y_n) dot.c Psi_n $ #v(0.25cm) $ #scale(x: 80%, y: 80%, reflow: true, rebase(flower.one(( pistil: (size: 1.5cm, content: $accent(x, arrow) #h(8pt) Phi$), petal_size: 5cm, petals: ( (name: "1", content: $accent(y_1, arrow) #h(8pt) Psi_1$), (name: "1", content: $accent(y_2, arrow) #h(8pt) Psi_2$), (name: "1", content: $accent(y_3, arrow) #h(8pt) Psi_3$), (name: "1", content: $accent(y_(i-1), arrow) #h(8pt) Psi_(n-1)$), (name: "1", content: $accent(y_n, arrow) #h(8pt) Psi_n$), ) )).content)) \ $ #set text(size: 22pt) $ forall arrow(x). (and.big Phi #limp or.big_i exists arrow(y_i). Psi_i) $ ] ] #slide(title: [Natural rules #nature])[ $ #nature = underbrace("(De)iteration", {#irule[poll$arrow.b$],#irule[poll$arrow.t$]}) union underbrace("Instantiation", {#irule[ipis],#irule[ipet]}) union underbrace("Scrolling", {#irule[epis]}) union underbrace("QED", {#irule[epet]}) union underbrace("Case reasoning", {#irule[srep]}) $ #pause #v(1em) // Let $Phi, Psi$ be _bouquets_, i.e. multisets of flowers. All rules are: - *Invertible*: if $Phi --> Psi$ then $Psi$ equivalent to $Phi$ #pause #thus "Equational" reasoning #pause - #alert[*Analytic*]: if $Phi --> Psi$ and $a$ occurs in $Psi$ then $a$ occurs in $Phi$ #pause #thus Reduces proof-search space ] #slide(title: [Cultural rules #culture])[ $ #culture = underbrace("Insertion", {#irule[grow],#irule[glue]}) union underbrace("Deletion", {#irule[crop],#irule[pull]}) union underbrace("Abstraction", {#irule[apis],#irule[apet]}) $ #pause #v(1em) - All rules are *non-invertible* - Some rules are *non-analytic* ] #slide(title: [Hypothetical provability])[ - Remember our paradigm: #align(center)[*proving $=$ erasing*] #pause - This works in arbitrary #alert[contexts] $X$ (i.e. one-holed bouquets) #pause - Formally: #definition[ For any bouquets $Phi$ and $Psi$, $Psi$ is _provable_ from $Phi$, written $Phi #ent Psi$, if for any context $X$ in which $Phi$ occurs and _pollinates_ the hole of $X$, we have $ #cfill($X$, $Psi$) --> #cfill($X$, phantom($Phi$)) $ ] ] #slide(title: [Cult-elimination])[ #theorem("Soundness")[ If $Phi --> Psi$ then $Psi #kent ^cal(K) Phi$ in every Kripke structure $cal(K)$. ] #pause #v(-1em) #theorem("Completeness")[ If $Phi #kent ^cal(K) Psi$ in every Kripke structure $cal(K)$, then $Phi #ent ^#nature Psi$. ] #pause #v(-1em) #corollary([Admissibility of #culture])[ If $Phi #ent Psi$ then $Phi #ent ^#nature Psi$. ] #pause #align(center)[ *Completeness* of #alert[analytic] fragment #nature! ] ] #new-section-slide([*The Flower Prover*]) #focus-slide[ _A *#link("http://www.lix.polytechnique.fr/Labo/Pablo.DONATO/flowerprover")[demo]* is worth a thousand pictures!_ ] #slide(title: [Paradigm])[ Another instance of *Proof-by-Action*: - *Direct manipulation* of the _goals_ themselves #pause - *Formulas* still supported, but #alert[superfluous] #pause - *Modal* interface to interpret click and DnD: $ #text(fill: eastern.darken(20%))[Proof] #text[mode] &arrow.l.r.double.long #text(fill: eastern.darken(20%))[Natural] #text[(invertible and analytic) rules] \ #text(fill: red.darken(20%))[Edit] #text[mode] &arrow.l.r.double.long #text(fill: red.darken(20%))[Cultural] #text[(non-invertible) rules] \ #text(fill: purple.darken(20%))[Navigation] #text[mode] &arrow.l.r.double.long #text(fill: purple.darken(20%))[Contextual] #text[closure (functoriality)] \ $ #pause - Possible actions immediately visible: #thus *discoverable* and *touch-friendly* ] #let step(name) = { pause h(1cm) xrule(name) h(-1cm) } #slide(title: [Towards Curry-Howard])[ #v(-4em) #scale(x: 75%, y: 75%, $ #rebase(flower.one(( pistil: (size: 2cm, content: $ #move(dx: -0.75cm, dy: 0.1cm, flower.one(( pistil: (color: white, size: 0.75cm, content: $A$), angle: 1rad / 2, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) \ #move(dy: -0.6cm, $A$) $), angle: 1rad / 2, petal_size: 4cm, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) #step[poll$arrow.b$] #rebase(flower.one(( pistil: (size: 2cm, content: $ #move(dx: -0.75cm, dy: 0.1cm, flower.one(( pistil: (color: white, size: 0.75cm, content: $$), angle: 1rad / 2, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) \ #move(dy: -0.6cm, $A$) $), angle: 1rad / 2, petal_size: 4cm, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) #step[srep] #h(-1em) #rebase(flower.one(( pistil: (size: 1cm, content: $A$), petal_size: 4.5cm, petals: ((:), (name: "1", content: move(dx: -0.75cm, flower.one(( pistil: (size: 0.75cm, content: $B$), angle: 1rad / 2, petals: ((:), (name: "a", content: $B$), (:), (:), (:), (:)) )).content)), (:), (:)), )).content) #h(1em) #step[poll$arrow.b$] #h(-1em) #rebase(flower.one(( pistil: (size: 1cm, content: $A$), petal_size: 4.5cm, petals: ((:), (name: "1", content: move(dx: -0.75cm, flower.one(( pistil: (size: 0.75cm, content: $B$), angle: 1rad / 2, petals: ((:), (name: "a", content: $$), (:), (:), (:), (:)) )).content)), (:), (:)), )).content) #h(1em) #step[epet] $) #set align(center) #pause #v(-1em) Where is the proof *object*?? #pause #v(1em) $ underbrace(overbracket("Direct manipulation", "Dynamic"), #text(size: 24pt)[#only(7)[Proofs] #only(8)[Construction]]) "of" underbrace(overbracket(#text[Flowers #emoji.flower.hibiscus], "Static"), #text(size: 24pt)[Statements #only(8)[$+$ Proofs]]) $ #v(1em) #uncover(8)[#alert[Curry-Howard] style *proof-term* annotations] ] #slide(title: [Towards Curry-Howard])[ #v(-4em) #move(dx: -1em, scale(x: 75%, y: 75%, $ #rebase(flower.one(( pistil: (size: 2.5cm, content: $f : #move(dx: -0.75cm, dy: 0.1cm, flower.one(( pistil: (color: white, size: 0.75cm, content: $A$), angle: 1rad / 2, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) \ #move(dx: 0cm, dy: -0.6cm, $x : A$) $), angle: 1rad / 2, petal_size: 4.5cm, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) #step[poll$arrow.b$] #rebase(flower.one(( pistil: (size: 2.5cm, content: $f x : #move(dx: -0.75cm, dy: 0.1cm, flower.one(( pistil: (color: white, size: 0.75cm, content: $$), angle: 1rad / 2, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) \ #move(dx: 0.4cm, dy: -0.6cm, $x : A$) $), angle: 1rad / 2, petal_size: 4.5cm, petals: ((:), (name: "1", content: $B$), (:), (:), (:), (:)), )).content) #step[srep] #h(-1em) #rebase(flower.one(( pistil: (size: 1cm, content: $x : A$), petal_size: 5cm, petals: ((:), (name: "1", content: $ #move(dy: 8mm, $"case"(f x) :$) \ #move(dx: -0.75cm, flower.one(( pistil: (size: 0.85cm, content: $y : B$), angle: 1rad / 2, petals: ((:), (name: "a", content: $B$), (:), (:), (:), (:)) )).content) $), (:), (:)), )).content) #h(1.5em) #step[poll$arrow.b$] #h(-1.5em) #rebase(flower.one(( pistil: (size: 1cm, content: $x : A$), petal_size: 5cm, petals: ((:), (name: "1", content: $ #move(dy: 8mm, $"case"(f x) :$) \ #move(dx: -0.75cm, flower.one(( pistil: (size: 0.85cm, content: $y : B$), angle: 1rad / 2, petals: ((:), (name: "a", content: $y : B$), (:), (:), (:), (:)) )).content) $), (:), (:)), )).content) $)) #v(-2em) #set align(center) #pause #thus Proof steps recorded _inside_ statements~~#text(size: 16pt)[(but no dependent types!)] #pause #rect(inset: 1em)[ $#text(fill: blue)[$t$] : #text(fill: red)[$phi$]$ #text(fill: red)[ #only(6)[Flower = Type = Normal term] #only("7-")[Flower = $#halert[Type = Normal term]$] ] #text(fill: blue)[ Proof step = Neutral term ] ] #show quote.where(block: false): it => { ["] + h(0pt, weak: true) + it.body + h(0pt, weak: true) + ["] if it.attribution != none [ #it.attribution] } #uncover("7-")[ #quote(attribution: [@miquel_implicative_2020])[ Blurring the frontier between proofs and types ] ] ] #slide(title: [Related works (non-exhaustive)])[ // #set text(size: 19pt) // - *Intuitionistic existential graphs:* // - @oostra_graficos_2010: original idea // - @minghui_graphical_2019: variant on Oostra's graphs // #pause - *Structural proof theory:* - @guenot_nested_2013: rewriting-based *nested sequent* calculi - @lyon_refining_2021 @girlando_intuitionistic_2023: *fully invertible* labelled sequent calculi // #pause - *Proof assistants:* - @ayers_thesis: #sys[Box] datastructure similar to flowers // #pause - *Categorical logic:* - @Johnstone2002-rm: #alert[coherent/geometric formulas] in *topos theory* - @bonchi_diagrammatic_2024: algebra of #sys[Beta] ~~#text(size: 16pt)[(previous talk!)] ] #slide(title: [Bibliography])[ #set cite(form: none) @Chaudhuri2013 #cite(label("DBLP:conf/cade/Chaudhuri21")) @clouston-annotation-free-2013 #cite(label("10.1145/3497775.3503692")) @guenot_nested_2013 @Guglielmi1999ACO #bibliography( "main.bib", style: "chicago-author-date", ) ]
https://github.com/alex-touza/fractal-explorer
https://raw.githubusercontent.com/alex-touza/fractal-explorer/main/paper/src/chapters/2_estudi_matemàtic_dels_objectes_fractals.typ
typst
#import "../environments.typ": * #import "../utilities.typ": * #import "../shortcuts.typ": * #import "@preview/dashy-todo:0.0.1": todo #import "@preview/cetz:0.2.2": canvas, draw, plot = Estudi matemàtic dels objectes fractals En aquesta part del treball, s'exposaran les matemàtiques que estudien els objectes fractals. La primera secció introdueix el concepte de dimensió topològica, que contextualitza la següent secció, que tracta la dimensió fractal. La segona i tercera secció estudien els exemples més coneguts dels dos grans tipus de fractals: els sistemes de funcions iterades i els fractals de funcions sobre el pla. A continuació, es presenten les definicions matemàtiques utilitzades en aquest capítol. Per motius de brevetat, algunes definicions conegudes al currículum de Batxillerat com la continuïtat d'una funció no s'han exposat. S'assumeix, també, un coneixement bàsic de teoria de conjunts. /*En un intent de simplificar les definicions, s'ha optat per no fer ús del terme _espai mètric_ i utilitzar més simplement el terme _conjunt_. Per aquest motiu, cal tenir en compte que sempre que es faci servir aquest últim terme, la definició és vàlida per a qualsevol espai mètric.*/ #def[Topologia sobre un conjunt][ Una _topologia_ $tau$ sobre un conjunt $X$ és una col·lecció de subconjunts oberts de $X$ tals que el conjunt buit i $X$ mateix estan en $tau$ i es compleix que tant la intersecció com la unió dels conjunts de cada subcol·lecció finita de $tau$ està dins $tau$. Simbòlicament: $ emptyset in tau, X in tau \ forall S in tau, union.big_(O in S) O in T and sect.big_(O in S) O in T $ La _topologia discreta_ és la col·lecció de tots els conjunts de $X$, i la _topologia indiscreta_ és simplement el conjunt buit i $X$. Hi ha moltes altres definicions alternatives de topologies, però aquesta és la més simple d'exposar. Aquesta estructura matemàtica s'exposa pel seu ús en definicions posteriors. ] <def-topologia> #def[Espai topològic][ Un _espai topològic_ és un parell ordenat $(X, tau)$ on $X$ és un conjunt i $tau$ és una topologia sobre $X$ (@def-topologia). ] <def-espai-topològic> #def[Transformació homeomorfa][ Una funció $f: A -> B$ on $A$ i $B$ són espais topològics (@def-espai-topològic) és una _transformació homeomorfa_ o un _homeomorfisme_ si es compleix que tant $f$ com $f^(-1)$ són contínues en tot el seu domini ($A$ i $B$ corresponentment) i que $f$ és bijectiva, és a dir, hi ha una relació un a un entre $A$ i $B$ (simbòlicament, $forall b in B med exists! a in A : f(a) = b$, on $exists!$ vol dir "existeix només un"). Diem que dos espais $A$ i $B$ són homomòrfics si existeix una transformació homeomorfa entre ells. Per exemple, la funció $f(x) = x^3$ és un homeomorfisme perquè és clarament bijectiva i contínua en tot $RR$, i la seva funció inversa $f^(-1)=root(3, x)$ és contínua. En canvi, la funció $g(x)=x^2$ ni és bijectiva ni la seva funció inversa $g^(-1)=sqrt(x)$ és contínua, així que no és un homeomorfisme. Intuïtivament, un homeomorfisme només deforma, no talla ni enganxa, encara que a vegades aquesta simplificació sovint és errònia (com amb la transformació d'una recta a un punt, que no és un homeomorfisme). Determinar si una certa transformació és un homeomorfisme és un exercici comú en topologia. ] <def-homeomorfisme> #def[Propietat topològica][ Una propietat $P$ és _topològica_ si per a qualsevol conjunt $X$, $P$ no varia si a $X$ se li aplica una transformació homeomorfa (@def-homeomorfisme). ] <def-prop-topologica> #def[Mesura de distància][ Una _mesura de distància_ sobre un conjunt $M$ és una funció $d$ que obté una parella de punts en $M$ i retorna un nombre real. Simbòlicament, $ d colon M times M -> RR^+ union {0} $ Una mesura de distància ha de complir els següents axiomes: + La distància d'un punt a si mateix és nul·la: $d(x, x) = 0$ + La distància de dos punts diferents és positiva: $x != y <=> d(x, y) > 0$ + La distància d'un punt $x$ a un punt $y$ és la mateixa que de $y$ a $x$. $d(x, y) = d(y, x)$ + Es compleix la desigualtat triangular: $d(x, z) <= d(x,y) + d(y, z)$ Per exemple, la distància $n$-euclidiana sobre $RR^n$ és una funció $d colon RR^n times RR^n -> RR^+ union {0}$ definida com $d(x, y) = sqrt(sum^n_(i=0) (x_i - y_i)^n)$ on $x = (x_0, ..., x_(n-1)), y = (y_0, ..., y_(n-1))$. ] <def-mesura-distancia> #def[Espai mètric][ Un _espai mètric_ definit com un parell ordenat $(M, d)$ on $M$ és un conjunt i $M$ és una mesura de distància sobre $M$ (@def-mesura-distancia). ] <def-espai-mètric> #def[Diàmetre][ Donat un conjunt $E = {x_1, x_2, ..., x_n}$ dins un espai mètric $(M, d)$ (@def-espai-mètric), definim el seu _diàmetre_, denotat amb $abs(E)$, com la distància més gran possible entre qualsevol parella de punts. Simbòlicament, $abs(E) = sup { d(x_i, x_j) : x_i,x_j in E}$. ] #def[Recobriment][ Donat un conjunt $A$ dins un espai mètric $(M, d)$ (@def-espai-mètric), un _recobriment_ és una col·lecció de conjunts $cal(C) = { E_i }$ tals que la unió de tots els conjunts de la col·lecció conté el conjunt $A$.#footnote[En algunes fonts es requereix que els conjunts que formen els recobriments siguin també subconjunts de $A$. Per la geometria fractal, però, la definició presentada és més útil.] Simbòlicament, $ cal(C)(A) = {E_i } : A subset.eq union.big_(E_i in cal(C)) E_i $ Un _recobriment obert_ és un recobriment format per conjunts oberts. ] <def-recobriment> #def[Recobriment-$delta$][ Donat un conjunt $A$ dins un espai mètric $(M, d)$ (@def-espai-mètric), un _recobriment-$delta$_ on $delta$ és un nombre real positiu és una col·lecció comptable ${ E_i }$ de conjunts amb diàmetres $abs(E_i) <= delta$ tals que la unió de tots els conjunts de la col·lecció conté el conjunt $A$. Simbòlicament#footnote[La definició real d'un recobriment fa ús de _conjunts indexats_ però s'ha optat per usar una definició simplificada.]: $ cal(C)_delta (A) = {E_i : abs(E_i) <= delta}, A subset.eq union.big_(E_i in cal(C)) E_i $ ] <def-recobriment-delta> #def[Malla][ La _malla_ d'un recobriment és el diàmetre més gran dels conjunts que el formen. Simbòlicament, $ "malla"(C) = sup{abs(E_i) : E_i in cal(C)} $ ] <def-malla> #def[Espai mètric compacte][ Un espai mètric $(M, d)$ (@def-espai-mètric) és _compacte_ si per a qualsevol recobriment obert $cal(C)$ (@def-recobriment) existeix una subcol·lecció finita $cal(F) subset.eq cal(C)$ tal que $ A subset.eq union.big_(E in cal(F)) E $ Si $M subset.eq RR^n$, aleshores $(M, d)$ és compacte si $M$ és fitat i tancat. Per exemple, el conjunt $A = (0, 1)$ no és compacte perquè és obert; el conjunt $B = (-infinity, 4]$ no és compacte perquè és no fitat, i el conjunt $C = [0, 1]$ és compacte perquè és fitat i tancat. ] <def-compacte> #def[Ordre][ Donada una col·lecció de conjunts $cal(F)$ en un espai mètric $(M, d)$ (@def-espai-mètric), el seu _ordre_ és el major nombre de conjunts que se superposen en un sol punt. Formalment, l'ordre és l'enter més petit $k$ tal que cap punt en $M$ pertany a més de $k$ conjunts en $cal(F)$ a la vegada. Simbòlicament, $ "ord"(cal(F)) = max{abs({A in cal(F) : x in A}) : x in M} $ on l'operador $abs(Y)$ indica la cardinalitat del conjunt, és a dir, el nombre d'elements. ] <def-ordre> #def[Refinament][ Donat un recobriment $cal(C)$ (@def-recobriment) d'un espai topològic $(M, d)$ és un altre recobriment $cal(R)$ del mateix espai tal que cada conjunt de $cal(R)$ està en algun conjunt de $cal(C)$. Simbòlicament, $ cal(R)(cal(C)) = {E_i : exists C in cal(C) : E_i in C }, A subset.eq union.big_(E_i in cal(C)) E_i $ Intuïtivament, un refinament és un segon recobriment més petit que un primer recobriment, inclòs en aquest. ] <def-refinament> /* #def[Funció gamma][ La _funció gamma_ $Gamma(z)$ està definida als nombres complexos amb part real positiva i és una extensió del concepte de factorial, definit només a nombres enters positius, a aquest conjunt superior. La funció es defineix així: $ Gamma(z) = integral^infinity_0 t^(z-1) e^(-t) dif t $ Es compleix que, per a tot $n$ enter positiu, $Gamma(n) = (n-1)!$, i, similarment al factorial, per a tot $z$ complex, $Gamma(z+1) = z Gamma(z)$. ] <funcio-gamma> */ // p.92 == Dimensió topològica /* A la geometria elemental, és ben conegut per tothom que un punt té dimensió 0, una recta té dimensió 1, etcètera. Però el concepte de dimensió també s'associa a qualsevol conjunt. */ Sovint, informalment, es defineix la dimensió com el nombre d'eixos de coordenades. Quan es tracta de determinar la dimensió d'un espai euclidià #footnote[El terme _espai euclidià_ es pot referir a un entorn $EE^3$ o $EE^n$ depenent del context.] $EE^n$, fer-ho és trivial: per definició, la seva dimensió és $n$, és a dir, el nombre de coordenades que hem de fer servir per localitzar qualsevol punt a l'espai. Però és més interessant trobar la dimensió dels propis objectes, que bé podem inserir en un espai. Per tant, com que el nombre d'eixos de coordenades és un valor de l'entorn i no del propi objecte, aquesta definició informal resulta ser poc útil. Com podem definir amb més precisió la dimensió per a qualsevol conjunt? A les matemàtiques aquest terme té moltes definicions diferents, de vegades equivalents i altres no. En aquest capítol ens centrarem en la dimensió topològica i dues de les seves definicions. /* A la geometria fractal, és fonamental el concepte de _dimensió_. AquestaEn aquesta secció definirem amb rigor aquest terme, començant pels casos més simples amb la noció de dimensió comuna i acabant amb la dimensió fractal més utilitzada. Utilitzem el terme _dimensió comuna_ per diferenciar el concepte usual de dimensió utilitzat en geometria bàsica i les diferents dimensions fractals. */ === Dimensió intrínseca Anomenem dimensió intrínseca o paramètrica d'un objecte el nombre de paràmetres requerits per obtenir els punts que el formen (@def-dim-intrinseca). #def[Dimensió intrínseca][ Si $B$ és un conjunt i $P colon A -> B$ és la funció que retorna tots els punts de $B$, la _dimensió intrínseca_ de $B$ és el nombre mínim de variables independents necessàries. ] <def-dim-intrinseca> Aleshores, per trobar la dimensió intrínseca, n'hi ha prou amb trobar una funció que defineixi els punts del conjunt. Per mostrar de forma senzilla aquest mètode, demostrem les dues proposicions següents: #proposition[ Una circumferència té dimensió 1. ] <prop-dim-circum> #proposition[ Un pla en $RR^3$ té dimensió 2. ] <prop-dim-pla> #demo[de @prop-dim-circum][ Aquesta proposició podria semblar contraintuïtiva, ja que no podem traçar una circumferència en $RR^1$ (i.e. en una línia contínua) però sí en $RR^2$ (i.e. el pla). Tanmateix, mitjançant la parametrització podem demostrar-ho. Podem trobar les coordenades d'una circumferència $c$ amb la seva equació paramètrica: $ c#h(0%): cases( x = r cos(theta), y = r sin(theta) ) $ on $r$ és una constant que indica el radi de la circumferència. El paràmetre $theta$ és l'angle que forma el vector $accent(e_1, arrow)$ amb el vector $accent(O P, arrow)$. Hom pot trobar, aleshores, un punt $P$ que pertany a la circumferència $c$ només sabent el valor de l'angle $theta$ (recordem que el radi $r$ és una constant): $ P(theta) = (x(theta), y(theta)) = (r cos(theta), r sin(theta)) $ Per tant, com només fa falta un sol paràmetre per obtenir els punts que formen la circumferència, aquest té dimensió 1.#footnote[Recordem que l'interior d'una circumferència no forma part d'ella. Quan ens referim a l'àrea d'una circumferència, llavors, realment estem parlant del seu interior. Això s'aplica a tota la resta de formes geomètriques bàsiques.] ] #demo[de @prop-dim-pla][ Aquesta proposició podria semblar òbvia, però demostrem-ho amb el mètode de la parametrització per il·lustrar millor el concepte de dimensió. Similarment a la demostració anterior, utilitzem l'equació paramètrica del pla $pi$ que s'estudia. Siguin $accent(O P, arrow) = (p_1, p_2, p_3)$ el vector posició d'un punt del pla i $accent(u, arrow) = (u_1, u_2, u_3)$ i $accent(v, arrow) = (v_1, v_2, v_3)$ vectors paral·lels al pla linealment independents. Aleshores, amb els paràmetres $lambda$ i $mu$, definim el pla: $ pi#h(0%): cases( x = p_1 + lambda u_1 + mu v_1, y = p_2 + lambda u_2 + mu v_2, z = p_3 + lambda u_3 + mu v_3, ) $ de la qual obtenim una funció que retorni qualsevol punt del pla: $ P(lambda, mu) = (p_1 + lambda u_1 + mu v_1, p_2 + lambda u_2 + mu v_2, p_3 + lambda u_3 + mu v_3) $ Per tant, com que podem expressar els punts del pla $pi$ amb dos paràmetres, l'objecte té dimensió 2. De nou, és interessant observar que, tot i que el pla es trobi en un entorn tridimensional, a $RR^3$, l'objecte en si té dimensió 2. Per reiterar-ho, si, hipotèticament, el pla estigués en un espai euclidià $EE^4$, aleshores tindríem quatre equacions enlloc de tres, però la dimensió seguiria sent 2. ] Observeu com si haguéssim aplicat la definició informal amb "eixos de coordenades", erròniament hauríem associat la dimensió 2 a la circumferència i la dimensió 3 al pla. La dimensió és una propietat intrínseca de l'objecte, així que no pot dependre de l'entorn en què estigui inserit. Ara, considerem una corba a $RR^2$. Una corba es pot deformar en una recta a $RR^1$, però, intuïtivament, no podem transformar una recta en un punt només deformant-lo (és a dir, sense tallar ni enganxar) perquè una recta té una llargada mentre que un punt no en té (@fig-homeomorfismes). Observeu com els dos primers objectes, la corba i la recta, són ambdós dimensió 2, però el punt té dimensió 1. Això fa pensar que si els objectes no tenen la mateixa dimensió, aleshores certes transformacions no són possibles. Aquestes deformacions s'anomenen _homeomorfismes_ (@def-homeomorfisme) i, per tant, la dimensió és una propietat topològica (@def-prop-topologica) perquè les transformacions homeomorfes no alteren la dimensió de l'objecte. Per aquest motiu, el concepte de dimensió que s'ha exposat sol ser referit com a _dimensió topològica_. #figure(caption: [Una corba en un pla es pot deformar en una recta, però cap dels dos en un punt. La primera transformació és un homeomorfisme i la segona no ho és.])[ #canvas({ import draw: * line((-3, 1.5), (4, 1.5), stroke: blue.lighten(60%)) let transf = gray.lighten(50%) line((-3, 1.5), (-3, 1), stroke: transf) line((4, 2), (4, 1.5), stroke: transf) line((3, 2), (3, 1.5), stroke: transf) line((1, 1.5), (1, 1.2), stroke: transf) line((0, 1.5), (0, 0.85), stroke: transf) line((-1, 1.5), (-1, 0.75), stroke: transf) line((-2, 1.5), (-2, 0.8), stroke: transf) bezier-through((-3, 1), (3, 2), (4, 2)) line((5, 1.5), (11, 1.5)) circle((12,1.5), radius: 0.03, fill: black) }) ] <fig-homeomorfismes> /* === Dimensió per comportament local La parametrització no és l'única definició de dimensió intrínseca. Un altre forma de trobar-la és estudiant el seu comportament local, que sovint és més fàcil de trobar que la parametrització en situacions una mica més complexes. Així, podem deduir intuïtivament que una circumferència és de dimensió 1 */ === Dimensió de recobriment de Lebesgue <cap-lebesgue-recobriment> ==== Explicació intuïtiva Sovint, la parametrització resulta no ser un bon mètode fora de geometria euclidiana elemental. En aquesta secció exposarem una definició alternativa de la dimensió topològica. Considerem l'interior d'un triangle i una corba. Clarament, el primer té dimensió 2 i el segon, 1 i, aleshores, el primer té superfície i el segon no (@fig-dim-lebesgue-1). Per expressar la dimensió topològica, tractem de trobar una altra forma d'expressar que un objecte té superfície o no. #figure(caption: [Un triangle té superfície i una corba no.])[ #canvas({ import draw: * line((0,1), (4, 1), (2, 4), close: true, fill: gray.lighten(80%)) bezier-through((5,1), (7, 3), (10, 2), ) }) ] <fig-dim-lebesgue-1> Creem un recobriment obert a cada forma i ens fixem en els solapaments. #figure(caption: [Exemple de recobriment amb tres conjunts per al triangle i dos per a la corba.])[ #canvas({ import draw: * line((0,1), (4, 1), (2, 4), close: true, fill: gray.lighten(80%)) bezier-through((5,1), (7, 3), (10, 2), ) let draw-set(..pts, color)=catmull(..pts, close: true, stroke: color, fill: color.transparentize(70%)) draw-set((1, 3), (-0.2, 1), (2, 1), green) draw-set((3, 3), (2, 1), (4.2, 1), red) draw-set((2, 4.2), (3, 2), (2, 1.25), (1, 2), purple) draw-set((5, 0.5), (5, 3), (8, 3), green) draw-set((10, 1.8), (10, 3), (8, 3), purple) //circle((1.25, 2.85), radius: 0.1, fill: blue.transparentize(40%), stroke: none) //circle((2.8, 2.85), radius: 0.1, fill: blue.transparentize(40%), stroke: none) circle((2, 1.3), radius: 0.1, fill: blue.transparentize(40%), stroke: none) circle((8, 3), radius: 0.1, fill: blue.transparentize(40%), stroke: none) }) ] <fig-dim-lebesgue-2> Resulta que si maximitzem el nombre de conjunts que formen part dels recobriments i tractem de minimitzar el nombre de punts que es troben a més d'un conjunt, observem que, al triangle, tenim un màxim tres conjunts que contenen un mateix punt (@fig-dim-lebesgue-2) i, a la corba, dos. Això fa pensar que aquest nombre de solapaments està relacionat amb la dimensió topològica. ==== Definició formal Aquesta altra definició de dimensió topològica s'anomena dimensió de recobriment de Lebesgue (@def-dim-lebesgue). #def[Dimensió de recobriment de Lebesgue o dimensió topològica][ Sigui $n$ un nombre enter tal que $n >= 1$. Diem que un conjunt $S$ té _dimensió de recobriment de Lebesgue_ $<= n$ si i només si cada recobriment obert de $S$ (@def-recobriment) té un refinament (@def-refinament) amb ordre de com a màxim $n$ (@def-ordre). Aleshores, clarament, el valor de la dimensió de recobriment de Lebesgue és $n$ si és $<= n$ però no $<= n-1$./*#footnote[La definició real fa servir refinaments, però l'autor no ha pogut arribar a entendre el seu propòsit i, segons ha pogut comprovar, l'ús directe dels recobriments no sembla afectar la definició.]*/ @Edgar1990 ] <def-dim-lebesgue> L'explicació detallada de la definició es troba a l'annex. Apliquem-la pas a pas demostrant les següents proposicions: #proposition[Una corba té dimensió 1.] <prop-cim-corba> #proposition[L'interior d'un triangle té dimensió 2.] <prop-dim-triangle> #demo[de @prop-cim-corba][ Adonem-nos que un recobriment d'una corba cobrirà tot la corba amb un sol conjunt o, si la col·lecció en té més d'un, per força tindrà algun solapament. Com hem observat a la @fig-dim-lebesgue-2, ] /* ==== Teorema per a espais mètrics compactes La dimensió de recobriment es pot calcular de forma més senzilla en espais mètrics compactes, cosa que serà útil per trobar el seu valor a les fractals estudiades a les següents seccions.- Recordem que un espai mètric compacte dins de $RR^n$ (@def-compacte) és un espai fitat i tancat. #theorem[Teorema de la dimensió de recobriment de Lebesgue per a espais mètrics compactes][ Siguin $S$ un espai mètric compacte i $n >= 1$ un enter. Si i només si per cada $epsilon > 0$ existeix un recobriment obert de $S$ (@def-recobriment) amb ordre $<= n$ (@def-ordre) i malla $<= epsilon$ (@def-malla). ] */ == Dimensió fractal <cap-dimensio-fractal> Fins ara hem estudiat el concepte dimensió en formes bàsiques: corbes, circumferències, plans, rectes... Tanmateix, la dimensió topològica resulta ser insuficient per estudiar els objectes fractals, ja que molts dels seus resultats no donen informació sobre la seva estructura. Les dimensions fractals, en canvi, proveeixen informació sobre la rugositat de l'objecte. En aquesta secció s'estudiaran dues de les dimensions fractals i una situació comuna en què el càlcul d'aquests valors resulta ser més simple. === Dimensió de Hausdorff ==== Mesura de Lebesgue Considerem el concepte bàsic de distància. Un espai euclidià és un espai mètric (@def-espai-mètric) $EE^n = (RR^n, d)$ on $d$ és la distància euclidiana (@def-mesura-distancia). Aleshores, a $EE^2$, $d(x, y) = sqrt((x_0 - y_0)^2 + (x_1 - y_1)^2 )$ Quan parlem de mesura de Lebesgue, és només una forma més elegant de referir-se a les mesures convencionals de llargada, àrea, volum, etc, per a $RR^1$, $RR^2$, $RR^3$, ..., $RR^n$#footnote[Evidentment, les definicions de dimensions no només s'apliquen a espais euclidians, però aquí només discutim aquests per simplificar l'explicació.]. És a dir, és una generalització del concepte de _llargada_ per a qualsevol dimensió $n$. Denotem $cal(L)^n$ com la mesura de Lebesgue a $RR^n$ (altres notacions en són $lambda^n$ o $"vol"^n$). Considerem una corba $A$ en un pla, que és una varietat $RR^1$ a $RR^2$. La mesura de Lebesgue no ens permetria calcular la llargada d'aquesta corba: $cal(L)^2(A) = 0$ perquè $cal(L)^2$ és l'àrea i una corba no en té, i $cal(L^1)(A)$ no existeix perquè $cal(L)^n$ només funciona per a subconjunts de $RR^n$. En general, la mesura de Lebesgue no és convenient quan tenim un subconjunt $m$-dimensional de $RR^n$ amb $m < n$ @morgan-measures. #figure(caption: [Una corba no té àrea, però la llargada tampoc es pot calcular amb la mesura de Lebesgue.])[ #canvas({ import draw: * bezier-through((3,1), (6, 2), (10, 1), ) }) ] /* #figure( canvas(length: 3cm, { import draw: * set-style( mark: (fill: black, scale: 2), stroke: (thickness: 0.4pt, cap: "round"), angle: ( radius: 0.3, label-radius: .22, fill: green.lighten(80%), stroke: (paint: green.darken(50%)) ), content: (padding: 1pt) ) grid((-1.25, -1.25), (1.25, 1.25), step: 0.25, stroke: gray + 0.2pt) line((-1.25, 0), (1.25, 0), mark: (end: "stealth")) line((0, -1.25), (0, 1.25), mark: (end: "stealth")) }) ) */ ==== Mesura de Hausdorff La mesura de Hausdorff ve motivada per calcular la _llargada_ (és clar, de forma genèrica per a qualsevol dimensió) de qualsevol subconjunt d'un espai mètric, evitant els problemes que causa la mesura de Lebesgue. Consisteix en realitzar recobriments amb un diàmetre dels conjunts (@def-recobriment-delta) cada vegada més petit, de manera que quan siguin infinitament petits i, per tant, el recobriment estigui format per un nombre infinit de conjunts, podrem obtenir la llargada $s$-dimensional del conjunt (@fig-dim-hausdorff). #figure(caption: [Visualització del funcionament de la mesura de Hausdorff per a una corba en un pla. Els diàmetres dels conjunts (en blau) es fan cada vegada més petits, obtenint un valor cada vegada més precís de la llargada del conjunt en qüestió (en negre).])[ #canvas({ import draw: * bezier((0, 1), (2, 3), (5, 1)) bezier((5, 1), (7, 3), (10, 1)) let points = ((0, 1), (1.4, 1.05), (2.8, 1.35), (2.7, 2.5), (2, 3)) set-style(mark: (symbol: "|", width: 0.3)) for (i, p) in points.slice(0, -1).enumerate() { line(p, points.at(i + 1), stroke: blue.transparentize(50%)) } let points = ((5, 1), (5.3, 1), (5.6, 1), (5.9, 1), (6.2, 1.05), (6.5, 1.05), (6.8, 1.1), (7.1, 1.15), (7.4, 1.2), (7.7, 1.3), (8, 1.5), (8.1, 2), (7.8, 2.35), (7.5, 2.6), (7.2, 2.9), (7, 3)) set-style(mark: (symbol: "|", width: 0.3)) for (i, p) in points.slice(0, -1).enumerate() { line(p, points.at(i + 1), stroke: blue.transparentize(50%)) } }) ] <fig-dim-hausdorff> #def[Mesura de Hausdorff][ Definim la _mesura de Hausdorff_ $s$-dimensional com la suma més petita possible de diàmetres elevats a $s$ dels conjunts que formen una cobertura-$delta$, amb $delta$ tendint a zero. Simbòlicament: $ hausdorff = lim_(delta -> 0) inf {sum_i abs(E_i)^s : abs(E_i) <= delta, A subset.eq union.big_i E_i }, s in [0, +infinity), delta in RR $ ] <def-mesura-hausdorff> La justificació de la definició formal està explicada amb summe detall a l'annex corresponent. /* #theorem[Relació entre la mesura de Lebesgue i la mesura de Hausdorff][ Donat un conjunt $A$ $n$-dimensional tal que $A subset RR^n$ i la mesura de Hausdorff $n$-dimensional del conjunt $A$ on $n$ és un nombre enter positiu, la mesura de Hausdorff i la mesura de Lebesgue segueixen la relació $ cal(H)^n (A) = c_n^(-1) cal(L)^n (A) $ on $c_n$ és el volum d'una $n$-esfera de diàmetre 1, que es calcula amb l'expressió $ c_n = pi^(n/2) / Gamma(n/2 + 1) $ on $Gamma$ és la funció gamma (@funcio-gamma). /*A més, desenvolupant aquesta funció, podem obtenir expressions equivalents més simples segons la paritat de $n$ per facilitar el càlcul @falconer-unit-ball: $ c_n = cases( display( pi^(n/2)/(n/2)! ) &n eq.triple 0" "(mod 2), display( display(pi^((n-1)/2) ((n-1)/2)! ) / n! ) wide&n eq.triple 1" "(mod 2) ) $*/ ] */ /* Considerem de nou l'@eq-hausdorff-delta. Observem que si $delta < 1$, #hausdorffdelta decreix o no augmenta amb $s$. És a dir, que per $s < t$ i $delta < 1$, necessàriament es compleix que: $ cal(H)^s_delta (A) >= cal(H)^t_delta (A) $ I com @eq-hausdorff és el límit amb $delta -> 0$, similarment: */ ==== Definició de la dimensió de Hausdorff Resulta que la mesura de Hausdorff compleix les següents proposicions, la demostració dels quals es troba a l'annex: #proposition[ Si $cal(H)^s (A) > 0$ i $s < t$, aleshores $cal(H)^t (A) = +infinity$. ] <hausdorff-prop1> #proposition[ Si $cal(H)^t (A) < +infinity$ i $s < t$, aleshores $cal(H)^s (A) = 0$. ] <hausdorff-prop2> Intuïtivament, aquestes proposicions haurien de semblar raonables; de la mateixa manera que la mesura de Lebesgue $n$-dimensional només s'aplica a conjunts $n$-dimensionals en $RR^n$ ---ja que no tindria sentit intentar mesurar la llargada pròpiament dita d'un cub, o el volum d'una recta---, la mesura de Hausdorff també és només finita per a un valor específic de dimensió. Aquestes proposicions impliquen que la mesura de Hausdorff $s$-dimensional és o bé $+infinity$ per a valors petits de $s$ o bé 0 per a s valors grans de $s$, excepte un valor específic. Aquest valor de $s$ és la dimensió de Hausdorff. Per tant, podem definir-la així: $ dim_"H " A = inf{s : hausdorff = 0} = sup{s : hausdorff = +infinity} $ El fet sorprenent de la mesura de Hausdorff, que marca la diferència amb la mesura de Lebesgue, tanmateix, és que aquest valor $s$, la dimensió de Hausdorff, per definició, pot no ser un enter. === Dimensió autosimilar //p. 118 === Condició del conjunt obert == Fractals de sistemes de funcions iterades === Definició //Aquests tipus de fractals també s'anomenen Sistemes de Funcions Iterades, o _IFS_ per abreviar. === Triangle i catifa de Sierpinski ==== Construcció ==== Càlcul de la dimensió topològica #proposition[El triangle de Sierpinski té dimensió topològica 1.] <prop-sierpinski-dim> #demo[de @prop-sierpinski-dim][ ] El conjunt $S_0$ està, lògicament, format per un sol triangle equilàter de costat 1. El conjunt $S_1$ està format per tres conjunts $S_0$ cadascun de costat $1/2$. Com que de cada triangle n'apareixen tres a la següent iteració, inductivament, deduïm que el conjunt $S_k$ conté $3^k$ triangles de costat $2^(-k)$ cadascun. === Conjunts de Cantor <cap-cantor> Hi ha múltiples conjunts de Cantor, però aquí ==== Definició geomètrica El conjunt triàdic de Cantor es defineix en $RR^1$ a partir del segment $[0,1]$. Anomenarem aquest punt de partida $C_0$. $C_1$ es construeix eliminant el segon terç del segment, obtenint $C_1 = [0, 1 slash 3] union [2 slash 3, 1]$. En general, $C_(k+1)$ és el resultat d'eliminar el segon terç de cadascun dels segments de què $C_k$ està format. Aleshores, el conjunt de Cantor es defineix com $C = lim_(n->+infinity) C_n$. #figure(caption: [Primeres cinc iteracions del conjunt de Cantor])[ #canvas({ import draw: * }) ] ==== Definició aritmètica ==== Propietats === Estel de Koch == Fractals de funcions sobre el pla === Conjunts de Julia /*p. 27*/ #figure(caption: [])[ #canvas({ import draw: * let c = () let julia line((0,1), (4, 1), (2, 4), close: true, fill: gray.lighten(80%)) bezier-through((5,1), (7, 3), (10, 2), ) }) ] === Conjunt de Mandelbrot === Fractal de Newton /* == Atractors estranys === Teoria del caos === Atractor de Lorentz == Fractals tridimensionals Quaternions */
https://github.com/kalxd/morelull
https://raw.githubusercontent.com/kalxd/morelull/master/README.md
markdown
# morelull ![睡睡菇](https://media.52poke.com/wiki/thumb/c/c9/755Morelull.png/240px-755Morelull.png) 面向民科(我自己)技术文档。专注于中文排版。 不善于色彩设计,只堪入目耳。 # 简介 *morelull*原本为LaTeX模板,现切换成了Typst模板。 *morelull*在原有基础,设定了新字体、重写部分默认样式。 一些typst无法解决的问题,该模板也同样存在:默认开头空两格…… 整体主题色彩依据[中国色彩](https://github.com/kalxd/happiny)。 # 依赖 [a2c-nums](https://github.com/typst/packages/tree/main/packages/preview/a2c-nums/0.0.1) :阿拉伯数字转为中文数字。 # 安装 模板暂时无法通过网络安装,可手动安装到本地,见[typst包文档](https://github.com/typst/packages?tab=readme-ov-file#local-packages)。 # 使用模板 ```typst #import "local/morelull:0.5.0": morelull, t #show: morelull.with(标题: "文章的标题", 作者: "文章的作得") = 第一段 #t 开始你的表演…… ``` *morelull*仅提供两个函数,一个是模板函数`morelull`,另一个是开头缩进`t`。 # 说明 模板使用了方正字体,需要额外安装;字体不存在的情况下,编译无法通过。 # 发布协议 GPL v3
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/outrageous/0.1.0/README.md
markdown
Apache License 2.0
# Outrageous Easier customization of outline entries. ## Examples For the full source see [`examples/basic.typ`](./examples/basic.typ) and for more examples see the [`examples` directory](./examples). ### Default Style ![Example: default style](./example-default.png) ```typ #import "@preview/outrageous:0.1.0" #show outline.entry: outrageous.show-entry ``` ### Custom Settings ![Example: custom settings](./example-custom.png) ```typ #import "@preview/outrageous:0.1.0" #show outline.entry: outrageous.show-entry.with( // the typst preset retains the normal Typst appearance ..outrageous.presets.typst, // we only override a few things: // level-1 entries are italic, all others keep their font style font-style: ("italic", auto), // no fill for level-1 entries, a thin gray line for all deeper levels fill: (none, line(length: 100%, stroke: gray + .5pt)), ) ``` ## Usage ### `show-entry` Show the given outline entry with the provided styling. Should be used in a show rule like `#show outline.entry: outrageous.show-entry`. ```typ #let show-entry( entry, font-weight: presets.outrageous-toc.font-weight, font-style: presets.outrageous-toc.font-style, vspace: presets.outrageous-toc.vspace, font: presets.outrageous-toc.font, fill: presets.outrageous-toc.fill, fill-right-pad: presets.outrageous-toc.fill-right-pad, fill-align: presets.outrageous-toc.fill-align, body-transform: presets.outrageous-toc.body-transform, label: <outrageous-modified-entry>, state-key: "outline-page-number-max-width", ) = { .. } ``` **Arguments:** For all the arguments that take arrays, the array's first item specifies the value for all level-one entries, the second item for level-two, and so on. The array's last item will be used for all deeper/following levels as well. - `entry`: [`content`] &mdash; The [`outline.entry`](https://typst.app/docs/reference/meta/outline/#definitions-entry) element from the show rule. - `font-weight`: [`array`] of ([`str`] or [`int`] or `auto` or `none`) &mdash; The entry's font weight. Setting to `auto` or `none` keeps the context's current style. - `font-style`: [`array`] of ([`str`] or `auto` or `none`) &mdash; The entry's font style. Setting to `auto` or `none` keeps the context's current style. - `vspace`: [`array`] of ([`relative`] or [`fraction`] or `none`) &mdash; Vertical spacing to add above the entry. Setting to `none` adds no space. - `font`: [`array`] of ([`str`] or [`array`] or `auto` or `none`) &mdash; The entry's font. Setting to `auto` or `none` keeps the context's current font. - `fill`: [`array`] of ([`content`] or `auto` or `none`) &mdash; The entry's fill. Setting to `auto` keeps the context's current setting. - `fill-right-pad`: [`relative`] or `none` &mdash; Horizontal space to put between the fill and page number. - `fill-align`: [`bool`] &mdash; Whether `fill-right-pad` should be relative to the current page number or the widest page number. Setting this to `true` has the effect of all fills ending on the same vertical line. - `body-transform`: [`function`] or `none` &mdash; Callback for custom edits to the entry's body. It gets passed the entry's level ([`int`]) and body ([`content`]) and should return [`content`] or `none`. If `none` is returned, no modifications are made. - `page-transform`: [`function`] or `none` &mdash; Callback for custom edits to the entry's page number. It gets passed the entry's level ([`int`]) and page number ([`content`]) and should return [`content`] or `none`. If `none` is returned, no modifications are made. - `label`: [`label`] &mdash; The label to internally use for tracking recursion. This should not need to be modified. - `state-key`: [`str`] &mdash; The key to use for the internal state which tracks the maximum page number width. The state is global for the entire document and thus applies to all outlines. If you wish to re-calculate the max page number width for `fill-align`, then you must provide a different key for each outline. **Returns:** [`content`] ### `presets` Presets for the arguments for [`show-entry()`](#show-entry). You can use them in your show rule with `#show outline.entry: outrageous.show-entry.with(..outrageous.presets.outrageous-figures)`. ```typ #let presets = ( // outrageous preset for a Table of Contents outrageous-toc: ( // ... ), // outrageous preset for List of Figures/Tables/Listings outrageous-figures: ( // ... ), // preset without any style changes typst: ( // ... ), ) ``` ### `align-helper` Utility function to help with aligning multiple items. ```typ #let align-helper(state-key, what-to-measure, display) = { .. } ``` **Arguments:** - `state-key`: [`str`] &mdash; The key to use for the [`state`] that keeps track of the maximum encountered width. - `what-to-measure`: [`content`] &mdash; The content to measure at this call. - `display`: [`function`] &mdash; A callback which gets passed the maximum encountered width and the width of the current item (what was given to `what-to-measure`), both as [`length`], and should return [`content`] which can make use of these widths for alignment. **Returns:** [`content`] [`str`]: https://typst.app/docs/reference/foundations/str/ [`int`]: https://typst.app/docs/reference/foundations/int/ [`bool`]: https://typst.app/docs/reference/foundations/bool/ [`content`]: https://typst.app/docs/reference/foundations/content/ [`label`]: https://typst.app/docs/reference/meta/label/ [`function`]: https://typst.app/docs/reference/foundations/function/ [`array`]: https://typst.app/docs/reference/foundations/array/ [`relative`]: https://typst.app/docs/reference/layout/relative/ [`fraction`]: https://typst.app/docs/reference/layout/fraction/ [`state`]: https://typst.app/docs/reference/meta/state/ [`length`]: https://typst.app/docs/reference/layout/length/
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/foundations/int.typ
typst
--- int-base-alternative --- // Test numbers with alternative bases. #test(0x10, 16) #test(0b1101, 13) #test(0xA + 0xa, 0x14) --- int-base-binary-invalid --- // Error: 2-7 invalid binary number: 0b123 #0b123 --- int-base-hex-invalid --- // Error: 2-8 invalid hexadecimal number: 0x123z #0x123z --- int-constructor --- // Test conversion to numbers. #test(int(false), 0) #test(int(true), 1) #test(int(10), 10) #test(int("150"), 150) #test(int("-834"), -834) #test(int("\u{2212}79"), -79) #test(int(10 / 3), 3) #test(int(-58.34), -58) #test(int(decimal("92492.193848921")), 92492) #test(int(decimal("-224.342211")), -224) --- int-constructor-bad-type --- // Error: 6-10 expected integer, boolean, float, decimal, or string, found length #int(10pt) --- int-constructor-bad-value --- // Error: 6-12 invalid integer: nope #int("nope") --- int-constructor-float-too-large --- // Error: 6-27 number too large #int(9223372036854775809.5) --- int-constructor-float-too-large-min --- // Error: 6-28 number too large #int(-9223372036854775809.5) --- int-constructor-decimal-too-large --- // Error: 6-38 number too large #int(decimal("9223372036854775809.5")) --- int-constructor-decimal-too-large-min --- // Error: 6-39 number too large #int(decimal("-9223372036854775809.5")) --- int-signum --- // Test int `signum()` #test(int(0).signum(), 0) #test(int(1.0).signum(), 1) #test(int(-1.0).signum(), -1) #test(int(10.0).signum(), 1) #test(int(-10.0).signum(), -1) --- int-from-and-to-bytes --- // Test `int.from-bytes` and `int.to-bytes`. #test(int.from-bytes(bytes(())), 0) #test(int.from-bytes(bytes((1, 0, 0, 0, 0, 0, 0, 0)), endian: "little", signed: true), 1) #test(int.from-bytes(bytes((1, 0, 0, 0, 0, 0, 0, 0)), endian: "big", signed: true), 72057594037927936) #test(int.from-bytes(bytes((1, 0, 0, 0, 0, 0, 0, 0)), endian: "little", signed: false), 1) #test(int.from-bytes(bytes((255,)), endian: "big", signed: true), -1) #test(int.from-bytes(bytes((255,)), endian: "big", signed: false), 255) #test(int.from-bytes((-1000).to-bytes(endian: "big", size: 5), endian: "big", signed: true), -1000) #test(int.from-bytes((-1000).to-bytes(endian: "little", size: 5), endian: "little", signed: true), -1000) #test(int.from-bytes(1000.to-bytes(endian: "big", size: 5), endian: "big", signed: true), 1000) #test(int.from-bytes(1000.to-bytes(endian: "little", size: 5), endian: "little", signed: true), 1000) #test(int.from-bytes(1000.to-bytes(endian: "little", size: 5), endian: "little", signed: false), 1000) --- int-from-and-to-bytes-too-many --- // Error: 2-34 too many bytes to convert to a 64 bit number #int.from-bytes(bytes((0,) * 16)) --- int-repr --- // Test the `repr` function with integers. #test(repr(12), "12") #test(repr(1234567890), "1234567890") #test(repr(0123456789), "123456789") #test(repr(0), "0") #test(repr(-0), "0") #test(repr(-1), "-1") #test(repr(-9876543210), "-9876543210") #test(repr(-0987654321), "-987654321") #test(repr(4 - 8), "-4") --- int-display --- // Test integers. #12 \ #1234567890 \ #0123456789 \ #0 \ #(-0) \ #(-1) \ #(-9876543210) \ #(-0987654321) \ #(4 - 8) --- issue-int-constructor --- // Test that integer -> integer conversion doesn't do a roundtrip through float. #let x = 9223372036854775800 #test(type(x), int) #test(int(x), x) --- number-invalid-suffix --- // Error: 2-4 invalid number suffix: u #1u
https://github.com/gabrielrovesti/ITSM-Decommissioning-Project
https://raw.githubusercontent.com/gabrielrovesti/ITSM-Decommissioning-Project/main/1%20-%20Project/ITSM%20Project/unipd-doc.typ
typst
MIT License
#let notes() = doc => { set text(font: "New Computer Modern") doc } #let unipd-doc(title: none, subtitle: none, author1: none, author2: none, author3: none, date: none) = doc => { let unipd-red = rgb(180, 27, 33) set page(header: [ _ITSM Project - Dissertation Document_ #h(1fr) ], footer: [ _IT Service Management 2023-2024_ #h(1fr) #counter(page).display( "1/1", both: true, ) ]) set list(marker: ([•], [◦], [--])) set heading(numbering: "1.1.") show heading.where(level: 1): it => { set text(fill: unipd-red) it } align(center, { v(10em) figure(image("images/unipd-logo.png", width: 40%)) v(3em) text(size: 22pt, weight: "bold", fill: unipd-red, smallcaps(title)) v(5pt) text(size: 18pt, weight: "bold", fill: unipd-red, subtitle) parbreak() set text(size: 15pt) author1 author2 author3 parbreak() date pagebreak() }) show outline: set heading(outlined: true) show outline.entry.where(level: 1): it => { v(1em, weak: true) strong(it) } outline( title: "Table of contents", indent: 2em, ) pagebreak() outline(title: "List of Figures", target: figure.where(kind: image)) outline(title: "List of Tables", target: figure.where(kind: table)) pagebreak() doc }
https://github.com/heloineto/utfpr-tcc-template
https://raw.githubusercontent.com/heloineto/utfpr-tcc-template/main/template/cover-page.typ
typst
#let cover-page( institution: "", title: "", authors: (), city: "", year: "", ) = { [ #set align(center) #set text(weight: "bold") #block( width: 100%, height: 6em, upper(institution) ) #block( width: 100%, height: 11em, (authors.map(author => upper(author)).join("\n")) ) #upper(title) #align(bottom)[ #upper(city) #linebreak() #year ] ] pagebreak() }
https://github.com/infolektuell/gradle-typst
https://raw.githubusercontent.com/infolektuell/gradle-typst/main/examples/src/main/typst/document.typ
typst
MIT License
#let gitHash = sys.inputs.at("gitHash", default: "") = Test document #gitHash #lorem(5000)
https://github.com/matryt/modules-typst
https://raw.githubusercontent.com/matryt/modules-typst/main/text-columns/1.0.0/lib.typ
typst
#let columns(..blocks) = { stack( dir:ltr, for b in blocks.pos() [ #box(b) #h(0.5cm) ] ) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/use-academicons/0.1.0/lib-impl.typ
typst
Apache License 2.0
/// Render an Academicon by its name or unicode // based on duskmoons typst-fontawesome // https://github.com/duskmoon314/typst-fontawesome /// Parameters: /// - `name`: The name of the icon /// - This can be name in string or unicode of the icon /// - `ai-icon-map`: The map of icon names to unicode /// - Default is a map generated from Academicons CSS /// - *Not recommended* You can provide your own map to override it /// - `..args`: Additional arguments to pass to the `text` function /// /// Returns: The rendered icon as a `text` element #let ai-icon( name, ai-icon-map: (:), ..args, ) = { text( font: ("Academicons"), weight: { 400 }, // If the name is in the map, use the unicode from the map // If not, pass the name and let the ligature feature handle it ai-icon-map.at(name, default: name), ..args, ) }
https://github.com/MultisampledNight/flow
https://raw.githubusercontent.com/MultisampledNight/flow/main/src/gfx/util.typ
typst
MIT License
// Utilities for defining icons and other graphics. #import "maybe-stub.typ": cetz #import "../palette.typ": * #import "draw.typ" #let round-stroke(paint: fg) = ( cap: "round", join: "round", paint: paint, thickness: 0.1em, ) #let canvas(body, length: 1em, ..args) = cetz.canvas( ..args, length: length, { import draw: * set-style( stroke: round-stroke(), ) body }) #let icon( body, // if true, render the actual icon itself in bg on a rounded rectangle with the accent. // if false, render only the icon itself. invert: true, // if `invert` is true, the radius of the accent rect radius: 0.25, // the key under which to look information like accent up from `palette.status`. // if neither this nor `accent` is set, default to the fg color. key: none, // overrides `key` if set. the color to tint the icon in. accent: none, // If true, returns a `content` that can be directly put into text. // If false, returns an array of draw commands that can be used in a cetz canvas. contentize: true, // If `contentize` is false, put the lower left corner of this icon at this position. at: (0, 0), name: none, // Arguments to forward to `canvas` if `contentize` is true. ..args, ) = { if not cfg.render { return } import draw: * let cmds = group( ..if name != none { (name: name) } else { (:) }, { set-origin(at) let accent = if accent != none { accent } else { status.at(key, default: fg) } let icon-accent = accent if invert { rect( (0, 0), (1, 1), stroke: none, fill: accent, radius: radius, ..if name != none { (name: name) } else { (:) } ) icon-accent = bg } else { // hacking the boundary box in so the spacing is right line((0, 0), (1, 1), stroke: none) } // intended to be selectively disabled via passing `none` explicitly set-style( stroke: (paint: icon-accent), fill: icon-accent, ) // so the user can just draw from 0 to 1 while the padding is outside set-origin((0.2, 0.2)) scale(0.6) body() }, ) if contentize { box( inset: (y: -0.175em), canvas(..args, cmds) ) } else { cmds } } #let diagram( // Key is the name used for a node, // value is a dictionary with the keys: // - `pos`: where to place the node // - (optional) `display`: what content to show at `pos` // - Defaults to the node name // - (optional) `accent`: what color outgoing edges should have // - Defaults to the foreground color of the current theme // - Also determines the color of the `name` if `display` is not used // // If the value doesn't contain the `pos` key, // it is assumed to be directly the position as coordinate or cetz position. // // The node names directly map to cetz names. nodes: (:), // Key is the name of the node used as source, // value is the target coordinate or node name. // Use the `br` function in `gfx.draw` // if you want to target more than node and/or // don't take the direct path. edges: (:), ..args, ) = { let cmds = { import draw: * for (name, cfg) in nodes { let cfg = if ( type(cfg) == dictionary and "pos" in cfg ) { cfg } else { (pos: cfg) } cfg.accent = cfg.at("accent", default: fg) let display = cfg.at( "display", default: text(fill: cfg.accent, name), ) content( cfg.pos, pad(0.5em, display), name: name, ) nodes.at(name) = cfg } for (from, to) in edges { let source-cfg = nodes.at(from) trans( from, styled( stroke: round-stroke( paint: source-cfg.accent, ), fill: source-cfg.accent, to, ), ) } args.pos().at(0, default: none) } align(center, canvas(cmds, ..args.named())) }
https://github.com/tiankaima/typst-notes
https://raw.githubusercontent.com/tiankaima/typst-notes/master/7e1810-algo_hw/hw8.typ
typst
#import "utils.typ": * == HW8 (Week 9) Due: 2024.05.05 === Exerciese 1 Proof that Bellman-Ford maximizes $x_1+x_2+dots.c+x_n$ subject to the constraints $x_j - x_i <= w_(i j)$ for all edges $(i,j)$ and $x <= 0$, and also minmizes $max_i {x_i}-min_i {x_i}$. #ans[ #rect(stroke: blue + 0.05em, inset: 1em)[ Consider turning the problem into a single-source shortest path problem by doing the following transformation: - For each $x_j - x_i <= w_(i j)$ constraint, we think of it as an edge $(i,j)$ with weight $w_(i j)$. (note it's directed from $i$ to $j$) Then we add a new vertex $s$ and connect it to all other vertices with weight $0$. We then run Bellman-Ford algorithm on this graph to find the longest path. We fix $x_i = "dist"[i]$ as the solution. ] It's trivial to see why $x_1+x_2+dots.c+x_n$ being the longest path is equivalent to $x_1+x_2+dots.c+x_n$ being maximized. The constraint are met since, for each $x_j - x_i <= w_(i j)$, we have $"dist"[j] <= "dist"[i] + w_(i j)$, which is equivalent to $x_j - x_i <= w_(i j)$. To see why this also minmizes $max_i {x_i}-min_i {x_i}$, we can see that the longest path is the one that maximizes the difference between the maximum and minimum values. (Suppose there exists another set of solutions that has a larger difference, say $max_i {x_i '} - min_i {x_i '}$, the constraint between the two sets of solutions would be violated, since the longest path is the one that maximizes the difference.) ] === Question 23.2-6 Show how to use the output of the Floyd-Warshall algorithm to detect presence of a negative-weight cycle. #ans[ If the output of the Floyd-Warshall algorithm contains a negative number on the diagonal, then there exists a negative-weight cycle in the graph. This is because the diagonal represents the shortest path from a vertex to itself, and if there exists a negative-weight cycle, then the shortest path from a vertex to itself would be negative infinity. ] === Question 23.3-4 Professor Greenstreet claims that there is a simpler way to reweight edges than the method used in Johnson's algorithm. Letting $w^*=min_((u,v)in E){w(u,v)}$, just define $hat(w) (u,v)=w(u,v)-w^*$ for all edges $(u,v)in E$. What is wrong with the professor's method of reweighting? #ans[ Might result in path with more edges longer than direct edge, which is not optimal. ] === Question 24.3-3 Let $G=(V,E)$ be a bipartite graph with vertex partition $V=L union R$, and let $G$ be its corresponding flow network. Give a good upper bound on the length of any augmenting path found in $G$ during the execution of FORD-FULKERSON. #ans[ $2min{abs(L),abs(R)}+1$ ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/rubby/0.10.0/example.typ
typst
Apache License 2.0
#set text( font: ("Liberation Sans", "Noto Sans CJK JP") ) // Optional #import "@preview/rubby:0.10.0": get-ruby #let ruby = get-ruby() ```typst #let ruby = get-ruby() // (1) Adds missing delimiter around every content/string // or #let ruby = get-ruby(auto-spacing: false) // (2) Logic from original project ``` #ruby[ふりがな][振り仮名] #ruby[とう|きょう|こう|ぎょう|だい|がく][東|京|工|業|大|学] #ruby[とうきょうこうぎょうだいがく][東京工業大学] Next 2 lines look the same with (1) (default): #let ruby = get-ruby() #ruby[|きょうりょく|][|協力|] #ruby[きょうりょく][協力] But lines are being typeset differently if (2) is used: #let ruby = get-ruby(auto-spacing: false) #ruby[|きょうりょく|][|協力|] #ruby[きょうりょく][協力] // Page boundaries are not honored First 3 lines out of 4 look the same way with (1): #let ruby = get-ruby() #ruby[きゅう][九]#ruby[じゅう][十] #ruby[きゅう|][九|]#ruby[|じゅう][|十] #ruby[きゅう|じゅう][九|十] #ruby[きゅうじゅう][九十] Only 2nd and 3rd lines look the same way with (2): #let ruby = get-ruby(auto-spacing: false) #ruby[きゅう][九]#ruby[じゅう][十] #ruby[きゅう|][九|]#ruby[|じゅう][|十] #ruby[きゅう|じゅう][九|十] #ruby[きゅうじゅう][九十]
https://github.com/Skimmeroni/Appunti
https://raw.githubusercontent.com/Skimmeroni/Appunti/main/Metodi%20Algebrici/Interi/Eulero.typ
typst
Creative Commons Zero v1.0 Universal
#import "../Metodi_defs.typ": * Viene detta *funzione di Eulero* la funzione $phi : (NN - {0}) |-> (NN - {0})$ cosí definita: $ phi(n) = cases( 1 & "se" n = 1, |{k in NN : 0 < k < n, "MCD"(k, n) = 1}| & "se" n > 1 ) $ Ovvero, che per l'argomento $1$ restituisce $1$ mentre per un generico argomento $n$, numero naturale maggiore di $1$, restituisce il numero di numeri naturali coprimi ad $n$ che si trovano nell'intervallo $(0, n)$, estremi esclusi. #example[ Per $n = 26$, si ha: $ phi(26) = |{k in ZZ : 0 < k < 26, (k, 26) = 1}| = |{1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25}| = 12 $ ] #lemma[ Se $p in NN$ é un numero primo maggiore di $1$, allora $phi(p) = p - 1$. ] <Euler-function-single-prime> #proof[ Per un generico $p$ numero naturale con $p > 1$, $phi(p)$ é il numero di numeri naturali maggiori di 0 e minori di $p$ con cui $p$ é coprimo. Se peró $p$ é primo, allora sará certamente coprimo a tutti i numeri che costituiscono tale intervallo; essendo tale intervallo di lunghezza $p - 1$, si ha $phi(p) = p - 1$. ] #lemma[ Siano $p$ e $alpha$ due numeri naturali maggiori di 0, con $p$ primo. Allora: $ phi(p^(alpha)) = p^(alpha) − p^(alpha - 1) = p^(alpha − 1) (p − 1) $ ] <Euler-function-primes> #proof[ Sia $m$ un qualsiasi numero naturale diverso da $0$ e inferiore a $p^(alpha)$. Essendo $p$ un numero primo, gli unici possibili valori di $"MCD"(p^(alpha), m)$ sono $p^(0), p^(1), p^(2), ..., p^(alpha - 1)$. Affinché $"MCD"(p^(alpha), m)$ non sia $1$, $m$ deve necessariamente essere un multiplo di $p$, ed il numero di multipli $p$ minori di $p^(alpha)$ é $p^(alpha - 1)$. Tutti i restanti numeri compresi (estremi esclusi) fra $0$ e $p^(alpha)$ sono coprimi a $p^(alpha)$, ed il numero di tali numeri deve quindi essere $p^(alpha) - p^(alpha - 1)$. ] #theorem("Moltiplicativitá della funzione di Eulero")[ La funzione di Eulero é moltiplicativa. Ovvero, presi $a, b in NN - {0}$ primi fra di loro, si ha $phi(a b) = phi(a) phi(b)$. ] <Euler-function-multiplicative> #proof[ Siano $r$ e $s$ due numeri interi, scelti con queste caratteristiche: $ 0 < r < a space space space "MCD"(r, a) = 1 space space space 0 < s < b space space space "MCD"(s, b) = 1 $ Per il @Chinese-remainder-theorem, il sistema di congruenze $ cases( x equiv r mod a, x equiv s mod b ) $ ammette soluzioni. In particolare, ne ammette una ed una sola compresa tra $0$ e $a b$ (estremi esclusi); sia $c$ questa soluzione. É possibile verificare che $"MCD"(c, a b) = 1$. Si assuma infatti per assurdo che questo non sia vero, e che esista pertanto un numero primo $p$ divisore sia di $c$ che di $a b$. Valendo $p | a b$, é possibile applicare il @Euclid-lemma, pertanto deve valere almeno un assunto fra $p | a$ e $p | b$. Si supponga che sia vera $p | a$. Essendo $c$ soluzione del sistema di congruenze, deve valere $c equiv r mod a$, ovvero che esiste un $k in ZZ$ tale per cui $c - r = a k$. Riscrivendo l'espressione come $r = c - a h$, si evince che $p | r$, ma si ha assunto che valesse $p | a$ e che $"MCD"(r, a) = 1$, e le due assunzioni sono incompatibili. É facile verificare che assumendo invece che sia vera $p | b$, si ricade in una contraddizione analoga, pertanto occorre assumere che effettivamente $"MCD"(c, a b) = 1$. Poiché ogni coppia di interi $r$ ed $s$ definiti come sopra dá luogo ad un intero $c$ tale che $0 < c < a b$ e $"MCD"(c, a b) = 1$ abbiamo che $phi(a) phi(b) lt.eq phi(a b)$. Viceversa, sia $t$ un numero intero scelto di modo che valga $0 < t < a b$ e $"MCD"(t, a b) = 1$. Dividendo $t$ per $a$, si ha $t = a q + r$ con $0 lt.eq r < a$ e $q in ZZ$. É possibile verificare che $"MCD"(a, r) = 1$. Innanzitutto, si osservi come debba per forza aversi $r != 0$; se cosí fosse, si avrebbe $a | t$, ma questo non é possibile perché per come $t$ é stato definito deve valere $"MCD"(t, a b) = 1$. Si supponga per assurdo che $"MCD"(a, r) > 1$: se cosí fosse, deve valere sia $"MCD"(a, r) | a$ che $"MCD"(a, r) | r$, da cui si ha $"MCD"(a, r) | a b$ e $"MCD"(a, r) | t$, che é una contraddizione. Occorre pertanto assumedere che effettivamente $"MCD"(a, r) = 1$. In maniera analoga, si mostra che dividendo $t$ per $b$ e scrivendo $t = b overline(q) + s$ con $0 < s lt.eq b$ si ha $"MCD"(b, s) = 1$. In totale, si ha che $t$ é soluzione del sistema di congruenze: $ cases( x equiv r mod a, x equiv s mod b ) $ Da cui si conclude che $phi(a) phi(b) = phi(a b)$. ] #corollary[ Sia $n > 1$ un numero naturale, e sia $n = p_(1)^(alpha_(1)) p_(2)^(alpha_(2)) ... p_(m)^(alpha_(m))$ la sua fattorizzazione in numeri primi, dove ciascun $p_(i)$ con $1 lt.eq i lt.eq m$ é un numero primo distinto, elevato ad un certo esponente $alpha_(i)$. L'espressione di $phi(n)$ puó essere anche scritta come: $ phi(n) = product_(i = 1)^(m) p_(i)^(alpha_(i) − 1) (p_(i) − 1) = p_(1)^(alpha_(1) − 1) (p_(1) − 1) p_(2)^(alpha_(2) − 1) (p_(2) − 1) ... p_(m)^(alpha_(m) − 1) (p_(m) − 1) $ ] <Euler-function-factored> #proof[ Questo risultato deriva direttamente dal @Euler-function-multiplicative. Infatti, se $phi$ é moltiplicativa, allora: $ phi(n) = phi(p_(1)^(alpha_(1))) phi(p_(2)^(alpha_(2))) ... phi(p_(m)^(alpha_(m))) = product_(i = 1)^(m) phi(p_(i)^(alpha_(i))) $ Applicando poi il @Euler-function-primes all'argomento della produttoria, si ha: $ product_(i = 1)^(m) phi(p_(i)^(alpha_(i))) = product_(i = 1)^(m) p_(i)^(alpha_(i) − 1) (p_(i) − 1) = p_(1)^(alpha_(1) − 1) (p_(1) − 1) p_(2)^(alpha_(2) − 1) (p_(2) − 1) ... p_(m)^(alpha_(m) − 1) (p_(m) − 1) $ ] Il @Euler-function-factored permette di calcolare la funzione di Eulero in maniera molto piú semplice rispetto al calcolarla direttamente a partire dalla definizione, soprattutto per numeri molto grandi, perché richiede solamente la fattorizzazione in numeri primi e semplici moltiplicazioni. #example[ Sia $n = 246064$. La sua fattorizzazione in numeri primi é $2^(4) dot 7 dot 13^(3)$. Si ha: $ phi(246064) = product_(i = 1)^(3) p_(i)^(alpha_(i) − 1) (p_(i) − 1) = 2^(4 − 1) (2 − 1) dot 7^(1 − 1) (7 − 1) dot 13^(3 − 1) (13 − 1) = 97344 $ ]
https://github.com/kdog3682/typkit
https://raw.githubusercontent.com/kdog3682/typkit/main/0.1.0/src/footers/standard.typ
typst
#import "sizes.typ" #let standard(page) = { counter(page).display( number => { let num = text(number, size: sizes.small) let mark = [— #num —] center(mark, horizon) }, ) }
https://github.com/dadn-dream-home/documents
https://raw.githubusercontent.com/dadn-dream-home/documents/main/contents/08-thiet-bi/index.typ
typst
= Đặc tả cảm biến, thiết bị Cảm biến, thiết bị ở đây được sử dụng do OhStem cung cấp. Dưới đây là bảng các các thiết bị được nhóm sử dụng. #figure(align(left + horizon, table( columns: (auto, auto, 1fr), inset: 1em, image("yolobit.jpg", width: 3cm), [*Bộ kit#linebreak()Yolo:Bit*], [ - 25 đèn LED đa màu, được sắp xếp theo ma trận vuông 5 #sym.times 5. - 2 nút nhấn A, B để tương tác. - Cảm biến ánh sáng. - Cảm biến nhiệt độ và độ ẩm. - Cảm biến gia tốc để đo góc nghiêng và hướng chuyển động. - Loa phát nhạc. ], image("dht20.png", width: 3cm), [*DHT20*], [ - Điện áp đầu vào: $3.3 "V"$ - Đo phạm vi độ ẩm: $0 tilde.op 100%$ RH - Dải nhiệt độ đo: $-40 tilde.op +80 degree C$ - Độ chính xác độ ẩm: $plus.minus 3% "RH" (25 degree C)$ - Độ chính xác nhiệt độ: $plus.minus 0,5 degree C$ - Tín hiệu đầu ra: Tín hiệu I2C ], image("den.png", width: 3cm), [*LED RGB*], [ - Điện áp hoạt động: $3.3 "V"$ - Số lượng LED: 4 #sym.times RGB LED - Dòng điện tối đa: $60 "mA"$ / (1 LED), $240 "mA"$ / (4 LED) - Loại LED: WS2812-4 - Độ sáng: $0 tilde 255$ - Điều khiển: Sử dụng 1 chân tín hiệu điều khiển - Góc khả vi: $> 140 degree$ - Kích thước: $48 times 24 times 18 "mm"$ (D #sym.times R #sym.times C) ], image("quat.png", width: 3cm), [*Quạt mini*], [ - Điện áp hoạt động: $3.3 "V"$ - Tín hiệu điều khiển: 2 pins - Kích thước của mạch: 24mm #sym.times 48mm #sym.times 16mm ], image("lcd.png", width: 3cm), [*LCD 1602#linebreak()I2C*], [ - Điện áp hoạt động: $3.3 "V"$. - Địa chỉ i2c: 0x27 - Màu: Xanh lá - Kích thước lỗ bắt ốc: 3 #sym.times M3 - Kích thước của mạch: 80mm #sym.times 42mm #sym.times 19m - Trọng lượng: 38g ] )), caption: "Bảng các thiết bị được sử dụng trong đồ án" )
https://github.com/pascal-huber/typst-letter-template
https://raw.githubusercontent.com/pascal-huber/typst-letter-template/master/examples/C5-WINDOW-LEFT.typ
typst
MIT License
#import "@local/lttr:0.1.0": * #show: lttr-init.with( debug: true, format: "C5-WINDOW-LEFT", title: "Brief schribä mit Typst isch zimli eifach", opening: "Hoi Peter,", closing: "Uf widerluege", signature: "Ruedi", date-place: ( date: "20.04.2023", place: "Witfortistan", ), receiver: ( "<NAME>", "Bahnhofsstrasse 16", "1234 Zimliwitwegistan", ), sender: ([ <NAME>\ Bahnhofsgasse 15\ 8957 Spreitenbach ]), ) #show: lttr-preamble #lorem(50) #show: lttr-closing
https://github.com/AHaliq/DependentTypeTheoryReport
https://raw.githubusercontent.com/AHaliq/DependentTypeTheoryReport/main/main.typ
typst
#import "preamble/style.typ" #show: style.setup.with( "Dependent Type Theory", "<NAME>", authorid: "202303466", subtitle: "Projektarbejde i Datalogi 10ECTS (F24.520202U002.A)", preface: [This report is written for the course on Modern Dependent Type Theory undertaken as a project module: "Projektarbejde i Datalogi 10 ECTS (F24.520202U002.A)", led by <NAME> and <NAME> in Aarhus University in the Fall semester of 2024], bibliography: bibliography("refs.bib"), ) // ------------------------------------------------------------ #include "chapters/chapter1/index.typ" #include "chapters/chapter2/index.typ" #include "chapters/chapter3/index.typ" #include "chapters/chapter4/index.typ"
https://github.com/DJmouton/Enseignement
https://raw.githubusercontent.com/DJmouton/Enseignement/main/Templates/layouts.typ
typst
/* Template de mise en page pour l'entièreté d'un document Utilisation: 1. Importer le template voulu #import "/Templates/layout.typ": SNT 2. L'appliquer au document entier: #show: doc => template(doc) Peut-être aussi utilisé pour n'importe quel contenu */ #let SNT(body) = { set page( paper: "a4", numbering: "1 / 1" ) set par( justify: true, ) set text( font: "", size: 11pt, lang: "FR" ) set figure.caption(separator: [ -- ]) set figure(supplement: "Figure") show figure: it => [#it #v(0.5em)] [#body] } #let NSI(body) = { set page( paper: "a4", numbering: "1 / 1", header: [ #context { let headings = query(selector(heading).before(here())) if headings.len() < 3 { return } let first = none let second = none while headings.len() > 0 and (first == none or second == none) { let current = headings.pop() if second == none { if current.level == 2 {second = current.body} } else { if current.level == 1 {first = current.body} } } if first == none or second == none {return} text(size: 8pt, [#first > #second]) } ], ) show par: set block(below: 1.5em) set par( justify: true, leading: 1.5em, ) set heading(numbering: "1.1.1.") show heading: set block(above: 2em, below: 1.2em) set text( font: "", size: 11pt, lang: "FR" ) set figure.caption(separator: [ -- ]) set figure(supplement: "Figure") show figure: it => [#it #v(0.5em)] [#body] } #let titre(body) = align(center, text(size: 24pt, smallcaps(body))) #let sous_titre(body) = align(center, text(size: 14pt, smallcaps(body))) // Example #let example = [ #titre([What's up gang]) #sous_titre([It's a "me", Mario]) = Moi, roi du monde #lorem(30) == Pourquoi voter pour moi === Parceque #lorem(15) === Feur == Vous n'avez pas le choix #figure(caption: "Waw c'est fou", emoji.alien) = Ze end ] #SNT(example) #pagebreak(weak:true) #NSI(example)
https://github.com/timon-schelling/abi-research-paper-rewrite-with-typst
https://raw.githubusercontent.com/timon-schelling/abi-research-paper-rewrite-with-typst/main/src/main.typ
typst
#import "template.typ": * #let color0 = rgb("#000000") #let color1 = rgb("#C10000") #let color2 = rgb("#149900") #let color3 = rgb("#0F00B6") #let color4 = rgb("#A3006A") #let color5 = rgb("#F5C000") #let color6 = rgb("#BD4800") #let color7 = rgb("#8617C2") #let color8 = rgb("#00ADA8") #let color9 = rgb("#81BD00") #let bgcolor0 = color0.lighten(80%) #let bgcolor1 = color1.lighten(70%) #let bgcolor2 = color2.lighten(70%) #let bgcolor3 = color3.lighten(70%) #let bgcolor4 = color4.lighten(70%) #let bgcolor5 = color5.lighten(70%) #let bgcolor6 = color6.lighten(70%) #let bgcolor7 = color7.lighten(70%) #let bgcolor8 = color8.lighten(70%) #let bgcolor9 = color9.lighten(70%) #let theme = { sys.inputs.at("theme", default: none) } #set page(fill: rgb("1a1a1a")) if theme == "dark" #set text(fill: rgb("c7c7c7")) if theme == "dark" #if theme == "dark" { bgcolor0 = color0.lighten(17%) bgcolor1 = color1 bgcolor2 = color2 bgcolor3 = color3 bgcolor4 = color4 bgcolor5 = color5 bgcolor6 = color6 bgcolor7 = color7 bgcolor8 = color8 bgcolor9 = color9 color0 = rgb("#c7c7c7") color1 = color1.lighten(60%) color2 = color2.lighten(60%) color3 = color3.lighten(60%) color4 = color4.lighten(60%) color5 = color5.lighten(60%) color6 = color6.lighten(60%) color7 = color7.lighten(60%) color8 = color8.lighten(60%) color9 = color9.lighten(60%) } #show: project.with( title: "Pi and seek - Pi ohne Kreis? Wird Pi ohne den Zusammenhang mit der Geometrie eines Kreises verwendet?", authors: ( "<NAME>", ), date: "27. April 2023", bib: "refs.bib", bib-title: "Literatur", ) #let default_coordinate_system(body) = rect(width: 240pt, height: 240pt, inset: 0pt, stroke: none)[ #place(center + horizon, help_lines()) #place(center + horizon, axes(fill: color0, stroke: color0)) #place(right + horizon, dy: -8pt, [$ x $]) #place(center + top, dx: 8pt, [$ y $]) #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none)[ #body ]) ] = Einleitung Seit die Idee der Kreiszahl $pi$ (sie wird im Weiteren noch genauer definiert und analysiert) sich in der Mathematik etabliert hat, wurden (und werden) immer wieder Methoden entwickelt (absichtlich und auch zufällig), um ihren Wert mit einer gewissen Präzision zu berechnen. In der Bibel (wichtigste Textsammlung des Judentums und Christentums) ist beispielweise indirekt ein Wert von $3$ für $pi$ erwähnt. #cite(<ARTICLE:The-Quest-for-Pi:1996>) Eine der frühsten erhaltenen Aufzeichnungen eines Wertes für die Kreiszahl $pi$ geht ungefähr auf das Jahr $-2000$ ($2000$ BC. / $2000$ v. Chr. nach dem Gregorianischen Kalender) zurück und beträgt nach Annäherung der Babylonier $3 + frac(1, 8)$. Zu den moderneren Formen der Berechnung von $pi$ zählt unter anderem der Chudnovsky-Algorithmus; $pi$ ist darin wie folgt definiert. #cite(<ARTICLE:A-DETAILED-PROOF-OF-THE-CHUDNOVSKY-FORMULA-WITH-MEANS-OF-BASIC-COMPLEX-ANALYSIS:2020>) $ frac(1, pi) = 12 sum^infinity_(k=0) frac((-1)^k (6k)! (545140134k + 13591409), (3k)!(k!)^3 640320^(3k + 3/2)) $ Wie beim Chudnovsky-Algorithmus ist es in der Mathematik oft nicht klar ersichtlich ob und wenn, welche Verbindung zwischen der Verwendung von $pi$ und der Geometrie des Kreises besteht. Da jedoch $pi$ erst durch die Geometrie des Kreises definiert ist, kann sachlogisch die Hypothese aufgestellt werden, dass wenn $pi$ auftaucht, ein Zusammenhang mit der Geometrie des Kreises bestehen müsste. #cite(<VIDEO:Why-is-pi-here-And-why-is-it-squared-A-geometric-answer-to-the-Basel-problem:2018>) Den Chudnovsky-Algorithmus zu erklären, würde weit über den Rahmen dieser Arbeit hinaus gehen. #cite(<ARTICLE:A-DETAILED-PROOF-OF-THE-CHUDNOVSKY-FORMULA-WITH-MEANS-OF-BASIC-COMPLEX-ANALYSIS:2020>) Aus diesem Grund werden weniger komplexe Sachverhalte als Beispiel heran gezogen, um die zuvor erwähnte und im Weiteren ausformulierte Hypothese zu überprüfen. == Ideenfindung Das Thema dieser Arbeit ist aus der Methode, die Kreiszahl $pi$ zu berechnen, die erstmalig vom Mathematiker <NAME> in seiner Arbeit "PLAYING POOL WITH PI (THE NUMBER PI FROM A BILLIARD POINT OF VIEW)" vorgestellt wurde, abgeleitet. #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<VIDEO:The-most-unexpected-answer-to-a-counting-puzzle:2019>) Diese Methode soll es ermöglichen, $pi$ bis zu jeder Genauigkeit/Präzision zu berechnen, ohne technische Hilfsmittel zu nutzen. #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) Ihre genaue Funktionsweise wird im Hauptteil dieser Arbeit näher erläutert. == Forschungsfrage Pi ohne Kreis? Wird Pi ohne den Zusammenhang mit der Geometrie eines Kreises verwendet? (Existieren Sachverhalte, in denen Pi ohne Zusammenhang mit der Geometrie eines Kreises Verwendung findet?) === Warum stellt sich die Frage? Die von <NAME> in seinem Artikel "PLAYING POOL WITH PI (THE NUMBER PI FROM A BILLIARD POINT OF VIEW)" vorgestellte Methode, um Stellen von $pi$ zu berechnen(die gestellte Frage nach der Anzahl an Kollisionen zweier Billardkugeln in einem dynamischen System), kann mit Hilfe des Energie- und Impulserhaltungssatzes in ein geometrisches Problem umgewandelt werden, das tatsächlich einen Kreis enthält #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<VIDEO:How-colliding-blocks-act-like-a-beam-of-light-to-compute-pi.:2019>) #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) (der genaue Weg wird im Hauptteil dieser Arbeit erläutert und nachvollzogen). Aus diesem Grund stellt sich die Frage, ob nicht bei allen Verwendungen von $pi$ auf eine solche oder ähnliche Art ein Zusammenhang zur Geometrie des Kreises mathematisch bewiesen werden kann. === Welche Relevanz hat die Frage? Im Fachbereich der Philosophischen Mathematik wird versucht, Gegenstand, Voraussetzungen, Natur und Methoden der Mathematik zu ergründen und zu verstehen. Es werden unter anderem Überlegungen angestellt, ob die Mathematik ein von Menschen erdachtes Konzept ist oder ob Menschen sie lediglich entdeckt haben, gerade entdecken oder noch entdecken werden. #cite(<BOOK:New-Directions-in-the-Philosophy-of-Mathematics:1998>) Wenn $pi$ nicht nur in einem direkten oder indirekten Zusammenhang, mit der Geometrie bewiesen werden kann, liegt die Vermutung nahe, dass die Menschen ihre Bedeutung nicht oder nicht in Gänze verstehen, $pi$ in Verbindung mit Kreisen nur ein Indiz für eine tiefgreifendere mathematische Wahrheit ist. Wir als Menschheit (genauer Mathematiker) haben $pi$ im Zusammenhang mit Kreisen definiert. Wenn $pi$ demnach an anderer Stelle ohne Verbindung zu unserer menschlichen Definition Verwendung findet, spricht eben diese Tatsache eher für eine von Menschen entdeckte Mathematik. Das Ergebnis dieser Arbeit wird demnach als Argument für die eine oder andere Perspektive benutzt werden können, kann in jedem Fall zu einem besseren Verständnis der Mathematik im Allgemeinen und der Zahl $pi$ im Speziellen beitragen. == Hypothese Die Zahl $pi$ ist definiert als das Verhältnis des Durchmessers eines Kreises und seines Umfanges. Demnach muss ihre Verwendung immer einen Zusammenhang mit jenem Verhältnis und damit zur Geometrie des Kreises haben. Die Frage ist nicht ob, sondern auf welchem Wege (über welche mathematischen Zusammenhänge und mathematischen Fachgebiete) solch ein Zusammenhang besteht. == Abgrenzungen Es geht in dieser Arbeit nahezu ausschließlich um den Zusammenhang zwischen $pi$ und der Geometrie des Kreises. Die Geschichte der Zahl $pi$ wird zwar erwähnt, es wird dabei allerdings keineswegs Vollständigkeit angestrebt, sondern eher darauf gedachtet, welche Teile helfen, die Verständlichkeit der restlichen Arbeit zu verbessern. Gleiches gilt für den Kreis, seine Geometrie und Geschichte. Es werden auch Grundlagen aus anderen Feldern der Mathematik vorausgesetzt, wie beispielsweise die Analysis (besonders Integralrechnung) oder Grundlagen der Geometrie (Satzgruppe des Pythagoras, Strahlensätze, Kreiswinkelsatz). == Methoden In der vorliegenden Arbeit wird versucht, deduktiv die schon erläuterte Hypothese zu überprüfen, indem an einzelnen Sachverhalten ihre Anwendbarkeit mathematisch bewiesen wird. Es werden allerdings auch Beweise anderer Autoren in Folge von Literaturarbeit mit in die Auswertung einbezogen. Die Auswahl der Sachverhalte ist dabei nicht nach einem festgelegten Schema erfolgt, vielmehr wurde bei der Auswahl darauf geachtet, dass sich die Ergebnisse leicht von etwaigen Rezipienten nachvollziehen lassen. Allerdings ist wichtig anzumerken, dass die gewählten Sachverhalte dennoch als repräsentativ eingestuft werden, denn die Rechereche wurde ergebnissoffen durchgeführt, bedeutet es wurde gleichermaßen versucht, die These zu belegen, als auch sie zu widerlegen. Für die Fallanalyse wurde im Voraus festgelegt, in welche Kategorien einzelne Sachverhalte eingeordnet werden und wie diese zu bewerten sind. Jede Kategorie, die dabei mindestens einmal auftrat, wurde mindestens ebenso häufig mit einem Beispiel in der Arbeit repräsentiert. #pagebreak() = Hauptteil == Mathematische Grundlagen Im folgenden Teil werden mathematische Grundlagen, die für die weitere Arbeit von besonderer Bedeutung, sind näher beleuchtet. Es werden auch andere allgemein anerkannte mathematische Grundlagen und Methoden vorausgesetzt. === Division Um die Kreiszahl $pi$ zu definieren, wird neben Grundlagen der Geometrie noch die Rechenart der Division benötigt. Sie ist eine der vier Grundrechenarten der Mathematik, genauergenommen der Arithmetik, definiert als Umkehroperation der Multiplikation. Es wird ein Dividend durch einen Divisor dividiert, das Resultat nennt sich Quotient. #cite(<WEB:Division-Wolfram-Research:2021>) $ underbrace(a, "Dividend") : underbrace(b, "Divisor") = underbrace(c, "Wert des Quotienten") $ Wenn eine Zahl $a$ und eine Zahl $b$ mulltipiziert werden, ergibt sich aus dem Ergebnis $c$ durch Dividieren durch $a$ wieder $b$ und durch Dividieren durch $b$ wieder $a$, sofern $a$ und $b$ nicht Null sind. #cite(<WEB:Division-Wolfram-Research:2021>) Es gilt demnach das folgende Gleichungssystem. $ a dot b &= c \ frac(c, a) &= b \ frac(c, b) &= a \ a &!= 0 \ b &!= 0 \ $ Diese Erkentnisse über die Division reichen aus, um im Folgenden eine formale Definition von $pi$ zu konstruieren. === Kreiszahl Pi Um $pi$ als Kreiszahl zu begreifen, fehlt an dieser Stellen noch das Verständnis der Geometrie des Kreises. Aus diesem Grund wird im Folgenden seine Definition genauer untersucht. Ein Kreis ist definiert als zweidimensionale Fläche. Sie wird begrenzt durch eine konstant gekrümmte Linie, verlaufend auf allen Punkten, die in einer Entfernung von $r$ von einem Mittelpunkt $O$ liegen. Die Strecke $r$ wird Radius genannt. Der zweifache Radius nennt sich Durchmesser $d$. Er beschreibt eine Strecke verlaufend durch den Mittelpunkt und begrenzt an beiden Enden durch einen Punkt, der auf der Begrenzung des Kreises liegt. #cite(<BOOK:Einfuehrung-Mathematik-Primarstufe-Geometrie:2015>) #cite(<BOOK:Pi-Unleashed:2001>) #cite(<BOOK:A-History-of-Pi:2015>) Diese Definition besteht schon sehr lange, schon Euklid verwendete sie. Er soll den Kreis wie folgt definierte haben: "A circle is a plane figure bounded by one curved line, and such that all straight lines drawn from a certain point within it to the bounding line, are equal. The bounding line is called its circumference and the point, its centre." #cite(<BOOK:Euclid-books-I-II:1883>) Diese Definition für einen Kreis mit dem Radius $r = 1$ kann grafisch folgendermaßen dargestellt werden. #cite(<BOOK:Einfuehrung-Mathematik-Primarstufe-Geometrie:2015>) #cite(<BOOK:Pi-Unleashed:2001>) #cite(<BOOK:A-History-of-Pi:2015>) #figure( [ #rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none)[ #place(center + horizon, circle(radius: 100pt, stroke: color0)) #place(center + horizon, line(length: 200pt, angle: 90deg, stroke: color1)) #place(center + horizon, line(start: (50%, 0%), end: (100%, 0%), stroke: color2)) #place(center + horizon, circle(radius: 2pt, fill: color3)) #place(center + horizon, dx: 8pt, dy: -8pt, text(fill: color3, [$ O $])) #place(left + horizon, dx: 4pt, [$ c = d pi = 2 pi $]) #place(center + horizon, dx: 25%, dy: 7pt, text(fill: color2, [$ r = 1 $])) #place(center + horizon, dx: 15%, dy: -25%, text(fill: color1, [$ d = 2 r = 2 $])) ] ], caption: [ Kreis mit dem Radius $r = 1$ ] ) Mathematiker entdeckten eine besondere Eigenschaft des Kreises: ein jeder Kreis mit einem beliebig gewählten Radius $r$ ($r > 0$) und damit auch Durchmesser $d$, hat einen Umfang $c$ ($c$ für das englische Wort "Circumference"), der dem Durchmesser $d$ multipliziert mit einem konstanten Faktor entspricht. Dieser Faktor wurde über die Zeit als Kreiszahl $pi$ standartisiert. $pi$ entspricht demnach dem Verhälnis von Umfang $c$ und Durchmesser $r$. #cite(<BOOK:A-History-of-Pi:2015>) #cite(<BOOK:Pi-Unleashed:2001>) #cite(<ARTICLE:The-Tau-Manifesto:2010>) $ d dot pi &= c space.quad | : d \ pi &= frac(c, d) \ $ Wird an gleicher Stelle statt des Durchmessers $d$ der Radius $r$ gewählt, erhält man die ebenfalls standardisierte Zahl $tau$. #cite(<ARTICLE:The-Tau-Manifesto:2010>) $ r dot tau & = c space.quad | : r \ tau & = frac(c, r) \ $ $tau$ entspricht exakt dem Zweifachen von $pi$. #cite(<ARTICLE:The-Tau-Manifesto:2010>) $ tau & = frac(c, r) & | dot frac(1, 2) \ tau dot frac(1, 2) & = frac(c, r) dot frac(1, 2) & \ frac(tau, 2) & = frac(c, 2r) & | dot 2r \ frac(tau, 2) dot 2r & = c & \ frac(tau, 2) dot 2r & = c = pi dot d & \ frac(tau, 2) dot 2r & = pi dot d & \ frac(tau, 2) dot d & = pi dot d & | : d \ frac(tau, 2) & = pi & | dot 2 \ tau & = 2pi & \ $ Aus dieser Erkenntnis folgt, in der Mathematik kann, wann immer $2pi$ Verwendung findet, statt seiner auch $tau$ verwendet werden. Für diese Arbeit ist vorallem interessant, dass $tau$ genau wie $pi$ eine direkte Verbindung zu Kreisen hat, wir $tau$ wie $pi$ erst über die Geometrie des Kreises definieren. #cite(<ARTICLE:The-Tau-Manifesto:2010>) $pi$ ist ebenfalls essenziell um den Flächeninhalt eins Kreises zu berechnen, denn der Radius $r$ eines Beliebigen Kreises zum Quadrat $r^2$, multipliziert mit $pi$ entspricht dem Flächeninhalt $A$ des Kreises. #cite(<ARTICLE:AREA-INSIDE-THE-CIRCLE-INTUITIVE-AND-RIGOROUSPROOFS:2017>) Dies kann wie folgt grafisch dargestellt werden. #figure( [ #rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none)[ #place(center + horizon, circle(radius: 100pt, fill: bgcolor0, stroke: color0)) #place(center + horizon, line(start: (50%, 0%), end: (100%, 0%), stroke: color2)) #place(center + horizon, circle(radius: 2pt, fill: color3)) #place(center + horizon, dx: 8pt, dy: -8pt, text(fill: color3, [$ O $])) #place(center + bottom, dy: -25%, [$ A = pi r^2 = pi 1^2 = pi $]) #place(center + horizon, dx: 25%, dy: 7pt, text(fill: color2, [$ r = 1 $])) ] ], caption: [ Flächeninhalt $A$ eines Kreises mit Radius $r = 1$ ] ) Schon Archimedes erkannte und bewies mathematisch, $pi$ ist eine Konstante. #cite(<ARTICLE:CIRCULAR-REASONING-WHO-FIRST-PROVED-THAT-C-over-d-IS-A-CONSTANT:2013>) Daraus folgt, $pi$ kann berechnet werden, damit auch der Umfang eines jeden Kreises. Außerdem ist es mathematisch bewiesen, dass $pi$ eine irrationale Zahl ist (nicht als Bruch dargestellt werden kann), es daher nicht möglich ist, ihren genauen Wert zu erfahren. Es kann nur numerische Annäherungen mit einer gewissen Präzision geben. #cite(<ARTICLE:On-Discovering-and-Proving-that-Pi-Is-Irrational:2010>) Nun zu einer Möglichkeit wie $pi$ berechnet werden kann. Wie bereits erwähnt, sind Mathematikern zahlreiche solcher Methoden bekannt, weit mehr als es im Zuge dieser Arbeit Sinn hätte, zu erläutern. #cite(<ARTICLE:The-Quest-for-Pi:1996>) #cite(<ARTICLE:A-DETAILED-PROOF-OF-THE-CHUDNOVSKY-FORMULA-WITH-MEANS-OF-BASIC-COMPLEX-ANALYSIS:2020>) #cite(<BOOK:Pi-Unleashed:2001>) #cite(<BOOK:A-History-of-Pi:2015>) Aus diesem Grund wird für diesen Teil nur beispielhaft Archimedes Methode erläutert. Er bemerkte, dass regelmäßige Polygone, die innerhalb und außerhalb eines Kreises gezeichnet werden, einen Umfang haben, der nahezu dem Umfang des Kreises entspricht. Dabei gilt, je mehr Seiten das genutzte Polygon hat, um so näher liegt sein Umfang an dem des Kreises. #cite(<BOOK:Pi-Unleashed:2001>) #cite(<BOOK:A-History-of-Pi:2015>) #cite(<ARTICLE:The-Quest-for-Pi:1996>) Im Folgenden für einige Polygone dargestellt. #figure( [ #rect(width: 295pt, height: 290pt, inset: 0pt, stroke: none)[ #place(top + left, rect(width: 140pt, height: 140pt, inset: 0pt, stroke: none, [ #place(horizon + center, circle(radius: 70pt, stroke: (paint: color1, dash: "densely-dashed"))) #place(horizon + center, regular_polygon(sides: 4, radius: 70pt, stroke: color0)) #place(horizon + center, regular_polygon(sides: 4, radius: 70pt, stroke: color0, inner: true)) ])) #place(top + right, rect(width: 140pt, height: 140pt, inset: 0pt, stroke: none, [ #place(horizon + center, circle(radius: 70pt, stroke: (paint: color1, dash: "densely-dashed"))) #place(horizon + center, regular_polygon(sides: 6, radius: 70pt, stroke: color0)) #place(horizon + center, regular_polygon(sides: 6, radius: 70pt, stroke: color0, inner: true)) ])) #place(bottom + left, rect(width: 140pt, height: 140pt, inset: 0pt, stroke: none, [ #place(horizon + center, circle(radius: 70pt, stroke: (paint: color1, dash: "densely-dashed"))) #place(horizon + center, regular_polygon(sides: 8, radius: 70pt, stroke: color0)) #place(horizon + center, regular_polygon(sides: 8, radius: 70pt, stroke: color0, inner: true)) ])) #place(bottom + right, rect(width: 140pt, height: 140pt, inset: 0pt, stroke: none, [ #place(horizon + center, circle(radius: 70pt, stroke: (paint: color1, dash: "densely-dashed"))) #place(horizon + center, regular_polygon(sides: 12, radius: 70pt, stroke: color0)) #place(horizon + center, regular_polygon(sides: 12, radius: 70pt, stroke: color0, inner: true)) ])) ] ], caption: [ Regelmäßige Polygone zur Annäherung von $pi$ ] ) Archimedes definierte $pi$ nicht genau, sondern als zwischen dem Umfang des kleineren Polygons $U_1$ und dem Umfang des größeren Polygons $U_2$ liegenden $U_1 > pi > U_2$. #cite(<BOOK:Pi-Unleashed:2001>) #cite(<BOOK:A-History-of-Pi:2015>) #cite(<ARTICLE:The-Quest-for-Pi:1996>) #pagebreak() == Fallanalyse Im Weiteren wird in dieser Arbeit an Beispielen der Zusammenhang zwischen $pi$ an verschiedenen Stellen der Mathematik und seiner Definition über den Kreis untersucht werden. Um diese Ergebnisse zur Beantwortung der hier gestelleten Frage aufzubereiten, ist es nützlich, sie bereits im Voraus zu kategorisieren und die Bewertung dann anhand dieser Kategorien vorzunehmen. Zu unterscheiden ist erst einmal zwischen einem bestehenden und einem nicht bestehenden Zusammenhang zur Geometrie des Kreises. Bei einem bewiesenen bestehenden Zusammenhang wird zwischen einem geometrischen und einem algebraischen Beweis unterschieden. Wenn kein Zusammenhang besteht, muss noch unterschieden werden, ob beweisbar ist, dass jener nicht besteht oder ob nur eine Vermutung diesen Schluss begründet. Es ergeben sich die folgenden Kategorien. #table( columns: (3.6cm, auto, auto), stroke: color0, [*Kategorie*], [*Definition*], [*Bewertung*], [Kategorie 1:\ Bestehender Zusammenhang mit algebraischem Beweis], [Es besteht ein Zusammenhang zwischen der Verwendung von $pi$ und dem Kreis der algebraisch formal bewiesen werden kann. Der entsprechende Sachverhalt kann formal ausgedrückt werden und anschließend über beliebig viele Schritte in Verbindung zu einer formalen Form des Kreises gebracht werden.], [Ist dies bei einem Sachverhalt der Fall, so besteht zweifellos ein Zusammenhang zwischen der Verwendung von $pi$ und dem Kreis, solange keine Mängel im Vorgehen bewiesen sind.], [Kategorie 2:\ Bestehender Zusammenhang mit geometrischem Beweis], [Es besteht ein Zusammenhang zwischen der Verwendung von $pi$ und dem Kreis, der geometrisch gezeigt werden kann. Es muss eindeutig, die gemetrische Form des Kreises die im Sachverhalt verborgen liegt, gezeigt werden.], [Ist dies bei einem Sachverhalt der Fall, so besteht ein Zusammenhang zwischen der Verwendung von $pi$ und dem Kreis, solange keine Mängel im Vorgehen bewiesen sind. Allerdings ist der Zusammenhang vermutlich nicht vollends ergründet. Es sollte daher nach Möglichkeiten gesucht werden, einen formalen Beweis zum besseren Verständnis zu finden.], [Kategorie 3:\ Nicht bestehender Zusammenhang als Vermutung], [Es ist weder möglich, einen Zusammenhang zwischen der Verwendung von $pi$ und dem Kreis geometrisch oder algebraisch zu beweisen noch zu wiederlegen. Es kann jedoch aufgrund erheblichen Aufwandes, der in die Untersuchung geflossen ist, vermutet werden, dass eventuell kein Zusammenhang besteht.], [Ist dies bei einem Sachverhalt der Fall, so kann keine genaue Aussage über das Bestehen oder Nichtbestehen eines Zusammenhangs zwischen der Verwendung von $pi$ und dem Kreis getroffen werden. Es kann nur vermutet werden, dass möglicherweise kein Zusammenhang besteht.], [Kategorie 4:\ Nicht bestehender Zusammenhang mit algebraischem Beweis], [Es besteht kein Zusammenhang zwischen der Verwendung von $pi$ und dem Kreis, was algebraisch formal bewiesen werden kann.], [Ist dies bei einem Sachverhalt der Fall, so besteht zweifellos kein Zusammenhang zwischen der Verwendung von $pi$ und dem Kreis, solange keine Mängel im Vorgehen bewiesen sind.] ) Die vierte Kategorie ist für diese Arbeit besonders interessant, weil, wenn auch nur ein Sachverhalt in diese Kategorie fällt, die Frage mit der sich diese Arbeit beschäftigt, sicher beantwortet werden kann. Wenn jedoch kein solcher Sachverhalt im Laufe dieser Arbeit gefunden werden sollte, kann die Frage nicht final beantworten werden, denn es könnte Sachverhalte geben, die nicht berücksichtigt werden konnten oder die (noch) nicht bekannt sind. Im Folgenden werden einzelne Sachverhalten den vier oben erläuterten Kategorien zugeordnet. === Pi als Integral Die folgende Formel wurde im Laufe dieser Arbeit entwickelt, um $pi$ mit beliebiger Genauigkeit berechenen zu können, ohne dass viel Vorwissen nötig ist, um ihre Herleitung nach zu vollziehen. $ pi = lim_(n -> infinity) frac(2, n) sum_(k=1)^(n) sqrt(1 - (-1 + (k - 1) dot frac(2, n))^2) + sqrt(1 - (-1 + k dot frac(2, n))^2) $ Statt hier nur zu beweisen, dass besagte Formel eine Verbindung zum Kreis hat, wird im Folgenden ihre Entwicklung reproduziert. Es wird gezeigt werden, dass ihr zugrunde die Geometrie des Kreises liegt, da sie sich aus eben jener ableiten lässt. Dafür ist an dieser Stelle ein mathematischer Zusammenhang mit $pi$ und dem Kreis, der weiter oben schon erwähnt wurde, wichtig. Zur Erinnerung: der Radius $r$ eines beliebigen Kreises zum Quadrat $r^2$ multipliziert mit $pi$ entspricht der Fläche $A$ des Kreises. #cite(<BOOK:Euclid-books-I-II:1883>) #figure( [ #rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none)[ #place(center + horizon, circle(radius: 100pt, fill: bgcolor0, stroke: color0)) #place(center + horizon, line(start: (50%, 0%), end: (100%, 0%), stroke: color2)) #place(center + horizon, circle(radius: 2pt, fill: color3)) #place(center + horizon, dx: 8pt, dy: -8pt, text(fill: color3, [$ O $])) #place(center + bottom, dy: -25%, [$ A = pi r^2 = pi 1^2 = pi $]) #place(center + horizon, dx: 25%, dy: 7pt, text(fill: color2, [$ r = 1 $])) ] ], caption: [ Flächeninhalt $A$ eines Kreises mit Radius $r = 1$ ] ) Daraus folgt, wenn es möglich ist ohne Verwendung von $pi$ den Flächeninhalt $A$ eines Kreises näherungsweise zu berechnen, kann diese Methode auch verwendet werden, um $pi$ mit einer gewissen Präzision zu berechnen. Zur Vereinfachung wählen wir einen Kreis mit dem Radius $r = 1$ und platzieren diesen sogenannten Einheitskreis auf dem Ursprung eines zweidimensionalen Koordinatensystems. #figure( [ #default_coordinate_system([ #place(center + horizon, circle(radius: 100pt, stroke: color0)) #place(right + top, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none)[ #place(bottom + left, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none)[ #line(length: 100%, start: (0%, 100%), angle: -45deg, stroke: color2) ]) ]) #place(center + horizon, dx: 25%, dy: -7pt, text(fill: color2, [$ r = 1 $])) ]) ], caption: [ Flächeninhalt $A$ eines Kreises mit Radius $r = 1$ ] ) Bei einem Kreis mit dem Radius $r = 1$ entspricht der Flächeninhalt $A$ exakt $pi$. $ r &= 1 \ A &= pi r^2 \ A &= pi 1^2 \ A &= pi \ $ Folglich kann das Ergebnis für den Flächeninhalt $A$ direkt, ohne weitere Umformungen als Wert für $pi$ verwendet werden. Die Idee im nächten Schritt: den Kreis mit Flächen anzunähern, deren Inhalt sich leichter berechnen lässt, als der des Kreises. Optimalerweise so, dass endlos neue Flächen hinzugefügt oder in ihrer Form nach einem festgelegten Schema verändert werden können, um die Genauigkeit mit jeder Ite­ra­ti­on der Berechungen zu verbessern (es wird ein Grenzprozess konstruiert). Eines der besten mathematischen Instrumente, um eine solche Vorgehensweise zu entwickeln, ist die Analysis, genauer die Integralrechnung. #cite(<BOOK:Das-kleine-Buch-der-Integralrechnung:2013>) Bekannt ist an dieser Stelle die allgemeinen Definition des Kreises. Aus dieser muss nun eine Funktion für das Interval $[-1;1]$ gebildet werden, zum Beispiel über den Satz des Pythagoras. #cite(<BOOK:Beweise-zur-Satzgruppe-des-Pythagoras-Analyse-und-Vergleich-ihrer-Behandlung-in-ausgewaehlten-gymnasialen-Unterrichtswerken-der-Jahrgangsstufe-9:2011>) Aus jedem Punkt des Kreises kann ein rechtwinkliges Dreieck konstruiert werden. Die Hypotenuse hat dabei immer die Länge des Kreisradius $r$, denn genau diese Eigenschaft definiert den Kreis überhaupt. Die Kathete $a$ wird dem $x$-Wert und Kathete $b$ dem $y$-Wert zugeordnet. Es kann beispielsweise das folgende Dreieck konstruiert werden. #figure( [ #default_coordinate_system([ #place(center + horizon, circle(radius: 100pt, stroke: color0)) #place(right + top, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none)[ #place(left + bottom, rect(width: 50pt, height: 86.602540pt, inset: 0pt, stroke: none)[ #place(center + horizon, line(start: (100%, 100%), end: (100%, 0%), stroke: color3)) #place(center + horizon, line(start: (0%, 100%), end: (100%, 0%), stroke: color2)) #place(center + horizon, line(start: (0%, 100%), end: (100%, 100%), stroke: color1)) #place(left + horizon, dx: 8pt, dy: -30%, text(fill: color2, [$ c = r $])) #place(right + horizon, dx: 28pt, text(fill: color3, [$ b = y $])) #place(center + bottom, dy: 8pt, text(fill: color1, [$ a = x $])) ]) ]) ]) ], caption: [ Konstruiertes rechtwinkliges Dreieck im Einheitskreis ] ) Der Satz des Pythagoras kann aus seiner allgemeinen Form $a^2 + b^2 = c^2$ wie folgt in zwei Funktionen in der Form $y = f(x)$ umgeformt werden. $ a & = x \ b & = y \ c & = r \ c^2 & = a^2 + b^2 \ $ Aus dieser allgemeinen Form wird durch Einsetzen von $x$, $y$ und $r$: $ r^2 = x^2 + y^2 $ Daraus ergibt sich nach anschließendem Auflösen nach $y$, $f_1(x)$ und $f_2(x)$. $ r^2 & = x^2 + y^2 & | - x^2 \ r^2 - x^2 & = y^2 & | sqrt(space) \ y & = minus.plus sqrt(r^2 - x^2) space & \ f_1(x) & = sqrt(r^2 - x^2) & \ f_2(x) & = - sqrt(r^2 - x^2) & \ $ $r$ wurde, um $pi$ zu berechnen, weiter oben als $r = 1$ definiert. Durch Einsetzen von $r = 1$ und anschließendes Vereinfachen ergeben sich die Funktionen $f_1(x) = sqrt(1 - x^2)$ und $f_2(x) = - sqrt(1 - x^2)$ für einen Kreis mit dem Radius $r = 1$ (Einheitskreis). $f_1(x)$ stellt die obere und $f_2(x)$ die untere Seite des Kreises dar. Wie die obere und untere Seite des Kreises, sind auch $f_1(x)$ und $f_2(x)$ die Spiegelung der jeweils anderen Funktion an der $x$-Achse ($f_1(x) = - f_2(x)$). #cite(<ARTICLE:CIRCULAR-REASONING-WHO-FIRST-PROVED-THAT-C-over-d-IS-A-CONSTANT:2013>) #cite(<BOOK:Einfuehrung-Mathematik-Primarstufe-Geometrie:2015>) #figure( [ #rect(width: 320pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( stroke: color3, closed: false, ..arc(start: -90deg, end: 90deg) ) ) ) ) #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( stroke: color1, closed: false, ..arc(start: 90deg, end: 270deg) ) ) ) ) ]) ) #place(right + horizon, rect(width: 88pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ f_1(x) = sqrt(1 - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color1) $ f_1(x) = - sqrt(1 - x^2) $ ]) ]) ] ], caption: [ Einheitskreis als Funktionen $f_1(x)$ und $f_2(x)$ ] ) Der Flächeninhalt des Kreises entspricht der Summe der Integrale $integral_(-1)^1 f_1(x) d x$ und $integral_(-1)^1 f_2(x) d x$ als Flächeninhalt (ihrem absoluten Wert). Um die Integrale zu berechnen (ohne Nutzung von $pi$ selbst oder mit $pi$ verbunden Funktionen, wie der Sinusfunktion $sin(x)$) bietet sich an, die Trapezsumme zu verwenden. #cite(<BOOK:Das-kleine-Buch-der-Integralrechnung:2013>) #cite(<BOOK:Encyclopaedia-of-Mathematics-Stochastic-Approximation-Zygmund-Class-of-Functions:1993>) Die Trapezsumme teilt das Integral in viele Trapeze auf (im Grenzprozess unendlich viele Trapeze). Der Flächeninhalt aller Trapeze summiert ist der Grenzwert für das jeweilige Integral. #cite(<BOOK:Encyclopaedia-of-Mathematics-Stochastic-Approximation-Zygmund-Class-of-Functions:1993>) Die Trapezsumme wird genauer, je schmaler die Trapeze werden und erfüllt damit perfekt die Anprüche, die es, wie oben schon erwähnt, an eine Methode zur Berechnung von $pi$ gibt. Um $pi$ genauer zu berechnen, kann die Breite $l$ (im weiteren wird die Breite der Trapeze repräsentiert durch $l$) der Trapeze verkleinert werden. Im Folgenden ist diese Methode grafisch für $l = frac(1, 2)$ und $l = frac(1, 5)$ dargestellt. #figure( [ #rect(width: 320pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #let trapezoid(..args) = place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( fill: bgcolor2, stroke: color2, closed: true, ..args ) ) ) ) #trapezoid((-100pt, 0pt), (-50pt, 86.6pt), (-50pt, -86.6pt)) #trapezoid((-50pt, 86.6pt), (-50pt, -86.6pt), (0pt, -100pt), (0pt, 100pt)) #trapezoid((50pt, -86.6pt), (50pt, 86.6pt), (0pt, 100pt), (0pt, -100pt)) #trapezoid((100pt, 0pt), (50pt, -86.6pt), (50pt, 86.6pt)) #place(center + horizon, dx: 25pt, dy: 50pt, axis(length: 46pt, stroke: color2, fill: color2) ) #place(center + horizon, dx: 25pt, dy: 50pt, axis(length: 46pt, stroke: color2, fill: color2, angle: 180deg) ) #place(center + horizon, dx: 25pt, dy: 38pt, [ #set text(fill: color2) $frac(1, 2)$ ]) #place(center + horizon, line(length: 100%, stroke: color2) ) #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( stroke: color3, closed: false, ..arc(start: -90deg, end: 90deg) ) ) ) ) #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( stroke: color1, closed: false, ..arc(start: 90deg, end: 270deg) ) ) ) ) ]) ) #place(right + horizon, rect(width: 88pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ f_1(x) = sqrt(1 - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color1) $ f_1(x) = - sqrt(1 - x^2) $ ]) ]) ] ], caption: [ Integrale von $f_1(x)$ und $f_2(x)$ angenähert über die Trapezsumme für $l = frac(1, 2)$ ] ) #figure( [ #rect(width: 320pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #let trapezoid(..args) = place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( fill: bgcolor2, stroke: color2, closed: true, ..args ) ) ) ) #trapezoid((-100pt, 0pt), (-80pt, 60pt), (-80pt, -60pt)) #trapezoid((-80pt, 60pt), (-80pt, -60pt), (-60pt, -80pt), (-60pt, 80pt)) #trapezoid((-60pt, -80pt), (-60pt, 80pt), (-40pt, 91.65pt), (-40pt, -91.65pt)) #trapezoid((-40pt, 91.65pt), (-40pt, -91.65pt), (-20pt, -97.97pt), (-20pt, 97.97pt)) #trapezoid((-20pt, -97.97pt), (-20pt, 97.97pt), (0pt, 100pt), (0pt, -100pt)) #trapezoid((20pt, -97.97pt), (20pt, 97.97pt), (0pt, 100pt), (0pt, -100pt)) #trapezoid((40pt, 91.65pt), (40pt, -91.65pt), (20pt, -97.97pt), (20pt, 97.97pt)) #trapezoid((60pt, -80pt), (60pt, 80pt), (40pt, 91.65pt), (40pt, -91.65pt)) #trapezoid((80pt, 60pt), (80pt, -60pt), (60pt, -80pt), (60pt, 80pt)) #trapezoid((100pt, 0pt), (80pt, 60pt), (80pt, -60pt)) #place(center + horizon, dx: 10pt, dy: 50pt, axis(length: 16pt, stroke: color2, fill: color2) ) #place(center + horizon, dx: 10pt, dy: 50pt, axis(length: 16pt, stroke: color2, fill: color2, angle: 180deg) ) #place(center + horizon, dx: 10pt, dy: 37pt, [ #set text(fill: color2) $frac(1, 5)$ ]) #place(center + horizon, line(length: 100%, stroke: color2) ) #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( stroke: color3, closed: false, ..arc(start: -90deg, end: 90deg) ) ) ) ) #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none, move(dx: 50%, dy: 50%, path( stroke: color1, closed: false, ..arc(start: 90deg, end: 270deg) ) ) ) ) ]) ) #place(right + horizon, rect(width: 88pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ f_1(x) = sqrt(1 - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color1) $ f_1(x) = - sqrt(1 - x^2) $ ]) ]) ] ], caption: [ Integrale von $f_1(x)$ und $f_2(x)$ angenähert über die Trapezsumme für $l = frac(1, 5)$ ] ) Für den an dieser Stelle vorliegenden Sachkontext ergibt sich, dass jedes Trapez an seinen beiden Parallelen durch die Funktionen $f_1(x)$ und $f_2(x)$ begrenzt wird. Wenn eine Seite (ein Parallele zur $y$-Achse) des Trapezes an der Stelle $x$ liegt, dann ist ihre Länge gleich der Differenz zwischen $f_1(x)$ und $f_2(x)$ an genau dieser Stelle $x$. Es lässt sich die Funktion $g(x) = f_1(x) - f_2(x)$ für die Länge einer Trapezseite an einer Stelle $x$ aufstellen. #cite(<BOOK:Encyclopaedia-of-Mathematics-Stochastic-Approximation-Zygmund-Class-of-Functions:1993>) #cite(<BOOK:Das-kleine-Buch-der-Integralrechnung:2013>) $g(x)$ kann wie folgt vereinfacht werden. $ g(x) &= f_1(x) - f_2(x) \ g(x) &= (sqrt(1 - x^2))-(- sqrt(1 - x^2)) \ g(x) &= sqrt(1 - x^2) + sqrt(1 - x^2) \ g(x) &= 2 dot sqrt(1 - x^2) = 2 dot f_1(x) \ $ $g(x)$ kann nun in die allgemeine Form der Trapezsumme als Funktion zur Berechung der Seitenlängen eingesetz werden. Allgemein kann die Trapezsumme wie folgt geschrieben werden. #cite(<BOOK:Encyclopaedia-of-Mathematics-Stochastic-Approximation-Zygmund-Class-of-Functions:1993>) #cite(<BOOK:Das-kleine-Buch-der-Integralrechnung:2013>) #cite(<BOOK:Einfuehrung-Mathematik-Primarstufe-Geometrie:2015>) $ integral_(a)^(b) t(x) d x = frac(b - a, n) sum_(k=1)^(n) frac(t(a + (k - 1) dot frac(b - a, n)) + t(a + k dot frac(b - a, n)), 2) $ $n$ steht dabei für die Anzahl der Trapeze, $a$ ist der Anfang und $b$ das Ende des Integrals. #cite(<BOOK:Encyclopaedia-of-Mathematics-Stochastic-Approximation-Zygmund-Class-of-Functions:1993>) #cite(<BOOK:Das-kleine-Buch-der-Integralrechnung:2013>) #cite(<BOOK:Einfuehrung-Mathematik-Primarstufe-Geometrie:2015>) Im Sachkontext sind die Integralgrenzen als $a = -1$ und $b = 1$ festgelegt, denn in diesem Bereich befindet sich der Einheitskreis ($f_1(x)$, $f_2(x)$ und demnach auch $g(x)$ sind nur im Intervall $[-1,1]$ überhaupt definiert), durch Einsetzen der Werte und Vereinfachen ergibt sich folgende Form. $ integral_(a)^(b) t(x) d x &= frac(b - a, n) &sum_(k=1)^(n) frac(t(a + (k - 1) dot frac(b - a, n)) + t(a + k dot frac(b - a, n)), 2) \ integral_(-1)^(1) t(x) d x &= frac(2, n) &sum_(k=1)^(n) frac(t(-1 + (k - 1) dot frac(2, n)) + t(-1 + k dot frac(2, n)), 2) \ $ Der Term $t(-1 + (k - 1) dot frac(2, n))$ steht für die eine und $t(-1 + k dot frac(2, n))$ für die andere Seitenlängen jedes der den Kreis füllenden Trapeze. $g(x)$ wurde weiter oben als Funktion, die genau dafür steht, definiert. Wird die Funktion $g(x)$ für $t(x)$ in diese Form eingesetzt, aufgelöst und $n$ gegen Unendliche laufen gelassen, so ergibt sich eine Formel zur Berechnung von $pi$. $ & pi = lim_(n -> infinity) frac(2, n) sum_(k=1)^(n) frac(g(-1 + (k - 1) dot frac(2, n)) + g(-1 + k dot frac(2, n)), 2) \ & pi = lim_(n -> infinity) frac(2, n) sum_(k=1)^(n) frac(2 dot sqrt(1 - (-1 + (k - 1) dot frac(2, n))^2) + 2 dot sqrt(1 - (-1 + k dot frac(2, n))^2), 2) \ & pi = lim_(n -> infinity) frac(2, n) sum_(k=1)^(n) frac(2 dot sqrt(1 - (-1 + (k - 1) dot frac(2, n))^2), 2) + frac(2 dot sqrt(1 - (-1 + k dot frac(2, n))^2), 2) \ & pi = lim_(n -> infinity) frac(2, n) sum_(k=1)^(n) frac(cancel(2) dot sqrt(1 - (-1 + (k - 1) dot frac(2, n))^2), cancel(2)) + frac(cancel(2) dot sqrt(1 - (-1 + k dot frac(2, n))^2), cancel(2)) \ & pi = lim_(n -> infinity) frac(2, n) sum_(k=1)^(n) sqrt(1 - (-1 + (k - 1) dot frac(2, n))^2) + sqrt(1 - (-1 + k dot frac(2, n))^2) \ $ Wenn $n$ beispielsweise bis $n = 1000000$ läuft, dann entspricht das Ergebnis bis zur neunten Nachkommanstelle dem tatsächlichen Wert von $pi$. #cite(<BOOK:Pi-Unleashed:2001>) #cite(<BOOK:A-History-of-Pi:2015>) #cite(<ARTICLE:The-Quest-for-Pi:1996>) $ & n = 1000000 \ & pi approx frac(2, n) sum_(k=1)^(n) sqrt(1 - (-1 + (k - 1) dot frac(2, n))^2) + sqrt(1 - (-1 + k dot frac(2, n))^2) = 3.14159265 02636 \ $ Wichtig ist an dieser Stelle anzumerken, dass diese komplexe Formel zur Berechnung von $pi$ eindeutig vom Kreis und seiner Geometrie abgeleitet ist. Ihr liegt die Idee, den Einheitskreis als Funktion zu repräsentieren und dann ihr Integral, somit logischerweise auch den Flächeninhalt des Kreises, mit Hilfe der Trapezsumme anzunähern und so $pi$ zu bestimmen. Die entwickelte Fromel: $ pi = lim_(n -> infinity) frac(2, n) sum_(k=1)^(n) sqrt(1 - (-1 + (k - 1) dot frac(2, n))^2) + sqrt(1 - (-1 + k dot frac(2, n))^2) $ kann zweifellos der 1. Kategorie zugeordnet werden, denn ihr Zusammenhang mit der Geometrie des Kreises wurde im Zuge ihrer Entwicklung eindeutig belegt. === <NAME> Billiard Problem <NAME> stellt in seiner Arbeit "PLAYING POOL WITH PI (THE NUMBER PI FROM A BILLIARD POINT OF VIEW)", eine Methode zur Berechung von $pi$ vor. #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) #cite(<VIDEO:The-most-unexpected-answer-to-a-counting-puzzle:2019>) Sie ist nicht darauf angelegt besonders schnell, effektiv oder effizient zu sein, aber sie wird von zahlreichen Mathematikern als sehr elegant und lehreich angesehen. #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<VIDEO:The-most-unexpected-answer-to-a-counting-puzzle:2019>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) Im Folgenden wird sie genau erklärt, um sie im Anschluss einer der oben genannten Kategorien zu zuordnen. Die folgende Erläuterung weicht von Galperins ursprünglicher Methode in Teilen ab, verändert aber nichts an der zu Grunde liegenden Mathematik. #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) Ein Objekt der Masse $M$ bewegt sich mit der Geschwindigkeit $V$ entlang einer Gerade auf ein zweites Objekt der Masse $m$ zu, das stationär ist (seine Geschwindigkeit $v$ ist Null), bevor es perfekt elastisch damit kollidiert (d. h. vor und nach der Kollision hat das System dieselbe Energie), #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) das zweite Objekt in Richtung einer unbeweglichen Wand (gedacht könnte die Wand eine unendliche Masse haben) treibt. #cite(<VIDEO:The-most-unexpected-answer-to-a-counting-puzzle:2019>) #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) Das zweite Objekt wird nach einer weiteren perfekten elastischen Kollision mit der Wand reflektiert und kollidiert erneut mit dem ersten Objekt. Dieser Vorgang wiederholt sich, bis sich beide Objekte von der Wand entfernen und die Geschwindigkeit $V$ des ersten Objekts die Geschwindigkeit $v$ des zweiten Objekts übersteigt. Es gelten dabei nur der Energie- und Impulserhaltungssatz, keine anderen physikalischen Gesetze. #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) #cite(<VIDEO:The-most-unexpected-answer-to-a-counting-puzzle:2019>) Das beschriebene System ist in der folgenden Grafik für die ersten zwei Kollisionen modelhaft dargestellt. #figure( [ #rect(width: 350pt, height: 350pt, inset: 0pt, stroke: none)[ #place(top + center, rect(width: 100%, height: 100pt, inset: 0pt, stroke: none)[ #place(horizon + left, line(length: 100%, stroke: color0, angle: 90deg)) #place(horizon + right, rect(width: 60pt, height: 60pt, inset: 0pt, stroke: color0, fill: bgcolor0, [ $ M $ #place(horizon + left, dx: -44%, axis(length: 85%, angle: 180deg, stroke: color0)) #place(horizon + left, dx: -50%, dy: 10pt, [$ V_0 $]) ])) #place(horizon + center, dx: 5%, rect(width: 60pt, height: 60pt, inset: 0pt, stroke: color0, fill: bgcolor0, [ $ m $ ])) ]) #place(horizon + center, rect(width: 100%, height: 100pt, inset: 0pt, stroke: none)[ #place(horizon + left, line(length: 100%, stroke: color0, angle: 90deg)) #place(horizon + center, dx: 15%, rect(width: 60pt, height: 60pt, inset: 0pt, stroke: color0, fill: bgcolor0, [ $ M $ #place(horizon + left, dx: -29%, axis(length: 55%, angle: 180deg, stroke: color0)) #place(horizon + left, dx: -33.5%, dy: 10pt, [$ V_1 $]) ])) #place(horizon + left, dx: 15%, rect(width: 60pt, height: 60pt, inset: 0pt, stroke: color0, fill: bgcolor0, [ $ m $ #place(horizon + left, dx: -29%, axis(length: 55%, angle: 180deg, stroke: color0)) #place(horizon + left, dx: -33.5%, dy: 10pt, [$ v_1 $]) ])) ]) #place(bottom + center, rect(width: 100%, height: 100pt, inset: 0pt, stroke: none)[ #place(horizon + left, line(length: 100%, stroke: color0, angle: 90deg)) #place(horizon + center, dx: 5%, rect(width: 60pt, height: 60pt, inset: 0pt, stroke: color0, fill: bgcolor0, [ $ M $ #place(horizon + left, dx: -29%, axis(length: 55%, angle: 180deg, stroke: color0)) #place(horizon + left, dx: -33.5%, dy: 10pt, [$ V_1 $]) ])) #place(horizon + left, dx: 7.5%, rect(width: 60pt, height: 60pt, inset: 0pt, stroke: color0, fill: bgcolor0, [ $ m $ #place(horizon + right, dx: 29%, axis(length: 55%, stroke: color0)) #place(horizon + right, dx: 33.5%, dy: 10pt, [$ v_1 $]) ])) ]) ] ], caption: [ Galperins Billiard Problem für die ersten zwei Kollision modelhaft dargestellet ] ) Um Galperins Methode durchzuführen, ist hier die Wahl eines Verhältnisses $d$ der beiden Massen $M$ und $m$ ($d = frac(M, n)$) erforderlich. Für $d$ muss dabei gelten $d = 10^(2(n-1)) and n in NN^*$. Theoretisch könnten alle Kollisionen gezählt werden. Nennen wir diese Anzahl an Kollisionen $K$. Wie Galperin beschreibt, ergäbe sich für $K = floor(pi dot 10^((n-1)))$. $K$ kann nur ganzzahlige Werte haben, denn im definierten System existieren nur ganze Kollisionen, die gezählt werden können. #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) $K$ ist equivalent zu den ersten $n$ Stellen von $pi$ somit ist $Pi = frac(K, 10^((n-1)))$ ein Näherungswert für $pi$, der für immer größere $n$ gegen $pi$ strebt. In der folgenden Tabelle sind Werte für $K$, $d$ und dem daraus berechnenten Näherungswert $Pi$ für $pi$ bis $n=9$ aufgelistet. #figure( [ #table( inset: 8pt, stroke: color0, columns: (auto, auto, auto, auto), [$n$], [$K$], [$d$], [$Pi$], [ $1$ \ $2$ \ $3$ \ $4$ \ $5$ \ $6$ \ $7$ \ $8$ \ $9$ \ ], align(left)[ $3$ \ $31$ \ $314$ \ $3141$ \ $31415$ \ $314159$ \ $3141592$ \ $31415926$ \ $314159265$\ ], align(left)[ $10^0$ \ $10^2$ \ $10^4$ \ $10^6$ \ $10^8$ \ $10^(10)$ \ $10^(12)$ \ $10^(14)$ \ $10^(16)$ \ ], align(left)[ $3$ \ $3.1$ \ $3.14$ \ $3.141$ \ $3.1415$ \ $3.14159$ \ $3.141592$ \ $3.1415926$ \ $3.14159265$ \ ] ) ], caption: [ Galperins Billiard Problem für die ersten zwei Kollision modelhaft dargestellet ] ) Diese Werte können mittels einer Physiksimulation bestätigt werden. #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<VIDEO:How-colliding-blocks-act-like-a-beam-of-light-to-compute-pi.:2019>) #cite(<VIDEO:The-most-unexpected-answer-to-a-counting-puzzle:2019>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) Wie bereits erwähnt, gelten in der gedachten Welt, in der Galperins Methode durchgeführt wird, der Energie- und Impulserhaltungssatz. Der Energieerhaltungssatz kann für $M$, $m$ und den dazugehörigen $V$, $v$ wie folgt geschrieben werden. Nennen wir dabei die gesamt Energie des Systems $q$, $q$ ist eine Konstante. $ q = frac(1, 2) M V^2 + frac(1, 2) m v^2 $ Am Anfang bewegt sich das zweite Objekt nicht $v_0 = 0$, $q$ entspricht deshalb der Anfangsenergie des ersten Objekts. $ q & = frac(1, 2) M V_0^2 + frac(1, 2) m v_0^2 \ q & = frac(1, 2) M V_0^2 + frac(1, 2) m dot 0^2 \ q & = frac(1, 2) M V_0^2 + cancel(frac(1, 2) m dot 0^2) \ q & = frac(1, 2) M V_0^2 \ $ Der Energieerhaltungssatz lässt sich auch grafisch darstellen. Dazu werden die Geschwindigkeiten beider Objekte jeweils durch eine Koordinate in einem zweidimensionalen Koordinatensystem repräsentiert (jeder Punkt entspricht einem Paar an Geschwindigkeiten $V$ und $v$), ein Problem der Dynamik wird zu einem der Geomentrie. #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) Sei dafür $x = V$ und $y = v$ im Konfigurationsraum (zweidimensionales Koordinatensystem mit $x$ und $y$-Achse, denen jeweils ein Wert oder Freiheitsgrad eines dynamischen Systems zugeordnet wird), so ergibt sich aus dem Energieerhaltungssatz eine Ellipse mit der Gleichung $q = frac(1, 2) M x^2 + frac(1, 2) m y^2$. #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) #figure( [ #default_coordinate_system([ #place(center + horizon, ellipse(height: 200pt, width: 200pt/3, stroke: color3)) ]) ], caption: [ Energieerhaltungssatz als Ellipse im Konfigurationsraum ] ) An dieser Stelle wird eine Verbindung zum Kreis gesucht, eine Neuskalierung des Koordinatensystems ist von Vorteil. #cite(<ARTICLE:The-Dynamics-of-Digits-Calculating-Pi-with-Galperins-Billiards:2017>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) Skalierung der beiden Achsen $x = V$ und $y = v$ durch multiplizieren mit der Wurzel der jeweiligen Masse ($M$ und $m$) ermöglicht eine Umformung des Energieerhaltungssatzes zu einer Form, die der eines Kreises entspricht. Im ersten Schritt wird die Gleichung der Ellipse $q = frac(1, 2) M x^2 + frac(1, 2) m y^2$, die im Konfigurationsraum den Energieerhaltungssatzes repräsentiert, vereinfacht. $ q &= frac(1, 2) M V^2 + frac(1, 2) m v^2 \ 2q &= M V^2 + m v^2 \ $ Für $x$ ergibt sich durch multiplizieren mit $sqrt(M)$ Folgendes. $ x &= sqrt(M) V \ x &= sqrt(M) sqrt(V^2) \ x &= sqrt(M V^2) \ x^2 &= M V^2 \ $ Und für $y$ in ähnlicher Form. $ y &= sqrt(m) v \ y &= sqrt(m) sqrt(v^2) \ y &= sqrt(m v^2) \ y^2 &= m v^2 \ $ Für $M V^2$ lässt sich dementsprechend $x^2$ und für $m v^2$ gleichermaßen $y^2$ einsetzen. $ 2q &= M V^2 + m v^2 \ 2q &= x^2 + m v^2 \ 2q &= x^2 + y^2 \ $ Durch Auflösen nach $y$ ergibt sich die Funktion $E_1(x) = sqrt(2q - x^2)$ für die untere und die Funktion $E_2(x) = - sqrt(2q - x^2)$ für die obere Hälfte des Kreises. $ 2q & = x^2 + y^2 \ y^2 & = 2q + x^2 \ y & = minus.plus sqrt(2q - x^2) \ E_1(x) & = sqrt(2q - x^2) \ E_2(x) & = - sqrt(2q - x^2) \ $ Die Funktionen $E_1(x) = sqrt(2q - x^2)$ und $E_2(x) = - sqrt(2q - x^2)$ beschreiben einen Kreis zentriert auf dem Ursprung, mit einem Radius $r$ von $r = sqrt(2q)$. #figure( [ #rect(width: 335pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #place(center + horizon, circle(radius: 100pt, stroke: color3) ) #place(right + top, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none)[ #place(left + bottom, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none)[ #line(length: 100%, start: (0%, 100%), angle: -45deg, stroke: color2) ]) ]) #place(center + horizon, dx: 25%, dy: -9pt, text(fill: color2, [$ r = sqrt(2q) $])) ]) ) #place(right + horizon, rect(width: 100pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ E_1(x) = sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color3) $ E_2(x) = - sqrt(2q - x^2) $ ]) ]) ] ], caption: [ Energieerhaltungssatz als $E_1(x)$ und $E_2(x)$ im Konfigurationsraum ] ) Bei jeder Kollision befindet sich der Punkt, der die beiden Geschwindigkeiten der Objekte beschreibt, vor und nach der Kollision auf dem Kreis. Durch den Impulserhaltungssatz wird vorgegeben, wo sich auf dem Kreis, der im Konfigurationsraum den Energieerhaltungssatz repräsentiert, der Punkt befindet, der die Geschwindigkeiten $V$ und $v$ der beiden Objekte nach einer Kollision abbildet. Sei der Gesamtimpuls des Systems $w$, so schreibt sich der Impulserhaltungssatz wie folgt. $ w = M V + m v $ Durch Skalierung unter Berücksichtigung des durch $x = sqrt(M) V$ und $y = sqrt(m) v$ definierten Konfigurationsraums und anschließender Umformung nach $y$ ergibt sich die lineare Funktion $I(x) = frac(w - sqrt(M) x, sqrt(m))$ mit der Steigung $I'(x) = - frac(sqrt(M), sqrt(m))$. #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) $ x &= sqrt(M) V \ y &= sqrt(m) v \ w &= M V + m v \ w &= sqrt(M) x + sqrt(m) y \ sqrt(m) y &= w - sqrt(M) x \ y &= frac(w - sqrt(M) x, sqrt(m)) \ I(x) &= frac(w - sqrt(M) x, sqrt(m)) \ $ Diese Funktion $I(x)$ hat zwei Schnittpunkte $P_0$ und $P_1$ mit der Funktion $E_2(x)$. Im Folgenden dargestellt für $M = m = 1$, $V = V_0 = -1$ und $v = v_0 = 0$. #figure( [ #rect(width: 335pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #place(center + horizon, circle(radius: 100pt, stroke: color3) ) #place(center + horizon, rect(width: 220pt, height: 220pt, inset: 0pt, stroke: none)[ #place(left + bottom, line(start: (0pt, 0pt), end: (120pt, 120pt), stroke: color1)) ]) #place(left + horizon, dx: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + bottom, dy: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(left + horizon, dx: 4pt, dy: -10pt, [ #set text(fill: color2) $P_0$ ]) #place(center + bottom, dx: 10pt, dy: -6pt, [ #set text(fill: color2) $P_1$ ]) ]) ) #place(right + horizon, rect(width: 100pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ E_1(x) = sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color3) $ E_2(x) = - sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 90pt, [ #set text(fill: color1) $ I(x) = frac(w - sqrt(M) x, sqrt(m)) $ ]) ]) ] ], caption: [ Erste Kollision im Konfigurationsraum ] ) $P_0$ ist der Punkt, der den Zustand des Systems vor der ersten Kollision symbolisiert und dementsprechend $P_1$ der Punkt, der das System nach der Kollision dargestellt. Nur eine Änderung von $V$ und $v$, so dass sie durch den Punkt $P_1$ repräsentiert werden kann, erfüllt sowohl den Energie- als auch den Impulserhaltungssatz und ist damit die einzig mögliche. Nach der ersten Kollision der beiden Objekte wird das zweite Objekt mit der Masse $m$ mit der Wand kollidieren. Jede Kollision mit der Wand reflektiert, wie auch von Galperin definiert, das Objekt, seine Geschwindigkeit $v$ wird negiert (Vorzeichen ändert sich $v_2 = -v_1$). Im Konfigurationsraum ist diese Kollision mit der Wand repräsentiert durch Spiegelung an der $x$-Achse. #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) #figure( [ #rect(width: 335pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #place(center + horizon, circle(radius: 100pt, stroke: color3) ) #place(center + horizon, rect(width: 220pt, height: 220pt, inset: 0pt, stroke: none)[ #place(left + bottom,line(start: (0pt, 0pt), end: (120pt, 120pt), stroke: color1)) ]) #place(center + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(left + horizon, dx: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + bottom, dy: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + top, dy: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(left + horizon, dx: 4pt, dy: -10pt, [ #set text(fill: color2) $P_0$ ]) #place(center + bottom, dx: 10pt, dy: -6pt, [ #set text(fill: color2) $P_1$ ]) #place(center + top, dx: -10pt, dy: 6pt, [ #set text(fill: color2) $P_2$ ]) ]) ) #place(right + horizon, rect(width: 100pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ E_1(x) = sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color3) $ E_2(x) = - sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 90pt, [ #set text(fill: color1) $ I(x) = frac(w - sqrt(M) x, sqrt(m)) $ ]) ]) ] ], caption: [ Zweite Kollision im Konfigurationsraum ] ) Wichtig ist anzumerken, dass bei dieser Re­fle­xi­on der Impulserhaltungssatz nicht erfüllt ist und durch Definition nicht erfüllt sein muss, denn die Wand hat eine gedachte unendliche Masse, sie ist nach Definition unbeweglich. #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) Dieser Vorgang von Kollision der beiden Objekte und anschließender Kollision des zweiten Objekts mit der Wand wiederholt sich, bis sich beide Objekte von der Wand entfernen ($v lt.eq 0$ und $V lt.eq 0$) und die Geschwindigkeit $V$ des ersten Objekts die Geschwindigkeit $v$ des zweiten Objekts übersteigt ($V lt.eq v$). Im Konfigurationsraum dargestellt durch ein Dreieck zwischen der $x$-Achse (repräsentiert $v lt.eq 0$ und $V lt.eq 0$) und einer Line $v = V$ (repräsentiert $V lt.eq v$ und damit die Objekte können nicht mehr kollidieren). #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #figure( [ #rect(width: 335pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #place(center + horizon, rect(width: 220pt, height: 220pt, inset: 0pt, stroke: none)[ #place(left + bottom, line(start: (0pt, 0pt), end: (120pt, 120pt), stroke: color1)) #place(right + top, polygon(fill: bgcolor5, (0.5pt, 109.5pt), (110pt, 0pt), (110pt, 109.5pt))) #place(right + top, line(start: (0pt, 110pt), end: (110pt, 0pt), stroke: color5)) ]) #place(center + horizon, circle(radius: 100pt, stroke: color3) ) #place(center + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(left + horizon, dx: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + bottom, dy: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + top, dy: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(left + horizon, dx: 4pt, dy: -10pt, [ #set text(fill: color2) $P_0$ ]) #place(center + bottom, dx: 10pt, dy: -6pt, [ #set text(fill: color2) $P_1$ ]) #place(center + top, dx: -10pt, dy: 6pt, [ #set text(fill: color2) $P_2$ ]) ]) ) #place(right + horizon, rect(width: 100pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ E_1(x) = sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color3) $ E_2(x) = - sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 90pt, [ #set text(fill: color1) $ I(x) = frac(w - sqrt(M) x, sqrt(m)) $ ]) ]) ] ], caption: [ Definition der letzen Kollision im Konfigurationsraum ] ) $P_2$ befindet sich in diesem Beispiel noch nicht in der definierten Zone (das Dreieck), der erste Schritt, der die Kollision der zwei Objekte abbildet, wiederholt sich. Bei der Kollision mit der Wand hat sich der Wert für den Gesamtimpuls $w$ so geändert, dass die Funktion $I(x)$ durch $P_2$ verläuft, der Schnittpunkt $P_3$ von $I(x)$ und $E_2(x)$. Befindet sich in der definierten Zone, es wird keine weiteren Kollisionen geben, die es zu zählen gilt. #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) #cite(<ARTICLE:PLAYING-POOL-WITH-PI:2003>) #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #figure( [ #rect(width: 335pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, default_coordinate_system([ #place(center + horizon, rect(width: 220pt, height: 220pt, inset: 0pt, stroke: none)[ #place(right + top, polygon(fill: bgcolor5, (0.5pt, 109.5pt), (110pt, 0pt), (110pt, 109.5pt))) #place(left + bottom, line(start: (0pt, 0pt), end: (120pt, 120pt), stroke: color1)) #place(right + top, line(start: (0pt, 0pt), end: (120pt, 120pt), stroke: color1)) #place(right + top, line(start: (0pt, 110pt), end: (110pt, 0pt), stroke: color5)) ]) #place(center + horizon, circle(radius: 100pt, stroke: color3) ) #place(center + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(left + horizon, dx: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + bottom, dy: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + top, dy: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(right + horizon, dx: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(left + horizon, dx: 4pt, dy: -10pt, [ #set text(fill: color2) $P_0$ ]) #place(center + bottom, dx: 10pt, dy: -6pt, [ #set text(fill: color2) $P_1$ ]) #place(center + top, dx: -10pt, dy: 6pt, [ #set text(fill: color2) $P_2$ ]) #place(right + horizon, dx: -4pt, dy: 9pt, [ #set text(fill: color2) $P_4$ ]) ]) ) #place(right + horizon, rect(width: 100pt, height: 240pt, inset: 0pt, stroke: none)[ #place(left + horizon, dy: -36pt, [ #set text(fill: color3) $ E_1(x) = sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 28pt, [ #set text(fill: color3) $ E_2(x) = - sqrt(2q - x^2) $ ]) #place(left + horizon, dy: 90pt, [ #set text(fill: color1) $ I(x) = frac(w - sqrt(M) x, sqrt(m)) $ ]) ]) ] ], caption: [ Dritte Kollision im Konfigurationsraum ] ) Die Summe der die Punkte verbindenen Linien ergibt $K$ (im Beispiel $K = 3$). Alle Linien, die eine Kollision mit der Wand repräsentieren, verlaufen parallel zueinander (und zur $y$-Achse) und alle Linien, die eine Kollision der beiden Objekte repräsentieren, haben die Steigung $I'(x) = - frac(sqrt(M), sqrt(m))$, verlaufen somit auch parallel zueinander. An jedem Schnittpunkt $P$ bilden die jeweiligen Linien, wie im Folgenden dargestellt, einen überall equivalenten Winkel $phi$. #figure([ #default_coordinate_system([ #place(center + horizon, rect(width: 220pt, height: 220pt, inset: 0pt, stroke: none)[ #place(left + bottom, line(start: (0pt, 0pt), end: (120pt, 120pt), stroke: color1)) #place(right + top, line(start: (0pt, 0pt), end: (120pt, 120pt), stroke: color1)) ]) #place(center + horizon, circle(radius: 100pt, stroke: color3) ) #place(left + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(center + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(right + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(left + horizon, dx: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + bottom, dy: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + top, dy: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(right + horizon, dx: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(left + horizon, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none, [ #move(dx: 0%, dy: 25%, path( stroke: color0, closed: false, ..arc(radius: 50pt, start: 135deg, end: 180deg) ) ) ])) #place(center + bottom, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none, [ #move(dx: 0%, dy: 0%, path( stroke: color0, closed: false, ..arc(radius: 50pt, start: 315deg, end: 360deg) ) ) ])) #place(center + top, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none, [ #move(dx: 17.5%, dy: 0%, path( stroke: color0, closed: false, ..arc(radius: 50pt, start: 135deg, end: 180deg) ) ) ])) #place(right + horizon, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none, [ #move(dx: 0%, dy: 0%, path( stroke: color0, closed: false, ..arc(radius: 50pt, start: 315deg, end: 360deg) ) ) ])) #place(left + horizon, dx: 4pt, dy: -10pt, [ #set text(fill: color2) $P_0$ ]) #place(center + bottom, dx: 10pt, dy: -6pt, [ #set text(fill: color2) $P_1$ ]) #place(center + top, dx: -10pt, dy: 6pt, [ #set text(fill: color2) $P_2$ ]) #place(right + horizon, dx: -4pt, dy: 9pt, [ #set text(fill: color2) $P_4$ ]) #place(left + horizon, dx: 10pt, dy: 33pt, [$phi$]) #place(center + bottom, dx: -15pt, dy: -34pt, [$phi$]) #place(center + top, dx: 14pt, dy: 29pt, [$phi$]) #place(right + horizon, dx: -11pt, dy: -37.5pt, [$phi$]) ]) ], caption: [ Winkel $phi$ im Konfigurationsraum ] ) Mit Hilfe des Kreiswinkelsatzes lässt sich beweisen, dass sich alle Kreisbögen zwischen benachbarten Punkten $P$ mit $2 phi$ bemessen lassen. #figure([ #default_coordinate_system([ #place(center + horizon, rect(width: 200pt, height: 200pt, inset: 0pt, stroke: none)[ #place(left + bottom, line(start: (0pt, 0pt), end: (100pt, 100pt), stroke: color1)) #place(left + horizon, line(length: 100pt, stroke: color1)) ]) #place(center + horizon, circle(radius: 100pt, stroke: color3) ) #place(center + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(left + horizon, dx: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + bottom, dy: 3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + top, dy: -3pt, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + horizon, circle(radius: 3pt, stroke: color2, fill: bgcolor2) ) #place(center + bottom, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none, [ #move(dx: 0%, dy: 0%, path( stroke: color0, closed: false, ..arc(radius: 50pt, start: 315deg, end: 360deg) ) ) ])) #place(center + horizon, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none, [ #move(dx: 0%, dy: 0%, path( stroke: color0, closed: false, ..arc(radius: 50pt, start: 270deg, end: 360deg) ) ) ])) #place(left + horizon, dx: 4pt, dy: -10pt, [ #set text(fill: color2) $P_0$ ]) #place(center + bottom, dx: 10pt, dy: -6pt, [ #set text(fill: color2) $P_1$ ]) #place(center + top, dx: -10pt, dy: 6pt, [ #set text(fill: color2) $P_2$ ]) #place(center + bottom, dx: -15pt, dy: -34pt, [$phi$]) #place(center + horizon, dx: -20pt, dy: -22pt, [$2 phi$]) ]) ], caption: [ Winkel $phi$ im Konfigurationsraum ] ) Ein ganzer Kreis hat einen Winkel von $2pi$. Statt die Kollisionen zu zählen, kann also auch berechnet werden, wie oft $2phi$ summiert werden kann, bevor es größer gleich $2pi$ ist oder vereinfacht, wie oft $phi$ summiert werden kann, bevor es größer gleich $pi$ ist. Für $K$ ergibt sich dementsprechend: $ K dot phi < pi and (K+1) dot phi gt.eq pi and K in NN^* $ Der Winkel $phi$ berechnet sich aus der Steigung von $I(x)$, $I'(x) = - frac(sqrt(M), sqrt(m))$. #figure( rect(width: 150pt, height: 150pt, inset: 0pt, stroke: none)[ #place(center + horizon, line(start: (0pt, 0pt), end: (100%, 100%), stroke: color1)) #place(center + horizon, rect(width: 120pt, height: 120pt, inset: 0pt, stroke: none)[ #place(center + top, line(length: 100%, stroke: color3)) #place(right + horizon, line(length: 100%, angle: 90deg, stroke: color2)) #place(center + bottom, rect(width: 100pt, height: 100pt, inset: 0pt, stroke: none, [ #move(dx: 60%, dy: 0%, path( stroke: color0, closed: false, ..arc(radius: 50pt, start: 315deg, end: 360deg) ) ) ])) #place(right + bottom, dx: -11pt, dy: -34pt, [$phi$]) #place(center + top, dy: -11pt, [ #set text(fill: color3) $1$ ]) ]) #place(left + bottom, dy: -30pt, [ #set text(fill: color1) $I(x) = frac(w - sqrt(M) x, sqrt(m))$ ]) #place(right + horizon, dx: 5pt, [ #set text(fill: color2) $frac(sqrt(M), sqrt(m))$ ]) ], caption: [ Winkel $phi$ berechnet aus Steigung von $I(x)$ ] ) Für $phi$ gilt daher Folgendes. $ phi = arctan(frac(sqrt(m), sqrt(M))) $ Alle Werte, die durch diese Methode für $K$, $d$ und dem daraus berechnenten Näherungswert $Pi$ für $pi$ berechnet werden können, sind identisch mit denen, die zuvor mittels Simulation berechnet wurden. #figure( [ #table( inset: 8pt, stroke: color0, columns: (auto, auto, auto, auto), [$n$], [$K$], [$d$], [$Pi$], [ $1$ \ $2$ \ $3$ \ $4$ \ $dots.v$ \ ], align(left)[ $3$ \ $31$ \ $314$ \ $3141$ \ $dots.v$ \ ], align(left)[ $10^0$ \ $10^2$ \ $10^4$ \ $10^6$ \ $dots.v$ \ ], align(left)[ $3$ \ $3.1$ \ $3.14$ \ $3.141$ \ $dots.v$ \ ] ) ], caption: [ Werte für $K$, $d$ und $\Pi$ bis $n=4$ ] ) Es ist zu erkennen, warum $K$ equivalent zu den ersten $n$ Stellen von $pi$ ist, denn der $arctan(e)$ nähert sich immer mehr dem Argument $e$ an, je kleiner dieses wird (gerechnet im Bogenmaß). #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) Es gilt: $ lim_(e -> 0) arctan(e) - e = 0 $ $e$ ist in diesem Fall gleich der Quotient der beiden Wurzeln der Massen $M$ und $m$ ($e = frac(sqrt(m), sqrt(M))$). Tabellarisch numerisch dargestellt: #figure( [ #table( inset: 8pt, stroke: color0, columns: (auto, auto, auto), [$frac(sqrt(m), sqrt(M))$], [$arctan(frac(sqrt(m), sqrt(M)))$], [$abs(arctan(frac(sqrt(m), sqrt(M))))$], align(left)[ $1$ \ $0.1$ \ $0.01$ \ $0.001$ \ $0.0001$ \ $dots.v$ \ ], align(left)[ $arctan(1)$ \ $arctan(0.1)$ \ $arctan(0.01)$ \ $arctan(0.001)$ \ $arctan(0.0001)$ \ $dots.v$ \ ], align(left)[ $approx 0.7853981633974$ \ $approx 0.0996686524912$ \ $approx 0.0099996666867$ \ $approx 0.0009999996667$ \ $approx 0.0000999999997$ \ $dots.v$ \ ] ) ], caption: [ Werte für $K$, $d$ und $\Pi$ bis $n=4$ ] ) Zusammenfassend lässt sich zu Galperins Methode $pi$ zu berechnen zeigen, dass die Anzahl der Kollisionen durch den Energieerhaltungssatz eine direkte Verbindung zum Kreis (ohne Skalierung, zu einer Ellipse) hat. #cite(<ARTICLE:Throwing-Pi-at-a-wall:2019>) #cite(<VIDEO:Why-do-colliding-blocks-compute-pi:2019>) Daraus folgt, auch Galperins Methode lässt sich der 1. Kategorie zuordnen, ihr Zusammenhang mit der Geometrie des Kreises wurde eindeutig belegt. === Basler Problem Das Basler Problem, im Grunde die Frage nach der genauen Summe aller Kehrwerte der natürlichen Zahlen zum Quadrat, wurde erstmals von Pietro Mengoli formuliert und später von Leonhard Euler gelöst. Die folgende Gleichung ist Eulers Lösung des Basler Problems. #cite(<ARTICLE:Summing-inverse-squares-by-euclidean-geometry:2010>) #cite(<VIDEO:Why-is-pi-here-And-why-is-it-squared-A-geometric-answer-to-the-Basel-problem:2018>) $ frac(pi^2, 6) = sum_(n = 1)^(infinity) frac(1, n^2) $ Es kann auf verschiedenen Arten bewiesen werden, dass auch hier eine Verbindung zwischen $pi$ und Kreis besteht. #cite(<ARTICLE:Summing-inverse-squares-by-euclidean-geometry:2010>) #cite(<VIDEO:Why-is-pi-here-And-why-is-it-squared-A-geometric-answer-to-the-Basel-problem:2018>) Eulers Lösung beruht beispielweise auf der Taylorreihe der Kardinalsinusfunktion, die ihrerseits wiederum im Zusammenhang mit dem Kreis definiert ist. #cite(<WEB:SincFunction-Wolfram-Research:2021>) #cite(<BOOK:Exploring-Eulers-Constant:2003>) #cite(<ARTICLE:Summing-inverse-squares-by-euclidean-geometry:2010>) #cite(<VIDEO:Why-is-pi-here-And-why-is-it-squared-A-geometric-answer-to-the-Basel-problem:2018>) Auch andere Lösungen können die Verbindung bestätigen. #cite(<ARTICLE:Summing-inverse-squares-by-euclidean-geometry:2010>) #cite(<VIDEO:Why-is-pi-here-And-why-is-it-squared-A-geometric-answer-to-the-Basel-problem:2018>) #pagebreak() == Zusammenführung und Bewertung der Ergebnisse Alle in der Fallanalyse untersuchen Sachverhalte enthalten bewiesenermaßen einen Zusammenhang zwischen $pi$ und Kreis (konnten alle der 1. Kategorie zugeordnet werden). Anhand der vorliegenden Ergebnisse, sofern keine Mängel im Vorgehen nachzuweisen sind, würde sich deduktiv schließen lassen, dass die Hypothese dieser Arbeit fundiert ist, Substanz hat. Dieser Schluss würde jedoch gravierende Mängel aufweisen. Es wurden zum einen längst nicht alle bekanten Sachverhalte untersucht, die nicht offensichtlich eine Verbindung zwischen Verwendung von $pi$ und der Geometrie des Kreises aufweisen. Zum anderen ist nicht klar, ob eventuell auch Sachverhalte existieren könnten, die in der Mathematik noch nicht bekannt sind, nie sein werden. Es ist daher in Frage zu stellen, ob es überhaupt möglich ist, die Hypothese dieser Arbeit zu beweisen, obwohl kein Gegenbeweis gefunden wurde. Für alle in der Arbeit untersuchten Sachverhalte konnte bewiesen werden, dass ein Zusammenhang zwischen $pi$ und Geometrie des Kreises besteht. Daraus kann allerdings nicht auf eine allgemein gültige Gesetzmäßigkeit geschlossen werden. = Fazit Das Ziel der vorliegenden Arbeit war, die Frage "Pi ohne Kreis? Wird Pi ohne den Zusammenhang mit der Geometrie eines Kreises verwendet? (Existieren Sachverhalte, in denen Pi ohne Zusammenhang mit der Geometrie eines Kreises Verwendung findet?)" zu beantworten, um das Verständnis der Kreiszahl $pi$ zu verbessern. Es wurde dazu anfänglich die Hypothese aufgestellt, dass $pi$ definiert ist als das Verhältnis des Durchmessers eines Kreises zu seinem Umfang und so ihre Verwendung immer einen Zusammenhang mit jenem Verhälnis und damit zur Geometrie des Kreises haben müsste. Um die Richtigkeit der anfänglichen Hypothese zu belegen (oder zu widerlegen) wurde an einzelnen Sachverhalten überprüft, ob sie zutrifft, ob sich in dem entsprechenden Sachverhalt eine Verbindung zwischen $pi$ und dem Kreis belegen oder widerlegen lässt. Bei allen hierbei behandelten Sachverhalten trifft die Hypothese zu. In jeder einzelnen ließ sich eindeutig nachweisen, dass ein Zusammenhang zwischen $pi$ und der Geometrie des Kreises besteht. Es kann jedoch nicht deduktiv geschlossen werden, dass die Hypothese dieser Arbeit gesichert ist, denn in dieser Arbeit konnten nicht alle bekannten Sachverhalte untersucht werden, die nicht offensichtlich eine Verbindung zwischen Verwendung von $pi$ und der Geometrie des Kreises aufweisen. Es ist ebenso nicht klar, ob eventuell auch Sachverhalte existieren könnten, die in der Mathematik noch nicht bekannt sind, nie sein werden. Es sei in Frage zu stellen, ob es überhaupt möglich ist, die Hypothese dieser Arbeit zu beweisen. Zur Beantwortung der zentralen Frage dieser Arbeit: für alle in dieser Arbeit untersuchten Sachverhalte konnte bewiesen werden, dass ein Zusammenhang zwischen $pi$ und Geometrie des Kreises besteht. Es kann daraus aber nicht auf eine allgemeine gültige Gesetzmäßigkeit geschlossen werden. = Ausblick Für Folgearbeiten würde sich anbieten, weitere Sachverhalte, die in dieser Arbeit keine Erwähnung finden, bezüglich des Zusammenhanges zwischen $pi$ und der Geometrie des Kreises zu untersuchen, um die Ergebnisse dieser Arbeit zu stärken oder anzuzweifeln. In diesem Zusammenhang ist auch wichtig, zu klären, auf welche Art und Weise sich $pi$ überhaupt in einem Sachverhalt nachweisen lässt (mag es sein, dass $pi$ nur durch die Geometrie des Kreises überhaupt nachweisbar ist).
https://github.com/exusiaiwei/My-brilliant-CV
https://raw.githubusercontent.com/exusiaiwei/My-brilliant-CV/main/modules/research.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Research Experience") #cvEntry( title: [Lab Operator and Coordinator], society: [Cognitive Science and Language Learning Laboratory], logo: "../src/logos/whu.png", date: [2021.1 - 2023.6], location: [Wuhan, China], description: list( [Study titled "Using eye tracking to investigate what native Chinese speakers notice about linguistic landscape images" was completed as the leading author, utilizing the laboratory's equipment. ], [The study currently under review by the journal "Linguistic Landscape", with the preprint published on arXiv (arXiv:2312.08906).], [Self-taught the operation of eye-tracking equipment, filling a gap in faculty expertise.], [Developed a comprehensive experimental proposal process and established standard operating procedures for the laboratory.], ), tags: ("Eye-tracking", "Paper under Review", "Linguistic Landscape") ) #cvEntry( title: [Student Researcher], society: [State Language Commission Research Project], logo: "../src/logos/whu.png", date: [2021.9 - 2022.1], location: [Wuhan, China], description: list( [Under the guidance of Associate Professor <NAME>, participated in the "Research on the Standardization of Language in Online Media" (ZDI135-93) and "Study on the Norms of Civilized Language Behavior" (ZDI135-122), projects commissioned by the State Language Commission.], [Contribution: Authored the paper titled "A Survey on the Use of 'Paratroopers' Based on Weibo Corpus" as the first author, which was published in the internal publication "Chinese Language Matters".], ), tags: ("Data Crawling", "Statistical Analysis", "Internet Language") ) #cvEntry( title: [Team Leader], society: [National College Students' innovation and entrepreneurship training program ], logo: "../src/logos/whu.png", date: [2020.12 - 2022.4], location: [Wuhan, China], description: list( [Project Topic: Preliminary Study on the Fixation Conditions of Linguistic Landscape Based on Eye-Tracking], [Conducted field surveys to collect photos of local linguistic landscapes in Wuhan, performed statistical analysis on the elements within these landscapes, and evaluated the feasibility of conducting eye-tracking experiments.], ), tags: ("Preliminary Research", "Statistical Analysis", "Linguistic Landscape") )
https://github.com/warab1moch1/MathmaticalFinance
https://raw.githubusercontent.com/warab1moch1/MathmaticalFinance/main/20240615.typ
typst
#import "manual_template.typ": * #import "theorems.typ": * #show: thmrules // Define theorem environments #let theorem = thmbox( "theorem", "Theorem", fill: rgb("#e8e8f8") ) #let lemma = thmbox( "theorem", // Lemmas use the same counter as Theorems "Lemma", fill: rgb("#efe6ff") ) #let corollary = thmbox( "corollary", "Corollary", base: "theorem", // Corollaries are 'attached' to Theorems fill: rgb("#f8e8e8") ) #let definition = thmbox( "definition", // Definitions use their own counter "Definition", fill: rgb("#e8f8e8") ) #let exercise = thmbox( "exercise", "Exercise", stroke: rgb("#ffaaaa") + 1pt, base: none, // Unattached: count globally ).with(numbering: "I") // Use Roman numerals // Examples and remarks are not numbered #let example = thmplain("example", "Example").with(numbering: none) #let remark = thmplain( "remark", "Remark", inset: 0em ).with(numbering: none) // Proofs are attached to theorems, although they are not numbered #let proof = thmproof( "proof", "Proof", base: "theorem", ) #let solution = thmplain( "solution", "Solution", base: "exercise", inset: 0em, ).with(numbering: none) #let project(title: "", authors: (), url: "", body) = { set page(paper: "a4", numbering: "1", number-align: center) set document(author: authors, title: title) set text(font: "Linux Libertine", lang: "en") set heading(numbering: "1.1.") set par(justify: true) set list(marker: ([•], [--])) show heading: it => pad(bottom: 0.5em, it) show raw.where(block: true): it => pad(left: 4em, it) show link: it => underline(text(fill: blue, it)) align(center)[ #block(text(weight: 700, 1.75em, title)) ] pad( top: 0.5em, bottom: 2em, x: 2em, grid( columns: (1fr,) * calc.min(3, authors.len()), gutter: 1em, ..authors.map(author => align(center)[ #author \ #link(url) ]), ), ) outline(indent: true) v(2em) body } #show: project.with( title: "No.6", authors: ( "warab1moch1", ), url: "https://github.com/warab1moch1" ) = 停止時刻 $(Omega, cal(F), PP, cal(F)_t)$ : filtrated Probability Space であるとする。 #definition[#h(1mm)停止時刻\ $T$ : $Omega arrow.r [0, infinity]$#footnote[ $infinity$ を含むことに注意 ] が停止時刻であるとは、$T$ が確率変数であって、かつ $ forall t >= 0 quad {T <= t} in.small cal(F)_t $ であることをいう。 ここで、${T <= t} = {omega in.small Omega|T(omega) <= t}$ である。 このとき、 $ cal(F)_t := {A in.small cal(F)|forall t >= 0 quad A sect {T <= t} in.small cal(F)_t} $ を(停止)時刻 $T$ での情報系($sigma$ - 加法族)という。 ] このときの直観的な解釈としては、#v(1mm) -- $T$ はランダムな時刻である\ 定義より、 $ T : Omega arrow.r [0, infinity] $ である確率変数であり、(上での表記の通り)時刻 $T$ 自体はあるランダムネスの素 $omega$ に基づいている。#v(1mm) -- 停止時刻の意味合い\ 確率変数であるということに加え、更に $ {T <= t} in.small cal(F)_t (forall t >= 0) $ である。これは、『未来の情報を使わずに決めることの時刻』であることを意味している。卑近な例としては、#v(1mm) - 所持金が初めて1万円を割る時刻 $T$ 当然ではあるが、これは、その瞬間(割ったタイミング)にしかわからないため、停止時刻である条件を満たしている。 逆に、そうでない例としては#v(1mm) - いずれ1万円を割るなら $0$、それ以外なら $100$ として定めた時刻 $S$ これは、未来の情報(条件)を使っていることから停止時刻でない。 #example[#h(1mm)今後の考察の対象\ -- $T equiv s$ : 定数時刻\ #proof[ $ {T <= t} &attach(eq, t: "def") {s <= t}\ &= cases( Omega quad (s<= t), nothing quad (s > t) ) in.small cal(F)_t $ ] -- $T,#h(1mm) S$ : 停止時刻であるとき、$T + S$、$min(T, S)$ #proof[ $ {(T and S) <= t}#footnote[ $ T and S := min(T, S) $ ] = {T <= t} union {S <= t} $ であり、$T, S$ がいずれも停止時刻であるという仮定から $ {T <= t},#h(1mm) {S <= t} in.small cal(F)_t $ であり、その有限和もまた $in.small cal(F)_t$ である。 ] このように、標準的な演算は(おおよそ)停止時刻になることがわかる。 -- $F subset.eq RR$ : 閉(開)集合、$X_t$ : 連続確率過程のとき、 $ H := inf{t >= 0|X_t in.small F} $ 即ち、$F$ への到達時刻 $H$ ( Hitting time ) は停止時刻#footnote[ $min$ でなく、$inf$ としている理由は開集合としている場合でも絶対に存在するためである ]である。 ] #definition[#h(1mm)任意抽出定理 ( Optional sampling theorem )\ $M$ : マルチンゲール(右連続)、 $S,#h(1mm) T$ : 有界な停止時刻 ( $S <= T$ ) とする。 即ち、 $ exists N("定数") quad S, #h(1mm) T <= N $ であり、また $ forall omega in.small Omega quad S(omega) <= T(omega) $ である。このとき、 $ EE[M_T|cal(F)_s] = M_S $ である。 ここで、$M_t$ : 確率変数であり、 $ M_T (omega) := M_T(omega) (omega) $ である。#footnote[ 仮定 $S <= T$ がないとき、(一般に) $ EE[M_T|cal(F)_S] = M_(T and S) $ である。 ] ] 次に、停止時刻での情報系についてその意味合いや応用例を取り上げる。 これまでに取り上げてきた定数 $t$ での $cal(F)_t$ と、(繰り返しにはなるが)確率変数である停止時刻によって得られる情報系 $cal(F)_T$ とを区別することが肝要である。 -- $X_t$ : $cal(F)_t$ - 可測であるとき、 $X_T$ : $cal(F)_T$ - 可測である。 ここで、 $ X_T(omega) = X_T(omega) (omega) bold(1)_{T eq.not infinity} (omega) $ である。即ち、$T$ が無限であるときは考えていない。 -- $X$ : 連続、かつ $X_t$ : $cal(F)_t$ - 可測であるとき、 $ X_t^T := X_(t and T) $ 即ち、$T$ で停止した(動きを凍結させた)確率過程を考える。\ (確率変数 $X^T$ : 連続、また 確率過程 $X_t^T$ : $cal(F)_t$ - 可測) このとき、$X$ : 右連続マルチンゲールであるなら、$X_t^T$ : 右連続マルチンゲールが従う。 #proof[$s <= t$ において、 $ EE[X_t^T|cal(F)_s] &= EE[X_(t and T)|cal(F)_s] quad #text(0.8em)[($because$ 上の定義)]\ &= X_(t and T and s) quad #text(0.8em)[($because$ 任意抽出定理)]\ &= X_(s and T)\ &= X_s^T $ ここで、停止時刻の例で取り上げたように、定数 $s,#h(1mm) t$ : 停止時刻であり、またそれ(ら)と停止時刻 $T$ との最小値もまた停止時刻であることに注意する。これより、上のように任意抽出定理を用いることができる。 ] = 反射原理 *図* #theorem[#h(1mm)反射原理 $W$ : ブラウン運動とする。このとき、$a$ への到達時刻 $ T_a := inf{t >= 0|W_t = a} $ に加え、$W$ の最大値過程 $ S_t := sup_(0<=s<=t) W_s $ を考える。このとき、 $ PP(S_t >= a,#h(1mm) W_t <= b) = PP(W_t >= 2 a - b) quad (a >= b >= 0) $ が成立している。] ここで、 \# fact $B_t := W_(T_a + t) - W_(T_a)$ はブラウン運動である(強マルコフ性) ↑(ここまで) これは、ブラウン運動の定義である独立増分性より、 $ W_(t+s) - W_s $ がまたブラウン運動であることを考えると、この $s$ が stopping time $T_a$ であっても大丈夫であることを意味している。 また、最大値過程 $S_t$ : $cal(F)_t$ - 可測である。 #proof[ $ PP(S_t > a,#h(1mm) W_t <= b) &= PP(T_a <= t, W_t <= b)\ & #text(0.8em)[$paren.l$ $because$ $t$ までの最大値が $a$ 以上] \ & #text(0.8em)[$arrow.r.double$ $t$ までに Hitting time $T_a$ が来ているはず $paren.r$]\ &= PP(T_a <= t,#h(1mm) B_(t - T_a) <= b - a) quad #text(0.8em)[($because$ $B_(t - T_a) = W_t - W_(T_a) = W_t - a)$#footnote[ $W_t$ は連続かつ1点集合 $a$ は閉であるため、停止時刻 $T_a$ でまさに値 $a$ をとる。 ]]\ &= PP^T_a times.circle cal(W) ({(s, omega) in.small RR times C(bracket.l 0, infinity paren.r)|s <= t,#h(1mm) omega(t-s) <= b - a})\ &= PP(T_a <= t,#h(1mm) B_(t- T_a) >= a - b) quad #text(0.8em)[($because$ ブラウン運動の正規性#footnote[ $X tilde.op cal(N)$ のとき、分布の対称性から $PP(X <= alpha) = PP(X >= - alpha)$ が従う。 ])]\ &= PP(T_a <= t, #h(1mm) W_t >= 2 a - b)\ &= PP(W_t >= 2 a - b) $ 最後の変形に関しては、 $a >= b$ から $ W_t &>= 2 a - b\ &>= 2 a - a\ &= a $ より、上での Hitting time の論理から $T_a <= t$ が保証されていることによる。 ] これより、何が嬉しいか(*Shreve p.111 を参照*)
https://github.com/ChrisEnv/letter-typst
https://raw.githubusercontent.com/ChrisEnv/letter-typst/main/_extensions/letter/typst-show.typ
typst
#show: letter.with( $if(title)$ title: [$title$], $endif$ // TODO: use Quarto's normalized metadata. $if(author)$ author: [$author$], $endif$ $if(sender_address)$ sender_address: [$sender_address$], $endif$ $if(sender_contact)$ sender_contact: [$sender_contact$], $endif$ $if(receiver)$ receiver: [$receiver$], $endif$ $if(date)$ date: [$date$], $endif$ $if(postal)$ postal: [$postal$], $endif$ $if(valediction)$ valediction: [$valediction$], $endif$ )
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/basics/scripting/conditions.md
markdown
MIT License
# Conditions & loops ## Conditions > See [official documentation](https://typst.app/docs/reference/scripting/#conditionals). In Typst, you can use `if-else` statements. This is especially useful inside function bodies to vary behavior depending on arguments types or many other things. ```typ #if 1 < 2 [ This is shown ] else [ This is not. ] ``` Of course, `else` is unnecessary: ```typ #let a = 3 #if a < 4 { a = 5 } #a ``` You can also use `else if` statement (known as `elif` in Python): ```typ #let a = 5 #if a < 4 { a = 5 } else if a < 6 { a = -3 } #a ``` ### Booleans `if, else if, else` accept _only boolean_ values as a switch. You can combine booleans as described in [types section](./types.md#boolean-bool): ```typ #let a = 5 #if (a > 1 and a <= 4) or a == 5 [ `a` matches the condition ] ``` ## Loops > See [official documentation](https://typst.app/docs/reference/scripting/#loops). There are two kinds of loops: `while` and `for`. While repeats body while the condition is met: ```typ #let a = 3 #while a < 100 { a *= 2 str(a) " " } ``` `for` iterates over all elements of sequence. The sequence may be an `array`, `string` or `dictionary` (`for` iterates over its _key-value pairs_). ```typ #for c in "ABC" [ #c is a letter. ] ``` To iterate to all numbers from `a` to `b`, use `range(a, b+1)`: ```typ #let s = 0 #for i in range(3, 6) { s += i [Number #i is added to sum. Now sum is #s.] } ``` Because range is end-exclusive this is equal to ```typ #let s = 0 #for i in (3, 4, 5) { s += i [Number #i is added to sum. Now sum is #s.] } ``` ```typ #let people = (Alice: 3, Bob: 5) #for (name, value) in people [ #name has #value apples. ] ``` ### Break and continue Inside loops can be used `break` and `continue` commands. `break` breaks loop, jumping outside. `continue` jumps to next loop iteration. See the difference on these examples: ```typ #for letter in "abc nope" { if letter == " " { // stop when there is space break } letter } ``` ```typ #for letter in "abc nope" { if letter == " " { // skip the space continue } letter } ```
https://github.com/CarloSchafflik12/typst-ez-today
https://raw.githubusercontent.com/CarloSchafflik12/typst-ez-today/main/README.md
markdown
MIT License
# ez-today Simply displays the current date with easy to use customization. ## Included languages German, English, French and Italian months can be used out of the box. If you want to use a language that is not included, you can easily add it yourself. This is shown in the customization section below. ## Usage The usage is very simple, because there is only the `today()` function. ```typ #import "@preview/ez-today:0.1.0" // To get the current date use this #ez-today.today() ``` ## Reference ### `today` Prints the current date with given arguments. ```typ #let today( lang: "de", format: "d. M Y", custom-months: () ) = { .. } ``` **Arguments:** - `lang`: [`str`] &mdash; Select one of the included languages (de, en, fr, it). - `format`: [`str`] &mdash; Specify the output format. - `custom-months`: [`array`] of [`str`] &mdash; Use custom names for each month. This array must have 12 entries. If this is used, the `lang` argument does nothing. ## Customization The default output prints the full current date with German months like this: ```typ #ez-today.today() // 11. Oktober 2024 ``` You can choose one of the included languages with the `lang` argument: ```typ #ez-today.today(lang: "en") // 11. October 2024 #ez-today.today(lang: "fr") // 11. Octobre 2024 #ez-today.today(lang: "it") // 11. Ottobre 2024 ``` You can also change the format of the output with the `format` argument. Pass any string you want here, but know that the following characters will be replaced with the following: - `d` &mdash; The current day as a decimal - `m` &mdash; The current month as a decimal (`lang` argument does nothing) - `M` &mdash; The current month as a string with either the selected language or the custom array - `y` &mdash; The current year as a decimal with the last two numbers - `Y` &mdash; The current year as a decimal Here are some examples: ```typ #ez-today.today(lang: "en", format: "M d Y") // October 11 2024 #ez-today.today(format: "m-d-y") // 10-11-24 #ez-today.today(format: "d/m") // 11/10 #ez-today.today(format: "d.m.Y") // 11.10.2024 ``` Use the `custom-months` argument to give each month a custom name. You can add a new language or use short terms for each month. ```typ // Defining some custom names #let my-months = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") // Get current date with custom names #ez-today.today(custom-months: my-months, format: "M-y") // Oct-24 ```
https://github.com/Slyde-R/not-jku-thesis-template
https://raw.githubusercontent.com/Slyde-R/not-jku-thesis-template/main/README.md
markdown
MIT No Attribution
[The compiled demo thesis.pdf](./template/thesis.pdf) # jku-thesis This is a Typst template for a thesis at JKU. ## Usage You can use this template in the Typst web app by clicking "Start from template" on the dashboard and searching for `not-JKU-thesis`. Alternatively, you can use the CLI to kick this project off using the command ``` typst init @preview/jku-thesis ``` Typst will create a new directory with all the files needed to get you started. ## Configuration This template exports the `jku-thesis` function with the following named arguments: - `thesis-type`: String - `degree`: String - `program`: String - `supervisor`: String - `advisor`: Array of Strings - `department`: String - `author`: String - `date`: datetime - `place-of-submission`: string - `title`: String - `abstract-en`: Content block - `abstract-de`: optional: Content block or none - `acknowledgements`: optional: Content block or none - `show-title-in-header`: Boolean - `draft`: Boolean The template will initialize your package with a sample call to the `jku-thesis` function. The dummy thesis, including the sources, was created by generative AI and is simply meant as a placeholder. The content, citations, and data presented are not based on actual research or verified information. They are intended for illustrative purposes only and should not be considered accurate, reliable, or suitable for any academic, professional, or research use. Any resemblance to real persons, living or dead, or actual research, is purely coincidental. Users are advised to replace all placeholder content with genuine, verified data and references before using this material in any formal or academic context.
https://github.com/wyatt-feng/sustech-ug-thesis-typst
https://raw.githubusercontent.com/wyatt-feng/sustech-ug-thesis-typst/main/thesis.typ
typst
Other
#import "metadata.typ": * #show: doc => meta(doc) = 基本功能 <intro> == 标题 Typst 中的标题使用 `=` 表示,其后跟着标题的内容。`=` 的数量对应于标题的级别。 除了这一简略方式,也可以通过 `heading` 函数自定义标题的更多属性。具体可以参考#link("https://typst.app/docs/reference/meta/heading/", [文档中的有关内容])。 下面是一个示例: #tbl( tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ #heading(level: 2, numbering: none, outlined: false, "二级标题") #heading(level: 3, numbering: none, outlined: false, "三级标题") #heading(level: 4, numbering: none, outlined: false, "四级标题") #heading(level: 5, numbering: none, outlined: false, "五级标题") ```, [ #heading(level: 2, numbering: none, outlined: false, "二级标题") #heading(level: 3, numbering: none, outlined: false, "三级标题") #heading(level: 4, numbering: none, outlined: false, "四级标题") #heading(level: 5, numbering: none, outlined: false, "五级标题") ] ), caption: "这是表序" )\ === 三级标题 ==== 四级标题 本模板目录的默认最大深度为 3,即只有前三级标题会出现在目录中。如果需要更深的目录,可以更改 `outlinedepth` 设置。 == 粗体与斜体 与 Markdown 类似,在 Typst 中,使用 `*...*` 表示粗体,使用 `_..._` 表示斜体。下面是一个示例: #tbl( tablex( auto-vlines: false, repeat-header: true, columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ *bold* and _italic_ are very simple. ```, [ *bold* and _italic_ are very simple. ] ), caption: "这是一个三线表样例" ) <booktab> \ 由于绝大部分中文字体只有单一字形,这里遵循 `PKUTHSS` 的惯例,使用#strong[黑体]表示粗体,#emph[楷体]表示斜体。但需要注意的是,由于语法解析的问题, `*...*` 和 `_..._` 的前后可能需要空格分隔,而这有时会导致不必要的空白。 如果不希望出现这一空白,可以直接采用 `#strong` 或 `#emph`。 #tbl( tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ 对于中文情形,*使用 \* 加粗* 会导致额外的空白,#strong[使用 \#strong 加粗]则不会。 ```, [ 对于中文情形,*使用 \* 加粗* 会导致额外的空白,#strong[使用 \#strong 加粗]则不会。 ] ), caption: "表序")\ == 脚注 从 v0.4 版本开始,Typst 原生支持了脚注功能。本模板中,默认每一章节的脚注编号从 1 开始。 #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ Typst 支持添加脚注#footnote[这是一个脚注。]。 ```, [ Typst 支持添加脚注#footnote[这是一个脚注。]。 ] ))\ == 图片 在 Typst 中插入图片的默认方式是 `image` 函数。如果需要给图片增加标题,或者在文章中引用图片,则需要将其放置在 `figure` 中,就像下面这样: #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ #figure( image("resources/images/1-writing-app.png", width: 100%), caption: "Typst 网页版界面", ) <web> ```, [ #figure( image("resources/images/1-writing-app.png", width: 100%), caption: "Typst 网页版界面", ) <web> ] ))\ @web 展示了 Typst 网页版的界面。更多有关内容,可以参考 @about。代码中的 `<web>` 是这一图片的标签,可以在文中通过 `@web` 来引用。 == 表格 在 Typst 中,定义表格的默认方式是 `table` 函数。但如果需要给表格增加标题,或者在文章中引用表格,则可以将其放置在 `tbl` 中。 需要注意的是下文表格中使用的`tablex`函数是第三方包,用来实现更灵活的表格如三线表等。它的语法和自带的`table`一样,如果 不需要高级功能的话可以互相替换。`tbl`函数的签名是`tbl(table, caption: "", source: "")`,其中`table`是要展示的表格,可以是`table` 或`tablex`的返回值,第二个参数是表序,可以省略,第三个参数是数据来源,可以省略。 #tbl( tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], codeblock( ```typ #tbl( tablex( columns: (auto, auto, auto, auto), inset: 10pt, align: horizon, [*姓名*],[*职称*],[*工作单位*],[*职责*], [李四],[教授],[北京大学],[主席], [王五],[教授],[北京大学],[成员], [赵六],[教授],[北京大学],[成员], [钱七],[教授],[北京大学],[成员], [孙八],[教授],[北京大学],[成员], ), caption: "答辩委员会名单", source: "这是数据来源", ) <tablex> ```, caption: "默认表格", ), [ #tbl( tablex( columns: (auto, auto, auto, auto), inset: 10pt, align: horizon, [*姓名*],[*职称*],[*工作单位*],[*职责*], [李四],[教授],[北京大学],[主席], [王五],[教授],[北京大学],[成员], [赵六],[教授],[北京大学],[成员], [钱七],[教授],[北京大学],[成员], [孙八],[教授],[北京大学],[成员], ), caption: "答辩委员会名单", source: "这是数据来源", ) <tablex> ] ), caption: "这是表序", ) 对应的渲染结果如 @tablex 所示。代码中的 `<tablex>` 是这一表格的标签,可以在文中通过 `@tablex` 来引用。 如果需要三线表,可以在`tablex`中传入参数`auto-vlines: false`,如同 @booktab 的代码所示。 == 公式 @eq 是一个公式。代码中的 `<eq>` 是这一公式的标签,可以在文中通过 `@eq` 来引用。 #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ $ E = m c^2 $ <eq> ```, [ $ E = m c^2 $ <eq> ] ))\ @eq2 是一个多行公式。 #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ $ sum_(k=0)^n k &= 1 + ... + n \ &= (n(n+1)) / 2 $ <eq2> ```, [ $ sum_(k=0)^n k &= 1 + ... + n \ &= (n(n+1)) / 2 $ <eq2> ] ))\ @eq3 到 @eq6 中给出了更多的示例。 #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ $ frac(a^2, 2) $ <eq3> $ vec(1, 2, delim: "[") $ $ mat(1, 2; 3, 4) $ $ lim_x = op("lim", limits: #true)_x $ <eq6> ```, [ $ frac(a^2, 2) $ <eq3> $ vec(1, 2, delim: "[") $ $ mat(1, 2; 3, 4) $ $ lim_x = op("lim", limits: #true)_x $ <eq6> ] )) == 代码块 像 Markdown 一样,我们可以在文档中插入代码块: #tbl( tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ````typ ```c int main() { printf("Hello, world!"); return 0; } ``` ````, [ ```c int main() { printf("Hello, world!"); return 0; } ``` ] ), caption: "代码" )\ 如果想要给代码块加上标题,并在文章中引用代码块,可以使用本模板中定义的 `codeblock` 命令。其中,`caption` 参数用于指定代码块的标题,`outline` 参数用于指定代码块显示时是否使用边框。下面给出的 @code 是一个简单的 Python 程序。其中的 `<code>` 是这一代码块的标签,意味着这一代码块可以在文档中通过 `@code` 来引用。 #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ````typ #codeblock( ```python def main(): print("Hello, world!") ```, caption: "一个简单的 Python 程序", outline: true, ) <code> ````, [ #codeblock( ```python def main(): print("Hello, world!") ```, caption: "一个简单的 Python 程序", outline: true, ) <code> ] ))\ @codeblock_definition 中给出了本模板中定义的 `codeblock` 命令的实现。 #codeblock( ```typ #let codeblock(raw, caption: none, outline: false) = { figure( if outline { rect(width: 100%)[ #set align(left) #raw ] } else { set align(left) raw }, caption: caption, kind: "code", supplement: "" ) } ```, caption: [`codeblock` 命令的实现], ) <codeblock_definition> == 有序段落 对于内容较长的列表,每项条目的宽度均和列表的第一行相等,即每一行都会缩进。 有时如果需要对段落进行标号而不想让整段内容缩进的话,可以使用`numberedpar`命令实现。 #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 有序段落 ], [ #set align(center) 渲染结果 ], ````typ #numberedpar( [本人郑重承诺所呈交的毕业设计(论文),是在导师的指导下], [独立进行研究工作所取得的成果,所有数据、图片资料均真实可靠], ) ````, align(left)[ #numberedpar( [本人郑重承诺所呈交的毕业设计(论文),是在导师的指导下], [独立进行研究工作所取得的成果,所有数据、图片资料均真实可靠], ) ] ))\ == 参考文献 Typst 支持 BibLaTeX 格式的 `.bib` 文件,同时也新定义了一种基于 YAML 的文献引用格式。要想在文档中引用参考文献,需要在文档中通过调用 `bibliography` 函数来引用参考文献文件。下面是一个示例: #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ 可以像这样引用参考文献: @wang2010guide 和 @kopka2004guide。 #biblio("ref.bib") ```, [ 可以像这样引用参考文献: @wang2010guide 和 @kopka2004guide。 ] )) 注意代码中的 `"ref.bib"` 也可以是一个数组,比如 `("ref1.bib", "ref2.bib")`。 = 理论 == 理论一 <theory1> 让我们首先回顾一下 @intro 中的部分公式: $ frac(a^2, 2) $ <first_eq_ch2> $ vec(1, 2, delim: "[") $ $ mat(1, 2; 3, 4) $ $ lim_x = op("lim", limits: #true)_x $ 如@first_eq_ch2 所示,它是一个公式 #pagebreak() #biblio("ref.bib") #pagebreak() #appendix() == 关于 Typst <about> === 在附录中插入图片和公式等 附录中也支持脚注#footnote[这是一个附录中的脚注。]。 附录中也可以插入图片,如 @web1。 #figure( image("resources/images/1-writing-app.png", width: 100%), caption: "Typst 网页版界面", ) <web1> 附录中也可以插入公式,如 @appendix-eq。 #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ $ S = pi r^2 $ <appendix-eq> $ mat( 1, 2, ..., 10; 2, 4, ..., 20; 3, 6, ..., 30; dots.v, dots.v, dots.down, dots.v; 10, 20, ..., 100 ) $ $ cal(A) < bb(B) < frak(C) < mono(D) < sans(E) < serif(F) $ $ bold(alpha < beta < gamma < delta < epsilon) $ $ upright(zeta < eta < theta < iota < kappa) $ $ lambda < mu < nu < xi < omicron $ $ bold(Sigma < Tau) < italic(Upsilon < Phi) < Chi < Psi < Omega $ ```, [ $ S = pi r^2 $ <appendix-eq> $ mat( 1, 2, ..., 10; 2, 4, ..., 20; 3, 6, ..., 30; dots.v, dots.v, dots.down, dots.v; 10, 20, ..., 100 ) $ $ cal(A) < bb(B) < frak(C) < mono(D) < sans(E) < serif(F) $ $ bold(alpha < beta < gamma < delta < epsilon) $ $ upright(zeta < eta < theta < iota < kappa) $ $ lambda < mu < nu < xi < omicron $ $ bold(Sigma < Tau) < italic(Upsilon < Phi) < Chi < Psi < Omega $ ] ))\ @complex 是一个非常复杂的公式的例子: #tbl(tablex( columns: (1fr, 1fr), [ #set align(center) 代码 ], [ #set align(center) 渲染结果 ], ```typ $ vec(overline(underbracket(underline(1 + 2) + overbrace(3 + dots.c + 10, "large numbers"), underbrace(x + norm(y), y^(w^u) - root(t, z)))), dots.v, u)^(frac(x + 3, y - 2)) $ <complex> ```, [ $ vec(overline(underbracket(underline(1 + 2) + overbrace(3 + dots.c + 10, "large numbers"), underbrace(x + norm(y), y^(w^u) - root(t, z)))), dots.v, u)^(frac(x + 3, y - 2)) $ <complex> ] ))\ 附录中也可以插入代码块,如 @appendix-code。 #codeblock( ```rust fn main() { println!("Hello, world!"); } ```, caption: "一个简单的 Rust 程序", outline: true, ) <appendix-code>
https://github.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024/master/Vex%20Robotics%2053A%20Notebook%202023%20-%202024/Entries/Build%20Entry/Catapult-Testing-Auton-Testing.typ
typst
#set page(header: [VR #h(1fr) November 25, 2023 ]) = Catapult Testing == Stand-Up Notes #let cell = rect.with( inset: 8pt, fill: rgb("#E3E3E3"), width: 100%, radius: 10pt ) #grid( columns: (255pt, 255pt), rows: (85pt), gutter: 3pt, cell(height: 100%)[*Veena*:\ - Michael and I will test the catapult for the maximum number of rubber bands that can be used to power it], cell(height:100%)[*Zoey*: \ - I will test our autonomous programs ] ) == Catapult Testing - As mentioned in our tournament reflections (see pg []), our last catapult could not shoot over the middle barrier - To ensure our new design can shoot over the middle barrier from the load zone, we will test how many rubber bands are required to shoot triballs over (range) and compare this to how many rubber bands the catapult can withstand (torque) === Range *Procedure* - Disconnected catapult from motor \ > Eliminate resistance from motor - Added rubber bands in multiples of two \ > One for each tension post - Tested until triballs consistently shot over the middle barrier *Results* #table( columns: (10%,45%,45%), rows: (3.5%), fill: (_, row) => if row >=4 {rgb("#E4FFE6")} else if row == 3 or row == 2 or row == 1{rgb("#FFE4E2")}, [Trial], [No. Rubber Bands], [Shoot Over?], [1], [2], [X], [2], [4], [X], [3], [4], [X], [4], [6], [✔], [5], [6], [✔], [6], [8], [✔], [7], [8], [✔] ) #pagebreak() === Torque - Engaged catapult’s motor \ > Test if motor can withstand rubber bands - Added rubber bands in multiples of two \ > One for each tension post - Tested Until motor could no longer turn *Results* #table( columns: (10%,45%,45%), rows: (3.5%), fill: (_, row) => if row <=7 and row > 0 {rgb("#E4FFE6")} else if row >= 8 {rgb("#FFE4E2")}, [Trial], [No. Rubber Bands], [Turn?], [1], [2], [✔], [2], [4], [✔], [3], [4], [✔], [4], [6], [✔], [5], [6], [✔], [6], [8], [✔], [7], [8], [✔], [8], [10], [X], [9], [10], [X] ) === Conclusion - Between 6 and 8 rubber bands was optimal for shooting match loads == Ratchet #block( width: 100%, fill: rgb("#FFE4E2"), inset: 8pt, radius: 4pt, [ *Problem Analysis* - When testing the catapult’s torque, the ratchet was not strong enough - Rubber bands easily pulled the catapult’s arm against the ratchet] ) #let cell1 = rect.with( inset: 8pt, fill: rgb("EEEEFF"), width: 100%, radius: 10pt ) #let cell2 = rect.with( inset: 8pt, fill: rgb("FFFEEB"), width: 100%, radius: 10pt ) #grid( columns: (340pt, 170pt), rows: (220pt, 575pt, 625pt), gutter: 3pt, cell1(height: 100%)[*Solution No. 1* \ Increase number of rubber bands pulling ratchet’s screw against gear #figure(image("/Images/Build Images/ratchet gear front.png", width: 100%), caption: [Incresed Rubber Bands on Ratchet])], cell2(height:100%)[*Result*: \ - Rubber bands continued to pull the screw against the gear its ratcheted to - But, there was not enough force to keep the arm stationary], cell1(height: 100%)[*Solution No. 1* \ - Lower the ratchet compared to the gear it pushed against - The smaller angle between the screw head and get may increase traction #figure(image("/Images/Build Images/ratchet gear og height.png", width: 100%), caption: [Ratchet; Original Altitude]) #figure(image("/Images/Build Images/ratchet gear lower height.png"), caption: [Ratchet; Modified Altidue]) ], cell2(height: 100%)[*Results* \ - This weakened the strength of the ratchet and exacerbated the problem ], cell1(height: 100%)[*Solution No. 1* \ - Replaced the gear the ratchet pushes against with a sprocket, because the head of a screw fits in between the teeth of a sprocket better than those of a gear. #figure(image("/Images/Build Images/ratchet sprocket back.png", width: 100%), caption: [Ratchet; Sprocket]) #figure(image("/Images/Build Images/ratchet sprocket.png"), caption: [Ratchet; Sprocket]) ], cell2(height: 100%)[*Results* \ - This solved the problem completely - Succeeded in preventing the rubberbands that launch the arm from back driving the catapult’s motor. ] ) #pagebreak() = Goal Side Autonomous Testing Today we also extensively tested our autonomous programs. For 11/25 daily stand up, see page []. When coding out autonomous program, we tune the program in parts. We start with the first few movements, tune them, add the next movements, tune them, and repeat the process until we have completed the intended route. #grid( columns: (4in, 4in), figure( image("/Images/Build Images/auton skill sketch.png", width: 105%), caption: [Autonomous Goal Side Route],), figure( image("/Images/Build Images/AutonSkillScore.png", height: 50%), caption: [Autons Goal Side Score],), figure( image("/Images/Build Images/AutonRouteKey.png", width: 50%, ), caption: [Auton Route Key] ) ) #pagebreak() == Stage 1 + Drive forward with match load + Outtake match load + Turn towards far triball on field + Drive to far triball + Intake it === Testing #table( columns: (10%,18%,18%, 18%, 18%, 18%), rows: (3.5%, auto, auto), fill: (_, row) => if row <=7 and row > 0 {rgb("#FFE4E2")} else if row == 8 {rgb("#E4FFE6")}, [Trial], [!], [2], [3], [4], [5], [1], [✔], [✔], [X], [Ended Prog], [], [2], [✔], [✔], [X], [Ended Prog], [], [3], [✔], [✔], [X], [Ended Prog], [], [4], [✔], [✔], [X], [Ended Prog], [], [5], [✔], [✔], [X], [Ended Prog], [], [6], [✔], [✔], [X], [Ended Prog], [], [7], [✔], [✔], [✔], [✔], [X ], [8], [✔], [✔], [✔], [✔], [✔], ) === Post-Test Edits - Original Intake had a set number of seconds to run for, changed to true or false so that intake can run even while driving (more efficient) - _Pros::delay_ is now used for intake while staying still \ == Stage Two + Drive forward + Outtake matchload + Turn + drive to far triball + Intake far triball + Score Matchload and triball using wings + Turn 180 to outtake far triball + Score far triball + Turn towards final triball + Intake final triball + Score final triball \ #pagebreak() === Testing \ #let check = symbol("✔") #table( columns: (10%,9%,9%, 9%, 9%, 9%, 9%, 9%, 9%, 9%, 9%), rows: (3.5%, auto, auto), fill: (_, row) => if row == 9 and row == 13 and row > 0 {rgb("#E4FFE6")}, // else if row <=10 and row == {rgb("#FFE4E2")} [==== Trial], [==== 1], [==== 2], [==== 3], [==== 4], [==== 5], [==== 6], [==== 7], [==== 8], [==== 9], [==== 10], [9], [#check], [X], [#check], [#check], [X], [X], [X], [Ended Prog], [], [], [10], [#check], [#check], [#check], [X], [#check], [#check], [X], [#check], [#check], [#check], [11], [#check], [#check], [#check], [X], [#check], [#check], [X], [#check], [X], [X], [12], [X], [✔], [#check], [X], [X], [Ended Prog], [], [], [], [], [13], [✔], [#check], [X], [Ended Prog], [], [], [], [], [], [], [14], [#check], [#check], [#check], [X], [#check], [Ended Prog], [], [], [], [], [15], [#check], [#check], [#check], [X], [#check], [#check], [X], [#check], [X], [Ended Prog], [16], [#check], [#check], [#check], [X], [#check], [#check], [X], [#check], [X], [X], [17], [#check], [#check], [#check], [X], [#check], [#check], [X], [#check], [Ended Prog], [], [18], [#check], [X], [#check], [#check], [X], [#check], [#check], [#check], [#check], [X], [19], [#check], [#check], [#check], [#check], [#check], [#check], [#check], [#check], [#check], [X], [20], [#check], [#check], [#check], [#check], [X], [#check], [X], [#check], [X], [X], [21], [#check], [#check], [#check], [#check], [#check], [#check], [#check], [#check], [#check], [X], [22], [#check], [#check], [#check], [X], [X], [#check], [X], [#check], [#check], [X], [23], [#check], [#check], [#check], [X], [End Prog] ) === Post-Test Edit #block( width: 100%, fill: rgb("FFEAE8"), inset: 8pt, radius: 4pt, [*Problem Analysis: Timing* \ Ran out of time during autonomous runs, and therfor didn't get maximum points], ) #block( width: 100%, fill: rgb("EEEEFF"), inset: 8pt, radius: 4pt, [*Solution* - Changed function that limited time to boolean to speed up route - Made delays shorter]) #block( width: 100%, fill: rgb("FFFEEB"), inset: 8pt, radius: 4pt, [*Code* \ [Insert Image]] ) #block( width: 100%, fill: rgb("FFEAE8"), inset: 8pt, radius: 4pt, [*Problem Analysis: Intaking* \ Often touched triball robot meant to intake but couldn't actually Intake ], ) #block( width: 100%, fill: rgb("EEEEFF"), inset: 8pt, radius: 4pt, [*Solution* - Started the Intake before reaching triball and sped it up to 100% speed]) #block( width: 100%, fill: rgb("FFFEEB"), inset: 8pt, radius: 4pt, [*Code* \ [Insert Image]] ) #block( width: 100%, fill: rgb("FFEAE8"), inset: 8pt, radius: 4pt, [], ) #block( width: 100%, fill: rgb("EEEEFF"), inset: 8pt, radius: 4pt, []) // Vertical intake sketch.png #block( width: 100%, fill: rgb("FFFEEB"), inset: 8pt, radius: 4pt, [] ) === Final Code #pagebreak() = Non-Goal Side Autonomous Testing
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/style-06.typ
typst
Other
// Test using rules for symbols #show sym.tack: it => $#h(1em) it #h(1em)$ $ a tack b $
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/visualize/gradient-text-other_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(width: 200pt, height: auto, margin: 10pt) #set par(justify: true) #set text(fill: gradient.radial(red, blue)) #lorem(30)
https://github.com/cs-24-sw-3-01/typst-documents
https://raw.githubusercontent.com/cs-24-sw-3-01/typst-documents/main/system-development/main.typ
typst
#import "@preview/grape-suite:1.0.0": exercise #import exercise: project, task, subtask #show: project.with( title: "System Development Exercises", university: [Aalborg University], institute: [Datalogiske Institut], seminar: [3. Semester], author: "", show-solutions: false ) = Lecture 2 == Individual Exercises ==== 3.6.4 What is a common event? - A mechanism for expressing dynamic relations between objects - Event are instantaneous _(either happened or not happened)_ ==== 3.6.9 What are the basic criteria for selecting classes and events? *Class* - Can you identify objects from the class? - Does the class contain unique information? - Does the class encompass multiple objects? - Does the class have a suitable and manageable number of events? *Events* - Is the event instantaneous? (Has happened/Has not happened) - Is the event atomic (cannot be split further) - Can the event be identified when it happens? ==== 3.6.10 What is the result of the class activity? The result of the class activity shows the connection between events and classes. In the hair dresser example, the Customer and Assistant class can both experience the _"reserved"_ event ==== 3.6.15 Teaching administration. Consider a system for monitoring student activities in a university department. The department offers its students courses and thesis projects. Each course follows one of several course descriptions. Courses and thesis projects are evaluated through graded exams. The department must track all its activities, the teachers responsible for the activity, the students participating in the activity, and the results of the activity exams. #let g = green.lighten(75%) #let r = red.lighten(75%) #table( columns: (auto, auto), inset: 10pt, align: horizon, table.header( [*Class*], [*Event*], ), table.cell(fill: g)[Student],[], table.cell(fill: g)[Teacher],[], table.cell(fill: g)[Project],[], table.cell(fill: g)[Course],[], table.cell(fill: r)[Thesis],[], table.cell(fill: r)[Grade],[], table.cell(fill: g)[Exam],[], table.cell(fill: r)[Activity],[], table.cell(fill: r)[Result],[], ) #table( columns: (15em, auto, auto, auto, auto, auto), inset: 10pt, align: center, table.header( [], [*Student*], [*Teacher*], [*Project*], [*Course*], [*Exam*] ), [Course Enrolled],[X],[X],[],[],[], [Project Started],[X],[],[],[],[], [Exam Selected],[X],[],[],[],[], [Exam Started],[X],[],[],[],[], [Exam Ended],[X],[],[],[],[], [Exam Graded],[X],[],[],[],[], [Student Graduated],[X],[],[],[],[], ) // Add details and assumptions as needed and address the following problems. List class candidates in the teaching administration system. Evaluate the candidates systematically and produce the resulting event table. ==== Explain the differences on slide 42 lecture 1. ==== On slide 43 lecture 1, write up the system definition for the classical bank. Modify it to cover the modern bank. Compare the two. On which elements in the FACTOR criterion are they different? ==== On slide 44 lecture 1, write up the system definition for the traditional warehouse. Modify it to cover a modern warehouse like IKEA. Compare the two and emphasize differences. == Group Exercises ==== Compare and discuss the results of individual exercises 4 and 6. ==== 3.6.16 ==== Problem Analysis ===== Make a first system definition by carrying out the activities described in Chapter 2. ===== Carry out the Classes activity as described in Chapter 3. ===== Reconsider your first system definition: was it useful for selecting classes and events or does it have to be refined. // Start the analysis on your project (if you have chosen it): // Make a first system definition by carrying out the activities described in Chapter 2. // Carry out the Classes activity as described in Chapter 3. // Reconsider your first system definition: was it useful for selecting classes and events or does it have to be refined. // If you have not yet chosen your project, you can use one of these two case descriptions: // Kaj's Cars: a brief description of a car rental company. // Fisk til døren: an extensive description of a company that delivers fish to a group of private customers.
https://github.com/Gekkio/gb-ctr
https://raw.githubusercontent.com/Gekkio/gb-ctr/main/appendix/memory-map.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "../common.typ": * #let detail(..args) = text(7pt, ..args) #let gbc-bit(content) = table.cell(fill: rgb("#FFFFED"), content) #let gbc-bits(length, content) = table.cell(colspan: length, fill: rgb("#FFFFED"), content) #let unmapped-bit = table.cell(fill: rgb("#D3D3D3"))[] #let unmapped-bits(length) = range(length).map((_) => unmapped-bit) #let unmapped-byte = table.cell(colspan: 8, fill: rgb("D3D3D3"))[] #let todo(length) = range(length).map((_) => []) #set text(9pt) == Memory map tables #set page(flipped: true) #figure( table( columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr), inset: (x: 5pt, y: 3.5pt), align: (left, center, center, center, center, center, center, center, center), [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], [#hex("FF00") P1], ..unmapped-bits(2), [P15 #detail[buttons]], [P14 #detail[d-pad]], [P13 #detail[#awesome("\u{f358}") start]], [P12 #detail[#awesome("\u{f35b}") select]], [P11 #detail[#awesome("\u{f359}") B]], [P10 #detail[#awesome("\u{f35a}") A]], [#hex("FF01") SB], table.cell(colspan: 8)[SB\<7:0\>], [#hex("FF02") SC], [SIO_EN], ..unmapped-bits(5), gbc-bit[SIO_FAST], [SIO_CLK], hex("FF03"), unmapped-byte, [#hex("FF04") DIV], table.cell(colspan: 8)[DIVH\<7:0\>], [#hex("FF05") TIMA], table.cell(colspan: 8)[TIMA\<7:0\>], [#hex("FF06") TMA], table.cell(colspan: 8)[TMA\<7:0\>], [#hex("FF07") TAC], ..unmapped-bits(5), [TAC_EN], table.cell(colspan: 2)[TAC_CLK\<1:0\>], hex("FF08"), unmapped-byte, hex("FF09"), unmapped-byte, hex("FF0A"), unmapped-byte, hex("FF0B"), unmapped-byte, hex("FF0C"), unmapped-byte, hex("FF0D"), unmapped-byte, hex("FF0E"), unmapped-byte, [#hex("FF0F") IF], ..unmapped-bits(3), [IF_JOYPAD], [IF_SERIAL], [IF_TIMER], [IF_STAT], [IF_VBLANK], [#hex("FF10") NR10], ..todo(8), [#hex("FF11") NR11], ..todo(8), [#hex("FF12") NR12], ..todo(8), [#hex("FF13") NR13], ..todo(8), [#hex("FF14") NR14], ..todo(8), hex("FF15"), unmapped-byte, [#hex("FF16") NR21], ..todo(8), [#hex("FF17") NR22], ..todo(8), [#hex("FF18") NR23], ..todo(8), [#hex("FF19") NR24], ..todo(8), [#hex("FF1A") NR30], ..todo(8), [#hex("FF1B") NR31], ..todo(8), [#hex("FF1C") NR32], ..todo(8), [#hex("FF1D") NR33], ..todo(8), [#hex("FF1E") NR34], ..todo(8), hex("FF1F"), unmapped-byte, [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], ), kind: table, caption: [#hex[FFxx] registers: #hex-range("FF00", "FF1F")] ) #pagebreak() #figure( table( columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr), inset: (x: 5pt, y: 3.5pt), align: (left, center, center, center, center, center, center, center, center), [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], [#hex("FF20") NR41], ..todo(8), [#hex("FF21") NR42], ..todo(8), [#hex("FF22") NR43], ..todo(8), [#hex("FF23") NR44], ..todo(8), [#hex("FF24") NR50], ..todo(8), [#hex("FF25") NR51], ..todo(8), [#hex("FF26") NR52], ..todo(8), hex("FF27"), unmapped-byte, hex("FF28"), unmapped-byte, hex("FF29"), unmapped-byte, hex("FF2A"), unmapped-byte, hex("FF2B"), unmapped-byte, hex("FF2C"), unmapped-byte, hex("FF2D"), unmapped-byte, hex("FF2E"), unmapped-byte, hex("FF2F"), unmapped-byte, [#hex("FF30") WAV00], ..todo(8), [#hex("FF31") WAV01], ..todo(8), [#hex("FF32") WAV02], ..todo(8), [#hex("FF33") WAV03], ..todo(8), [#hex("FF34") WAV04], ..todo(8), [#hex("FF35") WAV05], ..todo(8), [#hex("FF36") WAV06], ..todo(8), [#hex("FF37") WAV07], ..todo(8), [#hex("FF38") WAV08], ..todo(8), [#hex("FF39") WAV09], ..todo(8), [#hex("FF3A") WAV10], ..todo(8), [#hex("FF3B") WAV11], ..todo(8), [#hex("FF3C") WAV12], ..todo(8), [#hex("FF3D") WAV13], ..todo(8), [#hex("FF3E") WAV14], ..todo(8), [#hex("FF3F") WAV15], ..todo(8), [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], ), kind: table, caption: [#hex[FFxx] registers: #hex-range("FF20", "FF3F")] ) #pagebreak() #figure( table( columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr), inset: (x: 5pt, y: 3.5pt), align: (left, center, center, center, center, center, center, center, center), [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], [#hex("FF40") LCDC], [LCD_EN], [WIN_MAP], [WIN_EN], [TILE_SEL], [BG_MAP], [OBJ_SIZE], [OBJ_EN], [BG_EN], [#hex("FF41") STAT], unmapped-bit, [INTR_LYC], [INTR_M2], [INTR_M1], [INTR_M0], [LYC_STAT], table.cell(colspan: 2)[LCD_MODE\<1:0\>], [#hex("FF42") SCY], ..todo(8), [#hex("FF43") SCX], ..todo(8), [#hex("FF44") LY], ..todo(8), [#hex("FF45") LYC], ..todo(8), [#hex("FF46") DMA], table.cell(colspan: 8)[DMA\<7:0\>], [#hex("FF47") BGP], ..todo(8), [#hex("FF48") OBP0], ..todo(8), [#hex("FF49") OBP1], ..todo(8), [#hex("FF4A") WY], ..todo(8), [#hex("FF4B") WX], ..todo(8), gbc-bit[#hex("FF4C") ????], ..todo(8), gbc-bit[#hex("FF4D") KEY1], gbc-bit[KEY1_FAST], ..unmapped-bits(6), gbc-bit[KEY1_EN], hex("FF4E"), unmapped-byte, gbc-bit[#hex("FF4F") VBK], ..unmapped-bits(6), gbc-bits(2)[VBK\<1:0\>], [#hex("FF50") BOOT], ..unmapped-bits(7), [BOOT_OFF], gbc-bit[#hex("FF51") HDMA1], ..todo(8), gbc-bit[#hex("FF52") HDMA2], ..todo(8), gbc-bit[#hex("FF53") HDMA3], ..todo(8), gbc-bit[#hex("FF54") HDMA4], ..todo(8), gbc-bit[#hex("FF55") HDMA5], ..todo(8), gbc-bit[#hex("FF56") RP], ..todo(8), hex("FF57"), unmapped-byte, hex("FF58"), unmapped-byte, hex("FF59"), unmapped-byte, hex("FF5A"), unmapped-byte, hex("FF5B"), unmapped-byte, hex("FF5C"), unmapped-byte, hex("FF5D"), unmapped-byte, hex("FF5E"), unmapped-byte, hex("FF5F"), unmapped-byte, [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], ), kind: table, caption: [#hex[FFxx] registers: #hex-range("FF40", "FF5F")] ) #pagebreak() #figure( table( columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr, 1fr), inset: (x: 5pt, y: 3.5pt), align: (left, center, center, center, center, center, center, center, center), [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], [#hex("FF60") ????], ..unmapped-bits(6), [], [], hex("FF61"), unmapped-byte, hex("FF62"), unmapped-byte, hex("FF63"), unmapped-byte, hex("FF64"), unmapped-byte, hex("FF65"), unmapped-byte, hex("FF66"), unmapped-byte, hex("FF67"), unmapped-byte, gbc-bit[#hex("FF68") BCPS], ..todo(8), gbc-bit[#hex("FF69") BPCD], ..todo(8), gbc-bit[#hex("FF6A") OCPS], ..todo(8), gbc-bit[#hex("FF6B") OCPD], ..todo(8), gbc-bit[#hex("FF6C") ????], ..todo(8), hex("FF6D"), unmapped-byte, hex("FF6E"), unmapped-byte, hex("FF6F"), unmapped-byte, gbc-bit[#hex("FF70") SVBK], ..unmapped-bits(6), gbc-bits(2)[SVBK\<1:0\>], hex("FF71"), unmapped-byte, gbc-bit[#hex("FF72") ????], ..todo(8), gbc-bit[#hex("FF73") ????], ..todo(8), gbc-bit[#hex("FF74") ????], ..todo(8), gbc-bit[#hex("FF75") ????], ..todo(8), gbc-bit[#hex("FF76") PCM12], gbc-bits(4)[PCM12_CH2], gbc-bits(4)[PCM12_CH1], gbc-bit[#hex("FF77") PCM34], gbc-bits(4)[PCM34_CH4], gbc-bits(4)[PCM34_CH3], hex("FF78"), unmapped-byte, hex("FF79"), unmapped-byte, hex("FF7A"), unmapped-byte, hex("FF7B"), unmapped-byte, hex("FF7C"), unmapped-byte, hex("FF7D"), unmapped-byte, hex("FF7E"), unmapped-byte, hex("FF7F"), unmapped-byte, [#hex("FFFF") IE], table.cell(colspan: 3)[IE_UNUSED\<2:0\>], [IE_JOYPAD], [IE_SERIAL], [IE_TIMER], [IE_STAT], [IE_VBLANK], [], [bit 7], [6], [5], [4], [3], [2], [1], [bit 0], ), kind: table, caption: [#hex[FFxx] registers: #hex-range("FF60", "FF7F"), #hex("FFFF")] )
https://github.com/goshakowska/Typstdiff
https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_working_types/sub_script/sub_script.typ
typst
First#sub[first sub text] Normal text Second#sub[second sub text]
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/field-07.typ
typst
Other
// Error: 6-13 dictionary does not contain key "invalid" and no default value was specified #(:).invalid
https://github.com/alerque/polytype
https://raw.githubusercontent.com/alerque/polytype/master/content/hello-world.md
markdown
+++ title = "Hello World!" description = "Your most basic greeting." extra.typesetters = [ "sile", "typst", "xelatex", "groff", "satysfi", "pagedjs", "weasyprint" ] +++ Just the simplest way to get a phrase onto a numbered page. The page size, font face, margins, and everything else should be the defaults. The only non-default addition to the minimal way to get text on a page is adding a folio in the simplest way possible. The position of the folio may vary depending on defaults, but if an explicit position is required use bottom center.
https://github.com/ns-shop/ns-shop-typst
https://raw.githubusercontent.com/ns-shop/ns-shop-typst/main/fonts/pre.typ
typst
#import "template.typ": * #h1("Lời cảm ơn", numbering: false) Tôi xin gửi lời cảm ơn chân thành tới các giáo viên hướng dẫn của tôi, <NAME> và <NAME>, vì sự hỗ trợ và định hướng quan trọng của cô trong quá trình phân tích thiết kế kiến trúc hệ thống website thương mại điện tử. Dưới sự chỉ dạy tận tâm của các cô, tôi đã học được rất nhiều kiến thức chuyên môn và nhận được sự truyền cảm hứng về tinh thần trách nhiệm và thái độ làm việc nghiêm túc. Tôi cũng muốn gửi lời cảm ơn đến tất cả các thầy cô trong học viện Kỹ thuật Mật Mã và khoa an toàn thông tin đã tận tình giảng dạy và truyền đạt những kiến thức và kinh nghiệm quý báu cho tôi trong suốt thời gian học tập tại học viện. Sự quan tâm và tạo mọi điều kiện thuận lợi từ phía các thầy cô cũng đã đóng góp không nhỏ trong quá trình thực hiện đồ án của tôi. Tôi cũng không thể quên lời cảm ơn đến gia đình, bạn bè và những người đã động viên, đóng góp ý kiến và hỗ trợ tôi trong suốt quá trình học tập, nghiên cứu và hoàn thành đồ án. Tôi xin gửi lời cảm ơn chân thành tới tất cả mọi người đã đóng góp vào quá trình học tập và hoàn thiện đồ án tốt nghiệp của tôi. Sự giúp đỡ và hỗ trợ từ mọi người là một phần không thể thiếu để tôi có thể đạt được kết quả tốt nhất. Tôi rất biết ơn sự hướng dẫn và hỗ trợ từ ThS. V<NAME> và ThS. <NAME> và toàn thể những người đã góp phần vào thành công của tôi trong quá trình thực hiện đồ án. Tôi sẽ luôn đánh giá cao sự đóng góp của mọi người và sẽ nỗ lực để áp dụng kiến thức đã học vào thực tế trong tương lai. Tôi xin chân thành cảm ơn! \ #[ #set align(right) Tp. <NAME>, ngày 05 tháng 06 năm 2023 \ Sinh viên thực hiện #h(75pt) \ \ \ Ngô Quang Sang #h(80pt) ] #h1("Lời cam đoan", numbering: false) Tôi xin cam đoan bản đồ án này do tôi tự nghiên cứu dưới sự hướng dẫn của giảng viên hướng dẫn ThS. <NAME> và <NAME>. Để hoàn thành đồ án này, tôi chỉ sử dụng những tài liệu đã ghi trong mục tài liệu tham khảo, ngoài ra không sử dụng bất cứ tài liệu nào khác mà không được ghi. Nếu sai, tôi xin chịu mọi hình thức kỷ luật theo quy định của Học viện. #[ #set align(right) Tp. <NAME>, ngày 05 tháng 06 năm 2023 \ Sinh viên thực hiện #h(75pt) \ \ \ Ngô Quang Sang #h(80pt) ] #h1("Mục lục", numbering: false) #par(first-line-indent: 0pt, outline( title: none, depth: 3, )) #h1("Danh mục các ký hiệu, chữ viết tắt", numbering: false) #tabl( columns: (auto, 1fr), [*Từ viết tắt*], [*Định nghĩa*], [TMĐT], [Thương mại điện tử], [SSL], [Secure Socket Layer], [CSS], [Cascading Style Sheets], [HTML], [HyperText Markup Language - Ngôn ngữ Đánh dấu Siêu văn bản], [RWD], [Responsive web design - Thiết kế responsive], [URL], [Uniform Resource Locator], [PCI DSS], [Payment Card Industry Data Security Standard], [API], [Application Programming Interface], [DBMS], [Database Management System - Hệ quản trị cơ sở dữ liệu], [COD], [Cash on delivery - Thanh toán khi nhận hàng], [SQL], [Structured Query Language], [CSDL], [Cơ sở dữ liệu], [AES], [Advanced Encryption Standard], [JWT], [JSON Web Token], ) #h1("Danh mục bảng", numbering: false) #par(first-line-indent: 0pt, outline( title: none, target: figure.where(kind: table) )) #h1("Danh mục hình vẽ, đồ thị", numbering: false) #par(first-line-indent: 0pt, outline( title: none, target: figure.where(kind: image) )) #h1("Mở đầu", numbering: false) Số lượng người dùng thương mại điện tử (TMĐT) tăng nhanh: Gần đây, sự phát triển công nghệ mở ra nhiều cơ hội kinh doanh mới, giúp thị trường TMĐT phát triển và thu hút nhiều người dùng hơn. Theo Hiệp hội Thương mại điện tử Việt Nam, hoạt động kinh doanh trên các sàn TMĐT và mạng xã hội là những nét nổi bật của ngành TMĐT Việt Nam năm 2022 và quý 1/2023. Kết quả khảo sát cho thấy có tới 65% doanh nghiệp đã triển khai hoạt động kinh doanh trên các mạng xã hội. Ngoài ra, số lượng lao động trong doanh nghiệp thường xuyên sử dụng các công cụ như Zalo, WhatsApp, Viber hay Facebook Messenger cũng liên tục tăng qua từng năm. @tapchicongthuong1 #img("23image.png", cap: "Người dùng sử dụng các nền tảng mạng xã hội trong 2 năm") Với sự phát triển mang tính toàn cầu của mạng Internet và TMĐT, con người có thể mua bán hàng hoá và dịch vụ thông qua mạng máy tính toàn cầu một cách dễ dàng trong mọi lĩnh vực thương mại rộng lớn. Tuy nhiên đối với các giao dịch mang tính nhạy cảm này cần phải có những cơ chế đảm bảo bảo mật và an toàn vì vậy vấn đề an toàn bảo mật thông tin trong TMĐT là một vấn đề hết sức quan trọng. Hiện nay vấn đề an toàn bảo mật cho dữ liệu và thanh toán trong TMĐT đã và đang được áp dụng phổ biến và rộng rãi ở Việt Nam và trên phạm vi toàn cầu. Vì thế vấn đề an toàn bảo mật cho dữ liệu và thanh toán đang được nhiều người tập trung nghiên cứu và tìm mọi giải pháp để đảm bảo an toàn bảo mật cho các hệ thống thông tin trên mạng. Tuy nhiên cũng cần phải hiểu rằng không có một hệ thống thông tin nào được bảo mật 100% bất kỳ một hệ thống thông tin nào cũng có những lỗ hổng về bảo mật và an toàn mà chưa được phát hiện ra. Khi giao dịch trực tuyến, người dùng thường cung cấp thông tin cá nhân và tài khoản ngân hàng. Nếu không có biện pháp bảo mật, dữ liệu này có thể bị đánh cắp và lợi dụng để gây hại. Vấn đề an toàn bảo mật thông tin cho dữ liệu và thanh toán trong TMĐT phải đảm bảo bốn yêu cầu sau đây: - Đảm bảo tin cậy: Các nội dung thông tin không bị theo dõi hoặc sao chép bởi những thực thể không được uỷ thác. - Đảm bảo toàn vẹn: Các nội dung thông tin không bị thay đổi bởi những thực thể không được uỷ thác. - Sự chứng minh xác thực: Không ai có thể tự trá hình như là bên hợp pháp trong quá trình trao đổi thông tin. - Không thể thoái thác trách nhiệm: Người gửi tin không thể thoái thác về những sự việc và những nội dung thông tin thực tế đã gửi đi. Mục tiêu chính của đề tài này là tạo ra sản phẩm nhằm tăng cường an toàn và bảo mật trong TMĐT: Triển khai giải pháp xác thực đảm bảo an toàn bảo mật cho dữ liệu và thanh toán giúp tăng cường an toàn và bảo mật cho giao dịch TMĐT, giúp người dùng yên tâm hơn khi giao dịch trực tuyến. Giúp nâng cao uy tín và chất lượng của website TMĐT khi triển khai các giải pháp bảo mật an toàn và đáp ứng các tiêu chuẩn an toàn quốc tế, đó là điểm cộng để nâng cao uy tín và chất lượng của website, thu hút người dùng tin tưởng và sử dụng. Nghiên cứu các kỹ thuật và triển khai các phương pháp mã hóa bảo vệ dữ liệu, chống xâm nhập và đánh cắp dữ liệu và áp dụng các kết quả đã tìm hiểu và nghiên cứu để triển khai hệ thống an toàn bảo mật cho dữ liệu và thanh toán trong TMĐT. TMĐT đang trở thành lĩnh vực kinh doanh tiềm năng, đóng góp tích cực cho sự phát triển của nền kinh tế và xã hội. Triển khai giải pháp bảo mật an toàn cho TMĐT giúp tạo điều kiện thuận lợi cho sự phát triển của lĩnh vực này, giúp doanh nghiệp TMĐT tăng cường sự tin tưởng của khách hàng và nâng cao hiệu quả kinh doanh. Hiện nay, các quy định về bảo mật thông tin và thanh toán trực tuyến đang được nhiều quốc gia và khu vực áp dụng. Triển khai giải pháp bảo mật an toàn cho TMĐT giúp đáp ứng các tiêu chuẩn và quy định này, giúp website TMĐT tránh được các rủi ro về pháp lý. Vì vậy, đề tài này có tính cấp thiết và ý nghĩa thực tiễn cao, giúp tăng cường an toàn và bảo mật cho giao dịch TMĐT, đóng góp tích cực cho sự phát triển của lĩnh vực TMĐT và đáp ứng các tiêu chuẩn và quy định của pháp luật.
https://github.com/rmolinari/thesis_1999
https://raw.githubusercontent.com/rmolinari/thesis_1999/master/README.md
markdown
# My Doctoral Thesis In 1999 I submitted a thesis as part of my PhD program in Mathematics. It was written up in [LaTeX](https://www.latex-project.org/). I have long since lost the source files but, luckily, I still have a hard copy. This is an experimental project with the goal of (re)typesetting my thesis in [Typst](https://typst.app/docs), a new (2023) typsetting engine. ## Goals I have two main goals. Firstly, I would very much like to have the ability to regenerate a version my thesis. It annoys me to have lost all my sources from my student days and makes we wonder what else I lost that I would find interesting to see again today. As things stand, it would be hard to replace my hard copy if I should ever lose it. Secondly, I would like to learn more about Typst. It looks like a reasonable tool for typesetting documents with significant amounts of mathematical notation while avoiding much of the complexity of LaTeX and related tools. 25 years ago I felt productive with LaTex, but not so much these days. I've been using [ConTeXt](https://wiki.contextgarden.net/Main_Page) for several years when typesetting short mathematical documents - like solutions to problems in the American Mathematical Monthly - but I'm always having to remind myself how to do things, and sometimes run into instability. ## Plan I plan to retypeset as much of my thesis as I can, working from my hard copy. My submitted thesis has more typos that I care to admit, even after all the proofreading I did back in the day. After a certain point I became blind to them. For now I'm aiming to reproduce the thesis, errors and all, so that I can fix them as later commits. Of course, the very process of typsetting it again means I'll introduce new errors. The thesis also has expositional problems that are evident to me even 25 years later, when much of my knowledge is gone and my mathematical maturity is back at a primitive level. For example, section 3.4 is a bit of a mess and could use better exposition and perhaps some diagrams. Typst is still in beta and in flux. Things will surely change, and I'm sure that things I want to be able to do aren't (yet) possible. I may get too frustrated to continue, or I may just run out of steam. We'll have to see how it goes.
https://github.com/HarryLuoo/sp24
https://raw.githubusercontent.com/HarryLuoo/sp24/main/Physics311/reviewNotes/part3.typ
typst
#set math.equation(numbering: "[1") = Angular momentum of a rigid body == $arrow(L)$ in non-inertial frame $ arrow(L) = sum m(arrow(r) times arrow(v)) = sum m [arrow(Omega) r^2 - arrow(r) (arrow(Omega) dot arrow(r))]\ L_i = #rect(inset: 8pt)[ $ display( I_(i j) Omega_j)$ ] quad arrow(L) = I * arrow(Omega) \ $ If $(x_1x_2x_3)$ are principal axis, $L_1 = I_1 Omega_1, med L_2 = I_2 Omega_2, med L_3 = I_3 Omega_3$ == Free motion of a rigid body angular momentum is conserved if no external torque. Motion in inertial COM frame is simplier. - _ex motion of a symmetric top _ $ I_1=I_2=I_3=I,quad tilde(I) = I display(mat(1,0,0;0,1,0;0,0,1))$\ $arrow(L) = I arrow(Omega) -> dot(arrow(L)) = 0 => dot(arrow(Omega))=0$ Uniform rotation about fixed axis paralle to $arrow(L)$ - _ex rigid rotor_ $I_1=I_2= sum m x_3^2, quad I_3 = 0$ $arrow(L) = I arrow(Omega), quad arrow(Omega) perp x_3$ by geometry We have $dot(arrow(Omega)) = 0 =>$ Motion is unif in plane perp to $arrow(Omega)$ and that it stays in that plane. - _ex asymmetric top_ $I_1=I_2=I_perp eq.not I_3 => tilde(I) = display(mat(I_perp, 0 ,0; 0, I_perp , 0; 0,0, I_3)) $ $x_3$ is symm. axis, for any orthogonal axes = Rigid body EOM $ cases(dot(arrow(p)) = arrow(F), dot(arrow(L))= arrow(K) "torque") $ == Euler angles: $psi$ spin, $theta$ nutation, $phi$ precession #image("assets/2024-05-06-01-58-03.png", width: 20%) $(theta in [0,pi], phi in [0,2pi], psi in [0,2 pi])$ in turns of rotation $R = R(hat(z), phi) R(hat(X),theta) R(hat(Z), psi)$ === The lagrangian in Euler angles - First: $T= 1/2 (I_1 Omega_1^2 + I_2 Omega_2^2+ I_3 Omega_3^2)$ - Rotation in components: $ Omega_1 = dot(phi) sin theta sin psi + dot(theta) cos psi\ Omega_2 = dot(phi) sin theta cos psi - dot(theta) sin psi\ Omega_3 = dot(phi) cos theta + dot(psi)\ $ - $T = 1/2 I_1(dot(phi) sin theta sin psi + dot(theta) cos psi)^2 + 1/2 I_2 (dot(phi) sin theta cos psi - dot(theta) sin psi)^2 + 1/2 I_3 (dot(phi) cos theta + dot(psi))^2$ - $L(theta, phi, psi, dot(theta), dot(phi), dot(psi)) = T - U$ === Free motion of symmetric top in Euler angles $I_1 = I_2 = I_perp => quad T=1/2 I_perp ( dot(theta)^2 + dot(phi)^2 sin^2theta) + 1/2 I_3 (dot(phi) cos theta + dot(psi))^2$ $Omega_perp = L_z slash I_perp,quad Omega_3 = L_z cos theta slash I_3 quad$ E-L -> $ theta: med (dif)/(dif t) I_perp dot(theta) = I_perp sin theta cos theta med dot(phi) ^2 - I_3 dot(phi) sin theta (dot(phi) cos theta +dot(psi))\ phi: med (dif )/(dif t) (I_perp dot(phi) sin^2theta + I_3 cos theta (dot(phi) cos theta + dot(psi))) = 0\ psi: med (dif)/(dif t) I_3 (dot(phi) cos theta + dot(psi)) = 0\ $ choosing $hat(z)$ along the angular momentum, we have $L_3 = L_z cos theta = I_3Omega_3 = I_3 (dot(phi)cos theta + dot(psi))$\ $=> dot(L)_3 = "const" =>theta = "const"$ $ quad Omega_3 = (L_z cos theta)/( I_3)$ $ quad dot(phi) = (L_3)/(I_perp cos theta) = (L_z)/(I_perp) = "const"$ - _ex heavy symmertic top with one pt fixed_ By paralle axis thm, $I'_(i j) I_(i j) + M (l^2 delta_(i j) - l_i l_j)$ $=> I'_perp = I_perp + M l^2, quad I'_3 = I_3, quad U = m g Z = M g l cos theta$ $=> L = T-U = 1/2 I'_perp (dot(theta)^2 + dot(phi)^2 sin^2theta) + 1/2 I_3 (dot(psi) + dot(phi) cos theta)^2 = M g l cos theta$ \ E-L : $ L_z=p_phi = (I'_perp sin^2theta + I_3 cos^2theta)dot(phi) quad "const"\ L_3=p_psi = I_3 (dot(psi) + phi cos theta)quad"const" $ Considering energy conservation$ E = T + U => quad underbrace(E - (L_3^2)/(2I_3) - M g l, E' )= 1/2 I'_perp dot(theta)^2 + underbrace(1/(2 I'_perp) (L_z - L_3 cos theta)^2/(sin^2theta) - M g l (1- cos theta), U_"eff" (theta) ) $ effective 1 dof problem. recognizing $ dot(theta) = (dif theta)/(dif t) => quad t = integral (d theta)/(sqrt(2[E - U_"eff" (theta)] slash I'_perp) $ Considering U_eff: when $ theta = 0, L_z = L_3$when $theta approx 0$ $ => quad U_"eff" approx ((L_3^2)/(8 I'_perp) - (M g l)/(2))theta^2$ Motion about $theta = 0 $ stable if $L_3^2 > 4 I'_perp M g l => Omega_3^2 > 4 I'_perp M g l slash I_3^2quad$ , or stable if sping ab. symm. axis is fast enough. - Nutuation: cosider $dot(phi) = L_3/I'_perp ((L_z slash L_3)-( cos theta))/(sin^2theta) = L_3/ I'_perp f(theta)$ #image("assets/2024-05-06-12-26-58.png", width: 70%) #image("assets/2024-05-06-12-27-08.png", width: 70%) considering the sign and trends of $f(theta)$ given constrains on theta, we can differentiate different nutation motion. If $theta_0$ in graph 2 is out of range, the nutation is smooth; if $theta_0$ is in range, the nutation is oscillatory(will change sign and spin in spiral.); if $theta_0$ is on the endpoint of our constrained range, the nutation is spiky and "not smooth" at points. == Euler equations set body frame $(X,Y,Z) = (hat(e)_1^0,hat(e)_2^0,hat(e)_3^0$, space frame $(x_1,x_2,x_3) =(hat(e)_1,hat(e)_2,hat(e)_3)$ Set any vector $arrow(A)= sum A_i^0 hat(e)_i^0 = sum A_i hat(e)_i $ By magic of vec analysis, $ ( (dif arrow(A))/(dif t) )_"Space" = ((dif arrow(A))/(dif t))_"Body" + arrow(Omega) times arrow(A)_"Space" $ When applied to $ ((dif arrow(L))/(dif t))_"Space" = arrow(Kappa) = ( (dif arrow(L))/(dif t) )_"body" + arrow(Omega) times arrow(L)$, recognizing $L_i= I_i Omega_i$: $ I_1 dot(Omega)_1 + (I_3 - I_2) Omega_2 Omega_3 = K_1\ I_2 dot(Omega)_2 + (I_1 - I_3) Omega_3 Omega_1 = K_2\ I_3 dot(Omega)_3 + (I_2 - I_1) Omega_1 Omega_2 = K_3\ $ $K_i = 0$ if $arrow(L)$ is conserved on $i$ axis. - _ex symmetric top_ $I_1=I_2= I, arrow(K) =0$ $quad (dot(Omega)_1 + (I_3-I_1)/(I_perp) Omega_2 Omega_3 = 0;med dot(Omega)_2 + (I_1-I_3)/(I_perp) Omega_3 Omega_1 = 0; med dot(Omega)_3 = 0)$ let $omega = ((I_3 - I_perp)slash(I_perp)) Omega_3 => #rect(inset: 4pt)[ $ display((Omega_1 = A cos omega t; med Omega_2 = -1/omega dot(Omega)_1 = +A sin omega t))$ ] $ = Motion in non-inertial frame - Set non-inertial frame with velocity $arrow(V)(t),med arrow(A) = dot(arrow(V)), quad arrow(v) = arrow(v)' + arrow(V)(t)$ where $arrow(v)'$ is velocity w.r.t. non-inertial frame. lagrangian $L' = 1/2 m v'^2 - m arrow(r)' dot arrow(A) - U$ , using E-L eq: $ m dot(arrow(v))' = - (diff U)/(diff arrow(r)') - m arrow(A)$ - _ex pendulum in acc. car_ $quad m dot.double(arrow(r)) = arrow(T) + m arrow(g) - m arrow(A) $ , finding equil. angle: $ arrow(T) = -m (arrow(g)- arrow(A)) = -m arrow(g)_"eff"$ , then use geometry between $arrow(g) , -arrow(A) => tan phi_0 = A/g$. Oscillation freq. $omega = sqrt(g_"eff"slash l)$ == Motion in rotating frame Set rotation with $arrow(Omega)$, $L = 1/2 m v^2 + arrow(m v) dot (arrow(Omega) times arrow(r)) + 1/2 m (arrow(Omega) times arrow(r))^2 - m arrow(r) dot arrow(A)- U$ Using E-L, $#rect(inset: 8pt)[ $display( m dot(arrow(v)) = - (diff U)/(diff arrow(r)) - m arrow(A) + 2 m (arrow(v) times arrow(Omega)) + m arrow(Omega) times (arrow(r) times arrow(Omega)) + m arrow(r) times dot(arrow(Omega)))$ ] $ - Namely, $ m dot(arrow(v)) = - (diff U)/(diff arrow(r)) + arrow(F)_"cor" + arrow(F)_"cent"\ arrow(F)_"Cor" = 2 m (arrow(v) times arrow(Omega)), quad arrow(F)_"cent" = m arrow(Omega) times (arrow(r) times arrow(Omega))= m(arrow(Omega) times arrow(r)) times arrow(Omega) $ - _ex free fall on earth, centrifugal force _ $ med arrow(F) =arrow(g)_0 + m Omega^2 R sin theta hat(rho) => arrow(g)_"eff" = arrow(g_0) + Omega^2 R sin theta hat(rho)$ - _ex free fall, coriolis force_ $quad dot(arrow(v)) = arrow(g) + 2 arrow(v) times arrow(Omega), quad arrow(Omega) = Omega sin theta hat(y) + Omega cos theta hat(z)$ In components, $ arrow(v_x) = 2 Omega ( v_y cos theta - v_z sin theta)\ arrow(v_y) = -2 Omega v_x cos theta\ arrow(v_z) = 2 Omega v_x sin theta - g $ Free fall EOM: $arrow(R) = integral v dif r $, consider $arrow(v) = arrow(v_1) + arrow(v_2) = -arrow(g) + 2 arrow(v_1) times arrow(Omega)+2 arrow(v_2) times arrow(Omega)$ where approximately, $arrow(v_2) = 2(arrow(v_0) - g t hat(z) ) times arrow(Omega)$. If no initial velocity, integrating velocity in x components gives, $x(t) = 1/3 g Omega ((2h)/(g))^(3 slash 2) sin theta $ - _ex foucaults pendulum_ EOM $ $ #figure( grid( columns: 2, // 2 means 2 auto-sized columns gutter: 2mm, // space between columns image("assets/2024-05-06-15-05-32.png", width: 50%), $arrow(r) = l sin beta cos alpha hat(x) + l sin beta sin alpha hat(y) + (l - l cos beta) hat(z)\ arrow(T) = - T sin beta cos alpha hat(x) - T sin beta sin alpha hat(y) + T cos beta hat(z)\ arrow(Omega) = Omega sin theta hat(y) + Omega cos theta hat(z)$ , ))\ $ cases(T = m g, m dot.double(x) = T_x + 2 m hat(x) dot (dot(arrow(r)) times arrow(Omega)) = - (m g x)/l + 2 m Omega dot(y) cos theta, m dot.double(y) = -(m g y)/(l) - 2 m Omega dot(x) cos theta) $ letting $omega^2 = g/l,Omega_z = Omega cos theta, quad #rect(inset: 8pt)[ $ display(eta = x + i y = e^(i gamma t))$ ] $ $ dot.double(x) + omega^2 x = 2 Omega_z dot(y), dot.double(y) + omega^2 y = -2 Omega_z dot(x) \ gamma = - Omega_z plus.minus sqrt(omega^2 - Omega_z^2) \ eta(t) = a e^(- i Omega_z t) cos omega t\ =>cases(x = a cos Omega_z t cos omega t, y = a sin Omega_z t cos omega t) $ = Hamiltonian Mechanics $H(q,p,t) = sum_(j=1)^(n) p_j dot(q)_j - L(q,dot(q), t) quad $ 1D: $H = (p^2)/(2 m) + U(x)$ - Hamilton's equation $dot(q)_i = (diff H)/(diff p_i) quad dot(p)_i = - (diff H)/(diff q_i) $ - _ex particle in polar_ $ quad L = T - U = 1/2 m (dot(r)^2 + r^2 dot(phi)^2) - U(r,phi) => quad p_r = (diff L)/(diff dot(r)) = m dot(r), med p_phi = (diff L)/(diff dot(phi)) = m r^2 dot(phi) $ $ H = p_r dot(r) + p_phi dot(phi) - L = (p_r^2)/(2m)+(p_phi^2)/(2 m r^2) => quad dot(r) = (diff H)/(diff p_r) = p_r/m, quad dot(phi) = (diff H)/(diff p_phi) = p_phi/(m r^2) \ dot(p)_r = -(diff H)/(diff r) = (p_phi^2)/(m r ^3) - (diff U)/(diff r), quad dot(p)_phi = -(diff H)/(diff phi) = - (diff U)/(diff phi) $ == Phase space - _ex harmonic oscillator_ $H = (p^2)/(2 m) + (1/2) m omega^2 x^2, quad omega = sqrt(k/m) $ $ {dot(x) = (diff H)/(diff p) = p/m, quad dot(p) = - (diff H)/(diff x) = - m omega^2 x}=> quad { dot(q) = p/m, quad dot(p) = - m omega^2 x} $ $q(t_0+delta t) = q(t_0)+ dot(q) delta t = q_0 + p/m delta t; quad p(t_0 + delta t) = p(t_0) + dot(p) delta t = p_0 - m omega^2 q delta t$ parametric ellipse in phase space. == Liouville's thm volume of a region op phase space is conserved under time evolution, when boundary of volume and all pts inside move along their orit for some amount of time. == Poisson bracket Time evolution of an observable $A(q,p,t)$: $ (dif A)/(dif t) = (diff A)/(diff t) + underbrace(sum_(i=1)^(n) (diff A)/(diff q_i) (diff H)/(diff p_i) - (diff A)/(diff p_i) (diff H)/(diff q_i), eq.triple {A,H}) $ More generally, for $A (q,p,t), quad B (q,p,t)$ $ {A,B} = sum_(i) (diff A)/(diff q_i) (diff B)/(diff p_i) - (diff A)/(diff p_i) (diff B)/(diff q_i) $ notice, ${A,p_i} = (diff A)/(diff q_i), {A,q_i} = - (diff A)/(diff p_i) $ - When $ (dif C)/(dif t) = (diff C)/(diff t)+ {C,H} = 0 $ then $C(q,p,t)$ is conserved. == Cononical transformation consider transformation $q_i -> Q_i (q,t)$ the transformation is canonical iff the transformation leave the form of Hamilton's eq. unchanged. $ cases( dot(q) = (diff H )/(diff p) , dot(p) = - (diff H)/(diff q) )=> cases dot(Q) = (diff K)/(diff P), dot(P) = - (diff K)/(diff Q) $ where $K(Q,P,t)$ new Hamiltonian. = Exerpts from practice problems == constraints, small Oscillations A particle of massmmoves withoutfriction on the inside wall of an axially symmetric vessel given by $z=b^2(x^2+y^2)$ - KE in cylindrical coords: $ T = 1/2 m (dot(rho)^2 + rho^2 dot(theta)^2 + dot(z)^2), quad dot(z) = b dot(rho) rho =>\ L = m/2 [dot(rho)^2 (1 + b^2 rho^2) + rho^2 dot(theta)^2] - (m g b)/(2) rho^2 $ E-L: $ dot.double(rho)(1 + b^2 rho^2) + b^2 dot(rho)^2 rho - rho dot(theta)^2 + g b rho = 0\ m rho^2 dot(theta) = "const" eq.triple M " conserved angular momentum" $ - energy and angular momentum given $z_0, b, g,m$ $ E = m/2 [dot(rho)^2 (1 + b^2 rho^2) + rho^2 dot(theta)^2] + (m g b)/(2) rho^2 $ For a fixed $z_0$, $rho_0$ is the equilibrium position, and $dot(rho) = 0$ , then $ E = m/2 rho_0^2 dot(theta)^2 + m g b rho_0^2/2 \ dot(theta)^2 = g b\ => E = 2 m g z_0 $ plugging in $ dot(theta), rho=rho_0$, we have $M = 2 m z_0 sqrt(g/b) $ - frequency of small oscillations about equilibrium perturbation: $rho = rho_0 + epsilon$, neglecting anything with $epsilon^2$ , EOM of rho is $ dot.double(epsilon)(1+b^2rho_0^2) - rho dot(theta)^2 + g b rho_0+ g b epsilon = 0\ $ want to know $rho dot(theta)^2$, can be found from $theta$ EOM$ rho dot(theta)^2 = M^2/(m^2 rho^(3) )= M^2/(m^2 rho_0^3) (1/(1+ epsilon/rho_0)^(3) ) approx M^2/(m^(3 ) rho_0^4)(1- 3 epsilon/rho_0)\ = b rho_0 g - 3 b g epsilon $ Plugging in to rho EOM, we have $ dot.double(epsilon)(1+ 2 b z_0) + 4 g b epsilon = 0\ dot.double(epsilon) = - omega^2 epsilon, Omega^2 = (4 g b)/(1 + 2 b z_0) $ == Conservation laws two particles of ${m_1,q_1,arrow(r)_1},{m_2,q_2, arrow(r)_2$ in capacitor with $arrow(E) = E_0 hat(z)$, particles interact with $U(r_1,r_2) = (k)/(abs(arrow(r_1)- arrow(r_2))) e^(-abs(arrow(r)_1 - arrow(r_2))/lambda) $. List all conserved quantities and associate each with a specific symmetry of the problem. - lagrangian $L = 1/2 m_1 dot(arrow(r))_1^2 + 1/2 m_2 dot(arrow(r))_2^2 - U + E_0(q_1 z_1 + q_2 z_2)$. Setting $arrow(r) = (x,y,z) = arrow(r)_1 - arrow(r)_2, arrow(R) = (X,Y,Z) = (arrow(m_1r)_1 + m_2 arrow(r)_2)/(M), mu = (m_1 m_1)/(M)$, we can have$ L = [1/2 M dot(arrow(R))^2 + (q_1+q_2) E_0 Z] + [1/2 mu dot(arrow(r))^2 - U (r)+ (q_1m_2 - q_2m_2)/M med E_0 z]\ $ Observe: momenta $P_x = (diff L)/(diff dot(X)) , P_y = (diff L)/(diff dot(Y)) $ are conserved. Invariance under time translation gives conserved energy $ E= (diff L)/(diff dot(R))dot(R) + (diff L)/(diff dot(r))dot(r) -L $ Angular momentum $L_"ttl" = arrow(r_1) times arrow(p_1) + arrow(r_2) times arrow(p_2) = M arrow(R) times dot(arrow(R)) + mu arrow(r) times dot(arrow(r)) = arrow(R) times arrow(P) + arrow(r) times arrow(p)$. Invariance under rotation about $hat(z): R -> R + epsilon hat(z) times R, quad r -> arrow(r) + epsilon hat(z) times arrow(r)$ gives conserved $L_z = (arrow(R) times arrow(P))_z quad l_z = [arrow(r) times arrow(p)]_z$. == Normal modes A system of $N$ particles with masses $m_i$ moves around a circle of radius a, with position angle $theta_i$. Interaction potential $U = k/2 sum_(1)^(N) (theta_(j+1) - theta_j)^2 .$, with $theta_(N+1) = theta_1+2 pi$. lagrangian of system is $a^2/2 sum_(1)^(N) m_j dot(theta)_j^2 - U $ - show Largrangian for particle i, show system in equalibrium when particles are equally spaced. $ L = a^2/2 sum_(1)^(N) m_j dot(theta)_j^2 - k/2 sum_(1)^(N) (theta_(j+1) - theta_j)^2\ $ E-L for $theta_i: quad a^2m_i dot.double(theta)_i = k(theta_(i+1) - theta_i)- k (theta_i - theta_(i-1) ) = -k [2 theta_i - (theta_(i+1) + theta_(i-1) )]$ When eqaully spaced, $theta_i = (2pi i)/N$, thus $dot.double(theta)_i = 0$ for all particles, thus equalibrium. - show the system always has a normal mode of osc. with 0 freq. $ bb(M) dot dot.double(arrow(theta)) = - bb(K) dot arrow(theta), quad M_(i j) = a^2 m_i delta_(i j), quad K_(i j) = k(2 delta_(i,j) - delta_(i,j+1) - delta_(i, j-1) ) \ $ take anstaz susbsitution $arrow(theta)->arrow(z) = arrow(b) e^(i omega t) $ gives $omega^2 bb(M) dot arrow(b) = bb(K) dot arrow(b)$ , where $arrow(b)$ is a constant vec. Look for a 0 freq $omega = 0$ , $bb(K) dot arrow(b) = 0$ holds, so $b_i = b$. let $b = Theta(t)$, knowing $dot.double(Theta) = 0$ recall our subsitution, the time evo of $theta_i(t) = Theta_0+ Theta_1 t$ i.e. trajectory is all masses rotating at same rate $Theta_1$ - find all normal modes when $N =2, M_1 = k m slash a^2, m_2 = 2 k m slash a^2$ . Using standard normal mode analysis, for $N = 2, quad omega^2 bb(M) dot arrow(b) = bb(K) dot arrow(b) $ becomes $ display(mat(a^2omega^2 m_1 - 2k, 2k; 2k, a^2 omega^2 m_2 -- 2k)) vec(b_1, b_2) = 0 $ <eq.normal> zero det gives $ a^(4) omega^(4) m_1 m_2 - 2k a^2 omega^2 (m_1+m_2) = 0 quad => omega^2 = 0 "or" (2k (m_1+m_2))/(a^2 m_1 m_2) $ setting $m_2 = 2m_1 = k m slash a^2$, the second sol becomes $ omega^2 = 3/m$ Corresponding normal mode is pound by plugging $omega$ into @eq.normal $ display(mat(1,2;2,4)) vec(b_1,b_2) = 0 quad => b_1 = -2 b_2 eq.triple A e^(- i delta) $ taking the real part, we find the SOLUTION $ vec(theta_1, theta_2) = vec(1,-1/2) A cos (omega t- delta) $ two masses osc. exactly out of phase, with m2 osc. with half the amplitude. == non-inertial frame a pendulum suspended inside a car, accelerated at cosntant $arrow(A)$. - lagrangian, and EOM for angle $theta$, the angle from vertical. set $X$ be coord of the moving support with $arrow(A)$ $x = X + l sin phi, quad y = l cos phi$ $T = 1/2m(dot(x)^2 + dot(y)^2) = 1/2 m l^2 dot(phi)^2 + m l dot(X) dot(phi) cos phi + 1/2 m dot(X)^2$ , $U = - m g y = - m g l cos phi$ $L = T - U = 1/2 m l^2 dot(phi)^2 + m g l cos phi - m A l sin phi$ feeding into EL: $l dot.double(phi) = - g sin phi - A cos phi$ - Find equilibrium, show it is stable, and find freq. the equilibrium condition is that the forcee vanishes$ - g sin phi_0 - A cos phi_0 = 0 quad => tan phi_0 = -A slash g $ to find equil. take $phi = phi_0 + delta phi$, expanding the above$ l delta dot.double(phi) = ( - g cos phi_0 + A sin phi_0) delta phi = -delta phi sqrt( g^2+ A^2) \ => delta dot.double(phi) = - omega^2 delta phi, quad omega^2 = (g^2 + ^2)/(l) $ == Hamiltonian of particle in rotating frame find H of said particle, and show coriolis force does not appear in hamiltonian Largrangian: $L = 1/2 m v^2 + m dot (arrow(Omega) times arrow(r)) + 1/2 m (arrow(Omega) times arrow(r))^2 - U$ Do conical transformation, the momentum is $arrow(P) = (diff L)/(diff v) = m arrow(v) + m Omega times arrow(r)$ Hamiltonian $H = arrow(p) dot arrow(v) - L = (p^2)/(2m ) - arrow(Omega) dot (arrow(r) times arrow(p) ) + U$ THis can also be $ 1/2 m v^2 - 1/2 m (arrow(Omega) times arrow(r)^2) + U$ Observe that there is no term linaer in velocity from centrifugal force, therefore no coriolis force in Hamiltonian. == conservation laws in hamiltonian 1D system with $H = (p^2)/(2) - 1/(2 q^2)$, show that $ D = (p q)/(2) - H t quad$ is conserved. - EOM: $ dot(q) = (diff H)/(diff p) = p quad dot(p)= - (diff H)/(diff q) = - 1/q^3 $ now write $ (dif D)/(dif t) = (p dot(q))/(2) + (dot(p) q)/(2) - H = (p^2 )/(2) - (1)/(2 q^2) - H = 0$ as wanted. - or use possion braket: $ (dif D)/(dif t) = {H,D} + (diff D)/(diff t) = {H, (p q )/(2)} - H \ = (p * p/2 - 1/q^3 * q/2) - p^2/2 + 1/(2 q^2) =0 $ == Hamiltonian of a rigid body lagrangian of heavy symm top of mass M, at pt O with distance $l$ from the center of mass is $ L = (I_perp)/(2) (dot(theta)^2 + dot(phi)^2 sin^2theta) + (I_3)/(2) (dot(psi)+ dot(phi) cos theta)^2- M g l cos theta $ Observe momenta, and Hamiltonian H. find ham's eqn for this system. Identify the three conserved quantities and explain their physical meaning. $ p_theta = (diff L)/(diff dot(theta)) = I_perp dot(theta)\ p_phi = (diff L)/(diff dot(phi)) = I_3 cos theta (dot(psi) + dot(phi) cos theta) + I_perp dot(phi) sin^2theta\ p_psi = (diff L)/(diff dot(psi)) = I_3 ( dot(psi) + dot(phi) cos theta) $ and the Hamilitonian is $ H = p_theta dot(theta) + p_phi dot(phi) + p_psi dot(psi) - L$ , plugging in gives $ H = (p_theta^2)/(2 I_perp) + (p_psi^2)/(2 I_3) + ((p_phi - p_psi cos theta)^2)/(2 I_perp sin^2 theta) + M g l cos theta $ Ham's eqn are #image("assets/2024-05-07-10-43-01.png", width: 90%) No explicit time dependence means the energy is conserved. The energy is now hamiltoninan, $E = H(q(t), p(t))$ From ham's eqn, we see $ dot(p)_phi = - (diff H)/(diff phi) = 0, quad dot(p)_psi = - (diff H)/(diff psi) = 0 $ momentum on the $phi$ is conserved, due to the fact that there is no z-component to the gravitational torque. momentum on $psi$ is conserved, due to the fact that there is nox3-component to the gravitational torque == Dynamics in a magnetic field consider motion of a charged particle q in the presence of B and E field. Lagrangian of particle is $ L= 1/2 m v^2 - q phi(arrow(r),t)+ q arrow(A)(arrow(r),t) dot arrow(v) $ where $phi, arrow(A)$ are the scalar and vector potentials, related to the electric and magnetic fields by $ bb(E) = - nabla phi - (diff arrow(A))/(diff t), quad bb(B) = nabla times arrow(A) $ - write E-L, express results in terms of E and B, verify that this is lorentz force law. $ -q partial_i phi + q(partial_i A_j) dot(x)_j = (dif )/(dif t) (m dot(x)_i + q A_i) $ expanding gets us $ m dot.double(x)_i = q( -partial_i phi - partial_t A_i) + q dot(x)_j (partial_i A_j - partial_j A_i) $ algebra magic tells us that $arrow(v) times bb(B) = v_j (partial_i A_j - partial_j A_i) quad E_i = -partial_i phi - partial_t A_i$ , so this turns out to be $ m dot.double(r) = q (arrow(E) + arrow(v) times arrow(B)) $ - show lagrangian is invariant under gauge transformation #image("assets/2024-05-07-11-10-10.png") - find $p = (diff L)/(diff v) $from lagrangian and from which recover the hamiltonian. $ arrow(p) = (diff L)/(diff v) = m v + q arrow(A) quad => v = 1/m (arrow(p) - q arrow(A))\ H = arrow(p)dot arrow(v) - L = ((arrow(p) - q arrow(A))^2)/(2m) + q phi(arrow(r), t) $ - Compute the prosson brackets between the different components of the kenetic momentum $arrow(k) = m arrow(v)$ from the above answer we have $k_i = p_i - q A_i$ use poisson brackets $ {k_i, k_j} &= {p_i - q A_i, p_j - q A_j} \ & = q({A_i, p_j} - {A_j,p_i} \ & = q( (diff A_i)/(diff x_j) - (diff A_j)/(diff x_i) ) \ & = - q epsilon_(i j k) B_k $ the poisson brackets of the components of the kinetic momentum is thus non-zero in a magnetic field.
https://github.com/cadojo/correspondence
https://raw.githubusercontent.com/cadojo/correspondence/main/src/vita/src/resume.typ
typst
MIT License
// // Preamble // #import "experience.typ": * #import "education.typ": * #import "projects.typ": * #import "skills.typ": * #import "socials.typ": * #let decorated(src, body) = { if src == none { body } else { stack(dir: ltr, spacing: 0.5em, move(dy: 0.5em, src), h(0.5em), body) } } #let resume( name: none, email: none, phone: none, title: "Professional Resume", url: none, theme: rgb(120,120,120), body: stack(spacing: 1.25em, experiences(), degrees(), skills()), side: stack(projects(), socials()), metadata, ) = { show heading.where(level: 1): set text(27pt, black) show heading.where(level: 2): set text(18pt) show heading.where(level: 3): set text(12pt) set stack(spacing: 1em) set text(size: 9pt) show link: set text(weight: "bold") set page( margin: ( "left": 0.3in, "right": 0.3in, "top": 1in, "bottom": 0.5in, ), fill: white, background: place( right + bottom, rect( fill: theme, height: 100%, width: 33%, ) ), paper: "us-letter", header: grid( columns: (67%, 1fr, 29%), grid( columns: (2fr, 1fr, 0.5em), [ #heading(level: 1, name) ], [ #v(2em) #align( right, stack( dir: ttb, spacing: 1.5em, heading(level: 3, title), if url != none { text(9pt, style: "italic",url) } ) ) ], [] ), none, [ #pad( top: 1em, align(left)[ #set text(white, 11pt) #stack( dir: ttb, spacing: 1.75em, phone, email, ) ] ) ] ), header-ascent: 0.5in, ) metadata grid( columns: (67%, 1fr, 29%), stack( dir: ttb, spacing: 1.5em, [ #show heading.where(level: 2): set text(theme) #show heading.where(level: 2): set align(left) #body ], ), "", [ #set text(white) #show heading.where(level: 2): set align(center) #side ] ) }
https://github.com/jamesrswift/pixel-pipeline
https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/src/layers/drawing/lib.typ
typst
The Unlicense
#import "shapes/lib.typ" as shapes #import "layer.typ": layer
https://github.com/taooceros/MATH-542-HW
https://raw.githubusercontent.com/taooceros/MATH-542-HW/main/HW1/HW1.typ
typst
#import "@local/homework-template:0.1.0": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Math 542 HW1", authors: ("<NAME>",), ) #let ( theorem, lemma, corollary, remark, proposition, example, proof ) = ( thm, lemma, corollary, remark, proposition, example, proof ) #show: thmrules = #theorem[ "First Isomorphism Theorem for Modules", ][ Let M, N be R-modules and let $p : M -> N $be an R-module homomorphism. Then $ker(psi)$ is a submodule of $M$ and $M\/ker cong psi(M)$. ]<thm:firstiso> #solution[ As $psi$ is a $R$-module homomorphism, $ forall m_1, m_2 in M, r in R : psi(r m_1 + m_2) = r psi(m_1) + psi(m_2) $ For $ker(psi)$ to become a submodule, we requires $forall r in R, x in ker(psi): r x in ker(psi)$ We have $r dot 0 = 0$, and $forall x in ker(psi): psi(x) = 0$ Then $forall r in R, x in ker(psi):psi(r x) = r psi(x) = r dot 0 = 0$ Because a module homomorphism must be a group homomorphism. By first isomorphism theorem of group, $M\/ker(psi) cong psi(M)$. ] #theorem( "Second Isomorphism Theorem for Modules", )[ let A and B be submodules of M. Then $(A+B)/B cong A/(A sect B)$ ] #solution[ Construct a map $psi : A -> (A+B)/B$ by composing map from $phi: A-> A+B$ as a natural map and the canonical projection. Then we can write $psi(a)$ as $a B$, which means its kernel is $A sect B$. ] = == #solution[ #let tor(M) = $"Tor"(#M)$ We want to show $forall r in R, m in tor(M): r m in tor(M)$ Thus we want to find some $r'$ such that $r' r m = 0$ We know that $exists r'' : r'' m = 0$, then it suffices to find $r'$ such that $r' r = r''$. As $R$ is an integral domain, we have $r''r = r r'' => (r'' r) m = (r r'') m = 0$, and $r r'' != 0$ because $r != 0 and r'' != 0$. ] == #example[ #let tor(M) = $"Tor"(#M)$ Consider $R=ZZ\/6ZZ$ : $2 in tor(R)$ but $5 times 2 = 4 != tor(R)$. ] == #solution[ #let tor(M) = $"Tor"(#M)$ Consider the zero divisor $r_1, r_2 in R$. We have $r_1, r_2 != 0 and r_1 r_2 = 0$. Then consider any non-zero element $m in M$, $r_2 r_1 m = 0 => r_1 m in tor(M)$. Then it suffices to show that $r_1 m != 0$. However, if $r_1 m = 0$, then $m in tor(M)$, which also satisfy the requirement. ] == === Because $ZZ$ is an integral domain, then become a torsion submodules means exist some elements that makes the whole submodule become $0$. Then the first entries must be $0$. The second entry is just the whole $ZZ\/6ZZ$ as we always have $6 in ZZ$ that makes every element in $ZZ\/6ZZ$ to be 0. = Denote the finite-dimensional $k[x]$-module as $V$. To become a submodule $V'$, it must be invariant under the linear transformation represented by $x$. It suffices to find a polynomial $chi(A)$ such that $chi(A) = 0$. By Cayley-Hamilton theorem, this polynomials always exists, which is the charateristic polynomial. Thus every element is a torsion element, and thus the torsion submodules are $V$ itself. == #proposition[ The only finite-dimensional simple $CC[x]$-modules are one-dimensional. ] #solution[ As any $n times n$ matrix with entries in $CC$ has an eigenvector. We know that the span of eigenvector of $x$ will never escape the span, and thus is a submodule. As long as the dimension of $CC[x]$-modules are not 1, we definately can find a span of eigenvector that has dimensions less than the module. ] == #proposition[ Let $M := CC^2$ be a $CC[x]$-module where the action of $x$ is given by the matrix $mat(1,1;0,1)$. Find all submodules of $M$. ] #solution[ By (1), we will have the submodules span by the eigenvectors of $mat(1,1;0,1)$. $ mat(1,1;0,1)mat(x;y) = lambda mat(x;y) => mat(x+y =x;y = y) => mat() $ ] = == #solution[ For $f$ to be a R-module isomorphism, it must be a isomorphism of the underlying set. Consider $f$ is bijective first. Therefore, $exists g : f compose g = g compose f = id$. It suffices to prove that $g$ is a R-module homomorphism. Because $f$ is a R-module homomorphism $ forall m_1, m_2 in M, r in R: f(r m_1 + m_2) = r f(m_1) + f(m_2) $ Then we have $g(f(r m_1 + m_2)) = r m_1 + m_2 = g(r f(m_1) + f(m_2))$. Because $f$ is bijective, $f(m_1)$ and $f(m_2)$ points to a unique element in $M$ denoted as $m_3$ and $m_4$ $ forall m_3, m_4 in M: exists m_1, m_2 in M : f(m_1) = m_3 and f(m_2) = m_4 $ Therefore, $forall m_3, m_4 in M: g(r m_3 + m_4) = r g(m_3) + g(m_4) = r m_1 + m_2$. Assume the existence of such $g$ that is a R-module homomorphism and $g compose f = id = f compose g$: We know that the existence of inverse of the underlying set means that $f$ and $g$ is bijective. Then nothing left to be proved. ] == #solution[ By @thm:firstiso we have $ker(f)$ as a submodule of $M$. However, because $M$ is simple, then $ker(f)$ is either ${0}$ or $M$. Then for any non-zero $R$-module homomorphism $f : M->M$, we have $ker(f) = {0}$, which means it is injective, and as $f$ maps from $M$ to $M$, it is subjective, so thus bijective. By (1), we have such $g$ exists. ] == #solution[ Consider a matrix $mat(0,1;-1,0)$ that has no eigenvector in $RR^2$. Then we have no submodule for this module. $"End"_R (M)$ is all the linear transformation that commute with $x$, and for this case it is $mat(a,b;-b,a)$, and thus we can just send this to $a+b i$. ] = == Let $A$ be any $ZZ$-module, let $a$ be any element of $A$ and let $n$ be a positive integer. Prove that the map $phi_a : ZZ\/n ZZ -> A $ given by $phi(overline(k)) = k a$ is a well defined $ZZ$-module homomorphism if and only if $n a = 0$. Prove that $"Hom"_ZZ (ZZ\/n ZZ, A) cong A_n$, where $A_n = {a in A bar n a = 0}$ (so $A_n$ is the annihilator in $A$ of the ideal $(n)$ of $ZZ$ --- cf. Exercise 10, Section 1). #solution[ if $n a = 0$ $ phi(overline(x) + overline(y)) = phi(x + y mod n) = (x + y mod a) a\ phi(overline(x)) + phi(overline(y)) = (x+y) a $ Because $n a$ = 0, $(x+y) a = (x + y mod n)a$ If $phi_a$ is a valid homomorphism, then $ phi(overline(x) + overline(y)) = phi(overline(x)) + phi(overline(y)) => (x+y)a = (x + y mod n) a => n a = 0 $ ] #solution[ From Previous statement, we have each $phi_a : ZZ\/n ZZ -> A$ correspoinded to a set of $a$ such that $n a = 0$. #let hom = [$"Hom"_(ZZ) (ZZ\/n ZZ, A)$] #let znz = [$ZZ\/n ZZ$] We want to prove $forall psi in hom : exists a in A : psi = phi_a $ For $psi$ to be in $hom$, we will have the property that $forall x in znz, z in ZZ : z psi(x) = psi(z x)$ Therefore, $z psi(x) = overline(z) psi (x)$. Therefore, $psi(x)$ must have the property that $n psi(x) = 0$, which fits exactly into the $a$ we have. ] == Exhibit all $ZZ$-module homomorphisms from $ZZ\/30ZZ$ to $ZZ\/21ZZ$. #solution[ By previous exercise, it suffices to find all $a in ZZ\/21ZZ$ such that $30 a = 0 => 9a = 0$. We have $a_1 = 7, a_2 = 14, a_3 = 0$ ] = Bonus Given a ring $R$, the opposite ring $R^"op"$ is the ring with all the same elements, where addition is defined identically, but for which $x dot^"op" y := y dot x$ where $dot$ is multiplciation in $R$ and $dot^"op"$ is the multiplication in $R^"op"$. Take $R$ as a left $R$-module and show that $"Hom"_(R-"Mod")(R,R)$ is isomorphic to $R^"op"$ as a ring. #solution[ #let hom = $"Hom"_(R-"Mod")(R,R)$ #let op = "op" Consider an element $f$ in $hom$, it must follows the module property. That is $ forall r_1, r_2 in R: r_1 f(r_2) = f(r_1 r_2) => f(r_1) = f(r_1 dot 1) = r_1 f(1) $ Therefore, $f$ can only have one form $f_r (r') = r' r$. Then the map $psi: R -> hom$ by sending $r arrow.bar f_r$. This map is clearly both injective and surjective. Consider the map $phi: hom -> R^op$ that maps $f_r$ to $r$ in $R^op$. Because it is the inverse of $psi$ in the underlying set, it is injective and surjective, and thus a isomorphism. ] #[ #let op = [op] #let Mat = "Mat" Show that if $R = Mat_(n times n) (k)$ is the ring of $n times n$ matrices with entries in a field $k$, then $R^op cong R$ where the isomorphism is given by sending a matrix to its transpose. ] #solution[ This map is a clearly bijection on the underlying set. The only thing left to check it is a homomorphism. $ f(A+B) = (A+B)^T = A^T + B^T\ f(A B) = (B A)^T = A^T B^T = f(A)f(B) $ ]
https://github.com/pku-typst/meppp
https://raw.githubusercontent.com/pku-typst/meppp/main/template/main.typ
typst
MIT License
#import ("@preview/meppp:0.2.1"): * #let abstract = [ 这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。这是摘要。 ] #show: doc => meppp-lab-report( title: "这是实验标题", author: "我是作者", info: "这是作者信息", abstract: abstract, keywords: ( "this is keyword1", "this is keyword2", ), author-footnote: [<EMAIL>; +86 11451419198], doc, ) = 引言 这是引言。这是引言。这是引言。这是引言。这是引言。这是引言。这是引言。这是引言。这是引言。这是引言。 = 实验装置 这是实验装置。这是实验装置。这是实验装置。这是实验装置。这是实验装置。这是实验装置。这是实验装置。这是实验装置。这是实验装置。这是实验装置。这是实验装置。 == 第一个实验装置 #figure(image("example_fig.png"), caption: [这是第一个实验装置的示意图])<img> 第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。第一个实验装置。 = 结果与讨论 结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。这是结果与讨论。 #figure( grid( gutter: 15pt, columns: 2, subfigure(pku-logo()), subfigure(pku-logo()), subfigure(pku-logo()), subfigure(pku-logo()), ), caption: [logos], ) #meppp-tl-table( table( columns: 4, rows: 2, table.header([Item1], [Item2], [Item3], [Item4]), [Data1], [Data2], [Data3], [Data4], ), ) #lorem(80) = 结论 这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。这是结论。 @kopka2004guide = 致谢 #lorem(40) #bibliography("example_ref.bib")
https://github.com/SergeyGorchakov/russian-phd-thesis-template-typst
https://raw.githubusercontent.com/SergeyGorchakov/russian-phd-thesis-template-typst/main/parts/appendix.typ
typst
MIT License
#import "../lib.typ": * #show: phd-appendix = Примеры вставки листингов программного кода <app:A> #figure( [```rust pub fn main() { println!("Hello, world!"); } ```], caption: [Листинг программного кода на языке программирования Rust] ) #figure( [```python def fibonaci(n): if n <= 1: return n else: return(fibonaci(n-1) + fibonaci(n-2)) ```], caption: [Листинг программного кода на языке программирования Python] ) = Очень длинное название второго приложения, в~котором продемонстрирована работа с~длинными таблицами <app:B> == Подраздел приложения <app:B2> #figure( table( columns: (1fr,1fr,1fr,1fr,), table.header([*Заголовок 1*],[*Заголовок 2*], [*Заголовок 3*],[*Заголовок 4*],), ..for x in range(1,50){ ([#x],[#x],[#x],[#x],) } ), caption: [Очень длинное название таблицы] )
https://github.com/crystalsolenoid/typst-resume-template
https://raw.githubusercontent.com/crystalsolenoid/typst-resume-template/main/src/items.typ
typst
#let text-rootSite = "example.com/projects" #let rootSite = "https://" + text-rootSite #let email = "<EMAIL>" #let githubHandle = "example" #let linkedin = "linkedin.com/in/example-1234" #let projectURL(is-text, slug) = { if is-text == false { if slug == none { rootSite + "/" } else { rootSite + "/" + slug + "/" } } else { if slug == none { text-rootSite } else { text-rootSite + "/" + slug } } } #let website = ( title: "Portfolio", url: projectURL(false, none), text-url: projectURL(true, none), icon: "folder.svg", ) #let email = ( title: "Email", url: "mailto:" + email, text-url: email, icon: "envelope.svg", ) #let github = ( title: "GitHub", url: "https://github.com/" + githubHandle, text-url: "github.com/" + githubHandle, icon: "github.svg", ) #let linkedin = ( title: "LinkedIn", url: "https://www." + linkedin, text-url: linkedin, icon: "linkedin.svg", ) #let example-project = ( title: [Lancer Almanacs], url: projectURL(false, "my-project"), text-url: projectURL(true, "my-project"), date: [1668 - 1678], description: [ Analyzed the Lancer farmers' almanac over ten years. ], technology: [ in Rust ], details: ( [ Compared accuracy against actual weather patterns. ], ), ) #let school = ( title: [Master of Magic in Recent Runes], organization: [the Unseen University], location: [Ankh-Morpork], dates: [1657 - 1665], details: ( [President of the Ancient Runes Study Society.], ) ) #let example-position = ( department: [Department of Non-Evil Advisors], organization: [Kingdom of Genua], title: [Grand Vizier], location: [Genua], dates: [1666 - Present], show-detail: true, details: ( [Facilitated a 10% increase in crop yields.], [Guided the organization through a period of instability, leading to a gain in productivity over two years.], ) )
https://github.com/francescoo22/masters-thesis
https://raw.githubusercontent.com/francescoo22/masters-thesis/main/chapters/7-Conclusion.typ
typst
#pagebreak(to:"odd") = Conclusion<cap:conclusion> == Results This thesis has introduced a novel uniqueness system for the Kotlin language, bringing several important improvements over existing approaches @aldrich2002alias @boyland2001alias @zimmerman2023latte. The system provides improved flexibility in managing field accesses, particularly in handling nested properties within Kotlin programs. It allows the correct permissions for nested field accesses to be determined at any point of the program, without imposing any restrictions based on whether properties are unique, shared, or inaccessible. Furthermore, the uniqueness of properties can evolve during program execution, similarly to variables. The system also introduces a clear distinction between borrowed-shared and borrowed-unique references, making it easier to integrate uniqueness annotations into existing codebases. Indeed, one of its key benefits is the ability to be adopted incrementally, enabling developers to incorporate it into their Kotlin code without the need for significant changes. The uniqueness system has been rigorously formalized, detailing the rules and constraints necessary to ensure that unique references are properly maintained within a program. Finally, this work has demonstrated how the uniqueness system can be used to encode Kotlin into Viper more precisely, enabling more accurate and reliable verification of Kotlin programs. == Future Work === Extending the Language Extending the range of Kotlin features supported by the annotation system is a natural next step for this work. One area for extension is support for `while` loops. Currently, loops are not well supported by SnaKt due to the lack of support for inferring invariants. As a result, handling loops was not a primary focus for the uniqueness system. Lambdas are another important feature in Kotlin that the uniqueness system must support. Lambdas often capture references through closures, which presents challenges for maintaining uniqueness. Handling these references correctly requires careful tracking to ensure that the captured variables do not lead to unintended aliasing. Bao et al. @reachability-types have proposed a system for tracking aliasing in higher-order functional programs, which could provide valuable insights for addressing these challenges. === Improving Borrowed Fields Flexibility Currently, fields of borrowed parameters are subject to restrictions necessary for ensuring system soundness when unique references are passed to functions expecting shared borrowed parameters. Specifically, borrowed fields can only be reassigned using a unique reference. However, in some cases, allowing reassignment with shared references would also be safe. Similarly, borrowed fields become inaccessible after being read, even though there are situations where they could safely remain shared. Introducing rules to manage these scenarios would enhance the system's flexibility in handling borrowed fields, representing a significant improvement. === Tracking of Local Aliases The uniqueness system proposed by Zimmerman et al. @zimmerman2023latte guarantees the following uniqueness invariant: "A unique object is stored at most once on the heap. In addition, all usable references to a unique object from the local environment are precisely inferred." This invariant allows for the creation of local aliases of unique objects without compromising their uniqueness. In contrast, the uniqueness system proposed in this work takes a different approach. When local aliases are created, the original reference becomes inaccessible, and the local alias is treated as unique. This design choice prioritizes flexibility in the usage of paths while maintaining simplicity in the typing rules. However, there is potential for future improvements to the system. By refining the existing rules, it may be possible to achieve a uniqueness invariant that allows the creation of controlled aliases without losing the guarantees of uniqueness. Such an enhancement would expand the range of Kotlin code supported by the system while preserving the integrity of uniqueness guarantees. === Checking Annotations This work presents a uniqueness system and shows how it can be used to verify Kotlin code by encoding it into Viper. Currently, SnaKt assumes that any annotated Kotlin program is well-typed according to the typing rules presented in @cap:annotation-system. To improve the system, a static checker is under development. This checker will use Kotlin's control flow graph to ensure that the annotations satisfy the typing rules of the uniqueness system. By integrating this static analysis, SnaKt will start to encode Kotlin into Viper only if the program is well-typed, reducing the need for manual validation and increasing the reliability of the verification process. === Proving the Soundness of the Annotation System Another area for future work is proving the soundness of the proposed annotation system. Establishing soundness would involve formally demonstrating that the system's rules and annotations prevent illegal aliasing and correctly track ownership throughout program execution. For instance, it would be important to prove that when a path is unique at any given point in the program, no other accessible paths point to the same object as that path. Additionally, it would be valuable to demonstrate that borrowed parameters are not further aliased by any function, ensuring that the borrowing mechanism preserves the integrity of reference uniqueness and prevents unintended aliasing.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-16100.typ
typst
Apache License 2.0
#let data = ( ("GURUNG KHEMA LETTER A", "Lo", 0), ("GURUNG KHEMA LETTER KA", "Lo", 0), ("GURUNG KHEMA LETTER KHA", "Lo", 0), ("GURUNG KHEMA LETTER GA", "Lo", 0), ("GURUNG KHEMA LETTER GHA", "Lo", 0), ("GURUNG KHEMA LETTER NGA", "Lo", 0), ("GURUNG KHEMA LETTER CA", "Lo", 0), ("GURUNG KHEMA LETTER CHA", "Lo", 0), ("GURUNG KHEMA LETTER JA", "Lo", 0), ("GURUNG KHEMA LETTER JHA", "Lo", 0), ("GURUNG KHEMA LETTER HA", "Lo", 0), ("GURUNG KHEMA LETTER TTA", "Lo", 0), ("GURUNG KHEMA LETTER TTHA", "Lo", 0), ("GURUNG KHEMA LETTER DDA", "Lo", 0), ("GURUNG KHEMA LETTER DDHA", "Lo", 0), ("GURUNG KHEMA LETTER VA", "Lo", 0), ("GURUNG KHEMA LETTER TA", "Lo", 0), ("GURUNG KHEMA LETTER THA", "Lo", 0), ("GURUNG KHEMA LETTER DA", "Lo", 0), ("GURUNG KHEMA LETTER DHA", "Lo", 0), ("GURUNG KHEMA LETTER NA", "Lo", 0), ("GURUNG KHEMA LETTER PA", "Lo", 0), ("GURUNG KHEMA LETTER PHA", "Lo", 0), ("GURUNG KHEMA LETTER BA", "Lo", 0), ("GURUNG KHEMA LETTER BHA", "Lo", 0), ("GURUNG KHEMA LETTER MA", "Lo", 0), ("GURUNG KHEMA LETTER YA", "Lo", 0), ("GURUNG KHEMA LETTER RA", "Lo", 0), ("GURUNG KHEMA LETTER LA", "Lo", 0), ("GURUNG KHEMA LETTER SA", "Lo", 0), ("GURUNG KHEMA VOWEL SIGN AA", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN I", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN II", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN U", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN UU", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN E", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN EE", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN AI", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN O", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN OO", "Mn", 0), ("GURUNG KHEMA VOWEL SIGN AU", "Mn", 0), ("GURUNG KHEMA VOWEL LENGTH MARK", "Mn", 0), ("GURUNG KHEMA CONSONANT SIGN MEDIAL YA", "Mc", 0), ("GURUNG KHEMA CONSONANT SIGN MEDIAL VA", "Mc", 0), ("GURUNG KHEMA CONSONANT SIGN MEDIAL HA", "Mc", 0), ("GURUNG KHEMA SIGN ANUSVARA", "Mn", 0), ("GURUNG KHEMA CONSONANT SIGN MEDIAL RA", "Mn", 0), ("GURUNG KHEMA SIGN THOLHOMA", "Mn", 9), ("GURUNG KHEMA DIGIT ZERO", "Nd", 0), ("GURUNG KHEMA DIGIT ONE", "Nd", 0), ("GURUNG KHEMA DIGIT TWO", "Nd", 0), ("GURUNG KHEMA DIGIT THREE", "Nd", 0), ("GURUNG KHEMA DIGIT FOUR", "Nd", 0), ("GURUNG KHEMA DIGIT FIVE", "Nd", 0), ("GURUNG KHEMA DIGIT SIX", "Nd", 0), ("GURUNG KHEMA DIGIT SEVEN", "Nd", 0), ("GURUNG KHEMA DIGIT EIGHT", "Nd", 0), ("GURUNG KHEMA DIGIT NINE", "Nd", 0), )
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/polylux/book/src/dynamic/rule-string.typ
typst
#import "../../../polylux.typ": * #set page(paper: "presentation-16-9") #set text(size: 40pt) #polylux-slide[ #uncover("-2, 4, 6-8, 10-")[polylux] ]
https://github.com/metamuffin/typst
https://raw.githubusercontent.com/metamuffin/typst/main/docs/src/guides/welcome.md
markdown
Apache License 2.0
--- description: Guides for Typst. --- # Guides Welcome to the Guides section! Here, you'll find helpful material for specific user groups or use cases. Currently, one guide is available: An introduction to Typst for LaTeX users. Feel free to propose other topics for guides! ## List of Guides { #list-of-guides } - [Guide for LaTeX users]($guides/guide-for-latex-users)
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/template/components.typ
typst
Other
#import "@preview/book:0.2.5": cross-link as web-cross-link #import "theme.typ": theme #import "util.typ" #let note = body => block( breakable: true, stroke: (left: 5pt + gray), outset: (left: -2.5pt), inset: (left: 10pt, rest: 5pt), text(fill: theme.note, body) ) #let hr(above: none, bellow: none, color: theme.main) = [ #if above != none { v(above) } #line(length: 100%, stroke: 0.4pt + color) #if bellow != none { v(bellow) } ] #let cross-ref(target, supplement: auto, web-path: none, web-content: none) = locate( loc => { if util.is-web-target() { web-cross-link(web-path, web-content, reference: target) } else { // TODO: remove fallback when all pages are ready let elem = query(target, loc) if elem.len() > 0 { ref(target, supplement: supplement) } else { text(fill: red)[Unknown label <#str(target)>] } } }) #let cross-link(target, content, web-path: none) = locate(loc => { if util.is-web-target() { web-cross-link(web-path, content, reference: target) } else { link(target, content) } }) #let title-ref(target, web-path: none, web-content: none) = locate(loc => { if util.is-web-target() { web-cross-link(web-path, web-content, reference: target) } else { let heads = query(target, loc); if heads.len() == 0 { return [Unknown title] } let head = heads.at(0) if head.func() != heading { panic("only ref to heading, found " + head.func()) } link(target)[#head.body] } })
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/numbering.md
markdown
MIT License
# Numbering ## Individual heading without numbering ```typ #let numless(it) = {set heading(numbering: none); it } = Heading #numless[=No numbering heading] ``` ## "Clean" numbering ```typ // original author: tromboneher // Number sections according to a number of schemes, omitting previous leading elements. // For example, where the numbering pattern "A.I.1." would produce: // // A. A part of the story // A.I. A chapter // A.II. Another chapter // A.II.1. A section // A.II.1.a. A subsection // A.II.1.b. Another subsection // A.II.2. Another section // B. Another part of the story // B.I. A chapter in the second part // B.II. Another chapter in the second part // // clean_numbering("A.", "I.", "1.a.") would produce: // // A. A part of the story // I. A chapter // II. Another chapter // 1. A section // 1.a. A subsection // 1.b. Another subsection // 2. Another section // B. Another part of the story // I. A chapter in the second part // II. Another chapter in the second part // #let clean_numbering(..schemes) = { (..nums) => { let (section, ..subsections) = nums.pos() let (section_scheme, ..subschemes) = schemes.pos() if subsections.len() == 0 { numbering(section_scheme, section) } else if subschemes.len() == 0 { numbering(section_scheme, ..nums.pos()) } else { clean_numbering(..subschemes)(..subsections) } } } #set heading(numbering: clean_numbering("A.", "I.", "1.a.")) = Part == Chapter == Another chapter === Section ==== Subsection ==== Another subsection = Another part of the story == A chapter in the second part == Another chapter in the second part ``` ## Math numbering See [there](./math/numbering.md). ## Numbering each paragraph <div class="warning"> By the 0.12 version of Typst, this should be replaced with good native solution. <div> ```typ // original author: roehlichA // Legal formatting of enumeration #show enum: it => context { // Retrieve the last heading so we know what level to step at let headings = query(selector(heading).before(here())) let last = headings.at(-1) // Combine the output items let output = () for item in it.children { output.push([ #context{ counter(heading).step(level: last.level + 1) } #context { counter(heading).display() } ]) output.push([ #text(item.body) #parbreak() ]) } // Display in a grid grid( columns: (auto, 1fr), column-gutter: 1em, row-gutter: 1em, ..output ) } #set heading(numbering: "1.") = Some heading + Paragraph = Other + Paragraphs here are preceded with a number so they can be referenced directly. + _#lorem(100)_ + _#lorem(100)_ == A subheading + Paragraphs are also numbered correctly in subheadings. + _#lorem(50)_ + _#lorem(50)_ ```
https://github.com/lucifer1004/leetcode.typ
https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/solutions/s0012.typ
typst
#import "../helpers.typ": * // This problem is an excellent example where the stdlib can greatly save our effort #let integer-to-roman-ref(num) = { numbering("I", num) }
https://github.com/Jollywatt/typst-fletcher
https://raw.githubusercontent.com/Jollywatt/typst-fletcher/master/docs/gallery/commutative.typ
typst
MIT License
#import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge #set page(width: auto, height: auto, margin: 5mm, fill: white) #diagram( spacing: (1em, 3em), $ & tau^* (bold(A B)^n R slash.double R^times) edge(->) & bold(B)^n R slash.double R^times \ X edge("ur", "-->") edge("=") & X edge(->, tau) edge("u", <-) & bold(B) R^times edge("u", <-) $, edge((2,1), "d,ll,u", "->>", text(blue, $Gamma^*_R$), stroke: blue, label-side: center) )
https://github.com/benjft/CV
https://raw.githubusercontent.com/benjft/CV/master/projects.typ
typst
== Personal Projects === ProcVis _(TypeScript; HTML; Sass)_ #link("https://www.benjft.uk/ProcVis")[`benjft.uk/ProcVis`] #linebreak() A web app to teach computer architecture. - Designed and implemented an emulator for a Von Neumann processor. - Created a simple instruction set for programming the processor. - Emulated the processor entirely in the browser with a user interface. - Visualised the internal processes of the processor. - Aimed to make computer architecture learning interactive and intuitive. - *Skills:* UI/UX Design, Educational Technology === Locksley _(C\#; .Net MAUI; Go)_ A mobile app for tracking personal scores, handicaps, and grouping statistics in archery. - Features both a client app and an API. - Can be used to organise tournaments and shares scores/challenges. - *Skills:* API Development, Mobile Development, Data Management === ScanSolver _(Python)_ A tool designed to find optimal (fastest) orbits for ground scanning satellites in Kerbal Space Program. - Implemented a numerical method to search for valid solutions. - Efficiently homed in on solutions as the problem was not fully solvable algebraically. - *Skills:* Algorithm Development, Simulation, Optimization Techniques === GreenFinger _(C++; Arduino)_ CovHack 2021 submission, won 1st place. - Greenhouse automation robot that monitors soil moisture levels and waters plants as needed. - Configurable through a locally broadcasted website. - Allows different zones to have varying thresholds set up easily. - Displays a history of statistics (temperature, water levels, etc.). - *Skills:* IoT (Internet of Things), Web Development, Data Logging and Analysis === DLA-SimTool _(Go)_ A tool written to study lattice bound diffusion limited aggregation (DLA). - Used monte-carlo techniques to simulate DLA. - Characterised the properties of the resulting cluster. - Studied higher dimensional aggregates. - Analyzed how the fractal properties of the structure change with dimensionality. - *Skills:* Statistical Analysis, Scientific Computing === ActiveMatterTool _(Java)_ A tool to analyze the behaviour of "soft active matter" through simulation. - Used monte-carlo techniques to simulate a tiled section of space. - Captured behavioural changes in the simulated active matter as particle density increases. - *Skills:* Physics Simulation, Computational Physics
https://github.com/jerrita/CQUPTypst
https://raw.githubusercontent.com/jerrita/CQUPTypst/master/chapters/tail.typ
typst
#let chapter_tail = [ = 致谢 致谢二字一级标题:黑体3号字居中,段前17磅,段后16.5磅,1.5倍行距,致谢二字与致谢内容之间不空行。致谢内容正文样式:宋体小四号,1.5倍行距。 可以从下列方面致谢:协助完成研究工作和提供便利条件的组织或个人;在研究工作中提出建议和提供帮助的人;给予转载和引用权的资料、图片、文献、研究思想和设想的所有者;其他应感谢的组织或个人。 主要感谢导师和对论文工作有直接贡献及帮助的人士和单位。学位申请人的家属及亲朋好友等与论文无直接关系的人员,一般不列入致谢的范围。 致谢辞应谦虚诚恳,实事求是,切忌浮夸与庸俗之词。 #pagebreak() = 参考文献 // yml 格式如下 (你也可以使用 `.bib`) // https://github.com/typst/hayagriva/blob/main/docs/file-format.md #bibliography("../refs.yml", title: none) #pagebreak() = 附录 #lorem(50) ]
https://github.com/daskol/typstd
https://raw.githubusercontent.com/daskol/typstd/main/doc/main.typ
typst
Apache License 2.0
#import "template.typ": * #import "@preview/tablex:0.0.7": * #set text(font: "Times New Roman") #let lsp = smallcaps[LSP] #let typst = smallcaps[Typst] = Overview == Initialization In fact #typst and #lsp share the same elements of architecture. The most important one is an abstraction of document/source synchronization. #bibliography("main.bib") #include "subsection.typ" @hu2021lora
https://github.com/konceptosociala/FunctionGraph
https://raw.githubusercontent.com/konceptosociala/FunctionGraph/main/report.typ
typst
#import "@preview/bubble:0.1.0": * #show: bubble.with( title: "Program \"Graph of a function\"", subtitle: "Educational practice", author: "<NAME>", affiliation: "National University of Kyiv-Mohyla Academy", date: "13.05.2024", year: "2024", logo: image("report/logo-NaUKMA.png"), ) #set text(lang: "en") #set heading(numbering: "1.") #set figure.caption(position: bottom) #outline(title: "Table of contents") #outline(title: "List of figures", target: figure) #pagebreak() = Formulation of the problem - Analyze a function using Excel. Build a table of initial data and a graph of your function. - Write a program that builds a graph of a given function. Requirements for the program, mandatory functionality: 1. Ability to set initial data, range and step. 2. Saving the graph to a file. 3. The program window contains the name of the graph, its formula and author. #figure( align(center)[#image("report/graph_task1.png", width: 100%)], caption: [Graph №6 task] ) = Problem analysis For the correct solving of the problem we used an open-source spreadsheet editor LibreOffice Calc to analyze function data and build a corresponding graph with the given parameters and mathematical formula. This gave us an understanding of the details of the construction of this graph and its properties, as well as the actual understanding of the construction of graphs in the Cartesian coordinate system. #figure( align(center)[#image("report/graph_task2.png", width: 80%)], caption: [Graph data, analyzed in LibreOffice Calc] ) = Program structure The program has been built using *Swing* framework with custom components, built on-top of *JPanel*, *JSpinner*, *JButton* and other Swing basic components #figure( align(center)[#image("report/FunctionGraph.svg", width: 80%)], caption: [Basic program interface] ) = Description of methods and classes == Main class - *FunctionGraphApp*: This is the main class that launches the application. It creates the main window and adds all the necessary components. == UI components - *ChartPanel*: This class is responsible for displaying the function graph. It uses a XChart library to plot the graph based on the provided data. - *FormulaPanel*: This panel displays the formula of the function. It typically includes labels to show the function equation. - *ParamSpinner*: This component allows users to input the initial data for the function, such as coefficients or constants. It is typically implemented as a spinner for easy adjustment of numerical values. - *RangeSpinner*: This component allows users to set the range of the x-axis for the function graph. It includes spinners for setting the minimum and maximum values of the range. - *ControlPanel*: Group panel for Formula and Controls - *SaveButton*: This button enables the user to save the displayed graph to a file. When clicked, it triggers the functionality to export the graph as an image file. - *SettingsPanel*: This panel groups together all the controls for user input, including ParamSpinner, RangeSpinner, and SaveButton. It provides a user interface for setting the function parameters and range. - *PanelBorder*: This utility class is used to add borders and styling to panels. It helps in organizing the layout and improving the visual appearance of the application. == Utility Classes - *FunctionGraph*: This utility class contains the logic for computing the function values based on the given parameters, range, and step size. It provides methods to generate data points that are then plotted by ChartPanel. It provides method `rebuild`, which helps to rebuild the graph according to defined parameters `Params` - *Params*: This class represents the parameters for the function. It stores values such as coefficients, range, and step size, and provides methods to retrieve and update these values. It extends `Hashmap<String, Double>` class, so it provides the same methods `get`, `put` and `remove` #pagebreak() = User manual with illustrations Here is a simple instruction for using the program: #figure( align(center)[#image("report/screen1.svg", width: 80%)], caption: [Basic program interface] ) 1. *Formula panel*, where the formula, on-top of which the graph is built, is stored 2. *Settings panel*, where you can set parameters _a_ and _b_, _t_ range and _step_, which indicates graph rendering precision. Here is an example of the graph with modified parameters: #figure( align(center)[#image("report/screen2.png", width: 80%)], caption: [Rendered graph with modified parameters] ) 3. *"Save image" button*, which helps you to save your results to `png` file using saving dialog: #figure( align(center)[#image("report/screen3.png", width: 70%)], caption: [Graph image save dialog] ) 4. *Chart panel*, where the graph is being rendered 5. *Author panel*, which displays the program author and the copyright = Conclusion The experiment involved developing a graphics program that renders a graph based on a given mathematical function. The program, built using the Swing framework, offers a comprehensive user interface for setting function parameters and visualizing the resulting graph. Key functionalities include the ability to set initial data, specify the range and step size for the function, and save the graph as an image file. == Key Achievements - *Graph Rendering*: The program successfully renders graphs based on user-defined parameters. The use of the XChart library in the ChartPanel component ensures high-quality graph plotting. - *User Interface*: The application features a well-organized interface with separate panels for formula display, parameter input, and graph visualization. The SettingsPanel efficiently groups controls for adjusting function parameters and graph range. - *Dynamic Updates*: The program allows real-time updates to the graph as users modify parameters, thanks to the integration of ParamSpinner and RangeSpinner components with change listeners. - *Graph Saving*: Users can save the rendered graph as a `png` file, facilitated by the SaveButton component and the BitmapEncoder from the XChart library. == Challenges - *Parameter Handling*: Ensuring the correctness of user inputs and dynamically updating the graph without performance issues was a crucial aspect that required careful management of event listeners and a rendering pipeline. - *UI Layout*: Designing an intuitive and aesthetically pleasing layout involved several iterations to balance functionality and user experience, particularly in grouping controls and managing screen real estate using Swing library. == Future Enhancements - *Function Flexibility*: Extending the program to support a wider variety of mathematical functions would increase its applicability. - *Customization Options*: Adding more customization options for the graph's appearance, such as colors, line styles, and grid options, would enhance user control. - *Error Handling*: Improving error handling, especially for user input validation, would make the program more robust and user-friendly. Overall, the project successfully met its objectives, creating a functional and user-friendly program for graph rendering. It provides a solid foundation for further development and enhancement in future iterations. = Software code listing == `FunctionGraphApp` ```java package org.konceptosociala.function_graph; import java.awt.*; import javax.swing.*; import lombok.*; import com.formdev.flatlaf.intellijthemes.*; import org.konceptosociala.function_graph.components.*; import org.konceptosociala.function_graph.utils.*; public class FunctionGraphApp extends JFrame { @Getter Params params = new Params(); @Getter FunctionGraph chart = new FunctionGraph(Color.decode("#F5F5F5")); public FunctionGraphApp() { initApp(); add(new ControlPanel(this), BorderLayout.EAST); add(new ChartPanel(this, "<NAME>"), BorderLayout.CENTER); } private void initApp() { FlatArcOrangeIJTheme.setup(); setTitle("Function graph №6"); setSize(800, 600); setResizable(false); setLocationRelativeTo(null); setLayout(new BorderLayout()); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void rebuildChart() { chart.rebuild(params); revalidate(); repaint(); } public static void main(String[] args) { FunctionGraphApp app = new FunctionGraphApp(); app.setVisible(true); } } ``` == Components === `ChartPanel` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; import java.awt.*; import org.knowm.xchart.XChartPanel; import org.knowm.xchart.XYChart; import org.konceptosociala.function_graph.FunctionGraphApp; public class ChartPanel extends JPanel { public ChartPanel(FunctionGraphApp application, String author) { setLayout(new BorderLayout()); setBorder(new PanelBorder("Graph", 5)); XChartPanel<XYChart> xChartPanel = new XChartPanel<>(application.getChart()); add(xChartPanel, BorderLayout.CENTER); application.rebuildChart(); JPanel authorPanel = new JPanel(); authorPanel.setBorder(new PanelBorder("Author", 0)); authorPanel.add(new JLabel(author+" © 2024")); add(authorPanel, BorderLayout.SOUTH); } } ``` === `ControlPanel` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; import java.awt.*; import org.konceptosociala.function_graph.FunctionGraphApp; public class ControlPanel extends JPanel { public ControlPanel(FunctionGraphApp application) { setLayout(new BorderLayout()); add( new FormulaPanel(new String[]{ "x = (a + b) * cos(t) – b * cos((a / b + 1) * t)", "y = (a + b) * sin(t) – b * sin((a / b + 1) * t)" }), BorderLayout.NORTH ); add(new SettingsPanel(application), BorderLayout.CENTER); } } ``` === `FormulaPanel` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; public class FormulaPanel extends JPanel { public FormulaPanel(String[] formulas) { setBorder(new PanelBorder("Formula", 5)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); for (String formula : formulas) { add(new JLabel(formula)); } } } ``` === `PanelBorder` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; import javax.swing.border.*; public class PanelBorder extends CompoundBorder { public PanelBorder(String title, int padding) { super( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), title ), BorderFactory.createEmptyBorder(padding, padding, padding, padding) ); } } ``` === `ParamSpinner` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; import javax.swing.event.*; import java.awt.*; import org.konceptosociala.function_graph.FunctionGraphApp; public class ParamSpinner extends JPanel { public ParamSpinner( FunctionGraphApp application, String label, String paramName, SpinnerNumberModel model ){ setLayout(new FlowLayout(FlowLayout.LEFT)); add(new JLabel(label)); JSpinner spinner = new JSpinner(); spinner.setModel(model); spinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { application.getParams().replace(paramName, (double)spinner.getValue()); application.rebuildChart(); } }); add(spinner); } } ``` === `RangeSpinner` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; import javax.swing.event.*; import java.awt.*; import org.konceptosociala.function_graph.FunctionGraphApp; public class RangeSpinner extends JPanel { public RangeSpinner( FunctionGraphApp application, String labelFrom, String labelTo, String paramNameFrom, String paramNameTo, SpinnerNumberModel modelFrom, SpinnerNumberModel modelTo ){ setLayout(new FlowLayout(FlowLayout.LEFT)); add(new JLabel(labelFrom)); JSpinner spinnerFrom = new JSpinner(); spinnerFrom.setModel(modelFrom); spinnerFrom.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { application.getParams().replace(paramNameFrom, (double)spinnerFrom.getValue()); application.rebuildChart(); } }); add(spinnerFrom); add(new JLabel(labelTo)); JSpinner spinnerTo = new JSpinner(); spinnerTo.setModel(modelTo); spinnerTo.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { application.getParams().replace(paramNameTo, (double)spinnerTo.getValue()); application.rebuildChart(); } }); add(spinnerTo); } } ``` === `SaveButton` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; import org.knowm.xchart.BitmapEncoder; import org.knowm.xchart.XYChart; import org.knowm.xchart.BitmapEncoder.BitmapFormat; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; public class SaveButton extends JButton { public SaveButton(String label, XYChart chart) { setText(label); addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new File(System.getProperty("user.home"))); int retrival = chooser.showSaveDialog(null); if (retrival == JFileChooser.APPROVE_OPTION) { try { BitmapEncoder.saveBitmap(chart, chooser.getSelectedFile().getAbsolutePath()+".png", BitmapFormat.PNG); JOptionPane.showMessageDialog(null, "Image successfully saved!", "Success", JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { JOptionPane.showMessageDialog(null, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }); } } ``` === `SettingsPanel` ```java package org.konceptosociala.function_graph.components; import javax.swing.*; import java.awt.*; import org.konceptosociala.function_graph.FunctionGraphApp; public class SettingsPanel extends JPanel { public SettingsPanel(FunctionGraphApp application) { setBorder(new PanelBorder("Controls", 5)); setLayout(new BorderLayout()); Box box = Box.createVerticalBox(); box.add(new ParamSpinner( application, "Parameter a", "a", new SpinnerNumberModel( application.getParams().get("a"), null, null, 0.01 ) )); box.add(new ParamSpinner( application, "Parameter b", "b", new SpinnerNumberModel( application.getParams().get("b"), null, null, 0.01 ) )); box.add(new RangeSpinner( application, "Min t", "Max t", "tMin", "tMax", new SpinnerNumberModel( application.getParams().get("tMin"), null, null, 0.1 ), new SpinnerNumberModel( application.getParams().get("tMax"), null, null, 0.1 ) )); box.add(new ParamSpinner( application, "Step", "step", new SpinnerNumberModel( application.getParams().get("step").doubleValue(), 0.01, 10.0, 0.01 ) )); add(box, BorderLayout.NORTH); add(new SaveButton("Save image", application.getChart()), BorderLayout.SOUTH); } } ``` == Utils === `FunctionGraph` ```java package org.konceptosociala.function_graph.utils; import static java.lang.Math.*; import java.util.ArrayList; import java.awt.*; import org.knowm.xchart.XYChart; import org.knowm.xchart.XYSeries; import org.knowm.xchart.style.markers.SeriesMarkers; public class FunctionGraph extends XYChart { public FunctionGraph(Color bgColor) { super(0, 0); getStyler().setChartBackgroundColor(bgColor); getStyler().setLegendVisible(false); getStyler().setChartTitleVisible(false); getStyler().setAxisTitlesVisible(false); XYSeries series = addSeries("graph", new double[1], new double[1]); series.setMarker(SeriesMarkers.NONE); } public void rebuild(Params params) { var xData = new ArrayList<Double>(); var yData = new ArrayList<Double>(); var a = params.get("a"); var b = params.get("b"); var tMin = params.get("tMin"); var tMax = params.get("tMax"); var step = params.get("step"); for (double t = tMin; t < tMax; t += step) { double x = (a + b) * cos(t) - b * cos((a / b + 1) * t); double y = (a + b) * sin(t) - b * sin((a / b + 1) * t); xData.add(x); yData.add(y); } updateXYSeries("graph", xData, yData, null); } } ``` === `Params` ```java package org.konceptosociala.function_graph.utils; import java.util.HashMap; public class Params extends HashMap<String, Double> { public Params() { put("a", 4.23); put("b", 2.35); put("tMin", -15.0); put("tMax", 20.0); put("step", 0.1); } } ```
https://github.com/jamesrswift/musicaux
https://raw.githubusercontent.com/jamesrswift/musicaux/main/src/commands/bars.typ
typst
#import "basic-content.typ": basic-content #import "../symbols.typ": * // Clefs // TO DO: Move to separate service that handles tune's key #let single = basic-content.with(pitch: 3, symbols.bar) #let dotted = basic-content.with(pitch: 3, symbols.bar.dotted) #let double = basic-content.with(pitch: 3, symbols.bar.double) #let double-bold-open = basic-content.with(pitch: 3, symbols.bar.double.bold.reverse) #let double-bold-close = basic-content.with(pitch: 3, symbols.bar.double.bold)
https://github.com/SkiFire13/master-thesis
https://raw.githubusercontent.com/SkiFire13/master-thesis/master/chapters/background/7-strategy-improvement.typ
typst
#import "../../config/common.typ": * #import "@preview/algorithmic:0.1.0" == Local strategy iteration === Strategy iteration Strategy iteration @jurdzinski_improvement is one of the oldest algorithms that computes the winning sets and the optimal strategies for the two players of a bipartite and total parity game. The algorithm starts with a strategy for player 0 and repeats _valuation_ phases, during which it computes a _play profile_ for each vertex, and _improvement_ phases, during which it uses such play profiles to improve the strategy. This continues until the strategy can no longer be improved, at which point it is guaranteed to be optimal. We will start introducing some concepts that will help characterize how favorable a vertex is for a given player. We will start by giving the definition of a _relevance ordering_, which is a total order over the vertices where bigger vertices correspond to bigger priorities. This will be important in determining which vertices are more impactful on the winner of a play. We then define the sets of _positive and negative vertices_, which are a different way to partition the set of vertices. In particular the set of positive vertices contains vertices whose priority is even, and thus more favorable to player 0, while the negative vertices will be those with odd priority. We also introduce a _reward ordering_, which instead expresses how favorable to player 0 a vertex is. In particular a positive vertex has a bigger reward than a negative one. Positive vertices are also more rewarding if they have a bigger priority, while negative vertices are less rewarding in that case. Finally, the reward ordering is extended to sets of vertices, where the reward of the most relevant vertex decides which set is more rewarding. #definition("relevance ordering")[ Let $G = (V_0, V_1, E, p)$ be a parity game. A relevance ordering $<$ is a total order that extends the partial order induced by the $p$ function. In particular $<$ is such that $forall u, v. p(u) < p(v) => u < v$. ] It should be noted that in general multiple relevance orderings can exist for a given parity game, and usually an arbitrary one can be picked. The specific choice can affect the efficiency, but it is currently unclear how different choices impact on efficiency and if some heuristic can be devised to guide this choice. #definition("positive and negative vertices")[ Let $G = (V_0, V_1, E, p)$ be a parity game. We define $V_+ = { v in V | p(v) "is even" }$ and $V_- = { v in V | p(v) "is odd" }$. ] #definition("reward ordering")[ Let $G = (V_0, V_1, E, p)$ be a parity game with a relevance ordering $<$, and let $v, u in V$. We write $u rwlt v$ when $u < v$ and $v in V_+$ or $v < u$ and $u in V_-$. $ u rwlt v <=> (u < v and v in V_+) or (v < u and u in V_-) $ ] #definition("reward ordering on sets")[ Let $G = (V_0, V_1, E, p)$ be a parity game with a relevance ordering $<$ and let $P, Q subset.eq 2^V$ be two different sets of vertices. We write $P rwlt Q$ if the following holds: $ P != Q and "max"_< P symmdiff Q in (P sect V_-) union (Q sect V_+) $ ] Intuitively $P rwlt Q$ represents the reward for $P$ being less than the one for $Q$. The way this is determined is by looking at the vertices that are in either $P$ or $Q$ but not both, namely the symmetric set difference $P symmdiff Q$. The vertices that are in both are ignored because they will equally contribute to the reward of the two sets. From the symmetric difference it is then selected $v = max_< P symmdiff Q$, the greatest remaining vertex according to the relevance ordering. Then $P rwlt Q$ holds when $v in P$ and $v in V_-$, representing the situation where $v$ is not favorable to player 0 and thus makes the reward of the left set worse, or when $v in Q$ and $v in V_+$, representing the situation where $v$ is favorable to player 0 and thus makes the reward of the right set better. At the core of the algorithm there is the valuation phase computing the _play profiles_, which helps understanding how favorable a play is for each player. Moreover an ordering between play profiles is defined, with bigger values being more favorable to player 0 and lower ones being more favorable to player 1. In particular play profiles are based on three key values: - the most relevant vertex that is visited infinitely often, which we will refer to as $w$, which directly correlates to the winner of the play; - the vertices visited before $w$ that are more relevant than it; - the number of vertices visited before $w$. Recall that the game is total, thus every play is infinite, and plays induced by an instance that are infinite always consists of a prefix followed by a cycle. Thus in this case $w$ coincides with the most relevant vertex of the cycle that is reached in a play. Intuitively in this context the last two values are linked to the chances that changing strategy would change either the value of $w$ or the cycle itself, thus more relevant vertices before $w$ or a longer prefix are more beneficial for the losing player. #definition("play profile and valuation")[ Let $G = (V_0, V_1, E, p)$ be a parity game with a relevance ordering $<$ and $pi = v_0 v_1 ...$ a play on $G$. Let $w = max_< inf(pi)$ be the most relevant vertex that is visited infinitely often in the play and $alpha = { u in V | exists i in N. v_i = u and forall j < i. v_j != w }$ be the set of vertices visited before the first occurrence of $w$. Let $P = alpha sect { v in V | v > w }$ and $e = |alpha|$. The play profile of the play $pi$ is the tuple $(w, P, e)$. Given an instance $(G, sigma, tau)$ a valuation $phi$ is a function that associates to each vertex the play profile $(w, P, e)$ of the play induced by the instance. ] Given a valuation, we are then interested in determining whether a strategy for player 0 is optimal. It can be shown @jurdzinski_improvement that if there exist a winning strategy for a player then the _optimal_ strategy is winning, otherwise it must be losing. The problem thus reduces to determining whether the current player 0 strategy is optimal, and if not improve it until it is. This can be done by looking at the play profiles of the successors of each vertex: if one of them is greater than the one of the successor chosen by the current strategy then it is not optimal. In other words the optimal strategy chooses the successor with the greatest play profile. If the strategy is not optimal then a new strategy is determined by picking for each vertex the successor with the greatest play profile. This will however change the optimal strategy for player 1 and thus the valuation, which must be recomputed, leading to another iteration. It has been shown in @jurdzinski_improvement that each new strategy "improves" upon the previous one, and eventually this process will reach the optimal strategy. This can however require $O(Pi_(v in V_0) "out-deg"(v))$ improvement steps in the worst case. Intuitively this is because each of the $Pi_(v in V_0) "out-deg"(v)$ strategies for player 0 could end up being considered. #definition("play profile ordering")[ Let $G = (V_0, V_1, E, p)$ be a parity game with a relevance ordering $<$, and $(u, P, e)$ and $(v, Q, f)$ be two play profiles. Then we define: $ (u, P, e) rwlt (v, Q, f) <=> cases( & u rwlt v \ or ( & u = v and P rwlt Q) \ or ( & u = v and P = Q and u in V_- and e < f) \ or ( & u = v and P = Q and u in V_+ and e > f) ) $ ] #theorem("optimal strategies")[ Let $G = (V_0, V_1, E, p)$ be a parity game with a relevance ordering $<$, $sigma$ and $tau$ be two strategies for respectively player 0 and 1 and $phi$ a valuation function for $(G, sigma, tau)$. The strategy $sigma$ is optimal against $tau$ if $forall u in V_0. forall v in u E. phi(v) rwle phi(sigma(u))$. Dually, $tau$ is optimal against $sigma$ if $forall u in V_1. forall v in u E. phi(tau(u)) rwle phi(v)$. ] Finally, an algorithm is given in @jurdzinski_improvement to compute, given a strategy for player 0, an optimal counter-strategy for player 1 along with a valuation for them. // TODO: This uses generic subgames and strategy restricted edges/games. #algorithmic.algorithm({ import algorithmic: * Function($valuation$, args: ($H$,), { For(cond: $v in V$, { State[$phi(v) = bot$] }) For(cond: [$w in V$ (ascending order with respect to $prec$)], { If(cond: $phi(w) = bot$, { State[$L = reach(H|_({v in V | v <= w}), w)$] If(cond: $E_H sect {w} times L != varempty$, { State[$R = reach(H, w)$] State[$phi|_R = subvaluation(H|_R, w)$] State[$E|_H = E|_H without (R times (V without R))$] }) }) }) Return($phi$) }) State[] Function($subvaluation$, args: ("K", "w"), { For(cond: $v in V_K$, { State[$phi_0 (v) = w$] State[$phi_1 (v) = varempty$] }) For(cond: [$u in {v in V_K | v > w}$ (descending order with respect to $<$)], { If(cond: $u in V_+$, { State[$overline(U) = reach(K|_(V_K without {u}), w)$] For(cond: $v in V_K without overline(U)$, { State[$phi_1 (v) = phi_1 (v) union {u}$] }) State[$E_K = E_K without ((overline(U) union {u}) times (V without overline(U)))$] }) Else({ State[$U = reach(K|_(V_K without {w}), u)$] For(cond: $v in U$, { $phi_1 (v) = phi_1 (v) union {u}$ }) State[$E_K = E_K without ((U without {u}) times (V without U))$] }) }) If(cond: $w in V_+$, { State[$phi_2 = maximaldistances(K, w)$] }) Else({ State[$phi_2 = minimaldistances(K, w)$] }) Return($phi$) }) }) The algorithm works by determining from which vertices player 1 can force a play to reach that vertex again, resulting in a cycle. This is done by considering the vertices with lowest reward first, as those are the ones that are more favorable to player 1. For each one that is found the algorithm then forces every vertex that can reach it to do so, by removing the edges that would allow otherwise, and hence fixing the $w$ component of their play profile. Then for this set of vertices it computes the _subvaluation_, whose goal is to find the value of the optimal player 1 strategy for them by minimizing the $P$ and $e$ components of the play profiles of these vertices. In particular this step goes through each vertex that has a higher relevance than $w$ from the one with highest relevance to the one with lowest, which are exactly those that will influence the $P$ component and its role in the play profile ordering. For each of these, if they are favorable to player 0 then it will prevent all vertices that can reach them before reaching $w$ from doing so, again by removing the edges that would allow that. If instead they are favorable to player 1 then the algorithm will force any vertex that can reach them before reaching $w$ to do so. Finally, depending on whether $w$ is favorable to player 0 or not, to each vertex is forced the longest or shortest path to reach $w$, thus fixing the $e$ component of the play profile. Ultimately this will leave each vertex with only one outgoing edge, representing the strategy for its controlling player. It has been proven in @jurdzinski_improvement that this algorithm has a complexity of $O(|V| times |E|)$. === Local algorithm The strategy improvement algorithm has the downside of requiring to visit the whole graph. In some cases this might be an inconvenience, as the graph could be very large but only a small portion may need to be visited to determine the winner of a specific vertex of interest. For an extreme example, consider a disconnected graph, in which case the winner of a vertex only depends on its connected component and not on the whole graph. The local strategy iteration algorithm @friedmann_local fills this gap by performing strategy iteration on a _subgame_, a parity game defined as a subgraph of the main game, and providing a way to determine whether this is enough to infer the winner in the full game. It may happen that the winner is not immediately decidable, in which case the subgame would have to be _expanded_. To do this we will need to define what a subgame is, how to expand it and what is the condition that decides the winner on a vertex. #definition([$U$-induced subgames])[ Let $G = (V_0, V_1, E, p)$ be a parity game and $U subset.eq V$. The $U$-induced subgame of $G$, written $G|_U$, is a parity game $G' = (V_0 sect U, V_1 sect U, E sect (U times U), p|_U)$, where $p|_U$ is the function $p$ with domain restricted to $U$. ] #definition("partially expanded game")[ Let $G = (V_0, V_1, E, p)$ be a parity game and $G' = G|_U$ a subgame of $G$. If $G'$ is still a total parity game it is called a partially expanded game. ] Given a partially expanded game, two optimal strategies and its winning sets, the local algorithm has to decide whether vertices winning for a player in this subgame are also winning in the full game. Recall that a strategy is winning for a player $i$ if any strategy for the opponent results in an induced play that is winning for $i$. However the fact that plays are losing in the subgame does not necessarily mean that all plays in the full game will be losing too, as they might visit vertices not included in the subgame. Intuitively, the losing player might have a way to force a losing play for them to reach one of the vertices outside the subgame, called the _$U$-exterior_ of the subgame, and thus lead to a play that is not possible in the subgame. The set of vertices that can do this is called the _escape set_ of the subgame, and for such vertices no conclusions can be made. For the other vertices instead the winner in the subgame is also the winner in the full game and they constitute the definitely winning sets. #definition($U$ + "-exterior")[ Let $G = (V_0, V_1, E, p)$ be a parity game and $G|_U$ a subgame of $G$. The $U$-exterior of a vertex $v in U$, also written $D_G (U, v)$, is the set of its that successors that are not themselves in $U$. That is, $D_G (U, v) = v E sect (V without U)$. The $U$-exterior of of the subgame $G|_U$ is instead the union of all $U$-exteriors of its vertices, that is: $ D_G (U) = union.big_(v in U) v E sect (V without U) $ ] In order to define the concept of _escape set_ we will use the notion of _strategy restricted edges_. These are needed because we are interested in plays that are losing for a player, and to do that we have to restrict the moves of the opposing player to the ones represented by its optimal strategy. #definition("strategy restricted edges")[ Let $G = (V_0, V_1, E, p)$ be a parity game and $sigma$ a strategy for player $i$ in $G$. The set of edges restricted to the strategy $sigma$ is $E_sigma = { (u, v) | u in V_i => sigma(u) = v }$. ] #definition("escape set")[ Let $G = (V_0, V_1, E, p)$ be a parity game, $U subset.eq V$ and $G|_U$ the induced subgame of $G$. Let $L = (G|_U, sigma, tau)$ be an instance of the subgame. Let $E_sigma^*$ (resp. $E_tau^*$) be the transitive-reflexive closure of $E_sigma$ (resp. $E_tau$). The escape set for player 0 (resp. 1) from vertex $v in U$ is the set $E_L^0 (v) = v E_sigma^* sect D_G (U)$ (resp. $E_L^1 (v) = v E_tau^* sect D_G (U)$). ] #definition("definitive winning set")[ Let $G = (V_0, V_1, E, p)$ be a parity game, $U subset.eq V$ and $G|_U$ the induced subgame of $G$. Let $L = (G|_U, sigma, tau)$ be an instance of the subgame with $sigma$ and $tau$ optimal strategies, and let $phi$ be the valuation for this instance. The definitive winning sets $W'_0 (L)$ and $W'_1 (L)$ are defined as follows: $ W'_0 (L) &= { v in U | E_L^1 (v) = varempty and (phi(v))_1 in V_+ } \ W'_1 (L) &= { v in U | E_L^0 (v) = varempty and (phi(v))_1 in V_- } $ ] In practice we will however not compute the full escape sets, but instead we will find for which vertices they are empty. We can do this by considering all the vertices in $U_i$ that can reach vertices in the unexplored part of the game. Then we compute the set of vertices that can reach said vertices when the edges are restricted according to the strategy for player $1-i$. This will result in the set of all vertices which have a non-empty escape set, so we just need to consider their complement when computing the definitive winning sets. #lemma("definitive winning set soundness")[ Let $G = (V_0, V_1, E, p)$ be a parity game and $G|_U$ a subgame of $G$ with an instance $L = (G, sigma, tau)$. Then $W'_0 (L) subset.eq W_0$ and $W'_1 (L) subset.eq W_1$. ] As previously mentioned, if the winner of a vertex cannot be determined in a subgame, that is the vertex is not in a definitive winning set, then the subgame must be _expanded_ to a larger subgame, which is then solved, repeating the process. Given a partially expanded game $G|_U$, the expansion process starts by selecting new vertices in the $U$-exterior to include in the set $U$, creating a new set $U'$. However $G|_U'$ might not be a total parity game, so the expansion process must continue to include new vertices in $U'$ until the $U'$-induced subgame becomes total. More formally, an _expansion scheme_ is made up of a _primary expansion function_ $epsilon_1$ and a _secondary expansion function_ $epsilon_2$, and the new subgame will be decided through a combination of them. In particular the primary expansion function will select a non-empty set of vertices in the $U$-exterior to add to the current game, while the secondary expansion function will be used to recursively select elements from the $U$-exterior of new vertices until the game becomes total. #definition("expansion scheme")[ Let $G = (V_0, V_1, E, p)$ be a parity game and $G|_U$ a subgame of $G$. An expansion scheme is a pair of functions $epsilon_1 : 2^V -> 2^V$ and $epsilon_2 : 2^V times V -> 2^V$ such that: - $varempty subset.neq epsilon_1 (U) subset.eq D_G (U)$ - $forall v in U. epsilon_2 (U, v) subset.eq D_G (U, v)$ - $forall v in U. v E = D_G (U, v) => epsilon_2 (U, v) != varempty$ ] The expansion is then computed by first applying $epsilon_1$ to get the set of new vertices, and then by inductively applying $epsilon_2$ to each new vertex until there is no new vertex produced: #let expand = text(font: "", smallcaps("Expand")) $ expand(U) &= expand_2 (U, epsilon_1 (U)) \ \ expand_2 (U, A) &= cases( U & "if" A = varempty \ expand_2 (U union A, union.big_(v in A) epsilon_2 (U union A, v)) & "otherwise" ) $ Two expansion schemes are provided in @friedmann_local, a _symmetric scheme_ and an _asymmetric scheme_. Both start by expanding the game to one of the vertices in the escape set of the vertex of interest $v^*$ for the currently losing player $i$ on it. Formally, $epsilon_1 (U) = { w }$ for some $w in E^i_L (v^*)$ where $p((phi(v^*))_1) "mod" 2 equiv 1 - i$. The idea is that player $i$ has the ability to force a play from $v^*$ to reach the new vertex, which might be winning for them and thus could change the winner on $v^*$ in the new subgame. On the other hand if that does not happen then the escape set of $v^*$ for player $i$ might reduce, eventually becoming empty and thus making $v^*$ definitely winning for player $1-i$. The two expansion schemes differ however in the secondary expansion function. Both choose not to expand any new vertex if the just expanded vertex already has a successor in the current subgame, as doing otherwise may be wasteful. However the symmetric scheme chooses to expand only one of the successors, that is $epsilon_2 (U, v) = { w }$ for some $w in v E$. Instead the asymmetric scheme performs a different choice depending on whether $v$ is controlled by player 0 or 1. If it is controlled by player 1 it chooses to expand all the $U$-exterior of $v$, that is $epsilon_2 (U, v) = D_G (U, v)$ if $v in V_1$, otherwise if it is controlled by player 0 it chooses to expand only one successor like in the symmetric scheme, that is $epsilon_2 (U, v) = { w }$ for some $w in v E$ if $v in V_0$. Intuitively, the symmetric scheme makes no assumption about the winner and expands vertices for both players in the same way. Instead the asymmetric scheme assumes that player 0 will win, and thus tries to expand more vertices controlled by player 1 in order to reduce its escape set. Ultimately there are different tradeoffs involved, since the symmetric scheme expands relatively few vertices and thus may require solving more subgames, while the asymmetric scheme is eager, but in doing so it might expand to larger subgames that could otherwise be avoided. #let expand = mathstr("expand") #let improve = mathstr("improve") Finally, the algorithm performs an initial expansion to get a total subgame that includes the vertex of interest. Then it repeatedly solves the current subgame, using an $improve$ subroutine, until the vertex $v^*$ becomes definitely winning for either player, and expands it, using an $expand$ subroutine, when no conclusion can be made on it. #algorithmic.algorithm({ import algorithmic: * Function(mathstr("local-strategy-iteration"), args: ($G$, $v^*$), { State[$U = expand({v^*})$] State[$sigma = $ arbitrary player 0 strategy on $G|_U$] State[$tau = $ optimal player 1 strategy against $sigma$ on $G|_U$] State[$L = (G, sigma, tau)$] While(cond: $v^* in.not W_0 (L) union W_1 (L)$, { If(cond: [$sigma$ is improvable w.r.t $L$], { State[$L = improve(L)$] }) Else({ State[$L = expand(L)$] }) }) Return($sigma, tau, W_0 (L), W_1 (L)$) }) }) The complexity of the algorithm depends on the specific expansion scheme used. For the two expansion schemes provided it has been proven in @friedmann_local that the asymmetric scheme will require at most $O(|V|^(|V_0|))$ iterations, while the symmetric one will require at most $O(|V| dot |V|^(|V_0|))$.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.3.0/src/intersection.typ
typst
Apache License 2.0
#import "vector.typ" #import "util.typ" /// Checks for a line-line intersection between the given points and returns its position, otherwise {{none}}. /// /// - a (vector): Line 1 point 1 /// - b (vector): Line 1 point 2 /// - c (vector): Line 2 point 1 /// - d (vector): Line 2 point 2 /// - ray (bool): When `true`, intersections will be found for the whole line instead of inbetween the given points. /// -> vector,none #let line-line(a, b, c, d, ray: false) = { let lli8(x1, y1, x2, y2, x3, y3, x4, y4) = { let nx = (x1*y2 - y1*x2)*(x3 - x4)-(x1 - x2)*(x3*y4 - y3*x4) let ny = (x1*y2 - y1*x2)*(y3 - y4)-(y1 - y2)*(x3*y4 - y3*x4) let d = (x1 - x2)*(y3 - y4)-(y1 - y2)*(x3 - x4) if d == 0 { return none } return (nx / d, ny / d, 0) } let pt = lli8(a.at(0), a.at(1), b.at(0), b.at(1), c.at(0), c.at(1), d.at(0), d.at(1)) if pt != none { let on-line(pt, a, b) = { let (x, y, ..) = pt let epsilon = util.float-epsilon let mx = calc.min(a.at(0), b.at(0)) - epsilon let my = calc.min(a.at(1), b.at(1)) - epsilon let Mx = calc.max(a.at(0), b.at(0)) + epsilon let My = calc.max(a.at(1), b.at(1)) + epsilon return mx <= x and Mx >= x and my <= y and My >= y } if ray or (on-line(pt, a, b) and on-line(pt, c, d)) { return pt } } } /// Finds the intersections of a line and cubic bezier. /// /// - s (vector): Bezier start point /// - e (vector): Bezier end point /// - c1 (vector): Bezier control point 1 /// - c2 (vector): Bezier control point 2 /// - la (vector): Line start point /// - lb (vector): Line end point /// - ray (bool): When `true`, intersections will be found for the whole line instead of inbetween the given points. /// -> array #let line-cubic(la, lb, s, e, c1, c2) = { import "/src/bezier.typ": line-cubic-intersections as line-cubic return line-cubic(la, lb, s, e, c1, c2) } /// Finds the intersections of a line and linestrip. /// - la (vector): Line start point. /// - lb (vector): Line end point. /// - v (array): An {{array}} of {{vector}}s that define each point on the linestrip. /// -> array #let line-linestrip(la, lb, v) = { let pts = () for i in range(0, v.len() - 1) { let pt = line-line(la, lb, v.at(i), v.at(i + 1)) if pt != none { pts.push(pt) } } return pts } /// Finds the intersections of a line and path in 2D. The path should be given as a {{drawable}} of type `path`. /// /// - la (vector): Line start /// - lb (vector): Line end /// - path (drawable): The path. /// -> array #let line-path(la, lb, path) = { let segment(s) = { let (k, ..v) = s if k == "line" { return line-linestrip(la, lb, v) } else if k == "cubic" { return line-cubic(la, lb, ..v) } else { return () } } let pts = () for s in path.at("segments", default: ()) { pts += segment(s) } return pts } /// Finds the intersections between two path {{drawable}}s in 2D. /// /// - a (path): Path a /// - b (path): Path b /// - samples (int): Number of samples to use for bezier curves /// -> array #let path-path(a, b, samples: 8) = { import "bezier.typ": cubic-point // Convert segment to vertices by sampling curves let linearize-segment(s) = { let t = s.at(0) if t == "line" { return s.slice(1) } else if t == "cubic" { return range(samples + 1).map( t => cubic-point(..s.slice(1), t/samples) ) } } let pts = () for s in a.at("segments", default: ()) { let sv = linearize-segment(s) for ai in range(0, sv.len() - 1) { pts += line-path(sv.at(ai), sv.at(ai + 1), b) } } return pts }
https://github.com/mariunaise/HDA-Thesis
https://raw.githubusercontent.com/mariunaise/HDA-Thesis/master/main.typ
typst
#import "@preview/cetz:0.2.2" #import "@preview/fletcher:0.5.1" #import "@preview/gentle-clues:0.9.0" #import "@preview/glossarium:0.4.1": * #import "@preview/lovelace:0.3.0" #import "@preview/tablex:0.0.8" #import "@preview/unify:0.6.0" #import "@preview/quill:0.3.0" #import "@preview/equate:0.2.0": equate #import "@preview/drafting:0.2.0": * #show: equate.with(breakable: true, sub-numbering: true) #set math.equation(numbering: "(1.1)") #show figure.where( kind: table ): set figure.caption(position: top) #import "template/conf.typ": conf #show: make-glossary #set document(title: "Towards Efficient Helper Data Algorithms for Multi-Bit PUF Quantization", author: "<NAME>") #show: doc => conf( title: "Towards Efficient Helper Data Algorithms for Multi-Bit PUF Quantization", author: "<NAME>", chair: "Chair for Security in Information Technology", school: "School of Computation, Information and Technology", degree: "Bachelor of Science (B.Sc.)", examiner: "Prof. Dr. <NAME>", supervisor: "M.Sc. <NAME>", submitted: "30.08.2024", doc ) #set page(footer: locate( loc => if calc.even(loc.page()) { align(right, counter(page).display("1")); } else { align(left, counter(page).display("1")); } )) #include "content/introduction.typ" #include "content/SMHD.typ" #include "content/BACH.typ" #include "content/outlook.typ" #include "glossary.typ" #counter(heading).update(0) #bibliography("bibliography.bib", style: "ieee")
https://github.com/dismint/docmint
https://raw.githubusercontent.com/dismint/docmint/main/linear/pset2.typ
typst
#import "template.typ": * #show: template.with( title: "PSET 2", subtitle: "18.06", pset: true, toc: false, ) #set math.mat(delim: "[") Collaborators: <NAME> = Problem 2.1.3 You should subtract $-1/2$ times the first row to cancel out the $x$ in the second equation. Thus in matrix form you will end up with: $ mat(2, 4; 0, 3) = mat(6; 3) $ Which will solve out to $x, y = boxed((5, 1))$ If you switch the right side to $(-6, 0)$ then you will get: $ mat(2, 4; 0, 3) = mat(-6; -3) $ Which will solve out to $x, y = boxed((-5, -1))$ = Problem 2.1.10 #bimg("pset2graph.png") The line that goes through the solutions of the equations has an equation of $boxed(5x - 4y = 16)$ = Problem 2.2.1 == (a) $ boxed(mat(5, 5, 5; 25, 1, 1; 0, 0, 1)) $ == (b) $ boxed(mat(1, 1, 1; 0, 1, 1; 0, -7, 1)) $ == (c) $ boxed(mat(0, 0, 1; 1, 0, 0; 0, 1, 0)) $ = Problem 2.2.3 $ E_(21) &= mat(1, 0, 0; -4, 1, 0; 0, 0, 1)\ E_(31) &= mat(1, 0, 0; 0, 1, 0; 2, 0, 1)\ E_(32) &= mat(1, 0, 0; 0, 1, 0; 0, -2, 1)\ $ Now we multiply all the elimination steps together to get the overall elimination matrix: $ E &= E_(32)E_(31)E_(21)\ &= mat(1, 0, 0; 0, 1, 0; 0, -2, 1)mat(1, 0, 0; 0, 1, 0; 2, 0, 1)mat(1, 0, 0; -4, 1, 0; 0, 0, 1)\ &= mat(1, 0, 0; 0, 1, 0; 2, -2, 1)mat(1, 0, 0; -4, 1, 0; 0, 0, 1)\ &= boxed(mat(1, 0, 0; -4, 1, 0; 10, -2, 1))\ $ This leads to an inverse of: $ E^(-1) = L = boxed(mat(1, 0, 0; 4, 1, 0; -2, 2, 1)) $ = Problem 2.2.12 == (left) $ P^(-1) = boxed(mat(0, 0, 1; 0, 1, 0; 1, 0, 0)) $ == (right) $ P^(-1) = boxed(mat(0, 0, 1; 1, 0, 0; 0, 1, 0)) $ = Problem 2.2.20 $ C &= A B\ A^(-1) C &= A^(-1) A B\ A^(-1) C &= B\ A^(-1) C C^(-1) &= B C^(-1)\ A^(-1) &= boxed(B C^(-1))\ $ = Problem 2.2.34 Subtract the second row from the last row, and the first row from the second row to get the following: $ A &= mat(a, b, b; a, a, b; a, a, a)\ &= mat(a, b, b; a, a, b; 0, 0, a-b)\ &= mat(a, b, b; 0, a-b, 0; 0, 0, a-b)\ $ We have now shown that the pivots are not zero, meaning that the matrix must have an inverse. The pivots are $a, a-b, a-b$. For matrix $C$, we can choose the numbers $boxed((0, 2, 7))$ These all work because we create matrices that are not linearly independent. The latter two simply create two identical rows and columns respectively, and having an entire row of zeros trivially means that the matrix is dependent. We know that in order for a matrix to be invertible, it must be the case that all of the rows / columns are linearly independent, thus these choices for $c$ will result in a matrix that cannot be inverted. = Problem 2.3.3 $ E &= boxed(mat(1, 0, 0; 0, 1, 0; -3, 0, 1))\ E A &= mat(2, 1, 0; 0, 4, 2; 0, 0, 5)\ E^(-1) &= boxed(mat(1, 0, 0; 0, 1, 0; 3, 0, 1)) $ Now we factor $A$ $ E A &= U\ A &= E^(-1) U\ &= mat(1, 0, 0; 0, 1, 0; 3, 0, 1)mat(2, 1, 0; 0, 4, 2; 0, 0, 5)\ &= boxed(mat(2, 1, 0; 0, 4, 2; 6, 3, 5))\ $ = Problem 2.3.7 $ E_(43) &= mat(1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, -1, 1)\ E_(32) &= mat(1, 0, 0, 0; 0, 1, 0, 0; 0, -1, 1, 0; 0, 0, 0, 1)\ E_(21) &= mat(1, 0, 0, 0; -1, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1)\ E_(43) E_(32) E_(21) = E &= mat(1, 0, 0, 0; -1, 1, 0, 0; 0, -1, 1, 0; 0, 0, -1, 1)\ E A = U &= boxed(mat(a, a, a, a; 0, b-a, b-a, b-a; 0, 0, c-b, c-b; 0, 0, 0, d-c))\ $ Calculating the inverse of $E$: $ E^(-1) = L = boxed(mat(1, 0, 0, 0; 1, 1, 0, 0; 1, 1, 1, 0; 1, 1, 1, 1)) $ In order for all four pivots to exist, we require that the diagonal must be non zero. For this to happen, it must be the case that: + $a != 0$ + $b != a$ + $c != b$ + $d != c$ = Problem 2.4.1 == (a) $ A &= mat(1, 0; 9, 3)\ A^T &= mat(1, 9; 0, 3)\ A^(-1) &= mat(1, 0; -3, 1/3)\ (A^(-1))^T &= mat(1, -3; 0, 1/3)\ (A^T)^(-1) &= mat(1, -3; 0, 1/3)\ $ == (b) $ A &= mat(1, c; c, 0)\ A^T &= mat(1, c; c, 0)\ A^(-1) &= mat(0, 1/c; 1/c, -1/c^2)\ (A^(-1))^T &= mat(0, 1/c; 1/c, -1/c^2)\ (A^T)^(-1) &= mat(0, 1/c; 1/c, -1/c^2)\ $
https://github.com/kilpkonn/typst-thesis
https://raw.githubusercontent.com/kilpkonn/typst-thesis/main/annotation.typ
typst
MIT License
#set text(lang: "ee") #lorem(50) Lõputöö on kirjutatud inglise keeles keeles ning sisaldab teksti #context counter(page).at(<end>).first() leheküljel, #context counter(heading).at(<conclusion>).first() peatükki, #context counter(figure.where(kind: image)).final().first() joonist #context counter(figure.where(kind: raw)).final().first() koodinäidist ja #context counter(figure.where(kind: table)).final().first() tabelit.
https://github.com/HiiGHoVuTi/requin
https://raw.githubusercontent.com/HiiGHoVuTi/requin/main/calc/chaitin.typ
typst
#import "../lib.typ": * #show heading: heading_fct _Ce problème est un peu long et la partie III est particulièrement difficile, la remarque de fin de chaque partie résume les résultats importants._ #import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge === Programme auto-délimité Soit $Sigma = {0, 1}$, un _programme auto-délimité_ est un mot du langage $cal(P)$ des mots sur $Sigma$ sans facteur $111$ autre que leur suffixe. #question(0)[Donner un automate reconnaissant $cal(P)$.] #correct[ #diagram( node-stroke: .1em, spacing: 4em, edge((-1,0), "r", "-|>", label-pos: 0, label-side: center), node((0,0), $0$, radius: 2em), edge($1$, "-|>"), node((1,0), $1$, radius: 2em), edge($1$, "-|>"), node((2,0), $2$, radius: 2em), edge($1$, "-|>"), node((3,0), $3$, radius: 2em, extrude: (-2.5, 0)), edge((0,0), (0,0), $0$, "-|>", bend: -130deg), edge((1,0), (0,0), $0$, "-|>", bend: -40deg), edge((2,0), (0,0), $0$, "-|>", bend: -55deg), edge((3,0), (0,0), $0$, "-|>", bend: -70deg), edge((3,0), (3,0), $1$, "-|>", bend: -130deg), ) ] On considère le langage $mono("BF")$ défini par la grammaire suivante $ S -> med g S | d S | + S | - S | [ S ] | epsilon $ On le munit de la sémantique suivante, comme action sur $ZZ times NN^ZZ$: #grid(columns: (1fr, 1fr), [ - $g dot (p, t) := (p - 1, t)$ - $+ dot (p, t) := (p, t + chi_{p})$ ], [ - $d dot (p, t) := (p + 1, t)$ - $- dot (p, t) := (p, t - chi_{p})$ ]) #align(center, [ - $["prog"] dot (p, t) := cases((p\,t) "si" t[p] = 0, ["prog"]dot"prog"dot (p,t) "sinon")$ ]) #question(1)[Le langage $mono("BF")$ est-il rationnel ?] #correct[ Le langage `BF` n'est pas rationnel car il doit reconnaître un bon parenthésage. Pour justifier correctement, on utilise le lemme de l'étoile. $triangle$ On suppose par l'absurde que `BF` est rationnel. Soit $N$ une longueur de pompage. On pose $u := \[^N\]^N in$ `BF`. Comme $|u| > N$, il existe $x,y,z in Sigma^star$ tels que: #align(center, grid( columns: (1fr, 1fr, 1fr, 1fr), [- $x y z = u$], [- $|x y| <= N$], [- $| y | >= 1$], [- $ cal(L)(x y^star z) subset$ `BF`] )) Comme $|x y| <= N$, $x y = [[...[$ et $y = [[...[$ donc $x y^(2N) z$ est un parenthésage déséquilibré et n'est pas reconnu par `BF`. C'est absurde $arrow.zigzag$ #h(1fr) $triangle.l$ ] #question(0)[Implémenter la fonction $mono("ZERO")$ qui assigne la case pointée à $0$ en $mono("BF")$.] #correct[ ```bf [-] ``` ] #question(0)[Implémenter la fonction $mono("NAND")$ en $mono("BF")$.] #correct[ ```bf [d[d-g-]g-]dd+ ``` ] // #question(0)[Implémenter la fonction $mono("MOVE")$ qui déplace une valeur à une adresse donnée en $mono("BF")$.] #question(1)[Justifier que $mono("BF")$ est Turing-complet.] #correct[ La fonction `NAND` est une porte logique universelle. On peut donc réimplémenter un ordinateur en `BF`. On n'attend pas une justification plus rigoureuse. ] #question(2)[Proposer une surjection de $cal(P)$ dans $mono("BF")$.] #correct[ On se munit de $phi : [|0, 6|] -> {g, d, +, -, [, ]}$ surjective. $square$ Soit $P in cal(P)$. Associons à $P$ un programme de `BF`. On découpe $P$ en blocs de trois bits, en jetant tout surplus à gauche. En interprétant un bloc de trois bits comme un nombre de $[|0, 6|]$ (on rappelle que $111$ est interdit), on construit le programme comme la concaténation des images de ces blocs par $phi$. Si le parenthésage n'est pas équilibré, on supprime toutes les parenthèses fermantes jamais ouvertes. #h(1fr) $square$ Il est facile de vérifier que cette construction est surjective. ] On munit $cal(P)$ de la sémantique associée, en faisant un langage Turing-complet. === Complexité de Kolmogorov Si $u in NN^NN$ est une suite d'entiers, alors $cal(K)(u)$ désigne la taille du plus petit programme $p in cal(P)$ tel que $p$ réalise la fonction $chi_NN u$. Si $cal(Q)$ est un autre langage, on notera $cal(K_Q)(u)$ la quantité analogue. #question(0)[Montrer que $cal(K)$ est bien définie dans $NN union {+oo}$.] #correct[ Pour tout $u in NN$, $cal(K)(u)$ est défini comme l'infimum d'une partie de $NN$. Si on accepte la convention $inf emptyset = +oo$, alors $cal(K)$ est bien définie. ] #question(1)[Donner une suite $u in NN^NN$ telle que $cal(K)(u)=+oo$.] #correct[ On se munit de $phi : mono("OCaml") -> NN$ une énumération des programmes `OCaml`. Soit $"arrêt"$ la suite non-calculable qui à $n$ associe $1$ si $phi^(-1)(n)$ termine et $0$ sinon. Aucun programme ne calcule $"arrêt"$ donc $cal(K)("arrêt") = +oo$. #align(right, $square$) ] #question(2)[Soient $cal(Q\,R)$ Turing-complets, montrer qu'il existe $k in NN$ tel que $cal(K_Q)<= k + cal(K_R)$.] #correct[ On se munit de $R in cal(Q)$ un programme simulant l'exécution de $cal(R)$. On pose $k in NN$ la taille de $R$. $square$ Soit $u in NN^NN$. - Si $cal(K_Q)(u) = +oo$, alors $cal(K_R)(u)$ aussi car $u$ n'est pas calculable. - Sinon, $u$ est calculable et il existe $r in cal(R)$ un programme de longueur $cal(K_R)(u)$ qui calcule $u$. Comme $R$ simule l'évaluation dans $cal(R)$, alors le programme $q in cal(Q)$ qui passe $r$ en argument à $R$ calcule $u$. La taille de $q$ est $k+cal(K_R)(u)$ donc $cal(K_Q)(u) <= k + cal(K_R)(u)$. #h(1fr) $square$ On conclut que $cal(K_Q)<= k + cal(K_R)$. #align(right, $square$) ] #question(0)[Justifier l'existence de $phi : NN -> cal(P)$ bijective calculable.] #correct[ On propose $phi$ la fonction qui compte en binaire (avec $111$ comme suffixe). ] Par abus de notation, on notera $cal(K)(n) := cal(K)(chi_{0} n)$ pour $n in NN$. On pose $psi(m) := min {n in NN, cal(K)(phi(n)) >= m}$ puis $frak(E) = cal(K) compose phi compose psi$. #question(1)[Montrer que $frak(E)(m) >= m$ pour tout $m in NN$.] #correct[ Il est sous-entendu qu'il faut montrer que cette quantité existe. Comme $cal(K)$ n'est pas bornée et que $phi$ est bijective, $psi$ est bien définie. $square$ Soit $m in NN$, par définition, $psi(m)$ vérifie $cal(K)(phi(psi(m))) >= m$. #h(1fr) $square$ ] #question(2)[Montrer que si $cal(K(K)) < +oo$, alors $frak(E)(m) = cal(O)(log(m)).$] #correct[ Cette question nécessite un gadget pour exprimer un entier en taille logarithmique. On peut contourner le casse-tête en rappelant que $cal(P)$ est Turing-complet, donc il existe un programme $"expo"$ réalisant l'exponentiation. Ainsi, à une constante additive près, on peut exprimer un entier en taille logarithmique. Il existe un programme $"seuil" in cal(P)$ de taille $k_1 in NN$ calculant le plus petit entier vérifiant une propriété calculable. La propriété $P_m (n) := cal(K)(phi(n)) >= m$ est calculable car $cal(K)$ et $phi$ le sont. Ainsi, il existe un programme $"seuil"_P in cal(P)$ de taille $k_2 in NN$ calculant $psi$. Enfin, il existe un programme de taille $k_3 in NN$ calculant $phi compose psi$. Ainsi, on a montré que $frak(E)(m) <= k_3 + cal(O)(log m)$ #align(right, $square$) ] #question(1)[Calculer $cal(K)(cal(K)).$] #correct[ $triangle$ On suppose par l'absurde que $cal(K)(cal(K)) < +oo$. Alors $frak(E)(m) >= m$ et $frak(E)(m) = cal(O)(log m)$ soit $frak(E)(m) <= A log (m)$ soit encore $-frak(E)(m) >= A log(m)$. En sommant ces deux inégalités, $ forall m in NN, 0 >= A log (m) - m $ Par croissances comparées, $(A log(m) - m) -->_(m -> +oo) -oo$ donc il existe $m_0 in NN$ tel que $ A log (m) - m <= -861 $ On aurait $0 >= 861$, absurde $arrow.zigzag$ #h(1fr) $triangle.l$ On conclut que $cal(K(K)) = +oo$. #align(right, $square$) ] On a défini la _complexité de Kolmogorov_ qui décrit la quantité d'information contenue dans une suite, et est (à une constante additive près) invariante du modèle de calcul. // #pagebreak() === Programme aléatoire On admet pouvoir munir $Sigma^NN$ d'une structure d'espace probabilisé, telle qu'il existe $U$ une variable aléatoire telle que #align(center, grid(columns: (1fr), [$forall u in Sigma^star, med PP(u "préfixe de" U) = 2^(-|u|)$] )) #question(1)[Proposer une surjection de l'image de $U$ dans $cal(P)$.] #correct[ On pose $f : Sigma^NN -> NN union {+oo}$, $f(u) := inf {n in NN, 111 "suffixe de" u^n}$. Enfin, on pose $ phi(u) := cases(u^f(n) "si" f(n) in NN, 111 "sinon") $ On montre sans difficulté que $phi$ est bien définie de $Sigma^NN$ dans $cal(P)$ et qu'elle est surjective. ] On dit qu'une suite $u in NN^NN$ est _aléatoire au sens de Chaitin-Levin_ si la suite $(cal(K)(u^n) - n)$ est minorée. #question(0)[Justifier cette définition. Donner un nombre univers non-aléatoire.] #correct[ Cette définition signifie qu'il est toujours (à une constante près) au moins aussi concis d'écrire les $n$ premiers chiffres de $u$ que d'essayer de les compresser à l'aide d'un programme. ] #question(1)[Montrer qu'une suite calculable n'est pas aléatoire.] #correct[ Si $u in Sigma^NN$ est calculable, alors il existe un programme de taille $k in NN$ qui la calcule. De plus, il existe un programme de taille $k + cal(O)(log n)$ qui calcule son $n$-ième préfixe, en utilisant la logique de la partie II. Ainsi, la suite $cal(K)(u^n) - n$ est majorée par $k + A log n - n$ n'est donc pas minorée. #align(right, $square$) ] // #question(4)[Montrer que $u in NN^NN$ est aléatoire si et seulement si la suite $(cal(K)(u^n) - n)$ tend vers $+oo$.] Une _supermartingale_ est une fonction $F : Sigma^star -> RR_+$ telle que $F(u) >= (F(0u) + F(1u))/2$. Une supermartingale est _gagnante_ sur une suite $u in Sigma^NN$ si $lim sup F(u^n) = oo$. Une (super)martingale est _constructive_ si il existe une suite calculables de (super)martingales à valeurs rationnelles qui l'approchent par dessous. En particulier, une martingale rationnelle calculable est constructive. Enfin, une suite $u in Sigma^NN$ est _calculablement aléatoire_ si aucune supermartingale constructive n'est gagnante sur $u$. #question(0)[Donner une martingale non-nulle, en déduire un nombre non-aléatoire.] #correct[ On peut vérifier que $ F(u) := cases(2^n "si" exists n in NN\, u = 1^n, 0 "sinon") $ est une (super)martingale. Celle-ci gagne sur la suite constante à $1$, qui est un développement binaire de $1$. On en déduit que $1$ n'est pas un nombre aléatoire. #align(right, $square$) ] #question(1)[Donner une famille infinie de supermartingales constructives.] #correct[ $square$ Soit $p in QQ sect med ]-1,1[$. On pose $F_p (epsilon) := 1$ puis $ forall u in Sigma^star, F_p (1u) := (1+p) F_p (u) "et" F_p (0u) := (1 - p) F_p (u) $ On vérifie sans problème que $F_p$ est une (super)martingale constructive. #h(1fr) $square$ De plus, il suffit de regarder l'image de $1$ pour constater que $p arrow.bar F_p$ est injective. On a bien une famille infinie de supermartingales constructives. #align(right, $square$) ] #question(2)[Montrer qu'une suite calculable n'est pas calculablement aléatoire.] #correct[ Il suffit d'adapter l'exemple de la question $19$. Construisons $F$ une martingale gagnante sur $u$ calculable. On se munit d'un programme calculant $u$. $square$ On suppose avoir construit $u^n$ et $F$ sur tous les mots de longueur inférieure à $n$. On construit $u^(n+1)$ avec notre programme et note $delta in Sigma$ le nouveau bit, puis $overline(delta)$ sa négation. On pose $ forall u in Sigma^n, F(delta u) = 2 F(u) "et" F(overline(delta)u) = 0 $ #align(right, $square$) On vérifie sans problème que $F$ est constructive et gagnante sur $u$. #align(right, $square$) ] #question(3)[Donner une suite non-calculable et non-calculablement-aléatoire.] #correct[ Par l'argument de dénombrement précédent, il existe une suite calculablement aléatoire, que l'on note $cal(a) in Sigma^NN$. On pose $cal(w) in Sigma^NN$ la suite telle que $ forall n in NN, cal(w)(2n) = 1 "et" cal(w)(2n+1) = cal(a)_n $ Un bon parieur pourra alors envisager la martingale $M$ telle que $M(epsilon)=1$ et $ forall u in Sigma^star, M(1u) := cases(2M(u) "si" |u| "est pair", M(u) "sinon") "et" M(0u) = cases(0 "si" |u| "est pair", M(u) "sinon") $ Cette martingale est constructive et gagne sur $cal(w)$. #align(right, $square$) ] #question(3)[Montrer que $U$ est presque sûrement calculablement aléatoire.] #correct[ Les supermartingales constructives sont dénombrables, alors que $Sigma^NN$ ne l'est pas. La distribution n'ayant aucun biais\* pour les suites non calculablement aléatoires, elles sont de mesure nulle. Ainsi, la probabilité que $U$ soit calculablement aléatoire est de $1$. // TODO(Juliette): mettre quand même la grosse preuve avec des mesures de partout \* démonstration absolument faite avec les mains, par peur d'invoquer les démons de la théorie de la mesure. ] #question(4)[Montrer que _calculablement aléatoire_ et _Chaitin-Levin-aléatoire_ sont des propriétés équivalentes.] #correct[ _coming soon..._ ] #question(1)[En déduire que $U$ est presque sûrement Chaitin-Levin-aléatoire.] #correct[ On peut se demander à quoi sert cette question, mais essayer de montrer directement cette propriété sans passer par l'équivalence ci-dessus est particulièrement difficile (comme montrer l'équivalence, en fait). ] On s'est muni d'une suite $U$ aléatoire, nous donnant un programme auto-délimité aléatoire $P in cal(P)$. === Le nombre qui sait tout On définit $Omega in RR$ comme $Omega := PP(P "termine")$, on l'identifiera à son développement binaire $Omega in Sigma^NN$. #question(0)[Donner un programme dont le calcul approche $Omega$, quel est son problème ?] #correct[ Lancer tout un tas de programmes en parallèle et compter combien s'arrêtent. À aucun instant cette moyenne n'est fiable en revanche, car on n'a aucune garantie sur le temps d'exécution d'un programme qui termine. On aura au mieux une minoration assez désastreuse. ] #question(2)[Exprimer $Omega$ en fonction des longueurs des programmes qui terminent.] #correct[ La clef est de remarquer que ${p = P}$ et $p "préfixe de" P$ sont le même événement. $ Omega &= PP(P "termine") = PP(union.big.sq_(p in cal(P)) {P = p "et" p "termine"} ) \ &= sum_(p in cal(P)) PP{P = p "et" p "termine"} \ &= sum_(p in cal(P)\ p "termine") PP{P = p} \ &= sum_(p in cal(P)\ p "termine") PP{p "préfixe de " P} \ Omega &= sum_(p in cal(P)\ p "termine") 2^(-|p|) $ ] #question(0)[Encadrer $Omega$ avec les $Omega^k$. Discuter du caractère strict (ou non) des inégalités.] #correct[ Ayant identifié $Omega$ à son développement binaire, $ forall n in NN, quad Omega^n <= Omega < Omega^n + 2^(-n) $ D'après la question suivante, les deux inégalités sont strictes, mais seul la deuxième l'est évidemment. ] #question(2)[Résoudre le problème de l'arrêt pour des programmes à taille bornée.] #correct[ $square$ Soit $n in NN$. On considère un programme qui exécute tous les programmes de taille au plus $n$ en parallèle, et qui ajoute à un compteur $2^(-|p|)$ dès que $p$ s'arrête. En un temps fini (le maximum des temps d'arrêt des programmes terminant), le compteur aura atteint $Omega^n$. Ainsi, on sait qu'aucun autre programme s'arrête car le compteur dépasserait $Omega^n+2^(-n)$. On a donc déterminé lesquels parmi les programmes de longueur au plus $n$ s'arrêtent. #align(right, $square$) En particulier, on a résolu le problème de l'arrêt. ] #question(1)[Calculer $cal(K)(Omega)$.] #correct[ $triangle$ Supposons par l'absurde que $cal(K)(Omega) < +oo$. En particulier, $Omega$ est une suite calculable et on peut déterminer $Omega^n$ pour tout $n in NN$ en temps fini. D'après la question précédente, on pourrait résoudre le problème de l'arrêt en un temps fini, c'est absurde $arrow.zigzag$ #h(1fr) $triangle.l$ Ainsi $cal(K)(Omega) = +oo$. #align(right, $square$) ] On suppose connaître $Omega^n$ pour tout $n in NN$. #question(1)[Proposer un algorithme qui répond à la conjecture de Syracuse.] #correct[ Soit `arret` un programme `OCaml` résolvant l'arrêt. Le programme `OCaml` suivant ```ocaml let step k = if k mod 2 = 0 then k / 2 else 3 * k + 1 in let rec boucle k = if k <> 1 then boucle (step k) in let rec syracuse n = if arret boucle n then syracuse (n+1) in not (arret syracuse 0) ``` renvoie `true` si et seulement si la conjecture de Syracuse est vraie. ] #question(2)[Peut-on répondre à l'hypothèse de Riemann par l'affirmatif ? par le négatif ?] #correct[ - Si l'hypothèse de Riemann admet une preuve dans ZFC, une machine de Turing qui construit toutes les preuves possibles finira par la trouver, donc `arret machineRiemann = true` répondrait par le positif. - Il va de même si la négation de l'hypothèse de Riemann admet une preuve dans ZFC. - Si celle-ci est indécidable, on ne saurait pas répondre, même avec la connaissance de $Omega$. ] #question(3)[Montrer que $Omega$ est aléatoire au sens de Chaitin-Levin.] #correct[ On note `DIAGONAL` le même programme que précédemment, mais qui note les résultats des machines et renvoie un nombre absent de cette liste. $square$ Comme `DIAGONAL n` renvoie un nombre qui n'est renvoyé par aucun programme de taille au plus $n$, sa taille $T$ est strictement supérieure à $n$. En notant $omega_n := cal(K)(Omega^n)$, on a également $T = omega_n + T'$ où $T'$ est la taille de la partie de `DIAGONAL` indépendante de $n$. En rassemblant ces deux informations, $ omega_n + T' = T > n "donc" omega_n > n - T' $ #h(1fr) $square$ On conclut que $(cal(K)(Omega^n) - n)$ est minorée par une constante ($T'$ est indépendante de $n$). Ainsi, $Omega$ est Chaitin-Levin aléatoire. #align(right, $square$) ] #question(1)[En déduire que la taille d'un programme qui calcule $Omega^n$ est en $Omega(n)$.] #correct[ C'est immédiat étant donné le résultat précédent. ]
https://github.com/0x1B05/nju_os
https://raw.githubusercontent.com/0x1B05/nju_os/main/am_notes/content/chapter2.typ
typst
#import "../template.typ": * = 使用示例 == 特殊记号 你可以 Typst 的语法对文本进行#highlight[特殊标记],我们为如下标记设定了样式: #enum( [*突出*], [_强调_], [引用 @figure], [脚注 #footnote("脚注例")], ) == 代码 行内代码使用例 `#include`,下面是代码块使用例: #code(caption: [代码块插入例])[ ```cpp #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; } ``` ] <cpp-example> == 图片 <figure> #figure(caption: [图片插入例])[#image("../figures/typst.png")]<image-example> == 表格 #figure(caption: [表格插入例])[ #table( columns: (1fr, 1fr, 1fr), [表头1] , [表头2] , [表头3], [单元格1], [单元格2], [单元格3], [单元格1], [单元格2], [单元格3], [单元格1], [单元格2], [单元格3], )] == 引用块 #blockquote[ 引用块例 #blockquote[ 二级引用块 ] ] == 公式 使用 `#mi('LaTeX equation')` 编写行内公式 #mi(`e^{ix} = \cos x + i \sin x`) 使用 `#mitex('LaTeX equation')` 编写行间公式:#mitex(`e^{ix} = cos x + i sin x`) == 定理环境 #definition("定义")[#lorem(30)] #example("示例")[#lorem(30)] #tip("提示")[#lorem(30)] #attention("注意")[#lorem(30)] #quote("引用")[#lorem(30)] #theorem("定理")[#lorem(30)] #proposition("命题")[#lorem(30)] #sectionline
https://github.com/0x1B05/nju_os
https://raw.githubusercontent.com/0x1B05/nju_os/main/lecture_notes/content/13_并发Bug的应对.typ
typst
#import "../template.typ": * #pagebreak() = 并发 Bug 的应对 == 死锁的应对 === 回顾:死锁产生的必要条件 #link("https://dl.acm.org/doi/10.1145/356586.356588")[ System deadlocks ] (1971):死锁产生的四个必要条件 - 用 “资源” 来描述 - 状态机视角:就是 “当前状态下持有的锁 (校园卡/球)” - Mutual-exclusion - 一张校园卡只能被一个人拥有 - Wait-for - 一个人等其他校园卡时,不会释放已有的校园卡 - No-preemption - 不能抢夺他人的校园卡 - Circular-chain - 形成校园卡的循环等待关系 - 站着说话不腰疼的教科书: - “理解了死锁的原因,尤其是产生死锁的四个必要条件,就可以最大可能地避免、预防和解除死锁。所以,在系统设计、进程调度等方面注意如何不让这四个必要条件成立,如何确定资源的合理分配算法,避免进程永久占据系统资源。此外,也要防止进程在处于等待状态的情况下占用资源。因此,对资源的分配要给予合理的规划。” 不能称为是一个合理的 argument - 对于玩具系统/模型 - 我们可以直接证明系统是 deadlock-free 的 - 对于真正的复杂系统 - Bullshit === 如何在实际系统中避免死锁? 四个条件中最容易达成的: 避免循环等待(如何让任何上锁的等待关系都没有环?) Lock ordering(有向无环图,拓扑排序,直接规定一个顺序) - 任意时刻系统中的锁都是有限的 - 严格按照固定的顺序获得所有锁 (Lock Ordering),就可以消灭循环等待 - “在任意时刻获得 “最靠后” 锁的线程总是可以继续执行” - 例子:修复哲学家吃饭问题 - 如何发生死锁的?(编号代表叉子) #example("Example")[ - T1: 1 2 - T2: 2 3 - T3: 3 1 ] - 人为规定先获得编号小的那一把锁,再获得编号大的那一把 #example("Example")[ - T1: 1 2 - T2: 2 3 - T3: 1 3 ] #code(caption: [lock-ordering])[ ```c void Tphilosopher(int id) { int lhs = (id + N - 1) % N; int rhs = id % N; // Enforce lock ordering if (lhs > rhs) { int tmp = lhs; lhs = rhs; rhs = tmp; } while (1) { P(&avail[lhs]); printf("+ %d by T%d\n", lhs, id); P(&avail[rhs]); printf("+ %d by T%d\n", rhs, id); // Eat printf("- %d by T%d\n", lhs, id); printf("- %d by T%d\n", rhs, id); V(&avail[lhs]); V(&avail[rhs]); } } ``` ] === Lock Ordering: 应用 (Linux Kernel: rmap.c) #tip("Tip")[ 实际情况下就是采用lock-ordering的,而且应用的很广泛。 ] #image("images/2024-03-18-21-06-49.png") Emmm…… Textbooks will tell you that if you always lock in the same order, you will never get this kind of deadlock. *Practice will tell you that this approach doesn't scale*: when I create a new lock, I don't understand enough of the kernel to figure out where in the 5000 lock hierarchy it will fit. The best locks are encapsulated: they never get exposed in headers, and are never held around calls to non-trivial functions outside the same file. You can read through this code and see that it will never deadlock, because it never tries to grab another lock while it has that one. People using your code don't even need to know you are using a lock. —— #link( "https://www.kernel.org/doc/html/latest/kernel-hacking/locking.html",)[ Unreliable Guide to Locking ] by <NAME> - 最终犯错的还是人 #tip("Tip")[ - 比如说项目里面用到了lock-ordering,但是实际的代码又不符合,希望这个时候编译器直接给个错误。 ] == Bug 的本质和防御性编程 === 回顾:调试理论 程序 = 物理世界过程在信息世界中的投影 Bug = 违反程序员对 “物理世界” 的假设和约束 - Bug 违反了程序的 specification - 该发生的必须发生 - 不该发生的不能发生 - Fault → Error → Failure === 编程语言与 Bugs 编译器/编程语言 - 只管 “翻译” 代码,不管和实际需求 (规约) 是否匹配 - “山寨支付宝” 中的余额 balance - 正常人看到 0 → 18446744073709551516 都认为 “这件事不对” (“balance” 自带 no-underflow 的含义) 怎么才能编写出 “正确” (符合 specification) 的程序? - 证明:Annotation verifier (#link("https://dafny-lang.github.io/dafny/")[ Dafny ]), [ Refinement types ]("https://dl.acm.org/doi/10.1145/113446.113468") - 推测:Specification mining (#link("http://plse.cs.washington.edu/daikon/")[ Daikon ]) - 构造:#link("https://link.springer.com/article/10.1007/s10009-012-0249-7")[ Program sketching ] - 编程语言的历史和未来 - 机器语言 → 汇编语言 → 高级语言 → 自然编程语言 === 回到现实 今天 (被迫) 的解决方法 - 虽然不太愿意承认,但始终假设自己的代码是错的 - (因为机器永远是对的) 然后呢? - 首先,做好测试 - 检查哪里错了 - 再检查哪里错了 - 再再检查哪里错了 - “防御性编程” - 把任何你认为可能 “不对” 的情况都检查一遍 === 防御性编程:实践 _把程序需要满足的条件用 `assert` 表达出来。_ 及早检查、及早报告、及早修复 - Peterson 算法中的临界区计数器 - `assert(nest == 1);` - 二叉树的旋转 - `assert(p->parent->left == p || p->parent->right == p);` - AA-Deadlock 的检查 - `if (holding(&lk)) panic();` - xv6 spinlock 实现示例(非常好) === 防御性编程和规约给我们的启发 你知道很多变量的含义 ```c #define CHECK_INT(x, cond) \ ({ panic_on(!((x) cond), "int check fail: " #x " " #cond); }) #define CHECK_HEAP(ptr) \ ({ panic_on(!IN_RANGE((ptr), heap)); }) ``` 变量有 “typed annotation” - `CHECK_INT(waitlist->count, >= 0);` - `CHECK_INT(pid, < MAX_PROCS);` - `CHECK_HEAP(ctx->rip);` `CHECK_HEAP(ctx->cr3);` - 变量含义改变 → 发生奇怪问题 (overflow, memory error, ...) - 不要小看这些检查,它们在底层编程 (M2, L1, ...) 时非常常见 - 在虚拟机神秘重启/卡住/...前发出警报 == 自动运行时检查 === 动态程序分析 通用 (固定) bug 模式的自动检查 - ABBA 型死锁 - 数据竞争 - 带符号整数溢出 (undefined behavior) - Use after free - …… 动态程序分析:状态机执行历史的一个函数 f(τ) - 付出程序执行变慢的代价 - 找到更多 bugs === Lockdep: 运行时 Lock Ordering 检查 Lockdep 规约 (Specification) - 为每一个锁确定唯一的 “allocation site” - assert: 同一个 allocation site 的锁存在全局唯一的上锁顺序 检查方法:printf - 记录所有观察到的上锁顺序,例如 [x,y,z]⇒x→y,x→z,y→z - 检查是否存在 x⇝y∧y⇝x - 我们有一个 “山寨版” 的例子 #link("https://jyywiki.cn/OS/OS_Lockdep.html")[ Lockdep 的实现 ] - Since Linux Kernel 2.6.17, also in [ OpenHarmony ](https://gitee.com/openharmony)! === ThreadSanitizer: 运行时的数据竞争检查 并发程序的执行 trace - 内存读写指令 (load/store) - 同步函数调用 - Happens-before: program order 和 release acquire 的传递闭包 对于发生在不同线程且至少有一个是写的 x,y 检查 x≺y∨y≺x - 实现:Lamport's Vector Clock - [ Time, clocks, and the ordering of events in a distributed system ](https://dl.acm.org/doi/10.1145/359545.359563) === 更多的 Sanitizers 现代复杂软件系统必备的支撑工具 - #link("https://clang.llvm.org/docs/AddressSanitizer.html")[ AddressSanitizer ] (asan); ([ paper ](https://www.usenix.org/conference/atc12/technical-sessions/presentation/serebryany)): 非法内存访问 - Buffer (heap/stack/global) overflow, use-after-free, use-after-return, double-free, ... - Linux Kernel 也有 [ kasan ](https://www.kernel.org/doc/html/latest/dev-tools/kasan.html) - #link("https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html")[ ThreadSanitizer ] (tsan): 数据竞争 - #link("https://clang.llvm.org/docs/MemorySanitizer.html")[ MemorySanitizer ] (msan): 未初始化的读取 - #link("https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html")[ UBSanitizer ] (ubsan): undefined behavior - Misaligned pointer, signed integer overflow, ... - Kernel 会带着 -fwrapv 编译 - IntelliSanitize - 等你开发 == 操作系统实验中的防御性编程 === 同学们面对的困境 理论很美好,现实很残酷 - 我们的框架直接运行在虚拟机上 - 根本没法带这些 sanitizers - 我们根本不可能 “观测每一次共享内存访问” - 直接摆烂 - (困难是摆烂的第一原因) 另一种思路 (rule of thumb) - 不实现 “完整” 的检查 - 允许存在误报/漏报 - 但实现简单、非常有用 === 例子:Buffer Overrun 检查 Canary (金丝雀) 对一氧化碳非常敏感 - 用生命预警矿井下的瓦斯泄露 (since 1911) 计算机系统中的 canary - “牺牲” 一些内存单元,来预警 memory error 的发生 - (程序运行时没有动物受到实质的伤害) === Canary 的例子:保护栈空间 (Stack Guard) ```c #define MAGIC 0x55555555 #define BOTTOM (STK_SZ / sizeof(u32) - 1) struct stack { char data[STK_SZ]; }; void canary_init(struct stack *s) { u32 *ptr = (u32 *)s; for (int i = 0; i < CANARY_SZ; i++) ptr[BOTTOM - i] = ptr[i] = MAGIC; } void canary_check(struct stack *s) { u32 *ptr = (u32 *)s; for (int i = 0; i < CANARY_SZ; i++) { panic_on(ptr[BOTTOM - i] != MAGIC, "underflow"); panic_on(ptr[i] != MAGIC, "overflow"); } } ``` === 烫烫烫、屯屯屯和葺葺葺 msvc 中 debug mode 的 guard/fence/canary - 未初始化栈: 0xcccccccc - 未初始化堆: 0xcdcdcdcd - 对象头尾: 0xfdfdfdfd - 已回收内存: 0xdddddddd - 手持两把锟斤拷,口中疾呼烫烫烫 - 脚踏千朵屯屯屯,笑看万物锘锘锘 - (它们一直在无形中保护你) ```py (b'\xcc' * 80).decode('gb2312') ``` === 防御性编程:低配版 Lockdep 不必大费周章记录什么上锁顺序 - 统计当前的 spin count - 如果超过某个明显不正常的数值 (1,000,000,000) 就报告 ```c int count = 0; while (xchg(&lk, LOCKED) == LOCKED) { if (count++ > SPIN_LIMIT) { panic("Spin limit exceeded @ %s:%d\n", __FILE__, __LINE__); } } ``` - 配合调试器和线程 backtrace 一秒诊断死锁 === 防御性编程:低配版 AddressSanitizer (L1) 内存分配要求:已分配内存 `S=[ℓ0 ,r0 )∪[ℓ1 ,r1 )∪…` - `kalloc(s)` 返回的 [ℓ,r) 必须满足 [ℓ,r)∩S=∅ - thread-local allocation + 并发的 free 还蛮容易弄错的 ```c // allocation for (int i = 0; (i + 1) _ sizeof(u32) <= size; i++) { panic_on(((u32 _)ptr)[i] == MAGIC, "double-allocation"); arr[i] = MAGIC; } // free for (int i = 0; (i + 1) _ sizeof(u32) <= alloc_size(ptr); i++) { panic_on(((u32 _)ptr)[i] == 0, "double-free"); arr[i] = 0; } ```
https://github.com/Mc-Zen/zero
https://raw.githubusercontent.com/Mc-Zen/zero/main/src/utility.typ
typst
MIT License
/// Takes a number by integer and fractional part and /// shifts specified number of digits left. Negative values /// for `digits` produce a right-shift. Numbers are automatically /// padded with zeros but both integer and fractional parts /// may become "empty" when they are zero. #let shift-decimal-left(integer, fractional, digits) = { if digits < 0 { let available-digits = calc.min(-digits, fractional.len()) integer += fractional.slice(0, available-digits) integer += "0" * (-digits - available-digits) fractional = fractional.slice(available-digits) if integer.starts-with("0") { integer = (integer + ";").trim("0").slice(0,-1) } } else { let available-digits = calc.min(digits, integer.len()) fractional = integer.slice(integer.len() - available-digits) + fractional fractional = "0" * (digits - available-digits) + fractional integer = integer.slice(0, integer.len() - available-digits) } return (integer, fractional) } #assert.eq(shift-decimal-left("123", "456", 0), ("123", "456")) #assert.eq(shift-decimal-left("123", "456", 2), ("1", "23456")) #assert.eq(shift-decimal-left("123", "456", 5), ("", "00123456")) #assert.eq(shift-decimal-left("123", "456", -2), ("12345", "6")) #assert.eq(shift-decimal-left("123", "456", -5), ("12345600", "")) #assert.eq(shift-decimal-left("0", "0012", -4), ("12", "")) #assert.eq(shift-decimal-left("0", "0012", -2), ("", "12"))
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/tbl/0.0.3/README.md
markdown
Apache License 2.0
# `tbl.typ` This is a library for [Typst](https://typst.app/) built upon Pg Biel's fabulous [`tablex`](https://github.com/PgBiel/typst-tablex) library. It allows the creation of complex tables in Typst using a compact syntax based on the `tbl` preprocessor for the traditional UNIX TROFF typesetting system. There are also some novel features that are not currently offered by Typst itself or `tablex`, namely: - Decimal point alignment (using the `decimalpoint` region option and `N`-classified columns) - Columns of equal width (using the `e` column modifier) - Columns with a guaranteed minimum width (using the `w` column modifier) - Cells that are ignored when calculating column widths (using the `z` column modifier) - Equation tables (using the `mode: "math"` region option) Many other features exist to condense common configurations to a concise syntax. For example: ```` #import "@preview/tbl:0.0.3" #show: tbl.template.with(box: true, tab: "|") ```tbl R | L R N. software|version _ AFL|2.39b Mutt|1.8.0 Ruby|1.8.7.374 TeX Live|2015 ``` ```` ![](https://raw.githubusercontent.com/maxcrees/tbl.typ/v0.0.3/test/00/02_software.png) Many other examples and copious documentation are provided in the [`README.pdf`](https://maxre.es/tbl.typ/v0.0.3.pdf) file. [The source repository](https://github.com/maxcrees/tbl.typ) also includes a test suite based on those examples, which can be ran using the GNU `make` command. See `make help` for details.
https://github.com/mintyfrankie/brilliant-CV
https://raw.githubusercontent.com/mintyfrankie/brilliant-CV/main/template/modules_en/education.typ
typst
Apache License 2.0
// Imports #import "@preview/brilliant-cv:2.0.3": cvSection, cvEntry, hBar #let metadata = toml("../metadata.toml") #let cvSection = cvSection.with(metadata: metadata) #let cvEntry = cvEntry.with(metadata: metadata) #cvSection("Education") #cvEntry( title: [Master of Data Science], society: [University of California, Los Angeles], date: [2018 - 2020], location: [USA], logo: image("../src/logos/ucla.png"), description: list( [Thesis: Predicting Customer Churn in Telecommunications Industry using Machine Learning Algorithms and Network Analysis], [Course: Big Data Systems and Technologies #hBar() Data Mining and Exploration #hBar() Natural Language Processing], ), ) #cvEntry( title: [Bachelors of Science in Computer Science], society: [University of California, Los Angeles], date: [2018 - 2020], location: [USA], logo: image("../src/logos/ucla.png"), description: list( [Thesis: Exploring the Use of Machine Learning Algorithms for Predicting Stock Prices: A Comparative Study of Regression and Time-Series Models], [Course: Database Systems #hBar() Computer Networks #hBar() Software Engineering #hBar() Artificial Intelligence], ), )
https://github.com/rdboyes/resume
https://raw.githubusercontent.com/rdboyes/resume/main/modules_zh/education.typ
typst
// Imports #import "@preview/brilliant-cv:2.0.2": cvSection, cvEntry, hBar #let metadata = toml("../metadata.toml") #let cvSection = cvSection.with(metadata: metadata) #let cvEntry = cvEntry.with(metadata: metadata) #cvSection("教育经历") #cvEntry( title: [数据科学硕士], society: [加利福尼亚大学洛杉矶分校], date: [2018 - 2020], location: [美国], logo: image("../src/logos/ucla.png"), description: list( [论文: 使用机器学习算法和网络分析预测电信行业的客户流失], [课程: 大数据系统与技术 #hBar() 数据挖掘与探索 #hBar() 自然语言处理], ), ) #cvEntry( title: [计算机科学学士], society: [加利福尼亚大学洛杉矶分校], date: [2014 - 2018], location: [美国], logo: image("../src/logos/ucla.png"), description: list( [论文: 探索使用机器学习算法预测股票价格: 回归与时间序列模型的比较研究], [课程: 数据库系统 #hBar() 计算机网络 #hBar() 软件工程 #hBar() 人工智能], ), )
https://github.com/Mc-Zen/quill
https://raw.githubusercontent.com/Mc-Zen/quill/main/src/tequila-impl.typ
typst
MIT License
#import "gates.typ" #let bgate(qubit, constructor, nq: 1, supplements: (), ..args) = (( qubit: qubit, n: nq, supplements: supplements, constructor: constructor, args: args ),) #let generate-single-qubit-gate(qubit, constructor: gates.gate, ..args) = { if qubit.named().len() != 0 { assert(false, message: "Unexpected argument `" + qubit.named().pairs().first().first() + "`") } qubit = qubit.pos() if qubit.len() == 1 { qubit = qubit.first() } if type(qubit) == int { return bgate(qubit, constructor, ..args) } qubit.map(qubit => bgate(qubit, constructor, ..args)) } #let generate-two-qubit-gate(control, target, start, end) = { if type(control) == int and type(target) == int { assert.ne(target, control, message: "Target and control qubit cannot be the same") return bgate( control, start, target - control, nq: target - control + 1, supplements: ((target, end),) ) } let gates = () if type(control) == int { control = (control,) } if type(target) == int { target = (target,) } for i in range(calc.max(control.len(), target.len())) { let c = control.at(i, default: control.last()) let t = target.at(i, default: target.last()) assert.ne(t, c, message: "Target and control qubit cannot be the same") gates.push(bgate(c, start, nq: t - c + 1, t - c, supplements: ((t, end),))) } gates } #let generate-multi-controlled-gate(controls, qubit, target) = { let sort-ops(cs, q) = { let k = cs.map(c => (c, gates.ctrl.with(0))) + ((q, target),) k = k.sorted(key: x => x.first()) let n = k.last().at(0) - k.first().at(0) if k.first().at(1) == gates.ctrl.with(0) { k.first().at(1) = gates.ctrl.with(n) } else if k.last().at(1) == gates.ctrl.with(0) { k.at(2).at(1) = gates.ctrl.with(-n) } return k } let gates = () controls = controls.map(c => if type(c) == int { (c,)} else { c }) if type(qubit) == int { qubit = (qubit,) } for i in range(calc.max(qubit.len(), ..controls.map(array.len))) { let q = qubit.at(i, default: qubit.last()) let cs = controls.map(c => c.at(i, default: c.last())) assert((cs + (q,)).dedup().len() == cs.len() + 1, message: "Target and control qubits need to be all different (were " + str(q) + " and " + repr(cs) + ")") let ops = sort-ops(cs, q) gates.push(bgate( ops.first().at(0), ops.first().at(1), nq: ops.last().at(0) - ops.first().at(0) + 1, supplements: ops.slice(1) )) } gates } #let gate(qubit, ..args) = bgate(qubit, gates.gate, ..args) #let mqgate(qubit, n: 1, ..args) = { bgate(qubit, nq: n, gates.mqgate, ..args.pos(), ..args.named() + (n: n)) } #let barrier() = bgate(0, barrier) #let x(..qubit) = generate-single-qubit-gate(qubit, $X$) #let y(..qubit) = generate-single-qubit-gate(qubit, $Y$) #let z(..qubit) = generate-single-qubit-gate(qubit, $Z$) #let h(..qubit) = generate-single-qubit-gate(qubit, $H$) #let s(..qubit) = generate-single-qubit-gate(qubit, $S$) #let sdg(..qubit) = generate-single-qubit-gate(qubit, $S^dagger$) #let sx(..qubit) = generate-single-qubit-gate(qubit, $sqrt(X)$) #let sxdg(..qubit) = generate-single-qubit-gate(qubit, $sqrt(X)^dagger$) #let t(..qubit) = generate-single-qubit-gate(qubit, $T$) #let tdg(..qubit) = generate-single-qubit-gate(qubit, $T^dagger$) #let p(theta, ..qubit) = generate-single-qubit-gate(qubit, $P (#theta)$) #let rx(theta, ..qubit) = generate-single-qubit-gate(qubit, $R_x (#theta)$) #let ry(theta, ..qubit) = generate-single-qubit-gate(qubit, $R_y (#theta)$) #let rz(theta, ..qubit) = generate-single-qubit-gate(qubit, $R_z (#theta)$) #let u(theta, phi, lambda, ..qubit) = generate-single-qubit-gate( qubit, $U (#theta, #phi, #lambda)$ ) #let meter(..qubit) = generate-single-qubit-gate(qubit, constructor: gates.meter) #let cx(control, target) = generate-two-qubit-gate( control, target, gates.ctrl, gates.targ ) #let cz(control, target) = generate-two-qubit-gate( control, target, gates.ctrl, gates.ctrl.with(0) ) #let swap(control, target) = generate-two-qubit-gate( control, target, gates.swap, gates.swap.with(0) ) #let ccx(control1, control2, target) = generate-multi-controlled-gate( (control1, control2), target, gates.targ ) #let cccx(control1, control2, control3, target) = generate-multi-controlled-gate( (control1, control2, control3), target, gates.targ ) #let ccz(control1, control2, target) = generate-multi-controlled-gate( (control1, control2), target, gates.ctrl.with(0) ) #let cca(control1, control2, target, content) = generate-multi-controlled-gate( (control1, control2), target, gates.gate.with(content) ) #let ca(control, target, content) = generate-two-qubit-gate( control, target, gates.ctrl, gates.gate.with(content) ) #let multi-controlled-gate(controls, qubit, target) = generate-multi-controlled-gate( controls, qubit, target ) /// Constructs a circuit from operation instructions. /// /// - n (auto, int): Number of qubits. Can be inferred automatically. /// - x (int): Determines at which column the subcircuit will be put in the circuit. /// - y (int): Determines at which row the subcircuit will be put in the circuit. /// - append-wire (boolean): If set to `true`, the a last column of outgoing wires will be added. /// - ..children (any): Sequence of instructions. #let build( n: auto, x: 1, y: 0, append-wire: true, ..children ) = { let operations = children.pos().flatten() let num-qubits = n if num-qubits == auto { num-qubits = calc.max(..operations.map(x => x.qubit + calc.max(0, x.n - 1))) + 1 } let tracks = ((),) * num-qubits for op in operations { let start = op.qubit // if start < 0 { start = num-qubits + start } let end = start + op.n - 1 assert(start >= 0 and start < num-qubits, message: "The qubit `" + str(start) + "` is out of range. Leave `n` at `auto` if you want to automatically resize the circuit. ") assert(end >= 0 and end < num-qubits, message: "The qubit `" + str(end) + "` is out of range. Leave `n` at `auto` if you want to automatically resize the circuit. ") let (q1, q2) = (start, end).sorted() if op.constructor == barrier { (q1, q2) = (0, num-qubits - 1) } let max-track-len = calc.max(..tracks.slice(q1, q2 + 1).map(array.len)) let h = (q1, q2) let h = (start,) + op.supplements.map(x => x.first()) for q in range(q1, q2 + 1) { let dif = max-track-len - tracks.at(q).len() if op.constructor != barrier and q not in h { dif += 1 } tracks.at(q) += (1,) * dif } if op.constructor != barrier { tracks.at(start).push((op.constructor)(..op.args, x: x + tracks.at(start).len(), y: y + start)) for (qubit, supplement) in op.supplements { tracks.at(qubit).push((supplement)(x: x + tracks.at(end).len(), y: y + qubit)) } } } let max-track-len = calc.max(..tracks.map(array.len)) + 1 for q in range(tracks.len()) { tracks.at(q) += (1,) * (max-track-len - tracks.at(q).len()) } let num-cols = x + calc.max(..tracks.map(array.len)) - 2 if append-wire { num-cols += 1 } let placeholder = gates.gate( none, x: num-cols, y: y + num-qubits - 1, data: "placeholder", box: false, floating: true, size-hint: (it, i) => (width: 0pt, height: 0pt) ) (placeholder,) + tracks.flatten().filter(x => type(x) != int) } /// Constructs a graph state preparation circuit. /// /// - n (auto, int): Number of qubits. Can be inferred automatically. /// - x (int): Determines at which column the subcircuit will be put in the circuit. /// - y (int): Determines at which row the subcircuit will be put in the circuit. /// - invert (boolean): If set to `true`, the circuit will be inverted, i.e., a circuit for /// "uncomputing" the corresponding graph state. /// ..edges (array): #let graph-state( n: auto, x: 1, y: 0, invert: false, ..edges ) = { edges = edges.pos() let max-qubit = 0 for edge in edges { assert(type(edge) == array, message: "Edges need to be pairs of vertices") assert(edge.len() == 2, message: "Every edge needs to have exactly two vertices") max-qubit = calc.max(max-qubit, ..edge) } let num-qubits = max-qubit + 1 if n != auto { num-qubits = n assert(n > max-qubit, message: "") } let gates = ( h(range(num-qubits)), barrier(), edges.map(edge => cz(..edge)) ) if invert { gates = gates.rev() } build( x: x, y: y, ..gates ) } /// Template for the quantum fourier transform (QFT). /// - n (auto, int): Number of qubits. /// - x (int): Determines at which column the QFT routine will be placed in the circuit. /// - y (int): Determines at which row the QFT routine will be placed in the circuit. #let qft( n, x: 1, y: 0 ) = { let gates = () for i in range(n - 1) { gates.push(h(i)) for j in range(2, n - i + 1) { gates.push(ca(i + j - 1, i, $R_#j$)) gates.push(p(i + j - 1)) } gates.push(barrier()) } gates.push(h(n - 1)) build(n: n, x: x, y: y, ..gates) }
https://github.com/jedel1043/Math-Notes
https://raw.githubusercontent.com/jedel1043/Math-Notes/main/style.typ
typst
#import "theorems.typ": * #let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em)).with(numbering: none) #let theorem = thmbox( "theorem", "Theorem", fill: rgb("#e8e8f8") ).with(numbering: none) #let lemma = thmplain( "lemma", "Lemma", base: "theorem", titlefmt: strong ).with(numbering: none) #let proof = thmplain( "proof", "Proof", base: "theorem", bodyfmt: body => [#body #h(1fr) $square$] ).with(numbering: none) #let conf( title: none, doc ) = { set page( paper: "us-letter" ) set align(center) text(17pt, title) set align(left) set enum(numbering: "a.1)") set math.mat(gap: 0.5em) show enum: a => block(a, width: 100%) show link: underline doc }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/terms_05.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page / Term: Not in list /Nope
https://github.com/k0tran/bsbd_labs_s2
https://raw.githubusercontent.com/k0tran/bsbd_labs_s2/master/reports/lab1.typ
typst
#import "template.typ": * #show: lab.with(n: 1) = Диаграмма сущностей и разделение на схемы Для начала напомню, что база данных, разработанная в предыдущем семестре используется в гипотетическом канцелярском магазине. Product это конкретная единица товара, Product Type - "род" товара. Так же учитываются поставки и продажи, на оба события назначается ответственный работник/кассир. #pic(img: "lab1/diagram.png")[Диаграмма сущностей] Далее по заданию необходимо разделить сущности на схемы при необходимости. Я посчитал полезным ограничить примерные границы для ролей следующим образом: - PDB (Product DataBase) - все что относится к данным о продуктах в целом: - Product Type - Country - Vendor - Category - inventory - продукты на витринах: - Product - sales - все что относится к продажам: - Sale - Customer - staff - менеджмент сотрудников: - Employee - Job - logistics - поставки: - Supply Можно заметить, что в inventory и logistics только по одному элементу. Это сделано для того что бы все оставалось организованным и при этом не хранилось в public, так как с полными привилегиями по умолчанию можно легко накосячить. Для того что бы добавить схему необходимо прописать ```sql CREATE SCHEMA pdb; ``` И после использовать префикс в виде схемы в названии таблицы (например вместо product pdb.product). #pagebreak() = Роли После разбиения на схемы было решено ввести 4 роли: роль для модификации pdb, роль для продаж (кассиры), роль для hr'ов и роль для управления логистикой (какие-нибудь менеджеры): - pdb_role - SELECT, INSERT, UPDATE, DELETE на pdb - sales_role - роль "продавца", списывает продукты, добавляет sale'ы. - SELECT, INSERT, UPDATE, DELETE на sales - SELECT, UPDATE на inventory (там только bool поставить надо) - staff_role - роль для HR'ов: - SELECT, INSERT, UPDATE, DELETE на staff - SELECT на sales (для того что бы потенциально смотреть насколько каждый сотрудник эффективен) - logistics_role - роль для управления поставками: - SELECT, INSERT, UPDATE, DELETE на logistics и inventory Важно отметить, что особо глубокого смысла в данном разделении нет, я просто подумал про справедливые, но строгие требования и написал их как вижу. Также замечу, что ни одна роль не имеет системных привелегий. Это потому, что они здесь не должны быть. Данная архитектура уже предусматривает добавление товара и его параметров. Если все-таки бд необходимо будет перестроить, то это уже будут кардинальные изменения. В таком случае разумно использовать суперпользователя. #pagebreak() = Проверка ролей == Краткий экскурс в postgres При выполнении лабораторных я использовал docker образ postgres. Что бы поднять его у себя сначала пуллим, а затем, собственно, поднимаем (user:user простой тестовый пароль): ```sh sudo docker pull postgres sudo docker run -itd -e POSTGRES_USER=user -e POSTGRES_PASSWORD=user -p 5432:5432 -v /data:/var/lib/postgresql/data --name postgresql postgres ``` После этого подключится к серверу в качестве user с той же машины можно будет следующей командой: ```sh PGPASSWORD=user psql -U user -d mydb -h localhost ``` Если у вас пишет, что mydb не существует, то просто создайте ее от имени user: ```sh PGPASSWORD=user psql -U user -h localhost -c "CREATE DATABASE mydb;" ``` Напоследок отмечу, что выполнить просто команды можно через `-c`, выполнить файл через `-f`. Файл `setup.sql` используется для создания тестовой бд. == Просмотр pg_roles Для того что бы быстро задавать использовался файл setup.sql (см приложение). Зайдем на сервер и просмотрим pg_roles #pic(img: "lab1/pg_roles.png")[pg_roles] Как можно убедится, ни одна роль не имеет системных привелегий. Теперь пройдемся по ролям. == pdb_role ```sql -- should allow SELECT vendor FROM pdb.product_type; -- should deny SELECT salary, days_per_week FROM sales.employee; ``` #pic(img: "lab1/r_pdb.png")[Тест роли (1)] == sales_role ```sql -- should allow SELECT price FROM inventory.product; -- should deny DELETE FROM inventory.product WHERE price > 1000; ``` #pic(img: "lab1/r_sales.png")[Тест роли (2)] == staff_role ```sql -- should allow SELECT name FROM staff.employee; -- should deny DELETE FROM inventory.product WHERE price > 1000; ``` #pic(img: "lab1/r_staff.png")[Тест роли (3)] == logistics ```sql -- should allow SELECT price FROM inventory.product; -- should deny SELECT salary, days_per_week FROM sales.employee; ``` #pic(img: "lab1/r_logistics.png")[Тест роли (4)] #pagebreak() // Костыль что бы заголовки были без номера #set heading(numbering: (..numbers) => if numbers.pos().len() <= 0 { return "" } ) #endhead[Заключение] В данной лабораторной работе были рассмотрены такие важные аспекты PostgreSQ как схемы и роли. Сначала были выбраны наиболее подходящие схемы, а затем определены роли, соответствующие функционалу канцелярского магазина. Также было произведено подключение и проверка привилегий ролей, чтобы убедиться, что они соответствуют ожиданиям. #pagebreak() #endhead[Приложение А] Код setup.sql #let text = read("../playground/setup.sql") #raw(text, lang: "sql") #endhead[Приложение B] Код для заполенния таблицы #let text = read("../playground/fill.sql") #raw(text, lang: "sql")