repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/hongjr03/shiroa-page | https://raw.githubusercontent.com/hongjr03/shiroa-page/main/DSA/chapters/1绪论.typ | typst |
#import "../template.typ": *
#import "@preview/pinit:0.1.4": *
#import "@preview/fletcher:0.5.0" as fletcher: diagram, node, edge
#import "/book.typ": book-page
#show: book-page.with(title: "绪论 | DSA")
= 绪论
== 基本概念
#definition[
- *数据*:所有能输入到计算机中,且能被计算机程序处理的符号的总称。是计算机操作的对象的总称。是计算机处理的信息的某种特定的符号表示形式。
- *数据元素*:是数据(集合)中的一个“个体”,是数据结构中讨论的基本单位。可由若干个数据项组成。
- *数据项*:是数据结构中讨论的最小单位。数据元素可以是数据项的集合。
- *数据对象*:是性质相同的数据元素的集合,是数据的一个子集。
- *数据结构*:带结构的数据元素的集合。是相互之间存在一种或多种特定关系的数据元素的集合。或者说,数据结构是相互之间存在着某种*逻辑关系*的数据元素的集合。
]<基本概念>
四种*逻辑结构*<逻辑结构>:线性结构、树形结构、图形结构或网状结构、集合结构。
// #notefig("../assets/2024-06-12-21-20-53.png")
#definition[
数据的*存储结构*:逻辑结构在存储器中的映象。
]
- 数据元素的映象方法:如用二进制位串表示。
- 关系的映象方法:
+ *顺序映象*:以相对的存储位置表示后继关系。整个存储结构中只含数据元素本身的信息,其存储位置由隐含值确定。
+ *链式映象*:以附加信息(指针)表示后继关系。需要用一个和 x 在一起的附加信息指示 y 的存储位置。
== 抽象数据类型
#definition[
*抽象数据类型(#underline[A]bstract #underline[D]ata #underline[T]ype, ADT)*:是指一个数学模型以及定义在此数学模型上的一组操作。
]
描述方法:可用三元组 $(D, S, P)$ 描述。
- 其中 $D$ 是数据对象;
- $S$ 是 $D$ 上的关系集;
- $P$ 是对 $D$ 的基本操作集。
== 算法和算法分析
#definition[
*算法*:算法是为了解决某类问题而规定的一个有限长的操作序列。
]
算法必须满足以下五个特性:<算法的特性>
+ *有穷性*:算法中的每个步骤都能在有限时间内完成。
+ *确定性*:算法中的每一步都有确切的含义,不会出现二义性。
+ *可行性*:算法中的所有操作都必须足够基本,能够通过已经实现的基本运算执行。
+ *有输入*:算法必须有零个或多个输入。
+ *有输出*:算法必须有一个或多个输出。
算法设计的四个原则:
+ *正确性*
+ *可读性*
+ *健壮性*
+ *高效率与低存储量需求*
== 算法复杂性分析
<算法复杂性分析>
#definition[
*时间复杂度*:是指算法的运行时间与问题规模之间的关系。
]
#definition[
*空间复杂度*:是指算法的存储空间与问题规模之间的关系。
]
$O(n)$按数量级递增顺序排列:<常见时间复杂度>
#grid(
rows: 2,
row-gutter: 1em,
columns: 1,
)[
#set text(size: 8pt)
*复杂度低* #h(1fr) *复杂度高*
#v(-0.5em)
#pin(1) #h(1fr) #pin(2)
#pinit-arrow(1, 2)
#v(-1em)
][
#table(
align: center + horizon,
stroke: none,
columns: (1fr, auto, 1fr, auto, 1fr, 1fr, auto, auto, 1fr),
table.header(
[*常数阶*],
[*对数阶*],
[*线性阶*],
[*线性对数阶*],
[*平方阶*],
[*立方阶*],
[*…*],
[*k 次方阶*],
[*指数阶*],
),
[$O(1)$], [$O(log n)$], [$O(n)$], [$O(n log n)$], [$O(n^2)$], [$O(n^3)$], [$dots$], [$O(n^k)$], [$O(2^n)$],
)
]
分析方法:算法的运行时间由程序中所有语句的*频度*(即该语句重复执行的次数)*之和*构成。
#note_block[
*算法的时间复杂度由嵌套最深层语句的频度决定。*
]
|
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/let-17.typ | typst | Other | // Ref: false
// Destructuring with a sink.
#let (a: _, ..b) = (a: 1, b: 2, c: 3)
#test(b, (b: 2, c: 3))
|
https://github.com/elinscott/psi-slides-template | https://raw.githubusercontent.com/elinscott/psi-slides-template/main/psi.typ | typst | // PSI theme
// Adapted from the University theme by <NAME> - https://github.com/drupol
#import "@preview/touying:0.4.2": *
#let slide(
self: none,
title: auto,
subtitle: auto,
header: auto,
footer: auto,
display-current-section: auto,
..args,
) = {
if title != auto {
self.uni-title = title
}
if subtitle != auto {
self.uni-subtitle = subtitle
}
if header != auto {
self.uni-header = header
}
if footer != auto {
self.uni-footer = footer
}
if display-current-section != auto {
self.uni-display-current-section = display-current-section
}
(self.methods.touying-slide)(
..args.named(),
self: self,
title: title,
setting: body => {
show: args.named().at("setting", default: body => body)
body
},
..args.pos(),
)
}
#let title-slide(self: none, ..args) = {
self = utils.empty-page(self, margin: 2em)
self.page-args += (
fill: self.colors.primary,
background: {
set image(fit: "stretch", width: 100%, height: 100%)
self.background-image
},
)
let info = self.info + args.named()
info.authors = {
let authors = if "authors" in info {
info.authors
} else {
info.author
}
if type(authors) == array {
authors
} else {
(authors,)
}
}
let content = {
align(left, image("media/logos/psi_scd_banner_white.png", height: 10%))
align(
horizon,
{
block(
inset: 0em,
breakable: false,
{
text(
size: 2em,
fill: self.colors.neutral-lightest,
strong(info.title),
)
if info.subtitle != none {
linebreak()
text(
size: 1.2em,
fill: self.colors.neutral-lightest,
strong(info.subtitle),
)
}
},
)
set text(size: .8em)
text(size: .8em, info.author, fill: self.colors.neutral-lightest)
linebreak()
if info.location != none {
text(
size: .8em,
info.location + ", ",
fill: self.colors.neutral-lightest,
)
}
if info.date != none {
text(
size: .8em,
info.date.display("[day padding:none] [month repr:long] [year]"),
fill: self.colors.neutral-lightest,
)
}
},
)
}
(self.methods.touying-slide)(self: self, repeat: none, content)
}
#let new-section-slide(self: none, short-title: auto, title) = {
self = utils.empty-page(self, margin: 2em)
let content(self) = {
set align(horizon)
set text(size: 1.5em, fill: self.colors.neutral-lightest, weight: "bold")
pad(states.current-section-with-numbering(self))
}
let footer(self) = {
block(
inset: 2em,
width: 100%,
text(
fill: self.colors.neutral-lightest,
utils.call-or-display(self, self.uni-footer),
),
)
}
let header(self) = {
block(
inset: 2em,
width: 100%,
align(top + right, image("media/logos/psi_white.png", height: 1.2em)),
)
}
self.page-args += (
fill: self.colors.primary,
footer: footer,
header: header,
)
(self.methods.touying-slide)(
self: self,
repeat: none,
section: (title: title, short-title: short-title),
content,
)
}
#let focus-slide(
self: none,
background-color: none,
background-img: none,
body,
) = {
let background-color = if background-img == none and background-color == none {
rgb(self.colors.primary)
} else {
background-color
}
self = utils.empty-page(self, margin: 2em)
self.page-args += (
fill: self.colors.primary,
..(
if background-color != none {
(fill: background-color)
}
),
..(
if background-img != none {
(
background: {
set image(fit: "stretch", width: 100%, height: 100%)
background-img
},
)
}
),
)
set text(fill: white, size: 2em)
(self.methods.touying-slide)(self: self, repeat: none, align(horizon, body))
}
#let matrix-slide(
self: none,
columns: none,
rows: none,
background-color: none,
gutter: 5pt,
stroke: none,
alignment: none,
title: none,
..bodies,
) = {
self = utils.empty-page(self)
let footer(self) = {
block(
inset: 2em,
width: 100%,
text(
fill: self.colors.neutral,
utils.call-or-display(self, self.uni-footer),
),
)
}
if title == none {
title = states.current-section-title
}
// header
self.uni-header = self => {
grid(
columns: (6fr, 1fr),
align(
top + left,
text(fill: self.colors.primary, weight: "bold", size: 1.2em, title),
),
align(top + right, image("media/logos/psi_black.png", height: 1.2em)),
)
}
let header(self) = {
block(inset: 2em, width: 100%, utils.call-or-display(self, self.uni-header))
}
self.page-args += (
margin: (top: 4em, bottom: 3em, x: 2em),
footer: footer,
header: header,
)
(self.methods.touying-slide)(
self: self,
composer: (..bodies) => {
let bodies = bodies.pos()
let columns = if type(columns) == int {
(1fr,) * columns
} else if columns == none {
(1fr,) * bodies.len()
} else {
columns
}
let num-cols = columns.len()
let rows = if type(rows) == int {
(1fr,) * rows
} else if rows == none {
let quotient = calc.quo(bodies.len(), num-cols)
let correction = if calc.rem(bodies.len(), num-cols) == 0 {
0
} else {
1
}
(1fr,) * (quotient + correction)
} else {
rows
}
let num-rows = rows.len()
if num-rows * num-cols < bodies.len() {
panic("number of rows (" + str(num-rows) + ") * number of columns (" + str(num-cols) + ") must at least be number of content arguments (" + str(
bodies.len(),
) + ")")
}
let cart-idx(i) = (calc.quo(i, num-cols), calc.rem(i, num-cols))
let alignment = if alignment == none {
left + horizon
} else {
alignment
}
let color-body(idx-body) = {
let (idx, body) = idx-body
let (row, col) = cart-idx(idx)
let color = if calc.even(row + col) {
white
} else {
background-color
}
set align(alignment)
rect(
inset: .5em,
width: 100%,
height: 100%,
fill: color,
stroke: stroke,
body,
)
}
let content = grid(
columns: columns, rows: rows,
gutter: gutter,
..bodies.enumerate().map(color-body)
)
content
},
..bodies,
)
}
#let slides(self: none, title-slide: true, slide-level: 1, ..args) = {
set text(font: "Arial")
if title-slide {
(self.methods.title-slide)(self: self)
}
(self.methods.touying-slides)(self: self, slide-level: slide-level, ..args)
}
#let register(
self: themes.default.register(),
aspect-ratio: "16-9",
progress-bar: false,
color-scheme: "blue-green",
display-current-section: false,
footer-columns: (5%, 1fr, 15%),
footer-a: self => states.slide-counter.display(),
footer-b: self => if self.info.short-title == auto {
self.info.title
} else {
self.info.short-title
},
footer-c: self => self.info.date.display("[day padding:none] [month repr:long] [year]"),
..args,
) = {
// save the variables for later use
self.uni-enable-progress-bar = progress-bar
self.uni-progress-bar = self => states.touying-progress(ratio => {
grid(
columns: (ratio * 100%, 1fr),
rows: 2pt,
components.cell(fill: self.colors.primary),
components.cell(fill: self.colors.secondary),
)
})
self.uni-display-current-section = display-current-section
self.uni-title = none
self.uni-subtitle = none
// footer
self.uni-footer = self => {
set text(size: .6em)
grid(
columns: footer-columns,
align: (left + bottom, left + bottom, right + bottom),
utils.call-or-display(self, footer-a),
utils.call-or-display(self, footer-b),
utils.call-or-display(self, footer-c),
)
}
// header
self.uni-header = self => {
if self.uni-title != none {
grid(
columns: (6fr, 1fr),
align(
top + left,
text(
fill: self.colors.primary,
weight: "bold",
size: 1.2em,
self.uni-title,
),
),
align(top + right, image("media/logos/psi_black.png", height: 1.2em)),
)
} else {
grid(
columns: (1fr),
align(top + right, image("media/logos/psi_black.png", height: 1.2em))
)
}
}
// set page
let header(self) = {
block(inset: 2em, width: 100%, utils.call-or-display(self, self.uni-header))
}
let footer(self) = {
block(
inset: 2em,
width: 100%,
text(
fill: self.colors.neutral,
utils.call-or-display(self, self.uni-footer),
),
)
}
self.page-args += (
paper: "presentation-" + aspect-ratio,
header: header,
footer: footer,
header-ascent: 0em,
footer-descent: 0em,
margin: (top: 4em, bottom: 3em, x: 2em),
)
// register methods
self.methods.slide = slide
self.methods.title-slide = title-slide
self.methods.new-section-slide = new-section-slide
self.methods.touying-new-section-slide = new-section-slide
self.methods.focus-slide = focus-slide
self.methods.matrix-slide = matrix-slide
self.methods.slides = slides
self.methods.touying-outline = (self: none, enum-args: (:), ..args) => {
states.touying-outline(
self: self,
enum-args: (tight: false) + enum-args,
..args,
)
}
self.methods.alert = (self: none, it) => text(fill: self.colors.primary, it)
self.methods.init = (self: none, body) => {
set text(size: 20pt)
set heading(outlined: false)
show footnote.entry: set text(size: .6em, fill: self.colors.neutral)
set footnote.entry(separator: none, indent: 0em)
set bibliography(title: none, style: "nature-footnote.csl")
body
}
// color theme
self.colors += (
neutral: rgb("#808080"),
neutral-light: rgb("#aaaaaa"),
neutral-lighter: rgb("#d5d5d5"),
neutral-lightest: rgb("#ffffff"),
neutral-dark: rgb("#555555"),
neutral-darker: rgb("#2b2b2b"),
neutral-darkest: rgb("#000000"),
)
if color-scheme == "blue-green" {
self.colors += (
primary: rgb("#0014e6"),
secondary: rgb("#00f0a0"),
tertiary: rgb("#000000"),
)
self.background-image = image("media/backgrounds/blue-green.png")
} else if color-scheme == "pink-yellow" {
self.colors += (
primary: rgb("#dc005a"),
secondary: rgb("#f0f500"),
tertiary: rgb("#000000"),
)
self.background-image = image("media/backgrounds/pink-yellow.png")
} else if color-scheme == "navy-red" {
self.colors += (
primary: rgb("#000073"),
secondary: rgb("#dc005a"),
tertiary: rgb("#000000"),
)
self.background-image = image("media/backgrounds/navy-red.png")
} else {
panic("color-scheme " + color-scheme + " not supported (must be blue-green/pink-yellow/navy-red)")
}
self.freeze-in-empty-page = false
self
}
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/055%20-%20Murders%20at%20Karlov%20Manor/007_Episode%207%3A%20Rot%20before%20Recovery.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Episode 7: Rot before Recovery",
set_name: "Murders at Karlov Manor",
story_date: datetime(day: 15, month: 01, year: 2024),
author: "<NAME>",
doc
)
Kellan didn't have an office so much as he had an alcove, a semi-partitioned little corner of the main floor where room had been made for a desk, a rickety file cabinet, and a small brass machine on a perfectly sized pedestal. Kellan tapped the machine as he ushered Kaya into the space. The machine made a soft humming sound and clicked on, its cracked glass screen becoming consumed by a web of notes and rough sketches.
Kaya blinked. "What is #emph[that] ?"
"It's my private projektor," said Kellan. "We use them to visualize the things we're investigating, when the answer isn't clear-cut. Part of why Proft's the best detective we have is because he doesn't #emph[need] one. He can just keep everything in his head and spin it around and around until it falls together the right way. The rest of us use visual aids."
He leaned over, taking a large feather that Kaya suspected might have begun as one of Ezrim's out of a mug on his desk. The bottom inch or so had been tipped in mizzium, which gleamed a dull copper-gold in the light from the projektor.
"Every projektor has an associated stylus," he said, moving back toward the machine. "You can't update the files without them, unless you do it through uploads to the central unit."
"Wow," said Kaya. "I knew you had to have a way of keeping track … but that's amazing, Kellan. The evidence capsules, the barrier wards, the—well, the filing system. It's all very impressive."
Kellan stood a little straighter, clearly pleased by her praise, and touched the screen with his stylus, bringing up an array of small notes and pictures. "This one's from the thopter that found us in the alley," he said, tapping one of the pictures and expanding it to fill the whole display. "It's the newest piece of information we have."
"Information, not evidence?"
"Evidence is something we #emph[know] relates." He frowned. "That sort of ambush usually means you're getting close to an answer, but I can't see what that answer might be. No two pieces fit together the right way. The fur on those cultists doesn't match up with Rakdos stirring people to murder again."
"I don't think Rakdos is behind this," said Kaya. "It feels like Judith #emph[wants] us looking at her parun for some reason—and I can come up with half a dozen reasons she'd want us to do that—but this isn't his style. Yes, killing Teysa and Zegana causes a lot of chaos and instability." She paused, swallowing. She knew she was right. Dismissing Teysa's death so casually still burned. "But it won't throw the city into freefall. It won't cause riots in the streets. Rakdos would want to see the bodies clogging the gutters, if he'd stirred himself for something like this."
#figure(image("007_Episode 7: Rot before Recovery/01.png.jpg", width: 100%), caption: [Art by: Gaboleps], supplement: none, numbering: none)
"So who do you think is behind this?"
"I don't know yet, but we need to find out fast. If this gets much worse, things are going to explode, and the city hasn't fully recovered from the invasion."
Maybe the city never would. Maybe, like her, Ravnica would be feeling the aftershocks of Phyrexia forever. And maybe that was a good thing. It meant they'd remember. Tragedies weren't forgotten until the injuries started to heal.
Kellan nodded, expression thoughtful. "Do you think Trostani—"
He didn't have time to finish his question before an alarm blared through the building, too loud to ignore. Kaya jerked bolt upright, the sour taste of adrenaline filling her mouth.
"What—?"
Kellan tossed his stylus onto the desk and started out of the cubby, moving fast. Kaya had no choice but to hurry if she wanted to keep up.
"Someone's compromised the evidence locker!" shouted Kellan, straining to be heard above the alarm. "Some of the things we have—oh, no."
He had stopped dead in the middle of the narrow passage between desks. Kaya almost ran right into him before she managed to stop and turned to look at whatever had captured his attention. The rest of the agents were running in that direction, except for the ones who had, like Kellan, stopped to stare.
The room containing the evidence locker lay in ruins, the walls completely shattered by the force of whatever had been released. The ceiling of the headquarters hadn't fared much better. The cause of all this damage wasn't currently visible, obscured by a wall of roiling dust and debris. Some of the agents closer to the evidence cage were shouting, their voices adding to the din made by the alarm and chunks of falling masonry.
Kaya stepped forward, stopping shoulder to shoulder with Kellan. "Has this ever happened before?" she asked.
"The capsules are secure before we put them in the locker," he said, not moving. He didn't look like he remembered #emph[how] to move. "We have protocols in case a system fails, but the locker isn't supposed to—"
Something in the smoke roared.
It was a deep, guttural sound, loud enough to shake the foundations. Kaya grabbed hold of Kellan's arm as the shifting floor threatened to knock her off balance. Kellan's face had taken on a glossy pallor, making him look like a man who'd just seen a ghost—and not one in the service of the Orzhov. More agents shouted. Some screamed, turning to run from whatever they saw in the billowing cloud.
The roar came again, and the smoke parted as its occupant lunged forward, massive, spatulate front paws slamming into the floor. One of the screams cut off abruptly as a paw landed on the screamer, presumably smashing them flat. Each paw was tipped in a daggered claw easily longer than Kaya was tall, tapering to a wicked point.
The beast that had done all this damage swung around, sniffing at the air. Its nose was a star-shaped flowerburst of fleshy tendrils. The whole thing resembled nothing so much as a mole twice the size of an adult troll, flesh etched with runic lines that gleamed green with power.
Kaya swallowed. "That the Gruul god you were telling me you detained?"
Kellan nodded, momentarily speechless.
"And what do we know about the god?"
"The Gruul call him Anzrag," said Kellan. "He's … I guess he's a harvest god for them? Planting and growth and that sort of thing? Only they call him 'the rampage mole' so I don't know how good a fit that is …"
"Uh-huh. Feel like your legs are working again?"
"I think so—why?"
"Because he's over there, and we're over here, but he's doing a lot of damage, and he's going to come over here eventually."
"Oh." Kellan seemed to shake off his shock, giving Kaya a brief, sheepish look. "Thanks."
"No thanks needed." Kaya released his arm and drew her daggers, their edges taking on a purple gleam. "Let's make this an unfair fight."
With that, she charged toward the divine mole, using a fallen chunk of ceiling as a ramp onto an unbroken desk, leaping from there to a much taller shelf. The Gruul god had yet to notice her, and so she was able to climb to the absolute top before launching herself toward the massive mole.
Kellan, meanwhile, was running toward the god, the basket hilts in his hands already activated, motioning agents out of his way as he gathered momentum. They weren't the only ones going on the attack: while the Agency had their share of analysts and investigators whose understanding of combat began and ended with documenting the aftermath, far more of them had been recruited from the streets, former guild members or people whose instinct for trouble had been too finely honed to keep them safe at home. Some of them had produced knives or swords from inside their dusters. One woman with a shock of frizzy blond hair was holding a device of clear Izzet make, shooting rays of electricity at Anzrag to keep him at bay while she waved less combat-minded agents clear of the chaos.
At least four people were down, two buried under chunks of masonry, one flattened by the god, and one sliced nearly in two by her claws. Kaya roared a Kaldheim battle challenge as she flew toward the god, and Anzrag turned toward the sound, snout quivering with curiosity and confusion.
Kaya struck him square in the middle of the tendril starburst, daggers biting deep. The Gruul god howled with pain, backpedaling and shaking his head hard from side to side. Kaya held fast to the hilts of her daggers, pulling herself up so that she was level with Anzrag's tiny, almost hidden eyes. Anzrag seemed to focus on her for the first time, making a confused sound that was still loud enough to make Kaya's eardrums ache.
Below her on the ground, Kellan had reached the fight and was slashing away at Anzrag's forelegs, forcing the god to dance backward, Kaya still hanging from his nose. Neither of them had severely injured the great mole. Both had surely gotten his attention.
There was another roar behind them, less bestial than enraged. Kaya dared a glance over her shoulder. Ezrim was standing in the open space between the agent desks and the evidence pen, mounted on his steed, whose wings were spread as wide as they could go, mouth open in unmistakable challenge. Anzrag roared again, throwing his head back and sending Kaya flying, daggers still grasped firmly in her hands. She shouted as she fell and was only marginally surprised when Kellan was there to catch her, keeping her from hitting—or passing insubstantially through—the floor.
Anzrag paid them no attention, stalking toward Ezrim instead, head down and bloodied nasal tendrils twitching as he snuffled at the floor. Ezrim roared again, wings spreading wider as he challenged this intruder to his territory. Kaya elbowed Kellan gently as he set her feet on the floor.
"Evidence capsule," she hissed.
"What?"
"Grab an evidence capsule." She kept her voice low. Some of the other agents were still attacking, but Anzrag's attention was much more fixed on Ezrim and the threat he represented. "We don't know how he got out. I'm betting we can put him #emph[back] ."
"That's right—all the binding seals we put on him must still be there!"
Kellan nodded and bolted for the ruined evidence cage, jumping over several chunks of fallen masonry as Kaya turned back to Anzrag, watching as the Gruul god stalked toward Ezrim.
"Sir?" she called. "You need anything?"
"A new ceiling would be nice," he said peevishly before screeching at the approaching mole in a distinctly avian tone, mount snapping its wings shut and open again in sharp challenge. Kaya knew now that Ezrim and his mount were technically individual beings, but watching the mighty archon brace for a fight, it was impossible not to see them as a single unit. Anzrag seemed to view them the same way. He moved like he was approaching a large predator, not a man on some sort of massive taloned beast.
#figure(image("007_Episode 7: Rot before Recovery/02.png.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Kellan ran up next to her, a containment capsule in his hands. He eyed Anzrag warily as he passed it over.
"How do I work this thing?" asked Kaya, sheathing her daggers and taking the capsule.
"It's already keyed to Anzrag. Just press the button," said Kellan, and then, "Hey!" as Kaya took off running, capsule in her hands.
Anzrag turned, growling under his breath, as Kaya got close. Kaya took a breath and phased out, turning intangible just before Anzrag's paw passed through her body, claws swiping harmlessly at nothing. The god was still trying to figure out what had happened, standing in baffled puzzlement, when Kaya turned solid again and pressed the button. The capsule chimed, an incongruously pleasant sound, before expanding into a massive bubble, trapping Anzrag inside.
Silence fell over the office, save for the sharp breathing of an injured agent slumped against a broken desk and the occasional thud of another piece of broken ceiling.
Kaya looked at Ezrim, holding up the container. "Where should I put this?"
He closed his wings, turning to face the rest of the room. "Who's here and uninjured?" he demanded.
"Here, sir," said several agents.
"Good. I want all of you to go to the Gruul encampments. Find Yarus and bring him back here. I know he had something to do with this."
Kaya, who wasn't so sure but wasn't going to contradict him, turned away, only to see Agrus Kos standing at the edge of the devastation, beckoning to her. She motioned for Kellan to stay where he was before walking through the shattered desks and fallen rocks between her and Agrus, letting them pass harmlessly through her insubstantial flesh.
"What is it?" she asked.
"There's something that's bugging me," he said. "It's itching the back of my neck, which I don't like, since I thought dying would mean no more itches. I always felt like this when things didn't fit together quite right on a case."
"Nothing fits on this case," said Kaya.
"Got that right." Agrus shook his head. "I need to go somewhere. I think I can get a whole bunch of answers all at once if I do."
"Great," said Kaya. "I'll get Kellan."
"No. Not #emph[we] need to go somewhere—#emph[I] need to go. I know you're in charge of this investigation, but this is too dangerous for a living person. Even Orzhov leaders can die. We don't need another ghost." The look he gave Kaya held more sympathy than scorn. "I'll be back as soon as I can. Before the deadline, for sure."
"You're not asking."
"No."
"All right. I'll see you when you get back."
"Thanks, boss." <NAME> turned and, much like Kaya, walked right through the debris as he left the room.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
"Getting a little tired of following you around without you telling me where we're going," said Etrata, bracing herself against the slick wall as she and Proft followed the curve of the enclosed street down into the bowels of the city.
"I told you we were going to the Sixth Precinct," said Proft, in a tone that implied she was being entirely unreasonable complaining about it.
"Yes, #emph[to] ," she said. "'To' is not the way most people say 'under.' Those are very different words! This is Golgari territory!"
Proft gave her the delighted smile of a teacher whose student had finally managed to catch up. "Yes, precisely," he said. "When Korozda rose to the surface, it changed the shape of the warrens below. The Swarm has been largely in hiding since the invasion, but if you knew the warrens before they shifted, you can still find your way."
"Oh, that's very reassuring."
The air here was warm and fragrant, although it didn't stink like the boilerpits. Instead, the air had the ripe richness of healthy compost, the earthy weightiness of mushrooms. It smelled like a growing world. Decay, yes, but life as well; two things without which all of Ravnica would surely fall.
"Have you never spent time in the Golgari portions of the undercity?"
Etrata shot him a sour look. "I'm an assassin, not an undertaker. Once they're dead, I'm done with them."
"Pity. You should consider expanding your horizons. There's much beauty below." Proft pushed aside a curtain of cobwebs, leading her into a smaller, more level tunnel. They weren't going down as steeply any longer. That was a small mercy, as it made it easier for both to keep their footing. Etrata wasn't accustomed to being the unsteady one, but Proft moved through the damp tunnels as if he had been born to the guild, easy in his environment. It was another oddity piled atop a man made almost entirely of oddities, and she wasn't sure she liked it.
She liked the idea of being left alone in these tunnels even less. They had already made so many turns during their descent that she wasn't confident in her ability to find her way back to the surface alone. Etrata hurried to catch up.
Proft motioned for her to hang back as he rapped his knuckles against a doorway dotted with patches of lichen and clusters of small, glowing mushrooms. No one answered.
Looking unsurprised, Proft opened the rotting door to reveal a large cavern lined with the crumbling ruins of some ancient guildhall. There were no fires, but there was light provided by larger clusters of those same glowing mushrooms.
At the center of the space, barbed spear in hand, stood an elf woman dressed in layered leather, topped with tatters that emulated spiderwebs. Her face was painted with a white spider's-head mask, the lines gleaming stark against her dark skin. She looked at Proft and Etrata, seeming utterly unsurprised by their presence.
"Have you come to arrest me for some fabricated crime, Detective?" she asked, making no effort to conceal the bitterness in her tone.
"I would never have found you if you hadn't allowed it, Izoni," said Proft. "You knew the moment we entered your tunnels. You also know we've been investigating the death of Zegana."
"Teysa as well, now," said Izoni. "I have no doubt they're connected, and you have no reason to believe I wasn't the one who cut their threads."
"I saw your spiders in the tunnels, and in Etrata's cell," said Proft. "If you were responsible for this, more people would be dead, and I'd never have seen your eyes. You're more subtle than that."
Izoni frowned, but Etrata could tell he was getting through to her. No one rose as high in their guild as Izoni had without some degree of pride. "You are correct not to suspect me," Izoni finally allowed. "The Swarm has come under enough scrutiny recently. Even if I wanted to kill the city's leadership, I wouldn't do it now. Not when it could hurt my people so direly."
"I brought you this," said Proft, producing the small vial of powder collected from Etrata's bolthole. "I believe the killers are being controlled in some fashion, forced to do the bidding of another."
Izoni stepped closer and took the vial, shaking it to knock the grains off the sides of the jar before removing the lid and tapping a small portion into her palm. Etrata stiffened. Izoni impassively leaned down to sniff the powder.
"Immunity," she said, as if reading Etrata's mind. "Poisons, drugs, natural or unnatural—it doesn't matter. Nothing does me harm." She shook the powder carefully back into the jar before grabbing a piece of dangling cobweb and scouring her hand clean. Looking at Proft, she said, "This #emph[is] natural. Biological, at the very least. It's not from any plant or fungus I've ever seen, and I know everything that grows on Ravnica."
#figure(image("007_Episode 7: Rot before Recovery/03.png.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
She looked around herself, taking note of the ruins around her. "But the Swarm hides our face now because of something #emph[not] of Ravnica."
"That was my concern as well," said Proft. "If the invaders have changed their tactics …"
"We may not have won as decisively as we all want to believe."
Proft turned slowly, raising his hand to his mouth in thought, and froze as he caught a flicker of motion among the ruins. He lowered his hand again, taking a step forward, and saw the hooded figure lurking there, watching their conversation. The figure began to turn away.
"Stop!" yelled Proft.
The figure bolted. Proft started after them, not listening to Etrata shouting for him to wait, to stop, to tell her where he thought he was going. He was running. He was in pursuit. This was something his body knew how to do.
The figure had a head start, but Proft was gaining, closing the distance between them with his long, loping strides. He reached out, hoping to catch the figure's cloak, but fell as something slammed into the side of his head with force enough to take the rest of the world away.
Consciousness left, and Proft left with it.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Rix Maadi cast a long shadow, even in the undercity. Agrus Kos had always hated this place when he was alive. He truly wished he didn't feel compelled to visit now that he was dead. But the evidence …
Too much pointed to Rakdos without forming a full and coherent picture. The attack by Massacre Girl had been too sloppy. Judith had been too eager to point Kaya and Kellan at her own parun. None of this made sense.
There was one thing he could do to contribute to the investigation that no one else could do, and he reminded himself of that as he passed through the walls of Rix Maadi, descending through the Rakdos guildhall toward the great lava pit where Rakdos himself dwelled.
No one stopped or seemed to see him as he traveled lower and lower, until the gleaming basin of the pit itself cut through the gloom. Glad he didn't need to breathe in his ghostly form, Agrus moved to the edge of the pit and looked down.
Rakdos lay curled at the burning center of the lava, eyes closed, seeming oddly peaceful. A thick layer of dust covered his body, interspersed with patches of blood-red moss. He had been here and asleep for quite some time.
Rakdos couldn't be the answer.
Agrus began to turn away, intending to leave the same way he had entered, and stopped as smoke snaked out of nowhere, wrapping around his wrists and ankles, holding him down. A sudden searing pain swept over him. He fell to his knees, fighting to look up and see what had attacked him, but collapsed as the pain grew more intense.
#figure(image("007_Episode 7: Rot before Recovery/04.png.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Then, with a flash of reddened light, he vanished, and Judith stepped out of the shadows, a crystal skull in her hands, smirking at the place where he had been. "Now, now, darling," she said, caressing the skull. "Can't have you spoiling all my fun when I'm so close to getting what I really want."
She raised the skull to her face, smirk becoming a smile as she saw the small figure of <NAME> screaming inside, wrapped tight in chains of smoke.
"Rakdos sleeps now because he wishes to, but it would be a small matter for the other guilds to bind him in dreamless slumber, if I could only convince them that his desires had become a danger," she said, sweetly. "Our guild needs new leadership, a … #emph[dramatic] change of scene. All I need to do is throw enough clues in front of those amateur crime-chasers, and this ends with me at center stage. You're not a part of my script, little spirit. You'll stay where I put you."
She turned and sauntered away from the lava pit, leaving the demon she ostensibly served to slumber.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Proft groaned as he woke, raising one hand automatically to cup the side of his head, and was distantly pleased when he felt no blood or gaping wounds. He opened his eyes as he sat up and froze, staring at the blue-white room around him. Wonder, awe, and confusion warred for control of his mind as he pushed himself to his feet, looking around the impossible edifice of his own mind palace. How could he have summoned it while he wasn't even awake …?
He turned again and froze. A figure in a long, hooded cloak was rummaging through one of his drawers, looking at the files inside.
Proft cleared his throat. "Excuse me, but I don't remember inviting any guests. What are you here for?"
"Ah, you're awake, or whatever serves for waking in dreams," said the figure, sounding almost amused. Their voice was distorted, clearly disguised in some way. Not looking up, the figure added, "I came to meet you. To see this place for myself. Very impressive, what you've created here."
"Thank you," said Proft, suppressing the urge to preen at the flattery. "But as I said before, I'm afraid you weren't invited. Are you by any chance the killer I've been tracking? Your powers of suggestion must be extraordinary to have worked your way in here."
"Sadly, my friend, I'm not the one you're looking for," said the figure, pulling a folder out of the drawer and flipping it open. "I'm merely passing through. Ravnica is a waypoint, not the destination. But your contributions will be remembered, and I'll see you're rewarded in some way when the time comes."
He tucked the folder into his cloak, turning as if to go.
#figure(image("007_Episode 7: Rot before Recovery/05.png.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Proft began to protest this blatant theft of his intellectual property, only for the mind palace to shatter as his eyes opened and he woke for the second time, cheek stinging and hot with pain. Again, he touched the side of his head and winced at the already blooming bruise.
Pushing himself up onto his hands, he looked around, quickly finding Etrata crouched only a few feet away, her own eyes wide and glossy with the fading remains of panic. "I hit you when you wouldn't wake up," she said. "You took off running, and then I found you like this. I thought maybe whatever's … been making people kill … maybe it had you, now."
He looked past her to Izoni. "Did you see anyone else here?"
"No," said Etrata.
Izoni merely shook her head.
"I see." Proft rose. "Come, Etrata. We're needed in the city above."
"How do you know that?"
"Unconsciousness is marvelous for organizing the thoughts. Izoni, many thanks. You have my sincere gratitude, and my hope that your help today will allow the Swarm to step closer to their return to proper prominence."
"Your lips to the Guildpact's ears, but your wishes are appreciated," said Izoni as she turned away. "Go back to your sunlit realms, Detectives. You're no longer wanted here."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
"He should have been back by now," said Kaya, glaring at the door.
"You say he told you this was too dangerous for a living person?" Kellan shot her a concerned look before he returned to entering notes into his projektor. The building rang with the sound of lithomancers and engineers clearing away the rubble. Ezrim had arranged for the removal of the fallen Agency detectives, while the agents he had dispatched to recover Yarus had yet to return. In the aftermath of the chaos and with two groups already effectively out in the field, he had instructed Kellan and Kaya to stay put for the time being.
Kaya was getting restless.
"He said he'd be back before the deadline."
"We have hours yet, then," said Kellan, almost cheerfully.
His cheer died as the front doors slammed open and Aurelia marched into the room, followed by an entire garrison of Boros soldiers. She stalked past the clean-up crews, not sparing the wreckage a second glance as she made her way toward Ezrim's office.
Kellan and Kaya exchanged a look. "Oh, that can't be good," Kellan said.
"No, it's not," said Kaya. "Wait here."
Kaya walked calmly toward the wall between them and the private offices, and through, continuing through the building in a straight line. Ezrim looked up and frowned as she stepped out of his office wall.
"Knocking is still polite," he said.
"You're about to have company," said Kaya, just as Aurelia hammered on the door.
"Enter," said Ezrim warily.
Aurelia opened the door and stepped inside, looking only mildly annoyed by the sight of Kaya. It was a small thing, compared to her clear and towering rage.
"<NAME> is missing," she spat. "He was meant to report in at the sixth bell, and he didn't appear. This is an insult too far. I'm done waiting. The Boros Legion marches to war. The Cult of Rakdos will pay for what they've done."
Kaya took a large step backward, through the wall into the next office. If the Boros were going to war, all of Ravnica would quickly follow. She lunged for the office door, pulling it open to reveal a youth, perhaps twelve or thirteen years of age, with the hardened expression of someone who had been surviving guildless in the city streets for as long as they could remember.
"You Kaya?" they asked.
"Yes," she replied. "You are?"
"Delney. Got a message for you." They held out a slip of paper.
Kaya took it, reading quickly. #emph[Meet at Karlov Cathedral. Come alone.]
"Can you tell my partner—" she looked up as she spoke. Delney was already gone.
Kellan would understand. He would have to. With Ravnica on the brink of war, she didn't have any time left to waste on niceties. Besides, where could she possibly be safer than at the heart of Orzhov territory?
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
If there was one thing the Orzhov were good at, it was burying their own. Not that they had a higher rate of death than the other guilds—according to civic records, full Orzhov members lived longer than most people—but when someone died, the people responsible for organizing the funeral did so with the full awareness that their absent colleagues were likely to show up and critique the flowers. Written instructions were to be followed with absolute precision, and in the absence of written instructions, the closest friends of the deceased were consulted. If the ghosts wound up angry with the results, well, it was their own fault for not communicating clearly.
Kaya's carriage let her off in front of a cathedral dressed to the nines in climbing moonflower and bruise-black phantom kisses, the windows draped with sheets of white velvet and the mirrors covered in layers of crepe. The building echoed with silence. Until Teysa's body was brought for the week of formal viewing, only her closest friends and family members were expected to enter the building, allowing them a few moments of private time with her spirit—assuming it had chosen to linger.
Kaya walked up the steps, heart in her throat and knots in her stomach, and told herself again and again that Teysa would choose to linger. Teysa would be back. Teysa would be back, and she could tell Kaya that the note in her pocket wasn't what it looked like; Teysa hadn't betrayed them all.
She slipped inside, walking through the door to avoid alerting the attendants, and made her way to the grand nave, where pews had been set up for the mourners—and the debtors, who would be expected to attend the actual funeral and ceremonially reaffirm their intention to repay Teysa what they owed her.
The pews were empty, save for two vaguely familiar figures. One, a man in a long Agency coat, sat toward the front. The other, a female vampire who had changed at some point into her own guild colors, sat closer to the doors, watching them warily. She tensed at Kaya's appearance.
Proft waved a hand. "It's fine, Etrata. We invited her. Planeswalker, if you would?"
"I have a name," said Kaya, walking over to sit near him on the pew.
"Yes, but as we're not that well acquainted, it seemed presumptuous. My investigation has progressed."
"How did you know to call me?"
"I knew of the chief's intent to involve you, and once I heard of <NAME>'s unfortunate demise, I knew you wouldn't be able to resist. You have my condolences, by the way."
"Thank you." The words were like ashes in her mouth. Kaya glanced at Etrata. "At least now I know where #emph[she] went."
"Yes, well, I needed her, and the Azorius can be so narrow-minded when it comes to matters of guilt," said Proft. "The killers are being controlled by an outside force. She has no memory of the murder. Which means …"
"She's not responsible either," said Kaya. Proft shot her a glance. She sighed. "Teysa's murderer claims not to remember killing her. I don't want her to be dead, but I guess I … I wanted this to be simple."
"<NAME> was not a simple woman."
"No," said Kaya. "Never. But I was gone for so long, and I'm worried that she might have been complicated in ways I didn't expect."
"What do you mean?"
Kaya took a deep breath. "When I found her body, I found … something else. A note, in her own hand, but not her own language. It was written in Phyrexian."
"And you're afraid she sold us out?"
"I'm afraid she may have let greed overwhelm sense, and thought she could get the Phyrexians into her debt. But if her killer was mind controlled … who would want #emph[three] guild leaders dead?"
"Three?" asked Proft, looking briefly alarmed.
"There's been an attempt on Aurelia's life."
"Ah." The alarm faded. "What have you learned?"
"I don't think Rakdos is responsible, for all that Judith seems to want us to think he is. We—Kellan and I—traveled to Vitu-Ghazi to consult the Guildpact. I'm still not sure what the passage she told us to look at meant, and there hasn't been time to really discuss it. We were attacked on the way back into the city."
"Attacked? By whom?"
"A group of people in robes I didn't recognize. We didn't get to question any of them. Once they were defeated, they swallowed some plant that turned their bodies to moss. They blew away." She grimaced. "Other than some fur on their robes, we don't have a lot to go on. And now Agrus Kos is missing, and Aurelia's ready to go to war against the Rakdos—"
Proft said nothing. Kaya turned to look at him. He was staring off into space with an expression she would have called blank, if not for the satisfaction creeping around the edges. He looked like a man who had just been handed a glorious and unexpected gift, and intended to savor it.
"Detective? Are you all right?"
Proft rose. Etrata, who was becoming attuned to his signals, moved to join them.
"I know who's responsible for this," said Proft. "All of this. And I can prove it. But I need you to keep Etrata's whereabouts to yourself, and to arrange a little gathering for me before I can explain …"
Kaya stared at him.
Etrata shrugged.
"You get used to it," she said.
|
|
https://github.com/cu1ch3n/karenda | https://raw.githubusercontent.com/cu1ch3n/karenda/main/main.typ | typst | #import "lib.typ": *
#show: karenda
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/transform_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test creating the TeX and XeTeX logos.
#let size = 11pt
#let tex = {
[T]
h(-0.14 * size)
box(move(dy: 0.22 * size)[E])
h(-0.12 * size)
[X]
}
#let xetex = {
[X]
h(-0.14 * size)
box(scale(x: -100%, move(dy: 0.26 * size)[E]))
h(-0.14 * size)
[T]
h(-0.14 * size)
box(move(dy: 0.26 * size)[E])
h(-0.12 * size)
[X]
}
#set text(font: "New Computer Modern", size)
Neither #tex, \
nor #xetex!
|
https://github.com/Han-duoduo/mathPater-typest-template | https://raw.githubusercontent.com/Han-duoduo/mathPater-typest-template/main/chapter/chap1.typ | typst | Apache License 2.0 | = 问题提出
== 问题背景
物理小区识别码PCI的配置方式会带来PCI冲突、PCI混淆和PCI模3干扰。PCI冲突发生在两个或多个同频小区之间。PCI混淆发生在两个小区在满足信号切换条件时因领区同频、同PCI导致的PCI混淆 @wx3。PCI模3干扰则是在PCI模上3后相同,导致的干扰,这会导致小区下行网络延迟。因此研究PCI的规划显得尤为重要,好的PCI规划不仅可以提升用户的体验同时可以减少资源的浪费。而MR(Measurement Report,测量报告)则是用于网络评估和优化,它是指信息在业务信道上以一定的时间间隔发送一次数据。
== 问题重述
因此在PCI规划时则需使得MR数据冲突、MR数据混淆和MR数据的模3干扰数量尽可能的小。为了合理复用PCI需要解决以下问题:
+ 在给定的2067个小区中,使得冲突MR数、混淆MR数和模3干扰的MR数总和最小的PCI分配方案。
+ 在考虑冲突MR数、混淆MR数和模3干扰的MR数的优先级依次降低的基础上,重新给出PCI的规划
+ 由于对2067个小区的PCI的重新分配,在此之外距离较近的小区也会受到一些影响。因此还需给出使这些小区以及临近的小区的冲突MR数、混淆MR数和模3干扰的MR数的总和最少的PCI规划
+ 考虑周围可能被影响的小区的时候也加入三种MR数的优先级,从而重新分配PCI。
|
https://github.com/Pegacraft/typst-plotting | https://raw.githubusercontent.com/Pegacraft/typst-plotting/master/docs/docs.typ | typst | MIT License | #import "template.typ": *
#import "typst-doc.typ": parse-module, show-module
#show link: underline
#show "(deprecated)": block(box(fill: red, "deprecated", inset: 3pt, radius: 3pt))
// Take a look at the file `template.typ` in the file panel
// to customize this template and discover how it works.
#show: project.with(
title: "Typst-plotting",
subtitle: "Auto generated documentation",
authors: (
"Pegacraffft",
"Gewi"
),
// Insert your abstract after the colon, wrapped in brackets.
// Example: `abstract: [This is my abstract...]`
abstract: [
*Typst-plotting* is a plotting library for #link("https://typst.app/", [Typst]).\
It supports drawing the following plots/graphs in a variety of styles.
- Scatter plots
- Line charts
- Histograms
- Bar charts
- Pie charts
- Overlaying plots/charts
More features will be added over time. If you have some feedback, let us know!
],
date: "17.6.2023",
)
// We can apply global styling here to affect the looks
// of the documentation.
#set text(font: "Fira Sans")
#show heading.where(level: 1): it => {
align(center, it)
}
#show heading: set text(size: 1.5em)
#show heading.where(level: 3): it => text(size: 1em, style: "italic", block(it.body))
#{
let options = (allow-breaking: false)
let modules = (
"Axes": "/plotst/axis.typ",
"Plots": "/plotst/plotting.typ",
"Classification": "/plotst/util/classify.typ",
)
//set heading(numbering: "1.1.")
outline(indent: 2em, depth: 2)
align(center)[Docs were created with #link("https://github.com/Mc-Zen/typst-doc")[typst-doc]]
pagebreak()
for (name, path) in modules {
let module = parse-module(path, name:name , )
show-module(module, first-heading-level: 1, allow-breaking: false)
}
} |
https://github.com/piepert/philodidaktik-hro-phf-ifp | https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/parts/ephid/beurteilen_bewerten/funktionen_leistungspruefung.typ | typst | Other | #import "/src/template.typ": *
== Funktionen von Leistungsüberprüfungen
#grid(column-gutter: 1em, row-gutter: 1em, columns: 3,
[*Rekrutierungsfunktion*#en[@Klager2021_Bewertung[S. 4 f]]],
[*Didaktische Funktion*#en[@Klager2021_Bewertung[S. 5]]],
[*Sozialisierungsfunktion*#en[@Klager2021_Bewertung[S. 5]]],
[
- *Förderungsauswahl:* Durch Prüfungen und Leistungskontrollen können SuS, die für eine Förderung in Frage kommen, ausgewählt werden.
- *Diagnose:* Prüfungen ermöglichen es, den Stand der Qualifikation der SuS zu erheben.
- *Platzierung:* die SuS können nach ihren Ergebnissen in eine Rangfolge gebracht werden.
- *Selektion:* Prüfungen öffnen oder verschließen Zugänge zu Berufen und/oder weiterführender Ausbildung.
], [
- *Gliederung:* Prüfungen können die Lernzeiträume strukturieren.
- *Orientierung* Prüfungen sind Anlass, sich ein genaues Bild über die Ausbildungsziel, -inhalte und -niveaus zu machen.
- *Evaluation:* Prüfungen helfen die Qualität der Ausbildung und den jeweiligen Bildungs- und #ix("Kompetenzstand", "Kompetenz") zu informieren.
- *Motivation:* Gut vorbereitete und erfolgreich abgeschlossene Prüfungen helfen den Lernenden, sich für weitere Anstrengungen zu motivieren.
], [
- *Anpassung:* Prüfungen fördern die Anpassung an gesellschaftlich bestehende Werte, Normen und Rollen.
- *Hierarchie:* Prüfungen sind von anderen gesetzte Anforderungssituationen, die erfüllt werden müssen und schaffen somit eine Hierarchie zwischen Prüfenden und Prüflingen.
- *Initiation:* Prüfungen sind Bewährungssituationen, die bewältigt werden müssen.
- *Entwicklung:* Prüfungen sind Herausforderungen für die Persönlichkeitsentwicklung.
]) |
https://github.com/Rhinemann/mage-hack | https://raw.githubusercontent.com/Rhinemann/mage-hack/main/src/chapters/Attributes.typ | typst | #import "../templates/interior_template.typ": *
#show: chapter.with(chapter_name: "Attributes")
= Attributes
#show: columns.with(2, gutter: 1em)
Attributes represent raw ability and essential traits every character possesses.
#block(breakable: false)[
== Using Attributes
Attributes are the second PC's three primary trait sets, so they are to be used in every roll, as any action can fall into one of these areas: mental, physical and social, and a specific situation determines which exact attribute will be used.
]
Attributes serve as the second of the three Prime Sets used in every roll, rated from #spec_c.d4 to #spec_c.d12.
The nine Attributes are split into three categories: Physical, Social, Mental.
#block(breakable: false)[
== Rating Attributes
Attributes usually have a rating from #spec_c.d6 to #spec_c.d10, although there are exceptions.
]
/ #spec_c.d4 Poor: Notably deficient in this area.
/ #spec_c.d6 Typical: An average degree of ability.
/ #spec_c.d8 Excellent: Above-average performance.
/ #spec_c.d10 Remarkable: Greatly above average.
/ #spec_c.d12 Incredible: Peak levels of ability.
#block(breakable: false)[
== Attribute List
]
#block(breakable: false)[
=== Mental Attributes
Mental Attributes reflect your character's acuity, intellect, and strength of mind.
]
#block(breakable: false)[
==== Intelligence
Raw knowledge, memory, and capacity for solving difficult problems. This may be book smarts, or a wealth of trivia.
]
#block(breakable: false)[
==== Wits
Ability to think quickly and improvise solutions. It reflects your character's perception, and ability to pick up on details.
]
#block(breakable: false)[
==== Resolve
Determination, patience, and sense of commitment. It allows your character to concentrate in the face of distraction and danger, or continue doing something in spite of insurmountable odds.
]
#block(breakable: false)[
=== Physical Attributes
Physical Attributes reflect your character's bodily fitness and acumen.
]
#block(breakable: false)[
==== Strength
Muscular definition and capacity to deliver force. It affects many physical tasks, including most actions in a fight.
]
#block(breakable: false)[
==== Dexterity
Speed, agility, and coordination. It provides balance, reactions, and aim.
]
#block(breakable: false)[
==== Stamina
General health and sturdiness. It determines how much punishment your character's body can handle before it gives up.
]
#block(breakable: false)[
=== Social Attributes
Social Attributes reflect your character's ability to deal with others.
]
#block(breakable: false)[
==== Presence
Assertiveness, gravitas, and raw appeal. It gives your character a strong bearing that changes moods and minds.
]
#block(breakable: false)[
==== Manipulation
Ability to make others cooperate. It's how smoothly they speak, and how much people can read into their intentions.
]
#block(breakable: false)[
==== Composure
Poise and grace under fire. It's their dignity, and ability to remain unfazed when harrowed.
] |
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/SK/zalmy/Z005.typ | typst | Pane, počuj moje slová, \* všimni si moje vzdychanie.
Pozoruj moju hlasitú prosbu, \* môj kráľ a môj Boh.
Veď ku tebe, Pane, sa modlím, \* za rána počúvaš môj hlas, za rána prichádzam k tebe a čakám.
Ty nie si Boh, \* ktorému by sa páčila neprávosť,
zlý človek nepobudne pri tebe, \* ani nespravodliví neobstoja pred tvojím pohľadom.
Ty nenávidíš všetkých, čo páchajú neprávosť, \* ničíš všetkých, čo hovoria klamstvá.
Od vraha a podvodníka \* sa odvracia Pán s odporom.
No ja len z tvojej veľkej milosti smiem vstúpiť do tvojho domu \* a s bázňou padnúť na tvár pred tvojím svätým chrámom.
Pane, veď ma vo svojej spravodlivosti pre mojich nepriateľov, \* urovnaj svoju cestu predo mnou.
Lebo v ich ústach úprimnosti niet, \* ich srdcia sú plné zrady;
ich hrtan je ako otvorený hrob, \* na jazyku samé úlisnosti.
Súď ich, Bože, nech padnú pre svoje zámery; \* vyžeň ich pre množstvo ich zločinov, veď teba, Pane, rozhorčili.
Nech sa tešia všetci, čo majú v teba dôveru, \* a naveky nech jasajú.
Chráň ich a nech sa radujú v tebe, \* čo tvoje meno milujú.
Lebo ty, Pane, žehnáš spravodlivého, \* ako štítom venčíš ho svojou priazňou. |
|
https://github.com/jamesrswift/dining-table | https://raw.githubusercontent.com/jamesrswift/dining-table/main/examples/ETH-GBP.typ | typst | The Unlicense | #import "../src/lib.typ" as dining-table
#set par(justify: true)
#set text(size: 12pt)
#set page(margin: 1em)
#let converted = csv(
"ETH-GBP.csv",
row-type: dictionary
).map((it) =>(:
..it,
Date: datetime(
..(
"year", "month", "day"
).zip(
it.Date.matches(
regex("(\d{4})-(\d{2})-(\d{2})")
).first().captures
).fold(
(:),
(acc, (key, value)) => (..acc, (key): int(value))
)
)
))
#let column(key) = (:
key: key,
header: [#key],
width: 1fr,
align: right,
)
#dining-table.make(
columns: (
(
key: "Date",
header: [Date],
display: (it)=>{it.display()},
gutter: 1em
),
column("Open"),
column("High"),
column("Low"),
column("Close"),
column("Volume")
),
data: converted
)
|
https://github.com/chamik/gympl-skripta | https://raw.githubusercontent.com/chamik/gympl-skripta/main/cj-autori/havel.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/helper.typ": autor
#autor("<NAME>", "1936", "2011 (75 let)", "spisovatel, prezident", "ČVUT, DAMU", "demokratický", "/cj-autori/media/havel.jpg")
Spoluzakladatel Charty 77, pět let byl vězněn, během normalizace (1969--1989) měl zakázáno publikovat. V 60. letech 20. století působil v divadle Na zábradlí. Obdržel Rakouskou státní cenu za evropskou literaturu. Poté dvakrát získal v New Yorku cenu Obie. Dalším úspěchem byla Mírová cena německých knihkupců.
V letech 1989, 1990, 1993 a 1989 byl poslanci zvolen za prezidenta republiky. Byl členem (a spoluzakladatelem) politické strany Občanské fórum. Obdržel Čestnou medaily T. <NAME>ka. Také mu byl propůjčen Řád Bílého Lva I. třídy a Řád T. <NAME>. Několikrát navržen na Nobelovu cenu za mír.
Nejslavnější díla napsal během normalizace. Psal absurdní dramata, básně (experimentální poezie) a eseje. Zabýval se tématy jako moc, byrokracie, svoboda, morálka...
\7. října 1989 popřálo Rudé právo Václavu Havlovi (resp. "<NAME> z Malého Hrádku") k narozeninám včetně jeho fotky.
#align(center, image("/cj-autori/media/ferdinand-vanek.jpg", height: 5cm))
Mezi jeho známá díla patří:
1. Zahradní slavnost
2. Vyrozumění
3. Protest
4. Audience
*Současníci*\
_<NAME>_ -- Čekání na Godota (@godot[]), 1952\
_<NAME>_ -- Žert, 1967\
_<NAME>_ -- Smrt krásných srnců, 1971
#pagebreak()
|
https://github.com/soul667/typst | https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/polylux/book/src/dynamic/alternatives.md | markdown | # `#alternatives` to substitute content
The so far discussed helpers `#one-by-one`, `#line-by-line`, and `pause` all
build upon `#uncover`.
There is an analogon to `#one-by-one` that is based on `#only`, namely
`#alternatives`.
You can use it to show some content on one subslide, then substitute it by
something else, then by something else, etc.
Consider this example:
```typ
{{#include poor-alternatives.typ:6:11}}
```
Here, we want to display three different sentences with the same structure:
Some person likes some sort of ice cream.

As you can see, the positioning of `likes` and `ice cream` moves
around in the produced slide because, for example, `Ann` takes much less space
than `Christopher` when using `#only` for that job.
This somewhat disturbs the perception of the constant structure of the sentence
and that only the names and kinds of ice cream change.
To avoid such movement and only subsitute certain parts of content, you can use
the `#alternatives` function.
With it, our example becomes:
```typ
{{#include alternatives.typ:6:11}}
```
resulting in

`#alternatives` will put enough empty space around, for example, `Ann` such that
it uses the same amount of space as `Christopher`.
In a sense, it is like a mix of `#only` and `#uncover` with some reserving of
space.
By default, all elements that enter an `#alternatives` command are aligned at
the bottom left corner.
This might not always be the desired or the most pleasant way to position it, so
you can provide an optional `position` argument to `#alternatives` that takes an
[`alignment` or `2d alignment`](https://typst.app/docs/reference/layout/align/#parameters--alignment).
For example:
```typ
{{#include alternatives-position.typ:6:9}}
```
makes the mathematical terms look better positioned:

Similar to `#one-by-one` and `#line-by-line`, `#alternatives` also has an optional
`start` argument that works just the same as for the other two.
|
|
https://github.com/Bayremselmi/infodev | https://raw.githubusercontent.com/Bayremselmi/infodev/main/Lab-3.typ | typst | #import "Class.typ": *
#show: ieee.with(
title: [#text(smallcaps("Lab 1 : Web Application with Genie"))],
/*
abstract: [
#lorem(12).
],
*/
authors:
(
(
name: "<NAME>",
department: [AII 22],
organization: [ISET Bizerte --- Tunisia],
profile: "Oussamatabai",
),
(
name: "<NAME>",
department: [AII 22],
organization: [ISET Bizerte --- Tunisia],
profile: "Bayremselmi",
),
)
)
= *Exercise*
In this lab, you will create a basic web application using *Genie framework* in Julia. The application will allow us to control the behaviour of a sine wave, given some adjustble parameters. You are required to carry out this lab using the REPL as in @fig:julia.
#figure(
image("Images/Julia.png", width: 80%, fit: "contain"),
caption: "Julia"
) <fig:julia>
#exo[*Sine Wave Control*][We provide the Julia and HTML codes to build and run a web app that allows us to control the amplitude and frequency of a sine wave.
*samples* : We also added a slider to change the number of samples used to draw the figure. .The range is from
100 to 1000 / with steps : 1
*amplitude* : We added a slider to change the amplitude max and min of sine wave .The range is from
0 to 8 / with steps : 0.5
*frequency* : The latter setting permits to grasp the influence of sampling frequency on the look of our chart .The range is from
0 to 100 / with steps : 1
*phase* : this slider adjusts the phaseof the sine wave. the range is from
-3.14 to 3.14 / with steps : 0.314
*offset* : this slider adjusts the offset of sine wave.The range is from -0.5 to 1 / with steps : 1
]
#exo[*phase*][*Phase ranging between −3.14 and 3.14, changes by a step of 0.314*]
```julia
@in pha::Float32 = 1
---
@onchange N, amp, freq , pha begin
x = range(0, 1, length=N)
y = amp*sin.(2*π*freq*x .+pha)
```
*Julia*
```HTML
<div class="st-col col-12 col-sm st-module">
<p><b>phase</b></p>
<q-slider v-model="pha"
:min="-3.14" :max="3.14"
:step="0.314" :label="true">
</q-slider>
</div>
```
*html*
#figure(
image("Images/Capture11.PNG", width: 100%, fit: "contain"),
caption: "add phase"
) <fig:phase>
#exo[*offset*][*Offset varies from −0.5 to 1, by a step of 0.1*]
```julia
@in ofs::Float32 = 1
---
@onchange N, amp, freq , pha , ofs begin
x = range(0, 1, length=N)
y = amp*sin.(2*π*freq*x .+pha).+ofs
*Julia*
```
```HTML
<div class="st-col col-12 col-sm st-module">
<p><b>offset</b></p>
<q-slider v-model="ofs"
:min="-0.5" :max="1"
:step="0.1" :label="true">
</q-slider>
</div>
```
*html*
#figure(
image("Images/Capture22.PNG", width: 100%, fit: "contain"),
caption: "add offset"
) <fig:offset>
```zsh
all the prorgam
```
#let code=read("../Codes/web-app/app.jl")
#raw(code, lang: "julia")
#let code=read("../Codes/web-app/app.jl.html")
#raw(code, lang: "html")
```zsh
julia -- project
```
```julia
cd("(location of the folder)/infodev-main/Codes/web-app")
julia> using GenieFramework
julia> Genie.loadapp() # Load app
julia> up() # Start the server
```
We can now open the browser and navigate to the link #highlight[#link("http://127.0.0.1/:8000")[http://127.0.0.1/:8000]]. We will get the graphical interface as in @fig:genie-webapp.
#figure(
image("Images/Capture22.PNG", width: 100%),
caption: "Genie -> Sine Wave",
) <fig:genie-webapp> |
|
https://github.com/qujihan/toydb-book | https://raw.githubusercontent.com/qujihan/toydb-book/main/src/chapter2/engine.typ | typst | #import "../../typst-book-template/book.typ": *
#let path-prefix = figure-root-path + "src/pics/"
== Engine Trait
在存储引擎中,每一对 KV 都是以字母序来存储的字节序列(byte slice)。其中Key是有序的,这样就可以进行高效的范围查询。范围查询在一些场景下非常有用,比如在执行一个扫描表的SQL的时候(所有的行都是以相同的key前缀)。Key应该使用KeyCode进行编码(接下来会讲到)。在写入以后,数据并没有持久化,还需要调用flush()保证数据持久化。
在ToyDB中,即使是读操作,也只支持单线程,这是因为所有方法都包含一个存储引擎的可变引用。无论是raft的日志运用到状态机还是对文件的读取操作,都是只能顺序访问的。
在ToyDB中,实现了一个基于BitCask的,一个基于标准库BTree的存储引擎。
每一个可以被ToyDB使用的存储引擎都需要实现`storage::Engine`这个trait。下面看一下这个trait。
#code(
"toydb/src/storage/engine.rs",
"strong::Engine",
)[
```rust
/// 带有 Self: Sized 是为了无法使用trait object(比如Box<dyn Engine>)
/// 但是也提供了一个scan_dyn()方法来返回一个trait object
pub trait Engine: Send {
/// scan()返回的迭代器
type ScanIterator<'a>: ScanIterator + 'a
where
Self: Sized + 'a;
/// 删除一个key, 如果不存在就什么都不发生
fn delete(&mut self, key: &[u8]) -> Result<()>;
/// 将缓冲区的内容写出到存储介质中
fn flush(&mut self) -> Result<()>;
fn get(&mut self, key: &[u8]) -> Result<Option<Vec<u8>>>;
/// 遍历指定范围的key/value对
fn scan(&mut self, range: impl std::ops::RangeBounds<Vec<u8>>) -> Self::ScanIterator<'_>
where
Self: Sized;
/// 与scan()类似, 能被trait object使用. 由于使用了dynamic dispatch, 所以性能会有所下降
fn scan_dyn(
&mut self,
range: (std::ops::Bound<Vec<u8>>, std::ops::Bound<Vec<u8>>),
) -> Box<dyn ScanIterator + '_>;
/// 遍历指定前缀的key/value对
fn scan_prefix(&mut self, prefix: &[u8]) -> Self::ScanIterator<'_>
where
Self: Sized,
{
self.scan(keycode::prefix_range(prefix))
}
/// 设置一个key/value对, 如果存在则替换
fn set(&mut self, key: &[u8], value: Vec<u8>) -> Result<()>;
/// 获取存储引擎的状态
fn status(&mut self) -> Result<Status>;
}
```
]<engine>
其中的`get`,`set`以及`delete`只是简单的读取以及写入key/value对,并且通过`flush`可以确保将缓冲区的内容写出到存储介质中(通过`fsync`系统调用等方式)。`scan`按照顺序迭代指定的KV对范围。这个对一些高级功能(SQL表扫描等)至关重要。并且暗含了以下一些语义:
- 为了提高性能,存储的数据应该是有序的。
- key应该保留字节编码,这样才能实现范围扫描。
对于存储引擎而已,并不关心`key`是什么,但是为了方便上层的调用,提供了一个称为`KeyCode`的order-preserving编码,具体可以在 @encoding 看到。
此外在上面的代码中还需要注意两个东西,一个是`ScanIterator`,一个是`Status`。`ScanIterator`是一个迭代器,用于遍历存储引擎中的KV对。`Status`是用于获取存储引擎的状态,比如存储引擎的大小,垃圾量等。
现在简单看一下`Status`。
#code(
"toydb/src/storage/engine.rs",
"Status",
)[
```rust
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Status {
/// The name of the storage engine.
/// 存储引擎的名字
pub name: String,
/// The number of live keys in the engine.
/// 存储引擎中的活跃key的数量
pub keys: u64,
/// The logical size of live key/value pairs.
/// 存储引擎中的活跃key/value对的逻辑大小
pub size: u64,
/// The on-disk size of all data, live and garbage.
/// 所有数据的磁盘大小, 包括活跃和垃圾数据
pub total_disk_size: u64,
/// The on-disk size of live data.
/// 活跃数据的磁盘大小
pub live_disk_size: u64,
/// The on-disk size of garbage data.
/// 垃圾数据的磁盘大小
pub garbage_disk_size: u64,
}
impl Status {
pub fn garbage_percent(&self) -> f64 {
if self.total_disk_size == 0 {
return 0.0;
}
self.garbage_disk_size as f64 / self.total_disk_size as f64 * 100.0
}
}
```
]
简简单单几个属性,以及定义了一个计算垃圾比例的方法。这个比例可以用来判断是否需要进行压缩。
再看一下`ScanIterator`。
#code("toydb/src/storage/engine.rs", "ScanIterator")[
```rust
/// A scan iterator, with a blanket implementation (in lieu of trait aliases).
pub trait ScanIterator: DoubleEndedIterator<Item = Result<(Vec<u8>, Vec<u8>)>> {}
impl<I: DoubleEndedIterator<Item = Result<(Vec<u8>, Vec<u8>)>>> ScanIterator for I {}
```
]
这里定义了一个`trait`,用于遍历存储引擎中的KV对 (@engine 中`Scan*`所用)。这个`trait`指定了`Item`(`Item`就是迭代项)类型为`Result<(Vec<u8>, Vec<u8>)>`,其中`Vec<u8>, Vec<u8>`分别是key,value。另外这个`trait`还需要组合`DoubleEndedIterator`这个`trait`。
另外`ScanIterator`没有定义任何额外的方法,这个实现是空的,这种方式称为 blanket implementation(通用实现),这个允许我们为一大类类型提供一个统一的实现。
|
|
https://github.com/GYPpro/DS-Course-Report | https://raw.githubusercontent.com/GYPpro/DS-Course-Report/main/Rep/05.typ | typst | #import "@preview/tablex:0.0.6": tablex, hlinex, vlinex, colspanx, rowspanx
#import "@preview/codelst:2.0.1": sourcecode
// Display inline code in a small box
// that retains the correct baseline.
#set text(font:("Times New Roman","Source Han Serif SC"))
#show raw.where(block: false): box.with(
fill: luma(230),
inset: (x: 3pt, y: 0pt),
outset: (y: 3pt),
radius: 2pt,
)
#show raw: set text(
font: ("consolas", "Source Han Serif SC")
)
#set page(
paper: "a4",
)
#set text(
font:("Times New Roman","Source Han Serif SC"),
style:"normal",
weight: "regular",
size: 13pt,
)
#let nxtIdx(name) = box[ #counter(name).step()#counter(name).display()]
#set math.equation(numbering: "(1)")
#show raw.where(block: true): block.with(
fill: luma(240),
inset: 10pt,
radius: 4pt,
)
#set math.equation(numbering: "(1)")
#set page(
paper:"a4",
number-align: right,
margin: (x:2.54cm,y:4cm),
header: [
#set text(
size: 25pt,
font: "KaiTi",
)
#align(
bottom + center,
[ #strong[暨南大学本科实验报告专用纸(附页)] ]
)
#line(start: (0pt,-5pt),end:(453pt,-5pt))
]
)
/*----*/
= 基于`vector`实现`stack`
\
#text(
font:"KaiTi",
size: 15pt
)[
课程名称#underline[#text(" 数据结构 ")]成绩评定#underline[#text(" ")]\
实验项目名称#underline[#text(" ") 基于`vector`实现`stack` #text(" ")]指导老师#underline[#text(" 干晓聪 ")]\
实验项目编号#underline[#text(" 05 ")]实验项目类型#underline[#text(" 设计性 ")]实验地点#underline[#text(" 数学系机房 ")]\
学生姓名#underline[#text(" 郭彦培 ")]学号#underline[#text(" 2022101149 ")]\
学院#underline[#text(" 信息科学技术学院 ")]系#underline[#text(" 数学系 ")]专业#underline[#text(" 信息管理与信息系统 ")]\
实验时间#underline[#text(" 2024年6月13日上午 ")]#text("~")#underline[#text(" 2024年7月13日中午 ")]\
]
#set heading(
numbering: "1.1."
)
= 实验目的
实现stack
= 实验环境
计算机:PC X64
操作系统:Windows + Ubuntu20.0LTS
编程语言:C++:GCC std20
IDE:Visual Studio Code
= 程序原理
利用`vector`维护动态增长的数据,并提供栈操作的`pop`和`push`函数
#pagebreak()
= 程序代码
== `stack.h`
#sourcecode[```cpp
// #define _PRIVATE_DEBUG
#ifndef INTERFACE_STACK_HPP
#define INTERFACE_STACK_HPP
#ifdef _PRIVATE_DEBUG
#include <iostream>
#endif
namespace myDS
{
template<typename VALUE_TYPE>
class stack{
protected:
private:
vector<VALUE_TYPE> _data;
public:
stack(){ }
void push(VALUE_TYPE t) {
_data.push_back(t);
}
VALUE_TYPE pop() {
VALUE_TYPE t = _data.back();
_data.pop_back();
return t;
}
VALUE_TYPE top() {
return _data.back();
}
bool empty() {
return _data.empty();
}
int size() {
return _data.size();
}
void clear() {
_data.clear();
}
~stack() { }
};
}
#endif
```]
|
|
https://github.com/chamik/gympl-skripta | https://raw.githubusercontent.com/chamik/gympl-skripta/main/cj-dila/3-romeo-a-julie.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/helper.typ": dilo, replika
#dilo("Romeo a Julie", "romeo", "<NAME>", "<NAME>", "14. až 16. st.; renesance, humanismus", "Anglie", "1597", "drama", "tragédie")
#columns(2, gutter: 1em)[
*Téma*\
Nešťastný osud milenců, boj o lásku
*Motivy*\
Láska, válka rodů, smrt, nepřátelství, rodina
*Časoprostor*\
Verona, polovina 16. st.
*Postavy* \
_<NAME>_ -- Mladý, milý, bezhlavě zamilovaný, vášnivý romantik, impulzivní, hrdý, čestný\
_<NAME>_ -- Mladá (14), inteligentní, citlivá, obětavá, odvážná, oddaná své lásce, naivní, tvrdohlavá, krásná \
_<NAME> (Vavřinec)_ -- Františkán, přítel Romea, obětavý, mírumilovný \
_Merkucio_ -- dobrý přítel Romea\
_Tybalt_ -- Juliin bratranec, vášnivý bojovník, agresivní \
_Paris_ -- Mladý šlechtic, má si vzít Julii\
_Chůva_ -- veselá, upovídaná, stará \
*Kompozice*
chronologická, 5 dějství:\
expozice, kolize, krize, katastrofa, závěr
*Jazykové prostředky*\
renesanční jazyk, archaismy, poetismy, inverze, metafory, přirovnání, hyperboly
*Obsah*\
Děj začíná střetem mezi rody Monteků a Kapuletů na náměstí, který musí ukončit až vévoda.
Zde se už objevuje Romeo, nešťastně zamilován do Rosaliny. Společně se svými druhy se
dozvídá o maškarním plese u Kapuletů a rozhodne se tam jít. Na plese spatří Julii a zamiluje
se do ní.
Po skončení plesu se Romeo vplíží na zahradu Kapuletů a pod okny Julii vyznává lásku. Ta
pozná hloubku jeho citů a následující den je bratr Vavřinec oddá. Později dochází k další
potyčce, kdy Tybalt zabije Romeova přítele Merkucia, a Romeo z pomsty zabije Tybalta. Za
to je vyhoštěn z Verony a odjíždí do Mantovy. Julie truchlí nad odchodem Romea, její otec
to však považuje za smutek z Tybaltovy smrti a chce svou dceru přivést na jiné myšlenky
svatbou s Paridem.
Zoufalá Julie žádá o pomoc bratra Vavřince, který vymyslí plán. Julie vypije nápoj, po kterém
bude vypadat jako mrtvá. Když ji dají do hrobky, přijde pro ní Romeo a až se Julie probudí,
společně utečou. První část plánu vyjde, ale posel bratra Vavřince se k Romeovi nedostane.
Romeo se tedy domnívá, že Julie je opravdu mrtvá a koupí si jed. Když přichází k její hrobce,
potká se tam s Paridem, kterého zabije. Vedle své lásky vypije jed a umírá. Julie se probouzí.
Když vidí mrtvého Romea, vezme jeho dýku a zabije se.
Obě rodiny se nad mrtvými těly svých dětí usmíří a postaví ve Veroně zlaté sochy Romea
a Julie.
*Literárně historický kontext*\
Vzniklo v době vlády <NAME>. kdy divadlo zažívalo velký rozkvět. V tomto období se psalo hlavně o lidských pocitech, individualismu a lásce.
]
#pagebreak()
*Ukázka -- Jednání druhé, scéna 2*
#table(columns: 2, stroke: none,
..replika("", "[...]"),
..replika("Julie", [
Romeo, Ó Romeo! -- proč's Romeo?\
Své jméno zapři, otce zřekni se,\
neb, nechceš-li, mně lásku přísahej,\
a nechci dál být Capuletova.
]),
..replika("Romeo", [_(stranou)_ Mám dále naslouchat, či, promluvit?]),
..replika("Julie", [
Jen jméno tvé mým nepřítelem jest;\
ty's jen ty sám a nejsi Montekem.\
Co jest to Montek? ruka, ani noha,\
ni paž, ni tvář, ni jiná část, jež vlastní\
jest člověku. Ó, jiné jméno měj!\
Co jest to jméno? To, co růží zvem,\
pod jiným jménem sladce vonělo\
by zrovna tak. A tak Romeem nezván,\
Romeo podržel by veškerou\
tu vzácnou dokonalost, kterou má\
bez toho jména. -- Odlož jméno své,\
a za své jméno, jež tvou částí není,\
mne vezmi celou.
]),
..replika("Romeo", [
Za slovo tě beru.\
Jen láskou svou mne zvi a na novo\
tak budu pokřtěn; od té chvíle dál\
Romeo nechci býti nikdy víc.
]),
..replika("Julie", [Kdo's ty, jenž nocí zastřen vtíráš se v mé tajemství?]),
..replika("Romeo", [
Dle jména nevím, jak\
bych řekl ti, kdo jsem. Své jméno sám,\
ó, drahá světice, mám v nenávisti,\
neb vím, ţe tobě nepřítelem jest;\
je, kdybych psané měl, bych roztrhal.
]),
..replika("Julie", [
Sto slov mé ucho ještě nevpilo,\
jež prones' jazyk tvůj, a znám ten hlas.\
Nejsi Romeo, jeden z Monteků?
]),
..replika("", "[...]")
)
#pagebreak() |
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/weave/0.1.0/tests/tests.typ | typst | Apache License 2.0 | #import "../lib.typ": *
#pipe(
5,
(
x => x + 1,
x => x + 2,
x => assert(x == 8),
),
)
#compose(
(
c => assert(c == "xyz"),
c => c + "z",
c => "x" + c,
),
"y",
)
#let pipeline = pipe_((
c => c + "c",
c => "a" + c,
))
#assert(pipeline("b") == "abc")
#let composed = compose_((
c => "a" + c,
c => c + "c",
))
#assert(composed("b") == "abc")
|
https://github.com/Readon/NSFC-application-template-typst | https://raw.githubusercontent.com/Readon/NSFC-application-template-typst/main/main.typ | typst | MIT License | #import "template.typ": *
#show: proposal.with(
)
= 立项依据与研究内容(建议8000字以下):
== *项目的立项依据*(研究意义、国内外研究现状及发展动态分析,需结合科学研究发展趋势来论述科学意义;或结合国民经济和社会发展中迫切需要解决的关键科技问题来论述其应用前景。附主要参考文献目录);
对于习惯用LaTeX写文档的同学们,一个写基金申请书的模版可能有参考作用。因此我做了这个2021年面上项目申请书正文部分模版。祝大家基金申请顺利!
2023-01-20: 根据2023年面上项目申请书正文的官方MsWord模板,对本模板的字号和少量蓝色文字做了更新。
2023-01-29\&02-01:根据几位老师的建议,对section的缩进,“参考文献”四个字的大小、字体和居左等做了调整。官方模板中阿拉伯数字不加粗,因此也做了相应的调整。
== *项目的研究内容、研究目标,以及拟解决的关键科学问题*(此部分为重点阐述内容);
本项目的研究目标是获得申请面上项目的LaTeX模版。
拟解决的关键问题包括:
== *拟采取的研究方案及可行性分析*(包括研究方法、技术路线、实验手段、关键技术等说明);
详见1.2使用说明。
== *本项目的特色与创新之处;*
本模版修改自由度很高,可以按照用户自己的需求修改而不要求用户具有很多LaTeX技巧。
== *年度研究计划及预期研究结果*(包括拟组织的重要学术交流活动、国际合作与交流计划等)。
拟组织研讨会1次,将这个模版广而告之。但是目前还没有经费。
= 研究基础与工作条件
== *研究基础*(与本项目相关的研究工作积累和已取得的研究工作成绩);
申请人用LaTeX写过几篇文章,包括自己的博士论文。
== *工作条件*(包括已具备的实验条件,尚缺少的实验条件和拟解决的途径,包括利用国家实验室、国家重点实验室和部门重点实验室等研究基地的计划与落实情况);
申请人课题组具有可以编译LaTeX的计算机,可以成功编译此模版。
== *正在承担的与本项目相关的科研项目情况*(申请人和主要参与者正在承担的与本项目相关的科研项目情况,包括国家自然科学基金的项目和国家其他科技计划项目,要注明项目的资助机构、项目类别、批准号、项目名称、获资助金额、起止年月、与本项目的关系及负责的内容等);
无。
== *完成国家自然科学基金项目情况*(对申请人负责的前一个已资助期满的科学基金项目(项目名称及批准号)完成情况、后续研究进展及与本申请项目的关系加以详细说明。另附该项目的研究工作总结摘要(限500字)和相关成果详细目录)。
不告诉你。
= 其他需要说明的情况
== 申请人同年申请不同类型的国家自然科学基金项目情况(列明同年申请的其他项目的项目类型、项目名称信息,并说明与本项目之间的区别与联系)。
无。
== 具有高级专业技术职务(职称)的申请人或者主要参与者是否存在同年申请或者参与申请国家自然科学基金项目的单位不一致的情况;如存在上述情况,列明所涉及人员的姓名,申请或参与申请的其他项目的项目类型、项目名称、单位名称、上述人员在该项目中是申请人还是参与者,并说明单位不一致原因。
无。
== 具有高级专业技术职务(职称)的申请人或者主要参与者是否存在与正在承担的国家自然科学基金项目的单位不一致的情况;如存在上述情况,列明所涉及人员的姓名,正在承担项目的批准号、项目类型、项目名称、单位名称、起止年月,并说明单位不一致原因。
无。
== 其他。
无。 |
https://github.com/jneug/typst-tools4typst | https://raw.githubusercontent.com/jneug/typst-tools4typst/main/is.typ | typst | MIT License | #import "alias.typ"
// =================================
// Test functions for use in any(),
// all() or find()
// =================================
/// Creates a new test function, that is #value(true), when #arg[test] is #value(false).
///
/// Can be used to create negations of tests like:
/// #codesnippet[```typ
/// #let not-raw = is.neg(is.raw)
/// ```]
///
/// // Tests
/// #test(
/// scope: (not-raw: is.neg(is.raw)),
/// `not-raw("foo")`,
/// `not not-raw(raw("foo"))`,
/// ```
/// not not-raw(`foo`)
/// ```
/// )
///
/// - test (function, boolean): Test to negate.
/// -> function
#let neg( test ) = (..args) => { not test(..args) }
/// Tests if values #arg[compare] and #arg[value] are equal.
///
/// // Tests
/// #test(
/// `is.eq("foo", "foo")`,
/// `not is.eq("foo", "bar")`
/// )
///
/// - compare (any): first value
/// - value (any): second value
/// -> boolean
#let eq( compare, value ) = {
return value == compare
}
/// Tests if #arg[compare] and #arg[value] are not equal.
///
/// // Tests
/// #test(
/// `is.neq(1, 2)`,
/// `is.neq("a", false)`,
/// `not is.neq(1, 1)`,
/// `not is.neq("1", "1")`,
/// )
///
/// - compare (any): First value.
/// - value (any): Second value.
/// -> boolean
#let neq( compare, value ) = {
return value != compare
}
/// Tests if any one of #arg[values] is equal to #value(none).
///
/// // Tests
/// #test(
/// `is.n(none)`,
/// `not is.n("a")`,
/// `is.n(1, false, none, "none")`,
/// `not is.n(1, false, "none")`
/// )
///
/// - ..values (any): Values to test.
/// -> boolean
#let n( ..values ) = {
return none in values.pos()
}
/// Alias for @@n().
#let non = n
/// Tests if none of #arg[values] is equal to #value(none).
///
/// // Tests
/// #test(
/// `not is.not-none(none)`,
/// `is.not-none("a")`,
/// `not is.not-none(1, false, none, "none")`,
/// `is.not-none(1, false, "none")`
/// )
///
/// - ..values (any): Values to test.
/// -> boolean
#let not-none( ..values ) = {
return none not in values.pos()
}
/// Alias for @@not-none()
#let not-n = not-none
/// Tests, if at least one value in #arg[values] is not equal to
/// #value(none).
///
/// Useful for checking mutliple optional arguments for a
/// valid value:
/// ```typ
/// #if is.one-not-none(..args.pos()) [
/// #args.pos().find(is.not-none)
/// ]
/// ```
///
/// // Tests
/// #test(
/// `is.one-not-none(false)`,
/// `not is.one-not-none(none)`,
/// `is.one-not-none(none, none, none, 2, "none", none)`,
/// `is.one-not-none(1, 2, 3, "none")`,
/// `not is.one-not-none(none, none, none)`
/// )
///
/// - ..values (any): Values to test.
/// -> boolean
#let one-not-none( ..values ) = {
return values.pos().any((v) => v != none)
}
/// Tests if any one of #arg[values] is equal to #value(auto).
///
/// // Tests
/// #test(
/// `is.a(auto)`,
/// `not is.a("auto")`,
/// `is.a(1, false, auto, "auto")`,
/// `not is.a(1, false, "auto")`
/// )
///
/// - ..values (any): Values to test.
/// -> boolean
#let a( ..values ) = {
return auto in values.pos()
}
/// Alias for @@a()
#let aut = a
/// Tests if none of #arg[values] is equal to #value(auto).
///
/// // Tests
/// #test(
/// `not is.not-auto(auto)`,
/// `is.not-auto("auto")`,
/// `not is.not-auto(1, false, auto, "auto")`,
/// `is.not-auto(1, false, "auto")`
/// )
///
/// - ..values (any): Values to test.
/// -> boolean
#let not-auto( ..values ) = {
return auto not in values.pos()
}
/// Alias for @@not-auto()
#let not-a = not-auto
/// Tests, if #arg[value] is _empty_.
///
/// A value is considered _empty_ if it is an empty array,
/// dictionary or string, or the value #value(none).
///
/// // Tests
/// #test(
/// `is.empty(none)`,
/// `is.empty(())`,
/// `is.empty((:))`,
/// `is.empty("")`,
/// `not is.empty(auto)`,
/// `not is.empty(" ")`,
/// `not is.empty((none,))`,
/// )
///
/// - value (any): value to test
/// -> boolean
#let empty( value ) = {
let empty-values = (
array: (),
dictionary: (:),
string: "",
content: []
)
let t = str(type(value))
if t in empty-values {
return value == empty-values.at(t)
} else {
return value == none
}
}
/// Tests, if #arg[value] is not _empty_.
///
/// See @@empty() for an explanation what _empty_ means.
///
/// // Tests
/// #test(
/// `not is.not-empty(none)`,
/// `not is.not-empty(())`,
/// `not is.not-empty((:))`,
/// `not is.not-empty("")`,
/// `is.not-empty(auto)`,
/// `is.not-empty(" ")`,
/// `is.not-empty((none,))`,
/// )
///
/// - value (any): value to test
/// -> boolean
#let not-empty( value ) = {
let empty-values = (
array: (),
dictionary: (:),
string: "",
content: []
)
let t = str(type(value))
if t in empty-values {
return value != empty-values.at(t)
} else {
return value != none
}
}
/// Tests, if #arg[value] is not _empty_.
///
/// See @@empty() for an explanation what _empty_ means.
///
/// // Tests
/// #test(
/// `is.any(2, 2)`,
/// `is.any(auto, auto)`,
/// `is.any(1, 2, 3, 4, 2)`,
/// `is.any(1, 2, none, 4, none)`,
/// `not is.any(1, 2, 3, 4, 5)`,
/// `not is.any(1, 2, 3, 4, none)`,
/// )
///
/// - value (any): value to test
/// -> boolean
#let any( ..compare, value ) = {
// return compare.pos().any((v) => v == value)
return value in compare.pos()
}
/// Tests if #arg[value] is not equals to any one of the
/// other passed in values.
///
/// // Tests
/// #test(
/// `not is.not-any(2, 2)`,
/// `not is.not-any(auto, auto)`,
/// `not is.not-any(1, 2, 3, 4, 2)`,
/// `not is.not-any(1, 2, none, 4, none)`,
/// `is.not-any(1, 2, 3, 4, 5)`,
/// `is.not-any(1, 2, 3, 4, none)`,
/// )
///
/// - ..compare (any): values to compare to
/// - value (any): value to test
/// -> boolean
#let not-any( ..compare, value) = {
// return not compare.pos().any((v) => v == value)
return not value in compare.pos()
}
/// Tests if #arg[value] contains all the passed `keys`.
///
/// Either as keys in a dictionary or elements in an array.
/// If #arg[value] is neither of those types, #value(false) is returned.
///
/// // Tests
/// #test(
/// `is.has(4, range(5))`,
/// `not is.has(5, range(5))`,
/// `not is.has(5, 5)`,
/// `is.has("b", (a:1, b:2, c:3))`,
/// `is.has("b", "c", (a:1, b:2, c:3))`,
/// `not is.has("d", (a:1, b:2, c:3))`,
/// `not is.has("a", "d", (a:1, b:2, c:3))`,
/// )
///
/// - ..keys (any): keys or values to look for
/// - value (any): value to test
/// -> boolean
#let has( ..keys, value ) = {
if type(value) in (dictionary, array) {
return keys.pos().all((k) => k in value)
} else {
return false
}
}
// =================================
// Types
// =================================
/// Tests if #arg[value] is of type `t`.
///
/// // Tests
/// #test(
/// `is.type("string", "test")`,
/// `is.type("boolean", false)`,
/// `is.type("length", 1em)`,
/// `not is.type("integer", "test")`,
/// `not is.type("dictionary", false)`,
/// `not is.type("alignment", 1em)`,
/// )
///
/// - t (string): name of the type
/// - value (any): value to test
#let type( t, value ) = alias.type(value) == t
/// Tests if #arg[value] is of type dictionary.
///
/// // Tests
/// #test(
/// `is.dict((a:1, b:2, c:3))`,
/// `is.dict((:))`,
/// `not is.dict(())`,
/// `not is.dict(false)`,
/// `not is.dict(5)`,
/// )
///
/// - value (any): value to test
#let dict( value ) = alias.type(value) == "dictionary"
/// Tests if #arg[value] is of type array.
///
/// // Tests
/// #test(
/// `is.arr(())`,
/// `is.arr((1, 2, 3))`,
/// `is.arr(range(5))`,
/// `not is.arr((:))`,
/// `not is.arr(false)`,
/// `not is.arr(5)`,
/// )
///
/// - value (any): value to test
#let arr( value ) = alias.type(value) == "array"
/// Tests if #arg[value] is of type content.
///
/// // Tests
/// #test(
/// `is.content([])`,
/// `is.content(raw("foo"))`,
/// `not is.content(false)`,
/// `not is.content(1)`,
/// `not is.content(())`,
/// )
///
/// - value (any): value to test
#let content( value ) = alias.type(value) == "content"
/// Tests if #arg[value] is of type label.
///
/// // Tests
/// #test(
/// `is.label(label("one"))`,
/// `is.label(<one>)`,
/// `not is.label(false)`,
/// `not is.label(1)`,
/// `not is.label(())`,
/// )
///
/// - value (any): value to test
#let label( value ) = alias.type(value) == "label"
/// Tests if #arg[value] is of type color.
///
/// // Tests
/// #test(
/// `is.color(red)`,
/// `is.color(rgb(10%,10%,10%))`,
/// `is.color(luma(10%))`,
/// `not is.color(1)`,
/// `not is.color(())`,
/// )
///
/// - value (any): value to test
#let color( value ) = alias.type(value) == "color"
/// Tests if #arg[value] is of type stroke.
///
/// // Tests
/// #test(
/// `is.stroke(red + 1pt)`,
/// `not is.stroke(1)`,
/// `not is.stroke(())`,
/// )
///
/// - value (any): value to test
#let stroke( value ) = alias.type(value) == "stroke"
/// Tests if #arg[value] is of type location.
///
/// // Tests
/// #locate(loc => test(
/// scope: (loc:loc),
/// `is.loc(loc)`,
/// `not is.loc(<a-label>)`,
/// ))
///
/// - value (any): value to test
#let loc( value ) = alias.type(value) == "location"
/// Tests if #arg[value] is of type boolean.
///
/// // Tests
/// #test(
/// `is.bool(true)`,
/// `is.bool(false)`,
/// `not is.bool(1)`,
/// `not is.bool(())`,
/// )
///
/// - value (any): value to test
#let bool( value ) = alias.type(value) == "boolean"
#let str( value ) = alias.type(value) == "string"
#let int( value ) = alias.type(value) == "integer"
#let float( value ) = alias.type(value) == "float"
#let num( value ) = alias.type(value) in ("float", "integer")
#let frac( value ) = alias.type(value) == "fraction"
#let length( value ) = alias.type(value) == "length"
#let rlength( value ) = alias.type(value) == "relative length"
#let ratio( value ) = alias.type(value) == "ratio"
#let angle( value ) = alias.type(value) == "angle"
#let align( value ) = alias.type(value) == "alignment"
#let align2d( value ) = alias.type(value) == "alignment"
#let func( value ) = alias.type(value) == "function"
/// Tests if types #arg[value] is any one of `types`.
///
/// // Tests
/// #test(
/// `is.any-type("string", "integer", 1)`,
/// `is.any-type("string", "integer", "1")`,
/// `not is.any-type("string", "integer", false)`
/// )
///
/// - ..types (string): type names to check against
/// - value (any): value to test
#let any-type( ..types, value ) = {
return alias.type(value) in types.pos()
}
/// Tests if all passed in values have the same type.
///
/// // Tests
/// #test(
/// `is.same-type(..range(5))`,
/// `is.same-type(true, false)`,
/// `is.same-type(none, none, none)`,
/// `not is.same-type(..range(5), "a")`,
/// `not is.same-type(true, false, auto)`,
/// `not is.same-type(none, none, none, auto)`
/// )
///
/// - ..values (any): Values to test.
#let same-type( ..values ) = {
let t = alias.type(values.pos().first())
return values.pos().all((v) => alias.type(v) == t)
}
/// Tests if all of the passed in values have the type `t`.
///
/// // Tests
/// #test(
/// `is.all-of-type("boolean", true, false)`,
/// `is.all-of-type("none", none)`,
/// `is.all-of-type("length", 1pt, 1cm, 1in)`,
/// `not is.all-of-type("boolean", true, false, 1)`,
/// )
///
/// - t (string): type to test against
/// - ..values (any): Values to test.
#let all-of-type( t, ..values ) = values.pos().all((v) => alias.type(v) == t)
/// Tests if none of the passed in values has the type `t`.
///
/// // Tests
/// #test(
/// `not is.none-of-type("boolean", true, false)`,
/// `not is.none-of-type("none", none)`,
/// `is.none-of-type("boolean", 1pt, 1cm, 1in)`,
/// `is.none-of-type("boolean", 1, 1mm, red)`,
/// )
///
/// - t (string): type to test against
/// - ..values (any): Values to test.
#let none-of-type( t, ..values ) = values.pos().all((v) => alias.type(v) != t)
/// Tests if #arg[value] is a content element with `value.func() == func`.
///
/// If `func` is a string, #arg[value] will be compared to `repr(value.func())`, instead.
/// Both of these effectively do the same:
/// ```js
/// #is.elem(raw, some_content)
/// #is.elem("raw", some_content)
/// ```
///
/// // Tests
/// #test(
/// `is.elem(raw, raw("code"))`,
/// `is.elem(table, table())`,
/// `is.elem("table", table())`,
/// `not is.elem(table, grid())`,
/// `not is.elem("table", grid())`,
/// )
///
/// - func (function): element function
/// - value (any): value to test
#let elem( func, value ) = if alias.type(value) == "content" {
if alias.type(func) == "string" {
return repr(value.func()) == func
} else {
return value.func() == func
}
} else {
return false
}
/// Tests if #arg[value] is a sequence of content.
///
/// // Tests
/// #test(
/// `is.sequence([])`,
/// `not is.sequence(grid())`,
/// `is.sequence([
/// a b
/// ])`,
/// )
#let sequence( value ) = if alias.type(value) == "content" {
return repr(value.func()) == "sequence"
} else {
return false
}
#let raw( value ) = if alias.type(value) == "content" {
return value.func() == alias.raw
} else {
return false
}
#let table( value ) = if alias.type(value) == "content" {
return value.func() == alias.table
} else {
return false
}
#let list( value ) = if alias.type(value) == "content" {
return value.func() == alias.list
} else {
return false
}
#let enum( value ) = if alias.type(value) == "content" {
return value.func() == alias.enum
} else {
return false
}
#let terms( value ) = if alias.type(value) == "content" {
return value.func() == alias.terms
} else {
return false
}
#let cols( value ) = if alias.type(value) == "content" {
return value.func() == alias.columns
} else {
return false
}
#let grid( value ) = if alias.type(value) == "content" {
return value.func() == alias.grid
} else {
return false
}
#let stack( value ) = if alias.type(value) == "content" {
return value.func() == alias.stack
} else {
return false
}
|
https://github.com/Origami404/kaoyan-shuxueyi | https://raw.githubusercontent.com/Origami404/kaoyan-shuxueyi/main/微积分/03-一元积分.typ | typst | #import "../template.typ": sectionline, gray_table, colored
#let dx = $dif x$
= 一元积分学
== 不定积分
=== 基本积分模式
多项式和对数:
$
integral x^a dx &= 1 / (a + 1) x^(a + 1) + C \
integral a^x dx &= 1 / (ln a) a^x + C \
$
三角函数:
#gray_table(
columns: 7,
[导数], [$cos$], [$-sin$], [$sec^2$], [$-cot^2$], [$sec tan$], [$-csc cot$],
[函数], [$sin$], [$cos$], [$tan$], [$cot$], [$sec$], [$csc$],
[原函数], [$-cos$], [$sin$], [$-ln|cos|$], [$ln|sin|$], [$ln|sec + tan|$], [$ln|csc - cot|$],
) \
反三角函数 (带系数的形式在后边有理分式积分里有用):
$
integral 1 / ((a x)^2 + b^2) dx &= colored(1 / (a b)) arctan (a x) / b + C \
integral 1 / sqrt(b^2 - (a x)^2) dx &= colored(1 / a) arcsin (a x) / b + C \
integral 1 / colored(sqrt(x^2 plus.minus a^2)) &= ln |x + colored(sqrt(x^2 plus.minus a^2))| + C
$
=== 换元 / 凑微分
识别到常见的微分结构, 但是这个结构里的 "$x$" 比较复杂, 而且旁边还多乘了一个东西的时候可以用.
识别到无法直接处理的函数复合的时候可以用 ($arctan sqrt(x)$ 之类).
识别到需要三角换元的时候可以用:
#figure(image("../assets/第一类换元-三角换元.png", width: 60%))
换元的时候一定要记得有时候
=== 分部积分
$
u v = integral u dif v + integral v dif u
$
识别到目标积分是两个部分乘起来, 并且其中一个部分求导之后比原来简单的时候用. 一般来讲反三角和多项式求导后比求导前简单, 所以优先尝试让它们被导一次.
要额外注意分部后的正负号, 一般都是负号.
=== 有理分式积分
考试基本上只考二次的, 所以我们只考虑下面形式的有理分式积分:
$
I = integral (M x + N) / (x^2 + m x + n) dx
$
首先上面的函数肯定可以拆成两部分, 其中一部分含 $x$, 并且刚好能凑出微分来; 另一部分只有一个常数:
$
I = M / 2 integral (dif (x^2...)) / (x^2...) dx quad + quad integral N' / (x^2 + m x + n) dx
$
前者可以直接按照幂函数模式积出来, 后者则需要根据分母的 $Delta$ 不同来处理:
$
Delta = 0 quad &=> quad I = integral N' / (x - x_0)^2 dx quad &=> quad "直接积分" \
Delta < 0 quad &=> quad I = integral N' / ((x - x_0)^2 + R^2) dx quad &=> quad arctan ... \
Delta > 0 quad &=> quad I = integral N' / ((x - a) (x - b)) dx = integral (A / (x - a) + B / (x - b)) dx quad &=> quad ln ...
$
=== 三角有理式
$
I = integral sin^m x cos ^n x dx
$
- 当 $m$, $n$ 都是偶数时或都是奇数时, 可以用半角公式把指数除以 $2$.
- 当 $m$, $n$ 有一个是奇数时, 就可以把奇数那个拿一个去凑微分得到 $dif sin$ 或者 $dif cos$, 然后剩下的两个偶数里可以直接用 $sin^2 + cos^2 = 1$ 换成另一个
对于三角有理分式, 可以直接用万能公式换成普通有理分式, 然后暴力算就可以了:
$
sin x = (2 t) / (1 + t^2) quad quad cos x = (1 - t^2) / (1 + t^2) quad quad (t = tan (x / 2))
$
=== 指数有理式
直接换元换上去变成分母多一阶的有理分式, 然后暴力算就可以了:
$
integral f(a^x) dx = 1 / (ln a) integral f(t) / t dif t
$
#pagebreak()
== 定积分
=== 定积分检查步骤
#set list(marker: ([★], [⤥], [›]))
- 检查定积分内函数的奇偶性
- 奇函数原点对称区间内定积分恒 $0$
- 偶函数则把区间折半并加上系数 $2$
- 定积分的换元一定要保证换元函数的可逆性
- 检查区间内函数是否有瑕点
- 一般看分母在区间内有没有可能为 $0$ 即可
- 区间中有瑕点, 需要分段积分; 区间端点是瑕点或无穷则直接积到最后结果再取极限即可
=== 变限积分
$
dif / (dif x) integral^x_c f(t) dif t = f(x)
$
遇到内层积分是变限积分的二重积分时, 可以把变限积分视作 "容易取得导数的函数", 然后套分部积分公式处理. 一般而言乘积项都会被题目的设计消掉.
如果变限积分内的函数依赖 $x$, 那么不可以直接用上面的公式, 会多出来一项.
=== 华莱士公式 / 点火公式
#set math.cases(gap: 1em)
$
integral^(pi / 2)_0 sin^n x dx =
integral^(pi / 2)_0 cos^n x dx =
cases(
(n-1)!! / n!! " , " n = 2k + 1,
(n-1)!! / n!! dot.c pi / 2 " , " n = 2k,
)
$
=== 应用
- 极座标系求面积: $dif S = 1/2 rho^2 dif theta$
- 绕 $x$ 轴旋转体: 切成一片片圆盘, $dif V = pi y^2 dot.c dx$
- 绕 $y$ 轴旋转体: 切成一圈圈圆柱, $dif V = 2 pi x dot.c y dot.c dx$
- $x$, $y$ 由参数方程给出时, 记得先检查参数和 $x$ 是不是一一对应的, 若否则先用对称性限制一下积分区间
#pagebreak() |
|
https://github.com/maucejo/cnam_templates | https://raw.githubusercontent.com/maucejo/cnam_templates/main/src/cnam-templates.typ | typst | MIT License | #import "/src/presentation/_presentation_template.typ": *
#import "/src/letters/_reunion.typ": *
#import "/src/letters/_convention.typ": *
#import "/src/letters/_lettre.typ": *
#import "/src/report/_report.typ": * |
https://github.com/Riesi/typst_stains | https://raw.githubusercontent.com/Riesi/typst_stains/main/README.md | markdown | The Unlicense | A Typst implementation of coffeestains the LaTeX package.
# Stains
Pull requests for more stains are always welcome!
# Attribution
This package was inspired by the LaTeX package "coffeestains" and the 4 stains from said package have been imported to this one.
https://ctan.org/pkg/coffeestains |
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/021%20-%20Battle%20for%20Zendikar/007_Home%20Waters.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Home Waters",
set_name: "Battle for Zendikar",
story_date: datetime(day: 30, month: 09, year: 2015),
author: "<NAME>",
doc
)
#emph[When we last saw the merfolk Planeswalker Kiora, she had narrowly escaped from a battle with a deity, the sea god Thassa on Theros. Although she hadn] #emph['t gotten what she wanted out of the fight, neither had she left empty-handed, fleeing Theros with the sea god's sacred weapon in hand.]
#emph[Now she returns to her home plane of Zendikar, ready to fight the monstrous Eldrazi that threaten her world with destruction. They are massive, unstoppable. But the Eldrazi are not only monsters. The merfolk of Zendikar have long worshiped them as deities.]
#emph[And Kiora has already faced one god and lived to tell about it.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
#emph["Come on!" she said in a dream.]
#emph[She took Turi] #emph['s small, webbed hand in her own and tugged.]
#emph["Elder Misha's telling stories. Keep up! We're gonna miss it!"]
#emph[She pulled her sister along with her, and the two young merfolk sat down on the beach with the other youths just as Elder Misha began to speak. The other adults had all retreated to the far end of the beach, barely visible in the moonlight, where they told their own stories—stories for adults. Misha] #emph['s story was for children. The matriarch spoke above the surf in a soft but piercing voice.]
#emph["Long ago, but in our very own sea, the great god Ula was preparing for a hunt."]
#emph[Ula, who had made the seas—the ocean-dwellers] #emph[' highest god, dour and proud. She stuck out her tongue at him. Turi stuck her tongue out, too.]
#emph["Ula was furious at the dolphins, whose frolicking he took as an insult to his dignity. And so he planned to hunt one of them, as an example to the others. But dolphins are tricksters, and beloved of Cosi, the greatest trickster of all."]
#emph[Cosi stories! All the best stories were Cosi stories, but the other adults never listened to them.]
#emph["And so Cosi decided to foul Ula's hunt. The night before the hunt, Cosi snuck to Ula's bedside at the bottom of the sea and swapped his great spear for a gull's feather, which he enchanted to look exactly the same. Emeria saw this from her lofty perch in the sky realm, but she said nothing, for she enjoyed watching the other two gods quarrel.]
#emph["In the morning, Ula set out for his hunt, none the wiser. He gave a great bellowing speech about his dignity and his station. The dolphins clustered around to hear, for they had been told by Cosi that they had nothing to fear. This only made Ula angrier. He struck with his spear-that-was-not-a-spear, once, twice—but the dolphins only laughed, for in truth it was a feather, and could do no worse than tickle their sleek sides."]
#emph[Elder Misha did a shockingly good impression of the high, chittering laughter of a dolphin. The children giggled.]
#emph["Ula did not understand how the dolphins were unharmed, but he knew when he was being mocked. He lashed out at them more, struck again and again, tried to twist his spear inside the wounds he had not caused. The dolphins shrieked with glee. Enraged, Ula snapped the useless spear across his knee—and found himself holding two halves of a simple feather. The dolphins laughed so hard you can still hear them laughing, even to this day . . ."]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Kiora hit the sand hard on her hands and knees, ears ringing, vision swimming.
Planeswalking. Ha.
Ha, ha, ha.
Kiora preferred to swim—to push down and down until the coldest, darkest depths of two worlds' oceans ran together to become one, bridging a senseless chaos far darker, far colder. But in this particular case, she was lucky to have arrived at all.
Home. Zendikar.
She coughed, sucking in air, gills opening and closing. She was trembling, exhausted, filthy—coated in muck from the bottom of an ocean a world away.
Her hands were numb, so she had no idea if she was empty-handed. She hoped the mud wasn't the only thing she'd brought with her from Theros.
Her vision cleared. She looked down.
There, still clutched tightly in both hands, was the weapon of a god.
She let out a long, rattling laugh.
#emph[I won] , she thought. #emph[I beat a god. I won!]
The two-pronged spear was unwieldy, longer than she was tall, though it had been far larger when the sea god Thassa held it. It seemed to have hardly any weight at all. As Kiora watched, the starfield that marked it as the work of a god—what the people of Theros called the touch of Nyx—seemed to thin and dry, as though evaporating, as though the air of this different world was anathema to the stuff of gods. Soon the bident took on the texture of dried coral. Disappointing.
Kiora hoped it was still a weapon worthy of a god. But even if it was just a spear, it was the finest trophy she'd ever taken. Perhaps she'd give it to Turi, to go with her other mementos of Kiora's travels.
If Turi was still alive. If any of them were.
If the Eldrazi hadn't killed them all.
Kiora stumbled to her feet. She was still dazed after a massive magical battle, being choked nearly to death by a god, and pushing through a desperate, messy planeswalk. But this was Zendikar. It wasn't safe, especially not now.
She looked around.
#figure(image("007_Home Waters/01.jpg", width: 100%), caption: [Island | Art by <NAME>], supplement: none, numbering: none)
She stood on the shores of Tazeem. Waves lapped against the beach. The sun shone. Great stones reached into the sky, defying the bonds of gravity.
Zendikar lived!
Kiora whooped and ran out into the slapping surf, letting the water of Zendikar's sea wash away the mud of Theros. The bident sang a brief, clear note when it hit the water. Only that—but it was promising.
Cool, clean water flowed over and around her, washing the sea-bottom taste of her fight with Thassa out of her gills. She was clean, and she was free, and she was home. She dove into a sea that tasted like no other, anywhere. She sped along the shore, spun, dove, and careened toward the surface, breaching in a huge arc.
Kiora was in midair when she saw it: an expanse of beach that was #emph[wrong] , all fine gray dust, spongy and brittle—
She twisted to look, hit the water at a strange and stinging angle, and forced her way back to the surface. The beach looked wrong. It sounded wrong, too, each wave dissipating against it with a hiss and leaving the sand—if that was what it was—completely, impossibly dry. She dove, plucked a crab from the surf, and climbed onto the rocky shore near the dead beach.
"Sorry, friend," she said, and tossed the crab onto the unnatural gray beach. The crab righted itself, stood tall in a threatening display, and scuttled back into the water.
Satisfied that the stuff wasn't going to instantly kill her, Kiora stepped out onto the beach. The texture was fine, more dust than sand, and she could feel it draw the moisture from her feet. What had been solid stones were now pitted and crumbling lumps. Was this what the Eldrazi were doing to Zendikar?
A gust of wind whipped up puffs of the dust. Kiora's body reacted as though she were underwater—clearlids closed, lungs shut off, gills open. She spat in disgust and dove back into the sea, blinking.
She imagined that grit circulating through the ocean, clogging everything, until life became impossible.
Kiora gripped the bident and focused her will into it. Slowly, as she floated there, her senses expanded. Tides and currents, continental shelves and underwater vents, algal blooms and anoxic zones . . . she felt them all, stretching out around her, like the fingers of her own hand. The vile beach behind her was a great dead weight, a hole in her awareness.
Along the shore and even out on the sea bottom, in the open ocean, she could feel more dead places, robbed of all life by the encroachment of the Eldrazi. Eldrazi in the oceans! Bad enough when they'd attacked dry land. Now they had taken to the water, swimming through her ocean, sapping the life out of it, scraping away at the sea bottom. She could #emph[feel] them.
But the Eldrazi weren't the only things out there. She couldn't sense them, but the merfolk of Zendikar were still alive out there, still fighting. They had to be.
Kiora swam away from the lifeless shore and turned northward to follow the coast, looking for any sign of habitation.
#figure(image("007_Home Waters/02.jpg", width: 100%), caption: [Kiora, Master of the Depths | Art by Jason Chan], supplement: none, numbering: none)
In some places, Zendikar was as it had always been. In others, it was a blighted wasteland. Merfolk settlements sat abandoned on the coastal plain, swallowed by seaweed or reduced to shifting, lifeless ruins choked by dust. Kiora cruised low over the first few to look for survivors, but found only small Eldrazi probing the ruins, sifting through the rubble, looking for gods knew what.
#emph[The gods do know what] , she thought. Ula, Cosi, and Emeria—the gods of Zendikar's merfolk, since unmasked as the Eldrazi titans Ulamog, Kozilek, and Emrakul. Were they gods? Did they have a plan for Zendikar? Or were they just mindless beasts, consuming without thought or purpose?
After spotting the Eldrazi poking around the ruins, she kept well above the abandoned settlements. Looking for unlikely survivors wasn't worth being caught unawares in tight confines.
As the sun sank low in the sky, she found a cave high on a cliff face to stay the night. With the last of her flagging strength, she called a giant octopus from Zendikar's depths. It lifted her up to the cave, then settled in to guard her against Eldrazi.
Beyond the narrow opening was an open cavern lit by a skylight. The chamber was worked stone, and at the far end stood an altar to the Three.
#figure(image("007_Home Waters/03.jpg", width: 100%), caption: [Shrine of the Forsaken Gods | Art by Daniel Ljunggren], supplement: none, numbering: none)
She had traveled with her tribe to an altar very much like this one more than once, to lay offerings at the feet of uncaring stone gods. The supplicants brought hedron shards and land-fruit for Emeria, shells and pearls for Ula—and nothing for Cosi.
She and Turi had snuck back in the night, to leave Cosi knotted ropes and whisper secrets in his ear, and his altar was never bare when they arrived. They'd been children, offering their devotion to the forbidden god just for the thrill, the sense of transgression. She'd wondered even then how many of her elders had done the same in their youth—and how many had never stopped.
No one worshiped Cosi. Everyone knew that. The adults refused to listen to the stories about him—not, she learned later, because the stories were childish, but because they were blasphemous, and it was shameful to hear them. So why had they let anyone tell the children those stories? Why not stick to the pious stories, the daytime stories, of the three gods creating water, earth, and sky? Why tell stories that made the gods seem foolish?
Why build statues of Cosi at all?
A shiver went through her. The gods' gazes were blank, pitiless. It would be easy, all too easy, to revere them still, to think that the monstrosities that had risen really #emph[were] gods, worthy of worship. It would be easy . . . except that she remembered the stories of Cosi stealing Emeria's robes, or tricking Ula into swallowing a stone. She remembered sitting, shivering, on that moonlit beach, snickering at the hubris of the gods, the warm bodies of her kin quaking with laughter beside her, relentlessly mortal and alive.
Those stories had taught her not to fear gods . . . nor to trust them.
Her childhood, she had come to understand, had been a quiet battleground. The respectable merfolk of the world would prefer to wipe the worship of Cosi from existence, to forget the trickster god entirely. But his worshipers, secret and otherwise, would never let that happen. If they wanted to build statues of Cosi, to leave him things, to tell the children heretical stories . . . who was going to stop them? A trickster could make the tribe's troubles disappear in the night, now and then. But they could do far worse than that, too, if anyone tried to stop them. And there might be a trickster in any tribe.
Other cultures did not tell children stories like this—about mocking tradition and defying the gods. But other cultures did not have Cosi. Cosi had kept vigil. His tricksters made sure they remembered that even gods were fallible. How many would have turned to the monsters' side, or given up all hope, or simply gone mad when the Eldrazi rose, if not for those stories? Had that been the point all along? Or had they just gotten lucky?
Slowly, holding her breath without meaning to, she walked up to the statues of the Three. She looked up at them, towering above her. And she spit in Ula's blank, stupid face.
"You do not reign here," she said, her voice echoing off of damp stone. "Not now. Not ever."
Nothing happened. Nothing changed. There was only spit and stone and silence.
Kiora snorted, then curled up to sleep beneath the statue of Cosi.
#emph[The only honest god] , she thought. #emph[We always knew you were a liar.]
Under the stony eyes of false gods, clutching her stolen weapon, Kiora found uneasy sleep.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
It was late the following day when she found her people.
She saw the Eldrazi first, swarming in the water and swooping down from the sky. They'd surrounded a school of merfolk and herded them away from the shore.
Kiora gripped the bident and sped up.
#figure(image("007_Home Waters/04.jpg", width: 100%), caption: [Drowner of Hope | Art by <NAME>k], supplement: none, numbering: none)
There were perhaps a hundred merfolk, swimming in tenuous formation. Aquatic Eldrazi—Ulamog's lineage, from the look of them, with featureless, bone-white heads and masses of writhing tentacles—had gotten between them and the shore. There were soldiers among the merfolk, keeping the Eldrazi at bay with nets and spears, but the creatures were picking off stragglers. One of the Eldrazi grabbed a merfolk and squeezed. Then it relaxed its tentacles, but instead of a corpse, all that came out was a billowing cloud of that awful dust. Kiora shuddered.
She called to the great creatures of the deep—no need to summon, not when Zendikar would offer up allies freely. She called, and heard them answer. In the meantime: the bident. Finally!
She reached out, took hold of some nameless strand of water, and flicked the bident. A vortex formed near one of the Eldrazi, sending it tumbling. Tricky. She tried again, a bigger flick, and sucked another Eldrazi into the deeps. She laughed, bubbling. Oh, yes. This was good. But the bigger Eldrazi wouldn't go down so easily.
More vortexes—and then her allies were there, a few giant octopuses and a great gnarled serpent. They set to work, swiping up the smaller Eldrazi and wrestling with the larger ones. Meanwhile, the merfolk took advantage of her distraction to swim for shore, the soldiers among them hanging back to cover the retreat.
One of her octopuses fell, too many of its arms worn through. Another grappled with the largest of the Eldrazi, rolling and pitching through the water. Suckered tentacles intertwined with unnatural sinewy ones, a massive ball of flesh and fury that kicked up enough sediment to obscure the combatants. The first of the merfolk reached the shore, but if that big Eldrazi bested her octopus . . .
It needed help. She swam toward shore, channeling power through the bident. It glowed pleasingly. She felt the octopus surge, filled with the strength of the deep. She felt her way through the murky waters to shore and stood, triumphant, as the octopus squeezed the last trace of false, unsettling life out of the big Eldrazi.
#figure(image("007_Home Waters/05.jpg", width: 100%), caption: [Tightening Coils | Art by <NAME>], supplement: none, numbering: none)
By the time she was finished and the wounded octopus slithered back into the depths, the beach was full of merfolk refugees. Not a hundred. But nearly. The survivors spread across the beach, huddled in tight-knit groups. It was a hodgepodge of tribes, and even though they were in her home waters, all the faces she saw were strangers.
Kiora sat down heavily on a rock apart from the main group, laying the bident across her knees. No one had thanked her, but she didn't begrudge it. They were busy tending their wounds and counting the missing. And who was she, to them? A stranger with a strange weapon.
"Kiora!" cried a voice from the throng.
She stood up.
A young woman shouldered her way past groups of survivors, eyes bright. She was laden with packs of scrolls.
Turi!
#figure(image("007_Home Waters/06.jpg", width: 100%), caption: [Coralhelm Guide | Art by <NAME>], supplement: none, numbering: none)
She had just enough time to move the bident aside before the younger merfolk enveloped her in an embrace worthy of an octopus.
Turi turned to the survivors behind her, arms still wrapped around Kiora.
"It's her!" shouted Turi. "My sister! I told you she'd come back!"
Kiora rolled her eyes, still smiling. "What tales have you been spinning about me, little fish?"
Turi held her at arm's length and grinned.
"Only true things!" said Turi. "I told them my sister's been to places they've never even heard of, and she brings me treasures. And no matter how long she's been gone, she always comes back, even the time I saw her get eaten by a serpent with my own eyes."
Kiora shuddered at that memory, years distant. Turi made light of it now, but it had been the most horrible moment in their young lives. They'd been exploring too far out, at Kiora's urging—past the edge of the continental shelf—when a serpent had cruised up out of the darkness to swallow them. Kiora had darted out in front of it, got its attention, and shouted for her sister to swim hard and not look back.
#figure(image("007_Home Waters/07.jpg", width: 100%), caption: [Shoal Serpent | Art by <NAME>], supplement: none, numbering: none)
Turi had looked anyway, and her panicked face was the last thing Kiora had seen before the serpent's jaws closed around her and the world dissolved, her Planeswalker spark igniting in a moment of boiling panic. It had been months before she'd found her way back to Zendikar and her people. The revelation that there were other worlds than hers paled in comparison to the certainty that she hadn't done enough to save Turi. When she'd finally gotten back, she'd found Turi stick-thin and glassy-eyed, wasting away, killing herself with guilt at Kiora's sacrifice.
They'd made a pact after that. Kiora had promised to come back, and Turi had promised to wait for her.
"And they believed you?"
"Well . . ."
Kiora hugged her sister again. "I'll see what I can do. I wouldn't want to let you down."
Turi examined the bident.
"Is that for me?"
Kiora often brought her trinkets from other worlds. On this trip, she hadn't had the time.
"No!" said Kiora, pulling it away with a smile. "I stole it fair and square."
"You #emph[stole ] it? From who?"
Kiora grinned.
"A sea god," she said. "A real sea god."
Turi stuck her tongue out at Kiora.
"It's true!" said Kiora, holding up a hand. "Cosi take me if I lie."
Turi paled. A couple of nearby merfolk stared.
"Kiora," said Turi quietly. "People don't . . . do that anymore. Swear by the gods."
Kiora cocked her head.
"Why not?" she asked, at full volume. "They'll blaspheme against gods, but not against monsters?"
"Please," said Turi, through gritted teeth. "Some of these people have #emph[seen] <NAME>. Before he left. Lost family and homes to him. Think about how they feel."
"Left?"
Turi groaned—#emph[not the point!] —but she surely knew better than to stand in the way of her sister's relentless curiosity.
"No one's seen him in months," she said. "Or Emrakul. Only Ulamog. Some people are saying the other two have gone back to wherever they came from."
Kiora frowned. Was that possible? Could they have . . . left?
"I'll believe it when I see it," she said. "What about our tribe?"
Turi hugged herself, suddenly looking very young.
"I don't know," she said. "I was studying at Sea Gate—"
"Studying?" said Kiora. "You?"
"I #emph[like] learning," said Turi, with wounded pride.
"So do I," said Kiora. "That's why I travel."
Kiora hadn't meant it to sting, but Turi flinched.
"So you were at Sea Gate," said Kiora, more gently. "Then what?"
"The Eldrazi," said Turi. Her eyes were distant. "They overran the place. I was lucky to get away. Not . . . not everyone did. I joined up with this group to try to get home. On our way out of Sea Gate, we saw Ulamog in the distance."
#figure(image("007_Home Waters/08.jpg", width: 100%), caption: [Ulamog, the Ceaseless Hunger | Art by Michael Komarck], supplement: none, numbering: none)
"Ulamog is at Sea Gate?"
Wrong question. She knew it was the wrong question. But she had to know, damn it!
"I don't care where Ulamog is!" shouted Turi. "I'm trying to get #emph[home] , Kiora! To our family. Do you even care what's happened to them?"
Now the others nearby looked away, pretending not to hear. Nice of them.
Kiora put her hands on Turi's shoulders.
"Little sister," she said. "I knew what was happening here. I worried for you the whole time I was away—for everyone, but especially you. You don't know what it means to me to see you well."
"Yes I do," said Turi quietly. "Every time you leave, I wonder if you'll come back. And I know that if something ever does happen to you, I'll never find out. I'll never be able to follow you."
"If I could take you with me, I would."
"No," said Turi, not unkindly. "You wouldn't. You'd want me to stay here. Stay safe. Wouldn't you?"
"Nowhere on Zendikar is safe," said Kiora. "Not now. That's why I'm not concerned about finding the tribe. That's why I'm headed for Sea Gate. If nobody stops Ulamog, everyone will die, no matter where they are."
#figure(image("007_Home Waters/09.jpg", width: 100%), caption: [Titan's Presence | Art by Slawomir Maniak], supplement: none, numbering: none)
Too loud. People turned to look.
"Back to Sea Gate?" said Turi. "No."
"Kiora, is it?" asked a gruff voice, interrupting what was obviously a private moment. Lout.
Kiora disentangled herself from Turi and turned to the stranger. He was old and scarred, with the darkened scales of one who'd spent too long away from water. His accent sounded Sejiri, and he spoke like someone who expected to be listened to even so far from home. Kiora immediately disliked him.
"That's me," she said, with what she hoped was grating cheerfulness.
"I am Yenai," said the old merfolk. "Thank you for your assistance."
#figure(image("007_Home Waters/10.jpg", width: 100%), caption: [Sea Gate Loremaster | Art by Dave Kendall], supplement: none, numbering: none)
"No trouble at all," said Kiora. "We're all on the same side now. Aren't we, Sejiri?"
Yenai looked pained, though she wasn't sure why. Merfolk ethnic divisions bred rivalry, not hatred. Had that changed?
"Of course," he said. "I hope we're traveling in the same direction as well."
"Depends," said Kiora. "I'm going to Sea Gate."
It was true. It hadn't been, a few minutes ago. But if that was where Ulamog was, she wasn't going to waste time hiding somewhere else.
"We've just come from Sea Gate," said Yenai. "We're not going back."
"That's a shame," said Kiora. "I suppose I'll take my sister and my sea monsters and go."
"Kiora, don't be stupid!" said Turi. "We're talking about a titan. A god. You can't stand up to that. Kozilek and Emrakul are gone. Maybe—maybe Ulamog will go as well. Maybe they'll all leave us alone. Throwing yourself in his path won't do any good."
"There's no shelter at Sea Gate," said Yenai.
He climbed onto a rock, letting his voice grow louder.
"Our plan hasn't changed. We're heading down the coast, away from the worst of the swarm. Away from Ulamog. Then, though the journey will be long and arduous, we know where we must go."
He turned and looked out over the great, wide ocean. What an idiot.
#figure(image("007_Home Waters/11.jpg", width: 100%), caption: [Island | Art by Vincent Proce], supplement: none, numbering: none)
"Across the sea, to Murasa. We've heard it's better there. It can't be worse."
There were nodding heads in the assembled crowd. One of them, to Kiora's frustration, was Turi's.
"A lovely speech," said Kiora. "You've got quite a voice. A storyteller's voice, in fact."
Yenai glared at her.
"Do you know any Cosi stories?" asked Kiora.
Yenai's eyes widened.
"How dare you—"
"You know," said Kiora. "Cosi stories. Like the one about Ula and the clam. Or the time Emeria mistook a jellyfish for the moon . . ."
"Blasphemy and mockery," spat Yenai. "Turi, you didn't mention that your sister was a trickster. It would have saved us some misspent hope."
"She's not a trickster," said Turi, though she looked far from certain.
Kiora wasn't one of Cosi's devoted cultists. Not really. She was just a mischievous soul who'd never quite grown out of thumbing her nose at the gods.
"It's fine," she said. "If you don't know any Cosi stories, you should have just said so."
Turi gripped her arm.
"Kiora, stop."
Kiora shrugged out of her grip and walked out into the surf, letting the bident's points trail in the water behind her. All those currents spread out like threads. She tugged on one and felt it move.
"I know a Cosi story," she said. "It's about the time Cosi taught a mortal how to steal Ula's spear."
She walked back up the beach, dragging the bident and the sea behind her.
"The mortal took the spear and ran. And when Ula came looking for his weapon . . ."
The crowd was silent, attentive—though whether rapt or furious, Kiora could not say.
". . . the mortal spat in Ula's eye."
A great wave broke over and around her, slapping against the beach but parting around the assembled merfolk so it did no more than tickle their toes, even as it thundered past them, up the beach, to roar against the rocks. She even spared Yenai from the wave, though she was sorely tempted to let it bowl him over and carry him and his fragile dignity somewhere else.
"I'm not going to wait around in some hole, or risk my life on a trek across the sea, while the Eldrazi devour the world," she said, over the rush of receding water. "I'm going to Sea Gate. I'm going to stand and fight."
She raised the bident. There was silence.
"Well?"
Around her, dozens of merfolk shook their heads, eyes wide.
"No," said Yenai. "You're out of your mind."
Kiora turned to Turi.
"Kiora, #emph[no] ," said Turi. "I can't go back there. I can't. Please. Don't."
"I have to," said Kiora. "You know I do."
Turi's lip trembled.
"I just got you back," she said. "We just found each other again, and I thought . . ."
Kiora gathered her sister in a long, warm hug.
"I'll come back," said Kiora in Turi's ear. "I promise."
Old words, well worn.
"I'll wait for you," said Turi.
Kiora stepped away then, into the surf, and began calling a serpent. If she wanted to get to Sea Gate before Ulamog hit land and rendered most of her assets moot, she'd need to hurry.
And half a dozen of the merfolk quietly came and stood beside her.
Yenai watched them go, crestfallen. He had to know she'd just pulled away most—maybe all—of the devotees of Cosi in his little troop. Perhaps there'd be less trouble with them gone. Perhaps. But perhaps there'd be trouble only tricksters could solve, and he—and Turi—would have to get by without them.
"My sister," said Kiora, quietly. "She's going with Yenai. I need someone to look after her. Please."
A tall woman nodded and hung back. She deserved blessings for that, though Cosi gave none.
Kiora turned back toward the beach, where Turi, Yenai, Turi's nameless protector, and the others stood watching, with expressions ranging from sorrowful to angry to simply exhausted.
"Good fortune," said Kiora. Fortune, Cosi's domain. Even though she really did wish them well, she couldn't resist needling.
Then a serpent rolled up onto the beach, and she and her little band of tricksters climbed onto its back. As the beach and the surf and the upturned faces of Turi and Yenai and the others fell away, Kiora waved a quick salute before the serpent's strokes carried them away.
She learned her companions' names, heard their grim tales of how life on Zendikar had changed for the worse. She learned that <NAME> and Sejiri were gone, and felt just the slightest bit sorry for reminding Yenai of his lost homeland.
Then she told them the tale of how she stole the bident, and swore it was true, every word of it.
Sea Gate beckoned. Ulamog awaited. The serpent swam.
And the sea resounded with the laughter of tricksters.
|
|
https://github.com/Toniolo-Marco/git-for-dummies | https://raw.githubusercontent.com/Toniolo-Marco/git-for-dummies/main/slides/main.typ | typst | #import "@preview/touying:0.5.2": *
#import themes.university: *
#import "@preview/cetz:0.2.2"
#import "@preview/fletcher:0.5.1" as fletcher: node, edge
#import "@preview/ctheorems:1.1.2": *
#import "@preview/numbly:0.1.0": numbly
#import "/slides/components/code-blocks.typ": code-block, window-titlebar
#import "/slides/components/utils.typ": n_pagebreak
// Code-blocks Rule
#show raw.where(block: true): it => code-block(
grid(rows:2,row-gutter: 0pt,
// always keep the dots on the left!
grid.cell(align: left)[
#window-titlebar
],
block.with(
fill: rgb("#1d2433"),
inset: 8pt,
radius: 5pt,
)(
text(fill: rgb("#a2aabc"), it)
)
)
)
// Inline Code Rule
#show raw.where(block: false): it => box(
fill: rgb("#1d2433"),
inset: 5pt,
baseline: 25%,
radius:2pt,
text(fill: rgb("#a2aabc"), it
)
)
#set quote(block: true)
#show quote: set align(center)
#show link: underline
// cetz and fletcher bindings for touying
#let cetz-canvas = touying-reducer.with(reduce: cetz.canvas, cover: cetz.draw.hide.with(bounds: true))
#let fletcher-diagram = touying-reducer.with(reduce: fletcher.diagram, cover: fletcher.hide)
#show: university-theme.with(
aspect-ratio: "16-9",
// config-common(handout: true),
config-info(
title: [Git for Dummies],
subtitle: [Slides],
author: [<NAME>],
date: datetime.today(),
institution: [Università degli Studi di Trento],
// logo: emoji.crab,
),
)
#set text(size: 18pt)
#set heading(numbering: numbly("{1}.", default: "1.1"))
// align sub titles near to main slide title
#show heading.where(level: 3): it =>[
#set align(top+left)
#it
]
#set align(horizon) //align vertically each slide content
#title-slide()
== Outline <touying:hidden>
#components.adaptive-columns(outline(title: none, indent: 0em))
= Theory
== Introduction
#include "./theory/introduction.typ"
== Commit
#include "./theory/commit.typ"
== Branch
#include "./theory/branch.typ"
== Remote Repository
#include "./theory/remote-repo.typ"
== Pull Request
#include "./theory/pull-request.typ"
== Fork
#include "./theory/fork.typ"
= Practice
== Configuration<config>
#include "./practice/configuration.typ"
== Init<init>
#include "./practice/init.typ"
== Clone
#include "./practice/clone.typ"
== Staging
#include "./practice/staging.typ"
== Checkout
#include "./practice/checkout.typ"
== Analysis
#include "./practice/status-analysis.typ"
== Commit
#include "./practice/commit.typ"
== Branch
#include "./practice/branch.typ"
== Merge
#include "./practice/merge.typ"
== Remote
#include "./practice/remote.typ"
= Advanced
#slide[
#bibliography("refs.yaml", style: "institute-of-electrical-and-electronics-engineers", title: "References")
] |
|
https://github.com/soul667/typst | https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/polylux/helpers.typ | typst | #import "logic.typ"
#let sections-state = state("polylux-sections", ())
#let register-section(name) = locate( loc => {
sections-state.update(sections => {
sections.push((body: name, loc: loc))
sections
})
})
#let current-section = locate( loc => {
let sections = sections-state.at(loc)
if sections.len() > 0 {
sections.last().body
} else {
[]
}
})
#let polylux-outline(enum-args: (:), padding: 0pt) = locate( loc => {
let sections = sections-state.final(loc)
pad(padding, enum(
..enum-args,
..sections.map(section => link(section.loc, section.body))
))
})
#let polylux-progress(ratio-to-content) = locate( loc => {
let ratio = logic.logical-slide.at(loc).first() / logic.logical-slide.final(loc).first()
ratio-to-content(ratio)
})
#let last-slide-number = locate(loc => logic.logical-slide.final(loc).first()) |
|
https://github.com/maxlambertini/tomorrow-cv | https://raw.githubusercontent.com/maxlambertini/tomorrow-cv/main/template.typ | typst | #let contact(text: "", link: none) = {
(text: text, link: link)
}
#let subSection(title: "", titleEnd: none, subTitle: none, subTitleEnd: none, content: [], textContent: none) = {
(title: title, titleEnd: titleEnd, subTitle: subTitle, subTitleEnd: subTitleEnd, content: content ,textContent : textContent)
}
#let textSection(title: "", content: "") = {
(title:title, content:content)
}
#let section(title: "", content: subSection(), textContent : none) = {
(title: title, content: content, textContent : textContent)
}
#let project(
theme: rgb("#C03452"),
name: "",
email: none,
title: none,
contact: ((text: [], link: "")),
skills: (
languages: ()
),
about: (title:"", content: ""),
main: (
(title: "", content: [])
),
titleFont: "Chivo",
sidebar: (),
body) = {
//fill: theme,
let backgroundTitle(content) = {
align(center, box(
fill: theme.lighten(97%),
text(theme.darken(25%), font:titleFont,
size: 1.25em, weight: "bold",
upper(content)),
width: 1fr,
inset: (
top: 0.35em,
bottom: 0.45em,
rest: 0.3em
),
stroke: (
top: none,
left: none,
right: none,
bottom: (paint: theme, thickness: 2pt, dash: "dotted"),
)
)
)
}
let secondaryTitle(content) = {
text(weight: "bold", size: 1.125em, font:titleFont, upper(content))
}
let italicColorTitle(content) = {
text(weight: "bold", style: "italic", font:titleFont, size: 1.125em, theme, content)
}
let italicColorSimpleTitle(content) = {
text(weight: "bold", style: "italic", size: 1.125em, theme, content)
}
let formattedName = block(upper(text(2.5em, font: titleFont, weight: "bold", theme, name)))
let formattedTitle = block(upper(text(1.8em, gray.darken(50%), title)))
let titleColumn = align(center)[
#formattedName
#formattedTitle
#v(0.5em)
#contact.map(c => {
if c.link == none [
#c.text
] else [
#underline(link(c.link, text(theme, c.text)))
]
}).join(" - ")
]
let contactColumn = align(center)[
#image("max.png", width: 50%)
]
grid(
columns: (1fr, 2fr),
column-gutter: 6mm,
contactColumn,
titleColumn,
)
set par(justify: true)
let formattedLanguageSkills = [
#text(skills.languages.join(" • "))
]
let createLeftRight(left: [], right: none) = {
if (right == none) {
align(start, text(left))
} else {
grid(
columns: (2fr, 1fr),
align(start, text(left)),
align(end, right),
)
}
}
// let parseContentList(contentList) = {
// if contentList.format == "bulletJoin" [
// #text(contentList.content.join(" • "))
// ] else if contentList.format == "bulletList" [
// #contentList.content.map(c => list(c)).join()
// ]
// }
let parseSubSections(subSections) = {
subSections.map(s => {
[
#if s.textContent == none [
#if s.title != none [
#v(3pt)
#createLeftRight(
left: secondaryTitle(s.title),
right: if s.titleEnd != none {
italicColorSimpleTitle(s.titleEnd)
}
)
#if s.subTitle != none or s.subTitleEnd != none [
#text(
top-edge: 0.2em,
createLeftRight(
left: italicColorTitle(s.subTitle),
right: s.subTitleEnd
),
)
]
]
#s.content
] else [
#v(4pt)
#s.textContent
]
]
}).join()
}
let parseSection(section) = {
section.map(m => {
[
#backgroundTitle(m.title)
#parseSubSections(m.content)
]
}).join()
}
let parseTextSection(section) = {
[
#backgroundTitle(section.title)
#section.content
]
}
let aboutSection = parseTextSection(about)
let mainSection = parseSection(main)
let sidebarSection = parseSection(sidebar)
grid(
columns: (1fr, 2fr),
column-gutter: 6mm,
sidebarSection,
[
#aboutSection
#mainSection
],
)
// Main body.
set par(justify: true)
show: columns.with(3, gutter: 1.3em)
// body
} |
|
https://github.com/BeiyanYunyi/resume | https://raw.githubusercontent.com/BeiyanYunyi/resume/main/modules_zh/projects.typ | typst | #import "../brilliant-CV/template.typ": *
#cvSection("社区项目")
#cvEntry(
title: [炎上书屋],
society: [Vue 3#hBar()NaiveUI#hBar()UnoCSS#hBar()Prosemirror],
date: [2022.7 - 今],
location: [网文网站],
description: list(
[https://firebook.store],
[使用Vue 3+Vue Router构建网络文学网站],
[还原设计稿,独立开发,3个月交付],
[2人团队共同维护至今],
),
)
#cvEntry(
title: [BookExchange],
society: [Vue 3#hBar()NaiveUI#hBar()Mongoose#hBar()Express#hBar()Drizzle],
date: [2022.4 - 今],
location: [书本交换活动平台全栈项目],
description: list(
[https://github.com/BeiyanYunyi/BookExchange],
[使用Vue 3+NaiveUI构建前端],
[使用Express+Mongoose构建后端],
[将Mongoose迭代为Drizzle,MongoDB迭代为SQLite],
[独立开发,14天交付],
[维护至今],
),
)
#cvEntry(
title: [Sodesu],
society: [Solid.js#hBar()UnoCSS],
date: [2023.1 - 今],
location: [Waline 评论系统前端],
description: list(
[https://github.com/BeiyanYunyi/Sodesu],
[使用Solid.js+UnoCSS复刻原前端],
[维护至今],
),
)
#cvEntry(
title: [bilibili subscriber],
society: [Flutter#hBar()GetX#hBar()Isar#hBar()Dart],
date: [2023.1 - 2023.5],
location: [Flutter练手项目,bilibili第三方关注工具],
description: list(
[https://github.com/BeiyanYunyi/bilibili_subscriber],
[独立开发],
[使用Isar作为数据库],
),
)
#cvEntry(
title: [Icalingua],
society: [Vue 2#hBar()Element#hBar()knex#hBar()MongooDB#hBar()SQLite#hBar()PostgreSQL#hBar()MySQL#hBar()Redis#hBar()Electron],
date: [2021.7 - 2022.1],
location: [第三方QQ客户端],
description: list(
[https://github.com/Icalingua-plus-plus/Icalingua-plus-plus],
[使用knexjs构建第三方QQ客户端数据库],
[实现了除MongoDB外四个数据库的存储功能],
),
)
#cvEntry(
title: [五十音図],
society: [Vue 3#hBar()TailwindCSS],
date: [2022.3],
location: [Vue 3练手项目,日语五十音图与小测试],
description: list(
[https://github.com/BeiyanYunyi/GoJuuOnZu],
[使用Vue 3+TailwindCSS构建前端],
[独立开发,14天完成],
),
)
#cvEntry(
title: [Discourse-RN],
society: [React Native#hBar()Expo],
date: [2021.8 - 2021.9],
location: [React Native练手项目,Discourse论坛第三方APP],
description: list([https://github.com/BeiyanYunyi/discourse-RN], [独立开发]),
)
|
|
https://github.com/ivaquero/book-control | https://raw.githubusercontent.com/ivaquero/book-control/main/14-线性二次型调节器.typ | typst | #import "@local/scibook:0.1.0": *
#show: doc => conf(
title: "线性二次型调节器",
author: ("ivaquero"),
header-cap: "现代控制理论",
footer-cap: "github@ivaquero",
outline-on: false,
doc,
)
= 一维动态规划
== 简单系统
考虑系统
$ x_([k+1]) = x_([k]) + u_([k]) $
其中
- 初始值:$x[0]=1$
- 目标值:$x[d]=0$
- 末端:$N=2$
于是,其代价函数可定义为
$
J = 1 / 2 underbrace(x^2[w], "末端代价") + 1 / 2 ∑_(k=0)^(N-1)(
underbrace(x^2_([k]),"运行代价") + underbrace(u^2_([k]), "输入代价")
)
$
== 极端策略
#block(
height: 11em,
columns()[
- 策略1:一步到位
- 输入代价
- $u[0] = -1$
- $u[1] = 0$
- 最终代价
- $x[1] = 0, x[2] = 0$
- $J = 1$
- 策略2:两步走
- 输入代价
- $u[0] = -0.5$
- $u[1] = -0.5$
- 最终代价
- $x[1] = 0.5, x[2] = 0$
- $J = 0.875$
],
)
== 最优策略
即,求$u^*[0], u^*[1]$,使$J$最小,采用逆向分级方法
- $k = 1→2$
$
J_(1→2) &= 1 / 2 x^2[2] + 1 / 2 x^2[1] + 1 / 2 u^2[1]\
&= 1 / 2 (x[1] + u[1])^2 + 1 / 2 x^2[1] + 1 / 2 u^2[1]
$
求导得
$ pdv(J_(1→2),u[1]) = x[1] + u[1] + u[1] = 0 $
有
$ u^*[1] = -1 / 2 x[1] $
于是
$ J^*_(1→2) = 3 / 4 x^2[1] $
#pagebreak()
进而得
$ J_(0→2) = J_(1→2) + 1 / 2(x^2[0] + u^2[0]) $
根据 Bellman 最优理论,若$J_(0→2)$最小,则子项$J_(1→2)$此时必为 最小。代入$J^*_(1→2)$和$x[1]$,可得
$ J_(0→2) = 3 / 4 (x[0] + u[0])^2 + 1 / 2 (x^2[0] + u^2[0]) $
求导得
$ pdv(J_(0→2),u[0]) = 3 / 2 (x[0] + u[0]) + u[0] = 0 $
此时
$ u^*[0] = -3 / 5 x[0] $
回代得
$ x[0] = 2 / 5, x[1] = 1 / 5 $
最终得
$ J_(min) = 0.8 $
= 线性二次型调节器
== 连续线性系统
对连续线性系统
$ dot(𝒙) = 𝑨 𝒙 + 𝑩 𝒖 $
若$𝒖 = -k 𝒙$,则
$ dot(𝒙) = (𝑨 - 𝑩 k)𝒙 = 𝑨_("cl") 𝒙 $
此时,可通过调整$k$来调整$𝑨_("cl")$的特征值,从而控制系统的稳定性。
对$𝒖$考虑,则需要引入最优化控制,其损失函数为
$ J = ∫_0^∞ (𝒙^(⊤) 𝑸 𝒙 + 𝒖^(⊤) 𝑹 𝒖) dd(t) $
这就得到了一个 LQR(linear quadratic regulator)问题。其中
- $𝒙^(⊤) 𝑸 𝒙 > 0$,类似惩罚项
- $𝒖^(⊤) 𝑹 𝒖$中,$𝑹$越大,$𝒖$的影响越大
== 离散线性系统
对离散线性系统
$ 𝒙_([k+1]) = 𝑨 𝒙_([k]) + 𝑩 𝒖_([k]) $ <sys-quad>
#pagebreak()
其代价函数可化为二次型
$
J &= 1 / 2 underbrace((𝒙_([N]) - 𝒙_d_([N]))^(⊤) 𝑺(𝒙_([N]) - 𝒙[d]), "末端代价") \
&+1 / 2∑_(k=0)^(N-1) (underbrace((𝒙_([N]) - 𝒙[d])^(⊤) 𝑸 (𝒙_([N]) - 𝒙[d])^(⊤), "运行代价") + 𝒖^(⊤)_([k]) 𝑹 𝒖_([k]))
$
调节目标
$ 𝒙_d = 𝟎 = vec(delim: "[", 0, 0, ⋮,0) $
则
$ J = 1 / 2 𝒙_([N])^(⊤) 𝑺 𝒙_([N]) + 1 / 2 ∑_k^(N-1) (𝒙_([k])^(⊤) 𝑸 𝒙_([k]) + 𝒖^(⊤)_([k]) 𝑹 𝒖_([k])) $
此时,$𝑺, 𝑸$为半正定对角阵,$𝑹$为正定对角阵。
== 逆向分级
$k = N$时
$ J_(N→N) = 1 / 2 𝒙_([N])^(⊤) 𝑺 𝒙_([N]) $
此时$J$为最优末端代价,因为此时无法再产生变化。令$𝑺 = P_([0])$,即
$ J_(N→N) = 1 / 2 𝒙_([N])^(⊤) P_([0]) 𝒙_([N]) $
$k = N-1$时
$
J_(N-1→N) &= 1 / 2 𝒙_([N])^(⊤) 𝑺 𝒙_([N]) + 1 / 2 𝒙_([N-1])^(⊤) 𝑸 𝒙_([N-1]) + 1 / 2 𝒖^(⊤)_([N-1]) 𝑹 𝒖_([N-1])\
&= J_(N→N) + 1 / 2 𝒙_([N-1])^(⊤) 𝑸 𝒙_([N-1]) + 1 / 2 𝒖^(⊤)_([N-1]) 𝑹 𝒖_([N-1])
$
以此类推
$
J_(N-2→N) = J_(N-1→N) + 1 / 2 𝒙_([N-2])^(⊤) 𝑸 𝒙_([N-2]) + 1 / 2 𝒖^(⊤)_([N-2]) 𝑹 𝒖_([N-2])
$
又由@eqt:sys-quad,可得
$ 𝒙_([N]) = 𝑨 𝒙_([N-1]) + 𝑩 𝒖_([N-1]) $
于是,令一阶导数
$ pdv(J_(N-1→N), 𝒖_([N-1])) = 0 $
得
$
𝒖^*_([N-1]) = -(𝑩^⊤ P_([0])𝑩 + 𝑹)^(-1) 𝑩^⊤ P_([0]) 𝑨 𝒙_([
N-1
]) = -underbrace(F_([N-1]), "feedback")underbrace(𝒙_([N-1]),"Gain")
$
#pagebreak()
又二阶导数
$ pdv(J_(N-1→N), 𝒖_([N-1]), 2) = underbrace((𝑩^⊤ P_([0])𝑩)^⊤, "≥0") + underbrace(𝑹^⊤, ">0") $
故$𝒖^*$为最小值。进一步得
$ J_(N-1→N) = 1 / 2 𝒙_([N-1])^(⊤) P_([1]) 𝒙_([N-1]) $
其中
$ P_([1]) = (𝑨 - 𝑩 F_([N-1]))^⊤ P_([0])(𝑨 - 𝑩 F_([N-1])) + F_([N-1])^⊤ 𝑹 F_([N-1]) + 𝑸 $
类推得
$ J_(N-k→N) = 1 / 2 𝒙_([N-1])^(⊤) P_([k]) 𝒙_([N-1]) $
其中
$
cases(
P_([k]) = (𝑨 - 𝑩 F_([N-k]))^⊤ P_([k-1])(𝑨 - 𝑩 F_([N-k])) + F_([N-k])^⊤ 𝑹 F_([N-k]) + 𝑸,
F_([N-k]) = (𝑩^⊤ P_([0])𝑩 + 𝑹)^(-1) 𝑩^⊤ P_([k-1]) 𝑨,
𝒖^*_([N-k]) = -F_([N-k]) 𝒙_([N-k])
)
$
|
|
https://github.com/ShapeLayer/ucpc-solutions__typst | https://raw.githubusercontent.com/ShapeLayer/ucpc-solutions__typst/main/lib/i18n/ko-kr.typ | typst | Other | #let make-prob-meta = (
difficulty_prefix: "출제진 의도 — ",
difficulty_postfix: "",
author: "출제자",
authors: "출제자",
submitted_prefix: "제출 ",
submitted_postfix: "회",
passed_prefix: "정답 ",
passed_postfix: "건",
ac-ratio_prefix: "정답률: ",
ac-ratio_postfix: "%",
first-solver_prefix: "최초 해결: ",
first-solver_postfix: "",
online-open-contest: "온라인 오픈 콘테스트",
offline-onsite-contest: "오프라인 온사이트 대회",
first_solved_at_prefix: "+",
first_solved_at_postfix: "분",
)
#let make-prob-overview = (
problem: "문제",
difficulty: "의도한 난이도",
author: "출제자",
)
#let make-problem = (
make-prob-meta: make-prob-meta
)
#let problem = make-problem
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/gentle-clues/0.5.0/docs.typ | typst | Apache License 2.0 | #import "@local/gentle-clues:0.4.1": *
#gc_header-title-lang.update("en")
#set text(font: "Roboto")
= Gentle clues for typst
Add some beautiful, predefined admonitions or define your own.
#clue(title: "Example")[
```typst
#clue(title: "Example")[Test content.]
```
#sym.arrow The default is a navy colored clue.
]
#info(title: "NEW v0.4.0",_color: gradient.linear(..color.map.crest))[
* Translations:*
- French language titles: `gc_header-title-lang.update("fr")`
*Colors:*
- Colored borders by default.
- Added support for gradients: `#clue(_color: gradient.linear(..color.map.crest))`
- *Breaking:* Removed string color_profiles.
*Task Counter*
- Added a Task Counter.
- Disable with `#gc_enable-task-counter.update(false)`
#set text(9pt)
#grid( columns: 4, gutter: 1em, task[Do], task[Do], task[Do])
]
#info(title: "Options")[
- Changing header title language with: `gc_header-title-lang.update("en")`
- Accepts `"en", "de"` or `"fr"` for the moment.
- define header inset: `#clue(header-inset: 0.5em)[]`
- define header title: `#clue(title: "MyTitle")[]`
- define custom color:
- `#clue(_color: red)[]`
- `#clue(_color: (stroke: teal, bg: teal.lighten(40%), border: red))[]`
- define the width: `#clue(width: 4cm)[]`
- define right border radius: `#clue(radius: 9tp)[]` #text(9pt, fill: gray)[(`0pt` to disable)]
- make clues break onto next page -> `breakable: true`
]
#success(title: "Clues can now break onto the next page")[
#lorem(80)
]
== Predefined
`abstract`, `summary`, `tldr`
#abstract[Make it short. This is all you need.]
`question`, `faq`, `help`
#faq[How do amonishments work?]
`note`, `info`
#note[It's as easy as
```typst
#note[Whatever you want to say]
```
]
`example`,
#example[Testing ...]
`task`, `todo`
#task[#box(width: 0.8em, height: 0.8em, stroke: 0.5pt + black, radius: 2pt) Check out this wonderfull admonishments!]
`error`, `failure`, `missing`
#error[Something did not work here.]
`warning`, `attention`, `caution`,
#warning[Still a work in progress.]
`success`, `check`, `done`
#success[All tests passed. It's worth a try.]
`tip`, `hint`, `important`
#tip[Try it yourself]
`conclusion`,`idea`
#conclusion[This package makes it easy to add some beatufillness to your documents]
`reminder`
#memo[Leave a #emoji.star on github.]
`quote`
#quote[Keep it simple. Admonish your life.]
== Headless
just add `title: none` to any example
#info(title:none)[Just a short information.]
== Define your own
```typst
// Define it
#let ghost-admon(title: "Buuuuuuh", icon: emoji.ghost , ..args) = clue(color: purple, title: title, icon: icon, ..args)
// Use it
#ghost-admon[Huuuuuuh.]
```
#let ghost-admon(title: "Buuuuuuh.", icon: emoji.ghost , ..args) = clue(_color: gray, title: title, icon: icon, ..args)
#ghost-admon[Huuuuuuh.]
|
https://github.com/jamesrswift/pixel-pipeline | https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/src/math/aabb.typ | typst | The Unlicense | #import "vector.typ"
#let from-vectors(vecs, initial: none) = {
let bounds = initial
if type(vecs) == array {
for (i, pt) in vecs.enumerate() {
if bounds == none and i == 0 {
bounds = (low: pt, high: pt)
} else {
assert(type(pt) == array, message: repr(initial) + repr(vecs))
let (x, y,) = pt
let (lo-x, lo-y,) = bounds.low
bounds.low = (calc.min(lo-x, x), calc.min(lo-y, y))
let (hi-x, hi-y) = bounds.high
bounds.high = (calc.max(hi-x, x), calc.max(hi-y, y))
}
}
return bounds
} else if type(vecs) == dictionary {
if initial == none {
return vecs
} else {
return from-vectors((vecs.low, vecs.high,), initial: initial)
}
}
}
/// Get the size of an aabb as vector. This is a vector from the aabb's low to high.
///
/// - bounds (aabb): The aabb to get the size of.
/// -> vector
#let size(bounds) = {
return vector.sub(bounds.high, bounds.low)
} |
https://github.com/miliog/typst-penreport | https://raw.githubusercontent.com/miliog/typst-penreport/master/typst-penreport/helper/vuln.typ | typst | MIT No Attribution | #import "@preview/tablex:0.0.5": *
#import "cwe.typ": *
#import "severity.typ": *
#import "status.typ": *
#let vuln(
title: "",
target: "",
severity: Severity.Undetermined,
type: none,
status: Status.NotFixed,
recheck: false,
description,
remediation,
) = [
#heading(level: 2, title)
#locate(loc => [
#let vuln_data = (
title: title,
severity: severity,
type: type,
page: numbering("1.1", ..counter(page).at(loc)),
position: loc.position(),
)
#metadata(vuln_data)<data>
])
#tablex(
columns: (1fr, 1fr),
inset: 10pt,
stroke: (paint: gray, thickness: 0pt),
vlinex(start: 0, end: 1, x: 0, stroke: getSeverityInfo(severity).bg + 5pt),
vlinex(start: 0, end: 1, x: 1, stroke: getStatusInfo(status).bg + 5pt),
vlinex(start: 1, end: 2, x: 0, stroke: gray + 5pt),
vlinex(start: 2, end: 3, x: 0, stroke: rgb("#222255").lighten(50%) + 5pt),
align: left,
.. {
if status == Status.NotFixed and not recheck {
(
colspanx(2, cellx(fill: getSeverityInfo(severity).bg.lighten(75%))[
Severity: *#getSeverityInfo(severity).text*
]),
)
} else {
(cellx(fill: getSeverityInfo(severity).bg.lighten(75%))[
Severity: *#getSeverityInfo(severity).text*
],
cellx(fill: getStatusInfo(status).bg.lighten(75%))[
Status: *#getStatusInfo(status).text*
]
,)
}
},
colspanx(2, cellx(fill: gray.lighten(75%))[
Target: #target
]),
colspanx(2, inset: 0pt, cellx()[
#if type != none [
#let weakness = findWeaknessById(type)
#box(inset: 10pt, width: 100%, fill: rgb("#222255").lighten(75%))[
#link("https://google.com")[*CWE-#weakness.id: #weakness.name*]
]
#v(-15pt)
#box(inset: 10pt, fill: rgb("#222255").lighten(80%), width: 100%)[
#weakness.description
]
]
]),
)
#heading(level: 3, "Description", numbering: none)
#description
#heading(level: 3, "Remediation", numbering: none)
#remediation
#pagebreak(weak: true)
] |
https://github.com/maxlambertini/troika-srd-typst | https://raw.githubusercontent.com/maxlambertini/troika-srd-typst/main/template.typ | typst | // The project function defines how your document looks.
// It takes your content and some metadata and formats it.
// Go ahead and customize it to your liking!
#let leftMargin = locate(loc => if calc.even(loc.page()) { 1.5cm } else { 2.5cm })
#let rightMargin = locate(loc => if calc.even(loc.page()) { 2.5cm } else { 1.5cm })
#let project(title: "", authors: (), date: none, logo: none, cover: none, body) = {
// Set the document's basic properties.
set document(author: authors, title: title)
set page(numbering: "1", number-align: center)
set text(lang: "en", size: 9pt, font:"Averia Serif Libre")
set page(
margin: (
top: 1.6cm,
bottom: 2.0cm,
inside: 1.8cm,
outside: 2.2cm,
),
)
if cover != none {
set page(background: image(cover))
align(center)[
#v(2em, weak: true)
#block(text(fill: white, weight: 700, 10.75em, title))
#v(10em, weak: true)
#block(text(fill: white, weight: 700, 1.75em, "A science Fantasy RPG"))
]
pagebreak()
set page(background: none)
}
// Title row.
align(center)[
#v(2em, weak: true)
#block(text(weight: 700, 10.75em, title))
#v(10em, weak: true)
#date
]
// Author information.
pad(
top: 0.5em,
bottom: 0.5em,
x: 2em,
grid(
columns: (1fr,) * calc.min(3, authors.len()),
gutter: 1em,
..authors.map(author => align(center, strong(author))),
),
)
// logo
if logo != none {
align(center)[
#v(24pt)
#image(logo, width:33%)
#v(24pt)
]
}
// Main body.
set par(justify: true)
body
}
#let chapterLayout(title,numCol, content) = {
line(length: 100%, stroke: 2pt + gradient.linear(..color.map.rainbow))
title
v(18pt)
line(length: 100%, stroke: 2pt + gradient.linear(..color.map.rainbow))
v(30pt)
if numCol == 1 {
content
} else {
columns(numCol, gutter: 5mm, content)
}
} |
|
https://github.com/quarto-ext/typst-templates | https://raw.githubusercontent.com/quarto-ext/typst-templates/main/README.md | markdown | Creative Commons Zero v1.0 Universal | ## Typst Templates for Quarto
This repository provides Quarto custom formats for the core templates provided by the Typst team at <https://github.com/typst/templates>.
| Format | Usage |
|-------------------------|-----------------------------------------------|
| [IEEE](https://github.com/quarto-ext/typst-templates/tree/main/ieee) | `quarto use template quarto-ext/typst-templates/ieee` |
| [AMS](https://github.com/quarto-ext/typst-templates/tree/main/ams) | `quarto use template quarto-ext/typst-templates/ams` |
| [Letter](https://github.com/quarto-ext/typst-templates/tree/main/letter) | `quarto use template quarto-ext/typst-templates/letter` |
| [Fiction](https://github.com/quarto-ext/typst-templates/tree/main/fiction) | `quarto use template quarto-ext/typst-templates/fiction` |
| [Poster](https://github.com/quarto-ext/typst-templates/tree/main/poster) | `quarto use template quarto-ext/typst-templates/poster` |
| [Dept News](https://github.com/quarto-ext/typst-templates/tree/main/dept-news) | `quarto use template quarto-ext/typst-templates/dept-news` |
These formats are published under the [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) public domain license. |
https://github.com/typst-doc-cn/tutorial | https://raw.githubusercontent.com/typst-doc-cn/tutorial/main/src/basic/modulize-modules.typ | typst | Apache License 2.0 | #import "mod.typ": *
#show: book.page.with(title: "模块")
正如我们在《基础文档》中所说的,Typst为我们提供了脚本的便捷性。但是事实上,不写或少写脚本便能完成排版才是最大的便捷。无论我们会不会自己用脚本解决某个问题,我们总是希望Typst能够允许我们以一种优雅的方式#strike[复制粘贴]引入这些代码。理想情况下,当某位前辈为我们准备好了模板,我们可以只用两行代码便可完成排版的配置:
#```typ
#import "@preview/senpai-no-awesome-template.typ:0.x.x": *
#show: template.with(..)
```
模块便是为此而诞生的。Typst的模块(module)机制非常简单:每个文件都是一个模块并可以被导入。Typst模块将允许你:
+ 在本地工作区内,在多个文档之间共享你爱用的排版函数。
+ 将一份文档分作多个文件编写。
+ 通过本地注册或网络共享,使用外部模板或库。
本节将告诉你有关Typst的模块机制的一切。由于Typst的模块机制过于简单,本节将不会涉及很多需要理解的地方。故而,本节主要伴随讲解一些日常使用模块机制时所遇到的问题。
== 根目录
根目录的概念是Typst自0.1.0开始就引入的。
+ 当你使用`typst-cli`程序时,根目录默认为你文件的父目录。你也可以通过`--root`命令行参数手动指定一个根目录。例如你可以指定当前工作目录的父文件夹作为编译程序的根目录:
```bash
typst c --root ..
```
+ 当你使用VSCode的tinymist或typst-preview程序时,为了方便多文件的编写,根目录默认为你所打开的文件夹。如果你打开一个VSCode工作区,则根目录相对于离你所编辑文件最近的工作目录。
在早期,Typst就禁止访问*根目录以外的内容*。尽管扩大可访问的文件数量在某种程度上增进了便捷性,也意味着降低了执行Typst脚本的安全性。这是因为,根目录下所有的子文件夹和子文件都有机会被*你编写的或其他人编写(外部库)的Typst脚本访问*。
一个常见的错误做法是,为了共享本地代码或模板,在使用`typst-cli`的时候将根目录指定为系统的根目录。
- 如果你是Windows用户,则以下使用方法将有可能导致个人隐私泄露:
```bash
typst c --root C:\
```
并访问你系统中的某处文件。
```typ
#import "/Users/me/templates/book.typ": book-template
```
- 如果你是Linux或macOS用户,则以下使用方法将有可能导致个人隐私泄露:
```bash
typst c --root /
```
并访问你系统中的某处文件。
```typ
#import "/home/me/templates/book.typ": book-template
```
本节将介绍另外一种方式——通过在注册本地包在你的多个Typst项目之间共享代码。
== 绝对路径与相对路径
我们已经讲解过`read`函数和`include`语法,其中都有路径的概念。
如果路径以字符`/`开头,则其为「绝对路径」。绝对路径相对于根目录解析。若设置了根目录为#text(red, `/OwO/`),则路径`/a/b/c`对应路径#text(red, `/OwO/`)`a/b/c`。
#code(
```typ
#include "/src/intermediate/chapter1.typ"
```,
res: [我是`/OwO/src/intermediate/chapter1.typ`文件!],
)
否则,路径不以字符`/`开头,则其「相对路径」。相对路径相对于当前文件的父文件夹解析。若我们正在编辑#text(red, `/OwO/src/intermediate/`)`main.typ`文件,则路径`d/e/f`对应路径#text(red, `/OwO/src/intermediate/`)`d/e/f`。
#code(
```typ
#include "chapter2.typ"
```,
res: [我是`/OwO/src/intermediate/chapter2.typ`文件!],
)
== 「import」语法与「模块」
Typst中的模块概念相当简单,你只需记住:每个文件都是一个模块。
#let m1-code = raw(read("packages/m1.typ").trim().replace("\r", ""), lang: "typ", block: true)
假设有一个文件位于`packages/m1.typ`:
#m1-code
此时文件名就是所引入模块的名称,那么`packages/`#text(red, `m1`)`.typ`就对应#text(red, `m1`)模块。
你可以简单通过绝对路径或相对路径引入一个文件模块:
#code(```typ
#import "packages/m1.typ"
#repr(m1)
```)
你可以通过这个「模块」对象访问到文件顶层作用域的变量或函数。例如在`m1`文件中,你可以访问到其顶层作用域中的`add`或`sub`函数。
#code(```typ
#import "packages/m1.typ"
#m1.add \
#m1.sub
```)
你可以在引入模块名的同时将其更名为你想要的名称:
#code(```typ
#{
import "packages/m1.typ" as m2
repr(m2)
} \
// 等价于
#{
import "packages/m1.typ"
let m2 = m1
repr(m2)
}
```)
你可以在冒号后添加一个星号表示直接引入模块中所有的函数:
#code(```typ
// 引入所有函数
#import "packages/m1.typ": *
#type(add), #type(sub)
```)
你也可以在冒号后追加一个逗号分隔的名称列表,部分引入来自其他文件的变量或函数:
#code(```typ
// 仅仅引入`sub`函数
#import "packages/m1.typ": sub
#type(sub) \
// 引入`add`和`sub`函数
#import "packages/m1.typ": add, sub
#type(add), #type(sub) \
```)
注意,本地的变量声明与`import`进来的变量声明都会覆盖Typst内置的变量声明。例如Typst内置的`sub`函数实际上为取下标函数。你可以在引入外部变量的同时更名以避免可能的名称冲突:
#code(```typ
1#sub[2]
#import "packages/m1.typ": sub as subtract
#repr(subtract(10, 1))#sub[3]
```)
== 「include」语法与「import」语法的关系
在Typst内部,当解析完一个文件时,文件将被分为顶层作用域中的「内容」和「变量声明」,组成一个文件模块。
例如对于`packages/m1.typ`文件:
#m1-code
其「内容」是除了「变量声明」以外的文件内容,连接起来为:
```typ
一段内容
// #let add(x, y) = x + y
另一段内容
// #let sub = ..
```
其导出所有在文件顶层作用域中的「变量声明」:
```typ
// 一段内容
//
#let add(x, y) = x + y
//
// 另一段内容
//
#let sub(x, y) = x - y
```
因此`include`和`import`分别得到以下结果。
使用`include`得到:
#code(```typ
#repr(include "packages/m1.typ")
```)
使用`import`得到:
#code(```typ
#import "packages/m1.typ"
#repr(m1.add), #repr(m1.sub)
```)
你可以同时使用`include`和`import`获得同一个文件的内容和变量声明。
== 控制变量导出的三种方式
有的时候你不希望将一些变量暴露出去,这个时候你可以让这些变量的名称以「下划线」(`_`)开头:
```typ
#let _factor = 1;
#let add2(x, y) = _factor * (x + y)
```
这样`import`的时候就不会轻易访问到这些变量。
还有一种方法是在非顶层作用域中构造闭包,这样`import`中就不会包含`factor`,因为`factor`不在顶层:
```typ
#let add2 = {
let factor = 1;
(x, y) => factor * (x + y)
}
```
值得注意的是,`import`进来的变量也可以被重新导出,只要他们也在顶层作用域。这允许你以更优雅的第三种方式为使用者屏蔽内部变量,例如你可以在子文件夹中完成实现并重新导出:
```typ
// 仅从packages/m1/add.typ文件中重新导出`add`函数。
#import "m1/add.typ": add
// 重新导出packages/m1/sub.typ文件中所有的函数
#import "m1/sub.typ": *
```
|
https://github.com/storopoli/Bayesian-Statistics | https://raw.githubusercontent.com/storopoli/Bayesian-Statistics/main/slides/10-sparse_regression.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "@preview/polylux:0.3.1": *
#import themes.clean: *
#import "utils.typ": *
#import "@preview/cetz:0.1.2": canvas, plot
#new-section-slide("Sparse Regression")
#slide(title: "Recommended References")[
- #cite(<gelman2020regression>, form: "prose") - Chapter 12, Section 12.8: Models
for regression coefficients
- Horseshoe Prior: #cite(<carvalho2009handling>, form: "prose")
- Horseshoe+ Prior: #cite(<bhadra2015horseshoe>, form: "prose")
- Regularized Horseshoe Prior: #cite(<piironen2017horseshoe>, form: "prose")
- R2-D2 Prior: #cite(<zhang2022bayesian>, form: "prose")
- Betancourt's Case study on Sparsity: #cite(<betancourtSparsityBlues2021>, form: "prose")
]
#focus-slide(background: julia-purple)[
#align(center)[#image("images/memes/horseshoe.jpg")]
]
#slide(title: [What is Sparsity?])[
#v(2em)
Sparsity is a concept frequently encountered in statistics, signal processing,
and machine learning, which refers to situations where the vast majority of
elements in a dataset or a vector are zero or close to zero.
]
#slide(title: [How to Handle Sparsity?])[
Almost all techniques deal with some sort of *variable selection*, instead of
altering data.
#v(2em)
This makes sense from a Bayesian perspective, as data is *information*, and we
don't want to throw information away.
]
#slide(title: [Frequentist Approach])[
The frequentist approach deals with sparse regression by staying in the
"optimization" context but adding *Lagrangian constraints* #footnote[
this is called *LASSO* (least absolute shrinkage and selection operator) from #cite(<tibshirani1996regression>, form: "prose")
#cite(<zou2005regularization>, form: "prose").
]:
$
min_β {sum_(i=1)^N (y_i - α - x_i^T bold(β))^2}
$
suject to $|| bold(β) ||_p <= t$.
#v(1em)
Here $|| dot ||_p$ is the $p$-norm.
]
#slide(title: [Variable Selection Techniques])[
#v(4em)
- *discrete mixtures*: _spike-and-slab_ prior
- *shrinkage priors*: _Laplace_ prior and _horseshoe_ prior @carvalho2009handling
]
#slide(title: [Discrete Mixtures -- Spike-and-Slab Prior])[
#text(size: 16pt)[
Mixture of two distributions—one that is concentrated at zero (the "spike") and
one with a much wider spread (the
"slab"). This prior indicates that we believe most coefficients in our model are
likely to be zero (or close to zero), but we allow the possibility that some are
not.
Here is the Gaussian case:
$
β_i | λ_i, c &tilde "Normal"(0, sqrt(λ_i^2 c^2)) \
λ_i &tilde "Bernoulli"(p)
$
where:
- $c$: _slab_ width
- $p$: prior inclusion probability; encodes the prior information about the
sparsity of the coefficient vector $bold(β)$
- $λ_i ∈ {0, 1}$: whether the coefficient $β_i$ is close to zero (comes from the "spike", $λ_i = 0$)
or nonzero (comes from the "slab", $λ_i = 1$)
]
]
#slide(title: [Discrete Mixtures -- Spike-and-Slab Prior])[
#side-by-side[
#align(center)[
#figure(
{
canvas(
length: 0.75cm,
{
plot.plot(
size: (16, 9),
x-label: none,
y-label: "PDF",
x-tick-step: 1,
y-tick-step: 0.1,
x-min: -4,
x-max: 4,
y-max: 0.5,
y-min: 0,
{
plot.add(
domain: (-4, 4),
samples: 200,
style: (stroke: (paint: julia-purple, thickness: 2pt)),
x => hs(x, 1, 0.05),
)
},
)
},
)
},
caption: [$c = 1, λ = 0$],
numbering: none,
)
]
][
#align(center)[
#figure(
{
canvas(
length: 0.75cm,
{
plot.plot(
size: (16, 9),
x-label: none,
y-label: "PDF",
x-tick-step: 1,
y-tick-step: 0.1,
x-min: -4,
x-max: 4,
y-max: 0.5,
y-min: 0,
{
plot.add(
domain: (-4, 4),
samples: 200,
style: (stroke: (paint: julia-purple, thickness: 2pt)),
x => hs(x, 1, 1),
)
},
)
},
)
},
caption: [$c = 1, λ = 1$],
numbering: none,
)
]
]
]
#slide(title: [Shinkrage Priors -- Laplace Prior])[
The Laplace distribution is a continuous probability distribution named after
<NAME>. It is also known as the double exponential distribution.
It has parameters:
- $μ$: location parameter
- $b$: scale parameter
The PDF is:
$
"Laplace"(μ, b) = 1 / (2b) e^(-((| x - μ |) / b))
$
It is a symmetrical exponential decay around $μ$ with scale governed by $b$.
]
#slide(title: [Shinkrage Priors -- Laplace Prior])[
#align(center)[
#figure(
{
canvas(
length: 0.9cm,
{
plot.plot(
size: (16, 9),
x-label: none,
y-label: "PDF",
x-tick-step: 1,
y-tick-step: 0.1,
x-min: -4,
x-max: 4,
y-max: 0.55,
y-min: 0,
{
plot.add(
domain: (-4, 4),
samples: 200,
style: (stroke: (paint: julia-purple, thickness: 2pt)),
x => laplace(x, 1),
)
},
)
},
)
},
caption: [$μ = 0, b = 1$],
numbering: none,
)
]
]
#slide(title: [Shinkrage Priors -- Horseshoe Prior])[
#text(size: 17pt)[
The horseshoe prior @carvalho2009handling assumes that each coefficient
$β_i$ is conditionally independent with density
$P_("HS")(β_i | τ )$, where $P_("HS")$
can be represented as a scale mixture of Gaussians:
$
β_i | λ_i, τ &tilde "Normal"(0, sqrt(λ_i^2 τ^2)) \
λ_i &tilde "Cauchy"^+ (0, 1)
$
where:
- $τ$: _global_ shrinkage parameter
- $λ_i$: _local_ shrinkage parameter
- $"Cauchy"^+$ is the half-Cauchy distribution for the standard deviation $λ_i$
Note that it is similar to the spike-and-slab, but the discrete mixture becomes
a "continuous" mixture with the $"Cauchy"^+$.
]
]
#slide(title: [Discrete Mixtures -- Spike-and-Slab Prior])[
#side-by-side[
#align(center)[
#figure(
{
canvas(
length: 0.75cm,
{
plot.plot(
size: (16, 9),
x-label: none,
y-label: "PDF",
x-tick-step: 1,
y-tick-step: 0.1,
x-min: -4,
x-max: 4,
y-max: 0.8,
y-min: 0,
{
plot.add(
domain: (-4, 4),
samples: 200,
style: (stroke: (paint: julia-purple, thickness: 2pt)),
x => hs(x, 1, 1),
)
},
)
},
)
},
caption: [$τ = 1, λ = 1$],
numbering: none,
)
]
][
#align(center)[
#figure(
{
canvas(
length: 0.75cm,
{
plot.plot(
size: (16, 9),
x-label: none,
y-label: "PDF",
x-tick-step: 1,
y-tick-step: 0.1,
x-min: -4,
x-max: 4,
y-max: 0.8,
y-min: 0,
{
plot.add(
domain: (-4, 4),
samples: 200,
style: (stroke: (paint: julia-purple, thickness: 2pt)),
x => hs(x, 1, 1 / 2),
)
},
)
},
)
},
caption: [$τ = 1, λ = 1 / 2$],
numbering: none,
)
]
]
]
#slide(title: [Discrete Mixtures versus Shinkrage Priors])[
*Discrete mixtures* offer the correct representation of sparse problems
@carvalho2009handling by placing positive prior probability on
$β_i = 0$ (regression coefficient), but pose several difficulties: mostly
computational due to the *non-continuous nature*.
#v(2em)
*Shrinkage priors*, despite not having the best representation of sparsity, can
be very attractive computationally: again due to the *continuous property*.
]
#slide(title: [Horseshoe versus Laplace])[
#text(size: 17pt)[
The advantages of the Horseshoe prior over the Laplace prior are primarily:
- *shrinkage*: The Horseshoe prior has infinitely heavy tails and an infinite
spike at zero. Parameters estimated under the Horseshoe prior can be shrunken
towards zero more aggressively than under the Laplace prior, promoting sparsity
without sacrificing the ability to detect true non-zero signals.
- *signal* detection: Due to its heavy tails, the Horseshoe prior does not overly
penalize large values, which allows significant effects to stand out even in the
presence of many small or zero effects.
- *uncertainty* quantification: With its heavy-tailed nature, the Horseshoe prior
better captures uncertainty in parameter estimates, especially when the truth is
close to zero.
- *regularization*: In high-dimensional settings where the number of predictors
can exceed the number of observations, the Horseshoe prior acts as a strong
regularizer, automatically adapting to the underlying sparsity level without the
need for external tuning parameters.
]
]
#slide(title: [Effective Shinkrage Comparison])[
Makes more sense to compare the shinkrage effects of the proposed approaches so
far. Assume for now that $σ^2 = τ^2 = 1$, and define $κ_i = 1 / (1 + λ_i^2)$.
#v(1em)
Then $κ_i$ is a random shrinkage coefficient, and can be interpreted as the
amount of weight that the posterior mean for
$β_i$ places on $0$ once the data $bold(y)$ have been observed:
#v(1em)
$
op(E)(β_i | y_i, λ_i^2) =
(λ_i^2) / (1 + λ_i^2) y_i +
1 / (1 + λ_i^2) 0 =
(1 - κ_i) y_i
$
]
#slide(title: [Effective Shinkrage Comparison #footnote[spike-and-slab with $p = 1 / 2$
would be very similar to Horseshoe but with discontinuities.]])[
#side-by-side[
#align(center)[
#figure(
{
canvas(
length: 0.75cm,
{
plot.plot(
size: (16, 9),
x-label: none,
y-label: "PDF",
x-tick-step: 1,
y-tick-step: 0.1,
x-min: 0,
x-max: 1,
y-max: 0.8,
y-min: 0,
{
plot.add(
domain: (0.01, 0.99),
samples: 200,
style: (stroke: (paint: julia-purple, thickness: 2pt)),
x => beta(x, 0.5, 0.5),
)
},
)
},
)
},
caption: [Laplace],
numbering: none,
)
]
][
#align(center)[
#figure(
{
canvas(
length: 0.75cm,
{
plot.plot(
size: (16, 9),
x-label: none,
y-label: "PDF",
x-tick-step: 1,
y-tick-step: 0.1,
x-min: 0,
x-max: 1,
y-max: 0.8,
y-min: 0,
{
plot.add(
domain: (0.1, 0.9),
samples: 200,
style: (stroke: (paint: julia-purple, thickness: 2pt)),
x => shinkragelaplace(x, 1 / 2),
)
},
)
},
)
},
caption: [Horseshoe],
numbering: none,
)
]
]
]
#slide(title: [Shinkrage Priors -- Horseshoe+])[
#text(size: 17pt)[
Natural extension from the Horseshoe that has improved performance with highly
sparse data @bhadra2015horseshoe.
Just introduce a new half-Cauchy mixing variable $η_i$ in the Horseshoe:
$
β_i | λ_i, η_i, τ &tilde "Normal"(0, λ_i) \
λ_i | η_i, τ &tilde "Cauchy"^+(0, τ η_i) \
η_i &tilde "Cauchy"^+ (0, 1)
$
where:
- $τ$: _global_ shrinkage parameter
- $λ_i$: _local_ shrinkage parameter
- $η_i$: additional _local_ shrinkage parameter
- $"Cauchy"^+$ is the half-Cauchy distribution for the standard deviation $λ_i$ and $η_i$
]
]
#slide(title: [Shinkrage Priors -- Regularized Horseshoe])[
The Horseshoe and Horseshoe+ guarantees that the strong signals will not be
overshrunk. However, this property can also be harmful, especially when the
parameters are weakly identified.
#v(2em)
The solution, Regularized Horseshoe @piironen2017horseshoe (also known as the "Finnish
Horseshoe"), is able to control the amount of shrinkage for the largest
coefficient.
]
#slide(title: [Shinkrage Priors -- Regularized Horseshoe])[
#text(size: 16pt)[
$
β_i | λ_i, τ, c &tilde "Normal" (0, sqrt(τ^2 tilde(λ_i)^2)) \
tilde(λ_i)^2 &= (c^2 λ_i^2) / (c^2 + τ^2 λ_i^2) \
λ_i &tilde "Cauchy"^+(0, 1)
$
where:
- $τ$: _global_ shrinkage parameter
- $λ_i$: _local_ shrinkage parameter
- $c > 0$: regularization constant
- $"Cauchy"^+$ is the half-Cauchy distribution for the standard deviation $λ_i$
Note that when $τ^2 λ_i^2 << c^2$ (coefficient $β_i ≈ 0$), then $tilde(λ_i)^2 → λ_i^2$;
and when $τ^2 λ_i^2 >> c^2$ (coefficient $β_i$ far from $0$), then $tilde(λ_i)^2 → (c^2) / (τ^2)$ and $β_i$ prior
approaches $"Normal"(0,c)$.
]
]
#slide(title: [Shinkrage Priors -- R2-D2])[ Still, we can do better. The *R2-D2* #footnote[
$R^2$-induced Dirichlet Decomposition
] prior @zhang2022bayesian has heavier tails and higher concentration around
zero than the previous approaches.
#v(2em)
The idea is to, instead of specifying a prior on $bold(β)$, we construct a prior
on the coefficient of determination $R^2$\footnote{ square of the correlation
coefficient between the dependent variable and its modeled expectation.}. Then
using that prior to "distribute" throughout the $bold(β)$. ]
#slide(title: [Shinkrage Priors -- R2-D2])[
#text(size: 16pt)[
$
R^2 &tilde "Beta"(μ_(R^2) σ_(R^2), (1 - μ_(R^2)) σ_(R^2)) \
bold(φ) &tilde "Dirichlet"(J, 1) \
τ^2 &= (R^2) / (1 - R^2) \
bold(β) &= Z dot sqrt(bold(φ) τ^2)
$
where:
- $τ$: _global_ shrinkage parameter
- $bold(φ)$: proportion of total variance allocated to each covariate, can be
interpreted as the _local_ shrinkage parameter
- $μ_(R^2)$ is the mean of the $R^2$ parameter, generally $1 / 2$
- $σ_(R^2)$ is the precision of the $R^2$ parameter, generally $2$
- $Z$ is the standard Gaussian, i.e. $"Normal"(0, 1)$
]
]
|
https://github.com/protohaven/printed_materials | https://raw.githubusercontent.com/protohaven/printed_materials/main/meta-templates/class-NAME.typ | typst |
#import "/meta-environments/env-templates.typ": *
#import "./glossary/glossary_terms.typ": *
#show: doc => class_handout(
title: "Class MUMBLE",
category: "MUMBLE",
number: "NUM",
clearances: ("Turbo Encabulator",),
instructors: ("Someone",),
authors: ("Someone", "Someone Else"),
draft: true,
doc
)
// Content goes here
= Welcome
Welcome to the Introduction to Lathe class at Protohaven!
#set heading(offset:1)
#include "/common-policy/content/shop_rules.typ"
#include "/common-policy/content/tool_status_tags.typ"
#include "/common-policy/content/filing_a_tool_report.typ"
#set heading(offset:0)
#pagebreak()
= Safety
// Important safety notes for this particular class
If you feel unsure of something, feel free to ask!
= Introduction
== Learning Objectives
== Terminology
= Tools
#set heading(offset:1)
// #include "/common-tools/TOOLNAME.typ"
#set heading(offset:0)
= Resources
// == Acknowledgments |
|
https://github.com/fenjalien/metro | https://raw.githubusercontent.com/fenjalien/metro/main/src/impl/array.typ | typst | Apache License 2.0 | #import "num/num.typ"
#import "qty.typ"
#import "unit.typ" as unit_
#import "/src/utils.typ": combine-dict
#let default-options = (
list-final-separator: [ and ],
list-pair-separator: [ and ],
list-separator: [, ],
product-mode: "symbol",
product-phrase: [ by ],
product-symbol: sym.times,
range-open-phrase: none,
range-phrase: [ to ],
list-close-bracket: sym.paren.r,
list-open-bracket: sym.paren.l,
product-close-bracket: sym.paren.r,
product-open-bracket: sym.paren.l,
range-close-bracket: sym.paren.r,
range-open-bracket: sym.paren.l,
// list-independent-prefix: false,
// product-independent-prefix: false,
// range-independent-prefix: false,
list-exponents: "individual",
product-exponents: "individual",
range-exponents: "individual",
list-units: "repeat",
product-units: "repeat",
range-units: "repeat",
)
#let process-numbers(typ, numbers, joiner, options, unit: none) = {
let exponents = options.at(typ + "-exponents")
let units = options.at(typ + "-units")
if unit != none {
unit = unit_.unit(unit, options + qty.get-options(options))
}
let exponent = if exponents != "individual" {
let first = num.parse(num.get-options(options), numbers.first(), full: true)
if first.at(3) != none {
num.process(num.get-options(options), ..first, none).at(3)
options.fixed-exponent = int(first.at(3))
options.exponent-mode = "fixed"
options.drop-exponent = true
}
}
let repeated-unit = if units == "repeat" { unit }
let result = joiner(numbers.map(n => num.num(n, options) + repeated-unit))
if exponents == "combine-bracket" or (unit != none and units == "bracket") {
result = math.lr(options.at(typ + "-open-bracket") + result + options.at(typ + "-close-bracket"))
}
return result + exponent + if repeated-unit == none { unit }
}
#let qty-list(numbers, unit: none, options) = {
options = combine-dict(options, default-options)
return process-numbers(
"list",
numbers,
numbers => if numbers.len() == 2 {
numbers.join(options.list-pair-separator)
} else {
let last = numbers.pop()
numbers.join(options.list-separator)
options.list-final-separator
last
},
options,
unit: unit
)
}
#let num-list = qty-list.with(unit: none)
#let qty-product(numbers, options, unit: none) = {
options = combine-dict(options, default-options)
return process-numbers(
"product",
numbers,
numbers => if options.product-mode == "symbol" {
math.equation(numbers.join(options.product-symbol))
} else {
numbers.join(options.product-phrase)
},
options,
unit: unit
)
}
#let num-product = qty-product.with(unit: none)
#let qty-range(n1, n2, options, unit: none) = {
options = combine-dict(options, default-options)
return process-numbers(
"range",
(n1, n2),
numbers => {
options.range-open-phrase
numbers.join(options.range-phrase)
},
options,
unit: unit
)
}
#let num-range = qty-range.with(unit: none) |
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/page-binding_04.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
//
// // Error: 19-44 `inside` and `outside` are mutually exclusive with `left` and `right`
// #set page(margin: (left: 1cm, outside: 2cm)) |
https://github.com/barrel111/readings | https://raw.githubusercontent.com/barrel111/readings/main/problems/external/1910SU/week4.typ | typst | #import "@local/preamble:0.1.0": *
#import "@preview/cetz:0.2.2": canvas, plot, draw
#show: project.with(
course: "1910SU",
sem: "Summer",
title: "Group Discussion: Trigonometry",
subtitle: "Solutions",
contents: false,
)
= Composition of Trigonometric and Inverse Trigonometric Functions.
\
== $tan (sec^(-1)(x))$
\
Let $theta = sec^(-1)(x) in [0, pi/2) union (pi/2, pi]$. Consider the right-angled triangle with unit hypotenuse and adjacent side of length $1/x$. One of the angles in this right-angled triangle must be $theta$. Pictorally,
\
#align(center)[
#canvas({
import draw: *
let (a, b, c) = ((0, 0), (0, 3), (5, 0))
line(a, b, c, close: true, name: "line")
content(
(2.5, 2),
angle: -30deg,
[$1$]
)
content(
(2, -1/2),
[$1 slash x$]
)
arc((5, 0), start: 150deg, delta: 30deg, mode: "PIE", anchor: "origin")
content((3.75, 0.35), [$theta$])
rect(a,(rel: (1/2, 1/2)))
})]
The perpendicular side is then given by,
$ sin theta = sqrt(1 - 1/x^2) $
Then,
$ tan (sec^(-1)(x)) = tan(theta) = (sin theta)/(cos theta) = x dot sqrt(1 - 1/x^2) = x/abs(x) dot sqrt(x^2 - 1). $
== $csc (cot^(-1)(x))$
\
Let $theta = cot^(-1)(x) in [0, pi]$. Consider the right-angled triangle with adjacent side of length $x$ and perpendicular side of unit length. One of the angles in this right-angled triangle must be $theta$. Pictorally,
\
#align(center)[
#canvas({
import draw: *
let (a, b, c) = ((0, 0), (0, 3), (5, 0))
line(a, b, c, close: true, name: "line")
content(
(-0.5, 1.5),
[$1$]
)
content(
(2, -1/2),
[$x$]
)
arc((5, 0), start: 150deg, delta: 30deg, mode: "PIE", anchor: "origin")
content((3.75, 0.35), [$theta$])
rect(a,(rel: (1/2, 1/2)))
})]
Then the hypotenuse has length $sqrt(1 + x^2)$. Finally,
$ sin(cot^(-1)(x)) = 1/sin(theta) = sqrt(1 + x^2). $
== $sin (cos^(-1)(x))$
\
Let $theta = cos^(-1)(x) in [0, pi]$. Consider the right-angled triangle with unit length hypotenuse and adjacent side of length $x$. One of the angles in this right-angled triangle must be $theta$. Pictorally,
\
#align(center)[
#canvas({
import draw: *
let (a, b, c) = ((0, 0), (0, 3), (5, 0))
line(a, b, c, close: true, name: "line")
content(
(2.5, 2),
angle: -30deg,
[$1$]
)
content(
(2, -1/2),
[$x$]
)
arc((5, 0), start: 150deg, delta: 30deg, mode: "PIE", anchor: "origin")
content((3.75, 0.35), [$theta$])
rect(a,(rel: (1/2, 1/2)))
})]
Then,
$ sin (cos^(-1)(x)) = sin theta = sqrt(1 - x^2). $
= Sum and Difference Formulas.
\
Label the points on the provided diagram as follows.
#align(center)[
#canvas({
import draw: *
rect((0, 0),(rel: (6, 4)))
let (a, b, c) = ((0, 0), (2, 4), (6, 1.5))
line(a, b, c, close: true)
content((-0.25, -0.25), [$A$])
content((2, 4.25), [$C$])
content((0, 4.25), $B$)
content((6, 4.25), $D$)
content((6.25, 1.5), $E$)
content((6.25, 0), $F$)
})]
In $triangle.t A B C$, we have
$ A B = cos beta cos alpha, $
$ B C = sin beta cos alpha. $
In $triangle.t C D E$, we have
$ C D = cos beta sin alpha, $
$ D E = sin beta sin alpha. $
In $triangle.t A E F$, we have
$ E F = cos(alpha + beta), $
$ A F = sin (alpha + beta). $
Note further that,
$ E F = A B - D E ==> cos(alpha + beta) = cos alpha cos beta - sin beta sin alpha, $
$ A F = B C + C D implies sin (alpha + beta) = sin alpha cos beta + cos alpha sin beta. $
|
|
https://github.com/Hobr/njust_thesis_typst_template | https://raw.githubusercontent.com/Hobr/njust_thesis_typst_template/main/template/chapter/1.typ | typst | MIT License | // 引言
= 引言
+ 南京理工大学(@logo)
- 南京校区@greenwade_comprehensive_1993
- 江阴校区
- 汤山校区
- 盱眙校区
+ 南京航空航天大学
+ `mono font`
#figure(
image("../../img/logo.jpg", width: 60%),
caption: [你说的对, 但*南京理工大学*是一所......],
) <logo>
_行内公式:_ $Q = rho A v + C$
$
f(x, y) := cases(
1 "if" (x dot y)/2 <= 0,
2 "if" x "is even",
3 "if" x in NN,
4 "else",
)
$
$
mat(
1, 2, ..., 10;
2, 2, ..., 10;
dots.v, dots.v, dots.down, dots.v;
10, 10, ..., 10;
)
$
*加粗, 代码*
```latex
\begin{itemize}
\item Fast
\end{itemize}
```
术语表:
/ Term: 1
/ Term: 2
#rect()[
#calc.max(3, 2 * 4) \
#underline()[_斜体_下划线]
]
#for x in range(3) [
Hi #x.
]
#lorem(250)
== 更多
// Store the integer `5`.
#let five = 5
// Define a function that
// increments a value.
#let inc(i) = i + 1
I have #five fingers.
If I had one more, I'd have
#inc(five) fingers. Whoa!
#lorem(250)
== 表格
#table(
columns: 5 * (1fr,),
..for x in range(1, 10) {
for y in range(1, 6) {
(str(x * y),)
}
},
)
#lorem(250)
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/delegis/0.1.0/delegis.typ | typst | Apache License 2.0 | // sentence marker
#let s = "XXXXXX"
#let unnumbered = (it, ..rest) => heading(level: 6, numbering: none, ..rest, it)
// template
#let delegis = (
// Metadata
title : "Vereinsordnung zur IT-Infrastruktur",
abbreviation : "ITVO",
resolution : "3. Beschluss des Vorstands vom 24.01.2024",
in-effect : "24.01.2024",
draft : false,
// Template
logo : none,
// Overrides
size : 11pt,
font : "Atkinson Hyperlegible",
lang : "de",
paper: "a5",
str-draft : "Entwurf",
str-intro : (resolution, in-effect) => [Mit Beschluss (#resolution) tritt zum #in-effect in Kraft:],
// Content
body
) => [
/// General Formatting
#set document(title: title + " (" + abbreviation + ")", keywords: (title, abbreviation, resolution, in-effect))
#let bg = if draft {
rotate(45deg, text(100pt, fill: luma(85%), font: font, strDraft))
} else {}
#set page(paper: paper, numbering: "1 / 1", background: bg)
#set text(hyphenate: true, lang: lang, size: size, font: font)
/// Clause Detection
#show regex("§ ([0-9a-zA-Z]+) (.+)$"): it => {
let (_, number, ..rest) = it.text.split()
align(center, heading(level: 6, numbering: none, {
"§ " + number + "\n" + rest.join(" ")
}))
}
/// Heading Formatting
#set heading(numbering: "I.1.A.i.a.")
#show heading: it => {
set align(center)
text(size: size, it, weight: "regular")
}
#show heading.where(level: 1): it => emph(it)
#show heading.where(level: 2): it => emph(it)
#show heading.where(level: 3): it => emph(it)
#show heading.where(level: 4): it => emph(it)
#show heading.where(level: 5): it => emph(it)
#show heading.where(level: 6): it => strong(it)
/// Outlines
#show outline.entry: it => {
show linebreak: it => {}
show "\n": " "
it
}
#set outline(indent: 1cm)
#show outline: it => {
it
pagebreak(weak: true)
}
/// Sentence Numbering
#show regex("XXXXXX"): it => {
counter("sentence").step()
super(strong(counter("sentence").display()))
}
#show parbreak: it => {
counter("sentence").update(0)
it
}
/// Title Page
#page(numbering: none,{
place(top + right, block(width: 2cm, logo))
v(1fr)
show par: set block(spacing: .6em)
if draft { text[#str-draft:] } else { par(text(str-intro(resolution, in-effect))) }
par(text(2em, strong[#title~(#abbreviation)]), leading: 0.6em)
v(3cm)
})
/// Content
#body
]
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/052%20-%20March%20of%20the%20Machine%3A%20The%20Aftermath/002_Beyond%20Repair.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Beyond Repair",
set_name: "March of the Machine: The Aftermath",
story_date: datetime(day: 02, month: 05, year: 2023),
author: "<NAME>",
doc
)
Deep within the bowels of what had once been the Emeria Skyclave, Nahiri ripped the taint of Phyrexia from her plane.
In theory, it was a straightforward process: remove the metal that had been grafted into the surroundings and leave behind nothing but the original stone. In practice, it was a nightmare. Compleation had fused stone and metal together on a molecular level, and disentangling the two took an excruciating amount of patient, intricate work for every handspan of metal. Fortunately, Nahiri had nothing if not time.
She'd lost track of how long she'd been down here in the dark. At first the lack of sight had been disorienting, but eventually her other senses had attuned to compensate, and now she knew every inch of her surroundings. She knew the drip of water down stone, the cold hiss of wind through the corridors, the bloody tang of rust. She knew that she was alone.
The first order of business when she'd woken up to find the invasion over and herself somehow still alive had been to rip all remaining traces of metal from her body. The process had been painful, and bloody. Peeling off the metal had taken less than a day, but it had been several more before the wounds finished scabbing over, and weeks before the scabs all fell off. The entire time, she'd been on edge, expecting people to come looking for her. As time passed, Nahiri realized that everyone must assume she was dead—or rather, they didn't care if she was alive.
Well, that was fine by her. She had work to do.
Currently, she faced a tricky situation: She'd been working through a particular corridor for the last few days, but now her way was blocked by a wall of interlaced metal, all fused into the surrounding rock. The metal pieces were wickedly sharp; she'd cut herself exploring the shape of them. She'd have to dismantle it all before she could proceed further.
Wrapping her hands around a metal claw, she felt for the seam where stone and metal tangled together, coaxing the stone to loosen its grip. She tried not to dwell on how much effort it took. Every act of lithomancy cost her now, where before it had taken little more than a thought to shape stone to her will.
Then again, she was no longer a Planeswalker.
She couldn't say for sure what had happened. All she remembered was a blast of Halo searing into her, moments before the Skyclave had fallen, with her still inside. Perhaps the Halo had been what had allowed her—maybe others as well—to survive after New Phyrexia's grip had fallen apart. Perhaps it was something to do with the fact that she had been fused into the Skyclave itself. She didn't know for sure. All she knew was that she was alive, and hollow. The core of her power, her spark, no longer a part of her.
At first the pain of its absence had been so great she'd thought she would die, but over time, she'd grown used to the hollow ache in her soul. She'd grown to accept she was now weak.
Once she'd loosened the stone's grip sufficiently on the metal, she braced herself and tugged. The metal resisted—and then jerked so abruptly free that Nahiri stumbled and fell. She landed hard on her rear, and the claw came to rest with the point digging in just below her sternum, just shy of puncturing her skin.
Nahiri froze. Memories surged through her: How it had felt when the metal had been not just pressing against her heart but wrapped around it, when her soul had been melded to the glory of the machine. How pure and untainted their vision of perfection, how glorious Zendikar could be through its salvation—
With a shudder, she shoved the thoughts away. They belonged to an entity that did not exist. That was the ghost of Phyrexia. It was not her.
It was #emph[not ] her.
The claw's tip scraped lightly against her skin as she wriggled out from underneath. Once she was free, she wrapped her hands around it, careful to avoid the cutting edges, and retraced her steps back through the corridor, letting the claw drag in her wake. The rasp of the metal against stone echoed all around her.
The corridor wound in a twisted upward slope. When the echoes changed, hollowing out, she knew she was nearing her destination. She slowed down and edged forward until her feet touched the edge of a cliff. If she took another step, she'd fall into the pit containing her masterpiece: a mountainous cairn of Phyrexian metal, all the pieces of Phyrexia she'd spent the last days, weeks, who knew how long, ripping out of the Skyclave.
There was probably enough there by now to rival the height of Sea Gate itself, and she'd still only scratched the surface of what the Skyclave contained. It would take months to rip it all free. Years, perhaps, but she wouldn't rest until she had scoured every trace of the cursed metal from this place.
She'd have to figure out how to destroy it eventually. But right now, if she could pry Phyrexia's cold, alien grip off her plane, that was good enough.
And after that?
She would deal with that then. But for now, this was all she could do. It would have to be enough.
Once upon a time she would have been angry. She would have raged against the Multiverse for stripping her of her power, for delivering this fate to her. But now where anger should have been, she felt only hollowness, and a grim weariness to see the job done.
She tossed the piece of metal into the dark and turned back down the slope.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Small skittering creatures scuttled through the dark: tough, scrawny things of too many bones and too little meat. Aside from Nahiri, they were the only living things in this place. Every now and then, she caught one in a fist of stone, crushing it and superheating the rock to cook it directly. The act of eating was tedious, but necessary. She found herself longing for the taste of kor cuisine. Not the cooking of recent centuries—the hardy, straightforward campfire fare that kor caravans have been reduced to—but the more nuanced tastes of a culture the plane had long forgotten, back when she was still just a mortal. She'd eat it again once she was done here, she promised herself, and didn't think about how long that might take.
The wall of metal came down, only to reveal another one behind it. She took that one down too to find yet another. Then another, and another. A vague sense of dread grew in her with every layer peeled away. This Skyclave had been the heart of the engine meant to convert Zendikar itself; the walls must have been put up deliberately to protect some core component. They certainly wouldn't have been for decoration; Phyrexia was nothing if not efficient. Indecision and frivolity were weaknesses of flesh. It was nothing like a machine, pure and gleaming, incorruptible, #emph[beautiful] —
Nahiri grabbed the closest piece at hand and #emph[ripped ] it free in a savage burst of lithomancy that left her body trembling and shaking, sensations she gladly embraced. Focus on the here and now. Don't think about what came before. Don't think about what you used to be.
#emph[Don't think about what you did.]
At last the final wall came down, and she walked through to find herself in the chamber where she had bound herself into the Skyclave itself.
She knew it as soon as she set foot inside. The room sang to her, stone and metal woven together like the weft and warp of fabric where she had been fused into the very walls. In that deliberate plaiting she could read Phyrexia's influence, how it had sought to take the material of this plane and turn it against itself. Because that was what Phyrexia did best, wasn't it? Corrupt the essence of a plane, take your urge to protect and shield and twist it to serve their own ends~
A wave of dizziness and nausea swept over her, and she put a hand against the wall to steady herself. But for once, the touch of Phyrexian metal comforted her. It didn't matter what this place had been. Phyrexia was gone for good. Still, she walked the perimeter of the room, trailing a hand over the wall to reassure herself that the metal was, in fact, dead.
And then she brushed a section of the wall and felt a fluttering shock of power deep inside.
Instinct snatched her hand back. Her first impulse was to grab the surrounding stone and squeeze it inwards, crushing whatever lay within. But the sensation hadn't been unpleasant. If anything, it had felt~ familiar.
Cautiously, Nahiri placed her hand on the wall again. There it was, a little whorl of power embedded in metal and stone. Now that she was focusing, she thought she could feel the outlines. It wasn't too deep within the metal.
Curiosity battled with dread and won. She retreated to the outside corridor and shaped herself a blade of stone.
She cut slowly, channeling heat into the edge of the blade to melt the metal apart. The last thing she wanted was to damage the object she was trying to cut free, so she focused on the act, forcing herself not to think about what it might be~
Her blade touched empty air, and the object fell out of the wall and into her waiting hand.
She held a lump of stone the size of her fist. She ran her hands over it, feeling its contours. It was a hedron, if that hedron had grown in impossibly thin slices of stone layer by layer around a central seed, like an oyster laying down coats of pearl around a speck of grit. The whole thing felt delicate, like even an ounce of wrong pressure would crush them. As for the grit in its center~
It was her Planeswalker spark.
The feel of it was unmistakable. Now that she held it in her hands, she could feel the rush of power that it contained, that had been hers for centuries. She was suddenly, acutely aware of the hollow in her where her spark had once been, that emptiness she'd been trying so hard to ignore.
#emph[Empty, because I poured everything I had into destroying my home. I burned myself out trying to save it from itself, because I believed I was doing right at that time.]
Her heart thudded in her chest like the strike of a hammer on metal. Something bubbled up in her that she hadn't thought she was capable of anymore.
Hope.
The weight of metal above, below, and all around her: suddenly it was suffocating. And the darkness. When was the last time she'd seen sunlight? How long had it been since she'd seen her home, seen Zendikar itself? She reached out, gripped stone in great grasping fistfuls, and with a surge of power, #emph[heaved] .
Stone ruptured upward. Metal shrieked and peeled away in violent blossoms. The stone punched through the roof the chamber, and then up and further up, until, far above, it pierced the vaulted roof of the Skyclave itself, a rough set of stairs that stretched from her feet all the way to the outside. Sunlight dripped into the darkness.
Nahiri sat down hard. Her whole body shook with exhaustion, and she had to swallow rapidly to keep from vomiting, but it was done. She had a way out.
As her eyes adjusted to the light, she saw her body for the first time. She'd known she was scarred, of course; she'd felt them in the dark. But it was one thing to feel, and another to see the puckered white lines that striped her skin: The diamond pattern of the Skyclaves seared into her where flesh had fused to metal, ripped free, then fused again, over and over. Overlaid against that coldly geometric precision were newer, harsher welts, where she herself had clawed the disgusting, beautiful touch of metal from her body.
#figure(image("002_Beyond Repair/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
She ran a finger along a jagged seam tracing down the outside of her right hand, all the way from the tip of her middle finger to her elbow. There had been a heart of metal in the stone blades grafted onto her hands, and right after she'd woken up, she hadn't yet figured out how to disentangle the two the way she did now. Even if she had, she wouldn't have cared. All she'd wanted was to rescue herself from Phyrexia's grip, no matter how much she damaged herself in doing so. Flesh could always heal, after all. It seemed like a small penance to pay for having failed Zendikar yet again.
She pushed herself to her feet. Her legs were still a little shaky, but at least her stomach no longer felt like it wanted to heave itself up her throat. The hedron fit snugly into her palm, as though it belonged there, and she supposed in a way that it did.
Nahiri began to climb.
The way up was longer than she'd anticipated; she hadn't realized just how far down she'd been. The light steadily increased the higher she got, until her eyes ached with the strain of it. By the time she emerged onto the Skyclave's hull, her eyes were closed and she was feeling her way by stone sense alone.
The touch of wind on her face felt as alien as the air of a new plane. For a moment, she simply stood there, trying not to flinch from the touch of it. Even through the skin of her eyelids, her eyes hurt. It would take a while before she grew accustomed to seeing again.
Or was that the only reason she was keeping them so resolutely closed?
#emph[Look, you coward.]
She opened her eyes.
The world was a blurred smear of light and color. Then the light ebbed, and Zendikar resolved itself into existence.
She almost howled at the sight. It was worse than any wreckage the Roil had ever caused, worse than when the Eldrazi had eaten their way through Bala Ged. Sinew and metal extended as far as she could see, warped and rent with rivers of oil. She saw all too plainly the brute force of Phyrexia at work, the blind bulldozing of native earth, eager simply to spread compleation as far, and as fast, as possible. The scope of it was almost unfathomable. This wasn't something that mortals could fix; this was a problem for gods.
And she'd thought she could dismantle it, one insignificant piece at a time.
Bitterness curdled in her belly. Gods, had she really convinced herself she was doing something meaningful down there in the Skyclave, plucking at scraps? She might as well have tried to separate the sea back into its component rivers. Her useless little pickings were nothing compared to what Phyrexia—no, what she had accomplished.
Seeing Zendikar, she could no longer deny it: This was her doing. Phyrexia had wielded her like a hammer, but she had still been the one to strike, to bring Phyrexia's weight down on her home. This was her fault.
The scars on her arms pulled taut as she curled her hands into fists. Well, maybe she'd been part of the problem before, but she was done with hiding like a coward. Now she was going to fix things, return them to the way they'd been before. Which meant, first things first, finding a way to restore her spark.
In the light of day, the hedron's translucent delicacy looked even more impossible, the layered slices of stone a three-dimensional palimpsest that caught the sunlight and fractured it into an iridescent rainbow. This must have been a protective barrier of some sort, an instinctive protection her spark had grown to protect itself while it was being used to fuel the Skyclave engine. Somehow, she had to find a way to extract it and fuse it into herself again. She would leave this place and find whatever allies she still had on Zendikar—Kesenya, perhaps. Nahiri had helped Kesenya start her expedition house, and that was a debt the other woman was sure to acknowledge, even if their current relationship was less than ideal. And Kesenya had connections to expedition houses across practically every continent. Even if she didn't know what to do, she'd be able to point Nahiri in a promising direction.
The plan crystallized in her mind, chasing away some dark fog she hadn't realized was there. A sense of purpose filled her. It felt good to have a goal in mind again. She should have left the Skyclave ages ago.
She heard it before she sensed it, the displacement of air like a hard exhale. A breeze ruffled her hair. She spun around, knowing before she did what was coming.
A Planeswalker.
The irony of the situation didn't escape her, that a Planeswalker would come hunting her down now, at this moment. She'd made a lot of enemies in her travels through the Multiverse, and she was weak. If it was Sorin who had come seeking her, or Jace~
But the figure who appeared in front of her was larger than any she'd expected, with a strong feline face and white fur covering his entire body. A scar ran through the left eye socket.
"Hello, Nahiri," Ajani said.
For a moment, Nahiri could only stare, feeling an undeniable sense of relief that the Planeswalker she had sensed wasn't one of her enemies. In fact, Ajani was the last person in the Multiverse she would have expected to see. She barely knew him. When she'd last seen him, it had been as Elesh Norn's most faithful evangel, her most favored lieutenant. The leonin who stood before her now was not plated and seamed with porcelain. Now he was just~ himself. Flesh. Untainted.
And still a Planeswalker.
She blurted out the first thing that came to mind. "What are you doing here?" It emerged a rusty, hoarse croak. It had been a long time since she'd spoken.
"Isn't it obvious? I came looking for you." His eyes moved over her. She met his gaze steadily, challenging him to say something about her appearance. "I thought~ I expected to find you dead."
She smiled humorlessly. "Disappointed?"
"Surprised." His whiskers twitched. "The others are dead, you know."
"Who?"
"The others." When she didn't respond, he continued, "<NAME>. Jace and Vraska, too, I would guess, except no one's found their bodies yet."
The other Planeswalkers who had been Elesh Norn's evangels. A roster of those who had led the charge against their homeworlds. The syllables of their names clawed her ears. "And Nissa?"
For a long while, Ajani didn't answer, long enough that Nahiri thought he wasn't going to. "She survived as well," he said at last, "but she's been damaged. I don't know what happened; some part of the process when we were cleansed of Phyrexia, but she can no longer planeswalk. I can, but~ it took everyone. Teferi, Kaya, Melira~ so many others. They saved me. They cleansed me of the taint of Phyrexia and kept me intact." A shudder passed through him. "The others~ weren't so lucky as you and I."
Nahiri kept her hand curled around the hedron, hiding it from sight. He was clearly still sensing her spark, even though it was no longer in her. If he wanted to think she was still a Planeswalker, she saw no reason to inform him otherwise. No reason to reveal any sign of weakness, not with that strange look on his face that made him look~ guilty, she would have said. But about what? "Who sent you?"
"What?"
"You can't have come on your own volition. Who asked you to find me?"
"No one." He sounded surprised. "I just wanted to see what had become of you."
"Well, if that's all you came to see about, you can be on your way. I'm fine." She walked over to the edge of the Skyclave hull and peered down. Her first step would be to get back down to ground level. This side was steep, but she could make handholds for herself to climb. Luckily, the Skyclave had crashed into a flat plain, so at least she wouldn't have to fight through tangled forests or thickets. Before, she never would have had to care. She could have simply willed herself wherever she liked.
#emph[Soon] , she promised herself.
The back of her neck prickled. She turned to find Ajani was staring at her. "What?" she snapped.
"Are you?" he asked.
"Am I what?"
"Are you really fine?"
Her eyes narrowed. "What's that supposed to mean?"
Ajani said nothing. Some of the initial relief she had felt faded, replaced with unease. Something about this wasn't right. No one came looking for her unless it was for a purpose, and in her experience, those purposes had rarely been benevolent. "Look, I'm fine. So if you don't mind, go away and leave me alone. I'm busy right now."
"Healing Zendikar, correct?"
She bristled. "And if I am?"
Another silence. Nahiri realized she was tensing her entire body, and forced herself to relax. Ajani's whiskers twitched. "I have a proposal to make."
"I'm not interested," Nahiri said at once.
"Will you not even hear me out?" The words were still soft, but there was a growl to them, a gleam in his eye. Anger or threat, Nahiri didn't know, and she didn't have to; the danger was clear.
She crossed her arms over her chest.
"Ever since things ended, I've been traveling the planes, and the scope of destruction we wrought. I'm sure I don't need to tell you the untold damage to the Multiverse. Someone needs to make amends for what we've done. To fix things." He took a deep breath. "That could be you and I."
It took a moment for his meaning to sink in. "You want me to~ join you? Be your partner in fixing the Multiverse?" An incredulous laugh slipped out of her. "You have others who would willingly assist you. They saved you, didn't they? Go ask them instead. I'm sure you have plenty of friends who'd jump on the chance to do so." Despite herself, she couldn't keep the bitterness out of her voice. "I told you already I'm not interested, so you can go off and save the rest of the Multiverse. In fact, you're welcome to it. But you leave Zendikar alone. This is my home, not yours. I'll repair it myself, without your—your meddling."
He shook his head in irritation. "This isn't just about the Multiverse. It's also about us. No one else faced what we did. We're the only ones left who knows what it's like to go through~ what we went through."
"What we went through," Nahiri repeated. "You mean as Phyrexians." The word was sour in her mouth. She made herself say it anyway. Ajani flinched. "Nissa knows."
"She's also no longer a Planeswalker." Nahiri's grip on her hedron tightened. "She never saw the aftermath of what we wrought. Out of everyone in the Multiverse, you and I, Nahiri, are the only ones who can truly know the sins we committed. That's why we must be there for each other. We need to help each other, for our own good. And we can't do it alone."
Nahiri scowled, not bothering to hide her annoyance. She'd always considered Ajani somewhat high-handed, the way he assumed he knew what was best for everyone, but this was too much. "I never asked for your help," she snapped, "and I won't be a balm for your guilt. You'll just have to learn to live with it instead."
His ears flattening against his skull. "Do you think I'm here on a whim?" he growled. "This thing must be done. We bore the sin of it here; we must be the ones to fix it. Whatever it takes." And when she didn't respond, he continued, voice softer but unsteady now, "Doesn't it haunt you, what we did? I remember everything as a~ a Phyrexian." It seemed to cost him to say that word. "Every evil act, every memory. It's there, intact. Is it the same for you?"
Abruptly, she saw herself, kneeling on the neck of a Skyclave elemental, anointing it—no, drowning it—in oil. How she had blessed—cursed—corrupted—everything she touched, dragging Phyrexia in her wake in a glistening skirt. How she had believed with all her heart that she was saving her plane from something worse. A bitter, metallic taste flooded her mouth. Furious, she shoved the memory away. "I've already told you to leave me alone, what about that don't you understand? Why are you still here?"
"Because I want to help you," Ajani snarled. "How many times must I repeat myself?"
Nahiri glared, but even as she did, a cold, trickling awareness filled her. Ajani was a Planeswalker, and still in full control of his powers. To come all this way, just because they'd both served together under Elesh Norn, was ridiculous. No one in their right mind would willingly want to dwell on that time.
What if he was here to kill her?
If he was, then it all made sense. His presence here. The way he kept pressing her to dwell on her time as a Phyrexian—he could be trying to destabilize her emotionally, making it easier for him to surprise her with an attack. Ajani had been Elesh Norn's strategist, the most ruthless and loyal of her evangels. Phyrexia changed your allegiance but not the core of who you were. That single-minded purposefulness, that capacity for ruthlessness, had to have come from Ajani himself.
He had come to Zendikar seeking her out specifically. He had wanted to find if she was alive. He could very well have determined to seek out all the former evangels and end them, to cleanse the plane of Phyrexia's taint. Whatever it takes, he had said. He was right about one thing, if nothing else: they had caused a lot of damage. From what she knew of Ajani, he was not one to let such wrongs stand if there was something he could do about it.
It was something she herself might have done as well, if she could.
Lukka, she thought abruptly. Tamiyo. Vraska. He hadn't said how they had died.
He hadn't said who had killed them.
As subtly as she could, she reached out with her power, flooding the Skyclave hull all around her. He'd made a mistake, giving her forewarning. If he was planning to kill her, she would at least be ready for it. She might not be a match for him, but she could at least slow him down long enough to—hopefully—escape.
If he'd realized she'd seen through to his true motive though, he gave no sign of it. He was pacing back and forth now, short, sharp bursts of restless motion, his tail lashing from side to side. "We need each other, Nahiri, whether you want to admit it or not. I know what it's like to be where you are now. Who else can say that? Who else will truly be able to comprehend the darkness and self-loathing of what you've done? Who else will understand?" He stopped abruptly and swung to face her again. A note of pleading entered his voice. "Let me help you heal—and help #emph[me ] heal. "
Disbelief flashed through Nahiri. Heal? #emph[Heal? ] With her plane wrecked, her spark torn from her, and her body reshaped in ways that would tell the tale of Phyrexia's claws in her until the end of time? While he stood there, looking unscathed by the ordeal, looking #emph[whole] ? But of course he would. He'd had friends to pull him out from the mess and patch him up and take care of him, whereas she—she had only ever had herself.
"Don't you dare tell me what I need, you miserable cat," Nahiri hissed. "You don't know the half of what I've gone through. You don't know what's been done to me. You don't know what sins I've committed."
"#emph[So talk to me] . I #emph[want ] to help you."
"No," Nahiri spat. "Who are you to come here and lecture me about what I should or should not be doing? What gives you the right? You and your friends are what got me in this state"—she swept a hand over her body—"in the first place. If you want someone to talk to about all this, go find Nissa. Or Chandra, she's your friend, isn't she? Why aren't you crying on her shoulder?"
Another flinch, this one sharper. A dangerous growl rose in Ajani's throat.
Nahiri knew she should have stopped then, but a recklessness had seized her. The edges of the hedron dug into the palm of her hand, the pain a sharp, focusing clarity. "I was only involved in this mess because of your weakness. Do you think they would've had to call on the likes of me if the great <NAME> hadn't fallen? Hadn't stood at Elesh Norn's side and told her exactly how to beat them? You slaughtered the gods of Theros. You murdered <NAME>. And now you want to stand here and tell #emph[me ] how I should atone?"
A look of fury suffused Ajani's face, and a full-throated snarl ripped him, an anguished sound more animal shriek than anything else. His claws unsheathed, and Nahiri didn't have to guess at the expression of murderous grief on his face.
She yanked on the stone around her, flinging it between the two of them. She'd only meant to form a wall, something to slow him down while she scaled the Skyclave's hull, but then stone buckled under her feet, and she realized she'd overestimated the strength she'd needed. She had the space of a breath to realize the mistake she'd made, and then the dome of the Skyclave collapsed beneath her feet.
#figure(image("002_Beyond Repair/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
The last thing she saw was Ajani's eyes widening in alarm as he lunged toward her, one paw outstretched, mouth open to shout her name.
She fell.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
A jagged smear of light soared distantly above: a hole in the roof of the Skyclave, a tear in the fabric of the plane. At first, surfacing from unconsciousness, Nahiri could only stare. The hole was so distant that it didn't make sense. Surely she should be dead after having fallen so far. And yet here she was, still alive somehow, through sheer luck and nothing else.
She tried to sit up, and nearly screamed as her shoulder flamed with pain. She put a hand to it and touched a shard of metal, a claw that had pierced through the back of her shoulder and out the other side. Phyrexian metal. She had fallen on the cairn she herself had created.
She almost couldn't make herself reach over and grab the metal. The pain when she pulled it free made her yell. But then it was out, and she lay there, shoulder throbbing and her nose filling with the smell of blood. She could do it. Pain was a temporary state of being. Flesh could always heal. As soon as she was a Planeswalker again, this would be nothing more than a distant memory—
Her hands were empty. Where was the hedron?
Nahiri bolted upright, eyes already darting across the cairn. She'd been holding the hedron when she fell, which meant it had to have fallen with her~ yes, there it was, nestled in a curve of jagged metal halfway down. She crawled toward it, metal edges biting into her hands and knees.
As soon as she picked it up though, she knew something was wrong. The slices of thin, fragile stone that had petaled around the core were cracked, and even the ones still intact looked duller, rougher. It must have been shattered in the fall. She couldn't feel her spark at all.
For a moment all Nahiri could do was sit there and stare. Whatever essence of herself had been infused in the stone was there no longer. Her last hope at regaining her power—at becoming a Planeswalker once more—was gone. All she had left to fix Zendikar with was herself: powerless.
She would have laughed, if she didn't think it would break her apart.
She let the hedron drop from her hand. It tumbled down the side of the cairn, and she didn't bother to see which way it fell.
By the time she finally emerged back to the top of the Skyclave, the pain in her shoulder had settled into an insistent throb. She had to step carefully; the whole of the Skyclave's dome felt fragile, and she was so exhausted and half-blind with pain that she couldn't have reinforced so much as a single tile. Ajani was nowhere to be seen.
Nahiri was aware of an emotion building within her, something deep and warm and familiar. There was grief, that long, slow sorrow for her plane that had suffered so much and been broken so many times. But beneath that was something even hotter, and more familiar.
Anger.
She could see it all so clearly now. The real threat, the real problem, was not herself. It was not even Phyrexia. It was Planeswalkers. This was what Planeswalkers did. They went to a new plane, wreaked havoc on it, then departed without further thought for the damage they caused. Just as Ajani had come here, seeking her for his own selfish purposes, ruined her last chance of truly healing Zendikar, and then ran away, leaving her to deal with the consequences of his actions.
She should know. She used to be one herself.
Nahiri clenched her fists, feeling her nails bite into her palms. The fury felt good, the warmth of it comforting and familiar. Anger she knew. Anger she could harness, could use to fuel more works in the future.
And she knew what she needed to do next.
If not for Planeswalkers, Phyrexia wouldn't have been able to reach across the Multiverse, and Zendikar wouldn't have been blighted as it had. Sorin and Ugin would never have been able to bind the Eldrazi in her home, all those thousands of years ago, and awaken the Roil. As long as people like them existed, her home would always be under threat.
Zendikar had always been able to recover from the ravages that had been wrought on it. But even planes grew weary, and sooner or later it would encounter something—or someone—that broke the heart of it beyond all repair.
Not if she could help it, though.
She was done with hiding away in the dark. She might not wield the power she previously had, but that didn't mean she was helpless.
There were still things she could do. Still ways, perhaps, to close Zendikar off from outside forces who would do it harm.
#figure(image("002_Beyond Repair/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Nahiri looked out over the wreck of her plane, her beautiful, blighted, broken home. She would protect it until her last breath. She was still Zendikar's guardian, after all. She would always be Zendikar's guardian.
"No more," she breathed. "No more pain. No more suffering." Her voice hardened with furious conviction. "Whatever it takes, I swear. No Planeswalker will set foot on Zendikar ever again."
|
|
https://github.com/imkochelorov/ITMO | https://raw.githubusercontent.com/imkochelorov/ITMO/main/src/algorithms/s2/l4/man.typ | typst | #import "template.typ": *
#set page(margin: 0.4in)
#set par(leading: 0.55em, first-line-indent: 0em)
#set text(font: "New Computer Modern")
#show par: set block(spacing: 0.55em)
#show heading: set block(above: 1.4em, below: 1em)
#show heading.where(level: 1): set align(center)
#show heading.where(level: 1): set text(1.44em)
#set page(height: auto)
#set page(numbering: none)
#set raw(tab-size: 4)
#set raw(lang: "py")
#show: project.with(
title: "Алгоритмы и Структуры Данных. Лекция 4",
authors: (
"_scarleteagle",
"imkochelorov"
),
date: "6.03.2024",
)
= Splay-дерево
Splay-дерево --- обычное дерево поиска, которое является сбалансированным, благодаря операции `splay`\
\
Операции Splay-дерева:
- `find(x)`
- `insert(x)`
- `remove(x)`
- `splay(x) # перестроить дерево так, чтобы x стал корнем`
#align(center)[#image("1.png", width: 45%) дерево поиска]
\
Зададим 3 преобразования дерева, поднимающие необходимый нам элемент наверх
== Преобразование дерева _зиг_
$p$ --- корень, нужно поднять $x$ --- сына $p$\
#v(0.2cm)
Повернём $(x, p)$\
#align(center)[#image("2.png", width: 80%) операция _зиг_]
== Преобразование дерева _зиг-зиг_
$x$ --- сын $p$, сына $g$, ориентация $(p, space g)$ и $(x, space p)$ совпадает.\
Поднимем $x$ на место $g$.\
#v(0.2cm)
Повернём $(p, space g)$, повернём $(x, space p)$\
#align(center)[#image("3.png", width: 100%) операция _зиг-зиг_]
== Преобразование дерева _зиг-заг_
$x$ --- сын $p$, сына $g$, ориентация $(p, space g)$ и $(x, space p)$ не совпадает.\
Поднимем $x$ на место $g$.\
#v(0.2cm)
Повернём $(x,space p)$, повернём $(x,space g)$\
#align(center)[#image("4.png", width: 100%) операция _зиг-зaг_]
== `splay(x)`
Находим $x$ в дереве, идём снизу вверх, поднимаем $x$ наверх, делая _зиг_, _зиг-зиг_ или _зиг-заг_\
#align(center)[#image("5.png", width: 15%) $T(mono("splay"))=O(H)$]
== `find(x)`
В конце `find(x)` сделаем `splay(x)`.\
$T(mono("find"))=T(mono("splay"))$\
Если мы не нашли $x$, сделаем `splay` от последней вершины, до которой дошли.
== `insert(x)`
В конце `insert(x)` делаем `splay(x)`.\
$T(mono("insert"))=T(mono("splay"))$
#v(0.2cm)
Введём ещё две операции// потому что почему бы и нет
- `merge(T1, T2)` --- $forall x in T_1, y in T_2: x < y$
- `split(x)` $--> (T_1, T_2): forall y in T_1: y <= x, forall y in T_2: y > x$
== `merge(T1, T2)`
```
def merge(T1, T2):
x = findMax(T1)
splay(x)
root1.right = T2
```
== `split(x)`
```
def split(x):
find(x)
T2 = root.right
T1 = root
root.r = None
return (T1, T2)
```
== `remove(x)`
```
def remove(x):
find(x)
merge(root.left, root.right)
```
== Доказательство асимптотики `splay(x)`
*Утверждение*: $tilde(T)(mono("splay"))=O(log n)$\
#v(0.2cm)
*Доказательство*: воспользуемся методом потенциалов\
#v(0.2cm)
$tilde(T)("op")=T("op") + Delta phi$\
#v(0.2cm)
$s(v)$ --- размер поддерева $v$\
#v(0.2cm)
$r(v)$ --- ранг вершины $v$\
#v(0.2cm)
$r(v) eq.def log_2 (s(v))$\
#v(0.2cm)
$phi = limits(sum)_v r(v)$\
#v(0.2cm)
*Лемма:* #rect($tilde(T) (mono("splay(x)")) <= 3 (r("root") - r(x)) + 1$)
#v(0.2cm)
+ $tilde(T)(italic("зиг"))=1+(r'(x)+r'(p)-r(x)-r(p))$, где $r'$ --- новый ранг, $r$ --- старый ранг\
#v(0.2cm)
$r'(p)<r(p)$\
#v(0.2cm)
$tilde(T)(italic("зиг"))=1+(r'(x)+r'(p)-r(x)-r(p))<=1+r'(x)-r(x)<=1+3 (r'(x)-r(x))$\
#v(0.2cm)
*_Итог:_*
$tilde(T)(italic("зиг")) <= 1 + 3 dot (r'(x) - r(x))$\
+ $tilde(T)(italic("зиг-зиг"))=2+(r'(x)+r'(p)+r'(g)-r(x)-r(p)-r(g))$\
#v(0.2cm)
$r'(x)=r(g)$\
#v(0.2cm)
$r(x)<=r(p)$\
#v(0.2cm)
$r'(p)<=r'(x)$
#v(0.2cm)
$tilde(T)(italic("зиг-зиг"))=2+(r'(x)+r'(p)+r'(g)-r(x)-r(p)-r(g))=2+(r'(p)+r'(g)-r(x)-r(p))<=$\
#v(0.2cm)
$<=2+r'(p)+r'(g)-2r(x)<=2+r'(x)+r'(g)-2r(x)$\
#v(0.2cm)
*Утверждение:* $2+r'(x)+r'(g)-2r(x) <= 3 (r'(x)-r(x))$\
#v(0.2cm)
*Доказательство:*\
#v(0.2cm)
$r'(x)+r'(g)-2r(x)-3r'(x)+3r(x)<=-2$\
#v(0.2cm)
$-2r'(x)+r'(g)+r(x) <= -2$\
#v(0.2cm)
_Рассмотрим:_ $(r(x)-r'(x))+(r'(g)-r'(x))$.\
#v(0.2cm)
$log_2 s(x)/(s'(x)) + log_2 (s'(g))/(s'(x))$\
#v(0.2cm)
_Заметим:_ $s'(g)+s(x) <= s'(x)$\
#v(0.2cm)
$underbrace((s'(g))/(s'(x)), a) + underbrace((s(x))/(s'(x)), b) <= 1$\
#v(0.2cm)
$a + b <= 1$\
#v(0.2cm)
$log_2 a + log_2 b = log_2 (a b)$\
#v(0.2cm)
*_Итог:_* $tilde(T)(italic("зиг-зиг")) <= 3 (r'(x) - r(x))$\
#v(0.2cm)
+ $tilde(T)(italic("зиг-заг")) <= 3 dot (r'(x) - r(x))$ --- домашняя работа #emoji.face.happy\
*Итого:*\
#v(0.2cm)
$tilde(T)(italic("зиг")) <= 1 + 3 dot (r'(x) - r(x))$\
#v(0.2cm)
$tilde(T)(italic("зиг-зиг")) <= 3 dot (r'(x) - r(x))$\
#v(0.2cm)
$tilde(T)(italic("зиг-заг")) <= 3 dot (r'(x) - r(x))$\
\
`splay(x)`: $r(x) --> r'(x) --> r''(x) --> dots$\
#v(0.2cm)
$3 dot (r'(x) - r(x)) + 3 dot (r''(x) - r'(x)) + 3 dot (r'''(x) - r''(x)) + dots$ --- _телескопическая сумма_\
#v(0.2cm)
$3 dot (cancel(r'(x)) - r(x)) + 3 dot (cancel(r''(x)) - cancel(r'(x))) + 3 dot (r'''(x) - cancel(r''(x))) + dots$\
#v(0.2cm)
$3 dot r (root) - 3 dot r(x) + 1$
== Заключение
Splay-дерево не является каким-то _странным_ деревом. Мы не накладывали никакого дополнительного инварианта или ограничения на двоичное дерево поиска, как делали для AVL-дерева. Мы даже не рассматривали как выглядит Splay-дерево, потому что оно никак не отличается от обыкновенного дерева поиска, кроме операции `splay(x)` и может быть хоть бамбуком
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/037%20-%20Ravnica%20Allegiance/014_The%20Gathering%20Storm%3A%20Chapter%2020.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"The Gathering Storm: Chapter 20",
set_name: "Ravnica Allegiance",
story_date: datetime(day: 23, month: 10, year: 2019),
author: "<NAME>",
doc
)
#emph[Vraska and Lavinia.] Ral looked at the pair of them and narrowed his eyes. #emph[But it’s not, is it?]
"Lavinia would never work for Bolas," he said aloud. "Not voluntarily."
"He has a sort of . . . emissary," Kaya said. "A fragment of his spirit, I think. It can control people."
Ral, remembering <NAME> and his attempted coup at Selesnya, nodded slowly. "I’ve met the thing."
"So . . ." Hekara said. "Is she on our side, or their side, or what?"
"She’s on their side," Ral said. "But try not to kill her."
"Ah, Ral," Lavinia said, stepping forward. The voice was hers, but the tone, the manner, was all wrong. It was Bolas, or at least the fragment of Bolas that had been flitting around Ravnica. "In the old days, such concerns would never have troubled you. When did you get so soft-hearted?"
"When I got away from you," Ral said.
"So quick to anger, too." Lavinia put on a self-satisfied smirk. "Almost like you have something to be ashamed of."
"I’ve done a great many things I’m ashamed of," Ral said. He looked at Vraska. "That doesn’t mean I have to add to my sins by helping #emph[him] ."
"Don’t pretend you understand me, Zarek," Vraska said, loosening her saber in its scabbard. "And don’t try to claim the moral high ground here. There’s a ruined city full of my people you have to account for."
"We had no choice," Ral said. "If #emph[you] hadn’t betrayed us in the first place—"
His eyes went back to Lavinia, who was still smiling. Ral stopped abruptly.
"They want to drag this out," he said quietly. "If Bolas gets away from Niv-Mizzet, he can smash this place to fragments. We have to end this as quickly as we can."
Kaya gave a grim nod. "So what’s the plan?"
"I’ll handle Lavinia." Power crackled in his hands. "I can probably stun her. You and Hekara keep Vraska busy. Don’t get too close, she can—"
"I’ve fought gorgons before," Kaya said. "I can handle myself."
"And besides, turning to stone might be fun," Hekara said. "I would try to make sort of a silly face, like #emph[bleh] ! And then that’d be a statue forever."
"Let’s try to avoid that," Ral said.
He stepped to the left, toward Lavinia, while Kaya circled to the right and Hekara walked nonchalantly down the middle. Vraska and Lavinia both drew their swords, matching their opponents. Ral gave the gorgon a last glance, then shook his head and concentrated on his own opponent. #emph[I hope Kaya’s high opinion of herself is justified.]
He’d never seen Lavinia fight. In her Azorius days, however, she’d been a famed duelist, and her crisp stance with the blade indicated she hadn’t let her skills go to rust. Ral raised one hand and launched an exploratory bolt of lightning, which crackled across the room and earthed itself on her chest. Lavinia didn’t flinch, and magic glowed from her armor.
#emph[Lightning ward.] Like Glademaster Garo, she’d come prepared. #emph[So this isn’t going to be easy.]
Another step forward, and Lavinia moved, as suddenly as if he’d crossed a tripwire. Her footwork was so smooth she seemed to flow over the ground, sword flicking out in a casual thrust that would have run Ral through the throat. He sidestepped, caught her next swing on the steel bracer extending back from his mizzium gauntlet, and let loose a burst of lightning at close range. This time Lavinia #emph[did] flinch, but only slightly, and the lightning ward buzzed as it consumed most of the power. Lavinia reversed her swing, and Ral retreated to put a steel support pillar between them. He thought furiously as she circled around.
#emph[I could overload the ward. ] That’s what he’d done to Garo, but it had its risks. It would use up much of the power left in his accumulator, and probably kill Lavinia if he didn’t gauge the discharge just write. #emph[Damn, damn, damn. I should have insisted on sending someone with her. She said she was tracking down Bolas’s lead agent—that has to be Tezzeret.] #emph[He must have gotten the drop on her.]
"What’s the matter, Ral?" Lavinia said, in Bolas’s mocking tone. "You don’t seem to be throwing yourself into violence with your usual verve."
"Why Lavinia?" Ral said, circling cautiously. "If you wanted someone here to stop me, why not send Tezzeret?"
"Because you’d love the chance to settle the score with Tezzeret," Bolas said. He made Lavinia’s face pout, the expression looking utterly unnatural on her. "But hurting poor Lavinia will break your heart."
"Break my #emph[heart] ?" Ral said, incredulously. "This is to hurt #emph[me?] "
"Oh, you have no idea what I’m going to do to you," Bolas said. "I don’t like it when people don’t pay their debts, <NAME>. I made you what you are, and when I asked for a favor in return, you turned your back on me. For that, Lavinia’s going to die. Your friends here will die. But #emph[you] I will keep, because you are going to watch everyone you care for die screaming. Starting with poor little Tomik. Such a #emph[nice] boy." Lavinia’s lips twisted unnaturally into the dragon’s awful grin.
Ral did his best to keep a lid on his anger. "Seems like a lot of work for someone busy taking over the Multiverse."
"It’s worthwhile to pay my debts. It . . . creates a useful reputation. Besides, it amuses me." Bolas shrugged. "On the other hand, maybe I’ll just kill you here and now. We’ll have to see—"
Lavinia shot forward again, fast enough that Ral nearly missed the move and got skewered. He threw himself to one side as her sword scraped against the support pillar, drawing sparks. Her leg hooked out and wrapped around his, sending him tumbling to the floor, and he rolled sideways just in time to avoid a downward strike. Ral put his hands out, unleashing a powerful burst of energy, and the force of it picked Lavinia up and hurled her against a pillar. Her armor rang against it with a sound like a gong, and she dropped to one knee.
Ral grabbed a hanging cable and hauled himself to his feet. Lavinia straightened up as well, a line of red dribbling from the corner of her mouth.
"Oh, I felt that." Her lip quirked. "Or rather, Lavinia did. Careful with your toys, Ral, or you’ll end up breaking them."
#emph[Damn and double damn.] He glanced briefly over his shoulder and saw Vraska and Kaya dancing among the steel pillars. Kaya couldn’t seem to get close enough to use her daggers, but her ability to simply walk through the obstacles had kept her out of the way of Vraska’s serrated sword and away from her deadly gaze thus far. Hekara lurked at the edge of the fight, sending razor-edged projectiles at the gorgon whenever she had a clear shot.
#emph[Holding their own, but not winning.] And Bolas had to be getting closer. #emph[We need to get past them—]
Ral glanced at the security keyboard, but Lavinia followed his gaze and shook his head.
"Thinking of running out on me, Zarek? The dance is only half done." She raised her blade. "Come on, then."
#emph[No choice.] Ral let power gather in his gauntlets as he closed the distance. He ducked under a slash, blocked another with his bracer, and reached for Lavinia. She spun away, laughing and cutting at him from another angle. Ral went after her, pent-up power in his gauntlets growing white-hot, but she was too fast. Her counterstrokes nearly caught him several times, and he had to desperately backpedal to avoid a quick sideways cut.
"Ral!" A pair of Hekara’s knives sailed past Lavinia, making her take a half-step back. The razorwitch summoned more, blades dropped into existence in her hands, and Lavinia ducked and dodged through the pillars, the knives caroming off the steel. Ral, catching his breath, went after her.
"Try and hold her attention!" Ral called.
"That’s what she said!" Hekara called back.
"I don’t—" Ral shook his head as the girl cackled, and kept his mind on the fight.
Having to watch Hekara restricted Lavinia’s movements, and Ral quickly closed in. Soon Lavinia was on the defensive, slashing to keep him away while she ducked and dodged the barrage of blades. Ral waited until one strike came a little too far forward, then bulled into it, scraping the sword away with one bracer as he brought his other hand around, crackling with deadly power—
"Ral!" Lavinia shouted, in her own voice. "Don’t!"
Ral hesitated. Not for long, but it was enough. Bolas’s smile coiled across Lavinia’s face, and she kicked him in the stomach, doubling him over. He sank to his knees, gasping for breath.
"Idiot," Bolas said, as Lavinia’s sword came forward.
There was a moment of frantic motion, and then a moment of stillness.
The three of them were close, close enough to embrace. Ral, struggling to rise, and Lavinia, her blade extended. Between them was Hekara, taking Lavinia’s sword high in the chest. It passed cleanly through her leather-motley suit, the tip emerging a few inches from her back just inside the shoulder blade, far enough to dimple Ral’s skin without piercing it.
Ral’s caught her before she could fall. "Hekara!"
She leaned back to look up at him, still grinning. "Mates, right?"
"Mates," Ral said, through gritted teeth.
"‘Sides," Hekara said, her hands coming up to touch the spot where Lavinia’s sword entered her flesh, "never been stabbed all the way through before. Always wondered what it was like." She coughed, spraying blood across the steel, and stared at it in fascination. "‘S not so bad. Doesn’t hurt as much as I thought."
Lavinia stepped away, pulling her sword free with a tooth-rattling scrape of blade on bone. Hekara’s eyes went very wide, and a gout of blood pulsed from the wound.
"Oh," she said in a small voice. "That’s more like it." And she died, with a little shiver that jangled the bells in her hair.
"You see, Ral?" Bolas said. "You see what your mercy gets you—"
Ral surged to his feet with a roar, springing across Hekara’s body. Lavinia pivoted and swung, and Ral blocked with his bracer, sword impacting with bone-shaking force. Before she could pull it away, his other hand shot out, grabbing the blade near the base. It cut into his palm, but he didn’t care—power surged through him, flowing down the wires linking his accumulator to his gauntlets, torrenting into the steel. The blade began to smoke, and Lavinia let go of it reflexively as it grew too hot to touch. It sizzled as it hit the floor, glowing cherry-red, slowly losing its shape as it melted into a pool of slag.
Lavinia danced backward, but Ral stayed with her, grabbing her arm and yanking her off balance. She aimed a kick at his midsection, and he accepted it with a grunt, his other hand grabbing for her throat. There was something there, a bit of metal with a glowing crystal in it, that Ral had seen when she’d leaned in to stab Hekara. He didn’t know what it was, but the look of the thing made its origin unmistakable. #emph[Tezzeret.] He grabbed it and yanked it free.
"#emph[Still] you persist in your attempt to—" Lavinia, backing away from him, stumbled and clutched at her head. "No. Stop it." And then, in a voice much more like Lavinia’s own, she bellowed, "#emph[Get out of my head!] "
She doubled over, clutching her skull, and something burst out of her. A misty, spectral shape took form above her as she collapsed to the floor. It was indistinct, but nevertheless Ral could see its outlines—vaguely humanoid, but the head was topped by long, curving horns.
#emph[Poor fools.] The voice was Bolas through and through, now, scraping against Ral’s thoughts. #emph[All I have to do is find another body. You know you can’t stop me.]
"He can’t," said Kaya, emerging through a pillar in a burst of purple light, "but I sure as hell can." A pair of daggers, ablaze with energy, caught the Bolas-thing in the back. "I think we are all #emph[very] sick of you."
The spirit made a sound that started as a dragon’s roar and rose to a teakettle scream. Its incorporeal form writhed, then blew apart like a dandelion touched by the wind, bits of its essence scattered in all directions before fading away.
"Hated that bloody thing," Kaya muttered. Then, taking in the two women on the floor, her breath caught. "Hekara—"
"Kaya, down!" Ral shouted. His hand came up, and lightning crackled out, but his aim was off and it struck and earthed on the steel pillar beside Vraska. The gorgon swung around it, serrated sword whistling through the air.
Kaya got her daggers up in time to block the cut, but the force of the blow knocked her back. Before she could recover, Vraska brought the saber around in a vicious pommel strike that cracked the guard against Kaya’s temple. Kaya crumpled, laid out on the floor beside Hekara and Lavinia. Vraska stalked past the three unmoving bodies, tendrils spread and writhing, focused on Ral.
"Brave girl," Vraska hissed. "But foolish, to take her eyes off the more dangerous opponent."
Ral gave ground, backing toward the outside edge of the room. He sent a bolt of lightning at the gorgon, but she dodged behind a steel pillar, and his electricity wrapped uselessly around it.
"I, on the other hand, have been watching #emph[you] ," Vraska said. "And what I know is that you spent entirely too much of your power. Melting Lavinia’s sword?" She clicked her tongue. "Surely that was unnecessary."
"I have enough left to deal with you," Ral said, still backing up. He didn’t dare let her close—at short range, there was no way to avoid the gorgon’s deadly gaze. Electricity still crackled over his gauntlets, but Vraska was right. He’d spent power recklessly, here and fighting the soldiers down below.
"Then do it." Vraska stepped away from the pillar, matching Ral’s easy steps backward. They were well away from the core of the beacon now, approaching the exterior of the dome. "Blast me to pieces. Go on." When he didn’t move, her grin widened, tongue darting over sharp teeth. "As I said."
"Is this really what you want?" Ral said, letting a hint of desperation into his voice. "For Bolas to win? You think he’ll let you keep running your little empire?"
"Of course not," Vraska said. "I’m sure he’ll kill me as soon as I’m no longer useful."
"Then—"
"But you’re missing the point," Vraska said. "He’s going to win #emph[anyway] . Niv-Mizzet can’t stop him. Your beacon won’t stop him. And if the only chance for the Golgari to survive is to join the winning side . . ." She shrugged. "I have to take it. No matter what the cost."
"He lies. You should know that. Whatever he’s promised you, he has no reason to deliver."
"I know." Vraska’s eyes narrowed. "But it’s all I’ve got."
Ral’s back came up against the copper dome. Vraska licked her lips.
"Nowhere to run, Zarek." She levelled her sword. "We’ve done this before. And this time, there’s no angel to rescue you."
"There isn’t," Ral agreed. "But #emph[this] time, we’re on my turf, not yours."
He reached up, and found the edge of one of the gratings that let wires and conduits pierce the dome and reach the outside of the tower. It was made of thin copper wire, twisted together, and Ral sent all the power left in his backpack running through it. It sparked, then sagged, melting away. Cables flopped to the ground, leaving an opening in the dome a yard square.
Outside, the storm had finally broken. Rain drummed down on the city in torrents, ringing on the dome and sluicing off it in sheets. The dark clouds that had hovered all day had descended, and bright bolts leapt from one to the next, followed by distant peals of thunder. Ral could feel their power echoed inside him, raising the hairs on the back of his neck. He smiled, very slowly.
"You beat me when we fought in the Undercity," he said. "Now let me show you how powerful I am here, under the skies of Ravnica!"
Vraska snarled and lunged forward, eyes beginning to glow with their killing light. But it was far too late. Lightning arced out from the closest clouds, a dozen strokes at once, groping like searching fingers for the hole in the dome. They threaded through it like the eye of a needle and slammed into Ral, surrounding him with a crackling, scintillating aura of brilliant white. Every hair on his head stood on end. Pieces of his backpack whined and fused, but he didn’t need it, not now. He raised one hand, and let the power flow. The bolt was a monster, fed by the pent-up energy of the long-denied storm, and it crossed the space between him and Vraska in a fraction of a second.
When the light faded, she was gone, replaced by a long smoking streak on the steel floor.
Ral staggered as the power faded. Channeling that much was difficult, even for him, and combined with everything that had come before he suddenly felt as though he’d run laps around the Tenth District. #emph[Nearly done.] He forced himself to keep moving, lurching across the room.
He knelt beside Hekara, on her back in a pool of crimson, and reached down to close her staring eyes. Beside her lay Lavinia, and Ral made sure she was breathing easily. He did the same for Kaya, a few paces further on; there was blood on her head where Vraska’s sword-hilt had cut her, but it didn’t look like the blow had cracked her skull. Satisfied she would be all right, he struggled to his feet and shuffled onward.
When he finally stood in front of the beacon, staring down at the security keyboard, his mind went suddenly blank. For a moment, his stomach churned, terrified.
#emph[Elias.] A bit of music his lover had tapped on a keyboard, a lifetime ago. Before #emph[everything] . Ral reached down, hand trembling, and pressed the keys.
With a hiss, the core of the beacon opened. Above the keyboard, a single large button emerged from a locked compartment. Only one control, in the end, because the beacon had only one function. Once it was turned on, its light would shine across the Multiverse.
The button was, of course, bright red. What Izzet engineer could resist?
#emph[Well.] Ral stared at it for a moment, then took a deep breath. #emph[It’s time to roll the dice.]
He brought his hand down hard.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Deep under the city, the kraul death priest Mazirek scuttled through a damp tunnel. Storrev glided along beside him, resplendent in her rotten finery, and an escort of Erstwhile flanked the pair of them. Mazirek paid the zombies little heed; his mind was elsewhere.
Storrev had brought a message arranging a meeting. She didn’t know the source, but it was obvious to Mazirek, given the timing. #emph[Bolas.] With Vraska gone to serve the dragon directly—#emph[and hopefully to die painfully] —Bolas had promised Mazirek leadership of the Golgari. #emph[Finally, the power I deserve.] The time had come for the dragon to deliver on his pledges.
But he didn’t know #emph[where] this messenger was supposed to be meeting him. These were passages he’d never entered before, veering close to the surface and interlaced in places with the basements of some parts of the upper city. It made sense—Bolas was a creature of the surface in the end, and like all surface dwellers he was uncomfortable venturing too far into the underground kingdom of the Swarm. Still, Mazirek looked around a little nervously as Storrev led him through an archway of natural stone and into a larger cavern, which looked like it had been enlarged by human hands.
"How much farther to this messenger?" Mazirek said, the words slurred and strewn with clicks.
"I believe we have arrived." Storrev looked around the broad, dark chamber. "We have only to wait."
"I do not like waiting." Mazirek’s many eyes narrowed. "Have you lied to me, Storrev?"
He let power bleed into his voice. He was the one who had awoken the Erstwhile. None of them, even free-willed liches like Storrev, could disobey a direct order or refuse a question.
"No, my lord." The lich bowed. "I received a message requesting a meeting. I have brought you to the place it specified."
"A message from #emph[whom] ?"
"No one I know," Storrev said.
Not Vraska, then. Mazirek was still half-convinced this was some trap of the gorgon’s. He looked around, irritably, and caught the glint of burning torches against the moisture-slick walls. A man was approaching, wrapped in a hooded cloak.
"You!" Mazirek clicked at him. "You are the messenger."
"Yeah," he grunted. "I’m Brutus, of Brutus’s Improvised Comedy Fun-Time Show." His hood fell back, revealing a large, bald head, layered over with scars.
"#emph[Comedy] show?" Mazirek said. "What nonsense is this?"
"You don’t look very funny," Storrev said.
"Lotta people say that," Brutus rumbled. He reached under his cloak and came up with a huge butcher’s cleaver, flecked with rust and dried blood. "But wait till you hear the punchline."
"What?" Mazirek chittered. "Are you #emph[threatening] us?"
"Nope," Brutus said. "Just doing a favor for Hekara. She asked me to tell you that Vraska sends her regards."
"Insolent—"
Mazirek raised one claw to obliterate the fool, then paused as something moved in the dark. More figures in Rakdos red and black emerged into the light of the torch, all around them, broad-shouldered and well-armed. None of them looked particularly interested in comedy.
"Storrev!" the kraul screeched. "You knew."
"I did," the lich said. "Though, as I said, I have never met Brutus before."
"You will defend me," he said. "You and your Erstwhile. Defend me to the death!"
Storrev inclined her head. "I knew you would order that, as well."
The Rakdos thugs closed in.
"You will be destroyed!" Mazirek shouted.
"Sacrifices are necessary," Storrev said. "The rest of us will be free."
Mazirek turned away from her with a snarl, death magic leaping from his claws. There were a few moments of frantic violence, then silence, broken only by ugly chuckle of Brutus’s laughter.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
#linebreak It was autumn in Ravnica, and so it rained. The torrent from the sky splashed over gutters full of shattered glass and broken bricks, and drummed on the ruins of shops and houses. It soaked the clothes of corpses, cut down in the streets or half-buried in their broken homes. It cleaned the smoke out of the air, and banished the smell of burning metal. In places, where the sewer lines had been broken, it gathered into vast, stagnant pools.
The rain soaked Tezzeret to the bone, weighing down his dreadlocks and soaking his robe. It beaded and ran down the surface of his metal arm, dripping from his clawed fingers. He shook his head, spraying water, as he turned the corner from a street that was half rubble and came into the presence of his master.
<NAME> sat in the wreckage of a row of houses, a pile of smashed bricks and shattered rafters for his throne. He looked, to Tezzeret’s surprise, very much the worse for wear. Scorch marks and broken scales were all over his enormous body, and one huge burn on his chest was crisscrossed with deep cuts that wept black blood. None of it seemed to bother the dragon unduly, though, and as Tezzeret watched the wounds began to close.
In one hand he held a huge white skull, which could only have belonged to another dragon nearly as large as Bolas himself. Scoured clean of flesh, it rested in the palm of Bolas’s enormous hand, and Bolas regarded it with a mixture of pride and something like sadness.
#emph[This world doesn’t have a chance.] Tezzeret permitted himself a private grin. #emph[It never did.] #emph[] #linebreak He crossed the street and knelt in front of the dragon. Bolas contemplated the skull for a moment longer, then set it carefully aside and looked down at Tezzeret.
"My faithful servant." Bolas’s urbane tone, in person, was undercut by the deep bass of the dragon’s rumble. "You have news?"
"Yes, master." Tezzeret got to his feet. "Matters are proceeding well, and we have encountered no significant resistance so far."
"#emph[You] have not." Bolas glanced at the skull. "No matter. What else?"
"<NAME> has reached the Beacon Tower," Tezzeret said, cautiously. "Vraska and your . . . ah, spirit confronted him, but they were successful. The spirit was destroyed, and Vraska’s fate is uncertain."
"And the beacon?"
Bolas had to know. Tezzeret had known, the moment it had happened. The beacon burned in his mind, a bright flame visible to any Planeswalker, an invitation to Ravnica. He cleared his throat.
"He has activated it, master."
"I see." A slow smile spread across the dragon’s enormous face. "Then everything is going according to plan."
=== The End
|
|
https://github.com/gianzamboni/cancionero | https://raw.githubusercontent.com/gianzamboni/cancionero/main/wip/whisper.typ | typst | #import "../theme.typ": *;
== Whisper
=== Burn the ballroom
#columns(2)[
Come in, sit down sweet angel \
Leave me all your tears \
Tell me all of your troubles \
The weight of your short years \
#newVerse
Love is only a river \
Drowning all of your cheer \
Sell me all of your laughter \
And I will take some of your fear \
#newVerse
Whoa-oh, whoa-oh-oh-oh-oh \
Oh-oh-oh-oh, oh-oh-oh
#newVerse
His favorite days were the mornings \
She came with confessions \
of cardinal sin \
A beast in the business \
Of selling forgiveness \
Dead eyes on a treacherous grin
#newVerse
Yet he laps up the vice \
Like a wolf in the night \
He's the left hand of God on the stage \
And with one hand he offers \
Salvation to lovers \
The other, it taketh away \
#newVerse
So give me your fire \
Give me your fear \
Give me your faith \
When love gives you tears \
#newVerse
Give me your heart \
Give me your fate \
Give me your hand \
When love gives you hate \
#newVerse
Give me your prayers \
Up on your feet \
And I'll give you a show \
It helps fill the seats
#newVerse
So give me your sins \
Give me your lies \
But whisper your love \
And I'll whisper mine \
#newVerse
His favorite line was \
the one formed outside \
When they trade in \
confessions for lies \
#newVerse
A beast in the business \
Of selling forgiveness \
And buying salvation with wine \
And he cries out to God \
"How can you claim them all \
When I know that they are all mine?" \
#newVerse
So give me your fire \
Give me your fear \
Give me your faith \
When love gives you tears \
#newVerse
Give me your heart \
Give me your fate \
Give me your hand \
When love gives you hate \
#newVerse
Give me your prayers \
Up on your feet \
And I'll give you a show \
It helps fill the seats
#newVerse
So give me your sins \
Give me your lies \
But whisper your love \
And I'll whisper mine \
#newVerse
Whoa-oh, whoa-oh-oh-oh-oh \
#newVerse
Give me your fire \
Give me your fear \
Give me your faith \
When love gives you tears \
#newVerse
Give me your heart \
Give me your fate \
Give me your hand \
When love gives you hate \
#newVerse
Give me your prayers \
Up on your feet \
And I'll give you a show \
It helps fill the seats
#newVerse
Give me your sins \
Give me your lies \
But whisper your love \
Whoa, oh-oh \
#newVerse
Come in, sit down, sweet angel \
And I will take some of your fear \
#newVerse
So give me your fire \
Give me your fear \
Give me your faith \
When love gives you tears
#newVerse
Give me your heart \
Give me your fate \
Give me your hand \
When love gives you hate \
#newVerse
Give me your prayers \
Up on your feet \
And I'll give you a show \
It helps fill the seats
So give me your sins \
Give me your lies \
But whisper your love \
(and I'll whisper mine) \
] |
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/PianoDiProgetto/sections/ConsuntivoSprint/QuattordicesimoSprint.typ | typst | MIT License | #import "../../const.typ": Re_cost, Am_cost, An_cost, Ve_cost, Pr_cost, Pt_cost
#import "../../functions.typ": rendicontazioneOreAPosteriori, rendicontazioneCostiAPosteriori, glossary
==== Quattordicesimo consuntivo
*Inizio*: Venerdì 22/03/2024
*Fine*: Giovedì 28/03/2024
#rendicontazioneOreAPosteriori(sprintNumber: "14")
#rendicontazioneCostiAPosteriori(sprintNumber: "14")
===== Analisi a posteriori
La retrospettiva mostra che il team è stato in grado di rispettare le ore preventivate (61), impiegando 62.5 ore produttive per portare a termine le attività previste; questo #glossary[sprint] è stato dedicato fondamentalmente alla preparazione del prodotto software e dei documenti richiesti per la prima parte della seconda revisione #glossary[PB], ossia _Analisi dei Requisiti v2.0_ e _Specifica Tecnica v1.0_.
===== Aggiornamento della pianificazione e gestione dei rischi
L'unico rischio che si è verificato nel corso dell'ultimo #glossary[sprint] è RP1 o "Comprensione erronea dei requisiti", dovuto non tanto ad ambiguità nei requisiti documentati all'interno dell'_Analisi dei Requisiti_ (che è stata corretta per tempo subito dopo l'#glossary[RTB] secondo le disposizioni del Prof. Cardin), ma piuttosto all'interpretazione che ne hanno fatto i componenti del team durante la progettazione e, di conseguenza, lo sviluppo del prodotto software. Infatti, certi dettagli specificati nel documento non sono stati presi in considerazione, con conseguenti discrepanze (seppur lievi) tra il contenuto dell'_Analisi dei Requisiti_ e il software. Di fronte a questo rischio, i continui momenti di verifica previsti dal #glossary[framework Scrum] hanno effettivamente consentito al team di accorgersi tempestivamente del problema e di adottare il giusto approccio per risolverlo: alcuni dei requisiti sono effettivamente stati rivisti nella loro formulazione per renderli più specifici e riflettere le scelte adottate nello sviluppo, ma la maggior parte del lavoro è stata svolta sul software vero e proprio, per assicurarsi che rispettasse appieno quanto concordato con la Proponente. In altre parole, nonostante il rischio non abbia portato ad un dispendio di risorse aggiuntive particolarmente oneroso, sarebbe stato bene applicarsi per rispettare l'_Analisi dei Requisiti_ con estrema attenzione fin dall'inizio della progettazione, adottando un approccio "a priori". |
https://github.com/floriandejonckheere/utu-thesis | https://raw.githubusercontent.com/floriandejonckheere/utu-thesis/master/thesis/chapters/07-proposed-solution/06-visualization.typ | typst | #import "@preview/acrostiche:0.3.1": *
== Visualization
MOSAIK can generate visualizations of the steps in the microservice decomposition process.
The information extraction step outputs a dependency graph, where the vertices represent the classes of the monolith application, and the edges represent the dependencies between the classes.
#figure(
image("/figures/07-proposed-solution/extraction.svg", width: 60%),
caption: [Visualization of information extraction step],
) <information_extraction_graph>
As each coupling strategy can create one or more edges, the graph can contain significant visual cluttering and can be difficult to interpret.
The graph visualization implementation accepts several parameters to control the layout and appearance of the graph, such as aggregating the edges between two vertices, filtering out edges with a low weight, and hiding vertices with no outgoing or incoming edges.
The application offers multiple renderers to visualize the graph, using different layout algorithms and styles.
@information_extraction_graph illustrates the visualization of the information extraction step applied to the source code of MOSAIK.
The decomposition step does not modify the graph structure, but adds subgraphs to the visualization to indicate the microservice candidates.
@decomposition_graph illustrates the visualization of the decomposition step.
#figure(
image("/figures/07-proposed-solution/decomposition.svg", width: 60%),
caption: [Visualization of decomposition step],
) <decomposition_graph>
The graphs are rendered using the open-source Graphviz software#footnote[#link("https://graphviz.org/")[https://graphviz.org/]], which provides a set of tools for generating and manipulating graph visualizations using the DOT language#footnote[#link("https://graphviz.org/doc/info/lang.html")[https://graphviz.org/doc/info/lang.html]].
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.0.2/bezier.typ | typst | Apache License 2.0 | // This file contains functions related to bezier curve calculation
#import "vector.typ"
/// Get point on quadratic bezier at position t
///
/// - a (vector): Start point
/// - b (vector): End point
/// - c (vector): Control point
/// - t (float): Position on curve [0, 1]
/// -> vector
#let quadratic-point(a, b, c, t) = {
// (1-t)^2 * a + 2 * (1-t) * t * c + t^2 b
return vector.add(
vector.add(
vector.scale(a, calc.pow(1-t, 2)),
vector.scale(c, 2 * (1-t) * t)
),
vector.scale(b, calc.pow(t, 2))
)
}
/// Get dx/dt of quadratic bezier at position t
///
/// - a (vector): Start point
/// - b (vector): End point
/// - c (vector): Control point
/// - t (float): Position on curve [0, 1]
/// -> vector
#let quadratic-derivative(a, b, c, t) = {
// 2(-a(1-t) + bt - 2ct + c)
return vector.scale(
vector.add(
vector.sub(
vector.add(
vector.scale(vector.neg(a), (1 - t)),
vector.scale(b, t)),
vector.scale(c, 2 * t)),
c)
, 2)
}
/// Get point on cubic bezier curve at position t
///
/// - a (vector): Start point
/// - b (vector): End point
/// - c1 (vector): Control point 1
/// - c2 (vector): Control point 2
/// - t (float): Position on curve [0, 1]
/// -> vector
#let cubic-point(a, b, c1, c2, t) = {
// (1-t)^3*a + 3*(1-t)^2*t*c1 + 3*(1-t)*t^2*c2 + t^3*b
vector.add(
vector.add(
vector.scale(a, calc.pow(1-t, 3)),
vector.scale(c1, 3 * calc.pow(1-t, 2) * t)
),
vector.add(
vector.scale(c2, 3*(1-t)*calc.pow(t,2)),
vector.scale(b, calc.pow(t, 3))
)
)
}
/// Get dx/dt of cubic bezier at position t
///
/// - a (vector): Start point
/// - b (vector): End point
/// - c1 (vector): Control point 1
/// - c2 (vector): Control point 2
/// - t (float): Position on curve [0, 1]
/// -> vector
#let cubic-derivative(a, b, c1, c2, t) = {
// -3(a(1-t)^2 + t(-2c2 - bt + 3 c2 t) + c1(-1 + 4t - 3t^2))
vector.scale(
vector.add(
vector.add(
vector.scale(a, calc.pow((1 - t), 2)),
vector.scale(
vector.sub(
vector.add(
vector.scale(b, -1 * t),
vector.scale(c2, 3 * t)
),
vector.scale(c2, 2)
),
t
)
),
vector.scale(c1, -3 * calc.pow(t, 2) + 4 * t - 1)
),
-3
)
}
/// Get bezier curves ABC coordinates
///
/// /A\ <-- Control point of quadratic bezier
/// / | \
/// / | \
/// /_.-B-._\ <-- Point on curve
/// ,' | ',
/// / | \
/// s------C------e <-- Point on line between s and e
///
/// - s (vector): Curve start
/// - e (vector): Curve end
/// - B (vector): Point on curve
/// - t (fload): Position on curve [0, 1]
/// - deg (int): Bezier degree (2 or 3)
/// -> (tuple) Tuple of A, B and C vectors
#let to-abc(s, e, B, t, deg: 2) = {
let tt = calc.pow(t, deg)
let u(t) = {
(calc.pow(1 - t, deg) /
(tt + calc.pow(1 - t, deg)))
}
let ratio(t) = {
calc.abs((tt + calc.pow(1 - t, deg) - 1) /
(tt + calc.pow(1 - t, deg)))
}
let C = vector.add(vector.scale(s, u(t)), vector.scale(e, 1 - u(t)))
let A = vector.sub(B, vector.scale(vector.sub(C, B), 1 / ratio(t)))
return (A, B, C)
}
/// Compute control points for quadratic bezier through 3 points
///
/// - s (vector): Curve start
/// - e (vector): Curve end
/// - B (vector): Point on curve
///
/// -> (s, e, c) Cubic bezier curve points
#let quadratic-through-3points(s, B, e) = {
let d1 = vector.dist(s, B)
let d2 = vector.dist(e, B)
let t = d1 / (d1 + d2)
let (A, B, C) = to-abc(s, e, B, t, deg: 2)
return (s, e, A)
}
/// Compute control points for cubic bezier through 3 points
///
/// - s (vector): Curve start
/// - e (vector): Curve end
/// - B (vector): Point on curve
///
/// -> (s, e, c1, c2) Cubic bezier curve points
#let cubic-through-3points(s, B, e) = {
let d1 = vector.dist(s, B)
let d2 = vector.dist(e, B)
let t = d1 / (d1 + d2)
let (A, B, C) = to-abc(s, e, B, t, deg: 3)
let d = vector.sub(B, C)
if vector.len(d) == 0 {
return (s, e, s, e)
}
d = vector.norm(d)
d = (-d.at(1), d.at(0))
d = vector.scale(d, vector.dist(s, e) / 3)
let c1 = vector.add(A, vector.scale(d, t))
let c2 = vector.sub(A, vector.scale(d, (1 - t)))
let is-right = ((e.at(0) - s.at(0))*(B.at(1) - s.at(1)) -
(e.at(1) - s.at(1))*(B.at(0) - s.at(0))) < 0
if is-right {
(c1, c2) = (c2, c1)
}
return (s, e, c1, c2)
}
|
https://github.com/brayevalerien/Learning-Typst | https://raw.githubusercontent.com/brayevalerien/Learning-Typst/main/tutorial/04_making_a_template/template.typ | typst | MIT License | #let template(
title: none,
authors: (),
abstract: [],
content
) = {
set page(
paper: "us-letter",
header: align(right+horizon, title),
numbering: "1"
)
set par(justify: true)
set text(font: "New Computer Modern", size: 11pt)
// Title
align(center, text(size: 17pt)[*#title*])
// Authors
let count = authors.len()
let ncols = calc.min(count, 3)
grid(
columns: (1fr,) * ncols,
row-gutter: 24pt,
..authors.map(author => align(center)[
#author.name \
#author.institute \
#link("mailto:" + author.email)
]),
)
// Abstract
align(
center,
[
#set par(justify: false)
*Abstract* \
#abstract
]
)
// Define show rules for the rest of the document
show: rest => columns(2, gutter: 15pt, rest)
show heading.where(
level: 1
): it => block(width: 100%)[
#set align(center)
#set text(13pt)
#smallcaps(it.body)
]
show heading.where(
level: 2
): it => text(
size: 11pt,
weight: "regular",
style: "italic",
it.body + [.],
)
// Content
content
} |
https://github.com/yy01zz02/profile-template | https://raw.githubusercontent.com/yy01zz02/profile-template/main/src/chinese.typ | typst | MIT License | // import from template
#import "../template/template.typ": *;
#show: template;
#init(
name: "张三",
// 插入图片功能尚未支持
// pic_path: "/img/avatar.jpg",
pic_path : "",
)
#info(
color: rgb(0, 0, 0),
(
icon: "/img/fa/fa-home.svg",
link: "https://zhangsan.io/",
content: "https://zhangsan.io/"
),
(
icon: fa_github,
link: "https://github.com/NorthSecond",
content: "NorthSecond"
),
(
icon: fa_email,
link: "mailto:San%20Zhang<<EMAIL>>",
content: "<EMAIL>",
),
(
icon: fa_phone,
link: "tel:+86 133 3333 3333",
content: "+86 133 3333 3333",
),
)
#resume_section("教育经历")
#resume_item(
"家里蹲大学·计算机学院",
"硕士生 | 计算机技术",
"泵饶叙史掷陋谣邪苦豫锣旧技贸刃蛭!天绳顺。",
"2024.09 -- 2027.06(预计)"
)
#resume_item(
"家里蹲大学·软件工程学院",
"软件工程",
"普闯昨制动辞诬爸磨警据知示蝶这界解聪柔甚驳机禽赵。",
"2020.09 -- 2024.06"
)
#resume_section([实践经历])
#resume_item(
"某大厂",
"实习生",
"宇宙中心曹县",
"2021.11 -- 至今"
)
#resume_desc("工作职责", "泵饶叙史掷陋谣邪苦豫锣旧技贸刃蛭!天绳顺。普闯昨制动辞诬爸磨警据知示蝶这界解聪柔甚驳机禽赵,郎吻骑藏池莲汰炫换布牌墓吐匹儡持涤贤奉访脂拱牺慧来患赞角混越美吓凑尸涉籼!背饥砂兄着农撑棒扑,虑蹄蒲管")
#resume_desc("工作成果", "获得了某大厂的认可")
#resume_section("发表论文")
- [XXXX 2023]*You*, #lorem(5), and #lorem(1). "#lorem(10)" Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2023.
#resume_section([项目经历])
#resume_item(
"一种基于深度学习的摸鱼方法",
"项目负责人,主要完成人",
[家里蹲大学·大创项目],
"2021.11 -- 2022.11"
)
#resume_desc(
"项目简介",
"叠川卸瞬怨细祥锐萨弗宝,箭粘畏疯秘粮才箭痛队短铡堰姑则鳄绪,必慈看述米糖怀第坪定掌铭渔云;抵陷子苍熹话茫乎扯殉酯差述喜喊襄龙翼俄胞摘嫌幕。"
)
#resume_desc(
"承担工作",
[统筹安排小组计划,文献调研,算法设计与一部分实验,结论总结与报告编写。园厉搏尺枣段,彭覆般,家资颌寨偷迟色庭很大松锈虽堕纯烤?砧煮?]
)
#resume_desc(
"项目成果",
"环械深韦寨予助链削睛宴育症更碑矿火将任洁涤堆玲。"
)
#resume_section([竞赛经历与所获表彰])
#resume_desc(
"专业技能竞赛",
[肺己阐择萧精拜纱茎、掺圈剪绒鲢碧捞使永扩、逸螟株捆穿虽危熔烫行锄厉戒凹册嗨茄、王暗脉炮深竖政、怕蠢批割万柳休胁助黎嘲壤缓廷急烟顷寇;]
)
#resume_desc(
"数学建模竞赛",
[妹赋替茫竟督。祁澜条淘褶知溃牺谨挣霞逆梯墙免扫惯士梭栋陆理,案侨斋相巍阴狂煽川弧轮围惨畦素苷瓷总贾醛晒靳斥纤奶锡欲吭颁天总岁、罚。]
)
#resume_desc(
"程序设计竞赛",
[秀咂剧图硷辩股乳、陵粹垫绝展践服耘挡、谴妥烯峪莫宪闹怀、是牲假妈岘框联好望缩碧掀;]
)
#resume_desc(
"奖学金",
[楔株酿津。宋扩镗盼瞬催什斧菌潘谱昭逝迫申将酸保舰戒惊蕴鞘哩爬;]
)
#resume_desc(
"其他表彰",
[死途腋跳锻垒带抱滥狱肾杰丸蚕莎细宣逸祥时夜!绥活浦踏肥麦山银呀缚揭嘲值凹允穆表斤格略署。]
)
#resume_section([专业技能])
#resume_desc(
"编程语言",
[悬圭班,弄艘街胃海代遭颤淮,曝一帅典龟贝枕示耙灶婶挡叠师倾锦起苗待荡纪致旁报、泪哇衫截缺其爬制]
)
#resume_desc(
"开发工具",
[由讽涝稼曹涨拣,抖,壁汹役崎垒是牲供饮啉文熏灵压肆欺警巨育俞殖局说骑曾跗劲轻团舰直双品屁锐池雏趣笼久袖煤技艰哑密钠赌葱隙恋衫枝历陋拴访待禁吾、下赵釉轻禾。谴延来码灼逃。]
)
#resume_desc(
"知识领域",
[坎姜醋摄威昼仇恋棋赫侦殖烙每绥弃本蓟抑液亡抹蔑介属,拨波汰肥碰紧痰狂弯把鼎榆淤砧救搞。]
)
#resume_desc(
"外语能力",
[CET-6 666分、雅思 9.0。]
) |
https://github.com/binhtran432k/ungrammar-docs | https://raw.githubusercontent.com/binhtran432k/ungrammar-docs/main/components/cover.typ | typst | #let print_cover_head(head, department) = {
set align(center)
[
#show: upper
#set par(leading: 1.2em)
#head
*#department*
]
"____________ * ____________"
}
#let print_logo(logo) = {
if logo != none {
v(0.25fr)
align(center, logo)
v(0.50fr)
} else {
v(0.75fr)
}
}
#let print_subject(subject) = {
set align(center)
set text(size: 15pt)
upper[#subject]
}
#let print_title(title, major) = {
set align(center)
block(width: 100%, inset: (y: 2em), stroke: (y: 1pt))[
#set par(leading: 1em)
#show: upper
#text(weight: "bold", size: 18pt)[#title]
#upper(text(size: 14pt)[Major: #major])
]
}
#let print_cover_details(lecturers, students, committee, secretary, reviewer) = {
grid(
columns: (1fr, 1fr),
rows: (1.4em, 1.4em, 1.4em, 2em, auto),
column-gutter: .5cm,
align(right, [_Thesis Committee_:]), align(left, committee),
align(right, [_Supervisor(s)_:]),
align(left, for lecturer in lecturers [#lecturer]),
align(right, [_Member Secretary_:]), align(left, secretary),
align(right, [_Reviewer_:]), align(left, reviewer),
align(right, [_Students_:]),
align(
left,
for student in students [
#v(1em, weak: true)
#student.at("id") - #student.at("name")
],
),
)
}
#let print_footer(city) = {
set align(center)
[#city, #datetime.today().display("[month]/[year]")]
}
|
|
https://github.com/lublak/typst-ctxjs-package | https://raw.githubusercontent.com/lublak/typst-ctxjs-package/main/README.md | markdown | MIT License | # CtxJS
A typst plugin to evaluate javascript code.
- multiple javascript contexts
- load javascript modules as source or bytecode
- simple evaluations
- formated evaluations (execute your code with your typst data)
- call functions
- call functions in modules
- create bytecode with an extra tool (ctxjs_module_bytecode_builder)
## Example
```typst
#import "@preview/ctxjs:0.1.1"
#{
_ = ctxjs.create-context("context_name")
let test = ctxjs.eval("context_name", "function test(data) {return data + 2;}")
let returns-4 = ctxjs.call-function("context_name", "test", (2,))
let returns-6 = ctxjs.eval-format("context_name", "test({test})", (test:4))
let code = ```
export function another_test_function() { return {data: 'test'}; }
```;
_ = ctxjs.load-module-js("context_name", "module_name", code.text)
let returns-array-with-another-test = ctxjs.get-module-properties("context_name", "module_name")
let returns-data-with-test-string = ctxjs.call-module-function("context_name", "module_name", "another_test_function", ())
}
```
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/029.%20pypar.html.typ | typst | pypar.html
The Python Paradox
August 2004In a recent talk I said something that upset a lot of
people: that you could get smarter programmers to work on
a Python project than you could to work on a Java project.I didn't mean by this that Java programmers are dumb. I
meant that Python programmers are smart. It's a lot of
work to learn a new programming language. And people don't
learn Python because it will get them a job; they learn it
because they genuinely like to program and aren't satisfied with the languages they
already know.Which makes them exactly the kind of programmers
companies should want to hire. Hence what, for lack of a better
name, I'll call the Python paradox: if a company chooses to write
its software in a comparatively esoteric language, they'll be able
to hire better programmers, because they'll attract only those
who cared enough to learn it. And for
programmers the paradox is even more pronounced: the language
to learn, if you want to get a good job, is a language that
people don't learn merely to get a job.Only a few companies have been smart enough to realize this
so far. But there is a kind of selection going on here too: they're
exactly the companies programmers would
most like to work for. Google, for example. When they
advertise Java programming jobs, they also want Python experience.A friend of mine who knows nearly all the widely used languages
uses Python for most of his projects. He says the main reason
is that he likes the way source code looks. That may seem
a frivolous reason to choose one language over another.
But it is not so frivolous as it sounds: when you program,
you spend more time reading code than writing it.
You push blobs of source code around the way a sculptor does
blobs of clay. So a language that makes source code ugly is
maddening to an exacting programmer, as clay full of lumps
would be to a sculptor.At the mention of ugly source code, people will of course think
of Perl. But the superficial ugliness of Perl is not the sort
I mean. Real ugliness is not harsh-looking
syntax, but having to build programs out of the wrong
concepts. Perl may look like a cartoon character swearing,
but there are
cases where it surpasses Python conceptually.So far, anyway. Both languages are of course
moving targets. But they
share, along with Ruby (and Icon, and Joy, and J, and Lisp,
and Smalltalk) the fact that
they're created by, and used by, people who really care about
programming. And those tend to be the ones who do it well.Turkish TranslationJapanese TranslationPortuguese TranslationItalian TranslationPolish TranslationRomanian TranslationRussian TranslationSpanish TranslationFrench TranslationTelugu Translation
If you liked this, you may also like
Hackers & Painters.
|
|
https://github.com/dyc3/senior-design | https://raw.githubusercontent.com/dyc3/senior-design/main/weekly-reports.typ | typst | = Weekly Reports <reports>
#import "lib/misc.typ": github
== Week Report 25 (4/18/2024) <report-w25>
- Completed: Fix putting more than one panel in a dashboard causes panels to error #github("dyc3/opentogethertube", 1646)
- Completed: Fix poor service recovery after restarts or deploys #github("dyc3/opentogethertube", 1647)
- Completed: Add a consistent hashing `MonolithSelection` implementation #github("dyc3/opentogethertube", 1293)
- Delayed: Add legend to panel describing what each node means #github("dyc3/opentogethertube", 1427)
- Cleaned up report for printing
*Tasks for next week*
- Update localization strings for Spanish.
- Continue implementing zod validation on API endpoints.
*Figures Updated*
- Updated: @Figure::balancer-internals-class
- Updated: @Figure::deployment-new
- Updated: @Figure::ports-1-monolith
- Updated: @Figure::ports-2-monolith
- Added: @Figure::vis-dev-env-docker
- Added: @Figure::vis-dev-env-no-docker
- Updated: @Figure::discovery-class
- Updated: @Figure::discovery-sequence
- Updated: @Figure::service-discoverers
- Updated: @Figure::full-package-diagram
- Updated: @Figure::gossip-class-diag
- Updated: @Figure::manage-balanacer-connections-class
- Updated: @Figure::monolith-id-sequence
- Updated: @Figure::monolith-selection-internals-class
- Updated: @Figure::monolith-class-new
- Updated: @Figure::DOM-class-visualization
- Updated: @Figure::panel-internal-class
#figure(
image("figures/sprint-screenshots/Sprint30.png"),
caption: "Screenshot of Sprint 30."
) <Figure::Sprint30>
== Week Report 24 (4/11/2024) <report-w24>
*What we did this week*
- Completed: Make the load balancing algorithm configurable #github("dyc3/opentogethertube", 1294)
- Completed: Add client ids to system state #github("dyc3/opentogethertube", 1562)
- Completed: Created `TopologyView` for visualization #github("dyc3/opentogethertube", 1606)
- Completed: Rework `RegionView` into packed circles chart #github("dyc3/opentogethertube", 1607)
- Completed: Add `useColorProvider hook` to manage what colors are being assigned to which nodes #github("dyc3/opentogethertube", 1608)
- Completed: Recorded Ansary Semi-Final Pitch #github("dyc3/senior-design", 369)
- Completed: Increase clients being routed through the balancer in prod
- Delayed: Add legend to panel describing what each node means #github("dyc3/opentogethertube", 1427)
- Continued: Development of ChatBot for use as internal tool.
*Tasks for next week*
- Fix putting more than one panel in a dashboard causes panels to error #github("dyc3/opentogethertube", 1646)
- Fix poor service recovery after restarts or deploys #github("dyc3/opentogethertube", 1647)
- Add a consistent hashing `MonolithSelection` implementation #github("dyc3/opentogethertube", 1293)
*Figures Updated*
#figure(
image("figures/sprint-screenshots/Sprint29.png"),
caption: "Screenshot of Sprint 29."
) <Figure::Sprint29>
== Week Report 23 (4/4/2024) <report-w23>
*What we did this week*
- Completed: Rework the visualization activity animation #github("dyc3/opentogethertube", 1563)
- Completed: User login/register not triggering user info update #github("dyc3/opentogethertube", 1547)
- Completed: Cookies to force routing through load balancer or directly through monolith #github("dyc3/opentogethertube", 1566)
- Completed: Smoke test for communication between `ott-vis-datasource` and `ott-collector` #github("dyc3/opentogethertube", 1409)
- Completed: Add sequence diagram for client reconnect issue #github("dyc3/senior-design", 351)
- Delayed: Make the load balancing algorithm configurable #github("dyc3/opentogethertube", 1294)
- Delayed: Add client ids to system state #github("dyc3/opentogethertube", 1562)
- Delayed: Add legend to panel describing what each node means #github("dyc3/opentogethertube", 1427)
- Delayed: Make it so client joins do not trigger a reconnect message #github("dyc3/opentogethertube", 1546)
- In Progress: #github("dyc3/opentogethertube", 1385)
*Tasks for next week*
- Finish remaining tasks from this week
- Create `TopologyView` for visualization #github("dyc3/opentogethertube", 1606)
- Rework `RegionView` #github("dyc3/opentogethertube", 1607)
- Increase clients being routed through the balancer in prod
*Figures Updated*
#figure(
image("figures/sprint-screenshots/Sprint28.png"),
caption: "Screenshot of Sprint 28."
) <Figure::Sprint28>
== Week Report 22 (3/28/2024) <report-w22>
*What we did this week*
- Completed: Make monolith discovery polling interval configurable #github("dyc3/opentogethertube", 1295)
- Completed: Expanded end to end test suite
- Delayed: Make port for `dns_server` optional in `DnsDiscoveryConfig` #github("dyc3/opentogethertube", 1450)
- In Progress: #github("dyc3/opentogethertube", 1385)
*Tasks for next week*
- Add legend to panel describing what each node means #github("dyc3/opentogethertube", 1427)
- Reassigned: Make monolith load balancing algorithm configurable #github("dyc3/opentogethertube", 1294)
- Rework the visualization activity animation #github("dyc3/opentogethertube", 1563)
*Figures Updated*
- Added: @Figure::client-reconnect-sequence
- Updated: @Figure::service-discoverers
#figure(
image("figures/sprint-screenshots/Sprint27.png"),
caption: "Screenshot of Sprint 27."
) <Figure::Sprint27>
== Week Report 21 (3/21/2024) <report-w21>
*What we did over break*
- Completed: Make Balancer IDS constant from the perspective of monoliths #github("dyc3/opentogethertube", 1338)
- Completed: Fix E2E tests consistently failing #github("dyc3/opentogethertube", 1492)
- Completed: Add typos to CI checks #github("dyc3/senior-design", 338)
- Completed: Add figure file names in document #github("dyc3/senior-design", 332)
- Created a new visualization view that fixes the layout and performance issues of the other views
- *Started slow rollout of balancer to production environment*, currently routing 5% of clients to balancer
*Tasks for next week*
- Make port for `dns_server` optional in `DnsDiscoveryConfig` #github("dyc3/opentogethertube", 1450)
- Upgrade to typst v0.11.0 #github("dyc3/senior-design", 336)
- Make monolith load balancing algorithm configurable #github("dyc3/opentogethertube", 1294)
- Make monolith discovery polling interval configurable #github("dyc3/opentogethertube", 1295)
- Panel does not handle large number of rooms very well #github("dyc3/opentogethertube", 1423)
- Panel jitters when refreshing data, even if the data does not change #github("dyc3/opentogethertube", 1424)
- Add legend to panel describing what each node means #github("dyc3/opentogethertube", 1427)
- Fix balancer memory leak #github("dyc3/opentogethertube", 1540)
- `/api/state` endpoint needs to be authenticated #github("dyc3/opentogethertube", 1466)
*Figures Updated*
- Added: @Figure::vis-collector-component
- Updated: @Figure::components-monolith
- Updated: @Figure::deployment-current
- Updated: @Figure::deployment-new
#figure(
image("figures/sprint-screenshots/Sprint25.png"),
caption: "Screenshot of Sprint 25."
) <Figure::Sprint25>
#figure(
image("figures/sprint-screenshots/Sprint26.png"),
caption: "Screenshot of Sprint 26."
) <Figure::Sprint26>
== Week Report 20 (3/7/2024) <report-w20>
*What we did this week*
- Completed: Add config in dns discoverer to overwrite dns server to Chris #github("dyc3/opentogethertube", 1337)
- Completed: Fix message parsing error #github("dyc3/opentogethertube", 1339)
- Completed: Add preview failure when requesting youtube channel #github("dyc3/opentogethertube", 1447)
- Completed: Fix permissions in permanent rooms not saving #github("dyc3/opentogethertube", 1410)
- Completed: Elevator Pitch Outline
- Delayed: Make Balancer IDS constant from the perspective of monoliths #github("dyc3/opentogethertube", 1338)
- Delayed: Make monolith discovery polling interval configurable #github("dyc3/opentogethertube", 1295)
*Tasks for next week*
- Continue to manually test load balancer for bugs
- Integrate Zod for HTTP request validation #github("dyc3/opentogethertube", 1385)
- Adjust the visualization to handle a larger number of rooms better #github("dyc3/opentogethertube", 1423)
- Add legend to `ott-vis-panel` describing what each node means #github("dyc3/opentogethertube", 1427)
- Make the load balancing algorithm configurable #github("dyc3/opentogethertube", 1294)
- Brainstorm visualization node layouts
*Figures Updated*
- Added: @Figure::visualization-datasource-smoketest-sequence
- Updated: @Figure::full-package-diagram
- Updated: @Figure::service-discoverers
- Updated: @Figure::visualization-balancer-datasource-sequence
#figure(
image("figures/sprint-screenshots/Sprint24.png"),
caption: "Screenshot of Sprint 24."
) <Figure::Sprint24>
== Week Report 19 (2/29/2024) <report-w19>
*What we did this week*
- Completed: Make `ott-vis-datasource` communicate with `ott-collector` #github("dyc3/opentogethertube", 1358)
- Completed: Allow cross origin requests for `ott-collector`
- Completed: Performed further repo maintenance
- Completed: Make `ott-collector` discover balancers #github("dyc3/opentogethertube", 1360)
- Completed: Make `ott-collector` collect system state #github("dyc3/opentogethertube", 1361)
- Completed: MVP for visualization
- Delayed: Fix message parsing error #github("dyc3/opentogethertube", 1339)
*Tasks for next week*
- Continue to manually test load balancer for bugs
- Make Balancer IDS constant from the perspective of monoliths #github("dyc3/opentogethertube", 1338)
- Reassigned add config in dns discoverer to overwrite dns server to Chris #github("dyc3/opentogethertube", 1337)
*Figures Updated*
- Added: @Figure::create-endpoint-activity
- Added: @Figure::service-discoverers
- Added: @Figure::visualization-balancer-datasource-sequence
- Updated: @Figure::discovery-class
- Updated: @Figure::discovery-sequence
- Updated: @Figure::full-package-diagram
- Updated: @Figure::monolith-id-sequence
#figure(
image("figures/sprint-screenshots/Sprint23.png"),
caption: "Screenshot of Sprint 23."
) <Figure::Sprint23>
== Week Report 18 (2/22/2024) <report-w18>
*What we did this week*
- Completed: Add command line flags to both the monolith and balancer to validate their configs and exit #github("dyc3/opentogethertube", 1296) #github("dyc3/opentogethertube", 1297)
- Completed: Got rid of unused dependencies.
- Completed: Upgrade certain dependencies.
- Completed: Added average load test that better approximates average peak load of system in production.
- Completed: Fixed OTT-Common import
- Completed: Lean Canvas for IDE
*Tasks for next week*
- Continue to manually test load balancer for bugs
- Delayed: Add tests for malformed websocket packets #github("dyc3/opentogethertube", 1206)
- Delayed: Make the monolith polling interval configurable #github("dyc3/opentogethertube", 1295)
- Delayed: Determine how information will be passed from the load balancer to the visualizations #github("dyc3/senior-design", 224)
- Fix message parsing error in Balancer #github("dyc3/opentogethertube", 1339)
- Make the datasource communicate with `ott-collector` #github("dyc3/opentogethertube", 1358)
- Create `ott-collector` crate for collecting system state #github("dyc3/opentogethertube", 1357)
- New docker compose for combing `ott-vis` and `ott-datasource` #github("dyc3/opentogethertube", 1359)
- Fix bug where balancer does not detect disconnected clients sometimes #github("dyc3/opentogethertube", 1343)
- Make `ott-collector` discover balancers #github("dyc3/opentogethertube", 1360)
*Figures Updated*
- Added: @Figure::average-load-class
- Added: @Figure::visualization-balancer-datasource-sequence
- Updated: @Figure::balancer-channels-client-monolith
- Updated: @Figure::panel-internal-class
#figure(
image("figures/sprint-screenshots/Sprint22.png"),
caption: "Screenshot of Sprint 22."
) <Figure::Sprint22>
== Week Report 17 (2/15/2024) <report-w17>
*What we did this week*
- Completed: Add Monolith Discoverer that works for any dns server #github("dyc3/opentogethertube", 1239)
- Completed: Add datsource package #github("dyc3/opentogethertube", 1300)
- Completed: Restructure `ott-vis` to allow for multiple visualizations #github("dyc3/opentogethertube", 1281)
- Completed: Update `GlobalView` to use `SystemState` for rendering #github("dyc3/opentogethertube", 1286)
- Completed: Add `RegionView` to `ott-vis` #github("dyc3/opentogethertube", 1252)
- Completed: Have the balancer handle websocket pings #github("dyc3/opentogethertube", 1320)
*Tasks for next week*
- Continue to manually test load balancer for bugs
- Delayed: Add command line flags to both the monolith and balancer to validate their configs and exit #github("dyc3/opentogethertube", 1296) #github("dyc3/opentogethertube", 1297)
- Delayed: Add tests for malformed websocket packets #github("dyc3/opentogethertube", 1206)
- Delayed: Make the monolith polling interval configurable #github("dyc3/opentogethertube", 1295)
- Delayed: Determine how information will be passed from the load balancer to the visualizations #github("dyc3/senior-design", 224)
*Figures Updated*
- Added: @Figure::balancer-channels-client-monolith
- Updated: @Figure::service-discoverers
- Added: @Figure::malformed-websocket-test-sequence
- Added: @Figure::monolith-id-sequence
- Added: @Figure::DOM-class-visualization
- Updated: @Figure::panel-internal-class
#figure(
image("figures/sprint-screenshots/Sprint21.png"),
caption: "Screenshot of Sprint 21."
) <Figure::Sprint21>
== Week Report 16 (2/8/2024) <report-w16>
*What we did this week*
- Update @Figure::full-package-diagram
- Update @Figure::balancer-crates
- Update @Figure::manage-balanacer-connections-class
- Minor change to @Figure::monolith-selection-internals-class
- The "Default" visualization has been renamed to "Global"
- Completed: Business Model Canvas for IDE
- Completed: Make monolith ids constant across the system instead of being generated on connect #github("dyc3/opentogethertube", 1251)
- Completed: Add other panels to provisioned dashboard #github("dyc3/opentogethertube", 1280)
- Completed: Set up datasource package #github("dyc3/opentogethertube", 1300)
- Completed: Integrate the `Global` visualization into a grafana panel #github("dyc3/opentogethertube", 1262)
*Tasks for next week*
- Continue to manually test load balancer for bugs
- Delayed: Create a monolith discoverer for docker-compose environments #github("dyc3/opentogethertube", 1239)
- Delayed: Determine how information will be passed from the load balancer to the visualizations #github("dyc3/senior-design", 224)
- Add command line flags to both the monolith and balancer to validate their configs and exit #github("dyc3/opentogethertube", 1296) #github("dyc3/opentogethertube", 1297)
- Restructure `ott-vis` to allow for multiple visualizations #github("dyc3/opentogethertube", 1281)
- Make the monolith polling interval configurable #github("dyc3/opentogethertube", 1295)
- Delayed: Add tests for malformed websocket packets #github("dyc3/opentogethertube", 1206)
#figure(
image("figures/sprint-screenshots/Sprint20.png"),
caption: "Screenshot of Sprint 20."
) <Figure::Sprint20>
== Week Report 15 (2/1/2024) <report-w15>
*What we did this week*
- Minor update to @Figure::balancer-internals-class
- Added new figure to describe internals of MonolithSelection trait: @Figure::monolith-selection-internals-class
- Ensured all members could run multiple monoliths and load balancers on their systems for manual testing
- Updated @Figure::service-discoverers with new implementation for docker
- Added information to explain Grafana and D3.js
*Tasks for next week*
- Manually test load balancer for bugs
- Delayed: Integrate the `Default` visualization into a grafana panel
- Delayed: Determine how information will be passed from the load balancer to the visualizations
- Delayed: Create a monolith discoverer for docker-compose environments
- Delayed: Make monolith ids constant across the system instead of being generated on connect
== Week Report 14 (1/25/2024) <report-w14>
*What we did over break*
- Onboarded Victor
- fixed misc bugs in the load balancer
*What we did this week*
- Planned out development for the visualization interface
- Prototyped the `Default` visalization
- fixed misc bugs in the load balancer
- Onboarded Micheal
*Tasks for next week*
- Integrate the `Default` visualization into a grafana panel
- Determine how information will be passed from the load balancer to the visualizations
- Create a monolith discoverer for docker-compose environments
- Make monolith ids constant across the system instead of being generated on connect
- Fix misc bugs in the load balancer
== Week Report 13 (12/13/2023) <report-w13>
*What we did this week*
- Minor doc updates with requested changes from previous review
- Added new figures for 4+1 view: @Figure::balancer-internals-class, @Figure::deployment-geo, @Figure::balancer-crates
- Added region field to emulated monoliths #github("dyc3/opentogethertube", 1127)
- Added use case for expo demo @UseCase::visualization-interface
- Slides for today's presentation
*Tasks for next week*
- Delayed: Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
- Continued: Manual testing of the load balancer to find bugs, create harness tests for them
- Continued: expo demo visualization requirements and design
- Dependency upgrades
- Prioritize allocating rooms on monoliths in the same region as the Balancer #github("dyc3/opentogethertube", 1170)
== Week Report 12 (12/06/2023) <report-w12>
*What we did this week*
- Made requested doc changes from previous review
- Minor refactors to harness tests
- Minor refactors to balancer protocol code
- Stuff for IDE
- Started work on visualizations for expo demo
*Tasks for next week*
- Continued: Manual testing of the load balancer to find bugs, create harness tests for them
- Delayed: Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
- Delayed: Add region field to emulated monoliths #github("dyc3/opentogethertube", 1127)
- Slides for presentation next week
== Week Report 11 (11/29/2023) <report-w11>
*What we did this week*
- Review: Generalize emulated monolith behavior #github("dyc3/opentogethertube", 1129)
- Rework the discovery section of the doc
- Other misc doc changes
*Tasks for next week*
- Continued: Manual testing of the load balancer to find bugs, create harness tests for them
- Delayed: Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
- Delayed: Add region field to emulated monoliths #github("dyc3/opentogethertube", 1127)
- Make requested doc changes from previous review
== Week Report 10 (11/15/2023) <report-w10>
*What we did this week*
- Set up prometheus metrics for the load balancer #github("dyc3/opentogethertube", 1094)
- Continued: Manual testing of the load balancer to find bugs, create harness tests for them
- Add region field to balancer config #github("dyc3/opentogethertube", 1126)
- PR Created: Generalize emulated monolith behavior #github("dyc3/opentogethertube", 1129)
- Updated @UseCase::self-host with more detailed flows
*Tasks for next week*
- Continued: Manual testing of the load balancer to find bugs, create harness tests for them
- Review: Generalize emulated monolith behavior #github("dyc3/opentogethertube", 1129)
- Delayed: Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
- Delayed: Add region field to emulated monoliths #github("dyc3/opentogethertube", 1127)
== Week Report 9 (11/08/2023) <report-w9>
*What we did this week*
- Add region field to balancer protocol #github("dyc3/opentogethertube", 1121)
- Re-evaluated severity of load/join bug #github("dyc3/opentogethertube", 1101) to be not as important
- Implemented unloading duplicate rooms #github("dyc3/opentogethertube", 1130)
- Added a script to auto-bump version numbers for releases #github("dyc3/opentogethertube", 1122)
*Tasks for next week*
- Set up prometheus metrics for the load balancer #github("dyc3/opentogethertube", 1094)
- Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
- Continued: Manual testing of the load balancer to find bugs, create harness tests for them
- Generalize emulated monolith behavior #github("dyc3/opentogethertube", 1129)
- Add region field to balancer config #github("dyc3/opentogethertube", 1126)
- Add region field to emulated monoliths #github("dyc3/opentogethertube", 1127)
== Week Report 8 (11/01/2023) <report-w8>
*What we did this week*
- Decided on a versioning scheme for OTT
- Worked on the load balancer requirements (@Chapter::balancer-requirements)
- allow the load balancer to force a monolith to unload a room
- Presentation slides for use cases and requirements
*Tasks for next week*
- Set up prometheus metrics for the load balancer #github("dyc3/opentogethertube", 1094)
- Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
- Add region field to balancer protocol #github("dyc3/opentogethertube", 1121)
- Manual testing of the load balancer to find bugs, create harness tests for them
== Week Report 7 (10/25/2023) <report-w7>
*What we did this week*
- Refined the load balancer requirements (@Chapter::balancer-requirements)
- Made use cases for the load balancer linkable in requirements
- Continued working on resolving race conditions in the load balancer
*Tasks for next week*
- Come up with a versioning scheme and release schedule for OTT.
- and add it to OTT client builds, load balancer
- allow the load balancer to force a monolith to unload a room
- Continue refining the load balancer requirements (@Chapter::balancer-requirements)
- Presentation slides for use cases and requirements
*Delayed Tasks*
- Set up prometheus metrics for the load balancer #github("dyc3/opentogethertube", 1094)
- Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
== Week Report 6 (10/18/2023) <report-w6>
*What we did this week*
- Fixed a bug in the load balancer, #github("dyc3/opentogethertube", 1076)
- Resolved a race condition in the load balancer, #github("dyc3/opentogethertube", 1101)
- Added a git commit hash to page footer of OTT client builds
- Set up typeshare for codegen of shared types between the load balancer and monoliths
- Made requirements in this document linkable
- Let emulated monoliths track which rooms they have loaded.
- Started working on the new requirements chapter (@Chapter::balancer-requirements)
*Tasks for next week*
- Set up prometheus metrics for the load balancer #github("dyc3/opentogethertube", 1094)
- Implement unicast room message handling in the load balancer #github("dyc3/opentogethertube", 1100)
- Finish the new requirements chapter (@Chapter::balancer-requirements)
== Week Report 5 (10/11/2023) <report-w5>
*What we did this week*
- Generalized some common functionality in Emulated Monoliths and Clients
- Created some more harness tests for request routing
- Added mock HTTP server to Emulated Monoliths
*Tasks for next week*
- Fix a bug in the load balancer, #github("dyc3/opentogethertube", 1076)
- Resolve a race condition in the load balancer, #github("dyc3/opentogethertube", 1101)
- Set up prometheus metrics for the load balancer
- Implement unicast room message handling in the load balancer
- Investigate adding git commit hash to OTT client builds
== Week Report 4 (10/04/2023) <report-w4>
*What we did this week*
- Continued designing the load balancer testing harness
- Created our first actually useful test for the load balancer: `discovery_add_remove`
- Prototype Emulated Monoliths, Clients
- Resolved test aggregation
- Dev plan slides for presentation
*Tasks for next week*
- Generalize some common functionality in Emulated Monoliths and Clients
- Fix a bug in the load balancer, #github("dyc3/opentogethertube", 1076)
- Have emulated Monoliths also listen for HTTP requests, and send mock responses
== Week Report 3 (09/27/2023) <report-w3>
*What we did this week*
- Documented Monolith discovery process
- Wrote development plan document
- Finished requirements for the load balancer testing harness
- Specified Room Migration process
- Started designing the load balancer testing harness
- Implemented lazy room state loading from Redis
*Tasks for next week*
- Continue designing the load balancer testing harness, prototype it
- Emulated Monoliths, Clients
- Test aggregation
- Dev plan slides for presentation
- Fix a bug in the load balancer, #github("dyc3/opentogethertube", 1076)
- Fix some of the figures in the discovery chapter of the spec
== Week Report 2 (09/20/2023) <report-w2>
*What we did this week*
- Set up a new repo for the load balancer spec
- Converted load balancer spec from latex to typst
- Updated some parts of the load balancer spec to reflect current implementation
- The remaining inconsistencies will be fixed as we come upon them.
- Determined the best way to do integration tests for the load balancer
- Determined some requirements for the load balancer testing harness
- Got dev environment set up for Chris
- Got the spec to have the elements that are in the latex template
- Fixed some lint CI job failures
*Tasks for next week*
- Document Monolith discovery process
- Development plan document
- Finish requirements for the load balancer testing harness
- Specify Room Migration process
- Start designing the load balancer testing harness
- Implement lazy room state loading from Redis
== Week Report 1 (09/13/2023) <report-w1>
*What we did this week*
- Wrote up a project description to share with potential team mates
- Search for potential team mates
- Rewrote how balancer-monolith connections work, they now go in the opposite direction (balancer -> monolith) instead of (monolith -> balancer) because it decreases latency when starting up the balancer.
- Finalized team
*Tasks for next week*
- Set up a new repo for the load balancer spec
- Convert load balancer spec from latex to typst
- Update load balancer spec to reflect current implementation
- Determine the best way to do integration tests for the load balancer
- Determine requirements for the load balancer testing harness
- Get dev environment set up for Chris
*Risks*
- Chris is not experienced with Rust which may slow down development
- Carson will be available to help Chris with Rust
|
|
https://github.com/kdog3682/mathematical | https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/components/numberline.typ | typst | #import "@local/typkit:0.1.0": *
#import "@preview/cetz:0.2.0"
#import cetz.draw: *
#import "../draw/index.typ" as draw
#let BRACE_OFFSET = 0.65
#let draw-distance((from, label, to), lerp) = {
let from = lerp(from)
let to = lerp(to)
todo()
}
#let draw-brace((from, label, to, side, style), lerp) = {
let from = lerp(from)
let to = lerp(to)
if is-string(label) {
label = bold(label)
}
// opposite side is required for numberlines
draw.brace(from, to, label, offset: BRACE_OFFSET, side: opposite(side), style: style)
}
#let draw-point((value, label), lerp, offset: 0.35) = {
let pos = lerp(value)
draw.shapes.point(pos, radius: 0.1)
if label != none {
if is-string(label) {
label = bold(label)
}
content(draw.utils.offset(pos, y: offset), label)
}
}
#let draw-pair((from, label, to, style), lerp) = {
draw-point(from, lerp)
draw-point(to, lerp)
draw-brace((from: from.value, to: to.value, label: label, side: "above", style: style), lerp)
}
#let draw-square((value, label), lerp) = {
let pos = lerp(value)
line(pos, (rel: (0, .4)), stroke: strokes.soft)
rect((), (rel: (0.2, .2)), anchor: "east", fill: black)
}
#let draw-reference = (
point: draw-point,
brace: draw-brace,
pair: draw-pair,
square: draw-square,
)
#let numberline-base(data, min: auto, max: auto, length: auto) = {
let transform(x, mode: "max") = {
let value = x.at("value", default: none)
if value != none {
return value
}
let value = if mode == "min" {
x.at("from", default: none)
} else {
x.at("to", default: none)
}
if is-number(value) {
return value
}
return value.value
}
if max == auto {
let highest = get-max(data, transform: transform)
max = calc.max(10, highest)
}
if min == auto {
let lowest = get-min(data, transform: transform.with(mode: "min"))
min = calc.min(1, lowest)
}
if length == auto {
length = max - min
}
return {
let (a, b) = ((0,0), (length,0))
line(
(rel: (-1,0), to: a),
(rel: (1,0), to: b),
mark: (fill: black, end: "stealth", start: "stealth"),
name: "line",
)
let len = cetz.vector.dist(a, b)
let lerp(v) = {
cetz.vector.lerp(a, b, (v - min) / (max - min))
}
for d in data {
draw-reference.at(d.type)(d, lerp)
}
// Place ticks
// Both sided
let aa = 0.1
let bb = aa * -2
// Place ticks above
// Place ticks below
for maj in range(min, max + 1) {
let val = cetz.vector.lerp(a, b, (maj - min) / (max - min))
move-to(val)
line((rel: (0, aa)), (rel: (0, bb)))
content((rel: (0, -aa)), $maj$, anchor: "north")
}
}
}
#let data = (
(type: "point", label: [A], value: 1),
(type: "point", label: [B], value: 2),
// (type: "point", label: [C], value: 3),
(
type: "pair",
label: $3x + 1$,
from: (value: 3, label: "A"),
to: (value: 6, label: "B"),
style: "segment",
),
// (type: "brace", label: [$\ax^2 + 3$], from: 3, to: 7, side: "above"),
)
#let numberline((x, y), data, name: none) = {
draw.utils.wrapper(numberline-base(data), x, y)
}
// it works
#cetz.canvas({
draw.shapes.grid()
draw.shapes.point((0, 0))
numberline((3, 3), data, name: "abc")
})
|
|
https://github.com/codevbus/resume | https://raw.githubusercontent.com/codevbus/resume/main/README.md | markdown | MIT License | # <NAME>'s Resume
After a long run with LaTeX, I've decided to move to [Typst](https://typst.app/). Typst similar to LaTeX, but more modern and user-friendly.
This document will be a work in progress, and I will update it as needed with relevant experience, projects, and aesthetic modifications.
## Instructions
You can clone this as a standard GitHub repository. If you wish to access/download a PDF copy, please choose the [PDF file listed above](https://github.com/codevbus/mv-resume/blob/master/mv_cv.pdf) and ask for the "Raw" file.
## License
This repository is licensed under the MIT license.
## Change Log
### v1.0
* First publicly available version
### v1.0.1
* Update to use semver
### v1.1.0
* Added additional experience and technical skills
### v2.0.0
* Major design change. Emphasis on brevity and single page utilization.
### v3.0.0
* Re-design. Retain single page, with more emphasis on content and a simpler presentation.
Converting to MIT license.
### v4.0.0
* New re-design that still focuses on brevity and single-page content. I took a lot of inspiration from <NAME>'s [great example](https://www.latextemplates.com/template/friggeri-resume-cv). In this iteration, I made a serious effort to separate content and formatting between the tex and cls files, respectively. This should make future re-factoring and updates easier.
### v4.1.0
* Added a new experience, as well as smaller font size and bottom margin spacing
### v4.2.0
* Added some summary detail, added color and switched to Helvetica for readability/standardization.
### v5.0.0
* Redesign that emphasizes brevity and readability. Added recent job experience.
### v6.0.0
* Layout redesign and updated content.
### v6.1.0
* Removed redundant LinkedIn profile warning, broadened title of bottom section
### v7.0.0
* Migrated to Typst.
|
https://github.com/Marlstar/TypstCustomPackages | https://raw.githubusercontent.com/Marlstar/TypstCustomPackages/master/packages/local/TitleTemplate/0.1.0/titletemplate.typ | typst | #let project(title: "", authors: ("<NAME>",), body) = {
// Set the document's basic properties.
set document(author: authors, title: title)
set page(numbering: "1", number-align: center)
set text(font: "Linux Libertine", lang: "en")
// Title row.
align(center)[
#block(text(weight: 700, 1.75em, title))
]
// Author information.
pad(
top: 0.5em,
bottom: 0.5em,
x: 2em,
grid(
columns: (1fr,) * calc.min(3, authors.len()),
gutter: 1em,
..authors.map(author => align(center, strong(author))),
),
)
// Main body.
set par(justify: true)
body
} |
|
https://github.com/whs/typst-govdoc | https://raw.githubusercontent.com/whs/typst-govdoc/master/thai.typ | typst | #let thai(body) = {
set text(
font: ("TH Sarabun New", "TH SarabunPSK", "Laksaman", "Angsana New", "AngsanaUPC", "Waree", "Noto Serif"),
size: 16pt,
lang: "th",
region: "TH",
)
body
}
#let thnum(num) = str(num)
.replace("0", "๐")
.replace("1", "๑")
.replace("2", "๒")
.replace("3", "๓")
.replace("4", "๔")
.replace("5", "๕")
.replace("6", "๖")
.replace("7", "๗")
.replace("8", "๘")
.replace("9", "๙")
|
|
https://github.com/DaAlbrecht/thesis-TEKO | https://raw.githubusercontent.com/DaAlbrecht/thesis-TEKO/main/content/Abstract.typ | typst | In this thesis, a microservice is developed that allows replaying messages in a
RabbitMQ stream. To find the most suitable technology for this task, a high
level overview of the AMQP protocol is made and the most popular protocol
implementations in Java, Go and Rust are compared. The microservice is published
as a docker image and can be easily integrated into existing systems.
|
|
https://github.com/jujimeizuo/ZJSU-typst-template | https://raw.githubusercontent.com/jujimeizuo/ZJSU-typst-template/master/contents/appendix.typ | typst | Apache License 2.0 | = 这是一个附录
#lorem(100)
= 这是另一个附录
#lorem(100) |
https://github.com/Akida31/anki-typst | https://raw.githubusercontent.com/Akida31/anki-typst/main/README.md | markdown | # anki-typst
Create anki cards from typst.
This exports your typst notes to images and creates anki notes containing them.
## Writing cards
For more information see the [manual](./typst/doc/doc.pdf)
### via theorem environment
anki-typst defines a theorem interface similar to [typst-theorems](https://github.com/sahasatvik/typst-theorems/):
```typst
#import @local/anki:0.2.0
#import anki.theorems: item
// Don't forget this! v
#show: anki.setup.with(enable_theorems: true)
// create item kinds
#let example = item("Example", initial_tags: ("example",))
#let theorem = item("Theorem", proof_name: "\"Proof\"")
// create item
#example("Pythagoras")[
$ a^2 + b^2 = c^2 $
]
// use secondary numbering
#example("triangle", secondary: auto)[
#sym.triangle.tr.filled
]
#example("another triangle", secondary: auto)[
#sym.triangle.t.stroked
]
// and a theorem, with a custom number
#theorem("Triangular numbers", number: "42")[
The triangular numbers are given by:
$ T_n = sum_(k=1)^n k = (n(n+1))/2 $
][
Induction over n.
]
```

### via raw function
But you can also use the raw export function:
```typst
#import @local/anki:0.2.0: anki_export
#anki_export(
id: "id 29579",
tags: ("Perfect", ),
deck: "beauty",
model: "simple",
question: "Are you beautiful?",
answer: "Yes!",
)
```
## Generating anki cards
* Make sure to install the command line interface
* run `anki-typst create-all-decks -p main.typ`
* then `anki-typst create-default-model`
* and finally `anki-typst create -p main.typ`
## Installing
* install [typst](https://github.com/typst/typst?tab=readme-ov-file#installation) ;)
* install [rust](https://www.rust-lang.org/tools/install)
* go to the `cli` folder and execute `install.sh`. This will install the command line interface to create anki cards from typst
* go to the `typst` folder and execute `python install.py`. This will install the `anki` package to the local package folder
|
|
https://github.com/levinion/typst-dlut-templates | https://raw.githubusercontent.com/levinion/typst-dlut-templates/main/templates/translate/cover.typ | typst | MIT License | #import "../util/style.typ":font_size,font_family
#let header = [
#set align(center)
#set text(
font: font_family.songti_bold, size: font_size.xiao_er, weight: "medium",
)
#v(3.5em)
大 连 理 工 大 学 本 科 外 文 翻 译
]
#let title(chinese_title, english_title)=[
#set align(center)
#set text(font: font_family.songti, size: font_size.er)
*#chinese_title*\
#set text(font: font_family.songti, size: font_size.san)
*#english_title*\
]
#let desc(faculty, major, name, id, teacher, date)=[
#set align(center)
#set text(font: font_family.songti, size: font_size.xiao_si)
#let grid_v(content)=[
#rect(width: 100%, inset: 2pt, stroke: (bottom: black))[#content]
]
#grid(
columns: (100pt, 180pt), row-gutter: 1.5em, column-gutter: -1em, "学部(院):",
grid_v(faculty), "专 业:", grid_v(major), "学 生 姓名:",
grid_v(name), "学 号:", grid_v(id), "指 导 教 师:",
grid_v(teacher), "完 成 日 期:", grid_v(date),
)
]
#let fonter = [
#set align(center)
#set text(font: font_family.songti, size: font_size.xiao_si)
大连理工大学
]
#let cover(chinese_title, english_title, faculty, major, name, id, sup, date) = [
#set page(margin: (left: 2.5cm, right: 2.5cm))
#header\
#title(chinese_title, english_title)\
#v(180pt)
#desc(faculty, major, name, id, sup, date)
#v(20pt)
#fonter
#pagebreak(weak:true)
]
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/par/text.typ | typst | Apache License 2.0 | = Introduction
See @tolkien54 for more details.
#lorem(10)
#figure(
[],
caption: [A rhinoceros],
) <tolkien54>
Here is another paragraph.
|
https://github.com/darioglasl/Arbeiten-Vorlage-Typst | https://raw.githubusercontent.com/darioglasl/Arbeiten-Vorlage-Typst/main/Anhang/06_Jira/01_bugs.typ | typst | === Known Bugs <appendixKnownBugs>
Hier sind alle bekannten Bugs zu finden.
==== Übersicht der bekannten Bugs
In der nachfolgenden Tabelle ist eine Übersicht zu finden, welche sortiert nach Priorität ist.
#figure(
table(
columns: (auto, auto, auto),
align: left,
[*Issue Key*], [*Summary*], [*Prio*],
[DI-01],[Beispiel Bug],[Highest],
),
caption: "Übersicht der bekannten Bugs",
)
==== DI-01: Beispiel Bug
lorem ipsum |
|
https://github.com/LauHuiQi0920/3007DataVisualizationTeamCyan | https://raw.githubusercontent.com/LauHuiQi0920/3007DataVisualizationTeamCyan/main/custom-template.typ | typst | // Some definitions presupposed by pandoc's typst output.
#let blockquote(body) = [
#set text( size: 0.92em )
#block(inset: (left: 1.5em, top: 0.2em, bottom: 0.2em))[#body]
]
#let horizontalrule = [
#line(start: (25%,0%), end: (75%,0%))
]
#let endnote(num, contents) = [
#stack(dir: ltr, spacing: 3pt, super[#num], contents)
]
#show terms: it => {
it.children
.map(child => [
#strong[#child.term]
#block(inset: (left: 1.5em, top: -0.4em))[#child.description]
])
.join()
}
// Some quarto-specific definitions.
#show raw.where(block: true): block.with(
fill: luma(230),
width: 100%,
inset: 8pt,
radius: 2pt
)
#let block_with_new_content(old_block, new_content) = {
let d = (:)
let fields = old_block.fields()
fields.remove("body")
if fields.at("below", default: none) != none {
// TODO: this is a hack because below is a "synthesized element"
// according to the experts in the typst discord...
fields.below = fields.below.amount
}
return block.with(..fields)(new_content)
}
#let empty(v) = {
if type(v) == "string" {
// two dollar signs here because we're technically inside
// a Pandoc template :grimace:
v.matches(regex("^\\s*$")).at(0, default: none) != none
} else if type(v) == "content" {
if v.at("text", default: none) != none {
return empty(v.text)
}
for child in v.at("children", default: ()) {
if not empty(child) {
return false
}
}
return true
}
}
#show figure: it => {
if type(it.kind) != "string" {
return it
}
let kind_match = it.kind.matches(regex("^quarto-callout-(.*)")).at(0, default: none)
if kind_match == none {
return it
}
let kind = kind_match.captures.at(0, default: "other")
kind = upper(kind.first()) + kind.slice(1)
// now we pull apart the callout and reassemble it with the crossref name and counter
// when we cleanup pandoc's emitted code to avoid spaces this will have to change
let old_callout = it.body.children.at(1).body.children.at(1)
let old_title_block = old_callout.body.children.at(0)
let old_title = old_title_block.body.body.children.at(2)
// TODO use custom separator if available
let new_title = if empty(old_title) {
[#kind #it.counter.display()]
} else {
[#kind #it.counter.display(): #old_title]
}
let new_title_block = block_with_new_content(
old_title_block,
block_with_new_content(
old_title_block.body,
old_title_block.body.body.children.at(0) +
old_title_block.body.body.children.at(1) +
new_title))
block_with_new_content(old_callout,
new_title_block +
old_callout.body.children.at(1))
}
#show ref: it => locate(loc => {
let target = query(it.target, loc).first()
if it.at("supplement", default: none) == none {
it
return
}
let sup = it.supplement.text.matches(regex("^45127368-afa1-446a-820f-fc64c546b2c5%(.*)")).at(0, default: none)
if sup != none {
let parent_id = sup.captures.first()
let parent_figure = query(label(parent_id), loc).first()
let parent_location = parent_figure.location()
let counters = numbering(
parent_figure.at("numbering"),
..parent_figure.at("counter").at(parent_location))
let subcounter = numbering(
target.at("numbering"),
..target.at("counter").at(target.location()))
// NOTE there's a nonbreaking space in the block below
link(target.location(), [#parent_figure.at("supplement") #counters#subcounter])
} else {
it
}
})
// 2023-10-09: #fa-icon("fa-info") is not working, so we'll eval "#fa-info()" instead
#let callout(body: [], title: "Callout", background_color: rgb("#dddddd"), icon: none, icon_color: black) = {
block(
breakable: false,
fill: background_color,
stroke: (paint: icon_color, thickness: 0.5pt, cap: "round"),
width: 100%,
radius: 2pt,
block(
inset: 1pt,
width: 100%,
below: 0pt,
block(
fill: background_color,
width: 100%,
inset: 8pt)[#text(icon_color, weight: 900)[#icon] #title]) +
block(
inset: 1pt,
width: 100%,
block(fill: white, width: 100%, inset: 8pt, body)))
}
#let poster(
// The poster's size.
size: "'36x24' or '48x36''",
// The poster's title.
title: "Paper Title",
// A string of author names.
authors: "Author Names (separated by commas)",
// Department name.
departments: "Department Name",
// University logo.
univ_logo: "Logo Path",
// Footer text.
// For instance, Name of Conference, Date, Location.
// or Course Name, Date, Instructor.
footer_text: "Footer Text",
// Any URL, like a link to the conference website.
footer_url: "Footer URL",
// Email IDs of the authors.
footer_email_ids: "Email IDs (separated by commas)",
// Color of the footer.
footer_color: "Hex Color Code",
// Text color of the footer.
footer_text_color: "Hex Color Code",
// DEFAULTS
// ========
// For 3-column posters, these are generally good defaults.
// Tested on 36in x 24in, 48in x 36in, and 36in x 48in posters.
// For 2-column posters, you may need to tweak these values.
// See ./examples/example_2_column_18_24.typ for an example.
// Any keywords or index terms that you want to highlight at the beginning.
keywords: (),
// Number of columns in the poster.
num_columns: "3",
// University logo's scale (in %).
univ_logo_scale: "50",
// University logo's column size (in in).
univ_logo_column_size: "10",
// Title and authors' column size (in in).
title_column_size: "20",
// Poster title's font size (in pt).
title_font_size: "48",
// Authors' font size (in pt).
authors_font_size: "36",
// Footer's URL and email font size (in pt).
footer_url_font_size: "30",
// Footer's text font size (in pt).
footer_text_font_size: "40",
// The poster's content.
body
) = {
// Set the body font.
set text(font: "STIX Two Text", size: 16pt)
let sizes = size.split("x")
let width = int(sizes.at(0)) * 1in
let height = int(sizes.at(1)) * 1in
univ_logo_scale = int(univ_logo_scale) * 1%
title_font_size = int(title_font_size) * 1pt
authors_font_size = int(authors_font_size) * 1pt
num_columns = int(num_columns)
univ_logo_column_size = int(univ_logo_column_size) * 1in
title_column_size = int(title_column_size) * 1in
footer_url_font_size = int(footer_url_font_size) * 1pt
footer_text_font_size = int(footer_text_font_size) * 1pt
// Configure the page.
// This poster defaults to 36in x 24in.
set page(
width: width,
height: height,
margin:
(top: 1in, left: 2in, right: 2in, bottom: 2in),
footer: [
#set align(center)
#set text(32pt, white)
#block(
fill: rgb(228,51,44),
width: 100%,
inset: 20pt,
radius: 10pt,
[
//#text(font: "Courier", size: footer_url_font_size, footer_url)
//#h(1fr)
#text(size: footer_text_font_size, smallcaps(footer_text))
#h(1fr)
#text(font: "Courier", size: footer_url_font_size, footer_email_ids)
]
)
]
)
// Configure equation numbering and spacing.
set math.equation(numbering: "(1)")
show math.equation: set block(spacing: 0.65em)
// Configure lists.
set enum(indent: 10pt, body-indent: 9pt)
set list(indent: 10pt, body-indent: 9pt)
// Configure headings.
//set heading(numbering: "I.A.1.")
show heading: it => locate(loc => {
// Find out the final number of the heading counter.
let levels = counter(heading).at(loc)
let deepest = if levels != () {
levels.last()
} else {
1
}
set text(24pt, weight: 400)
if it.level == 1 [
// First-level headings are centered smallcaps.
#set align(center)
#set text({ 32pt })
#show: smallcaps
#v(50pt, weak: true)
#if it.numbering != none {
numbering("I.", deepest)
h(7pt, weak: true)
}
#it.body
#v(35.75pt, weak: true)
#line(length: 100%)
] else if it.level == 2 [
// Second-level headings are run-ins.
#set text(style: "italic")
#v(32pt, weak: true)
#if it.numbering != none {
numbering("i.", deepest)
h(7pt, weak: true)
}
#it.body
#v(10pt, weak: true)
] else [
// Third level headings are run-ins too, but different.
#if it.level == 3 {
numbering("1)", deepest)
[ ]
}
_#(it.body):_
]
})
// Arranging the logo, title, authors, and department in the header.
align(center,
grid(
rows: 2,
columns: (title_column_size, univ_logo_column_size),
column-gutter: 0pt,
row-gutter: 50pt,
text(title_font_size, title + "\n\n") +
text(authors_font_size, emph(authors) +
" (" + departments + ") "),
image(univ_logo, width: univ_logo_scale),
)
)
// Start three column mode and configure paragraph properties.
show: columns.with(num_columns, gutter: 64pt)
set par(justify: true, first-line-indent: 0em)
show par: set block(spacing: 0.65em)
// Display the keywords.
if keywords != () [
#set text(24pt, weight: 400)
#show "Keywords": smallcaps
*Keywords* --- #keywords.join(", ")
]
// Display the poster's contents.
body
}
// Typst custom formats typically consist of a 'typst-template.typ' (which is
// the source code for a typst template) and a 'typst-show.typ' which calls the
// template's function (forwarding Pandoc metadata values as required)
//
// This is an example 'typst-show.typ' file (based on the default template
// that ships with Quarto). It calls the typst function named 'article' which
// is defined in the 'typst-template.typ' file.
//
// If you are creating or packaging a custom typst template you will likely
// want to replace this file and 'typst-template.typ' entirely. You can find
// documentation on creating typst templates here and some examples here:
// - https://typst.app/docs/tutorial/making-a-template/
// - https://github.com/typst/templates
#show: doc => poster(
title: [#strong[Mapping Crime in the Los Angeles: A Visual Journey \(2020-2024)];],
// TODO: use Quarto's normalized metadata.
authors: [<NAME>],
departments: [Information and Communication Technologies],
size: "33x23",
// Institution logo.
univ_logo: "../imgs/sit-logo.png",
// Footer text.
// For instance, Name of Conference, Date, Location.
// or Course Name, Date, Instructor.
footer_text: [Information Visualization 2024],
// Any URL, like a link to the conference website.
// Emails of the authors.
footer_email_ids: [singaporetech.edu.sg],
// Color of the footer.
// Text color of the footer.
// DEFAULTS
// ========
// For 3-column posters, these are generally good defaults.
// Tested on 36in x 24in, 48in x 36in, and 36in x 48in posters.
// For 2-column posters, you may need to tweak these values.
// See ./examples/example_2_column_18_24.typ for an example.
// Any keywords or index terms that you want to highlight at the beginning.
// Number of columns in the poster.
// University logo's scale (in %).
// University logo's column size (in in).
// Title and authors' column size (in in).
// Poster title's font size (in pt).
// Authors' font size (in pt).
// Footer's URL and email font size (in pt).
// Footer's text font size (in pt).
doc,
)
= Introduction
<introduction>
Crime in america is a significant concern , the safety and well-being of residents, business and touristism will be impacted severely. There is a sharp rise in motor vehicle thefts is up 25% from 2019 to 2022#footnote[#link("https://www.marketwatch.com/guides/insurance-services/car-theft-statistics/");] showing that there is still plenty of improvement required to curb the crime rate.
Understanding and identifying area with high type of crime are can help the effort of effective law enforcement training and perpetration. Data constantly shows that neighborhoods such as South Los Angeles are still prevalent with violent crime#footnote[#link("https://www.latimes.com/california/story/2023-10-12/violent-crime-is-down-fear-is-up-why-is-la-perceived-as-dangerous");];. Using statistical past data , using quantifiable information to identify hotspots allows law enforcement agencies allowing efficient dividing of resource better while maximizing safety.
Taking a look at a crime distribution around the University of Southern California’s University Park campus on medium #footnote[#link("https://towardsdatascience.com/visualizing-crime-in-los-angeles-14db37572909/");] \(@fig-wsj-on-poster). This visualization is display see through blue dots to represent a hit in crime on a specific area, while straight to the point however there are several aspects of the plot can be refine.
= Previous Visualization
<previous-visualization>
#block[
#block[
#figure([
#box(width: 100%,image("../imgs/bad_graph.jpeg"))
], caption: figure.caption(
position: bottom,
[
Crime distribution around USC, published by the Medium.
]),
kind: "quarto-float-fig",
supplement: "Figure",
numbering: "1",
)
<fig-wsj-on-poster>
]
]
= Strengths
<strengths>
+ Alpha was used on the circles allowing darker spots to appear if overlapped.
+ Gentle color blue was used, allowing the user to easily view spots affected by a crime. The color picked does not have a conflicting color with the background of the map, which was a nice touch.
+ An area with good distribution was picked, as there are clusters displayed on the map.
+ As the mouse is hovered over the circles, the exact number of crimes is displayed through a tooltip \(@fig-infotip), allowing the user to see the exact number of crimes in that area .
#block[
#block[
#figure([
#box(width: 100%,image("../imgs/combined.png"))
], caption: figure.caption(
position: bottom,
[
Crime distribution around USC, published by the Medium.
]),
kind: "quarto-float-fig",
supplement: "Figure",
numbering: "1",
)
<fig-infotip>
]
]
= Suggested Improvements
<suggested-improvements>
+ #emph[State layer view:] separated with area code, performs better visualization of the crime distribution. A localize view does not represent a crime spread well for meaningful actions.
+ #emph[Identify type of crime clearly:] A clearer view of top crime should be labeled and display.
+ #emph[Add missing title and guides:] Title should be used for clear description
+ #emph[Add missing guides:] Guides should be used to show clear distinction of color shade to total crime count.
+ #emph[Use a saturation color palette:] Shows a meaningful progression through color space. Saturation palettes shows cold to hot zone allowing human to see intensity of an area.
+ #emph[Label locations:] Labeling popular city center allow enforcer to see crime distribution and easily identify the areas with high crime rate.
+ #emph[Add crime types for each area:] Displaying the top 3 crimes in each area allows for better understanding of the crime distribution and provides additional information.
= Implementation
<implementation>
== Data
<data>
- Los Angelas year 1st January 2020 to 7th June 2024.#footnote[#link("https://data.lacity.org/Public-Safety/Crime-Data-from-2020-to-Present/2nrs-mtv8/data_preview");] The data used is the universal data while @fig-wsj-on-poster use a subset of the data ending at 2021.The data set are broken apart to 10 years data set 2010 to 2019 #footnote[#link("https://catalog.data.gov/dataset/crime-data-from-2010-to-2019");] however different format might be implement hence not used.
== Software
<software>
We used the Quarto publication framework and the R programming language, along with the following third-party packages:
- #emph[dplyr] for data manipulation
- #emph[tidyverse] for data transformation, including #emph[ggplot2] for visualization based on the grammar of graphics
- #emph[readxl] for data import
- #emph[lubridate] for date and time manipulation
- #emph[DT] for interactive data tables
- #emph[knitr] for dynamic document generation
- #emph[pals] for color palettes
- #emph[RColorBrewer] for color palettes
= Improved Visualization
<improved-visualization>
#block[
#block[
#figure([
#box(width: 100%,image("../imgs/plot.png"))
], caption: figure.caption(
position: bottom,
[
Top 3 crimes and total crimes by area.
]),
kind: "quarto-float-fig",
supplement: "Figure",
)
]
]
= Further Suggestions for Interactivity
<further-suggestions-for-interactivity>
While our visualization was designed for a poster, interactive features were not implemented. However, in an HTML document, these features can be achieved using various R packages. #strong[ggplot2] allows for #strong[hover, drag, zoom, and export];, which improves accessibility for people with sight disabilities by enabling zoom to increase text size. #strong[Shiny] facilitates the #strong[sorting of graphs] to clearly differentiate categories and provides #strong[dynamic input];, such as displaying the distribution of only robbery crimes throughout the state. Additionally, #strong[plotly] offers #strong[customized tooltips] with ggplot2, expands long town names, and shows exact numbers without crowding. By #strong[darkening borders] and adding shadows, plotly highlights areas when hovered, enhancing the overall user experience.
= Conclusion
<conclusion>
To update not changed yet, We successfully implemented all suggested improvements for the non-interactive visualization. By labeling every state and choosing a colorblind-friendly palette, the revised plot is more accessible. The logarithmic color scale makes the decrease in incidence after the introduction of the vaccine less striking but enables readers to detect patterns in the low-incidence range more easily.
|
|
https://github.com/binhtran432k/ungrammar-docs | https://raw.githubusercontent.com/binhtran432k/ungrammar-docs/main/components/format.typ | typst | #import "glossary.typ": update_glossaries, print_glossary
#import "utils.typ": getHeader
#import "cover.typ" as cover
#let project(
title: "",
author: "",
subject: "",
doc_type: "thesis",
city: "Ho Chi Minh",
cover_head: "",
department: "",
major: "",
year: "2023",
logo: none,
declaration: "",
acknowledgments: "",
glossaries: (abbreviation: (:)),
supervisors: (:),
students: (:),
reviewer: "",
committee: "",
secretary: "",
body,
) = {
set page(
paper: "a4",
margin: (
top: 3cm,
right: 2cm,
bottom: 2cm,
left: 3cm,
),
)
// Set the document's basic properties.
set document(author: author, title: title)
set text(
size: 12pt,
// font: "Times_New_Roman",
font: "New Computer Modern",
stretch: 120%,
lang: "en"
)
show math.equation: set text(weight: 400)
// set math.equation(numbering: "(1.1)") // Currently not directly supported by typst
set math.equation(numbering: "(1)")
set heading(numbering: "1.1.1.a")
set par(justify: true)
show raw.where(block: true): blk => {
set par(justify: false)
set block(fill: gray.lighten(90%), width: 100%, inset: (x: 1em, y: 1em))
blk
}
// show heading.where(level: 1): set text(size: 24pt)
show heading.where(level: 2): set text(size: 18pt)
show heading.where(level: 3): set text(size: 14pt)
show outline.entry.where(level: 1): it => {
v(16pt, weak: true)
strong(it)
}
show outline.entry.where(level: 2): it => {
it
}
show link: set text(fill: blue)
show ref: it => {
let eq = math.equation
let hd = heading
let el = it.element
if el != none and el.func() == eq {
// Override equation references.
link(el.label)[#numbering(
el.numbering,
..counter(eq).at(el.location()),
)]
} else if el != none and el.func() == hd {
// Override equation references.
text(fill: blue.darken(60%))[#it]
} else {
// Other references as usual.
it
}
}
show cite: set text(fill: green)
// Cover
cover.print_cover_head(cover_head, department)
cover.print_logo(logo)
v(0.25fr)
cover.print_subject(subject)
cover.print_title(title, major)
v(1fr)
cover.print_cover_details(supervisors, students, committee, secretary, reviewer)
v(1fr)
cover.print_footer(city)
pagebreak(weak: true)
set page(numbering: "i")
counter(page).update(1)
// Declaration and Acknowledgments
[
#set heading(numbering: none)
#show heading: it => {
it
v(1.5em)
}
#if declaration != "" {
declaration
pagebreak(weak: true)
}
#if acknowledgments != "" {
acknowledgments
pagebreak(weak: true)
}
]
// Table of contents.
[
#show heading: it => {
it
v(1em)
}
#let locTitle = [Table of Contents]
#outline(
title: locTitle,
depth: 3,
indent: true,
)
#pagebreak()
#let lofTitle = [List of Figures]
#outline(
title: lofTitle,
depth: 3,
target: figure.where(kind: image),
)
#{
show heading: none
heading(numbering: none)[#lofTitle]
}
#pagebreak()
#let lotTitle = [List of Tables]
#outline(
title: lotTitle,
depth: 3,
target: figure.where(kind: table),
)
#{
show heading: none
heading(numbering: none)[#lotTitle]
}
#pagebreak()
#update_glossaries(glossaries)
#if glossaries.abbreviation.len() > 0 {
heading(
outlined: true,
numbering: none,
text("List of Abbreviations"),
)
print_glossary(glossaries, "abbreviation", bold: true)
pagebreak()
}
#if glossaries.symbol.len() > 0 {
heading(
outlined: true,
numbering: none,
text("List of Symbols"),
)
print_glossary(glossaries, "symbol", bold: false)
}
]
// Main body.
set page(numbering: "1", number-align: center)
// set par(first-line-indent: 20pt)
set page(header: getHeader())
counter(page).update(1)
show heading.where(level: 1): it => [
// #pagebreak(weak: true)
#set text(size: 24pt)
#v(1.5in)
#block[
#if it.numbering != none [
Chapter #counter(heading).display()
#v(0.5cm)
]
#par(first-line-indent: 0pt)[#it.body]
]
#v(1.5cm, weak: true)
]
show heading.where(level: 2): it => [
#set text(size: 18pt)
#v(1cm, weak: true)
#block[
#if it.numbering != none [
#counter(heading).display()
]
#it.body
]
#v(1cm, weak: true)
]
show heading.where(level: 2): set text(size: 18pt)
show heading.where(level: 3): set text(size: 14pt)
show heading.where(level: 4): set text(size: 12pt)
body
if glossaries.glossary.len() > 0 {
pagebreak(weak: true)
heading(
outlined: true,
numbering: none,
text("Glossary"),
)
print_glossary(glossaries, "glossary")
}
}
#let appendix(body) = {
set heading(numbering: "A", supplement: [Appendix])
counter(heading).update(0)
outline(target: heading.where(supplement: [Appendix]), title: [Appendix])
body
}
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.3.0/src/matrix.typ | typst | Apache License 2.0 | #import "vector.typ"
// Global rounding precision
#let precision = 8
#let _round = calc.round.with(digits: precision)
#let cos(x) = {
_round(calc.cos(x))
}
#let sin(x) = {
_round(calc.sin(x))
}
#let pi = calc.pi
/// Create identity matrix with dimensions $m \times n$
///
/// - m (int): The number of rows
/// - n (int): The number of columns
/// - one (float): Value to set as $1$
/// - zero (float): Value to set as $0$
/// -> matrix
#let ident(m: 4, n: 4, one: 1, zero: 0) = {
({for m in range(0, m) {
({for n in range(0, n) {
if m == n { (one,) } else { (zero,) }
}},)
}})
}
/// Returns the dimension of the given matrix as `(m, n)`
/// - m (matrix): The matrix
/// -> array
#let dim(m) = {
return (m.len(), if m.len() > 0 {m.at(0).len()} else {0})
}
/// Returns the nth column of a matrix as a {{vector}}
/// - mat (matrix): Input matrix
/// - n (int): The column's index
/// -> vector
#let column(mat, n) = {
range(0, mat.len()).map(m => mat.at(m).at(n))
}
/// Replaces the nth column of a matrix with the given vector.
/// - mat (matrix): Input matrix.
/// - n (int): The index of the column to replace
/// - vec (vector): The column data to insert.
/// -> matrix
#let set-column(mat, n, vec) = {
assert(vec.len() == matrix.len())
for m in range(0, mat.len()) {
mat.at(m).at(n) = vec.at(n)
}
}
/// Rounds each value in the matrix to a precision.
/// - mat (matrix): Input matrix
/// - precision (int) = 8: Rounding precision (digits)
/// -> matrix
#let round(mat, precision: precision) = {
mat.map(r => r.map(v => _round(v, digits: precision)))
}
/// Returns a $4 \times 4$ translation matrix
/// - x (float): The translation in the $x$ direction.
/// - y (float): The translation in the $y$ direction.
/// - z (float): The translation in the $x$ direction.
/// -> matrix
#let transform-translate(x, y, z) = {
((1, 0, 0, x),
(0, 1, 0, y),
(0, 0, 1, z),
(0, 0, 0, 1))
}
/// Returns a $4 \times 4$ x-shear matrix
/// - factor (float): The shear in the $x$ direction.
/// -> matrix
#let transform-shear-x(factor) = {
((1, factor, 0, 0),
(0, 1, 0, 0),
(0, 0, 1, 0),
(0, 0, 0, 1))
}
/// Returns a $4 \times 4$ z-shear matrix
/// - factor (float): The shear in the $z$ direction.
/// -> matrix
#let transform-shear-z(factor) = {
((1, 0, factor, 0),
(0, 1,-factor, 0),
(0, 0, 1, 0),
(0, 0, 0, 1))
}
/// Returns a $4 \times 4$ scale matrix
/// - f (float,array,dictionary): The scale factor(s) of the matrix. An {{array}} of at least 3 {{float}}s sets the x, y and z scale factors. A {{dictionary}} sets the scale in the direction of the corresponding x, y and z keys. A single {{float}} sets the scale for all directions.
/// -> matrix
#let transform-scale(f) = {
let (x, y, z) = if type(f) == array {
vector.as-vec(f, init: (1, 1, 1))
} else if type(f) == dictionary {
(f.at("x", default: 1),
f.at("y", default: 1),
f.at("z", default: 1))
} else {
(f, f, f)
}
return(
(x, 0, 0, 0),
(0, y, 0, 0),
(0, 0, z, 0),
(0, 0, 0, 1))
}
/// Returns a $4 \times 4$ rotation xyz matrix for a direction and up vector
/// - dir (vector): idk
/// - up (vector): idk
/// -> matrix
#let transform-rotate-dir(dir, up) = {
dir = vector.norm(dir)
up = vector.norm(up)
let (dx, dy, dz) = dir
let (ux, uy, uz) = up
let (rx, ry, rz) = vector.norm(vector.cross(dir, up))
((rx, dx, ux, 0),
(ry, dy, uy, 0),
(rz, dz, uz, 0),
(0, 0, 0, 1))
}
// Return 4x4 rotate x matrix
/// Returns a $4 \times 4$ $x$ rotation matrix
/// - angle (angle): The angle to rotate around the $x$ axis
/// -> matrix
#let transform-rotate-x(angle) = {
((1, 0, 0, 0),
(0, cos(angle), -sin(angle), 0),
(0, sin(angle), cos(angle), 0),
(0, 0, 0, 1))
}
// Return 4x4 rotate y matrix
/// Returns a $4 \times 4$ $y$ rotation matrix
/// - angle (angle): The angle to rotate around the $y$ axis
/// -> matrix
#let transform-rotate-y(angle) = {
((cos(angle), 0, -sin(angle), 0),
(0, 1, 0, 0),
(sin(angle), 0, cos(angle), 0),
(0, 0, 0, 1))
}
// Return 4x4 rotate z matrix
/// Returns a $4 \times 4$ $z$ rotation matrix
/// - angle (angle): The angle to rotate around the $z$ axis
/// -> matrix
#let transform-rotate-z(angle) = {
((cos(angle), -sin(angle), 0, 0),
(sin(angle), cos(angle), 0, 0),
(0, 0, 1, 0),
(0, 0, 0, 1))
}
// Return 4x4 rotate xz matrix
/// Returns a $4 \times 4$ $x z$ rotation matrix
/// - x (angle): The angle to rotate around the $x$ axis
/// - z (angle): The angle to rotate around the $z$ axis
/// -> matrix
#let transform-rotate-xz(x, z) = {
((cos(z), sin(z), 0, 0),
(-cos(x)*sin(z), cos(x)*cos(z), -sin(x), 0),
(sin(x)*sin(z), -sin(x)*cos(z), cos(x), 1),
(0, 0, 0, 1))
}
/// Returns a $4 \times 4$ rotation matrix - yaw-pitch-roll
///
/// Calculates the product of the three rotation matrices
/// $R = Rz(a) Ry(b) Rx(c)$
///
/// - a (angle): Yaw
/// - b (angle): Pitch
/// - c (angle): Roll
/// -> matrix
#let transform-rotate-ypr(a, b, c) = {
((cos(a)*cos(b), cos(a)*sin(b)*sin(c) - sin(a)*cos(c), cos(a)*sin(b)*cos(c) + sin(a)*sin(c), 0),
(sin(a)*cos(b), sin(a)*sin(b)*sin(c) + cos(a)*cos(c), sin(a)*sin(b)*cos(c) - cos(a)*sin(c), 0),
(-sin(b), cos(b)*sin(c), cos(b)*cos(c), 1),
(0,0,0,1))
}
/// Returns a $4 \times 4$ rotation matrix - euler angles
///
/// Calculates the product of the three rotation matrices
/// $R = Rz(z) Ry(y) Rx(x)$
///
/// - x (angle): Rotation about x
/// - y (angle): Rotation about y
/// - z (angle): Rotation about z
/// -> matrix
#let transform-rotate-xyz(x, y, z) = {
((cos(y)*cos(z), sin(x)*sin(y)*cos(z) - cos(x)*sin(z), cos(x)*sin(y)*cos(z) + sin(x)*sin(z), 0),
(cos(y)*sin(z), sin(x)*sin(y)*sin(z) + cos(x)*cos(z), cos(x)*sin(y)*sin(z) - sin(x)*cos(z), 0),
(-sin(y), sin(x)*cos(y), cos(x)*cos(y), 0),
(0,0,0,1))
}
/// Multiplies matrices on top of each other.
/// - ..matrices (matrix): The matrices to multiply from left to right.
/// -> matrix
#let mul-mat(..matrices) = {
matrices = matrices.pos()
let out = matrices.remove(0)
for matrix in matrices {
let (m, n, p) = (
..dim(out),
dim(matrix).last()
)
out = (
for i in range(m) {
(
for j in range(p) {
(_round(range(n).map(k => out.at(i).at(k) * matrix.at(k).at(j)).sum(), digits: precision),)
}
,)
}
)
}
return out
}
// Multiply 4x4 matrix with vector of size 3 or 4.
// The value of vec_4 defaults to w (1).
//
// The resulting vector is of dimension 3
/// Multiplies a $4 \times 4$ matrix with a vector of size 3 or 4. The resulting is three dimensional
/// - mat (matrix): The matrix to multiply
/// - vec (vector): The vector to multiply
/// - w (float): The default value for the fourth element of the vector if it is three dimensional.
/// -> vector
#let mul4x4-vec3(mat, vec, w: 1) = {
assert(vec.len() <= 4)
let out = (0, 0, 0)
for m in range(0, 3) {
let v = (mat.at(m).at(0) * vec.at(0, default: 0)
+ mat.at(m).at(1) * vec.at(1, default: 0)
+ mat.at(m).at(2) * vec.at(2, default: 0)
+ mat.at(m).at(3) * vec.at(3, default: w))
out.at(m) = v
}
return out
}
// Multiply matrix with vector
/// Multiplies an $m \times n$ matrix with an $m$th dimensional vector where $m \lte 4$. Prefer the use of `mul4x4-vec3` when possible as it does not use loops.
/// - mat (matrix): The matrix to multiply
/// - vec (vector): The vector to multiply
/// -> vector
#let mul-vec(mat, vec) = {
let m = mat.len()
let n = mat.at(0).len()
assert(n == vec.len(), message: "Matrix columns must be equal to vector rows")
let new = (0,) * m
for i in range(0, m) {
for j in range(0, n) {
new.at(i) = new.at(i) + mat.at(i).at(j) * vec.at(j)
}
}
return new
}
/// Calculates the inverse matrix of any size.
/// - matrix (matrix): The matrix to inverse.
/// -> matrix
#let inverse(matrix) = {
let n = {
let size = dim(matrix)
assert.eq(size.first(), size.last(), message: "Matrix must be square to perform inversion.")
size.first()
}
let N = range(n)
let inverted = ident(m: n, n: n)
let p
for j in N {
for i in range(j, n) {
if matrix.at(i).at(j) != 0 {
(matrix.at(j), matrix.at(i)) = (matrix.at(i), matrix.at(j))
(inverted.at(j), inverted.at(i)) = (inverted.at(i), inverted.at(j))
p = 1 / matrix.at(j).at(j)
for k in N {
matrix.at(j).at(k) *= p
inverted.at(j).at(k) *= p
}
for L in N {
if L != j {
p = -matrix.at(L).at(j)
for k in N {
matrix.at(L).at(k) += _round(p * matrix.at(j).at(k))
inverted.at(L).at(k) += _round(p * inverted.at(j).at(k))
}
}
}
}
}
}
return inverted
}
/// Swaps the ath column with the bth column.
///
/// - mat (matrix): Matrix
/// - a (int): The index of column a.
/// - b (int): The index of column b.
/// -> matrix
#let swap-cols(mat, a, b) = {
let new = mat
for m in range(mat.len()) {
new.at(m).at(a) = mat.at(m).at(b)
new.at(m).at(b) = mat.at(m).at(a)
}
return new
}
/// Translates a matrix by a vector.
/// - mat (matrix): The matrix to translate
/// - vec (vector): The vector to translate by.
#let translate(mat, vec) = {
return mul-mat(
mat,
transform-translate(
vec.at(0),
-vec.at(1),
vec.at(2),
),
)
}
|
https://github.com/devraza/warehouse | https://raw.githubusercontent.com/devraza/warehouse/main/blog/hoaxes-overview.typ | typst | MIT License | #import "template.typ": conf
#show: doc => conf(
title: [ An overview on hoaxes ],
doc,
)
= Introduction
In recent times, hoaxes have become increasingly prevalent as the
internet continues to expand and as more people use social media.
Misinformation is on a rise - though this is information which isn’t
really new, the current state of things is horrible, and things really
shouldn’t be the way they are.
I aim for this to be a brief blog post detailing the effect of hoaxes on
society, focusing on why they’re so harmful.
= What exactly is a hoax?
Put simply, a hoax is made-up information, be it a story or something
else. Hoaxes are created with the intent of spreading false information - for a immense variety of reasons, from jokes and causing embarrassment
to provoking politic or social change #footnote[https://en.wikipedia.org/wiki/Hoax]. I won’t discuss
the causes of hoaxes further in this blog post.
= The effect of hoaxes
Hoaxes can cause significant damage to their targets if formulated
cleverly. For example:
#quote(block: true, attribution: "from the Wikipedia 4chan page")[
The stock price of Apple Inc.~fell significantly in October 2008 after a
hoax story was submitted to CNN’s user-generated news site iReport.com
claiming that company CEO <NAME> had suffered a major heart attack.
The source of the story was traced back to 4chan.
]
With the incredible presence of social media in our lives, spreading
harmful misinformation like that above can be as simple as making a few
posts - they don’t even need to be very convincing! What makes matters
worse is how gullible the general population is, even those educated in
this sort of thing - this shows #emph[just] how much influence the
internet and it’s contents have on us.
I would like to clarify that I’m not suggesting that people should avoid
using the internet to gather information - while its reliability is
incredibly questionable, the accessibility and openness it provides far
beats traditional methods of gathering information \(books and such). My
suggestion is that people should be much more careful with how they
interpret information on the internet, and perform their due diligence
in their research into whatever they’re aiming to learn; #strong[people
should make sure that what they’re reading is accurate before absorbing
any information] \(here’s your tl;dr).
That’s about it for this blog post, as it was meant to be a brief way of
expressing my thoughts on the matter. Thanks for reading!
|
https://github.com/a-camarillo/resume | https://raw.githubusercontent.com/a-camarillo/resume/main/README.md | markdown | # Resume generated with Typst
|
|
https://github.com/Catlordx/WUT-LAB-Report-Typst-Template | https://raw.githubusercontent.com/Catlordx/WUT-LAB-Report-Typst-Template/master/README.md | markdown | MIT License | 
这是一个WUT实验报告Typst模板
## conf.typ
这是主要的配置文件,包含了实验报告的模板定义和样式设置。
### 主要函数和定义
- `conf`: 设置页面和文本样式,并生成实验报告的基本结构。
- `experiment_table`: 生成实验项目表格。
- `blank_table`: 生成空白表格。
- `enf`: 设置英文文本样式。
- `section_1`: 生成第一部分的标题。
- `section_1_1`: 生成第一部分的第一个小节标题。
- `section_1_2`: 生成第一部分的第二个小节标题。
- `section_1_3`: 生成第一部分的第三个小节标题。
- `section_2`: 生成第二部分的标题。
- `section_2_1`: 生成第二部分的第一个小节标题。
- `section_2_2`: 生成第二部分的第二个小节标题。
- `section_2_3`: 生成第二部分的第三个小节标题。
## demo.typ
[main.typ](./main.typ)是一个示例文件,展示了如何使用 [wut.typ](wut.typ) 中定义的模板和函数生成实验报告。 |
https://github.com/El-Naizin/cv | https://raw.githubusercontent.com/El-Naizin/cv/main/letter.typ | typst | Apache License 2.0 | #import "brilliant-CV/template.typ": *
#show: layout
#set text(size: 12pt) //set global font size
#letterHeader(
myAddress: [1 Rue Gonnet \ 75003 Paris, France],
recipientName: [ABC Company],
recipientAddress: [15 Boulevard Roi \ 75011 Paris, France],
date: [05/05/2023],
subject: "Subject: Job Application for Senior Data Analyst"
)
Dear Hiring Manager,
I am excited to submit my application for the Senior Data Analyst position at ABC Company. With over 5 years of experience in data analysis and a demonstrated track record of success, I am confident in my ability to make a valuable contribution to your team.
In my current role as a Data Analyst at XYZ Company, I have gained extensive experience in data mining, quantitative analysis, and data visualization. Through my work, I have developed a deep understanding of statistical concepts and have become adept at using tools such as SQL, Python, and R to extract insights from complex datasets. I have also gained valuable experience in presenting complex data in a visually appealing and easily accessible manner to stakeholders across all levels of an organization.
I believe that my experience in data analysis makes me an ideal candidate for the Senior Data Analyst position at ABC Company. I am particularly excited about the opportunity to apply my skills to support your organization's mission and drive impactful insights. Your focus on driving innovative solutions to complex problems aligns closely with my own passion for using data analysis to drive positive change in organizations.
In my current role, I have been responsible for leading data projects from initiation to completion. I work closely with cross-functional teams to identify business problems and use data to develop solutions that drive business outcomes. I have a proven track record of delivering high-quality work on time and within budget.
Furthermore, I have extensive experience in developing and implementing data-driven solutions that improve business operations. For example, I have implemented predictive models that have improved sales forecasting accuracy by 10%, resulting in significant cost savings. I have also developed dashboards that provide real-time insights into business performance, enabling stakeholders to make more informed decisions.
As a highly motivated and detail-oriented individual, I am confident that I would thrive in the fast-paced and dynamic environment at ABC Company. I am excited about the opportunity to work with a talented team of professionals and to continue developing my skills in data analysis.
Thank you for considering my application. I look forward to the opportunity to discuss my qualifications further.
Sincerely,
#letterSignature("/src/signature.png")
#letterFooter()
|
https://github.com/maxgraw/bachelor | https://raw.githubusercontent.com/maxgraw/bachelor/main/apps/document/src/8-appendix/result.typ | typst | === Grunddaten <appendix-resultBase>
#let results = csv("../data/response.csv")
#rotate(-90deg, reflow: true, table(
columns: 28,
gutter: 0pt,
..results.flatten(),
))
#pagebreak()
=== Daten Transformiert <appendix-resultTransformed>
#let results = csv("../data/response_transformed.csv")
#rotate(-90deg, reflow: true, table(
columns: 26,
gutter: 0pt,
..results.flatten(),
))
#pagebreak()
=== Skalenmittelwerte pro Person <appendix-resultTransformedMean>
#let results = csv("../data/response_transformed_mean.csv")
#rotate(0deg, reflow: true, table(
columns: 6,
gutter: 0pt,
..results.flatten(),
))
#pagebreak()
=== Daten Konfidenz <appendix-responseConfidence>
#let results = csv("../data/response_confidence.csv")
#rotate(0deg, reflow: true, table(
columns: 7,
gutter: 0pt,
..results.flatten(),
))
#pagebreak()
=== Verteilung der UEQ-Skalen <appendix-resultDistribution>
#rotate(-90deg, image("../media/result/ueq_distribution.png"), reflow: true)
=== Anmerkungen <appendix-Anmerkungen>
- Start-Button deutlicher darstellen, Neu laden der Seite anders gestalten, "Löschen"-Button verschwindet hinter Stack-Cubes -> Ebene auf davor verschieben
- Nachdem der Kreis erschienen ist, weiß man nicht wie es weitergeht, evtl. Anweisung am Kreis, Knopf am Anfang größer und pregnanter.
- Die Möbel verdecken die buttons wenn diese sie überlagern. die buttons sollten immer im Vordergrund angezeigt werden.
- Die Anwendung hat sich einmal aufgehangen. Das Menü mit 1x1 und 2x1 hat keine Eingabe akzeptiert und die Seite musste neu geladen werden
- Die Stackcubes wurden nicht ohne Lücken aufeinander gestapelt. Es war möglich unrealistische (schwebende) Konstruktionen zu bauen. |
|
https://github.com/imatpot/typst-ascii-ipa | https://raw.githubusercontent.com/imatpot/typst-ascii-ipa/main/src/main.typ | typst | MIT License | #import "lib/delimiters.typ": *
#import "lib/converters.typ": branner, praat, sil, xsampa
|
https://github.com/CreakZ/mirea-algorithms | https://raw.githubusercontent.com/CreakZ/mirea-algorithms/master/reports/work_2/work_2.typ | typst | #import "../title_page_template.typ": title_page
#import "../layouts.typ": head1, head2, tab, un_heading, indent, tab_caption
#set text(font: "New Computer Modern", size: 14pt)
#set heading(numbering: "1.")
#set page(paper: "a4", margin: 2cm)
#set figure.caption(separator: [ -- ])
#title_page(2, [Абстрактный тип данных и его реализация на одномерном статическом массиве])
#un_heading([Оглавление])
#outline(
title: none,
indent: none
)
#pagebreak()
#set par(justify: true, first-line-indent: 1.25cm)
#set page(numbering: "1")
#head1([= Условие задачи и задание варианта])
#head2([== Условие задачи])
#par(
[#indent Дано множество из n целых чисел. Дан набор задач (операций), которые требуется выполнить над исходным множеством. Набор задач определен в варианте задания табл. 6.]
)
#par(
[Разработать и реализовать АТД задачи, по управлению множеством посредством операций, указанных в варианте задания. В АТД включить операции по заполнению исходного множества и отображения множества.]
)
#par(
[При разработке алгоритмов операций варианта могут быть выявлены
дополнительные алгоритмы, например такие: определить является ли число простым, или определить сумму цифр числа, эти алгоритмы надо включить в раздел операций АТД.]
)
#head2([== Задание варианта])
#par(
[#enum(
tight: true,
[Найти позицию элемента массива значение которого делится на каждую из цифр числа.],
[Вставить в массив новый элемент после элемента, значение которого делится на каждую цифру значения.],
[Удалить из массива все элементы, кратные трем.]
)]
)
#pagebreak()
#head1([= АТД задачи])
#let tab(theme) = {
set par(first-line-indent: 1.25cm, hanging-indent: 1.25cm)
text([#theme #linebreak()])
}
#let method(num, head, pre, post, header) = {
set par(hanging-indent: 1.25cm, first-line-indent: 1.25cm)
par([
#num #head #linebreak()
])
par([
Предусловие: #pre #linebreak()
])
par(
[Постусловие: #post #linebreak()]
)
par(
[Заголовок: #header #linebreak()]
)
}
#par(
justify: true,
[
АТД myArray \
{ \
#tab([_Данные_ (описание свойств структуры данных задачи)])
#tab([N – максимальное количество элементов в множестве])
#tab([n – длина массива])
#tab([arr – список значений элементов массива])
#tab([_Операции_ (объявления операций)])
#method(
[1.],
[Метод, осуществляющий вывод текущих значений множества],
[нет],
[выведенные через пробел элементы массива],
[#raw("printElements()")]
)
#method(
[2.],
[Метод, осуществляющий заполнение массива случайными значениями],
[нет],
[массив, заполненный случайными значениями],
[#raw("fillRandomly()")]
)
#method(
[3.],
[Метод, осуществляющий заполнение массива вручную – с клавиатуры],
[нет],
[массив, заполненный значениями, введенными с клавиатуры],
[#raw("fillManually()")]
)
#method(
[4.],
[Метод, возвращающий индекс первого элемента, делящегося на каждую из своих цифр. В случае отсутствия такового элемента возвращается -1],
[нет],
[число – индекс первого элемента, нацело делящегося на каждую из своих цифр],
[#raw("getIndex()")]
)
#method(
[5.],
[Метод осуществляющий вставку элемента newElem на позицию с индексом pos],
[pos – индекс элемента, на место которого требуется вставить новый элемент, newElem – значение нового элемента],
[массив arr длиной n+1 со вставленным элементом newElem на позиции pos],
[#raw("insert(int pos, int newElem)")]
)
#method(
[6.],
[Метод, осуществляющий вставку нового элемента newElem после элемента с индексом getIndex(). Если getIndex() = -1, вставка производится в начало массива],
[newElem – значение нового элемента],
[массив arr длиной $n+1$ со вставленным элементом newElem на позиции getIndex()+1],
[#raw("getIndexInsert(int newElem)")]
)
#method(
[7.],
[Метод, осуществляющий удаление из массива всех элементов, нацело делящихся на 3],
[нет],
[измененный массив arr, содержащий элементы, не делящихся нацело на 3],
[#raw("deleteMultiplesOfThree()")]
)
\
}
]
)
#pagebreak()
#head1([= Разработка программы])
#head2([== Реализация данных АТД])
#let code = read("../../src/work_2/headers/myArray.h")
#raw(code, lang: "cpp")
#pagebreak()
#head2([== Алгоритмы методов])
#tab_caption(1, [Псевдокод для метода, реализующего удаление элемента в заданной позиции])
#let tab = 0.5cm
#figure(
kind: table,
table(
columns: 2,
align: (center, left),
table.header(
table.cell(
colspan: 2,
[#raw("void erase(int pos)", lang: "cpp")]
)
),
[Номер], table.cell(
align: center, [Инструкция]
),
[1], [if $not$(pos > -1 $and$ pos < n) then],
[2], [#h(0.5cm) Вывод $quote.double.l.angle$ Невозможно удалить элемент: неверный индекс!$quote.double.r.angle$],
[3], [endIf],
[4], [for i $<-$ to n $-$ 2 do],
[5], [#h(0.5cm) arr[$i$] $<-$ arr[$i+1$]],
[6], [od],
[7], [n $<-$ n + 1]
)
)
#tab_caption(2, [Псевдокод для метода, реализующего вставку элемента в заданной позиции])
#figure(
kind: table,
table(
columns: 2,
align: (center, left),
table.header(
table.cell(
colspan: 2,
[#raw("void insert(int pos, int newElem)", lang: "cpp")]
)
),
[Номер], table.cell(
align: center, [Инструкция]
),
[1], [if $not$(pos > -1 $and$ pos < n) then],
[2], [#h(0.5cm) Вывод $quote.double.l.angle$Невозможно вставить элемент: неверный индекс!$quote.double.r.angle$],
[3], [endIf],
[4], [prev $<-$ arr[pos]],
[5], [arr[pos] $<-$ newElem],
[6], [for i $<-$ pos + 1 to n + 1 do],
[7], [#h(0.5cm) temp $<-$ arr[i]],
[8], [#h(0.5cm) arr[i] $<-$ prev],
[9], [#h(0.5cm) prev $<-$ temp],
[10], [od],
[11], [n $<-$ n + 1]
)
)
#pagebreak()
#tab_caption(3, [Псевдокод для метода, реализующего поиск первого элемента, делящегося нацело на каждую из своих цифр])
#figure(
kind: table,
table(
columns: 2,
align: (center, left),
table.header(
table.cell(
colspan: 2,
[#raw("void getIndex()", lang: "cpp")]
)
),
[Номер], table.cell(
align: center, [Инструкция]
),
[1], [for i $<-$ to n $-$ 1 do],
[2], [#h(0.5cm) number $<-$ arr[$i$]],
[3], [#h(0.5cm) while number > 0 do],
[4], [#(2*h(0.5cm)) if number $mod$ 10 $eq.not$ 0 then],
[5], [#(3*h(0.5cm)) if arr[$i$] $mod$ (number $mod$ 10) $eq.not$ 0 then],
[6], [#(4*h(0.5cm)) break],
[7], [#(3*h(0.5cm))endIf],
[8], [#(2*h(0.5cm)) else],
[9], [#(3*h(0.5cm)) break],
[10], [#(2*h(0.5cm))endIf],
[11], [#(2*h(0.5cm))number $<-$ number $"div"$ 10],
[12], [#h(0.5cm) od],
[13], [#h(0.5cm) if number $=$ 0 then],
[14], [#(2*h(0.5cm)) return i],
[15], [#h(0.5cm) endIf],
[16], [return -1]
)
)
#pagebreak()
#head2([== Таблица тестов операций])
#figure(
kind: table,
table(
columns: 4,
align: (center, center, left, left),
table.header(
[Номер], [Операция],
table.cell(
align: center,
[Входные данные]
),
table.cell(
align: center,
[Результат работы]
)
),
[1], [#raw("erase")], [n=7 \ arr={1, 2, 3, 5, 8, 13, 21} \ pos=3], [n=6 \ arr={1, 2, 3, 8, 13, 21}],
[2], [#raw("erase")], [n=2 \ arr={9, 11} \ pos=2], [Ошибка: $quote.double.l.angle$Невозможно удалить элемент: неверный индекс!$quote.double.r.angle$],
[3], [#raw("insert")], [n=7 \ arr={1, 2, 3, 5, 8, 13, 21} \ pos=3 \ newElem=4], [n=8 \ arr={1, 2, 3, 4, 5, 8, 13, 21}],
[4], [#raw("insert")], [n=5 \ arr={2, 2, 2, 2, 2} \ pos=5 \ newElem=8], [Ошибка: $quote.double.l.angle$Невозможно вставить в массив: неверный индекс!$quote.double.r.angle$],
[5], [#raw("getIndex")], [n=7 \ arr={13, 17, 31, 53, 15, 13, 21}], [4],
[6], [#raw("getIndex")], [n=3 \ arr={13, 17, 97}], [-1]
)
)
#pagebreak()
#head2([== Код проекта])
#head2([=== Файл #raw("myArray.cpp")])
#let arr_code = read("../../src/work_2/source/myArray.cpp")
#raw(arr_code, lang: "cpp")
#pagebreak()
#head2([=== Файл #raw("main.cpp")])
#let main_code = read("../../src/work_2/main.cpp")
#raw(main_code, lang: "cpp")
#pagebreak()
#head1([= Скриншоты результатов тестирования])
#par(
[#indent _Комментарий: на скриншотах ниже первое число – это длина массива n, а следующие n чисел – введенные вручную элементы массива. Далее в зависимости от введенных данных и вызываемого метода выводится результат работы (элементы массива через пробел, текст ошибки или число)._]
)
#figure(
image(
width: 60%,
"images/test1.png"
),
supplement: [Рисунок],
caption: [Тест №1]
)
#figure(
image(
width: 60%,
"images/test2.png"
),
supplement: [Рисунок],
caption: [Тест №2]
)
#figure(
image(
width: 60%,
"images/test3.png"
),
supplement: [Рисунок],
caption: [Тест №3]
)
#figure(
image(
width: 60%,
"images/test4.png"
),
supplement: [Рисунок],
caption: [Тест №4]
)
#figure(
image(
width: 60%,
"images/test5.png"
),
supplement: [Рисунок],
caption: [Тест №5]
)
#figure(
image(
width: 60%,
"images/test6.png"
),
supplement: [Рисунок],
caption: [Тест №6]
) |
|
https://github.com/rabotaem-incorporated/algebra-conspect-1course | https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/03-polynomials/11-interpolation.typ | typst | Other | #import "../../utils/core.typ": *
== Интерполяция
#th[
Пусть $K$ --- поле$, space n in NN: space x_1, x_2, ..., x_n in K,$ различные между собой. $y_1, y_2, ..., y_n in K$. Тогда $exists! f in K[x]: deg f <= n - 1$ и $f(x_i) = y_i, space i = 1, ..., n$.
]
#proof[
"Единственность":
Предположим, что существует два многочлена $f, g in K[x], space deg f <= n - 1, space deg g <= n - 1: space f(x_i) = g(x_i) = y_i, space i = 1, ..., n$
Пусть $h = f - g, space deg h <= n - 1, space h(x_i) = 0, space i = 1, ..., n$
Предположим, $h eq.not 0 ==>$ у $h <= n - 1$ корней, но такого не может быть.
"Существование":
*Формула Лагранжа*
Решим интерполяционную задачу в специальном случае, когда $y_1 = 1, space y_2 = ... = y_n = 0$.
Найдем соответствующий многочлен $f_1$.
$x_1, ..., x_n$ --- корни многочлена $f_1 ==> (x - x_2) divides f_1, ..., (x - x_n) divides f_1 ==>$
$underbrace((x - x_2) (x - x_3) ... (x - x_n), "степени " n - 1) divides f_1 ==> f_1 = c(x - x_2) ... (x - x_n), space c in K$
$f_1 (x_1) = 1 <==> c (x_1 - x_2) ... (x_1 - x_n) = 1 ==> c = (1)/((x_1 - x_2) ... (x_1 - x_n))$
Получился многочлен $f_1 = ((x - x_2) ... (x - x_n))/((x_1 - x_2) ... (x_1 - x_n))$
Аналогичная задача с $y_i = 1, forall_(j eq.not i) space y_j = 0$ имеет решение:
$f_i = ((x - x_1) ... hat((x - x_i)) ... (x - x_n))/((x_i - x_1) ... hat((x_i - x_i)) ... (x_i - x_n)) = ((x - x_1) ... hat((x - x_i)) ... (x - x_n))/(F'(x_i))$
Рассмотрим $f = y_1 f_1 + y_2 f_2 + ... + y_n f_n,quad y_1, ..., y_n$ теперь произвольные.
$deg <= max(deg f_1, ..., deg f_n) = n - 1$
Получилась такая формула $f(x_i) = y_1 underbrace(f_1 (x_i), 0) + y_2 underbrace(f_2 (x_i), 0) + ... + y_i underbrace(f_i (x_i), 1) + ... + y_n underbrace(f_n (x_i), 0) = y_i$
]
#notice[
Про связь с производной
$F = (x - x_1) ... (x - x_n)$
$F' = limits(sum)_(i = 1)^n (x - x_1) ... hat((x - x_i)) ... (x - x_n)$
$F'(x_j) = limits(sum)_(i = 1)^n (x_j - x_1) ... hat((x_j - x_i)) ... (x_j - x_n) = (x_j - x_1) ... hat((x_j - x_j)) ... (x_j - x_n)$
]
*<NAME>*
Рассмотрим интерполяционную задачу и предположим, что мы уже нашли $f_((n - 1)) in K[x]$, такой что $f_((n - 1))$ решение интерполяционной задачи $(x_1, ..., x_(n - 1); y_1, ..., y_(n - 1))$, то есть
$deg f_((n - 1)) <= n - 2$ и $f_((n - 1))(x_i) = y_i, space i = 1, ..., n - 1$
Пусть $f$ решение интерполяционной задачи
$f = f_((n - 1)) + g, space g = ?$
$f(x_i) = y_i = f_((n - 1)) (x_i), space i = 1, ..., n - 1$
$g = f - f_((n - 1)), space g(x_1) = ... = g(x_(n - 1)) = 0$
$deg g <= n - 1 ==> g = c (x - x_1) ... (x - x_(n - 1))$
$g(x_n) = f(x_n) - f_((n - 1)) (x_n) = y_n - f_((n - 1)) (x_n) ==>$ отсюда находится $c$ |
https://github.com/adrianvillanueva997/cv | https://raw.githubusercontent.com/adrianvillanueva997/cv/main/modules_en/education.typ | typst | // Imports
#import "@preview/brilliant-cv:2.0.2": cvSection, cvEntry, hBar
#let metadata = toml("../metadata.toml")
#let cvSection = cvSection.with(metadata: metadata)
#let cvEntry = cvEntry.with(metadata: metadata)
#cvSection("Education")
#cvEntry(
title: [Computer science],
society: [Universidad Europea, Madrid],
date: [2015- 2022],
location: [Spain],
description: list([Thesis: Building a self-hosted AI driven platform for security cameras monitoring using edge computing #hBar() GPA: 9.5/10]),
)
|
|
https://github.com/AOx0/expo-nosql | https://raw.githubusercontent.com/AOx0/expo-nosql/main/book/src/theme-gallery/bristol.typ | typst | MIT License | #import "../../../slides.typ": *
#import "../../../themes/bristol.typ": *
#show: slides.with(
authors: ("Author A", "Author B"), short-authors: "Short author",
title: "Title", short-title: "Short title", subtitle: "Subtitle",
date: "Date",
theme: bristol-theme(),
)
#slide(theme-variant: "title slide")
#new-section("section name")
#slide(title: "Slide title")[
A slide
]
#slide(title: "Two column")[
Column A goes on the left...
][
And column B goes on the right!
]
#slide(title: "Variable column sizes", colwidths: (2fr, 1fr, 3fr))[
This is a medium-width column
][
This is a rather narrow column
][
This is a quite a wide column
]
#slide(theme-variant: "wake up")[
Wake up!
] |
https://github.com/lucannez64/Notes | https://raw.githubusercontent.com/lucannez64/Notes/master/Correction_Olympiades_Partie_1.typ | typst | #import "template.typ": *
// Take a look at the file `template.typ` in the file panel
// to customize this template and discover how it works.
#show: project.with(
title: "Correction Olympiades Partie 1",
authors: (
"<NAME>",
),
date: "30 Octobre, 2023",
)
#set heading(numbering: "1.1.")
=== 1. Quelques exemples
<quelques-exemples>
#block[
#set enum(numbering: "a.", start: 1)
+ On peut construire une autre liste de longueur 8 et de score 3 en
changeant l’ordre de certains éléments tout en gardant 3 inversions.
Par exemple :
]
\[4,2,6,7,1,5,3,8\]
Ici on a inversé 2 et 5 par rapport à la liste initiale, ainsi que 6 et
7, tout en gardant le même nombre d’inversions (3).
#block[
#set enum(numbering: "a.", start: 2)
+ Avec n\=3, il y a 3! \= 6 listes possibles. Les voici avec leur score
:
]
- \[1,2,3\] : score 0 (liste triée dans l’ordre croissant)
- \[1,3,2\] : score 1 (une inversion 3-2) \
- \[2,1,3\] : score 1 (une inversion 2-1)
- \[2,3,1\] : score 1 (une inversion 3-1)
- \[3,1,2\] : score 1 (une inversion 3-2)
- \[3,2,1\] : score 2 (deux inversions 3-2 et 3-1)
=== 2. Fonction Python
<fonction-python>
```python
def score(L, n):
compteur = 0
for i in range(n-1):
if L[i] < L[i+1]:
compteur += 1
return compteur
```
=== 3. Démonstration des bornes du score
<démonstration-des-bornes-du-score>
- Score minimum \= 0. C’est le cas quand la liste est triée dans l’ordre
croissant, il n’y a alors aucune inversion.
- Score maximum \= n-1. C’est le cas quand la liste est triée dans
l’ordre décroissant. Il y a alors une inversion entre chaque paire
d’éléments successifs, soit n-1 inversions.
- Exemple de liste avec score 0 : \[1, 2, 3, …, n\] \
- Exemple de liste avec score n-1 : \[n, n-1, n-2, …, 1\]
=== 4. Existence d’une liste de score k
<existence-dune-liste-de-score-k>
#block[
#set enum(numbering: "a.", start: 1)
+ On peut construire une telle liste comme suit : on prend les k plus
grands éléments dans l’ordre décroissant, puis on ajoute les n-k plus
petits éléments dans l’ordre croissant. Cette liste aura alors
exactement k inversions.
]
Par exemple avec n \= 8 et k \= 3 : \
\[7, 6, 5, 1, 2, 3, 4, 8\]
#block[
#set enum(numbering: "a.", start: 2)
+ Oui il existe plusieurs listes avec le même score k. Par exemple avec
n \= 5 et k \= 2 :
]
\[4, 5, 1, 2, 3\] \
\[5, 4, 1, 2, 3\]
Ces deux listes ont toutes les deux exactement 2 inversions (entre 4 et
1, et entre 5 et 1).
=== 5. Formules pour L\_n(0) et L\_n(n-1)
<formules-pour-l_n0-et-l_nn-1>
L\_n(0) \= 1 car il n’y a qu’une seule liste possible avec 0 inversion :
la liste triée par ordre croissant.
L\_n(n-1) \= 1 car il n’y a qu’une seule liste possible avec n-1
inversions : la liste triée par ordre décroissant.
=== 6. Relation de récurrence
<relation-de-récurrence>
#block[
#set enum(numbering: "a.", start: 1)
+ Avec n \= 3 : \
L\_3(0) \= 1 (liste \[1,2,3\]) \
L\_3(1) \= 3 (listes \[2,1,3\], \[1,3,2\] et \[3,1,2\]) \
L\_3(2) \= 1 (liste \[3,2,1\])
]
Pour insérer 4 et garder un score de 1, on peut insérer 4 entre 1 et 2 :
\[3,1,4,2\]
#block[
#set enum(numbering: "a.", start: 2)
+ Pour insérer 4 et garder un score nul, on insère 4 avant 3 :
\[4,3,2,1\]
+ Avec n \= 4, vérification de la formule L\_4(1) \= 2#emph[L\_3(1) +
3]L\_3(0) \= 2#emph[3 + 3]1 \= 6
+ Démonstration de la relation de récurrence générale :
]
- Pour compter les listes de longueur n+1 et de score k, on regarde la
position d’insertion de n+1 :
- Si on insère n+1 à la fin, cela crée k nouvelles inversions et on
avait une liste de longueur n et score k. Il y a L\_n(k) listes
possibles.
- Si on insère n+1 en iième position, cela crée k-i nouvelles
inversions. On avait une liste de longueur n et score k-i. Il y a
L\_n(k-i) listes possibles pour chaque position d’insertion i.
- Il y a donc au total :
- (n+1-k)\*L\_n(k) listes avec insertion à la fin \
- (k+1)\*L\_n(k-1) listes avec insertion en position intermédiaire
D’où la relation L\_(n+1)(k) \= (n+1-k)#emph[L\_n(k) + (k+1)]L\_n(k-1)
#block[
#set enum(numbering: "a.", start: 5)
+ Formule générale par récurrence : L\_(n+1)(k) \= (n+1-k) \* L\_n(k) +
(k+1) \* L\_n(k-1)
+ Tableau des valeurs de L\_n(k) :
]
#align(center)[#table(
columns: 4,
align: (col, row) => (auto,auto,auto,auto,).at(col),
inset: 6pt,
[k \\ n], [3], [4], [5],
[0],
[1],
[1],
[1],
[1],
[3],
[6],
[10],
[2],
[1],
[15],
[35],
[3],
[-],
[20],
[56],
[4],
[-],
[-],
[70],
)
]
== Exercice 2 (candidats suivant l’enseignement de spécialité de la voie
générale)
<exercice-2-candidats-suivant-lenseignement-de-spécialité-de-la-voie-générale>
=== Partie 1
<partie-1>
+ b \= -(r1 + r2) \
c \= r1\*r2
+ Comme b ≤ 0 et c ≥ 0, les racines r1 et r2 sont de signes opposés.
Voici une proposition pour continuer le développement des réponses :
=== Partie 2
<partie-2>
+ #block[
#set enum(numbering: "a.", start: 1)
+ Soit (x1, x2, x3) une solution de (E). Alors : |x1|^2 + |x2|^2 +
|x3|^2 \= α|x1||x2||x3| par parité des fonctions carré et valeur
absolue. Donc (|x1|, |x2|, |x3|) est aussi solution de (E).
]
#block[
#set enum(numbering: "a.", start: 2)
+ S’il existe une solution (x1, x2, x3) dans Z^3 avec un xi non nul,
alors (|x1|, |x2|, |x3|) est une solution dans N^3.
]
#block[
#set enum(numbering: "1.", start: 2)
+ Si (x1, x2, x3) est solution de (E), alors en permutant x1 et x2, on
obtient que (x2, x1, x3) est aussi solution de (E).
+ D’après les questions précédentes, s’il existe une solution dans Z^3
différente de (0,0,0), alors il existe aussi une solution (x1, x2, x3)
dans N^3 avec x1 ≤ x2 ≤ x3.
]
=== Partie 3
<partie-3>
+ Supposons x1 \= 0. Alors d’après (E), on a x2^2 + x3^2 \= 0, donc x2
\= x3 \= 0. Ce qui contredit le fait que (x1, x2, x3) est différent de
(0,0,0). Donc nécessairement x1 \> 0.
+ #block[
#set enum(numbering: "a.", start: 1)
+ Montrons que y racine de Q \<\=\> (x1, x2, y) solution de (E) :
]
- Si y racine de Q, alors Q(y) \= 0, donc x1^2 + x2^2 + y^2 \= αx1x2y,
donc (x1, x2, y) solution de (E).
- Réciproquement, si (x1, x2, y) solution de (E), alors x1^2 + x2^2 +
y^2 \= αx1x2y, donc Q(y) \= 0, donc y racine de Q.
#block[
#set enum(numbering: "a.", start: 2)
+ x3 est racine de Q car (x1, x2, x3) solution de (E).
+ Q(x2) \= (3 - αx1)x2^2 + (x1^2 - x2^2) \< 0 car x1 \> 0 et x2 \> x1
d’après l’énoncé.
+ Q(0) \= x1^2 + x2^2 \> 0
+ Q a deux racines 0 \< x2 \< x3. De plus, Q(x2) \< 0 et Q(0) \> 0 donc
il existe une racine y \> x3 par le théorème des valeurs
intermédiaires.
+ Comme y est racine de Q, d’après a., (x1, x2, y) est solution de (E)
dans N^3.
]
#block[
#set enum(numbering: "1.", start: 3)
+ On peut réappliquer le raisonnement précédent en remplaçant x3 par y,
et trouver un nouveau triplet solution encore plus grand, et ainsi de
suite. Cela conduit à une impossibilité car il n’y a pas de suite
strictement croissante infinie d’entiers naturels.
+ On aboutit à une contradiction. Donc le seul triplet solution de (E)
dans Z^3 est (0,0,0).
+ Généralisation au cas de n variables :
]
On procède par récurrence sur n.~L’initialisation pour n\=2 est
immédiate. Supposons le résultat vrai jusqu’à l’ordre n-1, avec n ≥ 3.
Raisonnons par l’absurde en supposant qu’il existe un n-uplet (x1, …,
xn) solution de l’équation avec un xi ≠ 0.
En appliquant un raisonnement similaire aux questions précédentes, on
peut se ramener à un n-uplet (x1, …, xn) dans N^n avec x1 ≤ … ≤ xn.
On définit alors Q(y) \= y^2 - αx1…xn-1y + (x1^2 + … + xn-1^2). On
montre comme précédemment que Q admet deux racines distinctes xn et y
avec y \> xn.
Donc (x1, …, xn-1, y) est un (n-1)-uplet solution de l’équation analogue
en dimension n-1. Ceci contredit l’hypothèse de récurrence.
D’où finalement le seul n-uplet solution est (0, …, 0).
|
|
https://github.com/VisualFP/docs | https://raw.githubusercontent.com/VisualFP/docs/main/SA/design_concept/content/poc/options_ui_ghcjs.typ | typst | #import "../../../acronyms.typ": ac
= GHCJS <ghcjs>
There are many other Haskell libraries for #ac("UI") implementations, but
many rely on compiling Haskell to JavaScript. This cross-compilation is often
based on GHCJS. GHCJS implements a JS backend for #ac("GHC") and has recently been
merged into the #ac("GHC") repository @ghcjs-merged.
Using GHCJS with an accompanying #ac("UI") library, which would optimally support
#ac("FRP"), could make a lot of sense for an application like VisualFP.
Since all code would be compiled to JavaScript, it would automatically be
platform-independent without the need for a supporting server infrastructure
other than a way of serving static files.
But GHCJS has merged only recently @ghcjs-merged, and thus its usage poses some
challenges:
- No pre-built binaries are available at the time of writing, meaning the
complete #ac("GHC") compiler must be built manually.
- While there is some documentation, it doesn't seem to be very comprehensive.
The downsides could be overcome, and it is to be expected that
GHCJS will get better tooling support in the future.
But after writing some samples in GHCJS, it is to be expected that a considerable amount of
time would need to be invested to get GHCJS to work for the #ac("PoC").
|
|
https://github.com/Dherse/typst-brrr | https://raw.githubusercontent.com/Dherse/typst-brrr/master/samples/steno-numbers/jeff-numbers.typ | typst | #import "steno.typ" :*
#let title = "Jeff-Numbers — Cheat Sheet"
#let author = "<NAME>"
#let version = "0.1"
#let grid = 10pt
#let accentColor = blue
#let accentTextColor = white
#let headerColor = blue
#let headerLighten = 20%
#set document(author: author, title: title)
#set text(font: "Roboto")
#show link: underline
#show heading.where(level:1): it => [
#set align(center)
#set text(fill: accentTextColor)
#block(fill: accentColor.darken(headerLighten), width: 100%, outset: grid, smallcaps(it.body))
#v(grid)
]
#show heading.where(level:2): it => [
#v(grid)
#set align(left)
#set text(fill: accentTextColor)
#block(fill: headerColor.lighten(headerLighten), width: 100%, outset: grid, it.body)
#v(grid)
]
#set page(
width: 47cm, height: 58cm,
columns: 2, numbering: "1", margin: (top:105pt, x: grid*2, bottom: 25pt),
header: [
#set text(fill: accentTextColor)
#rect(fill: accentColor, width: 100%, inset: grid, outset: (left:100pt, right:100pt))[
#text(size: 2em, weight: "bold")[#title #counter(page).display("I")]
#text(size: 1.5em)[#("Enhanced number system for Plover")] #h(grid) #text(size: 1.2em)[https://github.com/jthlim/jeff-numbers]
]
],
footer: [
#rect(fill: accentColor, width: 100%, inset: grid*0.5, outset: (left:100pt, right:100pt))[
#set text(fill: accentTextColor)
#align(right)[v#version #sym.floral Made with #link("https://typst.app")[typst] by #link("https://www.yanncebron.com")[#author] #sym.floral Steno-Font by #link("https://github.com/Kaoffie/steno_font")[Kaoffie]]
]
]
)
#block(stroke: 0.5pt + accentColor.darken(headerLighten), inset: grid)[
= Input Modifiers
== Reverse
#stroke("EU"), #stroke("E") (for Multisteno) or #stroke("U") (for Uni) reverses any stroke, and works with any number of digits.
#stenoExplain("42", "24EU", "24 (Reverse)")
#stenoExplain("97031", "130EU79", "13079 (Reverse)")
== Double Last Digit
#stroke("-D") will always double the last digit.
#stenoExplain("11", "1-D", "1 (Double Last Digit [1])")
#stenoExplain("122", "12-D", "12 (Double Last Digit [2])")
#stenoExplain("3211", "123EUD", "123 (Reverse) (Double Last Digit [1])")
== Roman Numerals
#stroke("R") or #stroke("-R") converts a number to roman numerals, #stroke("*R") for lower case.
// todo R + -R ??
This will only work for numbers between 1 and 3999 inclusive.
#stenoExplain("XII", "12R", "12 (Roman Numerals)")
#stenoExplain("MCMXCII", "19/2EUR9", "19 / 29 (Reverse) (Roman Numerals) ") // todo
]
//#v(3em)
#block(stroke: 0.5pt + accentColor, inset: grid)[
= Separators
== Decimal Point
#stroke("*") will add a decimal point after.
#stenoExplain("12.34", "12*/34", "12 (Decimal Point) / 34")
== Comma
#stroke("*S") will add a comma after.
#stenoExplain("12,340.50", "12*S/340*/50", "12 (Comma) / 340 (Decimal Point) / 50")
]
#colbreak()
#block(stroke: 0.5pt + accentColor, inset: grid)[
= Suffixes
== 00 --- Hundred Suffix
#stroke("-Z") will add the suffix _00_.
#stenoExplain("200", "2-Z", "2 (Hundred Suffix)")
#stenoExplain("2300", "2/3-Z", "2 / 3 (Hundred Suffix)")
== ,000 --- Thousand Suffix
#stroke("*Z") will add the suffix _,000_.
#stenoExplain("12,000", "12*Z", "12 (Thousand Suffix)")
#stenoExplain("12,000,000", "12*Z/#*Z", "12 (Thousand Suffix) / (Thousand Suffix)")
== % --- Percent Symbol Suffix
#stroke("KR-") or #stroke("-RG") will suffix the entire number with a percent symbol.
#stenoExplain("79%", "KR-79", "79 (Percent Symbol Suffix)")
#stenoExplain("23%", "23-RG", "23 (Percent Symbol Suffix)")
#stenoExplain("112%", "1/12-RG", "1 / 12 (Percent Symbol Suffix)")
#stenoExplain("100%", "1KR-Z", "1 (Hundred Suffix) (Percent Symbol Suffix)")
== n#super("th") --- Ordinal Suffix
#stroke("W") or #stroke("-B") will add ordinal suffixes.
#stenoExplain("1st", "1-B", "1 (Ordinal Suffix)")
#stenoExplain("21st", "2/1-B", "2 / 1 (Ordinal Suffix)")
#stenoExplain("7th", "W-7", "7 (Ordinal Suffix)")
#stenoExplain("11th", "1/1-B", "1 / 1 (Ordinal Suffix)")
]
#colbreak()
#block(stroke: 0.5pt + accentColor, inset: grid)[
= Currency
== Dollar Value
#stroke("WR-") or #stroke("-RB") will format the entire number as a dollar value.
If the value ends with a decimal point, _.00_ will be appended.
#stenoExplain("$7", "WR-7", "7 (Dollar Value)")
#stenoExplain("$23", "23-RB", "23 (Dollar Value)")
#stenoExplain("$1,234", "1234-RB", "1234 (Dollar Value)")
#stenoExplain("$1,234.00", "1234*RB", "1234 (Decimal Point) (Dollar Value)")
#stenoExplain("$1,234.50", "1234*/50-RB", "1234 (Decimal Point) / 50 (Dollar Value)")
== Hundreds of Dollars
#stroke("-DZ") will convert a number to hundreds of dollars, and works with multiple strokes.
#stenoExplain("$100", "1-DZ", "1 (Hundreds of Dollars)")
#stenoExplain("$1,200", "1/2-DZ", "1 / 2 (Hundreds of Dollars)")
]
#block(stroke: 0.5pt + accentColor, inset: grid)[
= Clock
== Full Hour
#stroke("K-") or #stroke("-BG") will add the suffix _:00_.
#stenoExplain("9:00", "K-9", "9 (Full Hour)")
#stenoExplain("2:00", "2-BG", "2 (Full Hour)")
#stenoExplain("11:00", "1-BGD", "1 (Double Last Digit [1]) (Full Hour)")
== 15-Minute Steps
Using #stroke("K") combined with #stroke("-B") and/or #stroke("-G") gives 15 minute increments.
#stenoExplain("7:15", "K-7G", "7 (:15 Suffix)")
#stenoExplain("9:30","K-B9", "9 (:30 Suffix)")
#stenoExplain("3:45", "3K-BG", "3 (:45 Suffix)")
== AM/PM Suffix
Adding #stroke("-S") or #stroke("*S") will add suffix _a.m._ or _p.m._
#stenoExplain("3:00 a.m.", "3-BGS", "3 (Full Hour) (AM Suffix)")
#stenoExplain("12:00 p.m.", "12/#K*-S", "12 / (Full Hour) (PM Suffix)")
]
#colbreak()
#block(stroke: 0.5pt + accentColor, inset: grid)[
= Words
== To Words
#stroke("-G") will convert the number to words.
#stenoExplain("twelve", "12-G", "12 (To Words)")
#stenoExplain("two thousand", "2*GZ", "2 (Thousand Suffix) (To Words)")
#stenoExplain("twelve million", "12*Z/#*GZ", "12 (Thousand Suffix) / (Thousand Suffix) (To Words)")
Note that #stroke("-S") suffix with Plover's orthography rules will work as expected.
#stenoExplain("thirties", "30GS", "30 (To Words) (Pluralize)")
#stenoExplain("forty-fours", "4-D/#-GS", "4 (Double Last Digit [4]) / (To Words) (Pluralize)")
== Ordinal Words
Can be combined with #stroke("W-") to give ordinal words.
#stenoExplain("twenty-first", "12WEUG", "12 (Reverse) (Ordinal Word)")
#stenoExplain("tenths", "1W0GS", "10 (Ordinal Word)")
This can also be done as a suffix stroke.
#stenoExplain("one hundredth", "1-Z/#W-G", "1 (Hundred Suffix) / (Ordinal Word)")
]
#v(30em)
= Support the #link("http://www.openstenoproject.org/")[Open Steno Project] |
|
https://github.com/0x1B05/algorithm-journey | https://raw.githubusercontent.com/0x1B05/algorithm-journey/main/practice/note/content/二分查找.typ | typst | #import "../template.typ": *
#pagebreak()
= 二分查找
== 二分查找的本质
=== 问题引入
`1 2 3 5 5 5 8 9`
1. 找到第一个'>=5'的元素 (第一个 5)
2. 找到最后一个'\<5'的元素 (3)
3. 找到第一个'>5'的元素 (8)
4. 找到最后一个'<=5'的元素 (最后一个 5)
=== 新的角度
==== 情景概述
数组下标为`1 2 ... k-1 k ... n-2 n-1`,共 N 个元素 设前 k 个元素为蓝色区域,后 n-k
个为红色区域 假设一开始数组均为灰色,那么问题的目标即为找出蓝红边界,即求出未知数
k
==== 朴素算法
在最左侧设置一个蓝色指针,从最左边开始挨个遍历,直到找到蓝红边界 或
在最右侧设置一个红色指针,从最右边开始挨个遍历,直到找到蓝红边界
==== 二分查找
将蓝色指针右移的过程看作是扩展灰色区域为蓝色区域
将红色指针左移的过程看作是扩展灰色区域为红色区域
===== 例子
数组下标:`(0 1 2 3 4) [5 6 7 8]`
蓝色指针位于-1 位置,红色指针位于 9 位置
> ()内为蓝色边界,[]为红色边界
1. 蓝色指针移动到灰色区域的中间位置 (0+9)/2 即 4 位置,4 为蓝色说明 4 以及 4
前的位置均为蓝色
2. 红色指针移动到灰色区域中间的位置 (4+8)/2 即 6 位置,6 为红色,说明 6 以及 6
后的位置均为红色
3. 蓝色指针移动到灰色区域中间的位置 (4+6)/2 即 5 位置,5 为红色,说明 5 以及 5
前的位置均为蓝色
4. 找到蓝红边界!
===== 伪代码
```
l = -1,r = n
while l+1 != r
m = (l+r)/2 // 向下取整
if IsBLUE(m)
l = m
else
r = m
return l or r
```
初始:l 指向蓝色区域,r 指向红色区域 循环:l,r 快速向蓝红边界逼近,*保持 l,r
颜色不变* 结束:l,r 刚好指向蓝红边界
===== 细节问题
1. 为什么 l 的初始值为-1,r 的初始值为 n? 假设 l 初始化为 0
则如果整个数组均为红色,则 l 一开始即会处于红色区域内 假设 r 初始化为 n-1
则如果整个数组均为蓝色,则 r 一开始即会处于蓝色区域内
2. m 是否始终处于[0,n)以内?
$l_{min} = -1$ $r_{min} = 1("Why?") arrow.r m_{min} = 0$
$l_{max} = n-2$ $r_{max} = n arrow.r m_{min} = n-1$
故 m 不会溢出
3. 更新指针时能不能写成 l=m+1 或 r=m-1? 可以,但是从正确性和易懂性来看,不好.
4. 会不会死循环?
1. l+1=r(立刻推出)
2. l+2=r(回归第一种情况)
3. l+3=r(回归第二种或者第一种情况)
4. ...
===== 问题解答
#tablem[
| 问题 | 蓝红划分 | IsBLUE 条件 | 返回 | | ----------------------- |
------------------- | ----------- | ---- | | 找到第一个'>=5'的元素 | (1 2 3) [5
5 5 8 9] | \<5 | r | | 找到最后一个'\<5'的元素 | (1 2 3) [5 5 5 8 9] | \<5 | l |
| 找到第一个'>5'的元素 | (1 2 3 5 5 5) [8 9] | <=5 | r | |
找到最后一个'<=5'的元素 | (1 2 3 5 5 5) [8 9] | <=5 | l |
]
===== 模型
1. 建模:划分蓝红边界,确定 IsBLUE()
2. 确定返回 l 还是 r
3. 套用模板
4. 后处理
后处理:[没有蓝色区域]和[没有红色区域]的细节如何处理?比如例子中查找第一个大于等于
5 的元素,如果数组中所有元素都小于 5 那么,返回的 r
直接访问会越界,需要特殊处理一下, 同理 返回 L 的时候如果是-1,也需要特殊处理才行
就需要在取值的时候先判断该索引是否在[0,N)的区间,然后再取值.
===== 思考题
二分查找的下标是否是适用于浮点数? 题:通过二分查找的方法计算$sqrt{2}$,要求误差精确到$10^{-6}$
== 练习
参考了 作者: 房顶上的铝皮水塔 https://www.bilibili.com/read/cv14984337 出处:
bilibili
=== 搜索插入
给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引.如果目标值不存在于数组中,返回它将会被按顺序插入的位置.
==== 题解
```java
class Solution {
public int searchInsert(int[] nums, int target) {
int index = bin(nums, -1, nums.length, target);
return index;
}
private int bin(int[]nums, int left, int right, int target) {
while(left + 1 != right) {
int mid = left + ((right - left) >> 1);
if (nums[mid] < target) left = mid;
else right = mid;
}
// left 包括自身及其左边的值都比它小
// right 及其右边的值都大于等于自身
return right;
}
}
```
=== 寻找峰值
峰值元素是指其值严格大于左右相邻值的元素.
给你一个整数数组 `nums`,找到峰值元素并返回其索引.数组可能包含多个峰值,在这种情况下,返回
任何一个峰值 所在位置即可.
你可以假设 `nums[-1] = nums[n] = -∞` .
==== 分析
===== 关于这道题,首先需要考虑是否能使用二分查找?
首先我们假设数组中存在峰值,如果一个下标 i 对应的元素及其左右元素满足如下关系:
`num[i] < nums[i+1] && nums[i] > nums[i-1]`说明峰值在其右边:
`num[i] > nums[i+1] && nums[i] < nums[i-1]` 说明峰值在其左边:
`num[i] < nums[i+1] && nums[i] < nums[i-1]` 说明在谷底,下一步往左边和右边都可以
所以可以认为使用二分查找,一次可以忽略左边或者右边的数字,加快搜索
===== 为什么存在峰值?
首先,示例以及题目中没有说明不存在峰值应该返回什么元素,所以一定存在.其实也可推导:
假设数组中存在一个元素,这个元素就是峰值:
假设数组中存在两个元素,若左边的元素大于右边的元素,左边的元素就是峰值:反之则右边的元素是峰值.存在更多元素的情况就是两个元素的情况的展开
既然如此,我们需要考虑 isBlue 的实现:
对于一个元素,如果这个元素小于右边大于左边,则可以放到蓝色区域,那么,最后一个放入蓝色区域的元素的下一个元素就是峰值.
==== 题解
```java
class Solution {
public int findPeakElement(int[] nums) {
if (nums.length == 1) return 0;
return bin(nums, -1, nums.length);
}
// 数组中一定存在峰值吗?
private int bin(int[]nums, int left, int right) {
while(left + 1 != right) {
int mid = left + ((right - left) >> 1);
int lvalue = mid - 1 < 0 ? Integer.MIN_VALUE : nums[mid - 1];
int rvalue = mid + 1 >= nums.length ? Integer.MIN_VALUE : nums[mid + 1];
if (lvalue <= nums[mid] && nums[mid] <= rvalue)
left = mid;
else
right = mid;
}
return right;
}
}
```
> 另外题目中还说明了,不存在重复元素的情况,上述代码中等号可以去掉.
=== 在排序数组中查找元素的第一个位置和最后一个位置
给你一个按照非递减顺序排列的整数数组 `nums`,和一个目标值 `target`.请你找出给定目标值在数组中的开始位置和结束位置.如果数组中不存在目标值 `target`,返回
[-1, -1].
==== 分析
这题思路没有特别之处,将小于 target 的值归到蓝色区间,返回最后的 right
就可以.二分查找的模板存在一个问题,如果数组元素值都小于 target,那么 right 的值为
N:如果数组元素的值都大于 target,返回值为 0.
在上面的例子中,因为要找到具体的元素的下标,所以需要检查最后返回 right
对应的元素是不是 Target,并且还需要先考虑返回的 right 有没有数组越界.
==== 题解
```java
class Solution {
public int[] searchRange(int[] nums, int target) {
int left = -1 , right = nums.length;
while(left + 1 != right) {
int mid = left + ((right - left) >> 1);
// 小于target都归到蓝色区间
if (nums[mid] < target)
left = mid;
else
right = mid;
}
// right的值就是target
// CASE#1 有可能当前的值并不是target的值
if (right == nums.length || nums[right] != target)
return new int[]{-1,-1};
int end = right;
while (end + 1 < nums.length && nums[end + 1] == target) end ++;
return new int[]{right, end};
}
}
```
=== 搜索二维矩阵
编写一个高效的算法来判断 `m x n` 矩阵中,是否存在一个目标值.该矩阵具有如下特性:
每行中的整数从左到右按升序排列. 每行的第一个整数大于前一行的最后一个整数.
==== 题解
```java
class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
int m = matrix.length, n = matrix[0].length;
if (matrix[m-1][n-1] < target) return false;
int left = -1, right = m*n;
while(left + 1 != right) {
int mid = (left + right) >> 1;
int i = mid / n;
int j = mid % n;
if (matrix[i][j] < target) left = mid;
else right = mid;
}
// 最后的结果是right
return matrix[right/n][right%n] == target;
}
}
```
=== 搜索二维矩阵 II
编写一个高效的算法来搜索 `m x n` 矩阵 `matrix` 中的一个目标值 `target` .该矩阵具有以下特性:
每行的元素从左到右升序排列. 每列的元素从上到下升序排列.
==== 题解
```java
class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
int m = matrix.length, n = matrix[0].length;
int i = 0, j = n - 1;
while(i < m && j >= 0 ) {
if (matrix[i][j] > target) j --;
else if (matrix[i][j] < target) i ++;
else // 相等情况
return true;
}
return false;
}
}
```
=== 较小三数之和
要求找到三个数,并且让这三个数之和小于 target.
==== 题解
```java
class Solution {
public int threeSumSmaller(int[] nums, int target) {
Arrays.sort(nums); // 排序
int n = nums.length, cnt = 0;
for(int i = 0; i + 2 < n; i ++) {
for (int j = i + 1; j + 1 < n ; j++) {
// 二分查找具体的值
int real = target - nums[i] - nums[j];
int index = bin(nums, j, n, real);
cnt += index - j;
}
}
return cnt;
}
// 找到一个值小于2
private int bin(int[]nums, int left, int right, int target) {
while(left + 1 != right) {
int mid = left + ((right - left)>>1);
if (nums[mid] < target) left = mid;
else right = mid;
}
return left;
}
}
```
=== 寻找右区间
给你一个区间数组 `intervals` ,其中 `intervals[i] = [starti, endi]` ,且每个 `starti` 都
不同 .区间 i 的 右侧区间 可以记作区间 j ,并满足 `startj >= endi` ,且 `startj` 最小化
. 返回一个由每个区间 i 的 右侧区间 在 `intervals` 中对应下标组成的数组.如果某个区间
i 不存在对应的 右侧区间 ,则下标 i 处的值设为 -1 .
==== 分析
这道题要求找当前的区间的右区间,如果找不到就-1,找得到就下标.其实做了这么多关于区间的题,不论是使用贪心的原则,合并区间也好,还是其他的方法也罢,一上来的第一个思路就是将区间元素按照区间中的
start 大小进行排序.我们想想这个排序的思路是否可以运用到这道题.
===== 举例
[ [1,4], [2,3], [3,4], [1,2], [2,5], [4,7] ] 排序:[ [1,4], [1,2], [2,3], [2,5],
[3,4], [4,7] ] 对于[1,4]而言:后面[1,2], [2,3], [2,5], [3,4]为蓝区,[4,7]为红区
这个例子而言,因为 end 一定大于 start,通过 start
进行排序之后的元组可以通过检查当前 mid
指向的元素是否为[1,4]的右区间.我们通过设计不是右区间的在蓝色区域,第一个是右区间的在红色区域就满足了题目的最小化
start 的要求.
同时这道题其实有个 case 很智障,[1,1]也是自己的右区间,所以需要额外判断当
start=end 的情况.
==== 题解
```java
class Solution {
public int[] findRightInterval(int[][] intervals) {
// 在排序之前使用Hash表记录int[] 的下标
int n = intervals.length;
HashMap<int[], Integer> map = new HashMap<>();
for (int i = 0; i < n; i++)
map.put(intervals[i], i);
// 将数组进行排序
Arrays.sort(intervals, Comparator.comparingInt(o -> o[0]));
int[] ans = new int[n];
for (int i = 0; i < n; i++) {
// right 包括 (right)以后的数组的第一个元素都是大于等于 target
int[] cur = intervals[i];
int oriIndex = map.get(intervals[i]); // before sorting
if (cur[0] == cur[1]) {
ans[oriIndex] = oriIndex;
continue;
}
int index = bin(i, n, intervals, cur[1]);
// 在数组中可能二分查找找到不到这个元素
if (index >= n || intervals[index][0] < cur[1])
ans[oriIndex] = -1;
else
ans[oriIndex] = map.get(intervals[index]);
}
return ans;
}
// 搜索使用[left, right]下标框定起来的闭区间
private int bin(int left, int right, int[][] nums, int target) {
while (left + 1 != right) {
// 相等的并入右区间
int mid = left + ((right - left) >> 1);
if (nums[mid][0] < target) left = mid;
else right = mid;
}
return right;
}
}
```
---
=== 寻找重复数
给定一个包含 n + 1 个整数的数组 nums ,其数字都在 [1, n] 范围内(包括 1 和
n),可知至少存在一个重复的整数.
> 假设 nums 只有 一个重复的整数 ,返回 这个重复的数 . > 你设计的解决方案必须
不修改 数组 nums 且只用常量级 O(1) 的额外空间.
==== 分析
这道题中,给出长度为 n+1 的数组,但是数组中有一个存在元素 i,i
属于[1,n]存在一个重复值.我们可以有这样的一个思路,我们设计 left,right 和 mid
指针,我们在题目给定 nums 数组中,猜[left,mid]框定的区间内,nums
中的元素出现的次数.如果在 nums 中出现的次数大于
mid-left+1,即区间长度,说明存在重复元素.如果没有出现重复元素说明当前[left,mid]区间不对,我们转到[mid+1,right]子区间中尝试.
==== 题解
```java
class Solution {
public int findDuplicate(int[] nums) {
// 遍历 left 和 right区间内的所有数字
// 只存在一个重复数字
int left = 1 , right = nums.length - 1;
while(left < right) {
int mid = left + ((right - left) >> 1);
// 统[left: mid]区间的数字的数量
int cnt = 0;
for (int num : nums) {
if (num <= mid && num >= left)
cnt++;
}
// 如果当前区间的数字的数量超出
// 区间确定的数字和统计的数量的关系只有两种,要么是小于cnt要么是等于cnt
// 而且最后left == right时退出,所以返回left是可以的
if (mid - left + 1 < cnt)
right = mid;
else
left = mid + 1;
}
return left;
}
}
```
此外,如果要验证自己的代码是否正确可以使用最基本的一些 Case 进行尝试:
1. 数组长度为 2 时数组为{1,1},返回 left 会返回 1
2. 数组长度为 3 时,排序后的数组可能为{1,1,2}或者是{1,2,2},left=1,right=2,第一次的
mid 等于 1.对于{1,1,2},[1,1]区间内的 cnt 是 2,right =
mid,退出循环,left=1,并且作为返回值:对于{1,2,2},[1,1]区间的 cnt 为 1,cnt
等于区间长度,left = mid + 1,退出循环,返回 left=2. 这个例子也说明当 cnt
等于区间长度的时候 left=mid+1.
=== 最接近的二叉搜索树值
给定一个不为空的二叉搜索树和一个目标值`target`,请在改二叉搜索树中找到最接近目标`target`的数值.
> 给定的目标值`target`是一个浮点数 >
题目报郑在改二叉搜索树中只会存在一个最接近目标值的数
==== 分析
二叉搜索树可以通过成中序遍历形成一个有序数组,然后二分查找是可以的,这样时间空间复杂度都很高,没必要.
如果 target
小于当前的节点,那么接近这个数的节点肯定在左子树(往右边走越来越大,而且有右子树的最小值肯定大于当前节点):反之如果大于,找右子树.终止的节点肯定在叶子节点上,同时在遍历的过程记录一个最小的距离的值.
==== 题解
```java
class Solution {
public int closestValue(TreeNode root, double target) {
int val, closest = root.val;
while (root != null) {
val = root.val;
closest = Math.abs(val - target) < Math.abs(closest - target) ? val : closest;
root = target < root.val ? root.left : root.right;
}
return closest;
}
}
```
=== 旋转数组的最小数字
把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转.
给你一个可能存在重复元素值的数组 numbers
,它原来是一个升序排列的数组,并按上述情形进行了一次旋转.请返回旋转数组的最小元素.例如,数组
[3,4,5,1,2] 为 [1,2,3,4,5] 的一次旋转,该数组的最小值为 1.
注意,数组 [a[0], a[1], a[2], ..., a[n-1]] 旋转一次 的结果为数组 [a[n-1], a[0],
a[1], a[2], ..., a[n-2]] .
==== 分析
==== 题解
```java
class Solution {
public int findMin(int【】 nums) {
int len = nums.length;
while(len > 0 && nums【0】 == nums【len - 1】) len--;
if(len == 0) return nums【0】;
int val = nums【len - 1】;
int L = -1;
int R = len;
while(L + 1 != R) {
int mid = L + ((R - L) >> 1);
if(nums【mid】 <= val) {
R = mid;
}else {
L = mid;
}
}
return nums【R】;
}
}
```
> 二分查找的本质依照https://www.bilibili.com/video/BV1d54y1q7k7 视频所写 >
笔记部分习题来源与 leetcode,选取来源于作者: 房顶上的铝皮水塔
https://www.bilibili.com/read/cv14984337 出处: bilibili
|
|
https://github.com/ntjess/typst-nsf-templates | https://raw.githubusercontent.com/ntjess/typst-nsf-templates/main/nsf-proposal.typ | typst | MIT License | #import "@preview/tablex:0.0.6": tablex, cellx, rowspanx
#let title(body) = {
set align(center)
text(body, weight: "bold", size: 14pt)
}
#let info(body, title: none) = {
set text(size: 0.8em)
set par(justify: false)
block(
width: 100%,
inset: 0.5em,
stroke: black,
radius:0.5em,
fill: white.darken(3%),
)[
#box(
fill: blue.lighten(70%),
width: 100%,
outset: 0.5em,
stroke: black,
radius: (top: 0.5em),
align(center)[#title]
)
// box: Add a little vertical whitespace without causing a paragraph break
// pad: Prevent an unavoidable small amount of space that offsets the first word in
// the body otherwise
// baseline: Ensure the space shows right before the *body* instead of pushing up the
// title
#box(height: 0.35em, pad(left: -1em)[], baseline: 100%)
#set text(fill: blue.darken(20%))
#body
#v(0.15em)
]
}
#let instructions = info.with(title: [INSTRUCTIONS])
#let ProfessionalPreparationTable() = {
let prep-state = state("prep-info", ())
let add-info(
title,
institutions: none,
locations: none,
majors: none,
degrees: none,
is-first: false
) = {
let ul = underline
let other-titles = if is-first {
(ul[Location], ul[Major], ul[Degree & year])
} else {
(none,) * 3
}
prep-state.update(old => {
old + (
ul[#v(0.25em) #title #h(1fr)],
..other-titles,
institutions,
locations,
majors,
degrees
)
})
}
let prep-table = locate(loc => {
set list(marker: none, body-indent: 0em)
pad(
tablex(
columns: (1fr, ..(auto,) * 3),
column-gutter: 0.5em,
inset: (left: 0em, rest: 0.35em),
stroke: none,
..prep-state.at(loc)
)
)
})
(add-info: add-info, table: prep-table)
}
#let govt-use-disclaimer(restricted-pages) = [
This proposal includes data that must not be disclosed outside the Government and must not be duplicated, used, or disclosed -- in whole or in part -- for any purpose other than to evaluate this proposal. If, however, a contract is awarded to this offeror as a result of -- or in connection with -- the submission of this data, the Government has the right to duplicate, use, or disclose the data to the extent provided in the resulting contract. This restriction does not limit the Government's right to use information contained in this data if it is obtained from another source without restriction. The data subject to this restriction are contained in pages #restricted-pages.
]
#let align-wrapped-content(body, wrap-align: left) = {
layout(size => {
style(styles => {
set align(wrap-align) if measure(body, styles).width > size.width
body
})
})
}
#let unjustified-table(..args) = {
set par(justify: false)
tablex(..args)
}
#let govt-use-footer = [
Use or disclosure of data contained on this page is subject to the restriction on the first page of this volume.
]
#let page-count-footer = [
#set align(center)
#set text(size: 10pt)
Page #counter(page).display() of #locate(loc => counter(page).final(loc).last())
]
#let template(
body,
add-footer-disclaimer: true,
) = {
set text(font: "Times New Roman", hyphenate: false, size: 11pt)
set par(justify: true)
set heading(numbering: "1.")
set page(paper: "us-letter", margin: 1in, footer: page-count-footer)
show link: set text(fill: blue.darken(20%))
show heading: set text(size: 12pt, weight: "bold")
show heading.where(level: 1): it => {
set text(size: 12pt, weight: "bold")
locate(loc => {
block[
#if it.numbering != none {
numbering(it.numbering, ..counter(heading).at(loc))
h(0.5em)
}
#underline(it.body, evade: false)
]
})
}
show heading.where(level: 3): it => {
set text(size: 12pt, style: "italic", weight: "regular")
block(it.body)
}
show figure.caption: align-wrapped-content
body
} |
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/041%20-%20Kaldheim/006_Brokenbrow.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Brokenbrow",
set_name: "Kaldheim",
story_date: datetime(day: 22, month: 01, year: 2021),
author: "<NAME> & <NAME>",
doc
)
Above the Feltmark, the sun hung like a silver coin, washing out the green fields into a slow roll of undulating gray—a featureless canvas, ready to be splashed red.
There would be a battle today. Not a grand clash of armies, nothing that would make it into the sagas. Just a skirmish, really. On one side, a pack of Skelle raiders, bedecked in grisly trophies, steel thorns jutting from black armor, cruel blades hooking and curving like ugly grins. On the other side—significantly fewer, but there nonetheless—were the Tuskeri. Scarcely a war party, in truth. No more than a dozen, less than half the warriors that stalked toward them across the open plains, and yet they swaggered forward with all the confidence of roosters. There would be a battle today, and judging from what Njala saw, it would be a brief one. But it would be a battle nonetheless, so she and Alajn, shepherd and reaper, had come to watch, and to judge.
"There," said Alajn. Gesturing with one long and thin finger at the Tuskeri farthest out in front. "That's their new leader. <NAME>, they call him. Great warrior, great gambler, great drinker by all accounts."
#figure(image("006_Brokenbrow/01.jpg", width: 100%), caption: [Arni Brokenbrow | Art by: <NAME>], supplement: none, numbering: none)
Njala squinted. He was smaller than most of the warriors behind him, and not as broad-shouldered either. About the only thing that set him apart, other than his bright red hair, was the strange shard of bone which protruded from one side of his forehead like a single horn, narrow and pointed where it met his skull and tapering out into a jagged base at the end. "Leader? Of all of them?"
"All of them."
"What is he doing here, then?"
Alajn shrugged. "My guess? He was bored."
Njala frowned. To her, a Valkyrie, no mortal seemed to last longer than a sunny afternoon, but the daring and reckless souls of the Tuskeri clan flickered out quicker than most. If anything, their leaders' mad gambits for valor tended to end them even faster than the rank and file, and Brokenbrow appeared to be no exception. It looked like he would be joining his predecessors at the table in Starnheim soon.
With almost painful slowness, the two groups drew closer to one another, Skelle spreading out into a crescent shape so wide as to nearly encircle the Tuskeri. From the rear of both sides came a few curious arrows, most landing on shields, with a few burying themselves here and there into the grass. It had almost arrived: the moment the true selves of each warrior would be revealed. Would they turn and flee, to be cut down by their enemies—or by Alajn, if they got far enough—or would they stand, and fight, and die a glorious death that Njala could reward them for?
With an easy motion, Arni slipped his sword from its scabbard and spun it once, testing the weight. Then he grinned. In fact, he seemed to be grinning right at her.
Njala froze. It was impossible, just a coincidence. Even the wisest of mortals couldn't see a Valkyrie unless she wished to be seen. And yet she couldn't help but feel as if he were trying to tell her something. As if he were saying, #emph[watch this.]
At the last moment, when both groups were no more than ten strides from each other, the Tuskeri broke into a sudden charge, straight at the middle of the Skelle line. At the very front was <NAME>, sword held high in front of him, bellowing a war cry that sounded more joyous than wrathful.
"Well then," said Alajn, raising one pitch-colored eyebrow. "He certainly has that Tuskeri bravado."
Njala exhaled. The moment with Brokenbrow, if there had been such a moment, had passed. "It seems as though your duties won't need fulfilling today, Sister," said the Valkyrie, allowing herself a small smile.
"We'll see," said the reaper. "There's time yet for a bit of cowardice to strike."
The Tuskeri charge had caught their foes off guard. The Skelle hurriedly tried to set a line of spears, and as Njala watched, the new leader of the Tuskeri leaped into the air—over the spear tips, over the swinging axes, even over the raised shields—and brought his sword down, straight through the helmet of a wild-looking man in the front row. A breath later, the lines collided with the deafening crash of steel on steel: blades clanging off one another, shields driven together with brutal force, armor shuddering with impact.
Njala's smile faltered. In a moment, it was clear that the Skelle couldn't hold the line; they had spread themselves too thin trying to encircle their enemy. The Tuskeri punched straight through, cleaving the main body of the raiders in half. It didn't take long after that. Soon the Skelle were broken, fleeing across the open plains. Wordlessly, Alajn slipped away to do her dark work. Njala only watched in dumb amazement as Arni, in the aftermath, planted his rear on a pile of dead warriors nearly as tall as he was, laughing like a man at his wedding.
"Well, well, Sister," said Alajn, appearing again by Njala's side with a smirk. "It seems #emph[your] duties are the ones that won't need fulfilling today."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
In the endless hall of Starnheim, heroes of every age, from every clan, from peoples throughout the ten realms of Kaldheim, feasted and drank for all time. The table couldn't be contained by earthly geometry: it was precisely as long as it needed to be to accommodate the glorious, the valorous, the beings of all race and creed that had earned their seat. And yet, despite knowing this, Njala couldn't help but feel that one spot along the endless, peerless structure seemed emptier than it should have.
By all rights, Brokenbrow should have died earlier that day. As a Valkyrie of Starnheim, she had a nose for such things. But, with some embarrassment, Njala realized that she didn't know much else about him. Here, at least, such things were easily remedied.
She found Hormgart deep into his cups—not a difficult task, when the cups were as bottomless as one might desire. Of the dwarven skalds that had won their place at the table, Njala had always had a soft spot for him. His storytelling always had a grandfatherly ring to it, rather than the boasting theatrics of the others. With the back of one arm, Hormgart wiped at his mustache, gone gray countless centuries ago, and belched. "Njala! What an unexpected honor it is, this—this honor."
"Hormgart. I was hoping you might be able to tell me about someone. A mortal."
"You know, it's not as if we all know each other."
"He's the new leader of the Tuskeri. Arni, <NAME>. Surely you must have heard something."
Through the haze of drink, she could see his stone-colored eyes glinting in the firelight. "Ah. Brokenbrow. Well, now that you mention it—yes, I suppose I've heard a tale or two."
Farther down the table, a song had broken out. Ranks of warriors swayed in time, humming an old tune about a Beskir battle-maiden and the mob of suitors she had turned into a war party. The battle-maiden in question led the song herself, conducting with fingers outstretched. Hormgart didn't seem to notice. His knobby, weathered hands settled on his knees, as if bracing himself. Njala saw the dozens of little adjustments he made—the straightening of his back, the tilting of his head, the clearing of his throat. Hormgart had a story to tell. "You know, he wasn't always called Brokenbrow."
"Oh?"
"He was called Goatleaper, once," said Hormgart, tapping his nose. "Until one fateful day~"
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
#emph[One fateful day, deep in the Tusk mountains, word spread of a scourge of murderous trolls, terrorizing villages all along the Red Ridge. Now, the Tuskeri, being who they were, couldn't have been more pleased at the news. Trolls meant danger, and danger meant a chance at daring, and daring meant an opportunity to make your name. Of all the Tuskeri warriors saddling up to hunt trolls—for there were many indeed—it happened to be a small band, led by none other than <NAME>, who began their search on the very slope in which the trolls had made their den.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
In the high crags of the Tusk mountains, flanked on all sides by jutting spears of red stone, Njala and Alajn watched the man known as <NAME> court death once again. This time, it wasn't the cold steel of a Skelle raiding party that might deliver it; it was a dragon.
"A hellkite," said Alajn, "technically."
"Fine," said Njala. A hellkite, then.
Terminology aside: it was massive, all tooth and claw and barbed spine, with four curving horns and a tail that whipped through the air in terrible scything arcs. Arni and his band of Tuskeri had it surrounded, but it wasn't doing them much good. Any time one of them darted in with a spear or an axe, a slash of that fearsome tail made them reconsider. Just outside the loose circle of warriors, seemingly oblivious to the thrashing, snarling beast, <NAME> fiddled with a length of rope.
"What's he doing?" said Njala, biting her lip. "He'll never die a worthy death just, just #emph[tying knots] ."
Down in the crags, one man stepped forward, bellowing bravely, and swung a heavy two-handed sword into the flank of the beast. It bounced off the scaled hide as if he had swung with all his might into a rock. The hellkite curled its serpentine head around and fixed him with a pair of coal-red eyes, and the man dropped his sword and ran as fast as his legs could carry him.
"Don't you have duties to attend to?" muttered Njala to her sister.
Alajn watched the man belly-dive to the floor of the canyon to avoid a lash of the beast's tail. "In this case, I would say that was less an act of cowardice than of common sense."
Arni tugged at the series of knots one more time and, satisfied, stood up. Now, Njala could see that he had tied a loop into the rope; slowly at first, he began to spin it around his head. With an expert toss, he flung the lasso straight into the path of the hellkite's head, where it snagged on one of the horns and pulled taut. Instinctively, the creature jerked back—taking Arni with it.
Njala gasped as the Tuskeri leader was slung through the air, directly toward one of the natural spires ringing the valley floor. But just before he slammed into it, Arni seemed to twist in the air. Instead of hitting the red stone spine-first, he landed on it with both boots, his body compressing like a spring. To Njala, it almost seemed like he had meant to do that.
The hellkite seemed to understand what had just happened even less than the Valkyrie—with an air-splitting shriek, it thrashed backwards. In the split second before it pulled him from the rock, Njala saw it again: that grin, from before. #emph[Watch this.]
This time, the beast jerked straight away, rearing back and yanking Arni straight toward it. When he landed just behind the creature's head, coiled rope in hand, he took only a moment to steady himself, as if he were on the back of a rocking ship rather than a raging monster. It pitched and turned, but with the rope held tight and his weight dropped low, Arni couldn't be shaken off.
It wasn't just Njala watching as Arni slipped his blade from its scabbard and held it up, glinting like a mirror in the sunlight: all the Tuskeri gaped, wide-eyed, as their leader drove the blade between the creature's horns. A moment later, its mammoth body crashed to the valley floor.
"Unbelievable," whispered Njala. "He actually—he actually—"
"It seems that your favorite human lives to fight another day," said Alajn, finishing the thought for her, but Njala could barely hear her. She was thinking, instead, of the story Hormgart had told her—Arni's naming story.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
#emph[After a long and arduous climb, Arni and his band of brave warriors paused to catch their breath. It was then that they heard the telltale sounds of trolls—bones snapping, animals growling, and that grumbling, rumbling language of theirs—spilling out from a nearby cave. Creeping closer, Arni found far more than just a couple stone-eaters. There seemed to be a whole reeking warren of the creatures. Arni and his warriors were outnumbered, that was certain. But if they left now to round up more sword-hands, someone else might stumble across this cave and steal their glory before they could return. ]
#emph[Now, Arni was a mighty warrior, that much was true. But he was more than simply strong: he was cunning, too. After a few whispered words and a blessing or two from the cleric they had brought along for the climb, Arni stepped out from behind the rock.]
#emph["Aye," he said to the surprised faces and gaping tusked mouths staring at his sudden arrival. "You're the lot that've been raiding up and down the ridge. Now, I've got a whole army of berserkers out there, ready to tear your heads off, but I figured I'd give you a chance to settle this a different way. A headbutting contest," he proposed, grinning. "Loser packs up and leaves these mountains forever."]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Without a doubt, Tover Giants-Blood was the biggest human Njala had ever seen. He stood a full head and a half over the other Kannah warriors that emerged from the treeline. His bare chest, tattoos dancing with each steaming breath, was twice as broad as any other present. Even the massive pines of the Aldergard seemed somehow diminished when he passed under them. Arni was rarely the largest person in the room, but in front of Giants-Blood, he seemed little more than a boy.
"This is it," said Njala, from where she watched off to the side, flapping her wings now and then to get a better look. "This #emph[must ] be. An honor duel with #emph[that?] Brokenbrow's death has finally—#emph[finally] —found him." And what a glorious death it would be! Njala could hardly wait to congratulate him on a valorous life, to show him the endless halls in which he would spend eternity drinking, feasting, and fighting. She had already waited so damn long.
Alajn, though, didn't seem convinced. She only tilted her head, a small smile on her face.
"#emph[What?] " said Njala.
"Well," said the reaper, "it's not like the last eight times turned out the way you thought they might. It's starting to sound like wishful thinking, is all."
Njala scowled and turned back to the assembled warriors. They had formed a circle now, twelve paces across—Kannah and Tuskeri both, closing in the two men. From his back, Giants-Blood unslung an axe. It was a weapon for ogres, for trolls, with a double-bladed head of solid iron, but he seemed to heft it easily enough. "Brokenbrow!" he bellowed, in a voice that shook the snow from nearby branches. "I'll give you one last chance to repent. Grovel before me and my ancestors, beg our forgiveness for desecrating the resting place of my family, and you can leave this circle alive."
But Arni only scratched at his red beard, grinning. "Where's the fun in that, Tover? Though being honest, all this seems like a lot of trouble. Surely you've gotten lost and pissed somewhere you shouldn't have before."
Giants-Blood's lips curled back at that, revealing teeth like stone slabs. "Draw your blade, little man."
Obligingly, Arni pulled his sword from his scabbard. Against this opponent, it seemed little more than a dagger—but still glinted, bright and sharp, in the weak Bloodsky sun.
There was no cautious circling, no testing of one another's form. With an ursine roar, Giants-Blood charged forward, swinging the axe in an arc nearly as broad as the circle itself. Arni ducked beneath it and moved to close the gap between them, but Giants-Blood had that monstrous axehead crashing toward him again in a heartbeat. Arni jumped back, dancing along the edge of the circle, and Njala pumped her fist in happy triumph. "Fight bravely! Yes!" she whispered, mostly to herself. "Be courageous and heroic and actually #emph[die ] this time!"
Again, the big man swung, and again, Arni tried to dart forward before Giants-Blood could recover. This time, though, he caught a boot to the stomach and tumbled backwards, into the knees of the warriors surrounding them. Njala couldn't help but wince at the impact. A moment later, Arni was back on his feet.
Again and again, those terrible swings failed to cleave Arni in half, but he couldn't seem to do much other than dodge and duck and roll. It wasn't just Giants-Blood's long arms that made the man hard to close with, it was the way those broad and murderous strokes never seemed to cease. Any ordinary warrior would have been wheezing and panting by now, but obviously Tover Giants-Blood was no ordinary warrior.
He stepped in for another swing, and Arni braced himself to dodge. Suddenly, Tover brought up the haft of the axe in a sharp jab, cracking into Arni's jaw and sending him flying.
"A feint," said Alajn. "That big one's not the mindless brute he appears to be."
Njala didn't respond. Her eyes were fixed on Arni, who spat blood into the snow as he picked himself up off the ground. He wasn't smiling anymore. There was a focused look to his face now, a seriousness the Valkyrie had never seen before. A strange feeling began to bubble and swirl in Njala's stomach. Was she~ worried?
As Giants-Blood swung again—this attack no less brutal and quick than his countless others—Arni didn't dodge, duck, or roll: he stepped into the swing, toward his enemy, inside the path of the axe-head, and chopped down at the wooden haft with his sword. There was a splintering #emph[crack] , and the circle momentarily parted as men and women leaped out of the way of the freed axehead. It buried itself in the trunk of one of the towering pines surrounding them.
Arni, too, was sent reeling by the force of the blow. For a moment, Giants-Blood seemed stunned. He stared at the broken haft in his hand, now no better than a walking stick. But as Brokenbrow picked himself off the ground for the third time that day, the Kannah warrior lunged forward. Before Arni could bring up his sword, Giants-Blood cinched him tight in a bear hug, pinning his arms to his side and lifting him off the ground.
Arni thrashed and squirmed. He kicked, struggled, and swore, but all the wily speed and daring he'd shown earlier was useless now. He had been caught, like a rabbit in a snare.
The crowd of warriors, which had been whooping and shouting moments before, went quiet. All Njala could hear was the small, muffled gasps Arni made as Giants-Blood squeezed tighter and tighter, the sinews on his massive arms bulging with effort. The sword dropped from the Tuskeri leader's hand, landing soundlessly in the slurry of snow and dirt underneath them.
"Njala," said Alajn, putting a hand on her shoulder. Her voice was surprisingly tender. "Perhaps—perhaps you shouldn't see this."
"No," said Njala, shaking her head. "I have to be here. At the end."
A few more moments, a few more labored breaths, and it would be over. She could finally escort Arni to Starnheim: she could, at last, bring him to the eternal reward he deserved. Wasn't that what she wanted? It was her duty. It was her honor. And yet, Njala found that she didn't want Arni to be crushed to death by this bear of a man. She wanted him to find some way out of this mess, as he always seemed to. She wanted him to #emph[win] . She didn't want the legend of <NAME> to pass into history just yet. In fact, she wouldn't allow it.
Njala spread her wings and moved toward the circle, but before she could get any closer, Alajn stepped in front of her. "Njala, it's an honor duel."
"But—"
"And even if it wasn't, we are Valkyries. It is not our place to intercede in the affairs of mortals. You know this."
It was true, all of it, only Njala didn't care. She was trying to think of some point, some argument that would move her sister out of the way, when she saw it, over Alajn's shoulder. Arni was grinning. A grin she had seen so many times before.
#emph[Watch this.]
Giants-Blood had lifted him fully into the air, now, all the better to leverage that monstrous strength of his. For the first time in the fight, the two saw eye to eye. Arni drew his head back, back, back, and suddenly Njala remembered how Hormgart's story had ended—how <NAME> had gotten his name.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
#emph[Hours passed, the sun sank low over the red peaks of the Tusk mountains, and still, Arni and the troll continued. Both were tired, bloodied, dizzy from the constant impacts—but Arni was still grinning as he stepped forward for yet another headbutt. The troll, on the other hand, looked like he could scarcely believe what was happening. The human was actually keeping up. With a troll! In a ] headbutting #emph[contest! He was ashamed, but more than that, he was frightened. What if this small, grinning man actually beat him? In that moment of fear and uncertainty, the troll decided to do something not unfamiliar to troll-kind: he decided to cheat.]
#emph[It was time. Both Arni and the troll set their feet and craned their heads back for a savage blow. But just as Arni swung forward, the troll angled his tusks up, toward the Tuskeri's brow. It was, of course, a terrible mistake. There were many as strong, or stronger, than Arni Goatleaper, and many as cunning, or more cunning. But few who matched his strength or his cunning could also match the thickness of his skull.]
#figure(image("006_Brokenbrow/02.jpg", width: 100%), caption: [Arni Slays the Troll | Art by: <NAME>], supplement: none, numbering: none)
#emph[There was a sound like striking lightning, a crack that reverberated throughout the cave. When it passed, the troll lay flat on his back, one of his tusks snapped off at the root. Above him, victorious and bloody, troll-bone embedded in his forehead, was Arni Goatleaper—only his name was Goatleaper no longer.]
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/029%20-%20Aether%20Revolt/007_Breaking%20Points.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Breaking Points",
set_name: "<NAME>",
story_date: datetime(day: 18, month: 01, year: 2017),
author: "<NAME>",
doc
)
#emph[After the disastrous ] loss of the Aether Hub#emph[, the Gatewatch and several of their renegade allies escaped via the newly-launched skyship, ] Heart of Kiran#emph[. Jace broke from the rest of the group to ] help the pirate Kari Zev #emph[disrupt Consulate defenses from the air. Meanwhile, the crew of ] Heart of Kiran#emph[ approaches Ghirapur's Aether Spire, where Tezzeret's operation nears its endpoint.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Gideon raised a spotting scope to his eye. Lenses swiveled, and #emph[Skysovereign] came into crisp focus. The Consulate ship sagged in the air, nose tilted toward the ground, dragging a curtain of smoke like a giant's closing eyelid. It sank through the sky in slow motion, gently passing the tops of Ghirapur's buildings. It drew a swarm of other, smaller Consulate airships to it as it descended, handmaidens to an ailing queen.
"It's fallen," Gideon said. "And the blockade's gone with it. Jace and Captain Zev were successful."
Chandra slumped beside him at the bow of #emph[Heart of Kiran] , propping her weight against the railing. "Then we don't need the Aether Hub anymore. We have everything we need right here. We can take on Tezzeret directly."
"Our target is the Planar Bridge," Gideon said. Seeing Chandra wearily cling to the railing made him wince. Her battle with Baral had taken a lot out of her. "And you're in no state for any more one-on-ones."
Chandra drew her knees up to her chest. "I'm fine."
Gideon held up the scope again and watched #emph[Skysovereign] 's slow droop. He hoped its impact would as be gentle as its descent, complete with warning klaxons and evacuation procedures. The people of this world, even those of the Consulate, weren't evil. He wished no further harm to come to anyone—only to stop the completion of the artifact.
"Girl's right." Liliana was reclining on a deck chair. Her eyes were shaded under a parasol. "We shouldn't miss another chance to take out Tezzeret."
"We stop the device, we end the threat," Gideon said.
"Don't fool yourself," Liliana said. "The device is, ultimately, nothing."
"When it goes, Tezzeret goes. In any case, we can't attack yet. The Spire is still heavily guarded. We don't proceed until the inventors have better options for us."
On cue, <NAME> came up the stairs from below decks. "We've got something to show you."
Gideon followed the others down the stairs, glancing behind him. Beyond the slumping ruin of #emph[Skysovereign] rose the glimmering Aether Spire, where the Planar Bridge was being assembled piece by piece.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The belly of #emph[Heart of Kiran] was a compact chamber framed by a web-work of filigree girders. Gideon felt how close his feet were to open air; the wind whistled in through the seam of the hatch in the metal floor. He thought of how long it would take to fall all the way to the firm, firm ground, with his body surrounded by volumes of roaring space. He then decided this was a very bad thing to think about and abruptly stopped.
Saheeli and Rashmi stood next to a shape covered by a tarp, as long as a coffin and tapered to a point at one end.
Pia stepped forward. "With #emph[Skysovereign] defeated, the blockade has thinned. Within a couple of hours, we should be able to punch #emph[Heart of Kiran] past the perimeter, giving us a clean shot at the Consulate Spire. Once we're in, we think #emph[this] is the best way to disrupt Tezzeret's plans."
She pulled back the tarp. Suspended from the ceiling was a gleaming, sleek, sharp-nosed flying device, as long as Gideon was tall, with a sizable propeller at the rear.
#figure(image("007_Breaking Points/01.jpg", width: 100%), caption: [Hope of Ghirapur | Art by <NAME>], supplement: none, numbering: none)
"Rashmi and Saheeli have designed a specially modified thopter," said Pia. "Its payload is an aetheric disruptor, a device capable of incapacitating the Bridge and stopping its operation for good."
Saheeli slid open a panel on the top of the device, exposing the complicated equipment inside. "It took us every part we had, but it should work. The disruptor will generate a one-time energetic shock that will fry the Bridge's inner ring. The structure of the Planar Bridge will look largely intact, but it'll be useless—its central mechanism utterly destroyed. Tezzeret will be left with nothing."
Rashmi looked like she was ready to hurl the thopter at Tezzeret with her bare hands. "I call it #emph[Hope of Ghirapur] ," she said with forced calm.
Gideon nodded. Rashmi had to be distraught about what became of all her work in the Fair. Now she had channeled all that ingenuity into destroying the monstrosity her work had become—a sleek new innovation that had been specifically engineered to undo her previous one. "It looks fast," Gideon said.
"Fast enough to speed past normal air-based defenses," Rashmi said, "assuming we can get in close enough to the Spire to launch it."
"There's still a problem—the turret," Pia said. "Our renegade contacts have told us that Consulate artificers have installed a huge aether-powered cannon at the base of the Spire, and it has enough precision and range to take out anything that flies. Including #emph[Hope of Ghirapur] . Or #emph[Heart of Kiran] ."
"Can we cut the supply lines?" Saheeli asked. "Deprive them of aether again?"
"They'll be expecting that," Pia said. "We're seeing patrols all along the main supply lines."
"This turret," Liliana said, picking at a fingernail. "Does it have living operators?"
Gideon wheeled on her, grated by the way she specified #emph[living] . "We don't harm anyone we don't have to, Liliana," he said. "I want every option explored."
Liliana tilted her head, chiseling Gideon with an extremely-bored-with-your-naivete look.
"We're not here to bring death to the citizens of this city," said Gideon, now to the group. "We're here to stop Tezzeret, and #emph[Hope of Ghirapur] is our best chance of that. But unless we can disable that turret, we'll be shot down before we get anywhere close."
"I might have a way to take it out," Pia said. "But I'll need support. A ground team."
"I'm coming with you, Mom," Chandra said immediately.
Gideon thought about who would be left aboard, and their capabilities, if Chandra left. He shook his head. "We'll need your fire up here on the ship, Chandra. We'll be facing a swarm of aerial attackers as we circle in. We need to keep the path clear for #emph[Hope] ."
"I was thinking of Nissa, actually," Pia said quietly, patting Chandra's hand. "Someone who can help zero in on the aether lines."
Chandra made fists. Gideon barely heard her insistent whisper: "I need to be there. To make sure you're safe."
"#emph[You] want to be there to protect #emph[me] ?" Pia whispered back with a little smile.
"I failed you once," Chandra said. "You and Dad. I won't let it happen again."
"I'll go along with the ground team," Ajani said. "Don't worry, little candle. I'll keep them out of harm's way."
Chandra's pouty moue became a quick, fierce hug around Ajani's waist, and then she crossed her arms. Pia put a maternal hand around her waist.
Gideon nodded firmly. "Then there's the issue of Tezzeret himself."
#figure(image("007_Breaking Points/02.jpg", width: 100%), caption: [Heart of Kiran | Art by Jaime Jones], supplement: none, numbering: none)
Liliana looked up, suddenly interested.
"He'll see any attack coming," Gideon said. "And he'll be able to disable a mechanical device like #emph[Hope of Ghirapur] in no time."
"Leave him to me," Liliana said.
Gideon was wary. "We only need to distract him."
Liliana adjusted one of her silk gloves. "I believe having your flesh scoured from your skeleton can be a very effective distraction."
A vein bulged near Gideon's hairline. "I'm sorry," he said to the group. "Can the rest of you give Liliana and me a moment?"
The others exchanged glances and shuffled up the stairs, leaving Liliana and Gideon alone in the hold.
Once they were gone, Liliana dropped the casual amusement. "I'm your best option here and you know it. You said we're here to stop Tezzeret. So let's stop him."
"We just want Tezzeret to be unable to open doors between worlds."
Liliana chuckled derisively. "As long as Tezzeret knows this Planar Bridge artifact is possible, he'll stop at nothing to recreate it. He'll build this thing again and again, hurting anyone he needs to, ravaging every innocent little inventor-world until he has it."
"You're sure of this?"
"It's what I would do."
"We'll contact Jace. He could do something to Tezzeret's mind."
Liliana came back with surprising venom. "Absolutely not. The last time they met, Tezzeret #emph[tortured] —" She stopped herself, composed her face, then continued calmly. "You do not want the success of this whole plan to hinge on the two of them, together, in a life-or-death situation."
Gideon frowned. Jace always seemed to be a fraught topic with Liliana.
"I go; I distract Tezzeret," Liliana said, "and the rest of you fire that thing at the Bridge. That's your best move. It's your only move."
Gideon drew himself up to full height. "All right. But I'm going with you."
"No. You aren't, in fact."
"You going after him solo"—#emph[unchaperoned] —"is out of the question."
"It's the only way this works. The Consulate will see you and send every goon in the area. I can draw Tezzeret into a duel the way no one else can."
"Then we send you with a weapon. Another disruptor, or something else. You trick your way in, and #emph[you] stop the Bridge."
Liliana shook her head. "The inventors already said they used every ingredient in the kitchen to cook up this gadget. And if Tezzeret suspects any kind of trap or ambush, he won't engage me. I won't be able to distract him. I have to go alone, unarmed, or else your whole plan falls apart."
Gideon took a heavy breath. Painful as it was, he saw the truth of what she was saying. "I want you to explore every option before killing him."
"Of course," Liliana said sweetly.
The Gatewatch had come together to fight the same enemies, he thought. Not to do everything the way he would do it. "I can't believe I'm agreeing to this."
Liliana patted him on his beefy shoulder. "You've explored every option."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
It had been almost two hours since #emph[Heart of Kiran] dropped them on the surface. Pia knew the names on the street markers in this part of the city, but she could barely recognize these streets now that they were full of Consulate forces. Nissa's eyes could perceive the shape of the aether lines, though, and Ajani's nose warned when they were too near soldiers. Their small party sidled along side streets and alleyways, avoiding Consulate threats.
In the distance, a beam of energy lanced into the sky, sizzling a renegade whirler. They couldn't see the turret from their vantage point, but they had seen how its beams disintegrated everything it targeted. It left renegade pilots to bail out of their broken airships and turned thopters into dissipating stains of aether and smoke.
#figure(image("007_Breaking Points/03.jpg", width: 100%), caption: [Consulate Turret | Art by <NAME>], supplement: none, numbering: none)
The turret was their target. But first they had to meet with a renegade contact.
As they skulked between two Consulate foundries, a squirrel-sized automaton poked its head out of a window above them. It skittered along the bricks toward them, halted, and tilted its coppery flourish of a head. Then it sped away along the wall and around a corner.
"Ma'am?" Nissa asked.
Pia nodded, and they followed it.
They tracked it to the back gate of a Consulate complex, and paused by a door. "In here," Pia whispered.
"Ma'am, that building is directly on the main aether line," Nissa warned.
Ajani sniffed at the door, once and then a second time to be sure, and then visibly calmed. "Grandmother."
Pia knocked, and <NAME> opened the door. She beamed at the three of them.
#figure(image("007_Breaking Points/04.jpg", width: 100%), caption: [<NAME>, Sage Lifecrafter | Art by Magali Villeneuve], supplement: none, numbering: none)
"Is the package ready?" Pia asked.
<NAME> welcomed them into the building as the little automaton hopped onto her shoulder. The place looked like a Consulate warehouse from the outside, but held a renegade workshop and delivery bay on the inside.
The old lifecrafter led them over to a metal crate that was almost as large as the older woman herself and patted it. "All assembled and ready to ship out."
Ajani wrinkled his nose at the crate. "Are we sure about this?"
"I think you'll find this is just the thing," <NAME> said.
Ajani bent at the joints toward the crate, preparing to heft its weighty bulk onto his back. But Nissa had already picked it up, and it lifted readily. "I have it," she said.
Ajani blinked. And nodded. "What exactly is in this, Grandmother?"
"A weapon against the Consulate," <NAME> said. "To be deployed only when you get close to that nasty turret of theirs."
Pia hugged Mrs. Pashiri. "Thank you, my friend."
"Be safe."
They walked back out the door, only to find the street was now filled with renegade inventors, armed to the teeth with aether-powered devices. They stood in formation, looking at Pia, ready for orders.
"Oh, and I contacted a few friends," said Mrs. Pashiri.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Chandra threw blasts of fire from the bow. A squadron of needle-beaked thopters, aiming to skewer the hull of #emph[Heart of Kiran] , instead caught Chandra's blasts and exploded. Fried pieces fluttered. She shifted back on her heels in victory, but she felt her knees buckle, and she stumbled.
Saheeli, next to her at the bow, steadied her. "Are you all right?"
"It's fine," Chandra said like a curse, almost more at her own weary body than at Saheeli. She glanced up. "More incoming—"
Another barrage buzzed toward them, but Saheeli reached out with a spell, magically transmuting their delicate metals to clumsy lead. The thopters wobbled, lurched, and whumped uselessly into #emph[Heart of Kiran] 's hull, soft-bodied and blunt.
"You're good," Chandra said, once the airship's path was clear. "Ever consider bringing those talents beyond Kaladesh? We could use you." She thumped a hand on her forehead. "Crap, I sound just like Gideon."
Saheeli smiled. She looked out at the Spire in the distance, now in full view. "I don't know. Right now, I'm just concerned about this fight here, on our world."
"We'll stop Tezzeret. And then all this will be over. It will. I may be no good at speeches, but I do believe that."
"You're better at motivating people than you might think." Saheeli pulled out a scope, but instead of looking through it, she turned it over in her hands as the engines of #emph[Heart of Kiran] hummed under their feet. "So many people followed that tyrant, though. Unquestioningly. He showed up, and people just let him take control of whatever he wanted. Did you ever feel like the whole world was against you?"
"Usually feel like #emph[every] world is against me. But I know what you mean."
"Even if we manage to stop him...I don't know. There #emph[are] threats out there, beyond Kaladesh. Tezzeret is proof of that. But there'll still be work to do here, too."
Chandra shrugged. "If you ever change your mind." She remembered when Gideon and Jace planeswalked to Regatha, seeking her help in the conflict with the Eldrazi. Felt like forever ago. She'd refused their offer at first, too. Leaving home, wherever you considered your home, was never easy.
"I'm sorry about your father," Saheeli said, unbidden. "I remember hearing about it when he was...when he died. I was young at the time, like you." She looked through the scope in the direction of the Spire. "His would've been a helpful voice, right about now."
"Thank you," Chandra said. "He would've thought you were pretty terrific, too."
Gideon came up a ladder from below. "The Consulate defenses are crumbling," he said. "Liliana's begun her infiltration, and the ground force is deployed. Is #emph[Hope of Ghirapur] ready?"
"I've triple-checked it," Saheeli answered. "And the Aether Spire is dead ahead. Our target's in sight."
Chandra batted at Gideon's shoulder. "Are we really going to pull this off?"
"As long as our friends on the ground are able to disable the cannon in time."
Chandra nodded firmly. "They will."
#emph[Heart of Kiran] shuddered, jolted by a hard bump from the stern.
Saheeli and Gideon looked at each other. "What was that?"
"Probably just...turbulence," Chandra said.
Gideon appraised that theory with a raised eyebrow.
"Errant migratory goose?" she shrugged.
Saheeli blinked, stunned wordless by the even greater magnitude of this theory-badness.
"The skull of a really tall giant—#emph[fine] , I'll go check it out."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The turret was surrounded. Wheel-footed guardian automata. Weapon-armed peacewalkers protecting the aether lines. Consulate-piloted vehicles grinding the mosaic streets under their treads.
Pia shouted orders. Nissa set the huge metal container down on the street, and Pia set up a defense around it. Ajani rushed forward with his double axe, knocking aside one automaton and slicing another in two pieces. Nissa raised her staff, and the street buckled as the earth unfolded from underneath, blooming into a web of snaring vines. As one automaton was pulled down, renegade inventors clambered onto it, deploying malfunction hammers and binding traps.
#figure(image("007_Breaking Points/05.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
The turret swiveled toward the ground. It glowed with a blue heat, and, as an officer motioned with his hand, fired. The beam roasted the street, leaving a cobblestone-rimmed crater. Pia's renegades had scattered from the blast, but only just.
Before them loomed an immense rolling peacewalker, its chassis festooned with red Consulate banners that reached from its shoulders to its treads. It stood between them and the base of the turret, rotating at the waist to scan for enemies. From the platform where the thing's head should have been, Consulate soldiers took aim with launchers, firing blasts of barbed darts into the crowd. Pia shouted and pointed.
A young elf dashed forth and ran under the peacewalker's armature. She sliced through a vulnerable under-chassis fuel line with the quick arc of a dagger and a laugh of triumph. But when she whirled to sprint back out of its way, the spikes on its treads snagged a piece of her tunic and pulled. She lost her footing and fell sideways, dragged toward the spikes as she struggled to release herself.
Pia heard Ajani shout, "Shadowblayde!"
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
A thousand fight-or-flight micro-impulses prickled along Chandra's spine as she followed clouds of raw aether down into the ship's hold. Mist swallowed the base of the stairs, and she heard a whistling hiss—the kind of sound she never wanted to hear when aboard an aether-powered vehicle, hundreds of feet in the air.
She didn't see the interloper until she got down into the hold with #emph[Hope of Ghirapur] . There stood <NAME>, almost everything else obscured with aetheric steam.
"When I first came to you and your compatriots, <NAME>," Dovin said, "I had planned to recruit your help. I see now that that my plan was badly flawed."
Through the steam, Chandra could see the access plug. Some sort of mechanical grippers had cut a neat hole in the airship's belly and allowed a single person into the ship. The grippers had then sealed the hull off again, but a fuel conduit had been severed, and the cracked pipe was spraying aether everywhere.
Chandra pulled her gloves tight and advanced toward him. "Get off my dad's ship."
Dovin held up a pair of pliers. Gently held in the thin jaws of the pliers was a piece of torn metal, a tiny filigree cage that housed a compact, powerful module. It was from the aetheric disruptor—the crucial piece of #emph[Hope of Ghirapur] . And just as Chandra recognized it, Dovin crushed it.
"No!" Chandra yelled.
"My error is now remedied," Dovin said. "And I've identified the flaw in #emph[your] plan—a single, unique, easily-destroyed mechanism that is key to your entire operation."
It wasn't just the core of the disruptor. Through the shroud of aether, she could see that #emph[Hope of Ghirapur] 's guts were spilled out everywhere.
Chandra clothed herself in fire and rushed at Dovin.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The peacewalker kept barreling in a straight line toward the renegades. Shadowblayde must have cut a #emph[steering] line rather than the power. Running along with it, Shadowblayde tried to tear out of her tunic, but the wheels bit into the sleeve, drawing her arm dangerously close to the gnashing wheels.
Ajani roared and ran for the elf axe-first. He slapped away a barrage of Consulate projectiles with the axe head, and in a continuation of the motion slashed through the peacewalker's treads to free Shadowblayde.
"White Cat!" Shadowblayde cried. "Thank y—#emph[aagh!] "
Her tunic had come free, but the grinding mechanisms of the vehicle's underbelly still rolled over them, gear teeth threatening to rip at their flesh like knives. Ajani used his body to huddle over her. They tensed, awaiting the crushing weight as darkness swept over them—
—and then there was light. Metal screamed as the peacewalker wrenched and tilted sideways, one tread grinding and sparking against the street, the other spinning freely in the air. Nissa stood under the chassis, her arms holding up the great mechanical beast, a tangle of sinew-like vines twisting around her body and buttressing her strength against the ground.
Ajani and Shadowblayde rolled and leapt clear. As they rushed away, Nissa dropped the peacewalker with a crash. Mechanisms groaned, gears fused and sparked, and the peacewalker took a lurching left and careened into a building.
"Bring the package!" Pia called.
With the peacewalker out of the way, they had a brief, clear line of sight to the base of the turret—but it also had clear line of sight to them. While the cannon turned to aim down at them, inventors hurried forward with the container and dropped it right by the base of the turret, the business end of which now glowed with charged aether.
"Release!" Pia called.
The inventors yanked on the container's release clasps. Locks clicked open and seams parted, releasing, at first, only a strange chorus of snortling, snorfling, and the scrabbling of sets of tiny claws.
The turret's charger mechanisms revved and sang with energy. The focal end crackled with air-boiling heat. Renegade inventors scattered as the beam prepared to fire.
The locks disengaged and the container's sides fell open. Gremlins poured out by the dozens.
They instantly flooded into the street, pointing their snouts toward the turret.
#figure(image("007_Breaking Points/06.jpg", width: 100%), caption: [Invigorated Rampage | Art by <NAME>], supplement: none, numbering: none)
"FIRE!" yelled the turret officer.
But it was too late. Gremlins swarmed up the struts, sizzling its metal with their acidic drool. The cannon fired, blasting a smoking hole in the street, but meanwhile gremlins clawed open filigree pipes and aether tanks, gorging on the turret's rich stores of aether.
Soldiers tried to fend them off with dart-throwers and unsheathed weapons, but their strategy quickly turned to locating all available exits.
#figure(image("007_Breaking Points/07.jpg", width: 100%), caption: [Release the Gremlins | Art by Izzy], supplement: none, numbering: none)
The whole operation became a gremlin feast. Torn open and drained, the turret went dark and the cannon sagged, aetherless and useless.
Renegades cheered.
Pia smirked, nodding at her ground team. "That's our part," she said. She looked up at the sky. "Now everything depends on #emph[Hope of Ghirapur] ."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
It was hopeless. The outer shell of the modified thopter was intact, but it didn't matter—its precious, intricate payload was ruined.
Chandra hurled blasts of fire past #emph[Hope] , trying to push the interloper Dovin to retreat further back into the hold, but she could barely see in the misty chamber. She blasted wildly, briefly lighting her advance on Dovin, but she had only succeeded in setting bits of #emph[Heart of Kiran] on fire. Dovin had evaded her every spell.
#figure(image("007_Breaking Points/08.jpg", width: 100%), caption: [Hungry Flames | Art by Izzy], supplement: none, numbering: none)
"This airship has lost significant fuel supplies," Dovin said calmly. "For your safety, I would advise to land the ship soon."
Chandra couldn't hit something she couldn't see. She angrily slipped on her goggles, only to see Dovin in the act of giving a slight bow.
"At that time, the crew should commence proper evacuation protocols," he said. "Farewell."
And then he began to shimmer and fade. He was planeswalking away.
"Nooo!" Chandra flung a last-ditch blast of fire, but it sailed through the vedalken's disappearing form. He was gone.
Behind her, she heard Saheeli dashing down the stairs into the hold. "Crew says we're leaking fuel, what's going on down—" She must have seen the hollowed-out thopter, because she interrupted herself. "Oh no! Oh no, oh #emph[no] ..."
Chandra opened her mouth and made a sound that was more volume than vocabulary.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Gideon followed the others down into the hold. He took inventory: The chassis of #emph[Hope of Ghirapur] was torn open like a carcass. Pieces of the disruptor were strewn around the ship's hold like pecked-over internal organs. Saheeli had hastily welded #emph[Heart of Kiran] 's aether line, but the pipes still hissed at the joints. The whole airship rumbled and rattled, and altitude bells sounded shrill warnings.
Chandra clanged on the thopter with her knuckle. "So," she said through her teeth. "Can we still launch it?"
"It'll probably fly," Saheeli said. "But what's the point? Without the disruptor, it's just an empty shell."
Chandra's look was dark. "Maybe we should just ram the Bridge."
Gideon began to object, but Saheeli beat him. "No good," she said. "Dovin's wrecked the fuel system. #emph[Heart of Kiran] is fading fast. We can get in range, but not at speed. It's the thopter or nothing."
"But it can't detonate now," Chandra said.
Eyes were turning to Gideon. He took a breath, trying and failing to think of a way to protect all these people from the sad truth. "We need to call it off," he said. "We have to think of something else."
Rashmi spoke up. "Liliana's still down there."
"So's my mother!" Chandra said. "And Nissa, and Ajani! The rest of the renegades! Our #emph[friends] and our #emph[family] are counting on us."
"We're not going to get another chance," Saheeli murmured.
Gideon crossed his arms and looked at the ceiling. He wished he could scoop up everyone on this world onto this ship, and then reach his arms around the whole thing. Wrap all the soft people in an impenetrable hug. Everyone in his life always seemed to get into situations proving how #emph[fragile] they were.
Chandra ran her hand along the smooth thopter chassis. "I have a bad, bad idea." She glanced at Gideon, and then tipped her head inside the thopter's hatch.
"What are you even—?" Gideon started. When he traced forward along her thought process, he put up his hands. "No. What? No. Chandra. Absolutely not."
"It could work," Chandra said, her voice echoing from inside the chamber. She popped her head back out. She had that little Chandra half-grin on her face, but she was shaking. "From close range, #emph[I] could be the disruptor. When I fought Baral, before Nissa pulled me out of it, I was just about to complete a spell..." She stopped, her breaths coming sharp and quick. "Little thing. Big boom."
Gideon shook his head, trying to wave the idea away like candle smoke. "Not going to happen. People—I want other options, now."
But Chandra was already climbing into the hollowed-out #emph[Hope of Ghirapur] , tucking her limbs inside like a spider crab.
"Get out of there, gods damn it!" Gideon roared. "Absolutely not. That wouldn't even—even #emph[work] ." He hated how unconvinced he was of that.
Saheeli was looking sidelong at Rashmi. "We'd have to do some modifications to account for the altered encumbrance..." Rashmi nodded. "And we'd pad out the nose cone, of course, to absorb as much of the collision as possible...a filigree harness of some kind?"
Chandra's voice came from inside the thopter. "No nose cone." There was a CLANG as she kicked at the thopter's copper tip from the inside. CLANG. Her foot erupted from the front of the thopter. CLANG.
Gideon's laugh was incredulous. "Chandra! You'd be a smear on the wall! The impact alone would kill you."
Chandra's face popped back up from inside the thopter. She wasn't laughing. "They've cleared a path for us. They're counting on us. It's now or it's never." She shrugged. "I choose now."
This strategy was beyond ludicrous. As big an explosion as Chandra could generate, this was not even clever improvisation. It was useless suicide. Why would she even #emph[consider] —
Gideon's heart squeezed for her. Of course. The plane they were on—the very name of the #emph[ship] they were on. Of course she felt responsible. "Chandra," he said, as delicately as possible. "None of this will bring your father back."
There were no pyrotechnics. Just a series of even words fired back. "You can shut your goddamn mouth about my father." And she snapped on her goggles.
Gideon backed off a step. Saheeli and Rashmi looked at each other with a shared, quiet #emph[eek] .
"I'm sorry," Gideon said. "It's just...This isn't a time for you to go proving yourself. You're tired. You've spent so much rage already."
Chandra just looked at him through the goggle glass. "My rage is a renewable resource."
"We can find another way."
"If you can think of one, let me know. I'm going."
Saheeli and Rashmi were already holding welders and scrap material to modify the thopter.
Gideon studied the scene for a long moment, trying to freeze this awful situation so that it couldn't go any further wrong. He stomped around the ship's hold, circumambulating the thopter. He stuck his head inside the thopter's chamber, tracing the specifications of the interior space with Chandra in it, evaluating. He sighed, looking around for any kind of different answer.
Finally, he unhitched his sural from his belt and hung it on the wall. He looked at Chandra.
"You're not going alone."
|
|
https://github.com/kokkonisd/yahtzee-scoreboard | https://raw.githubusercontent.com/kokkonisd/yahtzee-scoreboard/main/README.md | markdown | # Yahtzee scoreboard
A scoreboard to track Yahtzee games.
Needs [typst](https://github.com/typst/typst) to build:
```console
$ typst c scoreboard.typ
```
|
|
https://github.com/xsro/xsro.github.io | https://raw.githubusercontent.com/xsro/xsro.github.io/zola/typst/Control-for-Integrator-Systems/lib/lib.typ | typst | #import "ode-dict.typ":ode45,get_signal
#import "operation.typ" as op
// wrap ode45 to SISO problem
#let ode(func,tfinal,x0,step)={
let (xout,dxout)=ode45((t,x)=>(value:func(t,x.value)),tfinal,(value:x0),step)
(get_signal(xout,"value"),get_signal(dxout,"value"))
}
// notation for sig ⌊⌋ ⌈⌉
#let sig(a)=$lr(⌊#a⌉)$
#let sgn(a)=$"sgn"lr((#a))$
|
|
https://github.com/mhspradlin/wilson-2024 | https://raw.githubusercontent.com/mhspradlin/wilson-2024/main/understanding-ai/day-1.typ | typst | MIT License | #set page("presentation-16-9")
#set text(size: 30pt)
#heading(outlined: false)[Understanding Artificial Intelligence]
July 2024
<NAME> --- Amazon
// TODO: Different structure
// Three parts
// - Story involving a person about topic
// - Crunchy mathy part, perhaps hands-on exercise
// - Read a thing and discuss in groups then as a class
#pagebreak()
= The Class
- Mix of lectures, reading, and discussions
- Break halfway through class
- Raise hand to ask questions at any time
- Be respectful and inclusive
#pagebreak()
= Background
Going around the room:
- What is your name?
- What school do you go to?
- What grade are you going in to?
- What are you most hoping to learn this week?
#pagebreak()
= Overview
/ Day 1: The Landscape, Decision Trees
/ Day 2: Social Media Algorithms
/ Day 3: Classifiers
/ Day 4: Image Synthesis and Chatbots
/ Day 5: Meta Learning, Superintelligence
#pagebreak()
= The AI Landscape
/ Intelligence: The ability to perceive or infer information.
/ Artificial Intelligence (AI): Intelligence exhibited by machines.
The above definition is very broad. Most people mean a computer system that can make decisions that change depending on the circumstances.
#pagebreak()
// == Definitions
// - *Narrow AI* --- AI applied to solve a specific problem
// - *General AI* (AGI) --- AI that can accomplish any intellectual task humans or animals can perform
// - *Superintelligence* --- Intelligence that exceeds humans
// - *Machine Learning* (ML) --- Computer algorithms that improve automatically through experience
// - *Deep Learning* --- Subset of ML based on neural networks and representation learning
// #figure(image("figures/AI_hierarchy.svg"))
// - *Data Science* --- Using statistics and algorithms to extract knowledge from data
// - *Traditional Programming* --- Encoding a set of rules for a machine to execute; typically contrasted with ML
// - *Model* --- An abstract conceptual representation of the workings of a system of objects in the real worls
// - *Training* --- Executing a Machine Learning algorithm on data to create a model
// #pagebreak()
// AI typically works together with data science:
// #figure(image("figures/ai-and-ds.png"))
== History
The idea of intelligent artificial beings has been around for a long time.
#figure(image("figures/talos.jpeg", height: 50%), caption: "Talos, giant bronze protector of Crete, c. 300 BC")
== History
- AI assumes that the process of human thought can be mechanized
- Formal reasoning developed with a long history:
- Aristotle --- Logic
- al-Khwārizmī --- Algebra and algorithms
- Gödel --- Logic, incompleteness proof
- Many, many, more all over the world
// - 1930s --- Cybernetics, early neural networks
// - Feedback loops, information theory, Turing machine
// - 1950 --- Turing Test
// - 1950s --- Checkers program
// - 1956 --- AI founded as an academic discipline (Dartmouth Workshop)
// - 1956-1974 --- Symbolic AI, rapid progrss and optimism
// - 1974-1980 --- First AI winter
// - 1980-1987 --- Expert systems boom, AI bubble
// - 1987-1993 --- Second AI winter
// - 1993-2011 --- AI behind the scenes
// - 2011-Today --- Big data, deep learning, AGI
// *AI Effect* --- as soon as AI successfully solves a problem, the problem is no longer considered by the public to be a part of AI. This phenomenon has occurred in relation to every AI application produced, so far, throughout the history of development of AI.
// #pagebreak()
#pagebreak()
= Deep Blue
#columns(2)[
#figure(image("figures/startreklcars.jpeg", height: 80%))
In 1985, AI was largely the stuff of science fiction
]
#pagebreak()
= Deep Blue
#columns(2)[
#figure(image("figures/Feng-Hsiung_20Hsu.png", height: 80%))
In 1985, Dr. <NAME> began developing a chess supercomputer while
a doctoral student at Carnegie Mellon.
In won a computer chess championship in 1987.
]
#pagebreak()
= Deep Blue
#columns(2)[
#figure(image("figures/300px-KasparobDeepThought1989.jpg", height: 80%))
In 1988, he developed Deep Thought. He joined
IBM Research after getting his doctorate in 1989.
Deep Thought played <NAME> in 1989 and lost badly. It was then renamed Deep Blue.
]
#pagebreak()
= Deep Blue
#columns(2)[
#figure(image("figures/Deep_Blue.jpeg", height: 80%))
Between 1989 and 1996, Deep Blue was developed using highly-tuned algorithms,
including decision trees, and custom chips were created to run the algorithms
quickly.
]
#pagebreak()
= Deep Blue
#columns(2)[
#figure(image("figures/deep-blue-1997.jpeg", height: 80%))
Deep Blue played <NAME> in Feburary of 1996. It made history
by being the first computer to win a game against the reigning world
champion, but Kasparov won 4-2.
]
#pagebreak()
= <NAME>
#columns(2)[
#figure(image("figures/Kasparov_Magath_1985_Hamburg-2.png", height: 80%))
- Youngest world champion ever (22) in 1985
- Was ranked \#1 for more than 25 years (!)
- Retired in 2007, pursued activism
]
#pagebreak()
= Deep Blue
#columns(2)[
#figure(image("figures/deep-blue-1997-2.jpeg", height: 80%))
Deep Blue was upgraded, rematch in May 1997.
- First game move 44 bug, Kasparov wins
- Second game Blue wins, cheating accusation
- Third game esoteric opening, draw
]
#pagebreak()
= Deep Blue
#columns(2)[
#figure(image("figures/deep-blue-1997-2.jpeg", height: 80%))
- Fourth game draw, bad time management by Kasparov
- Fifth game draw, Kasparov missed a win
- Sixth game, dubious opening by Kasparov, Blue wins
]
#pagebreak()
// In 1985-1990s, computers were considered powerful but AI was considered the stuff of science fiction
// Background on <NAME>
// Background on <NAME>
// Deep Thought - Won one game in 1988, lost big time to Kasperov in 1989
// Deep Blue 1996 match - Deep blue wins first, but Kasperov comes back to win in part by using anti-computer tactics (emphasis on long-term planning)
// Deep Blue 1997 match - upgraded to run twice as fast, with additional fine-tuning by chess grandmaster.
// First game, Kasparov wins but a bizarre 44th move by blue due to a bug thought to have intimidated
// Second game, Kasparov resigns but it turns out he could have played a draw. Kasparov accuses Deep Blue of cheating because a particular move was too sophisticaed
// Third game, Kasparov deliberately played an esoteric opening, but ends up as a draw
// Fourth game, Draw in part due to hurried moves and bad time management
// Fifth game, BDraw, turns out Kasparov had a win partway through
// Sixth game, Blue wins very fast. Kasparov tried to play a dubious opening on a gamble that the computer wouldn't play the refutation because it doesn't result in a material gain, but deep blue did and Kasparov resigns
== Group Exercise
Split into groups and discuss:
- What are three examples of AI you have encountered in your life?
- How can AI be used as a useful tool?
- Are there any risks associated with AI?
We will then have a class discussion.
#pagebreak()
= Decision Trees
#figure(image("figures/iris-decision-tree.png", height: 80%))
== Uses
- Commonly used in *expert systems*
- Is a *decision support* model
- Can encode policies and best practices
#v(2em)
Example of decision trees in action:
#align(horizon + center)[
https://akinator.com
]
#pagebreak()
== Approach
#columns(2)[
#figure(image("figures/decision-tree-example.jpeg", height: 80%))
- Start at root
- Squares mean a decision
- Continue until you get to the end
]
#pagebreak()
#figure(image("figures/decision-tree-chance-nodes.svg", height: 80%))
- Circles mean chance, good for modeling outcomes
== Exercise: Make a Decision Tree by Hand
Create a decision tree to decide if a given animal is a fish based on the table below.
#text(size: 24pt)[
#table(columns: (auto, auto, auto , auto),
inset: 10pt,
[],
[*Can survive without coming to surface?*],
[*Has flippers?*],
[*Fish?*],
[1], [Yes], [Yes], [Yes],
[2], [Yes], [Yes], [Yes],
[3], [Yes], [No], [No],
[4], [No], [Yes], [No],
[5], [No], [Yes], [No],
)
]
#pagebreak()
== Exercise: Make a Decision Tree by Hand
- What was your solution?
- How can you tell if it works as you expect?
#pagebreak()
= Exercise: Make a Decision Tree for Tic-Tac-Toe
Make a decision tree to play tic-tac-toe. Write down your rules such that another
person could follow them.
When we're done, we will play out a game on the board using the tree.
#pagebreak()
#text(size: 28pt)[
#table(columns: (auto, auto, auto , auto, auto, auto),
inset: 10pt,
[],
[*No surfacing?*],
[*Flippers?*],
[*Head?*],
[*Tentacles?*],
[*Fish?*],
[1], [Yes], [Yes], [Yes], [No], [Yes],
[2], [Yes], [Yes], [Yes], [Yes], [Yes],
[3], [Yes], [No], [No], [No], [No],
[4], [No], [Yes], [Yes], [No], [No],
[5], [No], [Yes], [No], [Yes], [No],
[6], [No], [No], [No], [No], [No],
[7], [No], [Yes], [Yes], [Yes], [No],
[8], [Yes], [Yes], [No], [No], [No],
)
]
== Algorithm: ID3
+ Calculate the _entropy_ of every attribute $a$ of data set $S$.
+ Split the set $S$ into subsets using the attribute for which the resulting entropy after splitting is minimized.
+ Make a decision tree node containing that attribute.
+ Recurse on subsets using the remaining attributes.
_Entropy_ is a measure of how disordered data is.
== Entropy
In information theory, the "informational value" of some data is related to how surprising the event is. If something highly likely occurs, then the data contains little information. If something unlikely occurs, then there the event is very informative.
- Knowledge of a losing lottery number: Uninformative
- Knowledge of the winning number: Very informative
$
"Data point " x &= (x_a_1, x_a_2, ..., x_a_n) \
"Data set X" &= x_1, ..., x_n \
"Probability of event " E_i &= p(E_i) \
&= ("Count of " x "where" x_a_i = E_i) / ("Total count of " X) = |E_i| / |X| \
"Information" &= I(E_i) = log_2(1 / (p(E_i))) \
&= -log_2(p(E_i))) \
$
$
"Entropy of " X &= Eta(X) = sum_(i = 1)^n p(E_i) * I(E_i) \
"Information Gain"&" of attribute" A = I G(X,A) \ &= Eta(X) - Eta(X|A) \
&= Eta(X) - sum_(E_a in A) |E_a| / |X| * Eta(x in X | x_a = E_a)
$
Next we'll work an example.
== Entropy: Example
#text(size: 24pt)[
#table(columns: (auto, auto, auto , auto),
inset: 10pt,
[],
[*No surfacing?*],
[*Flippers?*],
[*Fish?*],
[1], [Yes], [Yes], [Yes],
[2], [Yes], [Yes], [Yes],
[3], [Yes], [No], [No],
[4], [No], [Yes], [No],
[5], [No], [Yes], [No],
)]
We'll compare information gain for splitting on `No surfacing?` and `Flippers?`.
#pagebreak()
Splitting on `No surfacing?`:
#let no-surfacing = text(size: 24pt)[
#table(columns: (auto, auto, auto , auto),
inset: 10pt,
[],
[*No surfacing?*],
[*Flippers?*],
[*Fish?*],
text(red)[1], text(red)[Yes], text(red)[Yes], text(red)[Yes],
text(red)[2], text(red)[Yes], text(red)[Yes], text(red)[Yes],
text(red)[3], text(red)[Yes], text(red)[No], text(red)[No],
text(blue)[4], text(blue)[No], text(blue)[Yes], text(blue)[No],
text(blue)[5], text(blue)[No], text(blue)[Yes], text(blue)[No],
)]
#no-surfacing
#pagebreak()
Overall entropy is: #text(size:28pt)[$Eta(X_"Fish?") &= sum_(i = 1)^n p(E_i) * I(E_i)$]
#columns(2)[
#no-surfacing
$
&= p("Yes") * I("Yes") \
&#h(2em)+ p("No") * I("No") \
&= 2/5 (-log_2(2/5)) \
&#h(2em)+ 3/5(-log_2(3/5)) \
&approx 0.97 "bits of entropy"
$
]
Entropy of `No surfacing?` = #text(red)[Yes]: #text(size:22pt)[$Eta(X_"Fish?"&|"No surfacing?" = "Yes")$]
#columns(2)[
#no-surfacing
$
&= p("Yes") * I("Yes") \
&#h(2em)+ p("No") * I("No") \
&= 2/3 (-log_2(2/3)) \
&#h(2em)+ 1/3 (-log_2(1/3)) \
&approx 0.92 "bits of entropy"
$
]
Entropy of `No surfacing?` = #text(blue)[No]: #text(size:22pt)[$Eta(X_"Fish?"&|"No surfacing?" = "No")$]
#columns(2)[
#no-surfacing
$
&= sum_(i = 1)^n p(E_i) * I(E_i) \
&= p("No") * I("No")\
&= 1 (-log_2(1)) \
&= 0 "bits of entropy"
$
]
$& I G(X_"Fish?", A_"No surfacing?") \
&= Eta(X_"Fish?") - Eta(X_"Fish?"|A_"No surfacing?") \
&= Eta(X_"Fish?") - \
& #h(2em) sum_(E_a in A_"No surfacing?") |E_a| / |X_"Fish?"| Eta(X_"Fish?" | "No surfacing?" = E_a) \
&= Eta(X_"Fish?") - |E_"Yes"| / |X_"Fish?"| Eta("Yes", "Yes", "No") + |E_"No"| / |X_"Fish?"| Eta("No", "No") \
&approx 0.97 - 3/5 * 0.92 + 2/5 * 0 = 0.418 "bits"
$
#pagebreak()
Splitting on `Flipper?`:
#text(size: 24pt)[
#table(columns: (auto, auto, auto , auto),
inset: 10pt,
[],
[*No surfacing?*],
[*Flippers?*],
[*Fish?*],
text(red)[1], text(red)[Yes], text(red)[Yes], text(red)[Yes],
text(red)[2], text(red)[Yes], text(red)[Yes], text(red)[Yes],
text(blue)[3], text(blue)[Yes], text(blue)[No], text(blue)[No],
text(red)[4], text(red)[No], text(red)[Yes], text(red)[No],
text(red)[5], text(red)[No], text(red)[Yes], text(red)[No],
)]
Entropy of #text(red)[Yes] is $1$.
Entropy of #text(blue)[No] is $0$.
Information gain is $approx 0.97 - 4/5 * 1 - 1/5 * 0 = 0.17 "bits"$.
#pagebreak()
== Splitting
- Splitting on `No surfacing?` has information gain of $0.42$
- Splitting on `Flipper?` has information gain of $0.17$
Thus, `ID3` would split on `No surfacing?` first.
Since everything in the #text(blue)[No] branch is the same classification, those rows are removed from the data set.
#pagebreak()
After that, there's just `Flippers?` left to split on using the remaining data.
#columns(2)[
#table(columns: (auto, auto, auto),
inset: 10pt,
[],
[*Flippers?*],
[*Fish?*],
text(red)[1], text(red)[Yes], text(red)[Yes],
text(red)[2], text(red)[Yes], text(red)[Yes],
text(blue)[3], text(blue)[No], text(blue)[No],
)
- This is the last attribute, so no calculations are necessary.
- Because rows get removed, the starting entropy can change attribute-to-attribute.
]
#pagebreak()
== Other Algorithms
As with most machine learning algorithms, there are alternatives to choose from:
- C4.5 --- Successor to ID3, can handle numeric values
- C5.0 --- Successor to C4.5, more efficient but proprietary
- CART --- Family of algorithms
- MARS --- Family of algorithms
Each has different performance and complexity.
#pagebreak()
== Strengths and Limitations
- Simple to interpret
- Valuable as a modeling process
- Generally good performance on large data
- Small changes in the data can render a tree inaccurate
- Less accurate compared to other techniques
- Gets very complicated if many factors are involved
- Prone to *overfitting*---matching the training data so closely it doesn't give good predictions
|
https://github.com/Quaternijkon/Typst_Lab_Report | https://raw.githubusercontent.com/Quaternijkon/Typst_Lab_Report/main/main.typ | typst | #import "theme.typ": *
#show: project.with(
course: "计算机系统",
lab_name: "位运算实验",
stu_name: "顶针",
stu_num: "SA114514",
major: "计算机科学与技术",
department: "计算机科学与技术学院",
date: (2024, 10, 1),
show_content_figure: true,
watermark: "USTC",
)
#show :show-cn-fakebold
#include "content.typ" |
|
https://github.com/satwanjyu/typst-cv-template | https://raw.githubusercontent.com/satwanjyu/typst-cv-template/main/main.typ | typst | MIT License | #set page(
margin: (x: 12mm, y: 16mm),
footer: [
Last updated: #datetime.today().display("[month repr:long] [year]")
],
footer-descent: 0%
)
#set par(justify: true)
// #set text(font: "OpenDyslexic 3")
#show heading.where(level: 1): set text(size: 24pt)
#show heading.where(level: 2): it => {
smallcaps(text(size: 15pt, it.body))
// Hack to get rid of vertical spacing of line function
v(-0.9em)
line(length: 100%, stroke: 0.8pt)
v(-0.2em)
}
#let subsection-heading(organization, title, duration, location) = {
text(weight: "bold")[#organization]
h(1fr)
duration
linebreak()
title
h(1fr)
location
}
#let spacer-m = v(0.8em)
#let spacer-s = v(0.4em)
// Adjust column sizes here
#grid(
columns: (1fr, 2fr),
column-gutter: 16pt,
// Left column
[
= Your Name
#spacer-s
#link("mailto:<EMAIL>") \
// Note: use hyphen - for seperator
#link("tel:+1 (234) 567-8901") \
#show link: underline
#link("example.com") \
#spacer-m
== Languages
- #lorem(5)
- #lorem(5)
- #lorem(5)
#spacer-m
== Skills
- #lorem(10)
- #lorem(10)
- #lorem(10)
#spacer-m
== Personal Interests
- #lorem(8)
- #lorem(8)
- #lorem(8)
],
// Right column
[
== Education
// Note: use en dash – for duration
#subsection-heading("Institution", "Degree", "2011.1 – 2022.2", "Location")
- #lorem(20)
- #lorem(20)
- #lorem(20)
#spacer-m
== Experience
#subsection-heading("Organization", "Title", "2011.1 – 2022.2", "Location")
- #lorem(20)
- #lorem(20)
- #lorem(20)
#spacer-m
#subsection-heading("Organization", "Title", "2011.1 – 2022.2", "Location")
- #lorem(20)
- #lorem(20)
- #lorem(20)
#spacer-m
== Projects
#show link: underline
#subsection-heading("Title", link("project.site"), "2011.1 – 2022.2", "Location")
- #lorem(20)
- #lorem(20)
- #lorem(20)
]
)
|
https://github.com/francescoo22/masters-thesis | https://raw.githubusercontent.com/francescoo22/masters-thesis/main/appendix/full-rules-set.typ | typst | #import "../config/utils.typ": *
#import "../vars/rules/base.typ": *
#import "../vars/rules/relations.typ": *
#import "../vars/rules/unification.typ": *
#import "../vars/rules/statements.typ": *
#pagebreak(to:"odd")
= Typing Rules
All the following rules are to be considered for a given program $P$, where fields within the same class, as well as across different classes, must have distinct names.
== General
#display-rules(
M-Type, "",
M-Type-2, "",
M-Args, "",
M-Args-2, "",
F-Default, ""
)
== Well-Formed Contexts
#display-rules(
Not-In-Base, Not-In-Rec,
Ctx-Base, Ctx-Rec,
)
== Sub-Paths and Super-Paths
=== Definition
#display-rules(
SubPath-Base, SubPath-Rec,
SubPath-Eq-1, SubPath-Eq-2,
)
=== Remove
#display-rules(
Remove-Empty, Remove-Base,
Remove-Rec, "",
)
=== Deep Remove
#display-rules(
Remove-SuperPathsEq-Empty, "",
Remove-SuperPathsEq-Discard, "",
Remove-SuperPathsEq-Keep, "",
)
=== Replace
#display-rules(
Replace, "",
)
=== Get Super-Paths
#display-rules(
Get-SuperPaths-Empty, "",
Get-SuperPaths-Discard, "",
Get-SuperPaths-Keep, "",
)
== Relations between Annotations
=== Partial Ordering
#display-rules(
A-id, A-trans,
A-bor-sh, A-sh,
A-bor-un, A-un-1,
A-un-2, "",
)
=== Passing
#display-rules(
Pass-Bor, Pass-Un,
Pass-Sh, ""
)
== Paths
=== Root
#display-rules(
Root-Base, Root-Rec,
)
=== Lookup
#display-rules(
Lookup-Base, Lookup-Rec,
Lookup-Default, "",
)
=== Get
#display-rules(
Get-Var, Get-Path,
)
=== Standard Form
#display-rules(
Std-Empty, Std-Rec-1,
Std-Rec-2, "",
)
== Unification
=== Pointwise LUB
#display-rules(
Ctx-Lub-Empty, Ctx-Lub-Sym,
Ctx-Lub-1, "",
Ctx-Lub-2, "",
)
=== Removal of Local Declarations
#display-rules(
Remove-Locals-Base, "",
Remove-Locals-Keep, "",
Remove-Locals-Discard, "",
)
=== Unify
#display-rules(
Unify, ""
)
== Normalization
#display-rules(
N-Empty, "",
N-Rec, ""
)
== Statements Typing
#display-rules(
Begin, "",
Seq-New, Decl,
Call, "",
Assign-Null, "",
Assign-Call, "",
Assign-Unique, "",
Assign-Shared, "",
Assign-Borrowed-Field, "",
If, "",
Return-p, "",
)
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/020%20-%20Prologue%20to%20Battle%20for%20Zendikar/001_Stirring%20from%20Slumber.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Stirring from Slumber",
set_name: "Prologue to Battle for Zendikar",
story_date: datetime(day: 13, month: 05, year: 2015),
author: "<NAME>",
doc
)
#emph[Over a thousand years ago, one woman stood between her world and the brink of destruction.]
#emph[The kor Planeswalker Nahiri, called the Lithomancer, ] helped imprison the Eldrazi#emph[ on her home plane of Zendikar over 6,000 years ago. Planeswalkers in those days were ageless and virtually immortal, and Nahiri had no intention of leaving Zendikar unguarded. She settled in to keep watch over the Eldrazi titans' prison and waited.]
#emph[And waited.]
#emph[And waited.]
#emph[Until things changed. The Eldrazi stirred. Nahiri woke.]
#emph[This was not the great reawakening of the Eldrazi seen in the storyline of Rise of the Eldrazi—the titans themselves remained imprisoned, even as their lineages ravaged Zendikar. This was around a thousand years earlier, and it might have led to a great rising…were it not for Nahiri standing in the way.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Nahiri was one with the world.
Eyes closed, she sat in a cocoon of stone, every inch of her skin connected to the bedrock, the solid foundation of Zendikar. Everything that touched the earth touched her, an endless march of meaningless motion as she and the world simply existed, being without doing. How long had she been there? How many generations of people and animals had come and gone since she retreated into this chamber and pulled the stone up around her like a cairn? It didn't matter. She was immortal, ageless as the world itself.
#emph[Am I even still alive?]
She had not left Zendikar since the day she had brought Sorin and the Spirit Dragon here, when they began their fateful work of imprisoning the Eldrazi. At first, she had stayed to keep watch. Their plan seemed to have worked: the prison held, and the Eldrazi were all but forgotten. But Zendikar didn't like holding them. Akoum still quivered and shuddered around their prison, as though it were trying to vomit them up. If she left, she had thought, how could she know that her world remained safe?
And for those first few centuries, she had lived—really #emph[lived] —among her own people, the kor. She had cooed at babies and wept at funerals, laughed around tables piled with good food, and fell in love…twice. She had taught lithomancy to a long, long stream of students, showing them how to use stone and the metal within it to form objects and weapons.
She had trained the kor to keep watch over the Eldrazi prison, leading bands of them on long pilgrimages across the plane. She showed them the focal points of the hedron network's power, and taught the stoneforgers among them how to test the walls of the prison, to make sure the—she had called them "gods," to help the kor understand—to make sure the gods did not emerge to ruin the world.
#figure(image("001_Stirring from Slumber/01.jpg", width: 100%), caption: [Nomads' Assembly | Art by Erica Yang], supplement: none, numbering: none)
But her students learned and moved on. Her lovers aged and died. Birth followed birth, over and over, and one funeral followed another, and eventually she couldn't remember why it mattered…any of it.
So she had made her way back here, to the chamber of the Spirit Dragon, the place she and Sorin had called the Eye of Ugin in a sort of shared joke. Her footsteps echoing in the vast stone hall, she had briefly considered trying to summon Sorin, the one person she knew who had existed longer than she had, who might understand the bleakness she was experiencing. He hadn't come to visit her in decades, but they had agreed that the power of the Eye of Ugin was to be used only in case the Eldrazi prison was broken.
She had sat down, all those years ago, and closed her eyes. And felt the world move on, all its people desperately carrying on as if their brief lives meant anything. Now, she stayed on Zendikar because she couldn't think of a reason to go anywhere else.
How long had it been? It didn't matter. Why could it possibly matter?
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
When the world broke, it wrenched at Nahiri's gut like a blade.
Akoum thrashed like a hooked fish pulled from the water. Through waves of crippling nausea, Nahiri tried to find the source of the world's pain, whatever bite or sting had provoked this response. As Zendikar shook around her, her mind found its way to the brink of an abyss, an utter void—the prison of the Eldrazi. It was open.
It was all metaphor, of course. The Eldrazi weren't contained, they weren't physical beings that could be held. They were creatures of the Blind Eternities, and their manifestations on Zendikar were mere projections, like puppets' shadows cast on a wall. The great spell that she, Sorin, and the Spirit Dragon had wrought was not a simple cage. It bound the Eldrazi to Zendikar by holding their shadows, so they could neither move through the plane nor withdraw from it.
But something had shifted, just slightly. She sensed restless movement from the titans, as though they were testing the strength of their bonds, and the seething motion of their broods bubbling into existence around them. The Spirit Dragon had explained, once, that these teeming throngs of lesser Eldrazi were like extensions of the three titans, sensory and digestive organs that all connected to the same extra-planar beings. When the titans had first been bound, their brood lineages continued swarming over the world but, with the titans in stasis, the lesser Eldrazi were like bodies spasming in the throes of death, their heads severed. Eventually, the people of Zendikar had finished them off. And as long as the prison had held, no new Eldrazi were created.
#figure(image("001_Stirring from Slumber/02.jpg", width: 100%), caption: [Emrakul's Hatcher | Art by <NAME>], supplement: none, numbering: none)
Now they were erupting from the ground, their every movement a prick of pain in Nahiri's flesh—a sensation she had not experienced in ages. She observed the feeling curiously, noticing the annoyance it stirred in her mind. She considered discarding those feelings and letting the Eldrazi free themselves, letting them annihilate Zendikar and its people and her along with them, letting them bring an end to the unchanging eternity of her existence and the meaningless passage of time.
But she was feeling pain, and annoyance, and with them came desire—a desire for those feelings to end.
So she scattered the rock that she had piled around herself and stood slowly, stretching limbs long unused. With the stone floor bucking beneath her, she took careful steps—anchoring each foot to the stone with her lithomancy as she moved—to the center of the chamber, where the great glowing hedron stood, the nexus point of the whole hedron network that formed the Eldrazi's prison.
Now, at last, it was time to summon Sorin.
The Spirit Dragon had worked some magic in the Eye of Ugin that surpassed her understanding, forging a special connection between each of them and that place—a connection that spanned the Blind Eternities. Any of the three of them, standing in that place, could send a message to the others, amplified by the Eye's magic, seeking the others out no matter what planes they were on. This spell was intended for exactly this circumstance, so that Nahiri could summon the others if the Eldrazi ever slipped their bonds.
#figure(image("001_Stirring from Slumber/03.jpg", width: 100%), caption: [Eye of Ugin | Art by <NAME>], supplement: none, numbering: none)
Closing her eyes and shutting out the rumbling of stone around her, she sent her call into the Æther—a wordless summons, which the others would experience as an insistent pull, tugging them toward Zendikar.
Her message sent, she settled back onto the floor and pulled the stone back up around her, wincing as the stone carried the sting of the Eldrazi's movements across her skin. Blocking the pain as she waited for the others, she tracked the swarming hosts' advance as they spread out from Akoum.
She blinked once, and felt the pounding of running feet as the Zendikari fled, then the steady march of armies organized to face the Eldrazi.
She blinked again, and felt Zendikar writhe in pain as the greater Eldrazi of the brood lineages annihilated life and mana in their path, absorbing the energies of the lush natural world.
She blinked a third time.
#emph[How long have I been here?]
The sudden thought jarred her back to full awareness. For a moment, she thought the notion of the Eldrazi breaking free had been a sort of dream, but the pain that crawled across her skin confirmed that the Eldrazi broods were still swarming across the plane—and they had spread far while she waited for Sorin and the Spirit Dragon.
They hadn't come. Sorin hadn't come. She was alone.
She wanted—wanted the pain to end, wanted to see Sorin again—and with some surprise, she realized she wanted to preserve Zendikar, the plane; and all its lost, meaningless, desperate people. But while she had been waiting, the situation had become so much worse.
She pulled her stone cocoon up over her head and disappeared into the rock, then emerged at the summit of a nearby mountain.
Eldrazi teemed in the valleys below her, turning the ground to chalky dust in their wake. Shuddering, she stomped her foot on the rocky mountain face and sent an avalanche to crush the abominations. Then she vanished into the rock again and emerged in Ondu, near a kor city she had visited many times in the early years of her guardianship.
The Eldrazi were there as well, but the city lay in rubble—dusty ruins, long abandoned, surely long before the Eldrazi emerged. With a wave of her hand, she closed the canyon to swallow the Eldrazi as she entered the city through a gap in its crumbling wall.
#figure(image("001_Stirring from Slumber/04.jpg", width: 100%), caption: [Demolish | Art by <NAME>], supplement: none, numbering: none)
"I know this street," she murmured. Her voice was a crunch of gravel, so long unused. She remembered haggling in the marketplace, ahead on the left, to buy a—what was it? Something bright and blue that made her smile. Soft.
"A scarf," she said, and decided that it was true.
All the pleasure and heartache of life rushed over her in a moment. Memories flooded her mind—the sights and sounds and smells of the bustling marketplace, the laughter in her heart, the taste of her lover's kiss, the bitter sting of tears. This had been a place of life once, a place where she had lived, and she had missed its fall.
The city had changed, even before its abandonment. Taller buildings had replaced familiar ones here and there, and a whole block had been destroyed and rebuilt since her last visit. A huge stone structure now stood, mostly intact, in a place that had been tenements. Curious, she stepped through its front arch.
Just inside, she saw herself carved in stone, stretching her arms wide in welcome.
She stopped and stared. It was definitely her. The figure was carved in relief from the wall, one leg protruding as if she were about to step from the stone. It must have been a stoneforge mystic, probably one of her students, who drew her features out from the rock. She traced her fingers along the smooth cheek of her stone incarnation, then her eyes fell on the wall from which the relief emerged.
She stepped back to see it better. Engraved behind and around the relief was another figure.
"Kozilek?" she said. "What—"
But it wasn't the Eldrazi titan—at least not exactly. In its overall outline, the figure could have been Kozilek, but the features were those of a male kor wearing a strange geometric crown that mimicked the bizarre obsidian plates that hovered over the titan's alien form. The kor's arms were spread wide, above the stone Nahiri's, and each hand gripped the hilt of a sword whose broad blade extended back along his forearm to the elbow, suggesting the Eldrazi's bifurcated limbs.
Above the male figure's head, an arcing banner proclaimed the subject of the artwork: "Nahiri the Prophet, Voice of Talib."
She turned her back on the sculpture and strode out of the building. Outside, she raised her hands and clenched her fists, and a cloud of dust billowed around her as the building collapsed in on itself.
It was her fault. She had been the first to call Kozilek a god, and apparently the kor had remembered that word more than they had remembered her dire warnings about the gods destroying the world. She felt sick.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
One by one, she visited the sites along the route she had taught the ancient kor, the focal points of the hedron network. Wherever she emerged from the stone, she found Eldrazi nearby. Each time, she opened the earth to swallow them up or sent cascades of rock down to bury them. Killing the Eldrazi broods was not the problem—any mere mortal could do that. But only she could stop them from coming into being—that was to say: only she, Sorin, and the Spirit Dragon. But she was alone, and she would do it alone. She would have to.
She almost didn't bother with the stops in Akoum. So near her resting place in the Eye of Ugin, she would certainly have noticed anything disrupting the hedron network, so there could be no point in examining those locations. But she decided to be thorough, if only because each site was an opportunity to revisit the world she had all but forgotten, to taste the memories that each place brought to the surface of her mind.
But then she visited a site high in the mountains near the Eye of Ugin. And in the very spot where she had taught the kor to test the strength of the hedron network, an unfamiliar stone building now stood. In contrast to the smooth stone of the kor structure, this one was formed of jagged, rough-hewn blocks with huge metal spikes jutting from the mortar and curving toward the sky. The ground was rippled, as though the building had sent out enormous roots that pushed the stone upward.
Even as she approached, she could tell that this was the point where the hedron network had been disturbed. Right under her nose, while she sat alone in the Eye of Ugin. Fury boiled up in her, directed as much at herself as at whoever had done this.
Fury—another feeling she had forgotten. It felt good.
She strode toward the building, each step shaking the ground and causing trickles of gravel and dust to run down the walls. As she drew near, three dark figures came around the building from the other side, crouching into combat stances as they spotted her.
She paused in her advance, falling to one knee and reaching a hand into the earth beneath her. The advancing figures slowed, wary. Then, with a shout, she pulled a glowing-hot sword from the ground and charged.
#figure(image("001_Stirring from Slumber/05.png", width: 100%), caption: [Nahiri, the Lithomancer | Art by <NAME>], supplement: none, numbering: none)
The figures seemed human, but she didn't recognize their clothing from any culture she knew. Flimsy gauze barely covered their chests, revealing the stark red paint adorning their ashen skin. Sharp hooks protruded from their shoulders and upper arms and, as they snarled at her approach, she saw slightly protruding fangs.
#emph[Vampires?] she thought. #emph[There are no vampires on Zendikar.]
Then she met them and her glowing sword cut through cold flesh, sending spurts of ruby blood steaming into the air.
She stepped over their bodies and tore her own doorway open in the rough stone wall. More of the vampire-like creatures scuttled away from her in surprise, then lay still on the floor in her wake, until at last she stood in a large central room.
At the center of that room, in exactly the point where the lines of the hedron matrix joined, stood a large stone altar. The worn slab that formed its top was stained with old blood.
Nahiri glanced around the chamber, spotting a few more vampires—could they actually be vampires?—scurrying out of the hall. To one side stood a huge stone statue, carved in a likeness that seemed like a half-remembered vision of Ulamog. It had sharp, human features beneath a helmet that strongly suggested the strange face-plate of the Eldrazi titan. Instead of legs, it had a mass of writhing tentacles, true enough to the Eldrazi's actual form. In its two human-like hands, it clutched the shoulder horns of a kneeling vampiric figure carved beneath it.
"More damned gods!" she cried. "Whatever you idiots thought a god might be, the Eldrazi titans are not that."
Even so, whatever rituals of sacrifice had been performed on this altar had been effective. Whether Ulamog heard the vampires' prayers or not, their rites had successfully disrupted the hedron network enough for the Eldrazi broods to spill forth.
Laying both hands on the stone altar, she stretched out her senses to assess the damage. It was a subtle change, the barest alteration in the network of the hedron prison. But it had allowed the Eldrazi titans just the smallest amount of room to move, to extend their presence into Zendikar once again. It could be repaired, of course, but it would take time. And it would be much easier if she had help.
"But no help is coming," she said aloud. "I'd better get started."
With a sigh, she looked around the building for a stone of appropriate size. Her eyes lit on the grotesque statue and she smiled. "Perfect."
She walked over to the statue and reached both hands high above her head, just reaching the hooks on the vampire's shoulders, where the bizarre Ulamog's hands were. Then she pulled downward and the whole statue changed.
It had taken forty years to establish the hedron network—what had seemed like a lifetime to her then, when she was still immersed in her connections to ordinary mortals. Crafting one single hedron would not take nearly so long, though she did it alone. The hardest part would be shaping the surface without Ugin's guidance.
What had been a statue became a formless mass of stone under Nahiri's hands, then eight triangular sides with sharp edges. Closing her eyes as she drew a deep breath, she tried to focus on the patterns she would need to scribe in the surface to properly redirect the flow of mana.
The pounding of footsteps on the surrounding ground broke her concentration and she sighed. More vampires surrounded her, advancing slowly with long, curved swords drawn.
"Do we have to do this?" she said. "It's getting tedious."
#figure(image("001_Stirring from Slumber/06.jpg", width: 100%), caption: [<NAME> | Art by <NAME>], supplement: none, numbering: none)
One of them hissed. "You defile our—"
"Fine," she said, and brought the walls down on them, then returned to her work.
Painstakingly, she ran her fingers over every inch of the hedron's surface, shaping the precise patterns the Spirit Dragon had taught her. When a swarm of Eldrazi came scurrying over the rubble toward her, she pulled up the stone to form a solid dome around and above her, sealing her in and the Eldrazi out. When the Eldrazi's Aura of corruption weakened the stone and made the dome start to crumble, she tumbled it down onto them and raised a new one.
It seemed to take forever, which struck her as odd. She had no clear idea of how long she had sat in the Eye of Ugin, meditating as the sensations of the world washed over her. She had left her life behind and cocooned herself away in the rock. But now, with the Eldrazi teeming across her world again, she felt hurried. Partly, of course, she wanted to seal the Eldrazi prison before too many people lost their lives battling them. But partly, she realized, she wanted to finish this task so that she could get back to the business of living.
Perhaps she had been cocooned long enough and she was ready to emerge into a new life, like a fully grown geopede. Perhaps the taste of bitter memory—of wistful longing, and especially of passionate rage—had awakened her from her centuries-long slumber and sparked her into a new wakefulness. In any event, she wanted to finish this so she could set out on her life's next step, whatever it might be.
At last the hedron was finished. Spreading her arms, she shattered the stone dome around her and took a deep breath of fresh air.
#figure(image("001_Stirring from Slumber/07.jpg", width: 100%), caption: [Perilous Vault | Art by <NAME>], supplement: none, numbering: none)
#emph[How long was I in there?] she wondered.
She shrugged off the passing thought and raised her arms, lifting the hedron stone high overhead in one smooth motion. A mere thought was all it took to turn it just so, to link up the broken lines of the hedron network and repair the Eldrazi prison.
She dropped to one knee and put her palms to the ground. She could feel the titans' movement slowing as the restored prison drove them back into torpor. Their broods still swarmed across the land, but that was a problem for the merely mortal. More troubling, Zendikar itself was still reacting—not just in Akoum, as it had since the Eldrazi were first bound, but all over. Quakes shook the ground and reshaped the landscape, surging waves changed coastlines, mighty winds scoured the canyons. Zendikar was twitching at the sting of the Eldrazi, and she suspected it might be some time before it fell quiet again.
She let herself sink into the earth and emerged once more in the Eye of Ugin. Placing her hands on the keystone hedron, she assured herself that the network was restored. She thought about calling out to Sorin and the Spirit Dragon again, but she had taken care of the situation. Zendikar was safe again, thanks to her own efforts. She didn't need the others.
That didn't alter the fact that they hadn't come, though. They had promised to return to Zendikar when called, to help her maintain the prison that she had guarded for countless centuries. But Sorin had abandoned her, and the Eldrazi had swept across Zendikar once more.
Other feelings she had all but forgotten, concern and anxiousness, swelled up in her heart and they made her smile even as they made her ache. They made her feel alive—the sensation of her heart pounding in her chest, the sound of it in her ears, the movement of her muscles as her brow furrowed and her jaw tightened.
What had Sorin been doing all the years she had been cocooned here in the Eye of Ugin? Was he still alive? Had he forgotten her and her vigil over Zendikar? Had he succumbed to the same apathy that had held her for so long?
She would go and find him, wake him up if she needed to, remind him of her and Zendikar and the friendship they had once shared, remind him what it was to live, to feel, to care. She had saved Zendikar, and now she would save him. And then she would return and walk among her people again, she would teach and laugh and love again, and it would #emph[matter] again. It would all matter.
Nahiri laid a gentle hand on the wall of the chamber and it melted away as she opened a pathway through the Blind Eternities. The walls of the chamber became bleak cliffs in a desolate mountain range. She took a deep breath of unfamiliar air and stepped into this other plane, eager to find her oldest friend.
|
|
https://github.com/Mufanc/hnuthss-template | https://raw.githubusercontent.com/Mufanc/hnuthss-template/main/pages/outlines.typ | typst | #import "@preview/i-figured:0.2.4"
#import "/configs.typ": font, fontsize
#import "/components.typ": anchor
#let title(content) = [
#align(center, text(font: font.sans, size: fontsize.L3, content))
]
// 目录
#let list-of-contents = [
#title[目#h(3.5em)录]
// 目录中一级标题用小四号黑体,其余用小四号宋体
#set text(size: fontsize.L4s)
#show outline.entry.where(level: 1): set text(font: font.sans)
#outline(title: [], indent: auto)
]
#let list-of-figures = [
#anchor("插图索引")
#title("插图索引")
#outline(
title: [],
target: figure.where(kind: i-figured._prefix + repr(image))
.or(figure.where(kind: i-figured._prefix + repr(raw)))
)
]
#let list-of-tables = [
#anchor("附表索引")
#title("附表索引")
#outline(title: [], target: figure.where(kind: i-figured._prefix + repr(table)))
]
|
|
https://github.com/Relacibo/typst-as-lib | https://raw.githubusercontent.com/Relacibo/typst-as-lib/main/README.md | markdown | MIT License | # Typst as lib
Small wrapper around [Typst](https://github.com/typst/typst) that makes it easier to use it as a templating engine.
This API is currently not really stable, although I try to implement the features with as little change to the API as possible.
## Usage
#### rust code
```rust
// main.rs
static TEMPLATE_FILE: &str = include_str!("./templates/template.typ");
static FONT: &[u8] = include_bytes!("./fonts/texgyrecursor-regular.otf");
static OUTPUT: &str = "./examples/output.pdf";
static IMAGE: &[u8] = include_bytes!("./templates/images/typst.png");
fn main() {
let font = Font::new(Bytes::from(FONT), 0)
.expect("Could not parse font!");
// Read in fonts and the main source file.
// We can use this template more than once, if needed (Possibly
// with different input each time).
let template = TypstTemplate::new(vec![font], TEMPLATE_FILE);
// Run it
let doc = template
.compile_with_input(dummy_data())
.output
.expect("typst::compile() returned an error!");
// Create pdf
let options = Default::default();
let pdf = typst_pdf::pdf(&doc, &options)
.expect("Could not generate pdf.");
fs::write(OUTPUT, pdf).expect("Could not write pdf.");
}
```
[Full example file](https://github.com/Relacibo/typst-as-lib/blob/main/examples/small_example.rs)
#### Typst code
```typ
// template.typ
#import sys: inputs
#set page(paper: "a4")
#set text(font: "TeX Gyre Cursor", 11pt)
#let content = inputs.v
#let last_index = content.len() - 1
#for (i, elem) in content.enumerate() [
== #elem.heading
Text: #elem.text \
Num1: #elem.num1 \
Num2: #elem.num2 \
#if elem.image != none [#image.decode(elem.image, height: 40pt)]
#if i < last_index [
#pagebreak()
]
]
```
Run example with:
```bash
cargo r --example=small_example
```
## Resolving files
### Binaries
Use `TypstTemplate::with_static_file_resolver` and add the binaries as key value pairs (`(file_name, &[u8])`).
### Sources
Use `TypstTemplate::with_static_source_file_resolver` and add the sources as key value pairs (`(file_name, String)`).
### Local files
Resolving local files can be enabled with `TypstTemplate::with_file_system_resolver`. The root should be the template folder. Files cannot be resolved, if they are outside of root.
Can be enabled like this:
```rust
let template = TypstTemplate::new(vec![font], TEMPLATE_FILE)
.with_file_system_resolver("./examples/templates");
```
If you want to use another local package install path, use:
```rust
let template = TypstTemplate::new(vec![font], TEMPLATE_FILE)
.add_file_resolver(
FileSystemResolver::new("./examples/templates")
.with_local_package_root("local/packages")
.cached()
);
```
### Remote Packages
The `package` feature needs to be enabled.
Can be enabled like this:
```rust
let template = TypstTemplate::new(vec![font], TEMPLATE_FILE)
.with_package_file_resolver(None);
```
This uses the file system as a cache.
If you want to use another cache root path, use:
```rust
let template = TypstTemplate::new(vec![font], TEMPLATE_FILE)
.add_file_resolver(PackageResolverBuilder::new()
.set_cache(
FileSystemCache(PathBuf::from("cache/root"))
)
.build().cached()
);
```
If you want to instead use the memory as cache, use:
```rust
let template = TypstTemplate::new(vec![font], TEMPLATE_FILE)
.add_file_resolver(PackageResolverBuilder::new()
.set_cache(
InMemoryCache::new()
)
.build().cached()
);
```
### Examples
#### Static binaries and sources
See [example](https://github.com/Relacibo/typst-as-lib/blob/main/examples/resolve_static.rs) which uses the static file resolvers.
```bash
cargo r --example=resolve_static
```
#### Local files and remote packages
See [example](https://github.com/Relacibo/typst-as-lib/blob/main/examples/resolve_packages.rs) which uses the file and the package resolver.
```bash
cargo r --example=resolve_files --features=package
```
### Custom file resolver
You can also write your own file resolver. You need to implement the Trait `FileResolver` and pass it to the `TypstTemplate::add_file_resolver` function.
## TypstTemplateCollection
If you want to compile multiple typst (main) source files you might want to use the `TypstTemplateCollection`, which allows you to specify the source file, when calling `TypstTemplateCollection::compile`, instead of passing it to new. The source file has to be added with `TypstTemplateCollection::add_static_file_resolver` first.
`TypstTemplate` is just a wrapper around `TypstTemplateCollection`, that also saves a `FileId` for the main source file.
## Loading fonts
Loading fonts is not in the scope of this library (yet?). If you are interested in that, write an issue.
- [This](https://github.com/typst/typst/blob/a2c980715958bc3fd71e1f0a5975fea3f5b63b85/crates/typst-cli/src/fonts.rs#L69) is how the typst-cli loads system fonts.
- Here is an [example](https://github.com/tfachmann/typst-as-library/blob/dd9a93379b486dc0a2916b956360db84b496822e/src/lib.rs#L216) of loading fonts from a folder.
## TODO
- allow usage of reqwest instead of ureq with a feature flag
- fonts
## Some links, idk
- [https://github.com/tfachmann/typst-as-library](https://github.com/tfachmann/typst-as-library)
- [https://github.com/KillTheMule/derive_typst_intoval](https://github.com/KillTheMule/derive_typst_intoval)
|
https://github.com/hanxuanliang/opentyp | https://raw.githubusercontent.com/hanxuanliang/opentyp/main/typ/cv.typ | typst | MIT License | #let cv(author: "", contacts: (), body) = {
set document(author: author, title: author)
set text(font: "Source Code Pro", size: 12pt, spacing: 30%)
show heading: it => [
#pad(bottom: -5pt, [#smallcaps(it.body)])
#line(length: 100%, stroke: 1pt)
]
// Author
align(center)[
#block(text(weight: 700, 1.75em, author))
]
// Contact information.
pad(
top: 0.05em,
bottom: 0.05em,
x: 1em,
align(center)[
#grid(
columns: 4,
gutter: 0.5em,
..contacts
)
],
)
// Main body.
set par(justify: true)
body
}
#let icon(name, baseline: 1.5pt) = {
box(
baseline: baseline,
height: 10pt,
image(name)
)
}
#let exp(place, title, location, time, details) = {
pad(
bottom: 010%,
grid(
columns: (auto, 1fr),
align(left)[
*#place* \
#emph[#title]
],
align(right)[
#location \
#time
]
)
)
details
}
#let codeText(textStr) = {
text(blue)[*#textStr*]
}
#let codeInline(textStr) = {
emph(text(rgb("#F7743C"))[*#textStr*])
}
|
https://github.com/liamrosenfeld/resume | https://raw.githubusercontent.com/liamrosenfeld/resume/main/template.typ | typst | #let resume(name: "", contactInfo: (), body) = {
set text(font: "New Computer Modern", lang: "en")
set document(author: name, title: name + "'s Resume")
set page("us-letter", margin: (x: 0.5in, y: 0.5in))
set text(9.5pt)
set list(indent: 7pt)
show heading.where(level: 1): it => text(16pt, weight: "bold", it.body)
show heading.where(level: 2): it => block[
#text(9.5pt, weight: "bold", upper(it.body))
#v(weak: true, 5pt)
#line(length: 100%, stroke: 0.4pt)
]
set align(center)
heading(name)
v(weak: true, 8pt)
stack(dir: ltr, spacing: 5pt,
for (idx, info) in contactInfo.enumerate() [
#info
#if idx + 1 != contactInfo.len() {
"⋄"
}
]
)
set align(left)
body
}
#let skillsTable(content: ()) = {
grid(
columns: (80pt, auto),
row-gutter: 5pt,
..content
)
}
#let workItem(role: "", company: "", when: "", description: []) = {
strong(role)
h(1fr)
when
linebreak()
v(weak: true, 5pt)
company
linebreak()
description
}
#let projectItem(name: "", when: "", writeup: [], description: [], isDigital: true) = {
strong(name)
h(6pt)
when
if isDigital [
#h(1fr)
#writeup
]
linebreak()
description
}
|
|
https://github.com/Mc-Zen/zero | https://raw.githubusercontent.com/Mc-Zen/zero/main/tests/num/test.typ | typst | MIT License | #import "/src/zero.typ": *
#set page(width: auto, height: auto, margin: .5em)
#table(
columns: 6,
[`num`], num[12.0], num[-2e3], num[0,222], num("2.2+-0.2"), num("2.2+-0.2e1"),
[Ref], $12.0$, $-2 times 10^3$, $0.222$, $2.2 plus.minus 0.2$, $(2.2 plus.minus 0.2) times 10^1$,
)
#pagebreak()
// input formats
#num[-2.23] \
#num(-2.23) \
#num("-2.23") \
#pagebreak()
// querbeet
#num("0") \
#num("-0") \
#num("45") \
#num(".23") \
#num("1.0") \
#num(".00002") \
#num("2e4") \
#num("-3.1e-1") \
#num("-3.1+-1.1") \
#num("2+-1e1") \
#pagebreak()
// tight
#let tnum = num.with(tight: true)
#let examples = ("12.2", "2+-3", "4e2", "-2+-1e1")
#table(
columns: 2, stroke: none,
[`tight: false`], [`tight: true`],
..array.zip(examples.map(num),examples.map(tnum)).flatten()
)
#pagebreak()
// decimal separator (in- and output)
#num("1.2+-,1") #num("1,2+-.9") \
#num("2e1.2") #num("2e1,2")
#set-num(decimal-separator: ",")
#num("1.2+-,1") #num("1,2+-.9") \
#num("2e1.2") #num("2e1,2")
#set-num(decimal-separator: ".")
#num("1.234", decimal-separator: ",") \
#num("1.234", decimal-separator: "__") \
#pagebreak()
// multiplication symbol
#num("2e9") \
#num("2e9", product: math.dot) \
#set-num(product: math.dot)
#num("2e9") \
#set-num(product: math.times)
#num("2e9") \
#pagebreak()
// unit mantissa
#num("1e9", omit-unity-mantissa: false) \
#num("1e9", omit-unity-mantissa: true) \
#num("2e9", omit-unity-mantissa: true) \
#num("1+-1e9", omit-unity-mantissa: true) \
#num("1", omit-unity-mantissa: true) \
#set-num(omit-unity-mantissa: true)
#num("1e3") \
#set-num(omit-unity-mantissa: false)
#num("1e3") \
#pagebreak()
// implicit plus
#num("1", positive-sign: false)
#num("1", positive-sign: true)
#num("-1", positive-sign: false)
#num("-1", positive-sign: true) \
#set-num(positive-sign: true)
#num("9")
#set-num(positive-sign: false)
#num("9")
#pagebreak()
// implicit plus exponent
#num("1e3", positive-sign-exponent: false)
#num("1e3", positive-sign-exponent: true)
#num("1e-1", positive-sign-exponent: false)
#num("1e-1", positive-sign-exponent: true) \
#set-num(positive-sign-exponent: true)
#num("1e9")
#set-num(positive-sign-exponent: false)
#num("1e9")
#pagebreak()
// power base
#num("1e2", base: 2) \
#num("1e2", base: [e]) \
#num("1e2", base: [π])
#set-num(base: "4")
#num("1e2") \
#set-num(base: 10)
#num("1e2")
#pagebreak()
// uncertainty mode
#let examples = (
"1.7+-.2",
"1.7+-.02",
"1.7+-.28",
"1.7+-2.8",
"1.7(2)",
"1.7(.2)",
"1.7(28)",
"2.2+.2-.5",
"2.2+2-5",
"2.2+2-.5",
"9.99+2-.5"
)
#table(
columns: 3, align: center, stroke: none,
[`separate`], [`compact`], [`compact-separator`],
..array.zip(
examples.map(num.with(uncertainty-mode: "separate")),
examples.map(num.with(uncertainty-mode: "compact")),
examples.map(num.with(uncertainty-mode: "compact-separator")),
).flatten()
)
#pagebreak()
// digit grouping
#num("10.10") \
#num("123.321") \
#num("1234.4321") \
#num("12345.54321") \
#num("1234567") \
#set-group(threshold: calc.inf)
#num("1234567") \
#set-group(threshold: 3)
#num("1234.4321") \
#set-group(separator: "'", size: 2)
#num("12345.54321") \
#set-group(separator: sym.space.thin, size: 3, threshold: 5)
#pagebreak()
// rounding
#num("1.234") \
#set-round(mode: "places", precision: 2)
#num("1.234") \
#num("1.236") \
#set-round(pad: false)
#num("1.1") \
#set-round(pad: true)
#num("1.1") \
#set-round(direction: "down")
#num("1.199") \
#set-round(direction: "up")
#num("1.192") \
#num("1.190") \
#set-round(direction: "nearest")
#set-round(mode: "figures", precision: 2)
#num("1.27") \
#num("0.00001227") \
#num("9876") \
#num("9976") \
#set-round(mode: "uncertainty", precision: 1)
#num("1.234(34)") \
#num("8.8+-2") \
#set-round(mode: none)
#num("1.234")
#pagebreak()
// digits
#num("1.234", digits: 2) \
#num("1.2", digits: 2)
#pagebreak()
// fixed exponent
#num("1.234", fixed: -2) \
#num("1.234", fixed: 1) \
#num("1e4", fixed: 1) \
#num("1e-4", fixed: -1) \
#pagebreak()
// combine positive-sign and omit-unity-mantissa
#num("1e3", positive-sign: true, omit-unity-mantissa: true) \
#num("-1e3", positive-sign: true, omit-unity-mantissa: true) \
// combine "compact" and exponential
#num("2.1+-.2e1", uncertainty-mode: "compact") \
#num("2.1+.2-.2e1", uncertainty-mode: "separate")
#pagebreak()
// content input
#num[.1]
#num[,1]
#num[2e-1,2]
#pagebreak()
// Mode math: false
#[
#show math.equation: set text(2pt)
#num(math: false)[2,3]
]
#pagebreak()
// num with manual state
#[
#let state = default-state
#{state.decimal-separator = ","}
#let num = num.with(state: state)
#num[2.34]
] |
https://github.com/francescoo22/LCD-exercises | https://raw.githubusercontent.com/francescoo22/LCD-exercises/main/src/encoding.typ | typst | #import "common.typ": *
== Encoding
Let $e : CCS_seq -> CCS$
The encoding of a $CCS_seq$ process $P$ is $e(P) without {nu}$
Note: $nu, nu'$ are channels that does not appear in $P$
#list(
tight: false,
spacing: 2em,
$e(0) = nu . 0$,
$e(alpha . P) = alpha . e(P)$,
$e(K) = K_e, space K_e def e(P) fi K def P$,
$e(P | Q) = (e(P)[nu'/nu] | e(Q)[nu'/nu] | overline(nu') . overline(nu') . nu . 0) wnup$,
$e(sum_(j in J, J != emptyset) alpha_j . P_j) = sum_(j in J, J != emptyset) alpha_j . e(P_j)$,
$e(P[f]) = e(P) [f]$,
$e(P without L) = e(P) without L$,
$e(P; Q) = (e(P)[nu'/nu] | overline(nu') . e(Q)) wnup$
) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.