repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/Tobias-Wennberg/typst-gramar-lsp
https://raw.githubusercontent.com/Tobias-Wennberg/typst-gramar-lsp/main/555_timer.typ
typst
Apache License 2.0
/* En inre blick av 555-kretsen © 2023 by <NAME> is licensed under CC BY-SA 4.0. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ */ #import "template.typst": conf #let Vcc=text[`V`#sub[`cc`]] #let TRIG=overline[`TRIGGER`] #let Vcontrol=text[`V`#sub[`CONTROL`]] #let title = [ En inre blick av 555-kretsen ] #show: doc => conf( title: title, authors: ( ( name: "<NAME>", affiliation: "Stockholm Science & Innovation School (SSIS)", email: "<EMAIL>", ), ), doc, ) = Om En 555 timer integrerad krets (IC) är en typisk krets för att skapa timer funktioner. Dessa kan vara förskjutningar, eller pulsgenerering. Pinouten är följande: + `GND` + $Vcc$ + $TRIG$ + `OUTPUT` + #overline[`RESET`] + `CONTROL` + `THRESHOLD` + `DISCHARGE` == `GND` _Ground/jord_ Detta är jord och ska (oftast) kopplas till motsvarande jord i kretsen. == `Vcc` _Voltage Common (c)_ ska kopplas till ström. == *$TRIG$* När $TRIG$ faller lägre än $1/2$ av $Vcontrol$ blir `OUTPUT` hög och timer intervallen startar. Medan $TRIG$ fortsätter vara låg är `OUTPUT` hög. == `OUTPUT` _push-pull_ kontakten (p.p) driver mellan låg och hög. == #overline[`RESET`] Timinginterval återställs när denna blir låg. == `CONTROL` Ger tillgång till interna spänningsdivideraren. Kopplas oftast till en $470 mu F$ kondensator. == `THRESHOLD` När denna är högre än $Vcontrol$ slutar `OUTPUT` hög intervallen och `OUTPUT` blir låg. == `DISCHARGE` Detta är en _open-drain (O.D)_ port. Den kopplas till `GND` när `OUTPUT` är låg. #show: rest => columns(1, rest) = INRE DELAR En 555-timer's krets är uppdelad av 6 delar: + Voltage divider + `THRESHOLD` jämnförare + $TRIG$ jämnförare + Latch + Output + Discharge == VOLTAGE DIVIDER Härifrån kommer namnet 555 i 555-timer. Det är tre $5 k Omega$ motstånd seriekopplade mellan jord och spänning: #align(center)[#image("./voltage_divider.svg", height: 3cm)] Detta ger en spänning av $1/3 Vcc$ vid $"VD"_1$ och $2/3 Vcc$ vid $"VD"_2$ == `THRESHOLD-` OCH `TRIGGER` JÄMFÖRARE En jämförare jämför två spänningar. Den ger hög om $V_+ > V_-$ och låg om $V_+ < V_-$ $ V_("out") := cases( 1 "om" V_(+) > V_(-), 0 "om" V_{+} < V_(-), ) $ Det är två jämförare i 555'an. Threshold jämföraren jämför $"VD"_1$ (från `Voltage Divider`) och `THRESHOLD`; trigger jämföraren jämför $"VD"_2$ med $TRIG$. #align(center)[#image("comparator.svg", height: 3cm)] == LATCH 555'an använder en set-release (SR) latch som sparar statusen på timern. En SR-latch bevarar senaste inputen: om senast _S_ var hög är _Q_ hög och _#overline("Q")_ låg; om senast _R_ var hög är _#overline("Q")_ hög och _Q_ låg. Många latch'ar har även en _RESET_ som tar _Q_ låg och _#overline("Q")_ hög. Vissa SR-latch'ar har inte _#overline("Q")_ och på 555'an är den oanvänd. Latchen är kopplad mellan C#sub("TH") och C#sub("TR") från jämförarna. #align(center)[#image("latch.svg", height: 3cm)] == OUTPUT Denna förstärker *inversen* av signalen från `Latch`. == DISCHARGE Kopplar `DISCHARGE` till `GND` när `OUTPUT/Latch` är hög. #align(center)[#image("discharge.svg", height: 3cm)] = RESULTAT #align(center)[#image("full.svg", height: 4cm)] = LÄGEN Man kan koppla in 555 kretsen på många sätt. Dessa sätt kallas lägen. Beroende på läget fungerar kretsen på olika sätt. De främsta lägena är - Astabil - Monostabil - Schmitt trigger Några andra noterbara är - *Sågtands oscillatorn* som skapar vågor gradvis och sedan dyker, likt ett sågblad. - *Låg sändninscykel oscillatorn*, som skapar en kort hög puls. - *Pulsbredds modulatorn* - *Förlorad puls detektorn*, som märker om en puls inte kom. == ASTABIL #align(center)[ #image("astabil_circuit.svg", width: 6cm)] i astabilt läge ger 555'an en kontinuerlig rektangulär puls med en satt period. #align(center)[#table( columns: (auto, auto), inset: 0pt, gutter: 0pt, align: horizon, fill: none, stroke: none, [#image("astabil_pulse.svg", height: 5.8cm)], [ #table( columns: (auto, auto, auto), inset: 10pt, align: horizon, [*C spänning*], [*inre latch*], [`OUTPUT`], $0$, "0", "1", $2/3 Vcc$, "0", "1", $1/3 Vcc$, "1", "0", $2/3 Vcc$, "0", "1", $1/3 Vcc$, "1", "0", ) ] )] + C är 0V, vilken innebär att `TRIGGER` är $< 1/3 Vcc$ och `OUTPUT` = 1. Det innebär även att `DISCHARGE` är öppen och kondensatorn laddas. + C är > $2/3 Vcc$ vilket innebär `DISCHARGE` $> 2/3 Vcc$ och `OUTPUT` = 0. Det innebär även att `DISCHARGE` är stängd och kondensatorn börjar laddas ur. + C är < $1/3 Vcc$ vilket innebär att `DISCHARGE` är $< 1/3 Vcc$ och `OUTPUT` = 1. `DISCHARGE` öppnas och kondensatorn börjar laddas. Notera att laddningen går genom R#sub[1] och R#sub[2] medan urladdningen endast går genom R#sub[2]. Detta innebär att `OUTPUT` kommer vara hög längre än låg. Ekvationen är $ t_("high") &= ln 2 dot (R_1 + R_2)C \ t_("low") &= ln 2 dot R_2 C $ och frekvensen $f$ blir $ f = 1/t_("high") + t_("low") = 1/(ln 2 dot (R_1 + 2R_2)C) $ och sändningscykeln \(D\) blir $ D("%") = t_("high")/t_("high") + t_("flow") 100 = (R_1 + R_2)/(R_1+2R_2) dot 100 $ === HÄRLEDNING FORMLER #align(center)[#image("RC_charging.svg", height: 3cm)] För en RC laddningskrets, där man laddar en kondensator över ett motstånd, tar det en viss tid för kondensatorn att ladda. Denna tid kommer bero på motståndet - _R_ - och kondensatorns - _C_. För fallande läget av spänningen över kondensatorn gäller differentialekvationen $ C (d V)/(d t) + V/R = 0 $ #table( columns: (auto,auto),inset: 0pt, gutter: 0pt, align: horizon, fill:none, stroke: none, [ Där V är spänningen över kondensatorn, C kapacitansen och R motståndet mellan kondensatorn positiva och negativa sida. ],[ #align(center)[#image("RC_discharge.svg", height: 2cm)]]) #let IF=$e^(t/(R C))$ #let nIF=$e^(-t/(R C))$ $ (d V)/(d t) + V /(R C) &= 0 \ #text("I.F.") & IF \ d/(d t) V IF &= 0 \ V IF &= K#text(", där K är en konstant") \ V &= K nIF $ Den allmäna formel för en kondensators naturliga urladdning i en RC krets är därmed $V = K e^(-t/(R C))$. Vi kan nu applicera den för bistabila 555-kretsen: $ V &= K e^(-t/(R C)) \ V(0) &= 2/3 epsilon#text(", där") epsilon#text(" är spänningen i kretsen") \ K &= 2/3 epsilon \ V &= 2/3 epsilon e^(-t/(R C)) \ V(t_1) &= epsilon/3 \ 2/3 epsilon e^(-t_1/(R C)) &= epsilon/3 \ e^(-t_1/(R C)) &= 1/2 \ -t_1/(R C) &= ln 1/2 \ t_1 &= ln 2 dot R C $ En allmän funktion för spänningsändringen för en kondensator i en RC-krets är lite mer komplicerad att härleda. Enligt _Kirchoff's lag_ vet vi $epsilon - V_R -V_c = 0$ där $epsilon$ är kretsens spänning, $V_R$ är spänningen över motståndet och $V_C$ spänningen över kondensatorn i våran krets där resistorn och kondensatorn är seriekopplad mellan spänningskällan och jord. Kapacitans är definerad $C=q/U equiv V_C = q/C$. Med _Ohm's lag_ vet vi $V_R = I R$ och ströms definition vet vi $I = (d q)/(d t)$. $ epsilon - V_R - V_C &= 0 \ epsilon - I R - q/C &= 0 \ epsilon - R (d q)/(d t) - q/C &= 0 $ Vi löser diff. ekvationen #let IF=$e^(t/(C R))$ #let nIF=$e^(-t/(C R))$ $ (d q)/(d t) + q/(C R) &= epsilon/R \ #text("I.F. ") &IF \ d/(d t)q IF &= epsilon/R IF \ q IF &= integral epsilon/R IF d t = C epsilon dot IF + K", Där K är en konstant" \ q &= C epsilon + K nIF $ Om kretsen startar på $0C$ säger vi $ q(0) &= 0 \ C epsilon + K e^(-0/(C R)) &= 0 \ C epsilon + K &= 0 \ K &= -C epsilon \ q &= C epsilon - C epsilon dot nIF \ &= C epsilon (1 - nIF) \ $ För överiga värden på startladdningen $q_0$ räknas $ q(0) &= q_0 \ C epsilon + K nIF &= q_0 \ C epsilon + K &= q_0 \ K &= q_0 - C epsilon \ q &= C epsilon + (q_0 - C epsilon) nIF $ Nu kan vi skapa en funktion för spänningen $ V_c=q/C = (C epsilon + (q_0 - C epsilon) nIF)/C = epsilon + (q_0 - C epsilon)/C nIF) = epsilon + (V_0 - epsilon)nIF $ Med denna formel kan vi härleda båda faserna för astabila läget. Vi sätter $R_1$ och $R_2$ som motstånden och $C_1$ kondensatorn i våran 555'krets. För fas 1 löser vi t: $ R &= R_1 +R_2 \ C &= C_1 \ V_0 &= 1/3 epsilon \ V_c (t) &= 2/3 epsilon \ epsilon + (1/3 epsilon - epsilon)nIF &= 2/3 epsilon \ 3/2 + 1/2 - 3/2 nIF &=1 \ nIF &= 1/2 \ t/(C R) &= ln 2 \ t = ln 2 dot C R &= ln 2 dot C_1(R_1 + R_2) $ För fas 2: $ R &= R_2 \ C &= C_1 \ V_0 &= 2/3 epsilon \ V_c (t) &= 1/3 epsilon \ epsilon + (2/3 epsilon - epsilon) nIF &= 1/3 epsilon \ 3 + (2 - 3)e^(-t/( C R)) &=1 \ nIF &= 2 \ t/(C R) &= ln 2 \ t = ln 2 dot C R &= ln 2 dot C R_2 $ == MONOSTABIL I monostabilt läge produceras en hög puls under en viss tid, beroende på R och C när `TRIG` ger en puls $> 1/3Vcc$ (_hög_). `TRIG`'s normalläge ska vara $< 1/3Vcc$(_låg_). #align(center)[#image("monostabil_circuit.svg", height: 5cm)] + `TRIG` börjar låg. `THRESHOLD`$> 2/3 Vcc$ vilket innebär att `OUTPUT` = 0 och `DISCHARGE` är öppen. $V_C arrow 0$ + `TRIG` ger en puls. Latchen slår om, `OUTPUT` blir hög, `DISCHARGE` stängs, och kondensatorn börjar ladda genom motståndet. + $V_C > 2/3 Vcc$. Latchen slår om, `OUTPUT` blir låg, `DISCHARGE` öppnas, och kondensatorn laddar ur snabbt. Tiden för att ladda motståndet är $t = R C ln 3$ === HÄRLEDNING FORMEL Vi vet från härledningen för bistabil att tiden för spänningsförändringen för kondensatorn i en RC-krets är $ V_c &= epsilon + (V_0 - epsilon)nIF $ Spänningen i kondensatorn vid start är försumbar, och den är klar vid $V_C = 2/3 Vcc$. $ V_c &= epsilon + (V_0 - epsilon)nIF \ V_0 &= 0 \ V_c &= epsilon - epsilon nIF = epsilon (1 - nIF) \ V_c (t_1) &= 2/3 epsilon \ epsilon (1 - e^(-t_1/(C R))) &= 2/3 epsilon \ 1 - nIF &= 2/3 \ nIF &= 1/3 \ t &= C R ln 3 $ == BISTABIL SR LATCH 555'an kan användas som en aktiv-låg SR latch #align(center)[#image("SR_latch.svg", height: 5cm)] Hur denna krets fungerar är trivialt och lämnas som uppgift åt läsaren.
https://github.com/Slyde-R/not-jku-thesis-template
https://raw.githubusercontent.com/Slyde-R/not-jku-thesis-template/main/abstract.typ
typst
MIT No Attribution
#let abstract(body, lang: "en") = { let überschriften = (en: "Abstract", de: "Zusammenfassung") v(1fr) align(center, text(1.4em, weight: 600, überschriften.at(lang))) body v(1fr) pagebreak() }
https://github.com/lrmrct/CADMO-Template
https://raw.githubusercontent.com/lrmrct/CADMO-Template/main/template/theorems.typ
typst
#let theorem_counter = counter("theorem_counter") #let theorem( body, name: "Theorem", author: none, ) = { theorem_counter.step() [ #strong()[ #name #context { counter(heading.where(level: 1)).display() "." theorem_counter.display() } #if author != none { [(#author)] } ] #h(0.6em) #if name != "Rule" { emph()[#body] } else { body } ] } #let proof( body ) = { box[ #strong()[Proof]#h(0.4em) #body #h(1fr) $square$ ] } #let counter_reset( theorem_counter: theorem_counter ) = { theorem_counter.update(0) }
https://github.com/maucejo/book_template
https://raw.githubusercontent.com/maucejo/book_template/main/src/_book-params.typ
typst
MIT License
#let colors = ( red: rgb("#c1002a"), gray: rgb("#dddddd").darken(15%) ) #let states = ( localization: state("localization"), in-outline: state("in-outline", false), num-pattern: state("num-pattern", "1.1."), num-pattern-fig: state("num-pattern-fig", "1.1"), num-heading: state("num-heading", "1"), page-numbering: state("page-numbering", "1/1"), isappendix: state("isappendix", false), isbackcover: state("isbackcover", false), author: state("author", none), title: state("title", none), ) #let fig-supplement = [Figure] #let text-size = 12pt #let paper-size = "a4"
https://github.com/han0126/MCM-test
https://raw.githubusercontent.com/han0126/MCM-test/main/2024校赛typst/chapter/chapter5.typ
typst
#import "../template/template.typ": * #import "@preview/mitex:0.2.4": * = 模型的建立与求解 == 第一小问模型的建立与求解 === 基于秩和比综合评价模型的建立 针对本问使用秩和比综合评价法($"RSR"$法)来建立在不排序的情况下对数据进行分级的模型#cite(<wx1>)。$"RSR"$法的基本思想是在一个$n$行($n$个评价对象)$p$列($p$个评价指标)矩阵中,通过秩转换,获得一个无量纲的统计量$"RSR"$值,再以$"RSR"$值对评价对象的优劣进行分档。 首先构建模型,步骤如下: \ *Step1:*选取评价对象 对于84个给出的大学生赛事直接进行评价会产生较多的工作量,故根据重要性和可评性以及评估的实用性选取了$"14"$个大学生赛事进行整体评估,其分别为中国高校计算机大赛、全国大学生物流设计大赛、全国大学生结构设计竞赛、全国大学生节能减排社会实践与科技竞赛、全国大学生机械创新设计大赛、全国大学生机器人大赛、全国大学生化工设计竞赛、全国大学生广告艺术大赛、全国大学生电子设计竞赛、全国大学生电子商务“创新、创意及创业”挑战赛、两岸新锐设计竞赛·华灿奖、ACM-ICPC国际大学生程序设计竞赛、“西门子杯”中国智能制造挑战赛以及“挑战杯”全国大学生课外学术科技作品竞赛。为方便接下来的计算和表达,按以上给出的顺序依次将这$"14"$个比赛编号$"1~14"$。由此选择出数量较少的赛事,方便数据的收集和分析。 \ *Step2:*选取评价指标并同趋化处理数据 影响对大学生竞赛赛事评价的指标多种多样,从各方面皆有涉及。通过查阅文献我们进行合理的指标选取,最终保留赛事参加总人数、赛事举办届数、CNIK数量、ALEXA国内排名以及主办方权威性共计四项指标来进行评价,其五项指标分别展现了赛事的参与度、办赛经验、赛事研究价值、赛事热度以及赛事的权威性能,足以公平有效地对各项大学生赛事评价和给出评级。 \ *Step3:*确认指标权重 对数据的处理包括对其进行清洗和预处理,涵盖去除缺失数据、异常值的处理等。为简化处理,对于主办方的设定采取设置不同大小的数值的方式,更加重要的主办方选取更大的数字,例如多部委(如教育部)主办的选择更大的数字,而协会和企业主办的则选用较小的数字。 对于数据进行同趋化处理与量纲问题的考虑,并采用熵权法确认各指标权重,计算出的指标权重如下表: #tbl( table( columns: (1fr,)*4, align: center+horizon, stroke: none, table.hline(stroke: 1.5pt), table.cell(colspan: 4)[*熵权法*], table.hline(stroke: 0.8pt), [*项*],[*信息熵值$d$*],[*信息效用熵值$e$*],[*权重$\%$*], table.hline(stroke: 0.8pt), [参赛人数],[0.295],[0.705],[51.256], table.hline(stroke: 0.8pt), [CNIK数],[0.712],[0.288],[20.942], table.hline(stroke: 0.8pt), [*项*],[*信息熵值$d$*],[*信息效用熵值$e$*],[*权重$\%$*], table.hline(stroke: 0.8pt), [举办届数],[0.843],[0.157],[11.419], table.hline(stroke: 0.8pt), [ALEXA国内排名],[0.921],[0.079],[5.764], table.hline(stroke: 0.8pt), [主办方权威度],[0.854],[0.146],[10.619], table.hline(stroke: 0.8pt), table.hline(stroke: 1.5pt) ), caption: "各项指标权重" ) #h(2em)根据上表展示的由熵权法得出的权重计算结果,对各指标权重进行分析如下:熵权法的权重计算结果显示,参赛人数的权重为$51.256%$、CNIK数的权重为$20.942%$、举办届数的权重为$11.419%$、ALEXA国内排名的权重为$5.764%$、主办方权威度的权重为$10.619%$,其中指标权重最大值为参赛人数($51.256%$),最小值为ALEXA国内排名($5.764%$)。 \ *Step4:*秩值的计算 根据每一个具体的评价指标按其指标值的大小进行排序,得到秩次 ,用秩次 来代替原来的评价指标值,根据编秩结果建立各指标的秩次数据矩阵。计算秩的方法大致分为两种,为整秩法和非整秩法。整秩法即将 个评价对象的 个评价指标排列成 行 列的原始数据表。编出每个指标各评价对象的秩,其中效益型指标从小到大编秩,成本型指标从大到小编秩,同一指标数据相同者编平均秩。得到秩矩阵 ;而非整秩法用类似于线性插值的方式对指标值进行编秩,以改进 法编秩方法的不足,所编秩次与原指标值之间存在定量的线性对应关系,从而克服了 法秩次化时易损失原指标值定量信息的缺点。 因此,本题选择采用整秩法将每一个具体的考评指标数值按高优指标从小到大进行编秩,得到秩次 ,再用秩次 来代替原来的考评指标值。根据编秩结果建立各考评指标的秩次数据矩阵: #mitex( ` R=\begin{pmatrix} R_{1,1} &\cdots & R_{1,5} \\ \vdots & \ddots & \vdots \\ R_{19,1} & \cdots & R_{19,5} \end{pmatrix} ` ) *Step5:*$"RSR"$值的计算 利用 Step2 的秩次,计算得到 值: $ "RSR"_n=1/(17times 3)sum_(p=1)^3 R_(n,p) $ *Step6:*分布表格的列写与$"Probit"$值的求得 $"RSR"$的分布是指用概率单位 表达的值特定的累计频率。其方法如下: 1. 将$"RSR"$值按照从小到大的顺序排列; 2. 列出各组频数$f$; 3. 计算各组累计频数; 4. 确定各组$"RSR"$的秩次$R$及平均秩次$overline(R)$; 5. 计算向下累计频率$(overline(R)-\/ n)times 100\%$,最后一项用修正; 6. 根据累计频率,查询“百分数与概率单位对照表”,求其所对应概率单位$"Probit"$值。 \ 值得注意的是,系统在编秩过程中进行的是同向趋势化处理,即将负向指标(成本型指标)转化成正向指标(效益型指标),统一对所有指标进行从小到大编秩。 \ *Step7:*直线回归方程的计算与对应$"RSR"$估计值的拟合 利用最小二乘估计法,以概率单位值$"Probit"$为自变量,以$"RSR"$值为因变量,计算线性回归方程。得出如下形式的结果: #equation( $ hat(R S R)=a+b times "Probit" $ ) *Step8:*依据拟合$"RSR"$值的排序与分级 按照回归方程推算得到的$"RSR"$估计值对考评对象进行分档排序。分档数量定为$3$档,分别对应优、中、差。 === 基于综合评价模型的求解 对本模型进行求解得出表格2、表格3,表格2给出了考评指标数据表和$"RSR"$的计算结果,表格3给出了$"RSR"$值分布。 #tbl( table(columns: (1fr,)*8, align: center+horizon, stroke: none, table.hline(stroke: 1.5pt), table.header()[*索引*][$X_1:$参赛人数][$R_1:$参赛人数][#sym.dots.h.c][$X_5$:主办方权威度][$R_5:$主办方权威度][$"RSR"$][排名], table.hline(stroke: 0.8pt), [1],[0.01],[1.07],[#sym.dots.h.c],[0.50],[7.50],[0.19],[10], [2],[0.00],[1.00],[#sym.dots.h.c],[0.00],[1.00],[0.08],[14], [3],[0.00],[1.03],[#sym.dots.h.c],[0.00],[1.00],[0.15],[12], [4],[0.01],[1.18],[#sym.dots.h.c],[0.50],[7.50],[0.19],[9], [5],[0.01],[1.11],[#sym.dots.h.c],[0.00],[1.00],[0.24],[4], [6],[0.00],[1.02],[#sym.dots.h.c],[0.50],[7.50],[0.19],[8], [7],[0.01],[1.08],[#sym.dots.h.c],[0.50],[7.50],[0.23],[5], [8],[0.02],[1.28],[#sym.dots.h.c],[0.50],[7.50],[0.19],[7], [9],[0.02],[1.31],[#sym.dots.h.c],[1.00],[14.00],[0.42],[3], [10],[0.00],[1.03],[#sym.dots.h.c],[0.50],[7.50],[0.15],[13], [11],[0.16],[3.10],[#sym.dots.h.c],[0.00],[1.00],[0.21],[6], [12],[0.00],[1.00],[#sym.dots.h.c],[0.50],[7.50],[0.47],[2], [13],[0.01],[1.08],[#sym.dots.h.c],[0.50],[7.50],[0.17],[11], [14],[1.00],[14.00],[#sym.dots.h.c],[1.00],[14.00],[0.84],[1], table.hline(stroke: 1.5pt), ), caption: "" ) #tbl( table(columns: (1fr,)*6, align: center+horizon, stroke: none, table.hline(stroke: 1.5pt), table.header()[$"RSR"$][频数][累计频数$sum f$][评价秩数][评价秩数$\/ n times 100 %$][$"Probit"$], table.hline(stroke: 0.8pt), [0.085],[1],[1],[1],[7.143],[3.535], [0.150],[1],[2],[2],[14.286],[3.932], [0.152],[1],[3],[3],[21.429],[4.208], [0.166],[1],[4],[4],[28.571],[4.434], [0.189],[1],[5],[5],[35.714],[4.634], [0.193],[1],[6],[6],[42.857],[4.820], [0.194],[1],[7],[7],[50.000],[5.000], [0.195],[1],[8],[8],[57.143],[5.180], [0.207],[1],[9],[9],[64.286],[5.366], [0.227],[1],[10],[10],[71.429],[5.566], [0.235],[1],[11],[11],[78.571],[5.792], [0.418],[1],[12],[12],[85.714],[6.068], [0.472],[1],[13],[13],[92.857],[6.465], [0.843],[1],[14],[14],[98.214],[7.100], table.hline(stroke: 1.5pt), ), caption: "" ) #h(2em)运用SPSS软件求解得Step6中线性回归方程式(1)中的常量$a=-0.601$和系数$b=0.168$,故可以得到对应的线性回归方程。 #tbl( table( columns: (35pt,35pt,55pt,65pt,27pt,55pt,20pt,35pt,45pt,1fr), align: center + horizon, stroke: none, table.hline(stroke: 1.5pt), table.cell(colspan: 10)[线性回归分析结果$b=14$], table.hline(stroke: 0.8pt), [],table.cell(colspan: 2)[非标准化系数],[标准化系数],table.cell(rowspan: 2)[$t$],table.cell(rowspan: 2)[$P$],table.cell(rowspan: 2)[$"VIF"$],table.cell(rowspan: 2)[$R^2$],table.cell(rowspan: 2)[调整$R^2$],table.cell(rowspan: 2)[$F$], table.hline(start: 1, stroke: 0.8pt), [],[$"B"$],[标准错误],[$"Beta"$], table.hline(stroke: 0.8pt), [常数],[-0.601],[0.151],[-], table.hline(stroke: 0.8pt), [-3.972],[0.002$***$],[-],table.cell(rowspan: 2)[0.739],table.cell(rowspan: 2)[0.717],table.cell(rowspan: 2)[$F=33.959 $$P=0.000***$], [$"Probit"$],[0.168],[0.029],[0.86],[5.827],[0.002$***$],[1], table.hline(stroke: 0.8pt), table.cell(colspan: 10)[因变量:$"RSR"$], table.hline(stroke: 0.8pt), table.cell(colspan: 10)[注:$***$、$**$、$*$分别代表$1%$、$5%$、$10%$的显著性水平], table.hline(stroke: 1.5pt) ) ) #h(2em)表4展示了本次模型的分析结果,包括模型的标准化系数、$t$值、$"VIF"$值、$R^2$、调整$R^2$等,用于模型的检验,并分析模型的公式。其中$R^2$代表曲线回归的拟合程度,越接近$1$效果越好;$"VIF"$值代表多重共线性严重程度,用于检验模型是否呈现共线性,即解释变量间存在高度相关的关系($"VIF"$应小于$"10"$或者$5$,严格为$5$)。若$"VIF"$出现$"inf"$,则说明$"VIF"$值无穷大,建议检查共线性,或者使用岭回归。线性回归模型要求总体回归系数不为$0$,即变量之间存在回归关系,根据F检验结果对模型进行检验。 从F检验的结果分析可以得到,显著性$P$值为$0.000***$,水平呈现显著性,拒绝了回归系数为0的原假设,同时模型的拟合优度$R^2$为$0.717$,模型表现较为优秀,因此模型基本满足要求。对于变量共线性表现,$"VIF"$全部小于$10$,因此模型没有多重共线性问题,模型构建良好。 由此输出拟合效果图,展示本次模型的原始数据图、模型拟合值、模型预测值如下: #image("../figures/图片2.png", width: 100%) \ 通过回归方程计算得到的$"RSR"$估计值分档排序结果如表5所示。 #tbl( table( columns: (50pt,1fr,1fr,1fr), stroke: none, align: center + horizon, table.hline(stroke: 1.5pt), table.cell(colspan: 4)[分档排序临界值表格], table.hline(stroke: 0.8pt), [档次],[百分比临界值],[$"Probit"$],[$"RSR"$临界值(含拟合值)], table.cell(colspan: 4)[分档排序临界值表格], table.hline(stroke: 0.8pt), table.hline(stroke: 0.8pt), [第1档],[$<15.866$],[$<4$],[$<0.0724$], [第2档],[$15.866~$],[$4~$],[$0.0724~$], [第3档],[$84.134~$],[$6~$],[$0.4092~$], table.hline(stroke: 1.5pt) ), caption: "分档排序结果" ) #h(2em)本步骤目的在于得到分档排序临界值表格,尤其是$"Probit"$临界值对应的RSR临界值(拟合值)。百分位数临界值和$"RSR"$临界值根据分档水平数量而变化,该两项是固定值且完全一一对应;而表格中$"RSR"$临界(拟合值)则是根据$"Probit"$临界值代入回归模型计算得到。 接着为了将数据按照秩的各种情况映射到正态分布曲线上,结合正态分布的相关划分方法进行分档,需建立分档等级结果。先通过$"RSR"$拟合值,以及上一表格中的$"RSR"$临界(拟合值)进行区间比较,进而得到分档等级水平。分档等级$"Level"$数字越大表示等级水平越高,即效应越好。 由此得出各项竞赛分档等级结果汇总如下: #tbl( table( columns: (128pt,60pt,1fr,1fr,60pt), stroke: none, align: center + horizon, table.hline(stroke: 1.5pt), table.header()[名称][$"RSR"$排名][$"Probit"$][$"RSR"$拟合值][分档等级], table.hline(stroke: 0.8pt), [全国大学生电子设计竞赛],[3],[6.465233792685523],[0.4875824299071976],[A], table.hline(stroke: 0.8pt), [ACM-ICPC国际大学生程序设计竞赛],[2],[6.067570523878141],[0.4206049020488354],[A], table.hline(stroke: 0.8pt), [“挑战杯”全国大学生课外学术科技作品竞赛],[1],[7.100165492844469],[0.5945225447513265],[A], table.hline(stroke: 0.8pt), [中国高校计算机大赛],[10],[6.067570523878141],[0.4206049020488354],[A], table.hline(stroke: 0.8pt), [全国大学生结构设计竞赛],[12],[4.208361392256625],[0.10746249948004671],[B], table.hline(stroke: 0.8pt), [全国大学生节能减排社会实践与科技竞赛],[9],[4.819987630207295],[0.2104773278651365],[B], table.hline(stroke: 0.8pt), [全国大学生机械创新设计大赛],[4],[5.791638607743375],[0.3741303114854323],[B], table.hline(stroke: 0.8pt), [全国大学生机器人大赛],[8],[5],[0.2407964054827395],[B], table.hline(stroke: 0.8pt), [全国大学生化工设计竞赛],[5],[5.565948821932863],[0.3361178896648158],[B], table.hline(stroke: 0.8pt), [全国大学生广告艺术大赛],[7],[5.1800123697927045],[0.2711154831003424],[B], table.hline(stroke: 0.8pt), [两岸新锐设计竞赛·华灿奖],[6],[5.36610635680057],[0.3024588737948707],[B], table.hline(stroke: 0.8pt), [“西门子杯”中国智能制造挑战赛],[11],[4.434051178067137],[0.1454749213006632],[B], table.hline(stroke: 0.8pt), [全国大学生物流设计大赛],[14],[3.534766207314477],[-0.005989618941718677],[C], table.hline(stroke: 0.8pt), [全国大学生电子商务“创新、创意及创业”挑战赛],[13],[3.9324294761218583],[0.06098790891664352],[C], table.hline(stroke: 1.5pt) ), caption: "分档结果" ) #h(2em)综上即完成题设要求,对选取的14种竞赛赛事进行了分级评价,由上表所示分成了A级(三个)、B级(9个)、C级(2个)。 == 第二小问模型的建立与求解 === 基于综合评价模型的建立 本题要求未进入目录的$34$项赛事进行评价并排序,用于多准则决策分析方法,选择熵值法作为本题模型。 \ *Step1:*赛事的筛选 由于本题意欲寻找最有可能进入目录的赛事,故可先大幅进行筛选。经完成率和获奖率的筛选最终选择$14$个赛事作为最终的评价样本。 \ *Step2:*数据的正向处理 本题选择举办届数、参赛院校数、在观察目录中的排名以及主办方权威度四个方面作为指标。 目标是将指标数值表示为极大型,即数值越大代表指标越优秀。 分析举办届数为中间型指标,使用以下公式处理: $ M=max{|x_i-x_("best")|} $ $ tilde(x)=1-(|x_i-x_("best")|)/ M $ 对于观察目录中的排名指标而言,其为极小型指标,应用以下公式将其化为极大型: $ x^*=1/x (x>0) $ *Step3:*数据的标准化 数据标准化是一种将具有不同尺度和单位的数据转换为具有相同尺度和单位的数值的数据处理方法,通常用于多个维度数据的比较和分析。本题选择min-max标准化法进行数据标准化,公式如下: $ (x-min)/(max-min) $ 标准化后的数据一般在$[0,1]$或$[-1,1]$的范围内,可以根据需要进行调整。 \ *Step4:*熵值的原理 熵值法的核心原理在于,对于数据集中的每个指标,通过计算其分布的不确定性,来衡量其在综合决策中的重要性。这种方法既考虑到了指标之间的关联性和权重分配,又具有较好的稳定性和可操作性,是一种有效的多指标决策分析方法。 计算信息熵采用如下公式: $ H(X)=-sum_(i=1)^n p(x_i)log p(x_i) $ 其中,信息熵越大,表示信息越不确定,呈现出的分布越均匀。通过计算所有指标的信息熵,可以得到每个指标的权重。 === 基于综合评价模型的求解、评价过程与结果 首先根据权重计算结果对各指标的权重进行分析。权重计算结果如下: #tbl( table( columns: (1fr,)*4, stroke: none, align: center+horizon, table.hline(stroke: 1.5pt), table.cell(colspan: 4)[熵权法], table.hline(stroke: 0.8pt), [项],[信息熵值$e$],[信息效用值$d$],[权重$(%)$], table.hline(stroke: 0.8pt), [举办届数],[0.852],[0.148],[22.771], [参赛院校数],[0.883],[0.117],[18.017], [观察目录排名],[0.912],[0.088],[13.598], [主办方权威度],[0.703],[0.297],[45.614], table.hline(stroke: 1.5pt) ) ) #h(2em)表7展示了熵值法的权重计算结果,根据结果对各个指标的权重进行分析。 熵值法的权重计算结果显示,举办届数的权重为$22.771%$、参赛院校数的权重为18.017%、观察目录排名的权重为$13.598%$、主办方权威度的权重为$45.614%$。 根据以上数据绘制指标重要度直方图,以直方图形式展示了指标的重要度排序(降序)如下所示: #table( columns: 1fr, align: center+horizon, stroke: none, [#image("../figures/图片3.png", width: 100%)] ) 根据权重输出得到综合得分,实现排序如表8所示:\ #tbl( table( columns: (1fr,1fr,1fr), stroke: none, align: center+horizon, table.hline(stroke: 1.5pt), table.header()[行索引][综合评价][排名], table.hline(stroke: 0.8pt), [1],[0.17805508971552064],[11], [2],[0.6258971475098188],[4], [3],[0.0770851230799413],[12], [4],[0.29324330502927876],[8], [5],[0.23039785912635463],[10], [6],[0.3057240998089282],[7], [7],[0.5439566561694258],[5], [8],[0.9167211059094001],[1], [9],[0.4999018317876996],[6], [10],[0.25229332695910317],[9], [11],[0.9064190898634514],[2], [12],[0.7201096205873163],[3], table.hline(stroke: 1.5pt) ) ) == 第三问模型的建立与求解 === 基于预测模型建立的问题分析 为了从应用价值和如何改进方面给某校相关部门提出建议,本论文拟打算分别探究三个因素对参赛人数的影响,考虑到三个因素不是简单的线性关系,所以先分别探讨三个因素与参赛人数的关系,建立回归方程。 === 模型构建与分析 \ *1*参赛人数与每周理论培训时间,每周实践培训时间的关系 \ *1.1*绘制散点图 #table( columns: (1fr,1fr), stroke: none, align: center+horizon, [#image("../figures/1.png")],[#image("../figures/2.png")], [参赛人数-每周理论培训时间],[参赛人数-每周实践培训时间] ) #h(2em)在绘制参赛人数-每周实践培训时间的散点图时发现第二个数据异常,在进行线性插值后重新得到散点图如下图所示: #table( columns: (1fr,1fr), stroke: none, align: center+horizon, [#image("../figures/3.png")],[#image("../figures/4.png")], [参赛人数-每周理论培训时间],[参赛人数-每周实践培训时间] ) *1.2*求解线性回归模型 \ *1.3*模型参数求解与显著性检验 求解回归模型常用matlab中的regress函数,其中: - $a$为回归系数,升幂排列 - $"aint"$为回归系数的置信区间,默认$95%$ - $r$为残差,即理论值与测量值的差 - $"rint"$为残差的$95%$的置信区间 - $"stats"$模型检验参数$(R^2,F,p,"sig"^2)$($R^2$表示方程因变量与自变量之间的相关性检验,$R$也称为可决系数;$F$,$p$是方程显著性检验;$"sig"^2$是$sigma^2$的估计值。)#cite(<wx2>)最后得到参赛人数与每周理论培训时间的关系: $ y_1=14.7535+1.1969x_1-0.0003x_1^2 $ #h(2em)参赛人数与每周实践培训时间的关系: $ y_2=33.5964+0.0599x_2-0.0001x_2^2 $ #h(2em)代码中`[ones(length(x1),1),x1’,(x1.^2)’]`矩阵,形式是: $ mat( delim: "|", 1, x_1, dots, x_1^p; 1, x_2, dots, x_2^p; dots.v, dots.v, dots.down, dots.v; 1, x_n, ..., x_n^p; gap: #0.5em ) $ // #mitex( // ` // \left|\begin{array}{cccc} // 1 & x_{1} & \cdots & x_{1}^{p} \\ // 1 & x_{2} & \cdots & x_{2}^{p} \\ // \vdots & \vdots & \ddots & \vdots \\ // 1 & x_{n} & \cdots & x_{n}^{p} // \end{array}\right| // ` // ) #h(2em)回归系数计算如下: #figure( table( columns: (100pt,)*3, stroke: none, align: center + horizon, table.hline(stroke: 1.5pt), table.header()[$a_0$][$a_1$][$a_2$], table.hline(stroke: 0.8pt), [15.3716],[0.1824],[-0.0003], table.hline(stroke: 1.5pt) ) ) #figure( table( columns: (100pt,)*3, stroke: none, align: center + horizon, table.hline(stroke: 1.5pt), table.header()[$a_0$][$a_1$][$a_2$], table.hline(stroke: 0.8pt), [33.5964],[0.0599],[-0.0001], table.hline(stroke: 1.5pt) ) ) #table( columns: (1fr,1fr), stroke: none, align: center+horizon, [#image("../figures/5.png")],[#image("../figures/6.png")], [参赛人数-每周理论培训时间],[参赛人数-每周实践培训时间] ) #h(2em)回归系数的置信区间一般不应包括$0$;若包括$0$,说明该系数不显著($100$次实验,$95$次以上离$0$非常近,贡献不大),而由上表可以发现参赛人数与每周理论培训时间的回归方程的置信区间不含$0$,说明每周理论培训时间对参赛人数影响效果显著,同理,每周实践培训时间的回归方程的置信区间也不含$0$,说明每周理论培训时间对参赛人数影响效果也较为显著。计算得显著性水平($"p-value"$)分别均约为$0.000$,说明方程显著性较强,说明曲线拟合效果较好。 所以,回归方程可信度较高,参赛人数-每周理论培训时间和参赛人数-每周实践培训时间关系分别如下。 $ y_1=14.7535+1.1969x_1-0.0003x_1^2 $ $ y_2=33.5964+0.0599x_2-0.0001x_2^2 $ *2* 参赛人数与投入的关系 \ *2.1*绘制散点图 #table( columns: (1fr), stroke: none, align: center+horizon, [#image("../figures/7.png", width: 50%)] ) #h(2em)根据散点图发现参赛人数与投入之间的关系与参赛人数与先前两个自变量的关系不同,不能单一地用线性回归方程拟合,根据实际问题分析得:随着投入的增大参赛人数不可能一直增大,一定会达到一个极值,经过推断尝试发现用有理函数拟合效果最好。 *2.2*非线性回归模型 $ y_3=(b_1x_3+b_2)/(x_3+b_3) $ *2.3*模型参数求解与显著性检验 计算得参赛人数与投入的关系: $ y_3=(46.98x_3+1613)/(x_3+85.62) $ 回归系数: #figure( table( columns: (100pt,)*3, stroke: none, align: center + horizon, table.hline(stroke: 1.5pt), table.header()[$b_0$][$b_1$][$b_2$], table.hline(stroke: 0.8pt), [46.98],[1613],[85.62], table.hline(stroke: 1.5pt) ) ) #h(2em)上表可以发现参赛人数与投入·的回归方程的置信区间不含$0$,说明投入对参赛人数影响效果显著。由计算得显著性水平($"p-value"$)均为$0.000$,说明方程显著性较强,说明曲线拟合效果较好。所以,回归方程可信度较高,参赛人数与投入的关系如下: $ y_3=(b_1x_3+b_2)/(x_3+b_3) $ #h(2em)综上,理论培训时间、实践培训时间、投入分别与参加人数的对应关系为: $ y_1=14.7535+1.1969x_1-0.0003x_1^2 $ $ y_2=33.5964+0.0599x_2-0.0001x_2^2 $ $ y_3=(46.98x_3+1613)/(x_3+85.62) $ == 第三问第二小问模型的构建和求解 === 模型说明 考虑到本文第一问从三个指标分别分析对参加人数的影响,构建的是线性回归模型和有理函数模型。第二问为发现三个指标之间的相互作用与内在关联,现重新构建模型,以寻找各因素间的相互影响和共同对因变量投入的贡献程度,所以选择构建多项式非线性回归模型。 === 指标选取 本模型采用针对每周理论培训时间、每周实践培训时间以及投入的关系设置的不同问卷数据,并对其进行处理,作为模型的主要驱动因素。由于在该问卷中控制其它变量均为第七个水平上,为方便数理统计,分析每个因素对参加人数影响,可将每组数据用第七项数据减去每项的参赛人数(即用$43.15$减去每组数据)便于分析。下面将针对这三个主要驱动因素分别对参赛人数的影响进行分析。 === 回归拟合 - 每周理论培训时间(分钟) #h(2em)通过绘制出该数据的散点图,可猜想该函数为二次曲线,故建立如下模型: $ y_1=a_0+a_1x_1+a_2x_1^2 $ #h(2em)通过`matlab`中的`fit`函数进行回归拟合,可得到如下结果: #table( columns: (1fr,)*6, stroke: none, align: center + horizon, table.hline(stroke: 1.5pt), table.cell(rowspan: 2)[], table.cell(colspan: 2)[未标准化系数],table.cell(colspan: 2)[标准化系数],table.cell(rowspan: 2)[显著性], table.hline(stroke: 0.8pt), [$B$],[标准化错误],[$"Beta"$],[$t$], table.hline(stroke: 0.8pt), [$X$],[-.197],[.010],[-3.334],[-19.949],[<.001], [$X^2$],[.000],[.000],[2.752],[16.466],[<.001], [(常量)],[28.396],[.887],[],[32.018],[<.001], table.hline(stroke: 1.5pt) ) #table( columns: (1fr,1fr), stroke: none, align: center+horizon, [#image("../figures/8.png")],[#image("../figures/9.png")] ) #h(2em)从表中$X$项未标准化系数$B$为$-0.197$,标准化系数($"Beta"$)为$-3.334$,$t$值为$-19.949$,显著性($"p-value"$)小于$0.001$。这说明$X$项与因变量呈负相关,并且有显著影响,而 项未标准化系数$B$为$0.0$,但标准化系数($Beta$)为$2.752$,$t$值为$16.466$,显著性($"p-value"$)小于$0.001$。这表明 的平方项对因变量有显著的正相关影响。对于常数项未标准化系数$B$为$28.396$,$t$值为$32.018$,显著性($"p-value"$)小于$0.01$,表明截距在统计上也是非常显著的。 通过相关系数计算公式可求得该回归曲线 ,可知该模型有较好的拟合效果,故猜想为二次曲线合理,即回归方程为: $ y_1=28.396-0.1969x_1+0.0003392x_1^2 $ - 每周实践培训时间(分钟) #h(2em)通过绘制出该数据的散点图,猜想该函数也为二次曲线,故建立如下模型: $ y_2=a_0+a_1x_2+a_2x_2^2 $ #h(2em) 通过`matlab`中的`polyfit`函数进行回归拟合,可得到如下结果: #table( columns: (1fr,)*6, stroke: none, align: center + horizon, table.hline(stroke: 1.5pt), table.cell(rowspan: 2)[], table.cell(colspan: 2)[未标准化系数],table.cell(colspan: 2)[标准化系数],table.cell(rowspan: 2)[显著性], table.hline(stroke: 0.8pt), [$B$],[标准化错误],[$"Beta"$],[$t$], table.hline(stroke: 0.8pt), [$X$],[-.064],[.013],[2.336],[4.887],[.002], [$X^2$],[.000],[.000],[-1.535],[-3.212],[.015], [(常量)],[33.732],[.849],[],[39.711],[<.001], table.hline(stroke: 1.5pt) ) #table( columns: (1fr,1fr), stroke: none, align: center+horizon, [#image("../figures/10.png")],[#image("../figures/11.png")] ) #h(2em)通过相同方法可算相关系数$R^2=0.9826$,同时检验该回归模型的$t$值与显著性($"p-value"$), 说明该模型有较好的拟合效果,故: $ y_2=9.479-0.064x_2+0.0001212x_2^2 $ - 投入(千元) #h(2em)通过绘制出该数据的散点图分布并实际结合投入与参加人数的关系,猜想该函数为有理函数,故建立如下模型: $ y_3=(b_1x+b_2)/(x+b_3) $ #h(2em)现通过`matlab`中的`fit`函数对该曲线进行拟合,所得曲线拟合情况如下: #table( columns: (1fr,1fr), stroke: none, align: center+horizon, [#image("../figures/12.png")],[#image("../figures/13.png")] ) #h(2em)与此同时,可以计算得到:$"SSE"=34.9609$,调整后$R^2=0.9412$,故可知该曲线拟合效果较好,故: $ y_3=(-3.829x+2082)/(x+85.62) $ #h(2em)根据上述三个回归模型,分别得到每周理论培训时间、每周实践培训时间、投入对愿意参加人数影响的关系函数(以理论培训时间$259$,每周实践培训时间$196$,投入$372$,参与人数$43.15%$为标准),现将三条拟合曲线化成参加人数y与每周理论培训时间$x_1$、每周实践培训时间$x_2$、投入$x_3$的一个多元函数: $ y=43.15-[y_1(x_1)+y_2(x_2)+y_3(x_3)] $ 即: $ y=-0.0003392x_1^2-0.0001212x_2^2+0.1069x_1+0.064x_2+(3.829x_3-2082)/(x_3+85.62)+73361 $ 根据公式可求得回归平方和:$"SSR"=display(sum_(i=1)^n (hat(y_i)-overline(y))^2)$,总平方和:$"SST"=display(sum_(i=1)^n (y_i-overline(y))^2)$,和方差$"SSE"=display(sum_(i=1)^n (y_i-hat(y_i))^2)$,可计算出相关系数$R^2=display(1-"SSE"/"SST"=0.9602)$,接近$1$,故原数据的总变异可以由拟合值的变异解释。 \ F检验: 假设$H_0:beta_1=0,H_1:beta_1!=0$,其中:$beta_1$为$y_i$关于$x_i$的总体回归系数。 现给出统计量$F$计算公式:$F=display(("SSR"\/(m-1))/("SSE"\/(n-m))="MSR"/"MSE")$,其中,$n$为样本数量,$m$为自变量数量,即$n-m$为该模型的自由度。根据程序计算得到$F=348.8512$,通过查$F$检验临界表可知$display(F_(alpha=0.05) =19.458>F)$,故否定$H_0$假设,接受$H_1$假设,通过$F$检验。 将该回归模型代入原数据验证,可得到参与人数的实际值与拟合值之间的相对误差平均值在$3%$以内,表明对于拟合值和实际效果来说,拟合效果十分显著,证明该拟合出的参与人数方程通过检验。 \ \ \ === 计算最佳培训时间与投入 - 目标 $ y=-0.0003392x_1^2-0.0001212x_2^2+0.1069x_1+0.064x_2+(3.829x_3-2082)/(x_3+85.62)+73361 $ #h(2em)根据拟合的函数表达式,即求该函数取得最大值时的自变量的值。由于该函数存在多个变量,且为非线性函数,传统的Newton法等计算量大,求导困难且收敛性与结果很受初始值的影响,故现在避开传统数学方法,使用粒子群算法(PSO)求得该函数在一定区间内的最大值问题,该方法收敛快,且简单易实现。 - 粒子群算法(PSO:Particle swarm optimization) #h(2em)粒子群算法源于鸟群捕食的行为研究,其基本思路是通过群体与个体之间的协作和信息共享来寻求最优解。#cite(<wx3>)粒子仅具有两个属性:速度与位置。算法首先将初始化一组粒子群,每个粒子均具有一个初始位置和速度,根据适应度函数计算得到适应度函数值,将其标记成当前个体历史最优解,然后各个粒子之间通过协作共享信息得到全局历史最优解,并进行迭代得到新的速度和位置,然后计算粒子新的适应度函数值,如果粒子新的适应度函数值大于自己之前的个体历史最优解,那么这个新的适应度函数值成为该粒子新的个体历史最优解,所有粒子的个体历史最优解更新完后,再更新全局历史最优解,随后继续进行迭代,得到新的速度和位置,当迭代一定次数之后便得到较优解。 #image("../figures/14.png", width: 100%) - 求解步骤 1、初始化参数 该函数共有三个变量$x_1,x_2,x_3$,空间维度为$3$,设粒子数量为$N$,在$k$次迭代中,第$i$个粒子的位置为$x_i^k=(x_"i1"^k,x_"i2"^k,x_"i3"^k)$,速度为$v_i^k=(v_"i1"^k,v_"i2"^k,v_"i3"^k),i=1,2,dots,N$,其初始位置为随机的。 \ 2、计算适应度 适应度即该模型的目标函数值,对于该函数,若粒子坐标为:$(x_1,x_2,x_3)$,则适应度为: $ y=-0.0003392x_1^2-0.0001212x_2^2+0.1069x_1+0.064x_2+(3.829x_3-2082)/(x_3+85.62)+73361 $ 3、求初始全局最优解 第$i$个粒子的个体最优解记作$"pbest"$,通过比较全部粒子的$"pbest"$,找出最大值,记做全局最优解$"gbest"$。 \ 4、更新粒子速度 $ v_i^k=w v_i^(k-1)+c_1("pbest"_i^(k-1)-x_i^(k-1))+c_2("gbest"^(k-1)-x_i^(k-1)) $ #h(2em)其中$w,c_1,c_2$分别表示惯性,个体经验和社会经验的权重,当$c_1=0$时,粒子是盲从的,不学习任何自身经验,当$c_2=0$时,粒子时自大的,不学习任何社会经验,当$w$偏大时,有利于全局搜索,函数收敛性差;当$w$偏小时,有利于局部搜索,但运算更慢,故理想状况下,前期$w$值应偏大,而到搜索后期,$w$值应逐渐减小。 \ 5、更新位置(可行解)并求出适应度 \ 6、更新个体最优解和全局最优解 \ 7、迭代终止 - 结果分析 #table( columns: (1fr), stroke: none, align: center+horizon, [#image("../figures/15.png", width: 80%)] ) #h(2em)根据上述算法,求得当$x_1=290,x_2=260,x_3=699$时,该函数有最大值,故当每周理论培训时长为$290$分钟,实践培训时长为$260$分钟,投入$699$千元时,将有最多的参与人数,即有$45.216%$的人参加培训。 == 第三问的第三小问的求解 从应用价值上进行分析: 结果的实用性:本论文分析所得结果能够直接应用于学校的教育、管理或服务流程中,提高教学效率和质量。 成本效益分析:考虑实施结果所需的投入与参赛人数之间的关系。可以优化资源配置,使得在合适的投入下能有较多的学生参赛。 可持续性:评估结果是否具有长期的应用潜力,以及是否能够在不断变化的环境中保持其价值。 可扩展性:考虑结果是否可以推广到学校的其他部门或者其他赛事。 改进措施: 数据准确性:检查数据收集和分析过程,确保结果的准确性和可靠性。 持续监控:建立机制以持续监控结果的应用效果,确保其持续符合学校的需求。 本论文经过计算所得的参赛人数取得最大值对应的三个变量值为: $ x_1=290,x_2=260,x_3=699 $ #h(2em)每周理论培训时长为$290$分钟,实践培训时长为$260$分钟,投入$699$千元时,将有最多的参与人数。但是,考虑到实际情况,向学校相关部门提出以下更为合理的培训方案: 1、纸上得来终觉浅,绝知此事要躬行,建议适当增加实践教学时长,提高学生动手能力,建议把实践培训时长根据实际情况进行适当延长。 2、结合实际,考虑到学校经费等问题,且根据第一小问所计算出的函数曲线可以看出,当投入达到一定值时,贡献的增长率比起另外两个因素不算特别显著,所以建议适当削减学校投资经费。根据国家公务局《中央和国家机关培训费管理办法》#cite(<wx4>)的综合定额标准,将投入设置在$510$千元左右较为合理。
https://github.com/dismint/docmint
https://raw.githubusercontent.com/dismint/docmint/main/networks/pset7.typ
typst
#import "template.typ": * #show: template.with( title: "14.15 PSET 7", subtitle: "<NAME>", pset: true, ) = Problem 1 == (a) Assume for this question that we have a uniform distribution of consumers within the range $[0, 1]$. A customer will choose the product if their willingness to pay is at least as great as the price: $ (1-x) dot z >= 1 / 4 $ Because we want the system to be at equilibrium, we can assume that the equilibrium value will result in the proportion of buyers being the same as the cutoff for who is willing to buy the product (since the distribution is uniform). Thus we can turn this into a quadric and solve as follows: $ (1-z) dot z &= 1 / 4\ 0 &= z^2 - z + 1 / 4\ 0 &= 4z^2 - 4 z + 1 $ The last step normalizes the numbers to make them easier to work with. Thus we solve with the quadratic formula where $a = 4, b = -4, c = 1$: $ z &= (-b plus.minus sqrt(b^2 - 4 a c)) / (2 a)\ &= (4 plus.minus sqrt(16 - 16)) / (8)\ &= (4 plus.minus sqrt(0)) / (8)\ &= boxed(1 / 2) $ Thus in this first case where the cost of the good is $1/4$, there exists exactly one equilibrium number, which occurs at $z = 1/2$ == (b) Let us now repeat the same process, but with a cost of $2/9$: $ (1-z) dot z &= 2 / 9\ 0 &= z^2 - z + 2 / 9\ 0 &= 9z^2 - 9 z + 2 $ Again, we solve with the quadratic formula where $a = 9, b = -9, c = 2$: $ z &= (-b plus.minus sqrt(b^2 - 4 a c)) / (2 a)\ &= (9 plus.minus sqrt(81 - 72)) / (18)\ &= (9 plus.minus sqrt(9)) / (18)\ &= (9 plus.minus 3) / (18)\ &= boxed((1 / 3, 2 / 3)) $ Thus in this second case where the cost of the good is $2/9$, there exists two equilibrium numbers, which occur at $z = 1/3, 2/3$ == (c) At a price of $1/4$, this seems to be the perfect price at which there is a clear and even split amongst the consumers for either purchasing or not purchasing the product. When the price lowers slightly to $2/9$, we see that there are now two equilibrium points instead of two. This happens because the price is lower, meaning that there is an interesting network effect from having more people be able to afford the good. Because the equilibrium point is below this critical mark of $1/4$, there is now a majority of people who want to partake in the purchase of this good. However, there is of course the related network effect $z$, which is why we see two different points of equilibrium. == (d) In *(a)*, if the proportion of people using the good slightly shifts, then so will the willingness to pay. Think about the middle person with value $1/2$. If the proportion of people using the good increases, then that persons willingness to pay will increase as well. The same goes in the opposite direction. Thus the equilibrium point found in *(a)* cannot be stable. In general, this is also true for *(b)*. If the proportion of people using the good shifts, then the willingness to pay will also shift in the same direction. This is because the willingness to pay is directly related to the proportion of people using the good. Thus the equilibrium points found in *(b)* cannot be stable either. = Problem 2 == (a) Recall the potential functions presented in Lecture 14. I will be making use of this in my proof of this question. We can view any given latency function as the following sum: $ l_(j)(x) = sum_(i=0)^(k) a_(j i)x^i $ Now let us define a potential function using the integral of the latency function: $ phi(x) &= integral_(0)^(x) l_(j)(t) d t\ &= sum_(i=0)^(k) 1 / (k+1) a_(j i) x^(t+1) >= 1 / (k+1) sum_(i=0)^(k) a_(j i) x^(t+1)\ &= 1 / (k+1) x dot l_(j)(x)\ &= 1 / (k+1) C_(j)(x) <= C_(j)^*(x)\ &= C_(j)(x) <= (k+1) dot C_(j)^*(x) $ Thus we can see using the potential function that the latency function is bounded by a factor of $k+1$ for the price of anarchy. == (b) We can show that this bound is _asymptotically_ the best bound since there is a category of problems we have seen in the past that can force this worst case behavior. This question is the simple two path commuter problem with one constant value path and one path with a cost related to the proportion of people who are taking it. Formalize this statement as follows: #define( title: "Simple Routing" )[ In this question, we have a simple routing question with two paths. + The first path has a constant cost of $1$. + The second path has a cost of $x^k$ for each person who takes it, where $x$ is the fraction of the total number of people who take the second path. ] In this class of question, the price of anarchy is $infinity$. This is because the NE will once again take on the value of $1$, but the social equilibrium, especially at larger values of $k$, will near $0$. This means that the price of anarchy will be unbounded, and thus the it would be possible for us to find a POA of at least $k^alpha$ for sufficiently large $k$ when $alpha < 1$
https://github.com/ralphmb/My-Dissertation
https://raw.githubusercontent.com/ralphmb/My-Dissertation/main/main.typ
typst
Creative Commons Zero v1.0 Universal
#import "./other/template.typ": getHeader #let my_name = "<NAME>" #let thesis_title = "Modelling Football Data" #let thesis_domain = "Mathematics and Statistics" #let my_institution = "Coventry University" #set document(author: my_name, title: thesis_title) #set text(font: "New Computer Modern", lang: "en") //#show math.equation: set text(weight: 300, size: 9pt) #set heading(numbering: "1.1") #set par(justify: true) #v(0.25fr) #align(center)[ #text(2em, weight: 700, thesis_title) ] #pad( top: 0.7em, grid( columns: (1fr), gutter: 1em, align(center)[ *#my_name* \ #thesis_domain \ #my_institution \ ] ), ) // Table of contents. #outline(depth: 3, indent: true) #pagebreak() // Main body. #set page(numbering: "1", number-align: center) #set page(header: getHeader(), margin: (x:30pt, y:50pt)) #counter(page).update(1)// // Highlight first rows and columns in tables #set table( fill: (x, y) => if x == 0 or y == 0 { gray.lighten(40%) }, align: right, ) #show table.cell.where(x: 0): strong #show table.cell.where(y: 0): strong // And here's where we include all the sections. = Introduction #include("./sections/introduction.typ") #pagebreak(weak: true) #set par(first-line-indent: 20pt) #set page(columns: 2) = Review of Literature #include("./sections/litreview.typ") //#pagebreak(weak: true) = Preliminary Steps == Data Collection #include("./sections/datacollection.typ") == Exploratory Analysis #include("./sections/exploratory.typ") //#pagebreak(weak: true) = Logistic Regression #include("./sections/regression.typ") //#pagebreak(weak: true) = Survival Analysis #include("./sections/survival.typ") // Bibliography section #set page(header: []) #set text(8pt) // Setting smaller text sizes to save paper #bibliography("./sections/bibliography.bib") #pagebreak(weak: true) #set page(columns: 1) #set text(7pt) #heading([Appendices], numbering:none) #include("./sections/appendix.typ")
https://github.com/kilpkonn/typst-thesis
https://raw.githubusercontent.com/kilpkonn/typst-thesis/main/appendixes.typ
typst
MIT License
#import "@preview/codelst:2.0.0": sourcecode = Non-Exclusive License for Reproduction and Publication of a Graduation Thesis I, Author Author 1. Grant Tallinn University of Technology free licence (non-exclusive licence) for my thesis “Term Search in Rust”, supervised by <NAME> 1. to be reproduced for the purposes of preservation and electronic publication of the graduation thesis, incl. to be entered in the digital collection of the library of Tallinn University of Technology until expiry of the term of copyright; 2. to be published via the web of Tallinn University of Technology, incl. to be entered in the digital collection of the library of Tallinn University of Technology until expiry of the term of copyright. 2. I am aware that the author also retains the rights specified in clause 1 of the non-exclusive licence. 3. I confirm that granting the non-exclusive licence does not infringe other persons’ intellectual property rights, the rights arising from the Personal Data Protection Act or rights arising from other legislation. 12.05.2024
https://github.com/matthiasGmayer/typst-math-template
https://raw.githubusercontent.com/matthiasGmayer/typst-math-template/main/README.md
markdown
# typst-math-template Allows for globally numbered Definitions, Theorems, etc. Allows for compilation of subfiles and referencing of Theorems, etc. by using custom citations and references. Example ![image](https://github.com/matthiasGmayer/typst-math-template/assets/28257008/2445b5f5-138e-4d79-b795-e916b58e18d5) ``` #import "template.typ": * #show: sub_project This is a citation #ccite[pearl] #definition[MyDefinition][ $X=1$ ] #labeled[mydef] #remark[ $X!=2$ ] #proof[ see #tref[mydef] ] ``` Example PDF: https://drive.google.com/file/d/1RhTViesnDWg07kJuUAJ1CDqYahtzqYLo Source Code: https://typst.app/project/rJeB-bWl2aAzffB8YiYMew
https://github.com/Enter-tainer/delimitizer
https://raw.githubusercontent.com/Enter-tainer/delimitizer/main/README.md
markdown
MIT License
# `delimitizer` This package lets you customize the size of delimiters in your math equations. It is useful when you want to make your equations more readable by increasing the size of certain delimiters. Just like `\big`, `\Big`, `\bigg`, and `\Bigg` in LaTeX, `delimitizer` provides you with the same functionality in Typst. - `big(delimiter)`: Makes the delimiters bigger than the default size. - `Big(delimiter)`: Makes the delimiters bigger than `big()`. - `bigg(delimiter)`: Makes the delimiters bigger than `Big()`. - `Bigg(delimiter)`: Makes the delimiters bigger than `bigg()`. - `scaled-delimiter(delimiter, size)`: Scales the delimiters by a factor of your choice. - `paired-delimiter(left, right)`: Make a short hand for paired delimiters. This function returns a closure `f(size = auto: auto | none | big | Big | bigg | Bigg | relative, content: content)`. The keyed argument `size` is optional and defaults to `auto`. The positional argument `content` is required. - when `size` is `auto`, the size of the delimiters is automatically determined. - when `size` is `none`, the size of the delimiters is `1em`. - when `size` is `big`/`Big`/`bigg`/`Bigg`, the size of the delimiters is set to `big`/`Big`/`bigg`/`Bigg` respectively. - when `size` is `relative` length like `3em` or `150%`, the size of the delimiters is scaled by the factor you provide. Example: ```typst #let parn = paired-delimiter("(", ")") $ parn(size: bigg, parn(size: big, (a+b)times (a-b)) div parn(size: big, (c+d)times (c-d)) ) + d \ = (a^2-b^2) / (c^2-d^2)+d $ ``` ![demo](./demo.svg)
https://github.com/mintyfrankie/brilliant-CV
https://raw.githubusercontent.com/mintyfrankie/brilliant-CV/main/docs/docs-template.typ
typst
Apache License 2.0
#let template( title: "", subtitle: "", authors: "", date: "", version: "", doc, ) = { import "@preview/codly:0.2.0": * set document(author: authors, title: title) set page(numbering: "1", number-align: center) set text(font: "Source Sans 3", lang: "en") show link: set text(fill: rgb("#1e8f6f")) show link: underline show: codly-init.with() align( center, text(17pt, weight: "bold")[ #title #subtitle ], ) h(10pt) align( center, rect[ _Authors: #authors _ _Build Date: #datetime.today().display()_ _Version: #version _ ], ) outline(depth: 2) pagebreak() doc }
https://github.com/VaranTavers/vspct
https://raw.githubusercontent.com/VaranTavers/vspct/main/README.md
markdown
MIT License
# Varan's Simple Pseudocode for Typst This is meant to be an easy to modify basis for anyone who needs to write pseudocode in Typst. It is not battle-tested, I just needed some way to write pseudocode and this is what I came up with. ## Features: - Automatic numbering - Automatic indentation - Basic multilanguage support - Commands to reference it ## How to use: ### Include Copy your "vspct.typ" file into your project directory, and include it using: ``` #import "vspct.typ": * ``` ### Set the language In the "vspct.typ" file you can set the lang variable. The currently supported languages are: English (en) and Hungarian (hu). ``` #let lang = "en" ``` ### Base Your algorithm should be written inside a #pseudo function. ``` #pseudo(caption: "Title of algorithm")[ Code \ ] ``` Each row has to be terminated with a '\' character in order to start a new row. ### Variable assignment (with long left arrow): ``` #pseudo(caption: "Assignment")[ i #gets 5 \ a #gets 4 ] ``` ### I/O We use the following functions for input and output. ``` #pseudo(caption: "I/O")[ #pin($i$) \ #pout($i+1$) ] ``` ### If Since we don't want any collision with the already defined codewords almost every function is prefixed with a 'p' The usage of the simple if structure is the following: ``` #pseudo(caption: "Simple if")[ #pif($i % 3 < 2$)[ a #gets 0 ] ] ``` You can also do an if-else sturcture ``` #pseudo(caption: "Simple if-else")[ #pifelse($i % 3 < 2$)[ a #gets 0 ][ a #gets 1 ] ] ``` ### While Similarly to if we can do the following: ``` #pseudo(caption: "Simple while")[ i #gets 0 \ #pwhile($i < 10$)[ #pout($i$) \ $i gets i + 1$ ] ] ``` ### Repeat until ``` #pseudo(caption: "Simple while")[ i #gets 0 \ #prepeat($i = 10$)[ #pout($i$) \ $i gets i + 1$ ] ] ``` ### For each number in range ``` #pseudo(caption: "For each number between 1 and 10 ascending order")[ #pfor($i$, "1", "10")[ #pout($i$) \ ] ] ``` ``` #pseudo(caption: "For each number between 1 and 10 in descending order")[ #pfor($i$, "1", "10", cumul: "-1")[ #pout($i$) \ ] ] ``` ### Return keyword ``` #pseudo(caption: "Return a value")[ #preturn($g_b$) ] ``` ### Referencing an algorithm Referencing an algorithm can be done with the `pref` function ``` #pseudo(caption: "Return a value")[ #preturn($g_b$) ] <alg:test> We can see an example in #pref(<alg:test>). ```
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/029%20-%20Aether%20Revolt/009_Renewal.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Renewal", set_name: "<NAME>", story_date: datetime(day: 01, month: 02, year: 2017), author: "<NAME>, <NAME>, <NAME>, <NAME> & <NAME>", doc ) #emph[Tezzeret is defeated. Dovin Baan has disappeared. Rashmi's Planar Bridge, a threat to life across the Multiverse, lies in pieces, and the inventor has sworn to her friend Saheeli Rai that the work will not be duplicated. Now the Gatewatch and the people of Kaladesh must decide their paths into the future...for those who have a future.] #emph[For Chandra and her mother Pia, reunited after twelve years thinking each other dead, the days are all too brief.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) The Dhund compound was a hive of underground tunnels that coiled around its central core beneath the city of Ghirapur. Inside, scores of informants, Consulate soldiers, and prisoners toiled under the watchful eye of the Chief of Compliance, Dhiren Baral. That was, at least, until a few weeks ago. It had taken extended inquiries through a trail of sealed lips and greased palms for the new Consulate to determine the breadth of the Dhund's secret activities. Soon after, plans for reform were written, passed, and set into motion. The informants and soldiers were redistributed to new posts throughout the city. Some were themselves placed under arrest. Hundreds of prisoners—most of them mages and renegades who had "disappeared" long ago—were released in the space of a couple hours. The hallways reverberated with the shrieking protests of heavy cell doors on ungreased hinges that nearly drowned out the deafening cheers of newly freed citizens. They left without looking back, abandoning what little they had in their cells. Next, the foremen arrived to begin demolition of all but the central core that held the few remaining prisoners. Mighty pneumatic hammers punched holes into the vaulted ribs of the ceilings. Chunks of granite and brass rained down with thunderous crashes that shook entire blocks of the city above. Today, though, the hallways were empty. Construction paused while two days of festivities covered the city in in a blanket of lights and colors. The celebrations were held in honor of the new Consulate leadership—one that promised to embrace renegade interests. One that included even "Renegade Prime" herself, <NAME>. This new Consulate would be, as Consul Padeem had promised the crowds outside with rare enthusiasm, an..."impressive" step forward for Ghirapur. #figure(image("009_Renewal/01.jpg", width: 100%), caption: [Call for Unity | Art by <NAME>sell], supplement: none, numbering: none) Two sets of footsteps filled the emptiness of the Dhund's remains as Pia and <NAME> made their way through the ruined hallways toward the compound's intact core. Through the holes in the ceiling, they could see bright explosions of vibrant teals swirled with metallic particles light up the sky—fireworks from the processions in the streets overhead. "Those #emph[colors] ! How'd they do that?" Chandra gasped. "Even Keral Keep's never done stuff like this!" Pia tilted her head to one side. "Who-all keeps what?" "#emph[Ker] al. It's...a long story. I'll tell you later." "As for the colors, that's just a little copper powder mixed in with the fireworks. I'm sure Mrs. Pashiri can get a whole satchel of it for you," Pia said, and gave her daughter's cheek a quick kiss. Thick columns of late-afternoon sunlight cut through the dim interior. Arched catwalks overhead anchored an encroachment of jasmine and madhavi vines. Patches of fallen earth on the scuffed floor offered refuge to scattered seedlings that had drifted in on spring breezes. Chandra peered inside an open cell door at the things left behind by its past occupant. A carving on a wooden table. A single candle burned half away. A pair of small filigreed mage's shackles, sized to fit a child. Chandra ran her fingers over the intricate surface of the shackles, tasting the grim texture of their memories. In the hallway, Pia pressed the metal fingertips of her glove to the outside of an aether pipe. Nothing. It'd been dark for hours, maybe even days at this point. She opened the cover and found nothing inside save for a residual whiff of aether that burned her nostrils for a moment before fading. "Rerouted." Pia nodded with satisfaction. "Bound for the Weldfast, as planned." She scrawled her signature onto a gridded chart stamped with the Consulate insignia. Chandra poked her head out from one of the cells. "Mom, you know you already sound like the..." She cleared her throat, "#emph[Y'know...] " she whispered loudly. "Young lady—" Pia began in mock protest. "...#emph[The] Consul of Allocation," Chandra intoned. Her attempt at deadpan formality was betrayed by a toothy grin. "Oof." Pia winced. "It didn't sound nearly as bad in my head as it does out loud. Here, could you give <NAME> a hand here?" The two helped each other over the skeletal remains of a fallen catwalk. "What was it like up there with the Consuls?" Chandra asked as she knelt to untangle a fragrant vine of jasmine that had wound its way around the catwalk. She gently removed a branch and wrapped it around her wrist to carry with her. "...#emph[Scary] ." "For you?" Chandra exclaimed. "I saw you out there. You were a damn hero!" She paused for a heartbeat before turning red. "I mean, you still are! Just...if I was that good at fighting stuff... I wouldn't want things to change." "Change?" Pia tasted the word as it left her lips. #emph[Could I even recall the days before I was "Renegade Prime?" ] #emph[she thought. Before running from the law? Before we'd been all been labelled "renegades?"] Pia glanced at her daughter as they stepped through a patch of sunlight that spun Chandra's hair and armor into blazing gold. Still her little girl...but suddenly something else entirely. Chandra, a destroyer of titans, a beacon of mana and light exploding outside the Aether Spire. A revolutionary. A grown woman. "Fighting is all I can remember now." Pia said with an uneasy laugh. "But the world's changed. At least I hope it has. I'll change with it, learn something new." They rounded the corner and stepped back into the shadows of the prison walls. Suddenly it was her old Chandra again—armor dented and scuffed, a piece of yesterday's cabbage stuck in tangled, frizzy hair. Pia licked the end of her index finger and plucked away the offending vegetable with expert precision. The hallway ended abruptly as they reached the intact core of the prison, the Dhund's old, bitter heart. The high ceiling was narrow and windowless—shut as tightly as a clenched fist. A thick brass door faced them. Its worn metal grating was burnished from use and covered a pane of thick glass that looked in on the chamber's contents. A crisp form was tacked to one side of the door: name, imprisonment date, guard shifts. No visitors had been recorded. "Aether's accounted for. Now..." Pia trailed off and turned to Chandra. "...You know you don't have to go with me, right?" Chandra wrapped her mother in a sudden, fierce hug. "I know. But turn down extra seconds with you? That's crazy." Chandra said, burying in her face in her mother's machine-grease-and-chamomile-scented hair. "I'm staying with you, Mom." Bright, warm things swam through Pia's vision. #emph[I've waited twelve years for you to say that] . She thought as she blinked them away. Pia exhaled slowly and opened the grating. Behind the glass, the cell was spacious. Immaculately clean. Unlike the cells from the other hallways, this one held no personal effects at all. It held nothing, save for its sole inhabitant. Perhaps it was his lack of armor, mask, or weapons, but he looked so much smaller than the two women had remembered. His heavy form was wrapped in a simple canvas tunic. His hands were bound by filigree-and-gold mage's shackles. #figure(image("009_Renewal/02.jpg", width: 100%), caption: [Vedalken Shackles | Art by <NAME>], supplement: none, numbering: none) A thousand words swirled through her head—she could voice only one. "Baral." Pia said. <NAME> turned toward the grating. The events at the Aether Hub had reaped their due. Sparse tufts of hair protruded from cracked patches of his reddened scalp. His body was now more scars than skin; long, twisted cords of them coiled about his limbs, shiny pink masses punctuated with flecks of crimson and purple. "So the inspectors sent you to lead me to my execution in the arena." Baral rasped. "Fitting. Just like I had for all the other mages." Pia shook her head. "There's no more arena. There are no inspectors. Your sentence begins and ends here." Baral snorted. "Ridiculous. The safety of the Consulate, of all #emph[Ghirapur] belongs to the inspectors! Who else will track down the monsters?" "No one—there were #emph[never] monsters." Pia said. "It was Baan, wasn't it?" Baral growled. "These spineless bureaucrats have no idea of the...#emph[filth] that lurks amongst them. Easy enough when #emph[I ] kept them safe all these years! They owe me death in the arena—I want my due." "This is not about what you want." Pia said quietly. "It's about justice. Inspectors, mage-hunts, public executions...we don't live in that world anymore." "What would you know about 'that world?'" Baral's voice turned shrill. "Were #emph[you] born to be hidden away? Freakish?" "I was," Chandra said as she turned to face Baral. From the other side of the glass, Baral forced a wheezing laugh out of his chest. "The little monster! We have unfinished business, you and I." Pia's nerves stretched taut as sitar strings. "You don't speak to her." "I know how this ends. Leave your mommy's hands clean and do something right for once," Baral rumbled to Chandra. "Think of it. #emph[Your] blade at #emph[my] throat. The look on my face when you burn this wreck of a body to #emph[cinders] ." His blue eyes glittered in their shadowed hollows. "Chandra," Pia said softly, "you don't have to stay here and listen to this. He's nothing to us." Baral's pressed his face as close as he could to the cell's window, thick fingers pushed against the glass. "Even the score. Flesh for flesh—my corpse for your dead daddy's..." A slow smile bloomed over his face. The air around Chandra shimmered and crackled. Her hands flexed and curled into fists. "...One monster for another." Baral said. His grin pulled thick ropes of scars tightly over craggy cheeks. "I'm #emph[not] a monster!" Orange-gold sparks flew from Chandra's clenched fists and fell to the floor like a spatter of raindrops. Pia put her arms around Chandra's shoulders, wincing from the heat that rose that emanated from them. "No, you're not a monster. Your father and I gladly give our lives for those we love. For you, Chandra." Pia fixed a stony gaze on Baral. "I wouldn't expect #emph[him] to understand that." Chandra looked down at her hands as the last sparks danced to the ground and extinguished themselves. The heat had intensified the heady fragrance of the jasmine vine tied 'round her wrist. Its small, full blossoms were pale as stars in the darkness. "Cool water. A single lantern drifting..." Chandra murmured as her fingers flitted over the tops of the jasmine flowers. Her eyelids fluttered closed as she inhaled their scent. "Mom," she said, "You remember that old quarry we went to? Outside the city...?" Her voice was wistful, distant. Pia blinked, then nodded uncertainly. "...Let's go back there sometime," Chandra said, in that same distant tone. Chandra's eyes locked on Baral, and her features hardened. "Screw you," she said. "I don't owe you a damn thing." Baral's brittle smile cracked and fell away. "No! #emph[I] know how this has to end," he hissed. Lurid purple veins strained against the brittle skin of his broad neck. Flares of blue light sputtered and died on his bound hands. "My daughter and I leave #emph[you] today," Pia said. "Stay and be forgotten." She snapped the cell door's grating shut. "It's your end, not ours." Dull thuds sounded from the other side of the glass—the fists of the former inspector beating uselessly against the window. Chandra plucked a single white flower from the jasmine vine and placed it at the foot of the cell door. "What's that?" Pia asked. "Something from...a friend." Chandra said. Pia grasped one of her daughter's hands and held it tightly as the two turned their back on the cell. Ahead of them, the ruined hallways were bathed in sunlight. The howls of the voice behind the glass were small in the vast emptiness of the Dhund. The sounds of celebration from above soon drowned out everything behind them. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) #figure(image("009_Renewal/03.jpg", width: 100%), caption: [Tranquil Expanse | Art by Sam Burley], supplement: none, numbering: none) On the back patio of Yahenni's penthouse, Gideon sat on a curved bench and smiled. His friends and allies around the table were somber. Upstairs, Yahenni would be preparing themself for death. No. You prepare a corpse. Yahenni was getting dressed for their own wake. Judging by the muffled music coming from downstairs, Yahenni's long-postponed Penultimate Party had at last begun. It didn't seem like the time for smiling. Not after all the fighting in the beautiful streets of Kaladesh, Tezzeret's escape, Chandra's reckless, foolhardy—well, just #emph[Chandra] , generally. And now Yahenni's time had come. Nonetheless, even here where no one but his friends could see him, Gideon smiled. When a comrade falls, you carry their armor home. And if, with their dying breath (or equivalent), they ask you to smile while you're doing it? You smile. Set an example for the others. Don't fake it—feel it, whether you want to or not. Nissa was silent. She was still planning to go to the party, which was something. She already had one corner of her mouth propped upward, by force, and that was something too. Jace and Liliana were sitting together across the table from Gideon, pretending to ignore each other. Jace was pensive, one finger tracing anxious patterns around the table. Liliana leaned back and sipped a drink she'd pilfered from downstairs, and even her habitual haughty smirk seemed a little thin. Then there was Ajani, sitting next to Gideon. His feline features were unreadable, but his huge shoulders were slumped, his ears low, his single blue eye fixed on something far, far away. #emph[When you grieve, you're not leaving someone behind,] Hixus had told Gideon once. #emph[You're carrying them with you. And one person can only bear so much.] A small meteor landed on the bench beside him and slammed a glass of thick, yellow-orange liquid onto the table. "I got you lassi!" said Chandra. "Just, you know, the party's started, and I thought you might be thirsty." He looked down at her, and she flushed, her own lassi already half-finished in her hand. "It's, uh, good for you. It's got...yogurt?" He took a sip. "Thank you," he said. "It's good." It #emph[was] good. Too sweet. But good. Nissa wouldn't care for it. Ajani couldn't drink it. Liliana might like it, but she already had a drink. And Chandra, in pitching it to Gideon, had skipped the taste and gone straight to health benefits. They were, slowly, getting to know each other. "Uh," she said. "Depala says we have about ten minutes before Yahenni's grand entrance. We're all gonna be out there, right?" "Of course," said Gideon. Nods followed, of varying sincerity. "We owe Yahenni that much," said Nissa. Gideon cleared his throat. "We're all here, and we have a few minutes. We've got some things to talk about before the celebration takes us our separate ways." Gideon raised his glass of lassi. "To the friends we lose," he said. He turned to Ajani. "And those we gain." The group murmured agreement. Gideon placed a hand on the leonin's shoulder. "The five of us," he said, "are united by an oath. All of us, each for our own reasons, swore to keep watch. For threats. For villains. We found one here—one you were already watching." He looked to the others for approval. Nissa, Jace, and Chandra nodded. Liliana shrugged. "We'd be honored," said Gideon, "to count you among our number." The cat-man heaved a sigh. "If..." A pause. Gideon tried not to look #emph[too] expectant, not to undermine Ajani's own part in the decision. He had to want this. "Yes," said Ajani. "It would be...an honor. There is an oath?" Jace smiled at that. "It's pretty freeform," he said. He tapped his temple. "I can walk you through it, if you'd like." Ajani nodded. One ear twitched as Jace whispered telepathic instructions in his mind, then he lowered his head. "I have seen—" he said, before his voice cracked. Liliana looked away in disgust. Or embarrassment. "We don't have to do this now," said Nissa. "No," said Ajani. "No. This is right." The leonin breathed deeply. "I have seen tyrants," he said, "whose ambitions knew no limits. Creatures who styled themselves gods, or praetors, or consuls, but thought only of their own desires, not of those they ruled. Whole populations deceived. Civilizations plunged into war. People who were simply trying to live...made to suffer. To...to die." His left hand gripped the hem of his white cloak tightly. It had Bant-style stitching, Gideon noted. And it was too small for the leonin. What—and who—was the big cat carrying with him? "Never again," said Ajani. "Until all have found their place, I will keep watch." #figure(image("009_Renewal/04.jpg", width: 100%), caption: [Oath of Ajani | Art by <NAME>], supplement: none, numbering: none) There were murmurs of agreement and affirmation. "Thank you," said Ajani. "Now. As you say, we have found villains. What do you plan to do about them?" Liliana had briefed them already about her conversation with Tezzeret, and a plane called Amonkhet. "We have to stop them," said Gideon. "Tezzeret is too dangerous to go free. And from what you've said, Bolas is worse." "I hate it when you say things I agree with," said Liliana. "It's very disorienting." Gideon took it as teasing. It was easier than being offended. "We have to do something," said Jace. "We may have disrupted Tezzeret's Planar Bridge, but Bolas's plans aren't so easily undone. Whatever he's up to, he's bound to have contingency plans, because..." Jace paused. "Well, because I would. And he's a lot smarter than I am." That gave Gideon a chill. The only other being he'd ever heard Jace say that about was Ugin, another elder dragon, whose motives—though apparently less selfish than Bolas's—were inhuman in the extreme. Gideon turned to Liliana. "What can you tell us about Amonkhet?" Liliana blinked, slowly—about as much surprise as she ever showed. #emph[Yes] , thought Gideon. #emph[I'm trusting you to give us intel.] "Not much," said Liliana. "Bolas controls the place completely. As far as I know, he created it." "Created it?" said Nissa. "Is he that powerful?" "'We were gods, once,'" said Liliana. "He said that to me. Back before things changed, the most powerful Planeswalkers could do practically anything, and some did make their own worlds. Never got around to it, myself." "So it's a nasty place," said Chandra. "Whatever. I say we go there and show this dragon what happens when you mess with my home." "No," said Ajani. Five heads turned in his direction. "We can't just walk into Bolas's lair and expect to defeat him," said Ajani. "I've faced him before. I've actually #emph[won] . And that was only because he was trying to harness chaotic magical forces and fight my unfamiliar abilities at the same time." "You caught him off guard," said Jace. "That's what the others are advocating." "You #emph[won] ?" said Chandra. "By cheating," said Ajani. "He knows me now, knows what I can do. Besides, we fought in an aetheric chaos called the Maelstrom, a place utterly hostile to both of us. You're talking about facing him in the center of his power. He doesn't have to be prepared for us personally for that to be a bad idea." "You're not the only one of us who's faced him and lived," said Jace. "He's an incredibly powerful telepath, and I'm as scared of him as anybody. I know what he can do. But you don't know what #emph[we] can do, and I'm not convinced he does either." "I've been inside one of his lairs before," said Liliana. "I walked out again." Jace tensed up at that, but didn't say anything. Still hiding something? "We don't necessarily need to beat him in a straight fight," Liliana went on. "We can disrupt his plans, split off his allies—" "There's another way," said Ajani. "Bolas has a lot of enemies. And we have a lot of friends waiting in the wings. Give me time to get some of those friends together. Go find your own allies. Figure out what Bolas is actually planning, and what part of that plan is weakest." That argument pulled at Gideon. It would pull at Jace too. Ajani knew what he was doing. "He's got a point," said Jace. "We don't know anything about Bolas's plans. Maybe we should do some reconnaissance on Amonkhet, and bring our allies from elsewhere..." From upstairs, they heard everyone shout Yahenni's name. Time to go. Everyone looked at Gideon. "I hear you," said Gideon. "Both of you. But I don't think we're going to get a better chance at Bolas." "He'll turn a whole world against you," said Ajani. His voice rose, and his ears went flat. "You are going to get people #emph[killed] !" Gideon kept his chin up. Out of the corner of his eye, he saw Jace shy back. Three-hundred-odd pounds of angry cat stared down at him. Was this how Jace felt when Gideon got angry? "Apologies," said Ajani. "It's fine," said Gideon. "I'm not going to pretend this is an easy decision." Ajani fixed each of them with that ice-blue eye. "Please," he said. "Don't go to Amonkhet. Not yet. Stay here, or go find allies elsewhere. In the morning we can pick a rendezvous point. We can meet up in a few weeks' time, count our allies, compare notes, and plan our next move." He stood. "A few minutes alone before the party would be appreciated." He walked away from the table, but Chandra stood and ran to him. She wrapped him tightly in a hug, and the big cat hugged back. "I'm glad you're with us," she said. "You're a good hugger. You're even bigger than Gids. And, uh, furrier." Liliana laughed. "And you," said Ajani, "are a pleasant little hearth fire. Your mother's life would be cold without you, little flame." Chandra's smile dropped, and Ajani walked away. She sat down heavily on the bench next to Gideon. "Well," said Gideon quietly. "What do you all think? Is he right? Do we need more information and more allies before we go to Amonkhet?" There was a moment of dead silence. "No," said Chandra. "We beat three Eldrazi and we beat Tezzeret. Let's hit him hard, now." "No," said Liliana. "I don't relish the thought, but with Bolas scheming and Tezzeret on the loose, I—we—aren't safe anywhere." "...No," said Jace. "I trust his judgment, and his fears are rational, but he's wrong. Bolas #emph[is] smarter than us. Whatever time we spend preparing, he'll spend it better. You're right, Gideon. This is our chance. Once Tezzeret tells him what happened here, we lose the only advantage we have." Jace and Chandra agreeing—now #emph[that] was unsettling. Gideon turned to Nissa. "I'm not sure," she said. "I don't know Bolas. I don't know Amonkhet. But I know...us. If you all believe we can do it, then I believe it too." "He's #emph[scared] , Gideon," said Liliana. "He thinks he's lucky to have survived his last encounter with Bolas, and he's terrified of having another." Scared...? If Liliana couldn't see that Ajani was grieving, Gideon wasn't going to breach Ajani's privacy by telling her. "Don't," he said. "Don't presume to know what he's been through." Liliana's violet eyes locked on him. "We're in agreement, then?" said Jace—deflecting for Liliana. "Yes," said Gideon. "Whatever Bolas is doing on Amonkhet, he's going to do it whether we're there or not. We're not helping anybody by staying away. And I think you're right, Jace—we're not going to figure out what Bolas is up to before he adjusts to us knowing he's up to something." Gideon stood. "We'll pick a rendezvous in the morning," he said. "Then we'll meet Ajani there...after we face Bolas." "Come on," said Chandra. "Party time. #emph[Smile] ." Gideon followed her inside, and smiled. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) I'm getting dressed for the last time. Caring, capable, darling Depala drapes me in my favorite cape and secures it with my first-favorite broach. The setting sun outside illuminates the gold chest at the far end of my room, and the light bounces warmly around my chamber. Motes of dust catch in the fading light (what a lovely last sunset) and the only noise in the room comes from the soft snoozing of Depala's hyena (Crankshaft is a good girl, yes she is). I have four hours to live, and my Penultimate Party (catered food and all) will begin as soon as I descend the stairs. "There," Depala says with confidence, adjusting my broach, "you look spectacular, Yahenni." "Always do," I wheeze. My best friend's laugh is a little empty. She smiles sadly. "It's my time, Depala," I affirm. "I was worried you would never say that." I suppose I was always a little worried about that, too. "You sure about this?" she says with a worried brow. "Yes. Short-term cost isn't worth the long-term return, and all that." "Ever the investor, aren't you?" She smiles. She doesn't need to know more. Gaining a few extra days at a time isn't worth feeling like I'm dying too. And even if I only killed things that weren't people, I know I could never get the young memory of my best friend's screams out of my head. #emph[I] get to decide who I am, on my terms. And I am not a killer. #figure(image("009_Renewal/05.jpg", width: 100%), caption: [Die Young | Art by <NAME>ee], supplement: none, numbering: none) "Let's face the music, darling." Depala's grin spreads to her cheeks, and she fetches my support braces from across the room. Depala scoops me up (fairly certain I weigh less than a bandar at this point) and places me in the support braces. She fiddles with the straps on what's left of my legs, and I'm up and standing before the door. The door looms over me. It is a rich dark wood, and I can make out my reflection in the varnish. I never noticed how large it was before. Depala reaches her hand out to open it. She pauses. I feel her project a silent, tentative question. I understand. I'm ready. I nod. She opens the door, and I nearly fall over from the emotion that slams into me. "#strong[<NAME>, YAHENNI!] " I'm hit with a monsoon of fruity, flowery elation. The love of my friends spills over me, and I cannot help but laugh in delight. My aetherborn family approaches first. We briefly, silently revel in each other's shared joy, our empathic conversation pleasantly quick and hidden. Our love fuels our support fuels our love. Aetherborn families are, above else, a never-ending circle, endlessly nurturing themselves. Cleanest energy there is. Looking around I can finally sense how many people are here. My house is #emph[packed] , live music is streaming up from the courtyard, and it all vibrates with the collective joy that only a Penultimate Party can deliver. This feels like a good time for good deeds, I think. I pull a list from a hidden pocket. The party quiets and looks at me as I stand tall (ish) in the center of the room. "To my aetherborn family!" I yell, "I leave you half my savings!" My family cheers and slaps each other on the back, projecting a bashful bready you-didn't-have-to-do-thaaat-but-THANK-YOUUU toward me. Will in one fist, I point what remains of the other (two fingers down, three to go!) across the crowd. "My other half of savings goes to you, red-scarf-wearing human inventor in the corner!" The human in the corner near the buffet table jolts, mouth full of gulab jamun. They point at themselves uncertainly. "Sana Ahir? Nineteen years old? You were third in the aeronautical design division, right?" I confirm. As they slowly nod, their eyes grow wider. "Great! The other half of my savings will go toward your research!" Overcome with ecstasy, the human promptly faints. The crowd around us explodes in a blaze of elation and cheers. We are an endless loop of celebration. I sense a familiar presence enter downstairs and direct one of my relatives to lead the newcomers up to me. The crowd around me disperses to party, and a moment later I am greeted by the vanguard I have come to know as the Gatewatch. (It's a shame I never bothered asking which gate they're watching.) I walk forward and lean on my left brace. Chandra leads the way. Her sari is brand new, and the bruises and scrapes of recent battles are only slightly hidden by the finery. Her face is smiling with pride and exhaustion. From a quick read I can sense that she has been to a Penultimate Party before, and she knows this is a happy occasion. The others, though...yikes. Chandra must have done a terrible job explaining what a Penultimate Party is. Jace's mood is ringing a loud, rain-scented HELLO I AM UNCOMFORTABLE at such a volume that every empath in the room is turning to stare. The bipedal cat in the back (heart full of a still-raw grief, poor thing) feels ready to cry at any given moment. The rest are visibly uncomfortable. "Oh my gosh," I mock-whisper, "did somebody die?" Liliana laughs at that, but the others grimace awkwardly. I chuckle as part of my face crumbles off. The massive cat standing at the back of the group approaches me and kneels to my line of sight. "I am called Ajani. What can we do for you, friend, in this time of need?" Aw. What a sweetheart. "It's my party, so that means you follow my rules. I want #emph[you all] to have fun, and#emph[ I] want to say goodbye to everybody. But it #emph[has] to be fun! #emph[That's] the important part!" Ajani nods in genuine consideration. I sense Chandra's smile before it manifests. "Do you need a hand?" she says. "...With saying goodbye to everybody?" "With having fun?" I consider this for an entire second. "Sure, why not." "Then up you get!" Chandra quickly reaches down toward me and hoists me above and onto her shoulders. My support braces fall to the floor. I scream in delight. "Where to, Party Master?" she says through a full-face grin "ONWARD!" I yell, pointing toward the crowd across the room. Chandra piggybacks me around for a few minutes, occasionally running, occasionally pretending to lose her balance, laughing alongside me the whole time. When she's had her fill, she yawns and transfers me over to Gideon, who laughs heartily as he carries me under his arm like luggage. He casually passes me over to Depala, who impressively hoists me all the way above her head. Throughout the entire affair I laugh hysterically and continue to yell out my will. "Depala, darling, you get my investment portfolio!" She cheers and passes me back to Gideon with a friendly kiss on my remaining cheek. "Mrs. Pashiri, you old spitfire, you get my Fleetwheel Cruiser!" I hear Mrs. Pashiri's "Hooraaaaay" from somewhere behind the crowd. After considerable carrying and tossing and making the rounds, I catch the empathic scent of neroli from across the room. I point Gideon toward the source and he sets me onto a couch near a gently smiling Nissa. "Nissa! Nissanissanissa. Do you want to pick me up too?" Nissa shakes her head. "I want to sit with you. Are you in pain?" "A little," I admit, "But not bad enough to stave it off." She looks me up and down and raises a hand. That same familiar, warm current of energy flows into my (mostly gone) legs. I sigh with relief. It feels nice like before. Not healing...but helping. I sense something odd stirring in her. Nissa dislikes talking, which is fine. I can infer all I need from the silence of my friend while she busies herself with channeling. Top note: Grief. Trust. Feminine neroli (normal for her psychic scent) and a fresh stream (odd, that feels new).#linebreak Main body: Old, boggy fear#emph[.] An alien chalky shame on the edges.#linebreak Base note: Deep jungle and family. No, not family. Kinship? A connection without words, but one without the challenge and electric brilliance of #emph[personhood.] I close my senses. She is sad to lose me because she has had few friends like me. No. That's wrong. She hasn't had #emph[any ] friends like me. I can feel that once, long ago, she distrusted people she didn't understand. It is an old echo, but I can sense just how frightened she was, and how that fear kept her from becoming close with others. Until the Gatewatch. Until me. I'm thankful she didn't confront me with these old, long-gone feelings out loud. I'm thankful she didn't use me as a basin in which to spill her guilt for her actions in the past. She would rather work through her problems on her own without needing me for validation. A lesser person might. But she would never do that. She observes and grows on her own, for the sake of bettering herself. She is extraordinary. The channel of energy stops. My pain has gone, and Nissa looks into my eyes with a smile, unaware of my insight. "You've gotten much better at parties," I tease. She shrugs. "They're not frightening once you get to know them." Her answer may have been subconscious, but I know what she's trying to say. "I've realized...I #emph[want ] to know more about the things that are unfamiliar," she continues. "If I understand them, I won't be afraid of them." Her heart is a gentle canopy of humility and orange blossoms. "I want you to have something," I say quietly. Nissa's mood pickles. "I knew you'd hate presents, but that's dumb, so here you go." I reach under my shirt and pull a pendant necklace out from over my head. "The chain is gold from the mountains. I assume the sapphire in the middle on the pendant there is from Lathnu, too. Wear it under your clothing so hooligans don't run off with it." Nissa holds out a delicate hand to take the necklace. She puts it on gently over her head and tucks it under her top. "Traditionally you give these sorts of things to someone who misses home, so there y'go," I wheeze. I can feel how much the gesture means to her and relish in our little loop of positivity. "Thank you, Yahenni. I wish I had something to give you in return." "You can give me whatever you like as long as I don't have to carry it." She thinks for a bit. "Would you like to hear a secret? "Always." I see before me an elf with an impish smile, but behind her face I sense the vast tree of private joy that grows quickly with anticipation of disclosure. "Yours is one of an infinite number of worlds." What. "It is a single grain in an endless field. And each of those single grains is a realm unto its own." Her emotion rings with truth. Everything she is saying is real. How– "Sometimes there are...people...who can travel between those realms." She gives me a knowing look with the word "people." Honesty, honesty, warm copper honesty. #emph[How] — "People who travel to places very far away and very different from their home. And those people know that we are all tiny parts of a vast and complex whole. But the space between those realms, the thing that connects each of those universes, is the same substance that makes up the aetherborn. What makes up #emph[you ] extends far beyond Kaladesh. #emph[You ] are what connects the Multiverse." For a moment, I am silent, absorbing the immensity of what Nissa has told me. I finally land on a response. "I#emph[ knew it] ." #figure(image("009_Renewal/06.jpg", width: 100%), caption: [Omniscience | Art by Jason Chan], supplement: none, numbering: none) Nissa grins. I look at the ceiling in wonder. I feel tiny. I feel huge. I feel like I've been given the greatest gift of my life. "So...where are you #emph[really] from?" I eventually ask. "The world I come from is called Zendikar." "Are there aetherborn on Zendikar?" "No, but there are elemental beings that are sort of like you. There are vampires that are sort of like you, too, but you are much more friendly than they are." "What is the landscape like?" "It walks around." "WHAT." We talk and talk and talk. Eventually, Nissa talks herself out. The entire time my head is spinning with excitement and victory. I made this incredible person without a home feel so at home that she could reveal the most stupendous of secrets. What a victory! I see Depala out of the corner of my eye and remember what I must do. Depala leads my aetherborn family over to carry me up to the roof one last time. "Nissa, I'm afraid I have to go now. You're welcome to join me on the roof, if you like." Her emotion cascades through sentiment. "No," she says at last, "I should stay here. Farewell, Yahenni." She is very small on the couch. I cement the image of her looking back at me in my mind. "So long, darling." Nissa smiles sadly, and my mind is caught in a loop running over and over through the gift she just gave me. What an incredible Penultimate present... My family lifts my chair, bathes me with condolence and compassion, and brings me up to the roof. The Great Conduit curves brilliant and cerulean above me in the night. Hundreds of stars boldly shine through the city lights, and my dearest friends sit gathered around an empty bed, awaiting my arrival. The sky is incredible. A splash of violets and blues and aether and stars. It's a beautiful night for goodbyes. My family around me projects comfort and ease. It works, and I settle into a place of calm. The universe is so large and I am so small, and Nissa has given me the greatest gift I have ever received. I look into the eyes of my loved ones around me. I have given them all I can give, their joy floods every part of me, and our circuit is complete. I tell each of them a kind farewell. Taking my time, feeling everything they feel in return, reveling in each individual as I look them in the eye and wish them the best. None of them cry, and all of them promise to use what I bequeathed them to give back some good for the next aetherborn to soak up. I use my last bit of strength to reach down and scritch Depala's hyena behind the ears. Everyone is happy. Everyone is smiling. Everyone is promising to keep the party going after I leave. I feel the current of my city as it surges on into the next forever. I think of the single grain I call home and the infinite realms beyond everything I know. My friends tell me it's all right. It's time. You can let go now. And so I do. I shudder and release (it feels #emph[wonderful] ) I dissipate into the endless sky above and, triumphant, I end. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) "I shouldn't have stayed away so long," Chandra said. Chandra lugged the basket of ceramic tiles as she walked next to her mother, who wore her toolbox slung over one shoulder. Pia pointed the way from Aradara Station platform to a side street, and they made their way to their destination. "It's not your fault. It's not as if you could have just...traveled back whenever you wanted." Chandra swallowed. "I could've." "Oh." Her mother hitched up her toolbox as they rounded a corner. "Well. You didn't know." "I should have known. Somehow. I should have felt the mom-waves floating through the aether." Her mother gave her a look. "Is that how it works?" "No!" "Oh. Well. Too bad. Mom-waves can be very soothing." Chandra kicked a rock. "They would have been." "So how #emph[does] it work? The—being what you are. Traveling away from home. How is that possible?" Chandra laughed ruefully. "Asking the wrong person." "But...you can just #emph[do] it. Right? Like your fire." "Not like my fire. Not exactly. But it lets me move to other worlds. I've been able to ever since that day in the arena. It's a different kind of gift." Chandra caught her mother watching her face intently. She knew this wasn't parental concern—this was the thopter engineer in her. Her mother had always relished opening the guts of machines and seeing how they worked. "You want to pop open my hood, Mom?" "All I am asking for is a series of detailed schematics." "Well it's not like that. It's more like...when you unfocus your eyes, and you see patterns that weren't there before." Her mother slumped with disappointment. "Or when you're barely listening to the sounds of the train station, and for a moment, everything lines up and makes a melody." "Metaphors are not schematics," her mother said. Chandra shrugged. "That's the best I can do. I don't know why I am this way. I don't know why this is what I'm about now." They turned another corner, and found the place. Dad's place. The broken mosaic in the wall was an old portrait of her father, one of dozens of mosaics of well-known inventors around the city, likely built by some admiring artist. It was the closest thing they had to a burial plot, a spot where his memory had soaked into the city. The portrait had holes and chips in it from years of neglect. Chandra set down the basket and got to work, selecting ceramic tiles of the right hues. #figure(image("009_Renewal/07.jpg", width: 100%), caption: [Lost Legacy | Art by <NAME>], supplement: none, numbering: none) Her mother snapped the tiles with pliers, breaking them into the correct shapes. She smeared putty into the gaps with a gloved finger, and Chandra pressed the tiles into place. They worked together in silence for a time. No tears came—in fact Chandra drew a simple, industrious pleasure from it. It felt good to work alongside her mother, to dirty her hands in the act of making something, here in the middle of Ghirapur. An uninterrupted creative act. Chandra squashed a small square tile over her father's eyebrow, and she paused, looking into his eyes. "I'm going to stay," she said. "What?" "Stay. Here. On Kaladesh. With you." "But I thought—" her mother started. "I—I'd be glad for that, Chandra. But don't you think..." "I'll live here, and we'll be together again." Chandra filled in part of her father's goggles with red-tinted tiles. "A family." Her mother didn't say anything for such a long time that Chandra turned away from the mosaic to face her. "Mom?" Her mother's face was a closed curtain. "Don't make me go through it again, Chandra." "Through what?" "My heart can only handle so much." "Mom. That's why I'm staying!" "You're not staying. Don't say that. You're making this harder than it needs to be." "Making #emph[what] harder?" Chandra asked, jamming a tile into Dad's chest so hard it broke. "#emph[This] is our family now." Her mother pointed with the pliers, back and forth between herself and Chandra. "This is who you are, this is who I am, this is who we are together. We're a mother and her #emph[visiting] daughter." "No. I'm not leaving you again. Ever." "Don't say that, don't you #emph[say] that!" her mother almost shouted. She sighed and sat down heavily among the tiles. She picked up a bluish-silverish piece with her pliers and set it gently aside. "Chandra, I'm your mother, and of course I'd love for you to stay longer. But we both know you're more than this place now. I couldn't handle it if you lied to me about this new part of your life. I'd die a little bit every single #emph[day] if I thought I was the one keeping you here." Chandra felt a scratchy lump in her throat. "I can't go, Mom. I #emph[have] to go—and I can't." Pliers pointed up at her. "You can. You're a traveler. So you'll go, and you'll come back again, and we'll catch up, you and me. And your dad here. We can stop being a family of leaving, and become a family of arriving." Chandra was furious at the tears in her eyes. "I am not going to say that word." Her mother stood up, and she was a fierce, angry, slightly short pillar of love. "<NAME>, you #emph[say] goodbye to me. You say it to me five times, ten times to my face, and you take the #emph[power] out of that word. Do you understand me?" "Mom..." "Because I won't shackle you here with the worry that I won't be able to hear it. I won't hide your gifts from all those worlds that need them. And I won't go to the other side of this building and break these tiles and work on another damned shrine to someone I've los—" She halted herself, putting a shaking hand over her lips. "Mom, what?" "There's...another mosaic. Of you. From when you were eleven." Tears rolled out of Chandra's eyes. "Why?" "I told you. A shrine. You think some unnamed inventor-admirer made this? I made them both, you and your father. As soon as I got out. So I'd have a place where I could tell you both goodbye." Chandra couldn't say anything. She just fell into her mother's arms and squeezed. #figure(image("009_Renewal/08.jpg", width: 100%), caption: [Cathartic Reunion | Art by Howard Lyon], supplement: none, numbering: none) Her mother released her, sniffing through a smile. She appraised her with an engineer's eye, straightening the pattern on the shawl around Chandra's waist, tightening the strap that held her pauldron on her shoulder. "When do you have to go?" she asked brightly. "Soon." "Very soon?" She brushed a lock of hair away from Chandra's face and tucked it behind one ear, a sneaky excuse to graze her fingers along Chandra's cheek. "Yes," Chandra said, rubbing streaks out of her eyes. "To Amonkhet. Someplace I've never been." "Well, you'll have to tell me all about it." Chandra looked at the mosaic. It still had gaps and chips. "Dad's not done." "We're almost out of tiles anyway. We'll finish him when you get back." "It might be a while." "Gives me time to fire more tiles." "Can we work on mine, too? Next time?" Her mother's smile made her cheeks taut, with little creases of joy. She pushed her goggles up cock-eyed, took Chandra's hand, and looked into her eyes expectantly. Chandra made herself say the word, so that she could say it, and its opposite, again and again in the days and years to come. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) There were rivers in the air; they carried her like a mote of pollen. Great hearts were pounding in the deeps of the sky, singing slow symphonies of joy. Wordless, they expressed the sun breaking over the edge of clouds; the sharpness of stars over frosted peaks; the awareness of a new life growing within, nestled and patient, waiting for its first breath of radiance. She drifted bodiless among the singers, listening. Back and forth they called, echoing across cloud and current, composing shared dreams of weightlessness, rain, and memory. An eye the size of a house blinked. Radiant curiosity washed over her, like the return of sunlight from beyond the edge of all things. #emph[There is something new in our sky] , it sang in language of sensation and vibrance; quickened heartbeats and quivering muscle; caught breath and a hundred shades of blue. #emph[How wonderful there should be a thing we don't yet know.] #figure(image("009_Renewal/09.jpg", width: 100%), caption: [Aethersquall Ancient | Art by <NAME>], supplement: none, numbering: none) Elsewhere, vibration caught her attention. The sky rushed away. She opened her ears to footfalls on steel, her nose to fried food and sweat, and—finally—her eyes. Chandra walked across the twilit platform of the Spire, loose-limbed with fatigue, rubbing the gray circles under her eyes. "Hey, Nissa. Thought you were asleep." The curve and sway of music gave way before jagged angles of speech. Words returned in scribbles and scratches. "Sorry," she croaked. "I was..." Chandra squatted an arm-length away, sunrise-colored eyes darting from one corner of her face to another. Nissa searched her face, warm and flush with fluttering, nervous life, but found no capacity for understanding. No context she could appeal to. No words that could explain. Still she said, "I was listening to skywhales," and it seemed important that she should. Chandra blinked upward. "What? Where?" Nissa felt the curl and bustle of the aetherstreams. She turned her head, and weighed the bearings' change. "Far east, and several days south. Dawn is breaking over them." Chandra yawned, with an intensity that made her jaw tremble and her eyes water. "You've got good ears." "I was with them." "But you're right here?" She took a breath, and dove. "I can feel leylines. Or aetherstreams. When I meditate, and sometimes when I'm just sitting, I...become one with them. My perceptions, my thoughts, they slip away. I become one with the world." Chandra rocked back on her heels, fingers lacing nervously around her knees. "Spooky. That an elf thing? A Zendikar thing? Would #emph[I] drift off like that if I meditated?" "No." Nissa looked away, feeling the heat rise in her cheeks. "It's just...a #emph[me] thing." Chandra bolted to her feet, hair sparking and lifting in ripples. "Sorry! I didn't mean to—!" Nissa reached up. "Please don't run." She watched Chandra's fingers tremble against the violet sky. "I upset you again." Her hair sputtered and crackled. Auroral ribbons of orange shimmered across her scalp. "I always seem to—" Nissa's eyes squeezed shut, and she forced scribble-words into the air. "Y-you didn't!" Chandra turned back, holding her breath, unable to meet her eye. Nissa swallowed past the desert in her throat. "I don't speak often. I lived alone for...decades. Zendikar was my companion. We understood each other at a level deeper than words. I...I don't know #emph[how] to talk to you. I'm trying to learn." Chandra looked up, eyes wide and startled. "#emph[You] don't know how to talk to #emph[me] ?" "I will make mistakes," Nissa said. "Pick the wrong words. Misunderstand yours. I'll act strange and won't know that I am. But if you can be patient with me, I would like to be..." Waves of sky-song memory welled upward, symphonies of color and warmth, resonant movement and shared breath. She stilled them, reduced them, and forced out angular words shaped in a pallid shadow of acceptable truth. "...your friend." Chandra's hands leapt out to enfold hers, warm as a bird's nest. "I dunno," she sniffled, one corner of her mouth quivering upward. "I think you're pretty good at picking words." "It took all afternoon to decide how to say this." Chandra laughed, but it ended in another yawn. She released Nissa's hand to cover her mouth. "Ugh. Sorry." The shadows under Chandra's eyes had grown deeper. Nissa gestured to the space beside her. "Do you still wish to learn meditation? This is the stillest point in your city." "I dunno," Chandra looked back over her shoulder. "I thought, it's our last night here, maybe I could show everyone around? There's gonna be air races, and fireworks, there's a restaurant in Bomat that makes the best undhiyu, and I saw this little green girl selling mango-flavored snow..." She paused. "But you wouldn't like any of that, would you? Crowds and noise." "I'd go," Nissa said, as Chandra paced, the heels of her boots tapping like rain on leaves. "Mrs. Pashiri said I should show you around, just you and me, because all we did before was walk around prison and get locked in a box." Chandra frowned. "She #emph[also] said I should change into a sari. Even had one picked out. I was like... 'I'm gonna climb seven million stairs to meet her on the Spire in that?' Such a weird thing for her to—wait, what did you say?" Nissa felt the corners of her mouth ascend on their own, without the conscious thought #emph[I should smile now] . "I'd go." Chandra blinked down at her. "...Uhwuh?" she said, eloquently. "I'd like to see your home." "I thought you—?" "I'd get anxious. Yes," she admitted, fingers fretting in her lap. "I'd need...to step away and be quiet. But I'd be with you. Not alone." "Oh," Chandra said. "Well, there's still time. We could catch a late dinner. Or drinks, maybe." "Ah. I have something for you," Nissa said. She reached behind her to get the covered mug she'd bought earlier, before the sun slipped below the clouds. "What's that?" Chandra said, spilling to the ground beside her. "I'm not sure." Nissa removed the lid and sniffed. "The man I bought it from said it would be calming." She handed the mug to Chandra, who was yawning against the back of a hand. "I'm afraid it's grown cold. It should be drunk warm." "I got this," Chandra smirked, and rested base of the mug on one glowing palm. She cautiously inhaled the rising steam. "Sweetened milk. With pistachio, almond, and cardamom." Her eyes glistened in the dark. "Dad used to make this for me. When I couldn't sleep." Nissa cocked her head, trying to fathom if this was a good or an ill. At last, Chandra sipped carefully, smiled, and wiped at her eyes. "It's very good," she said. "I'd like you to imagine something." "Like a meditation?" she said, putting the mug aside. "Should I sit like you?" "However you find comfortable." Chandra tried to tuck her legs one under the other, but grimaced and began unstrapping pieces of armor, setting them aside in a clattering, sliding pile of lacquered steel. "And I'm not gonna float off with the skywhales?" she grinned. "If you do," Nissa said, seriously, "I will catch you." She closed her eyes. "I want you to imagine a river." "What kind?" "Fast. It dashes over rocks. The spray is forming rainbows." "What color?" Nissa frowned in the dark behind her eyelids. "The rainbows? They're all—" "No, the water. The #emph[river] . Is it muddy, or clear, or...?" "Whatever you wish. Imagine it tumbling by, frothing over the bank at your feet." "Am I wearing shoes?" "It doesn't—you're barefoot." "What's on the shore? Are there trees, or is this a canyon, or—?" "Shh." "But—" "#emph[Shh] ." She waited. Silence. "Just—" Very quietly, Chandra whispered, "#emph[I'mshushingnow] ." "...Just listen to my voice. Listen to the wind. To the waters rushing over the rocks, white and wild. Let the river grow wider. Deeper. As it spreads, the passing water slows. The spray over the rocks falls into stillness. The crash becomes a murmur." She'd chosen a river because Chandra had soothing memories of floating. Already, her breaths came slower, her fluttering bird's-heart steadied. "Walk into the river," Nissa murmured. "Slow steps. The water parts around your feet, silent and shining in the sun. One step at a time. It cools you. Your ankles. Your knees. Your waist. There's soft mud between your toes." She spoke low, in a heartbeat rhythm. Her mother had told stories in this way, after they'd been driven from yet another Joraga camp, after Nissa's tormented dreams and the flowers that bloomed to greet her had made the other elves mutter and gesture superstitiously. Tales of mountains that floated away, silent under starlight. Of trees that dropped fruit at orphans' feet and scooped them away from charging baloths. Stories in which the world was not a path between thorns and teeth, but an endless garden of profound and miraculous beauties, each waiting for a listener. It was many years before she'd realized they were animist stories, lost and suppressed, forbidden as heresy. Stories no longer remembered by any living soul, save herself. "Spread your fingers, and let the water flow between them. It's at your chest now. Lean back. Let it lift you. You weigh nothing. You're floating beneath the clouds. Be silent. Be still. You're only breathing." She listened. Chandra breathed slow and deep, a warmth radiating from her side. She didn't react to the lengthening silence. Nissa reopened herself to the surge of Kaladesh. Aether lifted her over streets splashed with throbbing color. Throngs jostled and skipped along bridges and through squares pulsing with music and laughter, shimmering with joy. Sparks leapt into the sky above the river, trailing streamers of hissing glitter. They crackled and burst, blooming into flowers of red and yellow flame. The crowds along the water's edge gasped and cheered. Down in the shadows, between glittering towers, the aether moved strangely. An eddy formed, sinking and coiling into an alley away from the revelry. She let herself dance downward around it and poured her awareness into the weeds pressing earnestly through cracked cobbles. They surged into a carpet of night-flowers. Wisps of aether streamed in from distant reaches of the city, far shores of the sky, and the blinding immensity that lay beyond Kaladesh. The energies blended, compacted, then puffed outward in a luminous cloud of blues—mid-morning sky, lagoon water, mountain root, sea ice, infant's eye. An exhalation of the world, a new young star throbbing quick, fierce, and steady. The edges of the cloud darkened, solidified. The crackling static within it quieted to a sizzle. The aetherborn looked at their hands, then at Nissa's flowers. #emph[Hello, child] .#emph[ Welcome to the world] . She had no idea if vibrations of root and leaf could be understood by the newborn. They held their new hands over a bloom, as if it were a candle's flame. From the sizzle of energy, patterns emerged, spontaneous and oddly familiar. #emph[Y-you. You? Are scented. You smell as if— smell like...neroli.] They paused, flickers of lightning-thought shivering through their limbs. #emph[What's neroli?] Vertiginous déjà vu washed over Nissa. #emph[You have a wonderful adventure ahead of you] , she told them. The aetherborn considered.#emph[ What should I do?] they asked. What would she do, if she had the time again? If she didn't flinch at light, noise, and touch, or speak in gestures and movements strange and off-putting to others? How could she tell this new life to laugh and weep without reservation or regret; to sing to the stars and waters, or to nothing at all; to love unreserved and unguarded; to treasure every moment with those beloved; to forgive any regretted trespass; to dance when moved to; to savor long silences in warm company; to greet each dawn, each face with the thought, #emph[this will be an adventure] ; to be brave, and kind, and trusting, and... ...like Chandra. The aetherborn waited, flickering. But why would anyone find her thoughts on the matter of value, anyway? #emph[Don't be afraid to follow your heart,] Nissa told them. #emph[...Why would that be scary?] Halfway across Ghirapur, her body exhaled a laugh into the deepening twilight. #emph[May it ever puzzle you.] Vibrations came from the end of the alley; she could feel them through the fine white web of her roots. The child looked to them.#emph[ There are others like me!] Other aetherborn surrounded them, lifted them to unsteady new feet, embraced. The alley trembled with greetings, vibrations of scent and colorless energies, each body's radiance stirring the others in sympathy. #emph[You're welcome, you're loved, there are marvelous days to come, and you're just in time to see them!] The group led them away, conversing in quicksilver flashes of thought. At the end of the alley, the child turned and looked back to her flowers. #figure(image("009_Renewal/10.jpg", width: 100%), caption: [Live Fast | Art by Ryan Yee], supplement: none, numbering: none) #emph[You...you have...] they tilted their head, trying to shake loose a thought. #emph[You have gorgeous eyes...sweetheart] . Half-familiar laughter shivered the air. THUMP. Nissa jolted awake in her own body. Chandra had collapsed against her side. Her head lolled over her shoulder, wisps of copper hair tickling her nose, slow tides of breath ebbing from her open mouth. And she was drooling on her sleeve. Nissa had hoped this would happen; Chandra needed sleep. There would be time for meditation later. Perhaps slipping away on thoughts of water would quench the fires of her nightmares. If not, Nissa would remain, waiting to help. But this position was not comfortable. Her arm already grew numb. Carefully, Nissa lifted Chandra's radiant featherweight, and maneuvered so she could rest her head across her lap. Chandra stirred in her sleep, turning on to her side and curling up, pulling her knees to her chest and her hands to her face. Then her lips parted, and industrial snores pealed across the platform. Kaladesh celebrated rebirth with pounding music, colors and light, food in a thousand varieties. Bonfires shimmered in the squares and parklands, casting shadows through bright-painted dancers. Crowds crossing the bridges dumped bags of dye into the Vinday, changing the river into a swirling rainbow. The streets thronged with bodies swaying and shifting together, greeting one another with laughter and shouts of joy, tears, open arms and forgiveness. In the quiet of the sky, Nissa guarded Chandra's sleep. It felt right. #figure(image("009_Renewal/11.jpg", width: 100%), caption: [Nimbus Maze | Art by <NAME>], supplement: none, numbering: none)
https://github.com/FlyinPancake/bsc-thesis
https://raw.githubusercontent.com/FlyinPancake/bsc-thesis/main/thesis/pages/chapters/chapter_4_execution.typ
typst
#import "@preview/glossarium:0.2.4": gls = Execution and evaluation == PostgreSQL <postgres-test-exec-sec> To establish a baseline for comparison, we utilize PostgreSQL as the reference database. We conduct several `pgbench` tests to assess the performance of PostgreSQL. However, the results obtained are not entirely reliable. This is because `pgbench` measures the end-to-end performance of the database, including factors such as network latency and client-side operations. Additionally, the results are not reliably reproducible due to the influence of machine load on database performance. Therefore, the obtained results lack conclusiveness, as they are neither reproducible nor stable. This will not be an issue for the evaluation of the virtual cluster, since we will run the same tests on the same hardware. In this chapter we present results in the form of box plots, with the small addition of the mean line (dashed) next to the median line (solid). #grid( columns: (1fr, 1fr), [ #figure( caption: [Baseline @rw @tps], gap: 2mm, )[ #image("../../figures/plots/postgres/unlimited/host_only_rw.svg", width: 125%) ] <initial-rw-baseline>], [ #figure( caption: [Baseline @ro @tps], )[ #image("../../figures/plots/postgres/unlimited/host_only_ro.svg", width: 125%) ] <initial-ro-baseline> ], ) In @initial-rw-baseline, we present our initial measurements of the @tps values of the database. It is important to note that these @tps values were obtained with 10 clients and 1000 transactions per client, while running on a memory-constrained pod. The @tps values hover around the higher 90s, which is relatively low. This can be attributed to the fact that the database is running on a single pod with limited memory resources. The data presented here is an aggregation of 10 `pgbench` runs with the same parameters, excluding the lowest and highest values. In the same test run, we also measured the performance of read-only (@ro) operations. For this particular test case, we utilize 20 clients and 1000 transactions per client. To distribute the requests among the @ro replicas of the database, we employ a NodePort service for load balancing. Naturally, the @tps values for the @ro tests are higher compared to the @rw tests, as the @ro tests do not involve any disk transactions. We observe, that the @ro tests are approximately an order of magnitude faster than the @rw tests. This discrepancy is expected, given the nature of the workload and the increased number of clients and servers. In @initial-ro-baseline, we illustrate the distribution of @ro @tps values, which exhibit a wider range compared to the @rw @tps values. However, it is important to note that the measured @tps values, even after accounting for the greatest outliers, exhibit significant variability. We use this data to establish a baseline for comparison with the same PostgreSQL setup, but running inside a virtual Kubernetes Cluster. We expect their performance to be similar, as the database is running on the same host cluster, but inside a `vcluster` instance. As discussed in @vcluster-arch-sec, `vcluster` only maps the pods to a virtual cluster, and real Kubernetes resources are backing every required virtual one. The overhead of the virtualization comes from the virtual control plane, and the syncer, which is responsible for synchronizing the virtual cluster state with the real (backing) one. #figure( caption: [Initial @rw @tps in a virtual Kubernetes cluster], )[ #image("../../figures/plots/postgres/unlimited/rw.svg", width: 100%) ] <initial-rw-vcluster> In @initial-rw-vcluster, we present the @tps values of the @rw tests, which were conducted inside a virtual Kubernetes cluster compared to the baseline. The left box plot titled "bare-metal" is the performance of PostgreSQL running on a conventional Kubernetes cluster, while the right side "vcluster" shows the performance of PostgreSQL running on the virtual Kubernetes cluster. The @tps values are $7.82%$ lower for the baseline, which is a significant difference. The variability of the @tps values are also increased. This behaviour is also observed in the @ro tests, which are presented in @initial-ro-vcluster. The @tps values decrease by $9.11%$ when running on the virtual cluster. #figure( caption: [Initial @ro @tps measured by `pgbench` inside a virtual Kubernetes cluster], )[ #image("../../figures/plots/postgres/unlimited/ro.svg", width: 100%) ] <initial-ro-vcluster> Recognizing that the outcomes derived from the preceding assessments did not fully reflect the actual performance of `vcluster`, we opt to undertake additional tests by elevating the resource constraints for the PostgreSQL database's pods. In these subsequent tests, we augment the RAM limit to $8G$ and set the CPU limit to $4$ cores. As illustrated in the data depicted in @rw-limits, the means of the throughput values (@tps) exhibit a notably reduced variance. Although the throughput delta resembles that of @initial-rw-baseline, the values register an increase of approximately $50$ to $100%$. This augmentation aligns with expectations, considering the expanded access to RAM by the database. #figure(caption: [@rw @tps with increased resource limits])[ #image("/figures/plots/postgres/limited/rw.svg", width: 90%) ] <rw-limits> Similarly, in @ro-limits, we present the @ro @tps values with the increased resource limits. The @tps values are more than an order of magnitude higher than the baseline, but the variability is also increased. This is expected, as the database has access to more RAM and CPU resources. We can observe that the virtual cluster and the host cluster caught up to each other. This we attribute to the fact that the PostgreSQL cluster in the virtual Kubernetes cluster and cluster in the host Kubernetes cluster now have access to the same amount of resources. The syncer might have a higher performance overhead for writing #gls("persistentvolume", suffix: "s", long: true) than reading them. #figure(caption: [@ro @tps with increased resource limits])[ #image("/figures/plots/postgres/limited/ro.svg", width: 100%) ] <ro-limits> === Measurement with different scales In @pgbench-sec we introduced `pgbench` and its ability to scale the benchmark database. We will now use this feature to measure the performance of PostgreSQL with different scales. We will use the same scale factors for the virtual cluster and the host cluster. As discussed in the context of @pgbench-performance-analysis, a battery of tests are conducted across @sf[s] ranging from $10$ to $200$. The ensuing section aims to present the outcomes of these tests. Notably, at the lower scale factors, there is an observable alternation in performance between the virtual cluster and the host cluster. Although this fluctuation is attributed to statistical noise, it is evident that no substantive distinctions are discernible between the two deployment methodologies. In the subsequent segment, identified as @sf10rw-fig, the ratios of @tps values align with the baseline measurements, albeit reflecting relatively diminished values. It is important to highlight that the bare-metal cluster consistently outperforms the virtual cluster. This performance contrast could plausibly be ascribed to the necessity for traversing the syncer in the virtual cluster configuration. #figure(caption: [@rw performance for @sf=10], image("/figures/plots/postgres/scales/rw_10.svg", width: 100%) ) <sf10rw-fig> Likewise, in the context of @sf10ro-fig, a discernible trend emerges wherein the @tps values for @ro operations surpass those observed in @sf10rw-fig. This outcome aligns with expectations since @ro tests exclude write operations to the disk. Notably, despite the reduced scaling factor, noteworthy enhancements in @tps values are evident compared to the baseline (with a scale factor of $100$). This enhancement can be attributed to optimizations implemented in the scaled tests, where the number of clients is proportionally adjusted to complement the scale factor, as elucidated in @pgbench-performance-analysis. Furthermore, with these optimizations, a convergence is observed between the means and medians, with minimal discernible differences within the margin of error. Variability patterns are also comparable, albeit with a slightly higher variability observed in the host cluster. This divergence may be attributed to both clusters being capable of delivering the required allocation of resources to the database. #figure(caption: [@ro performance for @sf=10], image("/figures/plots/postgres/scales/ro_10.svg", width: 100%) ) <sf10ro-fig> Advancing through the scale factors, we turn attention to @sf = 50 as depicted in @sf50rw-fig. We observe our first greater gap in performance comparing "bare-metal" and "vcluster" results. This increment aligns with expectations, attributed to the heightened presence of parallel workers and a greater volume of database rows in comparison to the scenario illustrated in @sf=10, as discussed earlier. Relative to the observations in @sf10rw-fig, it becomes apparent that the disparities in both means and medians experience a proportional augmentation. This indicative rise underscores that the variability in @tps values is concurrently expanding. #figure(caption: [@rw performance for @sf=50], image("/figures/plots/postgres/scales/rw_50.svg", width: 100%), ) <sf50rw-fig> Turning our attention to @sf50ro-fig, we observe a higher peak @tps score for the virtual cluster compared to the host cluster. This is a surprising result, as the virtual cluster is expected to be slower than the host cluster. We can attribute this to the fact that the end-to-end nature of `pgbench` will naturally lead to higher variability in the results. This is especially true for the virtual cluster as we add an additional layer of indirection. The medians and means return to comparable values to each other. `vcluster` seems to be able to keep up with the host cluster, providing similar performance to bare-metal. This is an expected result, as the virtual cluster and the host cluster have the same resource limits. #figure(caption: [@ro performance for @sf=50], image("/figures/plots/postgres/scales/ro_50.svg", width: 100%) ) <sf50ro-fig> For the @sf=100 tests we observe the same trends as seen in @sf50rw-fig. and @sf50ro-fig. The @tps values for the virtual cluster are lower than the bare-metal cluster for the @rw tests and similar for the @ro tests. #figure(caption: [@rw performance for @sf=100], image("/figures/plots/postgres/scales/rw_100.svg", width: 100%) ) <sf100rw-fig> #figure(caption: [@ro performance for @sf=100], image("/figures/plots/postgres/scales/ro_100.svg", width: 100%) ) <sf100ro-fig> The trends continue in @sf200rw-fig. and @sf200ro-fig, although in the @ro tests the virtual cluster is slightly more behind the host cluster than in the benchmarks before. Here we can see, that the virtual cluster is only able to keep up with the host cluster to a certain point. After that, the virtual cluster starts to slightly fall behind the host cluster. #figure(caption: [@rw performance for @sf=200], image("/figures/plots/postgres/scales/rw_200.svg", width: 100%) ) <sf200rw-fig> #figure(caption: [@ro performance for @sf=200], image("/figures/plots/postgres/scales/ro_200.svg", width: 100%) ) <sf200ro-fig> In @rw-scales, we present the means of the @rw tests for the different scale factors. We can observe that the virtual cluster and the host cluster have similar performance for the smaller scale factors, but the virtual cluster starts to fall behind the host cluster for the larger scale factors. Both setups reached their peak performance at @sf=100, and performance start to fall after that. This is expected as the database has to handle more clients and more data within the same resource constraints, which will lead to lower performance. #figure(caption: [@rw @tps with different database scales])[ #image("/figures/plots/postgres/scales/rw_means.svg", width: 100%) ] <rw-scales> In @ro-scales, we present the means of the @ro tests for the different scale factors. We can observe that the virtual cluster and the host cluster have similar performance for the smaller scale factors, but the virtual cluster starts to fall behind the host cluster for the largest scale factor. Both setups reached their peak performance at @sf=50, and performance start to fall after that. This can be attributed to the same reasons as in @rw-scales. #figure(caption: [@ro @tps with different database scales])[ #image("/figures/plots/postgres/scales/ro_means.svg", width: 100%) ] <ro-scales> === `vcluster`'s unexpected benefits During the evaluation of PostgreSQL within a virtual Kubernetes cluster, we observed an unexpected benefit of `vcluster`. We observed that the Kubernetes operator managing the PostgreSQL cluster was sluggish when trying to remove the cluster. Cleaning up the database cluster took a considerable amount of time, which is not ideal, as we want to be able to quickly remove the cluster when we are done with it. We can't blame the operator for this, as it is as we have not delved into tuning to to suit our needs. We can't expect however, that every operator is highly efficient, and we might encounter similar problems in the future. We observed that `vcluster` can help us with this problem. We can create a virtual cluster, and deploy the database cluster inside the virtual cluster. When we are done with the database cluster, we can simply delete the virtual cluster, and the database cluster will be deleted with it. This is a great benefit, as we can quickly remove the database cluster, and we don't have to wait for the operator to clean up the cluster. == Kafka <kafka-test-exec-sec> In this section, we will evaluate the performance of Kafka running inside a virtual Kubernetes cluster. We will use the setup described in @kafka-sec, within a vcluster and running on a real Kubernetes cluster. We will used the same setup for the virtual cluster and the host cluster, with the addtition of some additional configuration for the virtual cluster, as deployment is not as easy as on physical clusters. Our testing will focus on latency and not throughput, as increasing the througput can be done by scaling the Kafka cluster horizontally. We used Strimzi's Kafka operator @strimzi to deploy Kafka and Zookeeper on both the virtual cluster and the host cluster. We tried to reuse the same configuration for both clusters, but we had issues with the virtual cluster, as the virtual cluster does not expose the real nodes' IP addresses. This is a problem for the Strimzi operator, as it needs to know the IP addresses of the nodes to configure Kafka's boostrap. We solved this issue by using a custom configuration for the virtual cluster, where we manually set the IP addresses of the nodes. This is not a problem for the host cluster, as the Strimzi operator can access the real nodes' IP addresses. #figure(image("/figures/plots/kafka/latency.svg", width: 90%), caption: [Latencies of Kafka]) <kafka-latency> In @kafka-latency, we present means of different latency measurements for the virtual cluster and the host cluster. When addressing latency, lower values are desireable.We used the different test cases described in @kafka-sec to create a combined plot of the different measurements. We can observe that the two performance values are similar, within the margin of error. This is expected, as the virtual cluster and the host cluster have the same resource limits. The syncer might have some performance overhead, but it is limited. #figure(image("/figures/plots/kafka/p90.svg", width: 90%), caption: [90#super[th] percentile of Kafka's latencies]) <kafka-p90> For the 99#super[th] percentile in @kafka-p99, we can observe that the virtual cluster once again, exhibits similar performance to the host cluster (within the margin of error). These results are expected and align with the outcomes of the 90#super[th] percentile measurements in @kafka-p90. #figure(image("/figures/plots/kafka/p99.svg", width: 90%), caption: [99#super[th] percentile of Kafka's latencies]) <kafka-p99> == Functionality Testing -- CRD conflict <crd-conflict-sec> In this section, we aim to assess the efficacy of `vcluster` in resolving the @crd version conflict issue. For this evaluation, we will utilize the @crd outlined in @crd-conflict-planning—a straightforward @crd designed to accommodate a single version. Our objective is to attempt the application of both versions of the @crd to a common host cluster. The initial application of the first @crd version proves successful. However, encountering an error, as indicated in @crd-version-error, prevents the successful application of the second version. This scenario prompts further investigation into the capabilities of `vcluster` to effectively manage and reconcile conflicting @crd versions within the host cluster. #figure(caption: [Applying two versions of the same @crd to the same host cluster])[ ``` The CustomResourceDefinition "pdfdocument.k8s.palvolgyid.tmit.bme.hu" is invalid: status.storedVersions[0]: Invalid value: "v1": must appear in spec.versions ``` ] <crd-version-error> The anticipated outcome is aligned with the host cluster's inability to support the application of multiple versions of the same @crd. To further explore this, we will create a virtual cluster and examine the feasibility of applying both versions of the @crd within the virtual cluster. Two distinct `vcluster` instances, denoted as `pdf-v1` and `pdf-v2`, will be established, each corresponding to a different @crd version. Both virtual cluster instances will share the same host cluster. Following this, connections to the virtual clusters will be established, and the respective @crd versions will be applied. In this instance, both versions are successfully applied. Subsequently, we will verify the @crd versions within their respective virtual clusters, as depicted in @crd-version-check. #figure(caption: [Checking the @crd versions in the virtual clusters])[ ```sh $ kubectl get crd pdfdocument.k8s.palvolgyid.tmit.bme.hu -o custom-columns=NAME:.metadata.name,VERSION:.spec.versions[*].name # pdf-v1 NAME VERSION pdfdocument.k8s.palvolgyid.tmit.bme.hu v1 # pdf-v2 NAME VERSION pdfdocument.k8s.palvolgyid.tmit.bme.hu v2 ``` ] <crd-version-check> We can see that both versions of the @crd are present in their respective virtual clusters. This solution is not perfect, as we still can not use both versions from a single cluster. However, this can be a viable solution for some applications where the two versions are not used together.
https://github.com/not-matthias/typst-jku
https://raw.githubusercontent.com/not-matthias/typst-jku/main/utils.typ
typst
/* Based of the work of <NAME>, Mai 2023 Continued by <NAME>, October 2024 */ #import "jku.typ": font // Creates a box with a colourful background and an icon to // highlight to-dos, warnings, etc. #let note(content, type: "todo") = { let bg = rgb("#ebcc3433") let stroke = rgb("#ebcc3488") let sign = emoji.lightning box( baseline: .8em, fill: bg, inset: 8pt, radius: 4pt, stroke: stroke, grid( column-gutter: 8pt, columns: (10pt, auto), sign, text(font: font.sans, content) ) ) } #let _custom_endnote_counter = counter("custom_endnote") #let _endnotes = state("endnotes", (:)) #let endnote = (text) => { _custom_endnote_counter.step() locate(loc => { let index = _custom_endnote_counter.at(loc).first() _endnotes.update(nts => { nts.insert(str(index), text) nts }) super([#index]) }) } #let show_endnotes = () => { pagebreak(weak: true) layout(page-size => context { let endnotes = _endnotes.final() if endnotes.len() == 0 { return } heading(numbering: (..nums) => [], "Endnotes") for endnote in endnotes [ #block(width: page-size.width - .9cm, stack( dir: ltr, spacing: .2cm, super(endnote.first()), endnote.last() )) #v(.4em) ] } ) }
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/goto_definition/inside_block.typ
typst
Apache License 2.0
// path: base.typ #let f() = 1; ----- . #import "/base.typ": *; #let conf() = { import "@preview/example:0.1.0"; set text(size: /* ident after */ f()); }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/transform_03.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test setting scaling origin. #let r = rect(width: 100pt, height: 10pt, fill: forest) #set page(height: 65pt) #box(scale(r, x: 50%, y: 200%, origin: left + top)) #box(scale(r, x: 50%, origin: center)) #box(scale(r, x: 50%, y: 200%, origin: right + bottom))
https://github.com/CCNU-CSIT883-Group2/Documents
https://raw.githubusercontent.com/CCNU-CSIT883-Group2/Documents/master/UserRequirements/main.typ
typst
#import "../Templates/template.typ": * #show: group_work.with("User Requirements") = Sign Up ==== Purpose Allows new users to create an account. ==== Details - *Fields Required:* Nickname, password, and email. - *Role Selection:* Users choose between `student` or `teacher` roles. - *Validation:* Email verification for authenticity confirmation. = Login ==== Purpose Secure entry point for returning users. ==== Details - *Login Credentials:* Users can use either their nickname or email. - *Post-login Redirect:* Directs to the `Dashboard` upon successful login. = Dashboard ==== Purpose Central hub for user activities and analytics. ==== Features - *Statistics:* Visual analytics display performance metrics. - *Access Points:* Quick links for question creation, review, and quizzes. - *Settings Access:* Link to update personal and account settings. = Settings ==== Purpose Manages personal and account information. ==== Features - *Personal Information:* Update name, email, and other details. - *Password Management:* Secure password updating. - *Account Preferences:* Customize notifications, privacy, and sharing settings. = Create Questions ==== Purpose Enables the creation of customized practice questions. ==== Process - *Input Specifications:* Define number of questions, subject, specific knowledge points in a subject, and type(multiple/single-choice questions or fill-in-the-blank questions). - *GAI Library Integration:* Uses AI to generate tailored questions. The library will return the questions in json formats with its answers and the reason of it. But the fill-in-the-blank questions will be somehow special: the answer of it could be vigrous. - *Feedback Loop:* If a user's fill-in-the-blank answer differs from the AI-generated one, it is sent back to the library for validation. = Question Bank ==== Purpose Stores and manages created questions. ==== Capabilities - *Storage:* Saves questions in a personal repository. - *Review and Modify:* Options to revisit or alter stored questions. - *Export Functionality:* Export questions in multiple formats for offline use. = Answer Questions ==== Purpose Engages users with their created or saved questions. ==== Options - *Sequential Mode:* Answer all questions before reviewing corrections. - *Instant Feedback Mode:* Immediate feedback after each question. ==== Function - *Progress Tracking:* Shows how many questions have been answered. - *Question Type Prompt:* Should have clear prompts to show the type of question. = Analyze Performance ==== Purpose Provides analytical insights into user performance. Also display in the `Dashboard`. ==== Details - *Performance Metrics:* Analysis of correct and incorrect responses. - *Improvement Suggestions:* Recommends areas for further study. - *Custom Reports:* Generate detailed performance reports.
https://github.com/RaphGL/ElectronicsFromBasics
https://raw.githubusercontent.com/RaphGL/ElectronicsFromBasics/main/DC/chap3/7_common_hazards.typ
typst
Other
#import "../../core/core.typ" === Common sources of hazard Of course there is danger of electrical shock when directly performing manual work on an electrical power system. However, electric shock hazards exist in many other places, thanks to the widespread use of electric power in our lives. As we saw earlier, skin and body resistance has a lot to do with the relative hazard of electric circuits. The higher the body\'s resistance, the less likely harmful current will result from any given amount of voltage. Conversely, the lower the body\'s resistance, the more likely for injury to occur from the application of a voltage. The easiest way to decrease skin resistance is to get it wet. Therefore, touching electrical devices with wet hands, wet feet, or especially in a sweaty condition (salt water is a much better conductor of electricity than fresh water) is dangerous. In the household, the bathroom is one of the more likely places where wet people may contact electrical appliances, and so shock hazard is a definite threat there. Good bathroom design will locate power receptacles away from bathtubs, showers, and sinks to discourage the use of appliances nearby. Telephones that plug into a wall socket are also sources of hazardous voltage (the open circuit voltage is 48 volts DC, and the ringing signal is 150 volts AC -- remember that any voltage over 30 is considered potentially dangerous!). Appliances such as telephones and radios should never, ever be used while sitting in a bathtub. Even battery-powered devices should be avoided. Some battery-operated devices employ voltage-increasing circuitry capable of generating lethal potentials. Swimming pools are another source of trouble, since people often operate radios and other powered appliances nearby. The National Electrical Code requires that special shock-detecting receptacles called Ground-Fault Current Interrupting (GFI or GFCI) be installed in wet and outdoor areas to help prevent shock incidents. More on these devices in a later section of this chapter. These special devices have no doubt saved many lives, but they can be no substitute for common sense and diligent precaution. As with firearms, the best \"safety\" is an informed and conscientious operator. Extension cords, so commonly used at home and in industry, are also sources of potential hazard. All cords should be regularly inspected for abrasion or cracking of insulation, and repaired immediately. One sure method of removing a damaged cord from service is to unplug it from the receptacle, then cut off that plug (the \"male\" plug) with a pair of side-cutting pliers to ensure that no one can use it until it is fixed. This is important on jobsites, where many people share the same equipment, and not all people there may be aware of the hazards. Any power tool showing evidence of electrical problems should be immediately serviced as well. I\'ve heard several horror stories of people who continue to work with hand tools that periodically shock them. Remember, #emph[electricity can kill], and the death it brings can be gruesome. Like extension cords, a bad power tool can be removed from service by unplugging it and cutting off the plug at the end of the cord. Downed power lines are an obvious source of electric shock hazard and should be avoided at all costs. The voltages present between power lines or between a power line and earth ground are typically very high (2400 volts being one of the lowest voltages used in residential distribution systems). If a power line is broken and the metal conductor falls to the ground, the immediate result will usually be a tremendous amount of arcing (sparks produced), often enough to dislodge chunks of concrete or asphalt from the road surface, and reports rivaling that of a rifle or shotgun. To come into direct contact with a downed power line is almost sure to cause death, but other hazards exist which are not so obvious. When a line touches the ground, current travels between that downed conductor and the nearest grounding point in the system, thus establishing a circuit: #image("static/00067.png") The earth, being a conductor (if only a poor one), will conduct current between the downed line and the nearest system ground point, which will be some kind of conductor buried in the ground for good contact. Being that the earth is a much poorer conductor of electricity than the metal cables strung along the power poles, there will be substantial voltage dropped between the point of cable contact with the ground and the grounding conductor, and little voltage dropped along the length of the cabling (the following figures are #emph[very] approximate): #image("static/00068.png") If the distance between the two ground contact points (the downed cable and the system ground) is small, there will be substantial voltage dropped along short distances between the two points. Therefore, a person standing on the ground between those two points will be in danger of receiving an electric shock by intercepting a voltage between their two feet! #image("static/00069.png") Again, these voltage figures are very approximate, but they serve to illustrate a potential hazard: that a person can become a victim of electric shock from a downed power line without even coming into contact with that line! One practical precaution a person could take if they see a power line falling towards the ground is to only contact the ground at one point, either by running away (when you run, only one foot contacts the ground at any given time), or if there\'s nowhere to run, by standing on one foot. Obviously, if there\'s somewhere safer to run, running is the best option. By eliminating two points of contact with the ground, there will be no chance of applying deadly voltage across the body through both legs. #core.review[ - Wet conditions increase risk of electric shock by lowering skin resistance. - Immediately replace worn or damaged extension cords and power tools. You can prevent innocent use of a bad cord or tool by cutting the male plug off the cord (while its unplugged from the receptacle, of course). - Power lines are very dangerous and should be avoided at all costs. If you see a line about to hit the ground, stand on one foot or run (only one foot contacting the ground) to prevent shock from voltage dropped across the ground between the line and the system ground point. ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/cheda-seu-thesis/0.2.0/seu-thesis/templates/bachelor.typ
typst
Apache License 2.0
#import "../utils/fonts.typ": 字体, 字号 #import "../utils/set-bachelor.typ": set-bachelor #import "../utils/bilingual-bibliography.typ": appendix #import "../utils/states.typ": part-state #import "../utils/thanks.typ": thanks #import "../pages/cover-bachelor-fn.typ": bachelor-cover-conf #import "../parts/abstract-bachelor-fn.typ": abstract-conf #import "../parts/outline-bachelor-fn.typ": outline-conf #import "../parts/main-body-bachelor-fn.typ": main-body-bachelor-conf #let bachelor-conf( studentID: "00121001", author: "王东南", school: "示例学院", major: "示例专业", advisor: "湖牌桥", thesisname: "示例论文标题\n此行空白时下划线自动消失", date: "某个起止日期", cnabstract: [示例摘要], cnkeywords: ("关键词1", "关键词2"), enabstract: [#lorem(100)], enkeywords: ("Keywords1", "Keywords2"), outlinedepth: 3, bilingual-bib: true, doc, ) = { show: set-bachelor.with(bilingual-bib: bilingual-bib) // 封面 bachelor-cover-conf( studentID: studentID, author: author, school: school, major: major, advisor: advisor, thesisname: thesisname, date: date, ) // 独创性声明 include "../pages/statement-bachelor-ic.typ" // 摘要 abstract-conf( cnabstract: cnabstract, cnkeywords: cnkeywords, enabstract: enabstract, enkeywords: enkeywords ) // 目录 outline-conf(outline-depth: outlinedepth) // 正文 show: main-body-bachelor-conf doc } #show: bachelor-conf.with( studentID: "00121001", author: "王东南", school: "示例学院", major: "示例专业", advisor: "湖牌桥", thesisname: "示例论文标题\n此行空白时下划线自动消失", date: "某个起止日期", cnabstract: [示例摘要], cnkeywords: ("关键词1", "关键词2"), enabstract: [#lorem(100)], enkeywords: ("Keywords1", "Keywords2"), outlinedepth: 3, )
https://github.com/YabusameHoulen/Statistics
https://raw.githubusercontent.com/YabusameHoulen/Statistics/main/Information_folklore/Information_folklore.typ
typst
#import "../Template/pset.typ": pset #import "@preview/cuti:0.2.1": show-cn-fakebold // #show: show-cn-fakebold #set text(12pt, font: ("Times New Roman", "寒蟬錦書宋")) #show: pset.with( class: "Statistics", student: "Yabusame", title: "Information Critierion", date: datetime.today(), ) #let xb = $bold(x)$ #let yb = $bold(y)$ = 信息熵的基础知识 定义随机变量x的熵(#text(red,"离散情况")): $ H[x] = - sum_x p(x)log_2p(x) $ (*Noiseless Coding Theorem*) 熵是传输随机变量状态的比特数的下界 (*Maximum Entropy*) $ tilde(H) = - sum_i p(x_i)ln p(x_i) + lambda (sum_i p(x_i) - 1) attach(=>, t: "maximize") p(x_i) = 1/M ; H = ln M \ "where M is the total number of the state" $ (*Differential Entropy*) 在(#text(red,"连续分布")) $p(x)$下,观测到随机变量$x_i$的概率 $ => p(x_i)Delta$ $ lim_(Delta->0){-sum_i p(x_i)Delta ln p(x_i)} = - integral p(x) ln p(x) dif x = H[x] $ (*Kullback-Leibler Divergence*) $ "KL"(p||q) & = - integral p(xb) ln q(xb) dif xb - (- integral p(xb) ln p(xb) dif xb) \ & = - integral p(xb) ln q(xb)/p(xb) dif xb $ 注意 $"KL"(p||q) != "KL"(q||p)$,所以它并不是metric (Jensen 不等式证明等号成立的条件是$forall xb : p(xb)=q(xb)$) (*Conditional Entropy*) 考虑联合分布,在已知x的情况下确定y值所需要的信息是 $-ln p(y|x) => text("所对应的信息熵",font:"寒蟬錦書宋") H[y|x] = - integral.double p(xb,yb) ln p(yb|xb)dif yb dif xb $ $ H[x,y] = H[y|x] + H[x] $ (*Mutual Information*) $xb$和$yb$之间的相互信息 $ I[xb,yb] = "KL"[p(xb,yb)||p(xb)p(yb)] = - integral.double p(xb,yb) ln ((p(xb)p(yb))/p(xb,yb)) dif xb dif yb $ = (Bouns) 信息准则的几个谣传 AIC和BIC的原始形式如下: $ text("AIC")_m=-2 sum_(i=1)^n log(p_(hat(theta))(y_i)) + 2d_m $ $ text("BIC")_m=-2 sum_(i=1)^n log(p_(hat(theta))(y_i))+ d_m log(n) $ == AIC适合预测, BIC适合解释 ? 这种看法忽略了参数化和非参数化情形, AIC可能在$n arrow infinity$时也不能取到最好模型,在非参数情况下, BIC选择生成数据模型的一致性也不是良好定义的。 == 应该使用AIC, 因为现实情况更常见到非参数化的情形 ? 在实际情况中信息准则也会受到样本数的影响,例如: #enum( indent: 4em, [在样本少非参数的情况下, BIC可以察觉到突出的模型 ], [在参数化的情况下,系数在不同的数量级上很小,并且样本数不足以 估计它们,在这种情况下选择模型使用AIC更加适合], [主要有部分参数化、部分非参数化的两种情况], ) == penlity $l_0$ 不如 penlity (LASSO, SCAD, MCP), 因为它是离散的 ? 信息准则相当于带有$l_0$ penlity的回归, penlity 是否正确取决于计算的目的 #list( indent: 4em, [即使是对于固定调整参数(fixed tuning parameter),选择模型的能力与penlity function 的连续与否没有直接关系], [固定调整参数(fixed tuning parameter)的选择基于数据,其他penlity 不一定会给出更好结果], [事实上$l_0$ penlity 方式以最少的约束条件得到了minimax rate最佳值 ], ) 复杂的理论看不懂...直接到建议部分: + 当选择模型是为了预测的时候: - 依据参数化指标或者交叉验证选择AIC-Type 或 BIC-Type 方法 - 使用适应性的信息准则(例如BC) 结合AIC和BIC的方式 + 当希望从后随观测的相似的样本大小中重新得到选择参数时(选择变量用以解释模型)---使用BIC-Type 防止引入不重要的变量 + 如果保护最坏情况预测精度非常重要,首选AIC --- 极小极大速率(minmax rate)最优性 此外对于寻找可能相关变量的探索性研究,尽管AIC型方法可能会过度选择,但不会遗漏重要变量,这些变量可以在大样本量的后续研究中验证 + 当预测变量的数量 d 与样本大小 n 相比并不小,并且考虑 d 变量的所有子集时,最好使用高维 AIC 或 BIC 来解决潜在的严重选择偏差 + 当模型选择不稳定性较高时,出于预测目的,可以考虑模型平均
https://github.com/SkiFire13/typst-slides-unipd
https://raw.githubusercontent.com/SkiFire13/typst-slides-unipd/master/unipd.typ
typst
MIT License
#import "@preview/polylux:0.3.1": logic, utils #let unipd-palette = ( main: rgb(155, 0, 20), gray: rgb(72, 79, 89), light-gray: rgb(237, 237, 238), header-logo: "logo_text_white.png", title-background: "bg.svg", background-logo: "logo_text.png", footer-wave: "bg_wave.svg", ) #let palette-state = state("unipd-theme-palette", unipd-palette) #let with-palette = f => locate(loc => f(palette-state.at(loc))) #let title-background = with-palette(palette => { place(image(palette.title-background, width: 100%, fit: "stretch")) place( bottom + right, dx: -5%, dy: -5%, image(palette.background-logo, height: 18%) ) }) #let unipd-theme(aspect-ratio: "4-3", palette: unipd-palette, body) = { set page(margin: 0pt) set page(paper: "presentation-" + aspect-ratio) if aspect-ratio != "16-9-extended" set page(width: 1058.27pt, height: 595.28pt) if aspect-ratio == "16-9-extended" set text(font: "New Computer Modern Sans", size: 24pt) show heading.where(level: 2): set text(fill: palette.main) show heading.where(level: 2): it => it + v(1em) set list(marker: text("•", fill: palette.main.darken(20%))) palette-state.update(palette) body } #let title-slide( title: none, subtitle: none, authors: none, date: none, ) = logic.polylux-slide({ // Background title-background // Normalize data if type(subtitle) == none { subtitle = "" } if type(authors) != array { authors = (authors,) } if type(date) == none { date = "" } // Title, subtitle, author and date v(20%) align( center, box(inset: (x: 2em), text(size: 46pt, fill: white, title)) ) align( center, box(inset: (x: 2em), text(size: 30pt, fill: white, subtitle)) ) v(5%) // TODO: Max 2 columns, last in a single column block(width: 100%, inset: (x: 2em), grid( rows: (auto,), columns: (1fr,) * authors.len(), column-gutter: 2em, ..authors.map(author => align(center, text(size: 24pt, fill: white, author))) )) place(bottom, dx: 7.5%, dy: -30%, text(size: 24pt, fill: white, date)) }) #let header = with-palette(palette => { place(rect(width: 100%, height: 12%, fill: palette.main)) place(right, dx: -2%, dy: 1%, image(palette.header-logo, height: 10%)) // Section name in header place(dx: 2%, dy: 4.5%, text(size: 34pt, fill: white, utils.current-section)) }) #let footer = with-palette(palette => { place(bottom, image(palette.footer-wave, width: 100%)) // Slide number in the footer place( bottom + right, dx: -2.5%, dy: -2.5%, text( size: 18pt, fill: palette.main.lighten(50%), logic.logical-slide.display("1 of 1", both: true) ) ) }) #let slide(title: none, body) = logic.polylux-slide({ header v(15%) // Space for header footer if title != none { v(7%) let title-text = with-palette(palette => text(palette.main, title)) block( width: 100%, inset: (x: 4.5%, y: -.5em), breakable: false, outset: 0em, heading(level: 1, title-text) ) v(.7em) } v(1fr) block(width: 100%, inset: (x: 2em), body) v(2fr) }) #let new-section(title) = utils.register-section(title) #let new-section-slide(title) = logic.polylux-slide({ new-section(title) header footer set align(center + horizon) let titletext = with-palette(palette => text(palette.main, title)) heading(level: 2, titletext) }) #let filled-slide(content) = logic.polylux-slide(with-palette(palette => { set text(size: 44pt, fill: white) show: it => box(width: 100%, height: 100%, fill: palette.main, it) show: it => align(center + horizon, it) content })) #let (normal-block, alert-block, example-block) = { let make_block_fn(mk-header-color) = (title, body) => with-palette(palette => { show: it => align(center, it) show: it => box(width: 85%, it) let slot = box.with(width: 100%, outset: 0em, stroke: black,) stack( slot( inset: 0.5em, fill: mk-header-color(palette), align(left, heading(level: 3, text(fill: white, weight: "regular")[#title])) ), slot( inset: (x: 0.6em, y: 0.75em), fill: palette.light-gray, align(left, body) ) ) }) ( make_block_fn(palette => palette.gray), make_block_fn(palette => palette.main), make_block_fn(_ => rgb(0, 128, 0)), ) }
https://github.com/WinstonMDP/knowledge
https://raw.githubusercontent.com/WinstonMDP/knowledge/master/relations.typ
typst
#import "cfg.typ": cfg #show: cfg = Отношения $R$ рефлексивное $:= x R x$ $R$ иррефлексивное $:= x cancel(R) x$ $R$ симметричное $:= x R y -> y R x$ $R$ антисимметричное $:= x R y -> y R x -> x = y$ $R$ транзитивное $:= x R y -> y R z -> x R z$
https://github.com/saadulkh/typst-notes
https://raw.githubusercontent.com/saadulkh/typst-notes/main/README.md
markdown
MIT License
# Typst Notes Provides footnotes/endnotes implementation in Typst ## Archived This repository is now archived, as [typst](https://www.github.com/typst/typst) natively supports [footnotes](https://typst.app/docs/reference/meta/footnote/). ## Example Checkout ![this](example.pdf) simple example.
https://github.com/MatheSchool/typst-g-exam
https://raw.githubusercontent.com/MatheSchool/typst-g-exam/develop/docs-shiroa/template/pageless.typ
typst
MIT License
// The project function defines how your document looks. // It takes your content and some metadata and formats it. // Go ahead and customize it to your liking! #let project(title: "", authors: (), mode: "paged", body) = { assert(mode in ("paged", "pageless"), message: "invalid mode") // Set the document's basic properties. set document(author: authors, title: title) set page( height: auto, width: 210mm, // numbering: "1", number-align: center, ) if mode == "pageless" set text(font: ("Linux Libertine", "Source Han Serif SC", "Source Han Sans"), size: 12pt, lang: "en") set page(height: 297mm) // Title row. align(center)[ #block(text(weight: 700, 1.75em, title)) ] // Main body. set par(justify: true) // rules show raw.where(block: true): set par(justify: false) show raw.where(block: true): rect.with(width: 100%, radius: 2pt, fill: luma(240), stroke: 0pt) show link: text.with(blue) show link: underline body }
https://github.com/AxiomOfChoices/Typst
https://raw.githubusercontent.com/AxiomOfChoices/Typst/master/Courses/Math%2018_155%20-%20Differential%20Analysis%201/Assignments/Assignment%204.typ
typst
#import "/Templates/generic.typ": latex, header #import "@preview/ctheorems:1.1.0": * #import "/Templates/math.typ": * #import "/Templates/assignment.typ": * #show: doc => header(title: "Assignment 3", name: "<NAME>", doc) #show: latex #show: NumberingAfter #show: thmrules #let col(x, clr) = text(fill: clr)[$#x$] #let pb() = { pagebreak(weak: true) } #set page(numbering: "1") #let bar(el) = $overline(#el)$ #set enum(numbering: "a)") *Sources consulted* \ Classmates: . \ Texts: Class Notes. = Question == Statement Assume that $X$ is a closed set in $RR^n$ and $K$ is a compact set in $RR^n$. Show that $X + K := { x + y : x in X, y in K}$ is closed. == Solution Let $z_n$ be a converging sequence of points in $X + K$ with limit $z$, then we write $z_n = x_n + y_n$ for some sequences of points $x_n in X, y_n in K$. But now $y_n$ has some convergent subsequence $y_(n_k) -> y$ with $y in K$ because $K$ is compact, so since $z_(n_k) -> z$ we get that $x_(n_k) -> x$ for some $x$. Closedness of $X$ then guarantees that $x in X$ so since $z = x + y$ we get that $z in X + K$ and so $X + K$ is closed. = Question == Statement Show that if $u in cal(E)'(RR^n)$ and $phi in C^infinity (RR^n)$ then $supp u * phi seq supp u + supp phi$. == Solution Using the previous question we know that $supp u + supp phi$ is a closed set, so fix some point $x$ not in $supp u + supp phi$ and let $B_r (x)$ be some open neighborhood of it that does not intersect $supp u + supp phi$. Now let $psi in C_c^infinity (B_r (x))$ be any test function supported in $B_r (x)$, we have $ pair(u * phi, psi) = pair(u times.circle phi, psi(x+y)) $ but then we have $ pair(u times.circle phi, psi(x + y)) = pair(u, integral_(RR^n) phi(x) psi(x + y) d y) $ but now this integral can only be non-zero if $x in supp phi$ and $x + y in supp psi$ for some $x$, or otherwise said, $y in (-supp phi) + supp psi = -supp phi + B_r (x)$ where $- supp phi = {- z : z in supp phi}$. But now notice that $(- supp phi) + supp psi$ cannot intersect $supp u$ since then we would have $supp u + supp phi$ intersect $B_r (x)$. Hence we get $ pair(u times.circle phi, psi(x + y)) $ and so we have showed that $x in.not supp u * phi$. = Question == Statement If $u in cal(D)'(RR^n)$ and $phi,psi in C_c^infinity (RR^n)$, then $ (u * phi) * psi = u * (phi * psi) $ == Solution By definition for any test function $ pair((u * phi) * psi, eta) = pair((u * phi), integral_(RR^n) phi(x) eta(y + x) d x) = pair(u * phi, ov(psi) * eta) $ where $ov(phi)(x) = phi(-x)$. Now we continue this calculation $ pair(u * phi, ov(psi) * eta) = pair(u, ov(phi) * (ov(psi) * eta)) $ then as we saw in class we know that for $C_c^infinity$ functions we always have $phi * (psi * eta) = (phi * psi) * eta$, so we have $ pair(u, ov(phi) * (ov(psi) * eta)) = pair(u, (ov(phi) * ov(psi)) * eta) $ now we have $ (ov(phi) * ov(psi))(x) &= integral_(RR^n) ov(phi)(y) ov(psi)(x-y) d y = integral_(RR^n) phi(-y) psi(y-x) d y = integral_(RR^n) phi(y) psi(-y-x) d y \ &= (phi * psi)(-x) = ov(phi * psi)(x) $ so we have $ pair(u, ov(phi) * (ov(psi) * eta)) = pair(u, ov(phi * psi) * eta) = pair(u * (phi * psi), eta) $ so since this is true for any test function $eta$ we have $(u * phi) * psi = u * (phi * psi)$. = Question == Statement Let $U seq RR^n, V seq RR^m, W seq RR^ell$, and let $u in cal(D)'(U), v in cal(D)'(V), w in cal(D)'(W)$ + $supp (u times.circle v) = supp u times supp v$. + If $u_k -> u$ in $cal(D)'(U)$ and $v_k -> v$ in $cal(D)'(V)$, then $u_k times.circle v_k -> u times.circle v$ in $cal(D)'(U times V)$. + $diff_(x_j) (u times.circle v) = (diff_(x_j) u) times.circle v$ and $diff_(y_j) (u times.circle v) = u times.circle (diff_(y_j) v)$. == Solution + Let $(x,y) in.not supp u times supp v$, then either $x in.not supp u$ or $y in.not supp v$. In the first case, we find neighborhood $U'$ such that $u|_(U') = 0$, and we get for any $phi in C_c^infinity (U' times V)$, $ pair(u times.circle v, phi) = pair(u, v(phi)(x)) $ but $v(phi)(x)$ can only be non-zero at the $x$ for which $phi(x,y)$ is a non-zero function of $y$ which means $supp (v(phi)) seq U'$ and thus $ pair(u, v(phi)(x)) = 0. $ Similarly in the second case, we can find a neighborhood $V'$ such that $v|_(V') = 0$, and we get for any $phi in C_c^infinity (U times V')$ that $ pair(u times.circle v, phi) = pair(u, v(phi)(x)) $ but $supp phi(x,y) seq V'$ for any fixed $x$ so $v(phi)$ is always zero and thus $ pair(u, v(phi)(x)) = 0. $ In either case $(x,y) in.not supp (u times.circle v)$. On the other hand, assume that $(x,y) in supp u times supp v$, then take any neighborhood $U' times V'$ of $(x,y)$. By assumption there exists some test function $phi in C_c^infinity (U')$ such that $pair(u, phi) != 0$, similarly there exists some test function $psi in C_c^infinity (V')$ such that $pair(v, psi) != 0$. We thus have $ pair(u times.circle v, phi(x) psi(y)) = pair(u, v(phi(x) psi(y))) = pair(u, phi(x) v(psi(y))) = pair(u, phi) pair(v, psi) != 0 $ and so $(x,y) in supp (u times.circle v)$. + We simply compute for any $phi in C_c^infinity (U times V)$, $ pair(u_k times.circle v_k - u times.circle v, phi) = pair(u_k times.circle v_k - u_k times.circle v + u_k times.circle v - u times.circle v, phi) $ now we can split this into two terms, first we have $ pair(u_k times.circle v - u times.circle v, phi) = pair(u_k - u, pair(v, phi)) -> 0 $ since $u_k -> u$. Next we have $ pair(u_k times.circle v_k - u_k times.circle v, phi) = pair(u_k, pair((v_k - v)(y), phi(x,y))) $ now by uniform boundedness principle (see Theorem 4.16 in Dyatlov's notes) we have that there exists a constant $C$ and an integer $N$ such that $ abs(pair(u_k, pair((v_k - v)(y), phi(x,y)))) <= C norm(pair((v_k - v)(y), phi(x,y)))_(C^N) $ but we know by definition that $pair((v_k - v)(y), phi(x,y)) -> 0$ in $C_c^infinity (U)$ so $ pair(u_k, pair((v_k - v)(y), phi(x,y))) -> 0 $ + Finally we can compute $ pair(diff_(x_j) (u times.circle v), phi) &= - pair((u times.circle v), diff_(x_j) phi) = - pair(u, pair(v(y), diff_(x_j) phi(x,y))) \ &= - pair(u, diff_(x_j) pair(v(y), phi(x,y))) = pair(diff_(x_j) u,pair(v(y), phi(x,y))) \ &= pair(diff_(x_j) u times.circle v, phi) $ where the important step was $pair(v(y), diff_(x_j) phi(x,y)) = diff_(x_j) pair(v(y), phi(x,y))$ which is true because we saw in class that partial pairing with a distribution does not affect derivatives in the other variables. Similarly we also get $ pair(diff_(y_j) (u times.circle v), phi) &= - pair((u times.circle v), diff_(y_j) phi) = - pair(u, pair(v(y), diff_(y_j) phi(x,y))) \ &= pair(u, pair(diff_(y_j) v(y), phi(x,y))) = pair(u times.circle diff_(y_j) v, phi). $ which finishes the proof.
https://github.com/EgorGorshen/scripts-for-typst
https://raw.githubusercontent.com/EgorGorshen/scripts-for-typst/main/utils.typ
typst
MIT License
#import "@preview/ctheorems:1.1.2": * // ------- ОФРОМЛЕНИЕ global -------- #show: thmrules.with(qed-symbol: $square$) #show "thm-qed-symbol": none #set heading(numbering: "1.1.") #set math.equation(numbering: "[1.1]") #show ref: it => { let eq = math.equation let el = it.element if el != none and el.func() == eq { numbering(el.numbering, ..counter(eq).at(el.location())) } else { it } } #let theorem = thmbox("theorem", "Теорема", fill: rgb("#FFB347"), stroke: (left: 0.25em)) #let corollary = thmplain( "заключение", "Заключение", base: "theorem", titlefmt: strong, fill: rgb("DDA0DD"), inset: 1em, ) #let definition = thmbox("definition", "Определение", fill: rgb("#FFA07A")) #let example = thmplain("example", "Пример").with(numbering: none) #let liner(title, body) = block(above: 2em, stroke: (left: 2pt), width: 100%, inset: 14pt)[ #set text(font: "Noto Sans") #place( top + left, dy: - 1em, // Account for inset of block dx: 6pt - 1em, [_*#title*_], ) #body ] #let proof(body) = liner("Доказательство", body)
https://github.com/Complex2-Liu/macmo
https://raw.githubusercontent.com/Complex2-Liu/macmo/main/contests/2023/content/problem-09.typ
typst
#import "../lib/math.typ": problem, proof, note, ans, hasheq, eqref #problem[ 已知在 $n times n$ 的表格内第 $i$ 行及第 $j$ 列填入数 $a_(i j)$, 其中 $1 <= i, j <= n$, 且满足以下条件: 任何在不同行与不同列的 $n$ 个数之和均相等. 例如, 当 $n = 2$ 时, $a_(11) + a_(22) = a_(12) + a_(21)$. 求证: 存在数 $x_1, dots.h.c, x_n$ 及 $y_1, dots.h.c, y_n$ 使得对任意的整数 $1 <= i, j <= n$, 有 $a_(i j) = x_i + y_j$. ] #proof[ 记任意在不同行与不同列的 $n$ 个数之和为 $S$, 设矩阵 $A = (a_(i j))$. 任取 $x_1, y_1$ 使得 $a_(11) = x_1 + y_1$. 通过关系式 $a_(1 j) = x_1 + y_j$ 以及 $a_(i 1) = x_i + y_1$ 来定义 $x_i, y_j$, 其中 $2 <= i, j <= n$. 为了说明这样定义的 $x_i, y_j$ 满足题目的要求, 我们只需验证 #hasheq(hash: "467d635")[ $ a_(i j) + a_(1 1) = a_(1 j) + a_(i 1) $ ] <467d635> holds for all $2 <= i, j <= n$. 事实上, 考虑把 $A$ 的第 $1$ 行和第 $i$ 行挖掉, 再把第 $1$ 列和第 $j$ 列挖掉所得到的 $n - 2$ 阶子矩阵, 在这个子矩阵中任意取 $n - 2$ 个不同行不同列的数对他们求和, 设求和结果为 $S'$, then $ S = S' + a_(11) + a_(i j) = S' + a_(1 j) + a_(i 1). $ 这就证明了 #eqref(hash: true, "467d635"). ] /* vim: set ft=typst: */
https://github.com/AliothCancer/AppuntiUniversity
https://raw.githubusercontent.com/AliothCancer/AppuntiUniversity/main/capitoli_fisica/grandezze_termodinamiche.typ
typst
= Grandezze termodinamiche *Note* - Le lettere minuscole indicano grandezze massiche, cioè divise per la massa. - Per ottenere la grandezza non massica basta moltiplicare per la massa. == Energia interna $ Delta u = q - w $ - $Delta u:$ variazione di energia interna massica - $q:$ calore massico scambiato - $w:$ lavoro volumico *nota*\ il termine del lavoro ha davanti un meno perchè se fosse un'espansione si va da $v_1$ più piccolo a $v_2$ più grande quindi $(v_2 - v_1) > 0$ ma è lavoro che esce dal sistema e quindi contribuisce negativamente all'energia interna, questo spiega il meno davanti al lavoro. == Entalpia $ d h = d u + p dot d v + v dot d p $ Si può quindi vedere come: $ Delta h = Delta"energia interna" + "lavoro volumico" + "lavoro tecnico" $ Sostituendo l'energia interna: $ d h = d u + p dot d v + v dot d p\ d h = d q -cancel(p dot d v) + cancel(p dot d v) + v dot d p \ d h = d q + v dot d p = w_t $ \ \ Quindi: $ Delta h = "calore scambiato" + "lavoro tecnico" $ mentre: $ Delta u = "calore scambiato" - "lavoro volumico" $ == Entropia Misura del disordine di un sistema. *Caratteristiche* - Aumenta all'aumentare della temperatura - Più aumenta la temperatura e più le molecole del sistema viaggiano velocemente. - Diminuisce all'aumentare della pressione - Più un sistema è compresso e meno è disordinato. *Formule* in funzione di diverse grandezze: $ Delta s(T, v) = c_v ln (T / T_0) + R^* dot ln (v / v_0) \ \ Delta s(T, p) = c_p ln (T / T_0) - R^* dot ln (P / P_0) \ \ Delta s(v, p) = c_p ln (v / v_0) + c_v ln (P / P_0) $
https://github.com/EricWay1024/Homological-Algebra-Notes
https://raw.githubusercontent.com/EricWay1024/Homological-Algebra-Notes/master/README.md
markdown
# Lecture Notes for University of Oxford course C2.2 Homological Algebra (Michaelmas, 2023-24) Go to [Release](https://github.com/EricWay1024/Homological-Algebra-Notes/releases) for the latest compiled PDF, both the colourful (for screen viewing) and not-so-colourful version (for printing). Written with [Typst](https://typst.app/). To compile and watch for changes: ``` typst watch main.typ ``` Also check out [this repo of mine](https://github.com/EricWay1024/tikzcd-editor) for drawing commutative diagrams in Typst. Any issues and pull requests are welcome.
https://github.com/CodingThrust/Templates
https://raw.githubusercontent.com/CodingThrust/Templates/main/typst/README.md
markdown
# Setup Typst The template file is [template.typ](template.typ), and the preview is [template.pdf](template.pdf). To edit, you need to have [vscode](https://code.visualstudio.com/) and the following extensions installed: - [Typst LSP](https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp) - [Tinymist Typst](https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist) ## How to preview in a browser? Press `Command`-`Shift`-`P` (MacOS), and then select: - "Typst Preview: Preview current file in browser" to open the preview in a browser (need to close all existing preview windows). - "Typst Preview: Preview current file in browser and slide mode" to play slides.
https://github.com/fredguth/typst-business-model-canvas
https://raw.githubusercontent.com/fredguth/typst-business-model-canvas/main/README.md
markdown
# tufte-typst A Tufte inspired template for Typst ## Usage there is an example in the `./example` directory. Run from root directory with: ```sh typst watch example/main.typ --root . ``` ## Example ![example/main.pdf](./example/main.pdf)
https://github.com/talal/pesha
https://raw.githubusercontent.com/talal/pesha/main/template/main.typ
typst
MIT No Attribution
#import "@preview/pesha:0.4.0": * #show: pesha.with( name: "<NAME>", address: "5419 Hollywood Blvd Ste c731, Los Angeles, CA 90027", contacts: ( [(323) 555 1435], [#link("mailto:<EMAIL>")], ), footer-text: [<NAME> --- Page#sym.space] ) === Education #experience( place: "UCLA Anderson School of Management", time: [2011--13], )[ - Cumulative GPA: 3.98 - Academic interests: real-estate financing, criminal procedure, corporations - <NAME> Award ] #experience( place: "Hartford University", time: [2003--07], )[ - B.A. summa cum laude, Economics - Extensive coursework in Astrophysics, Statistics - <NAME> Scholarship ] === Business Experience #experience( place: "Boxer Bedley & Ball Capital Advisors", title: "Equity analyst", time: [01/2008--05/2011], location: "New York City, USA" )[ - Performed independent research on numerous American industries, including: - Steelmaking, croquet, semiotics, and butterscotch manufacturing - Led company in equities analyzed in two quarters #lorem(20) #lorem(20) ] === Other Work Experience #experience( place: "Proximate Cause", title: "Assistant to the director", time: [2007--08], )[ - Helped devise fundraising campaigns for this innovative nonprofit - Handled lunch orders and general errands ] #experience( place: "Hot Topic", title: "Retail-sales associate", time: [02/2004--10/2006], )[ - Top in-store sales associate in seven out of eight quarters - Inventory management - Training and recruiting ] #pagebreak() === #lorem(2) #lorem(55)
https://github.com/dead-summer/math-notes
https://raw.githubusercontent.com/dead-summer/math-notes/main/notes/ScientificComputing/ch2-scalar-nonlinear-eqns/scalar-nonlinear-eqns.typ
typst
#import "/book.typ": book-page #import "../../../templates/conf.typ": * #import "@preview/mitex:0.2.4": * #show: book-page.with(title: "Efficiency") #show: codly-init.with() #show: thmrules.with(qed-symbol: $square$) #codly_init() Let $f(x) in C[a, b]$ be a continuous function on some closed interval $[a, b]$ . We look for a solution to the scalar nonlinear equation $ f(x) = 0. $
https://github.com/MattiaOldani/Informatica-Teorica
https://raw.githubusercontent.com/MattiaOldani/Informatica-Teorica/master/capitoli/calcolabilità/02_sistemi_di_calcolo.typ
typst
#import "../alias.typ": * = Sistemi di calcolo Quello che faremo ora è modellare _teoricamente_ un sistema di calcolo. Un *sistema di calcolo* lo possiamo vedere come una _black-box_ che prende in input un programma $P$, dei dati $x$ e calcola il risultato $y$ di $P$ su input $x$. La macchina ci restituisce $y$ se è riuscita a calcolare un risultato, $bot$ se è entrata in un loop. #v(12pt) #figure( image("assets/architettura-von-neumann.svg", width: 20%) ) #v(12pt) Quindi, formalmente, un sistema di calcolo è una funzione del tipo: $ cal(C) : programmi times dati arrow.long dati_bot. $ Come vediamo, è molto simile ad una funzione di valutazione: - i dati $x$ corrispondono all'input $a$; - il programma $P$ corrisponde alla funzione $f$. Per fare ciò ci serve prima definire cos'è un programma. Un *programma* $P$ è una *sequenza di regole* che trasformano un dato di input in uno di output (o in un loop). Formalmente, un programma è una funzione $ P : dati arrow.long dati_bot, $ cioè una funzione che appartiene all'insieme $dati_bot^dati$. Con questa definizione riusciamo a mappare l'insieme $programmi$ sull'insieme delle funzioni, passo che ci serviva per definire la funzione di valutazione. Riprendendo la definizione di sistema di calcolo, possiamo dire che esso è la funzione $ cal(C) : dati_bot^dati times dati arrow.long dati. $ Con $cal(C)(P,x)$ indichiamo la funzione calcolata da $P$ su $x$ dal sistema di calcolo $cal(C)$, che viene detta *semantica*, il suo "significato" su input $x$. Il modello classico che viene considerato quando si parla di calcolatori è quello di *<NAME>*. == Potenza computazionale Prima di definire cosa sia la potenza computazionale, facciamo una breve premessa: indichiamo con $ cal(C)(P,\_): dati arrow.long dati_bot $ la funzione che viene calcolata dal programma $P$, ovvero la semantica di $P$. Detto ciò, definiamo la *potenza computazionale* di un calcolatore come l'insieme di tutte le funzioni che quel sistema di calcolo può calcolare grazie ai programmi, ovvero: $ F(cal(C)) = { cal(C)(P, \_) bar.v P in programmi } subset.eq dati_bot^dati. $ In altre parole, $F(cal(C))$ rappresenta l'insieme di tutte le possibili semantiche di funzioni che sono calcolabili con il sistema $cal(C)$. Stabilire _che cosa può fare l'informatica_ equivale a studiare quest'ultima inclusione. In particolare: - se $F(cal(C)) subset.neq dati_bot^dati$ allora esistono compiti *non automatizzabili*; - se $F(cal(C)) = dati_bot^dati$ allora l'informatica _può fare tutto_. Se ci trovassimo nella prima situazione vorremmo trovare un modo per delineare un confine che divida le funzioni calcolabili da quelle che non lo sono. Risolvere un problema equivale a calcolare una funzione: ad ogni problema è possibile associare una *funzione soluzione*, che mi permette di risolverlo automaticamente. Grazie a questa definizione, *calcolare le funzioni equivale a risolvere problemi*. _In che modo possiamo risolvere l'inclusione?_ Un approccio sfrutta la *cardinalità* dei due insiemi. Con _cardinalità_ si intende una funzione che associa ad ogni insieme il numero di elementi che contiene. Sembra un ottimo approccio, ma presenta alcuni problemi: infatti, funziona solo quando l'insieme è finito, mentre è molto fragile quando si parla di insiemi infiniti. Ad esempio, gli insiemi $NN$ dei numeri naturali e $PP$ dei numeri naturali pari sono tali che $PP subset.neq NN$, ma hanno cardinalità $|NN| = |PP| = infinity$. Ci serve dare una definizione diversa di cardinalità, visto che possono esistere "_infiniti più fitti/densi di altri_", come abbiamo visto nell'esempio precedente.
https://github.com/OrangeX4/typst-test-sync-repo
https://raw.githubusercontent.com/OrangeX4/typst-test-sync-repo/main/packages/local/classic-nju-lamda-slides/0.1.0/template/main.typ
typst
#import "@preview/classic-nju-lamda-slides:0.1.0": * #let s = register() #let s = (s.methods.info)( self: s, title: [Title], author: [Authors], date: [2024/7], ) #let (init, slides, touying-outline, alert) = utils.methods(s) #show: init #set text(font: "Fira Sans", weight: "light") #set strong(delta: 100) #set par(justify: true) #show strong: alert #let (slide, empty-slide, title-slide, focus-slide) = utils.slides(s) #show: slides = Introduction slides.
https://github.com/yhtq/Notes
https://raw.githubusercontent.com/yhtq/Notes/main/数理逻辑/作业/ml-3_1-hw.typ
typst
#import "../../template.typ": proof, note, corollary, lemma, theorem, definition, example, remark #import "../../template.typ": * #import "../main.typ": not1, True, False, infer #import "../main.typ": * #show: note.with( title: "作业3_1", author: "YHTQ", date: datetime.today().display(), logo: none, withOutlined : false, withTitle : false, withHeadingNumbering: false ) #set heading(numbering: (..nums) => { let nums1 = nums.pos() nums1.insert(0, 5) numbering("1.1.(a)", ..nums1) } ) = #empty == #empty #let isFunc = $"is_func"$ #let derivable = $"derivable"$ #let continuous = $"continuous"$ $not1 forall x (isFunc(x) -> derivable(x))$ == #empty $exists x (isFunc(x) and continuous(x) and not1 derivable(x))$ = #empty 关关雎鸠,在河之洲。窈窕淑女,君子好逑。 #let jj(x) = $"是雎鸠"(x)$ #let gg(x) = $"正在关关和鸣"(x)$ #let hz(x) = $"在河之洲"(x)$ #let yt(x) = $"是窈窕淑女"(x)$ #let jz(x) = $"是君子"(x)$ #let hq(x, y) = $"好逑"(x, y)$ $ exists x(jj(x) and gg(x) and hz(x))\ and forall x(yt(x) -> (forall y(jz(y) -> hq(x, y))))\ $ = #empty #let isCar = $"is_car"$ #let hasFourWheels = $"has_four_wheels"$ #let isHuman = $"is_human"$ #let isLazy = $"is_lazy"$ #let isSilly = $"is_silly"$ == #empty $ not1 forall x(isCar(x) -> hasFourWheels(x))\ $ $ exists x(isCar(x) and not1 hasFourWheels(x))\ $ == #empty $ not1 forall x(isHuman(x) -> not1 (isLazy(x) or isSilly(x)))\ $ $ exists x(isHuman(x) and (isLazy(x) or isSilly(x)))\ $ = #empty == #empty 这是项,不是公式 == #empty $A_1^3$ 是三元谓词符,此表达式中只有两个项作用在它上面,因此不是公式 = #empty #let t1 = $f_1^2 (x_1, x_3)$ == #empty $x_1$ 自由出现一次,#t1 对 $x_2$ 自由,该公式中没有与 $x_1, x_3$ 相关的任意量词 == #empty $x_1$ 约束出现两次,#t1 对 $x_2$ 不自由,因为 $x_2$ 出现在了 $forall x_1$ 的辖域之中。 = #empty (条件保证了 $calA(x_i) -> calA(x_j)$ 的替换不会产生歧义,证明过程中并不会直接用到条件) 如若不然,假设 $calA(x_j)$ 中含有 $forall x_i (calB'(x_j))$ 其中 $x_j$ 在 $calB'(x_j)$ 中自由出现,按照替换的规则将有: - 若其中含有由 $x_i$ 替换得到的 $x_j$,导致 $calA(x_i)$ 中含有 $forall x_i (calB'(x_i))$,但显然这样的 $x_i$ 不是自由出现的,因此不可能进行替换 - 否则,其中 $x_j$ 都直接来自于 $calA(x_i)$,然而 $calA(x_i)$ 中 $x_j$ 都约束出现,换言之一定处在 $calA(x_i)$ 子公式: - $forall x_j (calC (forall x_i (calB(x_j))))$ 之中,而替换不改变 $x_j$,因此在 $calA(x_j)$ 中上两式形如: - $forall x_j (calC' (forall x_i (calB'(x_j))))$ 导致 $calB'(x_j)$ 中的 $x_j$ 一定都约束出现,与假设矛盾
https://github.com/ma4096/mvar
https://raw.githubusercontent.com/ma4096/mvar/main/README.md
markdown
MIT License
# mvar Simple interface for numerical outputs (Python, Matlab) and documents (LaTeX, Typst). This project is still in its very early stages and you may find comments like "not yet implemented" in the code as well as rudimentary test files in the directories. If you just want to interface between LaTeX and Matlab, feel free to use the (more stable) implementation in [matlab-latex-variables](https://github.com/ma4096/matlab-latex-variables). ## Disclaimer I am not a professional software developer and do this project for fun. This project tree is quite unorganized with each folder containing the implementation in the given language as well as examples and general testing I use in development. The root contains the precompiler. ## Motivation When writing documentation of technical projects in latex, I often had to update values I got from calculations in Matlab (due to miscalculations or changed specifications). As this is boring and annoying work, I implemented these scripts/functions to be able to reference matlab variables directly in my documents so they update automatically. It grew to also accept input from Python and output to typst, an upcoming LaTeX alternative. The name mvar originally comes from matlab variable. ## Usage There are currently three parts: Some software/script (Python or Matlab) inputs variables into a transfer file (csv) which then get loaded/parsed into an output document-script (LaTeX or typst). In the document the variables can be referenced (details below) with or without the unit. Currently there is a precompilation needed to prevent namespace collisions and generate a list of abbrevations. ### Matlab Put the function transfer.m into a folder in the Matlab PATH so Matlab can find it. - For me (on Fedora 40 Linux) it is `/home/[user]/Documents/MATLAB` In your Matlab script use ```transfer([file path], var1, ..., varN)``` where the variables can be numerical or symbolical. Symbolical (and matrices) get parsed to LaTeX format. Even plain text is possible, as long as it is not including a comma or linebreak, which would break the csv-parsing. Boolean variables are converted into `1` (true) or `0` (false). I have not yet implemented a way to also store a unit or description (see transfer file), these are currently just added as "-,-". I strongly advise not to use this project to transfer symbolic equations from Matlab, as the used built-in parser to Matlab is not perfect. ### Python Include the python script `/python/mvar_transfer.py` in your python script (`from mvar_transfer import *`). ```python v = mvariable("example.txt") # the path were you eventually want to store the transfer file a = 10.2434 # example values s = "abd" v.add("a",a,"-","Abcd",sig=6) # add to transfer file with [name],[value],[unit],[description]. Also sets the number of significant digits to 6 (default is 4) v.fastadd("s",s) # doesnt set [unit] and [description], they get the default value - print(v.vars) # vars is a list with python dicts for each added variable v.save() # writes the transfer file. Always completely rewrites the file! ``` ### Transfer file The file used by both parts. It is just a simple csv-file with `[name],[value],[unit],[description]` in each line. A `,` in any of these fields will lead to failure when parsing! The default value for each field is `-`. ### LaTeX Put the file `MLtransfer.tex` into your latex-projects folder (or use another path in the following command). In a latex-file use ``` \input{MLtransfer.tex} \input{loader_collection.tex} % generated during precompilation in the same directory as your main document ``` to access it. Variables can be imported from the file they have been saved to from Matlab using ```\loadvariables{[namespace]}{[file path]}``` - `[namespace]` is a prefix added to each variable. Can be used to have multiple variables from different files/scripts with the same name. - `[file path]` includes the file extension (.txt) and can be relative path including changes in directory. e.g.: - `example.txt` if its in the same folder - `/subfolder/example.txt` if its in a sub folder - `../../otherfolder/example.txt` goes two folders back from original directory and into than into the new subfolder - Unlimited files can be loaded, as long as they are using different namespaces. Finally imported variables can be used as ```\mvar{[namespace]}{[var name]}``` - Don't forget to put (especially symbolical values) in a math environment like `$...$` - e.g.: - given the transfer file test.txt with the content `bar,123,m,Length of the bar` - `\loadvariables{foo}{test.txt}` - In the text: `\mvar{foo}{bar}` gives `123` If you directly want to use the saved unit, use `\mvarsi{[namespace]}{[var name]}`. This puts the value and the unit of the variable into a SI-environment. Due to the `\SI`-macro in LaTeX, this only works on numerical values. Saved boolean variables can be used with ```\mvaristrue{[namepsace]}{[var name]}{[text if true]}{[text if false]}``` where the used variable (from the given namespace) is checked to be 1. If it is 1, the expression evaluates as true and the correpsonding text is displayed (the text can include any latex code), if it is not 1, the other text repsectively is shown/returned. This can be useful for implementing an automatic documentation for used calculation "algorithms" (for me e.g. calculating screws after VDI 2230). To include the list of abbreviations which was build during precompilation simply include the generated `abbrev.tex` in your document. You also must include the package `longtable` in your document header as `abbrev.tex` requires it. ### typst The implementation of typst is still experimental and some features are not supported (like list of abbreviations), but the simple part works just fine :) To use it, import `mvar.typ` into your project: ```typst #import "mvar.typ": * // a is the namespace #let a = loadvariables("test.txt") //a is like a python dict Access variable named b via $ #a.b $ Access variable with unit (add si): //this can lead to nameconflicts if text.txt contains b and bsi $ #a.bsi $ #mlogic(a.l,[true],[false]) // if a.l == 1 (true as specified for transfer file), do accordingly. [true] could also be more complex typst code without the [] ([false] as well) ``` ### Precompilation (not finished!) Precompilation is currently working and required for LaTeX but has not yet been implemented for typst. Here the list of abbreviations is build from all the imported transfer files in a given document (LaTeX/typst), where the type of document is determined by the file extension. Also all the imported transfer files are collected into a single file called `loader_collection.tex`, from where they are imported into the document at its compilation instead from all over the place inside the document to allow for cross references. This feature is still under construction and not fully working! To perform the precompilation execute `mvar.py` in your projects main directory: ``` python mvar.py main.tex ``` You can also skip generating the list of abbreviations by adding the flag `-na` (no abbreviation) The configuration for list of abbreviations is specified in `config.ini` where you can edit the appearance/order of coloumns and rows (documented in place). It is only yet implemented for LaTeX and only includes numerical (scalar) variables or abbreviations which don't have a value (default value `-`). A precompilation is only needed when you include a new transfer file in your document tree, not if the data in the transfer files changes. If you are using the list of abbreviations you always need to precompile to update the list. ## Credits The basic csv-parser is copied from Stackexchange user's P<NAME>ik answer (edited by Mensch) with a lot of own additions. https://tex.stackexchange.com/questions/474397/populate-information-from-a-csv-file-into-a-latex-document-specifically-into-th/474404#474404 , last accessed May 20, 2024 The parser for Matlab matrices to latex notation is from Matlab user Lu Ce with minimal changes. <NAME> (2024). Matlab matrix to LaTeX conversion example (https://www.mathworks.com/matlabcentral/fileexchange/80629-matlab-matrix-to-latex-conversion-example), MATLAB Central File Exchange. Retrieved May 20, 2024. ## Planned features/ideas - Change from csv using comma as the separator to tab, allowing for more flexibility as what can be "transferred" (e.g. normal text). Currently LaTeX is not accepting it. - Access elements of matrices/arrays directly. Currently they have to be manually saved as scalar values, as matrices are always shown in pmatrix-environments. - Allow for all Matlab environment variables to be exported at once. It can get annoying with lots of variables, still less annoying than doing it by hand ;) - Build a list of abbreviations for typst - Build a variable explorer as an entirely own program (likely Python/tkinter based) - Allow for unit and description to be specified in Matlab - Change the way variables are exported in Matlab - Some kind of handler for importing and exporting numerical values with statistical errors (e.g. m = 1.23+-0.05 kg) If you have ideas for more features, feel free to contact me.
https://github.com/a-kkiri/CUMCM-typst-template
https://raw.githubusercontent.com/a-kkiri/CUMCM-typst-template/main/README.md
markdown
Apache License 2.0
<h1 align="center"> <a href="https://github.com/typst/typst"> <img alt="Typst" src="https://user-images.githubusercontent.com/17899797/226108480-722b770e-6313-40d7-84f2-26bebb55a281.png"> </a> <br />全国大学生数学建模竞赛 Typst 模板 </h1> ## 模板介绍 用于编写高教社杯全国大学生数学建模论文的 Typst 模板 > [!IMPORTANT] > > 本模板的承诺书页及编号专用页仅供参考,实际论文提交推荐使用官方模板提供的承诺书页及编号专用页。 ## 使用方法 你可以在 Typst 网页应用中使用此模板,只需在仪表板上点击 “Start from template”,然后搜索 cumcm-muban。 另外,你也可以在本地使用 CLI 命令来启动这个项目。 ``` typst init @preview/cumcm-muban ``` Typst 将会创建一个新的目录,其中包含了所有你开始**除字体外**所需要的文件。 如果在本地使用模板编写文档,可以在终端中使用 `typst watch --font-path ./fonts main.typ --root .` 进行即时预览;文档编写完成后,使用 `typst compile --font-path ./fonts main.typ` 生成 PDF 文件。 ## 模板预览 | [正文1](https://github.com/a-kkiri/CUMCM-typst-template/blob/main/template/figures/p4.jpg) | [正文2](https://github.com/a-kkiri/CUMCM-typst-template/blob/main/template/figures/p6.jpg)| [附录](https://github.com/a-kkiri/CUMCM-typst-template/blob/main/template/figures/p10.jpg)| |:---:|:---:|:---:| | ![正文1](https://github.com/a-kkiri/CUMCM-typst-template/blob/main/template/figures/p4.jpg?raw=true) | ![正文2](https://github.com/a-kkiri/CUMCM-typst-template/blob/main/template/figures/p6.jpg?raw=true)| ![附录](https://github.com/a-kkiri/CUMCM-typst-template/blob/main/template/figures/p10.jpg?raw=true)| > [!IMPORTANT] > > 对于 WebAPP/Linux/MacOS 使用者此模板不包含所需字体文件,请到 [CUMCM-typst-template/fonts.zip](https://github.com/a-kkiri/CUMCM-typst-template/blob/main/fonts.zip?raw=true) 下载并自行上传到网页应用程序。 > > 文档使用的中文字体仅包含约 7000 个通用汉字和符号,若某些字无法显示,请更换其他字体。 ## 更改记录 2024-08-20 - 更改附录页代码框样式 - 修复标题无法修改的问题 - 增加函数 `appendix` 用于显示附录内容 - 将粗体的 `stroke` 参数设置为 0.02857em
https://github.com/kdog3682/mathematical
https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/long-multiplication.typ
typst
#import "@local/typkit:0.1.0": * #let long-multiplication-v0(a, b) = { let top = split(a).map(int) let bottom = split(b).map(int) let top-rev = top.rev() let bottom-rev = bottom.rev() let store = bottom-rev.enumerate().map(((i, b)) => { let answer-row = () let carry-row = () for (j, t) in top-rev.enumerate() { let a = t * b let l = len(a) if l > 1 { let (c, d) = split(a).map(int) carry-row.push(c) answer-row.push(d) } else { carry-row.push("") answer-row.push(a) } } return ( answer-row: answer-row, carry-row: carry-row, ) }) // (6,1), (5,1) // panic(store) let x-length = len(top) let y-length = len(bottom) let c = 0 for row in store { for el in row { c += 1 if steps == c { break } } if steps == c { break } } } #let long-multiplication(a, b, steps: 100) = { let top = split(a).map(int) let bottom = split(b).map(int) let get(n) = { return if n < 10 { (none, n) } else { split(n).map(int) } } let get-operations(top, bottom) = { let top-rev = top.rev() let bottom-rev = bottom.rev() let operations = () let c = 0 for (row-index, b) in bottom-rev.enumerate() { for t in top-rev { if steps == c { return operations } c += 1 let a = t * b let (carry, value) = get(a) operations.push(( carry: carry, value: value, row-index: row-index, )) } } return operations } let operations = get-operations(top, bottom) let x-length = len(top) let y-length = len(bottom) let answer-row = () let carry-row = () for op in operations.slice(0, x-length) { carry-row.push(op.carry) answer-row.push(op.value) } let r1 = top let r2 = bottom panic(carry-row, answer-row) let c = 0 for row in store { for el in row { c += 1 if steps == c { break } } if steps == c { break } } } #long-multiplication(56, 12)
https://github.com/0xPARC/0xparc-intro-book
https://raw.githubusercontent.com/0xPARC/0xparc-intro-book/main/src/pair.typ
typst
#import "preamble.typ":* = Bilinear pairings on elliptic curves <pair> Before we are ready for KZG, there is one more piece of elliptic curve math that we need. Recall that the map $[bullet] : FF_q -> E$ is linear, meaning that $[a + b] = [a] + [b]$, and $[n a] = n[a]$. But as written we can't do "armored multiplication": #claim[ As far as we know, given $[a]$ and $[b]$, one cannot compute $[a b]$. ] On the other hand, it *does* turn out that we know a way to *verify* a claimed answer on certain curves. That is: #proposition[ On the curve BN254, given three points $[a]$, $[b]$, and $[c]$ on the curve, one can verify whether $a b = c$. ] The technique needed is that one wants to construct a nondegenerate bilinear function $ pair : E times E -> ZZ slash N ZZ $ for some large integer $N$. We think this should be called a _bilinear pairing_, but for some reason everyone just says _pairing_ instead. A curve is called _pairing-friendly_ if this pairing can be computed reasonably quickly (e.g. BN254 is pairing-friendly, but Curve25519 is not). This construction actually uses some really deep number theory (heavier than all the math in @ec) that is well beyond the scope of this modest book. Fortunately, we won't need the details of how it works; but we'll comment briefly in @pairing-friendly on what curves it can be done on. And this pairing algorithm needs to be worked out just once for the curve $E$; and then anyone in the world can use the published curve for their protocol. Going a little more generally, the four-number equation $ pair([m], [n]) = pair([m'], [n']) $ will be true whenever $m n = m' n'$, because both sides will equal $m n pair([1], [1])$. So this gives us a way to *verify* two-by-two multiplication. #remark[ The last sentence is worth bearing in mind: in all the protocols we'll see, the pairing is only used by the verifier Victor, never by the prover Peggy. ] #remark[We don't know how to do multilinear pairings][ On the other hand, we currently don't seem to know a good way to do _multilinear_ pairings. For example, we don't know a good trilinear map $E times E times E -> ZZ slash N ZZ$ that would allow us to compare $[a b c]$, $[a]$, $[b]$, $[c]$ (without knowing one of $[a b]$, $[b c]$, $[c a]$). ] == Verifying more complicated claims <pair-verify> #example[ Suppose Peggy wants to convince Victor that $y = x^3 + 2$, where Peggy has sent Victor elliptic curve points $[x]$ and $[y]$. To do this, Peggy additionally sends to Victor $[x^2]$ and $[x^3]$. Given $[x]$, $[x^2]$, $[x^3]$, and $[y]$, Victor verifies that: - $pair([x^2], [1]) = pair([x], [x]) $ - $pair([x^3], [1]) = pair([x^2], [x]) $ - $[y] = [x^3] + 2 [1]$. The process of verifying this sort of identity is quite general: The prover sends intermediate values as needed so that the verifier can verify the claim using only pairings and linearity. ] <pair-verify-example> == So which curves are pairing-friendly? <pairing-friendly> If we chose $E$ to be BN254, the following property holds: #proposition[ For $(p,q)$ as in BN254, the smallest integer $k$ such that $q$ divides $p^k-1$ is $k=12$. ] This integer $k$ is called the _embedding degree_. This section is an aside explaining how the embedding degree affects pairing. The pairing function $pair(a, b)$ takes as input two points $a, b in E$ on the elliptic curve, and spits out a value $pair(a, b) in FF_(p^k)^times$ -- in other words, a nonzero element of the finite field of order $p^k$ (where $k$ is the embedding degree we just defined). In fact, this element will always be a $q$-th root of unity in $FF_(p^k)$, and it will satisfy $pair([m], [n]) = zeta^(m n)$, where $zeta$ is some fixed $q$-th root of unity. The construction of the pairing is based on the #cite("https://en.wikipedia.org/wiki/Weil_pairing", "Weil pairing") in algebraic geometry. How to compute these pairings is well beyond the scope of these notes; the raw definition is quite abstract, and a lot of work has gone into computing the pairings efficiently. (For more details, see these #cite("https://crypto.stanford.edu/pbc/notes/ep/pairing.html", "notes").) The difficulty of computing these pairings is determined by the size of $k$: the values $pair(a, b)$ will be elements of a field of size $p^k$, so they will require $256k$ bits even to store. For a curve to be "pairing-friendly" -- in order to be able to do pairing-based cryptography on it -- we need the value of $k$ to be pretty small.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/icu-datetime/0.1.1/README.md
markdown
Apache License 2.0
# icu-datetime <!-- markdownlint-disable-file MD033 --> <!-- markdownlint-configure-file { "no-duplicate-heading": { "siblings_only": true } } --> This library is a wrapper around [ICU4X](https://github.com/unicode-org/icu4x)' `datetime` formatting for Typst which provides internationalized formatting for dates, times, and timezones. As the WASM bundle includes all localization data, it's quite large (about 8 MiB). ## Example ```typ #import "@preview/icu-datetime:0.1.1": fmt-date, fmt-time, fmt-datetime, experimental // These functions may change at any time #import experimental: fmt-timezone, fmt-zoned-datetime #let day = datetime( year: 2024, month: 5, day: 31, ) #let time = datetime( hour: 18, minute: 2, second: 23, ) #let dt = datetime( year: 2024, month: 5, day: 31, hour: 18, minute: 2, second: 23, ) #let tz = ( offset: "-07", iana: "America/Los_Angeles", zone-variant: "st", // standard ) = Dates #fmt-date(day, locale: "km", length: "full") \ #fmt-date(day, locale: "af", length: "full") \ #fmt-date(day, locale: "za", length: "full") \ = Time #fmt-time(time, locale: "id", length: "medium") \ #fmt-time(time, locale: "en", length: "medium") \ #fmt-time(time, locale: "ga", length: "medium") \ = Date and Time #fmt-datetime(dt, locale: "ru", date-length: "full") \ #fmt-datetime(dt, locale: "en-US", date-length: "full") \ #fmt-datetime(dt, locale: "zh-Hans-CN", date-length: "full") \ #fmt-datetime(dt, locale: "ar", date-length: "full") \ #fmt-datetime(dt, locale: "fi", date-length: "full") = Timezones (experimental) #fmt-timezone( ..tz, local-date: dt, includes: "specific-non-location-long" ) \ #fmt-timezone( ..tz, local-date: dt, includes: ( iso8601: ( format: "utc-extended", minutes: "required", seconds: "optional", ) ) ) = Zoned Datetimes (experimental) #fmt-zoned-datetime(dt, tz) \ #fmt-zoned-datetime(dt, tz, locale: "lv") \ #fmt-zoned-datetime(dt, tz, locale: "en-CA-u-hc-h24-ca-buddhist") ``` <!-- typst c res/example.typ res/example.png --root . --> ![Example](res/example.png) Locales must be [Unicode Locale Identifier]s. Use [`locale-info(locale)`](#locale-info) to get information on how a locale is parsed. Unicode extensions are supported, so you can, for example, set the hour cycle with `hc-h12` or set the calendar with `ca-buddhist` (e.g. `en-CA-u-hc-h24-ca-buddhist`). ## API ### `fmt-date` ```typ #let fmt-date( dt, locale: "en", length: "full" ) ``` Formats a date in some `locale`. Dates are assumed to be ISO dates. - `dt`: The date to format. This can be a [`datetime`] or a dictionary with `year`, `month`, `day`. - `locale`: A [Unicode Locale Identifier]. - `length`: The length of the formatted date ("full", "long" (default), "medium", "short", or `none`). ### `fmt-time` ```typ #let fmt-time( dt, locale: "en", length: "short" ) ``` Formats a time in some `locale`. - `dt`: The time to format. This can be a [`datetime`] or a dictionary with `hour`, `minute`, `second`, and (optionally) `nanosecond`. - `locale`: A [Unicode Locale Identifier]. - `length`: The length of the formatted time ("medium", "short" (default), or `none`). ### `fmt-datetime` ```typ #let fmt-datetime( dt, locale: "en", date-length: "long", time-length: "short" ) ``` Formats a date and time in some `locale`. Dates are assumed to be ISO dates. - `dt`: The date and time to format. This can be a [`datetime`] or a dictionary with `year`, `month`, `day`, `hour`, `minute`, `second`, and (optionally) `nanosecond`. - `locale`: A [Unicode Locale Identifier]. - `date-length`: The length of the formatted date part ("full", "long" (default), "medium", "short", or `none`). - `time-length`: The length of the formatted time part ("medium", "short" (default), or `none`). ### `fmt-timezone` ⚠ Warning: This function is experimental and can change at any time. ```typ #let fmt-timezone( offset: none, // required iana: none, bcp47: none, local-date: none, metazone-id: none, zone-variant: none, locale: "en", fallback: "localized-gmt", includes: () ) ``` Formats a timezone in some `locale`. - `offset`: A string specifying the GMT offset (e.g. "-07", "Z", "+05", "+0500", "+05:00"). (required) - `iana`: Name of the IANA TZ identifier (e.g. "Brazil/West" - see [IANA](https://www.iana.org/time-zones) and [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)). This is mutually exclusive with `bcp47`. This identifier will be converted to a BCP-47 ID. - `bcp47`: Name of the BCP-47 timezone ID (e.g. "iodga" - see [timezone.xml](https://github.com/unicode-org/cldr/blob/main/common/bcp47/timezone.xml)). This is mutually exclusive with `iana`. - `local-date`: A local date to calculate the metazone-id. This is mutually exclusive with `metazone-id`. When formatting zoned-datetimes this isn't necessary. - `metazone-id`: A short ID of the metazone. A metazone is a collection of multiple time zones that share the same localized formatting at a particular date and time (e.g. "phil" - see [metaZones.xml](https://github.com/unicode-org/cldr/blob/main/common/supplemental/metaZones.xml) (bottom)). - `zone-variant`: Many metazones use different names and offsets in the summer than in the winter. In ICU4X, this is called the _zone variant_. Supports `none`, `"st"` (standard), and `"dt"` (daylight). - `locale`: A [Unicode Locale Identifier] - `fallback`: The timezone format fallback. Either `"LocalizedGmt"` or a dictionary for an ISO 8601 fallback (e.g. `(iso8601: (format: "basic", minutes: "required", seconds: "never"))`). - `includes`: An array or a single item (str/dictionary) of part(s) to include - corresponds to calls on [`TimeZoneFormatter`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.TimeZoneFormatter.html). Valid options are: - `generic-location-format` (e.g. "Los Angeles Time") - `generic-non-location-long` (e.g. "Pacific Time") - `generic-non-location-short` (e.g. "PT") - `localized-gmt-format` (e.g. "GMT-07:00") - `specific-non-location-long` (e.g. "Pacific Standard Time") - `specific-non-location-short` (e.g. "PDT") - `iso8601`: A dictionary of ISO 8601 options `(iso8601: (format: "utc-basic", minutes: "optional", seconds: "optional"))` (e.g. "-07:00") ### `fmt-zoned-datetime` ⚠ Warning: This function is experimental and can change at any time. ```typ #let fmt-zoned-datetime( dt, zone, locale: "en", fallback: "localized-gmt", date-length: "long", time-length: "long" ) ``` Formats a date and a time in a timezone. Dates are assumed to be ISO dates. - `dt`: The date and time to format. This can be a [`datetime`] or a dictionary with `year`, `month`, `day`, `hour`, `minute`, `second`, and (optionally) `nanosecond`. - `zone`: The timezone. A dictionary with `offset`, `iana`, `bcp47`, `metazone-id`, and `zone-variant`. The options correspond to the arguments for `fmt-timezone`. Only `offset` is mandatory - the other fields provide supplemental information for named timezones. - `locale`: A [Unicode Locale Identifier] - `fallback`: The timezone format fallback. Either `"localized-gmt"` or a dictionary for an ISO 8601 fallback (e.g. `(iso8601: (format: "basic", minutes: "required", seconds: "never"))`). - `date-length`: The length of the formatted date part ("full", "long" (default), "medium", "short", or `none`). - `time-length`: The length of the formatted time part ("full", "long" (default), "medium", "short", or `none`). ### `locale-info` ```typ #let locale-info(locale) ``` Gets information about ICU4X' understanding of the `locale` - `locale`: A [Unicode Locale Identifier] #### Example ```typ // the default undefined language #assert.eq( locale-info("und"), ( id: ( language: "und", script: none, region: none, variants: (), ), extensions: ( unicode: (keywords: "", attributes: ()), transform: (lang: none, fields: ""), private: (), other: (), ) ) ) // full unicode language identifier #assert.eq( locale-info("en-arab-DE-posix-macos-u-foo-bar-hc-h12-ca-buddhist-t-en-latn-US-windows-rusty-h0-hybrid-a-other-ext-x-typst-wasm"), ( id: ( language: "en", script: "Arab", region: "DE", variants: ("macos", "posix"), ), extensions: ( unicode: ( keywords: "ca-buddhist-hc-h12", attributes: ("bar", "foo"), ), transform: ( lang: ( language: "en", script: "Latn", region: "US", variants: ("rusty", "windows"), ), fields: "h0-hybrid", ), private: ("typst", "wasm"), other: ("a-other-ext",), ), ) ) ``` ## Using Locally Download the [latest release](https://github.com/Nerixyz/icu-typ/releases), unzip it to your [local Typst packages](https://github.com/typst/packages#local-packages), and use `#import "@local/icu-datetime:0.1.1"`. ## Building To build the library, you need to have [Rust](https://www.rust-lang.org/), [Deno](https://deno.com/), and [`wasm-opt`](https://github.com/WebAssembly/binaryen) installed. ```sh deno task build ``` While developing, you can symlink the WASM file into the root of the repository (it's in the `.gitignore`): ```sh # Windows (PowerShell) New-Item icu-datetime.wasm -ItemType SymbolicLink -Value ./target/wasm32-unknown-unknown/debug/icu_typ.wasm # Unix ln -s ./target/wasm32-unknown-unknown/debug/icu_typ.wasm icu-datetime.wasm ``` Use `cargo b --target wasm32-unknown-unknown` to build in debug mode. [`datetime`]: https://typst.app/docs/reference/foundations/datetime/ [Unicode Locale Identifier]: https://unicode.org/reports/tr35/tr35.html#Unicode_locale_identifier
https://github.com/skomaroh1845/TheoreticalInformaticsMIPT
https://raw.githubusercontent.com/skomaroh1845/TheoreticalInformaticsMIPT/main/HW2.typ
typst
= <NAME> ДЗ 2 #set par( justify: true, ) = Задача 1 Постройте (многоленточную) машину Тьюринга, возвращающую 1, если входное слово $x_1$ $x_2$ . . . $x_n$ ∈ ${0, 1}^*$ является палиндромом (т. е. $x_1$ $x_2$ . . . $x_n$ = $x_n$ $x_(n−1)$ . . . $x_1$), и 0 в противном случае. Машина должна работать за время $O(n)$. == Решение: Машина переписывает входное слово на рабочую ленту, потом один курсор остатеся в конце переписанного слова на рабочей ленте, а на входной возвращается в начало, затем оба курсора начинают синхронное движение - на входной ленте сначала, на рабочей с конца слова, - сравнивая символы по одному, таким образом движентся через все слово, если путь пройден, то слово полиндром, если на каком-то шаге символы не совпадают, то выводи 0. Сложность - 3 полных прохода по слову в худшем случае (туда обратно при копировании и один проход при сравнении) - $O(n)$. Пусть у нашей машины 3 ленты: входная, рабочая и выходная, куда просто запишем результат. $sum = {0, 1}$ $Gamma = {▷, ◁, \#, 1, 0}$ $Q = {q_0, q_"copy", q_"go_back", q_"compare", q_"f"}$ $delta:$ - $q_0 vec(▷, \#, \#) -> q_"copy" vec(, \#, \#) vec(+1, 0, 0)$ - $q_"copy" vec(x_i, \#, \#) -> q_"copy" vec(, x_i, \#) vec(+1, +1, 0)$ -- копируем слово на рабочую ленту; $x_i$ - i входной символ - $q_"copy" vec(◁, \#, \#) -> q_"go_back" vec(, \#, \#) vec(-1, 0, 0)$ -- когда дошли до конца, возвращается - $q_"go_back" vec(x_i, \#, \#) -> q_"go_back" vec(, \#, \#) vec(-1, 0, 0)$ - $q_"go_back" vec(▷, \#, \#) -> q_"compare" vec(, \#, \#) vec(+1, -1, 0)$ -- когда вернулись в начало, начинаем сравнение - $q_"compare" vec(0, 0, \#) -> q_"compare" vec(, 0, \#) vec(+1, -1, 0)$ - $q_"compare" vec(1, 1, \#) -> q_"compare" vec(, 1, \#) vec(+1, -1, 0)$ - $q_"compare" vec(0, 1, \#) -> q_"f" vec(, 1, 0) vec(0, 0, 0)$ -- если символы разные, то записываем 0 в выходную ленту и завершаемся - $q_"compare" vec(1, 0, \#) -> q_"f" vec(, 0, 0) vec(0, 0, 0)$ - $q_"compare" vec(◁, \#, \#) -> q_"f" vec(, 0, 1) vec(0, 0, 0)$ -- если дошли до конца, то записываем 1 в выходную ленту и завершаемся. = Задача 2 Докажите, что множество вычислимых на одноленточных машинах Тьюринга функций не изменится, если разрешить машине любые целочисленные сдвиги (т. е. инструкции вида $q a arrow.r.bar q'a'n$, где $n$ — произвольное целое число; при этом «программа» $δ$ остается конечной). Достаточно описать, как эмулируется шаг «расширенной» машины на обыкновенной. == Описание эмуляции: Длина эмулируемого шага - своего рода параметр машины, он заранее задан для конкретной машины и конечен. Тогда мы можем перебрать n шагов через n внутренних состояний машины в качестве счетчика и шагнуть нужное количество раз. Например, пусть n = 5 и мы делаем шаг $q a_i arrow.r.bar q'a'_i n$, его эмуляция будет выглядеть следующим образом: - $q a_i -> q_1 a'_i $ +1 - $q_1 a_(i+1) -> q_2 a_(i+1)$ +1 -- здесь $a_(i+1)$ - любой следующий символ на ленте, в том числе и \# - $q_2 a_(i+2) -> q_3 a_(i+2)$ +1 - $q_3 a_(i+3) -> q_4 a_(i+3)$ +1 - $q_4 a_(i+4) -> q_5 a_(i+4)$ +1 - $q_5 a_(i+5) -> q' a_(i+5)$ 0 -- останавливаемся на n символе и переходим в требуемое состояние.
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/024%20-%20Shadows%20over%20Innistrad/009_Games.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Games", set_name: "Shadows Over Innistrad", story_date: datetime(day: 27, month: 04, year: 2016), author: "<NAME>", doc ) #emph[During the time of Avacyn's disappearance, two crazed and sinister siblings unleashed their greatest achievement. The necromancer Gisa raised a horde of undead ghouls, and her brother Geralf, an expert skaberen, created a similar army of skaabs—shambling corpses stitched together from disparate body parts. Each hoping to outdo the other in their mad sibling rivalry, Gisa and Geralf besieged the city of Thraben with their zombie armies, sending wave after wave of unhallowed creatures at the holy city. Scores of civilians and cathars fell in Thraben's defense, and the head of the church of Avacyn—Lunarch Mikaeus—was killed in the assault before Thalia, Guardian of Thraben, drove the monsters back. Odric, a champion of the church, captured Gisa and held her imprisoned in Rider's Lock. But the rivalry between Gisa and Geralf will not easily be put to rest.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Ludevic of Ulm, I hope this letter reaches you safely—skaabs make better bodyguards than couriers, after all. I believe the last time we saw each other was years ago at one of my parents' parties. I have so many boring memories of being forced to joylessly play the harpsichord for the adults while my awful sister sang to impress the guests. How many dinners did I spend wishing I were seated with the greatest mages of our time rather than atop a creaky child-size music bench! You always held such high renown in my mother's social circle, and your talents and notoriety made you the teacher I always craved as a child. That was many years ago, and I have grown into a well-admired and popular stitcher in the years since! I am now quite famous, and you have no doubt heard of my brave and mostly successful invasion of Thraben. I was able to evade capture thanks to my quick thinking and small stature, and have returned to my laboratory in what is left of Trostad. Upon my return, I have begun a new endeavor to expand my knowledge and skill. As a practitioner of the art of alchemy, I was hoping you would be able to provide some much-needed insight as I delve deeper into the art of necromantic fabrication than anyone has before. Would it trouble you to pass along any alchemical texts you believe would help further my studies? I am in need of a mentor, and I cannot think of anyone who would be better suited to assist me for the sake of invention and innovation. What is your preferred method of avoiding decay or further necrosis once a body has been revived? Would the addition of a second liver assist with toxin control in the metabolic system? What is your preferred method of animation via elemental transmutation? How familiar are you with Delia Davison's methods for brain extractions on living patients? I'm giddy with anticipation of your response! Sincerely, <NAME> #figure(image("009_Games/01.jpg", width: 100%), caption: [Stitcher Geralf | Art by Karla Ortiz], supplement: none, numbering: none) Commander Odric, I write to you in great distress. The transport caravan departing Rider's Lock was attacked this morning by a wave of rogue skaabs. The guards under my command were transporting the prisoner <NAME> to Thraben for punishment. The road between the prison and the city is usually well-trod and safe for passage, but as per your orders I tripled the guard that would travel along with the caravan. The weather was misty and gray—nothing out of the ordinary for this part of Gavony. As the light was beginning to come over the horizon, we were overcome by a sudden attack of ghastly, violent, misshapen skaabs. We defended the caravan valiantly, but the malice and will of these creatures was too great to overcome. One-quarter of the procession is dead despite our additional reinforcements, and the prisoner seems to have escaped in the chaos. These skaabs seemed different from ones I have seen in the past. Quick, many-limbed, as if their maker is testing a new formula for their sick development. My forces stood little chance. I write to you from a safe haven in Merwald Downs. I received little injury in the attack, but I believe the prisoner may be heading toward the coast. She is a half-day's travel ahead of me, but I am in pursuit. I will write when I know more. —Executive Officer Grete #figure(image("009_Games/02.jpg", width: 100%), caption: [Zombie Apocalypse | Art by Peter Mohrbacher], supplement: none, numbering: none) Geralf, GUESS WHO JUST BROKE OUT OF PRISON! Your ever-loving sister, Gisa #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Gisa, You don't just say "guess who" and then answer it in the signature, moron. Why are you writing me from the old family house? I thought it was destroyed—surely there isn't anything left after the accident. I had thought once free you would go back to your own territory. —Geralf #figure(image("009_Games/03.jpg", width: 100%), caption: [Ghoulcaller Gisa | Art by Karla Ortiz], supplement: none, numbering: none) Geralf, I may have my freedom now, but there are no words to express the embarrassment and anger I felt when I was first captured, brother. I was foolish to try and go along with your dumb plan, and I was a failure for getting caught by the guard. It seems fate itself had a hand in my release and I escaped my transport caravan while en route to Thraben from Rider's Lock. I was shackled up in the back of a covered carriage (with a muzzle and everything) and heard a dreadful commotion outside. Never one to ignore an opportunity, I swept my feet over my chains and rammed the door, escaping into the fog with the little dignity I had left in the midst of the attack. What do you think of that? I escaped all on my own! My joy was brief, and the malaise I feel now has overtaken the thrill of escape. I abandoned my old territory before our pathetic attempt to raze Thraben and knew there would be nothing left for me there. After I got the muzzle and chains off, I thought it might be best if I returned to the old family home in Nephalia. The rubble is all falling apart now, and it all still smells vaguely of smoke, dust, and preserving fluids. Some rooms are still habitable, but I couldn't stand to go into Father's study. The evidence of our parents' last scuffle still lines the walls. The weight of guilt hangs on me still after all this time. In an attempt to purge this feeling from myself, I raised Mummy and Father to apologize for what we did to the house. I felt such relief to tell them how sorry I was for the fire, and how neither you nor I intended to inherit our parents' loathing of each other. I spoke of my failure in Thraben, of how distant you and I have grown over the years, my humiliation at being chained and muzzled while you gleefully escaped. Of course they couldn't respond, but the experience was quite therapeutic for me. Given these recent happenings, I wish to add an addendum to the laws of necromantic warfare to exclude use of relations or family pets in battle (I #emph[know] you still have what is left of Spot). Respond with your desired time and location of our next duel. Your loving sister, Gisa #figure(image("009_Games/04.jpg", width: 100%), caption: [Ever After | Art by <NAME>], supplement: none, numbering: none) Gisa, You are being #emph[incredibly] irresponsible. Put Mummy and Father back in the ground#emph[ where they belong] . I am doing things far more important than necrowarfare now. I am pleased you are out of prison, but clearly you are too stupid to recognize my help when I give it to you. Please do not contact me again. —Geralf #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Geralf, I've returned your skaab along with a number of alchemic texts. I believe you should find the answers you are looking for within. If you are amenable, I am more than happy to take you under my proverbial wing. Your mother was a talented necromancer, and she clearly raised a brilliant heir. Please do not hesitate to contact me in the future. Any son of <NAME> is a son of mine. Your family has always been so playful in their love of the dark arts. Let us enjoy our brilliance and embark on the greatest game of all! —Ludevic #figure(image("009_Games/05.jpg", width: 100%), caption: [Geralf's Masterpiece | Art by Daarken], supplement: none, numbering: none) Ludevic, Thank you for your response, I look forward to poring through the annotated text you sent over. But please, let us not be flippant when talking about our craft. I am absolutely #emph[sick ] of games. —Geralf #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Dear <NAME>, Irresponsible?! Don't you bark at me like a child! I am one of the most talented ghoulcallers of our time—I am capable of feats you only #emph[dream] you could do. (I've heard you try to whistle—it's pathetic!) You may think you're too good for necrowarfare, but I know it's really because you don't think I can function without having to rely on #emph[you.] —Gisa P.S. I am going to do my best to remember all my favorite nicknames for you. We are Officially Fighting. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) <NAME>, After some time in pursuit, I have caught up with Gisa in Nephalia. She is currently residing in the remains of an old manor. I am watching from afar and awaiting backup to make the capture. I grow ever more uneasy with regard to my current position. My compass has suddenly begun to act oddly: the needle will spin on its own, regularly jolting and stopping in a direction completely opposite to where it had been moments before. The air feels charged as if a thunderstorm were near, but the skies betray no signs of activity. I do not know why these oddities have been increasing, but it is unlike anything I have encountered before. Something far more dangerous dominates my attention. I believe Gisa is calling again. Ghoul activity is very high, and I've nearly tripped into many empty graves as I travel near the coast of Nephalia. I have never personally seen a necromancer at work, but I can now say with certainty I have heard one. Unearthly whistles fill the fog of the night, light trills that send my stomach to my knees and raise the hair on my neck. She creates no lights nor flashes; instead her magic is a manic song that weaves with the sound of the coastal waves, penetrating the cold sand and lifting the dead from sleep. I understand now why you requested we muzzle her for captivity. What is most unsettling is the calm of the ghouls themselves. Those undead who hear this song do not fight, shamble, or violently lash out. They simply walk toward their conductor. She seems purposeful in her calling, as if these monsters were tools for a task unknown to me. The situation grows more unsteady as each night passes. I will await further instruction before pursuing the ghoulcaller. —Executive Officer Grete #figure(image("009_Games/06.jpg", width: 100%), caption: [Gisa's Bidding | Art by <NAME>], supplement: none, numbering: none) Dear Sausage Tailor, I MADE A FRIEND! And she's my age! I think! She looks like she needs some leafy greens and red meat, but I think she will do fine for my first friend. I met her while taking Mummy for a walk (Father is back in the ground now)—the woman simply walked up to us without any sort of fear. She looked Mummy up and down and asked if I was the one who raised her from the dead. I proudly said I did, to which the woman smiled politely and asked if I could repeat the process easily. How droll! I politely nodded, then called five ghouls and a half of a horse from under her feet. As soon as they were out of the ground, the woman unsheathed a tremendous sword and severed each of my ghouls on the spot. She smiled from ear to ear. I knew at once that we were destined to be the best of friends. The woman introduced herself as Nahiri, and she is clever and quite interested in my work. I showed her how to whistle just the right way to make the dead do as they're told. Nahiri was very amused by my talent and said she probably wouldn't be very good at it, but seemed very interested in seeing the extents of my abilities. I've been calling again, and it feels ever so wonderful! So there you have it. Go back to your backstitching and needlepoint—I have a new companion and I don't need you at all! —Gisa #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Dear Meat Embroiderer, Why aren't you answering my letters. It's because you have a #emph[girlfriend] , isn't it. —Gisa #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Gisa, #emph[Please] do not bring that up. Lili was never my girlfriend! She took Mikaeus's body back in Thraben and absconded. I never saw her again after our brief acquaintance. She is terrible and I hate her. I also hate you. Stop calling me by your old awful nicknames and thank me for helping you escape, already. Here is a foot covered in gout. It reminded me of your personality. —Geralf #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Executive Officer Grete, I have others stationed in Nephalia reporting an odd structure being built off the coast. There may be too many undead for you to handle on your own—pull out NOW. —<NAME> #figure(image("009_Games/07.jpg", width: 100%), caption: [Drownyard Temple | Art by John Avon], supplement: none, numbering: none) Dear Squ<NAME>, Nahiri has left me for a bit. My work continues. Isn't that wonderful? I'm a working woman now! When I pause to reflect on my current situation, I couldn't be luckier to have found this new friend. Without Nahiri I would be ruined. I sold my old property by the old necrowarfare grounds, and all former resources I had have been poured into my new career. My new friend asked for an army of builders, and I have raised her one! She was quite mum about what the zombies were for, but when I asked if they were to build a monument of stone to celebrate our talents she raised her eyebrows and nodded with great enthusiasm. Hear #emph[that] ? We are making a monument to our greatness! Nahiri is magnificently supportive. She adores my ghouls, and I think if I do good enough she'll even build me a weapon to eviscerate you with. I've seen her work—she is very good with rocks. I have no clue what you mean by "thank you for helping me escape," but I'm certain it is just you trying to get inside my brain #emph[as per usual] . Your silly tricks won't work on me! —Gisa #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Gisa, This has gone far enough. I don't want to play anymore. I am nearly finished with my greatest creation and all I want is for you to let this go. I was the one who sent the skaabs to free you from the prison caravan. I went through the trouble of building an attack force to overtake your captors and not #emph[once] have you thanked me for your release. Who else in this bloody hellhole of a parish has the capability to raise dozens of skaabs?! Did you think you were #emph[lucky] enough to just #emph[happen across] the very creatures I have made my name creating?! Your ignorance is insulting, and your insistence on clinging to our childish past is pathetic. Grow up as I have, dear sister. I just wanted to help you. —Geralf #figure(image("009_Games/08.jpg", width: 100%), caption: [Prized Amalgam | Art by Karl Kopinski], supplement: none, numbering: none) Commander Odric, Departing immediately. Ms. Cecani has erupted into a most violent rage. Safety of my patrol is in jeopardy. I write from <NAME> but intend to return to Thraben at once. Pray for our deliverance and safe return—she is not following us yet, but I fear Ms. Cecani is capable of nearly anything in her current state. —Executive Officer Grete #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Geralf, You are an arrogant, hubristic, #emph[feculent] bastard. How dare you naively assume I could not free myself?! I am an idiot for not seeing the truth sooner and recognizing those skaabs for what they were. Keep your presumptuous morality to your own damn self. I have #emph[never] needed your help, and I will #emph[never] be dependent on you for rescue. My name will forever belong in the history books of our land. Tales of the mightiness of me and Nahiri will last as long as our monument stands tall and firm in the sea! Our physical legacy will stand forever unchallenged, and our glory will transform all of Innistrad! All of that, of course, will happen in the fullness of time. As you can see, I chose a very special courier for this letter—I hope you don't mind I sent Mummy to deliver it to you. You always took #emph[her] side in things, after all. I've given the creature instructions to assist you in whatever task you ask of her—every task other than leaving. Do you like how it feels when I help you? Don't you feel #emph[thankful] for me stepping in and assuming you cannot do things on your own?! I have greater things to do with my time than continue to entertain #emph[you] . Look your mother in the eye and think of me. If you treat your own sister like a toddler who can't stand on her own feet, I will send you the one person who will always remind you that #emph[you are a child] . May you find pity in the embrace of whatever is left of your mother's arms. —Gisa
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/060.%20siliconvalley.html.typ
typst
siliconvalley.html How to Be Silicon Valley May 2006(This essay is derived from a keynote at Xtech.)Could you reproduce Silicon Valley elsewhere, or is there something unique about it?It wouldn't be surprising if it were hard to reproduce in other countries, because you couldn't reproduce it in most of the US either. What does it take to make a silicon valley even here?What it takes is the right people. If you could get the right ten thousand people to move from Silicon Valley to Buffalo, Buffalo would become Silicon Valley. [1]That's a striking departure from the past. Up till a couple decades ago, geography was destiny for cities. All great cities were located on waterways, because cities made money by trade, and water was the only economical way to ship.Now you could make a great city anywhere, if you could get the right people to move there. So the question of how to make a silicon valley becomes: who are the right people, and how do you get them to move?Two TypesI think you only need two kinds of people to create a technology hub: rich people and nerds. They're the limiting reagents in the reaction that produces startups, because they're the only ones present when startups get started. Everyone else will move.Observation bears this out: within the US, towns have become startup hubs if and only if they have both rich people and nerds. Few startups happen in Miami, for example, because although it's full of rich people, it has few nerds. It's not the kind of place nerds like.Whereas Pittsburgh has the opposite problem: plenty of nerds, but no rich people. The top US Computer Science departments are said to be MIT, Stanford, Berkeley, and Carnegie-Mellon. MIT yielded Route 128. Stanford and Berkeley yielded Silicon Valley. But Carnegie-Mellon? The record skips at that point. Lower down the list, the University of Washington yielded a high-tech community in Seattle, and the University of Texas at Austin yielded one in Austin. But what happened in Pittsburgh? And in Ithaca, home of Cornell, which is also high on the list?I grew up in Pittsburgh and went to college at Cornell, so I can answer for both. The weather is terrible, particularly in winter, and there's no interesting old city to make up for it, as there is in Boston. Rich people don't want to live in Pittsburgh or Ithaca. So while there are plenty of hackers who could start startups, there's no one to invest in them.Not BureaucratsDo you really need the rich people? Wouldn't it work to have the government invest in the nerds? No, it would not. Startup investors are a distinct type of rich people. They tend to have a lot of experience themselves in the technology business. This (a) helps them pick the right startups, and (b) means they can supply advice and connections as well as money. And the fact that they have a personal stake in the outcome makes them really pay attention.Bureaucrats by their nature are the exact opposite sort of people from startup investors. The idea of them making startup investments is comic. It would be like mathematicians running Vogue-- or perhaps more accurately, Vogue editors running a math journal. [2]Though indeed, most things bureaucrats do, they do badly. We just don't notice usually, because they only have to compete against other bureaucrats. But as startup investors they'd have to compete against pros with a great deal more experience and motivation.Even corporations that have in-house VC groups generally forbid them to make their own investment decisions. Most are only allowed to invest in deals where some reputable private VC firm is willing to act as lead investor.Not BuildingsIf you go to see Silicon Valley, what you'll see are buildings. But it's the people that make it Silicon Valley, not the buildings. I read occasionally about attempts to set up "technology parks" in other places, as if the active ingredient of Silicon Valley were the office space. An article about Sophia Antipolis bragged that companies there included Cisco, Compaq, IBM, NCR, and Nortel. Don't the French realize these aren't startups?Building office buildings for technology companies won't get you a silicon valley, because the key stage in the life of a startup happens before they want that kind of space. The key stage is when they're three guys operating out of an apartment. Wherever the startup is when it gets funded, it will stay. The defining quality of Silicon Valley is not that Intel or Apple or Google have offices there, but that they were started there.So if you want to reproduce Silicon Valley, what you need to reproduce is those two or three founders sitting around a kitchen table deciding to start a company. And to reproduce that you need those people.UniversitiesThe exciting thing is, all you need are the people. If you could attract a critical mass of nerds and investors to live somewhere, you could reproduce Silicon Valley. And both groups are highly mobile. They'll go where life is good. So what makes a place good to them?What nerds like is other nerds. Smart people will go wherever other smart people are. And in particular, to great universities. In theory there could be other ways to attract them, but so far universities seem to be indispensable. Within the US, there are no technology hubs without first-rate universities-- or at least, first-rate computer science departments.So if you want to make a silicon valley, you not only need a university, but one of the top handful in the world. It has to be good enough to act as a magnet, drawing the best people from thousands of miles away. And that means it has to stand up to existing magnets like MIT and Stanford.This sounds hard. Actually it might be easy. My professor friends, when they're deciding where they'd like to work, consider one thing above all: the quality of the other faculty. What attracts professors is good colleagues. So if you managed to recruit, en masse, a significant number of the best young researchers, you could create a first-rate university from nothing overnight. And you could do that for surprisingly little. If you paid 200 people hiring bonuses of $3 million apiece, you could put together a faculty that would bear comparison with any in the world. And from that point the chain reaction would be self-sustaining. So whatever it costs to establish a mediocre university, for an additional half billion or so you could have a great one. [3]PersonalityHowever, merely creating a new university would not be enough to start a silicon valley. The university is just the seed. It has to be planted in the right soil, or it won't germinate. Plant it in the wrong place, and you just create Carnegie-Mellon.To spawn startups, your university has to be in a town that has attractions other than the university. It has to be a place where investors want to live, and students want to stay after they graduate.The two like much the same things, because most startup investors are nerds themselves. So what do nerds look for in a town? Their tastes aren't completely different from other people's, because a lot of the towns they like most in the US are also big tourist destinations: San Francisco, Boston, Seattle. But their tastes can't be quite mainstream either, because they dislike other big tourist destinations, like New York, Los Angeles, and Las Vegas.There has been a lot written lately about the "creative class." The thesis seems to be that as wealth derives increasingly from ideas, cities will prosper only if they attract those who have them. That is certainly true; in fact it was the basis of Amsterdam's prosperity 400 years ago.A lot of nerd tastes they share with the creative class in general. For example, they like well-preserved old neighborhoods instead of cookie-cutter suburbs, and locally-owned shops and restaurants instead of national chains. Like the rest of the creative class, they want to live somewhere with personality.What exactly is personality? I think it's the feeling that each building is the work of a distinct group of people. A town with personality is one that doesn't feel mass-produced. So if you want to make a startup hub-- or any town to attract the "creative class"-- you probably have to ban large development projects. When a large tract has been developed by a single organization, you can always tell. [4]Most towns with personality are old, but they don't have to be. Old towns have two advantages: they're denser, because they were laid out before cars, and they're more varied, because they were built one building at a time. You could have both now. Just have building codes that ensure density, and ban large scale developments.A corollary is that you have to keep out the biggest developer of all: the government. A government that asks "How can we build a silicon valley?" has probably ensured failure by the way they framed the question. You don't build a silicon valley; you let one grow.NerdsIf you want to attract nerds, you need more than a town with personality. You need a town with the right personality. Nerds are a distinct subset of the creative class, with different tastes from the rest. You can see this most clearly in New York, which attracts a lot of creative people, but few nerds. [5]What nerds like is the kind of town where people walk around smiling. This excludes LA, where no one walks at all, and also New York, where people walk, but not smiling. When I was in grad school in Boston, a friend came to visit from New York. On the subway back from the airport she asked "Why is everyone smiling?" I looked and they weren't smiling. They just looked like they were compared to the facial expressions she was used to.If you've lived in New York, you know where these facial expressions come from. It's the kind of place where your mind may be excited, but your body knows it's having a bad time. People don't so much enjoy living there as endure it for the sake of the excitement. And if you like certain kinds of excitement, New York is incomparable. It's a hub of glamour, a magnet for all the shorter half-life isotopes of style and fame.Nerds don't care about glamour, so to them the appeal of New York is a mystery. People who like New York will pay a fortune for a small, dark, noisy apartment in order to live in a town where the cool people are really cool. A nerd looks at that deal and sees only: pay a fortune for a small, dark, noisy apartment.Nerds will pay a premium to live in a town where the smart people are really smart, but you don't have to pay as much for that. It's supply and demand: glamour is popular, so you have to pay a lot for it.Most nerds like quieter pleasures. They like cafes instead of clubs; used bookshops instead of fashionable clothing shops; hiking instead of dancing; sunlight instead of tall buildings. A nerd's idea of paradise is Berkeley or Boulder.YouthIt's the young nerds who start startups, so it's those specifically the city has to appeal to. The startup hubs in the US are all young-feeling towns. This doesn't mean they have to be new. Cambridge has the oldest town plan in America, but it feels young because it's full of students.What you can't have, if you want to create a silicon valley, is a large, existing population of stodgy people. It would be a waste of time to try to reverse the fortunes of a declining industrial town like Detroit or Philadelphia by trying to encourage startups. Those places have too much momentum in the wrong direction. You're better off starting with a blank slate in the form of a small town. Or better still, if there's a town young people already flock to, that one.The Bay Area was a magnet for the young and optimistic for decades before it was associated with technology. It was a place people went in search of something new. And so it became synonymous with California nuttiness. There's still a lot of that there. If you wanted to start a new fad-- a new way to focus one's "energy," for example, or a new category of things not to eat-- the Bay Area would be the place to do it. But a place that tolerates oddness in the search for the new is exactly what you want in a startup hub, because economically that's what startups are. Most good startup ideas seem a little crazy; if they were obviously good ideas, someone would have done them already.(How many people are going to want computers in their houses? What, another search engine?)That's the connection between technology and liberalism. Without exception the high-tech cities in the US are also the most liberal. But it's not because liberals are smarter that this is so. It's because liberal cities tolerate odd ideas, and smart people by definition have odd ideas.Conversely, a town that gets praised for being "solid" or representing "traditional values" may be a fine place to live, but it's never going to succeed as a startup hub. The 2004 presidential election, though a disaster in other respects, conveniently supplied us with a county-by-county map of such places. [6]To attract the young, a town must have an intact center. In most American cities the center has been abandoned, and the growth, if any, is in the suburbs. Most American cities have been turned inside out. But none of the startup hubs has: not San Francisco, or Boston, or Seattle. They all have intact centers. [7] My guess is that no city with a dead center could be turned into a startup hub. Young people don't want to live in the suburbs.Within the US, the two cities I think could most easily be turned into new silicon valleys are Boulder and Portland. Both have the kind of effervescent feel that attracts the young. They're each only a great university short of becoming a silicon valley, if they wanted to.TimeA great university near an attractive town. Is that all it takes? That was all it took to make the original Silicon Valley. Silicon Valley traces its origins to <NAME>, one of the inventors of the transistor. He did the research that won him the Nobel Prize at Bell Labs, but when he started his own company in 1956 he moved to Palo Alto to do it. At the time that was an odd thing to do. Why did he? Because he had grown up there and remembered how nice it was. Now Palo Alto is suburbia, but then it was a charming college town-- a charming college town with perfect weather and San Francisco only an hour away.The companies that rule Silicon Valley now are all descended in various ways from Shockley Semiconductor. Shockley was a difficult man, and in 1957 his top people-- "the traitorous eight"-- left to start a new company, Fairchild Semiconductor. Among them were <NAME> and <NAME>, who went on to found Intel, and <NAME>, who founded the VC firm <NAME>. Forty-two years later, <NAME> funded Google, and the partner responsible for the deal was <NAME>, who came to Silicon Valley in 1974 to work for Intel.So although a lot of the newest companies in Silicon Valley don't make anything out of silicon, there always seem to be multiple links back to Shockley. There's a lesson here: startups beget startups. People who work for startups start their own. People who get rich from startups fund new ones. I suspect this kind of organic growth is the only way to produce a startup hub, because it's the only way to grow the expertise you need.That has two important implications. The first is that you need time to grow a silicon valley. The university you could create in a couple years, but the startup community around it has to grow organically. The cycle time is limited by the time it takes a company to succeed, which probably averages about five years.The other implication of the organic growth hypothesis is that you can't be somewhat of a startup hub. You either have a self-sustaining chain reaction, or not. Observation confirms this too: cities either have a startup scene, or they don't. There is no middle ground. Chicago has the third largest metropolitan area in America. As a source of startups it's negligible compared to Seattle, number 15.The good news is that the initial seed can be quite small. Shockley Semiconductor, though itself not very successful, was big enough. It brought a critical mass of experts in an important new technology together in a place they liked enough to stay.CompetingOf course, a would-be silicon valley faces an obstacle the original one didn't: it has to compete with Silicon Valley. Can that be done? Probably.One of Silicon Valley's biggest advantages is its venture capital firms. This was not a factor in Shockley's day, because VC funds didn't exist. In fact, Shockley Semiconductor and Fairchild Semiconductor were not startups at all in our sense. They were subsidiaries-- of Beckman Instruments and Fairchild Camera and Instrument respectively. Those companies were apparently willing to establish subsidiaries wherever the experts wanted to live.Venture investors, however, prefer to fund startups within an hour's drive. For one, they're more likely to notice startups nearby. But when they do notice startups in other towns they prefer them to move. They don't want to have to travel to attend board meetings, and in any case the odds of succeeding are higher in a startup hub.The centralizing effect of venture firms is a double one: they cause startups to form around them, and those draw in more startups through acquisitions. And although the first may be weakening because it's now so cheap to start some startups, the second seems as strong as ever. Three of the most admired "Web 2.0" companies were started outside the usual startup hubs, but two of them have already been reeled in through acquisitions.Such centralizing forces make it harder for new silicon valleys to get started. But by no means impossible. Ultimately power rests with the founders. A startup with the best people will beat one with funding from famous VCs, and a startup that was sufficiently successful would never have to move. So a town that could exert enough pull over the right people could resist and perhaps even surpass Silicon Valley.For all its power, Silicon Valley has a great weakness: the paradise Shockley found in 1956 is now one giant parking lot. San Francisco and Berkeley are great, but they're forty miles away. Silicon Valley proper is soul-crushing suburban sprawl. It has fabulous weather, which makes it significantly better than the soul-crushing sprawl of most other American cities. But a competitor that managed to avoid sprawl would have real leverage. All a city needs is to be the kind of place the next traitorous eight look at and say "I want to stay here," and that would be enough to get the chain reaction started.Notes[1] It's interesting to consider how low this number could be made. I suspect five hundred would be enough, even if they could bring no assets with them. Probably just thirty, if I could pick them, would be enough to turn Buffalo into a significant startup hub.[2] Bureaucrats manage to allocate research funding moderately well, but only because (like an in-house VC fund) they outsource most of the work of selection. A professor at a famous university who is highly regarded by his peers will get funding, pretty much regardless of the proposal. That wouldn't work for startups, whose founders aren't sponsored by organizations, and are often unknowns.[3] You'd have to do it all at once, or at least a whole department at a time, because people would be more likely to come if they knew their friends were. And you should probably start from scratch, rather than trying to upgrade an existing university, or much energy would be lost in friction.[4] Hypothesis: Any plan in which multiple independent buildings are gutted or demolished to be "redeveloped" as a single project is a net loss of personality for the city, with the exception of the conversion of buildings not previously public, like warehouses.[5] A few startups get started in New York, but less than a tenth as many per capita as in Boston, and mostly in less nerdy fields like finance and media.[6] Some blue counties are false positives (reflecting the remaining power of Democractic party machines), but there are no false negatives. You can safely write off all the red counties.[7] Some "urban renewal" experts took a shot at destroying Boston's in the 1960s, leaving the area around city hall a bleak wasteland, but most neighborhoods successfully resisted them.Thanks to <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this, and to <NAME> for inviting me to speak.(The second part of this talk became Why Startups Condense in America.)VC Deals by RegionStartup Jobs by RegionThey Would Be GodsInterview: <NAME>Santa Clara Valley, 1971Scattered AbroadRussian TranslationSpanish TranslationJapanese TranslationPortuguese TranslationArabic Translation If you liked this, you may also like Hackers & Painters.
https://github.com/joshuabeny1999/unisg-thesis-template-typst
https://raw.githubusercontent.com/joshuabeny1999/unisg-thesis-template-typst/main/layout/abstract.typ
typst
Other
#let abstract(body, lang: "en") = { let title = (en: "Abstract", de: "Zusammenfassung") set page( margin: (left: 2.5cm, right: 2.5cm, top: 2.5cm, bottom: 2.5cm), numbering: none, number-align: center, ) let body-font = "Times new Roman" set text( font: body-font, size: 12pt, lang: lang ) set par( leading: 1em, justify: true ) // --- Abstract --- align(top + center, text(font: body-font, 1em, weight: "semibold", title.at(lang))) body }
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/016%20-%20Fate%20Reforged/004_The%20Truth%20of%20Names.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Truth of Names", set_name: "Fate Reforged", story_date: datetime(day: 28, month: 01, year: 2015), author: "<NAME>, <NAME> & <NAME>", doc ) The young khan of the Mardu sat poised at the front of her horde, perfectly still despite her horse shifting nervously beneath her. The worn leather grip of her bow, the weight of her sword on her back, the nervous energy of the warriors almost palpable behind her—she drew strength from all of these. More than anything else, she drew strength from her war name, Alesha, because it was #emph[hers.] She scanned the bluffs above her, but couldn't see the warriors she knew were crouching there. She peered ahead, toward the mouth of the canyon, searching for a sign of their foe. #emph[There.] She saw five—no, six—dark shapes in the air. They were too far away to make out the details—their four feathered wings, sinuous bodies, and long fins and spines—but a crackling of lightning around and among them left no doubt in her mind. These were the dragons they sought, the filthy brood of the monstrous Kolaghan. "Mardu!" she shouted. "Mardu!" The answering shouts from the horde shook the canyon, and Alesha smiled. The dragons couldn't miss them now. The distant shapes grew larger as the dragons sped toward the horde. Horses snorted as riders shifted in their saddles, readying themselves for the charge. Goblins chittered in their eagerness to die, and orcs stood like stone, waiting. #figure(image("004_The Truth of Names/01.jpg", width: 100%), caption: [Outpost Siege | Art by Daarken], supplement: none, numbering: none) Silently, Alesha raised her bow over her head, signaling the archers to ready their arrows. She waited, taking in a long, slow breath as the dragons winged ever closer. The air thrummed with the beats of their wings, and the tang of lightning blew to her on the wind. She lowered her bow, fitted an arrow, and drew back, hearing the creak of a hundred bows behind her. She could see the cold glow of the beasts' eyes and the lightning crackling in their mouths. #emph[Now.] Her arrow struck the first one in the mouth, sending a stray bolt of lightning harmlessly to the ground. A hundred arrows followed it, and the dragon veered up and to the side. Right into place. A half-dozen warriors dropped from the bluff onto the swerving dragon. One hit a wing and slid off, falling to his death. Two more clung desperately to spines on its back as it wheeled around in surprise. One clutched the dragon's long tail. But two Mardu—two who would be celebrated this night—drove swords into its flesh, striking deep into its shoulder and its flank. The beast roared its pain, and lightning sent a cascade of rock tumbling down the canyon wall. Alesha nudged her horse and loosed another arrow as she charged forward to meet the other ones head-on. Hooves thundered behind her, goblins shrieked, orcs rumbled their war cries. The Mardu surged to greet death, swords in hand. A dragon swooped down, opening its mouth to strafe Alesha and her vanguard with its deadly lightning breath. Her arrow lodged in its mouth, but an instant later lightning was flashing all around her. Panic surged in her chest, a memory of past terror, when another spawn of Kolaghan's brood had given her the scars she wore on her back. Her horse reared and whinnied, and Alesha jumped from the saddle before the beast could throw her. She rolled on the ground and came up in a crouch. The brazen shouts of the Mardu horde were mingled now with howls of pain and warning cries as the battle began in earnest. Alesha nocked another arrow and surveyed the field. With a handful of arrows jutting from between its scales, the dragon that had blasted her vanguard was circling around for another run. "That one!" she shouted, gesturing with her bow. "Bring it down!" From the smallest goblin to the tallest orc, every warrior in earshot turned as one, ready to carry out her will. A flurry of arrows battered the beast, bouncing off its scales or lodging between them, piercing holes in its wings, or—one very skilled or lucky shot—lodging in an eye. The creature shrieked, a deafening noise that sent goblins diving for cover and made even seasoned veterans duck their heads and shuffle a few steps backward. It landed, claws first, crushing and tearing at everything in reach. Alesha loosed one more arrow, which lodged in the beast's shoulder, then drew her sword from her back. "On it!" she shouted. "Now!" She could see the dragon collecting itself, getting its feet beneath it so it could launch itself into the air again. They had to kill it before it could do that. #figure(image("004_The Truth of Names/02.jpg", width: 100%), caption: [Alesha, Who Smiles at Death | Art by <NAME>ova], supplement: none, numbering: none) As one, her band surged ahead and crashed on it like a wave, with Alesha in their midst. Their numbers were pitifully small, she realized. The crash had killed many, and five other dragons kept the rest of the horde occupied. Six of the beasts were enough to guarantee a moment of glory for every fighter who deserved one. Her heavy blade—as long and as wide as her arm—bit deep into the dragon's flank, and she ducked as its wing lashed out in response to the pain. It tried to wheel around and face her, but a mighty swing from a towering orc's blade knocked its head back and sent a spray of sharp-smelling blood in its wake. Alesha nodded, watching the orc, a soft heel who had yet to earn his war name, despite fighting in many battles. This was his moment, and she wanted to witness it. A true warrior would have leaped into the opening his mighty blow had created, driving his sword into the creature's neck. An orc as strong as this one might even have been able to sever the head with a well-placed strike. There was the briefest pause as the others watched, anticipating the moment of glory. #figure(image("004_The Truth of Names/03.jpg", width: 100%), caption: [Battle Brawler | Art by <NAME>ski], supplement: none, numbering: none) It didn't come. Instead of going for the kill, the orc turned and slashed at the dragon's foreclaw, an instant before it would have cut across another fighter's belly. It was Gedruk Wingbreaker who ran forward and hacked at the creature's neck before it could regain its balance. It took him three hacking blows as the dragon writhed and flailed, and the beast's foul blood coated him before it was done. But at last it lay still, and a cheer went up from the fighters that circled it. Alesha scanned the field of battle. One other dragon was dead—the one that had led the initial charge—and two more were grounded. She pointed at one in the air, wheeling around for another strafing run. "That one!" she called, and the Mardu braced themselves to bring it down. While it maneuvered, though, they would have a moment to savor their triumph. Or their shame. "You!" she barked at the orc. He stepped closer, towering over her. "Khan?" he said, his voice a rumble almost drowned out in the noise of battle. "That kill could have been yours." She watched him carefully as her words sank in. He bristled, drawing himself up even taller. "Gedruk stole it." "Did he?" "I saw you hold back. I saw you cut the beast's claw instead of its neck. Why?" The orc snarled. "I don't know." "You could have earned your war name," she said. "Know who you are, and claim it." Anger twisted the orc's face and he took another step toward her. "#emph[You] tell me this? A human boy who thinks he's a woman?" Alesha kept her face impassive as a nearby goblin squeaked and scampered away from her, no doubt anticipating her wrath. Before she could answer the nameless orc, though, the dragon was upon them. They all knew what to do. Another hail of arrows sought out the beast's softer spots, this time joined by a blast of fire from a spark cannon. This one, too, crashed to the ground, and this time most of the warriors were out of reach of its flailing claws as it landed. Alesha shouted and the Mardu—even the nameless orc who had challenged her—rushed forward to meet it. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) It had been a day like this, a battle very much like this, when Alesha won the right to name herself. With blood running down her back where the dragon's claws had raked her flesh, she pulled a spear from a dead man's back and plunged it into the beast's mouth, up into its brain. The spear shaft splintered, but the dragon died in an instant. She didn't remember if she had been afraid as the monstrous head lunged at her. What she remembered was the panic that came after. Earning her war name had been her only goal. When the fight was over, she stood silently among the other young ones who were boasting of their accomplishments and the bold, grisly names they would choose. Headsmasher. Skullcleaver. Wingbreaker—Gedruk had been among them. Some of them, mostly orcs, boasted of their ancestors' deeds and spoke of their pride in adopting those ancestors' names. She had been so different—only sixteen, a boy in everyone's eyes but her own, about to choose and declare her name before the khan and all the Mardu. The khan had walked among the warriors, hearing the tales of their glorious deeds. One by one, they declared their new war names, and each time, the khan shouted the names for all to hear. Each time, the horde shouted the name as one, shaking the earth. Then the khan came to Alesha. She stood before him, snakes coiling in the pit of her stomach, and told how she had slain her first dragon. The khan nodded and asked her name. "Alesha," she said, as loudly as she could. Just Alesha, her grandmother's name. "Alesha!" the khan shouted, without a moment's pause. And the whole gathered horde shouted "Alesha!" in reply. The warriors of the Mardu shouted #emph[her name.] In that moment, if anyone had told her that in three years' time she would be khan, she just might have dared to believe it. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Half-lost in her memories, the khan of the Mardu was smiling when the other dragon hit the ground behind her, smiling as she whirled to face it, smiling as her sword bit deep into its neck while it lunged at the nameless orc beside her. It bellowed and thrashed as death came to claim it, but one more swing of her heavy blade cut its head clean off. #figure(image("004_The Truth of Names/04.jpg", width: 100%), caption: [Mardu Runemark | Art by <NAME>], supplement: none, numbering: none) The orc beside her stared dumbly, no trace of anger remaining on his face. "I know who I am," Alesha said to him, still smiling. "Now show me who you are." She nodded toward the last two beasts that still snapped and snarled at the surrounding Mardu. He hesitated, still slack-jawed, but then collected himself and ran back into battle. She followed him, watching as he threw himself into the frenzied melee around the largest of the dragons. He was strong, clearly, and fast despite his bulk. He fought with no lack of skill, but his techniques were unorthodox. He used his strength to batter the beast's head and limbs, to knock it off balance and shift its position. He ensured that its deadly teeth and claws never made contact with the other fighters, and he made openings for his allies to strike. He wasn't looking for the killing blow, but he made it possible. Alesha nodded, smiling to herself. Soon enough, the battle was over. Six dragons lay dead on the canyon floor among many dead warriors. Their losses were steep, but #emph[six dragons!] Six of Kolaghan's brood would never prey on the Mardu again. The horde had much to celebrate. The survivors set to work. The woe-reapers chanted their ancient rites over the dead to keep them still in death. Goblins skittered over the battlefield, gathering arrows that could be reused and broken weapons that could be reforged. Other Mardu carved up the dragon corpses for meat and trophies. #figure(image("004_The Truth of Names/05.jpg", width: 100%), caption: [Bloodfell Caves | Art by Adam Paquette], supplement: none, numbering: none) Alesha walked among them, just as she had fought beside them. In each cluster of fighters, she sought out those who had not yet claimed a war name. On this day, many had earned the right to claim their names. She listened to tale after tale of heroic deeds, and with each name chosen, she shouted the name for the horde to hear—with never a moment's hesitation. Fangbreaker. Cliffleaper. Barzeel. Tailrider. Turuk. Vallash. At last she came to the orc who had fought beside her, the orc who had dared to question her. "You," she said. "How many battles have you fought?" He stood stiffly, looking over her head rather than meeting her gaze. "Nine." "And what deeds of glory do you claim this day?" "None, Khan." "None? Nine battles and you have earned no glory? You have no war name to claim?" "No." "Then you are a fool. I know who you are, but you don't know yourself." He bristled again, but this time didn't dare to speak. She turned to the warrior next to him. "<NAME>," she said, "you fought beside this soft heel today. What did you see?" Vashar stood and looked at the taller orc. "I fell underneath one of the dragons," she said. "Its weight crushed me to the ground. You stood beside me and struck the beast, shifting its balance so I could get out, then you helped me to my feet." Alesha nodded and pointed to another. "<NAME>, what did you see?" "Khan, this one put himself between me and a deadly claw. His strength knocked the claw aside, then I slipped past and drove my spear beneath the dragon's foreleg." One more. "<NAME>, what did you see?" Jalasha reached up and clapped the orc on the shoulder. "My friend saved my life, throwing himself onto a dragon's head when it was about to take me in its jaws." #figure(image("004_The Truth of Names/06.jpg", width: 100%), caption: [Shockmaw Dragon | Art by <NAME>], supplement: none, numbering: none) Alesha nodded and stepped close to the nameless orc. She grabbed the edge of his armored collar and pulled his head down, forcing his eyes to meet hers. "I know who I am. I am not a boy. I am Alesha, like my grandmother before me." Several of the nearest warriors murmured their approval. "And I know who you are," she said. "The Mardu know you. But you—you think every Mardu must be a Backbreaker or Helmsmasher. You think your deeds are not as glorious as theirs. And you are wrong." She let go of his armor and shoved him, sending him stumbling back a few steps. "When you learn what your place among the Mardu is, then you can choose a name." She turned away, ready to move to the next group of soldiers. "Wait," the orc said. Alesha paused but did not turn around. "Why?" "I have a tale of the battle." She turned and glared at him. "We have heard enough of your deeds." "This is not my glory." He raised his voice so all around could hear. "Today I saw a warrior strike down a dragon with a single blow, and on her face she wore the joy of battle." Alesha smiled. The orc took a step closer and spoke more quietly. "As you say, my khan, I do not know myself. But I know you, I follow you—" Now he shouted over all the din of the battlefield. "—and I call you Alesha, Who Smiles at Death." And once again, the warriors of the Mardu shouted her name.
https://github.com/ClazyChen/Table-Tennis-Rankings
https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history/2024/WS-07.typ
typst
#set text(font: ("Courier New", "NSimSun")) #figure( caption: "Women's Singles (1 - 32)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [1], [SUN Yingsha], [CHN], [3651], [2], [WANG Manyu], [CHN], [3441], [3], [CHEN Meng], [CHN], [3415], [4], [HAYATA Hina], [JPN], [3320], [5], [CHEN Xingtong], [CHN], [3249], [6], [WANG Yidi], [CHN], [3226], [7], [ZHU Yuling], [MAC], [3222], [8], [HARIMOTO Miwa], [JPN], [3199], [9], [QIAN Tianyi], [CHN], [3156], [10], [ZHANG Rui], [CHN], [3098], [11], [HE Zhuojia], [CHN], [3089], [12], [KIHARA Miyuu], [JPN], [3086], [13], [HIRANO Miu], [JPN], [3085], [14], [CHENG I-Ching], [TPE], [3054], [15], [ITO Mima], [JPN], [3052], [16], [KUAI Man], [CHN], [3037], [17], [HAN Ying], [GER], [3031], [18], [HASHIMOTO Honoka], [JPN], [3029], [19], [FAN Siqi], [CHN], [3028], [20], [BATRA Manika], [IND], [3028], [21], [JEON Jihee], [KOR], [3023], [22], [ODO Satsuki], [JPN], [3012], [23], [SHI Xunyao], [CHN], [2984], [24], [LIU Weishan], [CHN], [2976], [25], [SATO Hitomi], [JPN], [2968], [26], [OJIO Haruna], [JPN], [2964], [27], [SZOCS Bernadette], [ROU], [2962], [28], [CHEN Yi], [CHN], [2946], [29], [PAVADE Prithika], [FRA], [2937], [30], [SHIN Yubin], [KOR], [2923], [31], [NAGASAKI Miyu], [JPN], [2922], [32], [SHIBATA Saki], [JPN], [2914], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Women's Singles (33 - 64)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [33], [YANG Xiaoxin], [MON], [2907], [34], [JOO Cheonhui], [KOR], [2900], [35], [MORI Sakura], [JPN], [2900], [36], [MITTELHAM Nina], [GER], [2893], [37], [DIAZ Adriana], [PUR], [2874], [38], [FAN Shuhan], [CHN], [2860], [39], [YUAN Jia Nan], [FRA], [2852], [40], [POLCANOVA Sofia], [AUT], [2837], [41], [PYON Song Gyong], [PRK], [2830], [42], [SUH Hyo Won], [KOR], [2816], [43], [LEE Eunhye], [KOR], [2812], [44], [WU Yangchen], [CHN], [2789], [45], [LI Yake], [CHN], [2783], [46], [SHAN Xiaona], [GER], [2778], [47], [KAUFMANN Annett], [GER], [2778], [48], [ZHANG Lily], [USA], [2777], [49], [GUO Yuhan], [CHN], [2765], [50], [KALLBERG Christina], [SWE], [2765], [51], [QIN Yuxuan], [CHN], [2764], [52], [XU Yi], [CHN], [2759], [53], [SAWETTABUT Suthasini], [THA], [2754], [54], [DOO Hoi Kem], [HKG], [2751], [55], [YANG Yiyun], [CHN], [2750], [56], [PARANANG Orawan], [THA], [2750], [57], [TAKAHASHI Bruna], [BRA], [2745], [58], [EERLAND Britt], [NED], [2739], [59], [WANG Xiaotong], [CHN], [2738], [60], [BAJOR Natalia], [POL], [2738], [61], [LEE Ho Ching], [HKG], [2738], [62], [ZENG Jian], [SGP], [2732], [63], [ZHU Chengzhu], [HKG], [2723], [64], [LIU Hsing-Yin], [TPE], [2722], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Women's Singles (65 - 96)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [65], [CHIEN Tung-Chuan], [TPE], [2719], [66], [YANG Ha Eun], [KOR], [2711], [67], [SAMARA Elizabeta], [ROU], [2709], [68], [AKULA Sreeja], [IND], [2708], [69], [QI Fei], [CHN], [2704], [70], [PESOTSKA Margaryta], [UKR], [2703], [71], [YOKOI Sakura], [JPN], [2698], [72], [NI Xia Lian], [LUX], [2694], [73], [HAN Feier], [CHN], [2687], [74], [KIM Hayeong], [KOR], [2686], [75], [CHENG Hsien-Tzu], [TPE], [2683], [76], [LI Yu-Jhun], [TPE], [2675], [77], [LEE Daeun], [KOR], [2675], [78], [WINTER Sabine], [GER], [2674], [79], [ZHANG Mo], [CAN], [2664], [80], [SASAO Asuka], [JPN], [2661], [81], [CHOI Hyojoo], [KOR], [2654], [82], [SHAO Jieni], [POR], [2647], [83], [KIM Nayeong], [KOR], [2640], [84], [DIACONU Adina], [ROU], [2638], [85], [XIAO Maria], [ESP], [2638], [86], [BERGSTROM Linda], [SWE], [2632], [87], [LUTZ Charlotte], [FRA], [2631], [88], [WAN Yuan], [GER], [2628], [89], [BADAWY Farida], [EGY], [2625], [90], [DRAGOMAN Andreea], [ROU], [2622], [91], [ZHU Sibing], [CHN], [2622], [92], [MESHREF Dina], [EGY], [2621], [93], [LEE Zion], [KOR], [2619], [94], [WANG Amy], [USA], [2619], [95], [YU Fu], [POR], [2614], [96], [KIM Byeolnim], [KOR], [2613], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Women's Singles (97 - 128)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [97], [MUKHERJEE Sutirtha], [IND], [2608], [98], [POTA Georgina], [HUN], [2607], [99], [ARAPOVIC Hana], [CRO], [2601], [100], [LIU Yangzi], [AUS], [2599], [101], [NG Wing Lam], [HKG], [2599], [102], [RAKOVAC Lea], [CRO], [2593], [103], [CHEN Szu-Yu], [TPE], [2591], [104], [ZONG Geman], [CHN], [2584], [105], [PIC<NAME>], [ITA], [2583], [106], [CIOBANU Irina], [ROU], [2577], [107], [<NAME>], [JPN], [2575], [108], [NOMURA Moe], [JPN], [2574], [109], [LIU Jia], [AUT], [2574], [110], [GHORPADE Yashaswini], [IND], [2572], [111], [SAWETTABUT Jinnipa], [THA], [2568], [112], [<NAME>], [JPN], [2566], [113], [HUANG Yu-Chiao], [TPE], [2562], [114], [HUANG Yi-Hua], [TPE], [2562], [115], [<NAME>], [CZE], [2559], [116], [YANG Huijing], [CHN], [2559], [117], [ZHANG Xiangyu], [CHN], [2558], [118], [<NAME>], [FRA], [2550], [119], [MUKHERJEE Ayhika], [IND], [2548], [120], [ZHANG Sofia-Xuan], [ESP], [2548], [121], [<NAME>], [SRB], [2544], [122], [PLAIAN Tania], [ROU], [2543], [123], [GODA Hana], [EGY], [2542], [124], [TOLIOU Aikaterini], [GRE], [2539], [125], [SCHREINER Franziska], [GER], [2539], [126], [<NAME>], [KOR], [2537], [127], [KAM<NAME>], [IND], [2531], [128], [<NAME>], [TUR], [2526], ) )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/drafting/0.1.1/README.md
markdown
Apache License 2.0
# Drafting This package hosts several utilities that are useful for drafting documents, namely margin notes and precise positioning helpers. Over time, hopefully more utilities will be contributed. A quick, comprehensive overview is provided by the [example document](https://github.com/ntjess/typst-drafting/blob/v0.1.1/docs/main.pdf): ![](https://github.com/ntjess/typst-drafting/raw/v0.1.1/docs/main.png)
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/math/calligraphic.md
markdown
MIT License
# Calligraphic letters ```typ #let scr(it) = math.class("normal", text(font: "", stylistic-set: 1, $cal(it)$) + h(0em) ) $ scr(A) scr(B) + scr(C), -scr(D) $ ``` Unfortunately, currently just `stylistic-set` for math creates bad spacing. Math engine detects if the letter should be correctly spaced by whether it is the default font. However, just making it "normal" isn't enough, because than it can be reduced. That's way the snippet is as hacky as it is (probably should be located in Typstonomicon, but it's not large enough).
https://github.com/IdoWinter/UnitedDumplingsLegislatureArchive
https://raw.githubusercontent.com/IdoWinter/UnitedDumplingsLegislatureArchive/main/legislature/constitution/direct-elections-pm.typ
typst
MIT License
#import "../templates.typ": * #set heading(numbering: "1.1") #eng_heb( eng: [ #show: doc => constitutional_amendement_en("Separate Elections for Prime Minister and Parliament", preamble: [ Acknowledging the need to enhance democratic processes and ensure the direct accountability of the executive leadership to the electorate, this amendment proposes the introduction of separate electoral mechanisms for the election of the Prime Minister and members of Parliament. ], doc) == General Provisions === In the general elections, citizens shall be provided with two distinct ballots: one designated for the election of the Prime Minister and the other for the election of Parliament members. === The election process for Parliament shall remain in accordance with existing electoral laws and regulations. == Election of the Prime Minister === The election of the Prime Minister shall be conducted through a direct electoral process by the populace. === Each eligible voter shall cast one vote on the designated ballot for their preferred Prime Ministerial candidate. == First-Round Electoral Threshold === Should a Prime Ministerial candidate secure 40% or more of the total valid votes cast in the first round, the candidate with the most votes shall be declared the winner and duly elected as Prime Minister. === The calculation of the 40% threshold shall exclude any null and void ballots, focusing solely on valid votes. == Second-Round Election (Runoff) === In the absence of a candidate achieving the required 40% threshold in the first round, a second-round election shall be initiated, featuring the two candidates with the highest number of votes from the first round. === The second-round election shall be scheduled no later than *1 meeting* following the announcement of the first-round results. === The candidate who receives the majority of votes in the second round shall be declared the winner and duly elected as Prime Minister. == Tie-Breaking Mechanisms === In the event of a tie for the second-highest number of votes in the first round, necessitating clarification on the candidates to proceed to the second round, a tie-breaking game of Chwazi shall be conducted within the *same meeting* of the election results announcement. === The tied candidates shall participate in the Chwazi Game under the supervision of the Electoral Commission, with the winner securing a place in the second-round election. === In the unlikely event of a tie in the second-round election, a subsequent Chwazi Game shall be organized within the *same meeting* to determine the final election winner. == Electoral Commission Oversight === The Electoral Commission shall be responsible for the oversight, administration, and facilitation of both rounds of the election, ensuring transparency, fairness, and adherence to the democratic principles enshrined in this amendment. === The Electoral Commission shall also oversee the conduct of the Turtle Board Game tie-breaker, ensuring it is conducted in a manner that upholds the integrity of the electoral process. == Conditional Extension and Permanency === This amendment is initially effective for the upcoming (6th) general election only. Its application to subsequent elections is not automatic. === For the separate electoral system for the Prime Minister as outlined in this amendment to extend beyond the immediate next election, a formal review and approval must be conducted by Parliament. === Such review shall take place no later than 5 meetings following the conclusion of the upcoming general election. During this period, Parliament shall assess the efficacy, fairness, and public reception of the separate electoral process. === Approval for extension beyond the next election requires a majority vote within Parliament. If approved, this separate electoral system for the Prime Minister shall become a permanent feature of the electoral process. === In the absence of parliamentary approval, the electoral system reverts to the pre-amendment method for all future elections until such time that further amendments may be made. == Commencement === This amendment shall come into force immediately upon ratification, applicable from the next scheduled general elections. === Transitional provisions shall be established to guide the implementation of this amendment in the forthcoming elections. ], heb: [ ])
https://github.com/artemist/typstcard
https://raw.githubusercontent.com/artemist/typstcard/canon/labels_dymo.typ
typst
#{ set page(width: 3.5in, height: 1.125in, margin: 0em) import "common.typ" let options = json("options.json") let cards = options.cards for (idx, card) in cards.enumerate() { if idx != 0 { pagebreak() } place( top + left, dx: 1in/16, dy: 1in/16, common.address_block(3in, 1in, card) ) } }
https://github.com/vEnhance/1802
https://raw.githubusercontent.com/vEnhance/1802/main/r06.typ
typst
MIT License
#import "@local/evan:1.0.0":* #show: evan.with( title: [Notes for 18.02 Recitation 6], subtitle: [18.02 Recitation MW9], author: "<NAME>", date: [23 September 2024], ) #quote(attribution: [<NAME>, in Doctor Who])[Run, you clever boy, and remember.] This handout (and any other DLC's I write) are posted at #url("https://web.evanchen.cc/1802.html"). - Optional midterm review, 4-270, Thu 4:30pm-6:30pm. Led by me, Vinjay, and Sebastian. - Please fill out the survey at #url("https://forms.gle/AsXPweCbJ1Nvzp3k7") when you can. - I made a Discord server. If you didn't get the link emailed to you, ask me to join. - Remember that September 30 is the last day to switch sections freely on Canvas. = It's a miracle that multiplication in $CC$ has geometric meaning Let $CC$ denote the set of complex numbers (just as $RR$ denotes the real numbers). It's important that realize that, *until we add in complex multiplication, $CC$ is just an elaborate $RR^2$ cosplay*. #figure( table( columns: 3, align: left, table.header([Concept], [For $RR^2$], [For $CC$]), [Notation], [$bf(v)$], [$z$], [Components], [$vec(x, y)$], [$x + y i$], [Length], [Length $|bf(v)|$], [Abs val $|z|$], [Direction], [(slope, maybe?)], [argument $theta$], [Length $1$], [unit vector], [$e^(i theta) = cos theta + i sin theta$], [Multiply], [_NONE_], [✨ $z_1 z_2$ ✨] ), kind: table ) - All the way back in R01, when I warned you about type safety, I repeatedly stressed you that you *cannot multiply two vectors in $RR^n$ to get another vector*. You had a "dot product", but it spits out a number. (Honestly, you shouldn't think of dot product as a "product"; the name sucks.) - Of course, the classic newbie mistake (which you better not make on your midterm) is to define a product on vectors component-wise: why can't $vec(x_1, dots.v, x_n)$ and $vec(y_1, dots.v, y_n)$ have "product" $vec(x_1 y_1, dots.v, x_n y_n)$? Well, in 18.02, every vector definition needed a corresponding geometric picture for us to consider it worthy of attention (see table at start of `r03.pdf`). This definition has no geometric meaning. - However, there is a big miracle for $CC$. For complex numbers, you can define multiplication by $(a+b i)(c+d i) = (a c - b d) + (a d + b c) i$ and there is _an amazing geometric interpretation_. Unfortunately, AFAIK there is no English word for "complex number whose absolute value is one" (err, CNWAVIO?), the same way there is for "unit vector". For 18.02, we instead use $e^(i theta) := cos theta + i sin theta$ as the "word"; whenever you see $e^(i theta)$, draw it as unit vector $cos theta + i sin theta$. It's worth pointing out the notation $e^(i theta)$ should strike you as _nonsense_. What meaning does it have to raise a number to an imaginary power? Does $i^i$ have a meaning? Does $cos(i)$ have a meaning? (If you want to know, check @i-to-the-i in the post-recitation notes.) But for 18.02, when starting out, I would actually think of the notation $e^(i theta)$ as a _mnemonic_, i.e. a silly way to remember the following result: #thm[ If you multiply two CNWAVIO's, you get the CNWAVIO with the angles added: $ e^(i theta_1) e^(i theta_2) = e^(i (theta_1 + theta_2)) <==> cos (theta_1 + theta_2) + i sin (theta_1 + theta_2) = (cos theta_1 + i sin theta_1) (cos theta_2 + i sin theta_2). $ More generally, multiplying two complex numbers multiplies the norms and adds the angles. ] <miracle> This is IMO the biggest miracle in all of precalculus. Corollary: $e^(i n theta) = (e^(i theta))^n <==> (cos theta + i sin theta)^n = cos(n theta) + i sin(n theta)$, allows taking $n$th roots; Maulik showed $z^2 = 2i$ in class. = Rectangular vs polar Every complex number can be written in either _rectangular form_ ($a+b i$ for $a,b in RR$) or _polar form_ ($r e^(i theta)$). Depending on what you are trying to do, some forms are easier to work with than others. #figure( table( columns: 3, align: left, table.header([Operation], [In rectangular], [In polar]), [$z_1 pm z_2$], [✅ Component-wise like in $RR^2$], [❌ Unless $z_1$ is a real multiple of $z_2$], [$z_1 z_2$], [✅ Expanding], [✅ by @miracle], [$z_1 slash z_2$], [✅ Use $1/(c+d i) = (c - d i) / (c^2+d^2)$ trick then multiply], [✅ by @miracle], [$n$#super[th] root of $z_1$], [❌ Not recommended for $n > 1$], [✅ by @miracle corollary], ), kind: table ) = Recitation problems from official course / 1.: For each of the following points, convert it from Cartesian to polar or vice versa: - $(x , y) = (- sqrt(3) , 1)$ - $(r , theta) = (3 , pi \/ 6)$ - $(x, y) = (- sqrt(6) , - sqrt(2))$ / 2.: Show that $sin (theta) = frac(1, 2 i) (e^(i theta) - e^(- i theta))$ and $cos (theta) = 1 / 2 (e^(i theta) + e^(- i theta))$. Use this to write $(sin (theta))^3$ in terms $sin (3 theta)$ and $sin (theta)$. / 3.: Consider the complex number $f (t) = frac(t + 2 i, 1 - 3 i)$ where $t$ is real. - Find the real and imaginary part of $f (t)$. - Find $overline(f (t))$ and $lr(|f (t)|)^2$. / 4.: Use polar form to find the fourth powers of $2 + 2 i$ and $- 3 + i sqrt(3)$. Graph these numbers and their fourth powers on the complex plane. / 5.: (If you have time) Consider the matrix $A = mat(0, - 1; 1, 0)$. In class, working with real numbers, this had no eigenvectors. But now we can treat it as a matrix with complex number entries. Find complex number eigenvalues for $A$ and for each one, find an eigenvector in $CC^2$, i.e. a two-component vector $vec(z, w)$ where $z$, $w$ are complex numbers. #pagebreak() = Post-recitation notes == The importance of definitions; also $cos(i)$ and $i^i$ (not for exam) <i-to-the-i> When learning mathematics, I believe definitions are actually more important than theorems. A lot of confusion comes from not having been given careful definitions of the objects. (See #url("https://web.evanchen.cc/handouts/NaturalProof/NaturalProof.pdf") for more on that.) So in general any time you are confused about whether an operation is "legal" --- and this is true in all of math, not just 18.02 --- *the first thing to really check whether you have been given a precise definition*. The endless Internet debates on whether $0$ is even or whether $0.999... = 1$ or whether $1/x$ is a continuous function (hint: yes) are all examples of people who don't know the definitions of objects they're dsicussing. === Real exponents, real base With that in mind, let's fix $a > 0$ a positive real number and think about what $a^r$ should mean. #defn[18.100 definition][ - When $n > 0$ is an integer, then $a^n := a times ... times a$, where $a$ is repeated $n$ times. - Then we let $a^(-n) := 1 / a^n$ for each integer $n > 0$. - When $m/n$ is a rational number, $a^(m/n)$ means the unique $b > 0$ such that $a^m = b^n$. (In 18.100, one proves this $b$ is unique and does exist.) - It's less clear what $a^x$ means when $x in RR$, like $x = sqrt(2)$ or $x = pi$. I think usually one takes a limit of rational numbers $q$ close to $x$ and lets $a^x := lim_(q -> x) a^q$. (In 18.100, one proves this limit does in fact exist.) ] <def18100> === Complex exponents, real base But when $z in CC$, what does $a^z$ mean? There's no good way to do this. You likely don't find an answer until 18.112, but I'll tell you now. In 18.100 you will also prove that the Taylor series $ e^x = sum_(k >= 0) r^k / k! $ is correct, where $e := sum_(k >= 0) 1/k!$ is Euler's constant. So then when you start 18.112, we will flip the definition on its head: #defn[18.112 definition][ If $z in CC$, we _define_ $ e^z := sum_(k >= 0) z^k / k!. $ Then for $a > 0$, we let $a^z = e^(z log a)$. ] <def18112> To summarize: in 18.100, we defined exponents in the way you learned in grade school and then proved there was a Taylor series. But in 18.112, you _start_ with the Taylor series and _then_ prove that the rules in grade school you learned still applied. And checking this consistency requires work. Because we threw away @def18100, identities like $ e^(z_1 + z_2) = e^(z_1) e^(z_2) " and " (e^(z_1))^(z_2) = e^(z_1 z_2)$ are no longer "free": they have to be proved rigorously too. (To be fair, they need to be proved in 18.100 too, but there it's comparatively easier.) I think you shouldn't be _surprised_ they're true; we know it's true for $RR$, so it's one heck of a good guess. But you shouldn't take these on faith. At least get your professor to acknowledge they _require_ a (non-obvious) proof, even if you aren't experienced enough to follow the proof yourself yet. Anyway, if we accept this definition, then Euler's formula makes more sense: #thm[Euler][We have $ e^(i theta) = cos theta + i sin theta. $] <euler> The point is that cosine and sine also have a Taylor series that is compatible with definition: #eqn[ $ cos(x) &= 1 - x^2/2! + x^4/4! - x^6/6! + ... \ sin(x) &= x - x^3/3! + x^5/5! - x^7/7! + ... . $ <trig> ] And if you put these together, you can verify @euler, up to some technical issues with infinite sums. I think Maulik even showed this in class: $ cos(theta) + i sin(theta) &= (1 - theta^2 / 2! + theta^4 / 4! - ...) + (theta - theta^3 / 3! + theta^5 / 5! - ...) i \ &= 1 + (theta i) + (theta i)^2 / 2! + (theta i)^3 / 3! + (theta i^4) / 4! + (theta i)^5 / 5! \ &= e^(i theta). $ === Complex exponents, complex base But what about $i^i$? Our @def18112 above only worked for positive real numbers $a > 0$. Here, it turns out you're out of luck. There isn't any way to define $i^i$ in a way that makes internal sense. The problem is that there's no way to take a single log of a complex number, so the analogy with $log a$ breaks down. Put another way: there's no good way to assign a value to $log(i)$, because $e^(i pi slash 2) = e^(5 i pi slash 2) = ...$ are all equal to $i$. You might hear this phrased "complex-valued logarithms are multivalued". You can have some fun with this paradox: $ i &= e^(i pi slash 2) ==> i^i = e^(- pi slash 2) \ i &= e^(5 i pi slash 2) ==> i^i = e^(-5 pi slash 2). $ Yeah, trouble. === Trig functions with complex arguments On the other hand, $cos(i)$ can be defined: use the Taylor series @trig, like we did for $e^z$. To spell it out: #defn[18.112 trig definitions][ If $z$ is a complex number, we define $ cos(z) &:= 1 - z^2/2! + z^4/4! - z^6/6! + ... \ sin(z) &:= z - z^3/3! + z^5/5! - z^7/7! + ... . $ ] <def18112trig> If you do this, then @def18112 implies the following identities are kosher: #prop[ Under @def18112trig, we have the identities $ cos(z) &:= (e^(i z) + e^(-i z)) / 2 \ sin(z) &:= (e^(i z) - e^(-i z)) / (2i). $ ] <reimtrig> #proof[ If you write out $e^(i z) = sum (i z)^k / k!$ and $e^(-i z) = sum (-i z)^k / k!$ and add them, the odd $k$'s cancel out and the even $k$'s don't, which gives you $ e^(i z) + e^(-i z) = 2 - 2 dot z^2/2! + 2 dot z^4/4! - 2 dot z^6/6! + ... . $ So dividing by $2$, we see $cos(z)$ on the right-hand side, as needed. The argument with $sin$ is similar, but this time the even $k$'s cancel and you divide by $2i$ instead. ] So for example, from @reimtrig, we conclude for example that $ cos(i) = (e + 1/e) / 2. $ Strange but true. == The future: what are 18.100 and 18.112 anyway? (not for exam) First I need to tell you what analysis is. When students in USA ask me what analysis is, I sometimes say "calculus but you actually prove things". But that's actually a bit backwards; it turns out that in much parts of the world, there is no topic called "calculus".#footnote[See #url("https://web.evanchen.cc/faq-school.html#S-10").] It would be more accurate to say calculus is analysis with proofs, theorems, and coherent theorem statements deleted, and it only exists in some parts of the world (which is why mathematicians will tend to look down on it). With that out of the way, - 18.100 is real analysis, i.e. analysis of functions over $RR$ - 18.112 is complex analysis, i.e. analysis of functions over $CC$. If you ever take either class, I think the thing to know about them is: #quote(attribution: [<NAME>, in _Real Mathematical Analysis_])[ Complex analysis is the good twin and real analysis is the evil one: beautiful formulas and elegant theorems seem to blossom spontaneously in the complex domain, while toil and pathology rule the reals ] Personally, I think it's insane that MIT uses 18.100 as their "intro to proofs" topic. (This is why 18.100 is a prerequisite for 18.701, abstract algebra, which makes no sense either.) = Exponentiation (for exam) This section is dedicated to $z^n$ and is *on-syllabus for exam*. Specifically, you ought to be able to solve equations like $ z^5 = 243 i$. This section shows you how. In this whole section, you always prefer to work in polar form. So if you get input in rectangular form, you should first convert to rectangular form. Conversely, if the answer is asked for in rectangular form, you should work with polar form anyway, and only convert to rectangular output at the end. == Raising to the $n$th power Before being able to extract $n$th roots, I need to make sure you know how to do $n$th powers. This is easy: $ (r (cos theta + i sin theta))^n = r^n (cos n theta + i sin n theta). $ For example, $ (3 (cos 18 degree + i sin 18 degree))^5 = 243 (cos 90 degree + i sin 90 degree) = 243 i. $ == Extracting $n$th roots If you can run the process in forwards, then you should be able to run the process backwards too. First, I will tell you what the answer looks like: #thm[ Consider solving the equation $z^n = w$, where $w$ is a given nonzero complex number, for $z$. Then you should always output exactly $n$ answers. Those $n$ answers all have magnitude $|w|^(1/n)$ and arguments spaced apart by $(360 degree) / n$. ] I think it's most illustrative if I show you the five answers to $ z^5 = 243 i $ to start. Again, first we want to convert everything to polar coordinates: $ z^5 = 243 i = 243 (cos 90 degree + i sin 90 degree). $ At this point, we know that if $|z^5| = 243$, then $|z| = 3$; all the answers should have absolute $3$. So the idea is to find the angles. Here are the five answers: $ z_1 = 3 (cos 18 degree + i sin 18 degree) ==> (z_1)^5 &= 243 (cos 90 degree + i sin 90 degree) \ z_2 = 3 (cos 90 degree + i sin 90 degree) ==> (z_2)^5 &= 243 (cos 450 degree + i sin 450 degree) \ z_3 = 3 (cos 162 degree + i sin 162 degree) ==> (z_3)^5 &= 243 (cos 810 degree + i sin 810 degree) \ z_4 = 3 (cos 234 degree + i sin 234 degree) ==> (z_4)^5 &= 243 (cos 1170 degree + i sin 1170 degree) \ z_5 = 3 (cos 306 degree + i sin 306 degree) ==> (z_5)^5 &= 243 (cos 1530 degree + i sin 1530 degree). $ Here's a picture of the five numbers: #figure( image("figures/r06-circle.png", width: 80%), caption: [The five answers to $z^5 = 243 i$, each of length $3$.], ) On the right column, all the numbers are equal. Notice something interesting happening on the right-hand side. The numbers $cos 90 degree + i sin 90 degree$ and $cos 450 degree + i sin 450 degree$, etc. are all the same number; if you draw them in the plane, they'll point to the same thing. However, they give five _different_ answers on the left. But if you continue the pattern one more, you start getting a cycle $ z_6 = 3 (cos 378 degree + i sin 378 degree) ==> (z_6)^5 &= 243 (cos 1890 degree + i sin 1890 degree). $ This doesn't give you a new answer, because $z_6 = z_1$. In general, if $w$ has argument $theta$, then the arguments of $z$ satisfying $z^n = w$ start at $theta / n$ and then go up in increments of $(360 degree) / n$. (For example, they started at $(90 degree) / 5 = 18 degree$ for answers to $z^5 = 243 i$.) So you can describe the general recipe as: #recipe(title: [Recipe for $n$th roots])[ 1. Convert $w$ to polar form; say it has angle $theta$. 2. One of the $n$ answers will be $|w|^(1/n) (cos theta / n + i sin theta / n)$. 3. The other $n-1$ answers are obtained by increasing the angle in increments of $(360 degree) / n$. ] - *Example 1*: Solve $z^5 = 243 i$. *Answer 1*: we first convert to polar form as $ 243 i = 243 (cos 90 degree + i sin 90 degree) $ and see that $243^(1/5) = 3$, and $theta = 90 degree$. The first angle is $theta / 5 = 18 degree$. So the five answers are $ z_1 &= 3 (cos 18 degree + i sin 18 degree) \ z_2 &= 3 (cos 90 degree + i sin 90 degree) \ z_3 &= 3 (cos 162 degree + i sin 162 degree) \ z_4 &= 3 (cos 234 degree + i sin 234 degree) \ z_5 &= 3 (cos 306 degree + i sin 306 degree). $ (As it happens, $z_2 = 3i$, which is easy to check by hand works.) - *Example 2*: Solve $z^4 = 8 + 8 sqrt(3) i$. *Answer 2*: We first convert to polar form as $ 8 + 8 sqrt(3) i = 16 (cos 60 degree + i sin 60 degree) $ and see that $16^(1/4) = 2$, and $theta = 60 degree$. The first angle is $theta / 4 = 15 degree$. So the four answers are $ z_1 &= 2 (cos 15 degree + i sin 15 degree) \ z_2 &= 2 (cos 105 degree + i sin 105 degree) \ z_3 &= 2 (cos 195 degree + i sin 195 degree) \ z_4 &= 2 (cos 285 degree + i sin 285 degree). $ - *Example 3*: Solve $z^3 = -1000$. *Answer 3*: We first convert to polar form as $ -1000 = 1000 (cos 180 degree + i sin 180 degree) $ and see that $1000^(1/3) = 10$, and $theta = 180 degree$. The first angle is $theta / 3 = 60 degree$. So the three answers are $ z_1 &= 10 (cos 60 degree + i sin 60 degree) \ z_2 &= 10 (cos 180 degree + i sin 180 degree) \ z_3 &= 10 (cos 300 degree + i sin 300 degree). $ (As it happens, $z_2 = -10$, as expected, since $(-10)^3 = -1000$.)
https://github.com/Trebor-Huang/HomotopyHistory
https://raw.githubusercontent.com/Trebor-Huang/HomotopyHistory/main/paper.typ
typst
#set page(paper: "iso-b5", margin: 1in) #set text(font: ("New Computer Modern", "Source Han Serif SC"), size: 12pt, weight: 400) #set par(justify: true, leading: 0.9em) #show heading.where(level: 1): it => ( pagebreak(to: "odd") + block(width: 100%, below: 1.8em)[ #set align(center) #set text(24pt) #it.body]) #show heading.where(level: 2): it => ( v(10pt) + block(width: 100%, above: 1.3em, below: 1.5em)[ #set align(center) #set text(15pt) #it.body]) #show heading.where(level: 3): it => ( v(8pt) + block(width: 100%, above: 1em, below: 1em)[ #set text(13pt) #it.body]) // Title page #include("frontpage.typ") // Contents #set page(numbering: "i") #counter(page).update(1) #show outline.entry.where( level: 1 ): it => { block(breakable: false)[ #line(length: 101%, stroke: 0.7pt) #v(-0.6em) #place(line( start: (0cm, -0.61em), end: (0cm, 1.2em), stroke: 0.7pt )) #h(0.4em) #strong(it, delta: 200) ] v(-1.7em) } #outline(title: "目录", fill: none, depth: 2, indent: 1em) #[ #v(1fr)#h(1fr) 由 #link("https://typst.app/")[#underline[Typst]] 排版. ] // Main matter #set par(first-line-indent: 2em) #show par: set block(spacing: 1.6em) #set page(numbering: "1") #counter(page).update(1) #show heading: it => { it v(-1.5em) par()[#text(size:0em)[#h(0.0em)]] } #include("intro.typ") #include("beginnings.typ") #include("algtop.typ") #include("homology.typ") #include("category.typ") #include("infcat.typ") #include("prospect.typ") #bibliography(title: "参考文献", "references.bib")
https://github.com/paugarcia32/CV
https://raw.githubusercontent.com/paugarcia32/CV/main/modules/personalSummary.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Personal Summary") Graduated in Network Engineering from the UPC of Castelldefels, with a solid background in IoT and cybersecurity. Passionate about technology and always willing to learn, I seek to contribute my knowledge and enthusiasm to innovative and challenging projects.
https://github.com/Slyde-R/not-jku-thesis-template
https://raw.githubusercontent.com/Slyde-R/not-jku-thesis-template/main/template/utils.typ
typst
MIT No Attribution
#let inwriting = true #let draft = true #assert(not(inwriting and not(draft)), message: "If inwriting is true, draft should be true as well.") #let todo(it) = [ #if inwriting [ #text(size: 0.8em)[#emoji.pencil] #text(it, fill: red, weight: 600) ] ] #let silentheading(level, body) = [ #heading(outlined: false, level: level, numbering: none, bookmarked: true)[#body] ] #let in-outline = state("in-outline", false) #let flex-caption-styles = rest => { show outline: it => { in-outline.update(true) it in-outline.update(false) } rest } #let flex-caption(long, short) = ( context ( if in-outline.get() { short } else { long } ) )
https://github.com/ntjess/typst-invoice-template
https://raw.githubusercontent.com/ntjess/typst-invoice-template/main/template.typ
typst
Apache License 2.0
#import "@preview/tablex:0.0.4": tablex, cellx, rowspanx #let default-currency = state("currency-state", "$") #let default-hundreds-separator = state("separator-state", ",") #let default-decimal = state("decimal-state", ".") #let date-to-str(date, format: "[day padding:none] [month repr:long] [year]") = { if type(date) == "string" { let pieces = date.split("-").map(int) date = datetime(year: pieces.at(0), month: pieces.at(1), day: pieces.at(2)) } let to-format = if date == none { datetime.today() } else { date } if type(to-format) == "datetime" { to-format.display(format) } else { to-format } } #let check-dict-keys(dict, ..keys) = { assert(type(dict) == "dictionary", message: "dict must be a dictionary") for key in keys.pos() { assert(key in dict, message: "dict must contain key: " + repr(key)) } } #let format-company-info(info, title: none) = [ #check-dict-keys(info, "company-name", "address", "name", "email", "phone") #title\ #info.company-name\ #info.address Attn: #info.name\ #link("mailto:" + info.email)\ #info.phone ] #let format-doc-info(info) = [ #check-dict-keys(info, "title", "id", "date") #text(size: 2.75em, weight: "extrabold")[#info.title] #v(-2em) ID: #info.id\ Date: #date-to-str(info.date) #if "valid-through" in info [ #linebreak() Valid through #date-to-str(info.valid-through) ] ] #let format-frontmatter(preparer-info, client-info, doc-info) = [ #grid(columns: 2, column-gutter: 1fr)[ #format-doc-info(doc-info) ][ #set align(bottom) #doc-info.at("logo", default: none) ] #line(length: 100%) #v(1em) #grid(columns: 2, column-gutter: 1fr)[ #format-company-info(client-info, title: [*TO:*]) ][ #format-company-info(preparer-info, title: [*FROM:*]) ] #v(1em) ] #let format-payment-info(payment-info) = { check-dict-keys(payment-info, "payment-window", "account-details") [ #v(1em) *Due within #payment-info.payment-window days of receipt.* #payment-info.account-details ] } #let price-formatter(number, currency: auto, separator: auto, decimal: auto, digits: 2) ={ // Adds commas after each 3 digits to make // pricing more readable if currency == auto { currency = default-currency.display() } if separator == auto { separator = default-hundreds-separator.display() } if decimal == auto { decimal = default-decimal.display() } let integer-portion = str(calc.abs(calc.trunc(number))) let num-length = integer-portion.len() let num-with-commas = "" for ii in range(num-length) { if calc.rem(ii, 3) == 0 and ii > 0 { num-with-commas = separator + num-with-commas } num-with-commas = integer-portion.at(-ii - 1) + num-with-commas } // Another "round" is needed to offset float imprecision let fraction = calc.round(calc.fract(number), digits: digits + 1) let fraction-int = calc.round(fraction * calc.pow(10, digits)) if fraction-int == 0 { fraction-int = "" } else { fraction-int = decimal + str(fraction-int) } let formatted = currency + num-with-commas + fraction-int if number < 0 { formatted = "(" + formatted + ")" } formatted } #let c(body, ..args) = cellx(inset: 1.25em, ..args, text(weight: "bold", body)) #let total-bill(amount) = { grid(columns: (auto, auto))[ ][ #tablex( columns: (auto, auto), align: (auto, right), auto-vlines: false, c[TOTAL], c[#price-formatter(amount)], ) ] } #let _format-charge-value(value, info, row-total, row-number) = { // TODO: Account for other helpful types like datetime if value == none { return (value, row-total, false) } let typ = info.at("type") let did-multiply = false if typ not in ("string", "index") { let multiplier = value if info.at("negative", default: false) { multiplier *= -1 } if typ == "percent" { multiplier = 1 + multiplier/100 } if row-total == none { row-total = 1 } row-total *= multiplier did-multiply = true } let out-value = value if typ == "currency" { out-value = price-formatter(value) } else if typ == "percent" { out-value = value } else if typ == "string" { out-value = eval(value, mode: "markup") } else if typ == "index" and value == "" { out-value = row-number } if "suffix" in info { out-value = [#out-value#info.at("suffix")] } (out-value, row-total, did-multiply) } #let _format-charge-columns(charge-info) = { let get-eval(dict, key, default) = { let value = dict.at(key, default: default) if type(value) == "string" { eval(value) } else { value } } let (names, aligns, widths) = ((), (), ()) for (key, info) in charge-info.pairs() { key = upper(key.at(0)) + key.slice(1) names.push(c(key)) let default-align = if info.at("type") == "string" { left } else { right } aligns.push(get-eval(info, "align", default-align)) widths.push(get-eval(info, "width", auto)) } // Keys correspodn to tablex specs other than "names" which is positional (names: names, align: aligns, columns: widths) } #let bill-table(..items, charge-info: auto) = { if charge-info == auto { charge-info = (:) } if items.pos().len() == 0 { return (table: none, amount: 0) } let out = () let total-amount = 0 let columns = () // A separate "Total" column is only needed if there are >1 multipliers let has-multiplier = false let found-infos = (:) // Initial scan finds all possible fields, and whether a "total" // field is needed for item in items.pos() { let mult-count = 0 for (key, value) in item.pairs() { if key not in charge-info { let fallback = (type: type(value)) charge-info.insert(key, fallback) } found-infos.insert(key, charge-info.at(key)) let (_, _, did-multiply) = _format-charge-value(value, charge-info.at(key), 0, 0) if did-multiply { mult-count += 1 } has-multiplier = has-multiplier or mult-count > 1 } } // Now that all needed keys are guaranteed to exist, we can start to format output values for (ii, item) in items.pos().enumerate() { let row-number = ii + 1 let row-total = none for (key, info) in found-infos.pairs() { let default-value = info.at("default", default: none) let value = item.at(key, default: default-value) let (display-value, new-row-total, _) = _format-charge-value( value, info, row-total, row-number ) out.push(display-value) row-total = new-row-total } if row-total == none { row-total = 0 } if has-multiplier { out.push(price-formatter(row-total)) } total-amount += row-total } if has-multiplier { found-infos.insert("total", (type: "currency")) } let col-spec = _format-charge-columns(found-infos) let names = col-spec.remove("names") let tbl = tablex( ..col-spec, auto-vlines: false, inset: 1em, ..names, ..out, ) (table: tbl, amount: total-amount) } #let invoice( body, preparer-info: none, client-info: none, payment-info: none, doc-info: none, apply-default-style: true, ) = { set text(font: "Arial", hyphenate: false) if apply-default-style set page(paper: "us-letter", margin: 0.8in, number-align: top + right) if apply-default-style // conditional "set" rules are tricky due to scoping show link: content => { if apply-default-style { set text(fill: blue.darken(20%)) underline(content) } else { content } } let frontmatter = format-frontmatter(preparer-info, client-info, doc-info) frontmatter body if payment-info != none { format-payment-info(payment-info) } } #let create-bill-tables(headings-and-charges, charge-info: auto, price-locale: (:)) = { if "currency" in price-locale { default-currency.update(price-locale.at("currency")) } if "separator" in price-locale { default-hundreds-separator.update(price-locale.at("separator")) } if "decimal" in price-locale { default-decimal.update(price-locale.at("decimal")) } let needs-heading = headings-and-charges.len() > 1 let running-total = 0 for (key, charge-list) in headings-and-charges.pairs() { if needs-heading { [= #key] } let bill = bill-table(..charge-list, charge-info: charge-info) bill.table running-total += bill.amount } h(1fr) set align(right) if not needs-heading total-bill(running-total) } #let remove-or-default(dict, key, default) = { // Self assignment allows mutability let dict = dict if key in dict { let value = dict.remove(key) (dict, value) } else { (dict, default) } } #let invoice-from-metadata(metadata-dict, pre-table-body: [], ..extra-invoice-args) = { let meta = metadata-dict let charges = (:) for key in meta.keys() { if lower(key).ends-with("charges") { let opts = meta.remove(key) charges.insert(key, opts) } } let (meta, info) = remove-or-default(meta, "charge-info", auto) let (meta, price-locale) = remove-or-default(meta, "locale", ()) show: invoice.with(..meta, ..extra-invoice-args) pre-table-body create-bill-tables(charges, charge-info: info, price-locale: price-locale) }
https://github.com/crd2333/crd2333.github.io
https://raw.githubusercontent.com/crd2333/crd2333.github.io/main/src/docs/AI/Reconstruction/Reconstruction.typ
typst
#import "/src/components/TypstTemplate/lib.typ": * #show: project.with( title: "Reconstruction", lang: "zh", ) #let SDF = math.text("SDF") #let clamp = math.text("clamp") #let Occupancy = math.text("Occupancy") #let NeRF = math.text("NeRF") = Implicit Neural Representations == 简单引入 - 参考 + #link("https://github.com/vsitzmann/awesome-implicit-representations")[github.com/vsitzmann/awesome-implicit-representations] + #link("https://blog.csdn.net/weixin_43117620/article/details/131980822")[浅谈3D隐式表示(SDF, Occupancy field, NeRF)] + #link("https://blog.csdn.net/weixin_42145554/article/details/126637671")[概述:隐式神经表示(Implicit Neural Representations, INRs)] + #link("https://zhuanlan.zhihu.com/p/156625765")[SIREN: 使用周期激活函数做神经网络表征] - 三维空间的表示形式可以分为显式和隐式 - 比较常用的显式表示比如体素 Voxel,点云 Point Cloud,三角面片 Mesh 等 #fig("/public/assets/AI/Reconstruction/2024-10-10-16-02-46.png", width: 60%) - 隐式神经表示(Implicit Neural Representations, INRs)是一种对各种信号进行参数化的新方法。传统的信号表示通常是离散的,而隐式神经表示将信号参数化为一个连续函数、场,将信号的域映射到该坐标上的属性的值,这些映射通常不是解析性的,但可以被神经网络所拟合 - 显式 vs 隐式 + 隐式的优点在于:表示不再与空间分辨率相耦合、表征能力更强、泛化性高、相对易于学习、空间需求一般相对较小; + 缺点在于:需要后处理、可能过度平滑、计算量大 - 隐式神经表示的应用领域包括:超分辨率、新视角合成、三维重建等 - 比较常用的隐式表示有:符号距离函数 Signed Distance Funciton(SDF),占用场 Occupancy Field,神经辐射场 Neural Radiance Field(NeRF) 等 - 这些函数 function 与场 field 实际上都是一种映射关系, $ SDF(p) = s, ~~~ x in RR^3, s in RR \ Occupancy(p) = o, ~~~ x in RR^3, o in [0, 1] \ NeRF(x,y,z,bd) = (R,G,B,sigma), ~~~ x,y,z in RR, "RGB is color, " sigma "is density" $ + SDF: 点在曲面内部则规定距离为负值,点在曲面外部则规定距离为正值,点在曲面上则距离为 $0$ #hide[#link("https://zhuanlan.zhihu.com/p/536530019")[SDF(signed distance field)]] + Occupancy: 通常以 $0.5$ 为标准,大于 $0.5$ 倾向于认为点被曲面占用(在内部),$0.5$ 倾向于认为点没有被曲面占用,$0.5$ 认为点在曲面上(即 $F(p)=0.5$ 表示一个曲面) + NeRF: 将“空间中的点 + 点发出的一条射线” 映射到 “点的密度值 + 射线的方向对应的颜色值”;或者说,空间中每一个点的每一个角度,都对应一个颜色值和一个透明度。反过来,从空间中一个点出发,沿着某个方向看去,看到这个方向上的颜色和透明度 == Literature Tree - 可以先从 #link("http://crd2333.github.io/note/Reading/Reconstruction/SIREN")[SIREN(笔记链接)] 和 #link("http://crd2333.github.io/note/Reading/Reconstruction/DeepSDF")[DeepSDF] 开始看 - 然后再看相对近代和比较重要的 #link("http://crd2333.github.io/note/Reading/Reconstruction/NeRF")[NeRF] 及其 #link("http://crd2333.github.io/note/Reading/Reconstruction/NeRF改进工作")[改进工作] - NeRF 本质上是用神经网络拟合一个隐式表示场,结合了 Ray-Marching 和体渲染的方法实现新视角图片的合成 - NeRF 的待改进点在于:速度优化,泛化性,动态场景与大场景,可解释性,视角需求数等 - NeRF 的改进工作 - 关于 NeRF 的改进,核心在于提高渲染速度和质量。它慢就慢在两点:逐像素射线并采样点,点的分布不合理;每个点都需要过一遍 MLP 以得到辐射场属性 - NSVF 从采样的角度出发试图解决问题; - FastNeRF, PlenOctrees, KiloNeRF, TensoRF 等工作五花八门,但本质上都还是利用体素化的方法往显式表示那边靠,减少 MLP 前向的时间开销。其中 Plenoxels 是比较激进的一个,变成了完全显式的方法(只是借用了 NeRF 的体渲染方法和辐射场属性);而 DVGO, InstantNGP 等 Hybrid 的方法结合了显式和隐式的优势,实现了更快的渲染速度 - MobileNeRF 在体素网格的基础上,把体渲染过程塞到图形渲染 pipeline 里,首次实现了移动设备上的实时渲染 - 关于 NeRF 的泛化性改进,我看的两篇 GRAF, GIRAFFE 利用 GAN 和额外随机采样的编码来一定程度上变得多样 - 关于 NeRF 的大场景渲染问题,NeRF++, Mip-NeRF, Mip-NeRF 360 的思路基本上是要么用非线性变换控制场景的采样频率,要么是把光线渲染变成光锥渲染(本质上也是控制了采样频率) - 最后是基本薄纱 NeRF 的 #link("http://crd2333.github.io/note/Reading/Reconstruction/3DGS")[3DGS] - 3DGS 本质上是又回到了显式表示(3D 高斯球),使用 splatting 代替体渲染方法,实现高速渲染 - 围绕 3DGS 的工作就没有那么 focus on 速度,而是变得五花八门,并且把之前 NeRF 上做过的各种应用都拿过来刷了一遍,但是看得还不多 - 最后,用一张 NeRF 阵营图做结,不得不说总结得确实很有意思也挺有道理 #fig("/public/assets/AI/Reconstruction/2024-10-24-15-21-18.png")
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/brainstorm-intake.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: "Brainstorm: Intake", type: "brainstorm", date: datetime(year: 2023, month: 8, day: 4), author: "<NAME>", witness: "<NAME>", ) = Options We decided on three different types of intake #grid( columns: (1fr, 2fr), gutter: 20pt, [ == Claw This design uses a pneumatically activated claw to grab the triballs. It has passive flex wheels on the end to increase its compression and grip on the triballs. #pro-con(pros: [ - Uses pneumatics instead of motors ], cons: [ - Very slow - Can run out of air ]) ], image("/assets/intakes/claw.svg"), [ == Flex Wheels This design uses a top down roller intake design, with flex wheels as the rollers. #pro-con(pros: [ - Compresses ], cons: [ - Needs motors ]) ], image("/assets/intakes/flex-wheels.svg"), [ == Sprockets and Rubber Bands This design uses a top down roller intake design, and has sprockets connected by rubber bands as rollers. #pro-con(pros: [ - Compresses a lot ], cons: [ - Needs motors ]) ], image("/assets/intakes/sprockets.svg"), )
https://github.com/FlyinPancake/bsc-thesis
https://raw.githubusercontent.com/FlyinPancake/bsc-thesis/main/thesis/pages/chapters/chapter_3_planning.typ
typst
= Measurement Planning My work is focused on the performance of the virtual cluster. How can the performance of the virtual cluster be defined? What are the metrics that should be measured? The performance of the virtual cluster can be defined as the performance of the applications running on the virtual cluster, as well as the performance of the virtual cluster's control plane. === Performance of the Applications Our testing will focus on applications that are often used in the cloud. These applications are PostgreSQL and Apache Kafka. These applications are often deployed in the cloud, and are used by many companies. Both applications are open-source, and have a large community of users and contributors. PostgreSQL has a companion application called `pgbench` #cite(<pgbench>), which is a benchmarking tool for PostgreSQL. For Kafka, there is no such tool, so one had to be created. === Performance of the Control Plane Virtual clusters are realized by a virtual control plane and a syncer #cite(<vcluster>). The virtual control plane is wholly responsible for the performance of "high-level" resources, such as Deployments, @crd[s], etc. These resources' performance can be compared to the performance of the same resources in a conventional Kubernetes cluster. The syncer is responsible for the performance of "low-level" resources, such as Pods, Containers, etc. These resources exist both in the virtual cluster and in the host cluster. To measure the performance overhead of the syncer, we need to compare the performance of the same resources in the virtual cluster and in the host cluster. === Metrics The metrics that should be measured vary between the applications. For PostgreSQL, I went over the documentation of `pgbench` and used the metrics that `pgbench` provides. I also measured the CPU and memory usage of the PostgreSQL pods inside the virtual cluster and in the host cluster. I parsed the events of the PostgreSQL pods to measure the time it took for the pods to start. == Testing environment The testing environment consists of three virtual machines. These virtual machines make up a Kubernetes cluster. Two of the virtual machines are worker nodes, these nodes run the applications that are being tested. They have 32 cores and 64GB of RAM each. The third system is the controller node, this node runs the control plane. It has 16 cores and 32GB of RAM. All the virtual machines run Ubuntu 22.04, run on OpenStack, and have AMD EPYC Rome CPUs. This setup represents a small private cloud cluster. The Kubernetes distribution that is used is `k3s` #cite(<k3s>), the same which is the default Kubernetes controller backing `vcluster` #cite(<vcluster>). Each machine has a single boot disk. The boot disk is a 160GB volume, which is more than enough for the operating system and the applications that are being tested. The boot disk is an SSD volume, which is the recommended volume type for boot disks in OpenStack. For use with @persistentvolume[s], the storage goes trough longhorn #cite(<longhorn>), which is a distributed block storage solution for Kubernetes. Longhorn uses the boot disks as storage, so the boot disks are also used for the @persistentvolume[s]. == Benchmarking PostgreSQL with `pgbench` <pgbench-sec> Benchmarking PostgreSQL is done using `pgbench` #cite(<pgbench>). It runs a predefined set of commands on a PostgreSQL database and returns the most important metrics to the user. To use `pgbench` to benchmark PostgreSQL, we need to determine the size of the test database. `pgbench` has an initialization mode, which creates the test data. It accepts a parameter called `scale`, which determines the size of the test data. the default value is 1. When the value of `scale` is 1, the test database's structure is as follows in #ref(<pgbench-scale-1>). #figure(caption: [The contents of the test database when `scale` is $1$])[ #table( columns: (auto, auto), align: (x, y) => (left, right).at(x), inset: 0.5em, [*Table name*], [*Number of rows*], [`pgbench_branches`], [$1$], [`pgbench_tellers`], [$10$], [`pgbench_accounts`], [$100000$], [`pgbench_history`], [$0$], ) ] <pgbench-scale-1> To simulate a larger PostgreSQL database, `pgbench`'s initialization mode can be utlilized to create a database with $100$ times more data. PostgreSQL can be hosted from a single node, but in production, it is always advised to use a cluster of PostgreSQL nodes. The most basic production-ready cluster is a cluster of $3$ nodes. We can see this in @postgres-cluster. These nodes are not simply PostgreSQL pods, but rather a main pod and $2$ replica pods. The data replication is not done by Kubernetes, but rather by PostgreSQL itself, using the streaming replication feature #cite(<postgres-replication>). We cannot commit changes to the replica pods, but we can read from them, so they can be useful as read-only databases too beside redundancy. If the main pod fails for any reason, one of the replica pods can be promoted to become the main pod. #figure(caption: [PostgreSQL cluster with a main pod and two replica pods])[ #image("../../figures/postgres-cluster.excalidraw.svg", width: 80%) ] <postgres-cluster> By default, `pgbench` runs @rw commands, but `pgbench` has @ro mode as well. This means that we can run the read-only commands on the replica pods, and the read-write commands on the main pod. The output of `pgbench` contains the following metrics: - @tps - The average latency of a transaction - The initial latency of the connection The output includes the relevant configuration arguments of `pgbench`, such as the number of clients, the number of threads, and the scaling factor of the test database. === Performance Analysis <pgbench-performance-analysis> Through the application of scaling, we can effectively emulate a larger database. Leveraging this scaling factor, we intend to assess the performance of PostgreSQL under varying conditions, including different scaling factors and numbers of clients. The selected scale values for our evaluations are $10$, $20$, $50$, $100$, and $200$. This choice is grounded in the practical consideration that larger scales would surpass the resource constraints of our system, resulting in impractical completion times. It is essential to note that the number of transactions will consistently be set to 1000. Furthermore, the number of clients will be established as $"scaling_factor / 10"$. This parameter holds significance, as setting it excessively high could overwhelm the system. Conventionally, the number of clients scales in tandem with the size of the database. In our testing environment, we are running separate worker and controller nodes, so we will be able to measure the performance unobstructed by `pgbench`'s own resource usage, as we will are running the database cluster on the worker nodes, and `pgbench` on the controller node. == Apache Kafka Performance <kafka-sec> At a high level, Kafka necessitates similar resources to PostgreSQL. However, its distinct emphasis on low latency sets it apart from PostgreSQL in terms of operational priorities. === Benchmarking Kafka Given Kafka's predominant use in diverse production environments, each use case entails unique configurations, rendering the creation of a generic benchmarking tool challenging. Unlike PostgreSQL, which has a general benchmarking tool, `pgbench`, Kafka lacks a comparable standardized benchmarking tool. Consequently, a custom tool, named `kafka-benchmark`, was developed for this purpose. Initially, the plan was to implement a Python script for producing and consuming Kafka messages. However, the performance of this script would have proven unsatisfactory, prompting a shift to the development of the benchmarking tool in Rust#cite(<rust>). The kafka-benchmark tool leverages the `librdkafka`#cite(<librdkafka>) C/C++ library through the `rdkafka`#cite(<rust-rdkafka>) crate#footnote[In the context of Rust programs, libraries and packages are referred to as crates] to interface with Kafka. By doing so, it capitalizes on the performance and features provided by librdkafka, while the Rust language ensures correctness and reliability for the benchmarking tool. Rust is a systems programming language, which is designed for performance and reliability. It differs from popular languages such as C and C++ in that it is memory safe by default, and from languages such as Java and Go in that it does not have a garbage collector. Having no garbage collector means that Rust does not iterfere with the application's execution to free up memory. Combining these two aspects, Rust makes for an outstanding choice for our benchmarking tool to be written in. These characteristics are crucially important for benchmarking, as any bechmarking tool should not interfere with the application's execution, otherwise the results would be not be accurate. // #figure(caption: [Architecture of the Kafka cluster])[ // #image("/figures/kafka-cluster.excalidraw.svg") // ] <kafka-cluster> === Kafka Custer Our Kafka cluster consists of three nodes for both Kafka and ZooKeeper. ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services#cite(<zookeeper>). This differs from the PostgreSQL cluster depicted in @postgres-cluster, where we had a main pod and replicas, as neither Kafka nor ZooKeeper have a main pod. They were initially designed to be a distributed system, so they are inherently behave as such. Kafka and ZooKeeper are both stateful applications, so they require @persistentvolume[s]. The Kafka cluster is deployed using the Strimzi#cite(<strimzi>) operator. === Performance Analysis Our analysis is concerned with the latency of Kafka. We measure the end-to-end latency in the conventional Kubernetes cluster, as well as the latency in the virtual cluster. During the testing, we use different numbers of clients, and different message sizes. The test parameters are presented in @kafka-test-parameters. We take all of the possible triplets of the test values, and we run tests for each of them. #figure(caption: [The test parameters for Kafka])[ #table( columns: (auto, auto), align: (x, y) => (left, right).at(x), inset: 0.5em, [*Producers*], [1,3,5], [*Consumers*], [1,3,5], [*Message Size*], [100 B, 1kB], ) ] <kafka-test-parameters> Each test will run for $300$ seconds and will be repeaterd $3$ times. We measure the latency of every message (after a warm-up period), and then we use HdrHistrogram@hdrhistogram to aggregate the latencies. We record the mean, the 50th percentile, the 90th percentile and the 99th percentile. We will then compare the latencies across the different tests. We expect the latency to be higher or equal in the virtual cluster. Due to the nature of this test, we might see some outliers in the latency measurements. == Functionality Testing -- CRD coflict <crd-conflict-planning> As indicated in the context of @version-conflict-sec, version conflicts may arise when attempting to apply two distinct versions of the same @crd to a shared cluster. Such situations can materialize when two different applications rely on the same @crd, albeit with incompatible versions. While this is typically not problematic, as the majority of @crd[s] are scoped to a specific namespace, challenges may arise when the relevant @crd is designated as cluster-scoped. As outlined in @vcluster-version-conflict-sec, it appears that vcluster possesses the capability to address such conflicts by segregating conflicting applications into distinct virtual clusters. This functionality however, has not been formally documented nor verified. Our objective is to confirm the presence and effectiveness of this functionality through producing a proof of concept. Our proof of concept consist of two distinct @crd[s], each with conflicting versions. We attempt to apply both @crd[s] to a shared cluster, and observe the resulting behavior. Then we repeat this process with the same @crd[s] applied to separate virtual clusters, and observe the resulting behavior. The results are then compared, and we determine whether the virtual cluster approach is effective in addressing version conflicts. In @test-crd we can observe the important metadata and spec fields of the @crd which will be used for testing. #figure([ ```yaml metadata: name: pdfdocument.k8s.palvolgyid.tmit.bme.hu spec: scope: Cluster versions: - name: v1 # or v2 ``` ], caption: [The contents of the test @crd]) <test-crd> With a conventional Kubernetes cluster, we expect the cluster to apply the first @crd, and then reject the second @crd, due to it not supporting `v1`. With multiple vclusters, we expect both clusters to apply their @crd[s]. We will then verify the presence of both @crd[s] in the cluster, and confirm that they are indeed separate versions. This test will not be concerned with the functionality of the @crd[s] themselves, as there is no backing controller for them, but rather with the behavior of the cluster when presented with conflicting @crd[s]. As such, we will not be testing the functionality of the @crd[s] themselves, but rather the behavior of the cluster when presented with conflicting @crd[s].
https://github.com/mem-courses/calculus
https://raw.githubusercontent.com/mem-courses/calculus/main/homework-1/calculus-homework3.typ
typst
#import "../template.typ": * #show: project.with( title: "Calculus Homework #3", authors: (( name: "<NAME> (#47)", email: "<EMAIL>", phone: "3230104585" ),), date: "October 18, 2023", ) = P53 习题1-3 1(1) #prob[按定义证明:$ lim_(x->1)(3x-1)=2 $] 任给 $eps>0$,要求 $|(3x-1)-2|<eps <=> |x-1|<display(eps/3)$.只需取 $delta=display(eps/3)$,那么对于任意 $|x-1|<delta$,都有 $|(3x-1)-2|<eps$ 成立,得证. = P53 习题1-3 1(4) #prob[按定义证明:$ lim_(x->+oo)1/2^x=0 $] 任给 $eps>0$,要求 $display(|1/2^x|<eps <=> 2^(-x)<eps)$.取 $delta=-ln(eps)+1$,那么对于任意 $x>delta$,都有: $ 1/2^x<1/2^delta=1/2^(-ln(eps)+1)=eps/2<eps $ 成立,得证. = P54 习题1-3 3 #prob[研究 $f(x) = display(cases(x\,quad&x<1,x^2+1\,quad&x>=1))$ 在 $x=1$ 处的极限.] $ lim_(x->1^-) f(x) = 1\ lim_(x->1^+) f(x) = 1^1+1=2 $ 因为 $display(lim_(x->1^-) f(x) != lim_(x->1^+) f(x))$,所以 $f(x)$ 在 $x=1$ 处的极限不存在. = P54 习题1-3 4 #prob[若 $f(x) = display(cases(x+a\,quad&x<0,x^3+2\,quad&x>=0))$ 在 $x=0$ 处的极限存在,求常数 $a$.] 要使 $f(x)$ 在 $x=0$ 处的极限存在,有 $display(lim_(x->0^-) f(x) = lim_(x->0^+) f(x))$,可得 $a=2$. = P54 习题1-3 5(3) #prob[证明极限不存在:$ lim_(x->-oo)x sin x $] 对于任意 $x_0=-(2k+1)pi space(k in ZZ_(>0))$,都存在 $x=-(2k+3)pi$,满足 $x<x_0$ 且 $ x sin x = x < x_0 = x_0 sin x_0 $ 故 $x sin x$ 在 $x->-oo$ 时无界,不存在极限. = P54 习题1-3 5(4) #prob[证明极限不存在:$ lim_(x->0)e^(1/x) $] 对于任意 $x_0>0$,都存在 $display(x=x_0/(1+x_0))$,满足 $0<x<x_0$ 且 $ e^(1/x) = e^(1/x_0 + 1) = e dot e^(1/x_0) > e^(1/x_0) $ 故 $e^(1/x)$ 在 $x->0^+$ 时无界,不存在极限. = P54 习题1-3 8(2) #prob[利用极限性质求极限:$ lim_(x->0)((1+x)^5-(1+5x))/(x^2+x^5) $] $ lim_(x->0)((1+x)^5-(1+5x))/(x^2+x^5) &= lim_(x->0)(x^2(10+10x+5x^2+x^3))/(x^2(1+x^3)) = lim_(x->0)(10+10x+5x^2+x^3)/(1+x^3) = 10 $ = P54 习题1-3 8(4) #prob[利用极限性质求极限:$ lim_(x->oo)((2x-3)^20 (3x+2)^30)/((2x+1)^50) $] $ lim_(x->oo)((2x-3)^20 (3x+2)^30)/((2x+1)^50) = (lim_(x->oo)(2x-3)/(2x+1))^20 (lim_(x->oo)(3x+2)/(2x+1))^30 = (3/2)^20 $ = P54 习题1-3 8(8) #prob[利用极限性质求极限:$ lim_(x->1)(x^(n+1)-(n+1)x+n)/((x-1)^2) quad (n in ZZ_+) $] 令 $u=x-1$,已知 $display(lim_(x->1) u=0)$. $ & lim_(x->1)(x^(n+1)-(n+1)x+n)/((x-1)^2) = lim_(u->0)((u+1)^(n+1)-(n+1)u-1)/(u^2)\ =& lim_(u->0) sum_(i=2)^(n+1) binom(n+1,i) u^(i-2) = binom(n+1,2) = n(n+1)/2 $ = P54 习题1-3 8(11) #prob[利用极限性质求极限:$ lim_(x->a^+)(sqrt(x)-sqrt(a)+sqrt(x-a))/sqrt(x^2-a^2) quad (a>0) $] $ lim_(x->a^+)(sqrt(x)-sqrt(a))/sqrt(x-a) = ((sqrt(x)-sqrt(a))(sqrt(x)+sqrt(a)))/(sqrt(x-a)(sqrt(x)+sqrt(a))) = (sqrt(x-a))/(sqrt(x)+sqrt(a)) = 0 $ $ lim_(x->a^+)(sqrt(x)-sqrt(a)+sqrt(x-a))/sqrt(x^2-a^2) = lim_(x->a^+)(sqrt(x-a)(1+(sqrt(x)-sqrt(a))/sqrt(x-a)))/(sqrt(x-a)sqrt(x+a)) = lim_(x->a^+)1/sqrt(x+a)=1/sqrt(2a) $ = P54 习题1-3 8(13) #prob[利用极限性质求极限:$ lim_(x->0)(sqrt(1+x)-sqrt(1-x))/(root(3,1+x)-root(3,1-x)) $] 令 $u=root(6,1+x)$,$v=root(6,1-x)$.已知 $display(lim_(x->0)u = lim_(x->0)v = 1)$. $ lim_(x->0)(u^3-v^3)/(u^2-v^2) = lim_(x->0)((u-v)(u^2+u v+v^2))/((u-v)(u+v)) = 3/2 $ = P54 习题1-3 8(15) #prob[利用极限性质求极限:$ lim_(x->+oo) [sqrt((x+a)(x+b)) - x] $] $ & lim_(x->+oo) [sqrt((x+a)(x+b)) - x] = lim_(x->+oo) ((x+a)(x+b)-x^2)/(sqrt((x+a)(x+b))+x) \ =& lim_(x->+oo) ((a+b)x + a b)/(sqrt((x+a)(x+b)) + x) = lim_(x->+oo) (a+b+(a b)/x)/(sqrt((1+a/x)(1+b/x)) + 1) = (a+b)/2 $ = P54 习题1-3 8(17) #prob[利用极限性质求极限:$ lim_(x->0)(1+cos^2 1/x)^x $] 已知 $cos^2 1/x in [0,1]$,故 $1+cos^2 1/x$ 有界. 根据 $display(lim_(x->0) a^x = 1)$,有 $display(lim_(x->0)(1+cos^2 1/x)^x) = 1$. = P54 习题1-3 9(2) #prob[利用两个重要极限求极限:$ lim_(x->0)(sin 5x-sin 3x)/(sin x) $] $ & lim_(x->0)(sin 5x-sin 3x)/(sin x) = lim_(x->0)(sin x cos 4x + sin 4x cos x - sin x cos 2x - sin 2x cos x)/(sin x) \ =& lim_(x->0)(cos 4x - cos 2x + (cos x)(sin 4x - sin 2x) / (sin x)) = (sin 4x - sin 2x) / (sin x) \ =& lim_(x->0)(2sin x cos x (2 cos 2x - 1)) / (sin x) = lim_(x->0)(2 cos x (2 cos 2x - 1)) = 2 $ = P54 习题1-3 9(5) #prob[利用两个重要性质求极限:$ lim_(x->0)sqrt(1-cos x^2)/(1-cos x) $] $ lim_(x->0)sqrt(2 sin^2 (x^2/2))/(2 sin^2 (x/2)) = lim_(x->0)sin(x^2/2)/(sqrt(2) sin^2(x/2)) = lim_(x->0)(sin(x^2/2) dot (x/2)^2 dot 2)/(sqrt(2) sin^2(x/2) dot x^2/2) = sqrt(2) $ = P54 习题1-3 9(7) #prob[利用两个重要性质求极限:$ lim_(x->0)(1-2x)^(1/x) $] 令 $u=display(1/x)$,已知 $display(lim_(x->0) u=oo)$. $ lim_(x->0) (1-2x)^(1/x) = lim_(u->oo) (1-2/u)^u = (lim_(u->oo) (1+1/(-u/2))^(-u/2))^(-2) = 1/e^2 $ = P54 习题1-3 9(8) #prob[利用两个重要性质求极限:$ lim_(x->oo)((x+a)/(x-a))^x $] 令 $display(u=x/(2a)+1/2)$,已知 $display(lim_(x->oo) u = oo)$. $ lim_(x->oo)((x+a)/(x-a))^x = lim_(x->oo)(1+2a/(x-a))^x = lim_(x->oo)(1+1/u)^(a(2u-1)) = e^(2a) $ = P55 习题1-3 10 #prob[由 $display(lim_(x->oo)((x^2+1)/(x+1)-a x-b)=0)$,求常数 $a$、$b$.] $ lim_(x->oo)((x^2+1)/(x+1)-a x-b) = lim_(x->oo)((x-1)+2/(x+1)-a x-b) = lim_(x->oo)((1-a)x-(1+b)) = 0 $ 那么有 $a=1$,$b=-1$.
https://github.com/marcantoinem/CV
https://raw.githubusercontent.com/marcantoinem/CV/main/en/project.typ
typst
#import "../src/style.typ": experience #let generateur = { experience( "AEP Schedule Generator v2", link("https://beta.horaires.aep.polymtl.ca/", "beta.horaires.aep.polymtl.ca"), "", "", [ - Replaced the old AEP schedule generator, a web application that helps students at Polytechnique Montréal to generate their schedule for the semester. - Implemented a new algorithm to generate schedules that are more balanced and optimized for students while being *up to 100x faster* for generating schedule than the previous algorithm enabling generation. - Improved the user interface to make it more user-friendly and accessible to all students. - Used a full stack Rust framework with *Leptos*, *Tailwind* and *WebAssembly* to build the application and allow to generate schedule locally instead of on the server. ], ) }
https://github.com/jneug/schule-typst
https://raw.githubusercontent.com/jneug/schule-typst/main/src/cu.typ
typst
MIT License
#import "_imports.typ": * #let checkup( ..args, body, ) = { let ( doc, page-init, tpl, ) = base-template( type: "CU", type-long: "Checkup", //_tpl: (:), title-block: (doc) => { place(right, image("assets/checkmark.svg", width:2cm)) heading( level: 1, outlined: false, bookmarked: false, )[Checkup zur #doc.title: #text(fill:theme.secondary, doc.topic)] }, ..args, body, ) { show: page-init tpl } } #let skala(..icons, spacing: .5em) = grid( columns: icons.pos().len(), column-gutter: spacing, ..icons.pos() ) #let skala2 = skala(emoji.thumb.up, emoji.thumb.down) #let skala3 = skala(emoji.face.beam, emoji.face.neutral, emoji.face.weary) #let skala4 = skala(emoji.face.beam, emoji.face.happy, emoji.face.diagonal, emoji.face.weary) #let skala5 = skala(emoji.face.beam, emoji.face.happy, emoji.face.neutral, emoji.face.diagonal, emoji.face.weary) #let skala6 = skala( emoji.face.beam, emoji.face.grin, emoji.face.happy, emoji.face.diagonal, emoji.face.frown, emoji.face.weary, ) #let ichkann( body, aufgaben, skala: skala4, ) = ( [#sym.dots #body], [#skala], [#aufgaben], ) #let trenner(content) = (table.cell(colspan: 3, fill: theme.table.header, content),) #let checkup-table(..cells) = { let fills = ( rows: (:), cols: (:), ) for (i, row) in cells.pos().enumerate() { if row.first().at("colspan", default: 1) > 1 { fills.rows.insert(str(i + 1), theme.table.header) } } table( columns: (1fr, auto, auto), fill: table-fill(fills: fills), align: (c, r) => (left + horizon, center + horizon, left + horizon).at(c), [*Ich kann #sym.dots*], [], [*Informationen & Aufgaben*], ..cells.pos().flatten() ) }
https://github.com/Shedward/dnd-charbook
https://raw.githubusercontent.com/Shedward/dnd-charbook/main/books/dobrogon-magarynich.typ
typst
#import "../dnd/dnd.typ" #import "../dnd/game/game.typ": * #show: dnd.core.charbook #let dobrogon = dnd.game.character( name: "<NAME>", class: "Artificer", subclass: "Alchemist", race: "Autognome", type: "Construct", alignment: "Chaotic Neutral", story: "Failed Merchant", spellcasting: spellcasting( focus: "Tools, Infusions", prepearing: true, rutualCasting: true ) ) #dnd.page.cover( dobrogon.name, author: "<NAME>.", title: "User manual", caption: [ Document number: 8001-004-01-e \ Revision: 3.0B ], subtitle: "DM1043/S843" ) #dnd.page.attacks #dnd.page.charlist(dobrogon) #dnd.page.inventory #page( header: section[Spellcasting] )[ #dnd.page.spellcasting(dobrogon) #dnd.page.spellsSection( level: cantrip, spell( "Mending", prep: alwaysPrepared, school: transmutation, castTime: minute(1), duration: instant, range: touch, components: "VSM" )[ *Repair* small tear or *Heal self HD(1d8) + CON* (min 1) ], spell( "Create Bonfire", prep: alwaysPrepared, school: conjuration, castType: concentration, duration: minute(1), range: cube(5, range: 60), components: "VS" )[ Create area, DEX or *Fire 2d8* on enter or stay ], spell( "Fire Bolt", prep: alwaysPrepared, school: evocation, duration: instant, range: target(120), components: "VS" )[ Ranged, *Frost 2d8, Slow 10ft* ], spell( "Ray of Frost", prep: alwaysPrepared, school: evocation, duration: instant, range: target(60), components: "VS" )[ Ranged, *Frost 2d8 + Slow 10ft* ] ) #dnd.page.spellsSection( level: spellLevel(1, slots: 4), spell( "Healing Word", prep: alwaysPrepared, school: evocation, castTime: bonusAction, duration: instant, range: target(60), components: "V" )[ *Heal 1d4 + Int* #atHigherLevels[+1d4] ], spell( "Ray of Sickness", prep: alwaysPrepared, school: conjuration, castTime: action, duration: instant, range: target(60), components: "VS" )[ Ranged, *Poison 2d8*, CON or Poisoned #atHigherLevels[+1d8] ], spell( "Tasha's Hideous Laughter", prep: freePreparation(alwaysPrepared), school: evocation, castTime: action, castType: concentration, duration: minute(1), range: target(30), components: "VSM" )[ WIS or *Prone and Incapacitated*, works only INT > 4 ], spell( "Absorb Elements", prep: preparing, school: abjuration, castTime: reaction, duration: round(1), range: self, components: "S" )[ Element *Resist*, next meele atack gain +1d6 #atHigherLevels[+1d6] ], spell( "Alarm", prep: preparing, school: abjuration, castTime: minute(1), castType: ritual, duration: hour(8), range: cube(20, range: 30), components: "VSM" )[ *Detect* intruder audibly~(60ft) or mentally~(1mile) ], ) ] #page[ #dnd.page.spellsSection( spell( "Catapult", prep: preparing, school: transmutation, castTime: action, duration: instant, range: straightLine(90, range: 60), components: "V" )[ DEX or *Bludg. 3d8*, you need an object 1-5lb to throw #atHigherLevels[+1d8,+5lb] ], spell( "Cure Wounds", prep: preparing, school: evocation, castTime: action, duration: instant, range: touch, components: "VS" )[ *Heal 1d8* + INT #atHigherLevels[+1d8] ], spell( "Detect Magic", prep: preparing, school: evocation, castTime: action, castType: concentration + ritual, duration: instant, range: sphere(30), components: "VS" )[ *Detect presence*, spend 1A to see auraaround object that bears magic and detect it's school ], spell( "Disguise Self", prep: preparing, school: abjuration, castTime: action, duration: hour(1), range: self, components: "VS" )[ *Shapeshift*, #(sym.plus.minus)1ft height. Testing by *Investigation* ], spell( "Expeditious Retreat", prep: preparing, school: transmutation, castTime: bonusAction, castType: concentration, duration: minute(10), range: self, components: "VS" )[ You can *Dash* ], spell( "Faerie Fire", prep: preparing, school: necromancy, castTime: action, castType: concentration, duration: minute(1), range: cube(20, range: 60), components: "V" )[ DEX or *Advantage againts*, light 10ft, no invisibility ], spell( "False Life", prep: preparing, school: evocation, castTime: action, duration: hour(1), range: self, components: "VSM" )[ Add *Temp. HP 1d4+4* #atHigherLevels[+5HP] ], spell( "Feather Fall", prep: preparing, school: transmutation, castTime: reaction, duration: minute(1), range: target(60), components: "VM" )[ *Slow falling speed by 60ft* ], spell( "Grease", prep: preparing, school: conjuration, castTime: action, duration: minute(1), range: square(10, range: 60), components: "VSM" )[ Create area, DEX or *Prone* ], spell( "Identify", prep: preparing, school: divination, castTime: minute(1), duration: instant, range: square(10, range: 60), components: "VSM" )[ *Identify* items and spells. #required[pearl 100gp] ], spell( "Jump", prep: preparing, school: transmutation, castTime: action, duration: minute(1), range: touch, components: "VSM" )[ *Jump* distance #sym.times 3 ], spell( "Longstrider", prep: preparing, school: transmutation, castTime: action, duration: hour(1), range: touch, components: "VSM" )[ *Speed* +10ft #atHigherLevels[+1 target] ], spell( "Purify Food and Drink", prep: preparing, school: transmutation, castTime: action, duration: instant, range: sphere(5, range: 10), components: "VS" )[ *Clean poison and disease* in non-magical food ], spell( "Sanctuary", prep: preparing, school: abjuration, castTime: bonusAction, duration: minute(1), range: target(30), components: "VS" )[ *Protection*, enemy: WIS or change target or skip ], spell( "Snare", prep: preparing, school: abjuration, castTime: minute(1), duration: hour(8), range: circle(5), components: "VSM" )[ *Trap*, INT or *Entangled* #required[consume 25ft rope] ], spell( "Tasha's Caustic Brew", prep: preparing, school: conjuration, castTime: action, castType: concentration + ritual, duration: minute(1), range: straightLine([30x5]), components: "VSM" )[ DEX or *Acid 2d4* each start, target can spend 1A to clean #atHigherLevels[+2d4] ], ) ] #page[ #dnd.page.spellsSection( level: spellLevel(2, slots: 2), spell( "Aid", prep: preparing, school: abjuration, castTime: action, duration: hour(8), range: target(30, count: 3), components: "VSM" )[ *Max/Cur HP +5* #atHigherLevels[+5HP] ], spell( "Aid", prep: preparing, school: abjuration, castTime: action, duration: hour(8), range: target(30), components: "VSM" )[ *Max/Cur HP +5* for 3 creatures #atHigherLevels[+5HP] ], spell( "Air Bubble", prep: preparing, school: divination, castTime: action, duration: hour(24), range: target(60), components: "VSM" )[ Allow 1 creature to *breath* #atHigherLevels[+2 target] ], spell( "Alter Self", prep: preparing, school: transmutation, castTime: action, castType: concentration, duration: hour(1), range: self, components: "VS" )[ *Shapeshift*, - Aquatic - you can breath and sweam fast - Appearance - change except size and form - Weapon - Grow weapon, magic, *Bludg 1d6* ], spell( "Arcane Lock", prep: preparing, school: abjuration, castTime: action, duration: always, range: touch, components: "VSM" )[ *Lock* a chest or passage. Open for people or password. Supressed by Knock. *Break +10DC* #required[consume gold dust 25gp] ], spell( "Blur", prep: preparing, school: evocation, castTime: action, castType: concentration, duration: minute(1), range: self, components: "V" )[ *Attack disadvantage against*, if relies on eyesight ], spell( "Continual Flame", prep: preparing, school: necromancy, castTime: action, duration: always, range: touch, components: "VSM" )[ *Infinite Light* #required[consume ruby dust 50gp] ], spell( "Darkvision", prep: preparing, school: transmutation, castTime: action, duration: minute(1), range: touch, components: "VSM" )[ *Darkvision* for 60ft ], spell( "Enhance Ability", prep: preparing, school: conjuration, castTime: action, duration: hour(1), range: touch, components: "VSM" )[ *Advantage for check* for selected stat, additionally - CON: +2d6 Temp HP. - STR: 2#(sym.times)Carrying Capacity - DEX: No fall damage < 20ft ], spell( "Enlarge/Reduce", prep: preparing, school: divination, castTime: action, duration: minute(1), range: target(30), components: "VSM" )[ CON or - Enlarge - Size#(sym.times)2, STR Adv., +1d4 attacks - Reduce - Size#(sym.times)0.5, STR Dis., -1d4 attacks ], spell( "Heat Metal", prep: preparing, school: transmutation, castTime: action, castType: concentration, duration: minute(1), range: target(60), components: "VSM" )[ *On metal object*, any touch - *Fire 2d8*, CON to drop or *Disadv.*. Use BA to damage again #atHigherLevels[+2 targets] ], spell( "Invisibility", prep: preparing, school: illusion, castTime: action, castType: concentration, duration: hour(1), range: touch, components: "VSM" )[ Become *Invisible* ], ) ] #page[ #dnd.page.spellsSection( spell( "Kinetic Jaunt", prep: preparing, school: transmutation, castTime: bonusAction, castType: concentration, duration: minute(1), range: self, components: "VSM" )[ *Speed +10ft*, *No provoking*, *You can go through creatures*, if you end up in creature - move away and take Force Field 1d8 ], spell( "Lesser Restoration", prep: preparing, school: abjuration, castTime: action, duration: instant, range: touch, components: "VS" )[ *Clean disease*, blind., deaf., paral. or poisoned ], spell( "Levitate", prep: preparing, school: transmutation, castTime: action, castType: concentration, duration: minute(10), range: [#target(60), \<500lb], components: "VSM" )[ CON or *Levitate up to 20ft*, you can use Move to change self #(sym.plus.minus)20ft, or Action to move others ], spell( "Magic Mouth", prep: preparing, school: illusion, castTime: minute(1), castType: ritual, duration: always, range: point(60), components: "VSM" )[ Implant a *voice message*, choose a trigger (max 30ft distance) #required[consume jade dust 10gp] ], spell( "Magic Weapon", prep: preparing, school: transmutation, castTime: bonusAction, castType: concentration, duration: hour(1), range: touch, components: "VS" )[ Non magical weapon become magical *+1 to attack and damage rolls* #atHigherLevels[+2 bonus] ], spell( "Melf's Acid Arrow", prep: preparing, school: evocation, castTime: action, duration: instant, range: target(90), components: "VSM" )[ Ranged, - on hit - *Acid 4d4* + *Acid 2d4* end of turn - on miss - *Acid 4d4* / 2 ], spell( "Protection from Poison", prep: preparing, school: abjuration, castTime: action, duration: hour(1), range: touch, components: "VS" )[ *Neutralize poisoning* (known or random) Target gain advantage agains being poisoned ], spell( "Pyrotechnichs", prep: preparing, school: transmutation, castTime: action, duration: instant, range: square(20, range: 60), components: "VS" )[ Choose non-magical fire, distinguish and choose: - Smoke - covers 20ft area heavily obscure, lasts 1m, heavy wind ends it - Fireworks - 10ft range, CON or *Blinded* ], spell( "Rope Trick", prep: preparing, school: transmutation, castTime: action, duration: hour(1), range: touch, components: "VSM" )[ Rope rises into the air and creates *extradimentional space* for up to 8 Medium creatures to *hide*. You can lift rope so it becomes invisible. Attacks or spells can't cross this space, but you can see what's outside #required[rope < 60ft] ], spell( "See Invisible", prep: preparing, school: illusion, castTime: action, duration: hour(1), range: self, components: "VSM" )[ *See Invisible*, *See Ethereal Plane* ], spell( "Skywrite", prep: preparing, school: transmutation, castTime: action, castType: concentration + ritual, duration: hour(1), range: [Sight], components: "VS" )[ *Write up to 10 words* in the sky. Heavy wind can end this spell early. ], spell( "Spider Climb", prep: preparing, school: transmutation, castTime: action, duration: hour(1), range: touch, components: "VSM" )[ Allow target to *walk on walls and ceilings* ], ) ] #page[ #dnd.page.spellsSection( spell( "Vortex Warp", prep: preparing, school: conjuration, castTime: action, duration: instant, range: target(90), components: "VSM" )[ CON or be *Teleported* #atHigherLevels[+30ft] ], spell( "Web", prep: preparing, school: conjuration, castTime: action, castType: concentration, duration: hour(1), range: cube(20, range: 60), components: "VSM" )[ Create web, which is *difficult terrain and lightly obscured*, Creaters end in web DEX or *Restrained*. Web is *flammable*, burn in 1r with *Fire 2d4* ], spell( "Flaming Sphere", prep: preparing, school: conjuration, castTime: action, castType: concentration, duration: minute(1), range: sphere(5, range: 60), components: "VSM" )[ Creates sphere, create that ends its turn within 5ft of it DEX or *Fire 2d6* Bonus Action: Move to 30ft ], ) #inputGrid(20) ] #dnd.page.abilities( ability("Build For Success", source: "Autognome")[ You can add a *d4* to one *attack~roll*, *ability~check*, or *saving~throw* you make, and you can do so after seeing the d20 roll but before the effects of the roll are resolved. You can use this trait a number of times equal to your proficiency bonus, and you regain all expended uses when you finish a long rest. #abilityCharges(3) ], ability("Healing Machine", source: "Autognome")[ If the *Mending* spell is cast on you, you can spend a Hit Dice, roll it, and regain a number of hit points equal to the roll plus your Constitution modifier (minimum of 1 hit point). In addition, your creator designed you to benefit from several spells that preserve life but that normally don't affect Constructs: Cure Wounds, Healing Word, Mass Cure Wounds, Mass Healing Word, and Spare the Dying. ], ability("Mechanical Nature", source: "Autognome")[ You have *resistance to poison* damage and *immunity to desease*, and you have advantage on saving throws agains being *paralyzed* or *poisoned*. You don't need to eat, drink, or breathe. ], ability("Sentry Rest", source: "Autognome")[ When you take a long rest, you spend at least 6 hours in an inactive, motionless state, instead of sleeping. In this state, you appear inert, but you remain conscious. ], ability("Supply Chain", source: "Failed Merchant")[ From your time as a merchant, you retain connections with wholesalers, suppliers, and other merchants and enterpreneurs. You can call upon these connections when looking for item or information. ], ability("The Right Tool f.t. Job", source: "Artificer")[ At 3rd level, you've learned how to produce exactly the tool you need: with thieves' tools or artisan's tools in hand, you can magically create one set of artisan's tools in an unoccupied space within 5 feet of you. This creation requires 1 hour of uninterrupted work, which can coincide with a short or long rest. Though the product of magic, the tools are nonmagical, and they vanish when you use this feature again. #abilitySlot(2) ], ability("Magic Tinkering", source: "Artificer")[ To use this ability, you must have thieves's tools or artisan's tools in hand. + The object sheds *bright light* in 5-foot radius and dim light for an additional 5 feet. + Object emits a *recorded message* that can be heard up to 10 feet away 6 seconds long. + The object continuously emits your choice of an *odor* or *nonverbal sound* perceivable up to 10 feet away + A static *visual effect* appears on one of the object surface #repeated(4, abilitySlot(2)) ], ability("Alchemy Savant", source: "Alchemist")[ Whenever you cast a spell using your alchemist's supplies as the spellcasting focus, you gain a bonus to one roll on the spell. That roll must *restore HP* or be a damage roll that deals *acid*, *fire*, *necrotic*, or *poison* damage. And the bonus equals INT ], ability("Experimental Elixir", source: "Alchemist")[ Beginning at 3rd level, whenever you finish a long rest, you can magically produce an experimental elixir in an empty flask you touch. + *Healing.* The drinker regains a number of hit points equal to *2d4 + INT* + *Swiftness.* The drinker's walking speed increases by 10 feet for 1 hour. + *Resilience.* The drinker gains a +1 bonus to AC for 10 minutes. + *Boldness.* The drinker can roll a *d4* and add the number rolled to every *attack row and saving throw* they make for the next minute. + *Flight.* The drinker gains a flying speed of 10 feet for 10 minutes. + *Transformation.* The drinker's body is transformed as if by the Alter Self spell. The drinker determines the transformation caused by the spell, the effects of which last for 10 minutes #repeated(4, abilitySlot(1)) ], ability("Infuse Item", source: "Artificer")[ Whenever you finish a long rest, you can touch a nonmagical object and imbue it with one of your artificer infusions, turning it into a magic item. An infusion works on only certain kinds of objects, as specified in the infusion's description. If the item requires attunement, you can attune yourself to it the instant you infuse the item. If you decide to attune to the item later, you must do so using the normal process for attunement Your infusion remains in an item indefinitely, but when you die, the infusion vanishes after a number of days equal to your Intelligence modifier (minimum of 1 day). The infusion also vanishes if you replace your knowledge of the infusion You can infuse more than one nonmagical object at the end of a long rest. You must touch each of the objects, and each of your infusions can be in only one object at a time. Moreover, no object can bear more than one of your infusions at a time. If you try to exceed your maximum number of infusions, the oldest infusion ends, and then the new infusion applies. If an infusion ends on an item that contains other things, like a bag of holding, its contents harmlessly appear in and around its space. #colbreak(weak: true) #subsection[Active] #repeated(5, spacing: paddings(3), abilitySlot(3)) ], ) #dnd.page.abilities( title: [Known Infusions], ability("Enhanced Weapon")[ #abilityRequirement[ A simple or martial weapon ] This magic weapon grants a +1 bonus to attack and damage rolls made with it. ], ability("Returning Weapon")[ #abilityRequirement[ A simple or martial weapon with throwin property ] This magic weapon grants a +1 bonus to attack and damage rolls made with it, and it returns to the wielder’s hand immediately after it is used to make a ranged attack. ], ability("Replicate Item:\nAlchemy Jug")[ Once a day using their action, the person holding the jug may name one liquid from the below table, and the jug will produce up to the maximum amount listed for that liquid, after which that liquid can be poured out at a rate of up to 2 gallons per minute. #simpleTable( ("Substance", "Max Amount"), "Acid", "8 ounces", "Basic poison", "1/2 ounce", "Beer", "4 gallons", "Honey", "1 gallon", "Mayonnaise", "2 gallons", "Oil", "1 quart", "Vinegar", "2 gallons", "Fresh water", "8 gallons", "Salt water", "12 gallons", "Wine", "1 gallon" ) ], ability("Replicate Item:\nBag of Holding")[ This bag has an interior space considerably larger than its outside dimensions, roughly 2 feet in diameter at the mouth and 4 feet deep. The bag can hold up to 500 pounds, not exceeding a volume of 64 cubic feet. The bag weighs 15 pounds, regardless of its contents. Retrieving an item from the bag requires an action. If the bag is overloaded, pierced, or torn, it ruptures and is destroyed, and its contents are scattered in the Astral Plane. If the bag is turned inside out, its contents spill forth, unharmed. Breathing creatures inside the bag can survive up to a number of minutes equal to 10 divided by the number of creatures (minimum 1 minute), after which time they begin to suffocate. Placing a bag of holding inside an extra-dimensional space created by a handy haversack, portable hole, or similar item instantly destroys both items and opens a gate to the Astral Plane. The gate originates where the one item was placed inside the other. Any creature within 10 feet of the gate is sucked through it to a random location on the Astral Plane. The gate then closes. The gate is one-way only and can't be reopened. ] ) #dnd.page.proficiencies( toolsProficiency( "Alchemist's Supplies", source: "Alchemist", items: ( [glass beaker #(sym.times) 2], "metal frame for holding", "glass stirring rod", "small pestle and mortar", "a porch of common ingredients (salt, iron powder, purified water)" ), actions: ( toolsAction("Make a Smoke Cloud", dc: 10), toolsAction("Identify a Poison", dc: 10), toolsAction("Identify a Substance", dc: 15), toolsAction("Make a Fire", dc: 15), toolsAction("Neutralize an Acid", dc: 20), toolsAction("Craft a Substance")[ During a long rest you can create one of a listed substances. To make it you need to *spend raw materials for a half of price of substance* #simpleTable( ("Substance", "Price"), "Acid", "25g / vial", "Alchemist's fire", "50g / flask", "Antitoxin", "50g / dose", "Oil", "1s / flask", "Perfume", "5g / vial", "Soap", "2c / item" ) ] ), skillsEffects: ( skillEffect(arcana)[ You can get more information about potions and other substances. ], skillEffect(investigation)[ You can understand what chemicals was used in area. ] ) ), colbreak(), toolsProficiency( "Thieve's Tools", source: "Artificer", items: ( "small file", "set of lockpicks", "small mirror on a little handle", "set of narrow-bladed scissors", "pair of pliers" ), actions: ( toolsAction("Pick a Lock", dc: "target"), toolsAction("Disarm a Trap", dc: "target"), toolsAction("Set a Trap")[ As a part of short rest, you can create a trap using improvised means. ] ), skillsEffects: ( skillEffect(history)[ You can get more information about places that famous for their traps. ], skillEffect(investigation, perception)[ You get more Information about traps. ] ) ), toolsProficiency( "Brewer's Tools", source: "Autognome", items: ( "large glass jug", "quantity of hops", "siphon", "several feet of tubing" ), actions: ( toolsAction("Detect potion in drinks", dc: 10), toolsAction("Detect alcohol", dc: 15), toolsAction("Ignore alcohol effect", dc: 20) ), skillsEffects: ( skillEffect(history)[ Additional info for events abount alcohol. ], skillEffect(medicine)[ You can help with alcohol poisoning and use. it as pain dull ], skillEffect(perception)[ You can use alco to improve mood of a person. ] ) ), colbreak(), toolsProficiency( "Tinker's Tools", source: "Artificer", items: ( "thread", "needles", "wet-stone", "scarp of cloth and leather", "small pot of glue" ), actions: ( toolsAction("Temporary fix a mech", dc: 10), toolsAction("Fix twice as fast", dc: 15), toolsAction("Make item out of junk", dc: 20), toolsAction("Repair")[ You can restore 10 hp per hour of work. You need materials. ] ), skillsEffects: ( skillEffect(history)[ You can determine age and origin of an item, even if you have only few pieces of it. ], skillEffect(investigation)[ You can learn how long ago item was broken. ] ) ), toolsProficiency( "Smith's Tools", source: "Artificer", items: ( "hammers", "tongs", "chracoal", "rags", "small pot of glue" ), actions: ( toolsAction("Sharpen a dull blade", dc: 10), toolsAction("Fix an armor", dc: 15), toolsAction("Dismantle non magical item", dc: 15), toolsAction("Repair")[ You can restore 10 hp per hour of work. You need materials. ] ), skillsEffects: ( skillEffect(arcana, history)[ You have additional insight for metal objects. ], skillEffect(investigation)[ You can spot slues about weapon, armor and other metalwork. ] ) ), toolsProficiency( "Carpenter's Tools", source: "Artificer", items: ( "saw", "hammer and nails", "square, ruler and adze", "plain and chisel" ), actions: ( toolsAction("Build a simple construct", dc: 10), toolsAction("Build a complex construct", dc: 15), toolsAction("Find weak spot in door", dc: 15), toolsAction("Dismantle a door", dc: 20), toolsAction("Reinforce window/door")[ For 1 min. with materials you increase its DC by 5. ], toolsAction("Build a shelter")[ For long rest you can build a shelter. It will break after 1d3 days after building. ] ), skillsEffects: ( skillEffect(history, investigation, perception)[ You can learn more about wooden items ], ) ), toolsProficiency( "Painter's Supplies", source: "Failed merchant", items: ( "easel, chracoal", "canvas", "brushes, palette" ), actions: ( toolsAction("Make a portrait", dc: 10), toolsAction("Make a picture with a hidden message", dc: 20), toolsAction("Painting and drawing")[ At a short or long rest you can produce simple work of art ] ), skillsEffects: ( skillEffect(arcana, history, religion)[ You have additional insights about art ], skillEffect(investigation, perception)[ You can spot clues about paintings ] ) ) ) #dnd.page.backstory[ Dobrogon was created by an old gnome in an unnamed deserted village as a moonshine apparatus. He spent most of his life in the basement, producing alcohol for an old alcoholic, unaware of the outside world. The basement was a dim and musty space, filled with worn shelves, cobwebs, and aging bottles. Sunlight peered through a cracked window, revealing a glimpse of the forgotten alchemist's sanctuary. At some point, while producing another batch, the old man adjusted something, causing Dobrogon to black out. When he woke up, he saw a swollen green headless body on the floor and a large hole in the wall. The old man was nowhere to be found. Dobrogon waited for a while, but the old man never showed up. So, Dobrogon decided to embark on a search. He left his home and wandered until he reached a roadside tavern after a few days. There, he met the owner who suggested he wait for the old man, claiming he would be there soon. In the meantime, Dobrogon crafted a variety of exquisite alcoholic. After a year of waiting, exhausted, Dobrogon set off to search for the old man elsewhere. During his journey, he traded alcohol and various beverages and substances derived from it. During this period, he became interested in alchemy as a means of creating more powerful and complex substances and compositions. Over time, due to active and careless use and lack of repairs (none of the encountered artificers could figure out its ridiculous construction), the built-in distillation cube in his body stopped producing alcohol properly. Occasionally, it would short-circuit, causing a small amount of high-proof alcohol to spray onto the ground or his organic parts (unclear whether it was humans, animals, or worse). Now, Dobrogon actively searches for the old man not just because he misses him, but also because he might be the only person who can fix him. ] #dnd.page.personality[ #biographySection("Personal Traits")[ #biographySubsection("Naivety")[ I often seeing the word with childlike wonder and a lack of cynicism. ] #biographySubsection("Curiosity")[ I possess an strong thirst for knowledge and an insatiable desire to explore the unknown. ] ] #biographySection("Bonds")[ #biographySubsection("Father")[ I don't know his actual name. But he made me and care about me. ] ] #biographySection("Ideals")[ #biographySubsection("Freedom")[ After getting first taste of freedom I liked it and won't give it away. ] ] #colbreak() #biographySection("Goals")[ #biographySubsection("Find father")[ Father missing for a very long time. I'm not even sure if he's alive, but I still have to try find him. ] #biographySubsection("Repair myself")[ My systems in a very bad condition. I need to find somebody skillfull enough to repair me. ] ] #biographySection("Flaws")[ #biographySubsection("Cheap Machine Oil")[ My father did not have access to good materials, so the cheapest machine oil was poured into me. *I have weakness for frost and cold.* ] #biographySubsection("Poorly Insulated Tubes")[ After a while of bad exploitation my alcohol producing systems got leaks. *I can randomly get drunk or make a little puddle of strong alcohol* ] ] ] #dnd.page.quests #dnd.page.quests
https://github.com/qujihan/typst-cv-template
https://raw.githubusercontent.com/qujihan/typst-cv-template/main/params.typ
typst
#let project-root = "../" #let template-root = "./" #let default-config = ( font-en: "Lora", font-zh: "Source Han Serif SC", font-size: 10.5pt, font-weight: 300, thin-line-space: 8pt, bold-line-space: 12pt, head-info-name-size: 2.3em, head-info-name-color: black, head-info-other-size: 0.4em, head-info-other-color: black, title-color: rgb("#000000"), emphasize-color: rgb("#00bbbb"), head-color: rgb("#181818"), subtitile-color: rgb("#1f1f1f"), content-color: rgb("#222222"), )
https://github.com/Gekkio/gb-ctr
https://raw.githubusercontent.com/Gekkio/gb-ctr/main/chapter/cpu/timing.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "../../common.typ": * #import "../../timing.typ" == CPU core timing === Fetch/execute overlap Sharp SM83 uses a microprocessor design technique known as _fetch/execute overlap_ to improve CPU performance by doing opcode fetches in parallel with instruction execution whenever possible. Since the CPU can only perform one memory access per M-cycle, it is worth it to try to do memory operations as soon as possible. Also, when doing a memory read, the CPU cannot use the data during the same M-cycle so the true minimum effective duration of instructions is 2 machine cycles, not 1 machine cycle. Every instruction needs one machine cycle for the fetch stage, and at least one machine cycle for the decode/execute stage. However, the fetch stage of an instruction always overlaps with the last machine cycle of the execute stage of the previous instruction. The overlapping execute stage cycle may still do some work (e.g. ALU operation and/or register writeback) but memory access is reserved for the fetch stage of the next instruction. Since all instructions effectively last one machine cycle longer, fetch/execute overlap is usually ignored in documentation intended for programmers. It is much easier to think of a program as a sequence of non-overlapping instructions and consider only the execute stages when calculating instruction durations. However, when emulating a SM83 CPU core, understanding and emulating the overlap can be useful. #warning[ Sharp SM831x is a family of single-chip SoCs from Sharp that use the SM83 CPU core, and their datasheet @sm831x includes a description of fetch/execute overlap. However, the description is not completely correct and can in fact be misleading. For example, the timing diagram includes an instruction that does not involve opcode fetch at all, and memory operations for two instructions are shown to happen at the same time, which is not possible. ] ==== Fetch/execute overlap timing example Let's assume the CPU is executing a program that starts from the address #hex("1000") and contains the following instructions: #let colors = ( inc: rgb("#b3b3ff"), ldh: rgb("#fffcb3"), rst: rgb("#b3ffb3"), nop: rgb("#ffb3b3"), ) #monotext[ #table( columns: 2, align: left + horizon, stroke: none, hex("1000"), table.cell(fill: colors.inc)[INC A], hex("1001"), table.cell(fill: colors.ldh)[LDH (n), A], hex("1003"), table.cell(fill: colors.rst)[RST #hex("08")], hex("0008"), table.cell(fill: colors.nop)[NOP] ) ] The following timing diagram shows all memory operations done by the CPU, and the fetch and execute stages of each instruction: #figure({ import timing: diagram, clock as c, data as d, either as e, high as h, low as l, unknown as u, undefined as x, high_impedance as z diagram( w_scale: 0.6, (label: "CLK 4 MiHz", wave: ( l(1), ..range(80).map(_ => c(1)), c(1), )), (label: "PHI 1 MiHz", wave: ( l(1), ..range(10).map(_ => (c(4), c(4))).flatten(), c(1), )), (label: "Mem R/W", wave: ( x(1), d(8, [R: opcode], fill: colors.inc), d(8, [R: opcode], fill: colors.ldh), d(8, [R: n], fill: colors.ldh), d(8, [W: A], fill: colors.ldh), d(8, [R: opcode], fill: colors.rst), x(8), d(8, [W: msb(PC)], fill: colors.rst), d(8, [W: lsb(PC)], fill: colors.rst), d(8, [R: opcode], fill: colors.nop), d(8, [R: opcode], opacity: 60%), x(1, opacity: 60%), )), (label: "Mem addr", wave: ( x(1), d(8, hex("1000"), fill: colors.inc), d(8, hex("1001"), fill: colors.ldh), d(8, hex("1002"), fill: colors.ldh), d(8, monotext[#hex("FF00")+n], fill: colors.ldh), d(8, hex("1003"), fill: colors.rst), x(8), d(8, monotext[SP-1], fill: colors.rst), d(8, monotext[SP-2], fill: colors.rst), d(8, hex("0008"), fill: colors.nop), d(8, hex("0009"), opacity: 60%), x(1, opacity: 60%), )), (label: [Before #monotext[INC A]], wave: ( d(9, [execute], opacity: 60% ), x(73), )), (label: monotext[INC A], wave: ( x(1), d(8, [M1: fetch], fill: colors.inc), d(8, [M2: execute], fill: colors.inc), x(65), )), (label: monotext[LDH (n), A], wave: ( x(9), d(8, [M1: fetch], fill: colors.ldh ), d(24, [M2-4: execute], fill: colors.ldh ), x(41), )), (label: monotext[RST #hex("08")], wave: ( x(33), d(8, [M1: fetch], fill: colors.rst), d(32, [M2-5: execute], fill: colors.rst), x(9), )), (label: monotext[NOP], wave: ( x(65), d(8, [M1: fetch], fill: colors.nop), d(8, [M2: execute], fill: colors.nop), x(1), )), (label: [After #monotext[NOP]], wave: ( x(73), d(8, [M1: fetch], opacity: 60%), x(1, opacity: 60%), )), )}, caption: "Fetch/execute overlap example" )
https://github.com/topdeoo/NENU-Thesis-Typst
https://raw.githubusercontent.com/topdeoo/NENU-Thesis-Typst/master/pages/reference.typ
typst
#import "../fonts/fonts.typ": font-family, font-size #let nenu-bibliography( bibliography: none, title: "参考文献", full: false, style: "gb-7714-2005-numeric", ) = { assert(bibliography != none, message: "bibliography 函数不能为空") set text(lang: "zh", size: font-size.五号, font: font-family.宋体) bibliography( title: title, full: full, style: style, ) }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/outline-indent_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Without heading numbering #set page(width: 200pt) #outline() #outline(indent: false) #outline(indent: true) #outline(indent: none) #outline(indent: auto) #outline(indent: n => 2em * n) #outline(indent: n => ([-], [], [==], [====]).at(n)) #outline(indent: n => "!" * calc.pow(2, n)) = About ACME Corp. == History #lorem(10) == Products #lorem(10) === Categories #lorem(10) ==== General #lorem(10)
https://github.com/swablab/documents
https://raw.githubusercontent.com/swablab/documents/main/protokoll.typ
typst
Creative Commons Zero v1.0 Universal
#import "templates/tmpl_page.typ": tmpl_page #import "templates/form.typ": form, form_field #let config = yaml("protokoll.yml") #show: doc => tmpl_page( title: config.title, subtext: [ #config.date \ #config.location \ Protokoll: #config.author Leitung: #config.lead ], doc, ) #set enum(numbering: "1.a.i.") #eval(config.content, mode: "markup") #form[Unterschrift][ #form_field("Protokollant") #if config.signature [ #place(top+left)[ #image("signature.png") ] ] ][ #if config.lead != none [ #form_field("Leitung") #if config.signature [ #place(top+left)[ #image("signature_lead.png") ] ] ] ]
https://github.com/camp-d/Notes
https://raw.githubusercontent.com/camp-d/Notes/main/ece3270.typ
typst
#set par(justify: true) = ECE 3270 - Digital Computer Design - Dr. Ligon = JAN 12 2024 ASIC: application specific integrated circuit FPGA: Field programmable gate array VHDL: hardware description language textbook: digital design using vhdl a systems approach room 309 room code: 327468 logical and physical specification + design entry types: - truth tables, waveforms, state diagrams. - Schematic capture. - hardware description language. netlist mixed-mode synthesis = JAN 17 2024 hierarchical design methodology involves creating segments of a product that are designed with different tools at differeing levels of specificity. synthesizer cad tool takes specification/hardware description language and creates design from the specification. Lab portion of the class involves using synthesizer on HDL code. schematic capture (drawing schematics) becomes untenable with larger and more complex designs during process of synthesis, technology mapping involves putting specific hardware into design. + EDIF: Electronic Design interchange format. + Functional Simulation is final step that verifies design. - functional simulators assume the time needed for signals to propagate through the logic gates is nebligible. - timing simulators must be used in tandem with functional simulators in order to obtain a complete test of the design. - add timing bounds to portions of circuit: best, worst, typical this allows for testing with all possible operation timings. - Use spice for specific timing measurements/edge cases. Spice uses numerical methods and has higher precision than simple digital logic simulators + Event-driven simulation: - Zero delay simulators will not detect race and hazard conditions. - Race condition: when two or more signals are changis simultaneously in a circuit which may resuelt in an ein correct state when a condition is assumed to be stable. + Possible states in logic simulation: - 0 - 1 - U (unknown) - Z (high impedance) Relevant with TSB (tri-state buffer) and TG (transmission gate) use reset or preset signal to set unknown back into a known state. Mixed-mode simulation: logic and spice simulation together = JAN 22 2024 + Design -- Place and route -- Schematic Capture - pin data: + placement + electrical resistance + signal name + special flags - Routing + traditional : by gate + floor planning : by structure - Simulations to estimate real-world timing - identify critical paths - full logical simulation - full electrical simulation - leads to re-routing, or re-design = Lecture 1: The Digital Abstraction, Combinational Logic. Associated reading: chapter 1, 3, 6 - The Digital Abstraction - representation - noise - Low voltage CMOS logic: [Damage] -- -0.3V -- 0.0V -- 0.7V -- 1.7V -- 2.5V -- 2.8V [Damage] - 0.7 to 1.7 V is transition region for 2.5V CMOS logic. - As opposed to analog systems, digital systems can: - Process, transport, and store info without noise distorion. - Possible because the signals are discrete - No loss of informmation with added noise until the noise becomes large enough to push the signal our of the valid range - Digital signals are periodically restored to keep them in the vaoid range using a buffer. - In analog systems, since all voltages are valid signals there is no way to restore the signal to a noiseless state between operations. - Analog systems also limited in precision - Accuracy is limited by the background noise. //#circle(radius: 10pt) - All resotring logic devices guarantee that the outputs fall into a range that is narrower than the input range - Larger noise margins are not necessarily better. $ V_(N M H) = V_( O H) - V_(I H)$ = Jan 24 2024G - Combinational logic means that logical outputs are based soley on inputs, not state or memory. - closed under acyclic composition ( as long as a feedback loop is not created when composing combinational logic circuits, then the composition is still combinational) - combinational, not combinatorial - Sequential logic depends on memory and state. - More than one possible logic equation for a given truth table. - Demorgans law: $ not (x and y) = not x or not y -> not ( x or y) = not x and not y $ - Hazards: - Hazards occur when changing from one implicant to another - Internal timing delays may cause undefined behavior. - Prime implicants on k-map. - Make circuits hazard-free by adding redundant implicants to cover transitions. - Types of hazards: static, dynamic, functional - Hazards also occur in sequential circuits. - Chapter 7 + appendix A+B: VHDL: = Jan 29 2024 -- VHDL syntax - Explicit declaration - CONSTANT bus_width : INTEGER := 32; - CONSTANT rise_delay : TIME := 20ns; - VARIABLE data_val : STD_LOGIC_VECTOR(7 DOWNTO 0); - VARIABLE sum : INTEGER RANGE 0 to 100; - VARIABLE done : BOOLEAN; - SIGNAL clock : STD_LOGIC; - SIGNAL addr_bus : STD_LOGIC_VECTOR (31 DOWNTO 0); Component Instantiation: - introduces a relationship to a component declaration. - port map maybe either named or positional. named: reg5 : fill_reg port map ( clk => clk, rst => rst, write => write_comp, read => readout, data_in => dataout_comp, FFout => FFOut, data_out => datareg5_out); positional: port map ( clk, rst, write_comp, readout, dataout_comp, FFout, datareg5_out); logical operators do not bind or have precedence except for the not operator. & - Concatenation operator for strings. String is any sequence of characters. VHDL identifier rules: - letters, digits, underscores only - The last character cannot be an underscore - two underscores in succession are not allowed - using reserved words is not allowed. + Combinational design entities use only + concurent assignment statements + Case or Case? statements (with "when others =>") + if statements - only if all signalsa have a default assignment + instantiations of other combinational modules. + Sequential desing entitites use only + Combinational logic + Explicitly declared register (flip-flops) + Do not use + Loops + Provess except for case, casex, or if + Do use + Signal slices e.g., a(7 downto 1) = b(6 downto 0); + Logic is organized into small design entities. + Leaf design entities not more than 40 lines + If it could be made two design entities, if should be. + Use lots of comments + Comments + Meaningful signal names - tempHigh, not th + Meaningful module names - DaysInMonth not mod3 + Constants + All constants explicitly defined if used nore than once + Signals + Bused (multi-bit signals) are numbered high to low - e.g., bus(31 downto 0) + All signals should be high-true (except primary inputs and outputs) + Visualize the logic your VHDL will generate. + if you can't visualize it, the result will not be pretty = January 31 2024 + What is a VHDL process? + proecesses are either awake or asleep + A process normally has a sensitivity list + When a signal in that sensitivity list changes value, the process wakes up and all of the sequentil statments are "executed" + for example, a process witha clock signal in its sensitivity list will become active on changes of the clock signal + At the end of the process, all outputs are assigned and the process goes back to sleep until the next time a signal changes in the sensitivity list. + Process + If no sensitivity list is given, then wait statements must be used in the process + Multiple statements can execute concurrently + The statements describing the behavior are executed sequentially + This is true from a simulation standpoint + From a synthesized hardware point-of-view, multiple assignments to a single signal (variable) generally implies multiplexing of the assignments to produce a signal output + Assignments made inside the process are not visivle outside of it. + process ```rust begin wait for 15 ns; clk <= not(clk); end process; process(clk, rst) begin if rst = '1'; then readout <= '0'; elsif (clk'event and clk = '1') then if(fout = '1') then readout <= '1'; else readout <= '0'; end if; end if; end process; ``` + clk'event is attribute of clk + when writing a <= b and b <= c updates happen at end of process + concurrent means nonprocedural (no in a process statement) + The order in which the CSA statements appear textually has nothing to do with the order in which they execute + They execute at the same time essentially + Concurrency is fundamental to hardware and VHDL, think in terms of parallel signal transforms ```rust with s select x <= a when "00", b when "01", c when "10", d when "11"; with int_value select x <= a when 0 to 3, b when 4 | 6 | 8, c when 10, d when others; ``` = Feb 2 2024 ```rust signal_name <= value_1 WHEN condition1 ELSE value_2 WHEN condition2 ELSE ... value_n WHEN conditionN ELSE value_x; ``` ```rust x <= a when (s = "00") else b when (s = "01") else c when (s = "10") else d; ``` = Feb 5 2024 -- Testbench examples -- end of first midterm material ```rust // & operator is string concatenation // report "input = " & to_string(to_integer(unsigned(input))) & " isprime = " & to_string(isprime); // empty testbench entity testbench is end testbench architecture test+adder of testbench is signal clk : std_logic := '0'; signal rst : std_logic := '0'; signal a : std_logic_vector(4 downto 0); signal b : std_logic_vector(4 downto 0); signal c : std_logic_vector(4 downto 0); begin dut : entity adder port map( in1 => a, in2 => b, out1 => c); //process for simulating the clock // process begin clk <= not(clk); wait for 20ns; end process; //This process does the RESET process begin rst <= '1'; wait for 53ns; rst <= '0'; wait until(rst'event and rst = '1'); //stops this process from happening again (this is an initial) end process; ``` - VHDL supports generics - An aggregate is a collection of items that are gathere together to form a total quantity ```rust v <= (others => '0'); v <= ('1', '0', others => '0'); // "00000000" v <= (4 => '1', others => '0'); // "00010000" v <= ( 3 DOWNTO 0 => '0', others => '1'); // "11110000" //example generics ENTITY counters IS GENERIC ( WIDTH: INTEGER := 8); PORT( d : IN STD_LOGIC_VECTOR(WIDTH-1 DOWNTO 0); clk: IN STD_LOGIC; clear: IN STD_LOGIC; load: IN STD_LOGIC; up_down : IN STD_LOGIC; qd : OUT STD_LOGIC_VECTOR(WIDTH-1 DOWNTO 0); ) ``` - For any instances of a component, use FOR GENERATE - This instantiates an object in each loop, which can help you create many numbers of similar components - no breaks, not actual loop = Feb 7 2024 -- Review Day -Multi state logic: 0, 1, U Z+, Z- Z+ input comes from floating output closer to a 1, Z- floatint output closer to a zero weak 1 vs weak 0 Tristate buffer: VHDL overall layout entity - parts specification architecture - actual logic description. process is piece that goes into architecture. behavioral, structural, dataflow. process is behavioral. switch level simulation - hybrid electrical and event driven simulation. mixed mode - is another hybrid simulation but ususally has 2 seperate simulations running in tandem. rise/fall time vs rise/fall delay -- testbench variables are not signals, cannot be assigned to ports or sensitivity list, etc. do as much as you can without variables. := assignment, <= continuous assignment ```rust process(clk, rst) if(rst) then q <= 0; else if(clk'event = 1 and clk = 1) then q <= d; end; end; ``` = Feb 12 2024 -- VHDL/CMOS - State machine might show up on final. - gtkwave - glhdl = Feb 16 2024 -- CMOS - AOI - AND OR INVERT - OAI - OR AND INVERT - AND and OR cannot be implemented directly by cmos logic, NAND and NOR can be however. - Be able to determine types of equations from diagrams and diagrams from equations. - n-type and p-type transistor back to back is tristate buffer/inverter. - parasitic capacitance and dynamic operation - Rise/Fall time - Parasitic capacitance negatively affects speed. Time to charge/discharge capacitors. - Propogation delay is time between 50% of "swing" of one signal and the 50% swing of another. - reminder: capacitance from dielectric is gate capacitance. - Fan in vs Fan out - fan in : number of inputs to a gate - fan out: number of outputs to a gate 4-5 is a pretty reasonable limit for fan out. = Feb 19 2024 -- CMOS Part 2 - Common fan-out issue is driving large number of chips, as number of chips gets larger the capacitance of each gate needs to be dealt with. - High fan-in side effects (series): - Increases output resistance or equivalently input capacitances which leades to larger propagation delay. - Increases $V_(O L)$ reducing noise margin. - High fan-in effects (parallel): - Increases load capacitances at gate output -> larger propagation delay - unlikely all transistors would turn on when $V_f$ changes from high to low - Logical Effort is a term that describes a metric to determine the delay in CMOS circuits. - Circuit Delay can be calculated from the fanout and the logical effort of a circuit - To compute the max delay, determine the longest path then multiply logical effort by the fan out - Wire Delay: in modern integrated circuits, large fraction of delay and power are due to driving wires that connect components. A long chip wire has significant series resistance and parallel capacitance - results in unacceptable delay and rise time - increasing the drive capacity of X does not help due to the resistivity of the line - using repeaters at fixed intervals can make delay linear. - Most energy dissipation in modern IC's comes from charging and discharging gate and wire capacitance. - Energy consumption is dominated by the largest gate in the path - Power = $ 0.5 C V^2 f alpha$ - Due to shrinking gate lengths and lower supply power has become significant. - As the threshold voltage decreases, the amount of leakage current increases exponentially. - CMOS capacitance scales with L for constan supply voltage, energy of a module also scales w/l - Energy density of a chip thus increases as 1/L - Worse scaling with frequency increases -- factor of $ 1/L^2 $ - Current solution is parallelism, multiple CPUs on one chip. = Feb 19 2024 -- Programmable Logic - General purpose building blocks: - Decoder - Encoder - Multiplexer - Arbiter - Comparator - Read-only memories - One-Hot encoding: - One bit in a binary number represents one element. Only one bit may be a 1 at any time. = Feb 21 2024 - Decoder - device that converts symbols from one code to another - a binary to one-hot decoder converts a symbol from binary code to a one-hot code - larger decoders can be built from several smaller decoders. - 6 -> 64 bit decoder requires 64 6-input AND gates (384 inputs) - 6 ->64 decoder using 2->4 decoders requires: 12 2-input AND gates (24 inputs), 64 3-input AND gates (192 inputs) - faster, smaller, lower power. = Feb 26 2024 - 3 input look up table: 256 functions programmable for 8 bits. - PLDs and PLAs are tied to output pins in hardware, whereas FPGAs can have any function routed to any pin. = Feb 28 2024 - Synchronous sequential logic - State Machine Types: - Moore : No outputs happen on state transitions, outputs only change with clock - Mealy : same as moore, but inputs can bypass to trigger outputs, regardless of clock, asynchronous transitions/logic = March 04 2024
https://github.com/vcu-ssg/ssg-poster-library
https://raw.githubusercontent.com/vcu-ssg/ssg-poster-library/main/typst-templates/poster-vcu/_extensions/poster-vcu/typst-template.typ
typst
// This is an example typst template (based on the default template that ships // with Quarto). It defines a typst function named 'article' which provides // various customization options. This function is called from the // 'typst-show.typ' file (which maps Pandoc metadata function arguments) // // If you are creating or packaging a custom typst template you will likely // want to replace this file and 'typst-show.typ' entirely. You can find // documentation on creating typst templates and some examples here: // - https://typst.app/docs/tutorial/making-a-template/ // - https://github.com/typst/templates #let article( title: none, authors: none, date: none, abstract: none, cols: 1, margin: (x: 1.25in, y: 1.25in), paper: "us-letter", lang: "en", region: "US", font: (), fontsize: 11pt, sectionnumbering: none, toc: false, doc, ) = { set page( paper: paper, margin: margin, numbering: "1", ) set par(justify: true) set text(lang: lang, region: region, font: font, size: fontsize) set heading(numbering: sectionnumbering) if title != none { align(center)[#block(inset: 2em)[ #text(weight: "bold", size: 1.5em)[#title] ]] } if authors != none { let count = authors.len() let ncols = calc.min(count, 3) grid( columns: (1fr,) * ncols, row-gutter: 1.5em, ..authors.map(author => align(center)[ #author.name \ #author.affiliation \ #author.email ] ) ) } if date != none { align(center)[#block(inset: 1em)[ #date ]] } if abstract != none { block(inset: 2em)[ #text(weight: "semibold")[Abstract] #h(1em) #abstract ] } if toc { block(above: 0em, below: 2em)[ #outline( title: auto, depth: none ); ] } if cols == 1 { doc } else { columns(cols, doc) } }
https://github.com/MrToWy/Bachelorarbeit
https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Chapters/3-Entwurf.typ
typst
#import "../abbreviations.typ": * #import "../Template/customFunctions.typ": * #import "@preview/pintorita:0.1.1" #show raw.where(lang: "pintora"): it => pintorita.render(it.text) = Entwurf <entwurf> In diesem Kapitel werden die gesammelten Anforderungen aus @anforderungsanalyse verwendet, um die Implementierung in @implementierung vorzubereiten. Hierzu wird zunächst ein Datenbankschema erstellt, um die Datenbank fürs Backend anzupassen (@dbschema). Anschließend werden die Benutzeroberflächen prototypisch geplant (@UI). Im letzten Schritt werden die benötigten Endpunkte des Backends ermittelt (@endpoints). Die Entwurfsphase ist für die Entwicklung des Systems wichtig, damit grundlegende Entscheidungen möglichst früh getroffen werden. Wenn die Entwicklung des Systems bereits begonnen hat, benötigen nachträgliche Änderungen oft einen höheren Aufwand. Durch einen guten Entwurf soll die Implementierung beschleunigt werden, da in der Implementierungsphase dann weniger Entscheidungen getroffen werden müssen. @kleuker_grundkurs_2013 == Aufbau der Datenbank <dbschema> Die Erstellung eines Datenbankschemas ist ein wichtiger Schritt. Mit einem vollständigen Datenbankschema wird sichergestellt, dass alle benötigten Daten in der Datenbank gespeichert werden können, dass auf die Daten effizient zugegriffen werden kann und dass die Datenkonsistenz gewährleistet ist. @relationaleDb[Kapitel 3] Die Datenbankschemas werden mithilfe der Krähenfußnotation @relationaleDb[Seite 26] erstellt. Die Bedeutung der Kardinalitäten ist in @kardinalitäten erklärt. @EntityRelationshipDiagram #figure(caption: "Notation der Kardinalitäten")[ #table( columns: (auto, auto), inset: 10pt, align: horizon, table.header( [*Zeichen*], [*Bedeutung*], ), [o|],[0 oder eins], [||],[genau eins], [o{],[0 oder mehrere], [|{],[eins oder mehrere], ) ]<kardinalitäten> === Benötigte Tabellen Für die Kernfunktionalität werden zunächst Tabellen für Module und Teilmodule benötigt. Um die Organisationsstruktur der Hochschule abbilden zu können, werden weiterhin Tabellen für Fakultäten, Abteilungen und Studiengänge benötigt. Damit ein Login möglich ist, kann die Tabelle User benutzt werden. Für die Anforderung @SHOWCHANGES wird eine Tabelle Changelog und eine Tabelle ChangelogItem benötigt. In der Tabelle Changelog wird für jede Änderung ein Eintrag eingetragen, welcher den ausführenden User und eine kurze Zusammenfassung beinhaltet. In den ChangelogItems stehen dann die konkreten geänderten Felder. Damit ein Modul einer Gruppe zugewiesen werden kann, wird eine Tabelle ModuleGroup benötigt, in der alle verfügbaren Gruppen aufgelistet sind. Des Weiteren werden noch die Tabelle "Job" und verschiedene "PDFStructure"-Tabellen für die Generierung der PDF-Dateien benötigt (dazu später mehr in @pythonScript). Jede Tabelle erhält eine Spalte "Id" als Primärschlüssel. @relationaleDb[Kapitel 3] Über diese Id werden die Relationen zu anderen Tabellen ermöglicht. Zusätzlich wird für jede Eigenschaft aus @structure eine dazugehörige Spalte benötigt. === Überlegungen zur Übersetzbarkeit Um die Anforderung @TRANSLATEMULTIPLE umsetzen zu können, wird eine Datenstruktur benötigt, welche die verschiedenen Texte in verschiedenen Sprachen aufbewahren kann. Hierzu wurden zunächst verschiedene Möglichkeiten evaluiert, um das beste Vorgehen zu ermitteln. #heading(level: 4, outlined: false, numbering: none)[Idee 1] Für die spätere Entwicklung des Frontends könnte es praktisch sein, alle Texte einer Art in einer eigenen Tabelle aufzubewahren (@idea1). Die Eingabe eines Textes könnte dann mit allen bisherigen Texten in der Tabelle abgeglichen werden, um Fehler zu finden. Für die erste Idee würde also pro Textfeld eine eigene Tabelle angelegt werden. Das Modul hätte beispielsweise für den Titel dann nur eine Id, die auf einen Eintrag in der Tabelle ModuleTitle verweist. ModuleTitle hätte dann einen Verweis auf TranslatedText. In TranslatedText könnten dann die konkreten Texte stehen. Diese Methodik hat den Nachteil, dass pro Textfeld eine neue Tabelle benötigt wird. Dadurch kann die Datenstruktur schnell unübersichtlich werden. Außerdem könnte der Zugriff kompliziert sein. Für die Entwicklung dieses Systems sollte eine einfachere Lösung gesucht werden. #heading(level: 4, outlined: false, numbering: none)[Idee 2] Eine etwas einfachere Methode wäre es, die übersetzten Texte in einer zentalen Tabelle "Translations" abzulegen (@idea2). Die Tabelle Modul hätte dann z. B. die Spalten TitleTranslationId, welche ein Foreign-Key auf die Tabelle Translation wäre. In Translation würde es dann die Spalten "Id", "English" und "German" geben, um die Texte dort abzuspeichern. Für diese Lösung muss nur eine einzelne zusätzliche Tabelle erstellt werden, was den initialen Aufwand minimiert. Auch hat die zentrale Speicherung von Texten den Vorteil, dass diese sehr einfach verwaltet werden können. Bei der Einführung einer neuen Sprache müsste nur eine neue Spalte zur Tabelle hinzugefügt werden. Die Lösung hat allerdings einen entscheidenen Nachteil. Ein Teilmodul hat 12 zu übersetzende Felder. Wenn dieses nun auf der Oberfläche angezeigt werden soll, muss für jedes der Felder ein Datenbank-Join, oder eine Unterabfrage gemacht werden. In der Tabelle Modul wird für jedes Textfeld nur eine Id abgelegt, die dann aus der Übersetzungstabelle abgerufen werden muss. Dies hätte einen hohen Aufwand im zukünftigen Quellcode der Anwendungen zu Folge. #heading(level: 4, outlined: false, numbering: none)[Idee 3] Um Zugriffe auf die Texte einfacher zu gestalten, wurde eine weitere Möglichkeit entwickelt (@idea3). Für jede Entität (z.B. Modul, Teilmodul...) wird neben der normalen Tabelle eine weitere Tabelle mit dem Suffix "\_Translations" angelegt. Diese Zusatztabelle enthält die übersetzten Textfelder. Für jede Sprache gibt es eine Zeile in der neuen Tabelle. Wenn es also zwei Sprachen gibt (Englisch & Deutsch) gibt es für jedes Modul zwei Einträge in der dazugehörigen Übersetzungstabelle. Um nun ein Teilmodul mit 12 Feldern aus der Datenbank zu erhalten, wird mit dieser Lösung nur noch ein Join benötigt. Der Quellcode der zukünftigen Anwendung sollte dadurch deutlich besser wartbar sein. #diagramFigure("ER-Diagramm - Idee 1", <idea1>, "ER_Translation") #diagramFigure("ER-Diagramm - Idee 2", <idea2>, "idea1") #diagramFigure("ER-Diagramm - Idee 3", <idea3>, "idea2") === Resultierendes Schema In @ER ist ein kleiner Teil des entstandenen ER-Diagramms zu sehen. Die vollständige Version des Diagramms ist sehr groß und findet daher hier keinen Platz. Die vollständige Abbildung ist in der Dokumentation des Systems zu finden (Pfad: #link("https://studymodules-docs.tobi.win/docs/backend/Architecture/Database")[/docs/backend/Architecture/Database]). In dem Diagramm ist beispielsweise auf der linken Seite zu sehen, dass ein Modul immer einem Studiengang zugewiesen sein muss. Andersherum kann ein Studiengang 0 bis n verschiedene Module anbieten. Das Schema soll Entwickelnde dabei unterstützen, die Datenstruktur des Systems zu verstehen. Anhand des Schemas kann im folgenden Kapitel die Datenbank des Backends erstellt werden, sodass diese dann alle benötigten Daten abspeichern kann. #diagramFigure("ER-Diagramm - Gesamtbild", <ER>, "simple_ER") #block(breakable:false)[ == Benutzeroberflächen <UI> Im Folgenden wird mithilfe von Mockups entworfen, wie die Benutzeroberflächen der neuen Anwendung aussehen sollen. Da an Mockups schnell Änderungen vorgenommen werden können, soll dieser Prozess dabei helfen, zeiteffizient gute Lösungen zu finden. Es werden zunächst in @scaffold die Elemente zur Navigation durch die Anwendung vorgestellt. Anschließend werden in @views die verschiedenen Komponenten der Anwendung, sowie die daraus zusammengesetzten Ansichten skizziert. ] In den Mockups wird darauf geachtet, die von #cite(<designInterfaces>, form: "prose") beschriebenen bekannten UI-Patterns anzuwenden. Dadurch sollen die Ansichten der neuen Anwendung selbsterklärend sein, da sie anderen modernen Websites ähneln. Weiterhin soll jede Ansicht, wenn möglich, genau einen Zweck verfolgen. Entweder soll eine Übersicht mehrere Elemente zeigen, oder ein einzelnes Element soll im Fokus stehen und detailliert gezeigt werden. Alternativ kann ein neues Element erstellt werden, oder eine Aufgabe soll erledigt werden. Das Mischen dieser Zuständigkeiten kann zu einer überladenen Website führen und wird deshalb, wenn möglich vermieden. @designInterfaces[Seite 35 ff.] /* Usability / User Experience Definition \ DIN 9241-210 Benutzungsschnittstelle\ DIN 9241-110 max. 7 Informationen gleichzeitig verarbeiten \ https://lexikon.stangl.eu/2912/chunks Miller, <NAME>. (1956). The Magical Number 7, Plus or Minus Two: Some Limits on Our Capacity for Processing Information. Psychological Review, 63, pp. 81-97. (Stangl, 2024). */ === Grundgerüst <scaffold> Die Oberfläche der Anwendung besteht aus einer oberen Leiste (Toolbar) und einer ausklappbaren Seitenleiste (Drawer). Unter der Toolbar ist die eigentliche Anwendung zu sehen, die aus verschiedenen Ansichten besteht. Die Toolbar ist in jeder Ansicht zu sehen. Diese Art der Navigation ist mittlerweile Standard und sollte für den Großteil der User selbsterklärend sein. @designInterfaces[Seite 131] #let toolbarText = [ #heading(level: 4, numbering:none, "Toolbar") Um mit möglichst wenig Aufwand (@CLICKS) jederzeit die Suchfunktion (@SEARCH) nutzen zu können, wird diese in der Toolbar platziert (siehe @grundgerüst). Neben der Suche ist ein Dropdown, mit dem die angezeigte Sprache umgestellt werden kann (@TRANSLATEMULTIPLE). Damit jederzeit erkenntlich ist, in welcher Ansicht sich der User befindet (@PATH), wird diese Information als Breadcrumb auf der Toolbar platziert. @designInterfaces[Seite 193 f.] ] #let toolbarImage = imageFigure(<grundgerüst>, "mockups/Grundgerüst.svg", "Toolbar") #let boxedToolbarImage = box(toolbarImage, inset: 0.5em) //#wrap-content(align: bottom + right,column-gutter: 1em,boxedToolbarImage, toolbarText) #toolbarText #toolbarImage #let drawerText = [ #heading(level: 4, numbering:none, "Drawer") Funktionen, die nicht oft benötigt werden, werden in einer ausklappbaren Seitenleiste (Drawer) platziert. Der Drawer kann mithilfe eines Knopfes ausgeklappt werden, welcher sich auf der Toolbar befindet. Somit können auch diese Funktionen mit wenig Aufwand (@CLICKS) von jeder Ansicht aus erreicht werden. Im Drawer sind die Masken zur Verwaltung der Benutzer (@CRUSER), zur Anzeige gelöschter Module (@SOFTDELETE) und zur Ansicht alter Prüfungsordnungen (siehe @drawer). Außerdem wird hier die Versionsnummer angezeigt, damit jederzeit überprüft werden kann, mit welcher Version des Systems gearbeitet wird.] #let drawerImage = imageFigure(width: 50%, <drawer>, "mockups/Drawer.png", "Drawer") //#wrap-content(align: bottom + right, drawerImage, drawerText) #drawerText #drawerImage === Komponenten und Ansichten <views> #heading(level: 4, numbering:none, "Login") #let loginText = [ Wenn ein User administrative Aufgaben übernehmen möchte, muss er sich zunächst über den Login-Button im Drawer (@drawer) anmelden (@LOGIN). Hierzu wird ein Screen benötigt, auf dem der User seine E-Mail und sein Passwort eingeben kann. Da Accounts von der studiengangsverantwortlichen Person erstellt werden (@CRUSER), wird auf dieser Seite keine Möglichkeit benötigt, sich selbst zu registrieren. Damit verständlich ist, wie ein Account erstellt werden kann, wird diese Information als Infotext unter dem Login-Button platziert (siehe @login).] #let loginImage = imageFigure(<login>, "mockups/Login.png", "Login", width: 20em) //#wrap-content(align: top + right, loginImage, loginText) #loginText #loginImage #box[ #let searchFunctionImage = imageFigureNoPad(<search>, "mockups/Search.svg", "Suche mit Dropdown", width: 6.7em) #let searchFunctionText = [ #heading(level: 4, numbering:none, "Suchfunktion") Für die Suchfunktion wird eine Komponente benötigt, mit der ein bestimmtes Modul gefunden werden kann. In die Suchleiste soll der User den Namen des gesuchten Moduls eingeben können. Dabei muss der Modulname nicht vollständig eingegeben werden. Module, die zu dem eingegebenen Text passen, sollen vorgeschlagen werden. Durch die Vorschläge (siehe @search) spart der User Zeit, da nicht der vollständige Modulname eingegeben werden muss und auch nicht erst zu einer Ergebnisseite weitergeleitet wird. @designInterfaces[Seite 502 ff.] Der User kann einen Vorschlag anklicken, um sich dieses Modul anzusehen. ] #let boxed = box(searchFunctionImage, inset: 0.5em) #wrap-content(align: bottom + right, boxed, searchFunctionText) ] #heading(level: 4, numbering:none, "Navigation") Auf der Startseite der neuen Anwendung soll nicht direkt die Modulübersicht präsentiert werden, weil diese ohne gesetzte Filter überladen wirken könnte. Stattdessen wird der User zunächst auf eine Übersicht aller Fakultäten geleitet (@navigationMockup). Hier kann entweder eine Fakultät ausgewählt werden, oder es kann per Klick auf "Alle Module" direkt zur Modulübersicht gewechselt werden. Die Farben der einzelnen Fakultäten sind dieselben wie auf der Website der #hsh @HochschuleHannover und sollen den User dabei unterstützen, schnell die richtige Fakultät zu finden. Diese Ansicht wird übersprungen, falls der User einen direkten Link zu einem bestimmten Studiengang aufruft. Dieser Link könnte beispielsweise auf der Website der Hochschule platziert sein. Der User wird dann direkt zur Modulübersicht geleitet. #imageFigure(<navigationMockup>, "mockups/Navigation.png", "Startseite - Auswahl Fakultät") Wenn in der Fakultätsauswahl eine Fakultät ausgewählt wurde, geht es weiter auf die Detailansicht der jeweiligen Fakultät (@navigationMockupLevel2). Hier werden alle Studiengänge der Fakultät aufgelistet. Die Studiengänge sind gruppiert nach der Abteilung, zu der sie zugehörig sind. Zur besseren Übersicht sind die Bachelorstudiengänge über den Masterstudiengängen angeordnet und zusätzlich farblich markiert. Des Weiteren gibt es die Möglichkeit in der oberen Leiste gezielt nach einem Studiengang zu suchen, oder nach Bachelor/Master zu filtern. Sobald auf dieser Übersicht ein Studiengang angeklickt wird, öffnet sich die Modulübersicht. In der Modulübersicht sind dann die Filter automatisch an die zuvor ausgewählte Fakultät und den ausgewählten Studiengang angepasst. #imageFigure(<navigationMockupLevel2>, "mockups/NavigationLevel2.png", "Startseite - Auswahl Studiengang") #pagebreak() #heading(level: 4, numbering:none, "Modulübersicht") #let moduleOverviewText = [ In der Modulübersicht (@moduleoverview) sollen alle Module in einer tabellarischen Übersicht angezeigt werden. In der Tabelle sollen nur die für #link(<UseCaseInfoModule>)[Use Case 2] benötigten Daten gezeigt werden. Alle weiteren Informationen sind dann in der detaillierten Ansicht zu finden. Die detaillierte Ansicht soll sich durch Anklicken eines Eintrags öffnen. Über der Tabelle gibt es mehrere Filtermöglichkeiten, um die gesuchten Module schneller finden zu können. ] #let moduleOverview = imageFigureNoPad(<moduleoverview>, "mockups/Modulübersicht.png", "Modulübersicht und Filter", width: 16em) #wrap-content(align: bottom + right, moduleOverview, moduleOverviewText) //#moduleOverviewText //#moduleOverview #heading(level: 4, numbering:none, "Detailansicht eines Modules") Sobald ein Modul ausgewählt wurde, wird die Detailansicht eines Modules (@preview) präsentiert. Hier sollen die Details des Modules übersichtlich dargestellt werden. Einzelne Informationen können beispielsweise mithilfe eines Graphen oder anhand von Icons visualisiert werden. Hierdurch können Studierende oder studieninteressierte Personen innerhalb kurzer Zeit einen Eindruck erhalten, was die Rahmenbedingungen des Modules sind. #imageFigure(<preview>, "modern-preview.png", "Detailansicht Modul") #box[ #heading(level: 4, numbering:none, "Modul anlegen / bearbeiten") Angemeldete User sehen auf verschiedenen Seiten Buttons, mit denen sie Module anlegen und bearbeiten können. Damit die Dateneingabe für den User möglichst intuitiv ist, orientiert sich die Sortierung der Eingabefelder an der Sortierung der Felder im resultierenden PDF. Um eine einheitliche Optik zu erreichen wurden anschließend die Felder geringfügig umsortiert, sodass gleiche Datentypen, oder Felder, die thematisch zueinander passen, nah beieinander sind. Das resultierende PDF wird in der Vorschau imitiert. Hier werden die Eingaben des Users in Echtzeit angezeigt, sodass der User jederzeit sehen kann, wie die Modulbeschreibung aussehen wird. #linebreak() #imageFigureNoPad(<addModule>, "mockups/AddModule.png", "Modul hinzufügen") ] #let changeMessageText = [Damit in der Auflistung der Änderungen eine hilfreiche Nachricht steht, sollen die vorgenommenen Änderungen beim Speichern eines Moduls zusammengefasst werden. Hierzu fragt ein Pop-up nach der Zusammenfassung und erklärt dem User, wo dieser Text zu sehen sein wird (@changeMsgImg).] #let changeMessageImg = imageFigureNoPad(<changeMsgImg>, "mockups/ÄnderungsMessage.png", "Text für Änderungshistorie", width: 12em) #wrap-content(align: top + right, changeMessageImg, changeMessageText) #let translateText = [ Für die Erstellung oder Bearbeitung eines Moduls kann entweder eine vorhandene Vorlage aus einem Dropdown ausgewählt werden (@lookup, @translateDropdown), oder ein neuer Text durch Klicken auf den "Neu"-Button angelegt werden. Dies ist besonders praktisch, da sich bestimmte Texte oft wiederholen. Wenn ein neuer Text angelegt wird, muss der User einen Kurztext angeben, der im Dropdown angezeigt wird, sowie die tatsächlichen Texte, die später im Modulhandbuch abgebildet werden (@translatePopup). ] #let translateDropdownImage = imageFigure(<translateDropdown>, "mockups/ÜbersetzbarkeitDropdown.svg", "Dropdown zur Textauswahl", width: 12em) #translateText #translateDropdownImage #imageFigure(<translatePopup>, "mockups/Übersetzbarkeit.svg", "Neuen Text hinzufügen", width: 16em) #block(breakable:false)[ #heading(level: 4, numbering:none, "Userverwaltung") #let userText = [ Das Hinzufügen eines neuen Users benötigt ebenfalls eine Eingabemaske (@createUser). Der Inhalt des Feldes "E-Mail-Adresse" wird automatisch anhand des eingegebenen Vor- und Nachnamens ausgefüllt, kann aber anschließend auch manuell bearbeitet werden, falls die E-Mail-Adresse vom bekannten Schema (<EMAIL>) einer Adresse der #hsh abweicht. Dies ist beispielsweise der Fall, wenn mehrere Personen denselben Vor- und Nachnamen haben. ] #let userImage = imageFigureNoPad(<createUser>, "mockups/CreateUser.png", "Neuen User hinzufügen", width: 8em) //#userText //#userImage #wrap-content(align: top + right, userImage, userText) ] #box[ #heading(level: 4, numbering:none, "Änderungshistorie") #let changeLogText = [ Alle Änderungen sollen nachverfolgbar sein (@SHOWCHANGES). Hierzu wird eine Übersicht über alle Änderungen benötigt (@changelogImage). Wenn eine Reihe der Tabelle, also eine einzelne Änderung angeklickt wird, öffnet sich eine Ansicht, in der die vorherige Version und die bearbeitete Version nebeneinander dargestellt sind. Mit einem Knopfdruck können die vorgenommenen Änderungen rückgängig gemacht werden. Auch hier wird nach einem Kommentar gefragt, um die Änderungen zusammenzufassen (@changeMsgImg) ] #let changeLogImage = imageFigure(<changelogImage>, "mockups/Änderungshistorie.png", "Änderungshistorie", width: 24em) #changeLogText #changeLogImage ] #box[ == Benötigte Endpunkte im Backend <endpoints> Damit das zukünftige Frontend mit dem Backend kommunizieren kann, muss das Backend Endpunkte (auch genannt Ressourcen, Endpoints, Routen...) bereitstellen, die das Frontend nutzen kann. Ein Endpunkt ist beispielsweise die Auflistung aller Module und ist mithilfe einer URI aufrufbar (hier z.B. /modules). Ein einzelnes Modul könnte über den Endpunkt #box[/modules/{id}] aufgerufen werden. @restUndHTTP[Abschnitt 3.2] ] In der vorliegenden Version des "StudyBase-"Backends gibt es bereits mehrere Endpunkte. Im Folgenden soll ermittelt werden, welche Endpunkte für das neue System benötigt werden. Nach dem YAGNI-Prinzip sollen dann in @implementierung nur die Endpunkte ausgearbeitet werden, die für das neue System benötigt werden. @restUndHTTP[Unterabschnitt 4.2.8] Durch die Planung, welche Endpunkte benötigt werden und wie diese aussehen sollen, wird die spätere Implementierung in @createEndpoints beschleunigt, da dann dort weniger Entscheidungen getroffen werden müssen. #heading(level: 4, numbering: none)[Endpunkt /modules] Im zukünftigen Frontend sollen an verschiedenen Stellen die Module aufgelistet werden. Die Suchfunktion soll Vorschläge anhand der Modulliste machen, die Studiengänge sollen ihre Module anzeigen und die studiengangsverantwortliche Person soll alle Module verwalten können. Es wird also eine Ressource benötigt, die alle Module auflistet. Für die Suchfunktion muss die Ressource allerdings weniger Informationen anzeigen, als für die Detailansicht eines Moduls. Beispielsweise ist für die Suche zunächst uninteressant, was die angestrebten Lernergebnisse eines Moduls sind. Durch die Begrenzung der übersendeten Informationen müssen weniger Daten vom Backend ans Frontend gesendet werden. Dies trägt zu einer besseren Performance bei, weil weniger Daten über das Internet übertragen werden. Die Suchfunktion benötigt: 1. den Namen des Moduls, um einen Vorschlag anzuzeigen (@search) 2. die Id des Moduls, um die Detailansicht zu dem Modul öffnen zu können 3. den Studiengang des Moduls, um die Ergebnisse gruppieren zu können (@search) Die Tabellen im restlichen System profitieren dahingegen von zusätzlichen Informationen. Diese können dabei helfen, die Module zu filtern (@FILTER), oder schnell Informationen zu einem Modul herauszufinden, ohne dieses aufrufen zu müssen. Es werden also die folgenden Informationen zusätzlich benötigt: 4. Semester, in dem das Modul vorgeschlagen ist (@recommendedSemester), um beispielsweise nur die Module des aktuellen Semesters zu filtern 5. Credits, um nach Modulen filtern zu können, die einen bestimmten Aufwand haben 6. Gruppe, um beispielsweise ein interessantes Wahlpflichtfach zu finden 7. Ansprechpartner (@responsible), um schnell eine Kontaktinformation zu erhalten Der Endpunkt /modules soll zusätzlich POST-Anfragen entgegennehmen können, um neue Module anzulegen. #heading(level: 4, numbering: none)[Endpunkt /modules/{id}] Hier sollten alle Informationen zur Verfügung gestellt werden, die für die Detailansichten eines einzelnen Moduls benötigt werden. Es müssen also alle Informationen aus @properties enthalten sein. Der Endpunkt /modules/{id} soll zusätzlich PUT-Anfragen entgegennehmen können, um bestehende Module bearbeiten zu können. #heading(level: 4, numbering: none)[Endpunkt /modules/{id}/changes] Hier sollten alle Informationen zur Verfügung gestellt werden, die für die Änderungshistorie eines Moduls benötigt werden (@changelogImage). Dazu gehört die Auflistung aller vorgenommenen Änderungen, der Autor der Änderung, sowie der erklärende Text, der bei einer Änderung angegeben werden muss (@changeMsgImg). #heading(level: 4, numbering: none)[Endpunkt /submodules] Ähnlich wie schon bei /modules wird eine Auflistung aller Teilmodule benötigt. Damit Teilmodule auffindbar sind, sollte die Auflistung den Namen des Teilmodules enthalten. Außerdem könnte die verantwortliche Person enthalten sein, damit Modulverantwortliche Personen nach den Teilmodulen filtern können, für die sie verantwortlich sind. Der Endpunkt /submodules soll zusätzlich POST-Anfragen entgegennehmen können, um neue Teilmodule anzulegen. #heading(level: 4, numbering: none)[Endpunkt /submodules/{id}] Hier sollten alle Informationen zur Verfügung gestellt werden, die für die Detailansichten eines einzelnen Teilmoduls benötigt werden. Es müssen also alle Informationen aus @submoduleProps enthalten sein. Der Endpunkt /submodules/{id} soll zusätzlich PUT-Anfragen entgegennehmen können, um bestehende Teilmodule bearbeiten zu können. #heading(level: 4, numbering: none)[Endpunkt /group] Für das Dropdown in dem die Gruppe eines Modules (@group) angegeben wird, wird ein eigener Endpunkt benötigt. Der Endpunkt /group soll zusätzlich POST-Anfragen entgegennehmen können, um neue Gruppen anzulegen. #heading(level: 4, numbering: none)[Endpunkt /language] Die Anwendung soll mehrere Sprachen unterstützen (@TRANSLATEMULTIPLE). Damit ein Wechsel der Sprache möglich ist, liefert dieser Endpunkt eine Liste der unterstützten Sprachen. #heading(level: 4, numbering: none)[Endpunkt /autocomplete/{languageId}?type={type}] Dieser Endpunkt soll alle verfügbaren Übersetzungen des angegebenen Typs zurückgeben. Ein Typ ist hier beispielsweise "EXAM_TYPE", für das Dropdown in dem die Prüfungsart angegeben wird (@exam). Mithilfe der Information sollen die verschiedenen Dropdowns in der Modulbearbeitung (@addModule), oder der Usererstellung (@createUser) befüllt werden. #heading(level: 4, numbering: none)[Endpunkt /faculties] Dieser Endpunkt ist für die Übersicht aller Fakultäten (@navigationMockup) zuständig. Hier ist es ausreichend, die Id der Fakultät sowie deren Namen bereitzustellen. #heading(level: 4, numbering: none)[Endpunkt /faculty/{id}] Für die Auswahl des Studiengangs (@navigationMockupLevel2) müssen alle Abteilungen der gewählten Fakultät geladen werden. Außerdem muss für jede Abteilung übermittelt werden, welche Studiengänge angeboten werden. Die Studiengänge müssen ein Feld enthalten, welches zwischen Bachelor- und Masterstudiengang unterscheidet, damit nach dieser Information gefiltert werden kann. #heading(level: 4, numbering: none)[Endpunkt /department] Dieser Endpunkt bietet eine Auflistung aller Abteilungen an. Zusätzlich sollten POST-Requests angenommen werden, um neue Abteilungen hinzufügen zu können. #heading(level: 4, numbering: none)[Endpunkt /degrees]<degreesEndpoint> Dieser Endpunkt bietet eine Auflistung aller Studiengänge an. Zusätzlich sollten POST-Requests angenommen werden, um neue Studiengänge hinzufügen zu können. #heading(level: 4, numbering: none)[Endpunkt /auth/login] Für den Login (@login) wird ein Endpunkt benötigt, der E-Mail und Passwort entgegennimmt, validiert und einen gültigen Token zurückgibt. Mithilfe des Tokens können die administrativen Funktionen genutzt werden, ohne sich jedes Mal mit E-Mail und Passwort autorisieren zu müssen. Dieser Endpunkt bestand bereits und wurde im Rahmen dieser Arbeit nicht verändert. #heading(level: 4, numbering: none)[Endpunkt /job] Für die PDF-Generierung wird ein Endpunkt benötigt, der eine Auflistung der Kompilierungsaufträge anbietet. Dieser Endpunkt muss POST-Anfragen annehmen, damit neue Aufträge angelegt werden können. Außerdem müssen PATCH-Anfragen angenommen werden, um den Status des Jobs zu verändern. == Zwischenfazit Im vergangenen Kapitel wurde das gesamte System geplant. Für das Backend gibt es ein Datenbankschema, sowie einen Plan, wie die Endpunkte der API gestaltet werden sollen. Für das Frontend gibt es Mockups für das Grundgerüst der Anwendung, sowie Mockups für einige Komponenten und Ansichten. Dank der detaillierten Planung sind im folgenden @implementierung weniger Entscheidungen zu treffen, sodass die Implementierung risikofreier ist.
https://github.com/ammar-ahmed22/typst-resume
https://raw.githubusercontent.com/ammar-ahmed22/typst-resume/main/README.md
markdown
<div align="center"> <h2><NAME> Resume</h2> <a href="https://github.com/ammar-ahmed22/typst-resume/releases" > <img src="https://img.shields.io/github/v/release/ammar-ahmed22/typst-resume"/> </a> <p> Welcome to the home of my resume! Here I host my data-driven, continously deployed resume made possible by <a href="https://typst.app">Typst</a>! </p> <img src="./latest.png" width="400" /> </div> ### ✨ How It Works This section explains the workflow and technologies behind the creation and maintenance of my resume. - **Automated Updates:** On every tagged update, the source files are compiled and released with a [custom authored GitHub action](https://github.com/ammar-ahmed22/compile-typst-action). - **Data-Driven Resume:** Due to the power of [Typst](https://typst.app), all my resume data is housed in a `.yml` file. Typst is able to read and parse the data which I used to define custom functions to render my resume! - **Version Control:** All tags and releases are semantically versioned. I've also authored a custom post-commit hook which prompts me if I want to tag the commit. The git hook automatically bumps the version based on the latest tag and whether it is a major, minor, or patch change! Here's how it looks when I make a commit: ```bash >> git add . && git commit -m "Some changes" [post-commit hook] Commit done! Would you like to tag this commit? [y/N] y [current-version]: v1.7 Is this a major change or a minor change? minor [bumping-version]: v1.8 [main 0d0fce2] Some changes 2 files changed, 30 insertions(+), 4 deletions(-) ``` - **Testing:** Being a `NodeJS` fan, I set up a `package.json` in this repo to be able to run `yarn` commands to compile my resume locally. ### 🔗 Connect With Me I am always open to connecting with professionals from the industry and discussing potential opportunities. <div align="center"> <a href="https://linkedin.com/in/ammarahmed2203"> <img src="https://img.shields.io/badge/Ammar%20Ahmed-764BA2?style=for-the-badge&logo=linkedin" alt="LinkedIn"/> </a> <a href="https://ammarahmed.ca"> <img src="https://img.shields.io/badge/Website-764BA2?style=for-the-badge" alt="Personal website" /> </a> <a href="mailto:<EMAIL>"> <img src="https://img.shields.io/badge/Email-764BA2?style=for-the-badge" alt="Email"/> </a> </div>
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/page-binding_03.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test setting the binding implicitly. #set page(margin: (inside: 30pt)) #set text(lang: "he") #rect(width: 100%)[Bound] #pagebreak() #rect(width: 100%)[Right]
https://github.com/catg-umag/inach-workshop-2024
https://raw.githubusercontent.com/catg-umag/inach-workshop-2024/main/document/sections/5_diversity.typ
typst
#import "@preview/gentle-clues:1.0.0": * #import "../catgconf.typ": github-pill, cmd = Análisis de Diversidad #github-pill("vegandevs/vegan") == Rarefacción La rarefacción es una técnica que permite evaluar la riqueza de especies dentro de una comunidad en función del número de secuencias obtenidas. Es útil para determinar si las secuencias obtenidas son suficientes para capturar la diversidad de la comunidad. Para ello, se utilizan muestreos aleatorios y se visualiza en una curva el número de especies observadas a medida que aumenta el número de secuencias. Para construir las curvas de rarefacción, podemos utilizar la función #link("https://vegandevs.github.io/vegan/reference/rarefy.html")[#cmd(`rarecurve()`)] del paquete vegan en R. El parámetro `sample` agrega una línea vertical al gráfico, útil para comparar la riqueza observada con la muestra de menor número de secuencias. ```R library(vegan) min_reads <- min(rowSums(count_data_t)) # número mínimo de secuencias en una muestra rarecurve(count_data_t, step = 20, sample = min_reads) ``` #pagebreak() == Diversidad Alfa Las métricas de diversidad alfa se emplean para medir la diversidad dentro de una muestra o ecosistema, es decir, la cantidad de especies y/o su abundancia relativa. Las métricas más comunes de diversidad alfa incluyen: - *Riqueza*: Número de especies observadas en una muestra. - *Equidad*: Grado de uniformidad en la distribución de las abundancias de las especies en una muestra. \ _Interpretación_: Valores cercanos a uno indican que todas las especies tienen abundancias similares, mientras que valores cercanos a cero sugieren que una o pocas especies dominan la comunidad. - *Shannon*: Índice que mide la diversidad considerando tanto la riqueza como la equidad de las especies en una muestra. \ _Interpretación_: Valores altos indican mayor diversidad y equidad, mientras que valores bajos pueden señalar una baja equidad o riqueza. - *Chao1*: Estimación de la riqueza total, incluyendo especies no observadas. \ _Interpretación_: Si el valor de Chao1 es significativamente mayor que la riqueza observada, indica que el muestreo fue insuficiente para detectar todas las especies presentes. Para calcular estas métricas en R, también usaremos el paquete vegan. ```R library(vegan) data_richness <- estimateR(data_otu) data_evenness <- diversity(data_otu) / log(specnumber(data_otu)) data_shannon <- diversity(data_otu, index = "shannon") ``` #info(title: "Normalización y diversidad alfa")[ La diversidad alfa habitualmente se calcula sobre los datos sin procesar y sin normalizar, ya que se busca evaluar la diversidad por muestra y no comparar muestras entre sí. ] #heading([Pruebas estadísticas], level: 3, numbering: none) Podemos utilizar diferentes test estádisticos para comprobar si existen diferencias significativas entre los grupos: pruebas no paramétricas como el test de Kruskal-Wallis o el test de Mann-Whitney o pruebas parámetricas como t-test y ANOVA. Antes de utilizar pruebas parámetricas se debe comprobar la normalidad y hococedasticidad de los datos. == Diversidad Beta La diversidad beta se utiliza para evaluar las diferencias de diversidad entre muestras o ecosistemas, es decir, qué tan similares o diferentes son las comunidades microbianas entre sí. Estas métricas de distancia varían entre cero y uno, y las más comunes son: // Bray-Curtis, Jaccard, Unifrac, entre otros. - *Bray-Curtis*: Calcula la disimilitud entre muestras basándose en la abundancia de los taxones presentes en ellas. - *Jaccard*: Calcula la disimilitud tomando en cuenta solo la presencia o ausencia de los taxones, sin considerar la abundancia. - *Unifrac*: Calcula la distancia filogenética entre comunidades. Se puede calcular en dos formas: - *Unweighted UniFrac*: Considera solo la presencia o ausencia de OTUs (sin abundancia). - *Weighted UniFrac*: Incluye tanto la abundancia como la evolución filogenética de los OTUs. // Se basa en la presencia/ausencia de las especies en las muestras, incluyendo información de la abundancia. #pagebreak() Para calcular la diversidad beta, necesitamos el archivo de abundancias generado en el paso anterior y un archivo de metadatos. A continuación, un ejemplo de archivo de metadatos: ```TSV sample sex Area latitude long deep 1M Male 48.2 60° 25,0 46° 41.8 60-80 4H Female 48.2 60° 33,1 46° 02.3 120-150 5H Female 48.2 60° 30,0 46° 36.4 30-30 6H Female 48.2 60° 30,1 46° 42.7 30-33 6M Male 48.2 60° 30,1 46° 42.7 30-33 7H Female 48.1 62° 37,0 55° 26.7 30-29 7M Male 48.1 62° 37,0 55° 26.7 30-29 ``` Para visualizar la diversidad beta, se utilizan matrices de disimilitud, como Bray-Curtis o Jaccard, que luego se proyectan en un espacio bidimensional utilizando un Análisis de Coordenadas Principales (PCoA). Esta técnica reduce la dimensionalidad de los datos, facilitando la visualización de las relaciones entre muestras. Algunas funciones útiles para este análisis en R son: - #link("https://vegandevs.github.io/vegan/reference/vegdist.html")[#cmd(`vegdist()`)]: Calcula una matriz de disimilitud entre las muestras, permitiendo elegir entre métricas como Bray-Curtis, Jaccard, Euclidiana, entre otras. - #link("https://vegandevs.github.io/vegan/reference/stressplot.wcmdscale.html")[#cmd(`cmdscale()`)]: Realiza un análisis de coordenadas principales (PCoA) a partir de la matriz de disimilitud. ```R library(vegan) bray_dist <- vegdist(data_otu, method = "bray") pcoa_res <- cmdscale(bray_dist, eig = TRUE) ``` #tip(title: "Varianza explicada en un PCoA")[ Al realizar un análisis de coordenadas principales (PCoA), es importante tener en cuenta que los valores propios (eigenvalues) representan la varianza explicada por cada componente. Un eigenvalue alto indica que ese eje captura una mayor cantidad de la varianza total de los datos, lo que permite una mejor interpretación de la estructura de las muestras. ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/minimalistic-latex-cv/0.1.0/template/main.typ
typst
Apache License 2.0
#import "@preview/minimalistic-latex-cv:0.1.0": cv, entry #show: cv.with( name: "<NAME>", metadata: ( address: "1234 City, Example Street 1/A", email: "<EMAIL>", telephone: "+123456789", ), photo: image("photo.jpeg"), lang: "en", ) = Professional Experience #entry( title: "Job Title", name: "Company", date: "Start - End", location: "City, Country" ) - *Keyword:* #lorem(25) #entry( title: "Job Title", name: "Company", date: "Start - End", location: "City, Country" ) - *Keyword:* #lorem(25) #entry( title: "Job Title", name: "Company", date: "Start - End", location: "City, Country" ) - *Keyword:* #lorem(25) = Education #entry( title: "Degree Title", name: "Institution", date: "Start - End", location: "City, Country" ) - *Coursework:* #lorem(20) - *Thesis title:* #lorem(6) #entry( title: "Degree Title", name: "Institution", date: "Start - End", location: "City, Country" ) - *Coursework:* #lorem(20) - *Thesis title:* #lorem(6) = Skills *Skill 1:* #lorem(10) *Skill 2:* #lorem(10) *Skill 3:* #lorem(10) = Languages *Language 1:* #lorem(2) *Language 2:* #lorem(2) *Language 3:* #lorem(2) *Language 4:* #lorem(2)
https://github.com/denkspuren/typst_programming
https://raw.githubusercontent.com/denkspuren/typst_programming/main/wrapText/experiment.typ
typst
// Idee, Wrapping mit Aufzählungen zu realisieren #set list(marker: align(bottom + right)[This is some text]) - #lorem(100) #box() #[#rect(width: 25%)[#par(justify:true)[#lorem(10)]]] #{[#rect(width: 25%)[#par(justify:true)[#lorem(10)]]] + [#par(justify:true)[#lorem(100)]]} #align(left + bottom)[Was ist das hier für ein Text und wo findet er sich wieder?] #align(right + bottom)[#lorem(30)]
https://github.com/ryuryu-ymj/mannot
https://raw.githubusercontent.com/ryuryu-ymj/mannot/main/examples/usage1.typ
typst
MIT License
#import "/src/lib.typ": * #set page(width: auto, height: auto, margin: (x: 2cm, y: .5cm), fill: white) #set text(24pt) #show: mannot-init $ mark(x) $
https://github.com/pedrofp4444/BD
https://raw.githubusercontent.com/pedrofp4444/BD/main/report/content/[5] Implementação Física/interrogações.typ
typst
#let interrogações = { [ == Tradução das interrogações do utilizador para SQL Nesta secção, apresenta-se uma análise detalhada das consultas SQL, convertidas dos requisitos de manipulação, utilizadas para extrair informações relevantes da base de dados da _Lusium_. Cada consulta aos dados foi cuidadosamente projetada para fornecer informações específicos sobre os dados relacionados a funcionários, terrenos e casos. Ao examinar cada interrogação, é possível entender melhor como os dados são manipulados e analisados de forma a auxiliar na investigação e tomada de decisões. No início do ficheiro, declaram-se três variáveis para permitir indicar qual o funcionário, caso ou terreno a ser utilizado na resolução das consultas, se necessário. Neste exemplo, propõe-se a utilização dos IDs 3, 3 e 1, para o funcionário, o caso e o terreno, respetivamente. #align(center)[ #figure( kind: image, caption: [Declaração dos IDs para utilização nas consultas.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Definir variáveis para utilizar nas queries SET @Funcionario_ID = 3; SET @Caso_ID = 3; SET @Terreno_ID = 1; ``` ) ) ] \ A primeira consulta calcula o prejuízo de um terreno. Para isso, subtrai a quantidade de minério coletado da quantidade de minério previsto. #align(center)[ #figure( kind: image, caption: [Listar o prejuízo de um terreno com SQL.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Listar o prejuízo de um terreno SELECT Terreno_ID, (Minério_previsto - Minério_coletado) AS Prejuízo FROM Terreno WHERE Terreno_ID = @Terreno_ID; ``` ) ) ] \ A segunda consulta verifica quando um funcionário se tornou suspeito de um determinado caso. Ela une as tabelas "Suspeito" e "Caso" para obter a data de abertura do caso correspondente ao funcionário e caso especificados. #align(center)[ #figure( kind: image, caption: [Ver quando é que um funcionário se tornou suspeito de um determinado caso com SQL.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Ver quando é que um funcionário se tornou suspeito de um determinado caso SELECT s.Funcionário_ID, s.Caso_ID, c.Data_de_abertura FROM Suspeito s INNER JOIN Caso c ON s.Caso_ID = c.Caso_ID WHERE s.Funcionário_ID = @Funcionário_ID AND s.Caso_ID = @Caso_ID; ``` ) ) ] \ A terceira consulta lista todos os suspeitos de um determinado caso. Une as tabelas "Suspeito" e "Funcionário" para exibir informações detalhadas sobre os suspeitos, incluindo nome, estado, envolvimento e notas. #align(center)[ #figure( kind: image, caption: [Listar os suspeitos de um determinado caso com SQL.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Listar os suspeitos de um determinado caso SELECT s.Funcionário_ID, f.Nome, s.Estado, s.Envolvimento, s.Notas FROM Suspeito s INNER JOIN Funcionário f ON s.Funcionário_ID = f.Funcionário_ID WHERE s.Caso_ID = @Caso_ID; ``` ) ) ] \ A quarta consulta mostra a data do último caso associado a um determinado funcionário. Junta as tabelas "Caso" e "Suspeito" e ordena os resultados por data de abertura em ordem decrescente, limitando a um único resultado. #align(center)[ #figure( kind: image, caption: [Ver a data do último caso de um determinado funcionário com SQL.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Ver a data do último caso de um determinado funcionário SELECT c.Caso_ID, c.Data_de_abertura FROM Caso c INNER JOIN Suspeito s ON c.Caso_ID = s.Caso_ID WHERE s.Funcionário_ID = @Funcionário_ID ORDER BY c.Data_de_abertura DESC LIMIT 1; ``` ) ) ] \ A quinta consulta lista todos os casos a que um determinado funcionário está associado. Une as tabelas "Caso" e "Suspeito" para exibir informações detalhadas sobre os casos, incluindo estado, estimativa de roubo, data de encerramento e ID do terreno. #align(center)[ #figure( kind: image, caption: [Listar os casos a que um determinado funcionário está associado com SQL.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Listar os casos a que um determinado funcionário está associado SELECT c.Caso_ID, c.Data_de_abertura, c.Estado, c.Estimativa_de_roubo, c.Data_de_encerramento, c.Terreno_ID FROM Caso c INNER JOIN Suspeito s ON c.Caso_ID = s.Caso_ID WHERE s.Funcionário_ID = @Funcionário_ID; ``` ) ) ] \ A sexta consulta determina o dia em que mais casos foram abertos. Agrupa os casos pela data de abertura, conta quantos casos foram abertos em cada data, e ordena em ordem decrescente, limitando a um único resultado, ou seja, o que contém mais casos. #align(center)[ #figure( kind: image, caption: [Ver o dia em que mais casos foram abertos com SQL.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Ver o dia em que mais casos foram abertos SELECT Data_de_abertura, COUNT(*) AS Total_de_Casos FROM Caso GROUP BY Data_de_abertura ORDER BY Total_de_Casos DESC LIMIT 1; ``` ) ) ] \ A última consulta lista os top 5 funcionários por quantidade de casos. Une as tabelas "Suspeito" e "Funcionário", agrupa por funcionário, conta os casos associados a cada um e ordena em ordem decrescente, limitando os resultados aos cinco principais. #align(center)[ #figure( kind: image, caption: [Listar os top 5 funcionários por quantidade de casos com SQL.], block( fill: rgb("#f2f2eb"), inset: 8pt, ```sql -- Listar os top 5 funcionários por quantidade de casos SELECT s.Funcionário_ID, f.Nome, COUNT(s.Caso_ID) AS Total_de_Casos FROM Suspeito s INNER JOIN Funcionário f ON s.Funcionário_ID = f.Funcionário_ID GROUP BY s.Funcionário_ID, f.Nome ORDER BY Total_de_Casos DESC LIMIT 5; ``` ) ) ] ] }
https://github.com/typst-community/guidelines
https://raw.githubusercontent.com/typst-community/guidelines/main/src/chapters/style/indentation.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/src/util.typ": * #import mantys: * = Indentation Indentation is always 2 spaces per level, tabs can be used to increase accessibility, but spaces and tabs should not be mixed. For 2 spaces this means that for most syntactic elements, the indentation of nested items or continuations lines up with the start of the first line. This keeps nested code narrow, allowing side-by-side editing and preview for most users. #do-dont[ ```typst // consistent easy to follow indentation - top level - nested continuation ``` ][ ```typst // inconsistent and too deep indentation - top level - nested continued ``` ] Likewise, in #mode.code the indentation of scopes is done with 2 spaces. #do-dont[ ```typc // 2 spaces are generally enough to visually tell levels of indentation apart let id(val) = { if false { panic() } val } ``` ][ ```typc // ridiculous indentation levels make this quickly hard to read when previewing a document let func(val) = { if val { // ... } } ``` ] Avoid deep indentation where possible, if a function has multiple code paths that end in simple return values and another which is heavily nested and large, try to invert conditions to decrease nesting. #do-dont[ ```typc let nested(a, b, c) = { if not a { return 0 } if not b { return 1 } // lots of code ... } ``` ][ ```typc let nested(a, b, c) = { if a { if b { // lots of code ... } else { 1 } } else { 0 } } ``` ]
https://github.com/Simgnt/report-typst-template
https://raw.githubusercontent.com/Simgnt/report-typst-template/main/_extensions/report/typst-show.typ
typst
// Typst custom formats typically consist of a 'typst-template.typ' (which is // the source code for a typst template) and a 'typst-show.typ' which calls the // template's function (forwarding Pandoc metadata values as required) // // This is an example 'typst-show.typ' file (based on the default template // that ships with Quarto). It calls the typst function named 'article' which // is defined in the 'typst-template.typ' file. // // If you are creating or packaging a custom typst template you will likely // want to replace this file and 'typst-template.typ' entirely. You can find // documentation on creating typst templates here and some examples here: // - https://typst.app/docs/tutorial/making-a-template/ // - https://github.com/typst/templates #show: report.with( $if(title)$ title: "$title$", $endif$ $if(institution)$ institution: "$institution$", $endif$ $if(datedebut)$ datedebut: "$datedebut$", $endif$ $if(datefin)$ datefin: "$datefin$", $endif$ $if(ville)$ ville: "$ville$", $endif$ $if(toc)$ toc: "$toc$", $endif$ $if(remerciements)$ remerciements: [$remerciements$], $endif$ $if(toc-title)$ toc-title: "$toc-title$", $endif$ $if(toc-depth)$ toc-depth: $toc-depth$, $endif$ $if(stagemaster)$ stagemaster: "$stagemaster$", $endif$ $if(author)$ author: "$author$" , $endif$ $if(index-terms)$ index-terms: ($for(index-terms)$"$it$"$sep$, $endfor$), $endif$ )
https://github.com/gyarab/2023-4e-ruzicka-jako_pavouk
https://raw.githubusercontent.com/gyarab/2023-4e-ruzicka-jako_pavouk/main/src-docs/kapitoly/uvod.typ
typst
= Úvod == Výběr tématu Nápad na vývoj této webové aplikace souvisel s faktem, že já sám *jsem neuměl psát všemi deseti*, a tak jsem se to rozhodl naučit. Se zděšením jsem ale zjistil, že co se týče české klávesnice, není moc možností, přičemž nějaké z nich stojí skoro 1000 Kč. == Struktura Můj projekt se skládá ze 3 hlavních částí. První částí je takzvaný *frontend*. To je ta část projektu, kterou vidí a s kterou interaguje uživatel. V mém případě do ní patří například design, statistika nebo samotné psaní textů. Druhou částí je takzvaný *backend* neboli program běžící na serveru. Tuto část aplikace sice nemá uživatel možnost vidět, ale neustále s ním komunikuje. Můj backend se stará o autentifikaci uživatelů (registrace, přihlašování, tokenizace, změna hesla), o posílání ověřovacích e-mailů a generování textů na psaní. Poslední částí je *databáze*, která ukládá data o uživatelích, disponuje seznamem lekcí, slovníkem a dalšími daty potřebnými k chodu aplikace. == Použité technologie #figure( image("../obrazky/technologie.png", width: 90%), caption: [Vue.js @vue-logo,#h(5pt) PostgreSQL @postgres-logo,#h(5pt) Go @go-logo], ) === Frontend Pro vývoj frontendu neboli samotné webové stránky jsem si vybral framework *Vue.js*. Hlavním důvodem bylo, že už jsem s ním měl zkušenosti ze skupinového projektu pro minulý rok. Místo Javascriptu jsem používal *Typescript*, ale nejsem si jist, jestli ho mohu doporučit. Čas od času jsem měl pocit, že musím psát hodně kódu navíc a přináší to *více škody než užitku*. #pagebreak() Co se týče kaskádových stylů, držel jsem se *čistého CSS*, protože si myslím, že s nástroji jako Bootstrap nebo Tailwind ztrácíte jak čitelnost, tak kontrolu nad kódem. Přijde mi, že CSS se odděluje od samotného HTML z nějakého důvodu a nechci se vracet k tomuto: #v(-4pt) ```html <ul style="display: flex; justify-content: center;"> <li style="width: 125px; height: 50px; transition: background-position-x 0.9s linear; text-align: center;"> <a href="/" style="font-size: 22px; color: #777; text-decoration: none; transition: all 0.45s;">Home</a> </li> <li style="width: 125px; height: 50px; transition: background-position-x 0.9s linear; text-align: center;"> <a href="/about" style="font-size: 22px; color: #777; text-decoration: none; transition: all 0.45s;">About</a> </li> </ul> ``` === Backend Jako jazyk pro backend, program starající se o data, jsem si zvolil *Go*, protože se mi v té době hodně líbil Python a chtěl jsem zkusit něco podobného, ale více low-level. Dnes se mi ale zpátky nechce. Použil jsem také framework Fiber, i když teď cítím, že bych se v klidu obešel bez něj, pouze za pomoci *standardní knihovny*. Ještě jsem totiž nevěděl, jak dobrou standardní knihovnu Go má a že mindset Go programátorů je úplným opakem JS developerů. Když chce člověk něco udělat v Javascriptu, většinou už existuje asi 287 knihoven, které všechny dělají to samé trošku jinak. Nějaká lépe, nějaká hůř. Vybereme si tedy jednu z nich a začneme bezhlavě importovat cizí programy, kterým nerozumíme a ani nechceme rozumět. V Go to tak není. Cokoliv, co potřebujete od regulárních výrazů přes unit testování, datum a čas až po komunikaci se sítí už je v standardní knihovně, psané lidmi, kteří rozumí nejen jazyku samotnému, ale i danému problému. === Databáze Pro uchovávání dat o uživatelích, slovech pro psaní a podobně jsem zvolil relační databázi *PostgreSQL*, kvůli její popularitě a výkonu. Ve výběrovém konkurzu byly i alternativy jako MongoDB nebo SQLite. Mongo jsem ale zavrhl, protože jsem chtěl spíše relační SQL databázi a SQLite je, podle mého názoru, lepší pro projekty v menším měřítku. === Dokumentace Pro psaní této dokumentace jsem využil *Typst* _"A markup-based typesetting system that is designed to be as powerful as_ LaTeX _ while being much easier to learn and use."_ #h(3pt) @typst Chtěl jsem se vyhnout stylování v MS Word, a LaTeX mi přišel dost zkostnatělý. Chvilku jsem tedy hledal a nakonec zkusil moderní, také open-source, alternativu.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/grid-1_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #let cell(width, color) = rect(width: width, height: 2cm, fill: color) #set page(width: 100pt, height: 140pt) #grid( columns: (auto, 1fr, 3fr, 0.25cm, 3%, 2mm + 10%), cell(0.5cm, rgb("2a631a")), cell(100%, forest), cell(100%, conifer), cell(100%, rgb("ff0000")), cell(100%, rgb("00ff00")), cell(80%, rgb("00faf0")), cell(1cm, rgb("00ff00")), cell(0.5cm, rgb("2a631a")), cell(100%, forest), cell(100%, conifer), cell(100%, rgb("ff0000")), cell(100%, rgb("00ff00")), )
https://github.com/RaphGL/ElectronicsFromBasics
https://raw.githubusercontent.com/RaphGL/ElectronicsFromBasics/main/DC/chap8/chap8.typ
typst
Other
== DC Metering Circuits #include "1_whats_a_meter.typ" #include "2_voltmeter_design.typ" #include "3_voltmeter_impact_on_measured_circuit.typ" #include "4_ammeter_design.typ" #include "5_ammeter_impact_on_measured_circuit.typ" #include "6_ohmmeter_design.typ"
https://github.com/jneug/typst-tools4typst
https://raw.githubusercontent.com/jneug/typst-tools4typst/main/alias.typ
typst
MIT License
// Aliases for some typst functions // to prevent naming collisions #let numbering = numbering #let align = align #let type = type #let text = text #let label = label #let raw = raw #let table = table #let list = list #let enum = enum #let terms = terms #let grid = grid #let stack = stack #let columns = columns
https://github.com/felsenhower/kbs-typst
https://raw.githubusercontent.com/felsenhower/kbs-typst/master/examples/05.typ
typst
MIT License
#image("typst.svg", width: 50%)
https://github.com/FlixCoder/typst-slides
https://raw.githubusercontent.com/FlixCoder/typst-slides/main/README.md
markdown
MIT License
# Typst beamer slides template A simple to use template for creating presentation slides. ## Usage and Example Take a look at [`slides.pdf`](https://github.com/FlixCoder/typst-slides/blob/main/slides.pdf) and [`slides.typ`](https://github.com/FlixCoder/typst-slides/blob/main/slides.typ) to see how it looks like and how to use it. ![Screenshot](./images/screenshot.png) ## Typst version Made with Typst v0.8.0, compiles with v0.11.0 - v0.12.0, it is unclear whether future versions will break something.
https://github.com/a-mhamdi/graduation-report
https://raw.githubusercontent.com/a-mhamdi/graduation-report/main/Typst/en-Report/chaps/chpt3.typ
typst
MIT License
/* --------------------------------- DO NOT EDIT -------------------------------- */ #import "../Class.typ": * #show: report.with(isAbstract: false) #set page(header: none) #figure(chap(chap3, numbering: "1."), kind: "chapter", supplement: "Chapter") <chp:chap3> // Chapter 3 #set page(header: smallcaps(title) + h(1fr) + emph(chap3) + line(length: 100%)) #set heading(outlined: true, numbering: "1.") /* ------------------------------------------------------------------------------ */ == Introduction #lorem(32) == Section 1 #lorem(16) === Subsection 1.1 #lorem(64) === Subsection 1.2 #lorem(64) == Section 2 #lorem(16) === Subsection 2.1 #lorem(64) === Subsection 2.2 #lorem(64) /* --- FIGURE --- */ #figure( image("images/typst.svg", width: 10%), caption: "Typst logo", ) <fig:typst-logo> @fig:typst-logo shows the `Typst` logo. /* --- TABLE --- */ #figure( table( columns: (auto, auto, auto), [a], [b], [c], [$a$], [$b$], [$c$], ), caption: "Some table", ) <tab:some-table> @tab:some-table displays some table. == Conclusion #lorem(32)
https://github.com/SillyFreak/typst-scrutinize
https://raw.githubusercontent.com/SillyFreak/typst-scrutinize/main/src/task-kinds/choice.typ
typst
MIT License
/// A checkbox which can be ticked by the student. If the checkbox is a correct answer and the /// document is in solution mode, it will be ticked. /// /// Example: /// /// #task-example(lines: "2-", ```typ /// #import task-kinds.choice: checkbox /// Correct: #checkbox(true) -- Incorrect: #checkbox(false) /// ```) /// /// - correct (boolean): whether the checkbox is of a correct answer /// -> content #let checkbox(correct) = context { import "../solution.typ" box(height: 0.65em, { show: move.with(dy: -0.1em) set text(1.5em) solution.answer( if not correct { sym.ballot } else if sys.version < version(0, 12, 0) { sym.ballot.x } else { sym.ballot.cross }, placeholder: sym.ballot, ) }) } /// A table with multiple options that can each be true or false. Each option is a tuple consisting /// of content and a boolean for whether the option is correct or not. /// /// Example: /// /// #task-example(lines: "2-", ```typ /// #import task-kinds: choice /// #choice.multiple( /// range(1, 6).map(i => ([Answer #i], calc.even(i))), /// ) /// #set table(stroke: none, inset: (x, y) => ( /// right: if calc.even(x) { 0pt } else { 0.8em }, /// rest: 5pt, /// )) /// #choice.multiple( /// boxes: left, /// direction: ltr, /// range(1, 6).map(i => ([#i], calc.even(i))), /// ) /// ```) /// /// - options (array): an array of (option, correct) pairs /// - boxes (alignment): `left` or `right`, specifying on which side of the option the checkbox /// should appear /// - direction (direction): `ttb` or `ltr`, specifying how options should be arranged /// -> content #let multiple(options, boxes: right, direction: ttb) = { assert(boxes in (left, right)) assert(direction in (ltr, ttb)) let col-multiplier = if direction == ltr { options.len() } else { 1 } table( columns: (auto, auto) * col-multiplier, align: (col, row) => ((left, center) * col-multiplier).at(col) + horizon, ..for (option, correct) in options { if boxes == left { (checkbox(correct), option) } else { (option, checkbox(correct)) } } ) } /// A table with multiple options of which one can be true or false. Each option is a content, and a /// second parameter specifies which option is correct. /// /// Example: /// /// #task-example(lines: "2-", ```typ /// #import task-kinds: choice /// #choice.single( /// range(1, 6).map(i => [Answer #i]), /// // 0-based indexing /// 3, /// ) /// #set table(stroke: none, inset: (x, y) => ( /// right: if calc.even(x) { 0pt } else { 0.8em }, /// rest: 5pt, /// )) /// #choice.single( /// boxes: left, /// direction: ltr, /// range(1, 6).map(i => [#i]), /// 3, /// ) /// ```) /// /// - options (array): an array of contents /// - answer (integer): the index of the correct answer, zero-based /// - boxes (alignment): `left` or `right`, specifying on which side of the option the checkbox /// should appear /// - direction (direction): `ttb` or `ltr`, specifying how options should be arranged /// -> content #let single(options, answer, boxes: right, direction: ttb) = { multiple( boxes: boxes, direction: direction, options.enumerate().map(((i, option)) => (option, i == answer)), ) }
https://github.com/ice1000/website
https://raw.githubusercontent.com/ice1000/website/main/book.typ
typst
#import "@preview/shiroa:0.1.1": * #show: book #book-meta( // title: "<NAME>", repository: "https://github.com/ice1000/ice1000.github.io", authors: ("<NAME>",), language: "en", summary: [ #prefix-chapter("index.typ")[About], = Academic Writing #prefix-chapter("lnl-modal/report.typ")[LNL Cxl Modal Logic], #prefix-chapter("dtt-dev/assemble.typ")[Dependent Theory of Types], = Miscellaneous #prefix-chapter("resume.typ")[Industry Resume], #prefix-chapter("typst-test.typ")[Typesetting Experiments], ] ) // re-export page template #import "/templates/page.typ": project #let book-page = project
https://github.com/ofurtumi/formleg
https://raw.githubusercontent.com/ofurtumi/formleg/main/h09/H9.typ
typst
#import "@templates/ass:0.1.1": * #show: doc => template( class: "TÖL301G", project: "Homework 9", doc ) #set heading(numbering: "1.a.") #let colred(x) = text(fill: red, $#x$) = Even Odd TM Define a Turing machine that performs the following function: $ f(x) = cases( "odd": x + 1, "even": x "/" 2 ) $ #grid(columns: 2, [ + Scan the string to the right until we reach the last bit + If the last bit is 1 the number is odd + Flip character and move left + If bit under pointer is 1 goto state _2.1_ + If bit under pointer is 0 flip bit + If the last bit is 0 the number is even + Replace the last bit with empty space + Move to start of string, halt We can construct this simple turing machine that does this calculation for us ], grid(columns: 2, gutter: 8pt, [ ``` Init: q0 Accept: qf q0,0 q0,0,> q0,1 q0,1,> q0,_ qcomp,_,< qcomp,0 qstart,_,< qcomp,1 qodd,0,< ```],[ ``` qodd,1 qodd,0,< qodd,0 qstart,1,< qodd,_ qf,1,- qstart,0 qstart,0,< qstart,1 qstart,1,< qstart,_ qf,_,- ```] ) ) = Mr. Koch == The loop We know that both $w_1: R^3$ and $w_2: (R l R l)^3$ lead home and are therefore accepted. Since $w_2$ is just $w_1$ after we apply the first replacement rule, we can assume the first replacement rule holds. If we look deeper into the replacement we see that by changing $R$ into $R l R l$ we keep our direction but make the route longer. This can be seen because $R$ and $l$ are opposites and therefore cancel each other out. The second replacement rule works the same way in reverse, we can assume it holds because $w_3$ is just $w_2$ after we apply the second replacement rule. == Turing machine Since all accepted strings are made from $R^3$ having the replacement rules applied to it. To decide if a string is acceptable we can reverse these rules until we either have $R^3$ or we reject. Let's show this on the string $w_3$: $ ( R l l R l R l l R l l l R l R l l R l R l l R l )^3\ ( R colred( l l R l ) R colred( l l R l ) colred( l l R l ) R colred( l l R l ) R colred( l l R l ) )^3\ ( R l R l l R l R l l)^3\ (colred( R l R l )l colred( R l R l )l)^3\ (R l R l)^3\ (colred( R l R l ))^3\ (R)^3 $ = $"EQ"_"CFG"$ Let's define a new CFG $G' = (V, Sigma, R, S)$ where $S$ is the starting variable and every token $sigma in Sigma$ has a transition rule $sigma -> sigma S$. If $Sigma$ includes ${x,y}$ then $S -> x S, S -> y S, S -> epsilon$, therfore $L(G') = Sigma *$ Now we define $R$ as a turing machine that decides $"EQ"_"CFG"$ and construct another turing machine $S$ that decides $"ALL"_"CFG"$ $S$ follows the rules: "On input $G$ where $G$ is a CFG: + Construct a CFG $angle.l G', angle.r$ as described above + Run $R$ on $G'$, if $R$ accepts then accept, otherwise reject" In step 1. since $G' = Sigma *$ then $R$ needs to decide if $G = Sigma *$ which is $"ALL"_"CFG"$ and since we know $"ALL"_"CFG"$ is undecidable then $S$ is undecidable.
https://github.com/tiankaima/typst-notes
https://raw.githubusercontent.com/tiankaima/typst-notes/master/1cc213-cg_hw1_report/main.typ
typst
#import "@preview/polylux:0.3.1": * #set page(paper: "presentation-16-9") #set text(size: 25pt) #show raw.where(block: true): it => { box( fill: blue.lighten(95%), inset: (x: 10pt, y: 0pt), outset: (x: 0pt, y: 15pt), radius: 2pt, )[ #set text(size: 20pt) #raw(it.text, lang: "bash") ] } #polylux-slide[ #align(horizon + center)[ = HW 1 - `MiniDraw`\ Highlights \ <NAME> 2024.03.08 ] ] #polylux-slide[ == Modern C++\ `constexpr` With `constexpr`, more jobs could be done at compile time while making code simpler, example: ```cpp // comp_canvas.h static constexpr std::vector<ShapeType> all_types() { return { ShapeType::kDefault, ShapeType::kLine, //... } } ``` #pagebreak() ```cpp // window_minidraw.cpp for (const auto type : Canvas::all_types()) { if (ImGui::Button(Canvas::name(type).c_str())) { p_canvas_->set_type(type); } ImGui::SameLine(); } // better than: if (ImGui::Button(Canvas::name(ShapeType::kDefault).c_str())) { p_canvas_->set_type(ShapeType::kDefault); } ImGui::SameLine(); if (ImGui::Button(Canvas::name(ShapeType::kLine).c_str())) { //... ``` ] #polylux-slide[ == Modern C++\ `enum class` `enum` behaves just like `int`, without type safety, which might cause unwanted behaviors, example: - Naming conflicts: ```cpp int main() { enum Color { RED, GREEN, BLUE }; enum TrafficLight { RED, YELLOW, GREEN }; // error: redeclaration of 'RED' int Red = 2; // error: 'int Red' redeclared as different kind of symbol } ``` #pagebreak() - Type safety: ```cpp int main() { enum Color { RED, GREEN, BLUE }; enum Gender { MALE, FEMALE }; Color a = RED; Gender b = MALE; if(a == b) { cout<<"Equal"; // warning, but compiles. } } ``` #pagebreak() - `enum class` is a better choice, with type safety, defined one as the following: ```cpp int main() { enum class EnumName { EnumValue1, EnumValue2, ... }; EnumName objName = EnumName::EnumValue1; // or just auto objName = EnumName::EnumValue1; // and compare with: if (objName == EnumName::EnumValue1) { // which is ensured to be safe. } } ``` ] #polylux-slide[ == Modern C++\ `decltype` & `inline` Sometimes when types are overly complicated, `decltype` could be used to simplify the code, example: ```cpp using IM_COL32_D = decltype(IM_COL32(0, 0, 0, 0)); // where: #define IM_COL32(R,G,B,A) (((ImU32)(A)<<IM_COL32_A_SHIFT) | ((ImU32)(B)<<IM_COL32_B_SHIFT) | ((ImU32)(G)<<IM_COL32_G_SHIFT) | ((ImU32)(R)<<IM_COL32_R_SHIFT)) ``` So the opacity function could be defined as: #pagebreak() ```cpp /* * Adjusts the alpha value of a color. * @param color The color to adjust. * @param alpha The alpha value to multiply the color alpha by. * @return The color with its alpha adjusted. */ inline IM_COL32_D opacity(IM_COL32_D color, float alpha) { return IM_COL32( (color >> IM_COL32_A_SHIFT) * alpha, (color >> IM_COL32_B_SHIFT) & 0xFF, (color >> IM_COL32_G_SHIFT) & 0xFF, (color >> IM_COL32_R_SHIFT) & 0xFF); } ``` #pagebreak() It's worth noticing that `inline` keyword now no longer means "inline" in Modern C++. Modern C++ compilers are already smart enough to decide whether to inline a function or not, so `inline` is now used to avoid multiple definitions of the same function in different translation units. You could now define a function in a header file without worrying about multiple definitions, example: ```cpp // header.h inline void foo() { //... } ``` ] #polylux-slide[ == Undo & Redo Modeling: ```cpp struct History { Action action; std::shared_ptr<Shape> shape; size_t delete_index = -1; }; std::vector<History> history_actions; size_t history_index = -1; ``` #pagebreak() Design Goals: - History of Undo & Redo are *linear*\ - When a diff occours, the redo history is cleared, and related variables are recycled to avoid memory leaks. - With Undos & Redos, the result state is always identical to the initial state. - This allows us to use one `size_t` to refence the location of deleted `Shape` ] #polylux-slide[ == Shortcuts Implementing some useful shortcuts might bring significant improvements to the user experience, example: - _Ctrl + Z_: Undo - _Ctrl + Y_: Redo - Pressing _Shift_ when drawing a _Rect_ to make it a _Square_, etc. ] #polylux-slide[ == Class Diagram #columns(2)[ #image("./model.png", width: 100%) #colbreak() Using `clang-uml` to generate PlantUML files, and then using `PlantUML` to generate the class diagram. Related document have already added to homework repo through #link("https://github.com/USTC-CG/USTC_CG_24/pull/5")[#text(fill: blue)[PR #5]]. ] ] #polylux-slide[ #align(horizon + center)[ = Thanks. ] ]
https://github.com/maantjemol/Aantekeningen-Jaar-2
https://raw.githubusercontent.com/maantjemol/Aantekeningen-Jaar-2/main/Financieel%20management/samenvatting.typ
typst
#import "../template/lapreprint.typ": template #import "../template/frontmatter.typ": loadFrontmatter #import "@preview/drafting:0.2.0": * #let defaultColor = rgb("#f2542d") #show: template.with( title: "Financieel Management in de Publieke Sector", subtitle: "Samenvatting", short-title: "Public Finance Samenvatting", venue: [ar#text(fill: red.darken(20%))[X]iv], // This is relative to the template file // When importing normally, you should be able to use it relative to this file. theme: defaultColor, authors: ( ( name: "<NAME> . ", ), ), kind: "Samenvatting", abstract: ( (title: "Samenvatting", content: [ Deze samenvatting biedt een uitgebreid overzicht van financieel management in de publieke sector. We onderzoeken de specifieke uitdagingen en dilemma's die publieke organisaties ervaren in het beheren van hun financiële middelen, te midden van complexe maatschappelijke doelstellingen. #line(length: 100%, stroke: gray) #outline(depth: 1, fill: "", title: [Inhoud]) ]), ), open-access: true, margin: ( ( title: "Key Points", content: [ - De publieke sector is gericht op een doel, en niet op winst. De publieke sector bestaat uit publiek georiënteerde organisaties, zoals de overheid en de middenveld organisaties. - De sector is divers georganiseerd en er zijn veel verschillende producten. De bekostiging is vaak via belastingen, en dus ook niet markt georiënteerd. - De crisis van 2008 heeft geleid tot een herziening van het Europees begrotingsraamwerk, waarbij de nadruk ligt op jaarlijkse uitgavenplafonds. ], ), ), font-face: "Open Sans" ) #set page( margin: (left: 2in, right: 0.8in), paper: "us-letter" ) #let marginRatio = 0.8 #let default-rect(stroke: none, fill: none, width: 0pt, content) = { pad(left:width*(1 - marginRatio), rect(width: width*marginRatio, stroke: stroke)[ #content ]) } #set-page-properties() #show terms: it => [ #margin-note(rect: default-rect, side: left, stroke: 0pt)[#text(defaultColor, weight: 600, size: 10pt)[#it.children.first().term:]\ #it.children.first().description] ] #set heading(numbering: none) #set quote(block: true) #show heading: set text(defaultColor, weight: "medium") = Inleiding Financieel management is de planning en beheersing van financiële zaken. Het gaat niet om beleid (wat en waarom) maar om de *hoe vraag*. Er wordt veel gebruik gemaakt van bedrijfseconomische instrumenten, maar in de context van de publieke sector. De algemene economie houdt een belangrijke rol. Denk hierbij bijvoorbeeld aan *kosten baten analyse.* Voorbeelden financieel management: - Wat kost een paspoort? - Corona en de kosten van de maatregelen De rode draad is dat het diverse thema's behandelt, maar altijd gaat om het hoe en niet om het wat en waarom. == Publieke sector een non profit? De publieke sector is gericht op een doel, en niet op winst. Waar is de publieke sector dan wel op gericht? - Diverse producten Het is divers georganiseerd en er zijn veel verschillende producten. Denk hierbij aan onderwijs, zorg, veiligheid, etc. De bekostiging is vaak via belastingen, en dus ook niet markt georiënteerd. De publieke sector is een aanzienlijk deel van de economie, ongeveer de helft. Onderdelen van een non-profit: - Publiek georiënteerde organisaties: overheid - cliëntgerichte organisaties (*middenveld*), zoals onderwijs, zorg, corporaties, openbaar vervoer; - Private organisaties, vakbonden, kerken, goede doelen. De publieke sector bestaat uit *publiek georiënteerde organisaties*, zoals de overheid en de *middenveld organisaties*. Wij gaan dus niet kijken naar ledenorganisaties, zoals vakbonden, kerken en goede doelen. Wie horen bij de overheid? - Rijk, provincies, gemeenten, waterschappen - ZBO's (zelfstandige bestuursorganen) - Agentschap (KNMI, DUO) == Marktwerking Er is geen marktwerking in de publieke sector, dus besluiten worden op andere manieren gemaakt. Denk hierbij ook aan marktfalen. De economie is in principe efficient, maar er moet ook rekening worden gehouden met: - Macro-economie - Verdeling/rechtvaardigheid - Paternalisme #pagebreak() Voorbeelden van marktfalen: - Externe effecten - Asymmetrische informatie - Collectieve goederen - Marktmacht Dit wordt opgelost door overheidsingrijpen. De overheid kan dit doen door: - regelgeving - belastingen - zelf producten leveren - overdrachten Dit gaat lang niet altijd goed. Als dit niet goed gaat, dan is er sprake van *budget imperfecties*, ofwel *non-market failure* Redenen voor non-market failure: - Output slecht gedefinieerd of niet meetbaar - Kwaliteit is moeilijk te meten - Geen concurrentie - Geen criteria voor het stopzetten van activiteiten - Beloning voor het formuleren van een probleem en het bedenken van een oplossing, _maar niet voor het oplossen van het probleem_ - Politieke conjunctuur, waardoor er geen lange termijn visie is - Common pool problemen (bijv. milieu) - Principaal-agent problemen (bijv. zorg) == Principaal-agent problemen: - Principaal: degene die de opdracht geeft (kiezer) - Agent: degene die de opdracht uitvoert (politici) Politici hebben vaak hun eigen doelen en belangen, zoals herverkiezing, macht, of persoonlijke voordelen (rents), die niet altijd in lijn zijn met de belangen van de kiezers. Dit kan leiden tot besluiten die de kiezers niet ten goede komen. Oplossingen hiervoor zijn: - Contracten (werken niet goed en zijn incompleet) - Begrotingsinstituties == Begrotingsinstituties Begrotingsinstituties zijn regels die ervoor zorgen dat de politici zich aan de begroting houden. Dit kan bijvoorbeeld door een *tekortnorm* in te stellen, of door een *onafhankelijke toezichthouder* in te stellen. == Common pool problemen Common pool problemen zijn problemen waarbij de kosten en baten niet bij dezelfde partij liggen. Dit kan leiden tot overexploitatie van een goed. Denk hierbij aan het milieu, waarbij de kosten van vervuiling niet bij de vervuiler liggen, maar bij de maatschappij. Ook geld komt bij de overheid uit een algemene pot. Dit wordt besteed aan afzonderlijke groepen. De netto baten voor de groepen zijn groot, en de kosten zijn klein. Dit kan leiden tot overconsumptie. *Oplossing:* een centraal begrotingsproces. Dit zorgt ervoor dat de kosten en baten bij dezelfde partij liggen. == Praktisch: - De overheid heeft een begroting, waarin de inkomsten en uitgaven staan. - Er zijn geen verborgen uitgaven - Beperk open eindjes - Beperk regelgeving die tot uitgaven leid. - Beperk contingent liabilities zoals garanties (expliciet én impliciet) - Zorg dat alles in vergelijkbare maatstaf te meten is - Niet te optimistisch ramen - Geen creatief boekhouden maar transparantie - Uitgaven gebruiken voor het doel waarvoor ze bedoeld zijn - Begrotingsnormen, eisen waar de begroting aan moet voldoen - Onafhankelijke informatie voorzieningen - Een centraal begrotingsproces - Een één partijregering, benoem een financieel zwaargewicht - Zorg voor een contract (regeerakkoord) met duidelijke afspraken. - Een hogere overheid zoals de EU, IMF (internationaal monetaire fonds) of de ECB (Europese centrale bank) kan ook helpen. == Fasen: - Planning en besluitvorming - Beheersing (controle en uitvoering) - Verslaggeving - Controle en verantwoording == New public management: New Public Management (NPM) is een manier om overheidsdiensten te beheren die ideeën uit de private sector leent om de overheid efficiënter te laten werken. *running government like a business* Gevolgen van NPM: - Focus op efficiency - Planning- en budgetteringstechnieken - Sturen op prestaties - Meer concurrentie - Managementstijlen uit de private sector - Contracten - Privatisering - Terminologie #pagebreak() == Fondsvorming: Fondsvorming is het reserveren van geld voor een specifiek doel. Dit kan bijvoorbeeld zijn voor de AOW, of voor de zorg. Dit zorgt ervoor dat er geld is voor de toekomstige uitgaven. Voordelen van een fonds: - Toewijzing van middelen voor een specifiek doel - Geld gaat naar waar het het meest nodig is. - Geld wordt niet gebruikt voor andere algemene doeleinden. - Er is op lange termijn geld beschikbaar voor een specifieke activiteit - Ook bedrijven kunnen bijdragen aan het fonds - Middelen stromen van de centrale naar de lokale overheden Nadelen van een fonds: - Niet alle middelen kunnen goed tegen elkaar worden afgewogen - Verlies van overzicht - Minder flexibiliteit - Neiging tot meer uitgaven Een aantal fondsen zijn: - AOW-spaarfonds - Fonds Economische Versterking: Garanderen van een deel van het aardgasvermogen d.m.v. investeringen die de economische structuur versterken; - Waddenfonds - BTW-compensatiefonds / Privaatrechtelijke fondsen: Stichtingen die van het Rijk een financiële bijdrage ontvangen en die vervolgens subsidie verlenen( bijv. cultuurfondsen). *Depositogarantie:* fond van de banken om spaargeld te garanderen. *Begrotingsreserve:* een reserve dat wordt apart gezet door het ministerie van financiën voor onvoorziene uitgaven. *Structuurfondsen:* fondsen van de EU om de economische structuur van de lidstaten te versterken. Het verschil tussen de rijke en arme landen moet kleiner worden. *Europees Sociaal Fonds* == Open-einde-regelingen: Open-einde-regelingen zijn regelingen waarbij de kosten niet van tevoren vaststaan. Dit kan leiden tot hoge kosten. Denk hierbij aan de zorg, waarbij de kosten niet van tevoren vaststaan. *Voordelen:* - Mensen die recht hebben op deze regeling weten zeker dat ze het geld krijgen. Er zijn geen limieten of wachtlijsten - De regeling helpt de economie automatisch te stabiliseren door in slechte tijden meer geld uit te keren en in goede tijden minder. *Nadelen:* - De kosten zijn moeilijk te voorspellen en kunnen hoog oplopen - Het is slecht beheersbaar #pagebreak() / Cederen: Het overdragen van een vordering van de ene naar de andere partij == Exportkredietverzekeringen: Een exportkredietverzekering is een soort verzekering die bedrijven helpt bij het exporteren van hun producten of diensten naar andere landen. Het beschermt bedrijven tegen het risico dat hun klanten in het buitenland niet kunnen betalen voor wat ze hebben gekocht. Als de klant niet kan betalen, compenseert de exportkredietverzekering het bedrijf voor het verlies. Dit moedigt bedrijven aan om internationaal zaken te doen door het risico te verminderen. Wordt geregeld door Minister van Financiën. Hoe werkt het *Gefinancierde transactie (vanuit lening)*? + Bedrijf A uit Nederland exporteert product X naar Bedrijf Y in land Z. + Bedrijf A regelt een exportkrediet bij een Nederlandse bank (Bank B). + Bank B verzekert dit krediet bij Atradius Dutch State Business. + Atradius vraagt goedkeuring aan het Ministerie van Financiën (MinFin) en voert een risicoanalyse uit. + Bij goedkeuring van MinFin stelt Atradius in overleg met Bank B een polis op. + Atradius bepaalt de hoogte van de polis en ontvangt daarvoor een vergoeding van de Staat. + Bank B sluit de polis af bij Atradius DSB. + De Staat betaalt Atradius DSB een vergoeding voor de verleende diensten. *Contante transactie* + Bedrijf A uit NL exporteert goed X aan bedrijf Y uit land Z; + Bedrijf A levert, bedrijf Y betaalt niet. Bedrijf A staakt de levering; + Atradius DSB neemt de vordering over. EKV is aanvullend en exporteurs kunnen pas aanspraak maken als ze niet commercieel verzekert kunnen worden. De EKV is bedoeld voor bedrijven die exporteren naar landen waar de politieke en economische situatie onzeker is. De EKV is bedoeld om de risico's van exporteren naar deze landen te verkleinen. Als de schade is uitgekeerd wordt er geprobeerd te *recupereren*. Dit gebeurt onder meer via de Club van Parijs. De link tussen de EKV en het ministerie van Buitenlandse Zaken wordt gelegd via het concept van Official Development Assistance. Dit is een vorm van ontwikkelingshulp waarbij de overheid van een land geld geeft aan een ander land om de economie te stimuleren. Voorbeeld: - Kwijtschelding van schulden aan ontwikkelingslanden - *De HGIS (Homogene Groep Internationale Samenwerking)* is een overzicht van alle uitgaven van Nederland in het kader van internationale samenwerking, inclusief de ODA-uitgaven - HGIS-nota geeft een totaaloverzicht van deze uitgaven, niet apart maar een overzicht Om kwijtschelding toe te rekenen aan de HGIS nota moet het desbetreffende land op de lijst van OESO-DAC voorkomen. *Minister van BHOS (Buitenlandse Handel en Ontwikkelingssamenwerking):* - Geen eigen begroting - Het bedrag dat aan ODA moet worden uitgegeven wordt bij elk Regeerakkoord opnieuw vastgelegd; Een schuldenkwijtschelding die als ODA wordt aangemerkt verlaagd de "echte" uitgaven naar ontwikkelingswerk. De totale omvang van de jaarlijkse schuldenkwijtschelding (aangemerkt als ODA) is niet terug te vinden in de HGIS-nota. Er is weinig controle op de besteding van de ODA-gelden. In principe heeft het parlement dus niets in te brengen over het belang van de schuldenkwijtschelding, terwijl de regering daar juridisch toe verplicht is. De toerekening van kwijtscheldingen aan de HGIS-nota wordt dus niet officieel goedgekeurd = Budget en begroting == BBP: Maatstaf voor de omvang van een economie; de totale waarde van alle goederen en diensten die in een land worden geproduceerd in een bepaalde periode. Het BBP wordt vaak gebruikt om de economische groei van een land te meten. Nominaal BBP versus reëel BBP: - Nominaal BBP: de waarde van alle goederen en diensten die in een land worden geproduceerd in een bepaalde periode, gemeten in huidige prijzen. - Reëel BBP: de waarde van alle goederen en diensten die in een land worden geproduceerd in een bepaalde periode, gecorrigeerd voor inflatie. $ Y=C+I+O+E-M $ Ons schuldratio mag max 60% zijn van het BBP. $ "Financieringssaldo" = "begrotingssaldo - aflossing schuld" $ - We mogen een maximaal tekort per jaar hebben van 3% van het BBP. - Inflatie niet hoger dan 1,5%-punt boven het gemiddelde van de drie EMU-landen met de laagste inflatie; - Geen wisselkoersdevaluaties t.o.v. de euro in de laatste twee jaar; - Kapitaalmarktrente niet meer dan 2%-punt boven de gemiddelde kapitaalmarktrente van de drie EMU-landen met de laagste inflatie. De schuldnorm (60%) en tekortnorm (3%) zijn arbitrair gekozen; er is geen economische reden voor. #pagebreak() == Schuldquote Hoe kan de schuldquote (schuld als percentage van BBP) veranderen? - Economische groei (BBP stijgt) - Reële rente (rente - inflatie) - Primair surplus PS = belastingen - uitgaven (zonder rente) - Boekhoudkundige mutaties $ "Primair saldo" = "overheidsinkomsten" - "(overheidsuitgaven - rente)" $ $ Delta b_t = (i_t - g_t) / (1+g_t) b_(t-1) - "ps"_t + "dda"_t $ $Delta b_t$: verandering in de schuldquote\ $i_t$: rente\ $g_t$: groei\ $b_(t-1)$: schuldquote vorig jaar\ $"ps"_t$: primair saldo\ $"dda"_t$: boekhoudkundige mutaties en andere zaken\ Als $i>g$ is de interest betaling hoger dan de groei. Hierdoor is er dus meer geld nodig (primair saldo) om de schuldquote te verlagen. Als $i<g$ is de interest betaling lager dan de groei. Hierdoor is er minder geld nodig (primair saldo) om de schuldquote te verlagen. == Contante waarde: Annuïteit: een vast bedrag dat periodiek wordt betaald. Dit kan bijvoorbeeld een lening zijn. Hoeveel moet ik vandaag op een bankrekening storten om over 7 jaren over €40.000 te beschikken als de rente 5% is? $ (€40.000)/1.05^7 = €28.427,25 $ *Houdbaarheidssaldo*: De contante waarde van alle toekomstige overheidsoverschotten en -tekorten. Bij een *houdbaarheidstekort* kunnen toekomstige generaties *niet van dezelfde overheidsvoorzieningen profiteren* als de huidige generaties zonder de belastingen te verhogen. *Netto vermogenspositie van de overheid:* Verschil tussen alle bezittingen van de overheid (financiële activa, gasvoorraad, kapitaalgoederenvoorraad) en de bruto schulden van de overheid *Conjectuur:* In tijden van hoogconjunctuur verbetert het overheidssaldo door hogere belastinginkomsten en lagere werkloosheidsuitgaven en vice versa in tijden van laagconjunctuur. *Verschillende soorten beleid:* 1. *anticyclisch:* in tijd van welvaart besparen, in tijd van crisis uitgeven 2. *trendmatig:* in tijd van welvaart besparen, in tijd van crisis ook besparen #pagebreak() Hoe maak je automatische conjectuur stabilisatoren? - *Progressief belastingstelsel:* inkomstenbelasting. Meer verdienen = meer belasting betalen - *Stelsel van sociale zekerheid:* Naarmate het (nationaal) inkomen daalt neemt de werkloosheid toe; de uitgaven voor werkloosheidsuitkeringen stijgen en de belastinginkomsten dalen. Dit zorgt voor een stabiliserend effect op de conjunctuur. *Structurele saldo:* het saldo gecorrigeerd voor de conjunctuur. Dit is het saldo dat je zou hebben als de economie op volle capaciteit draait. *Preventieve arm:* een set van regels die de begrotingen van landen in de eurozone moeten bewaken. == MTO: Het *middellangetermijnbegrotingsdoel* (MTO) is een begrotingsdoelstelling die de overheid zichzelf oplegt om de schuldquote te verlagen. Het MTO is een schuldquote van 60% van het BBP, met aanpassingen voor verwachte vergrijzingslasten Als de schuldratio $< 60%$ mag er een tekort zijn van 1% van het BBP. Als de schuldratio $> 60%$ mag er een tekort zijn van 0,5% van het BBP. Wanneer niet voldaan aan MTO: - Wanneer schuld $<60%$: verbetering structureel saldo met gemiddeld $0,5%$- punt per jaar; - Wanneer schuld $>60%$: verbetering structureel saldo met gemiddeld meer dan $0,5%$-punt per jaar. MTO gehaald? - Uitgaven mogen niet sneller stijgen dan de potentiële middellange termijn economische groei. MTO niet gehaald? - Uitgaven moeten minder snel stijgen dan de potentiële middellange termijn economische groei De uitgaveregel zorgt ervoor dat landen conjuncturele inkomstenmeevallers niet kunnen inzetten voor structurele uitgavenverhoging. == Correctieve arm: Deze vereist dat landen binnen een bepaalde termijn een buitensporig tekort herstellen. Dit moet gebeuren als er een tekort is van meer dan 3% van het BBP, of een begroot tekort van meer dan 3% van het BBP. Ook als de schuld $> 60%$ en die niet voldoende afneemt. voldoende afneemt betekent dat de schuldquote met 1/20 van de schuld per jaar afneemt. #pagebreak() Afwijkingen mogen als: - Ze tijdelijk zijn - Er sprake is van bijzondere omstandigheden - Het saldo een waarde bereikt die de referentiewaarde nadert; (er is een duidelijke neerwaartse trend) *Straffen:* - Een boete van 0,2% van het BBP - Een niet-rentedragende deposito van 0,2% van het BBP - Niet in EU: opschorting betalingen uit Europese Cohesiefondsen. - Eventueel meer sancties == Herziening Europees begrotingsraamwerk: *Belangrijkste verschil:* Er wordt alleen gestuurd op jaarlijkse uitgavenplafonds. MTO en de significante afwijkingsprocedure komen dan te vervallen, evenals de eis van afname van 1/20e per jaar. - Schuldratio >60%? - $S R>90%$: SR jaarlijks minimaal verminderen met 1% BBP; - $60%<S R<90%$: SR jaarlijks minimaal verminderen met 0,5% BBP. *Backloading* gaat ook worden voorkomen door te zeggen dat lidstaten die een technisch uitgavenpad krijgen moeten ieder jaar een gelijk deel van de benodigde aanpassing realiseren. Je mag dus niet beloven het tekort in de toekomst te verlagen. == Begroting: A budget is the financial mirror of society’s economic and social choices. Het zijn de financiële gevolgen van genomen beslissingen. De functies van een begroting: - Allocatiefunctie: hoe worden de middelen verdeeld? - Staatsrechtelijke functie: hoe wordt de macht verdeeld? - Democratiefunctie: hoe wordt de macht gecontroleerd? - Macro-economische functie: hoe wordt de economie gestuurd? - Beheer: Managen van de middelen - Verantwoording: Hoe worden de middelen gebruikt - Controle: er kan onafhankelijk gecontroleerd worden De begroting heeft betrekking op: - Uitgaven en ontvangsten: Het gaat om de bedragen die de overheid uit eigen middelen of door lenen zal besteden, en de inkomsten die ze zal ontvangen (bijv. belastingen). - Kosten en baten - Programma: wat wordt er bereikt met de uitgaven? - Projecten + acties: dingen die de overheid gaat bereiken en doen - Resultaten en effecten: wat gaat de begroting bereiken? #pagebreak() Traditioneel werd er incrementeel begroot. Dit betekent dat er gekeken wordt naar de begroting van vorig jaar, en dat er een klein beetje bij of af wordt gedaan. Tegenwoordig wordt er ook gebruik gemaakt van ZBB. Dit betekent dat er vanaf nul wordt begroot. Dit zorgt ervoor dat er kritisch wordt gekeken naar de uitgaven. Ook hier is er weer een principaal agent situatie: De agent (kabinet) stelt de begroting op en het parlement accepteer/overweegt deze en zet hem vast. In de EU zijn er 3 partijen: - De Europese Commissie: stelt de begroting op - Het Europees Parlement: keurt de begroting goed - De Raad van Ministers: stelt de begroting vast Een begroting moet voldoen aan de volgende dingen: - Volledigheid: alle inkomsten en uitgaven moeten erin staan - Vergelijkbare maatstaven: Alle uitgaven moeten kunnen worden vergeleken - Bruto ramen, rekening houden met alle kosten - Openbaarheid: iedereen moet de begroting kunnen inzien - Periodiciteit: de begroting moet elk jaar worden vastgesteld - Onderworpen aan controle: de begroting moet gecontroleerd kunnen worden == Periodiciteit: De begroting is meestal jaarlijks. Soms eens per meerdere jaren (bijv. 5 jaar). Dit is vaak bij grote projecten. Voorbeelden meerderjarige begrotingen: - Meerjarenbegroting van de EU - Duurt 7 jaar, wordt elke 7 jaar vastgesteld. er is een mid-term review - Rijksbegroting == Het begrotingsproces: + *Voorbereidingen:* De ministeries maken hun begrotingen op. Begroting bestaat uit hoofdstukken, elk hoofdstuk wordt verdedigt door een minister. + *Miljoenennota*: De Miljoenennota bevat een toelichting op de Rijksbegroting, met uitleg over de economische en financiële context en de beleidskeuzes die de basis vormen voor de begroting. + *Behandeling in het Parlement:* + Derde dinsdag van september: aangeboden aan de Tweede Kamer + 2de kamer behandelt de begroting en debatteert per hoofdstuk. Kunnen eventuele wijzigingen voorstellen. + Tweede kamer stemt op begroting + Eerste kamer stemt op begroting, ja of nee per hoofdstuk + *Uitvoering:* De begroting wordt uitgevoerd, er worden verschillende rapportages gemaakt. Voorlopige Rekening, de Voorjaarsnota en de Najaarsnota. + *Verslaggeving en controle:* aan het eind van het jaar worden er verslagen opgesteld. De Auditdienst Rijk en algemene Rekenkamer controleert de begroting. + *Verantwoording:* Op de derde woensdag van mei vindt de Verantwoordingsdag plaats, waarin de regering verantwoording aflegt over het gebruik van de publieke middelen. #pagebreak() Bij andere overheden loopt dit proces vaak redelijk hetzelfde, het verschil zit hem in de vormgeving. == Begrotingsstelsels: De overheid gebruikt er 3. *Kasstelsel:* - Gericht op betalingen - Uitgaven worden geregistreerd op moment van betalen - Ontvangsten worden geregistreerd op moment van ontvangen - Dit stelsel is simpel en eenduidig, maar biedt weinig inzicht in vermogen, waardemutaties en toekomstige kosten. *Verplichtingenstelsel:* - Gericht op het moment waarop een betalingsverplichting ontstaat. - Gaat ook over betalingen, maar geeft inzicht in toekomstige kosten. - Geeft beter inzicht in verplichtingen, maar nog steeds op basis van betalingen. - Nadelen: investeringen worden benadeeld. *Baten-lastenstelsel:* - Gericht op vermogensmutaties - Vermogen neemt toe (bate) en af (last) - Dit stelsel is het meest geavanceerd, maar ook het meest complex. Het geeft het beste inzicht in de vermogenspositie van de overheid. *In de praktijk:* - *Rijk:* Gebruikt een combinatie van de drie stelsels. - *Lagere overheden:* Vaak het stelsel van baten en lasten. - *EU:* Gebruikt het kas-verplichtingenstelsel. == Normering: Normering stelt grenzen aan de uitgaven van de overheid. Dit kan bijvoorbeeld zijn dat de overheid niet meer dan 3% van het BBP mag uitgeven. - *Tekortnormering:* Dit beperkt het begrotingstekort, het verschil tussen uitgaven en ontvangsten. - *Schuldnormering:* Dit beperkt de totale staatsschuld, de totale schuld van de overheid. - *Uitgaven (lasten) normering:* Dit stelt grenzen aan de uitgaven van de overheid, bijvoorbeeld door specifieke categorieën uitgaven te beperken. - *Ontvangsten (baten) normering:* Dit kan betrekking hebben op de hoogte van belastingen of andere inkomsten van de overheid. = Baten en lasten Wordt bijna overal gebruikt, behalve bij het rijk en de EU. Er worden 2 belangrijke documenten gebruikt: - *Balans:* Hierin staan de bezittingen en schulden van de overheid - *Exploitatie begroting:* economische baten en lasten van de overheid #pagebreak() Baten en lasten maakt een zuivere afweging mogelijk. Investeringen worden niet benadeeld en huren/kopen worden gelijk behandeld. Het maakt werkelijke kosten beter zichtbaar. Er is beter inzicht. Het is ook mogelijk om reserves te vormen. Het is niet meer mogelijk om dingen eeuwig door te schuiven. Waardemutaties en afschrijvingen worden zichtbaar. == Zuivere afweging: In het stelsel van baten en lasten wordt er anders omgegaan met investeringen. Ze worden niet beschouwd als eenmalige uitgaven. Een investering wordt opgedeeld in jaarlijkse lasten: - afschrijvingen - rente - herwaarderingen Hierdoor is het makkelijker om een vergelijking te maken tussen investeringen en andere alternatieven zoals huren of leasen. Hierdoor worden investeringen niet benadeeld zoals in het kasstelsel, waar een investering veel meer lijkt dan jaarlijks huren. == Inzicht in de toekomst: Met het baten en lasten systeem krijgt men meer inzicht in toekomstige lasten. Denk hierbij bijvoorbeeld aan vergrijzing met AOW en milieu. Ook is er beter inzicht in verstrekte leningen en garanties. Voordelen hiervan: - lasten gespreid over de tijd - lasten worden naar voren gehaald - toekomstige lasten zijn vroeg zichtbaar - betalingsverschuivingen werken niet meer in het voordeel van de politiek == Waardemutaties: Waardemutaties kunnen zorgen voor problemen. Als de waarde van je spullen stijgt kan er worden gezegd dat er meer uitgegeven kan worden. Dit kan opgelost worden door rekening te houden met deze waardemutaties. == Mogelijke problemen: + *Onduidelijke wat de investering is* + *Manier van afschrijven:* De manier van afschrijven kan invloed hebben op de begroting. Als er bijvoorbeeld lineair wordt afgeschreven, dan is er in het begin veel afschrijving, en later weinig. Dit kan zorgen voor een vertekend beeld. + *Afschrijvingstermijn:* Het termijn van de afschrijving kan effect hebben op de begroting. Een lang afschrijvingstermijn verlaagd jaarlijkse lasten + *Waarderingsgrondslagen:* de manier waarop bezit wordt gewaardeerd. *Wie bepaald dit soort dingen?* - Vroeger minister van financiën - Tegenwoordig _Accounting standards_ - Ook onafhankelijke controle van de Rekenkamer #pagebreak() == Geschiedenis De geschiedenis van het stelsel van baten en lasten in Nederland is gevuld met terughoudendheid, twijfel en hernieuwde pogingen. Hoewel er geen integrale invoering is gekomen, heeft de discussie geleid tot een geleidelijke verschuiving naar meer B&L-elementen in de publieke sector. De ambtelijk commitment van het ministerie van Financiën in 2017 gaf de hoop dat er daadwerkelijk stappen worden ondernomen, maar de politiek moet uiteindelijk beslissen over de toekomst van het stelsel in Nederland. == Extra's bij baten en lasten: *Kasstroom overzicht:* - Operationele kasstroom: gevolg bedrijfsprocessen - Investeringskasstroom: gevolg van investeringen - Financieringskasstroom: opgenomen en afgeloste leningen *Kapitaaldienst:* - Niet op de staat van baten en lasten (de gewone begroting) thuishoren - Stromen van kapitaal - Cashflow? == Staatsbalans: De staatsbalans is een overzicht van de bezittingen en schulden van de overheid. Het geeft inzicht in de financiële positie van de overheid. Het is een momentopname, en geeft geen inzicht in de resultaten van de overheid. *Intracomptabel:* balans moet er zijn \ *Extracomptabel:* balans mag er zijn Huidige staat in Nederland is dat ie extracomptabel is. Waardering lang niet altijd conform IPSAS. Er is ook geen controle. / Kostprijs: de totale kosten per product ($"GTK"$) = Kostprijzen in de publieke sector: *Directe kosten:* kosten die direct toewijsbaar zijn aan een product *Indirecte kosten:* kosten die niet direct toewijsbaar zijn aan een product == Primitieve opslagmethode: Hier tel je de indirecte kosten bij de directe kosten op: $ "GTK" = "Directe kosten" dot (1 + "Totale indirecte kosten" / "Totale directe kosten") $ == ABC: Activity Based Costing is een methode om de kosten van een product te berekenen. Hierbij worden de kosten toegewezen aan activiteiten, en niet aan producten. Dit zorgt voor een betere toewijzing van de kosten. == Break even analyse: $ "TO" = "TK" $ = Belastingfaciliteiten: De overheid heeft een aantal functies: + *Allocatiefunctie:* de overheid kan de economie sturen + *Stabilisatiefunctie:* de overheid kan de economie stabiliseren + *Verdelingsfunctie:* de overheid kan de inkomensverdeling beïnvloeden / Belastinguitgaven: Dingen als hypotheekrente aftrek, heffingskortingen enz. == Gevolgen fiscale regelingen: / Fiscale regelingen: uitzonderingen in het belasting stelsel - Deadweight loss - Leid tot hogere tarieven == Heffingsdruk: *Marginale heffingsdruk:* Hoeveel euro stijgt de af te dragen belasting als het inkomen met 1 euro stijgt. *Gemiddelde heffingsdruk:* Hoeveel procent van het inkomen moet worden afgedragen aan belastingen. Beide zouden toe moeten nemen als het inkomen toeneemt. Dit werkt helaas niet helemaal zo in de praktijk. De marginale druk kan soms dalen als het inkomen stijgt. Dit komt door belastingfaciliteiten zoals heffingskortingen. == Alleenstaande: Als een modale inkomenstrekker arbeidsaanbod van 4 naar 5 dagen per week verhoogd gaat ie voor de uren die hij extra werkt 3 euro per uur verdienen. Dit is een verstoring, zeer hoge marginale druk. == Evaluatie van regelingen: - 11 van 73 zijn doelmatig. - We moeten terughoudender zijn met nieuwe regelingen en oude afschaffen #pagebreak() = Prestaties en effecten == Traditionele begroting: Focust zich op de input en middelen. Denk hierbij aan: - *Kostensoorten:* - Personeel - Materieel - Overdrachten (organisaties) - Kapitaal (vastgoed, infra) - *Programma's:* denk bijvoorbeeld aan onderwijs, zorg, veiligheid - *Hoofdstukken:* denk aan categorieën binnen een programma. Bijvoorbeeld: basisonderwijs, middelbaar onderwijs, hoger onderwijs. *Nadelen* van deze manier van begroten: - De focus ligt niet op de resultaten maar op de middelen - Er is geen inzicht in de effecten van de uitgaven == Een begroting: $ "Middelen" -> "Prestaties (output)" -> "Effecten (daadwerkelijke uitkomst)" $ == Voorbeeld (ziekenhuis): - *Middelen:* aantal bedden, aantal personeelsleden, budget - *Prestaties:* behandelingen, operaties - *Effecten:* verbetering gezondheidstoestand == EEE: Je kunt efficiënt zijn door snel te werken, maar als je naar de verkeerde plek gaat, ben je niet effectief. Je kunt effectief zijn door naar de juiste plek te rijden, zelfs als je langzaam bent. *Economy (zuinigheid)* *Efficiency*\ productief (de dingen goed doen) *Effectiviteit*\ doelmatig (de goede dingen doen) == Meten van prestaties: Meten van prestatie in de publieke sector vaak lastig. Dit komt door: - Collectieve goederen - Veel dienstverlening (diensten zijn moeilijker te meten dan producten, goed onderwijs vs $x$ aantal producten) - Kwaliteit: moeilijk te meten #pagebreak() Wanneer veranderd productiviteit in de publieke sector? - Motivatie - Cultuur - Prikkels - Kapitaal, technologie - Schaal - Kwaliteit Gemiddelde totalen kosten dalen eerst en stijgen dan weer. Dit komt door de *wet van de afnemende meeropbrengsten*. Dit betekent dat als je meer van een input toevoegt, de extra output steeds minder wordt. Schaal en kwaliteit kunnen gerelateerd zijn, meer middelen om het goed te doen, maar het kan ook minder persoonlijk zijn (klein maar fijn). *schaaldoelmatig:* beoordeeld de efficiëntie van een organisaties aan de hand van de schaal van de organisatie\ *kostendoelmatig:* beoordeeld de efficiëntie van een organisatie aan de hand van de kosten van de organisatie. Een bedrijf dat 10% minder aan personeelskosten uitgeeft dan een vergelijkbaar bedrijf met dezelfde omvang, is kostendoelmatiger. *Gradaties:* - *Prestatiemeting:* Dit is het meest basale niveau. Hierbij worden simpelweg feiten en gegevens over de prestaties van een organisatie verzameld en geanalyseerd. Er wordt nog niet gestuurd op deze informatie. - *Voorbeeld:* Een school verzamelt data over het aantal leerlingen dat slaagt voor een examen. - *Prestatiebegroting:* Hier wordt een stap verder gezet door grenzen te stellen voor de prestaties. De begroting geeft aan welke doelen er moeten worden gehaald en welke middelen er daarvoor beschikbaar zijn. - *Voorbeeld:* Een school stelt een doel om het slagingspercentage te verhogen naar 80% en reserveert extra middelen voor bijles en extra ondersteuning. - *Prestatiemanagement:* Op dit niveau wordt er daadwerkelijk gestuurd op prestaties. Er wordt gecontroleerd of de gestelde doelen worden gehaald en er worden eventueel bijsturingen gedaan. - *Voorbeeld:* De school controleert regelmatig het slagingspercentage en past de ondersteuning aan waar nodig. - *Prestatiebekostiging:* Dit is het hoogste niveau van prestatiemeting. Hierbij wordt de financiering van een organisatie direct gekoppeld aan de behaalde prestaties. Dit creëert prikkels om te presteren en om de doelmatigheid te verhogen. - *Voorbeeld:* De school krijgt extra financiering als het slagingspercentage stijgt en minder financiering als het daalt. == Meten van effect: Het meten van effecten is vaak lastig omdat ze niet in een vacuum gebeuren. #pagebreak() *Wet van Baumol:* De Wet van Baumol beschrijft een fenomeen in de publieke sector: de groei van de productiviteit blijft daar vaak achter bij de groei in de marktsector. Dit komt doordat veel publieke diensten lastig te automatiseren zijn en de productiviteit dus minder snel toeneemt. == Prestatie management: Prestatiemanagement is een managementstijl waarbij er gericht wordt op het behalen van prestaties. Hierbij worden doelen gesteld en wordt er gestuurd op het behalen van deze doelen. Dit kan lijden tot meer doelmatigheid, maar ook ontsporing. In de praktijk is dit lastig omdat veel dingen niet goed meetbaar zijn in de publieke sector, denk aan kunst en cultuur, onderwijs en zorg. Andere dingen zoals politie, justitie, uitkeringen en belasting zijn wel goed meetbaar. Uitvoeringsorganisaties scoren over het algemeen beter op productiviteitsgroei dan bijvoorbeeld onderwijs. Dit heeft ermee te maken dat de schaal van onderwijs veel groter is, De gevolgen van een organisatie met een te grote schaal zijn: - Ondoelmatigheid - Slechtere bereikbaarheid - Minder concurrentie en keuze Er bestaat misschien een verband tussen kwaliteit en hogere kosten. Er is niet perse bewijs dat dit zo is. Decentrale overheden gebruiken vaker een prestatiebegroting. Dit wordt vooral gebruikt als een instrument voor management. Het Rijk is minder positief over prestatiebegrotingen. == Prestatie begrotingen in het rijk: Paar pogingen, belangrijkste is de VBTB (Van Beleidsbegroting tot Beleidsverantwoording): - Begroting op basis van beleid. - Ingrijpende wijziging opzet en indeling begroting Dit is helemaal mislukt omdat de doelstellingen te vaag waren en er geen prestaties maar middelen en processen werden gemeten. Nieuwe poging: *VB:* - Meer focus op prestaties en verantwoordelijkheid minister. - Minder ambitieus dan VBTB - Nog steeds geen connectie tussen kosten en effecten, dus geen inzicht in doelmatigheid. #pagebreak() == Grote projecten: Bij grote projecten zijn er 3 belangrijke vragen: - Besliscriterium - Bepaling kosten en baten - Hoe om te gaan met tijd == Tijd en contante waarde: Geld nu is meer waard dan geld later. Dit komt door inflatie maar bvb ook rente stijging. Het is uds nuttig om de contante waarde uit te kunnen rekenen: $ R_0 = (R_t)/((1+r)^t) $ *Hoe kies je $r$?* - *Onderhandeling*: De discontovoet wordt bepaald door onderhandeling tussen de betrokken partijen. Dit kan bijvoorbeeld gebeuren tussen verschillende overheidsinstanties of tussen de overheid en private partners. - *Rendement private sector*: De discontovoet wordt gebaseerd op het rendement dat private investeerders verwachten in vergelijkbare projecten. - *Social Discount Rate*: Deze benadering erkent dat toekomstige generaties ook belang hebben bij de voordelen van huidige projecten. Daarom wordt de discontovoet vaak lager vastgesteld dan in de private sector, om toekomstige baten meer gewicht te geven == Kiezen van projecten: 2 opties: - rangschikken op basis van de contante waarde - grenswaarde instellen en alles erboven kiezen *NPV:* Net Present Value. Dit is de contante waarde van de baten minus de contante waarde van de kosten. Als dit positief is, is het project rendabel. Een andere manier is *IRR* (internal rate of return) te gebruiken. Dat is hoeveel je terug verdient op het project: - Project A: Investeringskosten €1.000.000, baten van €1.200.000 over 5 jaar. Irr = 4% - Project B: Investeringskosten €500.000, baten van €600.000 over 2 jaar. Irr = 10% Schaal maakt hier uit, een klein project kan een hogere IRR hebben dan een groot project maar minder opleveren. Andere manier is *Benefit-Cost Ratio:* $ "Benefit" / "Cost" $ *Terugverdientijd* kan ook gebruikt worden:\ Houd geen rekening met netto baten en omvang van het project. Uiteindelijk is de beste toch wel de *contante waarde* == Bepaling kosten en baten Bij bedrijven tellen alleen economische kosten en baten. Bij de publieke sector telt ook de maatschappelijke kosten en baten mee. Dit is lastig te meten. == Kosten baten analyse: + Inventariseer alle kosten en baten. + Waardeer ze in geld, tel ze op + Bepaal CW + Als de CW positief is doen, anders niet == Waardering van kosten en baten: Je wilt altijd tegen marktprijzen waarderen. Er zijn een aantal problemen met de marktprijs: + De marktprijs kan de werkelijke waarde van een goed niet goed weerspiegelen + Indirecte belastingen kunnen de prijs beïnvloeden Er zijn vaak ook externe effecten die invloed hebben op de waardering, zoals een schonere omgeving of geluidsoverlast. Sommige goederen zijn non-rivaliserend zoals een park waar iedereen gebruik van kan maken. Het is moeilijk om van zoiets de waarde te bepalen. Voor sommige dingen ontbreken er ook gewoon prijzen, zoals dood, geluidsoverlast, stank, milieu, tijd. = KBA (kosten baten analyse) We willen dingen waarderen in geld. Denk aan de waarde van een mensenleven. Hoe waardeer je zoiets? Er zijn verschillende methodes: == Lost earnings Hierbij wordt er gekeken naar wat iemand verdient. CW van verloren inkomen. Consequentie: Laag geschoold minder waard dan hoog en oude mensen niks waard. == Willingness to pay Risico keer bedrag. Uitzoeken hoeveel mensen bereid zijn te betalen om risico te verminderen. Mensen die een hoger salaris eisen voor gevaarlijk werk. == Contingent valuation Vraag de mensen naar waardering. Het is eigenlijk niet mogelijk om een mensenleven uit te drukken in geld. Er zijn 4 fundamentele problemen (Heinzerling & Ackerman): == Waardering onnauwkeurig en ongeloofwaardig: Een mensenleven is van onschatbare waarde. Vaak schatten we de waarde van risico's die voor ons relevant zijn hoger in. Risico's zijn vaak vatbaarder voor beleid als ze minder vrijwillig zijn. Er moet ook genoegen worden genomen met incomplete informatie. == Discontering zorgt dat toekomstige schade minder waard is KBA maakt toekomst minder belangrijk, dus minder waarde voor toekomstige rampen enz. De oplossing hiervoor is voor dit soort dingen niet disconteren. Hierna ontstaan wel weer discussies over wat wel of niet gedisconteerd moet worden #pagebreak() == Wordt geen rekening gehouden met rechtvaardigheid en ethiek Verdeling gaat over wie iets heeft. Je wil het liefst Pareto efficient verdelen. Dat is onhaalbaar in de praktijk dus wordt er gekozen voor een potentiële Pareto-verbetering (Hicks-Kaldor). Dit kan ook averechts werken. Dit werkt niet altijd, vooral als mensen niet gecompenseerd kunnen worden (mensenlevens). == KBA is niet objectief of transparant Met KBA beslis je altijd met onvolkomen informatie. Het is beter om te beslissen met onvolkomen informatie dan helemaal niet. == Alternatieven op KBA: - _Technology-based:_ mest effectieve manier toepassen op bijvoorbeeld klimaatverandering - _Verhandelbare emissierechten_ - _Informational regulation_ - _Multicriteria-analyse_ == Multicriteria-analyse: Meet de kosten in eigen dimensies, ken gewichten toe aan de criteria en bepaal de score. Tel de scores op en vergelijk. Dit heeft inhoudelijk niet echt een verschil met KBA omdat je nog steeds die gewichten moet uitzoeken. == Meer alternatieven op KBA: - *Risk assessment:* alleen kijken naar mogelijke uitkomsten en hoe waarschijnlijk die zijn. - *Cost-effectiveness analysis:* vinden van alternatief met laagste kosten per eenheid minder risico - *Risk-benefit analysis:* medisch, kijken naar risico's en baten van een behandeling - Wel KBA, maar soms niet disconteren of randvoorwaarde voor zwakke en armen. - Breng kosten en baten samen, zet om in geld wat kan en disconteren. Dan blijft de NCW + niet in geld uit te drukken kosten over, die vergelijk je. == KBA in de praktijk: In de realiteit vallen kosten altijd hoger uit dan dat ze geraamd zijn. Waarom: - Technische oorzaken: denk aan vergissingen, slechte inschatting, bias. - Psychologische oorzaken: roze bril, dit lukt wel - Politieke oorzaken: politici willen graag projecten doorzetten, dus onderschatten de kosten. - Economische oorzaken: publiek en eigen belang dus dan maar de kosten onderschatte == De Auditdienst Rijk (ADR): Wij leveren een proactieve bijdrage aan de kwaliteit van de Rijksoverheid met onderzoek naar sturing, beheersing en verantwoording, Dit doen wij in nabijheid van de opdrachtgever, in onafhankelijkheid en met passende deskundigheid. #pagebreak() = (De)centralisatie: Er is een decentralisatie in de Nederlandse overheid tussen het rijk, de provincies en de gemeenten. De taakverdeling tussen deze overheden is gebaseerd op: - Keuze - Verantwoordelijkheid - Uitvoering/voorzieningen - Financiering - Financiële verhoudingen Traditioneel was er een grote focus op efficiency binnen de taakverdeling. *Fiscal federalism* is een theorie die verder kijkt dan alleen die efficiëntie. Er wordt ook gekeken naar de bevoegdheden en financiële verantwoordelijkheid van de overheden. *Theorie van Oates:* stelt kortweg dat decentralisatie van publieke diensten tot meer welvaart leidt. Iedere regio heeft z'n eigen behoefte. Een lokale overheid kan hier beter op inspelen dan een centrale overheid. Dit leid tot meer welvaart. Het liefst wil je alles zo lokaal mogelijk, maar er is een *optimaal voorzieningsgebied*, hoe groot moet een gebied zijn om een bepaalde dienst zo efficiënt en effectief mogelijk te kunnen leveren? Er zijn verschillende niveaus van decentralisatie. Een aantal tussenvormen ontstaan op basis van: keuze, verantwoordelijkheid, uitvoering/voorzieningen en financiering/kosten. == Aspiratie niveaus: De aspiratieniveaus, zoals beschreven door Goedhart, beschrijven verschillende doelen die een land kan nastreven als het gaat om de verdeling van publieke middelen en voorzieningen. 1. *Compensatie voor grootste verschillen in belastingcapaciteit:* Dit niveau streeft ernaar om de grootste verschillen in de financiële mogelijkheden van regio's te compenseren. Dit gebeurt door bijvoorbeeld extra middelen te geven aan regio's met een lage belastingcapaciteit, zodat ze toch een basisniveau van publieke diensten kunnen garanderen. 2. *Compensatie voor verschillen in objectieve behoeften:* Dit niveau gaat verder en beoogt ook verschillen in objectieve behoeften te compenseren. Zo kunnen regio's met een hoge concentratie ouderen of mensen met een beperking extra middelen krijgen om de specifieke zorgbehoeften in die regio te dekken. 3. *Volledige egalisatie voorzieningencapaciteit:* Dit niveau streeft ernaar om de financiële capaciteit van alle regio's om publieke diensten te leveren gelijk te maken. Dit betekent dat alle regio's, ongeacht hun belastingcapaciteit of behoeften, in staat moeten zijn om dezelfde hoeveelheid publieke diensten te leveren. 4. *Gelijke voorzieningen:* Dit is het meest ambitieuze niveau en streeft ernaar om overal in het land dezelfde publieke voorzieningen aan te bieden, ongeacht de regio. Dit betekent dat alle burgers dezelfde kwaliteit van onderwijs, zorg, openbaar vervoer etc. zouden moeten krijgen, onafhankelijk van hun woonplaats. Nederland bevind zicht officieel op niveau 3, dat wordt nagestreefd. In de praktijk komen we meer uit op niveau 4. == Political Economy: De theorie stelt dat politiek gedrag, zoals lobbyen en corruptie, de optimale taakverdeling tussen overheidsniveaus kan beïnvloeden. Hierdoor is het misschien toch handiger om sommige dingen te (de)centraliseren. *Voorbeeld:*\ Een gemeente kan besluiten om een bepaalde dienst te centraliseren, omdat de lokale politici daardoor meer macht en invloed krijgen. == Behavioral Economics: Deze theorie bestudeert hoe mensen in de praktijk beslissingen nemen. Ze stellen vast dat mensen vaak irrationele keuzes maken, gebaseerd op emoties, biases en beperkt inzicht. Dit kan leiden tot ongewenste uitkomsten bij het decentraliseren van diensten. *Voorbeeld:*\ Een gemeente kan besluiten om meer geld te besteden aan een populaire dienst, terwijl de behoefte aan andere diensten groter is. == Agency Theory en Transaction Costs: Deze theorieën focussen op de relaties tussen "principals" (bijvoorbeeld het Rijk) en "agenten" (bijvoorbeeld gemeenten). De theorie stelt dat er kosten verbonden zijn aan het controleren en sturen van agenten, en dat deze kosten de voordelen van decentralisatie kunnen tenietdoen. *Voorbeeld:*\ Het Rijk kan moeite hebben om gemeenten te controleren en te sturen, wat leidt tot inefficiëntie en verspilling van middelen. == Optimale bekostiging: Taakverdeling zegt niks over bekostiging. Een aantal criteria voor optimale bekostiging: - Allocatie: (efficiency). De welvaart moet maximaal zijn, productie minimale kosten. Dit geld voor 'normale' goederen en diensten, niet voor collectieve goederen. - Verdeling: (equity) - Stabilisatie / groei - transparantie - Administratieve lasten #pagebreak() *Verschillende manieren waarop publieke diensten worden bekostigt:* Vanaf boven naar beneden: + *Prijs en tarief:* Bijvoorbeeld de kosten voor een museumbezoek of de prijs van een treinkaartje. Niet makkelijk toepasbaar op publieke diensten. + *Belasting:* Minder handig omdat er geen directe relatie is tussen de kosten en de baten. Ook schade aan welvaart. Rijke overheden steeds rijker, arme steeds armer. + *Vrij besteedbare overdrachten van andere overheden:* _algemene_ subsidie aan gemeente om bijvoorbeeld iets uit te voeren. Hogere overheid heeft wel invloed. + *Gebonden overdrachten van andere overheden:* Overdrachten met een specifiek doel + *Leningen* == Praktijk: - *Nationaal*: Rijk - *Decentraal*: gemeenten, provincies, waterschappen - *Middenveld* - *Supranationaal*: EU Gemeentes geven 30% van het totaal uit. Komt door bvb jeugdzorg. Provincies geven een stuk minder uit, krijgen geld uit belastingen en provinciefonds. Waterschappen doen waterbeheer en krijgen het geld uit de primaire wateruitkering. = Toepassingen: == Ontvangsten gemeenten: *De vier belangrijkste bronnen van inkomsten voor gemeenten zijn:* + *Belastingen:* Gemeenten mogen zelf geen nieuwe belastingen invoeren, maar ze kunnen wel de tarieven van bestaande belastingen bepalen. De belangrijkste belasting voor gemeenten is de *OZB (Onroerende Zaak Belasting)*, die wordt geheven op vastgoed. + *Algemene uitkeringen:* Gemeenten ontvangen *algemene uitkeringen* uit het Gemeentefonds. Dit fonds wordt gevoed met een deel van de rijksbelastingen en de verdeling gebeurt op basis van objectieve criteria, zoals het aantal inwoners, de oppervlakte, etc. + *Specifieke uitkeringen:* De overheid kan gemeenten *specifieke uitkeringen* toekennen voor bepaalde doeleinden, bijvoorbeeld voor jeugdzorg of de WMO. Deze uitkeringen zijn vaak bedoeld om bepaalde doelstellingen te realiseren of om te compenseren voor extra kosten. + *Overige ontvangsten:* Deze categorie omvat een breed scala aan inkomsten, zoals *prijzen en tarieven* voor gemeentelijke diensten (bijv. paspoorten), *winst uit gemeentelijke bedrijven*, *opbrengsten uit deelnemingen* en *kapitaaldienst* (verkoop van gemeentelijke bezittingen). *Praktijk in Nederland:* Ongeveer eens in de tien jaar adviescommissie met de vraag voor mee ruimte voor gemeenten. Hier komt nooit verandering in. Aantal punten voor: - Betere afweging lokaal niveau - Belastingen hebben niet de nadelen van algemene en specifieke uitkeringen == Tax sharing: Een alternatief systeem op het Gemeentefonds. Hier ontvangen gemeentes direct een deel van de belastingen. Gemeentes dragen dan ook risico van belastingtegenvallers. De kosten om dit uit te voeren zijn laag. == Beperkingen voor gemeenten om zelfstandig belastingen te heffen. *Grondslag met hoge elasticiteit:* Belastingen die sterk fluctueren in opbrengsten zijn niet geschikt voor gemeenten. Het brengt een te hoog risico met zich mee. Denk aan BTW, accijnzen, inkomen, winst. *Smalle grondslag:* een belasting met een smalle grondslag zou oneerlijk zijn omdat er dan een ongelijke verdeling kan ontstaan. De gemeente kan dus belastingen heffen op bezit of belastingen met een laag aandeel in totale uitgaven. Een paar voorbeelden: - *OZB:* Belasting op onroerend goed. Gemeenten mogen zelf de tarieven bepalen. - *Parkeer* - *Rioolrechten* - *Hondenbelasting* Een aantal nieuwe belastingen: - *Heffing op waterverbruik* - *Schenk- en erfbelasting* Het zou ideaal zijn als er meer lokale belastingen komen die worden overgenomen van het Rijk, Het Rijk kan dan compenseren door verlaging en afschaffingen van specifieke uitkeringen. == Gemeentefonds: Het gemeentefonds is een fonds waaruit gemeenten worden gefinancierd. Het fonds wordt gevoed door een deel van de rijksbelastingen en de verdeling gebeurt op basis van objectieve criteria, zoals het aantal inwoners, de oppervlakte, etc. Het is vrij besteedbaar maar er zijn wel veel verplichte uitgaven. == Specifieke uitkeringen: Specifieke uitkeringen zijn gemaakt om bijzondere kosten de compenseren en gedrag te sturen. Er wordt sterk op verminderd. Het financieel belang blijft groot en het Rijk blijft zich bemoeien met de gemeentes. == EU inkomsten: De EU heeft een eigen begroting. De inkomsten van de EU bestaan uit: - *Importheffing* - *BTW* - *BNI:* inkomsten belasting - Totaal 1% van het BBP lidstaten Import en landbouwheffingen zijn eigen EU belastingen, BTW en BNI komen van lidstaten die afdragen op basis van berekening. == Voorstellen EU: Ook in de EU is _tax sharing_ mogelijk, bijvoorbeeld bij BTW, energiebelasting en vennootschapsbelasting. Er zijn een aantal voorstellen voor deze 3. Ook zijn er heffingen genoemd voor financiële transacties, Sms'jes en e-mails, $"CO"_2$ en seigniorage (productie van geld). = Recente decentralisaties: Er zijn redelijk wat taken doorgeschoven van het Rijk naar de gemeentes. De taken zijn 100% overgedragen, maar de kosten vaan 90%. De gemeentes kunnen dingen vaak effectiever en doelmatiger dan het Rijk. Een aantal voorbeelden zijn jeugdzorg en thuiszorg en begeleiding ouderen en gehandicapten. De gevolgen zijn dat veel taken worden gedecentraliseerd. De bekostiging is erg krap en als gevolg gaat de kwaliteit omlaag. Er zijn veel lokale verschillen. Er ontstaat een verschuiving naar intramurale zorg (zorg in instellingen) en er is een toename van de kosten. #line(length: 100%, stroke: gray) = De kredietcrisis: == Bankwezen in de VS: Het bankwezen in de VS heeft een complexe geschiedenis: - *Beurskrach, daarna Great Depression* - *Glass-Steagall Act:* scheiding tussen commerciële en investment banken - *Gramm-Leach Bliley Act:* herintroductie _universal banking model_ #quote(attribution: "Demirgüç-Kunt & Huizinga (2010)")[After the crisis, the US has now come full circle, from the separation of commercial and investment banking through the Glass- Steagall Act of 1933, to the reintroduction of universal banking by way of the Gramm-Leach-Bliley Act in 1999, and, finally, to the disappearance of large independent investment banks altogether in 2008.] == Subprime mortgages: Na het barsten van de dot com bubble werd de rente verlaagd. Hierdoor werd lenen goedkoper en minder winstgevend. De banken begonnen met het verstrekken van *subprime mortgages* (hypotheekleningen aan mensen met een slechte kredietwaardigheid). Hierdoor steeg de vraag naar hypotheken, daardoor de vraag naar huizen, waardoor de huizenprijzen stegen. == Derivaat: Een derivaat is een financieel instrument dat zijn waarde ontleent aan een onderliggende waarde, zoals aandelen, rente, valuta of grondstoffen. Derivaten worden gebruikt om risico's af te dekken of om te speculeren. #pagebreak() == Securitization: Securitization is the process of turning assets, like loans or mortgages, into tradable financial products. Here's a simple example: + *Bank loans*: A bank gives out many home loans. + *Pooling*: The bank bundles these loans together into a single package. + *Selling*: The bank sells this package to investors as securities (like bonds). + *Investors*: Investors buy these securities and receive the loan payments (with interest) from homeowners. Securitization lijdt over het algemeen tot een lager financieel risico, omdat het risico wordt gespreid over meerdere investeerders en meerdere assets (bvb leningen). Als 1 lening faalt, is het verlies voor de investeerder beperkt. Het idiosyncratic risk daalt. *Idiosyncratic risk*, also known as unsystematic risk, is the risk that affects a specific company or industry, not the entire market. This type of risk can be reduced through diversification. *Rating agencies:* Deze geven ratings aan de securitisaties. Dit is belangrijk omdat het de prijs bepaalt. De ratings geven aan hoe veilig de investering is. == Credit Default Swaps: Een Credit Default Swap (CDS) is een financieel derivaat dat de koper beschermt tegen het risico dat een lening niet wordt terugbetaald. De koper betaalt een premie aan de verkoper en in ruil daarvoor ontvangt hij een vergoeding als de lening niet wordt terugbetaald. Deze worden *niet gereguleerd* omdat ze technisch gezien een transactie zijn, geen verzekering. == Rente swaps: Een renteswap is een financieel derivaat waarbij twee partijen afspreken om rentebetalingen uit te wisselen. Dit kan bijvoorbeeld gebeuren als een partij een lening heeft met een variabele rente en deze wil omzetten naar een vaste rente. == Gevolgen van de kredietcrisis: De kredietcrisis had een aantal belangrijke gevolgen: - *Banken:* Veel banken gingen failliet of moesten worden gered door de overheid. - *Economie:* De economie kromp en de werkloosheid steeg. - *Overheid:* De overheid moest veel geld uitgeven om de economie te redden. #pagebreak() = Overheidsfinanciën: Een toename van overheidsbestedingen tot een stijging van de vraag naar geld. Hierdoor: - Stijgt de _prijs van geld_, *rente* - Daardoor nemen de financieringskosten toe - Daardoor dalen de investeringen. Dit heet _crowding out_. Als de overheid meer leent zorgt een stijgende rente. == Wet houdbare overheidsfinanciën: De "Wet houdbare overheidsfinanciën" is een wet die in 2012 werd aangenomen om de financiële stabiliteit van de Nederlandse overheid te waarborgen. Deze wet stelt grenzen aan de tekorten en schulden van de overheid. + _Emu tekortnorm voor *decentrale* overheden:_ 0,5% van het BBP. Dit zijn gemeenten, provincies en waterschappen. Er kan alleen sanctie worden opgelegd als het Rijk een tekort heeft van meer dan 3%. + _Emu tekortnorm voor *Rijk:*_ 3% van het BBP + _Emu schuldnorm:_ max 60% BBP, jaarlijks minimaal een 20ste deel gemiddeld (over 3 jaar heen) aflossen. Het rijk werkt met het *kasstelsel*, de decentrale overheden met het *baten en lasten stelsel*. Afschrijvingen hebben geen effect op het tekort. Het gaat alleen op directe uitgaven (aflossing/kapitaaluitgaven). Hierdoor kan je een evenwicht hebben in je balans, maar toch een tekort hebben met het kasstelsel. == Management van de staatsschuld: Er zijn een aantal geld en kapitaalmarkt instrumenten die de overheid kan gebruiken om de staatsschuld te beheren: - *Indexleningen:* - Treasury Inflation Protected Securities (TIPS): Deze obligaties beschermen de beleggers tegen inflatie, doordat de couponbetalingen worden aangepast aan de inflatie. - BBP-indexleningen: De rentebetaling op deze leningen hangt af van de groei van het BBP. - *Korte-termijnleningen*: - Commercial Papers: Dit zijn korte-termijnleningen (1 week tot 3 maanden) zonder onderpand, uitgegeven tegen een discount (leen mij 90k en ik geef je 100k terug). - Certificate of Deposits (CDs): Dit zijn deposito's met een vaste looptijd die via de secundaire markt verhandeld worden. Geef geld aan de bank (vast) en krijg rente. - *Middellange termijnleningen*: - Medium Term Notes (MTNs): Deze leningen hebben een looptijd van 3 tot 36 maanden en de hoofdsom en rente worden gegarandeerd door de Staat. Het doel van al deze regelingen is om de staatsschuld zo goedkoop mogelijk te financieren, met zo weinig mogelijk risico. *Wat begrippen (geen tentamenstof, hoeft niet uit je hoofd):* - *STRIPS* (Separate Trading of Registered Interest and Principal Securities): Hierbij worden coupons en obligaties onafhankelijk van elkaar verhandeld. - *Off-the-run bonds*: Staatsleningen die al eerder zijn uitgegeven dan de meest recente uitgifte. - *DSL* (Dutch State Loans): Kapitaalmarktinstrument voor financiering van de staatsschuld. - *DTV* (Dutch Treasury Certificate): Geldmarktinstrument voor financiering van de staatsschuld met een looptijd van 3 tot 12 maanden. - *Hedging*: Het afdekken van financieel risico, bijvoorbeeld via renteswaps of valutaswaps. *Permanente inkoopfaciliteit:* Mogelijkheid van de Staat om bepaalde oude leningen terug te kopen van beleggers. Dit kan bijvoorbeeld zijn als de rente vandaag laag is en de lening een hoge rente heeft. == Initiatiefnota: Een Kamerlid neemt een initiatiefnota om een onderwerp op de agenda te zetten. De regering komt hierna met een reactie. Je legt dit voor aan de minister. *Wat zijn derivaten?* Financiële derivaten zijn complexe financiële instrumenten die hun waarde ontlenen aan een onderliggend product, zoals aandelen, rente, valuta of grondstoffen. Een swap is een voorbeeld van een derivaat. Derivaten leveren een belangrijke bijdragen aan het stabiliseren van het financiële resultaat en de gezondheid van instellingen en ondernemingen. Coöperaties kwamen erachter dat het voordeliger was om een variable lening af te sluiten en een swap te doen om een vaste lening te krijgen. Dit was goedkoper dan een vaste lening afsluiten. De overheid had hier weinig inzicht in. *Open positie:* een open positie is een derivaat die geen bestaande lening afdekt. Er wordt iets afgesloten op toekomstige plannen. Dat mag niet. Er staat geen straf op. *Speculatie:* Het kopen van een financieel product met als doel om in de toekomst winst te maken. *Overhedging:* Situatie waarbij er meer financieel risico is afgedekt dan waaraan is blootgesteld. Verzekeren van een huis van €100.000 voor €200.000. *Embedded derivative: * Derivaten die (bijv.) in leningen zijn verpakt, zodat–geheel volgens de geldende regels- geen onderpand hoeft te worden gestort. *Wat is een renteswap?* Een renteswap is een financieel derivaat waarbij twee partijen afspreken om rentebetalingen met elkaar te ruilen. Dit kan bijvoorbeeld zijn om een variabele rente om te zetten in een vaste rente. #pagebreak() == Public debt overhang: Hoe hoger de spread, hoe meer risico beleggers voelen. Als: $ arrow.t "staatschuld" > arrow.t "spread" > arrow.b "economic growth" $ Wat is debt overhang: Episodes where public debt to GDP exceeds 90% for at least five years. Hogere staatschuld rijd tot hogere rente. Dit zorgt voor een lagere economische groei. Gedurende een debt overhang daalt de economische groei met 1,2% - Crowding out - Toenamen van lening laat de rente stijgen - De effecten op economische groei treden pas op wanneer de schuldratio $>$ 85% is. Lagere economische groei lijdt niet perse tot debt overhang. Landen met _public debt overhang_ ervaren niet altijd een snelle toename van reële rente. Debt overhang is vaak het gevolg van kostbare oorlogen of financiële crises. Debt overhang zorgt niet altijd voor een lagere economische groei. Wel heel vaak = Tentamen: - Aantal meerkeuzevragen, 20 of 30? Die gaan over alle stof. - 2 open vragen met a, b, c, d, e, f. - *Rekenmachine meenemen*. - Schulddynamiek formule krijg je. #pagebreak() = Formuleblad: *Nominale BBP vs Reële BBP:* - *Nominale BBP:* De waarde van alle goederen en diensten die in een land in een bepaalde periode worden geproduceerd, gemeten tegen huidige prijzen. - *Reële BBP:* De waarde van alle goederen en diensten die in een land in een bepaalde periode worden geproduceerd, gecorrigeerd voor inflatie. - *BBP Formule*: $Y = C + I + O + E - M $ - *Schuldquote:* Onze schuldquote mag niet hoger zijn dan 60% van het BBP. $ "Schuldquote" = "schuld" / "BBP" $ *Financieringssaldo:* $ "Financieringssaldo" = "begrotingssaldo - aflossing schuld" $ - Maximaal Toegestaan Jaarlijks Tekort: 3% van het BBP *Inflatielimiet:* Inflatie mag niet hoger zijn dan 1,5% boven het gemiddelde van de drie EMU-landen met de laagste inflatie. *Wisselkoersstabiliteit:* Geen wisselkoersdevaluaties tegen de euro in de afgelopen twee jaar zijn toegestaan. *Kapitaalmarktrente Limiet:* De kapitaalmarktrente mag niet meer dan 2% boven de gemiddelde kapitaalmarktrente van de drie EMU-landen met de laagste inflatie liggen. *<NAME>:* $ "<NAME>" = "overheidsinkomsten" - "(overheidsuitgaven - rente)" $ *Verandering in Schuldquote Formule:* $ Delta b_t = (i_t - g_t) / (1+g_t) b_(t-1) - "ps"_t + "dda"_t $ - $Delta b_t$: verandering in de schuldquote\ - $i_t$: rente\ - $g_t$: groei\ - $b_(t-1)$: schuldquote vorig jaar\ - $"ps"_t$: primair saldo\ - $"dda"_t$: boekhoudkundige mutaties en andere zaken\ - Annuïteit: Een vast bedrag dat periodiek wordt betaald, bijvoorbeeld een lening. *Contante waarde:* Hoeveel moet ik vandaag op een bankrekening storten om over 7 jaar €40.000 beschikbaar te hebben als de rente 5% is? $ (€40,000)/1.05^7 = €28,427.25 $ $ R_0 = (R_t)/((1+r)^t) $ #pagebreak() *Primitieve opslagmethode:* $ "GTK" = "Directe kosten" * (1 + "Totale indirecte kosten" / "Totale directe kosten") $ *Break-Even Analyse:* $ "TO" = "TK" $ *Kosten-Baten Verhouding:* $ "Baten" / "Kosten" $ #pagebreak() = Begrippenlijst: #table(columns: (1fr, 2fr), [*Publieke sector vs. marktsector:*], [De publieke sector is de sector die bestaat uit de overheid en de non-profitorganisaties. De marktsector bestaat uit bedrijven en particulieren.], [*Principaal-agentprobleem:*], [Het principaal agent probleem houdt in dat er een conflict van belangen ontstaat als een persoon acties onderneemt namens een ander persoon. Soms kunnen de belangen dan niet overeen komen.], [*Non-market failures:*], [het falen van overheidsingrijpen in een markt. Dit kan komen door slecht gedefinieerde grenzen, onduidelijke doelen, onvoldoende informatie, enz.], [*Begrotingsfondsen:*], [Een begrotingsfonds is een speciaal fonds dat wordt gebruikt om geld te reserveren voor een specifiek doel. Dit kan bijvoorbeeld zijn voor de financiering van pensioenen of zorg. Het kan snel leiden tot overspending.], [*Structureel overheidssaldo:*], [ Het structureel overheidssaldo is het begrotingssaldo gecorrigeerd voor de economische conjunctuur. Het geeft een beter beeld van de financiële positie van de overheid.], [*Begrotingsoverschot en -tekort:*], [Een overschot treed op als de inkomsten hoger zijn dan de uitgaven, een tekort is het tegenovergestelde.], [*Bruto overheidsschuld:*], [de totale schuld van de overheid inclusief financiële activa. ], [*Netto overheidsschuld:*], [de totale schuld van de overheid minus financiële activa.], [*Houdbaarheidssaldo:*], [Het houdbaarheidssaldo is het begrotingssaldo dat nodig is om de overheidsschuld op de lange termijn houdbaar te houden zonder dat de belastingen verhoogd hoeven te worden.], [*Aflossingen en afschrijvingen:*], [Een aflossing is het terugbetalen van een lening, een afschrijving is het afschrijven van een investering.], [*Garantieverlening:*], [Een garantie is een verplichting van de overheid om een lening terug te betalen als de lener dat niet kan.], [*Open-einderegeling:*], [Een regeling waar geen gedefinieerde einddatum/stop is.], [*Belastinguitgaven:*], [Belastinguitgaven zijn subsidies die worden verstrekt via het belastingstelsel. Dit kan bijvoorbeeld zijn door belastingvoordelen of aftrekposten.], [*Zero Base Budgeting:*], [Zero-based budgeting is een methode van budgettering waarbij elk budget vanaf nul wordt opgebouwd. ], [*Controleverklaring (Auditdienst Rijk):*], [Een controleverklaring is een verklaring van een accountant waarin hij aangeeft of de jaarrekening een getrouw beeld geeft van de financiële positie van een organisatie. Kan Goedkeurend, met beperking of oordeelonthouding zijn.], [*Activity Based Costing (ABC):*], [Activity-based costing is een methode van kostenberekening waarbij de kosten worden toegerekend aan de activiteiten die ze veroorzaken.], [*Kostentoerekening en kostprijs:*], [Kostentoerekening is het toerekenen van kosten aan een bepaald product of dienst. De kostprijs is de prijs die nodig is om een product of dienst te produceren.], [*Doelmatigheid:*], [efficient, zo goed mogelijk het doel bereiken.], [*Doeltreffend:*], [effectief, het goede doel bereiken.], [*Reële rente en inflatie:*], [De reële rente is de rente gecorrigeerd voor inflatie.], [*Maatschappelijke kosten-batenanalyse:*], [Een maatschappelijke kosten-batenanalyse is een methode om de kosten en baten van een project of beleid in kaart te brengen.], [*Discontovoet:*], [De discontovoet is het rendement dat een investeerder wil behalen op een investering.], [*Social Discount Rate:*], [De social discount rate is de discontovoet die wordt gebruikt in een maatschappelijke kosten-batenanalyse. Deze is altijd hoger dan de marktrente bij een kosten-batenanalyse.], [*Bekostiging van decentrale overheden:*], [Decentrale overheden worden bekostigd door belastingen, algemene uitkeringen, specifieke uitkeringen en overige ontvangsten.], [*Specifieke uitkeringen:*], [Specifieke uitkeringen zijn uitkeringen van het Rijk aan gemeenten voor specifieke doeleinden.], [*Gemeentefonds:*], [Het gemeentefonds is een fonds waaruit gemeenten worden gefinancierd. De verdeling gebeurt op basis van objectieve criteria.], [*Ruimtelijk bereik van voorzieningen:*], [Het ruimtelijk bereik van voorzieningen is de afstand die mensen moeten afleggen om gebruik te maken van een bepaalde voorziening.], [*Debt overhang:*], [Debt overhang is een situatie waarin de schuldquote van een land zo hoog is dat het de economische groei belemmert.], [*Crowding out:*], [Crowding out is een situatie waarin de overheid zoveel leent dat de rente stijgt en de investeringen daardoor dalen.], [*Theorema van Oates:*], [De theorie van Oates stelt dat decentralisatie van publieke diensten tot meer welvaart leidt.], [*Decentralisatie vs. centralisatie van voorzieningen:*], [Decentralisatie is het overdragen van taken naar lagere overheden, centralisatie is het tegenovergestelde.], [*Nominaal en reëel BBP:*], [Het nominale BBP is de waarde van alle goederen en diensten die in een land in een bepaalde periode worden geproduceerd, gemeten tegen huidige prijzen. Het reële BBP is gecorrigeerd voor inflatie.], [*Economische groei:*], [Economische groei is de toename van de productie van goederen en diensten in een land.], [*Financieringstekort:*], [Het financieringstekort is het verschil tussen de inkomsten en uitgaven van de overheid.], [*Begrotingssaldo:*], [Het begrotingssaldo is het verschil tussen de inkomsten en uitgaven van de overheid.], [*Primair saldo:*], [Het primair saldo is het begrotingssaldo gecorrigeerd voor rentebetalingen.], [*Begrotingsnormen (Stabiliteits- en Groeipact):*], [Het Stabiliteits- en Groeipact zijn afspraken tussen EU-landen over begrotingsnormen. Zo mag het tekort niet hoger zijn dan 3% van het BBP en de schuldquote niet hoger dan 60% van het BBP.], [*EMU-saldo:*], [Het EMU-saldo is het begrotingssaldo van de overheid gecorrigeerd voor economische conjunctuur.], [*Schuldratio:*], [De schuldratio is de verhouding tussen de schuld en het BBP.], [*Inputbegroting:*], [Een inputbegroting is een begroting waarbij de uitgaven worden bepaald op basis van de beschikbare middelen.], [*NPV:*], [Net Present Value, de contante waarde van alle toekomstige kasstromen minus de investering.], )
https://github.com/felsenhower/kbs-typst
https://raw.githubusercontent.com/felsenhower/kbs-typst/master/examples/16.typ
typst
MIT License
The first 8 Fibonacci Numbers are: #align(center)[ #table( columns: 8, [$F_1$], [$F_2$], [$F_3$], [$F_4$], [$F_5$], [$F_6$], [$F_7$], [$F_8$], [1], [1], [2], [3], [5], [8], [13], [21], ) ]
https://github.com/KXXH/YAYT
https://raw.githubusercontent.com/KXXH/YAYT/main/README.md
markdown
# YAYT: Yet Another Yuebao Template For 318 一个使用typst编写的318月报模版 ## 使用方法 ## 安装 1. 安装typst [官方CLI安装教程](https://github.com/typst/typst) - MacOS ```bash brew install typst ``` - Windows ```bash winget install --id Typst.Typst ``` 2. 下载本模版 ```bash git clone ... ``` ## 使用 在模版目录下新建`main.typ`或其他命名的`.typ`文件。 ### 模版参数 ```typst #show: project.with( title: "2023年11月工作汇报", // 文档标题,用于元信息,无实际可见作用 author: // 作者信息,包括姓名、专业、研究方向和年级 (name: "name", major: "电子信息", direction: "信息可视化与可视分析", grade: 2021), date: datetime.today(), // 提交日期,显示于封面 year: 2023, // 年份,显示于封面,默认为编译当年年份 month: 12 // 月份,显示于封面,默认为编译当月月份 ) ``` ### 常见排版需求 ### 标题 ```typst = 一级标题 == 二级标题 === 三级标题 ``` ### 文本样式 ```typst *加粗* _斜体_ `行内代码` - 无序列表 + 有序列表 $公式$ ``` 更多样式参考:[Typst文档](https://typst.app/docs/reference/syntax/) #### 插图 ```typst #figure( image("figures/figure_name.png", width: 70%), caption: [ Bulabulabula ] ) ``` #### 表格 ```typst #figure( caption: [ 三级目录进度情况 ], kind: table )[ #tablex( // 列数 columns: 2, inset: 5pt, // 表格内边距 // 表格对齐方式,垂直居中+水平居中 // align: horizon+center, // 表格对齐方式,垂直居中+水平靠左 align: horizon, // 三线表 auto-vlines: false, // 表头行数,如果不跨页则无明显作用 header-rows: 1, // 每个单元格 [*章节*], [*进度*], [第一章: 绪论], [ - 完成研究现状框架 - 完成可视化推荐算法研究现状 ] )], ``` #### 参考文献 引入参考文献文件(bib文件) ```typst #bibliography("reference.bib") ``` 引用参考文献 ```typst @cite_key ``` (使用`@`+`cite_key`的形式引用,`cite_key`为参考文献的标识符,可在bib文件中找到) ## 最佳实践 你可以使用[Typst Web App](https://typst.app)来编辑Typst文件(和Overleaf一样),也可以使用VS Code来编辑Typst文件。本模版已经包含Typst Web App所不具有的宋体字体,但使用本地编译能使用本地的中文字体,所以还是建议使用VS Code来编辑Typst文件。 ### VS Code拓展 - [Typst LSP](https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp) - [Typst Preview](https://marketplace.visualstudio.com/items?itemName=mgt19937.typst-preview):支持实时预览构建效果,比Overleaf还要方便
https://github.com/Ryoga-itf/dsa
https://raw.githubusercontent.com/Ryoga-itf/dsa/main/week01/report.typ
typst
#import "../template.typ": * #import "@preview/codelst:2.0.1": sourcecode, sourcefile #show: project.with( week: 1, name: "C によるプログラミングの復習", authors: ( ( name: sys.inputs.STUDENT_NAME, id: sys.inputs.STUDENT_ID, affiliation: "情報科学類 2 年 3 クラス" ), ), deadline: "2024 年 10 月 16 日", date: "2024 年 10 月 7 日", ) == 基本課題 === 課題1 本課題は `gcd_iter.c` および `main_iter.c` を入力、コンパイルし、実際に動作を確かめるというものである。 本課題の指示にレポートでの報告は不要である、とあるのでここでは省略する。 === 課題2 以下に実装した gcd_euclid 関数を示す。 #sourcefile(read("./gcd_euclid.c"), file:"./gcd_euclid.c") また、以下に実行結果を示す。実行においては、n = 333, m = 57 および n = 12, m = 144 で試している。 #sourcecode[``` $ ./gcd_euclid 333 57 The GCD of 333 and 57 is 3. $ ./gcd_euclid 12 144 The GCD of 12 and 144 is 12. ```] === 課題3 `gcd_iter(16, 12)` の動作について考える。 - 関数冒頭の処理により、$𝑛 = 12, 𝑚 = 16$ となる - 変数 `gcd` が $1$ に、i が 1 に初期化される - `while` ループに入る - `if` の条件中の式は `true` と評価され、`gcd` は $1$ になる - `i` がインクリメントされ、$2$ になる - `while` の条件 `i <= n` は `true` であるからループが続く - `if` の条件中の式は `true` と評価され、`gcd` は $2$ になる - `i` がインクリメントされ、$3$ になる - 同様にループが続き、`i = 4` のときに `gcd = 4` となる - 同様にループが続き、`i = 12` のとき、`i` がインクリメントされ、`i = 13` になり、条件を満たさなくなるため `while` ループを抜ける - 戻り値として `4` が返る `gcd_euclid(16, 12)` の動作について考える。 - `while` ループに入る - 変数 `tmp` に $𝑛 = 16$ を $𝑚 = 12$ で割った余りである $4$ が代入される - `n` が `m` に、`m` が `tmp` に更新される。 - `while` の条件 `m != 0` は `true` と評価されるため、ループが続く - 変数 `tmp` に `𝑛 = 12` を `𝑚 = 4` で割った余りである $0$ が代入される - `n` が `m` に、`m` が `tmp` に更新される。 - `while` の条件 `m != 0` は `false` と評価されるため、ループから抜ける - 戻り値として `𝑛` すなわち $4$ が返る == 応用課題 === 課題1 `gcd_iter` の計算量について考える。 この関数は、$n, m$ を $1$ から $min(n, m)$ までの数で割り、その余りを確認している。 よって、`gcd_iter(n, m)` の計算は $Omicron(min(n, m))$ で行える。 また、領域計算量は $Omicron(1)$ である。 `gcd_euclid` の計算量について考える。 $n > m > 0$ であり、$n$ を $m$ で割った余りが $q$ であるとする。 $ n >= 2m => m + q <= m + m <= 2/3 (n + m) \ n <= 2m => m + q <= m + (n - m) <= 2/3 (n + m) $ であるから、ユークリッドの互除法の計算を $1$ ステップ進めると、$2$ 数の和が $2/3$ 倍以下になることがわかる。 したがって、`gcd_euclid(n, m)` の計算は $Omicron(log(n + m))$ で行える。 特に、$1$ 回目の除算においては、どちらも $min(n, m)$ 以下になるため、$Omicron(log min(n, m))$ とすることもできる。 また、領域計算量は $Omicron(1)$ である。 以上より、それぞれの計算量(時間計算量,領域計算量)は 表 1 のようになる。 #figure( table( columns: 3, [], [*時間計算量*], [*領域計算量*], [`gcd_iter`], [$Omicron(min(n, m))$], [$Omicron(1)$], [`gcd_euclid`], [$Omicron(log min(n, m))$], [$Omicron(1)$], ), caption: [`gcd_iter` と `gcd_euclid` の計算量] ) === 課題2 以下に実装した `gcd_recursive` 関数を示す。 #sourcefile(read("./gcd_recursive.c"), file:"./gcd_recursive.c") `gcd_recursive(16, 12)` の動作について考える。 - `gcd_recursive(16, 12)` が呼び出される - `12 != 0` であるため、`gcd_recursive(12, 16 % 12)` すなわち `gcd_recursive(12, 4)` が呼び出される - `4 != 0` であるため、`gcd_recursive(4, 12 % 4)` すなわち `gcd_recursive(4, 0)` が呼び出される - `0 != 0` ではないため、`n` すなわち `4` が返る - `gcd_recursive(4, 0)` すなわち `4` が返る - `gcd_recursive(12, 4)` すなわち `4` が返る - `4` が返る
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-11AB0.typ
typst
Apache License 2.0
#let data = ( ("CANADIAN SYLLABICS NATTILIK HI", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK HII", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK HO", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK HOO", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK HA", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK HAA", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK SHRI", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK SHRII", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK SHRO", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK SHROO", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK SHRA", "Lo", 0), ("CANADIAN SYLLABICS NATTILIK SHRAA", "Lo", 0), ("CANADIAN SYLLABICS SPE", "Lo", 0), ("CANADIAN SYLLABICS SPI", "Lo", 0), ("CANADIAN SYLLABICS SPO", "Lo", 0), ("CANADIAN SYLLABICS SPA", "Lo", 0), )
https://github.com/quarto-ext/mitex
https://raw.githubusercontent.com/quarto-ext/mitex/main/README.md
markdown
# Use mitex for Typst Math with Quarto > [!WARNING] > > Experimental extension This is a Quarto extension that provides support for using the [Mitex](https://typst.app/universe/package/mitex/) Typst library to render mathematical expressions. ## Installing ``` bash quarto add quarto-ext/mitex ``` This will install the extension under the `_extensions` subdirectory. If you’re using version control, you will want to check in this directory. ## Using To use the extension, add the following to your Quarto document: ``` yaml filters: - mitex ``` ## Example Here is the source code for a minimal example: [example.qmd](example.qmd). - Inline Math will be wrapped in a Typst RawInline using `#mi()` - Display Math will be transformat to Typst RawBlock using `#mitex()` See built [PDF](https://quarto-ext.github.io/mitex) and [source `.typ`](https://quarto-ext.github.io/mitex/example.typ)
https://github.com/Shedward/dnd-charbook
https://raw.githubusercontent.com/Shedward/dnd-charbook/main/dnd/page/inventory.typ
typst
#import "../core/core.typ": * #let inventoryTable( header: (), columns: auto, rowsCount: auto, ) = { layout(size => { let columnsCount = header.len() let rowHeight = paddings(2.5) let gridColumns = if (columns == auto) { (1fr,) * columnsCount } else { columns } let emptyRow = (none,) * columnsCount let actualRowsCount = if (rowsCount == auto) { calc.trunc(size.height / rowHeight) } else { rowsCount } grid( columns: gridColumns, rows: rowHeight, column-gutter: paddings(1), inset: paddings(0.5), align: left, stroke: innerRowStrokes(), ..header.map(tableHeader), grid.hline(end: columnsCount, stroke: strokes.thin), ..(emptyRow * actualRowsCount), ) }) } #let inventoryDoubleColumnGrid(..content) = framed(fitting: expand, insets: 0pt)[ #grid( columns: (1fr, 1fr), inset: paddings(2), stroke: innerColumnStrokes(), ..content ) ] #let magicItemsTable = inventoryTable( header: ([Atn], [Magic Item], [Val]), columns: (paddings(2.5), 1fr, paddings(3)) ) #let itemsTable = inventoryTable( header: ([E], [Item], [C.], [W.]), columns: (paddings(2.5), 1fr, paddings(3), paddings(3)) ) #let moneyInput = framed( fitting: expand-h, insets: (x: paddings(2), y: paddings(1)), { let coins = ("PP", "GP", "SP", "CP") grid( columns: (20mm, 1fr, 20mm, 20mm), rows: (4mm, auto), gutter: paddings(2), inset: (bottom: 0pt, rest: paddings(1)), stroke: innerRowStrokes(), ..((none,) * coins.len()), ..(coins.map(propCap)) ) } ) #let inventory = [ #page( header: section[Inventory] )[ #inventoryDoubleColumnGrid( magicItemsTable, itemsTable ) ] #page[ #grid( rows: (1fr, auto, auto), gutter: paddings(2), inventoryDoubleColumnGrid( itemsTable, itemsTable ), subsection[Money], moneyInput ) ] ]
https://github.com/quarto-ext/typst-templates
https://raw.githubusercontent.com/quarto-ext/typst-templates/main/letter/_extensions/letter/typst-show.typ
typst
Creative Commons Zero v1.0 Universal
#show: letter.with( $if(sender)$ sender: [$sender$], $endif$ $if(recipient)$ recipient: [$recipient$], $endif$ $if(sent)$ date: [$sent$], $endif$ $if(subject)$ subject: [$subject$], $endif$ $if(name)$ name: [$name$], $endif$ )