repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/bullno1/cross_gear_translation | https://raw.githubusercontent.com/bullno1/cross_gear_translation/master/README.md | markdown | The Unlicense | Translation for the card game Cross Gear: https://www.drive-games.com/cross-gear, including the expansion: "Belief in Justice".
# To build the card translation
1. Make sure you have [rvm](https://rvm.io/).
2. Run `bundle install`.
3. Run `bundle exec rake`.
The paste up and character cards will be generated in `_output`.
To watch and build on change: `bundle exec guard -g default`.
# To build the rule book
1. Install [typst](https://typst.app/).
2. `cd rulebook`.
3. `typst compile rulebook.typ`.
`rulebook.pdf` will be generated.
To watch, use the [typst-lsp](https://github.com/nvarner/typst-lsp).
|
https://github.com/eliapasquali/typst-thesis-template | https://raw.githubusercontent.com/eliapasquali/typst-thesis-template/main/chapters/process.typ | typst | Other | #pagebreak(to:"odd")
= Processi e metodologie
<cap:processi-metodologie>
#v(1em)
#text(style: "italic", [
Breve introduzione al capitolo
])
#v(1em)
== Processo sviluppo software
|
https://github.com/Shedward/dnd-charbook | https://raw.githubusercontent.com/Shedward/dnd-charbook/main/dnd/core/tools.typ | typst |
#let arrayOrNone(v) = if v == none {
()
} else if type(v) == array {
v
} else {
(v,)
}
#let valueOrDefault(v, default) = if v == none {
default
} else {
v
}
#let mapOrNone(v, t) = if v == none {
none
} else {
t(v)
}
#let todo(caption) = block(fill: yellow, radius: 4pt, inset: 0.5em)[
#raw("[" + valueOrDefault(caption, "TODO") + "]")
]
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/par-justify_07.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test that justification doesn't break code blocks
#set par(justify: true)
```cpp
int main() {
printf("Hello world\n");
return 0;
}
```
|
https://github.com/lxl66566/my-college-files | https://raw.githubusercontent.com/lxl66566/my-college-files/main/信息科学与工程学院/互联网原理与技术/作业/理论3.typ | typst | The Unlicense | #import "template.typ": *
#show: project.with(
title: "理论 3",
authors: (
"absolutex",
)
)
= P1
假设客户A向服务器S发起一个Telnet 会话。与此同时,客户B也向服务器S发起一个Telnet 会话。给出下面报文段的源端口号和目的端口号:
a.从A向S发送的报文段。
#answer([源端口号:随机未被占用;目的端口号:23。])
b.从B向S发送的报文段。
#answer([源端口号:随机未被占用;目的端口号:23。])
c.从S向A发送的报文段。
#answer([源端口号:23;目的端口号:随机未被占用。])
d.从S向B发送的报文段。
#answer([源端口号:23;目的端口号:随机未被占用。])
e.如果A和B是不同的主机,那么从A向S发送的报文段的源端口号是否可能与从B向S发送的报文段的源端口号相同?
#answer([有可能它们的源端口号会相同,因为源端口号是随机选取的。])
f.如果它们是同一台主机,情况会怎么样?
#answer([将相同的源端口号分配给两个报文段])
= P23
主机A和B经一条TCP连接通信,并且主机B已经收到了来自A的最长为126字节的所有字节。假定主机A随后向主机B发送两个紧接着的报文段。第一个和第二个报文段分别包含了80字节和40字节的数据。在第一个报文段中,序号是127,源端口号是302,目的地端口号是80。无论何时主机B接收到来自主机A的报文段,它都会发送确认。
a.在从主机A发往B的第二个报文段中,序号、源端口号和目的端口号各是什么?
#answer([序号:207,源端口号:302,目的地端口号:80。])
b.如果第一个报文段在第二个报文段之前到达,在第一个到达报文段的确认中,确认号、源端口号和目的端口号各是什么?
#answer([确认号:207,源端口号:80,目的地端口号:302。])
c.如果第二个报文段在第一个报文段之前到达,在第一个到达报文段的确认中,确认号是什么?
#answer([128])
d.假定由A发送的两个报文段按序到达B。第一个确认丢失了而第二个确认在第一个超时间隔之后到达。画出时序图,显示这些报文段和发送的所有其他报文段和确认。(假设没有其他分组丢失。)对于图上每个报文段,标出序号和数据的字节数量;对于你增加的每个应答,标出确认号。
#answer([
A->B : Seq=127, Len=126, SrcPort=302, DstPort=80
B->A : Ack=253, SrcPort=80, DstPort=302
A->B : Seq=207, Len=80, SrcPort=302, DstPort=80
(丢失)
A->B : Seq=287, Len=40, SrcPort=302, DstPort=80
B->A : Ack=327, SrcPort=80, DstPort=302
])
= P31
假设测量的5个SampleRTT值(参见3.5.3节)是106ms、120ms、140ms、90ms和115ms。在获得了每个SampleRTT 值后计算 EstimatedRTT,使用$alpha$=0.125并且假设在刚获得前5个样本之后 EstismatedRTT的值为100ms。在获得每个样本之后,也计算DevRTT,假设β=0.25,并且假设在刚获得前5个样本之后DevRTT的值为5ms。最后,在获得这些样本之后计算TCP Timeoutnterval。
#answer([
$"EstimatedRTT" = (1 - alpha) \* "EstimatedRTT" + alpha \* "SampleRTT"$
$"DevRTT" = (1 - beta) \* "DevRTT" + beta \* |"SampleRTT" - "EstimatedRTT"|$
EstimatedRTT_1 = 101.25ms
EstimatedRTT_2 = 103.56ms
EstimatedRTT_3 = 107.07ms
EstimatedRTT_4 = 100.95ms
EstimatedRTT_5 = 103.73ms
DevRTT_1 = 3.68ms
DevRTT_2 = 9.77ms
DevRTT_3 = 18.11ms
DevRTT_4 = 14.93ms
DevRTT_5 = 17.33ms
TimeoutInterval = 103.73ms + 4 \* 17.33ms = 174.02ms
])
= P40
考虑图3-61。假设TCP Reno是一个经历如上所示行为的协议,回答下列问题。在各种情况中,简要地论证你的回答。
a.指出TCP慢启动运行时的时间间隔。
#answer([$6-1=5"ms"$])
b.指出TCP拥塞避免运行时的时间间隔。
#answer([$16-6=10"ms"$])
c.在第16个传输轮回之后,报文段的丢失是根据3个冗余ACK还是根据超时检测出来的?
#answer([冗余 ACK])
d.在第22个传输轮回之后,报文段的丢失是根据3个冗余ACK还是根据超时检测出来的?
#answer([超时])
e.在第1个传输轮回里,ssthresh的初始值设置为多少?
#answer([$42/2=21"ms"$])
f.在第18个传输轮回里,ssthresh的值设置为多少?
#answer([$29/2=14.5"ms"$])
g.在第24个传输轮回里,ssthresh的值设置为多少?
#answer([$21"ms"$])
h.在哪个传输轮回内发送第70个报文段?
#answer([27传输轮回])
i.假定在第26个传输轮回后,通过收到3个冗余ACK检测出有分组丢失,拥塞的窗口长度和ssthresh的值应当是多少?
#answer([cwnd: $8/2+3=7$;ssthresh: $8/2=4$])
j.假定使用TCP Tahoe(而不是TCP Reno),并假定在第16个传输轮回收到3个冗余ACK。在第19个传输轮回,ssthresh和拥塞窗口长度是什么?
#answer([cwnd: $4$;ssthresh: $8/2=4$])
k.再次假设使用TCP Tahoc,在第22个传输轮回有一个超时事件。从第17个传输轮回到第22个传输轮回(包括这两个传输轮回),一共发送了多少分组?
#answer([6个]) |
https://github.com/leyan/cetzpenguins | https://raw.githubusercontent.com/leyan/cetzpenguins/main/README.md | markdown | MIT License |
Cetzpenguins is a rewriting (very partial at the moment) of the [TikZpingus](https://github.com/EagleoutIce/tikzpingus) LaTeX package in [Typst](https://github.com/typst/typst) using [CeTZ](https://github.com/cetz-package/cetz), aiming to provide cute penguins to all the Typst documents that need them.
To draw the default penguin:
```Typst
#penguin()
```
<img src="gallery/basicPenguin.png"/>
The penguin can be customized, for the moment limited to colors and eye shape:
```Typst
#penguin(
width:2cm,
body-color:blue,
head-color:aqua,
left-eye:(color:red,
shape:"shiny"),
right-eye:(
color:green,
shape:"wink")
)
```
<img src="gallery/customizedPenguin.png"/> |
https://github.com/MohamedElashri/resume | https://raw.githubusercontent.com/MohamedElashri/resume/main/resume.typ | typst | #import "@preview/guided-resume-starter-cgc:2.0.0": *
#show: resume.with(
author: "<NAME>",
location: "Cincinnati, OH",
contacts: (
[#link("mailto:<EMAIL>")[Email]],
[#link("https://melashri.net")[Website]],
[#link("https://github.com/MohamedElashri")[GitHub]],
[#link("https://linkedin.com/in/elashri")[LinkedIn]],
),
// footer: [#align(center)[#emph[References available on request]]]
)
= Skills
#skills((
("Programming Languages", (
[C/C++],
[Python],
[Rust],
[Go],
[Wolfram Language]
)),
("Machine Learning", (
[PyTorch],
[Keras],
[JaX],
)),
("Developement Tools/Tech", (
[Git],
[Docker],
[Linux],
)),
("Soft", (
[Leadership],
[Teamwork],
[Student Mentoring]
)),
("Languages", (
[English (Fluent)],
[Arabic (Native)],
)),
))
= Experience
#exp(
role: "University of Cincinnati",
project: "PhD Research",
date: "2021 - Current",
location: "Cincinnati, OH ",
summary: "Doing research in flavor physics and working on Neural network based tracking",
details: [
- Doing an analysis on the Rare B meson decay where I do data analysis on the big dataset from *LHCb*.
- Working on state of art Neural Network based algorithm for calculating particles primary vertices.
- Working on a specialized GPU based framework for software data acquisition.
]
)
#exp(
role: "University of Minnesota, Duluth",
project: "Masters Research",
date: "2018 - 2020",
location: "Duluth, MN",
summary: "Done search for magnetic monopole analysis and maintaining Collboration Software",
details: [
- Doing a search analysis for magnetic monopoles at *NOvA* collaboration.
- Developing and maintaining several internal software packages used by other members.
]
)
#exp(
role: "Teaching Assistant",
project: "University of Cincinnati",
date: "2020 – 2022",
summary: "Teaching and tutoring physics for undergraduate students",
details: [
- Teaching introductory physics labs and promote students linking between theoretical development and nature facts.
- Helping conduct problem solving sessions and Physics tutoring center
]
)
#exp(
role: "Teaching Assistant",
project: "University of Minnesota, Duluth",
date: "2018 – 2020",
summary: "Teaching and tutoring physics for undergraduate students",
details: [
- Grading assignments and tests using answer key, documented results and informed lead teacher of students’
performance.
- Supported student learning objectives through personalized and small group assistance
- Created and improved tutorials resources and training materials
]
)
= Projects
#exp(
role: link("https://github.com/MohamedElashri/hadd-parallel")[Hadd-parallel],
project: "hadd command in parallel",
date: "May 2019",
summary: " A python module to do hadd in parallel for ROOT. Using multiprocessing library.",
details: [
- Designed a python module that utilize multiprocessing module to run ROOT CERN hadd in parallel
- Published and maintained internal version of that inside *NOvA* collaboration
]
)
#exp(
role: link("https://github.com/MohamedElashri/free-mac")["Free-Mac"],
project: "Free Command for macOS",
date: "April 2024 ",
summary: "A command-line utility for monitoring memory usage on macOS, port of 'free' linux.",
details: [
- Developed a tool that provides an overview of system memory usage, including total, used, free, cached, app, and wired memory
- Ensured feature parity with the Linux 'free' command to provide a familiar experience for macOS users
]
)
#exp(
role: link("https://github.com/MohamedElashri/txm-go")["Txm-Go"],
project: "A tmux Helper Tool",
date: "June 2024",
summary: "A command-line utility designed to make working with tmux more efficient and user-friendly.",
details: [
- Developed a Go-based tool that provides a set of commands to manage tmux sessions, windows, panes, and perform various actions
- Implemented features such as creating, listing, attaching to, detaching from, renaming, and killing tmux sessions, as well as managing windows and panes
]
)
#exp(
role: link("https://github.com/MohamedElashri/BBH_sim")["Binary Black Hole Simulation"],
project: "Python package for simulating binary black hole dynamics",
date: "June 2024",
summary: "Developed a user-friendly and efficient framework for simulating binary black hole systems.",
details: [
- Implemented a set of tools and functions to set up and run simulations, visualize the results, and generate gravitational waveforms
- Incorporated various physical effects, including post-Newtonian corrections, radiation reaction, and spin effects
]
)
#exp(
role: link("https://github.com/MohamedElashri/firewall")["Firewall"],
project: "A command-line interface for managing the ufw firewall",
date: "May 2024",
summary: "Developed a user-friendly CLI tool to streamline the management of firewall rules using ufw.",
details: [
- Implemented a set of intuitive commands for enabling, disabling, and restarting the firewall, displaying status and rules, and managing traffic based on ports, IPs, and application profiles
- Provided features for firewall logging, resetting to default settings, and backing up and restoring configurations
]
)
#exp(
role: link("https://github.com/MohamedElashri/IsingModel")["2D Ising Model MC Simulation"],
project: " 2D Ising Model Monte-Carlo Simulation",
date: "March 2022 ",
summary: "Developed a high-performance simulation of the 2D Ising model.",
details: [
- Implemented the Metropolis algorithm for efficient Monte Carlo sampling, utilizing Numba JIT compilation for accelerated performance
- Optimized the code to minimize nested loops and leverage vectorized operations, significantly reducing execution time for larger lattice sizes and more Monte Carlo sweeps
]
)
#exp(
role: link("https://github.com/MohamedElashri/gh-cp")["GitHub CLI Extension: gh-cp"],
project: "An extension for copying files from a GitHub repository",
date: "June 2024 ",
summary: "Developed an extension for the GitHub CLI allowing copying files from a repository.",
details: [
- Implemented support for copying single or multiple files from a GitHub repository, with options to specify a branch or commit to copy from
- Added functionality to read file paths from a file for bulk copying, enhancing efficiency when dealing with numerous files
]
)
#exp(
role: link("https://github.com/MohamedElashri/gh-emergency")["GitHub CLI Extension :gh-emergency"],
project: "A GitHub CLI extension for quickly save work in case of an emergency",
date: "June 2024",
summary: "Developed a GitHub CLI extension that simplifies the process of creating a new branch, staging changes, creating a commit, and pushing to all remotes in emergency situations.",
details: [
- Implemented a streamlined workflow for quickly adding, committing, and pushing changes to a remote repository with a single command
- Automated the creation of a new branch with a timestamped name to ensure unique identification of emergency commits
]
)
= Volunteering
#exp(
role: "Student Advisor",
project: "International Graduate Student Mentorship",
date: "May 2019 - June 2020",
summary: "Assisted incoming international students with their transition to UMD",
details: [
- Mentored new international graduate students, helping them navigate academic and cultural challenges
- Collaborated with university departments to ensure a smooth transition for international students
]
)
#exp(
role: "Journal Club President",
project: "Physics Club",
date: "2013 - 2018",
summary: "Established and led the Physics Club at Zewail University",
details: [
- Founded the Physics Club to promote interest and understanding of physics among students
- Organized engaging events, such as guest lectures, workshops, and hands-on experiments
- Collaborated with faculty members to develop educational resources and support student research
]
) |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/circuiteria/0.1.0/src/elements/ports.typ | typst | Apache License 2.0 | #import "@preview/cetz:0.2.2": draw
#import "../util.typ": rotate-anchor
#let add-port(
elmt-id, side, port, pos,
prev: none,
next: none,
debug: false
) = {
let name = port.at("name", default: "")
let name-rotate = port.at("vertical", default: false)
if (port.at("clock", default: false)) {
if prev == none or next == none {
panic("Clock port must have previous and next positions")
}
let size = if port.at("small", default: false) {8pt} else {1em}
let offset
if (side == "north") { offset = ( 0, -size) }
else if (side == "east") { offset = (-size, 0) }
else if (side == "south") { offset = ( 0, size) }
else if (side == "west") { offset = ( size, 0) }
let pos1 = (rel: offset, to: pos)
// TODO: use context or vectors to have the height relative to the width
draw.line(prev, pos1, next)
}
draw.content(
pos,
anchor: if name-rotate {rotate-anchor(side)} else {side},
padding: 2pt,
angle: if name-rotate {90deg} else {0deg},
name
)
let id = elmt-id + "-port-" + port.at("id")
if debug {
draw.circle(
pos,
name: id,
radius: .1,
stroke: none,
fill: red
)
} else {
draw.hide(draw.circle(
pos,
radius: 0,
stroke: none,
name: id
))
}
}
#let add-ports(
elmt-id,
tl, tr, br, bl,
ports,
ports-margins,
debug: false
) = {
let sides = (
"north": (tl, tr),
"east": (tr, br),
"south": (bl, br),
"west": (tl, bl)
)
if type(ports) != dictionary {
return
}
for (side, props) in sides {
let side-ports = ports.at(side, default: ())
let space = 100% / (side-ports.len() + 1)
for (i, port) in side-ports.enumerate() {
let pct = (i + 1) * space
let pt0 = props.at(0)
let pt1 = props.at(1)
if side in ports-margins {
let (a, b) = (pt0, pt1)
let margins = ports-margins.at(side)
a = (pt0, margins.at(0), pt1)
b = (pt0, 100% - margins.at(1), pt1)
pt0 = a
pt1 = b
}
let pos = (pt0, pct, pt1)
let pct-prev = (i + 0.5) * space
let pct-next = (i + 1.5) * space
let pos-prev = (pt0, pct-prev, pt1)
let pos-next = (pt0, pct-next, pt1)
if port.at("small", default: false) {
pos-prev = (pos, 4pt, pt0)
pos-next = (pos, 4pt, pt1)
}
add-port(
elmt-id,
side,
port,
pos,
prev: pos-prev,
next: pos-next,
debug: debug
)
}
}
} |
https://github.com/wjakethompson/wjt-quarto-ext | https://raw.githubusercontent.com/wjakethompson/wjt-quarto-ext/main/wjt-letter/_extensions/wjt-letter/typst-show.typ | typst | Creative Commons Zero v1.0 Universal | #show: doc => letter(
$if(sender)$
sender: [$sender$],
$endif$
$if(logo)$
logo: "$logo$",
$endif$
$if(recipient)$
recipient: [$recipient$],
$endif$
$if(sent)$
date: [$sent$],
$endif$
$if(subject)$
subject: [$subject$],
$endif$
$if(shorttitle)$
shorttitle: [$shorttitle$],
$endif$
$if(reporttype)$
reporttype: [$reporttype$],
$endif$
$if(name)$
name: [$name$],
$endif$
doc,
)
|
https://github.com/a-mhamdi/graduation-report | https://raw.githubusercontent.com/a-mhamdi/graduation-report/main/Typst/en-Report/chaps/intro.typ | typst | MIT License | /* --------------------------------- DO NOT EDIT -------------------------------- */
#import "../Class.typ": *
#show: report.with(isAbstract: false)
#set page(header: none)
#figure(chap("General Introduction"), supplement: [Chapter], numbering: none) // GI
#set page(header: smallcaps(title) + h(1fr) + emph("General Introduction") + line(length: 100%))
#set heading(level: 2, outlined: false)
/* ------------------------------------------------------------------------------ */
*Context & Motivations*
#lorem(64)
*Detailed Description*
#lorem(64)
/ @chp:chap1: #lorem(16)
/ @chp:chap2: #lorem(16)
/ @chp:chap3: #lorem(16)
|
https://github.com/mitex-rs/mitex | https://raw.githubusercontent.com/mitex-rs/mitex/main/crates/mitex/benches/bencher.typ | typst | Apache License 2.0 |
#import "/packages/mitex/lib.typ": *
#let integrate-conversion(it, data: (), convert-only: false) = {
let passed = 0
for d in data {
passed += 1
if convert-only {
let _ = mitex-convert(d.text)
} else /* render-math */ {
if d.type == "inline" {
mi(d.text)
linebreak()
} else {
mitex(d.text)
}
}
}
it
[#passed / #data.len() passed]
}
|
https://github.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024 | https://raw.githubusercontent.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024/neko/实验/table.typ | typst | #figure(
align(center)[#table(
columns: 11,
align: (auto,auto,auto,auto,auto,auto,auto,auto,auto,auto,auto,),
table.header([U\*n2], table.cell(colspan: 4)[8V], table.cell(colspan: 4)[4V], [], [],),
table.hline(),
[Te
(N.m)], [TG1], [TG2], [TG3], [TGm], [0], [TG1], [TG2], [TG3], [TGm], [],
[0], [0.8], [1.0], [1.2], [1.48], [0], [0.4], [0.6], [0.8], [1.1], [],
[T\*e], table.cell(colspan: 8)[], [], [],
[n (r/min)], [n0 (S0)], [n1 (S1)], [n2 (S2)], [n3 (S3)], [nm
(Sm)], [n0\' (S0\')], [n1\' (S1\')], [n2\' (S2\')], [n3\'
(S3\')], [nm\' (Sm\')],
[S], [-1600], [-1500], [-1460], [-1400], [-1190], [750], [710], [680], [640], [600],
)]
, kind: table
)
|
|
https://github.com/ChristophVanDeest/FH-Kiel-Typst-Template | https://raw.githubusercontent.com/ChristophVanDeest/FH-Kiel-Typst-Template/main/examples/bachelor-thesis/chapters/01_preamble.typ | typst | MIT License | #import("../dependencies.typ"): *
// You can add a heading without enumeration like this:
#heading(numbering: none)[Preamble]
Example abbreviation: @cpu.
Whereas recognition of the inherent dignity and of the equal and inalienable
rights of all members of the human family is the foundation of #gls("freedom"), justice
and peace in the world,
Whereas disregard and contempt for human rights have resulted in barbarous
acts which have outraged the conscience of mankind, and the advent of a world
in which human beings shall enjoy freedom of speech and belief and freedom
from fear and want has been proclaimed as the highest aspiration of the common
people,
Whereas it is essential, if man is not to be compelled to have recourse, as a last
resort, to rebellion against tyranny and oppression, that human rights should be
protected by the rule of law,
Whereas it is essential to promote the development of friendly relations between
nations,
Whereas the peoples of the United Nations have in the Charter reaffirmed their
faith in fundamental human rights, in the dignity and worth of the human person
and in the equal rights of men and women and have determined to promote
social progress and better standards of life in larger freedom,
Whereas Member States have pledged themselves to achieve, in cooperation
with the United Nations, the promotion of universal respect for and observance of
human rights and fundamental freedoms,
Whereas a common understanding of these rights and freedoms is of the
greatest importance for the full realization of this pledge,
Now, therefore,
The General Assembly,
Proclaims this Universal Declaration of Human Rights as a common standard of
achievement for all peoples and all nations, to the end that every individual and
every organ of society, keeping this Declaration constantly in mind, shall strive by
teaching and education to promote respect for these rights and freedoms and by
progressive measures, national and international, to secure their universal and
effective recognition and observance, both among the peoples of Member States
themselves and among the peoples of territories under their jurisdiction.
@UN |
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/051%20-%20March%20of%20the%20Machine/007_Episode%205%3A%20Cathartic%20Reunion.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Episode 5: Cathartic Reunion",
set_name: "March of the Machine",
story_date: datetime(day: 21, month: 04, year: 2023),
author: "<NAME>",
doc
)
Kaya, Kaito, and Tyvar warned her of Phyrexia's endless, undulating torture chambers. To hear them tell it, New Phyrexia is less a place in and of itself and more like being trapped within the organs of a gargantuan creature. Tubes running every which way form its veins and arteries; the chrome steps leading to the Invasion Tree are its ribs; the tree itself is a foul spine. The picture she'd gotten in her mind's eye was as clear as it was horrifying.
But when she arrives, she sees something different. There's no mistaking that they're in the belly of the beast—only it's not the same beast those three saw. This place is full of blinding light illuminating the ossuary structures around them. The Invasion Tree is still the creature's spine, but it is complemented by sharp white outcroppings. Platforms, Chandra thinks, each swarming with Phyrexians going about their fell duties. Like ants along leaves, especially when seen from a platform so far below.
Chandra can't comprehend how tall the Invasion Tree is. The original on Kaldheim is supposed to be huge, but this is bigger than the God-Eternals had been, bigger than anything she'd ever seen. Even tilting her head to the point of pain, she cannot see its crown. She expected Wrenn to say something about it, but maybe her companion's silence on the subject is worse.
"Come now, we mustn't take root," is the only thing Wrenn says before she starts moving. The flames within her spit crackle against their containment. Fire is always eager to show how it feels.
#figure(image("007_Episode 5: Cathartic Reunion/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
She's off toward a broken, needle-shaped structure not far from the platform where they've landed. Wrenn's noticed the same thing Chandra has: there are people at the base of that needle, people clambering down from its height. Golden armor makes them stand out against all the red and the white around them—and the skin beneath that armor even more so. Metal horns and spikes tell her they aren't quite human, but they aren't Phyrexian either. Each moves in their own time, and blood smears the clothes of some.
Chandra's feet carry her toward the others, each footfall heavy with anticipation. Coming here had been the right thing to do, she's sure of it, and here is the evidence: survivors in need of assistance. Teferi always said difficult times made quick allies.
"Taking that scrambler down paid off. I didn't expect help so soon," calls one of the survivors near the base of the needle. To her surprise he doesn't seem all that happy to see her. Steel juts from his skin like the scales on a serpent's brow, a stark contrast to Phyrexian aesthetics. He must have some kind of kinship with the stuff; some of the other survivors float to the bridge, clinging to rocks he seems to control. Wrenn is quick to help with Seven's tall reach.
"Came as soon as we could," she says. "My name's Chandra. This is Wrenn."
"Planning to stick around?"
"What? Of course we are. We wouldn't have come otherwise," Chandra says.
"That might mean you die here." He crosses his arms, studies her. One of the women in the group sighs. Unlike any of the others gathered, there's not a trace of metal on her anywhere. Against the hard lines of New Phyrexia's landscape, her features are soft.
"I'll take that chance. There's too much on the line to sit back and do nothing," says Chandra.
A beat passes between them—him narrowing his eyes, her staring him down. After what seems too long given the circumstances, he nods. "Koth," the man says, introducing himself. "That's Melira. Is it just you two?"
"For now," Chandra says. "I mean, maybe. I don't think—"
Koth palms the back of his head. He seems to be considering. "Two people." As his gaze falls to the ground, Chandra follows it. There are other bodies among the Phyrexian centurions—human ones. Her heart sinks.
She can't let it stay in the depths. When it comes to war, morale is as important as tactics and supplies. "Two #emph[Planeswalkers] . And we're all you're going to need. Wrenn's got a plan."
"Is that so?" Koth asks. "A plan. Wonderful."
"Don't be so dour," Melira cuts in. "We can't abandon hope now. It might be something we haven't tried."
"She's right, you know," Wrenn says. "You can't have tried this. There aren't any other dryads symbiotically bonded to trees."
Chandra's not sure if it's a joke—sometimes, with Wrenn, it's hard to tell. She surprises herself by laughing anyway. The woman smirks a little, too, and that feels like its own kind of victory.
Koth remains skeptical. "Let's hear this idea you've got," he says.
"It's simple. We'll head for the tree. Once we're there, I'll attach myself to him, and try to guide him," Wrenn answers.
"She's good at that. Really good!" Chandra adds when Koth narrows his eyes. "We might have a friend who can help, too. Maybe you've heard of Teferi?"
"No."
"Well," Chandra runs a hand through her hair, "he's the strongest time mage who's ever lived, so there's that, and he's a good friend of mine, so he'll help if we ask."
"And where is this Teferi?" asks Koth.
Chandra glances at Wrenn, who gives her an inexplicable and mysterious nod. "He's coming. Anyway, once we're at the tree, the rest'll come together. We're going to use it against them."
Koth crosses his arms. "And you're certain you can do this, Wrenn?"
"As certain as anyone can be."
He makes a small, considering sound. "Right. We don't have many other options. When we lost Karn, they took him over that way, too. Norn wanted to give him special treatment. We may as well try to gain control of the tree and rescue him at the same time."
"We'll have to move fast," says Melira. "Norn probably doesn't think a handful of rebels are a threat. We can use that hubris to our advantage, and strike before she realizes how threatening we can be."
"Base of the tree is heavily guarded. More centurions than she knows what to do with. We try it that way, everyone's dead before we start," Koth catches their eyes again. "You two fine with a rough trip?"
"Whatever it takes, I'm in," Chandra says. Wrenn nods as well.
"Good. Because you're not the only one with a powerful friend," he starts.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
"When you said friend~"
"He's a friend. For now. Maybe more like he isn't an enemy. It's complicated."
"You're sure?"
"I'm sure."
Chandra isn't. Staring at her own reflection in Urabrask's polished carapace, she's not sure what to think. He hasn't attacked yet, but maybe he's waiting for the right time. He hasn't insulted her or gone on about unity, but maybe this is all a cover.
She crosses her arms.
Urabrask lets out a breath. "Such keening mouths," he says. "Infighting will be the death of your kind."
Chandra frowns. He's right, and she kind of hates that he is. Wrenn offers a consolatory hand on her shoulder as Urabrask turns toward the edge of their platform.
"The main pathways to the Invasion Tree are guarded by more Phyrexians than your mind can hold in one place," he explains. He doesn't need to point them out with his claws, but he does. "If one of them sees us, Norn will know instantly. Koth learned this earlier. As a show of good will, I told him of the passage you took to get to this platform."
The path they'd taken was well hidden. At the time Chandra thought Koth sensed it beneath the ground with his powers. They hadn't seen a single patrol on their way through the twisting passage. A good thing, too, with how narrow some of it got.
"Organic eyes can behold the Realmbreaker without obstruction from here. More importantly, the trajectory is clear, and lies within the boundaries of your cognition. Your chance of success is still almost non-existent."
"I came here to help," Chandra snaps. "I don't care what some Phyrexian weirdo thinks of me, I'm going to do what I can here. Why are you even helping us, anyway?"
Fire roars from the eyeholes of Urabrask's carapace. "Because Norn stifles the fires of creation with her pontificating. Phyrexia cannot thrive if there is only one Phyrexia." Magma drips from his jaws, plumes of smoke rising from the holes they burn. "Even a newt understands. Urabrask serves no one." Melira steps between the two of them. "Let's keep our eyes on the prize. The plan's to have Koth fling you two over the divide."
"Why just us?" Chandra asks. Truth be told, she's grateful for the break.
"The rest of the Mirrans will provide a tantalizing distraction for the so-called Mother of Machines. They'll find a patrol somewhere and pick a fight. She'll focus on eliminating them, leaving our path in the air free."
That~ is maybe the simplest plan Chandra's ever heard to deal with the most precarious situation she's ever encountered. Flinging them across the divide? She takes a step to the edge of the platform. The chasm that yawns before her could probably fit all the tallest buildings in Ghirapur stacked together. The platform overlooking the tree is so far she can cover it with her thumb.
"Oh. I'm not fond of aerial travel," Wrenn says.
"It won't last long," Koth says. "I can launch us from here. Urabrask says that platform's mostly used for maintenance. Norn has the elf busy doing something else right now, so it should be clear."
The elf. Despite all the fire in her heart, Chandra's blood runs cold at the thought. They're being so casual about it. She wants to snap at them again, to say that Nissa's important in ways they can't understand, but if she does they might think less of her. She came here to help the Multiverse, after all. Rescuing Nissa's a small thing in comparison.
But if that's her platform, and if she's there~
"Let's do it," Chandra says.
"Glad you're on board," says Koth.
"The moment your dryad makes contact with the tree, Norn will know. We'll need to act quickly. Quick as your flesh can go without sloughing off." Urabrask has already turned toward the edge of the platform. Curiously, he leans down and begins carving sigils into the metal below them.
This tiny clutch of people is all that stands between Phyrexia and the Multiverse. The weight on her shoulders threatens to crush her. Chandra paces, as if to offset it by moving. Wrenn and Seven remain standing where Koth told them to be, looking ahead at the amassed forces. The air here isn't good for Seven—the tips of her branches have gone black. Just what is it doing to the rest of them? How long can they be here before they start changing, too? That last bit of Halo won't last forever.
"Are you ready?" Koth asks.
Chandra stops, one leg on either side of an inscribed rune. Over and over, she opens and closes her hands. "Yeah."
"Certainly," says Wrenn.
Koth nods. "Mirrans, are we ready?"
Chandra can't call the answering shouts hearty, or even confident. No, she's heard that kind of tone before, and it's closer to desperation than it is to hope. Her chest hurts. She counts them, the Mirrans, wondering how many will be gone by the next time she sees them.
Koth drives his fist into the earth.
The runes beneath their feet flash to life. An instant later they're shot straight into the air with only the stone beneath them as an anchor. Air whips across their faces; Chandra shields her eyes to keep them from tearing up.
#figure(image("007_Episode 5: Cathartic Reunion/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Behind her, she can hear Koth's shout: "Keep yourself in the air if you have to!"
Would it be better if she was down there, with him?
It's no use wondering.
Especially when they've got company in the air.
Chandra's not sure what she'd call the beasts that swoop in on the attack—they're a little like birds, a little like bats, and an awful lot of their bodies are made of bladed metal. What matters is that they're in the way, and if they're in the way, they're going to get blasted. Fire melts them as surely as it does everything else, though already she's starting to feel herself flag in between blows. On the other platform, Wrenn and Seven have grabbed one and used it to beat the others into retreat.
They aren't in the air long, but the bladed bats swarm them the whole time. Chandra's so busy fighting them off that she can't keep track of where they are in relation to the tree. Impact rockets her onto one of the Invasion Tree's lower branches. Her bones groan as she's thrown onto the jagged white surface. She's pretty sure one of her ribs cracked, because it hurts to breathe, but she needs to breathe if she's going to get anywhere.
One of the blade-bats swoops down on her, its wings forming a drill. Her teeth rattle from the sound. Chandra fumbles, rolls out of the way, pushes herself up on an outcropping. The blade-bat's shifted weapons: now, when it dives at her, it means to pin her to the wall. A hasty blast of fire sees it melted into a ball of metal at her feet.
Chandra takes a painful breath. "Almost there."
"Yes, I suppose that's so," answers Wrenn. "~ How odd. It's so quiet."
Chandra doesn't know if she's heard Wrenn sound afraid before now.
But she understands why. This tree is huge—bigger than anything Wrenn's ever tried to bond with, and nastier besides.
There's a very real chance this is going to be the last tree she ever joins. And as much as part of her wants to talk Wrenn out of it, she can't. The whole thing reeks of #emph[practicality ] and #emph[sacrifice] , but ultimately it isn't her choice. It's Wrenn's. And as far as they know, it's their best shot.
Plates along the tree shift and reform. Chandra tries to blast them, but she isn't fast enough; they form into centurions before she can get rid of all their parts. There's got to be a couple dozen of them—most armed with swords, but some with their arms changed into lances. One's taken the shape of a strange metallic hound.
She backs up against Seven.
"We're going to have to act fast," Chandra says. "Can you get started? I'll cover you."
"Y-yes, I can."
Something shifts behind her. Chandra readies another blast of fire. Flames engulf the branch, consuming two of the gathered centurions, but they don't move. The whole time they're burning, none of them move.
"Wrenn, I've got a bad feeling—" She starts.
But the mouths of the centurions birth their answer, slick skinned with black oil and corruption. "We do not want to hurt you. We only want to welcome you home."
Hearing a lone woman's voice emerging from so many throats, doubled and doubled again, sets Chandra's teeth on edge. "I don't care. Come on, Wrenn—"
Two spears fly at her just as she glances behind. Chandra hardly has time to scream before they've pinned her to the white-plated tree. Somehow her clothes are the only thing damaged—the spears landed just below her armpits. She's a sitting target up here, but if Wrenn can free her, they may still have a chance.
But as she starts to shout, she sees what's been keeping Wrenn occupied.
A figure faces down Wrenn. Green magic crackles around her metallic body, her four arms all acting as conduits. One—a blade—slices off Seven's thickest branch as if snapping a twig. Magic weaves around Wrenn and Seven's remaining limbs, binding them together, then lifting them in the air.
"We can perfect you the way we've perfected her," the voices speak. "All of your flaws, your weaknesses, gone. You will never be lonely again once you've become one with us."
The words aren't reaching her. Not now.
Because she recognizes that face. She'd recognize it anywhere—the way its cheeks round when it laughs, the ears prone to twitching, the small nose, the mouth so often quirked into a secret smile. If all the memories in Chandra's head poured out of her like molten metal into a blacksmith's pitcher, this one would remain stubbornly lodged inside.
Nissa.
It can't be—but it has to be. Even with two new arms grafted onto her body, even with black tears streaking her cheeks, even when so much of her is now copper root and bramble—Chandra recognizes her. Even the way she tilts her head toward Chandra is the same. Words unsaid weigh down Chandra's tongue; the agony of recognition tears at her heart. To recognize her~ to recognize Nissa like this hurts worse than dying, she's almost sure—what could hurt more than this?
But then Nissa speaks, and Chandra has her answer. Nissa's voice is the one thing they haven't changed. "You're afraid, aren't you? My new form must be hard for you to understand."
"Nissa," Chandra creaks. It's all she can get out. There are too many other words backed up in her head right now, all struggling to get out: #emph[This isn't you. You don't have to work for her. We can find some way to fix this. Please stop. I'm sorry we ever stopped talking.]
But all that comes out—time and time again—is Nissa's name.
Nissa doesn't react. There is no small smirk, no glint in her eye, no expression at all as she turns back toward Wrenn and Seven.
Two more spears pin Chandra in place. One lands in her calf. She screams, pressure building behind her eyes. Fire licks at her fingers. The breaths she tries to take don't do anything to soothe it.
"You don't have anything to be afraid of," Nissa says. Her tone is awful and flat. As Chandra watches, she tears Seven limb from limb—the sharp quills and blade of her new body working in tandem with her magic. Wrenn's screaming, too, fire flaring behind her eyes, but Nissa still does not react. When only Wrenn's small, dryad form remains, Nissa lets her fall to the floor. "I no longer feel any pain."
"This~ This isn't about~ !" Chandra stammers. It's getting hard to think, there's so much energy building up inside her, and none of it has anywhere to go.
Nissa turns toward her. "Is it about your plan? That's already failed. The Mother of Machines sent me to stop you."
"Why?" it comes out a scream, an accusation.
"Because what you're doing is short-sighted. You've always been short-sighted." A flick of her hand and the centurions stand down. Another, and they remove the spears—even the one that's pierced Chandra's calf. Freedom isn't much help. With the pain shooting through her leg, Chandra isn't running anywhere soon.
If she wanted to, she could fight back. Cauterizing wounds isn't difficult for a fire mage. She could take all this energy building up inside and let it loose. There's no way anyone could walk away from a blow like that. At this rate there might be enough building up to do some serious damage to the tree, too. No matter the "improvements" Norn's made, no metal can withstand the heart of a sun, right?
"You wanted to be the hero, didn't you? You wanted to save me and the Multiverse in one fell swoop. Unfortunately, you've gotten things backward. I'm here to save you. As always."
It would be the easiest thing in the world to let loose.
But if she does~
Chandra's tongue sticks to the roof of her mouth.
Nissa takes a step toward her. The smile breaking out across her face is wide and toothy and not at all like her. "Out of all your companions, only you and the dryad chose to face us. Your kind lack unity and understanding."
"More are coming," Chandra says. She screws her eyes shut. If she doesn't look, it's easier to keep everything in. Easier, too, to bathe this whole branch in flame. If she wanted to. If she doesn't look into Nissa's corrupted eyes, she won't have to remember what her face looks like while it's—no. No, she can't. It isn't just about her, or Nissa, or any one person. There are Mirrans dying underfoot to give them the chance to be here. Hundreds of planes are relying on them to take this tree down. However hot her fire burns, Chandra knows she can't take out the tree in one go.
She opens her eyes. There is Nissa, gesturing with her blade-arm, movements sharp and precise and not at all her own. "Look around you. Don't fear, I'll wait."
Chandra can't help herself—she looks. She wishes she hadn't.
There is an army on the other side of the bridge. A teeming, numberless army, the light shimmering off their sleek, silvery forms. A draconic monstrosity in the vanguard carries a blue banner. Next to it is a towering being, one Chandra must assume is their general. Every fall of their feet is a thunderclap, every weapon an arrow in the back of their hopes.
She can't even see the Mirrans from here. How are they going to take out a force like that?
"I asked the Mother of Machines for her blessing to speak with you the moment I knew what you were planning. The resistance never had a chance. But I knew there was a chance for #emph[you] . I know what you could be, if you only join with us."
Norn knew. The whole time they'd been here, she knew what was going on. The sparse resistance they'd met wasn't because Norn was occupied with the invasion, but a trap.
And now they're all going to die, or worse.
Grief is a porcelain shard in her throat. She tries to swallow. All it does is hurt more.
Chandra takes a step backward. Her heel hangs off the rounded ground of the overlook platform. One more step and she'll fall—a burning star, the dashed hopes of the Multiverse.
Nissa takes another step forward. Brazen, now, she traces a metallic claw along Chandra's cheekbone—but it still isn't Nissa that's speaking. Chandra feels sick. "We are offering you the holiest of graces: freedom from this fear. When you join our congregation, you will never know loneliness again. We would never leave you to die alone."
"I'm not alone," Chandra snaps. She isn't. Wrenn's laying on the ground, in pain, but alive. While Nissa's been talking, Wrenn's been pulling herself closer and closer to the tree.
For a second, there's hope in Chandra's eyes.
Nissa soon follows Chandra's gaze to the fallen dryad. A bitter laugh leaves her lips. Copper branches spring from the tree's surface to clutch Wrenn tight.
Wrenn screams.
"We see now. You're still alive. Impressive. You will make a fine guardian for Realmbreaker," Nissa says. After a moment's consideration, Nissa's head turns toward Chandra once more. "As for you—we shall say only this: there are many ways to serve Phyrexia. When you join the fold, you'll discover what it is you were truly meant to be."
Chandra's breath is coming ragged. Her head's pounding. Jaya could talk her through this, but Jaya's dead; Gideon could soak up anything she threw at him, but he's dead, too.
And now there's Nissa.
But there's Wrenn, too. And as Nissa advances once more, Wrenn catches Chandra's eye. Flames flicker within her pale body. The metal around her begins to glow. With the centurions averting their eyes and Nissa focused on Chandra, Norn has no way of knowing what's about to happen.
#emph[Breathe] , she tells herself. #emph[Hold on a little longer.]
Chandra's other heel hits the edge. Fire swirls around her forearm. "I'm not giving up here."
Nissa's ears droop, her lips part. A softness creeps in around her oil-slicked cheeks. How many times has she seen this look? In the cold hours of the night, before the sun rose, when they used to talk about whatever came to mind; whenever Chandra spat out an idea that didn't quite make sense and Nissa wasn't quite sure how to tell her. How many times has she seen it?
Why does it hurt so much now?
"Chandra."
That's her voice. Nissa's voice. Without any of the interference, without Norn's influence—just Nissa.
Chandra's flames flicker out.
Nissa holds out her hand. "Please, come with us. I miss you."
#figure(image("007_Episode 5: Cathartic Reunion/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
A life without fear. A life without the others second-guessing every decision she's ever made. A life free of loneliness and pain. Even if they stop Phyrexians here, won't something else take its place? Bolas, the Eldrazi, <NAME>—there was always a tyrant. But if she takes that hand right now, that story could end.
It'd be like running away together.
Running away from their problems, and their responsibilities, and everyone who'd sacrificed everything to get them here.
"I miss you, too," Chandra says. Tears burn at her eyes. "I miss you so much. But I can't. I'm sorry."
All that familiarity, all that softness, is gone an instant. Nissa's face is a mask of rage in the moment before the fire.
Chandra ducks below Nissa's slicing arm and drives her fiery fist into the branch itself. One second of blinding orange is all the warning they get before the ground beneath them explodes. The impact sends her and Nissa hurtling away, the centurions dropping like stone hail. Only Wrenn is close enough to the tree to cling to it.
She's going to have to handle it from here.
|
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/SK/zalmy/Z33_vecieren.typ | typst | #import "/style.typ": *
#set par(first-line-indent: 1em)
=== Žalm 33
#note[Žalm berieme v prípade, že je predpísaná lítia.]
Pána chcem velebiť v každom čase, \* moje ústa budú ho vždy chváliť.
V Pánovi sa bude chváliť moja duša; \* nechže to počujú pokorní a nech sa tešia.
Velebte so mnou Pána \* a oslavujme jeho meno spoločne.
Hľadal som Pána a on ma vyslyšal, \* a vytrhol ma zo všetkej hrôzy.
Na neho hľaďte a budete žiariť, \* a tvár vám nesčervenie hanbou.
Úbožiak zavolal a Pán ho vyslyšal, \* a vyslobodil ho zo všetkých tiesní.
Ako strážca sa utáborí anjel Pánov okolo bohabojných \* a vyslobodí ich.
Skúste a presvedčte sa, aký dobrý je Pán; \* šťastný človek, čo sa utieka k nemu.
Vy, jeho svätí, bojte sa Pána, \* veď bohabojní núdzu nemajú.
Boháči sa nabiedia a nahladujú, \* ale tým, čo hľadajú Pána, nijaké dobro chýbať nebude. |
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/model/enum.typ | typst | // Test enumerations.
--- enum-function-call ---
#enum[Embrace][Extend][Extinguish]
--- enum-number-override-nested ---
0. Before first!
1. First.
2. Indented
+ Second
--- enum-built-in-loop ---
// Test automatic numbering in summed content.
#for i in range(5) {
[+ #numbering("I", 1 + i)]
}
--- list-mix ---
// Mix of different lists
- Bullet List
+ Numbered List
/ Term: List
--- enum-syntax-at-start ---
// In the line.
1.2 \
This is 0. \
See 0.3. \
--- enum-syntax-edge-cases ---
// Edge cases.
+
Empty \
+Nope \
a + 0.
--- enum-number-override ---
// Test item number overriding.
1. first
+ second
5. fifth
#enum(
enum.item(1)[First],
[Second],
enum.item(5)[Fifth]
)
--- enum-numbering-pattern ---
// Test numbering pattern.
#set enum(numbering: "(1.a.*)")
+ First
+ Second
2. Nested
+ Deep
+ Normal
--- enum-numbering-full ---
// Test full numbering.
#set enum(numbering: "1.a.", full: true)
+ First
+ Nested
--- enum-numbering-closure ---
// Test numbering with closure.
#enum(
start: 3,
spacing: 0.65em - 3pt,
tight: false,
numbering: n => text(
fill: (red, green, blue).at(calc.rem(n, 3)),
numbering("A", n),
),
[Red], [Green], [Blue], [Red],
)
--- enum-numbering-closure-nested ---
// Test numbering with closure and nested lists.
#set enum(numbering: n => super[#n])
+ A
+ B
+ C
--- enum-numbering-closure-nested-complex ---
// Test numbering with closure and nested lists.
#set text(font: "New Computer Modern")
#set enum(numbering: (..args) => math.mat(args.pos()), full: true)
+ A
+ B
+ C
+ D
+ E
+ F
--- enum-numbering-pattern-empty ---
// Error: 22-24 invalid numbering pattern
#set enum(numbering: "")
--- enum-numbering-pattern-invalid ---
// Error: 22-28 invalid numbering pattern
#set enum(numbering: "(())")
--- enum-number-align-unaffected ---
// Alignment shouldn't affect number
#set align(horizon)
+ ABCDEF\ GHIJKL\ MNOPQR
+ INNER\ INNER\ INNER
+ BACK\ HERE
--- enum-number-align-default ---
// Enum number alignment should be 'end' by default
1. a
10. b
100. c
--- enum-number-align-specified ---
#set enum(number-align: start)
1. a
8. b
16. c
--- enum-number-align-2d ---
#set enum(number-align: center + horizon)
1. #box(fill: teal, inset: 10pt )[a]
8. #box(fill: teal, inset: 10pt )[b]
16. #box(fill: teal,inset: 10pt )[c]
--- enum-number-align-unfolded ---
// Number align option should not be affected by the context.
#set align(center)
#set enum(number-align: start)
4. c
8. d
16. e\ f
2. f\ g
32. g
64. h
--- enum-number-align-values ---
// Test valid number align values (horizontal and vertical)
#set enum(number-align: start)
#set enum(number-align: end)
#set enum(number-align: left)
#set enum(number-align: center)
#set enum(number-align: right)
#set enum(number-align: top)
#set enum(number-align: horizon)
#set enum(number-align: bottom)
--- issue-2530-enum-item-panic ---
// Enum item (pre-emptive)
#enum.item(none)[Hello]
#enum.item(17)[Hello]
|
|
https://github.com/pank-su/typst-gost | https://raw.githubusercontent.com/pank-su/typst-gost/main/templates/toc.typ | typst | #import "escd.typ": outlineFrame
#let toc() = {
show heading: set text(size: 14pt)
show heading: set align(center)
//counter(page).update(3)
set page(background:
outlineFrame(),
margin: (left: 25mm, right: 10mm, top: 20mm, bottom: 25mm),
paper: "a4"
)
outline(depth: 3, indent: true, title: align(center)[#upper("Содержание")])
} |
|
https://github.com/feiyangyy/Learning | https://raw.githubusercontent.com/feiyangyy/Learning/main/misc/host_usb_application.typ | typst | #import "@preview/pintorita:0.1.1"
// #set page(height: auto, width: auto, fill: white, margin: 2em)
// #set text(fill: white)
#show raw.where(lang: "pintora"): it => pintorita.render(it.text)
== USB 协议栈的星(树)形结构
1. 每个USB总线都有一个根集线器,一个电脑或者host设备上可以有多个根集线器
- 每个总线都有编号,从0开始 对应于 libusb_get_bus_number
2. 从根集线器开始,可以挂在设备和普通集线器(Hub),USB协议规定 至多只能有5个hub级联,也就是最后一个hub必须挂载设备,从而USB拓扑的深度是7(算上最后一级hub的设备)
- 虽然USB总线拓扑看起来像树形结构,但是其本质上是一个中心的星型结构。比如我们常见的hub,他至多可以有8个端口,然后厂家会拿其中一个端口做成USB公头,使其能和其他hub连接
- 端口编号为[1,8], 0号端口要么用于特殊目的,要么表示一些错误或不可用
3. 设备的定位
- 像linux 对usb设备的编号一样,通过 总线编号+端口号列表,可以唯一确定一个设备在总线中的拓扑位置
- 以linux的编号为例,其规则是:`[bus_number]-[port_list]`, port_list的表示为`a.b.c.d ...`(...表可能更多的意思),其中a b c d 都是1-8的数
- 比如 `1-2.3.3` 就表示挂在1号bus下的第2个端口(是一个集线器)的第3个端口(仍然是一个集线器)的第三个端口上,形如
```
root_hub_1 (bus number 1)
|---- (port 1...)
|---- hub (port 3)
|----- (port 1...)
|----- (port 2...)
|----- hub
| -------
| -------
| ------- device
```
- 对于这个例子,如果调用libusb_get_port_numbers 其port_numbers 传出参数就是[2,3,3]
== 基本步骤
1. 调用libusb_get_device_list 获取设备列表
2. for dev in devices,
- 执行libusb_get_device_descriptor 获取描述符
- |
|
https://github.com/fabriceHategekimana/master | https://raw.githubusercontent.com/fabriceHategekimana/master/main/3_Theorie/Broadcasting.typ | typst | #import "../src/module.typ" : *
#pagebreak()
== Broadcasting
Le broadcasting fait référence à la capacité d'une bibliothèque de manipuler des tableaux de différentes dimensions ensemble, en étendant implicitement la forme des tableaux plus petits pour qu'ils correspondent à la forme des tableaux plus grands. Cela permet de réaliser des opérations élémentaires sans explicitement dupliquer des données, ce qui est crucial pour l'efficacité computationnelle.
Le but est de voir comment le broadcasting peut-être implémenté dans notre système de type. L'idéal serait de pouvoir le faire pour les tenseurs avec les opération binaires (+, -, /, etc.). En général, l'extension se fait par la dernière dimension.
=== Cas simple
Dans cet exemple, fait avec python et la librairie numpy, l'opération marche sans problème. Nous avons deux tenseurs de même taille. Ce genre de cas est facile a implémenter et ne dépend pas du broadcasting. Cet exemple est juste pour montrer que c'est une propriété du broadcasting.
#Exemple()[Broadcasting avec numpy vecteur x vecteur
```python
a = np.array([1.0, 2.0, 3.0])
b = np.array([2.0, 2.0, 2.0])
a * b = array([2., 4., 6.])
```
]
=== Propriété 1: extension axiale
Une des propriétés intéressantes du broad casting est l'extension axiale. On est capable de prendre deux tableaux de taille différente. Nous avons ici, deux tenseurs de dimension 1 mais de longueur différente. Le broadcasting permet d'étendre la longueur de l'axe le plus court.
#Exemple()[Broadcasting avec numpy vecteur x scalaire
```python
a = np.array([1.0, 2.0, 3.0])
b = np.array([2.0])
# a * b = array([2., 4., 6.])
```
]
Si nous avons deux tenseurs de dimension N, T1: (n1, n2, ..., nN) et T2: (m1, m2, .., mN). Le broadcasting va nous permettre d'ajuster la taille de la dimension la plus petite à la dimension la plus grande. On aurait une signature du type:
op((n1, n2, ..., nN), (m1, m2, ..., mN)) -> (max(n1, m1), max(n2, m2), ..., max(nN, mN))
Dans le cas de l'exemple précédent, nous avons cette transformation: \*((3), (1)) -> (3).
=== Propriété 2: extension dimensionelle (extension sur la gauche)
Une autre propriété du broadcasting est sa capacité à ajuster la forme d'un tenseur en ajustant le nombre de dimension.
#Exemple()[Broadcasting avec numpy matrice x vecteur
```python
a = np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
b = np.array([2., 4., 6.])
# a * b = np.array([[ 2. 8. 18.], [ 8. 20. 36.]])
```
]
Si nous avons deux tenseurs de dimensions différentes T1: (n1, ...), T2: (m1, ..) et dim(T1) = N, dim(T2) = M le broadcasting va nous permettre d'ajuster la dimension la plus petite en ajoutant des axes supplémentairs de longueur 1. Après quoi, on applique l'extension axial mensionné précédement. Il serait difficile de représenter une signature pour des tenseurs de dimensions différentes sans ajouter des notations bizarre.
Notre exemple de tout à l'heure nous donnerait: \*((2, 3), (3)) -> (2, 3). Comme mentionné précédement, il n'y a pas de méthode possible avec notre système de type pour représenter ce genre d'opération. Pour accomplir cela, on pourait inclure la dimension dans la description de type comme dans le travail de <NAME> et al #cite(label("10.1007/978-3-642-54833-8_3")).
=== Autre propriété
Dans les langage dynamique comme python, le broadcasting est couplé à une transformation dynamique de type. Notament, on peut faire des calcules élémentaires entre des nombres et des matrices, ce qui est proche de la vision mathématique de l'algèbre linéaire.
#Exemple()[Broadcasting avec numpy vecteur x scalaire
```python
a = np.array([1.0, 2.0, 3.0])
b = 2.0
a * b = array([2., 4., 6.])
```
]
On se réalise que le broadcasting est la combinaison de trois applications: l'extension dimensionnelle, l'extension axiale et l'application de l'opération élément par élément. On peut donc séparer ça en trois fonctions différentes. Comme on l'a vu, les fonctions d'extension dimensionnelle et d'extension axiale.
L'équipe #cite(label("Liu2020-ja")) qui voulait developper un système de type pour les ndarray de numpy a proposé une représentation du broadcasting intéressante mais qui n'offre pas la sécurité qui nous intéresse.
#Exemple()[Exemple de typage pour le broadcasting
```python
def broadcast(x: Ndarray[*A], Ndarray[Broadcast[A]])
-> Ndarray ?:
```
]
La représentation des tenseurs que nous avons adopté dans le chapitre précédent reste quand même très puissante et assez fidèle à la représentation mathématique des vecteurs et matrices tout en gardant l'habilité de travailler avec des tenseurs de dimensions supérieur à 2. Malheureusement le broadcasting ne peut pas être fidèlement typé et sécurisé dans ce langage et sera donc mis de côté.
|
|
https://github.com/t2lab-it/Lozano-Duran2022_information-theoretic | https://raw.githubusercontent.com/t2lab-it/Lozano-Duran2022_information-theoretic/main/style.typ | typst | // Workaround for the lack of an `std` scope.
#let std-bibliography = bibliography
// Set the Fonts
#let gothic = ("MS PGothic", "Hiragino Kaku Gothic Pro", "IPAexGothic", "Noto Sans CJK JP")
#let mincho = ("MS PMincho", "Hiragino Mincho Pro", "IPAexMincho", "Noto Serif CJK JP")
#let english = ("Times New Roman", "New Computer Modern")
|
|
https://github.com/Treeniks/bachelor-thesis-isabelle-vscode | https://raw.githubusercontent.com/Treeniks/bachelor-thesis-isabelle-vscode/master/chapters/05-main-enhancements/code-actions-active-markup.typ | typst | #import "/utils/todo.typ": TODO
#import "/utils/isabelle.typ": *
== Code Actions for Active Markup
One #jedit feature that was missing entirely in #vscode is Isabelle's _active markup_. Active markup generally describes parts of the theory, state, or output content that is clickable. The action taken when the user clicks on an active markup can vary, as many different kinds of active markup exist. One type of active markup the user will probably come across frequently is the so-called _sendback_ markup. This type of markup appears primarily in the output panel, and clicking on it inserts its text into the source theory. It appears, for example, when issuing a `sledgehammer` command.
#footnote[The `sledgehammer` command is an Isabelle command that calls different external automatic theorem provers in hopes of one of them finding a proof. Isabelle then translates the found proof back into an Isabelle proof.]
When this command finds a proof, it is displayed in the output panel with a gray background (green when hovered with the mouse). The user can then click on the suggested proof, and Isabelle inserts it into the document. This example can be seen in @active-markup-sledgehammer-jedit. As mentioned, there are other types of active markup as well, but those are out of the scope of this thesis.
#{
show figure.caption: it => box(width: 69%, it)
[
#figure(
table(
columns: 2,
stroke: none,
table.header([*Before*], [*After*]),
box(stroke: 1pt, image("/resources/jedit-active-sledgehammer-before.png")),
box(stroke: 1pt, image("/resources/jedit-active-sledgehammer-after.png")),
),
kind: image,
caption: [Active markup in #jedit when using sledgehammer, before and after clicking on sendback markup.],
// placement: auto,
) <active-markup-sledgehammer-jedit>
]
}
Unlike other features discussed in this work, active markup is a concept that has no comparable feature within typical code editors. Clicking on parts of code may exist in the form of _Goto Definition_ actions or clicking on hyperlinks, but inserting things from some output panel into the code is unique. Hence, there is also no existing precedent on handling this type of interaction within the LSP specification. Because of this, the first question that needed to be answered is how we intend to tackle this problem in terms of user experience. That is, should the #vscode implementation work the same way as it does in #jedit (i.e. by clicking with the mouse), or should the interaction work completely differently?
#pagebreak() // bad style to put this here, but it just looks stupid otherwise
There exist two major problems when trying to replicate the user experience of #jedit:
1. For the sake of accessibility, it is usually possible to control VSCode entirely with the keyboard. In order to retain this property, we decided it should also be possible to interact with active markup entirely with the keyboard.
2. It would need a completely custom solution for both the language server and language client, increasing complexity and the barrier of entry for new Isabelle IDEs. We would potentially need to reimagine the way that output panel content is sent to the client, and it would be very difficult to expand the functionality to other types of active markup that live within the theory instead.
Instead, we decided to deviate from #jedit and utilize existing LSP features where possible. Luckily, the LSP spec defines a concept called _code actions_, which are suitable for active markup.
The intended use case of code actions is to support more complicated IDE features acting on specific ranges of code that may result in beautifications or refactors of said code. For example, when using the `rust-analyzer` language server, #footnote[https://rust-analyzer.github.io/] which serves as a server for the Rust programming language, #footnote[https://www.rust-lang.org/] it is possible to use a code action to fill out the arms of a match expression, an example of which can be seen in @rust-match-action.
#figure(
table(
columns: 2,
stroke: none,
table.header([*Before*], [*After*]),
box(stroke: 1pt, image("/resources/sublime-action-rust-light-before.png")),
box(stroke: 1pt, image("/resources/sublime-action-rust-light-after.png")),
),
kind: image,
caption: [`rust-analyzer`'s "Fill match arms" code action in Sublime Text.],
// placement: auto,
) <rust-match-action>
The main advantage of using code actions is that they are a part of the standard LSP specification, meaning most language clients support them out of the box. If the Isabelle language server supports interacting with active markup through code actions, there is no extra work necessary for the client.
To initiate a code action, the language client sends a `textDocument/codeAction` request to the server whose content can be seen in @action-request-interface. The request's response then contains a list of possible code actions. Each code action may be an _edit_, a _command_, or both. For our use case of supporting _sendback_ active markup, which only inserts text, the _edit_ type suffices. Although to support other types of active markup, the _command_ type may become necessary.
The `range` data sent in the code action request is the text range from which the client wants to get code actions. Code actions are quite dependent on caret position. Different parts of the document may exhibit different code actions. Most of the time, the `range` just includes the caret's current position. However, most clients will also allow the user to make a selection or even create multiple carets and request code actions for the selected range.
#figure(
box(width: 90%)[
```typescript
interface CodeActionParams {
textDocument: TextDocumentIdentifier;
range: Range;
context: CodeActionContext;
}
```
],
caption: [`CodeActionParams` interface definition @lsp-spec.],
kind: raw,
) <action-request-interface>
=== Implementation for the Isabelle Language Server
When the Isabelle language server receives a code action request, the generation of the code actions list for its response is roughly done in these four steps:
1. Find all #isar commands within the given `range`.
2. Get the command results of all these commands.
3. Extract all sendback markup out of these command results.
4. Create LSP text edit JSON objects, inserting the sendback markup's content at the respective command's position.
#{
show figure.caption: it => box(width: 71%, it)
[
#figure(
table(
columns: 2,
stroke: none,
table.header([*Before*], [*After*]),
box(stroke: 1pt, image("/resources/vscode-action-active-sledgehammer-light-before.png")),
box(stroke: 1pt, image("/resources/vscode-action-active-sledgehammer-light-after.png")),
),
kind: image,
caption: [Active markup in #vscode when using sledgehammer, before and after accepting code action. Code action initiated with "`Ctrl+.`". ],
placement: auto,
) <active-markup-sledgehammer-vscode>
]
}
Once the list of these code actions is sent to the language client, the server's work is done. The LSP text edit objects exist in a format standardized in the LSP, so the actual execution of the text edit can be done entirely by the client.
We also considered how to deal with correct indentation for the inserted text. In #jedit, when a sendback markup gets inserted, the general indentation function that exists in #jedit is called right after to correctly indent the newly inserted text. Since this internal indentation function uses direct access to the underlying jEdit buffer, we could not easily use this function from the language server. However, simply ignoring the indentation altogether results in a subpar user experience.
A proper solution would be to reimplement #jedit's indentation logic for the language server, which we will discuss in @future-work as it exceeds the scope of this thesis. For our contribution, the language server instead just copies the source command's indentation to the inserted text. This may give slightly different indentations compared to #jedit; however, the result is acceptable in practice.
An example of the resulting implementation for #vscode can be seen in @active-markup-sledgehammer-vscode.
// #TODO[
// - explanation of active markup
// - adding support for clicking is somewhat difficult and goes way beyond the LSP Spec
// - code actions are a way for the server to send different options to client, and the client to then be able to select one
// - can include just text edits, client commands or even server commands
// - thus very flexible
// - most clients already implement logic for it, so no need for manual implementation on client
// - now works for sendbacks (insertions)
// - example with sledgehammer/try0
// - indentation is copied from current line
// - indentation on jEdit is handled via global indent function
// - uses internal jEdit buffers, thus not easily translatable to server
// - TODO look into git history for more difficulties
// ]
|
|
https://github.com/daniel-ttel/banana-omen | https://raw.githubusercontent.com/daniel-ttel/banana-omen/main/template/toc.typ | typst | MIT License | #let toc(title: "Índice", depth: 3) = {
// Tabla de contenidos
show outline.entry.where(
level: 1
): it => {
strong(it)
}
show outline.entry.where(
level: 3
): it => {
set text(gray)
it
}
outline(
title: title,
depth: depth,
indent: 2em
)
}
|
https://github.com/FlorenceGhestem/My-Resume | https://raw.githubusercontent.com/FlorenceGhestem/My-Resume/main/assets/typst/typst-template.typ | typst | MIT License | #let resume(
name: none,
contact: (),
summary: none,
skills: (),
main_sections: (),
margin: (x: 0.75in, y: 0.75in),
paper: "us-letter",
lang: "en",
region: "UK",
font: (),
fontsize: 11pt,
doc,
) = {
// Define colors
let accent-color = rgb("#0077be") // Blue
let grey-color = rgb("#666666") // Grey for descriptions
let to-string(content) = {
if content.has("text") {
if type(content.text) == "string" {
content.text
} else {
to-string(content.text)
}
} else if content.has("children") {
content.children.map(to-string).join("")
} else if content.has("body") {
to-string(content.body)
} else if content == [ ] {
" "
}
}
set page(
paper: paper,
margin: margin,
)
set par(justify: true)
set text(lang: lang,
region: region,
font: font,
size: fontsize)
let section-title(title) = {
v(0.5em)
text(weight: "bold", size: 1.2em)[#title]
line(length: 100%, stroke: 0.5pt)
v(0.3em)
}
let (first-name, last-name) = to-string(name).split(" ")
[
#text(size: 2em, fill: accent-color)[#first-name]
#text(weight: "bold", size: 2em, fill: black)[#last-name]
]
v(0.5em)
if summary != none {
[#summary]
}
grid(
columns: (30%, 60%),
gutter: 1em,
{
// Sidebar
// Contact information
section-title("Contact Info")
for (value) in contact {
if value.link != none {
[
#link(to-string(value.link))[#value.text]
]
} else {
[#value.text]
}
v(0.3em)
}
if skills != () {
section-title("Skills")
for category in skills {
text(weight: "bold")[#category.name]
set text(size: 0.8em)
list(..category.items)
v(0.5em)
}
}
},
{
// Main sections
for section in main_sections {
section-title(section.title)
for entry in section.entries {
grid(
columns: (auto, 1fr),
gutter: 1em,
text(weight: "bold", fill: accent-color)[#entry.title],
align(right)[#emph[#entry.date]],
)
[#entry.organization, #entry.location]
if entry.description != none {
list(
..entry.description.map(item => [#text(fill: grey-color)[#item]])
)
}
v(0.5em)
}
}
}
)
doc
} |
https://github.com/OCamlPro/ppaqse-lang | https://raw.githubusercontent.com/OCamlPro/ppaqse-lang/master/src/étude/precision.typ | typst | #import "defs.typ": *
#import "links.typ": *
= Analyse numérique
== Entière
Les erreurs d'arithmétique entière sont des erreurs qui surviennent lors de
calculs sur des entiers machine. Il s'agit là des entiers que l'on trouve dans
la plupart des langages de programmation et souvent désignés par le mot clé
`int` ou dérivés.
La taille des entiers manipulables dépend de l'architecture du processeur
utilisé. Sur la plupart des architectures, elle correspond aux puissances de 2
entre 8 et 64. Par exemple, un entier de 8 bits non signé (uniquement
positif) peut représenter un entier mathématique de 0 à 255. Les formes
signées utilisent un bit pour indiquer si l'entier est positif ou négatif; ce
qui permet de représenter les entiers mathématiques de -128 à +127.
Dès lors que les entiers machines ont une taille finie, il est possible de
réaliser des opérations qui dépassent cette taille. Par exemple, calculer
$200 + 100$ sur un entier non signé de 8 bits donnera 44 (300 modulo 256). Ce
résultat est correct dans une arithmétique modulo 256 mais il est rare
que le programmeur pense dans cette arithmétique et il est plus probable qu'il
s'agisse d'une erreur involontaire. Ce type d'erreur est appelé _overflow_
(ou dépassement de capacité).
Ce genre d'erreur peut être assez subtil car
bien qu'il soit détecté par le processeur qui positionne un drapeau
signalant le dépassement, il nécessite que le programmeur vérifie ce drapeau
explicitement pour en tenir compte; ce qu'il ne fait généralement pas.
Il y a aussi des opérations qui peuvent conduire à des comportements indéfinis
par le langage. Les langages dont la sémantique n'est pas complètement
standardisée donnent une liberté aux compilateurs pour interpréter
certaines constructions. C'est ce qu'on appelle les _undefined behavior_.
Cela est problématique lorsque le comportement du compilateur n'est pas
celui imaginé par le développeur ou quand le programme est compilé avec un
autre compilateur. Ce genre d'erreur doit également être relevé car il
est susceptible de conduire à des erreurs d'exécution.
Une autre erreur couverte par l'analyse de l'arithmétique entière
est la division par 0. Celle-ci n'est pas plus autorisée en informatique que
dans les mathématiques générales et provoque une erreur fatale à l'exécution.
=== Flottante
L'arithmétique flottante est basée sur une représentation binaire des nombres
réels. Les nombres flottants sont représentés par
trois valeurs : le _signe_, la _mantisse_ et l'_exposant_.
La mantisse est la partie
significative du nombre, l'exposant est la puissance de 2 ou de 10 à laquelle
il faut multiplier la mantisse et le signe indique si le nombre est
positif ou négatif.
Comme pour les nombres entiers, il existe plusieurs tailles de flottants et
la norme #cite(<ieee:754-2008>) définit plusieurs formats en fonction
de la base (2 ou 10) et le nombre de bits utilisés (en puissance de 2 de
16 à 128).
Bien que les nombres flottants permettent de représenter des nombres
plus grands que leur équivalent entier, ils n'en sont pas moins sujet à des
dépassement de capacité. Cela étant, le calcul flottant est complet et en cas
de dépassement ou de calcul impossible (comme la division par 0), le résultat
est donné par des nombres spéciaux comme $+infinity$ ou $-infinity$ ou
_NaN_#footnote[_Not A Number_ (pas un nombre), utilisé pour les opérations
invalides].
Le fait que l'arithmétique flottante soit standardisée et complète en font
parfois un choix de prédilection pour les calculs en général. Certains
langages de programmation (comme Lua) ont un seul type numérique qui est,
par défaut, représenté par un flottant.
D'un point de vue mathématique, l'arithmétique flottante a cependant
un soucis d'arrondi inhérent au fait que la décomposition binaire d'un
nombre peut être supérieure à sa capacité. Elle est même d'ailleurs infinie
si le dénominateur du nombre n'est pas une puissance de 2. Par exemple, le
nombre décimal 0.5 a une représentation flottante exacte car c'est
$#text(red)[2]^(-1) = 1/#text(red)[2]$. En revanche 0.1 ($1/#text(red)[10]$)
n'a pas de représentation exacte car sa décomposition
binaire donne $0,0overline(0011)$ (où 0011 se répète à l'infini). Pour pouvoir
représenter ce nombre, il faut l'arrondir à une certaine précision et
généralement 0.1 vaut en 0.10000000000000000555 en flottant.
Ces arrondis donnent lieu à des approximations qui peuvent s'accumuler et
devenir problématiques lorsqu'on enchaîne les opérations. Elles peuvent
également donner lieu à des résultats contre intuitifs. Par exemple, en calcul
flottant, l'égalité $0.1 + 0.2 = 0.3$ est fausse ! Avec les
arrondis, $0.1 + 0.2$ vaut 0.30000000000000004441 tandis que 0.3 vaut
0.29999999999999998890. Dans ce contexte, écrire des algorithmes numériques
fiables peut être très délicat.
Les analyses statiques sur l'arithmétique flottante peuvent détecter
les opérations ambiguës comme la comparaison ci-dessus et vérifier la marge
d'erreur en effectuant un calcul abstrait sur les intervalles possibles ou en
évaluant le delta de précision qui est, de manière qui peut paraître
paradoxale, calculable de manière exacte. Il existe également des bibliothèques
de calcul pour réaliser à _runtime_ les opérations en utilisant ces deux
techniques.
|
|
https://github.com/swablab/documents | https://raw.githubusercontent.com/swablab/documents/main/templates/form.typ | typst | Creative Commons Zero v1.0 Universal | #import "common.typ": colors
#let form(title, ..fields, width: 60pt) = {
grid(
columns: (width, ..fields.pos().map(i => 1fr)),
rows: (2.25em),
gutter: 0.5em,
text(10pt)[
#align(horizon + right)[
#strong(title)
]
],
..fields
)
}
#let form_field(name, width: 100%) = {
stack(spacing: 2pt)[
#rect(
fill: colors.highlight,
width: width,
height: 2em,
)
][
#text(9pt, fill: black)[
#name
]
]
}
#let form_inline(width: 12em) = {
box(height: 0.75em, width: width, fill: colors.highlight, outset: (y: 3pt))
} |
https://github.com/RaphGL/ElectronicsFromBasics | https://raw.githubusercontent.com/RaphGL/ElectronicsFromBasics/main/DC/chap5/chap5.typ | typst | Other | == Series and parallel circuits
#include "1_what_are_series_parallel_circuits.typ"
#include "2_simple_series_circuits.typ"
#include "3_simple_parallel_circuits.typ"
#include "4_conductance.typ"
#include "5_power_calculations.typ"
#include "6_correct_ohms_law_use.typ"
#include "7_component_failure_analysis.typ"
#include "8_simple_resistor_circuits.typ"
|
https://github.com/Mufanc/hnuthss-template | https://raw.githubusercontent.com/Mufanc/hnuthss-template/main/configs.typ | typst | #let font = (
sans: ("Times New Roman", "Noto Sans SC"),
serif: ("Times New Roman", "Noto Serif SC"),
)
#let fontsize = (
LB: 42pt, // 初号
LBs: 36pt, // 小初
L1: 26pt, // 一号
L1s: 24pt, // 小一
L2: 22pt, // 二号
L2s: 18pt, // 小二
L3: 16pt, // 三号
L3s: 15pt, // 小三
L4: 14pt, // 四号
L4s: 12pt, // 小四
L5: 10.5pt, // 五号
L5s: 9pt, // 小五
L6: 7.5pt, // 六号
L6s: 6.5pt, // 小六
L7: 5.5pt, // 七号
L8: 5pt, // 八号
)
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-20000.typ | typst | Apache License 2.0 | #let data = (
"0": ("<CJK Ideograph Extension B, First>", "Lo", 0),
"a6df": ("<CJK Ideograph Extension B, Last>", "Lo", 0),
)
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/visualize/stroke_02.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Rectangle strokes
#rect(width: 20pt, height: 20pt, stroke: red)
#v(3pt)
#rect(width: 20pt, height: 20pt, stroke: (rest: red, top: (paint: blue, dash: "dashed")))
#v(3pt)
#rect(width: 20pt, height: 20pt, stroke: (thickness: 5pt, join: "round"))
|
https://github.com/yonatanmgr/university-notes | https://raw.githubusercontent.com/yonatanmgr/university-notes/main/0366-%5BMath%5D/03661111-%5BLinear%20Algebra%201A%5D/src/lectures/03661111_lecture_9.typ | typst | #import "/template.typ": *
#import "@preview/colorful-boxes:1.2.0": *
#show: project.with(
title: "אלגברה לינארית 1א׳ - שיעור 9",
authors: ("<NAME>",),
date: "1 בפברואר, 2024",
)
// #include "/utils/toc.typ"
// #pagebreak()
#set enum(numbering: "(1.א)")
== המשך משפטים על מימדים ובסיסים
=== (משפט) יהי $V$ מ״ו מעל $F$ ו-$U seq V$ תת-מרחב. נניח ש-$dim V < oo$. אזי, $dim U <= dim V$.\ יתר על כן, $dim U = dim V iff U=V$
==== הוכחה
כדי להוכיח ש-$dim U <= dim V$, די להראות שכל סדרת וקטורים בת״ל ב-$U$ היא באורך $dim V >=$.
\ ואכן, אם $u_1, dots, u_k in U$ בת״ל ב-$U$ אז היא גם בת״ל ב-$V$ ולכן $k <= dim V$.
בשביל החלק השני, די להוכיח שאם $n:= dim U = dim V$ אז $U=V$. ואכן, ניקח בסיס של $U$: $B=(u_1, dots, u_n)$ בסיס של $U$. בפרט, זוהי קבוצה בת״ל באורך $n$ ב-$V$, ולכן $B$ בסיס של $V$ (תת-קבוצה בת״ל מאורך הבסיס). #QED
=== (משפט) תהי $V seq F^n$ קבוצת הפתרונות של מערכת משוואות הומוגנית ב-$n$ נעלמים. אזי, $ dim V = "מספר המשתנים החופשיים" = n-("מספר המשתנים התלויים") $
==== הוכחה
$ "מטריצה מייצגת של מערכת המשוואות" ->mat(,,,;,,,;,,,) arrow.long.squiggly^"דירוג" mat(0, dots.h.c, 1, 0; 0,dots,0,0;0,dots,0,1) -> "המטריצה הקאנונית" $
נסמן ב-${1,dots,n} supset.eq I$ את קבוצת האינדקסים של המשתנים הקשורים וב-${1,dots,n} supset.eq J$ את האינדקסים המתאימים למשתנים החופשיים. יודעים שלכל בחירה של $(x_j)_(j in j) in F$ יש בדיוק בחירה אחת של $x_i in F, i in I$ כך ש-$(x_1, dots, x_n)$ יהיה פתרון. ואכן, אם המשוואה היחידה אחרי הדירוג בה $x_i$ מופיע היא $x_i = - sum_(j in J) k_(i j) x_j$ ואז אם $forall j in J$ נבחר את הפתרון $v_j in F^n$ המתאים ל-$x_j =1$, $forall j' in J x_(j') = 0$ וזו קבוצה פורשת ובת״ל ולכן בסיס. #QED
= העתקות לינאריות
== הגדרה
יהיו $V_1, V_2$ שני מרחבים לינאריים מעל שדה $F$. פונקציה $phi : V_1 -> V_2$ נקראת העתקה לינארית (או טרנספורמציה לינאריות) אם מתקיימים:
+ $forall v, u in V : phi(v+u) = phi(v)+phi(u)$
+ $forall lambda in F, forall v in V : phi(lambda v) = lambda phi(v)$
באופן שקול ל-(1) ו-(2) נוכל לדרוש:
3. $forall lambda_1, lambda_2 in F, forall v,u in V: phi(lambda_1 v + lambda_2 u) = lambda_1 phi(v) + lambda_2 phi(u)$.
נקרא ל-$phi$ *שיכון* אם $phi$ חח״ע.\ נסמן את *התמונה* של $phi$ ב-$Im(phi) = phi(V) := {phi (v):v in V}$, ואת *הגרעין* של $phi$: $ker phi = {v in V:phi(v) =0}$. \
נסמן את קבוצת כל ההעתקות הלינאריות מ-$V_1$ ל-$V_2$ ב-$hom (V_1, V_2) := {phi : V_1 -> V_2}$. לפעמים אם נרצה להדגיש את $F$ נסמן $hom_F (V_1,V_2)$, ואם $V_1=V_2$ נסמן בקצרה $hom_F (V_1) = hom_F (V_1, V_1)$.
\
=== דוגמאות
+ תמיד יש את העתקת האפס שמוגדרת $phi(v) = 0, forall v in V_1$. נסמנה ב-$dot.circle$ ובפרט $dot.circle in hom (V_1, V_2)$. ניתן לראות כי $im dot.circle = dot.circle$ ו-$ker dot.circle = V_1$.
+ נניח $V_1 = V_2 = V$. נגדיר את העתקת הזהות: $forall v in V, phi(v)=v$. זו העתקה לינארית ונסמנה ב-$id(V)$ או $id(space.hair)$ (או שנסמנה ב-$1$).
+ $V=F^2$. נגדיר $phi: V->V, phi(x,y)=(-y,x)$. $V$ זו העתקה לינארית. \
אז במקרה יש גם העתקה "הופכית" - סיבוב בכיוון השני: $psi(x,y)= (y,-x)$. ובאמת: $ phi(psi(x,y)) = phi(y,-x) = (x, y) $ ולהיפך: $ psi(phi(x,y)) = psi(y,-x) = (x, y) $
במקרה זה מתקיים $phi of psi = psi of phi = id(space.hair)$ (אם נסמן "כפל" בהרכבה ו-$id(space.hair) = 1$ נקבל $phi dot psi = psi dot phi = 1$). \
הגרעין $ker phi = {(x,y) | phi(x,y) = 0_V} = {(x,y) | (-y,x)= (0,0)} = {(0,0)}$.
=== (למה) תהי $phi: V->U$ העתקה לינארית מעל שדה $F$. מתקיימות התכונות הבאות:
0. $phi(0)=dot.circle$.
+ $im phi$ היא תת מרחב של $U$.
+ $ker phi$ היא תת מרחב של $V$.
+ $phi$ היא על $iff$ $im phi = U$
+ $phi$ היא חח״ע $iff$ $ker phi = U$
+ $phi$ היא העתקת האפס $iff$ $ker phi = V$ $iff$ $im phi = 0$
==== הוכחה
0. $phi(0_V) = phi(0_F dot 0_V) = 0_F dot phi(0_V) = 0_U$.
+ לפי (0), $dot.circle in im phi $. ניקח $u_1, u_2 in im phi, lambda_1, lambda_2 in F$. אז קיימים $v_1, v_2 in V$ כך ש-$ u_1 = phi(v_1), u_2 = phi(v_2) \
lambda_1 u_1 + lambda_2 u_2 = lambda_1 phi(v_1) + lambda_2 phi(v_2) = phi(lambda_1 v_1 + lambda_2 v_2) in im phi
$ כנדרש.
+ לפי (0), $0 in ker phi$. ניקח $lambda_1, lambda_2 in F, v_1, v_2 in ker phi$. כלומר:
$ phi(v_1) = phi(v_2) = 0 \
lambda_1 v_1 + lambda_2 v_2 in ker phi \
iff phi (lambda_1 v_1 + lambda_2 v_2) = 0 \ iff lambda_1 phi(v_1) + lambda_2 phi(v_2) = 0 \
arrow.t.double \ lambda_1 dot 0 + lambda_2 dot 0 = 0
$
+ ברור מההגדרה של על.
+ $phi$ חח״ע ו-$v in ker phi$. אזי, $phi(v) = 0 = phi(0)$. כיוון ש-$phi$ חח״ע $v=0$. לכן $ker phi = dot.circle = {0}$. \ נניח ש-$ker phi = 0$. צ״ל $phi$ חח״ע. נניח ש-$phi(v_1)=phi(v_2)$ צ״ל $v_1=v_2$. ואכן, $ 0 = phi(v_1) - phi(v_2) = phi(v_1 - v_2) => v_1-v_2 in ker phi = dot.circle => v_1- v_2 = 0 => v_1 = v_2 $
+ ברור מההגדרה.
#QED
== איזומורפיזם
העתקה לינארית $phi: V_1 -> V_2$ נקראת *איזומורפיזם* אם קיימת הופכית, כלומר קיימת $psi: V_2->V_1$ כך ש-$phi of psi=id(V_1)$ וגם $psi of phi = id(V_1)$ $(*)$.
// ==== תזכורת
// $(phi of psi) (v) = phi(psi(v))$. בדרך כלל
=== (למה) תהי $phi: V_1->V_2$ העתקה לינארית. מתקיימות התכונות הבאות:
+ $phi$ היא איזומורפיזם $iff$ $phi$ חח״ע ועל.
+ אם $phi$ איזומורפיזם אז ההופכית היא יחידה.
==== הוכחה
+ $arrow.double.l$: נניח ש-$phi$ איזומורפיזם ויהי $phi$ שמקיימת את $(*)$.
+ חח״ע: $phi(v)=phi(u)$ $arrow.double.l$ $u=psi(phi(v)) = psi(phi(v))$ כנדרש.
+ על: ניקח $v_2 in V_2$ צ״ל $v_1$ כך ש-$phi(v_1)=v_2$. נגדיר $v_1 = psi(v_2)$ ואז $phi(v_1)=phi(psi(v_2))=v_2$ כנדרש.
$arrow.double.r$: נניח ש-$phi$ חח״ע ועל. כלומר לכל $v_2 in V_2$ יש $v_1 in V_1$ יחיד המקיים $phi(v_1)=v_2$. נגדיר $psi: V_2->V_1$ ע״י $psi(v_2) = v_1$ ואז מההגדרה $psi phi = id(space) and phi psi = id(space)$.
נשאר להראות ש-$psi$ העתקה לינארית. ניקח $v, w in V_2$ ו-$lambda, mu in F$. צ״ל $overbracket(psi(lambda v + mu w), x) = overbracket(lambda psi (v) + mu psi (w), y)$.
$ &phi(x) = phi(psi(lambda v + mu w)) = lambda v + mu w
\ &phi(y) = phi(lambda psi (v) + mu psi (w)) = lambda phi psi (v) + mu phi psi (w) = lambda u + mu w
$
כלומר $phi(x) = phi(y)$ $arrow.double.l.long^(phi "חח״ע של")$ $x=y$. זה מוכיח ש-$psi$ לינארית.
מדוע $psi$ יחידה: אם $psi_1, psi_2$ שמקיימות את $(*)$: $ phi psi_1 (x) &=x \ phi(psi_2 (x)) &= x $
ונובע מחח״ע $psi_1(x) = psi_2(x)$. #QED
|
|
https://github.com/Myriad-Dreamin/apollo-typst | https://raw.githubusercontent.com/Myriad-Dreamin/apollo-typst/main/README.md | markdown | # apollo-typst
Typst blog template based on [Zola](https://getzola.org), [typst.ts](https://github.com/Myriad-Dreamin/typst.ts), and [apollo](https://github.com/not-matthias/apollo).
## Features
- Full functionality of [Zola](https://getzola.org) and [apollo](https://github.com/not-matthias/apollo).
- Supports both markdown and [typst](https://typst.app/).
## Usage
### Preparation
- Install `make`, `cargo`, and `yarn`.
- Install dependencies: `yarn install`, `yarn install:bin`.
- Configure your own blog in `config.toml`. Full configuration options can be found in the [apollo documentation](https://github.com/not-matthias/apollo/blob/main/content/posts/configuration.md).
### Write posts with Typst
- Create a new typst workspace under the `typst` directory and write your post with Typst.
- Create a `.md` file in the `content` directory and write the metadata of the post in the front matter. Then, add the `extra.typst` field to the front matter, specifying the name of the typst workspace. The content of the markdown file will be ignored; instead, the content from the typst file will be utilized. For an example, refer to `content/posts/test.md`.
- If the typst output has its own title, you can set `extra.hide_title = true` to prevent zola from generating a redundant title.
### Build
```shell
# If you updated the frontend
yarn build:frontend
# If you updated the typst
yarn build:typ
# Final zola build
yarn build
```
### Develop
```shell
yarn serve
```
### Deployment[WIP]
To deploy your site to GitHub Pages, you can use the provided GitHub Action:
`.github/workflows/deploy.yml`:
```yaml
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: ../.github/actions/deploy-action@main
with:
access-token: ${{ secrets.ACCESS_TOKEN }}
deploy-branch: static
# deploy-repo: another/repo
```
|
|
https://github.com/akrantz01/resume | https://raw.githubusercontent.com/akrantz01/resume/main/template/skills.typ | typst | MIT License | #import "common.typ": section
#let skills(title: "Skills", settings: (:), omit: (), ..entries) = {
section(title)
block(
above: 0.7em,
below: 1em,
entries.named().pairs().map(((name, list)) => box[
*#name*:
#list.join(", ")
]).join(v(-0.25em)),
)
}
|
https://github.com/r8vnhill/apunte-bibliotecas-de-software | https://raw.githubusercontent.com/r8vnhill/apunte-bibliotecas-de-software/main/Unit2/Encapsulation.typ | typst |
== Encapsulamiento
Técnica de ocultamiento de los datos de un objeto de manera que solo se pueda cambiar mediante las funciones definidas para ese objeto
Restringe el acceso directo a algunos de los componentes del objeto
*Modificadores de visibilidad*
#table(
columns: (auto, auto),
align: horizon,
table.header(
"Modificador", "Visibilidad"
),
`public`, [Accesible desde cualquier parte del código],
`private`, [Accesible solo desde la clase que lo contiene],
`protected`, [Accesible desde la clase que lo contiene y sus subclases],
`internal`, [Accesible solo desde el módulo que lo contiene]
) |
|
https://github.com/Jeomhps/datify | https://raw.githubusercontent.com/Jeomhps/datify/main/src/formats.typ | typst | MIT License | #import "utils.typ": first-letter-to-upper, pad, safe-slice
#import "translations.typ": month-name, day-name
#import "config.typ": default-date-lang
#let custom-date-format = (date, format, ..args) => {
// Default values
let lang = default-date-lang
// Process variable arguments to extract lang
for arg in args.pos() {
if type(arg) == "string" {
lang = arg
}
}
// Take all the information, stock it and reformat it.
let day = pad(date.day(), 2)
let month = pad(date.month(), 2)
let year = str(date.year())
let weekday = date.weekday()
let short-year = year.slice(-2)
// Uses the name function to return name in the correct languages
let full-day = day-name(int(weekday), lang)
let full-month = month-name(int(month), lang)
// Correct name for the language with and uppercase at the start
let capitalized-day = first-letter-to-upper(full-day)
let capitalized-month = first-letter-to-upper(full-month)
// Correct name for the language fully written in uppercase
let uppercase-day = upper(full-day)
let uppercase-month = upper(full-month)
// Short name for months, i.e January = Jan
let short-month-name = if full-month.len() > 3 { safe-slice(full-month, 3) } else { full-month }
// Format the arg format in the right form and returns it.
let formatted = format
// Day formats
.replace("DD", day)
.replace("day", full-day)
.replace("Day", capitalized-day)
.replace("DAY", uppercase-day)
// Month formats
.replace("MMMM", capitalized-month)
.replace("MMM", short-month-name)
.replace("MM", month)
.replace("month", full-month)
.replace("Month", capitalized-month)
.replace("MONTH", uppercase-month)
// Year formats
.replace("YYYY", year)
.replace("YY", short-year)
return formatted
}
|
https://github.com/hexWars/resume | https://raw.githubusercontent.com/hexWars/resume/main/typst/main.typ | typst | MIT License | #import "resume.typ": *
#show: doc => header(
name: [
陌生人
],
describe: [
描述
],
socials: (
(
describe: "blog.site",
icon: "house-solid.svg",
link: "https://blog.site",
),
(
describe: "job.gmail.com",
icon: "envelope-solid.svg",
link: "mailto:<EMAIL>",
),
(
describe: "135500222",
icon: "phone-solid.svg",
link: "mailto:<EMAIL>",
),
(
describe: "github/xxx",
icon: "github.svg",
link: "https://github.com",
),
(
describe: "asdf",
icon: "weixin.svg",
link: "mailto:<EMAIL>",
),
),
doc,
)
#place(
top + right,
dx: 6pt,
dy: 0pt,
line(
start: (0%, 11.1%),
end: (0%, 0%),
length: 4cm,
stroke: 6pt + rgb(0, 122, 122),
)
)
#place(
bottom + left,
dx: -33pt,
dy: -90pt,
box[
#rotate(-90deg, origin: left, text(size: 20pt, weight: 6000)[<EMAIL>])
]
)
#place(
bottom + left,
dx: -30pt,
dy: 90pt,
box[
#line(
start: (0%, 25%),
end: (0%, 0%),
length: 4cm,
stroke: 6pt + rgb(0, 122, 122),
)
]
)
#cv_section(title: "教育经历", color: blue)
#lorem(80)
#cv_section(title: "教育经历")
#lorem(80)
#cv_section(title: "教育经历", color: yellow)
- #lorem(10)
- #lorem(10)
- #lorem(10)
#cv_section(title: "教育经历", color: red)
#lorem(80)
#let alert(body, fill: red) = {
set text(white)
set align(center)
rect(
fill: fill,
inset: 6pt,
radius: 5pt,
[*#body*],
)
}
|
https://github.com/Robotechnic/diagraph | https://raw.githubusercontent.com/Robotechnic/diagraph/main/README.md | markdown | MIT License | # diagraph
A simple Graphviz binding for Typst using the WebAssembly plugin system.
## Usage
### Basic usage
<!--EXCLUDE-->
This plugin is quite simple to use, you just need to import it:
```typ
#import "@preview/diagraph:0.3.0": *
```
<!--END-->
You can render a Graphviz Dot string to a SVG image using the `render` function:
```typ
#render("digraph { a -> b }")
```
Alternatively, you can use `raw-render` to pass a `raw` instead of a string:
<!--EXAMPLE(raw-render)-->
````typ
#raw-render(
```dot
digraph {
a -> b
}
```
)
````

For more information about the Graphviz Dot language, you can check the [official documentation](https://graphviz.org/documentation/).
### Advanced usage
Check the [manual](https://raw.githubusercontent.com/Robotechnic/diagraph/main/doc/manual.pdf) for more information about the plugin.
<!--EXCLUDE-->
## Build
This project was built with emscripten `3.1.46`. Apart from that, you just need to run `make wasm` to build the wasm file. All libraries are downloaded and built automatically to get the right version that works.
There are also some other make commands:
- `make link`: Link the project to the typst plugin folder
- `make clean`: Clean the build folder and the link
- `make clean-link`: Only clean the link
- `make compile_database`: Generate the compile_commands.json file
- `make module`: It copy the files needed to run the plugin in a folder called `graphviz` in the current directory
- `make manual`: Generate the manual pdf
- `make wasi-stub`: Build the wasi stub executable, it require a rust toolchain properly configured
### Wasi stub
Somme functions need to be stubbed to work with the webassembly plugin system. The `wasi-stub` executable is a spetial one fitting the needs of the typst plugin system. You can find the source code [here](https://github.com/astrale-sharp/wasm-minimal-protocol/tree/master). It is important to use this one as the default subbed functions are not the same and the makefile is suited for this one.
### Protocol generator
This package also uses a protocol generator to generate the wasm interface. You can find the source code [here](https://github.com/Robotechnic/WebAssembly-protocol-generator). It is a required dependency to build this project.
<!--END-->
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
## Changelog
### 0.3.0
- Added support for edge labels
- Added a manual generated with Typst
- Updated graphviz version
- Fix an error in math mode detection
### 0.2.5
- If the shape is point, the label isn't displayed
- Now a minimum size is not enforced if the node label is empty
- Added support for font alternatives
### 0.2.4
- Added support for xlabels which are now rendered by Typst
- Added support for cluster labels which are now rendered by Typst
- Fix a margin problem with the clusters
### 0.2.3
- Updated to typst 0.11.0
- Added support for `fontcolor`, `fontsize` and `fontname` nodes attributes
- Diagraph now uses a protocol generator to generate the wasm interface
### 0.2.2
- Fix an alignment issue
- Added a better mathematic formula recognition for node labels
### 0.2.1
- Added support for relative lenghts in the `width` and `height` arguments
- Fix various bugs
### 0.2.0
- Node labels are now handled by Typst
### 0.1.2
- Graphs are now scaled to make the graph text size match the document text size
### 0.1.1
- Remove the `raw-render-rule` show rule because it doesn't allow use of custom font and the `render` / `raw-render` functions are more flexible
- Add the `background` parameter to the `render` and `raw-render` typst functions and default it to `transparent` instead of `white`
- Add center attribute to draw graph in the center of the svg in the `render` c function
### 0.1.0
Initial working version
|
https://github.com/voXrey/cours-informatique | https://raw.githubusercontent.com/voXrey/cours-informatique/main/typst/theorie_des_ordres.typ | typst | #import "@preview/codly:0.2.1": *
#show: codly-init.with()
#codly()
#set text(font: "New Computer Modern Sans")
= Théorie des Ordres
== 1. Premières Définitions
Cette section introduit du vocabulaire sur les ordres en s’appuyant sur un parallèle avec les graphes, notamment certaines notions introduites dans le DM d’Avril (sujet Mines MP 2014).
=== Contexte
Dans tout le chapitre, $X$ désigne un ensemble et $R$ une relation sur $X$.
=== Rappel
Une relation est tout simplement un sous-ensemble $R subset X times X$. Pour $(x, y) in X^2$, on note $x R y$ au lieu de $(x, y) in R$.
=== Parallèle
Un graphe est la donnée d’un ensemble fini de sommets $V$ et d’un ensemble d’arcs $E subset.eq V times V$. Mis à part que $V$ est fini, il s’agit exactement du même contexte. Nous allons donc introduire les définitions propres aux relations avec un parallèle dans le vocabulaire des graphes. Le fait que $V$ soit infini ne pose aucun problème, on se restreint aux graphes finis en MP2I pour faire de l’algorithmique, mais les graphes infinis sont largement étudiés en mathématiques.
=== Définitions
- $R$ est *réflexive* ssi : $forall x in X : x R y$.
- Vision graphe : il y a une boucle sur chaque sommet (comme dans le sujet Mines MP 2014).
- $R$ est *irréflexive* ssi : $forall x in X, not(x R y)$.
- Vision graphe : il n’y a aucune boucle dans le graphe.
- $R$ est *transitive* ssi : $forall (x, y, z) in X^3 : (x R y and y R z) ==> x R z$.
- On appelle *clôture réflexive transitive* $R$ la relation notée $R\*$ définie par : $x R\* y <==> exists n in NN : exists z_0, dots, z_n in X : x = z_0 R z_1 R dots R z_(n-1) R z_n = y$
- Vision graphe : la clôture transitive transforme les chemins en arêtes : il y a une arête $(x, y)$ dans le graphe $(X, R\*)$ si et seulement s’il y a un chemin de $x "à" y$ dans le graphe $(X, R)$.
- $R$ est *antisymétrique* ssi : $forall x, y in X, x R y and y R x ==> x = y$.
- Vision graphe : il n’y a pas de cycle simple de longueur exactement 2 ; ou encore tout cycle de longueur 2 est en fait une boucle prise 2 fois. Si la relation est également transitive, l’antisymétrie est équivalente à l’acyclicité du graphe (si on ignore les boucles !).
- $R$ est *totale* ssi : $forall x, y in X, x R y or y R x$.
- Vision graphe : celle-ci ne se visualise pas bien, on peut dire que le graphe non orienté sous-jacent est complet, mais ce n’est pas très parlant. On aura une meilleure vision graphe pour les *ordres totaux*.
=== Vocabulaire de la théorie des ordres
- *Pré-ordre* = réflexif + transitif.
- *Ordre strict* = irréflexif + transitif.
- *Ordre* (aka ordre partiel) = réflexif, transitif, antisymétrique.
- *Ordre total* = ordre partiel + total.
- AKA ordre linéaire. Pourquoi linéaire ? Nous y venons.
Exemples : on dessine,
- $NN$ muni de l’ordre naturel
- $ZZ$ muni de l’ordre naturel
- $P({0, 1, 2})$ muni de $subset.eq$
- $NN$ muni de l’ordre de divisibilité
- $ZZ$ muni de l’ordre de divisibilité est un pré-ordre : à cause de $n "et" -n$. Autre exemple du même genre ?
Culture générale : ces dessins s’appellent *diagrammes de Hasse*. Lorsque l’on dessine un ordre $(X, <=)$, on dessine en réalité le graphe $(X, R)$ où $<= "=" R\*$ pour une relation $R$ aussi "petite" que possible. Y a-t-il un minimum ? Considérez l’ensemble des réels, ou encore $NN union {+infinity}$.
=== 1.1. Les Ordres Linéaires
Quelle forme a le diagramme de Hasse d’un ordre total ? D’où le nom *linéaire*.
- Soit $<=$ un ordre partiel et $lt.eq.curly$ un ordre total tel que : $forall x, y in X, x <= y ==> x lt.curly.eq$. En théorie des ensembles, cela s’écrit plus simplement : $<= subset.eq lt.eq.curly.$. On dit que $lt.curly.eq$ est une *linéarisation* de $<=$. Exemple : une linéarisation de $P({0, 1, 2})$.
- Rappel : on appelle *tri par comparaison* un algorithme de tri qui trie un tableau en basant uniquement ses décisions sur des questions de $"if" x <= y "then" dots "else" dots$. Tous les algorithmes de tri par comparaison que vous connaissez supposent implicitement que si la branche `else` correspond à $x > y$. Autrement dit, ces algorithmes supposent que l’ordre est total. Que produit l’algorithme si on l’utilise sur un ordre partiel ? Il produit un tableau trié selon une certaine linéarisation. La linéarisation choisie va essentiellement dépendre de si l’algorithme teste $x <= y$ ou $y <= x$ en premier. Il se peut même que deux occurrences d’un même élément ne se trouve pas à côté dans le tableau trié, on peut intercaler des éléments incomparables, ou équivalents (deux éléments $x, y$ sont incomparables si $x lt.eq.not "et" y lt.eq.not x$ ; équivalents si au contraire $x <= y "et" y <= x$).\
Ce n’est pas surprenant : la spécification d’un algorithme de tri sur un ordre partiel est incomplète : il n’y a pas unicité du tableau trié qui est une permutation du tableau initial.
- Nous avons vu cette année un algorithme qui permet de calculer une linéarisation d’un ordre partiel (dans le cas où l’ordre est fini). Nommez cet algorithme : *tri topologique*
=== 1.2. Passage d’un pré-ordre à un ordre partiel (hors programme)
- Comme vu plus haut, tout graphe acyclique peut être vu comme un ordre partiel (quitte à en prendre la clôture réflexive transitive) et réciproquement, le diagramme de Hasse d’un ordre partiel est un graphe acyclique (que l’on dessine les arêtes transitives ou non).
- Pour un pré-ordre c’est encore plus simple : n’importe quel graphe peut être vu comme un pré-ordre, quitte à en prendre la clôture réflexive transitive. Prenons donc un graphe quelconque ( G \= (V, E) ) et considérons deux éléments ( x, y ) qui mettent en défaut l’anti-symétrie : on a ( x y ) et ( y x ). Ce sont donc deux éléments tels qu’il y a un chemin dans ( G ) de $x$ à $y$ ET un chemin de $y$ à $x$. Autrement dit, $x$ et $y$ sont dans la même composante fortement connexe. Ce sont donc les composantes fortement connexes qui posent problème, il suffit de les réduire à un point : on considère le graphe de composantes fortement connexe défini dans le cours de graphe, et justement nous avons vu qu’il est acyclique ! Il correspond donc bien à un ordre partiel et si la définition de pré-ordre de départ s’il est acyclique, on peut dire que le quotient en pré-ordre est justement parfait de "quotient par une relation d’équivalence".
- Dans le sujet Mines MP 2014, c’est là fin du sujet avec la notion "d’axiomatique". Une axiomatique consiste à choisir exactement un élément par composante fortement connexe, c’est à dire un représentant par classe d’équivalence, car vous l’aviez bien remarqué : les composantes fortement connexes sont les classes d’équivalence pour la relation ( E ) définie par ( xREy ) s’il existe un chemin de $x$ à $y$ et de $y$ à $x$. Choisir un représentant par classe ou interpréter la classe comme un seul élément c’est la même chose, ce sont deux définitions équivalente du quotient par une relation d’équivalence.
=== 1.3 Ordre Strict associé à un Ordre
Soit $<=$ un ordre partiel, alors on définit l’ordre strict associé noté $<$ par :
$
x < y <==> x <= y and x eq.not y
$
Cette définition ne convient plus si on travaille avec un pré-ordre (hors programme) : si $x "et" y$ sont dans la même composante fortement connexe, on va avoir $x < y "et" y < x$ puis par transitivité $x < x$ ce qui est impossible par irréflexivité. Il faut donc définir $<$ ainsi :
$
x < y <==> x <= y or x gt.eq.not y
$
=== 1.4. Majorant, Maximum et Éléments Maximaux
==== Définitions
Soit $S$ une partie de $X$ :
- $A in X$ est un majorant de $S$ si : $forall x in S, x <= A$.
- $A in X$ est un maximum de $S$ ssi $A$ est un majorant de $A in S$. On dit alors que $S$ admet un maximum.
- $A$ est un élément maximal de $S$ si : $forall x in S, x gt.not A$.
On a bien évidemment les définitions duales : minorant, minimum et élément minimal.
==== Remarques et Mises en garde
- Les ensembles ordonnés que vous pratiquez ont la mauvaise manie d’être totaux $(NN, ZZ, RR, dots)$ et vous êtes donc tentés de confondre un ordre maximal et maximum. Avec des ordres partiels, cela ne reflète pas notre intuition : quels sont les éléments maximaux de $P(E)\{E}$ pour E = {0, 1, 2} ?
- En remplaçant $x < y$ par sa définition :
$
x "élément maxiaml de" X <==> forall y in X, y >= x ==> x = y
$
et avec la définition plus générale de $x < y$ valable dans les pré-ordres :
$
x "élément maxiaml de" X <==> forall y in X, y >= x ==> x >= y
$
Vous retrouverez ainsi la définition des "axiomes" du sujet Mines MP 2014.
==== Petits exercices d’entraînement
- Montrer qu’un ordre qui admet un maximum a un unique élément maximal.
- Montrer que la réciproque est fausse.
- Donner les éléments maximaux et minimaux de $NN$ muni de l’ordre "divisibilité". Et de $NN\{0, 1}$?
- Majorant de $S$ : 0
- Maximum de $S$ : il n'y en a pas
- Elément max : non plus
- Minorant : 1
- Minimum : Il n'y en a pas
- Elément min : non plus
- Donner une condition suffisante sur l’ordre pour avoir "il existe un maximum ssi il existe un élément maximal".
=== 1.5. Vocabulaire de la théorie des ordres qui provient de la vision graphe
- Si $x < y$ on dit que $y$ est un *successeur* de $x$ et $x$ un *prédécesseur* de $y$.
- Si $x < y$ et il n’existe aucun $z in X$ tel que $x < z < y$, alors $y$ est un *successeur immédiat* de $x$, et $x$ est un *prédécesseur immédiat* de $y$.
- Un élément maximal est donc exactement un élément sans successeur, et un élément minimal est exactement un élément sans prédécesseur.
- Un maximum n’a pas de successeur, mais la réciproque est fausse : il existe des éléments sans successeur qui ne sont pas des maximums.
- Un majorant de $S$ est un élément accessible depuis tous les éléments de $S$ (accessible au sens *il existe un chemin*).
Exemple : $NN union {infinity}$, l’infini n’a ni prédécesseur immédiat ni successeur.
== 2. Construction sur les Ordres
Soit $(X, <=_x)$ et $(X, <=_y)$ deux ordres (partiels).
- Somme disjointe : $(X union.sq Y, <=_(union.sq))$. L'ensemble $X union.sq Y$ désigne la somme disjointe de $X "et" Y$, et l'ordre est défini par :
$
a <=_(union.sq) b <==> (a, b in X and a lt.eq_X b) or (a, b in Y and a lt.eq_Y b)
$
- La somme lexicographique : $(X union.sq Y, <=_+)$ où l'ordre est défini par :
$
a <=_+ b <==> (a, b in X and a lt.eq_union.sq b) or (a in X and b in Y)
$
- Le produit cartésien : $(X times Y, lt.eq_X)$ où l'ordre est défini par :
$
(x_1, y_1) lt.eq_X (x_2, y_2) <==> x_1 lt.eq_X x_2 and y_1 lt.eq_Y y_2
$
- Le produit lexicographique : $(X times Y, lt.eq_("lex"))$ où l'ordre est défini par :
$
(x_1, y_1) lt.eq_("lex") (x_2, y_2) <==> x_1 lt_X x_2 or (x_1 = x_2 and y_1 lt.eq_Y y_2)
$
== 3. Relation <NAME>
*Définition :* Soit $(X, lt.eq)$ i, espace ordonné. Il est bien fondé ssi il n'existe pas de suite infinie strictement décroissante : $x_0 > x_1 > x_2 > dots > x_n > dots$
*Théorème :* Soit $(X, lt.eq)$ un espace ordonné, les propositions suivantes sont équivalentes :
1. $(X, lt.eq)$ est bien fondé
2. Toute suite strictement décroissante est finie
3. Toute suite décroissante est stationnaire
4. Toute partie $S subset.eq X$ non vide a un élément minimal
5. Le principe de récurrence est valide sur $(X, lt.eq)$
*Principe de récurrence :* Soit $P$ une propritété sur $X$.
$
[forall x in X, (forall y in X, y < x ==> P(y)) =>(x)] ==> forall x in X, P(x)
$
*Exemple :* $X = NN$ et $lt.tri$ la relation telle que $n lt.tri m <==> m = n + 1$
Montrons $forall n in NN, P(n)$ par récurrence.
Pour cela il suffit de montrer $[forall n in NN, (forall y in NN, y lt.tri x ==> P(y)) =>(n)]$
Soit $n in NN$, on suppose que $forall y in NN, y lt.tri n ==> P(y)$.
Hypothèse : $forall y in NN, y lt.tri n ==> P(y)$
Disjonction de cas :
1. Soit $n=0$, auquel cas $exists.not y : y lt.tri n$ donc l'hypothèse est une tautologie et je dois montrer $P(n)$ sans aide, c'est le cas de base, je montre $P(0)$.
2. Sinon $n > 0$, et mon hypothèse se reformule en $P(n-1)$. Je dois donc montrer $P(n)$ en supposant $P(n-1)$, c'est l'hérédité.
*Sur les arbres :* $lt.tri "tel que" cases(G lt.tri T(G, D), D lt.tri T(G, D))$
*Sur les formules logiques :* (ensemble inductif) $"sous-formule" lt.tri "formule"$\
$E_0 = {top, bot, "var"}$.
*Démonstrations :*\
- $1 ==> 2$ : pas de suite infini $<==>$ les suites sont finies
- $1 ==> 3$ : Prenons $v_n$ suite strictement décroisssante
- Si elle est finie alors elle stationne
- Si elle est infinie alors elle ne peut pas être strictement décroissante, donc elle stationne
- $3 ==> 1$ : idem
- $1 ==> 4$ : Par l'absurde, soit $S subset.eq X$ n'ayant pas d'élément minimal
- On choisit $x_0 in S$ quelconque
- Comme $S$ n'a pas d'élément minimal, $exists x_1 in S : x_1 < x_0$
- On réitère ce raisonnement pour construire une suite $infinity$ strictement décroissante\
$
x_0 > x_1 > x_2 > x_3> dots
$
- C'est impossible car $X$ est bien fondé, donc $forall S subset.eq X, S$ admet un élément minimal.
- $4 ==> 5$ : On veut montrer $A ==> B$ avec $cases(B = forall x in X : P(x), A = [forall x in X : C ==> P(x)])$\
On suppose $A$ et on montre $B$
- Soit $S = {x in X | P(x) "est faux"}$
- Par l'absurde, supposons $S eq.not emptyset$.
- Alors par 4, $S$ admet un élément minimal $x in S$
- Cest-à-dire $forall y in X, y < x ==> y in.not S$
- Par définition de $S$ : $forall y in X, y < x ==> P(y)$
- Or $C = forall y in X, y < x ==> P(y)$
- Donc comme on a supposé $A$, on obtient que $P(x)$ est vrai, or $s in S$ donc $P(x)$ est faux.
- C'est absurde, donc $S = emptyset$. Autrement dit, $forall x in X, x in.not S$, soit exactement $B$.
- $5 ==> 1$ : Par l'absurde supposons qu'il existe $x_0 > x_1 > dots > x_n > dots$ une suite $infinity$ strictement décroissante.
- On considère la propriété $P(x) : \"forall i in NN, x eq.not x_i\"$.\
Montrons $P$ par récurrence :
- Il suffit de montrer $A = forall x in X, (forall y in X, y < x ==> P(y)) ==> P(x)$
- Soit $x in X$, supposons que $forall y in X, y < x ==> P(y)$ et montrons que $P(x)$
- Il y a deux cas :
- Si $forall i in NN, x eq.not x_i$, alors $P(x)$
- Sinon $exists i_0 in NN : x = x_i_0$. Or $x_(i_0 + 1) > x_i_0$ et on a supposé $forall y in X, y < x ==> P(y)$. En prenant $y = x_(i_0 + 1)$ on obtient $P(x_(i_0+1))$ ce qui est faux, donc l'implication est vraie.
Clarification : Avec $F = (forall y in X, y < x ==> P(y))$ on voulait montrer $F ==> P(x)$ et on a montré que $F$ est faux, donc l'implication est vraie.\
Donc on a montré $A$, par principe de récurrence on en déduit $B = forall x in X, P(x)$ ce qui est absurde.
== 4. Application à la Terminaison
=== 4.1. Programme Récursifs
|
|
https://github.com/Mc-Zen/tidy | https://raw.githubusercontent.com/Mc-Zen/tidy/main/tests/test_helping.typ | typst | MIT License | #import "/src/tidy.typ"
#let heymath = ```
#import "vector.typ": *
///
#let cos(x) = {}
///
#let pi-squared =
```.text
#let vector = ```
///
#let vec-add()
///
#let vec-subtract()
```.text
#let matrix = ```
#import "solve.typ"
/// - n (int): dimension
#let id(n)
```.text
#let solve = ```
///
#let solve(n)
```.text
#let help(..args) = {
let namespace = (
".": (() => heymath, () => vector),
"matrix": () => matrix,
"matrix.solve": () => solve
)
tidy.generate-help(
namespace: namespace,
package-name: "heymath",
onerror: msg => block(msg)
)(..args)
}
#help("pi-squared")
#let assert-not-failed(help-result) = {
assert.eq(
help-result.child.body.children.at(1)
.child.children.first().fill,
rgb("#d8dbed44")
)
}
// Valid calls
#assert-not-failed(help("cos"))
#assert-not-failed(help("pi-squared"))
#assert-not-failed(help("vec-add"))
#assert-not-failed(help("vec-subtract"))
#assert-not-failed(help("matrix.id"))
#assert-not-failed(help("matrix.solve.solve"))
// #assert-not-failed(help("matrix.id(n)"))
#help("matrix.id(n)")
// Invalid definition
#assert.eq(
help("ma"),
tidy.helping.help-box(block("The package `heymath` contains no (documented) definition `ma`"))
)
// Invalid submodule
#assert.eq(
help("matrixs.id"),
tidy.helping.help-box(block("The package `heymath` contains no module `matrixs`"))
)
// Invalid submodule
#assert.eq(
help("matrix.id(aaaa)"),
tidy.helping.help-box(block("The function `matrix.id` has no parameter `aaaa`"))
)
// Invalid submodule
#assert.eq(
help("cos(aaaa)"),
tidy.helping.help-box(block("The function `cos` has no parameter `aaaa`"))
)
// #help("vec-add")
// #help("vec-subtract")
// #help("matrixs.id")
// #help("matrix.asd")
// #help("matrix.solve.solve")
// #help("cos(x)")
// #help("matrix.id")
#help(search: "vec") |
https://github.com/Slyde-R/not-jku-thesis-template | https://raw.githubusercontent.com/Slyde-R/not-jku-thesis-template/main/template/content/Methodology.typ | typst | MIT No Attribution | #import "../utils.typ": todo, silentheading, flex-caption
= Methodology
#todo[Replace this chapter!]
== Research Design
This study employs a mixed-methods approach to comprehensively investigate feline manipulation tactics and their effects on human behavior. By combining qualitative and quantitative methods, the research aims to provide a detailed understanding of the specific behaviors cats use to influence their human companions, as well as the psychological and emotional impacts of these behaviors.
== Participants
=== Feline Subjects
The study includes a sample of domestic cats from diverse backgrounds to ensure a broad understanding of feline manipulation tactics. Cats are selected based on criteria such as age, breed, and living conditions, with the goal of representing a variety of typical domestic scenarios. The following images are examples of the participating cats:
- <NAME>: female, ragdoll, 11 years
#figure(
image("../images/MissMoneypenny.jpg", width: 60%), caption: flex-caption([Beautiful cat named <NAME>],[Picture of Miss Moneypenny])
)<MissMoneypenny>
- <NAME>: male, ragdoll, 11 years
#figure(
image("../images/JamesBond.jpg", width: 60%), caption: flex-caption([Charming cat named <NAME>],[Picture of James Bond])
)<JamesBond>
- Calcipher: male, oriental short hair, 4 months
#figure(
image("../images/Calcipher.jpg", width: 60%), caption: flex-caption([Adorable kitten named Calcipher],[Picture of Calcipher])
)<Calcipher>
- Mei: female, oriental short hair, 4 months
#figure(
image("../images/Mei.jpg", width: 60%), caption: flex-caption([Cute kitten named Mei],[Picture of Mei])
)<Mei>
=== Human Subjects
Human participants are recruited from households with cats to observe interactions and gather insights into the impact of feline behavior. Inclusion criteria include having lived with the cat for at least six months to ensure familiarity with the cat's behavioral patterns. Participants are selected to represent a range of demographics to capture diverse experiences.
== Data Collection Methods
Observational Study
Observations are conducted in naturalistic settings to document feline behaviors and their impact on human responses. Cats and their human companions are observed over a period of six weeks, focusing on interactions related to manipulation tactics such as vocalizations, body language, and attention-seeking behaviors. Observations are recorded using video and field notes to capture detailed instances of manipulation.
Surveys and Interviews
Surveys are distributed to human participants to gather quantitative data on their perceptions of feline behavior and its effects on their daily routines and emotional well-being. The survey includes questions about the frequency of specific behaviors, perceived manipulative tactics, and changes in human behavior as a result.
In-depth interviews are conducted with a subset of participants to explore their experiences and insights in greater detail. Interviews focus on specific instances of feline manipulation and its impact on household dynamics and personal feelings. The interviews are semi-structured, allowing flexibility to explore relevant topics that arise during the conversation.
== Data Analysis
=== Qualitative Analysis
Data from observations and interviews are analyzed using thematic analysis to identify common patterns and themes in feline manipulation tactics and human responses. Key behaviors and strategies are categorized, and the relationships between these behaviors and human reactions are explored.
==== Quantitative Analysis
Survey data are analyzed using statistical techniques to quantify the prevalence of specific behaviors and their perceived impact. Descriptive statistics, such as frequency distributions and measures of central tendency, are used to summarize the data. Inferential statistics, such as correlation and regression analyses, are employed to examine relationships between feline behaviors and changes in human routines and emotions.
== Ethical Considerations
Ethical approval is obtained from the relevant institutional review board (IRB) to ensure that all research activities adhere to ethical standards. Informed consent is obtained from all human participants, and confidentiality is maintained by anonymizing personal data. Feline subjects are observed in their natural environment without any intervention that could affect their well-being.
== Limitations
The study acknowledges potential limitations, including the observational nature of the research, which may introduce observer bias. Additionally, the sample size for both feline and human participants may limit the generalizability of the findings. Efforts are made to minimize these limitations by employing rigorous data collection and analysis methods. |
https://github.com/jamesrswift/pixel-pipeline | https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/src/lib.typ | typst | The Unlicense | #import "package.typ": package
#import "pipeline/lib.typ" as pipeline: factory, primitives
#import "layers/lib.typ" as layer
#import "primitives/lib.typ" as primitives
#import "math/lib.typ" as math |
https://github.com/takotori/PhAI-Spick | https://raw.githubusercontent.com/takotori/PhAI-Spick/main/sections/energie.typ | typst | = Energie $E$
#grid(
columns: (auto, auto),
gutter: 5pt,
[*Kinetische Energie*], [$ E_k = 1/2 m v^2 $],
[*Potenzielle Energie*], [$ E_p = m g h $],
[*Spannenergie einer Feder*], [$ E_F = 1/2 D y^2 $],
[*Energieerhaltungssatz*], [$ E_"tot" = sum_i E_i = "konst." $]
)
#v(-10pt)
#block(
inset: 10pt,
[
$E_"tot"$: Gesamtenergie im abgeschlossenen System \
$E_i$: Teilenergie
]
)
#v(-10pt)
*Energieerhaltung potenzielle Energie => Feder:*
$m g(h+y)=1/2 D y^2$
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/g-exam/0.1.0/README.md | markdown | Apache License 2.0 | # g-exam
Template to create exams with header, school letterhead, grade chart, ...
## Features
- Scoreboard.
- Scoring by questions and subquestions.
- Student information, on the first page or on all odd pages.
- Question and subcuestion.
- List of clarifications.
- Teacher's Watermark
- Exam Model Watermark
# Examples
### Minimal Example
``` typ
#import "@preview/g-exam:0.1.0": g-exam, g-question, g-subquestion
#show: g-exam.with(
#g-question(point: 2)[Question 1]
#v(1fr)
#g-question(point: 2)[Question 1]
#v(1fr)
)
```
### Minimal Example with sub-question
``` typst
#import "@preview/g-exam:0.1.0": g-exam, g-question, g-subquestion
#show: g-exam.with(
#g-question[Question 1]
#g-subquestion[Question 1]
#v(1fr)
#g-subquestion[Question 1]
#v(1fr)
#g-subquestion(point: 2)[Question 1]
#v(1fr)
)
```
### Full sample of an exam.
1. [Example of exam with punctuation](examples/exam-001.pdf)
1. [Example of exam with question only](examples/exam-002.pdf)
1. [Example of exam with subquestion](examples/exam-003.pdf)
1. [Example of exam with punctuation](examples/exam-005.pdf)
# Usage
To use this package, simply add the following code to your document:
### g-exam
Generate the skeleton of an exam, entering a header, student information, grade table, watermarks, ...
#### Parameters of `g-exam`
- **author**:
- **name**: Name of author of document.
- **email**: e-mail of author of document.
- **watermark**: Watermark with information about the author of the document.
- **school**:
- **name**: Name of the school or institution generating the exam.
- **logo**: Logo of the school or institution generating the exam.
- **exam-info**:
- **academic-period**: Academic period.
- **academic-level**: Academic level
- **academic-subject**: Academic subject.
- **number**: Number of exam.
- **content**: Content of exam.
- **model**: Watermark with information about the exam model.
- **localization**: Location information, in case you want to change a parameter or your language is not supported.
- **grade-table-queston: Text question in grade table**.
- **grade-table-total: Text total in grade table**,
- **grade-table-points: Text points in grade table**,
- **grade-table-calification: Text calification in grade**,
- **point: Text point**,
- **points: Text points**.
- **page: Text page**,
- **page-counter-display**: Text page conter display.
- **family-name**: Text surname or family name in studen data.
- **personal-name**: Text name or personal name in studen data.
- **group**: Text gorup in studen data.
- **date**: Text date in studen data.
- **languaje**: (str) (en, es, de, fr, pt, it) Languages for Default Localization
- **decimal-separator*: (str) (".", ",") Decimal separator
- **date**: Date of document.
- **show-studen-data**: (none, str),
- **first-page**: Show studen data only in first page.
- **odd-pages**: Show studen data in all odd pages.
- `none`: Not show studen data.
- **question-point-position**: (none, left, right)
- **right**: Show question point on the right.
- **left**: Show question point on the left.
- `none`: Not show the question point.
- **show-grade-table**: (true, false) Show grade table,
- **clarifications**: (str, (:)) Text of clarifications for students.
- **body** (body): Body of exam.
#### Parameters of `g-question`
- **point**: (none, float) Points of the question.
- **body** (body): Body of question.
#### Parameters of `g-subquestion`
- **point**: (none, float) Points of the sub-question.
- **body** (body): Body of sub-question.
# Changelog
### v0.1.0
- Initial version submitted to typst/packages. |
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/loading/csv.typ | typst | --- csv ---
// Test reading CSV data.
#set page(width: auto)
#let data = csv("/assets/data/zoo.csv")
#let cells = data.at(0).map(strong) + data.slice(1).flatten()
#table(columns: data.at(0).len(), ..cells)
--- csv-row-type-dict ---
// Test reading CSV data with dictionary rows enabled.
#let data = csv("/assets/data/zoo.csv", row-type: dictionary)
#test(data.len(), 3)
#test(data.at(0).Name, "Debby")
#test(data.at(2).Weight, "150kg")
#test(data.at(1).Species, "Tiger")
--- csv-file-not-found ---
// Error: 6-16 file not found (searched at tests/suite/loading/nope.csv)
#csv("nope.csv")
--- csv-invalid ---
// Error: 6-28 failed to parse CSV (found 3 instead of 2 fields in line 3)
#csv("/assets/data/bad.csv")
--- csv-invalid-row-type-dict ---
// Test error numbering with dictionary rows.
// Error: 6-28 failed to parse CSV (found 3 instead of 2 fields in line 3)
#csv("/assets/data/bad.csv", row-type: dictionary)
|
|
https://github.com/jassielof/typst-templates | https://raw.githubusercontent.com/jassielof/typst-templates/main/apa7/lib.typ | typst | MIT License | #import "../utils/to-string.typ": *
#import "utils/languages.typ": *
#import "utils/authoring.typ": *
#import "utils/orcid.typ": *
#import "utils/addendum.typ": *
#let apa7(
title: [Paper Title],
authors: (:),
affiliations: (:),
custom-authors: [],
custom-affiliations: [],
// Student-specific fields
course: [],
instructor: [],
due-date: [],
// Professional-specific fields
running-head: [],
author-notes: [],
keywords: (),
abstract: [],
// Common fields
font-family: "Libertinus Serif",
font-size: 12pt,
region: "us",
language: "en",
paper-size: "us-letter",
implicit-introduction-heading: true,
toc: false,
body
) = {
let double-spacing = 1.5em
authors = validate-inputs(authors, custom-authors, "author")
affiliations = validate-inputs(affiliations, custom-affiliations, "affiliation")
set document(
title: title,
author: if type(authors) == array {
authors.map(it => plain-text(it.name))
} else {
plain-text(authors).trim(" ", at: start).trim(" ", at: end)
},
keywords: keywords,
)
set text(
size: font-size,
font: font-family,
region: region,
lang: language,
)
set page(
margin: 1in,
paper: paper-size,
numbering: "1",
number-align: top + right,
header: context {
upper(running-head)
h(1fr)
str(here().page())
}
)
set par(
leading: double-spacing,
spacing: double-spacing,
)
show link: set text(
fill: blue,
)
show link: it => {
underline(it.body)
}
if running-head != none and running-head != [] and running-head != "" {
if plain-text(running-head).len() > 50 {
panic("Running head must be no more than 50 characters, including spaces and punctuation.")
}
}
align(center)[
#for i in range(4) {
[~] + parbreak()
}
#strong(title)
~
#parbreak()
#print-authors(authors, affiliations, language)
#print-affiliations(authors, affiliations)
#if type(course) == content and course != [] {
course
} else if type(course) != content {
panic("Course must be of type content: ", type(course))
}
#if type(instructor) == content and instructor != [] {
instructor
} else if type(instructor) != content {
panic("Instructor must be of type content: ", type(instructor))
}
#if ((type(due-date) == content and due-date != []) or (type(due-date) == str and due-date != "")) {
due-date
} else if type(due-date) != content {
panic("Due date must be of type content or string: ", type(due-date))
}
#if author-notes != [] and author-notes != none {
v(1fr)
strong(get-terms(language).at("Author Note"))
align(left)[
#set par(first-line-indent: 0.5in)
#author-notes
]
}
#pagebreak()
]
show heading: set text(size: font-size)
show heading: set block(spacing: double-spacing)
show heading: it => emph(strong[#it.body.])
show heading.where(level: 1): it => align(center, strong(it.body))
show heading.where(level: 2): it => par(
first-line-indent: 0in, strong(it.body)
)
show heading.where(level: 3): it => par(
first-line-indent: 0in, emph(strong(it.body))
)
show heading.where(level: 4): it => strong[#it.body.]
show heading.where(level: 5): it => emph(strong[#it.body.])
set par(
first-line-indent: 0.5in,
leading: double-spacing,
)
show figure: set figure.caption(
position: top
)
show figure: set block(
breakable: true
)
show figure: it => {
it.caption
align(center, it.body)
}
set figure(
gap: 1.5em,
placement: none
)
show figure.caption: it => {
set par(first-line-indent: 0in)
align(left)[
*#it.supplement #context it.counter.display(it.numbering)*
#emph(it.body)
]
}
set table(
stroke: none,
)
set list(
marker: ([•], [◦]),
indent: 0.5in - 1.75em,
body-indent: 1.3em,
)
set enum(
indent: 0.5in - 1.5em,
body-indent: 0.75em,
)
set raw(
tab-size: 4,
block: true,
)
show raw.where(block: true): block.with(
fill: luma(230),
inset: 5pt,
radius: 10pt,
)
show raw: text.with(
font: "DejaVu Sans Mono",
size: 10pt
)
show figure.where(kind: raw): it => {
set align(left)
it.caption
it.body
}
show quote: set pad(left: 0.5in)
show quote: set block(spacing: 1.5em)
show quote: it => {
let quote-text = plain-text(it.body)
let quote-text-words = plain-text(it.body).split(" ").len()
if quote-text-words <= 40 {
set quote(block: false)
[
"#quote-text.trim(" ")"~#it.attribution.
]
} else {
set quote(block: true)
set par(hanging-indent: 0.5in)
[
#quote-text.trim(" ")~#it.attribution
]
}
}
set bibliography(
style: "apa",
)
if (toc) {
show outline.entry.where(level: 1): it => {
strong(it)
}
show outline.entry.where(level: 2): it => {
strong(emph(it))
}
show outline.entry.where(level: 3): it => {
emph(it)
}
show outline.entry.where(level: 4): it => {
it
}
outline(indent: 2em, depth: 4)
pagebreak()
}
if (type(abstract) == content and abstract != []) {
heading(level: 1, get-terms(language).Abstract)
par(first-line-indent: 0in)[
#abstract
]
emph(get-terms(language).Keywords)
[: ]
keywords.map(it => it).join(", ")
pagebreak()
} else if (type(abstract) != content) {
panic("Invalid abstract type, must of type content: ", type(abstract))
}
if implicit-introduction-heading {
heading(level: 1, title)
}
body
}
|
https://github.com/dangh3014/postercise | https://raw.githubusercontent.com/dangh3014/postercise/main/README.md | markdown | MIT License | # Postercise
**Postercise** allows users to easily create academic research posters with different themes using [Typst](https://typst.app).



## Getting started
You can get **Postercise** from the official package repository by entering the following.
```typ
#import "@preview/postercise:0.1.0": *
```
Another option is to use **Postercise** as a local module by downloading the package files into your project folder.
Next you will need to import a theme, set up the page and font, and call the `show` command.
```typ
#import themes.basic: *
#set page(width: 24in, height: 18in)
#set text(size: 24pt)
#show: theme
```
To add content to the poster, use the `poster-content` command.
```typ
#poster-content()[
// Content goes here
]
```
There are a few options for types of content that should be added inside the `poster-content`. The body of the poster can be typed as normal, or two box styles are provided to headings and/or highlight content in special ways.
```typ
#normal-box[]
#focus-box[]
```
Basic information like title and authors is placed as options using the `poster-header` script.
```typ
#poster-header(
title: [Title],
authors: [Author],
)
```
Finally, additional content can be added to the footer with the `poster-footer` script.
```typ
#poster-footer[]
```
Again, as a reminder, all of these scripts should be called from inside of the `poster-content` block.
Using these commands, it is easy to produce posters like the following:

## More details
### `themes`
Currently, 3 themes are available. Use one of these `import` commands to load that theme.
```typ
#import themes.basic: *
#import themes.better: *
#import themes.boxes: *
```
### `show: theme.with()`
Theme options allow you to adjust the color scheme, as well as the color and size of the content in the header. The defaults are shown below. (The 'better.typ' theme defaults to different titletext color and size.)
```typ
#show: theme.with(
primary-color: rgb(28,55,103), // Dark blue
background-color: white,
accent-color: rgb(243,163,30), // Yellow
titletext-color: white,
titletext-size: 2em,
)
```
### `poster-content()[]`
The only option for the main content is the number of columns. This defaults to 3 for most themes. For the "better.typ" theme, there is 1 column and content is placed in the leftmost column below `poster-header`.
```typ
#poster-content(col: 3)[
// Content goes here
]
```
### `normal-box()[]` and `focus-box()[]`
By default, these boxes use the no fill and the accent-color fill, respectively. However, they do accept color as an option, and will add a primary-color stroke around the box if a color is given. For the "better.typ" theme, use `focus-box` to place content in the center column.
```typ
#normal-box(color: none)[
// Content
]
#focus-box(color: none)[
// Content
]
```
### `poster-header()`
Available options for the poster header for most themes are shown below. Note that logos should be explicitly labeled as images. Logos are not currently displayed in the header in the "better.typ" theme.
```typ
#poster-header(
title: [Title],
subtitle: [Subtitle],
author: [Author],
affiliation: [Affiliation],
logo-1: image("placeholder.png")
logo-2: image("placeholder.png")
)
```
### `poster-footer[]`
This command does not currently have any extra options. The content is typically placed at the bottom of the poster, but it is placed in the rightmost column for the "better.typ" theme.
```typ
#poster-footer[
// Content
]
```
## Known Issues
- The bibliography does not work properly and must be done manually
- Figure captions do not number correctly and must be done manually
## Planned Features/Themes
- Themes that use color gradients and background images
- Add QR code generation
|
https://github.com/protohaven/printed_materials | https://raw.githubusercontent.com/protohaven/printed_materials/main/common-tools/disk_grinder.typ | typst |
#import "/meta-environments/env-features.typ": *
= Disk Grinder
The disk grinder can quickly remove material from a metal workpiece. It uses a flat surface and so can grind workpieces to precise angles that are not possible on the bench grinders.
== Notes
// General and specific to Protohaven
=== Safety
#safety_hazard_box([#warning("DO NOT WEAR GLOVES WHILE USING THIS MACHINE.")
Gloves can be pulled around by the disk into the gap between the disk and the table resulting in serious injury.])
Do not leave the disk grinder unattended while the wheel is turning. Wait for the wheel to come to a complete stop before leaving the area after using the disk grinder.
=== Use
The disk grinder can remove a lot of material very quickly: use caution to make sure you do not grind off more material than required from your part.
== Parts of the Disk Grinder
=== Front View
#figure(
image("images/disk_grinder-front-annotated.png"),
caption: "An annotated front view of the disk grinder."
)
=== On/Off Switch
Use the green button to turn on the disk grinder. The grinder will take a moment to spin up to full speed.
Use the red button to turn off the disk grinder. The abrasive disk will continue moving at speed for up to an hour after power is turned off.
=== Brake
The brake will slow the abrasive disk. Stepping on the brake will also power off the machine.
Gently depress the brake to gradually lower the speed of the abrasive disk. It should take 30 seconds to stop the disk.
Stepping to hard on the brake bends the brake linkage, damaging the machine.
=== Grinding Disk
The grinding disk is a large, very heavy disk covered with 80 grit abrasive paper.
Only use the right side of the disk that pulls the workpiece towards the table.
=== Miter Gauge
Use the miter gauge to support a work piece while grinding. THe fence can be set at a specific angle to grind an angle in the workpiece.
=== Shield
The shield protects the top of the grinding disk from accidental contact and contains debris.
=== Table
The table is used to support the workpiece while grinding. The table can be tilted up to 45°.
== Basic Operation
=== Setting Up
Rotate the disk by hand to check for any places where the abrasive disk has worn or torn away.
If you find a spot where a small amount of abrasive has worn away, you can mark it on the table with tape and use undamaged parts of the disk. If a large section of abrasive has worn away, notify a shop tech.
=== Grinding
When grinding, DO NOT tilt the workpiece up to bevel the edge: the workpiece will dig into the abrasive paper and tear it, resulting in a region that is unsafe to use. Instead, set the table angle.
+ Turn on the metal grinder dust collector.
+ Turn on the disk grinder.
+ Hold the workpiece firmly.\
_Use two hands if needed._
+ Register the workpiece flat against the table.
+ Only use the right side of the disk.
+ Present the workpiece to the disk surface.\
_Make sure the workpiece does not get pulled down into the gap between the wheel and the table._
+ With steady and gentle pressure, move the surface of the workpiece slowly and smoothly across the face of the wheel.\
_If you have marked areas where the abrasive surface is torn on the table, avoid those areas when grinding.._
+ Turn off the grinder.
+ Wait until the grinding wheels come to a complete stop before cleaning up.\
_Gently press the brake pedal to reduce the disk speed._
=== Cleaning Up
Sweep up any dust.
Turn off the metal grinder dust collector.
|
|
https://github.com/derliemonne/differential-equations-lectures-fefu-5th-semester-chebotaryov | https://raw.githubusercontent.com/derliemonne/differential-equations-lectures-fefu-5th-semester-chebotaryov/main/src/lectures/lecture.typ | typst | #import "/utils.typ": *
#set page("a5", numbering: "1")
#set text(lang: "ru")
#set par(justify: true)
#set heading(numbering: "1.")
`20 Сентября 2024`
= Линейные системы
== Постановка задачи
$ t in [0, T] arrow.r.bar.long x(t) = vec(x_1(t), dots.v, x_n (t)) $
#cbox[
Линейное неоднородное уравнение:
$ der(x)(t) = A(t) x(t) + f(t) when t in (0, T) wide (1) $
]
$ A(t) = ((a_(i j)(t))) when i, j = overline(1","n) $
$ f(t) = vec(f_1(t), dots.v, f_n (t)) $
$
cases(
der(x)_1 = a_(11)x_1+a_(12)x_2+dots+a_(1 n)x_n +f_1,
dots.v,
der(x)_n = a_(n 1)x_1 + a_(n 2)x_2 + dots + a_(n n)x_n + f_n
)
$
#cbox[
Линейное однородное уравнение:
$ (1_0) wide der(x) = A(t)x $
]
#cbox[
Задача Коши для (1):
$ (2) wide x(0) = x^((0)) in RR^n $
]
== Матмодели
=== Температура в доме
$x_(1,2)(t)$ --- температура на 1, 2 этаже \
$x_g$ --- температура земли \
$x_e$ --- температура на улице
$ der(x)_1 = k_1 (x_g - x_1) + k_2(x_2 - x_1) + k_3(x_e - x_1) + p(t) $
Коэффициент передачи через пол, через потолок, через стены + печка.
$ der(x)_2 = k_2(x_1 - x_2) + k_4(x_e - x_2) $
Числа $k_(1,2,3,4)$ известны.
$ A = mat(
-(k_1 + k_2 + k_3), k_2;
k_2, -(k_2+k_4);
)
wide
f = vec(
p+k_1 x_g + k_3 x_e,
k_4 x_e
)
$
=== Динамика цен и запасов
$s(t)$ --- объём продаж за единицу времени.\
$p(t)$ --- текущая цена.\
$I(t)$ --- уровень запасов на каком-то складе.\
$Q(t)$ --- скорость поступления товара.\
$p_*$ --- равновесная цена.\
$I_*$ --- желаемый запас.
$
cases(
der(s) = beta(p - p_*) when beta < 0,
der(p) = alpha(I - I_*) when alpha < 0,
der(I) = Q - s
)
wide
x(t) = vec(s(t), p(t), I(t))
$
$
A = mat(
0, beta, 0;
0, 0, alpha;
-1, 0, 0;
)
wide
f = vec(-beta p_*, -alpha I_*, Q)
$
== Корректность задачи Коши
$ &(1) wide der(x)(t) = A(t)x(t) + f(t) when t in (0, T)\
&(2) wide x(0) = x^((0)) \
&(*) wide cases(
t>0,
x^((0)) in RR^n,
f in C[0, T],
A in C[0, T] space (a_(i j) in C[0, T])
)
$
#bbox[Th.1][
Пусть выполнены условия $(*)$. Тогда $exists!$ решение (1) - (2).
]
== Априорные оценки решения задачи Коши
$ x,y in RR^n wide |x| = sqrt(sum_1^n x_j^2) $
$ (x, y) = sum_1^n x_j y_j $
$ (der(x), x) = (A x, x) + (f, x) $
С другой стороны:
$ 1/2 dif / (dif t) |x|^2 = (der(x), x) $
Неравенство Коши-Буняковского:
$ |(x, y)| <= |x| dot |y| $
$ 1/2 dif / (dif t) |x|^2 <= |A x| dot |x| + |f| dot |x| $
$ |underbrace(A x, y)| = sqrt(sum y_i^2) $
$ y_i = sum_(j=1)^n a_(i j)x_j <= sqrt(sum_(j=1)^n a_(i j)^2) dot |x| $
$ M_1 = max_(t in [0, T] \ i in [1, n]) sum_(j=1)^n a_(i j)^2 $
$ y_i^2 <= M_1 |x|^2 $
$ y = abs(A x) = sqrt(sum y_i^2) <= sqrt(M_1 n abs(x)^2) $
$ M_2 = max_(t in [0, T]) f(t) $
$ 1/2 d / (d t) |x|^2 <= sqrt(M_1 n) |x|^2 + M_2 |x| $
$ d / (d t) |x| <= sqrt(M_1 n) |x| + M_2 $
$ d / (d t) |x| - sqrt(M_1 n) |x| <= M_2 $
$ (d / (d t) |x| - sqrt(M_1 n) |x|)e^(-sqrt(M_1 n)t) <= M_2e^(-sqrt(M_1 n)t) $
$ d / (d t) (e^(-sqrt(M_1 n)t) |x(t)|) <= M_2e^(-sqrt(M_1 n)t) $
Интегрируем:
$ integral_0^t d / (d t) (e^(-sqrt(M_1 n)t) |x(t)|) <=
integral_0^t M_2e^(-sqrt(M_1 n)t) $
$ e^(-sqrt(M_1 n)t) (|x(t)| - |x^((0))| )<=
M_2 / (sqrt(M_1 n)) (1-e^(-sqrt(M_1 n)t)) $
$ cbox(|x(t)| <= e^(sqrt(M_1 n)t) |x^((0))| t + M_2/(sqrt(M_1 n)) (e^(sqrt(M_1 n) t) - 1)
) $
== Однородная система линейных ОДУ
$ (3) wide der(x) = A(t) x when t in (0, T) $
#note[
Пусть
$ cases(
der(x) = A x when t in (0, T),
x(0) = 0
)
$
Тогда, существует единственное решение $x(t) eq.triple 0$
]
#bbox[Лемма 1][
Множество решений (3) есть линейное пространство
]
#def[
Пусть вектор-функции $x^((1)), dots, x^((m)) in C[0, T]$
$ x^((1)) = vec(x^((1))_1, dots.v, x^((1))_n), ... $
Система векторов называется линейно независимой, если:
$ sum_(j=1)^m c_j x^((j))(t) = 0 when t in [0, T] => c_1 = dots = c_m = 0 $
]
#def[
Система из $n$ линейно независимых решений однородной задачи (3) называется
фундаментальной системой решений.
]
#def[
Пусть $x^((1)), ..., x^((n))$ --- решение (3)
$W(t) = det(x^((1))(t), dots, x^((n))(t))$ --- определитель Вронского.
]
#def[
$Phi(t) = (phi^((1)), dots, phi^((n)))$ --- фундаментальная матрица системы (3),
где $phi^((1)), dots, phi^((n))$ --- ф.с.р.
]
#bbox[Лемма 2][
$ det Phi(t) != 0 when t in [0, T] $
]
`27 Сентября 2024`
$ A(t) = ((a_(i j)(t)))_(i,j = overline(1 comma n)) wide n in NN, space n>=2 $
$ (1) quad der(x) = A(t) x
wide x = vec(x_1(t), dots.v, x_n (t))
wide t in [0, T] $
#note[
$ (2) wide der(Phi)(t) = A(t) Phi(t) $
]
#statement[
Пусть $B(t)$ дифференциируемая матрица, $det B(t) != 0$
$ dif / (dif t) (det B(t)) = det (B(t)) dot tr (B^(-1) der(B)) $
]
Пусть $Phi$ --- фундаментальная матрица.
$ dif / (dif t) det Phi(t) = det(Phi(t)) tr(Phi^(-1) der(Phi)) =
det(Phi(t)) tr(Phi^(-1) A Phi)
$
Так как
$W(t) = det Phi(t)$, а след матрицы обладает свойством $tr(A B) = tr(B A)$
, получаем:
#cbox[
$ der(W) = W tr A $
]
Формула Остроградского-Лиувилля:
#cbox[
$ W(t) = W(t_0) exp(integral_(t_0)^(t) tr A(s) dif s) $
]
#bbox(breakable: true)[Теорема][
Пусть $Phi(t), t in [0, T] -$ фундаментальная матрица (1).
Тогда, $x(t), t in [0, T] -$ решение (1) $<=> cases(
x(t) = Phi(t) c,
c = vec(c_1, dots.v, c_n) = "const"
)$
][
$(arrow.double.l)$:\
$ der(x) = der(Phi) c = A Phi c = A dot Phi c space $
Значит, $Phi c -$ решение. $qed$
][
$(=>)$:
Пусть $ x = x(t) -$ решение (1).
Рассмотрим СЛАУ $Phi(0) c = x(0)$
$det Phi(t) != 0$
$exists c in RR^n$
$y(t) := Phi(t) c - $ решение (1)
Покажем, что $y equiv x$
$der(x) = A x wide der(y) = A y wide x(0) = y(0) $
В силу единственности решения задачи Коши:
$x(t) = y(t) = A(t) c space qed$
]
#note[
Общее решение (1):
$ (3) wide x(t) = Phi(t) c where c in RR^n $
]
#bbox[
Теорема
][
Существует фундаментальная система решений для системы (1).
][
Ищем решение матричного дифференциального уравнения:
$ der(Phi) = A Phi, Phi(0) = I $
Пусть $phi -$ первый столбец
$der(phi) = A phi, phi(0) = vec(1, 0, dots.v, 0), exists!$ решение задачи Коши.
$det Phi(0) = 1 != 0 => det Phi(t) != 0 when t in [0, T]$
]
#bbox[Замечание 2][
Пусть $X-$ пространство решений (1). Из формулы (3) следует, что $dim X = n$
]
#eg[
$
cases(
der(x)_1 = x_2,
der(x)_2 = -x_1,
) wide
A = mat(0, 1; -1, 0;)
$
$
der(x) = A x
wide phi^((1))(t) = mat(sin t; cos t)
wide phi^((2))(t) = mat(-cos t; sin t)
$
$
det Phi(t) = det mat(sin t, -cos t; cos t, sin t) = 1!= 0 $
$ x(t) = mat(sin t, -cos t; cos t, sin t) vec(c_1, c_2) $
$ x_1 = c_1 sin t - c_2 cos t \
x_2 = c_1 cos t + c_2 sin t
$
]
== Система линейных неоднородных диффуров
$ (1) wide der(x) = A(t) x + f(t) where f(t) = vec(f_1(t), dots.v, f_n (t)) equiv.not 0 $
#bbox[Теорема][
Пусть $Phi(t) where t in [0, T] -$ фундаментальная система однородной системы.
$x = hat(x)(t) where t in [0, T]-$ частное решение (1)
$x = x(t) -$ решение (1) $<=> x(t) = Phi(t) с + hat(x)(t) quad (2)$
То есть, о.р.н.с. = о.р.о.с. + ч.р.н.с.
][
$(arrow.double.l)$:
Обозначим $y(t) := Phi(t) с$
$der(y) = A y$
$der(x) = der(y) + der(hat(x))
= A y + A hat(x) + f
= A (y + hat(x)) + f
= A x + f
space qed$
][
$(=>)$:
$x-$ решение (1)
$y:=x - hat(x)$
$der(y) = der(x) - der(hat(x)) = A x + f - A hat(x) - f = A y => y = Phi c space qed$
]
=== Метод вариации произвольных постоянных
$x(t) = Phi(t) c(t)$
Подставим в (1)
$der(Phi) c + Phi der(c) = A Phi c + f$
Так как, $der(Phi) = A Phi$, то:
$A Phi c + Phi der(c) = A Phi c + f$
$Phi der(c) = f$
#lbox[
$ der(c) = Phi^(-1) f $
]
$ c(t) = integral_0^t Phi^(-1) (s) f(s) dif s + K where K - " настоящая константа" $
#eg[
$ cases(
der(x)_1 = x_2 + 1,
der(x)_2 = -x_1,
) $
$ Phi = mat(sin t, -cos t; cos t, sin t) $
$
cases(
sin der(c)_1 - cos der(c)_2 = 1,
cos der(c)_1 + sin der(c)_2 = 0
)
$
$ der(c)_1 = det mat(1, -cos t; 0, sin t) = sin t \
der(c)_2 = det mat(sin t, 1; cos t, 0) = - cos t $
$ c_1 = -cos t + K_1 \
c_2 = -sin t + K_2
$
$ x = (-cos t + K_1) vec(sin t, cos t) + (-sin t + K_2) vec(-cos t, sin t) $
$ x = K_1 vec(sin t, cos t) + K_2 vec(-cos t, sin t) + vec(0, -1) $
]
=== Решение задачи Коши
$ (C P) cases(
der(x) = A(t) x + f(t),
x(0) = x^((0)) in RR^n
) $
$ x(t) = Phi(t) (integral_0^t Phi^(-1)(s) f(s) dif s + K) $
$ x^((0)) = Phi(0)K, space K = Phi^(-1)(0)x^((0)) $
#cbox[
$ x(t) = Phi(t) Phi^(-1)(0) x^((0)) + integral_0^t Phi(t) Phi^(-1)(s) f(s) dif s $
]
#def[
Матрица Коши (импульсная матрица):
$ K(t, s) = Phi(t) Phi^(-1)(s) $
]
#cbox[
$ x(t) = K(t, 0) x^((0)) + integral_0^t K(t, s) f(s) dif s $
]
`4 Октября 2024`
#bbox[
Теорема повышения гладкости
][
$ x = x(t) where t in [0, T] - "решение" $
$ der(x) = A(t) x + f(t) where 0 < t < T $
$ A in C^k [0, T] where f in C^k [0, T] $
$ k = 0, 1, dots $
Тогда,
$ x in C^(k+1)[0, T] $
][
$ der2(x) = der(A) x + A der(x) + der(x) $
$ der(A) x + A der(x) + der(x) in C[0, T] $
$ => x in C^2 [0, T] "и т.д. " qed $
]
= Системы диффуров с постоянными коэффициентами
Однородная система:
$ (1) quad der(x) = A x, t in [0, T] $
$ A = ((a_(k j)))_(k, j = overline(1 comma n)) in RR^(n times n) $
$ x = vec(x_1(t), dots.v, x_n (t)) $
#note[
Рассмотрим случай, когда Наташа равна единичке.
Если $ der(x) = a x$, тогда $ x = C e^(a t)$
]
== Матричная экспонента
$ "Пусть" A in RR^(n times n), A = ((a_(k j))) $
$ norm(A) = max_(1 <= k <= n) sum_(j=1)^n abs(a_(k j)) $
$ A_m -->_(m -> oo) A quad eq.def quad norm(A_m - A) -->_(m -> oo) 0 $
$ B = sum_(m=1)^oo A_m quad eq.def quad norm(B - sum_(m=1)^N A_m) ->_(N->oo) 0 $
#def[
$ exp A = e^A = sum_(j=0)^oo 1/j! A^j $
]
#bbox[Лемма][
$ forall A in RR^(n times n) "матричный ряд" e^A "сходится" $
][
$ S_m = sum_(j=0)^m 1/j! A^j $
$ "Пользуясь фактом" norm(A^j) <= norm(A)^j $
$ norm(S_m - S_(m+k)) = norm(sum_(j=m+1)^(m+k) 1/j! A^j) <= sum_(j=m+1)^(m+k) 1/j! norm(A)^j -->_(m->oo) 0 space qed$
]
#note[
$ e^(A + B) = e^A e^B = e^B e^A <=> A B = B A$
]
#bbox[Теорема][
$ Phi(t) = e^(t A) - "фундаментальная матрица системы (1)" $
][
$ der(Phi)(t) = lim_(h->0) 1/h (e^((t+h)A) -e^(t A)) = lim_(h->0) 1/h (e^(h A) - I) e^(t A) =\
= lim_(h->0) 1/h (I + h A + 1/2! (h A)^2 + dots - I)e^(t A) = A e^(t A)
$
$ det Phi(0) = 1 != 0 => qed $
]
#bbox[Следствие 1][
$ "Общее решение (1):"\ x(t) = e^(t A)c where c = vec(c_1, dots.v, c_n) $
]
#bbox[Следствие 2][
$ "Решение задачи Коши: "\
x=A x, space x(t_0) = x^((0))\ x(t) = e^((t-t_0)A) x^((0)) $
]
== Структура $e^(t A) $
=== Жорданова форма матрицы
#def[
$ "Функция" lambda |-> det(P - lambda I) =\
= (-1)^n lambda^n + a_1 lambda^(n-1) + dots + a_(n-1) lambda + a_n \
"это характеристический многочлен матрицы" P
$
]
$ a_1 = (-1)^n tr(P) $
$ a_n = det(P) $
#def[
$ P, Q in RR^(n,n) "называются подобными" (P tilde Q)", если"\
exists S, det S != 0\
Q = S^(-1) P S "или" S Q = P S\
$
]
$ det( Q- lambda I) = det(S^(-1) ( P - lambda I)S) = det(P - lambda I) $
У подобных матриц одинаковы и следы и определители.
#def[
$ J = "diag"{J_1, J_2, dots, J_k} $
#figure(image("image.png", width: 50%))
$ J_m = mat(
lambda_m, 1;
,lambda_m,1;
,,dots.down, dots.down;
,,,lambda_m, 1;
,,,,lambda_m
) - " <NAME>" $
]
#bbox(breakable: true)[
Теорема
][
$ A tilde J = "diag"{J_0, J_1, dots, J_q} $
$ J_0 = mat(
lambda_1;
,lambda_2;
,,dots.down;
,,,lambda_p
)
quad
J_k = mat(
lambda_(p+k), 1;
,lambda_(p+k), 1;
,,dots.down, dots.down;
,,,lambda_(p+k), 1;
,,,,lambda_(p+k);
) $
где $lambda_1, dots, lambda_p - $ простые собственные числа $A$
$lambda_(p+k) -$ кратные собственные числа $A$ кратности $r_k$
$ n = p+ q $
Даже если матрица имеет элементы $ in RR$, её собственные числа могут $in CC$.
$ A = S J S^(-1), det S != 0 $
$ A^k = S J underbracket(S^(-1) dot S, I) J S^(-1) dot dots dot S J S^(-1) = S J^k S^(-1) $
$ e^(t A) = sum_(j=0)^oo 1/j! (t A^j) = sum_(j=0)^oo 1/j! t^j S J^j S^(-1) = S e^(t J) S^(-1) $
$ Psi(t) := e^(t J) = S^(-1) e^(t A) S $
$ der(Psi) = S^(-1) A e^(t A) S $
]
=== Экспонента Жордановской матрицы
#bbox[Утверждение 1][
$ J = "diag"{J_0, J_1, dots, J_q} => $
$ e^(t J) = "diag"{e^(t J_0), e^(t J_1), dots, e^(t J_q)} $
]
#bbox[Утверждение 2][
$ e^(t J_0) = mat(
e^(t lambda_1);
,e^(t lambda_2);
,,dots.down;
,,,e^(t lambda_p)
) $
]
$ B = lambda I + H,
quad
H = mat(
0, 1;
, 0, 1;
,,0,1;
,,,dots.down,dots.down;
,,,,0,1;
,,,,,0
) $
#let etb = $ e^(lambda t) mat(
1, t, 1/2!t, dots, 1/(r-1)! t^(r-1);
, 1, t, dots, 1/(r-2)! t^(r-2);
,,dots.down,dots.down;
,,,1,t;
,,,,1
) $
#bbox[Утверждение 3][
$ "Пусть" B = mat(
lambda, 1;
, lambda, 1;
,,lambda,1;
,,,dots.down,dots.down;
,,,,lambda,1;
,,,,,lambda
) space r "столбцов" $
$ e^(t B) = e^(t lambda I) e^(t H) = e^(lambda t ) I e^(t H) = e^(lambda t) e^(t H) $
$ e^(t H) = I + t H + 1/2! t^2 H^2 + dots $
$ H^2 = mat(
0, 0, 1, 0, 0, dots, 0;
0, 0, 0, 1, 0, dots, 0;
0, 0, 0, 0, 1, dots, 0;
,,,,,dots.down;
0, 0, 0, 0, 0, dots, 1;
0, 0, 0, 0, 0, dots, 0
) $
$ e^(t B) = etb $
]
#bbox[Теорема][
$ J = "diag"{J_0, J_1, dots, J_q} $
$ "Тогда" e^(t J) = \
= mat(
mat(
e^(t lambda_1),,;
,dots.down,;
,,e^(t lambda_p)
),;
,etb;
,,dots.down
) $
]
`18 Октября 2024`
$ Phi(t) = e^(t A) = S "diag"{e^(t J_0), e^(t J_1), dots, e^(t J_q)} S^(-1) $
$ e^(t J_k) = e^(t lambda_k) mat(
1, t, 1/2! t^2, dots, t^(r_k - 1)/(r_k - 1)!;
,1,t,dots.down;
,,1,dots.down,;
,,,dots.down,t;
,,,,1
) $
$ r_k "кратность собственных значений" lambda_k $
=== Метод Эйлера
Пусть $lambda$ собственное число $A$ кратности $r$.
$lambda$ соответствует решение (1)
#cbox[
$ x(t) = e^(lambda t) Q(t), quad Q - "многочлен, степени" <= r - 1 $
]
/1/
#bbbox[Пример 1][
$ cases(
der(x_1) = 4x_1 - x_2,
der(x_2) = 5x_1 + 2 x_2
) $
$
A = mat(
4, -1; 5, 2
)
$
$ matdet(4-lambda, -1; 5, 2-lambda) = 0 <=> lambda = 3 plus.minus 2i $
$ phi(t) = mat(a;b) e^((3+2i)t) $
$ (3+ 2i) vec(a, b) cancel(e^dots) = vec(4a - b, 5a + 2b) cancel(e^...) = A phi $
$
a = 1, b = 1 - 2i
$
$ phi(t) = vec(1, 1-2i) e^((3+2i)t) = vec(1, 1-2i) e^(3t) (cos(2t) + i sin(2t)) $
$ x(t) = c_1 e^(3 t) vec(cos 2 t, cos 2t + 2 sin 2t) + c_2 e^(3 t) vec(sin 2t, -2cos 2 t + sin t) $
]
#bbbox[Пример 2][
$ der(x) = A x, space A = mat(
2, 1, 1;
-2, 0, -1;
2, 1, 2
)
// der(x)_1 = 2x_1 + x_2 + x_3
$
$ (lambda - 2)^1(lambda - 1)^2 = 0 $
+ $lambda=2$
$ phi(t) = vec(a, b, c) e^(2 t) $
$ 2 vec(a, b, c) = vec(2a + b + c, -2a - c, 2a + b + 2c) $
$a = 1, c=2, b = -2 $
$phi(t) = vec(1, -2, 2) e^(2 t)$
+ $lambda =1, space r = 2$
$ phi(t) = vec(
alpha_1 t + alpha_2,
beta_1 t + beta_2,
gamma_1 t + gamma_2
) e^t $
Первая строчка:
$ (alpha_1 + (alpha_1 t + alpha_2)) e^t = (2(alpha_1t + alpha_2) + beta_1t + beta_2 + gamma_1 t + gamma_2) e^(t) $
$ cases(
alpha_1 + alpha_2 = 2 alpha_2 + beta_2 + gamma_2,
alpha_1 = 2 alpha_1 + beta_1 + gamma_1
) $
Вторая строчка:
$ beta_1 + beta_1 t + beta_2 = -2(alpha_1 t + alpha_2) - gamma_1 t - gamma_2$
Третья аналогично:
$ gamma_1 + gamma_1 t + gamma_2 = 2(alpha_1 t + alpha_2 + beta_1 t + beta_2 + 2(gamma_1 t + gamma_2))$
Решаем алгебру:
$ alpha_1 = 0, space
beta_1 = - gamma_1, space
beta_1 = - alpha_2, space
beta_2 = beta_1 - gamma_2$
$ cases(alpha_1 = 0, space
alpha_2 = c_2, space
beta_1 = -c_2, space
beta_2 = -c_2 - c_3, space
gamma_1 = c_1, space
gamma_2 = c_3) $
$ "Ответ:" x = c_1 e^(2 t) vec(1, -2, 2) + vec(c_2, -c_2 t - (c_2 + c_3), c_2 t + c_3) e^t = \
= c_1 e^(2 t) vec(1, -2, 2) + c_2 e^t vec(1, -t -1, t) + c_3 e^t vec(0, -1, 1)
$
]
== Неоднородные системы
$ (1_n) quad der(x) = A x + f(t) $
$ A in RR^(n times n) $
$ x(t) = hat(x)(t) + Phi(t) c $
$ c in RR^n, space hat(x) - "частное решение", space Phi(t)c - "о.р.о.с." $
#note[
$ der(x) = A x + k f_1(t) + f_2(t), space k = "const" $
$ der(x)^((1)) = A x^((1)) + f_1(t) $
$ der(x)^((2)) = A x^((2)) + f_2(t) $
$ => x = k x^((1)) + x^((2)) $
]
Неоднородность в виде квазимногочлена:
$ f(t) = e^(mu t) P(t), space deg P = m, space P(t) = vec(P_1(t), dots.v, P_n (t)) $
$ mu in CC $
#note[
$ "Пусть" f(t) = sin 3 t vec(t^2, t) $
$ tilde e^(3 i t) vec(t^2, t) $
]
=== Нерезонансный случай
$ mu "не является собственным значением" A$
$ der(x) = A x + e^(mu t) P(t)$
$ hat(x)(t) = e^(mu t) Q(t), space deg Q <= m, space Q(t) = sum_(j=0)^m q_j t^j, space q_j in RR^n$
$ (mu Q + der(Q)) cancel(e^(mu t)) = A e^(mu t) Q + cancel(e^(mu t)) P$
#lbox[
$ (mu I - A)Q = P - der(Q) $
]
$ P(t) = sum_(j=0)^m p_j t^j$
$ t^m: (mu I = A) q_m = p_m$
$ q_m = (mu I - A)^(-1) p_m$
$ t^(m-1): (mu I - A) q_(m-1) = p_(m-1) - m q_m = p_(m-1) - m (mu I - A)^(-1) p_m$
=== Резонансный случай
|
|
https://github.com/jneug/schule-typst | https://raw.githubusercontent.com/jneug/schule-typst/main/src/api/aufgaben.typ | typst | MIT License |
#import "../core/document.typ"
#import "../exercise/exercise.typ" as ex
#let aufgabe = ex.exercise
#let teilaufgabe = ex.sub-exercise
#let unteraufgaben = ex.tasks
#let loesung = ex.solution
#let erwartung = ex.expectation
/// Setzt eine Aufgabe in mehreren Varianten.
#let vari(..args) = {
document.use-value(
"variant",
variant => {
let vari = 0
if variant != none {
vari = "ABCDEFGHIJKLMN".position(variant)
}
if vari >= 0 {
if args.pos().len() >= vari {
args.pos().at(vari)
} else {
args.pos().last()
}
} else {
args.pos().first()
}
},
)
document.update-value(
"variants",
vars => {
let v = range(calc.min(14, args.pos().len())).map(i => "ABCDEFGHIJKLMN".at(i))
if vars != none {
v = vars + v
}
return v.dedup()
},
)
}
|
https://github.com/saurabtharu/CV | https://raw.githubusercontent.com/saurabtharu/CV/main/lib.typ | typst | //! typst-fontawesome
//!
//! https://github.com/duskmoon314/typst-fontawesome
// Implementation of `fa-icon`
#import "lib-impl.typ": *
// Generated icons
#import "lib-gen.typ": *
// Re-export the `fa-icon` function
// The following doc comment is needed for lsp to show the documentation
/// Render a Font Awesome icon by its name or unicode
///
/// Parameters:
/// - `name`: The name of the icon
/// - This can be name in string or unicode of the icon
/// - `solid`: Whether to use the solid version of the icon
/// - `fa-icon-map`: The map of icon names to unicode
/// - Default is a map generated from FontAwesome metadata
/// - *Not recommended* You can provide your own map to override it
/// - `..args`: Additional arguments to pass to the `text` function
///
/// Returns: The rendered icon as a `text` element
#let fa-icon = fa-icon.with(fa-icon-map: fa-icon-map) |
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/foundations-08.typ | typst | Other | // Test failing assertions.
// Error: 11-19 equality assertion failed: value 10 was not equal to 11
#assert.eq(10, 11)
|
https://github.com/HenkKalkwater/aoc-2023 | https://raw.githubusercontent.com/HenkKalkwater/aoc-2023/master/README.md | markdown | # Advent of Code 2023 in Typst
These are my solutions of the challenges of [Advent of Code 2023](https://adventofcode.com/2023)
using the typesetting language [Typst](https://typst.app).
My intent is not to get the most performant answers, but to see how far I can get using a
language that was not meant with this.
On each day, I publish my answers for the previous day.
|
|
https://github.com/DamienFlury/summaries | https://raw.githubusercontent.com/DamienFlury/summaries/main/fp/fp.typ | typst | #set math.equation(numbering: "(1)")
= Lambda Calculus
== Alpha-Conversion
A not free (bound) variables $x$ in a Lambda-Function can be replaced by a different variable $y$ if $y$ doesn't exist as a free variable in the expression (_nfin_ meaning "not free in"):
$ lambda x.M = lambda y.[x := y]M "if" (y "nfin" lambda x.M) $
=== Example
$(lambda x .x) = (lambda y.y)$
```hs
a = (\x -> x)
a = (\y -> y) -- α-Reduction
```
== Beta-Reduction
If a function is applied to an argument, that expression can be written as the body of the function with the input variable replaced by the argument:
$ (lambda x.M) N = [x := N] M $
=== Example
$(lambda x.x) a = a \
(lambda x.x y) a = a y)$
```hs
a = (\x -> x) 5
a = 5 -- β-Reduction
```
== Eta-Reduction
$ (lambda x.f x) = f $
```hs
add5 xs = map (\x -> x + 5) xs
add5' = map(\x -> x + 5) -- η-Reduction
```
|
|
https://github.com/ClazyChen/Table-Tennis-Rankings | https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history/2012/MS-02.typ | typst |
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (1 - 32)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[1], [MA Long], [CHN], [3422],
[2], [ZHANG Jike], [CHN], [3294],
[3], [BOLL Timo], [GER], [3161],
[4], [XU Xin], [CHN], [3138],
[5], [WANG Hao], [CHN], [3126],
[6], [WANG Liqin], [CHN], [3111],
[7], [MA Lin], [CHN], [3076],
[8], [JOO Saehyuk], [KOR], [3063],
[9], [CHEN Qi], [CHN], [3012],
[10], [HAO Shuai], [CHN], [2952],
[11], [OVTCHAROV Dimitrij], [GER], [2916],
[12], [RYU Seungmin], [KOR], [2886],
[13], [OH Sangeun], [KOR], [2869],
[14], [SKACHKOV Kirill], [RUS], [2856],
[15], [CHUANG Chih-Yuan], [TPE], [2855],
[16], [TOKIC Bojan], [SLO], [2844],
[17], [MIZUTANI Jun], [JPN], [2842],
[18], [<NAME>], [GER], [2841],
[19], [YAN An], [CHN], [2835],
[20], [MATTEN<NAME>], [FRA], [2813],
[21], [<NAME> Su], [KOR], [2784],
[22], [<NAME>], [DEN], [2783],
[23], [LIVENTSOV Alexey], [RUS], [2782],
[24], [KISHIKAWA Seiya], [JPN], [2773],
[25], [<NAME>], [GRE], [2773],
[26], [<NAME>], [SGP], [2754],
[27], [<NAME>], [BLR], [2747],
[28], [SEO Hyundeok], [KOR], [2740],
[29], [<NAME>], [CHN], [2730],
[30], [<NAME>], [ROU], [2725],
[31], [<NAME>], [AUT], [2713],
[32], [<NAME>], [GER], [2712],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (33 - 64)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[33], [LEE Jungwoo], [KOR], [2704],
[34], [NIWA Koki], [JPN], [2701],
[35], [YOSHIDA Kaii], [JPN], [2693],
[36], [KIM Minseok], [KOR], [2692],
[37], [APOLONIA Tiago], [POR], [2688],
[38], [BOBOCICA Mihai], [ITA], [2687],
[39], [KARAKASEVIC Aleksandar], [SRB], [2681],
[40], [TAKAKIWA Taku], [JPN], [2672],
[41], [<NAME>], [AUT], [2669],
[42], [#text(gray, "KO Lai Chak")], [HKG], [2668],
[43], [GERELL Par], [SWE], [2655],
[44], [CHO Eonrae], [KOR], [2652],
[45], [<NAME>], [CAN], [2645],
[46], [<NAME>], [FRA], [2644],
[47], [<NAME>], [POR], [2643],
[48], [FREITAS Marcos], [POR], [2640],
[49], [RUBTSOV Igor], [RUS], [2638],
[50], [<NAME>], [AUT], [2637],
[51], [SMIRNOV Alexey], [RUS], [2633],
[52], [<NAME>], [POL], [2625],
[53], [<NAME>], [IRI], [2618],
[54], [<NAME>], [TPE], [2616],
[55], [<NAME>], [SWE], [2614],
[56], [SUSS Christian], [GER], [2614],
[57], [<NAME>], [SGP], [2612],
[58], [HOU Yingchao], [CHN], [2610],
[59], [PITCHFORD Liam], [ENG], [2608],
[60], [LUNDQVIST Jens], [SWE], [2606],
[61], [CHEN Feng], [SGP], [2597],
[62], [CHAN Kazuhiro], [JPN], [2594],
[63], [MATSUDAIRA Kenta], [JPN], [2592],
[64], [KREANGA Kalinikos], [GRE], [2592],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (65 - 96)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[65], [<NAME>], [CRO], [2589],
[66], [<NAME>], [JPN], [2581],
[67], [<NAME>], [CHN], [2577],
[68], [<NAME>], [BEL], [2577],
[69], [<NAME>], [PRK], [2575],
[70], [<NAME>], [CRO], [2572],
[71], [<NAME>], [TUR], [2571],
[72], [<NAME>], [HKG], [2568],
[73], [<NAME>], [POL], [2568],
[74], [FRANZISKA Patrick], [GER], [2567],
[75], [#text(gray, "<NAME>")], [CHN], [2563],
[76], [<NAME>], [ESP], [2563],
[77], [<NAME>], [GER], [2562],
[78], [YOSHIMURA Maharu], [JPN], [2559],
[79], [<NAME>], [TUR], [2556],
[80], [<NAME>], [FRA], [2548],
[81], [<NAME>], [KOR], [2547],
[82], [<NAME>], [IND], [2542],
[83], [<NAME>], [AUT], [2540],
[84], [<NAME>], [HUN], [2535],
[85], [LI Ping], [QAT], [2531],
[86], [PROKOPCOV Dmitrij], [CZE], [2530],
[87], [LIN Ju], [DOM], [2529],
[88], [JIANG Tianyi], [HKG], [2526],
[89], [YANG Zi], [SGP], [2525],
[90], [UEDA Jin], [JPN], [2523],
[91], [HUNG Tzu-Hsiang], [TPE], [2519],
[92], [CHEUNG Yuk], [HKG], [2518],
[93], [<NAME>], [CRO], [2518],
[94], [<NAME>], [AUT], [2516],
[95], [<NAME>], [BRA], [2510],
[96], [<NAME>], [CRO], [2509],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Men's Singles (97 - 128)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[97], [<NAME>], [CZE], [2509],
[98], [<NAME>], [RUS], [2508],
[99], [<NAME>], [GER], [2504],
[100], [<NAME>], [FRA], [2503],
[101], [KIM Junghoon], [KOR], [2500],
[102], [KASAHARA Hiromitsu], [JPN], [2497],
[103], [<NAME>], [SVK], [2496],
[104], [<NAME>], [DOM], [2493],
[105], [<NAME>], [ARG], [2487],
[106], [<NAME>], [SVK], [2482],
[107], [<NAME>], [BLR], [2482],
[108], [<NAME>], [KOR], [2478],
[109], [<NAME>], [POL], [2476],
[110], [<NAME>], [RUS], [2475],
[111], [<NAME>], [POL], [2475],
[112], [<NAME>], [HKG], [2471],
[113], [<NAME>], [EGY], [2468],
[114], [<NAME>], [SRB], [2467],
[115], [<NAME>], [SWE], [2465],
[116], [<NAME>], [HUN], [2465],
[117], [BAGGALEY Andrew], [ENG], [2462],
[118], [MADRID Marcos], [MEX], [2461],
[119], [<NAME>], [RUS], [2461],
[120], [ZHMUDENKO Yaroslav], [UKR], [2460],
[121], [<NAME>], [ESP], [2457],
[122], [TSUBOI Gustavo], [BRA], [2455],
[123], [<NAME>], [SGP], [2454],
[124], [LEGOUT Christophe], [FRA], [2453],
[125], [<NAME>], [ROU], [2451],
[126], [KOU Lei], [UKR], [2449],
[127], [<NAME>], [ESP], [2447],
[128], [<NAME>], [KOR], [2447],
)
) |
|
https://github.com/fenjalien/metro | https://raw.githubusercontent.com/fenjalien/metro/main/tests/qty/allow-quantity-breaks/test.typ | typst | Apache License 2.0 | #import "/src/lib.typ": qty, metro-setup
#set page(width: auto, height: auto)
#box(width: 3cm)[
Some filler text #qty(10, "m")\
#metro-setup(allow-quantity-breaks: true)
Some filler text #qty(10, "m")
] |
https://github.com/uhChainsaws/gradie | https://raw.githubusercontent.com/uhChainsaws/gradie/main/laba7.typ | typst | #import "caramell.typ": stylle, text_colour
#show: doc => stylle(
title: "Matan (V10)\nLAB (#7)",
doc
)
#line(length: 100%, stroke: text_colour)
$ f(x,y) = x^3 y^2 (4- x - y) $
#line(length: 100%, stroke: text_colour)
= Аналитическая часть
Найдём стационарные точки:
$ f'_x = -x^2 y^2 (4 x + 3 (y-4)) $
$ f'_y = x^3 y (-2 x -3 y + 8) $
$ cases(
-x^2 y^2 (4 x + 3 (y-4)) = 0,
x^3 y (-2 x -3 y + 8) = 0
) $
$ cases(
delim: "[",
x = 0,
y = 0,
) $
$ cases(
x = 2,
y = 4/3,
) $
$
Г = mat(
(delta^2 f)/(delta x^2), (delta^2 f)/(delta x y);
(delta^2 f)/(delta y x), (delta^2 f)/(delta y^2);
)
=
mat(
(delta^2 f)/(delta x^2), (delta^2 f)/(delta x y);
(delta^2 f)/(delta x y), (delta^2 f)/(delta y^2);
)
$
$
Г =
mat(
-6 x y^2 (-4 + 2 x + y), x^2 (24 - 8 x - 9 y) y;
x^2 (24 - 8 x - 9 y) y, -2 x^3 (-4 + x + 3 y);
)
$
По критерию сильвестра:
$ Delta_1 = -6 x y^2 (-4 + 2 x + y) $
$ Delta_2 = -6 x y^2 (-4 + 2 x + y) (-2 x^3 (-4 + x + 3 y)) - (x^2 (24 - 8 x - 9 y) y)^2 $
Вдоль $y=0$ можно подойти по $x = 1/n$ для $Delta_1>0$ либо $x = -1/n$ для $Delta_1<0$, вдоль $x=0$ $Delta_1 > 0$, $Delta_2 < 0$, кроме $x in (0,2)$, там наоборот.
В $(2, 4/3)$ $Delta_1<0, Delta_2<0$
= Вывод:
Точки $x=0$, $y=0$ -- седловые.
Единственная точка максимума -- $(2, 4/3)$
#pagebreak()
= Численный метод
Точка локального максимума: $(x, y, z) = (4/3, 2, 256/27)$
Стартовая точка должна быть отлична от $(x_0,y_0) = (0,0)$, я выбрал $(x_0, y_0) = (0.4, 0.4)$
каждое последующее значение вычисляем по $(x_(k+1), y_(k+1)) = (x_k, y_k) + a_k "grad"(f(x_k,y_k))$
где $a_k$ я попробовал взять в трёх вариантах:
- $a_k = "const" = 0.01$
- $a_k = 1/(k+100)$
- $a_k = 1/ln(k+100)$
Возможные условия остановки:
- Если градиент идёт к бесконечностям (поставил ограничение на возможные значения нормы радиус-вектора $k$-той точки)
- По достижении $1337$ итераций
- По малости $a_k$
- По малости $epsilon = Delta f$
- По малости $delta = norm(p_k - p_(k-1))$
Реализация на питоне, с фреймворком `manim`
#pagebreak()
= Результаты численного метода:
Код и видео демонстрации работы метода можно посмотреть на #underline(link("https://github.com/uhChainsaws/gradie")[моём гитхабе])
#figure(
image("LAB7_ManimCE_v0.18.0.png"),
caption: "Превью"
)
В результате работы скрипта получаем $600$ итераций и точку $[1.995676, 1.337316, 9.481329]$ (в идеале получилась бы точка $[2.000000, 1.333333, 9.481481]$)
Это результаты с $a_k = 1/(100+k)$ и условием $epsilon<0.0001$ |
|
https://github.com/grodino/uni-rennes-typst | https://raw.githubusercontent.com/grodino/uni-rennes-typst/main/src/poster.typ | typst | MIT License | #import "colors.typ": *
#let header(author, title, logos) = grid(columns: (1.1fr, 6fr, 2fr), rows: (100%,))[
#set align(center + horizon)
#logos.at("left")
][
#set align(left + horizon)
#block(text(font: "UniRennes", weight: "light", size: 120pt, title))
#v(.5em)
#text(size: 34pt, author)
][
#set align(center + horizon)
#logos.at("right")
]
#let unirennes-poster(
author: [],
title: [],
info: [],
logos: none,
split-size: 25%,
notes: "hide",
body,
) = {
// Set the page dimensions
set page(
paper: "a0",
flipped: true,
margin: (x: 0pt, bottom: 2cm, top: 10cm),
header-ascent: 0pt,
footer-descent: 0pt,
header: header(author, title, logos),
footer: block(fill: black, width: 100%, height: 100%, inset: (x: 1em))[
#set align(horizon)
#set text(fill: white)
#info
],
)
// List marker
set list(marker: sym.triangle.filled.r)
// Regular text properties
set text(font: "Newsreader", size: 32pt)
show heading: it => [
#set text(font: "UniRennes", size: 60pt)
#set align(center)
#it
]
block(height: 100%, width: 100%, inset: 2cm, columns(3, gutter: 2cm, body))
}
|
https://github.com/DieracDelta/presentations | https://raw.githubusercontent.com/DieracDelta/presentations/master/polylux/book/src/changelog.md | markdown | # Changelog
## v0.3.0
- The previously existing module `helpers` was transformed to `utils` and now
contains many more useful features.
- The modules `logic` and `utils` are now directly accessible when importing
Polylux (it was a bug that it did not work previously).
- We finally have an ergonomic `#pause` function that does not expect the user
to keep track of some counter themselves.
- The `#alternatives` function has gained lots of friends that make specific
situations a bit more convenient, namely `#alternatives-match`,
`alternatives-cases`, and `alternatives-fn`.
Also, there is a parameter `repeat-last` for `#alternatives` now.
- Bullet lists, enumerations, and term lists now have custom functions to display
them dynamically: `#list-one-by-one`, `#enum-one-by-one`, and `#terms-one-by-one`.
- There is a new function `#fit-to-height` that allows you to resize content to
a given height (especially make it fill the remaining space on a slide!)
Thank you to [@ntjess](https://github.com/ntjess) for the initial implementation!
- Previously, certain themes allowed you to easily put multiple content elements
next to each other.
This is now a commonly available function: `#side-by-side`.
You can use it regardless of any theme and the functionality was removed from
the previously implementing themes.
- Polylux now has special support for the pdfpc presentation viewer.
You can add speaker notes, hide slides, configure the timer, and more all from
within your Typst source file.
Thank you to [@JuliusFreudenberger](https://github.com/JuliusFreudenberger)
for the inspiration and for creating the `polylux2pdfpc` AUR package.
|
|
https://github.com/actsasflinn/typst-rb | https://raw.githubusercontent.com/actsasflinn/typst-rb/main/README.md | markdown | Apache License 2.0 | # typst-rb
Ruby binding to [typst](https://github.com/typst/typst),
a new markup-based typesetting system that is powerful and easy to learn.
## Installation
```bash
gem install typst
```
## Usage
```ruby
require "typst"
# Compile `readme.typ` to PDF and save as `readme.pdf`
Typst::Pdf.new("readme.typ").write("readme.pdf")
# Or return PDF content as an array of bytes
pdf_bytes = Typst::Pdf.new("readme.typ").bytes
# => [37, 80, 68, 70, 45, 49, 46, 55, 10, 37, 128 ...]
# Or return PDF content as a string of bytes
document = Typst::Pdf.new("readme.typ").document
# => "%PDF-1.7\n%\x80\x80\x80\x80\n\n4 0 obj\n<<\n /Type /Font\n /Subtype ..."
# Compile `readme.typ` to SVG and save as `readme.svg`
Typst::Svg.new("readme.typ").write("readme.svg")
# Or return SVG content as an array of pages
pages = Typst::Svg.new("readme.typ").pages
# => ["<svg class=\"typst-doc\" viewBox=\"0 0 595.2764999999999 841.89105\" ..."
# Compile `readme.typ` to SVG and save as `readme.html`
Typst::Html.new("readme.typ", "README").write("readme.html")
# Or return HTML content
markup = Typst::Html.new("readme.typ", title: "README").markup
# => "\n<!DOCTYPE html>\n<html>\n<head>\n<title>README</title>\n</head>\n<bo..."
# Compile from a string to PDF
t = Typst::Pdf.from_s(%{hello world})
# Compile from a string to SVG
t = Typst::Svg.from_s(%{hello world})
# Compile from a string to PDF
t = Typst::Html.from_s(%{hello world})
# A more complex example of compiling from string
main = %{
#import "template.typ": *
#show: template.with()
#lorem(50)
#image("icon.svg")
}
template = %{
#let template(body) = {
set text(12pt, font: "Example")
body
}
}
icon = File.read("icon.svg")
font_bytes = File.read("Example.ttf")
t = Typst::Pdf.from_s(main, dependencies: { "template.typ" => template, "icon.svg" => icon }, fonts: { "Example.ttf" => font_bytes })
# From a zip file that includes a main.typ
# zip file include flat dependencies included and a fonts directory
Typst::Pdf::from_zip("working_directory.zip")
# From a zip with a named main typst file
Typst::Pdf::from_zip("working_directory.zip", "hello.typ")
```
## Contributors & Acknowledgements
typst-rb is based on [typst-py](https://github.com/messense/typst-py) by [messense](https://github.com/messense)
## License
This work is released under the Apache-2.0 license. A copy of the license is provided in the [LICENSE](./LICENSE) file.
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/2821-missing-fields_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
#show figure.caption: it => {
assert(it.has("supplement"))
assert(it.supplement == none)
}
#figure([], caption: [], supplement: none)
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-0600.typ | typst | Apache License 2.0 | #let data = (
("ARABIC NUMBER SIGN", "Cf", 0),
("ARABIC SIGN SANAH", "Cf", 0),
("ARABIC FOOTNOTE MARKER", "Cf", 0),
("ARABIC SIGN SAFHA", "Cf", 0),
("ARABIC SIGN SAMVAT", "Cf", 0),
("ARABIC NUMBER MARK ABOVE", "Cf", 0),
("ARABIC-INDIC CUBE ROOT", "Sm", 0),
("ARABIC-INDIC FOURTH ROOT", "Sm", 0),
("ARABIC RAY", "Sm", 0),
("ARABIC-INDIC PER MILLE SIGN", "Po", 0),
("ARABIC-INDIC PER TEN THOUSAND SIGN", "Po", 0),
("AFGHANI SIGN", "Sc", 0),
("ARABIC COMMA", "Po", 0),
("ARABIC DATE SEPARATOR", "Po", 0),
("ARABIC POETIC VERSE SIGN", "So", 0),
("ARABIC SIGN MISRA", "So", 0),
("ARABIC SIGN S<NAME>", "Mn", 230),
("ARABIC SIGN AL<NAME>", "Mn", 230),
("ARABIC SIGN RAHMATULLAH ALAYHE", "Mn", 230),
("ARABIC SIGN RADI ALL<NAME>", "Mn", 230),
("ARABIC SIGN TAKHALLUS", "Mn", 230),
("ARABIC SMALL HIGH TAH", "Mn", 230),
("ARABIC SMALL HIGH LIGATURE ALEF WITH LAM WITH YEH", "Mn", 230),
("ARABIC SMALL HIGH ZAIN", "Mn", 230),
("ARABIC SMALL FATHA", "Mn", 30),
("ARABIC SMALL DAMMA", "Mn", 31),
("ARABIC SMALL KASRA", "Mn", 32),
("ARABIC SEMICOLON", "Po", 0),
("ARABIC LETTER MARK", "Cf", 0),
("ARABIC END OF TEXT MARK", "Po", 0),
("ARABIC TRIPLE DOT PUNCTUATION MARK", "Po", 0),
("ARABIC QUESTION MARK", "Po", 0),
("ARABIC LETTER KASHMIRI YEH", "Lo", 0),
("ARABIC LETTER HAMZA", "Lo", 0),
("ARABIC LETTER ALEF WITH MADDA ABOVE", "Lo", 0),
("ARABIC LETTER ALEF WITH HAMZA ABOVE", "Lo", 0),
("ARABIC LETTER WAW WITH HAMZA ABOVE", "Lo", 0),
("ARABIC LETTER ALEF WITH HAMZA BELOW", "Lo", 0),
("ARABIC LETTER YEH WITH HAMZA ABOVE", "Lo", 0),
("ARABIC LETTER ALEF", "Lo", 0),
("ARABIC LETTER BEH", "Lo", 0),
("ARABIC LETTER TEH MARBUTA", "Lo", 0),
("ARABIC LETTER TEH", "Lo", 0),
("ARABIC LETTER THEH", "Lo", 0),
("ARABIC LETTER JEEM", "Lo", 0),
("ARABIC LETTER HAH", "Lo", 0),
("ARABIC LETTER KHAH", "Lo", 0),
("ARABIC LETTER DAL", "Lo", 0),
("ARABIC LETTER THAL", "Lo", 0),
("ARABIC LETTER REH", "Lo", 0),
("ARABIC LETTER ZAIN", "Lo", 0),
("ARABIC LETTER SEEN", "Lo", 0),
("ARABIC LETTER SHEEN", "Lo", 0),
("ARABIC LETTER SAD", "Lo", 0),
("ARABIC LETTER DAD", "Lo", 0),
("ARABIC LETTER TAH", "Lo", 0),
("ARABIC LETTER ZAH", "Lo", 0),
("ARABIC LETTER AIN", "Lo", 0),
("ARABIC LETTER GHAIN", "Lo", 0),
("ARABIC LETTER KEHEH WITH TWO DOTS ABOVE", "Lo", 0),
("ARABIC LETTER KEHEH WITH THREE DOTS BELOW", "Lo", 0),
("ARABIC LETTER FARSI YEH WITH INVERTED V", "Lo", 0),
("ARABIC LETTER FARSI YEH WITH TWO DOTS ABOVE", "Lo", 0),
("ARABIC LETTER FARSI YEH WITH THREE DOTS ABOVE", "Lo", 0),
("AR<NAME>", "Lm", 0),
("ARABIC LETTER FEH", "Lo", 0),
("ARABIC LETTER QAF", "Lo", 0),
("ARABIC LETTER KAF", "Lo", 0),
("ARABIC LETTER LAM", "Lo", 0),
("ARABIC LETTER MEEM", "Lo", 0),
("ARABIC LETTER NOON", "Lo", 0),
("ARABIC LETTER HEH", "Lo", 0),
("ARABIC LETTER WAW", "Lo", 0),
("ARABIC LETTER ALEF MAKSURA", "Lo", 0),
("ARABIC LETTER YEH", "Lo", 0),
("<NAME>", "Mn", 27),
("<NAME>", "Mn", 28),
("<NAME>", "Mn", 29),
("<NAME>", "Mn", 30),
("<NAME>", "Mn", 31),
("<NAME>", "Mn", 32),
("<NAME>", "Mn", 33),
("<NAME>", "Mn", 34),
("<NAME>", "Mn", 230),
("ARABIC HAMZA ABOVE", "Mn", 230),
("ARABIC HAMZA BELOW", "Mn", 220),
("ARABIC SUBSCRIPT ALEF", "Mn", 220),
("ARABIC INVERTED DAMMA", "Mn", 230),
("ARABIC MARK NOON GHUNNA", "Mn", 230),
("ARABIC ZWARAKAY", "Mn", 230),
("ARABIC VOWEL SIGN SMALL V ABOVE", "Mn", 230),
("ARABIC VOWEL SIGN INVERTED SMALL V ABOVE", "Mn", 230),
("ARABIC VOWEL SIGN DOT BELOW", "Mn", 220),
("ARABIC REVERSED DAMMA", "Mn", 230),
("ARABIC FATHA WITH TWO DOTS", "Mn", 230),
("ARABIC WAVY HAMZA BELOW", "Mn", 220),
("ARABIC-INDIC DIGIT ZERO", "Nd", 0),
("ARABIC-INDIC DIGIT ONE", "Nd", 0),
("ARABIC-INDIC DIGIT TWO", "Nd", 0),
("ARABIC-INDIC DIGIT THREE", "Nd", 0),
("ARABIC-INDIC DIGIT FOUR", "Nd", 0),
("ARABIC-INDIC DIGIT FIVE", "Nd", 0),
("ARABIC-INDIC DIGIT SIX", "Nd", 0),
("ARABIC-INDIC DIGIT SEVEN", "Nd", 0),
("ARABIC-INDIC DIGIT EIGHT", "Nd", 0),
("ARABIC-INDIC DIGIT NINE", "Nd", 0),
("ARABIC PERCENT SIGN", "Po", 0),
("ARABIC DECIMAL SEPARATOR", "Po", 0),
("ARABIC THOUSANDS SEPARATOR", "Po", 0),
("ARABIC FIVE POINTED STAR", "Po", 0),
("ARABIC LETTER DOTLESS BEH", "Lo", 0),
("ARABIC LETTER DOTLESS QAF", "Lo", 0),
("ARABIC LETTER SUPERSCRIPT ALEF", "Mn", 35),
("ARABIC LETTER ALEF WASLA", "Lo", 0),
("ARABIC LETTER ALEF WITH WAVY HAMZA ABOVE", "Lo", 0),
("ARABIC LETTER ALEF WITH WAVY HAMZA BELOW", "Lo", 0),
("ARABIC LETTER HIGH HAMZA", "Lo", 0),
("ARABIC LETTER HIGH HAMZA ALEF", "Lo", 0),
("ARABIC LETTER HIGH HAMZA WAW", "Lo", 0),
("ARABIC LETTER U WITH HAMZA ABOVE", "Lo", 0),
("ARABIC LETTER HIGH HAMZA YEH", "Lo", 0),
("ARABIC LETTER TTEH", "Lo", 0),
("ARABIC LETTER TTEHEH", "Lo", 0),
("ARABIC LETTER BEEH", "Lo", 0),
("ARABIC LETTER TEH WITH RING", "Lo", 0),
("ARABIC LETTER TEH WITH THREE DOTS ABOVE DOWNWARDS", "Lo", 0),
("ARABIC LETTER PEH", "Lo", 0),
("ARABIC LETTER TEHEH", "Lo", 0),
("ARABIC LETTER BEHEH", "Lo", 0),
("ARABIC LETTER HAH WITH HAMZA ABOVE", "Lo", 0),
("ARABIC LETTER HAH WITH TWO DOTS VERTICAL ABOVE", "Lo", 0),
("ARABIC LETTER NYEH", "Lo", 0),
("ARABIC LETTER DYEH", "Lo", 0),
("ARABIC LETTER HAH WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER TCHEH", "Lo", 0),
("ARABIC LETTER TCHEHEH", "Lo", 0),
("ARABIC LETTER DDAL", "Lo", 0),
("ARABIC LETTER DAL WITH RING", "Lo", 0),
("ARABIC LETTER DAL WITH DOT BELOW", "Lo", 0),
("ARABIC LETTER DAL WITH DOT BELOW AND SMALL TAH", "Lo", 0),
("ARABIC LETTER DAHAL", "Lo", 0),
("ARABIC LETTER DDAHAL", "Lo", 0),
("ARABIC LETTER DUL", "Lo", 0),
("ARABIC LETTER DAL WITH THREE DOTS ABOVE DOWNWARDS", "Lo", 0),
("ARABIC LETTER DAL WITH FOUR DOTS ABOVE", "Lo", 0),
("ARABIC LETTER RREH", "Lo", 0),
("ARABIC LETTER REH WITH SMALL V", "Lo", 0),
("ARABIC LETTER REH WITH RING", "Lo", 0),
("ARABIC LETTER REH WITH DOT BELOW", "Lo", 0),
("ARABIC LETTER REH WITH SMALL V BELOW", "Lo", 0),
("ARABIC LETTER REH WITH DOT BELOW AND DOT ABOVE", "Lo", 0),
("ARABIC LETTER REH WITH TWO DOTS ABOVE", "Lo", 0),
("ARABIC LETTER JEH", "Lo", 0),
("ARABIC LETTER REH WITH FOUR DOTS ABOVE", "Lo", 0),
("ARABIC LETTER SEEN WITH DOT BELOW AND DOT ABOVE", "Lo", 0),
("ARABIC LETTER SEEN WITH THREE DOTS BELOW", "Lo", 0),
("ARABIC LETTER SEEN WITH THREE DOTS BELOW AND THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER SAD WITH TWO DOTS BELOW", "Lo", 0),
("ARABIC LETTER SAD WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER TAH WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER AIN WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER DOTLESS FEH", "Lo", 0),
("ARABIC LETTER FEH WITH DOT MOVED BELOW", "Lo", 0),
("ARABIC LETTER FEH WITH DOT BELOW", "Lo", 0),
("ARABIC LETTER VEH", "Lo", 0),
("ARABIC LETTER FEH WITH THREE DOTS BELOW", "Lo", 0),
("ARABIC LETTER PEHEH", "Lo", 0),
("ARABIC LETTER QAF WITH DOT ABOVE", "Lo", 0),
("ARABIC LETTER QAF WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER KEHEH", "Lo", 0),
("ARABIC LETTER SWASH KAF", "Lo", 0),
("ARABIC LETTER KAF WITH RING", "Lo", 0),
("ARABIC LETTER KAF WITH DOT ABOVE", "Lo", 0),
("ARABIC LETTER NG", "Lo", 0),
("ARABIC LETTER KAF WITH THREE DOTS BELOW", "Lo", 0),
("ARABIC LETTER GAF", "Lo", 0),
("ARABIC LETTER GAF WITH RING", "Lo", 0),
("ARABIC LETTER NGOEH", "Lo", 0),
("ARABIC LETTER GAF WITH TWO DOTS BELOW", "Lo", 0),
("ARABIC LETTER GUEH", "Lo", 0),
("ARABIC LETTER GAF WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER LAM WITH SMALL V", "Lo", 0),
("ARABIC LETTER LAM WITH DOT ABOVE", "Lo", 0),
("ARABIC LETTER LAM WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER LAM WITH THREE DOTS BELOW", "Lo", 0),
("ARABIC LETTER NOON WITH DOT BELOW", "Lo", 0),
("ARABIC LETTER NOON GHUNNA", "Lo", 0),
("ARABIC LETTER RNOON", "Lo", 0),
("ARABIC LETTER NOON WITH RING", "Lo", 0),
("ARABIC LETTER NOON WITH THREE DOTS ABOVE", "Lo", 0),
("ARABIC LETTER HEH DOACHASHMEE", "Lo", 0),
("ARABIC LETTER TCHEH WITH DOT ABOVE", "Lo", 0),
("ARABIC LETTER HEH WITH YEH ABOVE", "Lo", 0),
("ARABIC LETTER HEH GOAL", "Lo", 0),
("ARABIC LETTER HEH GOAL WITH HAMZA ABOVE", "Lo", 0),
("ARABIC LETTER TEH MARBUTA GOAL", "Lo", 0),
("ARABIC LETTER WAW WITH RING", "Lo", 0),
("ARABIC LETTER KIRGHIZ OE", "Lo", 0),
("ARABIC LETTER OE", "Lo", 0),
("ARABIC LETTER U", "Lo", 0),
("ARABIC LETTER YU", "Lo", 0),
("ARABIC LETTER KIRGHIZ YU", "Lo", 0),
("ARABIC LETTER WAW WITH TWO DOTS ABOVE", "Lo", 0),
("ARABIC LETTER VE", "Lo", 0),
("ARABIC LETTER FARSI YEH", "Lo", 0),
("ARABIC LETTER YEH WITH TAIL", "Lo", 0),
("ARABIC LETTER YEH WITH SMALL V", "Lo", 0),
("ARABIC LETTER WAW WITH DOT ABOVE", "Lo", 0),
("ARABIC LETTER E", "Lo", 0),
("ARABIC LETTER YEH WITH THREE DOTS BELOW", "Lo", 0),
("ARABIC LETTER YEH BARREE", "Lo", 0),
("ARABIC LETTER YEH BARREE WITH HAMZA ABOVE", "Lo", 0),
("ARABIC FULL STOP", "Po", 0),
("ARABIC LETTER AE", "Lo", 0),
("ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA", "Mn", 230),
("ARABIC SMALL HIGH LIGATURE QAF WITH LAM WITH ALEF MAKSURA", "Mn", 230),
("ARABIC SMALL HIGH MEEM INITIAL FORM", "Mn", 230),
("ARABIC SMALL HIGH LAM ALEF", "Mn", 230),
("ARABIC SMALL HIGH JEEM", "Mn", 230),
("ARABIC SMALL HIGH THREE DOTS", "Mn", 230),
("ARABIC SMALL HIGH SEEN", "Mn", 230),
("ARABIC END OF AYAH", "Cf", 0),
("ARABIC START OF RUB EL HIZB", "So", 0),
("ARABIC SMALL HIGH ROUNDED ZERO", "Mn", 230),
("ARABIC SMALL HIGH UPRIGHT RECTANGULAR ZERO", "Mn", 230),
("ARABIC SMALL HIGH DOTLESS HEAD OF KHAH", "Mn", 230),
("ARABIC SMALL HIGH MEEM ISOLATED FORM", "Mn", 230),
("ARABIC SMALL LOW SEEN", "Mn", 220),
("ARABIC SMALL HIGH MADDA", "Mn", 230),
("ARABIC SMALL WAW", "Lm", 0),
("ARABIC SMALL YEH", "Lm", 0),
("ARABIC SMALL HIGH YEH", "Mn", 230),
("ARABIC SMALL HIGH NOON", "Mn", 230),
("ARABIC PLACE OF SAJDAH", "So", 0),
("ARABIC EMPTY CENTRE LOW STOP", "Mn", 220),
("ARABIC EMPTY CENTRE HIGH STOP", "Mn", 230),
("ARABIC ROUNDED HIGH STOP WITH FILLED CENTRE", "Mn", 230),
("ARABIC SMALL LOW MEEM", "Mn", 220),
("ARABIC LETTER DAL WITH INVERTED V", "Lo", 0),
("ARABIC LETTER REH WITH INVERTED V", "Lo", 0),
("EXTENDED ARABIC-INDIC DIGIT ZERO", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT ONE", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT TWO", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT THREE", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT FOUR", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT FIVE", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT SIX", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT SEVEN", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT EIGHT", "Nd", 0),
("EXTENDED ARABIC-INDIC DIGIT NINE", "Nd", 0),
("ARABIC LETTER SHEEN WITH DOT BELOW", "Lo", 0),
("ARABIC LETTER DAD WITH DOT BELOW", "Lo", 0),
("ARABIC LETTER GHAIN WITH DOT BELOW", "Lo", 0),
("ARABIC SIGN SINDHI AMPERSAND", "So", 0),
("ARABIC SIGN SINDHI POSTPOSITION MEN", "So", 0),
("ARABIC LETTER HEH WITH INVERTED V", "Lo", 0),
)
|
https://github.com/noahjutz/AD | https://raw.githubusercontent.com/noahjutz/AD/main/notizen/mathe/fib_plot.typ | typst | #import "@preview/cetz:0.2.2"
#import "/config.typ": theme
#let fibs(n) = {
let r = (0, 1)
for i in range(2, n) {
let next = r.at(i - 1) + r.at(i - 2)
r.push(next)
}
return r
}
#cetz.canvas(length: 85%, {
import cetz.draw: *
import cetz.plot
let n = 12
let data = fibs(n).enumerate()
let phi = 1.618
plot.plot(
axis-style: none,
size: (1, .5),
name: "plot", {
plot.add(
domain: (0, n),
x => calc.pow(phi, x) / calc.sqrt(5),
style: (stroke: theme.primary),
)
plot.add(
data,
style: (stroke: none),
mark: "o",
mark-size: .02,
mark-style: (stroke: none, fill: black)
)
plot.annotate({
for (x, y) in data {
content((x, y), anchor: "south", padding: 4pt)[#y]
}
})
})
content("plot.north-east", anchor: "west")[
#text(fill: theme.primary)[$f(n)$]
]
}) |
|
https://github.com/eduardz1/Bachelor-Thesis | https://raw.githubusercontent.com/eduardz1/Bachelor-Thesis/main/chapters/digital-twins.typ | typst | #import "../utils/common.typ": *
= Digital Twins <digital-twins> // TODO: talk maybe about IoT
#_block(title: "NASA's definition of digital twin", text: [
An integrated multiphysics, multiscale, probabilistic simulation of a vehicle or system that uses the best available physical models, sensor updates, fleet history, etc., to mirror the life of its flying twin. It is ultra-realistic and may consider one or more important and interdependent vehicle systems @dtnasa
],
)
A digital twin is a live replica of a Physical System and is connected to it in real time. An ontology-based asset model is often used to connect the state of the DT (Digital Twin) with the PT (Physical Twin) (see @dtschema). Digital Twins are meant as tools to understand and control assets in nature, industry, or society at large, they are meant to adapt as the underlying assets evolve with time @smol. They are categorized into three distinct definitions depending on their level of integration with each being encapsulated into the next @fmi:
#set par(justify: true, first-line-indent: 0em) // FIXME: workaround for https://github.com/typst/typst/issues/1050
/ Digital Model: acts as a digital copy of an existing model or system, changes in the digital copy do not affect the physical system.
/ Digital Shadow: extends the digital copy by automating the exchange of data from the physical system to the digital shadow, but not the opposite.
/ Digital Twin: defines the highest level of integration in which the exchange of data is bidirectional with both systems affecting one another.
#set par(justify: true, first-line-indent: 1em)
NASA was one of the first to introduce the concept of digital twins, however, this research field still lacks any form of standardization, NASA's approach is a monolithic one, what we're trying to do with #link(<smol-heading>)[SMOL] provides a more flexible approach and the basis for a standard way to approach this kind of problems.
#v(600pt) /* FIXME: remove once issue #466 is implemented */
#_content(
[
#figure(
image("../img/dtschema.svg"),
caption: [
High-level representation of a typical digital twin architecture @tbc.
]
) <dtschema>
== Applications
Digital Twins are already extensively employed in a wide range of fields, ranging from power generation equipment (like large engines, and power generation turbines) to establishing timeframes for regularly scheduled maintenance, to the health industry where they can be used to profile patients and help track a variety of health indicators. @dtibm
For instance <NAME>, <NAME>, and <NAME> describes @fmi, in the context of introducing the FMI (@fmi-section) standard in light of the need for a full-system simulation model, a digital twin of a hydrogen generator based on wind-turbine energy, a field where a high degree of modularity is observed. In this case, the digital twin allows for operational optimizations and error detection.
== Twinning by Construction
Digital twins that mirror a structure that does not change over time, also referred to as static digital twins, are said to be _twinned-by-construction_ if the initialization of the digital system ensures the twinning property @tbc. When the PT evolves over time, self-adaptation will play a crucial role in ensuring the twinning property.
More specifically the asset model can be used as the base to construct the digital twin, we see our implementation later on in @asset-model, this kind of DT is what we define as _twinned-by-construction_ and the process of establishing a connection between PT and DT via the asset model is what we call _twinning-by-construction_.
== Self-Adaptation and MAPE-K
Self-adaptation is the process that is triggered when we observe a deviation of the DT from the PT and/or when the asset model changes. In trying to standardize the self-adaptation process the MAPE-K process was introduced.
MAPE-K loops are feedback control loops that are used in self-adaptive systems to organize their behavior @mapek, the acronym summarizes the steps needed and stands for:
#set par(justify: true, first-line-indent: 0em) // FIXME: workaround for https://github.com/typst/typst/issues/1050
/ Monitor: the step in which streams of data are collected from the physical and digital systems.
/ Analyze: the step in which we process the data and express expectations on the data stream that is being fed for the digital twin to work correctly, an error might be raised if an unexpected value is registered or if the difference between the collected and simulated data surpasses a certain threshold.
/ Plan: the step in which model search techniques are used to tune the parameters to realign the DT with the PT.
/ Execute based on Knowledge: the step in which the DT is reset with the updated parameters that were computed in the preceding step.
#set par(justify: true, first-line-indent: 1em)
== FMI <fmi-section>
FMI stands for Functional Mockup Interface, it's a standard created to standardize the model exchange and the co-simulation format in the field of digital twins @fmi. The interface encapsulates simulators in FMUs (Functional Mock-up Units) which are software components that are used for exchanging and simulating dynamic system models. As formalized by <NAME>, and Vangheluwe @cosim, simulation units are a tuple $(S, U, Y, mono("set"), mono("get"), mono("doStep"))$ with $S$ as the domain of internal states, $U$ the set of inputs, $Y$ the set of outputs, $mono("set"): S times U times cal(V) -> S$ the function to set the values of the inputs to some values of domain #v(600pt) /* FIXME: remove once issue #466 is implemented */$cal(V)$, $mono("get"): S times Y -> cal(V)$ the function to get the results and $mono("doStep"): S times RR^+ -> RR$ the function to perform the simulation for a given amount of time @ksosu.
]
) |
|
https://github.com/cnaak/untypsignia.typ | https://raw.githubusercontent.com/cnaak/untypsignia.typ/main/test/test-01-readme.typ | typst | MIT License | #set page(width: auto, height: auto, margin: 12pt, fill: rgb("19181f"))
#set par(leading: 1.5em)
#set text(font: "Rouge Script", fill: rgb("80f4b6"))
#import "lib.typ": *
#let say() = [I prefer #typstmark() over #texmark() or #latexmark().]
#for sz in (20, 16, 14, 12, 10, 8) {
set text(size: sz * 1pt)
say()
linebreak()
}
|
https://github.com/KireinaHoro/research-plan | https://raw.githubusercontent.com/KireinaHoro/research-plan/master/systems-cover/manual.typ | typst | #import "@preview/tidy:0.3.0"
#import "systems-cover.typ"
#let docs = tidy.parse-module(
read("systems-cover.typ"),
name: "Systems Group Cover Page",
scope: (mod: systems-cover),
preamble: "import mod: *;"
)
#show link: underline
#set page(footer: align(center, counter(page).display("1")))
#tidy.show-module(docs)
|
|
https://github.com/DieracDelta/presentations | https://raw.githubusercontent.com/DieracDelta/presentations/master/polylux/book/src/dynamic/list-one-by-one.typ | typst | #import "../../../polylux.typ": *
#set page(paper: "presentation-16-9")
#set text(size: 50pt)
#polylux-slide[
#list-one-by-one(marker: [--], tight: false)[first][second][third]
]
|
|
https://github.com/tingerrr/chiral-thesis-fhe | https://raw.githubusercontent.com/tingerrr/chiral-thesis-fhe/main/assets/images/draft-watermark.typ | typst | #set page(height: auto, width: auto, margin: 0pt)
#set text(gray.lighten(85%), 122pt)
Entwurf
|
|
https://github.com/gongke6642/tuling | https://raw.githubusercontent.com/gongke6642/tuling/main/可视化/梯度/tidu.typ | typst | #image("1.png")
= 例子
#image("2.png")
渐变在文本上也受支持,但仅当将相对性设置为(默认值)或 时。若要创建逐字或逐字形渐变,可以手动或通过显示规则将文本的字词或字符换行到框中。auto"parent"
#image("3.png")
= 停止
渐变由一系列停靠点组成。每个停靠点都有一个颜色和一个偏移量。偏移量是 和 之间的比率或 和 之间的角度。偏移量是一个相对位置,用于确定停止点沿梯度的距离。光标的颜色是该位置的渐变颜色。在定义渐变时,可以选择省略偏移量。在这种情况下,Typst 将均匀地间隔所有停靠点。0%100%0deg360deg
= 相对性
和停靠点的位置取决于容器的尺寸。这个容器可以是它被涂漆的形状,也可以是最近的周围容器。这由梯度构造函数的参数控制。默认情况下,渐变是相对于它们所绘制的形状的,除非渐变应用于文本,在这种情况下,渐变是相对于最接近的祖先容器的。0%100%relative
Typst 按如下方式确定祖先容器:
对于放置在文档根/顶层的形状,最接近的祖先是页面本身。
对于其他形状,祖先是包含该形状的最内层块或框。这包括由显示规则和元素隐式创建的框和块。例如,旋转不会影响渐变的父级,但栅格会影响。
= 色彩空间和插值
渐变可以在任何颜色空间中插值。默认情况下,渐变在 Oklab 色彩空间中插值,这是一个感知均匀的色彩空间。这意味着渐变将被视为具有平滑的颜色渐进。这对于数据可视化特别有用。
但是,您可以选择在所需的任何受支持的颜色空间中插入渐变,但请注意,某些颜色空间不适合在颜色之间进行感知插值。选择插值空间时,请参阅下表。
#image("4.png")
= 方向
某些渐变对方向敏感。例如,线性渐变具有确定其方向的角度。Typst 使用顺时针角度,0° 从左到右,90°从上到下,180°从右到左,270°从下到上。
#image("5.png")
= 预设
Typst 预定义了可用于渐变的颜色映射表。有关详细信息,请参阅颜色文档。
= 关于文件大小的注意事项
梯度可能非常大,尤其是当它们有很多停靠点时。这是因为渐变存储为颜色和偏移量列表,这可能会占用大量空间。如果您担心文件大小,则应考虑以下几点:
SVG 梯度目前编码效率低下。这将在未来得到改进。
color.hsv、color.hsl 和 color.oklch 色彩空间中的 PDF 渐变存储为 color.oklab 颜色列表,中间有额外的停靠点。这样就避免了在 PDF 文件中对这些色彩空间进行编码的需要,但它确实会为渐变添加额外的停顿,从而增加文件大小。
= 定义
= linear
创建新的线性渐变,其中颜色沿直线过渡。
#image("6.png")
#image("7.png")
= radial
创建新的径向渐变,其中颜色从原点辐射出去。
渐变由两个圆圈定义:焦点圆圈和结束圆圈。焦圆是一个具有中心和半径的圆,它定义了渐变开始的点,并具有第一个停止点的颜色。结束圆是具有中心和半径的圆,它定义了渐变结束的点,并具有最后一个停靠点的颜色。然后将梯度插值在这两个圆之间。focal-centerfocal-radiuscenterradius
使用这四个值,也称为起始圆的焦点和结束圆的中心和半径,我们可以定义一个比基本径向渐变具有更有趣属性的渐变。
#image("8.png")
#image("9.png")
= conic
创建新的圆锥渐变,其中颜色围绕中心点径向变化。
您可以使用参数来控制渐变的中心点。默认情况下,中心点是形状的中心。center
#image("10.png")
#image("11.png")
= sharp
创建此渐变的锐化版本。
锐利的渐变在颜色之间具有离散的跳跃,而不是平滑的过渡。它们对于创建预设渐变的颜色列表特别有用。
#image("12.png")
= repeat
重复此渐变给定的次数,并可选择在每次重复时镜像它。
#image("13.png")
#image("14.png")
#image("15.png")
|
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/visualize/image-05.typ | typst | Other | // Test advanced SVG features.
#image("test/assets/files/pattern.svg")
|
https://github.com/Lucas-Wye/tech-note | https://raw.githubusercontent.com/Lucas-Wye/tech-note/main/src/docker.typ | typst | = Docker
#label("docker")
- Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的 Linux或Windows 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。
== Install
#label("install")
```sh
# Ubuntu
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# 建立docker组
sudo groupadd docker
# 将当前用户加入docker组
sudo usermod -aG docker $USER
# 卸载本机所有的镜像、容器、卷以及配置文件
sudo rm -rf /var/lib/docker
```
== Basic
=== Pull
```sh
docker pull [user name]/[repo name]:[tag name]
```
=== Run
```sh
-i # 以交互模式运行容器,通常与 -t 同时使用
-t # 为容器重新分配一个伪输入终端,通常与 -i 同时使用
-v # 绑定一个卷,格式为:本机绑定目录:容器内部绑定目录
-d # 后台运行容器,并返回容器ID
-P # 随机端口映射,容器内部端口随机映射到主机的高端口
-p # 指定端口映射,格式为:主机(宿主)端口:容器端口
-a # 指定标准输入输出内容类型,可选 STDIN/STDOUT/STDERR 三项
–name # 对所新建容器进行命名
–rm # 容器终止后,自动删除容器文件
```
=== Others
```sh
# 列出容器
docker container ls -a
# 查看容器ID
docker ps -a
# 重新启动已被终止的指定容器
docker start [CONTAINER ID]
# 终止容器
docker stop [CONTAINER NAME/ID]
# 若是利用 -it 在容器内部进行操作,仅需输入 exit 即可
# 删除容器
docker kill [CONTAINER NAME/ID]
# 将所有容器删除
docker container prune
# 列出镜像
docker images
# 重命名镜像
docker tag [old REPOSITORY]:[old TAG] or [IMAGE ID] [new REPOSITORY]:[new TAG]
# 删除镜像
docker rmi [IMAGE]
# 存出镜像
docker save -o [xx.tar] [REPOSITORY]:[TAG]
# 载入镜像
sudo docker load --input [镜像文件]
# 更新镜像
docker commit [OPTIONS] [IMAGE ID] [new REPOSITORY]:[new TAG]
# -m: 提交的描述信息
# -a: 指定镜像作者
```
== More
#label("more")
#link("https://www.runoob.com/docker/docker-container-usage.html")[Docker教程]
\
#link("https://wiki.jikexueyuan.com/project/docker-technology-and-combat/save_load.html")[Docker学习笔记]
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/list-marker_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test en-dash.
#set list(marker: [--])
- A
- B
|
https://github.com/WShohei/presentation | https://raw.githubusercontent.com/WShohei/presentation/master/lab/0926/slide/main.typ | typst | #import "templates/template.typ": *
#show: doc => slides(doc)
#show link: l => underline(l)
#show figure: it => {
show figure.caption: set text(7pt)
it
}
#slide(
title: "About this paper", pad(
x: 2em,
)[
#figure(
image("images/header.png")
)
- This paper is presented at SOSP 2023.
- PagedAttention, which is proposed in this paper, is the core of #link("https://github.com/vllm-project/vllm")[vLLM], the one of the state-of-the-art LLM serving systems.
])
== Preliminaries
#slide(
title: "KV Cache", pad(
x: 2em,
)[
#figure(image("images/KVCache.png"),
caption: "The mechanism of KV Cache. Cited from https://resources.nvidia.com/ja-jp-llm-developer-day/mastering-llm-techniques-inference-optimization")
])
#slide(
title: "batching techniques for serving LLMs", pad(
x: 2em,
)[
- Because requests for a LLM share the same model weights, #underline("batching can be applied to amortize the overhead of loading the model weights.")
- The batching techniques for serving LLMs are categorized into two types.
- request-level batching
#figure(
image("images/request-level.png", height: 30%)
)
- token-level batching
#figure(
image("images/token-level.png", height: 30%)
)
])
== Background
#slide(
title: "memory-bound throughput", pad(
x: 2em,
)[
- The throughput of these systems is memory-bound.
- These systems process multiple requests concurrently.
- The memory consumption make a barrier to the scalability.
- Less memory consumption means more requests can be processed concurrently.
#figure(
image("images/batch-memory.png", height: 50%), caption: "The memory consumption of LLMs served by existing systems and vLLM with different batch sizes."
)
])
#slide(
title: "memory distribution", pad(
x: 2em,
)[
- The memory distribution of the LLM is like below. (The size is the example of LLMs with 13B parameters.)
- Parameters: 65% (26GB)
- KV Cache: 30% (12GB)
- Others (e.g., activation): 5% (2GB)
#figure(
image("images/memory-dist.png", height: 60%), caption: "The memory distribution of LLMs with 13B parameters.",
)
])
#slide(
title: "", pad(
x: 2em,
)[
- The model parameters are constant during inference phase and the activations only occupy a small fraction of the GPU memory.
- KV Cache is the main bottleneck of the memory consumption.
#figure(
image("images/memory-dist-inst.png", height: 60%), caption: "The memory distribution of LLMs with 13B parameters.",
)
])
#slide(
title: "existing ways to manage the KV Cache", pad(
x: 2em
)[
The existing way to manage KV Cache is as follows:
+ *pre-allocate* the whole size of KV Cache in *coutiguous* virtual memory. (It is corresponding to the size of the model's maximum output length.)
+ pre-fill the KV Cache with the users' prompts.
+ iterate decoding and append the corresponding results to the KV Cache one by one.
#figure(
image("images/Inference-steps.png", height: 60%), caption: "Cited from https://aijishu.com/a/1060000000458185",
)
])
#slide(
title: "existing ways to manage the KV Cache", pad(
x: 2em
)[
This way has three types of memory wastes:
+ *internal-fragmentation*: the pre-allocated KV Cache is not fully used since the final output length is not always the maximum.
+ *external-fragmentation*: memory allocators often cause external fragmentation. (e.g., Buddy memory allocator)
+ *reserved* slots: the KV Cache is pre-allocated with the maximum output length, though the output length increases one by one.
#figure(
image("images/existing-kvmanage.png", width: 100%), caption: "KV cache memory management in existing systems.",
)
])
#slide(
title: "other challenging points", pad(
x: 2em
)[
LLM serving systems offer a range of decoding algorithms, such as:
- *greedy decoding*
- *beam search*
- *top-k sampling*
#text(blue)[The KV cache corresponding to the user's prompt can be shared] to minimize the memory consumption.
On the other hand, the KV cache during the autoregressive generation phase should remain unshared due to the different sample results and their dependencies on context and positions.
])
== Method
#slide(
title: "system overview of vLLM", pad(
x: 2em
)[
- PagedAttention divides the KV Cache into multiple #text(font: "Times New Roman", style: "italic")[pages].
- Each page is allocated only when it is needed.
- The pages are managed by a centralized scheduler.
- Because the scheduler works in user-space, it causes several problems. (about that later)
#figure(
image("images/vllm-overview.png", height: 60%), caption: "The system overview of PagedAttention."
)
])
#slide(
title: "PagedAttention", pad(
x: 2em
)[
vLLM works with PagedAttention as follows:
+ As in OS's virtual memory management, PagedAttention does not require reserving the memory for the maximum possible generated sequence length initially.
+ In the first autoregressive decoding step, vLLM generates the new token with the PagedAttention algorithm on physical blocks 7 and 1.
+ At the second decoding step, as the last logical block is full, vLLM stores the newly generated KV cache in a new logical block (physical block 3).
#figure(
image("images/pagedAttention.png", height: 50%), caption: "Block table translation in vLLM."
)
])
#slide(
title: "Application to Other Decoding Senarios - Parallel sampling - ", pad(
x: 2em
)[
In LLM-based program assistants, an LLM generates multiple completions for a single input prompt in parallel. Users can choose a favorite output.
#figure(
image("images/parallel-sampling.png", height: 50%), caption: "Parallel sampling example."
)
In parallel sampling, the KV cache corresponding to the user's prompt can be shared to minimize the memory consumption.
])
#slide(
title: "Application to Other Decoding Senarios - Parallel sampling - ", pad(
x: 2em
)[
When generating multiple texts, when a different token is output for the first time, the corresponding page is duplicated for each token, creating a separate page for each (#text(blue)[copy-on-write]).
Since one page can be shared across multiple contexts, #text(blue)[reference counting] is implemented to manage memory.
#figure(
image("images/parallel-sampling.png", height: 50%), caption: "Parallel sampling example."
)
])
#slide(
title: "Application to Other Decoding Senarios - Beam search - ", pad(
x: 2em
)[
In LLM tasks like machine translation, the users expect the top-k most appropriate translations output by the LLM.
#figure(
image("images/beam-search.png", height: 50%), caption: "Beam search example."
)
Unlike parallel decoding, beam search facilities sharing not only the blocks corresponding to the user's prompt but also other blocks across different candidates.
])
#slide(
title: "Application to Other Decoding Senarios - Beam search - ", pad(
x: 2em
)[
Previous LLM serving systems require frequent memory copies of the KV cache across the beam candidates.
For example, in the case shown in the figure, after the dotted line, candidate 3 (Block 12) would need to copy a large portion of candidate 2's KV cache to continue generation.
#figure(
image("images/beam-search.png", height: 50%), caption: "Beam search example."
)
This frequent memory copy overhead is significantly reduced by vLLM's physical block sharing.
])
#slide(
title: "Scheduling and Preemption", pad(
x: 2em
)[
As the number of requests and their outputs grow, systems can run out of the GPU's physical memory to store the newly generated KV cache.
When the request traffic surpasses the system's capacity, it must prioritize a subset of requests.
LLM serving systems face a unique challenge in the scheduling and preemption in LLM serving systems:
#text(blue)[the resulting output lengths are not known a priori, contignent on both the input prompt and the model.]
There are two classic questions that these LLM serving systems must answer:
+ What blocks should it evict?
+ How to recover evicted blocks if needed again?
])
#slide(
title: "What blocks should it evict?", pad(
x: 2em
)[
Since we know that all blocks of a sequence are accessed together, #text(blue)[all-or-nothing eviction policy] is applied to the blocks.
Furthermore, multiple sequences within one request (e.g., beam candidates in one beam search request) are gang-scheduled as a sequence group.
])
#slide(
title: "How to recover evicted blocks if needed again?", pad(
x: 2em
)[
There are two ways to recover evicted blocks:
+ *Swapping*: This is the classic technique used by most virtual memory implementations which copy the evicted pages to a swap space on the disk. In vLLM, evicted blocks are copied to the CPU memory. Besides the GPU block allocator, vLLM includes a CPU block allocator to manage the physical blocks swapped to CPU RAM.
+ *Recomputation*: This is a technique that recomputes the evicted blocks when needed. Note that #text(blue)[recomputation latency is significantly lower than the original latency, as the tokens generated at decoding can be concatenated with the original user prompt as a new prompt.]
])
== Evaluation
#slide(
title: "Model and server configurations", pad(
x: 2em
)[
- Model:
- OPT (with 13B, 66B, 175B parameters)
- LLaMA (with 13B parameters)
- Server: A2 instance with NVIDIA A100 GPUs on GCP
The detailed configurations are like below.
#figure(
image("images/eval-conf.png", height:50%), caption: "The detailed configurations of the model and server."
)
])
#slide(
title: "Workloads", pad(
x: 2em
)[
Datasets:
- ShareGPT: collection of user-shared cconversations with ChatGPT.
- Alpaca: instruction dataset generated by GPT-3.5 with self-instruct.
ShareGPT dataset has 8.4 times longer input prompts and 5.8 times longer outputs on average than the Alpaca dataset.
#figure(
image("images/dataset-dist.png", height: 40%), caption: "The distribution of the dataset."
)
These datasets do not include timestamps, so the authors added timestamps using Poisson distribution to simulate the real-world scenario.
])
#slide(
title: "Baselines and Key metrics", pad(
x: 2em
)[
*Baselines*:
- #link("https://github.com/NVIDIA/FasterTransformer")[FasterTransformer]: distributed inference engine highly optimized for latency. Its development has transitioned to #link("https://github.com/NVIDIA/TensorRT-LLM/tree/release/0.5.0")[TensorRT-LLM].
- #link("https://arxiv.org/pdf/2306.02707")[Orca]: a state-of-the-art at that time LLM serving system, which proposed the *iteration-level batching* technique.
*Key metrics*:
#text(blue)[The mean of every request's end-to-end latency divided by its output length.] A high-throughput serving system should have a low normalized latency against high request rates.
#figure(
image("images/e2e-latency.png", height: 40%), caption: "The end-to-end latency of the baselines."
)
])
#slide(
title: "Baselines and Key metrics", pad(
x: 2em
)[
They implemented three version of Orca as baselines:
+ *Orca (Oracle)*: It has the knowledge of the length of the outputs that will be actually generated for the requests. This shows upper-bound performance of Orca, #text(red)[which is infeasible in real-world scenarios].
+ *Orca (Pow2)*: It over-reserves the space for outputs by at most 2x.
+ *Orca (Max)*: It always reserves the maximum possible output length.
#table(
columns: (auto, auto, auto),
table.header(
[], [*Actual output length* (examples)], [*Reserved memory size*]
),
[*Orca (Oracle)*], [125 tokens], [125 tokens],
[*Orca (Pow2)*], [125 tokens], [250 tokens],
[*Orca (Max)*], [125 tokens], [2048 tokens]
)
])
#slide(
title: "Basic sampling", pad(
x: 2em
)[
#figure(
image("images/single-sequence-generation.png", height:80%), caption: "The end-to-end latency with OPT models on the ShareGPT and Alpaca dataset"
)
])
#slide(
title: "Basic sampling", pad(
x: 2em
)[
#figure(
image("images/single-sequence-generation-explosion.png", height: 60%), caption: "The end-to-end latency with OPT models on the ShareGPT and Alpaca dataset"
)
As the request rate increases, the latency initially increases at a gradual pace but then suddenly explodes.
This is because the request rate surpasses the capacity of the serving system, the queue length continues to grow infinitely and so does the latency of the requests.
])
#slide(
title: "Basic sampling", pad(
x: 2em
)[
#figure(
image("images/single-sequence-generation-less-pronounced.png", height: 60%), caption: "Average number of batched requests when serving OPT-13B for the ShareGPT (2 reqs/s) and Alpaca (30 reqs/s) datasets."
)
vLLM's advantage over Orca (Oracle) is less pronounced in (f).
This is because the model and server configuration for OPT-175B allows for #text(blue)[large GPU memory space] available to store KV cache, while #text(blue)[the Alpaca dataset has short sequences.]
These models can afford to reserve the maximum possible output length without running out of memory.
])
#slide(
title: "Basic sampling", pad(
x: 2em
)[
#figure(
image("images/batched-requests-shareGPT.png", height: 60%), caption: "Average number of batched requests when serving OPT-13B for the ShareGPT (2 reqs/s) and Alpaca (30 reqs/s) datasets."
)
vLLM has the capability of batching and processing more requests concurrently than the baselines.
])
#slide(
title: "Parallel Sampling and Beam Search", pad(
x: 2em
)[
#figure(
image("images/parallel-beam.png", height:60%), caption: "The end-to-end latency of parallel generation and beam search with OPT-13B on the Alpaca dataset."
)
With a larger number of sequences to sample or wider beam width, the performance gap between vLLM and the baselines widens. It's because the efficient memory sharing ,and management of vLLM can be more beneficial in these scenarios.
])
#slide(
title: "Parallel Sampling and Beam Search", pad(
x: 2em
)[
#figure(
image("images/avr-amount-mem-save.png", height:60%), caption: "Average amount of memory saving from sharing KV blocks, when serving OPT-13B for the Alpaca dataset."
)
- 6.1%-9.8% memory saving on parallel sampling
- 37.6%-55.2% memory saving on beam search
])
== Limitations
#slide(
title: "Redundancy of PagedAttention", pad(
x: 2em
)[
#figure(
image("images/pagedAttention-corrected.png", height: 70%), caption: "Block table translation in vLLM."
)
#text(red)[The image of PagedAttention in the paper is misleading.]
The block table manager is in the user space, so it maps the user space block IDs to the virtual memory addresses. This may deteriorate the coalescing of memory accesses.
])
#slide(
title: "Redundancy of PagedAttention", pad(
x: 2em
)[
#figure(
image("images/redundancy-pagedattention.png", height:60%), caption: "PagedAttention involves two layers of memory management: one in user space and one in OS kernel space."
)
PagedAttention needs to track #text(blue)[virtual] memory addresses of KV cache blocks and pass them to the attention kernel at runtime.
This approach requires deplicating what the operationg system already does for enabling #text(blue)[virtual-to-physical] address tranlsation.
])
#slide(
title: "Redundancy of PagedAttention", pad(
x: 2em
)[
#figure(
image("images/FA-Paged.png", height:60%), caption: [Overhead of PagedAttention in prefill kernels (model: Llama-3-8B, one A100 GPU). Numbers on top show overhead over the corresponding non-paged implementation of FlashAttention (FA) and FlashInfer (FI). #text(red)[Note that the FlashAttention and FlashInfer functionalities shown in the figure are features of vLLM.]]
)
This redundancy impacts the system's programmability, making it more challenging to correctly and efficiently implement other techniques that enhance the throughput and user experience of LLMs.
This figure shows that PagedAttention with other techniques has a significant overhead compared to the non-paged implementation of FlashAttention and FlashInfer.
])
== Related Work
#slide(
title: "Solution to Redundancy of PagedAttention: vAttention", pad(
x: 2em
)[
#figure(
image("images/vAttention-API.png"), caption: "vAttention API."
)
#link("https://arxiv.org/pdf/2405.04437")[vAttention] provides the same functionality as PagedAttention but without the redundant memory management #text(blue)[leveraging the low-level CUDA virtual memory management.]
For this purpose, they implemented custom CUDA memory allocator APIs because the existing CUDA APIs do not support the page size granularity of 64KB, which is the optimal size for the KV cache.
])
#slide(
title: "Solution to Redundancy of PagedAttention: vAttention", pad(
x: 2em
)[
#figure(
image("images/vAttention-workload-a.png"), caption: "The workload of vAttention."
)
])
#slide(
title: "Solution to Redundancy of PagedAttention: vAttention", pad(
x: 2em
)[
#figure(
image("images/vAttention-workload-b.png"), caption: "The workload of vAttention."
)
])
#slide(
title: "Solution to Redundancy of PagedAttention: vAttention", pad(
x: 2em
)[
#figure(
image("images/vAttention-workload-c.png"), caption: "The workload of vAttention."
)
])
#slide(
title: "Solution to Redundancy of PagedAttention: vAttention", pad(
x: 2em
)[
#figure(
image("images/vAttention-workload-d.png"), caption: "The workload of vAttention."
)
])
#slide(
title: "Solution to Redundancy of PagedAttention: vAttention", pad(
x: 2em
)[
#figure(
image("images/vAttention-workload-e.png"), caption: "The workload of vAttention."
)
])
#slide(
title: "Solution to Redundancy of PagedAttention: vAttention", pad(
x: 2em
)[
vAttention has the following advantages:
- The functionality of vAttention is #text(blue)[user-friendly for programmers], as it provides the same capabilities as PagedAttention without requiring manual memory management in user space.
- It follows that other techniques that improve the throughput and user experience of LLMs can be implemented more easily.
- The memory management overhead is reduced by leveraging the OS's virtual memory management.
However, it does not seem that vLLM has integrated vAttention. (#link("https://github.com/vllm-project/vllm/pull/6102")[PR \#6102])
])
#slide(
title: "Tradeoff between Time-between-tokens Latency and Throughput", pad(
x: 2em
)[
#grid(
columns: 2,
[
#figure(
image("images/tbt-throughput-tradeoff.png", height: 60%), caption: "The tradeoff between time-between-tokens latency and throughput."
)
],
[
#figure(
image("images/Inference-steps.png", height: 60%), caption: "Cited from https://aijishu.com/a/1060000000458185"
)
]
)
Current LLM serving systems involve a tradeoff between throughput and latency depending on their scheduling policy.
Prioritizing prefills optimizes throughput but sacrifices TBT (time-between-tokens) latency, while prioritizing decoding has the opposite effect.
])
#slide(
title: "Scheduling policies", pad(
x: 2em
)[
#figure(
image("images/scheduling.png", height: 60%), caption: "Scheduling policies of different LLM serving systems. A, B, C and D represent different requests. Subscript d represents a decode iteration, p represents a full prefill and p0, p1 represent two chunked prefills of a given prompt."
)
- A generation stall occurs when one or more prefills are scheduled in between consecutive decode iterations of a request.
- #link("https://www.usenix.org/system/files/osdi24-agrawal.pdf")[Sarathi-Serve] generates a schedule that eliminates generation stalls yet delivers high throughput splitting the prefills into smaller chunks. (#text(blue)[This functionality has already been merged into vLLM.])
])
#slide(
title: "Scheduling policies", pad(
x: 2em
)[
#figure(
image("images/scheduling-algorithm.png", height: 60%)
)
Aformentioned LLM serving systems all use FCFS (First-Come-First-Serve) scheduling policy.
There are other scheduling policies that can be applied to LLM serving systems.
These other scheduling policies are based on the principle: #text(blue)[shorter tasks should be scheduled before longer tasks].
(SRPT is infeasible due to the indeterminable output lengths of LLMs.)
])
#slide(
title: "Scheduling policies", pad(
x: 2em
)[
#figure(
image("images/scheduling-algorithm.png", height: 60%)
)
MLFQ (Multi-Level Feedback Queue) is a CPU scheduling algorithm that assigns processes to different priority levels based on their execution behavior. It dynamically adjusts process priority, giving preference to I/O-bound or short-running tasks and demoting CPU-bound processes to lower-priority queues to improve overall system responsiveness.
])
#slide(
title: "Scheduling policies", pad(
x: 2em
)[
#figure(
image("images/scheduling-algorithm.png", height: 60%)
)
#link("https://arxiv.org/pdf/2305.05920")[FastServe] proposes Skip-Join MLFQ, a scheduling policy leveraging LLMs' unique characteristics to improve throughput and latency.
Skip-Join MLFQ #text(blue)[determine the priority of a request based on the number of tokens of the user input prompt.] It skips the requests with a large number of tokens to avoid the generation stall.
])
== Conclusion
#slide(
title: "", pad(
x: 2em
)[
- PagedAttention proposed the method to manage the KV cache efficiently inspired by the virtual memory management of OS.
- vAttention adrressed the redundancy of PagedAttention by leveraging the low-level CUDA virtual memory management.
- TBT latency caused by long stalls during prefill generation can be minimized by splitting the prefills into smaller chunks.
- The scheduling policy based on the number of tokens of the user input prompt can improve the throughput and latency of LLM serving systems.
])
#slide(
title: "My thoughts", pad(
x: 2em
)[
- The scheduling policy in LLM serving systems can be optimized by predicting the output length of requests.
- Speculative execution in LLMs, which runs multiple computations in parallel based on predictions from smaller draft models, helps reduce latency and improve efficiency.
- Similarly, predictive methods can enhance the scheduling policy.
- Preemption occurs when the KV cache exceeds GPU memory. Current strategies simply evict or recompute blocks, but preemption could be improved by using KV cache compaction techniques, preserving output quality without unnecessary recomputation.
]) |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-A4D0.typ | typst | Apache License 2.0 | #let data = (
("LISU LETTER BA", "Lo", 0),
("LISU LETTER PA", "Lo", 0),
("LISU LETTER PHA", "Lo", 0),
("LISU LETTER DA", "Lo", 0),
("LISU LETTER TA", "Lo", 0),
("LISU LETTER THA", "Lo", 0),
("LISU LETTER GA", "Lo", 0),
("LISU LETTER KA", "Lo", 0),
("LISU LETTER KHA", "Lo", 0),
("LISU LETTER JA", "Lo", 0),
("LISU LETTER CA", "Lo", 0),
("LISU LETTER CHA", "Lo", 0),
("LISU LETTER DZA", "Lo", 0),
("LISU LETTER TSA", "Lo", 0),
("LISU LETTER TSHA", "Lo", 0),
("LISU LETTER MA", "Lo", 0),
("LISU LETTER NA", "Lo", 0),
("LISU LETTER LA", "Lo", 0),
("LISU LETTER SA", "Lo", 0),
("LISU LETTER ZHA", "Lo", 0),
("LISU LETTER ZA", "Lo", 0),
("LISU LETTER NGA", "Lo", 0),
("LISU LETTER HA", "Lo", 0),
("LISU LETTER XA", "Lo", 0),
("LISU LETTER HHA", "Lo", 0),
("LISU LETTER FA", "Lo", 0),
("LISU LETTER WA", "Lo", 0),
("LISU LETTER SHA", "Lo", 0),
("LISU LETTER YA", "Lo", 0),
("LISU LETTER GHA", "Lo", 0),
("LISU LETTER A", "Lo", 0),
("LISU LETTER AE", "Lo", 0),
("LISU LETTER E", "Lo", 0),
("LISU LETTER EU", "Lo", 0),
("LISU LETTER I", "Lo", 0),
("LISU LETTER O", "Lo", 0),
("LISU LETTER U", "Lo", 0),
("LISU LETTER UE", "Lo", 0),
("LISU LETTER UH", "Lo", 0),
("LISU LETTER OE", "Lo", 0),
("LISU LETTER TONE MYA TI", "Lm", 0),
("LISU LETTER TONE NA PO", "Lm", 0),
("LISU LETTER TONE MYA CYA", "Lm", 0),
("LISU LETTER TONE MYA BO", "Lm", 0),
("LISU LETTER TONE MYA NA", "Lm", 0),
("LISU LETTER TONE MYA JEU", "Lm", 0),
("LISU PUNCTUATION COMMA", "Po", 0),
("LISU PUNCTUATION FULL STOP", "Po", 0),
)
|
https://github.com/goshakowska/Typstdiff | https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_working_types/inline_math/inline_math.typ | typst | $Q = rho A v + C$
$A^2 + B^2 = C^2$ |
|
https://github.com/typst-community/valkyrie | https://raw.githubusercontent.com/typst-community/valkyrie/main/tests/types/any/test.typ | typst | Other | #import "/src/lib.typ" as z
#import "/tests/utility.typ": *
#show: show-rule.with();
#let schema = z.any()
= types/any
== Input types
#{
let input-types = (
"content (empty)": [],
"content (lorem)": lorem(20),
"number (0)": 0,
"number (negative float)": -1.2,
"string (empty)": "",
"string (lorem)": str(lorem(20)),
"dictionary (empty)": (:),
"dictionary": (foo: "bar"),
)
for (name, value) in input-types {
utility-expect-eq(
test: value,
schema: schema,
truth: value,
)([It should validate #name])
}
}
#z.parse(none, z.any(optional: true)) |
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/VerbaliInterni/VerbaleInterno_040323/meta.typ | typst | MIT License | #let data_incontro = "04-03-2024"
#let inizio_incontro = "14:00"
#let fine_incontro = "15:30"
#let luogo_incontro = "Discord" |
https://github.com/gabrielluizep/typst-ifsc | https://raw.githubusercontent.com/gabrielluizep/typst-ifsc/main/template/ifsclean.typ | typst | Creative Commons Zero v1.0 Universal | #import "@preview/polylux:0.3.1": *
#let primaryColor = rgb("#31a250")
#let ifsclean-footer = state("ifsclean-footer", [])
#let footer = [
#set align(right + bottom);
#set text(size: .6em, fill: rgb("#b2b2b2"))
#pad(0.5em)[
#counter(page).display("1 / 1", both: true)
]
]
#let ifsclean-theme(aspect-ratio: "16-9", body) = {
set page(
paper: "presentation-" + aspect-ratio,
margin: 0em,
header: none,
footer: none,
)
set text(size: 2em, font: "FreeSans")
show footnote.entry: set text(size: .6em)
ifsclean-footer.update(footer)
body
}
#let title-slide(
title: "IFSC Polylux",
subtitle: "Uma tema clean para apresentações",
authors: ((name: "<NAME>", email: "<EMAIL>")),
date: "12/12/2012",
) = {
set text(white)
box(
fill: primaryColor,
width: 100.1%,
height: 100.1%,
inset: (x: 4em, top: 5em, bottom: 2em),
)[
#box()[#text([*#title*], size: 2em)]
#v(0.25em)
#box()[#text(subtitle)]
#align(right + bottom)[
*#authors.name* \
#authors.email \
#date
]
#align(left + bottom)[
#image("/assets/ifsc-logo-h-branco.png", width: 8em)
]
]
}
#let slide(title: none, body) = {
if title != none {
[*#title*]
} else {
[*#utils.current-section*]
}
utils.current-section
body
ifsclean-footer.display()
}
#let new-section-slide(name: "section") = {
set page(fill: primaryColor, margin: (x: 1.5em, y: 2.5em))
set align(left + bottom)
set text(fill: white, size: 2.5em)
utils.register-section(name)
[*#name*]
} |
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/084.%20newthings.html.typ | typst | newthings.html
Six Principles for Making New Things
February 2008The fiery reaction to the release of Arc had
an unexpected consequence: it made me realize I had a design
philosophy. The main complaint of the more articulate critics was
that Arc seemed so flimsy. After years of working on it, all I had
to show for myself were a few thousand lines of macros? Why hadn't
I worked on more substantial problems?As I was mulling over these remarks it struck me how familiar they
seemed. This was exactly the kind of thing people said at first
about Viaweb, and Y Combinator, and most of my essays.When we launched Viaweb, it seemed laughable to VCs and e-commerce
"experts." We were just a couple guys in an apartment,
which did not seem cool in 1995 the way it does now. And the thing
we'd built, as far as they could tell, wasn't even software.
Software, to them, equalled big, honking Windows apps. Since Viaweb
was the first web-based app
they'd seen, it seemed to be nothing
more than a website. They were even more contemptuous when they
discovered that Viaweb didn't process credit card transactions (we
didn't for the whole first year). Transaction processing seemed
to them what e-commerce was all about. It sounded serious and
difficult.And yet, mysteriously, Viaweb ended up crushing all its competitors.The initial reaction to
Y Combinator was almost identical. It
seemed laughably lightweight. Startup funding meant series A rounds:
millions of dollars given to a small number of startups founded by
people with established credentials after months of serious,
businesslike meetings, on terms described in a document a foot
thick. Y Combinator seemed inconsequential. It's too early to say
yet whether Y Combinator will turn out like Viaweb, but judging
from the number of imitations, a lot of people seem to think we're
on to something.I can't measure whether my essays are successful, except in page
views, but the reaction to them is at least different from when I
started. At first the default reaction of the Slashdot trolls was
(translated into articulate terms): "Who is this guy and what
authority does he have to write about these topics? I haven't read
the essay, but there's no way anything so short and written in such
an informal style could have anything useful to say about such and
such topic, when people with degrees in the subject have already
written many thick books about it." Now there's a new generation
of trolls on a new generation of sites, but they have at least
started to omit the initial "Who is this guy?"Now people are saying the same things about Arc that they said at
first about Viaweb and Y Combinator and most of my essays. Why the
pattern? The answer, I realized, is that my m.o. for all four has
been the same.Here it is: I like to find (a) simple solutions (b) to overlooked
problems (c) that actually need to be solved, and (d) deliver them
as informally as possible, (e) starting with a very crude version
1, then (f) iterating rapidly.When I first laid out these principles explicitly, I noticed something
striking: this is practically a recipe for generating a contemptuous
initial reaction. Though simple solutions are better, they don't
seem as impressive as complex ones. Overlooked problems are by
definition problems that most people think don't matter. Delivering
solutions in an informal way means that instead of judging something
by the way it's presented, people have to actually understand it,
which is more work. And starting with a crude version 1 means your
initial effort is always small and incomplete.I'd noticed, of course, that people never seemed to grasp new ideas
at first. I thought it was just because most people were stupid.
Now I see there's more to it than that. Like a
contrarian investment fund, someone following this strategy will
almost always be doing things that seem wrong to the average person.As with contrarian investment strategies, that's exactly the point.
This technique is successful (in the long term) because it gives you
all the advantages other people forgo by trying to seem legit. If
you work on overlooked problems, you're more likely to discover new
things, because you have less competition. If you deliver solutions
informally, you (a) save all the effort you would have had to expend
to make them look impressive, and (b) avoid the danger of fooling
yourself as well as your audience. And if you release a crude
version 1 then iterate, your solution can benefit from the imagination
of nature, which, as Feynman pointed out, is more powerful than
your own.In the case of Viaweb, the simple solution was to make the software
run on the server. The overlooked problem was to generate web sites
automatically; in 1995, online stores were all made by hand by human
designers, but we knew this wouldn't scale. The part that actually
mattered was graphic design, not transaction processing.
The informal delivery mechanism was me, showing up in jeans and a
t-shirt at some retailer's office. And the crude version 1 was,
if I remember correctly, less than 10,000 lines of code when we
launched.The power of this technique extends beyond startups and programming
languages and essays. It probably extends to any kind of creative
work. Certainly it can be used in painting: this is exactly
what Cezanne and Klee did.At Y Combinator we bet money on it, in the sense that we encourage
the startups we fund to work this way. There are always new ideas
right under your nose. So look for simple things that other people
have overlooked—things people will later claim were
"obvious"—especially when they've been led astray by obsolete
conventions,
or by trying to do things that are superficially impressive. Figure
out what the real problem is, and make sure you solve that. Don't
worry about trying to look corporate; the product is what wins in
the long term. And launch as soon as you can, so you start learning
from users what you should have been making.Reddit is a classic example of
this approach. When Reddit first
launched, it seemed like there was nothing to it. To the graphically
unsophisticated its deliberately minimal design seemed like no
design at all. But Reddit solved the real problem, which was to
tell people what was new and otherwise stay out of the way. As a
result it became massively successful. Now that conventional ideas
have caught up with it, it seems obvious. People look at Reddit
and think the founders were lucky. Like all such things, it was
harder than it looked. The Reddits pushed so hard against the
current that they reversed it; now it looks like they're merely
floating downstream.So when you look at something like Reddit and think "I wish I could
think of an idea like that," remember: ideas like that are all
around you. But you ignore them because they look wrong.
|
|
https://github.com/MultisampledNight/flow | https://raw.githubusercontent.com/MultisampledNight/flow/main/src/template.typ | typst | MIT License | #import "cfg.typ"
#import "checkbox.typ"
#import "info.typ"
#import "keywords.typ"
#import "palette.typ": *
#import "presentation.typ"
#import "util.typ": *
#let _styling(body, ..args) = {
if not cfg.render {
return {
// PERF: consistently shaves off 0.02 seconds of query time
// tested on i7 10th gen
set page(width: auto, height: auto)
set text(size: 0pt)
// purely to make references not crash when querying
set heading(numbering: "1.1")
body
}
}
let args = args.named()
set page(
fill: bg,
numbering: "1 / 1",
)
set text(
fill: fg,
lang: args.at("lang", default: "en"),
)
set rect(stroke: fg)
set line(stroke: fg)
set table(stroke: fg)
set heading(numbering: "1.1")
set outline(
indent: auto,
fill: move(
dy: -0.25em,
line(length: 100%, stroke: gamut.sample(15%)),
),
)
show ref: text.with(fill: reference.same-file)
show link: it => {
let accent = if type(it.dest) == str {
reference.external
} else {
reference.same-file
}
let ret = text(fill: accent, it)
if not cfg.dev { ret = underline(ret) }
ret
}
show raw.where(block: false): it => highlight(
top-edge: 0.9em,
bottom-edge: -0.25em,
fill: luma(0%),
radius: 0.25em,
stroke: 4pt + luma(0%),
extent: 0em,
text(if cfg.dev { fg } else { luma(100%) }, it),
)
show raw.where(block: true): it => block(
fill: luma(0%),
radius: 0.5em,
inset: 0.5em,
width: 100%,
text(if cfg.dev { fg } else { luma(100%) }, it),
)
body
}
#let _shared(args) = {
let args = info.preprocess(args.named())
let title = args.at("title", default: {
if cfg.filename != none {
cfg.filename.trim(
".typ",
repeat: false,
)
} else {
"Untitled"
}
})
(args: args, title: title)
}
// The args sink is used as metadata.
// It'll exposed both in a table in the document and via `typst query`.
// See the manual for details.
#let generic(body, ..args) = {
let (args, title) = _shared(args)
show: _styling.with(..args)
show: keywords.process.with(cfg: args.at("keywords", default: none))
show: checkbox.process
set document(
title: title,
author: args.at("author", default: ()),
)
info.queryize(args)
body
}
#let note(body, ..args) = {
set text(font: "IBM Plex Sans", size: 14pt)
show raw: set text(font: "IBM Plex Mono")
show: generic.with(..args)
if cfg.render {
let (args, title) = _shared(args)
text(2.5em, strong(title))
if args.len() > 0 {
v(-1.75em)
info.render(args)
separator
}
outline()
separator
}
body
}
#let latex-esque(body, ..args) = {
set text(font: "New Computer Modern", size: 12pt)
show raw: set text(font: "FiraCode Nerd Font Mono")
show: generic.with(..args)
set outline(
title: [Table of contents],
fill: repeat[.],
)
if cfg.render {
let (args, title) = _shared(args)
let title = text(2em, strong(title))
let extra = args
.pairs()
.filter(((key, value)) => key != "title")
.map(((key, value)) =>
(
(upper(key.at(0)) + key.slice(1))
.replace("Cw", "Content warning"),
if type(value) in (str, int, float, content) {
value
} else if type(value) == array {
value.join([, ], last: [ and ])
} else if type(value) == dictionary {
value.keys().join[, ]
} else {
repr(value)
}
)
.join[: ]
)
.join[\ ]
align(center, {
title
[\ ]
v(0.25em)
extra
})
outline()
}
body
}
#let slides(body, handout: false, ..args) = {
set text(font: "IBM Plex Sans", size: 26pt)
show raw: set text(font: "IBM Plex Mono")
show: presentation._prelude
show: generic.with(..args)
show: it => presentation._process(it, handout: handout, args.named())
body
}
|
https://github.com/shenxiangzhuang/typst-cn-book | https://raw.githubusercontent.com/shenxiangzhuang/typst-cn-book/master/template/chapters/chap3.typ | typst | MIT License | #import "@preview/gentle-clues:1.0.0": *
#import "@preview/lovelace:0.3.0": *
#import "@preview/algo:0.3.3": algo, i, d, comment, code
= 实用组件 <chapter3>
== 高亮块(Admonitions)
#tip(title: `gentle-clues`)[高亮块借助`gentle-clues`库来实现。]
#example(title: "示例")[示例高亮块]
== 算法伪代码
#example(title: `lovelace`)[
@lovelace_demo 是实用`lovelace`库输出的伪代码示例。
#figure(
kind: "algorithm",
supplement: [Algorithm],
pseudocode-list(booktabs: true, numbered-title: [My cool algorithm])[
+ do something
+ do something else
+ *while* still something to do
+ do even more
+ *if* not done yet *then*
+ wait a bit
+ resume working
+ *else*
+ go home
+ *end*
+ *end*
]
) <lovelace_demo>
]
#example(title: `algo`)[
下面是用`algo`库输出的伪代码示例。
#algo(
title: [ // note that title and parameters
#set text(size: 15pt) // can be content
#emph(smallcaps("Fib"))
],
parameters: ([#math.italic("n")],),
comment-prefix: [#sym.triangle.stroked.r ],
comment-styles: (fill: rgb(100%, 0%, 0%)),
indent-size: 15pt,
indent-guides: 1pt + gray,
row-gutter: 5pt,
column-gutter: 5pt,
inset: 5pt,
stroke: 2pt + black,
fill: none,
)[
if $n < 0$:#i\
return null#d\
if $n = 0$ or $n = 1$:#i\
return $n$#d\
\
let $x <- 0$\
let $y <- 1$\
for $i <- 2$ to $n-1$:#i #comment[so dynamic!]\
let $z <- x+y$\
$x <- y$\
$y <- z$#d\
\
return $x+y$
]
] |
https://github.com/kdog3682/2024-typst | https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/exponent-rules.typ | typst | #import "@preview/showybox:2.0.1": *
#import "base-utils.typ": *
#let render-exponent-json(ruleIds, singleton: false) = {
let ruleIds = coerce-array(ruleIds)
let data = json("/home/kdog3682/2024-typst/src/exponents.json")
let line-attrs = (
length: 100%,
stroke: (thickness: 0.5pt, dash: "dotted"),
)
let render(exp) = {
let rule = [*Rule #exp.id #h(10pt) #exp.rule*]
let formula = mathup(exp.formula, size: none, label: "formula")
let example = mathup(exp.example, size: none, label: "example")
let eli5 = text(exp.eli5)
let lineContent = line(..line-attrs)
let hideIt = exp.id not in ruleIds
if hideIt {
return []
let rule = [*Rule #exp.id*]
return block({
rule
v(2pt)
lineContent
})
}
let content = block({
centered(rule)
v(2pt)
lineContent
v(2pt)
pad(left: 10pt, {
eli5
v(5pt)
formula
v(2pt)
example
})
})
return content
}
if singleton == true {
return render(data.first())
}
let table-attrs = (
align: auto,
column-gutter: 30pt,
row-gutter: 10pt,
columns: (1fr, 1fr),
// stroke: (
// top: none,
// left: none,
// right: none,
// bottom: none,
// ),
stroke: none,
rows: auto,
)
return table(..table-attrs, ..data.map(render))
}
#let exponent-rules(n, singleton: true) = {
let width = 100%
if singleton == true {
width = 50%
}
let color = blue
let content = render-exponent-json(n, singleton: singleton)
showybox(
title: "Exponent Rules",
width: width,
title-style: (
weight: 900,
sep-thickness: 1pt,
align: left,
),
// body-style: (
// inset: 40pt
// ),
frame: (
border-color: color,
title-color: color.lighten(30%),
body-inset: 15pt,
body-color: color.lighten(98%),
// footer-color: color.lighten(80%)
),
content
)
}
|
|
https://github.com/rabotaem-incorporated/algebra-conspect-1course | https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/05-group-theory/06-finitely-generated-groups.typ | typst | Other | #import "../../utils/core.typ": *
== Конечно порожденные абелевы группы
#ticket[Разложение конечной циклической группы в прямую сумму]
#pr[
Пусть $(a, b) = 1, space a, b in NN$. Тогда
$
ZZ fg a b ZZ iso (ZZ fg a ZZ) times (ZZ fg b ZZ)
$
]
#proof[
$([1]_a, [1]_b) = g, space ord(g) = a b ==> abs(gen(g)) = a b ==> gen(g) = (ZZ fg a ZZ) times (ZZ fg b ZZ)$
]
#ticket[Строение конечных и конечно порождённых абелевых групп]
#th[
Пусть $G$ --- конечная абелева группа. Тогда
$
G iso product_(i = 1)^m (ZZ fg p_i^(l_i) ZZ), #[где $p_i$ --- простое; $l_i in NN$]
$
Такое разложение единственно с точностью до порядка множителей.
Иногда эту теорему переформулируют: требуют, чтобы порядок каждого множителя делил порядок следующего (то есть собирают вместе все циклические подгруппы, у которых порядок взаимнопрост, и упорядочивают). Тогда разложение единственно.
]
#proof[Без доказательства]
#example[
$
C_2 times C_12 = C_(2^2) times C_3 times C_2
$
]
#th[
Пусть $G$ --- конечно порожденная абелева группа. Тогда
$ G iso ZZ^r times H, $
где $H$ --- конечная. При этом $r$ --- инвариант $G$,
$ H iso G_"tors" = {g in G bar thick ord g < oo}. $
Следовательно,
$ G iso product_(i = 1)^r ZZ times product_(i = 1)^m C_(p_i^m_i). $
]
#proof[Без доказательства]
#ticket[Циклическая подгруппа мультипликативной группы поля]
#denote[
$C_m <==> (ZZ fg m ZZ)$ --- циклическая группа. Иногда также обозначается $ZZ_m$, но возникает коллизия с обозначениями $p$-адических чисел.
]
#follow[
Пусть $K$ --- поле, $G$ --- конечная подгруппа мультипликативной группы поля: $G < K^*$, $abs(G) < oo$. Тогда $G$ циклическая.
]
#proof[
Знаем, что
$
G iso product_(i = 1)^m (C_(p_i^(l_i)))
$
Рассмотрим каждый элемент $g in G$. Возведем его в степень $M = lcm(p_i^(l_i))$. Так как для любого $x in C_(p_i^(l_i))$ верно $x^M = 1$, то $g^M = 1$. Значит, все элементы $g$ в поле $K$ являются корнями многочлена $x^M - 1$. Но таких корней не более $M$, значит, $abs(G) <= M$. С другой стороны, $abs(G) = p_1^(l_1)...p_m^(l_m) >= M$. Значит, $abs(G) = M$ и все $p_i$ взаимно просты, то есть $G$ --- циклическая.
]
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/columns_06.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test an empty second column.
#set page(width: 7.05cm, columns: 2)
#rect(width: 100%, inset: 3pt)[So there isn't anything in the second column?]
|
https://github.com/nikhilweee/nikipedia-typst | https://raw.githubusercontent.com/nikhilweee/nikipedia-typst/main/README.md | markdown | # Nikipedia
Paper summaries written in Typst.
Currently summarizing the following papers:
- [[arXiv:2305.18920]](https://arxiv.org/abs/2305.18290) Direct Preference
Optimization
# License
All files in this repository are subject to the
[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) License.
|
|
https://github.com/AU-Master-Thesis/thesis | https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/lib/lib.typ | typst | MIT License |
#import "blocks.typ": *
#import "note.typ"
#import "colors.typ"
#import "catppuccin.typ": *
// #import "template.typ": *
#import "@preview/codelst:2.0.1": sourcecode, codelst, sourcefile
#import "@preview/tablex:0.0.6": *
#import "@preview/drafting:0.2.0": *
#import "@preview/cetz:0.2.2": *
#import "@preview/hydra:0.4.0": hydra
// #import "@preview/glossarium:0.3.0": make-glossary, print-glossary, gls, glspl
// #show: make-glossary
#import "@preview/wordometer:0.1.1": word-count, total-words, total-characters
// #show: word-count.with(exclude: (heading.where(level: 1), strike, figure.caption, <no-wc>))
#import "@preview/acrostiche:0.3.1": init-acronyms, print-index, acr, acrpl
#import "@preview/oxifmt:0.2.1": strfmt
// #show: word-count
#let theme = catppuccin.latte
#let accent = theme.lavender
// #let colors = (
// )
#let rep(item, n) = range(n).map(_ => item)
#let hr = line(length: 100%)
// #let project-name = "Multi-agent Collaborative Path Planning"
// Better titles:
// #let project-name = "Hybrid Multi-agent Path Planning: Gaussian Belief Propagation and Global Path Finding"
// #let project-name = "Merging Gaussian Belief Propagation and Global Path Finding for Multi-agent Path Planning in Complex Environments"
#let project-name = "Simulating Multi-agent Path Planning in Complex Environments using Gaussian Belief Propagation and Global Path Finding"
#let supervisors = (
andriy: [<NAME>],
jonas: [<NAME>],
)
#let authors = ((
name: "<NAME>",
email: "<EMAIL>",
auid: "au649507",
), (
name: "<NAME>",
email: "<EMAIL>",
auid: "au649525",
),).map(author => {
author + (
department: [Department of Electrical and Computer Engineering],
organization: [Aarhus University],
location: [Aarhus, Denmark],
)
})
#let a = (
jens: authors.at(1).name,
kristoffer: authors.at(0).name,
)
#let sourcecode = sourcecode.with(frame: std-block, numbers-style: (lno) => move(dy: 1pt, text(
font: "JetBrainsMono NF",
size: 0.75em,
catppuccin.latte.overlay0,
lno,
)))
#let sourcefile = sourcefile.with(frame: std-block, numbers-style: (lno) => move(dy: 1pt, text(
font: "JetBrainsMono NF",
size: 0.75em,
catppuccin.latte.overlay0,
lno,
)))
#let sourcecode-reference(content, caption: none) = {
return figure(
content,
kind: "code",
supplement: [Listing],
caption: caption
)
}
// #let code-snippet(content) = {
// figure(
// content,
// kind: "code",
// supplement: [Code Snippet]
// )
// }
#let snippet = sourcecode.with(numbering: none, frame: std-block.with(inset: 2pt, radius: 3pt))
#let tablex = tablex.with(stroke: 0.25pt, auto-lines: false, inset: 0.5em)
#let rule = hlinex(stroke: 0.25pt)
#let thick-rule = hlinex(stroke: 0.75pt)
#let double-rule(cols) = (hlinex(), colspanx(cols)[#v(-0.75em)], hlinex(),)
#let boxed(content, color: accent.lighten(0%), fill: none, weight: 400) = {
if (fill == none) {
fill = color.transparentize(80%)
}
box(
fill: fill,
radius: 3pt,
inset: (x: 2pt),
outset: (y: 2pt),
text(color, weight: weight, content),
)
}
// #let list-box(title, content) = {
// gridx(
// columns: (1em, 1fr),
// column-gap: 1pt,
// [], [#boxed(title) #content],
// )
// // v(-3.25em)
// }
#let no-indent(content) = {
set par(first-line-indent: 0pt)
content
}
#let remark(txt, color: color.red, prefix: "") = {
if not "release" in sys.inputs {
boxed(color: color.lighten(0%), fill: color.lighten(80%), [*#prefix* #txt])
}
state("remark" + prefix, 0).update(s => s + 1)
}
#let todo = remark.with(color: theme.maroon, prefix: "Todo: ")
#let jens = remark.with(color: theme.teal, prefix: "Jens: ")
#let yens = remark.with(color: theme.pink, prefix: "Yens: ")
#let kristoffer = remark.with(color: theme.green, prefix: "Kristoffer: ")
#let k = kristoffer
#let jonas = remark.with(color: theme.mauve, prefix: "Jonas: ")
#let att(content) = note.a[] + text(theme.peach, content)
#let boxed-enum(
prefix: "",
suffix: "",
delim: ".",
color: accent.lighten(0%),
fill: accent.lighten(80%),
..numbers,
) = boxed(
color: color,
fill: fill,
prefix + numbers.pos().map(str).join(delim) + delim + suffix,
weight: 900,
)
#let box-enum(
prefix: "",
suffix: "",
delim: ".",
color: accent.lighten(0%),
..numbers,
) = boxed(
color: color,
fill: color.lighten(80%),
prefix + numbers.pos().map(str).join(delim) + suffix,
weight: 900,
)
#let hyp-counter = counter("hypothesis")
#let h-enum(
..numbers,
) = {
hyp-counter.step()
box-enum(prefix: "H-", delim: ".", color: theme.lavender, ..numbers)
}
#let req-enum(prefix: "R-", color: accent, ..numbers) = boxed(
color: color,
fill: color.lighten(80%),
text(weight: 900, prefix + numbers.pos().map(n => {
if n < 10 {
str(n)
} else {
str(n)
}
}).join(".")),
)
#let vdmpp(text) = raw(text, block: false, lang: "vdmpp")
#let requirement-heading(content) = heading(
level: 2,
supplement: "Requirement",
numbering: none,
outlined: false,
content,
)
#let req(content) = {
boxed(weight: 900)[R-#content]
h(0.5em)
}
#let abstraction-counter = counter("abstraction-counter")
#let abstraction-id = {
abstraction-counter.step()
boxed("A" + abstraction-counter.display(), weight: 900)
}
#let cy(content) = text(catppuccin.latte.yellow, content)
#let cr(content) = text(catppuccin.latte.maroon, content)
#let cg(content) = text(catppuccin.latte.green, content)
#let cb(content) = text(catppuccin.latte.lavender, content)
#let cp(content) = text(catppuccin.latte.mauve, content)
#let ra = sym.arrow.r
#let la = sym.arrow.l
#let swatch(color, content: none, s: 6pt) = {
if content != none {
content
// h(0.1em)
}
h(1pt, weak: true)
box(
height: s,
width: s,
fill: color,
// stroke: 1pt + color,
radius: s / 2,
baseline: (s - 0.5em) / 2,
)
}
#let sy = swatch(catppuccin.latte.yellow)
#let sr = swatch(catppuccin.latte.maroon)
#let sg = swatch(catppuccin.latte.green)
#let so = swatch(catppuccin.latte.peach)
#let sb = swatch(catppuccin.latte.blue)
#let sp = swatch(catppuccin.latte.mauve)
#let sl = swatch(catppuccin.latte.lavender)
#let sgr = swatch(catppuccin.latte.surface0)
#let sgr2 = swatch(catppuccin.latte.surface2)
#let sgr3 = swatch(catppuccin.latte.overlay2)
#let st = swatch(catppuccin.latte.text)
#let stl = swatch(catppuccin.latte.teal)
#let nameref(label, name, supplement: none) = {
show link : it => text(accent, it)
link(label, [#ref(label, supplement: supplement). #name])
}
#let numref(label) = ref(label, supplement: none)
#let scen(content) = boxed(color: catppuccin.latte.yellow, content)
#let toc-printer(target: none, depth: 2) = {
set par(first-line-indent: 0em)
outline(
indent: 2em,
fill: grid(
columns: 1,
block(fill: black, height: 0.5pt, width: 100%),
),
depth: depth,
target: target,
title: none,
)
}
#let hline-with-gradient(cmap: color.map.inferno, height: 2pt) = rect(width: 100%, height: height, fill: gradient.linear(..cmap))
#let merge(..dicts) = {
dicts.pos().fold((:), (acc, dict) => {
for (k, v) in dict {
acc.insert(k, v)
}
acc
})
}
#let important-datetimes = (project: (
start: datetime(day: 29, month: 01, year: 2024),
end: datetime(day: 04, month: 06, year: 2024),
))
#let plural(word, n) = if n <= 1 {
word
} else {
word + "s"
}
#let as-string(any) = {
if type(any) == "string" {
any
} else if type(any) == "content" {
let repr_any = repr(any)
repr_any.slice(1, repr_any.len() - 1) // remove square brackets
} else {
str(any)
}
}
#let plural-alt(s) = {
let s = as-string(s)
if s.ends-with("s") {
// plural
s + "es"
} else {
// singular
s + "s"
}
}
#let possessive(s) = {
let s = as-string(s)
if s.ends-with("s") {
// plural
s + "s"
} else {
// singular
s + "'s"
}
}
// Format a string | content as Title Case
#let titlecase(text) = {
let string = if type(text) == "string" {
text
} else if type(text) == "content" {
repr(text).slice(1,-1) // remove square brackets
} else {
panic("Invalid type for text. Valid types are 'string' | 'content'")
}
string.split(" ").map(word => {
let chars = word.split("")
(
upper(chars.at(1)),
..chars.slice(2, -1)
).join("") // join into a string again
}).join(" ") // join into a sentence again
}
#let repo(org: none, repo: none) = {
if (repo == none) {
panic("Name is required for repo")
}
if (org == none) {
raw(repo)
}
raw((org, repo).join("/"), block: false)
}
#let release = "release" in sys.inputs and sys.inputs.release == "true"
#let stats() = {
if release {
return
}
locate(loc => {
let words = state("total-words").final(loc)
let chars = state("total-characters").final(loc) + words * 0.8
let normal-pages = chars / 2400
let total-pages = 80
let people = 2
let total-days = important-datetimes.project.end - important-datetimes.project.start
let days-left = important-datetimes.project.end - datetime.today()
// let pages-person-day = (total-pages - normal-pages) / (people * days-left).days()
set text(size: 10pt, font: "JetBrainsMono NF")
set par(first-line-indent: 0em)
set align(center)
tablex(
columns: (auto, auto),
align: (left, right),
[*words*], [#words],
[*characters*], [#calc.round(chars, digits: 0)],
[*normal pages*], [#calc.round(normal-pages, digits: 2)],
rule,
[*goal pages*], [#total-pages],
[*goal characters*], [#(total-pages * 2400)],
// [*pp./person/day*], [#calc.round(pages-person-day, digits: 2)],
[*days left*], [#days-left.days()],
)
let colors = (
complete: catppuccin.latte.lavender,
incomplete: catppuccin.latte.maroon,
)
let progress = normal-pages / total-pages * 100%
let progress-left = 100% - progress
let days-gone = total-days.days() - days-left.days()
let days-left-percent = days-left.days() / total-days.days() * 100%
grid(
column-gutter: 0pt,
columns: (1fr, auto),
row-gutter: 5pt,
text(colors.complete, [#repr(progress) (#calc.round(normal-pages, digits: 2) pages)]), text(colors.incomplete, [#repr(progress-left) (#calc.round(total-pages - normal-pages, digits: 2) pages)]),
)
v(-0.75em)
grid(
column-gutter: 0pt,
columns: (progress, auto),
row-gutter: 5pt,
box(height: 1em, width: 100%, fill: colors.complete),
box(height: 1em, width: 100%, fill: colors.incomplete),
)
let percent-to-indhent = 100% - progress - days-left-percent
grid(
column-gutter: 0pt,
columns: (progress, 1fr, days-left-percent),
row-gutter: 5pt,
[], text(colors.incomplete, [#repr(percent-to-indhent)]), [],
box(height: 1em, width: 100%, fill: theme.overlay0), box(height: 1em, width: 100%, fill: colors.incomplete), box(height: 1em, width: 100%, fill: theme.overlay0),
)
v(0.25em)
grid(
column-gutter: 0pt,
columns: (1fr, auto),
row-gutter: 5pt,
text(colors.incomplete, [#repr(100% - days-left-percent) (#days-gone days)]),
text(colors.complete, [#repr(days-left-percent) (#days-left.days() days)]),
)
v(-0.75em)
grid(
column-gutter: 0pt,
columns: (1fr, days-left-percent),
row-gutter: 5pt,
box(height: 1em, width: 100%, fill: colors.incomplete),
box(height: 1em, width: 100%, fill: colors.complete),
)
let t = state("remark" + "Todo: ").final(loc)
let j = state("remark" + "Jens: ").final(loc)
let k = state("remark" + "Kristoffer: ").final(loc)
let jo = state("remark" + "Jonas: ").final(loc)
let total = t + j + k + jo
let columns = ()
let texts = ()
let boxes = ()
if t != none {
columns.push(t)
texts.push(text(theme.maroon, [#t todo]))
boxes.push(box(height: 1em, width: 100%, fill: theme.maroon))
}
if j != none {
columns.push(j)
texts.push(text(theme.teal, [#j Jens]))
boxes.push(box(height: 1em, width: 100%, fill: theme.teal))
}
if k != none {
columns.push(k)
texts.push(text(theme.green, [#k Kristoffer]))
boxes.push(box(height: 1em, width: 100%, fill: theme.green))
}
if jo != none {
columns.push(jo)
texts.push(text(theme.mauve, [#jo Jonas]))
boxes.push(box(height: 1em, width: 100%, fill: theme.mauve))
}
v(1em)
grid(
column-gutter: 0pt,
columns: columns.map(v => v / total * 100%),
row-gutter: 5pt,
..texts,
..boxes,
)
align(center, [#total *#plural("remark", total)*])
})
}
#let print-index(level: 1, outlined: false, sorted: "", title: "Acronyms Index", delimiter:":") = {
pagebreak(weak: true)
set page(columns: 2)
// assert on input values to avoid cryptic error messages
assert(sorted in ("","up","down"), message:"Sorted must be a string either \"\", \"up\" or \"down\"")
if title != ""{
heading(level: level, outlined: outlined)[#title]
}
state("acronyms",none).display(acronyms=>{
// Build acronym list
let acr-list = acronyms.keys()
// order list depending on the sorted argument
if sorted!="down"{
acr-list = acr-list.sorted()
}else{
acr-list = acr-list.sorted().rev()
}
let to-content-array() = {
let arr = ()
for acr in acr-list {
let acr-long = acronyms.at(acr)
let acr-long = if type(acr-long) == array {
acr-long.at(0)
} else {acr-long}
// ([*#acr#delimiter*], [#acr-long\ ])
arr.push([*#acr#delimiter*])
arr.push([#acr-long\ ])
}
arr
}
tablex(
columns: (auto, 10fr),
column-gutter: 1em,
row-gutter: 0.75em,
align: (right, left),
inset: 0pt,
// (), vlinex(), (),
..to-content-array()
)
})
}
#let node(color, content, rounding: 50%, size: 4mm) = {
let width = if (repr(content).len() - 2) > 1 { 0pt } else { 1.5pt };
h(5pt)
// block(
box(
fill: color.lighten(90%),
stroke: 1pt + color,
outset: (x: size / 2, y: size / 2),
inset: (y: -size / 4),
radius: rounding,
baseline: -size / 4,
height: 0pt,
width: 0pt,
align(
center,
text(
catppuccin.latte.text,
size: 0.5em,
weight: "bold",
font: "JetBrains Mono",
content
)
)
)
// )
h(5pt)
}
#let variable(color, content) = {
node(color, content)
}
#let factor(color, content) = {
node(color, content, rounding: 5%, size: 1.25mm)
}
#let listing-counter = counter("listing")
#let listing(
content,
line-numbering: auto,
caption: none,
) = {
let supplement = [Listing]
let sourcecode = if line-numbering == none {
sourcecode.with(numbers-style: (lno) => none)
} else {
sourcecode
}
return figure(
{
sourcecode(content)
},
caption: caption,
kind: "listing",
supplement: supplement,
)
}
#let example-counter = counter("example")
#let example-box(number) = boxed(color: accent)[*Example #number:*]
#let example(
body,
caption: none,
) = {
let supplement = [Example]
let n = context example-counter.get().at(0)
let title_prefix = text(weight: "bold", "Example " + n + if caption != none {": "} else {""})
return figure(
{
// set text(size: 0.8em)
example-counter.step()
blocked(
title: text(accent, title_prefix) + text(weight: "regular", caption),
body + [#metadata("example") <meta:excounter>],
color: theme.lavender.lighten(90%),
)
},
kind: "example",
supplement: [Example],
)
}
#let algorithm-counter = counter("algorithm")
#let algorithm(
content,
caption: none,
) = {
let supplement = [Algorithm]
let n = context algorithm-counter.get().at(0)
let title_prefix = text(weight: "bold", "Algorithm " + n + if caption != none {": "} else {""})
let ind = 1em
return figure(
{
// set text(size: 0.8em)
set par(first-line-indent: ind, hanging-indent: ind)
algorithm-counter.step()
blocked(
title: text(theme.mauve.lighten(20%), title_prefix) + text(weight: "regular", caption),
h(ind) + content,
color: theme.mauve.lighten(90%),
// content + linebreak() +
// repr(content.fields())
)
},
numbering: "1.",
kind: "algorithm",
supplement: supplement,
)
}
#let H(n) = [Hypothesis #boxed(color: theme.lavender)[*H-#n*]]
#let RQ(n) = [Research Question #boxed(color: theme.lavender)[*RQ-#n*]]
#let O(n) = [Objective #boxed(color: theme.lavender)[*O-#n*]]
#let scen = (
circle: "Circle",
environment-obstacles: "Environment Obstacles",
varying-network-connectivity: "Varying Network Connectivity",
// clear-circle: "Clear Circle",
junction: "Junction",
communications-failure: "Communications Failure",
solo-gp: "Solo Global Planning",
collaborative-gp: "Collaborative Global Planning",
iteration-amount: "Iteration Amount",
iteration-schedules: "Iteration Schedules",
).pairs().map(
it => {
let key = it.at(0)
let value = it.at(1)
(
key,
(
s: text(style: "italic", weight: 900, value),
n: value
)
)
}
).fold((:), (acc, it) => {
acc.insert(it.at(0), it.at(1))
acc
})
#let study = (
heading: it => {
set par(first-line-indent: 0em)
v(0.25em)
block(text(size: 14pt, weight: 900, it))
},
H-1: (
box: boxed(text(weight: 900, "H-1")),
prefix: [_*Contribution 1*_],
name: [_*Simulation Framework*_],
full: (
s: [_*Contribution 1 - Simulation Framework*_],
n: [Contribution 1 - Simulation Framework],
)
),
H-2: (
box: boxed(text(weight: 900, "H-2")),
prefix: [_*Contribution 2*_],
name: [_*Algorithm Enhancements*_],
full: (
s: [_*Contribution 2: Algorithm Enhancements*_],
n: [Contribution 2: Algorithm Enhancements],
)
),
H-3: (
box: boxed(text(weight: 900, "H-3")),
prefix: [_*Contribution 3*_],
name: [_*Global Planning Layer*_],
full: (
s: [_*Contribution 3: Global Planning Layer*_],
n: [Contribution 3: Global Planning Layer],
)
),
H-4: (
box: boxed(text(weight: 900, "H-4")),
prefix: [_*Contribution 4*_],
name: [_*GBP Path Tracking*_],
full: (
s: [_*Contribution 4: GBP Path Tracking*_],
n: [Contribution 4: GBP Path Tracking],
)
),
)
#let step = (
s1: boxed(color: colors.variable)[*Step 1*],
s2: boxed(color: colors.variable)[*Step 2*],
s3: boxed(color: colors.factor)[*Step 3*],
s4: boxed(color: colors.factor)[*Step 4*],
)
#let iteration = (
// factor: boxed(color: colors.factor)[*Factor Iteration*],
// variable: boxed(color: colors.variable)[*Variable Iteration*],
factor: text(colors.factor, "Factor Iteration"),
variable: text(colors.variable, "Variable Iteration"),
)
#let cost = (
cheap: " " + sg + " " + text(theme.green, style: "italic", "Cheap"),
expensive: " " + sr + " " + text(theme.maroon, style: "italic", "Expensive"),
)
#let gaussian = (
moments: [_Moments Form_],
canonical: [_Canonical Form_],
)
#let inference = (
MAP: [_#acr("MAP") inference_],
marginal: [_marginal inference_],
)
#let factor = (
lp: [_linearization point_],
)
#let jacobian = $upright(bold(J))$
#let m = (
Lambda: $#text(theme.mauve, $Lambda$)$,
eta: $#text(theme.mauve, $eta$)$,
mu: $#text(theme.mauve, $mu$)$,
Sigma: $#text(theme.mauve, $Sigma$)$,
X: $#text(theme.mauve, $X$)$,
J: jacobian,
SA: $#text(theme.teal, $Sigma_A$)$,
SB: $#text(theme.mauve, $Sigma_B$)$,
// #let m = (
Xb: $bold(upright(X))$,
D: $bold(upright(D))$,
x: $bold(upright(x))$,
P: $bold(upright(P))$,
p: $bold(upright(p))$,
proj: $bold(upright("proj"))$,
d: $bold(upright(d))$,
l: $bold(upright(l))$,
where: h(0.5em) + line(start: (0em, -0.1em), end: (0em, 1.2em), stroke: 0.25pt) + h(0.5em)
// )
)
#let number-word(num) = {
let num = str(num)
}
#let fsig(content) = text(font: "JetBrainsMono NF", size: 0.85em, content)
#let algeq(content) = {
show regex("(SampleRandomPoint|NearestNeighbor|Steer|CollisionFree|WithinGoalTolerance|MinCostConnection|Rewire|Sample|Nearest|ObstacleFree|neighborhood|Cost|Line|Parent)"): set text(theme.mauve, font: "JetBrainsMono NF", size: 0.85em)
content
}
#let transpose(matrix) = {
assert(type(matrix) == array)
let ncols = calc.max(..matrix.map(row => row.len()))
let nrows = matrix.len()
assert(matrix.map(row => row.len()).all(len => len == ncols))
for col in range(ncols) {
(matrix.map(row => row.at(col)),)
}
}
// https://github.com/AU-Master-Thesis/gbp-rs/blob/main/scripts/ldj.py
#let github(owner, repo, branch: "main", path: none, content: none) = {
let url = "https://github.com/" + owner + "/" + repo
if path != none {
url = url + "/blob/" + branch + "/" + path
}
let name = if path == none {
raw(repo)
} else {
raw(path)
}
link(url, name)
}
#let gbp-rs(content: none) = {
let name = if content == none {
"GitHub repository"
} else {
content
}
show regex("."): set text(accent)
link("https://github.com/AU-Master-Thesis/gbp-rs", name)
}
#let source-link(dest, file-path) = {
show regex("."): set text(accent)
link(dest, raw(block: false, file-path))
}
#let panel = (
bindings: text(theme.green, [*Keybindings Panel*]),
viewport: text(theme.lavender, [*Viewport*]),
settings: text(theme.maroon, [*Settings Panel*]),
metrics: text(theme.peach, [*Metrics Panel*]),
)
#let z-stack(..items) = {
grid(
columns: items.pos().len() * (1fr,),
column-gutter: -100%,
rows: 1,
..items
)
}
#let gradient-box(..cmap, width: 6em) = box(inset: (x: 2pt), outset: (y: 2pt), radius: 3pt, height: 0.5em, width: width, fill: gradient.linear(..cmap))
#let interleave(..arrays) = {
let arrays = arrays.pos()
assert(arrays.map(it => it.len()).all(len => len == arrays.at(0).len()))
for i in range(arrays.at(0).len()) {
for array in arrays {
(array.at(i),)
}
}
}
// #let foo(dict) = {
// for (k, list) in dict {
// [#k]
// for
// (k, v)
// }
// }
#let legend(handles, direction: ltr, fill: white.transparentize(25%)) = {
std-block(
width: auto,
// fill: theme.base.transparentize(100%),
fill: fill,
// stroke:
{
set align(left)
stack(
dir: direction,
..handles.map(handle => {
if direction == rtl {
h(handle.space)
} else if direction == btt {
v(handle.space / 2)
}
let patch = if "patch" in handle {
handle.patch
} else {
box(height: 0.8em, width: 0.8em, radius: 100%, fill: handle.color.lighten(handle.alpha), stroke: handle.color.lighten(handle.alpha), inset: (x: 2pt), baseline: 1pt)
}
box(
width: 1em,
// baseline: 0.15em,
align(
center,
patch
)
)
h(0.5em)
text(handle.color, size: 0.8em, handle.label)
if direction == ltr {
h(handle.space)
} else if direction == ttb {
v(handle.space / 2)
}
})
)
}
)
}
#let lm3-th13 = (
s: text(theme.green, $l_m=3,t_(K-1)=13.33s$),
n: $l_m=3,t_(K-1)=13.33s$
)
// #let lm1-th13 = text(theme.yellow, $l_m=1,t_(K-1)=13.33s$)
// #let lm3-th5 = text(theme.lavender, $l_m=3,t_(K-1)=5s$)
#let lm1-th13 = (
s: text(theme.teal, $l_m=1,t_(K-1)=13.33s$),
n: $l_m=1,t_(K-1)=13.33s$
)
#let lm3-th5 = (
s: text(theme.lavender, $l_m=3,t_(K-1)=5s$),
n: $l_m=3,t_(K-1)=5s$
)
#let inline-line(
length: 1em,
stroke: (paint: theme.lavender, thickness: 2pt, cap: "round")
) = box(
line(
length: length,
stroke: stroke
),
baseline: -0.25em
)
#let solo-gp-mean-decrease = (1 - 0.74 / 1.03) * 100
#let collaborative-gp-mean-decrease = (1 - 0.86 / 1.00) * 100
#let crop(
left: 0pt,
top: 0pt,
right: 0pt,
bottom: 0pt,
x: 0pt,
y: 0pt,
rest: 0pt,
body,
) = block(
clip: true,
pad(
left: left,
top: top,
right: right,
bottom: bottom,
x: x,
y: y,
rest: rest,
body,
)
)
#let configs = (
config: source-link("https://github.com/AU-Master-Thesis/gbp-rs/blob/main/config/simulations/Environment%20Obstacles%20Experiment/config.toml", "config.toml"),
environment: source-link("https://github.com/AU-Master-Thesis/gbp-rs/blob/main/config/simulations/Environment%20Obstacles%20Experiment/environment.yaml", "environment.yaml"),
formation: source-link("https://github.com/AU-Master-Thesis/gbp-rs/blob/main/config/simulations/Environment%20Obstacles%20Experiment/formation.yaml", "formation.yaml")
)
|
https://github.com/Jeomhps/datify | https://raw.githubusercontent.com/Jeomhps/datify/main/tests/test_utils.typ | typst | MIT License | // To compile this file : typst compile --root .. .\test_utils.typ
#import "../src/utils.typ": first-letter-to-upper, pad, safe-slice
#assert(first-letter-to-upper("hello") == "Hello")
#assert(first-letter-to-upper("world") == "World")
#assert(pad(5, 2) == "05")
#assert(pad(123, 5) == "00123")
#assert(safe-slice("Août", 3) == "Aoû")
|
https://github.com/kdog3682/typkit | https://raw.githubusercontent.com/kdog3682/typkit/main/0.1.0/src/drawing.typ | typst | #import "@preview/cetz:0.2.2"
#import "resolve.typ": *
#import "formulas.typ": *
#let canvas = cetz.canvas
#let points(points, ..sink) = {
for p in points {
cetz.draw.circle(p, radius: 0.2, stroke: none, fill: black, ..sink)
}
}
#let polygon(points, ..sink) = {
cetz.draw.line(..points, close: true, ..sink)
}
#let get-brace-content-angle(p1, p2) = {
let angle = get-angle-between-points(p1, p2) - 90deg
if angle < -180deg {
angle += 180deg
}
return angle
}
#let brace(a, b, ..sink) = {
cetz.decorations.brace(a, b, name: "brace", ..sink)
cetz.draw.content("brace.k", resolve-math-content(c))
cetz.decorations.brace(a, b, flip: true, name: "brace", ..brace-attrs)
if content != none and rotate-content == true {
let angle = get-brace-content-angle(m1, m2)
content = typst.rotate(content, angle)
}
//
}
#let rect(..sink) = {
let args = sink.pos()
let kwargs = sink.named()
let l = args.len()
if l == 4 {
args = args.chunks(2)
cetz.draw.rect(..args, ..kwargs)
}
else if l == 5 {
let c = args.pop()
// panic(c)
args = args.chunks(2)
cetz.draw.rect(..args, ..kwargs)
let center = midpoint(..args)
// panic(center)
cetz.draw.content(center, c)
}
}
#let content(..sink) = {
let args = sink.pos()
let kwargs = sink.named()
if args.len() == 3 {
return cetz.draw.content(args.slice(0, 2), args.at(2), ..kwargs)
} else {
return cetz.draw.rect(..args, ..kwargs)
}
}
#let square(p1, ..sink) = {
let args = sinks.pos()
let c = if args.len() == 1 {
args.at(0)
} else {
none
}
let kwargs = sink.named()
let length = kwargs.at("length", default: 1)
let p2 = (p1.at(0) + length, p1.at(1) + length)
let attrs = build-attrs((:), sink, key: "rect")
cetz.draw.rect(p1, p2, ..attrs)
}
#let brace-effect(shape, value, pos: "top") = {
return
}
// Explore ~/github
// Explore ~/2024-javascript/staging
// #panic(points((1,1), stroke:green))
|
|
https://github.com/davidedellagiustina/uniud-slides | https://raw.githubusercontent.com/davidedellagiustina/uniud-slides/master/README.md | markdown | MIT License | <!-- ToC hint -->
<div align=right>Table of Contents ↗️</div>
<!-- Header -->
<br/>
<p align="center">
<a href="https://github.com/davidedellagiustina/uniud-slides">
<img src="./.github/assets/logo.png" alt="Logo" height=80>
</a>
<h1 align="center">UniUD Slides</h1>
<p align="center">
<img src="https://img.shields.io/static/v1?label=&message=uniud&color=0000ff" alt="uniud">
<img src="https://img.shields.io/static/v1?label=template&message=slides&color=orange" alt="slides template">
<br/>
Unofficial <a href="https://typst.app">Typst</a> template for presentation slides at the <a href="https://www.uniud.it/it">University of Udine</a>.
<br/>
</p>
</p>
<!-- Readme contents -->
## Preview
| <img src="./.github/assets/slide-title.png" width="500"> | <img src="./.github/assets/slide-content.png" width="500"> |
| -------------------------------------------------------- | ---------------------------------------------------------- |
| Title slide | Content slide |
## Usage Instructions
### Local installation
If you wish to use a local installation of the Typst compiler on your computer, follow these instructions to use this template:
1. fork this repository;
2. clone your fork on your machine;
3. run `typst watch ./src/main.typ --font-path ./src/uniud-slides/assets/fonts`;
4. edit `./src/main.typ` and `./src/bibliography.yaml` to create your presentation;
5. (optional) use git with your fork for version control;
6. enjoy your slides!
### Web editor
If you prefer to use the Typst webapp, follow these instructions instead:
1. download a copy of this repository;
2. upload all the contents of the `./src` folder to the web editor;
3. edit `./src/main.typ` and `./src/bibliography.yaml` to create your presentation;
4. enjoy your slides!
|
https://github.com/piepert/philodidaktik-hro-phf-ifp | https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/parts/ephid/beurteilen_bewerten/bewertungsnormen.typ | typst | Other | #import "/src/template.typ": *
== #ix("Bewertungsnormen", "Bewertungsnorm")
Das System, nachdem die #ix("Bewertungen", "Bewertung") im Unterricht standardisiert werden, kann anhand verschiedener #ix("Normen", "Bewertungsnorm") festgelegt werden. Diese entscheiden, was der Bezugsrahmen für die Bewertung ist.
#grid(column-gutter: 1em, row-gutter: 1em, columns: 3,
[*#ix("Individualnorm")*],
[*#ix("Sozialnorm")*],
[*#ix("Sachnorm")*],
[
Als Orientierung dient die #ix("individuelle Bezugsnormorientierung", "Individualnorm", "Bezugsnormorientierung, individuell") aus der pädagogischen Psychologie: die individuelle Entwicklung der SuS bildet die Bezugsnorm.#en[Vgl. @Schwaighofer2019_Diagnostik[S. 275]] Die Frage ist: Wie war diese Leistung im Vergleich zu meinen sonstigen Leistungen? Es handelt sich also um einen Längsschnitt, der zum Vergleich der Entwicklung herangezogen wird.
], [
In der pädagogischen Psychologie wird die #ix("Sozialnorm") durch #ix("soziale Bezugsnormorientierung", "Bezugsnormorientierung, sozial") dargestellt. Der Rahmen der Bewertung ist hier ein Querschnittsvergleich mit dem relevanten Umfeld der Prüflinge.#en[Vgl. @Schwaighofer2019_Diagnostik[S. 275]] In diesem Fall ist das die restliche Klasse. Verglichen wird also mit dem sozialen Umfeld des Individuums, die Positionierung des Individuums im Bezug auf die anderen.
], [
Die #ix("Sachnorm") ist ein Vergleich der Leistung des Individuums weder mit seiner zeitlichen Entwicklung noch anderen SuS aus der Klasse, sondern mit vorbestimmten Kriterien.#en[Vgl. @Schwaighofer2019_Diagnostik[S. 275]] Das Ziel des Philosophieunterrichts ist eine Kompetenzgenerierung, dementsprechend müssen die Leistungen des Philosophieunterrichts an den jeweiligen Produkten der SuS bemessen werden.
]
)
#task(key: "bub-normen")[#ix("Bewertungsnorm", "Bewertung", "Bewertungsnorm") I][
Notieren und erklären Sie drei verschiedene Normen von #ix("Bewertungen", "Bewertung", "Bewertungsnorm")/#ix("Beurteilungen", "Beurteilung", "Beurteilungsnorm") im Philosophieunterricht. // Nennen Sie je eine Situation, in der die verschiedene Normen von Vorteil sind!
][
Als Bewertungsnormen unterscheiden wir die individuelle, soziale und sachliche Bezugsnorm. Jede legt einen anderen Vergleichswert für die Leistung an: die individuelle das Individuum und seine eigene Entwicklung im zeitlichen Längsschnitt, die soziale die umliegende Bezugsgruppe (die Klasse) im interindividuellen Querschnitt und zuletzt die Sachnorm ein vorher festgelegter Maßstab.
// Die individuelle Bezugsnorm ist dort von Vorteil, wo SuS, die sich selbst als besonders leistungsschwach wahrnehmen (unabhängig davon, ob sie es tatsächlich sind) oder fehlendes fachliches Selbstwertgefühl aufzeigen. Dadurch konzentrieren sich die SuS auf ihre eigene Leistungsentwicklung und da guter Unterricht eine Kompetenzentwicklung anstoßen soll, können Sie die eigene Entwicklung aktiv nachvollziehen.
// Die sachliche Bezugsnorm ist genau für den anderen Extremfall hilfreich, und zwar wenn SuS ein besonders gutes Selbstkonzept im Fach haben. Wenn die eigene Entwicklung somit nicht mehr so schnell
]
#task(key: "bub-sachnorm")[#ix("Bewertungsnorm", "Bewertung", "Bewertungsnorm") II][
Ordnen Sie die Bewertung mittels Bewertungsmatrizen begründet in eine der drei Normen ein!
][
Die Bewertung mittels Bewertungsmatrizen vergleicht die Leistung der SuS mit vorher festgelegten Kriterien, damit ist die verwendete Norm eine Sachnorm.
] |
https://github.com/NathanBurgessDev/tabletop-war-game-helper | https://raw.githubusercontent.com/NathanBurgessDev/tabletop-war-game-helper/main/Interim%20Report/interimTemplate.typ | typst | // I got this font from Google Fonts, you'll need to install it on your system
#set text(font: "EB Garamond", size: 11pt)
// Vertical space before
// needs to have:
// Project Title
// Name
// ID
// email
// name of the programme of your study
// project module
//
#let diss-title(
title: "Your Diss Title Goes Here",
author:"<NAME>",
ID: "20363169",
email: "psynb7",
programme: "BSc Computer Science",
module: "COMP3003",
abstract: none,
body,
) = {
align(center)[
#text(size: 18pt)[*Interim Report: #title*] \
#text(size: 14pt)[#module]\
#text(size: 14pt)[#author #email #ID]\
#text(size: 14pt, style: "italic")[#programme]\
]
body
}
|
|
https://github.com/Functional-Bus-Description-Language/Specification | https://raw.githubusercontent.com/Functional-Bus-Description-Language/Specification/master/src/glossary.typ | typst | #text(16pt)[
*Glossary*
]
#set par(justify: true)
Not all terms defined in the glossary list are used in the specification.
Some of them are formally defined because they are helpful when discussing, for example, compiler implementation.
#v(0.5cm)
#set terms(separator: v(0cm), hanging-indent: 1em)
#block(breakable:false)[
/ call register:
The proc register with the associated call pulse signal.
When the call register is written, the call pulse is generated.
]
#block(breakable:false)[
/ compiler back-end:
The part of a compiler responsible for taking registerification result and generating provider or requester firmware, gateware, or software.
]
#block(breakable:false)[
/ compiler front-end:
The part of a compiler responsible for parsing files with functional bus description and carrying out the registerification process.
]
#block(breakable:false)[
/ data:
The data term is used to refer to the content of the registers.
Unless it is used in the context of internal data types of the language.
]
#block(breakable:false)[
/ downstream:
A stream from the requester to the provider.
]
#block(breakable:false)[
/ exit register:
The proc register with the associated exit pulse signal.
When the exit register is read, the exit pulse is generated.
]
#block(breakable:false)[
/ functionality:
The functionality of given data.
It can be seen as a type of the data.
In case of functionalities encapsulating other functionalities, such as bus, block, proc or downstream, the functionality is used to denote a broader context of encapsulated data.
]
#block(breakable:false)[
/ gap:
Unused bits within a register.
]
#block(breakable:false)[
/ gateware:
The overall configuration of the logic placed in the FPGA to make it behave according to the desired description.
The term is not formally defined anywhere, however it is used to unburden the firmware term.
IEEE Std 610.12-1990 also mentions that the firmware term is too overloaded and confusing.
]
#block(breakable:false)[
/ generator:
The part of a compiler directly responsible for the target code generation based on registerification results.
]
#block(breakable:false)[
/ information:
The metadata on the functionality data.
The metadata describes where the data is located, for example bit masks and register addresses, and how to access the data.
]
#block(breakable:false)[
/ means:
The automatically generated method or data that shall be used by the requester to request particular functionality.
A means in particular programming language is usually a function, method or procedure that shall be called or class, dictionary, map or structure containing information on how to access particular functionality.
]
#block(breakable:false)[
/ provider:
The system component containing the generated registers and providing described functionalities.
]
#block(breakable:false)[
/ pure call register:
The proc call register containing no proc returns.
]
#block(breakable:false)[
/ pure exit register:
The proc exit register containing no proc params.
]
#block(breakable:false)[
/ register:
A logical set of storage elements which content can be read or written by providing a single address.
The set can be empty when the number of physical storage elements equals 0.
]
#block(breakable:false)[
/ registerification:
The process of placing data of functionalities into the registers.
The process includes assigning data bit masks, register addresses as well as block addresses and masks.
The term is new in the field and is coined in the specification.
]
#block(breakable:false)[
/ requester:
The system component accessing the generated registers and requesting described functionalities.
]
#block(breakable:false)[
/ strobe register:
The stream register with the associated strobe pulse signal.
When the strobe register is written (downstream), or read (upstream) the strobe pulse is generated.
]
#block(breakable:false)[
/ target:
The transpilation target.
For example, a target can be a requester Python code allowing to access functionalities of the provider in an asynchronous fashion.
A VHDL code providing description of the functionality registers and exposing AXI compliant interface is a valid provider target.
A JSON file describing registerification results is for example a valid documentation target.
The target depends on several factors, but the most important ones are programming/description language, synchronous or asynchronous access interface, bus type, dynamic or static address map reloading.
Each target has its recipient.
It is either provider, requester or documentation.
]
#block(breakable:false)[
/ upstream:
A stream from the provider to the requester.
]
#pagebreak()
|
|
https://github.com/OctarineSourcerer/NeonInTheDark | https://raw.githubusercontent.com/OctarineSourcerer/NeonInTheDark/main/main.typ | typst | #import "templates/documentTemplate.typ": bladesDoc
#show: doc => bladesDoc(
title: "NEON IN THE DARK",
subtitle: "A Blades In The Dark hack",
doc)
#include "sections/terms.typ"
#pagebreak()
#include "crews/boostergang.typ"
#pagebreak()
#include "crews/chromers.typ" |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/fh-joanneum-iit-thesis/1.1.0/template/chapters/3-related.typ | typst | Apache License 2.0 | #import "global.typ": *
= Related Work
#lorem(30)
#todo([
Describe the work of other research teams and noteworthy approaches related to your work. State what is different to your solution.
+ Related literature might/should contain: theoretical foundations,
- definitions of key terms,
- technologies, techniques,
- and/or a literature review
+ Note on the size and quality of your bibliography:
- BA about 30-40 references
- MA about 60-100 references
Furthermore, check:
Are the reference (too) old?
Did you include papers from scientific databases, such as ACM or IEEE?
Can the reader find your sources? (e.g. check if you named the publisher for books, or specified DOIs for scientific papers)
#v(1cm)
*Citation hints when writing in Typst:*
A single citation is possible with the \@Eco:2010 (i.e. using the _at_ sign), such as @Eco:2010.
Find in #cite(<acm:diglibrary>) and/or #cite(<ieee:xplore>) the lateset scientific findings. For citing multiple references, just name them one by one, such as #cite( <Alley:1998>) #cite(<Booth:2008>)
@Batina:2011
@Eco:2010
@Fernandez-Mir:2011
@Field:2003
@Google:2016a @Google:2017a
@Li:2008
@Shaw:2002
@Strunk:2000
@Wisconsin:2004
@Yin:2013
@Zobel:2004
and they will be listed within the _(_ _)_ round brackets separated by a _;_ semicolon.
If we know where a text of relevance is presented inside an article, we might specify the page number also, see @Yin:2013[p.~7]. If you want to cite without paranthesis, you specify _form_ as _prose_, as shown here with #cite(<Shaw:2002>, form: "prose").
])
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/113.%20makersschedule.html.typ | typst | makersschedule.html
Maker's Schedule, Manager's Schedule
"...the mere consciousness of an engagement will sometimes worry a whole day."� <NAME>
July 2009One reason programmers dislike meetings so much is that they're on
a different type of schedule from other people. Meetings cost them
more.There are two types of schedule, which I'll call the manager's
schedule and the maker's schedule. The manager's schedule is for
bosses. It's embodied in the traditional appointment book, with
each day cut into one hour intervals. You can block off several
hours for a single task if you need to, but by default you change
what you're doing every hour.When you use time that way, it's merely a practical problem to meet
with someone. Find an open slot in your schedule, book them, and
you're done.Most powerful people are on the manager's schedule. It's the
schedule of command. But there's another way of using time that's
common among people who make things, like programmers and writers.
They generally prefer to use time in units of half a day at least.
You can't write or program well in units of an hour. That's barely
enough time to get started.When you're operating on the maker's schedule, meetings are a
disaster. A single meeting can blow a whole afternoon, by breaking
it into two pieces each too small to do anything hard in. Plus you
have to remember to go to the meeting. That's no problem for someone
on the manager's schedule. There's always something coming on the
next hour; the only question is what. But when someone on the
maker's schedule has a meeting, they have to think about it.For someone on the maker's schedule, having a meeting is like
throwing an exception. It doesn't merely cause you to switch from
one task to another; it changes the mode in which you work.I find one meeting can sometimes affect a whole day. A meeting
commonly blows at least half a day, by breaking up a morning or
afternoon. But in addition there's sometimes a cascading effect.
If I know the afternoon is going to be broken up, I'm slightly less
likely to start something ambitious in the morning. I know this
may sound oversensitive, but if you're a maker, think of your own
case. Don't your spirits rise at the thought of having an entire
day free to work, with no appointments at all? Well, that means
your spirits are correspondingly depressed when you don't. And
ambitious projects are by definition close to the limits of your
capacity. A small decrease in morale is enough to kill them off.Each type of schedule works fine by itself. Problems arise when
they meet. Since most powerful people operate on the manager's
schedule, they're in a position to make everyone resonate at their
frequency if they want to. But the smarter ones restrain themselves,
if they know that some of the people working for them need long
chunks of time to work in.Our case is an unusual one. Nearly all investors, including all
VCs I know, operate on the manager's schedule. But
Y Combinator
runs on the maker's schedule. Rtm and Trevor and I do because we
always have, and Jessica does too, mostly, because she's gotten
into sync with us.I wouldn't be surprised if there start to be more companies like
us. I suspect founders may increasingly be able to resist, or at
least postpone, turning into managers, just as a few decades ago
they started to be able to resist switching from jeans
to suits.How do we manage to advise so many startups on the maker's schedule?
By using the classic device for simulating the manager's schedule
within the maker's: office hours. Several times a week I set aside
a chunk of time to meet founders we've funded. These chunks of
time are at the end of my working day, and I wrote a signup program
that ensures all the appointments within a given set of office hours
are clustered at the end. Because they come at the end of my day
these meetings are never an interruption. (Unless their working
day ends at the same time as mine, the meeting presumably interrupts
theirs, but since they made the appointment it must be worth it to
them.) During busy periods, office hours sometimes get long enough
that they compress the day, but they never interrupt it.
When we were working on our own startup, back in the 90s, I evolved
another trick for partitioning the day. I used to program from
dinner till about 3 am every day, because at night no one could
interrupt me. Then I'd sleep till about 11 am, and come in and
work until dinner on what I called "business stuff." I never thought
of it in these terms, but in effect I had two workdays each day,
one on the manager's schedule and one on the maker's.When you're operating on the manager's schedule you can do something
you'd never want to do on the maker's: you can have speculative
meetings. You can meet someone just to get to know one another.
If you have an empty slot in your schedule, why not? Maybe it will
turn out you can help one another in some way.Business people in Silicon Valley (and the whole world, for that
matter) have speculative meetings all the time. They're effectively
free if you're on the manager's schedule. They're so common that
there's distinctive language for proposing them: saying that you
want to "grab coffee," for example.Speculative meetings are terribly costly if you're on the maker's
schedule, though. Which puts us in something of a bind. Everyone
assumes that, like other investors, we run on the manager's schedule.
So they introduce us to someone they think we ought to meet, or
send us an email proposing we grab coffee. At this point we have
two options, neither of them good: we can meet with them, and lose
half a day's work; or we can try to avoid meeting them, and probably
offend them.Till recently we weren't clear in our own minds about the source
of the problem. We just took it for granted that we had to either
blow our schedules or offend people. But now that I've realized
what's going on, perhaps there's a third option: to write something
explaining the two types of schedule. Maybe eventually, if the
conflict between the manager's schedule and the maker's schedule
starts to be more widely understood, it will become less of a
problem.Those of us on the maker's schedule are willing to compromise. We
know we have to have some number of meetings. All we ask from those
on the manager's schedule is that they understand the cost.
Thanks to <NAME>, <NAME>, <NAME>, <NAME>,
and <NAME> for reading drafts of this.Related:How to Do What You LoveGood and Bad ProcrastinationTurkish TranslationFrench TranslationKorean TranslationGerman Translation
|
|
https://github.com/coco33920/.files | https://raw.githubusercontent.com/coco33920/.files/mistress/typst_templates/dept-news/template.typ | typst | // Used to collect sidebar articles.
#let articles = state("articles", ())
// This function gets your whole document as its `body` and formats
// it as the fun newsletter of a college department.
#let dept-news(
// The newsletter's title.
title: "Newsletter title",
// The edition, displayed at the top of the sidebar.
edition: none,
// A hero image at the start of the newsletter. If given, should be a
// dictionary with two keys: A `path` to an image file and a `caption`
// that is displayed to the right of the image.
hero-image: none,
// Details about the publication, displayed at the end of the document.
publication-info: none,
// The newsletter's content.
body
) = {
// Set document metadata.
set document(title: title)
// Configure pages. The background parameter is used to
// add the right background to the pages.
set page(
margin: (left: 2.5cm, right: 1.6cm),
background: place(right + top, rect(
fill: red,
height: 100%,
width: 7.8cm,
))
)
// Set the body font.
set text(12pt, font: "Barlow")
// Configure headings.
show heading: set text(font: "Syne")
show heading.where(level: 1): set text(1.1em)
show heading.where(level: 1): set par(leading: 0.4em)
show heading.where(level: 1): set block(below: 0.8em)
show heading: it => {
set text(weight: 600) if it.level > 2
it
}
// Links should be underlined.
show link: underline
// Configure figures.
show figure: it => block({
// Display a backdrop rectangle.
move(dx: -3%, dy: 1.5%, rect(
fill: rgb("FF7D79"),
inset: 0pt,
move(dx: 3%, dy: -1.5%, it.body)
))
// Display caption.
if it.has("caption") {
set align(center)
set text(font: "Syne")
v(if it.has("gap") { it.gap } else { 24pt }, weak: true)
[-- ]
it.caption
if it.numbering != none {
[ (] + counter(figure).display(it.numbering) + [)]
}
[ --]
}
v(48pt, weak: true)
})
// The document is split in two with a grid. A left column for the main
// flow and a right column for the sidebar articles.
grid(
columns: (1fr, 7.8cm - 1.6cm - 18pt),
column-gutter: 36pt,
row-gutter: 32pt,
// Title.
text(font: "Syne", 23pt, weight: 800, upper(title)),
// Edition.
text(fill: white, weight: "medium", 14pt, align(right + bottom, edition)),
// Hero image.
style(styles => {
if hero-image == none {
return
}
// Measure the image and text to find out the correct line width.
// The line should always fill the remaining space next to the image.
let img = image(hero-image.path, width: 14cm)
let text = text(size: 25pt, fill: white, font: "<NAME>", hero-image.caption)
let img-size = measure(img, styles)
let text-width = measure(text, styles).width + 12pt
let line-length = img-size.height - text-width
grid(
columns: (img-size.width, 1cm),
column-gutter: 16pt,
rows: img-size.height,
img,
grid(
rows: (text-width, 1fr),
move(dx: 11pt, rotate(
90deg,
origin: top + left,
box(width: text-width, text)
)),
line(angle: 90deg, length: line-length, stroke: 3pt + white),
),
)
}),
// Nothing next to the hero image.
none,
// The main flow with body and publication info.
{
set par(justify: true)
body
v(1fr)
set text(0.7em)
publication-info
},
// The sidebar with articles.
locate(loc => {
set text(fill: white, weight: 500)
show heading: underline.with(stroke: 2pt, offset: 4pt)
v(44pt)
for element in articles.final(loc) {
element
v(24pt, weak: true)
}
}),
)
}
// A stylized block with a quote and its author.
#let blockquote(by, body) = box(inset: (x: 0.4em, y: 12pt), width: 100%, {
set text(font: "Syne")
grid(
columns: (1em, auto, 1em),
column-gutter: 12pt,
rows: (1em, auto),
row-gutter: 8pt,
text(5em)["],
line(start: (0pt, 0.45em), length: 100%),
none, none,
text(1.4em, align(center, body)),
none, none,
v(8pt) + align(right, text(font: "Barlow")[---#by]),
)
})
// An article that is displayed in the sidebar. Can be added
// anywhere in the document. All articles are collected automatically.
#let article(body) = articles.update(it => it + (body,))
|
|
https://github.com/0x1B05/nju_os | https://raw.githubusercontent.com/0x1B05/nju_os/main/lecture_notes/content/05_多处理器编程:从入门到放弃.typ | typst | #import "../template.typ": *
#pagebreak()
= 多处理器编程:从入门到放弃
== 多处理器编程入门
=== Three Easy Pieces: 并发
操作系统作为 “状态机的管理者”,引入了共享的状态
- 带来了并发
- (操作系统是最早的并发程序)
```py
def Tprint(name):
sys_write(f'{name}')
def main():
for name in 'AB':
sys_spawn(Tprint, name)
= Outputs:
= AB
= BA
```
使用 model checker 绘制状态图
=== 多线程共享内存并发
线程:共享内存的执行流
- 执行流拥有独立的堆栈/寄存器
简化的线程 API (thread.h)
- `spawn(fn)` - 创建一个入口函数是 fn 的线程,并立即开始执行 - `void fn(int tid) { ... }` -
参数 tid 从 1 开始编号 行为:`sys_spawn(fn, tid)`
- `join()`
- 等待所有运行线程的返回 (也可以不调用)
- 行为:`while (done != T) sys_sched()`
=== 多线程共享内存并发:入门
多处理器编程:一个 API 搞定
```c
#include "thread.h"
void Ta() { while (1) { printf("a"); } }
void Tb() { while (1) { printf("b"); } }
int main() {
create(Ta);
create(Tb);
}
```
- 这个程序可以利用系统中的多处理器
- 操作系统会自动把线程放置在不同的处理器上
- CPU 使用率超过了 100%
==== demo
```c
#include "thread.h"
void Thello(int id) {
while (1) {
// printf("%c", "_ABCDEFGHIJKLMNOPQRSTUVWXYZ"[id]);
}
}
int main() {
for (int i = 0; i < 2; i++) {
spawn(Thello);
}
}
```
`gcc hello.c && ./a.out`, 接着`htop`可以看到占用了 200% 的 cpu, 把循环次数改成 3
就变成了 300% .
=== 问出更多的问题
_问一个好的问题再去寻找答案, 这个比单纯地学习知识效率更高._
==== 证明共享内存
`Ta` 和 `Tb` 真的共享内存吗? 如何证明/否证这件事?
`shared_men.c`
```c
#include "thread.h"
int x = 0;
void Thello(int id) {
x++;
printf("%d\n", x);
}
int main() {
for (int i = 0; i < 10; i++) {
spawn(Thello);
}
}
```
output:
```sh
❯ gcc hello.c && ./a.out
1
3
2
5
4
6
7
8
9
10
```
==== 如何证明线程具有独立堆栈 (以及确定堆栈的范围)?
单线程的堆栈:
```
| stack |
| stack down |
| heap up |
| heap |
| code |
```
```c
#include "thread.h"
void add(int n) {
int x = 0;
x++;
printf("x: %d\n", x);
}
int main(int argc, char *argv[]) {
for (int i = 0; i < 10; i++) {
spawn(add);
}
return 0;
}
```
output:
```sh
> gcc indp_stk.c && ./a.out
x: 1
x: 1
x: 1
x: 1
x: 1
x: 1
x: 1
x: 1
x: 1
x: 1
```
==== 线程的堆栈在哪?多大? 写一个程序来确定!(无穷递归!爆栈)
stack-probe.c
```c
#include "thread.h"
void *volatile low[64];
void *volatile high[64];
void update_range(int T, void *ptr) {
if (ptr < low[T]) low[T] = ptr;
if (ptr > high[T]) high[T] = ptr;
}
void probe(int T, int n) {
update_range(T, &n);
long sz = (uintptr_t)high[T] - (uintptr_t)low[T];
if (sz % 1024 < 32) {
printf("Stack(T%d) >= %ld KB\n", T, sz / 1024);
}
probe(T, n + 1); // Infinite recursion
}
void Tprobe(int T) {
low[T] = (void *)-1;
high[T] = (void *)0;
update_range(T, &T);
probe(T, 0);
}
int main() {
setbuf(stdout, NULL);
for (int i = 0; i < 4; i++) {
create(Tprobe);
}
}
```
===== `setbuf`?
```c
int main(){
printf("%d",1);
crash();
}
```
为什么`1`打印不出来? 如果`printf("%d",1);`换成`printf("%d\n",1);`就可以打印出来.
OS 会给出答案!
- 对于终端(包括
stdin、stdout)等交互式设备,通常采用行缓冲:即只有当遇到换行符或者缓冲区满时,才会进行实际的输入/输出操作。
- 对于其他非交互式设备(如文件、管道等),通常采用全缓冲:即只有当缓冲区满时,才会进行实际的输入/输出操作。
`setbuf` 是 C 语言标准库中的一个函数,用于设置文件流的缓冲策略。其原型如下:
```c
void setbuf(FILE *stream, char *buffer);
```
1. `stream`:这是一个指向 `FILE` 类型的指针,表示要设置缓冲策略的文件流。
2. `buffer`:这是一个指向字符的指针,表示要用作缓冲区的内存地址。如果这个参数为 `NULL`,那么 `stream` 将不会有缓冲区,也就是说,每次读写操作都会直接对文件进行。
在 C 语言中,文件 I/O 操作通常是缓冲的, 即当你调用一个输出函数(比如 `printf` 或 `putchar`)时,数据并不是立即写入文件,而是先写入一个缓冲区。只有当缓冲区满了,或者你显式地刷新缓冲区(比如通过调用 `fflush`),数据才会真正写入文件。
#tip("Tip")[
需要注意的是,`setbuf` 必须在打开文件流后、进行任何其他操作前调用。否则,其行为是未定义的。
]
```c
#include <stdio.h>
int main(int argc, char *argv[]) {
setbuf(stdout, NULL);
void *ptr = 0;
printf("%d", 1);
printf("%d", *(int *)ptr);
return 0;
}
```
这样`1`不需要换行符也可以被成功打印出来了!
===== continue stack-probe
```c
void *volatile low[64];
void *volatile high[64];
```
假设不超过 64 个线程, `low`代表看见的最低的地址的位置, `high`代表看见的最高的地址的位置.
```c
void update_range(int T, void *ptr) {
if (ptr < low[T]) low[T] = ptr;
if (ptr > high[T]) high[T] = ptr;
}
void probe(int T, int n) {
update_range(T, &n);
long sz = (uintptr_t)high[T] - (uintptr_t)low[T];
if (sz % 1024 < 32) {
printf("Stack(T%d) >= %ld KB\n", T, sz / 1024);
}
probe(T, n + 1); // Infinite recursion
}
void Tprobe(int T) {
low[T] = (void *)-1;
high[T] = (void *)0;
update_range(T, &T);
probe(T, 0);
}
```
`Tprobe` 中调用`Tprobe`赋初值, low 是当前看到的最低地址的位置, `high`是当前看到的最高地址的位置.
`update_range` 函数的参数 `ptr` 是一个指向某个内存地址的指针。这个函数的目的是更新线程 `T` 的栈的最低和最高地址。
当你在 `probe` 函数中调用 `update_range(T, &n);` 时,`&n` 是局部变量 `n` 在栈上的地址。因为每次递归调用 `probe` 都会创建一个新的 `n` 变量,所以 `n` 的地址可以用来追踪栈的增长。
回到 `update_range` 函数,如果传入的 `ptr` 指向的地址比当前线程的栈的最低地址还要低,那么就将 `low[T]` 更新为 `ptr`。同样,如果 `ptr` 指向的地址比当前线程的栈的最高地址还要高,那么就将 `high[T]` 更新为 `ptr`。
总的来说,`ptr` 参数的作用是提供一个参考点,用于更新线程 `T` 的栈的最低和最高地址。通过这种方式,程序可以追踪每个线程栈的使用情况。
```sh
gcc stack-probe.c && ./a.out | grep T1 | sort -nk3
```
可以看到 8192KB, 但是 8192KB 不总是够用的, 于是可以进一步配置线程栈的大小.
- 更多的 “好问题” 和解决
- 创建线程使用的是哪个系统调用?
- 能不能用 gdb 调试?
- 基本原则:有需求,就能做到 ([ RTFM
](https://sourceware.org/gdb/onlinedocs/gdb/Threads.html))
=== thread.h 背后:POSIX Threads
想进一步配置线程?
- 设置更大的线程栈
- 设置 detach 运行 (不在进程结束后被杀死,也不能 join)
- ……
POSIX 为我们提供了线程库 (pthreads)
- `man 7 pthreads`
- 练习:改写 thread.h,使得线程拥有更大的栈
- 可以用 stack probe 的程序验证
== 放弃 (1):原子性
=== 状态机的隐含假设
“世界上只有一个状态机”
- 没有其他任何人能 “干涉” 程序的状态
- 推论:对变量的 load 一定返回本线程最后一次 store 的值
- 这也是编译优化的基本假设
```c
int i = 0;
// assume i==0;
for(; i < n; i++){
}
```
但*共享内存*推翻了这个假设
```c
int Tworker() {
printf("%d\n", x); // Global x
printf("%d\n", x);
}
```
- 其他线程随时可以修改 `x`
- 导致两次可能读到不同的 `x`
=== 潘多拉的魔盒已经打开……
两个线程并发支付 ¥100 会发生什么 (代码演示)
```c
#include "thread.h"
unsigned long balance = 100;
void Alipay_withdraw(int amt) {
if (balance >= amt) {
usleep(1); // Unexpected delays
balance -= amt;
}
}
void Talipay(int id) { Alipay_withdraw(100); }
int main() {
create(Talipay);
create(Talipay);
join();
printf("balance = %lu\n", balance);
}
```
```sh
❯ gcc alipay.c && ./a.out
balance = 18446744073709551516
```
- 账户里会多出用不完的钱!
- Bug/漏洞不跟你开玩笑:Mt. Gox Hack 损失 650,000 BTC
- 时值 ~\$28,000,000,000
```c
create(Talipay);
```
会发生什么?正常
```c
create(Talipay);
join();
create(Talipay);
join();
```
会发生什么?正常
#example("求和")[
分两个线程,计算 `1+1+1+…+1` (共计 `2n` 个 `1`)
```c
#define N 100000000
long sum = 0;
void Tsum() { for (int i = 0; i < N; i++) sum++; }
int main() {
create(Tsum);
create(Tsum);
join();
printf("sum = %ld\n", sum);
}
```
可能的结果
- `119790390`, `99872322` (结果可以比 `N` 还要小), ...
- 直接使用汇编指令也不行
]
=== 放弃 (1):指令/代码执行原子性假设
_“处理器一次执行一条指令” 的基本假设在今天的计算机系统上不再成立 (我们的模型作出了简化的假设)。_
- 单处理器多线程
- 线程在运行时可能被中断,切换到另一个线程执行
- 多处理器多线程
- 线程根本就是并行执行的
- (历史) 1960s,大家争先在共享内存上实现原子性 (互斥)
- 但几乎所有的实现都是错的,直到 #link("https://en.wikipedia.org/wiki/Dekker's_algorithm")[ Dekker's Algorithm ],还只能保证两个线程的互斥
=== 放弃原子性假设的后果
我们都知道 `printf` 是有缓冲区的 (为什么?), 那`printf` 还能在多线程程序里调用吗?如果执行 `buf[pos++] = ch` (`pos` 共享) 不就 💥 了吗?
```c
void thread1() { while (1) { printf("a"); } }
void thread2() { while (1) { printf("b"); } }
```
RTFM! -> 我们发现`printf`是thread safe的.
== 放弃 (2):执行顺序
=== 例子:求和 (再次出现)
分两个线程,计算 1+1+1+…+1 (共计 2n 个 1)
```c
#define N 100000000
long sum = 0;
void Tsum() { for (int i = 0; i < N; i++) sum++; }
int main() {
create(Tsum);
create(Tsum);
join();
printf("sum = %ld\n", sum);
}
```
如果添加编译优化?
- -O1: 100000000 😱😱
- -O2: 200000000 😱😱😱
`gcc -O1 sum.c && objdump -d ./a.out > O1.txt`
`gcc -O2 sum.c && objdump -d ./a.out > O2.txt`
O1.txt:
```
000000000000117f <Tsum>:
117f: 48 8b 15 da 2e 00 00 mov 0x2eda(%rip),%rdx = 4060 <sum>
1186: 48 8d 42 01 lea 0x1(%rdx),%rax
118a: 48 81 c2 01 e1 f5 05 add $0x5f5e101,%rdx 1191: 48 89 c1 mov %rax,%rcx
1194: 48 83 c0 01 add $0x1,%rax
1198: 48 39 d0 cmp %rdx,%rax
119b: 75 f4 jne 1191 <Tsum+0x12>
119d: 48 89 0d bc 2e 00 00 mov %rcx,0x2ebc(%rip) = 4060 <sum>
11a4: c3 ret
```
中间是个循环, 循环完之后再赋值
```
%rdx = sum
loop
sum = %rcx
```
O2.txt:
```
00000000000011e0 <Tsum>:
11e0: 48 81 05 75 2e 00 00 addq $0x5f5e100,0x2e75(%rip) = 4060 <sum> 11e7: 00 e1
f5 05 11eb: c3 ret 11ec: 0f 1f 40 00 nopl 0x0(%rax)
```
直接赋值, 循环都没了。
```
sum += 0x5f5e100 ret
```
#tip("Tip")[
不同的编译器也许是不同地结果。
]
=== 放弃 (2):程序的顺序执行假设
_编译器对内存访问 “eventually consistent” 的处理导致共享内存作为线程同步工具的失效。_
刚才的例子:
- -O1: `R[eax] = sum; R[eax] += N; sum = R[eax]`
- -O2: `sum += N;`
- (你的编译器也许是不同的结果)
另一个例子
```c while (!done);// would be optimized to
if (!done) while (1);
```
==== 保证执行顺序
回忆 “编译正确性”
- C 状态和汇编状态机的 “可观测行为等价”
- 方法 1:插入 “不可优化” 代码
- `asm volatile ("" ::: "memory");`
- “Clobbers memory”(该位置上可能有其他任何东西改变共享的内存值)
```c int x = 0; void Tsum() { x = 1; asm volatile("" ::: "memory"); x = 1; }
```
- 方法 2:标记变量 load/store 为不可优化
- 使用 `volatile` 变量
```c extern int volatile done;
while (!done) ;
```
== 放弃 (3):处理器间的可见性
#example("Example")[
```c int x = 0, y = 0;
void T1() { x = 1; int t = y;// Store(x); Load(y)
printf("%d", t); }
void T2() { y = 1; int t = x;// Store(y); Load(x)
printf("%d", t); }
```
遍历模型告诉我们:`01`, `10`, `11`
- 机器永远是对的
- Model checker 的结果和实际的结果不同 → 假设错了
]
=== 🌶️ 现代处理器也是 (动态) 编译器!
- 错误 (简化) 的假设: 一个 CPU 执行一条指令到达下一状态
- 实际的实现:电路将连续的指令 “编译” 成更小的 $μ$ ops
- `RF[9] = load(RF[7] + 400)`
- `store(RF[12], RF[13])`
- `RF[3] = RF[4] + RF[5]`
在任何时刻,处理器都维护一个 $μ$op 的 “池子”
- 与编译器一样,做 “顺序执行” 假设:没有其他处理器 “干扰”
- 每一周期执行尽可能多的 $μ$op - 多路发射、乱序执行、按序提交
#tip("Tip")[
通过流水线可以实现IPC>1, 同时执行多个指令。
]
=== 放弃 (3):多处理器间内存访问的即时可见性
_满足单处理器 eventual memory consistency 的执行,在多处理器系统上可能无法序列化!_
当 `x != y` 时,对 x, y 的内存读写可以交换顺序
- 它们甚至可以在同一个周期里完成 (只要 load/store unit 支持)
- 如果写 x 发生 cache miss,可以让读 y 先执行
- 满足 “尽可能执行 $μ$op” 的原则,最大化处理器性能
```
= <-----------+
movl $1, (x) = |
movl (y), %eax = --+
```
- 在多处理器上的表现
- 两个处理器分别看到 y=0 和 x=0
```
cpu1 cpu2 cpu3 cpu4
1:x=1 2:x=2 load(x) load(x)
=2 =1
=1 =2
```
=== 宽松内存模型 (Relaxed/Weak Memory Model)
_宽松内存模型的目的是使单处理器的执行更高效。_
目前各大架构的系统模拟器最困难的地方就是模拟内存模型, 他们不知道哪个地方会被插入执行, 只能每行代码都加一个`fence`。
#tip("Tip")[
x86 已经是市面上能买到的 “最强” 的内存模型了 😂
]
- 这也是 Intel 自己给自己加的包袱
- 看看 #link("https://research.swtch.com/[email protected]")[ ARM/RISC-V ] 吧,根本就是个分布式系统
#image("images/2023-11-04-10-15-39.png")
#tip("Tip")[
- 通过队列, 可以看到total store order.
- 全局状态:`1 2`还是`2 1`
]
(x86-TSO in #link("https://research.swtch.com/hwmm")[ Hardware memory models ] by Russ Cox)
|
|
https://github.com/mem-courses/calculus | https://raw.githubusercontent.com/mem-courses/calculus/main/recourses-2/exam-template.typ | typst |
#let prob_counter = state("prob_counter", 0)
#let prob(x) = {
prob_counter.update(x => x + 1)
strong({
text("Problem ")
prob_counter.display()
text(". ")
})
x
v(1fr)
}
#let options(columns: 1, ..content) = {
let buffer = ()
for i in range(0, content.pos().len()) {
buffer.push({
text("(")
str.from-unicode(65 + i)
text(") ")
content.pos().at(i)
})
}
if columns != 1 {
columns = range(columns).map(x => 1fr)
}
table(
columns: columns,
stroke: 0pt,
row-gutter: 1em,
inset: 0pt,
..buffer,
)
} |
|
https://github.com/ShapeLayer/ucpc-solutions__typst | https://raw.githubusercontent.com/ShapeLayer/ucpc-solutions__typst/main/lib/colors.typ | typst | Other | // Colors
#let __ucpc_color_named = (
brown: (
rgb("#9d4900"),
rgb("#a54f00"),
rgb("#ad5600"),
rgb("#b55d0a"),
rgb("#c67739"),
),
bluegray: (
rgb("#38546e"),
rgb("#3d5a74"),
rgb("#435f7a"),
rgb("#496580"),
rgb("#4e6a86"),
),
yellow: (
rgb("#d28500"),
rgb("#df8f00"),
rgb("#ec9a00"),
rgb("#f9a518"),
rgb("#ffb028"),
),
cyan: (
rgb("#00c78b"),
rgb("#00d497"),
rgb("#27e2a4"),
rgb("#3ef0b1"),
rgb("#51fdbd"),
),
skyblue: (
rgb("#009ee5"),
rgb("#00a9f0"),
rgb("#00b4fc"),
rgb("#2bbfff"),
rgb("#41caff"),
),
cherry: (
rgb("#e0004c"),
rgb("#ea0053"),
rgb("#f5005a"),
rgb("#ff0062"),
rgb("#ff3071"),
),
)
#let color = (
brown: __ucpc_color_named.brown,
bluegray: __ucpc_color_named.bluegray,
yellow: __ucpc_color_named.yellow,
cyan: __ucpc_color_named.cyan,
skyblue: __ucpc_color_named.skyblue,
cherry: __ucpc_color_named.cherry,
bronze: (
V: __ucpc_color_named.brown.at(0),
IV: __ucpc_color_named.brown.at(1),
III: __ucpc_color_named.brown.at(2),
II: __ucpc_color_named.brown.at(3),
I: __ucpc_color_named.brown.at(4),
),
silver: (
V: __ucpc_color_named.bluegray.at(0),
IV: __ucpc_color_named.bluegray.at(1),
III: __ucpc_color_named.bluegray.at(2),
II: __ucpc_color_named.bluegray.at(3),
I: __ucpc_color_named.bluegray.at(4),
),
gold: (
V: __ucpc_color_named.yellow.at(0),
IV: __ucpc_color_named.yellow.at(1),
III: __ucpc_color_named.yellow.at(2),
II: __ucpc_color_named.yellow.at(3),
I: __ucpc_color_named.yellow.at(4),
),
platinum: (
V: __ucpc_color_named.cyan.at(0),
IV: __ucpc_color_named.cyan.at(1),
III: __ucpc_color_named.cyan.at(2),
II: __ucpc_color_named.cyan.at(3),
I: __ucpc_color_named.cyan.at(4),
),
diamond: (
V: __ucpc_color_named.skyblue.at(0),
IV: __ucpc_color_named.skyblue.at(1),
III: __ucpc_color_named.skyblue.at(2),
II: __ucpc_color_named.skyblue.at(3),
I: __ucpc_color_named.skyblue.at(4),
),
ruby: (
V: __ucpc_color_named.cherry.at(0),
IV: __ucpc_color_named.cherry.at(1),
III: __ucpc_color_named.cherry.at(2),
II: __ucpc_color_named.cherry.at(3),
I: __ucpc_color_named.cherry.at(4),
),
misc: (
ghudegy: rgb("#8769af"),
unrated: rgb("#2d2d2d"),
),
)
|
https://github.com/jw2476/cslog | https://raw.githubusercontent.com/jw2476/cslog/master/devlogs/buffer_race_conditions/mod.typ | typst | == 2023-07-25 - Buffer Race Conditions
=== The Problem
Occasionally, especially on my desktop, I'd notice missing chunks of vertex data. Upon investigation with RenderDoc I saw that the first 64 bytes of the vertex buffer was being set to a strange constant value.
=== Debugging
Using RenderDoc I traced back into the memory arena that buffer allocations were coming from, the same memory offset was being assigned to two buffers in the same frame.
#image("renderdoc.png")
Now this in theory wouldn't be an issue since the first buffer was being used in the render pass, and the second in the UI pass, however the GPU wasn't waiting properly when I was allocating and writing memory, even when I told the device to wait till idle on every write (which incurred a heavy performance penalty). The issue was due to the fact I was deallocating memory according to Rust lifetimes, i.e. when a resource goes out of scope rather than GPU lifetimes which were a lot longer, hence the race condition.
=== The Fix
The solution was to record frees into a "to free" buffer and flush that buffer when the program could guarantee the GPU wouldn't be using any resources and with this the vertex buffer corruption seemed to disappear. It's not the best solution and it locks me out of frames-in-flight so I may need to revisit it, however that won't be too hard since part of my debugging resulted in me writing a custom allocator and dropping and gpu_allocator requirement, so it will be easier to extend in future.
Here's an example of batching frees:
#image("batched.png")
TODO: Add code snippets and more detail |
|
https://github.com/TJ-CSCCG/tongji-undergrad-thesis-typst | https://raw.githubusercontent.com/TJ-CSCCG/tongji-undergrad-thesis-typst/main/.github/ISSUE_TEMPLATE/docs_request.md | markdown | MIT License | ---
name: Docs 反馈
about: 通过该 Issue 模板反馈目前 tongji-undergrad-thesis-typst 文档的不足之处
labels: 'type/docs'
---
### 文档不足之处
<!--在你认为存在缺陷的部分打勾-->
* 平台相关
* [ ] 在线平台:Typst App
* [ ] 本地平台:Typst
* 使用过程
* [ ] 模版编译(编译配置、依赖安装等)
* [ ] 最佳实践(Typst 基础知识、模版使用教学、工作流等)
* [ ] 不,我需要其他文档:_________
### 对文档的期望
<!--如果可以的话,还希望你能够在下方提供你期望中的文档大纲-->
### 其他信息
<!--这里用于写有关于上述 docs 的其他信息-->
|
https://github.com/valentinvogt/npde-summary | https://raw.githubusercontent.com/valentinvogt/npde-summary/main/src/chapters/12.typ | typst | #import "../setup.typ": *
#show: thmrules
= Finite Elements for the Stokes Equation
<ch:stokes>
#counter(heading).update((12, 2))
=== Constrained Variational Formulation
To simulate a fluid, we solve for a velocity field $bv$, so we have a vector
problem. We assume incompressibility (recall @sub:heat-conduction) and the _non-slip boundary condition_ $bv = 0$ on $partial Omega$.
The Stokes equation is then
$ V = {bv : Omega -> RR^d upright("continuous"), div bv = 0, bv = 0 upright("on") partial Omega} $
We basically generalize @ch:01 to vector fields:
$ u &--> bv \
grad u &--> jac bv &&upright("(Jacobian)") \
norm(grad u) &--> norm(jac bv)_F &&upright("(Frobenius norm)") \
grad u dot.op grad v &--> jac bv : jac bw && \ $
where the component-wise dot product is defined as $A : B= sum_(i j) A_(i j) B_(i j)$.
We also get a Sobolev space
$ bH^1_0(div 0,Omega) = {bv in (H^1_0(Omega))^d : div bv = 0} $
Like in @ch:01, we have a minimization problem
#neq(
$ bv^* &= argmin_(bv in V) &1/2 integral_Omega mu norm(curl bv)^2 dif bx - integral_Omega bold(f) dot bv dif bx \
&= argmin_(bv in V) &1/2 integral_Omega mu norm(jac bv)_F^2 dif bx - integral_Omega bold(f) dot bv dif bx $,
)<eq:stokes-minimization>
where $bold(f)$ is a given force field, $mu$ is the _viscosity_.
There is a variational (weak) form equivalent to @eq:stokes-minimization:
#neq(
$ bv^* in V upright("such that ") wide integral_Omega mu med jac bv : jac bw dif bx = integral_Omega bold(f) dot bw dif bx wide forall bw in V $,
)<eq:stokes-variational>
It's difficult to solve this directly because of the constraint $div bv = 0$.
Therefore, we use the method of Lagrange multipliers.
#pagebreak()
=== Saddle Point Formulation
We apply the method of Lagrange multipliers (generalized to vector fields) to
@eq:stokes-variational to get the following "saddle point" problem:
#subtle-box(
)[
Seek the velocity field $bv in (H_0^1(Omega))^d$ and a Lagrange multiplier $p in L^2_*(Omega)$ such
that
#neq(
$ &integral_Omega mu jac bv : jac bw dif bx + integral_Omega div bw med p dif bx &&= integral bold(f) dot bw dif bx quad &&forall bw &&in (H_0^1(Omega))^d\
&integral_Omega div bv med q dif bx &&= 0 quad &&forall q &&in L^2_*(Omega) $,
)<eq:ssp>
]
We can interpret the Lagrange multiplier $p$, which is a scalar field, as the _pressure_.
As trial and test space for the pressure, we use the space
#neq($ L^2_* = {q in L^2(Omega) : integral_Omega q dif bx = 0} $)<eq:l2-star>
because like in @sub:second-order-elliptic-variational-problems, the pressure is
only defined up to a constant (if $p$ solves @eq:ssp, then $p + c$ also solves
it for any $c in RR$).
In practice, to deal with this constraint, we enforce it through a Lagrange multiplier too:
#subtle-box[
Seek $bv in (H_0^1(Omega))^d$, $p in L^2(Omega)$, and $lambda in RR$ such that
#neq(
$
& integral_Omega mu jac bv : jac bw dif bx + && integral_Omega div bw med p dif bx & quad & quad = integral bold(f) &&dot bw dif bx quad &&forall bw in (H_0^1(Omega))^d \
& integral_Omega div bv med q dif bx && quad & + lambda integral_Omega q dif bx & quad = && 0 quad &&forall q in L^2(Omega) \
& quad && integral_Omega p dif bx & &quad = && 0
$
)<eq:ssp-zero-mean>
]
As always, we are concerned with the existence and uniqueness of solutions to
@eq:ssp.
#theorem(
number: "192.168.3.11", [Existence and uniqueness of weak solutions of Stokes problem],
)[
The Stokes problem @eq:ssp has a unique solution $(bv, p) in bold(H)^1_0(div 0,Omega) times L^2_*(Omega)$ which
satisfies
#neq(
$ norm(bv)_(H^1(Omega)) + norm(p)_(L^2(Omega)) <= C norm(bold(f))_(L^2(Omega)) $,
)<eq:stokes-estimate>
where $C= C(Omega)$.
]
#pagebreak()
=== Stokes System of PDEs
The strong form of @eq:ssp is the following system of PDEs:
#align(center)[
#subtle-box(width: 50%)[
#v(-0.2cm)
$ -mu bold(Delta) bv + grad p &= bold(f) \
div bv &= 0 upright("on ") Omega \
integral_Omega p dif bx &= 0 \
bv &= 0 upright("on ") partial Omega $
#v(-0.2cm)
]
]
Here, $bold(Delta)$ is the component-wise Laplacian.
== Galerkin Discretization of the Stokes Equation
<ch:stokes-galerkin>
We can write the saddle point problem @eq:ssp in a more abstract form:
Let $U= (H^1_0(Omega))^d$ and $Q= L^2_*(Omega)$.
Seek $bv in U$ and $p in Q$ such that
#neq($ a(bv, bw) + &b(bw, p) &&= ell(bw) && quad forall bw in U \
&b(bv, q) &&= 0 && quad forall q in Q $)
<eq:ssp-abstract>
where
$ a(bv, bw) = integral_Omega mu jac bv : jac bw dif bx , wide
b(bv, q) = integral_Omega div bv med q dif bx $
To apply the Galerkin method, we need basis functions for discrete subspaces $U_h subset U$ and $Q_h subset Q$:
$ frak(B)_U = {bold(phi)_h^1, ..., bold(phi)_h^N}, wide
frak(B)_Q = {beta_h^1, ..., beta_h^M} $
where $N= dim U_h$ and $M= dim Q_h$. The basis of $U_h$ is now vector-valued, but we can simply use scalar-valued basis functions for each component, e.g. $U_h = (cal(S)_1^0)^d$.
With a basis expansion, we can define Galerkin matrices:
$ bv_h = sum_(i=1)^N nu_i bold(phi)_h^i wide bold(arrow(nu))=[nu_i]_(i=1)^N \
p_h = sum_(i=1)^M pi_i beta_h^i wide bold(arrow(pi))=[pi_i]_(i=1)^M $
$ bold(A) = [a(bold(phi)_h^j, bold(phi)_h^i)]_(i, j=1)^N wide
bold(B) = [b(bold(phi)_h^j, beta_h^i)]_(i, j=1)^(M, N) wide
bold(arrow(gamma)) = [ell(bold(phi)_h^i)]_(i=1)^N $
And we get the following linear system:
$ upright("Saddle point LSE: ") quad
bnat(
bold(A), bold(B)^T;
bold(B), bold(0)
) bnat(
bold(arrow(nu)); bold(arrow(pi))
) = bnat(
bold(arrow(gamma)); bold(0)
) $
=== Pressure instability
<sub:stokes-pressure-instability>
It turns out that not every choice of discrete spaces leads to a stable method.
For the pressure field, we also consider _discontinuous_ piecewise polynomials from $L^2_*(Omega)$, see @eq:l2-star:
$ S^(-1)_(p,*)(msh) = {q_h in L^2(Omega) : quad eval(q_h)_K in cal(P)_p (RR^d) , quad integral_Omega q_h dif bx = 0 } $
Now we can analyze methods with respect to stability and convergence.
To study the convergence of the Galerkin method, we consider the error
$ E(bv_h, p_h) := norm(bv - bv_h)_(H^1(Omega)) + norm(p - p_h)_(L^2(Omega)) $
The following theorem states that stable methods are _quasi-optimal_ (cf. @thm:ceas-lemma, where the Galerkin solution was optimal).
#theorem(
number: "192.168.127.12", [Convergence of stable FE for Stokes problem],
)[
If the method defined by $U_h$, $Q_h$ is stable, then the error satisfies
$ E(bv_h, p_h) <= C (inf_(bw_h in U_h) norm(bv - bw_h)_(H^1(Omega)) + inf_(q_h in Q_h) norm(p - q_h)_(L^2(Omega))) $
where $C$ is a constant depending only on the mesh and $mu$.
]
We can apply our error estimates from @ch:convergence-and-accuracy to this to get convergence rates. For example, take $U_h = (cal(S)_1^0)^d$ and $Q_h = S^(-1)_(0,*)(msh)$, the so-called *P1-P0* method.
Then we have
$ E(bv_h, p_h) <= C h^2 norm(bv)_(H^3(Omega)) + C h norm(p)_(H^1(Omega)) = Order(h^2) + Order(h) = Order(h)
$ The first terms comes from @thm:best-approximation-error assuming $bv$ to be smooth, the second term comes from @eq:l2-estimate.
Some methods for the Stokes problem are:
#table(
columns: 6,
inset: 7pt,
align: (left, center, center, left, center, center),
[Method], [$U_h$], [$Q_h$], [Stability], [Convergence], [efficient?],
[*P1-P0*], [$(cal(S)_1^0(msh))^d$], [$S^(-1)_(0,*)(msh)$], [Unstable], [$Order(h)$], [$checkmark$],
[*P2-P0*], [$(cal(S)_2^0(msh))^d$], [$S^(-1)_(0,*)(msh)$], [Stable], [$Order(h)$], [$times$],
[*P2-P1*], [$(cal(S)_2^0(msh))^d$], [$S^0_(1,*)(msh)$], [Stable], [$Order(h^2)$], [$checkmark$],
[*CR-P0*], [$(cal(C R)_0(msh))^d$], [$S^(-1)_(0,*)(msh)$], [Stable], [$Order(h)$], [$checkmark$],
)
The $cal(C R)$ space will be introduced in the next subsection. By "efficient" we mean that both error terms converge with the same rate. If that is not the case -- as for the *P2-P0* method, where the pressure converges slower -- the computational cost for having 2nd degree polynomials for the velocity does not pay off.
=== Non-conforming Crouzeix--Raviart FEM
<sub:stokes-cr>
We define a new discrete space of basis functions for the velocity field: $cal(C R)(msh)$, the _Crouzeix--Raviart_ space. It has one *discontinuous, piecewise linear* basis function associated with every *edge* of the mesh. Let $bm_e$ be the midpoint of edge $e$. The basis functions are defined as
$ eval(b^e_h)_K in cal(P)_1(K) &quad forall K in msh\ quad b^e_h (bm_f) = delta_(e f) &quad forall e,f in cal(E)(msh) $
Note that, in contrast to the Lagrangian spaces $cal(S)_p^0(msh)$, the Crouzeix--Raviart space is not a subspace of $H^1(Omega)$. This is why it is called _non-conforming_. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.