repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/touying-unistra-pristine/1.0.0/src/colors.typ | typst | Apache License 2.0 | #let white = rgb("#ffffff")
#let black = rgb("#000000")
#let grey = rgb("#696260")
#let maroon = rgb("#B0685F")
#let brown = rgb("#BD6244")
#let orange = rgb("#FF4600")
#let orange-bright = rgb("#FF2015")
#let pink = rgb("#FF1D44")
#let pink-bright = rgb("#FA186E")
#let purple = rgb("#4C2ED6")
#let blue-dark = rgb("#315CDD")
#let blue = rgb("#0095FF")
#let cyan = rgb("#00C1C1")
#let green = rgb("#008A57")
#let yellow = rgb("#FFCD00")
#let yellow-light = rgb("#FFF594")
// ----
#let colorthemes = (
lblue: (blue, cyan),
blue: (blue-dark, cyan),
dblue: (blue-dark, blue),
yellow: (yellow, yellow-light, black),
pink: (pink, pink-bright),
neon: (purple, pink),
mandarine: (orange, brown),
hazy: (maroon, grey),
smoke: (grey, black),
)
// ----
#let link-color = rgb(118, 50, 55) |
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CU/minea/1_generated/00_all/0_vseobecna.typ | typst | #import "../../../all.typ": *
#show: book
= #translation.at("MINEA_OBS")
#include "../0_vseobecna/01_Pan.typ"
#pagebreak()
#include "../0_vseobecna/02_Bohorodicka.typ"
#pagebreak()
#include "../0_vseobecna/03_Kriz.typ"
#pagebreak()
#include "../0_vseobecna/04_Anjeli.typ"
#pagebreak()
#include "../0_vseobecna/05_Predchodca.typ"
#pagebreak()
#include "../0_vseobecna/06_SvatiOtcovia.typ"
#pagebreak()
#include "../0_vseobecna/07_ProrokJeden.typ"
#pagebreak()
#include "../0_vseobecna/08_ApostolJeden.typ"
#pagebreak()
#include "../0_vseobecna/09_ApostolViac.typ"
#pagebreak()
#include "../0_vseobecna/10_SvatitelJeden.typ"
#pagebreak()
#include "../0_vseobecna/11_SvatitelViac.typ"
#pagebreak()
#include "../0_vseobecna/12_PrepodobnyJeden.typ"
#pagebreak()
#include "../0_vseobecna/13_PrepodobnyViac.typ"
#pagebreak()
#include "../0_vseobecna/14_MucenikJeden.typ"
#pagebreak()
#include "../0_vseobecna/15_MucenikViac.typ"
#pagebreak()
#include "../0_vseobecna/16_HieromucenikJeden.typ"
#pagebreak()
#include "../0_vseobecna/17_HieromucenikViac.typ"
#pagebreak()
#include "../0_vseobecna/18_PrepodobnyMucenikJeden.typ"
#pagebreak()
#include "../0_vseobecna/19_PrepodobnyMucenikViac.typ"
#pagebreak()
#include "../0_vseobecna/20_MucenicaJedna.typ"
#pagebreak()
#include "../0_vseobecna/21_MucenicaViac.typ"
#pagebreak()
#include "../0_vseobecna/22_PrepodobnaZenaJedna.typ"
#pagebreak()
#include "../0_vseobecna/23_PrepodobnaZenaViac.typ"
#pagebreak()
#include "../0_vseobecna/24_PrepodobnaMucenicaJedna.typ"
#pagebreak()
#include "../0_vseobecna/25_SpovednikJeden.typ"
#pagebreak()
|
|
https://github.com/roman-vanesyan/cv | https://raw.githubusercontent.com/roman-vanesyan/cv/main/README.md | markdown | MIT License | # Curriculum Vitae

This repository hosts an automated system for generating my CV.
The template, written in Typst, is modular and composed of reusable
components. Feel free to fork it and adapt it to your needs.
The core philosophy of behind this repository is to design the CV structure once
and then use it in an append-only fashion for future updates.
## Release
GitHub Actions automatically schedules a new Release when a tag in the `vx.y.z` format is created.
A special `latest` release always reflects the most recent version of the CV.
## Build
To build the project, you'll need to install [Typst](https://typst.app).
Once installed, use the following command to build:
```
$ typst build cv.typ
```
For continuous building on file changes, use:
```
$ typst watch cv.typ
```
### Nix
For Nix users, the project includes a flake configuration file that provides
two convenient commands:
```
$ cv build
$ cv watch
```
## License
This project is licensed under the MIT License.
|
https://github.com/Area-53-Robotics/53B-Notebook-Over-Under-2023-2024 | https://raw.githubusercontent.com/Area-53-Robotics/53B-Notebook-Over-Under-2023-2024/master/entries/early_season/intake.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/templates/entries.typ": *
#import "/templates/headers.typ": *
#import "/templates/text.typ": *
#create_default_entry(
title: [Building Intake],
date: [September 30th, 2023],
witness: [Juan],
design: [Deb],
content: [
#box_header(
title: [Vertical Intake],
color: purple.lighten(60%)
) \
#entry_text()
#align(center)[
#image("/assets/intakes/intake_drawing.png")
]
In the end, we decided to use the vertical intake with two opposing wheels as our intake. With the new 5.5 watt motors, making this was easier than ever as we could have one motor for each half of the intake, and not have to worry about any complex chain system. The intake is also tensioned inward, so that the acorn inside the intake do not fall out, but the intake still works as the wheels move around the acorn. We also geared the relatively weak 5.5 watt motors up for torque, so that there was no case where the bot didn't have the power to intake an acorn.
#align(center)[
#image("/assets/intakes/roller_intake_complete.jpg")
]
]
) |
https://github.com/Wallbreaker5th/typst-introduction-in-one-page | https://raw.githubusercontent.com/Wallbreaker5th/typst-introduction-in-one-page/master/README.md | markdown | Creative Commons Zero v1.0 Universal | # Typst Introduction in One Page
该文档在一页的篇幅内,简要介绍了 Typst,列举了其一些优势,并展示了其功能。其目的在于快速回答「Typst 是什么」这个问题。

|
https://github.com/MALossov/YunMo_Doc | https://raw.githubusercontent.com/MALossov/YunMo_Doc/main/contents/2BuildUp.typ | typst | Apache License 2.0 | = 系统组成及功能说明
== 整体介绍
根据设计,本组绘制了如下系统框图,并将在之后根据框图进行各部分的详细讲解:
#figure(
image("../images/SystemDiagram_Colord.svg",width: 18cm),
caption: "总体系统框图"
)<系统框图>
可能乍一看这个系统框图会显得比较庞大、难以分辨每一部分,但其实每个部分的功能相当清晰和明确。在接下来的整体说明当中,我将整体介绍使用到的外设和作用。
=== 框图一览
根据如上 @系统框图 ,可以较好地看到我们的系统主要依托FPGA芯片和几个基本的片外外设——其中,外设在框图中的位置为 _FPGA板卡内资源_ 的大框 之外的四个小框,即为:
#figure(
table(
columns: (auto,auto,auto,auto,auto),
[*片外外设名称*],[外部按键输入],[摄像头OV5640],[DRAM芯片],[RTL8201F 百兆网芯片],
[*片内模块对应*],[模式切换],[CMOS摄像头模块],[DDR存储模块],[UDP顶层模块],
[*外设实现功能*],[使用 *单按键* 对于模式进行切换],[配置外部摄像头/转存摄像头捕获数据],[使用DRAM生成视频缓存],[配置以太网向上位机发送],
[*代码中模块名称*],[module_shift],[cmos_8_16bit#linebreak()和i2c_config],[DDR3_Memory\_#linebreak()Interface_Top_inst],[udp_top],
),
caption: "片外外设和对应接口模块一览"
)<外设一览表>
==== 主要外设
根据@外设一览表 所示, 面对各个外设、FPGA板卡主要完成的任务大略如下:
+ *外部按键输入*:通过常用的按键滤波、消抖操作,实现使用单键切换状态、及时进入下一状态的操作。
+ *摄像头OV5640*: 本次我们使用CMOS芯片 _OV5640_ 作为采集视频信号的摄像头芯片,其拥有SCCB接口和DVP接口提供配置和数据传输。
+ *DRAM芯片*: 本次使用的底板中,拥有一块DDR3的DRAM,结合高云提供的 _Video_Frame_Buffer_ 软核,构建一个含有3帧的视频缓存。使用近似于VGA标准的同步信号进行数据的传输,用于接收并行视频输入数据,然后缓存至存储器,并同时输出并行视频数据,从而实现帧缓存的功能。@gowin_2023_gowin
+ *RTL8201F*: 使用底板提供的 _RTL8201F_ 百兆以太网芯片,用于实现物理层的接口转换和信号调理。它支持10/100M自适应以太网速率,并具备自动协商功能,能够根据连接的设备自动选择最佳的速率。该芯片通过提供标准的MII(介质独立接口)和RMII(简化的介质独立接口)接口,与主控芯片(如单片机)进行通信。@_2023_phyrtl8201fcsdn\
==== 外设实物图
综合本次外设和实际应用情况,我们在这里给出实物图、并标注了如上四个外设所在的位置如 :@主要功能外设标注
#figure(
image("../images/BOARD_LOOKING_DOWN_Writed.png",width: 18cm,),
caption: "主要功能外设标注"
)<主要功能外设标注>
=== 内部模块
由于熟练使用外设即可完成大部分基础功能,内部模块的撰写主要作用为: *增强* 和 *融合*。
在连接部分当中,一般情况下,多为外部外设/软核的输出的位宽不一致、因此会采取FIFO等方式、重新设计数据位宽度、让生成与等待异步的数据能够被较好地放入另一个时钟当中。因此、这一部分由于出现在两个外设支持模块相互连接的地方、故被不再被单独列出。
而在增强部分中,我们主要只考虑 *视频处理模块*:在这一部分中,我们会进行需要进行的工作,完成如 @VIP模块功能 所示的全部功能,
#figure(
table(columns:(auto,auto,auto,auto),
[*功能名称*],[灰度处理],[二值化],[边缘检测]),
caption: "视频处理模块功能"
)<VIP模块功能>
==== 视频上位机模块
为实现功能,我们构建了如@上位机 所示的上位机模块:
#figure(
image("../images/上位机.png",height: 8cm),
caption: "MOS法师上位机软件"
)<上位机>
在这个上位机中,能够通过较为简单地调节左侧的各项设置进行接收模式的修改,
同时在软件的下方,也具有较为简洁明了的帧率指示、分辨率指示。
上位机使用的接收UDP数据格式为:
+ *帧头*:如果该次发送为首次发送,则会十六进制发送`0xf05aa50f`四个字节,进行表示:这个UDP报文为需要被上位机解析的报文。而上位机也会继续解析余下这一帧的全部报文。
+ *分辨率信息*:如果该次发送为首次发送,则会接着帧头按照16进制转换发送分辨率信息$640 times 480$,表示本帧的分辨率。
+ *帧内容*:以太网会按照行内容发送帧内容,每行的长度为 $640$ 个标准 RGB5-6-5的数据。
因此,如果是首行,则会发送长度为:1288的数据,如果是后续的`479`行,则会发送数据长度为1280的数据、因为少了一个分辨率的信息。可以使用`Wireshark` 软件进行以太帧的捕获,UDP报文情况详见@以太网抓帧:
#figure(
image("../images/UDP_Wiresharked.png",width: 15cm),
caption: "以太网抓帧UDP报文表"
)<以太网抓帧>
== 各模块介绍
=== UDP模块
udp_top模块是一个多功能的数字系统,涵盖了时钟管理、数据缓冲和以太网通信功能。
首先我们来看它的物理接口:在以太网芯片当中,用以连接以太网MAC层和PHY芯片的常用接口有:MII、RMII、SMII、GMII、RGMII。@_19
在本次UDP的实验当中、我们使用的芯片 _RTL8201F_ 使用的是以太网当中的RMII接口, @RMII物理接口示意 为 RMII 接口连接示意图。
#figure(
image("../images/RMII_PHY.png",width:6.9cm),
caption: "RMII物理接口示意"
)<RMII物理接口示意>
可以从 @RMII物理接口示意 当中看出,RMII 只需 7 根通信,在功能上却能够与MII是相同的。因此,我们构建如下的硬件框图结构@UDP模块框图 让RMII能够发送UDP报文:
#figure(
image("../images/STATE.png"),
caption: "UDP模块框图"
)<UDP模块框图>
可以看到,RMII模块的主要工作有两个:
+ *控制UDP通信:* 其中,通信的UDP部分使用RMII转GMII的模块进行完成——原因在于GMII拥有8条并行数据线,而RMII只有两条。使用GMII数据线转RMII可以有效地减少发送需要的时钟周期,在PLL时钟较低的同时就能够达到较高的发送速率。
+ *管理RMII状态*: 向其他上游逻辑模块,如控制FIFO的状态机@UDP模块状态转移图 进行状态汇报,管理状态。
#figure(
image("../images/UDP_STATE.png",width: 9cm),
caption: "UDP模块状态转移图"
)<UDP模块状态转移图>
在状态转移中可以看到,在发送时,主要在`数据发送`状态会从FIFO当中获取来自IP核缓存的以太网信息。
- 而在 *头一帧* 当中,则会在几个状态之中,发送此帧需要的各种帧头信息。
- 在其他帧当中,则会在等待时钟对齐之后,直接将数据发送到UDP模块当中。
_注意:_ 进入到Idle状态的条件为:当从RMII模块传回的信息表示RMII不忙碌时。
=== CMOS图像收集模块
在CMOS模块当中,我们使用OV5640作为CMOS,其上有两种总线接口,作用如下:
- *SCCB接口* :时序上和 $I^2 C$接口一致,作用为配置 _OV5640_ 芯片的相关功能即向摄像头寄存器写入对应指令。由于需要配置较多寄存器,对于OV5640摄像头具体配置信息,这里不再列举,具体的有,比如:修改输出图像的格式、画幅等。
- *DVP接口* : DVP(Digital Video Port)是非差分信号的并口传输,在本次实验当中、数据位为有8bit,是。在配置寄存器之后,按照较为标准的VGA时序等进行发送、并使用同步信号等判断是否已经接收完成一帧。@_2020_cmos
#figure(
image("../images/cmos_i2c.svg",width: 12cm),
caption: "CMOS配置和数据传输框图"
)<CMOS配置和数据传输框图>
由于这里DVP使用的位宽为硬件限制的8位,而如果使用高云的硬核作为视频缓存Buffer,则至少需要使用16bit的数据位宽。因此需要使用 *数据位转换* 模块让数据能够进入缓存。
=== 图像存储/数据流转移模块
#figure(
image("../images/Memory_IP.svg",width: 7cm),
caption: "存储模块系统框图"
)<存储模块系统框图>
输入行缓存控制电路接收并行视频输入数据,然后缓存到输入 FIFO 行
缓存中。当 FIFO 中数据存储到预先设定的阈值时,就向仲裁控制器发出写
请求。当仲裁控制器响应请求,给与存储器控制权,则开始发送写数据,地
址和命令。@gowin_2023_gowin
=== 图像处理模块
#figure(
image("../images/vip.svg",height: 8cm),
caption:"图像数据处理模块"
)<图像数据处理模块>
==== 二值化部分
*图像二值化* 是将像素点的灰度值设为最大(白色)或最小(黑色),以显示明显的黑白效果。以8bit灰度图像为例,二值化通过选取阈值将亮度高于阈值的像素点设为白色(255),低于阈值的设为黑色(0),突出图像的特征。@_2020_fpgaov5640
二值化的实现方法有两种:手动指定阈值和自适应阈值(如OTSU算法)。手动方法计算量小,速度快但适用性有限;自适应方法适用性强,能清晰显示图像轮廓,但计算更复杂。 *本作品采用手动阈值方法* ,适用于特定物体与背景灰度差异显著的情况。
在本次作品当中,我们使用OV5640摄像头采集RGB565数据,转化为Ycbcr格式后进行二值化。
其模块连接如@VIP内部连接图 所示:
#figure(
image("../images/IN_VIP.png",width: 12cm),
caption: "VIP内部连接图"
)<VIP内部连接图>
在对于二值化图像的发送中,并没有刻意对图像进行压缩,这也降低了误码对于发送的影响。虽然同时也较为浪费带宽。
==== 边缘检测部分
在边缘检测部分,主要依托于二值化打下的二值化图像的基础进行处理,根据连接图 @VIP内部连接图 可以看出,在二值化后,图像会先进入一个中值滤波,随后进入SOBEL边缘检测算法模块,进行边缘检测的计算。
SOBEL算法的实现可见@SOBEL ,中值滤波的实现可见 。这里放入附录当中。
=== 模式切换模块
在模式切换模块当中,我们主要使用按键信号作为状态信号切换的标志,其实现也较为简单,只要通过对于下降沿的检测、简单滤波,判断是否释放即可实现。
在状态切换之后,直接输出选择需要输出的信号即可。
#figure(
image("../images/module_shift.svg",width: 12cm),
caption: "模式切换模块框图"
)<模式切换模块框图>
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/text/fallback.typ | typst | Apache License 2.0 | // Test font fallback.
---
// Font fallback for emoji.
A😀B
// Font fallback for entire text.
دع النص يمطر عليك
// Font fallback in right-to-left text.
ب🐈😀سم
// Multi-layer font fallback.
Aب😀🏞سمB
// Font fallback with composed emojis and multiple fonts.
01️⃣2
// Tofus are rendered with the first font.
A🐈ዲሞB
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/page-binding_05.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
//
// // Error: 20-23 must be `left` or `right`
// #set page(binding: top) |
https://github.com/jamesrswift/pixel-pipeline | https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/tests/preamble.typ | typst | The Unlicense | #import "../src/lib.typ" as pixel
|
https://github.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024 | https://raw.githubusercontent.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024/master/Vex%20Robotics%2053A%20Notebook%202023%20-%202024/main.typ | typst | #set page(paper: "a4")
#set page(margin: (
top: 1in,
bottom: 3.5cm,
x: 1.5cm,
))
#show heading.where(level: 1): set text(size: 25pt)
#show heading.where(level: 1): set align(center)
//#show heading.where(level: 2): h2text => {
// rect(fill: rgb("#33ff74"),h2text,
// radius: 5pt,
// outset: 2pt)
//
#show heading.where(level: 2): set text(size: 18pt)
#show heading.where(level: 2): set align(left)
//#show heading.where(level: 3): h3text => {
// rect(fill: rgb("#99ffb9"),h3text,
// radius: 5pt,
//)
//}
#show heading.where(level: 3): set text(size: 14pt)
#show heading.where(level: 3): set align(left)
#show heading.where(level: 4): set text(size: 12pt)
#show heading.where(level: 4): set align(left)
#set text(
font: "Fira Sans",
size: 12pt,
)
#show emph: it => {
text(rgb("08C629"), it.body)
}
/*
= How to use headers:
= header 1(the biggest one)
== header 2 (middle)
=== header 3 (smallest)
*/
#include "Entries/Misc. Entry/Digital-Notebook.typ"
#pagebreak()
#include "Entries/Build Entry/Intake-Sleds-Battery-Mount.typ"
#pagebreak()
#include "Entries/Code Entry/Catapult-Code-Testing.typ"
#pagebreak()
#include "Entries/Tournament Entry/Dulaney-Royal-Rumble.typ"
#pagebreak()
#include "Entries/Misc. Entry/Scrum-Master-Evaluation.typ"
#pagebreak()
#include "Entries/Build Entry/Catapult-Intake-Brainstorm.typ"
#pagebreak()
#include "Entries/Build Entry/Catapult-Assembly.typ"
#pagebreak()
#include "Entries/Build Entry/Intake-4-Testing-Drivetrain-Bracing-LED-Code.typ"
#pagebreak()
#include "Entries/Build Entry/Catapult-Testing-Auton-Testing.typ"
#pagebreak()
#include "Entries/Code Entry/Autonomous-Testing.typ" |
|
https://github.com/AxiomOfChoices/Typst | https://raw.githubusercontent.com/AxiomOfChoices/Typst/master/Research/Summer%202024/Li-Guan%20flow/calculations.typ | typst | #import "/Templates/generic.typ": latex
#import "/Templates/notes.typ": chapter_heading
#import "@preview/ctheorems:1.1.0": *
#import "/Templates/math.typ": *
#show: latex
#show: chapter_heading
#show: thmrules
#show: symbol_replacing
#show: equation_references
= Guan-Li flow
== Setup
We are living in the manifold $N^(n+1) = HH^(n+1)$ which is characterized by its sectional curvatures
$
kappa(X,Y) = -1
$
for all orthonormal vectors $X,Y$.
Now since it is a space-form we have a nice form for the Riemann tensor, namely
$
R(X,Y,Z,W)
=
ip(X,Z)ip(Y,W) - ip(X,W)ip(Y,Z)
$
And thus also
$
Ric(X,Y)
&=
R(e_i,X,Y,e_i)
= ip(e_i, Y) ip(X,e_i) - ip(e_i,e_i) ip(X,Y)
\ &= ip(X,Y) - (n+1)ip(X,Y) = - n ip(X,Y).
$
$
R(e_i, X, Y, e_i)
$
We fix a CKV $X$ induced by the warped product structure $g = d r^2 + sinh(r)^2 d s^2$ giving us a Conformal Factor of $phi = 2 cosh(r)$. We record for later some info about $phi$.
#proposition[
+ $nabla phi = 2 X$.
+ $laplace phi = (n+1) phi$.
]<prop-phi_identities>
We will follow the evolution of a hyper-surface $M$ which is 1-convex as well as star-shaped with respect to $X$, that is the support function $u := ip(X,nu)$ is positive everywhere on $M$. It will evolve under the speed function
$
f := phi / H - u / n.
$
We will hence forth refer to all geometric quantities on $N$ with an overline to distinguish them from their counterparts on $M$. We will also use $pi$ to refer to the projection map onto the tangent plane of $M$.
We recall the known identity
#lemma("Codazzi equations")[
Let $h$ be the second fundamental form of $M$ then
$
ov(R)(X,Y,Z,nu) = - (nabla_X h) (Y,Z) + (nabla_Y h) (X,Z)
$
]
== Calculations
We will use the Parabolic operator
$
L = diff_t - phi/H^2 laplace.
$
We can check by manual calculations that
#proposition[
$
(nabla u)^j = h^j_i pi(X)^i
\ laplace u = - n nu(phi) + u n + ip(nabla H, X) + phi H - |A|^2u
$
]<prop-u_laplace>
We then compute
#proposition[
$
diff_t u = phi^2/H - (u phi)/n - 2 norm(pi(X))^2/H + (phi ip(X, nabla H))/H^2 + h_(i j) pi(X)^i pi(X)^j
$
]
#proof[
$
diff_t u
& = diff_t ip(X, nu)
= ip(diff_t X, nu)
+ ip(X, diff_t nu)
= ip(f ov(nabla)_nu X, nu)
+ ip(X, - nabla f)
\ &= ip(f ov(nabla)_nu X, nu)
+ ip(X, - nabla f)
= (phi/H - u/n) phi - ip(X, nabla (phi/H - u/n))
\ & = phi^2/H - (u phi)/n - ip(X, (nabla phi)/H - phi/H^2 nabla H - (nabla u)/n)
\ & = phi^2/H - (u phi)/n - ip(X, pi(2 X)/H - phi/H^2 nabla H - (h^j_i pi(X)^i)/n)
\ & = phi^2/H - (u phi)/n - 2 (||pi(X)||^2)/H + (phi ip(X, nabla H))/H^2 + h_(i j) pi(X)^i pi(X)^j
$
]
now using @prop-u_laplace we get
$
L u &= col(phi^2/H, #yellow) - (u phi)/n - 2 (||pi(X)||^2)/H + col((phi ip(X, nabla H))/H^2, #red) + h_(i j) pi(X)^i pi(X)^j
\ &- phi/H^2 (- n nu(phi) + u n + col(ip(nabla H, X), #red) + col(phi H, #yellow) - |A|^2u)
\ & = - (u phi)/n - 2 (||pi(X)||^2)/H + h_(i j) pi(X)^i pi(X)^j
+(phi n nu(phi))/H^2 - (phi u n)/H^2 + (phi|A|^2u)/H^2
$
Now recall that since $pi(X)$ is an orthogonal projection then we can decompose the norm of $X$ as
$
||X||^2 = ||pi(X)||^2 + ||ip(X, nu) nu||^2 = ||pi(X)||^2 + u^2
$
plugging this in we get
$
L u = - (u phi)/n - 2(||X||^2 - u^2)/H + h_(i j) pi(X)^i pi(X)^j + (phi n ip(nu, ov(nabla) phi))/H^2 - (phi u n)/(H^2) + (phi|A|^2u)/H^2.
$
Now combining the first and last term we get using @prop-eigenvalue_identity
$
phi u ((|A|^2)/(H^2) - 1/n) = (phi u(sum_(i < j)(kappa_i - kappa_j)^2))/(H^2 n),
$
we will drop the sum for clarity.
We now keep computing
$
L u &= (phi u(kappa_i - kappa_j)^2)/(H^2 n) - (u phi)/n - 2(||X||^2 - u^2)/H + h_(i j) pi(X)^i pi(X)^j + (phi n ip(nu, ov(nabla) phi))/H^2 - (phi u n)/(H^2)
$
We will now define the auxiliary function $Theta := 1 - u^2/(||X||^2)$, note that $Theta = 0$ when $X$ is parallel to $nu$ or equivalently $pi(X) = 0$. Then we further simplify the above to get
$
L u &= (phi u(kappa_i - kappa_j)^2)/(H^2 n) - (u phi)/n - (2 Theta norm(X)^2)/(H) + h_(i j) pi(X)^i pi(X)^j + (phi n ip(nu, ov(nabla) phi))/H^2 - (phi u n)/(H^2)
\ & = (phi u(kappa_i - kappa_j)^2)/(H^2 n) - (u phi)/n - (2 Theta sinh^2(r))/(H) + h_(i j) pi(X)^i pi(X)^j + (phi n ip(nu, 2 X)/H^2 - (phi u n)/(H^2))
\ & = (phi u(kappa_i - kappa_j)^2)/(H^2 n) - (u phi)/n - (2 Theta sinh^2(r))/(H) + h_(i j) pi(X)^i pi(X)^j + (phi n u)/H^2.
$
Now assume that we are at a minimum point of $u$, then $nabla u = h^i_j pi(X)^j = 0$ and so we have two cases.
+ $pi(X)$ is zero, then $Theta = 0$ and so we are left with #h(1fr)
$
L u = phi u (((kappa_i - kappa_j)^2)/(H^2 n) - 1/n + (n)/H^2)
= (phi u)/(H^2 n) ((kappa_i - kappa_j)^2 + n^2 - H^2)
$
Here in order for $u$ to decrease we must have $H$ be quite larger (at least larger than $n$) but also $(kappa_i - kappa_j)^2$ should remain quite small compared to $H$. I feel like this should be impossible due but cannot find a contradiction just yet.
+ $pi(X)$ is not zero but it is in the nullspace of $h^i_j$, this means that $h^i_j$ has at least one zero eigenvalue, hence we can estimate the first term. Since $(lambda_i - lambda_j)^2 >= (H/n - lambda_1)^2$ where $lambda_1$ is the smallest eigenvalue, then we have $(lambda_i - lambda_j)^2 >= (H/n)^2$. This then gives us
$
L u >= phi u /n^3 - u phi/n - (2 Theta sinh^2(r))/(H) + (phi n u)/(H^2)
$
so we are actually even in worse shape than the first case. We have an extra negative term to deal with which doesn't even include $u$.
Next let us check the evolution equation for $H$.
Recall the known evolution equation for $H$
#proposition[
The evolution equation for $H$ under flow with velocity $f$ is
$
diff_t H = - Delta f - f (abs(A)^2 + ov(Ric)(nu,nu))
$
]
Plugging in our speed function and Ricci curvature we get
#proposition[
The evolution equation for $H$ is
]
#proof[
$
diff_t H &= - Delta (phi/H - u/n) - (phi/H - u/n) (abs(A)^2 + ov(Ric)(nu,nu))
\ & = - nabla_i nabla_i (phi/H - u/n) - (phi/H - u/n) (abs(A)^2 - n)
\ & = - nabla_i ((nabla_i phi)/H - phi/H^2 nabla_i H - (nabla_i u)/n) - phi/H (abs(A)^2 - n) + u/n (abs(A)^2 - n)
\ & = - ((Delta phi)/H - 2 ip(nabla phi, nabla H)/H^2 + 2 phi/H^3 abs(nabla H)^2 - phi/H^2 Delta H - (Delta u)/n)
\ & - phi/H abs(A)^2 + (phi n)/H + (u abs(A)^2)/n - u
$
Now due to @prop-phi_identities can simplify the first term and using @prop-u_laplace we can simplify the fifth term, this gives us
$
diff_t H & = - col(((n+1) phi)/H,#green) + 4 ip(X, nabla H)/H^2 - 2 phi/H^3 abs(nabla H)^2 + phi/H^2 Delta H
\ & + (- n nu(phi) + col(u n, #red) + ip(nabla H, X) + phi H - col(abs(A)^2u, #yellow))/n - phi/H abs(A)^2 + col((phi n)/H,#green) + col((u abs(A)^2)/n,#yellow) - col(u, #red)
\ diff_t H - phi/H^2 Delta H & = (phi H)/n - phi/H + 4 ip(X, nabla H)/H^2 + ip(nabla H, X)/n - 2 phi/H^3 abs(nabla H)^2 - 2u - phi/H abs(A)^2
\ L H & = phi /(H n) (H^2 - n abs(A)^2 - n) + 4 ip(X, nabla H)/H^2 + ip(nabla H, X)/n - 2 phi/H^3 abs(nabla H)^2 - 2u
$
Hence at a minimum point we have
$
L H = phi/(H n) (H^2 - n abs(A)^2 - n) - 2u
$
]
Let us also find the evolution equation for the Auxiliary function $Theta$, we recall that $ Theta = 1 - u^2/norm(X)^2. $
We now compute
$
diff_t Theta &= - diff_t (u^2)/norm(X)^2 = - (2 u)/norm(X)^2 diff_t u + u^2/norm(X)^4 diff_t ip(X,X)
\ & = - (2 u)/norm(X)^2 (phi^2/H - (u phi)/n - 2 (||pi(X)||^2)/H + (phi ip(X, nabla H))/H^2 + h_(i j) pi(X)^i pi(X)^j) \ & + u^2/norm(X)^4 (phi/H - u/n) ip(nabla_nu X,X)
\ & = - (2 u phi^2)/(H norm(X)^2) + (2 u^2 phi)/(n norm(X)^2) + (4 u norm(pi(X))^2)/(H norm(X)^2) - (2 u phi ip(X, nabla H))/(H^2 norm(X)^2) - (2 u h_(i j) pi(X)^i pi(X)^j)/(norm(X)^2) \ & + (phi^2 u^3)/(H norm(X)^4) - (phi u^4)/(norm(X)^4 n)
$
We also compute
= Appendix
== Eigenvalues
#proposition[
Let $M$ be any diagonalizable matrix with eigenvalues $lambda_1, ..., lambda_n$, and let $T$ be its trace and $|M|^2$ its squared norm, then
$
n|M|^2 - T^2 = sum_(i < j) (lambda_i - lambda_j)^2
$
]<prop-eigenvalue_identity>
#proof[
We decompose the right hand sum
$
sum_(i < j) (lambda_i - lambda_j)^2
&=
sum_(i) (n-1) lambda_i^2 - 2 sum_(i < j) lambda_i lambda_j
\ &=
n sum_(i) lambda_i^2 - (sum_(i) lambda_i^2 + 2 sum_(i < j) lambda_i lambda_j)
\ & =
n sum_(i) lambda_i^2 - (sum_(i) lambda_i)^2
\ & =
n|M|^2 - T^2
$
]
|
|
https://github.com/darioglasl/Arbeiten-Vorlage-Typst | https://raw.githubusercontent.com/darioglasl/Arbeiten-Vorlage-Typst/main/Anhang/00_index.typ | typst | #heading(level: 1, [Anhang])
Im Anhang befinden sich alle Dokumente, die für das Verständnis der Arbeit nicht zwingend notwendig sind, aber dennoch einen Mehrwert bieten und für die Studienarbeit teils zwingend vorhanden sein müssen. Dazu gehören unter anderem das persönliche Fazit der Autoren, die Projektplanung, die Projektdokumentation, die offenen Jira-Issues und die Modulbeschreibung der Studienarbeit.
#set heading(supplement: [Anhang Abschnitt])
#set figure(outlined: false, numbering: none)
#pagebreak()
#include "01_Fazit/00_index.typ"
#pagebreak()
#include "02_Implementations_Details/00_index.typ"
#pagebreak()
#include "03_Projektplan/00_index.typ"
#pagebreak()
#include "04_Projektdokumentation/00_index.typ"
#pagebreak()
#include "05_Modulbeschreibung/00_index.typ"
#pagebreak()
#include "06_Jira/00_index.typ"
|
|
https://github.com/typst/typst-dev-assets | https://raw.githubusercontent.com/typst/typst-dev-assets/main/README.md | markdown | Apache License 2.0 | # typst-dev-assets
A crate with bundled assets for testing & docs generation of the Typst compiler.
|
https://github.com/Champitoad/typst-slides | https://raw.githubusercontent.com/Champitoad/typst-slides/main/utils.typ | typst | Creative Commons Zero v1.0 Universal | // Unit constructors
#let cm(x) = x * 1cm
#let rad(x) = x * 1rad
// Default getter for dictionary fields
#let mget(dict, field, default) = {
dict.at(field, default: default)
}
// Shift a point represented by its coordinates in a dictionary (x: float, y: float)
// by the amount of a vector also specified by its coordinates
#let shift(point, vec) = (
x: point.x + vec.x,
y: point.y + vec.y
)
// Add horizontal space around operator
#let spar(op, spacing: 2em) = {
h(spacing)
op
h(spacing)
}
// Additional info on right of slide title
#let title-right(content) = {
place(right, dy: -3mm, content)
}
// Highlight alert
#let halert(content) = {
block(fill: rgb("#ec8d33").transparentize(75%), outset: 8pt, content)
}
// Phantom text, like the \phantom LaTeX macro
#let phantom(txt) = {
text(fill: white.transparentize(100%), txt)
}
// Position content relative to its center instead of top-left corner
#let move_to_center(content) = context {
let content_size = measure(content)
let to_center = (x: -content_size.width / 2, y: -content_size.height / 2)
move(dx: to_center.x, dy: to_center.y, content)
}
#let squareFocus(content) = rect(inset: 15pt, content)
#let centerFocus(content, size: 22pt) = [
#set align(center)
#set text(size)
#v(1em)
#content
#v(1em)
] |
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/046.%20ladder.html.typ | typst | ladder.html
After the Ladder
August 2005Thirty years ago, one was supposed to work one's way up the corporate
ladder. That's less the rule now. Our generation wants to get
paid up front. Instead of developing a product for some big company
in the expectation of getting job security in return, we develop
the product ourselves, in a startup, and sell it to the big company.
At the very least we want options.Among other things, this shift has created the appearance of a rapid
increase in economic inequality. But really the two cases are not
as different as they look in economic statistics.Economic statistics are misleading because they ignore the value
of safe jobs. An easy job from which one can't be fired is worth
money; exchanging the two is one of the commonest forms of
corruption. A sinecure is, in effect, an annuity. Except sinecures
don't appear in economic statistics. If they did, it would be clear
that in practice socialist countries have nontrivial disparities
of wealth, because they usually have a class of powerful bureaucrats
who are paid mostly by seniority and can never be fired.While not a sinecure, a position on the corporate ladder was genuinely
valuable, because big companies tried not to fire people, and
promoted from within based largely on seniority. A position on the
corporate ladder had a value analogous to the "goodwill" that is a
very real element in the valuation of companies. It meant one could
expect future high paying jobs.One of main causes of the decay of the corporate ladder is the trend
for takeovers that began in the 1980s. Why waste your time climbing
a ladder that might disappear before you reach the top?And, by no coincidence, the corporate ladder was one of the reasons
the early corporate raiders were so successful. It's not only
economic statistics that ignore the value of safe jobs. Corporate
balance sheets do too. One reason it was profitable to carve up 1980s
companies and sell them for parts was that they hadn't formally
acknowledged their implicit debt to employees who had done good
work and expected to be rewarded with high-paying executive jobs
when their time came.In the movie Wall Street, <NAME>
ridicules a company overloaded with vice presidents. But the company
may not be as corrupt as it seems; those VPs' cushy jobs were
probably payment for work done earlier.I like the new model better. For one thing, it seems a bad plan
to treat jobs as rewards. Plenty of good engineers got made into
bad managers that way. And the old system meant people had to deal
with a lot more corporate politics, in order to protect the work
they'd invested in a position on the ladder.The big disadvantage of the new system is that it involves more risk. If you develop ideas in a startup instead
of within a big company, any number of random factors could sink
you before you can finish. But maybe the older generation would
laugh at me for saying that the way we do things is riskier. After
all, projects within big companies were always getting cancelled
as a result of arbitrary decisions from higher up. My father's
entire industry (breeder reactors) disappeared that way.For better or worse, the idea of the corporate ladder is probably
gone for good. The new model seems more liquid, and more efficient.
But it is less of a change, financially, than one might think. Our
fathers weren't that stupid.Romanian TranslationJapanese Translation
|
|
https://github.com/mitsuyukiLab/grad_thesis_typst | https://raw.githubusercontent.com/mitsuyukiLab/grad_thesis_typst/main/contents/how_to_use.typ | typst | = 卒論修論フォーマットの使い方 <how_to_use_this_format>
== 図について <about_figure>
=== 一般的な図の記述方法 <how_to_describe_figure_in_general>
図のcaptionは @fig:fig_example のように図の下部につけてください。
図の表題(caption)は英語で書きます。
また、表題の最後にはピリオドを付けて下さい。
図は原則として英語表記としてください。
文字・記号等は十分に判読できる大きさとしてください。
Typstでは、PNG・JPEG・GIF・SVG フォーマットの画像をサポートしています。
画像の中に文字が入っている場合はベクトル形式であるSVGフォーマットを採用することを強く進めます。
#figure(
image("img/example.svg", width: 90%),
placement: none, // top, bottom, auto, none
caption: "Example of a figure.",
supplement: "Fig.",
kind: "image",
) <fig:fig_example>
=== このテンプレートにおける図の記述方法 <how_to_describe_figure_in_this_format>
Typstの文法とこのテンプレートに沿って、図を記述する方法を以下に示します。
`placement` 属性は、位置固定 (`none`) や自動 (`auto`) だけでなく、紙面の上 (`top`) に寄せるか下 (`bottom`) に寄せるかを決められます。いい感じに調整してください。
```typst
#figure(
placement: none, // top, bottom, auto, none
image("img/example.svg", width: 90%),
caption: [Example of a figure.],
supplement: "Fig.", // 図番号の前につける文字列(固定)
kind: "fig", // 図目次作成のためのキーワード(固定)
) <fig:fig_example> // 図の参照用のラベル
```
```typst
図のcaptionは @fig:fig_example のように図の下部につけてください。
```
`supplement`属性と`kind`属性は、このテンプレートにおいてすべて共通です。
書くのを忘れそうなので、注意してください。
== 表について <about_table>
=== 一般的な表の記述方法 <how_to_describe_table_in_general>
表は,@tab:table_example のように表形式で記述します.
表題(caption)は表の上に書きます.
表の表題(caption)は英語で書きます.
また,表題の最後にはピリオドを付けて下さい.
また,表も原則として英語表記としてください.
#figure(
caption: [Example of a table.],
placement: none, // top, bottom, auto, none
table(
columns: 4,
stroke: (x: none),
table.header(
[*Margins*],
[...],
[*Left Column*],
[*Right Column*],
),
row-gutter: (2.2pt, auto),
[Top], [...], [27 mm], [27 mm],
[Left], [...], [16 mm], [107.5 mm],
[Right], [...], [100 mm], [191.5 mm],
[Bottom], [...], [275 mm], [275 mm],
),
supplement: "Table",
kind: "table",
) <tab:table_example>
=== このテンプレートにおける表の記述方法 <how_to_describe_table_in_this_format>
Typstの文法とこのテンプレートに沿って、表を記述する方法を以下に示します。
`placement` 属性は、位置固定 (`none`) や自動 (`auto`) だけでなく、紙面の上 (`top`) に寄せるか下 (`bottom`) に寄せるかを決められます。いい感じに調整してください。
```typst
#figure(
caption: [Example of a table.],
placement: none, // top, bottom, auto, none
table(
columns: 4,
stroke: (x: none),
table.header(
[*Margins*],
[...],
[*Left Column*],
[*Right Column*],
),
row-gutter: (2.2pt, auto),
[Top], [...], [27 mm], [27 mm],
[Left], [...], [16 mm], [107.5 mm],
[Right], [...], [100 mm], [191.5 mm],
[Bottom], [...], [275 mm], [275 mm],
),
supplement: "Table", // 表番号の前につける文字列(固定)
kind: "table", // 表目次作成のためのキーワード(固定)
) <tab:table_example> // 表の参照用のラベル
```
```typst
表は,@tab:table_example のように表形式で記述します.
```
`supplement`属性と`kind`属性は、このテンプレートにおいてすべて共通です。
書くのを忘れそうなので、注意してください。
== 数式について <about_equation>
数式の書き方はTypstのドキュメントを参照してください。数式については、このテンプレート特有のものはありません。
数式番号をつけるような中央揃えの数式は、以下のように記載してください。
例えば,@eq:mmg_example のように記述してください.
$
m(dot(u)-v r) &=-m_x dot(u)+m_y v r+X_H+X_P+X_R \
m(dot(v)+u r) &=-m_y dot(v)+m_x u r+Y_H+Y_R \
I_(z G) dot(r) &=-J_Z dot(r)+N_H+N_R
$ <eq:mmg_example>
```typst
$
m(dot(u)-v r) &=-m_x dot(u)+m_y v r+X_H+X_P+X_R \
m(dot(v)+u r) &=-m_y dot(v)+m_x u r+Y_H+Y_R \
I_(z G) dot(r) &=-J_Z dot(r)+N_H+N_R
$ <eq:mmg_example>
```
```typst
例えば,@eq:mmg_example のように記述してください.
```
また、文中に書く数式は、
例えば,$n_i = sum_(i=1)^(N)(f(r_(i j)))$のように記述してください。
```typst
また、文中に書く数式は、
例えば,$n_i = sum_(i=1)^(N)(f(r_(i j)))$のように記述してください。
```
== 参考文献について <about_reference>
参考文献は、例えば、references.bibにある以下の文献を引用することを考えます。
引用する場合は @visAssessmentApproachesLogistics2016 のように記述してください。
```bib
@article{visAssessmentApproachesLogistics2016,
title = {Assessment Approaches to Logistics for Offshore Wind Energy Installation},
author = {<NAME>. and <NAME>},
year = {2016},
journal = {Sustainable Energy Technologies and Assessments},
volume = {14},
pages = {80--91},
issn = {2213-1388},
langid = {english},
keywords = {Logistics,Offshore installations,Renewable energy sources,Wind energy,Wind farms}
}
```
```typst
引用する場合は @visAssessmentApproachesLogistics2016 のように記述してください。
```
複数の参考文献を扱う場合は、
@visAssessmentApproachesLogistics2016
@anchuanhongjiBoLangZhongniokeruChuannoCaoZongYunDongsimiyuresiyon2006
@aitallaStudyNewInstallation2017
のようになります。
適宜、参考文献を追加してください。
```typst
複数の参考文献を扱う場合は、
@visAssessmentApproachesLogistics2016
@anchuanhongjiBoLangZhongniokeruChuannoCaoZongYunDongsimiyuresiyon2006
@aitallaStudyNewInstallation2017
のようになります。
適宜、参考文献を追加してください。
```
使用してない参考文献は自動的に記載されないようになっているので、とりあえずreference.bibに入れておいて構いません.
通し番号は本文で言及された順になりますがこれも自動的に処理されるので気にしなくて良いです。
|
|
https://github.com/barrel111/readings | https://raw.githubusercontent.com/barrel111/readings/main/problems/online-problems.typ | typst | #import "@local/preamble:0.1.0": *
#import "@preview/fletcher:0.5.0" as fletcher: diagram, node, edge
#show: project.with(
course: "CS",
sem: "Summer",
title: "Online Algorithms",
subtitle: "Problems",
authors: ("<NAME>",),
)
#set enum(indent: 15pt, numbering: "a.")
#let OPT = `OPT`
#let ALG = `ALG`
= Introduction
== Komm 1.1
No, this does not change the analysis. The analysis for the approximation ratio
comes from showing $ALG >= W/2.$ The proposed changes to the algorithm only
incrases the value of $ALG$ for any instance, so this lower bound is still
effective. Furthermore, the family of instances provided to show that $r = 2$ is
tight for the original algorithm also shows that $r = 2$ is tight for this
algorithm.
== Komm 1.2
Consider the following instance on $K_4$.
#align(center)[
#diagram(
node-stroke: black + 0.5pt,
spacing: (14mm, 5mm),
node((0,0), [1], name: <1>), // double stroke
node((1,0), [2], name: <2>),
node((2,0), [3], name: <3>),
node((3,0), [4], name: <4>),
edge(<1>, <2>, "<->", label: "1", label-pos: 0.5),
edge(<2>, <3>, "<->", label: "1", label-pos: 0.5),
edge(<3>, <4>, "<->", label: "1", label-pos: 0.5),
edge(<1>, <3>, "<->", bend:40deg, label: "2"),
edge(<1>, <4>, "<->", bend:50deg, label: $gamma$),
edge(<2>, <4>, "<->", bend:-40deg, label: "2")
)]
Then the approximation ratio is,
$ ALG/OPT = (3 + gamma)/(6) = 1/2 + gamma/6. $
By making $gamma$ arbitrarily large, we may then make the approximation ratio arbitrarily large.
== Komm 1.3
We prove this by induction. Let $P(k)$ be the statement that all edges added in
the first $k$ rounds are in the minimum spanning tree.
|
|
https://github.com/WinstonMDP/math | https://raw.githubusercontent.com/WinstonMDP/math/main/knowledge/matrixes.typ | typst | #import "../cfg.typ": cfg
#show: cfg
= Matrixes
$a_(i j) :=$ the $(i, j)$-th element of the matrix $A$.
$(a_(i j)) := A$.
$A_((i)) :=$ the $i$-th row.
$A^((i)) :=$ the $i$-th column.
$(a_(i j)) + (b_(i j)) := (a_(i j) + b_(i j))$
$lambda (a_(i j)) := (lambda a_(i j))$
A product of a $n times s$ matrix $A$ and a $s times m$ matrix $B :=
n times m thick (sum_(t = 1)^s a_(i t) b_(t j))$.
$Z =
mat(
X_(1 1), ..., X_(1 s);
dots.v, dots.down, dots.v;
X_(n 1), ..., X_(n s);
)
mat(
Y_(1 1), ..., Y_(1 m);
dots.v, dots.down, dots.v;
Y_(s 1), ..., Y_(s m);
) ->
Z_(i j) = sum_(t = 0)^s X_(i t) Y_(t j)$.
A diagonal is main $:=$ it's from the upper-left corner to the lower-right one.
A square matrix of an order $n :=$ a $n times n$ matrix.
A diagonal matrix $:=
"diag"(a_1, ..., a_n) :=$
a square matrix with nonzero elements on the main diagonal and only on it.
An identity matrix $:= E := "diag"(1, ..., 1)$.
$op(L_n) F :=$ a set of square matrixes of the order $n$.
$op(L_n) F$ is an associative algebra with a unit having zero divisors.
A matrix $A = E_(i j) := a_(i j) = delta_(i j)$.
A matrix is scalar $:=$ it $= lambda E$.
$(forall B: A B = B A) <-> A$ is scalar.
$(a_(i j))^T := (a_(j i))$.
$(A B)^T = B^T A^T$.
A matrix $A$ is lower triangular $:= forall i < j: a_(i j) = 0$.
A lower triangular matrix $A$ is strictly lower triangular $:=$
elements on the main diagonal are nonzero.
An elementary transformation is equivalent to a multiplication by corresponding matrix
on the left. So each elementary transformation corresponds to a matrix.
An elementary transformation of type I $:=$ to swap two lines.
To swap the $i$-th and the $j$-th rows $(i != j)$ corresponds to
$E + E_(i j) + E_(j i) - E_(i i) - E_(j j)$.
An elementary transformation of type II $:=$
to add to a row another one multiplied by one.
Add the $i$-th row to the $j$-th one $(i != j)$ multiplied by $lambda$ corresponds to
$E + lambda E_(i j)$.
An elementary transformation of type III $:=$ to multiply a row by a nonzero constant.
To multiply the $i$-th row by nonzero $lambda$ corresponds to
$E + (lambda - 1) E_(i i)$.
Matrixes are equivalent $:=$
one is obtained from the other by elementary transformations.
A rank of a matrix $:=$ a rank of a system of its rows.
A rank of a matrix $=$
a rank of a system of its columns $=
\#$ nonzero rows of an equivalent echelon form.
Linear relationships between matrix columns don't change after elementary
transformations over rows. Unlike rows since their order isn't preserved.
$"rk"(A B) <= min(op("rk") A, op("rk") B)$.
$forall n times s$ matrix $A$ and $s times m$ matrix $B:
op("rk") A + op("rk") B - s <= "rk"(A B)$.
A square matrix $A$ of an order $n$ is nonsingular $:= op("rk") A = n$.
A square matrix $A$ is invertible $<->$ it's nonsingular.
A submatrix of a matrix $A :=$
a matrix obtained by deleting equal $hash$ rows and columns from $A$.
$A^(-1) = ((A_(i j))^T)/(det A)$.
$(A B)^(-1) = B^(-1) A^(-1)$.
A rank $=$ the max order of a nonzero minor.
A minor $M$ is nonzero $->$
each bordering minor of $M$ is zero $->
"rk" =$ an order of $M$.
A minor obtained from linear independent rows and columns is nonzero.
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/linguify/0.3.0/linguify.typ | typst | Apache License 2.0 | // linguify
#let __linguify_lang_preferred = state("linguify-preferred-lang", auto); // auto means detect from context text.lang
#let __linguify_lang_database = state("linguify-database", none); // none or dictionary
#let __linguify_lang_fallback = state("linguify-fallback-lang", auto); // auto means to look in database.
/// wrapper to get linguify database
/// ! needs context
#let linguify_get_database() = {
__linguify_lang_database.get()
}
/// set a data dictionary for linguify database
#let linguify_set_database(data) = {
assert.eq(type(data), dictionary, message: "expected data to be a dictionary, found " + type(data))
__linguify_lang_database.update(data);
}
/// check if database is not empty
/// ! needs context
#let linguify_is_database_initialized() = {
__linguify_lang_database.get() != none
}
/// add data to the current database
#let linguify_add_to_database(data) = {
context {
let database = __linguify_lang_database.get()
for (key,value) in data.pairs() {
database.insert(key, value)
}
__linguify_lang_database.update(database);
}
}
/// set a fallback language
#let linguify_set_fallback_lang(lang) = {
if lang != auto and lang != none {
assert.eq(type(lang), str, message: "expected fallback lang to be a string, found " + type(lang))
}
__linguify_lang_fallback.update(lang)
}
/// set a preferred language.
///
/// ! warning: language from `set text(lang: "de")` is not detected if this is used.
/// you probably want this to stay auto
#let linguify_set_preferred_lang(lang) = {
if lang != auto {
assert.eq(type(lang), str, message: "expected overwrite lang to be a string, found " + type(lang))
}
__linguify_lang_preferred.update(lang);
}
/// update all settings at once
#let linguify_config(data: auto, lang: auto, fallback: auto) = {
// set language data dictionary
if data != auto {
linguify_set_data(data)
}
// set fallback mode.
linguify_set_fallback_lang(fallback)
/// ! warning: language from `set text(lang: "de")` is not detected if this is used.
/// you probably want this to stay auto
linguify_set_preferred_lang(lang)
}
/// Helper function.
/// if the value is auto "ret" is returned else the value self is returned
#let if-auto-then(val,ret) = {
if (val == auto){
ret
} else {
val
}
}
/// fetch the string in the required lang.
#let linguify(key, default: auto, lang: auto) = {
context {
let database = __linguify_lang_database.get()
// check if database is not empty. Means no data dictionary was specified.
assert(database != none, message: "linguify database is empty.")
// get selected language.
let selected_lang = if-auto-then(lang, if-auto-then(__linguify_lang_preferred.get(), text.lang))
let lang_not_found = not selected_lang in database
let fallback_lang = if-auto-then(__linguify_lang_fallback.get(), database.at("default-lang", default: none) )
// if available get the language section from the database if not try to get the fallback_lang entry.
let lang_section = database.at(
selected_lang,
default: if (fallback_lang != none) { database.at(fallback_lang, default: none) } else { none }
)
// if lang_entry exists
if ( lang_section != none ) {
// check if the value exits.
let value = lang_section.at(key, default: none)
if (value == none) {
// info: fallback lang will not be used if given lang section exists but only a key is missing.
// use this for a workaround: linguify("key", default: linguify("key", lang: "en", default: "key"));
if (fallback_lang != none) {
// check if fallback lang exists in database
assert(database.at(fallback_lang, default: none) != none, message: "fallback lang (" + fallback_lang + ") does not exist in linguify database")
// check if key exists in fallback lang.
assert(database.at(fallback_lang).at(key, default: none) != none, message: "key (" + key + ") does not exist in fallback lang section.")
return database.at(fallback_lang).at(key)
}
if (default != auto) {
return default
} else {
if lang_not_found {
panic("Could not find an entry for the key (" + key + ") in the fallback section (" + fallback_lang + ") at the linguify database.")
} else {
panic("Could not find an entry for the key (" + key + ") in the section (" + selected_lang + ") at the linguify database.")
}
}
} else {
return value
}
} else {
if fallback_lang == none or selected_lang == fallback_lang {
panic("Could not find a section for the language (" + selected_lang + ") in the linguify database.")
} else {
panic("Could not find a section for the language (" + selected_lang + ") or fallback language (" + fallback_lang + ") in the linguify database.")
}
}
}
}
|
https://github.com/mem-courses/linear-algebra | https://raw.githubusercontent.com/mem-courses/linear-algebra/main/homework/linear-algebra-homework8.typ | typst | #import "../template.typ": *
#show: project.with(
title: "Linear Algebra Homework #8",
authors: (
(name: "<NAME> (#95)", email: "<EMAIL>", phone: "3230104585"),
),
date: "November 13, 2023",
)
#let alpha = math.bold(math.alpha)
#let beta = math.bold(math.beta)
#let gamma = math.bold(math.gamma)
#let theta = math.bold(math.theta)
#let xi = math.bold(math.xi)
#let ds = math.dots.c
#let TT = math.upright("T")
= P101 习题四 1(2) #ac
#prob[在线性空间 $PP^4$ 中,将向量 $beta=(0,2,0,-1)^TT$ 表示成向量组 $alpha_1=(1,1,1,1)^TT$,$alpha_2=(1,1,1,0)^TT$,$alpha_3=(1,1,0,0)^TT$,$alpha_4=(1,0,0,0)^TT$ 的线性组合:]
$beta = -alpha_1 + alpha_2 + 2 alpha_3 -2 alpha_4$.
= P101 习题四 2 #ac
#prob[设 $bold(A) = display(mat(alpha_1, alpha_2, alpha_3))$ 为三阶矩阵,$beta$ 是一个三元向量.若 $beta=-alpha_1+2alpha_2-2alpha_3$,试给出线性方程组 $bold(A) X=beta$ 的一个解.]
由已知,$display(mat(alpha_1,alpha_2,alpha_3) mat(-1,2,-2)^TT) = beta$,即 $X = display(mat(-1, 2, -2))^TT.$
= P101 习题四 3(3) #ac
#prob[判断向量组的线性相关性:$alpha_1=(2,2,7,-1)^TT$,$alpha_2=(3,-1,2,4)^TT$,$alpha_3=(1,1,3,1)^TT$.]
令 $bold(A) = display(mat(alpha_1,alpha_2,alpha_3)) in PP^(4 times 3)$,其中:
$
r(bold(A)) = r mat(2,3,1;2,-1,1;7,2,3;-1,4,1) = r mat(1,1,3,1;0,-4,-7,1;0,0,-1,1) = 3
$
所以向量组 $alpha_1,alpha_2,alpha_3$ 线性无关.
= P101 习题四 6 #ac
#prob[设 $alpha_1=(1,1,-1,-1)^TT$,$alpha_2=(1,2,0,3)^TT in PP^4$,这里 $PP$ 是一个数域,求两个向量 $alpha_3,alpha_4 in PP^4$ 使得 $alpha_1,alpha_2,alpha_3,alpha_4$ 线性无关.]
取 $alpha_3 = (0,0,1,0)^TT,sp alpha_4 = (0,0,0,1)^TT$,下证明此时四个向量线性无关:
$
r mat(1,1,-1,-1;1,2,0,3;0,0,1,0;0,0,0,1)
= r mat(1,1,-1,-1;0,1,1,4;0,0,1,0;0,0,0,1)
= 4
$
也就是说向量组 $alpha_1,alpha_2,alpha_3,alpha_4$ 线性无关.
= P102 习题四 8 #ac
#prob[
设 $alpha,beta$ 为三元列向量,矩阵 $bold(A) = alpha alpha^TT + beta beta^TT$,其中 $alpha^TT,beta^TT$ 分别是 $alpha,beta$ 的转置,证明:
(1) 秩 $r(bold(A)) <= 2$.
]
由于 $alpha,beta$ 为三元列向量,所以 $bold(A) in PP^(3 times 3)$,即证 $r(bold(A)) < 3$,即证 $bold(A) X = theta$ 有非零解.取 $X = display(mat(x_1,x_2,x_3)^TT)$,考虑线性方程组:
$
cases(
a_1 x_1 + a_2 x_2 + a_3 x_3 = 0,
b_1 x_1 + b_2 x_2 + b_3 x_3 = 0,
)
$
由于方程个数小于变量个数,该方程有无穷多解.其中任取一组非零解作为 $X$,则满足:
$
alpha^TT X = beta^TT X = 0
=>
bold(A) X = (alpha alpha^TT + beta beta^TT) X = 0 dot alpha + 0 dot beta = theta
$
故 $bold(A) X = theta$ 有非零解,即 $r(bold(A)) <= 2$.
#prob[(2) 若 $alpha,beta$ 线性相关,则秩 $r(bold(A))<2$.]
若 $alpha,beta$ 线性相关,则 $exists k != 0 st alpha + k beta = 0$,所以:
$
r(bold(A)) &= r(-k beta (-k beta)^TT + beta beta^TT) = r((k^2 +1) beta beta^TT) = r(beta beta^TT) = mat(b_1 beta, :, b_2 beta,:, b_3 beta)
$
若 $b_1,b_2,b_3$ 不全为零,则一定能找到一列 $b_i!=0$,将其他列用这行消去,可以得到 $r(bold(A)) = r(beta) <= 1$.否则 $bold(A) = bold(O)$,此时 $r(bold(A)) = 0$.
综上所述,$r(bold(A)) < 2$.
#note[实际上,对于列向量 $beta in PP^n$,有 $r(beta beta^TT) = r(beta) <= 1$.]
= P102 习题四 12 #ac
#prob[
已知 $m$ 个向量 $alpha_1,alpha_2,ds,alpha_m$ 线性相关,但其中任意 $m-1$ 个向量都线性无关,证明:
(1) 如果 $c_1 alpha_1 + c_2 alpha_2 + ds + c_m alpha_m = theta$,那么 $c_1,c_2,ds,c_m$ 或全为零或全不为零.
]
如果 $c_1,c_2,ds,c_m$ 中有一个为零且不全为零,不妨设 $c_1=0$ 且 $c_1 alpha_1 + c_2 alpha_2 + ds + c_m alpha_m = theta$.那么 $c_2 alpha_2 + c_3 alpha_3 + ds + c_m alpha_m = theta$,且 $c_2,c_3,ds,c_m$ 中至少有一个不为零.根据定义,向量组 $alpha_2,alpha_3,ds,alpha_m$ 线性相关,与题设矛盾.故 $c_1,c_2,ds,c_m$ 或全为零或全不为零.
#prob[(2) 如果存在等式 $c_1 alpha_1 + c_2 alpha_2 + dot.c + c_m alpha_m = theta$ 及 $d_1 alpha_1 + d_2 alpha_2 + dot.c + d_m alpha_m = theta$ 且 $d_1 != 0$,那么 $display(c_1/d_1 = c_2/d_2 = ds = c_m/d_m)$.]
由 (1) 知,$d_1!=0 => d_i!=0 sp (i=1,2,ds,n)$.若 $c_1=0$,则等式显然成立,下面只需考虑 $c_1!=0$ 的情况.由于向量组 $alpha_1,alpha_2,ds,alpha_m$ 线性相关而向量组 $alpha_2,alpha_3,ds,alpha_m$ 线性无关,$alpha_1$ 可被向量组其余向量唯一线性表示,即对于:
$
alpha_1 &= -1/c_1 (c_2 alpha_2 + c_3 alpha_3 + ds + c_m alpha_m)\
alpha_1 &= -1/d_1 (d_2 alpha_2 + d_3 alpha_3 + ds + d_m alpha_m)\
$
其中 $forall i>1$,$display(c_i/c_1 = d_i/d_1 => c_1/d_1 = c_i/d_i)$.故原命题得证.
= P103 习题四 14 #ac
#prob[
设 $alpha_i = display(mat(a_(i 1), a_(i 2), ds, a_(i s))) in PP^(1 times s) sp (i=1,2,ds,m)$.令
$ beta_i = mat(a_(i 1), a_(i 2), ds, a_(i s), b_(i, s+1), ds, b_( i n)) sp (i = 1,2,ds,m) $
其中 $b_(i j)$ 为 $PP$ 中的数($i=1,2,ds,m,sp j=s+1,ds,n$).
(1) 若 $alpha_1,alpha_2,ds,alpha_m$ 线性无关,问 $beta_1,beta_2,ds,beta_m$ 是否线性无关.
]
正确.下证明逆否命题:若 $beta_1,beta_2,ds,beta_m$ 线性相关,则 $alpha_1,alpha_2,ds,alpha_m$ 必线性相关.
此时必存在一组不全为 $0$ 的 $c_1,c_2,ds,c_m$ 使得 $c_1 beta_1 + c_2 beta_2 + ds + c_m beta_m = theta$.说明对于每一个 $1<=i<=s$,都有 $c_1 a_(1 i) + c_2 a_(2 i) + dots.c c_m a_(m i) = 0$,即 $c_1 alpha_1 + c_2 alpha_2 + ds + c_m alpha_m = theta$.即向量组 $alpha_1,alpha_2,ds,alpha_m$ 线性相关.
故原命题得证.
#prob[
(2) 若 $beta_1,beta_2,ds,beta_m$ 线性无关,问 $alpha_1,alpha_2,ds,alpha_m$ 是否线性无关.
]
错误.考虑反例如下:$
alpha_1 &= mat(1) quad alpha_2 &&= mat(1)\
beta_1 &= mat(1;0) quad beta_2 &&= mat(1;1)\
$
其中 $beta_1,beta_2$ 线性无关,而 $alpha_1,alpha_2$ 线性相关.
= P103 习题四 15 #ac
#prob[判断题,略.]
(1) T
(2) T
(3) F
(4) T
(5) T
(6) F\
(7) F
(8) T
(9) F
(10) T
(11) T
(12) F
= P104 习题四 17 #ac
#prob[选择题,略.]
选 (A) 项.
= P104 习题四 18 #ac
#prob[
设向量组 $alpha = display(mat(1,0,1))^TT,sp alpha_2 = display(mat(0,1,1))^TT, sp alpha_3 = display(mat(1,3,5))^TT$ 不能经向量组 $beta_1 = display(mat(1,1,1))^T,sp beta_2 =$$display(mat(1,2,3))^TT, sp beta_3 = display(mat(3,4,a))^TT$ 线性表示.
(1) 求 $a$ 的值.
]
由已知
$
r mat(alpha_1,:,alpha_2,:,alpha_3)
= r mat(1,0,1;0,1,1;1,3,5)
= r mat(1,0,1;0,1,1;0,0,1)
= 3
$
由于不能被线性表示,所以应有 $r display(mat(beta_1,:,beta_2,:,beta_3)) < 3$,即:
#set math.mat(delim: "|")
$
mat(beta_1,:,beta_2,:,beta_3)
= mat(1,1,1;1,2,3;3,4,a)
= mat(1,1,1;0,1,2;0,0,a-5)=0
$
#set math.mat(delim: "(")
故 $a=5$.
#prob[(2) 将 $beta_1,beta_2,beta_3$ 用 $alpha_1,alpha_2,alpha_3$ 线性表示.]
$
beta_1 &= 2 alpha_1 + 4 alpha_2 - alpha_3 \
beta_2 &= alpha_1 + 2 alpha_2 \
beta_3 &= 5 alpha_1 + 10 alpha_2 - 2 alpha_3\
$
= P172 习题七 2 #ac
#prob[判断题,略.]
(1) 不构成
(2) 构成
(3) 构成
(4) 不构成(次数可能小于等于 $n$)
(5) 不构成
= P172 习题七 4(2) #ac
#prob[设 $V$ 是数域 $PP$ 上的线性空间,证明 $(c_1-c_2) alpha = c_1 alpha - c_2 alpha,sp forall c_1,c_2 in PP, sp forall alpha in V$.]
$
(c_1-c_2) alpha = c_1 alpha - c_2 alpha
<=> ((c_1-c_2) + c_2) alpha = c_2 alpha + (c_1 - c_2) alpha
$
由于数域的封闭性,$(c_1-c_2) in PP$,再由已知条件和线性空间的运算法则,原命题成立.
= P172 习题七 4(3) #ac
#prob[设 $V$ 是数域 $PP$ 上的线性空间,证明 $c(alpha-beta) = c alpha - c beta,sp forall c in PP,sp forall alpha,beta in V$.]
根据线性空间的性质,$forall beta$,存在唯一的负向量 $gamma$ 使得 $beta+gamma = theta$.代入得
$ c(alpha-beta) = c alpha - c beta <=> c(alpha+gamma) = c alpha + c gamma $
由线性空间的运算法则可知成立.
= P172 习题七 5 #ac
#prob[如果向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 线性无关,证明向量组 $alpha_1,alpha_1+alpha_2,dots.c,alpha_1+alpha_2+dots.c+alpha_s$ 线性无关.]
可证明逆否命题,如果向量组 $alpha_1,alpha_1+alpha_2,dots.c,alpha_1+alpha_2+dots.c+alpha_s$ 线性相关,那么向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 线性相关.考虑一定存在一组不全为 $0$ 的实数 $c_1,c_2,dots.c,c_m$ 使得:
$
&c_1 alpha_1 + c_2 (alpha_1 + alpha_2) + dots.c + c_m (alpha_1 + alpha_2 + dots.c + alpha_m) = theta\
=> &(c_1+c_2+dots.c+c_m) alpha_1 + (c_2+c_3+dots.c+c_m) alpha_2 + dots.c + c_m alpha_m = theta\
$
下面只需证明当 $c_1,c_2,dots.c,c_m$ 不全为 $0$ 时,$(c_1+c_2+dots.c+c_m),(c_2+c_3+dots.c+c_m),dots.c,c_m$ 不全为 $0$.可证明其逆否命题,即当 $(c_1+c_2+dots.c+c_m),(c_2+c_3+dots.c+c_m),dots.c,c_m$ 全为 $0$ 时,$c_1,c_2,dots.c,c_m$ 必全为零.
由于矩阵 $bold(A) = display(mat(1,1,dots.c,1;0,1,dots.c,1;dots.v,dots.v,,dots.v;0,0,dots.c,1)_m)$ 满秩,可知 $bold(A) gamma = beta$ 只存在全零解即 $c_1,c_2,dots.c,c_m$ 全为零.
综上所述,原命题得证.
= P173 习题七 6 #ac
#prob[
设 $alpha_1,alpha_2,dots.c,alpha_s$ 是一组向量且
(1) $alpha_1 != 0$;\
(2) 每一个 $alpha_i sp(i=2,3,dots.c,s)$ 都不能经 $alpha_1,alpha_2,dots.c,alpha_(i-1)$ 线性表示.
证明 $alpha_1,alpha_2,dots.c,alpha_s$ 线性无关.
]
由数学归纳法知证原命题相当于证明当向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 线性无关且 $alpha_(s+1)$ 不能被向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 线性表示时,$alpha_1,alpha_2,dots.c,alpha_s,alpha_(s+1)$ 线性无关.
可证明其逆否命题,即当 $alpha_1,alpha_2,dots.c,alpha_s,alpha_(s+1)$ 线性相关时,要么 $alpha_1,alpha_2,dots.c,alpha_s$ 线性相关,要么 $alpha_(s+1)$ 可被向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 线性表示.
由于 $alpha_1,alpha_2,dots.c,alpha_s,alpha_(s+1)$ 线性相关,一定存在一个向量 $alpha_k$ 可被其余向量线性表示.
- 若 $1<=k<=s$,则 $alpha_1,alpha_2,dots.c,alpha_s$ 线性相关;
- 若 $k=s+1$,则这就是 $alpha_(s+1)$ 可被向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 线性表示.
综上所述,原命题得证.
= P173 习题七 7 #ac
#prob[对任意的两个向量 $alpha_1,alpha_2$.证明:$ beta_1 = 2 alpha_1 - alpha_2,sp beta_2 = alpha_1 + alpha_2,sp beta_3 = -alpha_1 + 3 alpha_2 $线性相关.]
注意到 $beta_3 = -4/3 beta_1 + 5/3 beta_2$,所以向量组 $beta_1,beta_2,beta_3$ 线性相关.
= P173 习题七 8 #ac
#prob[设 $alpha_1,alpha_2$ 线性无关,$alpha_1+beta,alpha_2+beta$ 线性相关,证明:向量 $beta$ 可经 $alpha_1,alpha_2$ 线性表示,并求出该表达式.]
由于 $alpha_1 + beta,alpha_2 + beta$ 线性相关,故一定存在 $k in PP$ 使得
$
(alpha_1+beta) + k(alpha_2 + beta) = 0
=> alpha_1 + k alpha_2 = -(k+1) beta
$
若 $k=-1$,则 $alpha_1 + beta = alpha_2 + beta => alpha_1 = alpha_2$,与 $alpha_1,alpha_2$ 线性无关矛盾.故 $k!=-1$,所以
$
beta = -1/(k+1) alpha_1 + -k/(k+1) alpha_2
$
即 $beta$ 可被 $alpha_1,alpha_2$ 线性表示,且表达式如上.
= P173 习题七 10 #ac
#prob[设向量 $beta$ 可经 $alpha_1,alpha_2,dots.c,alpha_s$ 线性表示,但不能经 $alpha_1,alpha_2,dots.c,alpha_(s-1)$ 线性表示,证明:向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 与向量组 $alpha_1,alpha_2,dots.c,alpha_(s-1),beta$ 等价.]
不妨设 $beta = c_1 alpha_1 + c_2 alpha_2 + dots.c + c_s alpha_s$,其中 $c_1,c_2,dots.c,c_s$ 不全为零.由于不能被 $alpha_1,alpha_2,dots.c,alpha_(s-1)$ 线性表示,所以一定有 $c_s!=0$,也就是说
$
alpha_s = 1/c_s beta - c_1/c_s alpha_1 - c_2/c_s alpha_2 - dots.c - c_(s-1)/c_s alpha_(s-1)
$
其中各项系数中至少有 $display(1/c_s != 0)$.也就是说向量组 $alpha_s$ 能被 $alpha_1,alpha_2,dots.c,alpha_(s-1),beta$ 表示.
综上所述,向量组 $alpha_1,alpha_2,dots.c,alpha_s$ 中的每个向量能被向量组 $alpha_1,alpha_2,dots.c,alpha_(s-1),beta$ 线性表示,且向量组 $alpha_1,alpha_2,dots.c,alpha_(s-1),beta$ 中的每个向量可被 $alpha_1,alpha_2,dots.c,alpha_s$ 中的每个向量线性表示,即这两个向量组等价. |
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compiler/call.typ | typst | Apache License 2.0 | // Test function calls.
// Ref: false
---
// Ref: true
// Omitted space.
#let f() = {}
#[#f()*Bold*]
// Call return value of function with body.
#let f(x, body) = (y) => [#x] + body + [#y]
#f(1)[2](3)
// Don't parse this as a function.
#test (it)
#let f(body) = body
#f[A]
#f()[A]
#f([A])
#let g(a, b) = a + b
#g[A][B]
#g([A], [B])
#g()[A][B]
---
// Trailing comma.
#test(1 + 1, 2,)
// Call function assigned to variable.
#let alias = type
#test(alias(alias), type)
// Callee expressions.
#{
// Wrapped in parens.
test((type)("hi"), str)
// Call the return value of a function.
let adder(dx) = x => x + dx
test(adder(2)(5), 7)
}
---
// Error: 26-30 duplicate argument: font
#set text(font: "Arial", font: "Helvetica")
---
// Error: 2-6 expected function, found boolean
#true()
---
#let x = "x"
// Error: 2-3 expected function, found string
#x()
---
#let f(x) = x
// Error: 2-6 expected function, found integer
#f(1)(2)
---
#let f(x) = x
// Error: 2-6 expected function, found content
#f[1](2)
---
// Error: 7 expected expression
// Error: 8 expected expression
#func(:)
// Error: 10-12 unexpected end of block comment
#func(a:1*/)
// Error: 8 expected comma
#func(1 2)
// Error: 7-8 expected identifier, found integer
// Error: 9 expected expression
#func(1:)
// Error: 7-8 expected identifier, found integer
#func(1:2)
// Error: 7-12 expected identifier, found string
#func("abc": 2)
// Error: 7-10 expected identifier, found group
#func((x):1)
---
// Error: 6-7 unclosed delimiter
#func[`a]`
---
// Error: 7-8 unclosed delimiter
#{func(}
---
// Error: 6-7 unclosed delimiter
// Error: 1:7-2:1 unclosed string
#func("]
|
https://github.com/YunkaiZhang233/a-level-further-maths-topic-questions-david-game | https://raw.githubusercontent.com/YunkaiZhang233/a-level-further-maths-topic-questions-david-game/main/shortcut.typ | typst | // TODO
#let a2 = "(A2 only)"
#let a2_all = [_All topics A2 only._]
#let source(text_content) = {
[*Problem Source: #text_content*]
}
#let marks(num) = {
let postfix = if (num == 1) {[mark]} else {[marks]}
[#align(end)[
*(#num #postfix)*
]]
}
#let sqm = [m#super([2])]
#let preface = [
= Preface
This is a set of topic questions collected from numerous past papers and exercise sheet solutions
designed for further mathematics specification in Edexcel's UK A Levels from 2017.
Most questions were selected from official past papers, but not limited to the Edexcel exam board. In fact I would like to avoid use of official UK Edexcel past paper questions from 2018 onwards as they can be used for mocks and would be a valuable source of pre-exam practices. Most questions here are coming from past papers from other exam boards (AQA, OCR, Edexcel IAL, CAIE, AQA International, WJEC, Cambridge Pre-U, etc.) on the same topics as the Edexcel syllabus, or pre-2017 Edexcel questions, as well as other sources online. References to the original source of questions will be included.
For AS students using this material: some of the questions even on AS topics would include A2-only level questions due to the difference between examination specification and the textbook contents. I will try to mark the "A2-only" questions explicitly but there may be questions I'm mismarking or missing. In such cases please let me (or your further maths teacher) know and we can mark the relevant questions. A more convenient way is to use your Github to access this repository and #underline(link("https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request")[*create a pull request*]).
For the situation above and if you find any other mistakes, or you just want to add the questions, or complain about something, you can also #underline(link("https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request")[*create a pull request*]) on Github directly from this project's source repository at #underline(link("https://github.com/YunkaiZhang233/a-level-further-maths-topic-questions-david-game")).
_Contact Information:_
Course Lecturer: Zameer ul-Hassan, David Game Colege
Author of this note: <NAME>, #underline(link("mailto:<EMAIL>")).
This document was made by #text(blue)[typst], available at #underline(link("https://typst.app/docs")[here]).
#pagebreak()
] |
|
https://github.com/Bi0T1N/typst-iconic-salmon-fa | https://raw.githubusercontent.com/Bi0T1N/typst-iconic-salmon-fa/main/README.md | markdown | MIT License | # [Social Media References based on Font Awesome for Typst](https://github.com/Bi0T1N/typst-iconic-salmon-fa)
The `iconic-salmon-fa` package is designed to help you create your curriculum vitae (CV). It allows you to easily reference your social media profiles with the typical icon of the service plus a link to your profile.
The package name is a combination of the acronym *SociAL Media icONs* and the word *iconic* because all these icons have an iconic design (and iconic also contains the word *icon*).
## Features
- Support for popular social media, developer and career platforms
- Uniform design for all entries
- Based on the Internet's icon library [Font Awesome](https://fontawesome.com/)
- Easy to use
- Allows the customization of the look (extra args are passed to [`text`](https://typst.app/docs/reference/text/text/))
## Fonts Installation
### Linux
1. [Download Font Awesome for Desktop](https://fontawesome.com/download)
2. Unzip the file
3. Switch into the `otfs` folder within the unzipped folder
4. Run `mkdir -p /usr/share/fonts/truetype/`
5. Run `install -m644 'Font Awesome 6 Brands-Regular-400.otf' /usr/share/fonts/truetype/`
6. Unfortunately not all brands are included in the brands font file, so you must also run `install -m644 'Font Awesome 6 Free-Regular-400.otf' /usr/share/fonts/truetype/`
## Usage
### Using Typst's package manager
You can install the library using the [typst packages](https://github.com/typst/packages):
```typst
#import "@preview/iconic-salmon-fa:1.0.0": *
```
### Install manually
Put the `iconic-salmon-fa.typ` file in your project directory and import it:
```typst
#import "iconic-salmon-fa.typ": *
```
### Minimal Example
```typst
// #import "@preview/iconic-salmon-fa:1.0.0": github-info, gitlab-info
#import "iconic-salmon-fa.typ": github-info, gitlab-info
This project was created by #github-info("Bi0T1N"). You can also find me on #gitlab-info("GitLab", rgb("#811052"), url: "https://gitlab.com/Bi0T1N").
```
### Examples
See the [`examples.typ`](examples/examples.typ) file for a complete example. The [generated PDF files](examples/) are also available for preview.
## Troubleshooting
### Icons are not displayed correctly
Make sure that you have installed the required Font Awesome ligature-based font files.
## Contribution
Feel free to open an issue or a pull request if you find any problems or have any suggestions.
## License
This library is licensed under the MIT license. Feel free to use it in your project.
## Trademark Disclaimer
Product names, logos, brands and other trademarks referred to in this project are the property of their respective trademark holders.
These trademark holders are not affiliated with this Typst library, nor are the authors officially endorsed by them, nor do the authors claim ownership of these trademarks.
|
https://github.com/mitex-rs/mitex | https://raw.githubusercontent.com/mitex-rs/mitex/main/packages/mitex/specs/latex/standard.typ | typst | Apache License 2.0 | #import "@preview/xarrow:0.2.0": xarrow
#import "../prelude.typ": *
// 0. Some useful internal variables or functions
#let mitex-color-map = (
"red": rgb(255, 0, 0),
"green": rgb(0, 255, 0),
"blue": rgb(0, 0, 255),
"cyan": rgb(0, 255, 255),
"magenta": rgb(255, 0, 255),
"yellow": rgb(255, 255, 0),
"black": rgb(0, 0, 0),
"white": rgb(255, 255, 255),
"gray": rgb(128, 128, 128),
"lightgray": rgb(192, 192, 192),
"darkgray": rgb(64, 64, 64),
"brown": rgb(165, 42, 42),
"orange": rgb(255, 165, 0),
"pink": rgb(255, 182, 193),
"purple": rgb(128, 0, 128),
"teal": rgb(0, 128, 128),
"olive": rgb(128, 128, 0),
)
#let get-tex-str-from-arr(arr) = arr.filter(it => it != [ ] and it != [#math.zws]).map(it => it.text).sum()
#let get-tex-str(tex) = if tex.has("children") {
get-tex-str-from-arr(tex.children)
} else {
tex.text
}
#let get-tex-color-from-arr(arr) = {
mitex-color-map.at(lower(get-tex-str-from-arr(arr)), default: none)
}
#let get-tex-color(texcolor) = if texcolor.has("children") {
get-tex-color-from-arr(texcolor.children)
} else {
texcolor.text
}
// 1. functions created to make it easier to define a spec
#let operatornamewithlimits(it) = math.op(limits: true, math.upright(it))
#let arrow-handle(arrow-sym) = define-cmd(1, handle: it => $limits(xarrow(sym: #arrow-sym, it))$)
#let _greedy-handle(fn) = (..args) => $fn(#args.pos().sum())$
#let greedy-handle(alias, fn) = define-greedy-cmd(alias, handle: _greedy-handle(fn))
#let limits-handle(alias, wrap) = define-cmd(1, alias: alias, handle: it => math.limits(wrap(it)))
#let matrix-handle(delim: none, handle: none) = define-env(
none,
kind: "is-matrix",
alias: none,
handle: math.mat.with(delim: delim),
)
#let call-or-ignore(fn) = (..args) => if args.pos().len() > 0 {
fn(..args)
} else {
math.zws
}
#let ignore-me = (..args) => { }
#let ignore-sym = define-sym("")
// 2. Standard package definitions, generate specs and scopes,
// for parser/convert and typst respectively
#let (
spec,
scope,
) = process-spec((
// Text mode
section: define-cmd(1, alias: "#heading(level: 1)"),
subsection: define-cmd(1, alias: "#heading(level: 2)"),
subsubsection: define-cmd(1, alias: "#heading(level: 3)"),
footnote: define-cmd(1, alias: "#footnote"),
cite: define-cmd(1, alias: "#mitexcite", handle: it => cite(label(get-tex-str(it)))),
emph: define-cmd(1, alias: "#emph"),
label: define-cmd(1, alias: "mitexlabel", handle: ignore-me),
tag: define-cmd(1, alias: "mitexlabel", handle: ignore-me),
ref: define-cmd(1, alias: "#mitexref", handle: it => ref(label(get-tex-str(it)))),
eqref: define-cmd(1, alias: "#mitexref"),
item: ignore-sym,
// environments for text mode
itemize: define-env(none, kind: "is-itemize"),
enumerate: define-env(none, kind: "is-enumerate"),
quote: define-env(none, alias: "quote(block: true)"),
abstract: define-env(none, alias: "quote(block: true)"),
figure: define-glob-env("{,b}", kind: "is-figure", alias: "figure"),
table: define-glob-env("{,b}", kind: "is-figure", alias: "figure"),
tabular: define-env(1, kind: "is-table", alias: "table"),
// commands for figure
centering: ignore-sym,
textwidth: sym,
caption: define-cmd(1, alias: "mitexcaption", handle: ignore-me),
includegraphics: define-glob-cmd("{,b}t", "#miteximage", handle: ignore-me),
// commands for tabular
toprule: define-glob-cmd("{,b}", "toprule"),
midrule: define-glob-cmd("{,b}", "midrule"),
bottomrule: define-glob-cmd("{,b}", "bottomrule"),
hline: ignore-sym,
vline: ignore-sym,
// Spaces: \! \, \> \: \; \ \quad \qquad
"!": define-sym("negthinspace", sym: h(-(3/18) * 1em)),
negthinspace: of-sym(h(-(3/18) * 1em)),
negthinmedspace: of-sym(h(-(3/18) * 1em)),
negmedspace: of-sym(h(-(4/18) * 1em)),
negthickspace: of-sym(h(-(5/18) * 1em)),
",": define-sym("thin"),
thinspace: define-sym("thin"),
">": define-sym("med"),
":": define-sym("med"),
medspace: define-sym("med"),
";": define-sym("thick"),
"": define-sym("thick"),
thickspace: define-sym("thick"),
enspace: of-sym(h((1/2) * 1em)),
nobreakspace: define-sym("space.nobreak"),
space: sym,
quad: sym,
qquad: define-sym("wide"),
phantom: define-cmd(1, handle: hide),
hphantom: define-cmd(1, handle: it => box(height: 0pt, hide(it))),
vphantom: define-cmd(1, handle: it => box(width: 0pt, hide(it))),
// Escape symbols
"_": define-sym("\\_"),
"^": define-sym("hat"),
"*": define-sym(""),
"|": define-sym("||"),
"&": define-sym("amp"),
"#": define-sym("hash"),
"%": define-sym("%"),
"-": define-sym("-"),
"+": define-sym("+"),
"$": define-sym("dollar"),
"{": define-sym("\\{"),
"}": define-sym("\\}"),
vert: define-sym("|"),
lvert: of-sym(math.class("opening", "|")),
rvert: of-sym(math.class("closing", "|")),
Vert: define-sym("||"),
lVert: of-sym(math.class("opening", "||")),
rVert: of-sym(math.class("closing", "||")),
lparen: define-sym("paren.l"),
rparen: define-sym("paren.r"),
lceil: define-sym("⌈"),
rceil: define-sym("⌉"),
lfloor: define-sym("⌊"),
rfloor: define-sym("⌋"),
// Sizes and styles
displaystyle: greedy-handle("mitexdisplay", math.display),
textstyle: greedy-handle("mitexinline", math.inline),
scriptstyle: greedy-handle("mitexscript", math.script),
scriptscriptstyle: greedy-handle("mitexsscript", math.sscript),
bf: greedy-handle("mitexbold", math.bold),
rm: greedy-handle("mitexupright", math.upright),
it: greedy-handle("mitexitalic", math.italic),
sf: greedy-handle("mitexsans", math.sans),
frak: greedy-handle("mitexfrak", math.frak),
tt: greedy-handle("mitexmono", math.mono),
cal: greedy-handle("mitexcal", math.cal),
bold: define-cmd(1, alias: "bold"),
mathbf: define-cmd(1, alias: "mitexmathbf", handle: it => math.bold(math.upright(it))),
bm: define-cmd(1, alias: "bold"),
boldsymbol: define-cmd(1, alias: "bold"),
pmb: define-cmd(1, alias: "bold"),
mathrm: define-cmd(1, alias: "upright"),
mathit: define-cmd(1, alias: "italic"),
mathnormal: define-cmd(1, alias: "italic"),
mathsf: define-cmd(1, alias: "sans"),
mathfrak: define-cmd(1, alias: "frak"),
mathtt: define-cmd(1, alias: "mono"),
Bbb: define-cmd(1, alias: "bb"),
mathbb: define-cmd(1, alias: "bb"),
mathcal: define-cmd(1, alias: "cal"),
mathbin: define-cmd(1, handle: it => math.class("binary", it)),
mathclose: define-cmd(1, handle: it => math.class("closing", it)),
mathinner: define-cmd(1, handle: it => math.class("fence", it)),
mathop: define-cmd(1, handle: it => math.class("unary", it)),
mathopen: define-cmd(1, handle: it => math.class("opening", it)),
mathord: define-cmd(1, handle: it => math.class("normal", it)),
mathpunct: define-cmd(1, handle: it => math.class("punctuation", it)),
mathrel: define-cmd(1, handle: it => math.class("relation", it)),
big: define-cmd(1, handle: it => math.lr(size: 1.2em, it)),
Big: define-cmd(1, handle: it => math.lr(size: 1.8em, it)),
bigg: define-cmd(1, handle: it => math.lr(size: 2.4em, it)),
Bigg: define-cmd(1, handle: it => math.lr(size: 3em, it)),
bigl: define-cmd(1, alias: "big"),
Bigl: define-cmd(1, alias: "Big"),
biggl: define-cmd(1, alias: "bigg"),
Biggl: define-cmd(1, alias: "Bigg"),
bigm: define-cmd(1, alias: "big"),
Bigm: define-cmd(1, alias: "Big"),
biggm: define-cmd(1, alias: "bigg"),
Biggm: define-cmd(1, alias: "Bigg"),
bigr: define-cmd(1, alias: "big"),
Bigr: define-cmd(1, alias: "Big"),
biggr: define-cmd(1, alias: "bigg"),
Biggr: define-cmd(1, alias: "Bigg"),
// todo: size, especially multi-line, ignore it for now.
Huge: ignore-sym,
normalsize: ignore-sym,
huge: ignore-sym,
small: ignore-sym,
footnotesize: ignore-sym,
Large: ignore-sym,
LARGE: ignore-sym,
scriptsize: ignore-sym,
large: ignore-sym,
tiny: ignore-sym,
// Colors
color: define-greedy-cmd("mitexcolor", handle: (texcolor, ..args) => {
let color = get-tex-color(texcolor)
if color != none {
text(fill: color, args.pos().sum())
} else {
args.pos().sum()
}
}),
textcolor: define-cmd(2, alias: "colortext", handle: (texcolor, body) => {
let color = get-tex-color(texcolor)
if color != none {
text(fill: get-tex-color(texcolor), body)
} else {
body
}
}),
colorbox: define-cmd(2, handle: (texcolor, body) => {
let color = get-tex-color(texcolor)
if color != none {
box(fill: get-tex-color(texcolor), $body$)
} else {
body
}
}),
// Limits
limits: left1-op("limits"),
nolimits: left1-op("scripts"),
// Commands
frac: define-cmd(2, handle: (num, den) => $(num)/(den)$),
// todo: cfrac, dfrac are same?
cfrac: define-cmd(2, handle: (num, den) => $display((num)/(den))$),
dfrac: define-cmd(2, handle: (num, den) => $display((num)/(den))$),
tfrac: define-cmd(2, handle: (num, den) => $inline((num)/(den))$),
binom: define-cmd(2),
dbinom: define-cmd(2, handle: (n, k) => $display(binom(#n, #k))$),
tbinom: define-cmd(2, handle: (n, k) => $inline(binom(#n, #k))$),
stackrel: define-cmd(2, handle: (sup, base) => $limits(base)^(sup)$),
substack: define-cmd(1, handle: it => it),
overset: define-cmd(2, handle: (sup, base) => $limits(base)^(sup)$),
underset: define-cmd(2, handle: (sub, base) => $limits(base)_(sub)$),
// Accents
"not": define-cmd(1, alias: "cancel"),
cancel: define-cmd(1),
xcancel: define-cmd(1, handle: math.cancel),
bcancel: define-cmd(1, handle: math.cancel.with(inverted: true)),
sout: define-cmd(1, handle: math.cancel.with(angle: 90deg)),
grave: define-cmd(1, alias: "grave"),
acute: define-cmd(1, alias: "acute"),
hat: define-cmd(1, alias: "hat"),
widehat: define-cmd(1, alias: "hat"),
tilde: define-cmd(1, alias: "tilde"),
widetilde: define-cmd(1, alias: "tilde"),
bar: define-cmd(1, alias: "macron"),
breve: define-cmd(1, alias: "breve"),
dot: define-cmd(1, alias: "dot"),
ddot: define-cmd(1, alias: "dot.double"),
dddot: define-cmd(1, alias: "dot.triple"),
ddddot: define-cmd(1, alias: "dot.quad"),
H: define-cmd(1, alias: "acute.double"),
check: define-cmd(1, alias: "caron"),
widecheck: define-cmd(1, alias: "caron"),
u: define-cmd(1, alias: "breve"),
v: define-cmd(1, alias: "caron"),
r: define-cmd(1, alias: "circle"),
vec: define-cmd(1, alias: "arrow"),
overrightarrow: define-cmd(1, alias: "arrow"),
overleftarrow: define-cmd(1, alias: "arrow.l"),
overline: cmd1,
underline: cmd1,
overbrace: limits-handle("mitexoverbrace", math.overbrace),
underbrace: limits-handle("mitexunderbrace", math.underbrace),
overbracket: limits-handle("mitexoverbracket", math.overbracket),
underbracket: limits-handle("mitexunderbracket", math.underbracket),
boxed: define-cmd(1, handle: it => box(stroke: 0.5pt, inset: 6pt, $it$)),
// Greeks
alpha: sym,
beta: sym,
gamma: sym,
delta: sym,
epsilon: define-sym("epsilon.alt"),
zeta: sym,
eta: sym,
theta: sym,
iota: sym,
kappa: sym,
lambda: sym,
mu: sym,
nu: sym,
xi: sym,
omicron: sym,
pi: sym,
rho: sym,
sigma: sym,
tau: sym,
upsilon: sym,
phi: define-sym("phi.alt"),
chi: sym,
psi: sym,
omega: sym,
Alpha: sym,
Beta: sym,
Gamma: sym,
Delta: sym,
Epsilon: sym,
Zeta: sym,
Eta: sym,
Theta: sym,
Iota: sym,
Kappa: sym,
Lambda: sym,
Mu: sym,
Nu: sym,
Xi: sym,
Omicron: sym,
Pi: sym,
Rho: sym,
Sigma: sym,
Tau: sym,
Upsilon: sym,
Phi: sym,
Chi: sym,
Psi: sym,
Omega: sym,
varbeta: define-sym("beta.alt"),
varepsilon: define-sym("epsilon"),
varkappa: define-sym("kappa.alt"),
varphi: define-sym("phi"),
varpi: define-sym("pi.alt"),
varrho: define-sym("rho.alt"),
varsigma: define-sym("sigma.alt"),
vartheta: define-sym("theta.alt"),
ell: sym,
// Function symbols
sin: sym,
cos: sym,
tan: sym,
cot: sym,
sec: sym,
csc: sym,
arcsin: sym,
arccos: sym,
arctan: sym,
sinh: sym,
cosh: sym,
tanh: sym,
coth: sym,
ln: sym,
log: sym,
lg: sym,
lim: sym,
limsup: sym,
liminf: sym,
hom: sym,
det: sym,
exp: sym,
deg: sym,
gcd: sym,
lcm: sym,
dim: sym,
ker: sym,
arg: sym,
Pr: sym,
// Limits
max: sym,
min: sym,
argmax: sym,
argmin: sym,
sup: sym,
inf: sym,
sum: sym,
prod: define-sym("product"),
int: define-sym("integral"),
iint: define-sym("integral.double"),
iiint: define-sym("integral.triple"),
oint: define-sym("integral.cont"),
oiint: define-sym("integral.surf"),
oiiint: define-sym("integral.vol"),
// Symbols
mod: define-sym("mod"),
bmod: define-sym("mod"),
cdot: define-sym("dot.c"),
cdotp: define-sym("dot.c"),
sdot: define-sym("dot.c"),
times: define-sym("times"),
oplus: define-sym("plus.circle"),
ominus: define-sym("minus.circle"),
pm: define-sym("plus.minus"),
plusmn: define-sym("plus.minus"),
mp: define-sym("minus.plus"),
div: define-sym("div"),
star: define-sym("star"),
cap: define-sym("sect"),
cup: define-sym("union"),
"in": define-sym("in"),
isin: define-sym("in"),
notin: define-sym("in.not"),
subset: define-sym("subset"),
subseteq: define-sym("subset.eq"),
subsetneqq: define-sym("⫋"),
ne: define-sym("!="),
neq: define-sym("!="),
lt: define-sym("<"),
gt: define-sym(">"),
le: define-sym("<="),
ge: define-sym(">="),
leq: define-sym("<="),
geq: define-sym(">="),
leqslant: define-sym("lt.eq.slant"),
geqslant: define-sym("gt.eq.slant"),
eqslantgtr: define-sym("⪖"),
eqslantless: define-sym("⪕"),
approx: define-sym("approx"),
leftarrow: define-sym("<-"),
rightarrow: define-sym("->"),
leftrightarrow: define-sym("<->"),
Leftarrow: define-sym("arrow.l.double"),
Rightarrow: define-sym("=>"),
Leftrightarrow: define-sym("<=>"),
larr: define-sym("<-"),
rarr: define-sym("->"),
lrarr: define-sym("<->"),
lArr: define-sym("arrow.l.double"),
rArr: define-sym("=>"),
lrArr: define-sym("<=>"),
Larr: define-sym("arrow.l.double"),
Rarr: define-sym("=>"),
Lrarr: define-sym("<=>"),
longleftarrow: define-sym("<--"),
longrightarrow: define-sym("-->"),
longleftrightarrow: define-sym("<-->"),
Longleftarrow: define-sym("<=="),
Longrightarrow: define-sym("==>"),
Longleftrightarrow: define-sym("<==>"),
to: define-sym("->"),
implies: define-sym("==>"),
impliedby: define-sym("<=="),
gets: define-sym("<-"),
mapsto: define-sym("|->"),
infty: define-sym("oo"),
lbrack: define-sym("bracket.l"),
rbrack: define-sym("bracket.r"),
lgroup: define-sym("⟮"),
rgroup: define-sym("⟯"),
llbracket: define-sym("bracket.l.double"),
rrbracket: define-sym("bracket.r.double"),
angle: define-sym("angle"),
lang: define-sym("angle.l"),
rang: define-sym("angle.r"),
langle: define-sym("angle.l"),
rangle: define-sym("angle.r"),
measuredangle: define-sym("angle.arc"),
sphericalangle: define-sym("angle.spheric"),
ast: define-sym("ast"),
checkmark: define-sym("checkmark"),
circledast: define-sym("ast.circle"),
backslash: define-sym("backslash"),
dagger: define-sym("dagger"),
ddagger: define-sym("dagger.double"),
circleddash: define-sym("dash.circle"),
odot: define-sym("dot.circle"),
bigodot: define-sym("dot.circle.big"),
boxdot: define-sym("dot.square"),
dots: define-sym("dots.h"),
cdots: define-sym("dots.h.c"),
ldots: define-sym("dots.h"),
vdots: define-sym("dots.v"),
ddots: define-sym("dots.down"),
dotsb: define-sym("dots.h.c"),
dotsc: define-sym("dots.h"),
dotsi: define-sym("dots.h.c"),
dotsm: define-sym("dots.h.c"),
dotso: define-sym("dots.h"),
sim: define-sym("tilde"),
simeq: define-sym("tilde.eq"),
backsimeq: define-sym("tilde.eq.rev"),
cong: define-sym("tilde.equiv"),
ncong: define-sym("tilde.equiv.not"),
nsim: define-sym("tilde.not"),
backsim: define-sym("tilde.rev"),
prime: define-sym("prime"),
backprime: define-sym("prime.rev"),
bigoplus: define-sym("plus.circle.big"),
dotplus: define-sym("plus.dot"),
boxplus: define-sym("plus.square"),
boxminus: define-sym("minus.square"),
eqsim: define-sym("minus.tilde"),
otimes: define-sym("times.circle"),
bigotimes: define-sym("times.circle.big"),
divideontimes: define-sym("times.div"),
leftthreetimes: define-sym("times.three.l"),
rightthreetimes: define-sym("times.three.r"),
ltimes: define-sym("times.l"),
rtimes: define-sym("times.r"),
boxtimes: define-sym("times.square"),
triangleq: define-sym("eq.delta"),
curlyeqprec: define-sym("eq.prec"),
curlyeqsucc: define-sym("eq.succ"),
gtrdot: define-sym("gt.dot"),
gg: define-sym("gt.double"),
gtreqless: define-sym("gt.eq.lt"),
ngeq: define-sym("gt.eq.not"),
geqq: define-sym("gt.equiv"),
gtrless: define-sym("gt.lt"),
gneqq: define-sym("gt.nequiv"),
ngtr: define-sym("gt.not"),
gnsim: define-sym("gt.ntilde"),
gtrsim: define-sym("gt.tilde"),
vartriangleright: define-sym("gt.tri"),
trianglerighteq: define-sym("gt.tri.eq"),
ntrianglerighteq: define-sym("gt.tri.eq.not"),
ntriangleright: define-sym("gt.tri.not"),
ggg: define-sym("gt.triple"),
lessdot: define-sym("lt.dot"),
ll: define-sym("lt.double"),
lesseqgtr: define-sym("lt.eq.gt"),
nleq: define-sym("lt.eq.not"),
leqq: define-sym("lt.equiv"),
lessgtr: define-sym("lt.gt"),
lneqq: define-sym("lt.nequiv"),
nless: define-sym("lt.not"),
lnsim: define-sym("lt.ntilde"),
lesssim: define-sym("lt.tilde"),
vartriangleleft: define-sym("lt.tri"),
trianglelefteq: define-sym("lt.tri.eq"),
ntrianglelefteq: define-sym("lt.tri.eq.not"),
ntriangleleft: define-sym("lt.tri.not"),
lll: define-sym("lt.triple"),
approxeq: define-sym("approx.eq"),
prec: define-sym("prec"),
precapprox: define-sym("prec.approx"),
preceq: define-sym("prec.eq"),
preccurlyeq: define-sym("prec.eq"),
npreceq: define-sym("prec.eq.not"),
precnapprox: define-sym("prec.napprox"),
nprec: define-sym("prec.not"),
precnsim: define-sym("prec.ntilde"),
precsim: define-sym("prec.tilde"),
succ: define-sym("succ"),
succapprox: define-sym("succ.approx"),
succeq: define-sym("succ.eq"),
succcurlyeq: define-sym("succ.eq"),
nsucceq: define-sym("succ.eq.not"),
succnapprox: define-sym("succ.napprox"),
nsucc: define-sym("succ.not"),
succnsim: define-sym("succ.ntilde"),
succsim: define-sym("succ.tilde"),
equiv: define-sym("equiv"),
propto: define-sym("prop"),
empty: define-sym("nothing"),
emptyset: define-sym("nothing"),
varnothing: define-sym("nothing"),
o: define-sym("nothing"),
O: define-sym("nothing"),
osplash: define-sym("⊘"),
setminus: define-sym("without"),
And: define-sym("amp"),
bigcirc: define-sym("circle.stroked.big"),
smallsetminus: define-sym("without"),
complement: define-sym("complement"),
ni: define-sym("in.rev"),
notni: define-sym("in.rev.not"),
Subset: define-sym("subset.double"),
nsubseteq: define-sym("subset.eq.not"),
sqsubseteq: define-sym("subset.eq.sq"),
subsetneq: define-sym("subset.neq"),
supset: define-sym("supset"),
Supset: define-sym("supset.double"),
supseteq: define-sym("supset.eq"),
nsupseteq: define-sym("supset.eq.not"),
sqsupseteq: define-sym("supset.eq.sq"),
supsetneq: define-sym("supset.neq"),
bigcup: define-sym("union.big"),
Cup: define-sym("union.double"),
uplus: define-sym("union.plus"),
biguplus: define-sym("union.plus.big"),
sqcup: define-sym("union.sq"),
bigsqcup: define-sym("union.sq.big"),
bigcap: define-sym("sect.big"),
Cap: define-sym("sect.double"),
sqcap: define-sym("sect.sq"),
partial: define-sym("diff"),
nabla: define-sym("nabla"),
coprod: define-sym("product.co"),
forall: define-sym("forall"),
exist: define-sym("exists"),
exists: define-sym("exists"),
nexists: define-sym("exists.not"),
top: define-sym("top"),
bot: define-sym("bot"),
neg: define-sym("not"),
lnot: define-sym("not"),
land: define-sym("and"),
wedge: define-sym("and"),
lor: define-sym("or"),
bigwedge: define-sym("and.big"),
curlywedge: define-sym("and.curly"),
vee: define-sym("or"),
bigvee: define-sym("or.big"),
curlyvee: define-sym("or.curly"),
models: define-sym("models"),
therefore: define-sym("therefore"),
because: define-sym("because"),
blacksquare: define-sym("qed"),
circ: define-sym("compose"),
multimap: define-sym("multimap"),
mid: define-sym("divides"),
nmid: define-sym("divides.not"),
wr: define-sym("wreath"),
parallel: define-sym("parallel"),
shortparallel: define-sym("parallel"),
nparallel: define-sym("parallel.not"),
perp: define-sym("perp"),
Join: define-sym("join"),
pounds: define-sym("pound"),
clubsuit: define-sym("suit.club"),
spadesuit: define-sym("suit.spade"),
bull: define-sym("bullet"),
bullet: define-sym("bullet"),
circledcirc: define-sym("circle.nested"),
rhd: define-sym("triangle.stroked.r"),
lhd: define-sym("triangle.stroked.l"),
triangle: define-sym("triangle.stroked.t"),
bigtriangleup: define-sym("triangle.stroked.t"),
bigtriangledown: define-sym("triangle.stroked.b"),
triangleright: define-sym("triangle.stroked.small.r"),
triangledown: define-sym("triangle.stroked.small.b"),
triangleleft: define-sym("triangle.stroked.small.l"),
vartriangle: define-sym("triangle.stroked.small.t"),
square: define-sym("square.stroked"),
Diamond: define-sym("diamond.stroked"),
diamond: define-sym("diamond.stroked.small"),
diamonds: define-sym("diamond.stroked"),
diamondsuit: define-sym("diamond.stroked"),
lozenge: define-sym("lozenge.stroked"),
blacklozenge: define-sym("lozenge.filled"),
bigstar: define-sym("star.stroked"),
longmapsto: define-sym("arrow.r.long.bar"),
nRightarrow: define-sym("arrow.r.double.not"),
hookrightarrow: define-sym("arrow.r.hook"),
looparrowright: define-sym("arrow.r.loop"),
nrightarrow: define-sym("arrow.r.not"),
rightsquigarrow: define-sym("arrow.r.squiggly"),
rightarrowtail: define-sym("arrow.r.tail"),
Rrightarrow: define-sym("arrow.r.triple"),
twoheadrightarrow: define-sym("arrow.r.twohead"),
nLeftarrow: define-sym("arrow.l.double.not"),
hookleftarrow: define-sym("arrow.l.hook"),
looparrowleft: define-sym("arrow.l.loop"),
nleftarrow: define-sym("arrow.l.not"),
leftarrowtail: define-sym("arrow.l.tail"),
Lleftarrow: define-sym("arrow.l.triple"),
twoheadleftarrow: define-sym("arrow.l.twohead"),
uparrow: define-sym("arrow.t"),
Uparrow: define-sym("arrow.t.double"),
downarrow: define-sym("arrow.b"),
Downarrow: define-sym("arrow.b.double"),
iff: define-sym("arrow.l.r.double.long"),
nLeftrightarrow: define-sym("arrow.l.r.double.not"),
nleftrightarrow: define-sym("arrow.l.r.not"),
leftrightsquigarrow: define-sym("arrow.l.r.wave"),
updownarrow: define-sym("arrow.t.b"),
Updownarrow: define-sym("arrow.t.b.double"),
nearrow: define-sym("arrow.tr"),
searrow: define-sym("arrow.br"),
nwarrow: define-sym("arrow.tl"),
swarrow: define-sym("arrow.bl"),
circlearrowleft: define-sym("arrow.ccw"),
curvearrowleft: define-sym("arrow.ccw.half"),
circlearrowright: define-sym("arrow.cw"),
curvearrowright: define-sym("arrow.cw.half"),
rightrightarrows: define-sym("arrows.rr"),
leftleftarrows: define-sym("arrows.ll"),
upuparrows: define-sym("arrows.tt"),
downdownarrows: define-sym("arrows.bb"),
leftrightarrows: define-sym("arrows.lr"),
rightleftarrows: define-sym("arrows.rl"),
rightharpoonup: define-sym("harpoon.rt"),
rightharpoondown: define-sym("harpoon.rb"),
leftharpoonup: define-sym("harpoon.lt"),
leftharpoondown: define-sym("harpoon.lb"),
upharpoonleft: define-sym("harpoon.tl"),
upharpoonright: define-sym("harpoon.tr"),
downharpoonleft: define-sym("harpoon.bl"),
downharpoonright: define-sym("harpoon.br"),
leftrightharpoons: define-sym("harpoons.ltrb"),
rightleftharpoons: define-sym("harpoons.rtlb"),
vdash: define-sym("tack.r"),
nvdash: define-sym("tack.r.not"),
vDash: define-sym("tack.r.double"),
nvDash: define-sym("tack.r.double.not"),
dashv: define-sym("tack.l"),
hbar: define-sym("planck.reduce"),
hslash: define-sym("planck.reduce"),
Re: define-sym("Re"),
Im: define-sym("Im"),
AA: define-sym("circle(A)"),
aa: define-sym("circle(A)"),
Box: define-sym("ballot"),
N: define-sym("NN"),
natnums: define-sym("NN"),
natural: define-sym("♮"),
P: define-sym("pilcrow"),
Q: define-sym("QQ"),
R: define-sym("RR"),
Z: define-sym("ZZ"),
S: define-sym("section"),
sect: define-sym("section"),
AE: define-sym("Æ"),
ae: define-sym("æ"),
alef: define-sym("aleph"),
alefsym: define-sym("aleph"),
aleph: define-sym("aleph"),
amalg: define-sym("product.co"),
arctg: of-sym(math.op("arctg")),
asymp: define-sym("≍"),
ch: of-sym(math.op("ch")),
circeq: define-sym("≗"),
colon: define-sym("colon"),
cth: of-sym(math.op("cth")),
dag: define-sym("dagger"),
Dagger: define-sym("dagger.double"),
ddag: define-sym("dagger.double"),
daleth: define-sym("ℸ"),
sharp: define-sym("♯"),
flat: define-sym("♭"),
i: define-sym("dotless.i"),
j: define-sym("dotless.j"),
imath: define-sym("dotless.i"),
jmath: define-sym("dotless.j"),
smallsmile: define-sym("⌣"),
smile: define-sym("⌣"),
ss: define-sym("ß"),
surd: define-sym("\√"),
tg: define-sym("tg"),
th: of-sym(math.op("th")),
weierp: define-sym("℘"),
wp: define-sym("℘"),
lbrace: define-sym("\\{"),
rbrace: define-sym("\\}"),
doteq: define-sym("≐"),
Vdash: define-sym("⊩"),
Doteq: define-sym("≑"),
Vvdash: define-sym("⊪"),
gnapprox: define-sym("⪊"),
ngeqslant: define-sym("gt.eq.not"),
precneqq: define-sym("prec.nequiv"),
gneq: define-sym("⪈"),
approxcolon: define-sym("approx:"),
approxcoloncolon: define-sym("approx::"),
backepsilon: define-sym("in.rev.small"),
barwedge: define-sym("⊼"),
beth: define-sym("beth"),
between: define-sym("≬"),
bigdot: define-sym("dot.circle.big"),
bigplus: define-sym("plus.circle.big"),
bigtimes: define-sym("times.circle.big"),
blacktriangle: define-sym("triangle.filled.t"),
blacktriangledown: define-sym("triangle.filled.b"),
blacktriangleleft: define-sym("triangle.filled.l"),
blacktriangleright: define-sym("triangle.filled.r"),
bowtie: define-sym("⋈"),
Bumpeq: define-sym("≎"),
bumpeq: define-sym("≏"),
centerdot: define-sym("dot.op"),
circledR: define-sym("®"),
circledS: define-sym("Ⓢ"),
clubs: define-sym("suit.club"),
cnums: define-sym("CC"),
Colonapprox: define-sym("::approx"),
colonapprox: define-sym(":approx"),
coloncolon: define-sym("::"),
coloncolonapprox: define-sym("::approx"),
coloncolonequals: define-sym("::="),
coloncolonminus: define-sym("::−"),
coloncolonsim: define-sym("::tilde.op"),
Coloneq: define-sym("::−"),
coloneq: define-sym(":−"),
colonequals: define-sym(":="),
Coloneqq: define-sym("::="),
coloneqq: define-sym(":="),
colonminus: define-sym(":−"),
Colonsim: define-sym("::tilde.op"),
colonsim: define-sym(":tilde.op"),
Complex: define-sym("CC"),
copyright: define-sym("copyright"),
ctg: define-sym("ctg"),
Darr: define-sym("arrow.b.double"),
dArr: define-sym("arrow.b.double"),
darr: define-sym("arrow.b"),
dashleftarrow: define-sym("arrow.l.dash"),
dashrightarrow: define-sym("arrow.r.dash"),
dbcolon: define-sym("::"),
degree: define-sym("degree"),
digamma: define-sym("ϝ"),
diagdown: define-sym("╲"),
diagup: define-sym("╱"),
doteqdot: define-sym("≑"),
doublebarwedge: define-sym("⩞"),
doublecap: define-sym("sect.double"),
doublecup: define-sym("union.double"),
eqcirc: define-sym("≖"),
Eqcolon: define-sym("−::"),
eqcolon: define-sym("dash.colon"),
Eqqcolon: define-sym("=::"),
eqqcolon: define-sym("=:"),
equalscolon: define-sym("=:"),
equalscoloncolon: define-sym("=::"),
eth: define-sym("ð"),
fallingdotseq: define-sym("≒"),
Finv: define-sym("Ⅎ"),
frown: define-sym("⌢"),
Game: define-sym("⅁"),
gggtr: define-sym(">>>"),
gimel: define-sym("gimel"),
Harr: define-sym("<=>"),
hArr: define-sym("<=>"),
harr: define-sym("<->"),
hearts: define-sym("♡"),
heartsuit: define-sym("♡"),
image: define-sym("Im"),
imageof: define-sym("⊷"),
infin: define-sym("infinity"),
intercal: define-sym("⊺"),
intop: define-sym("integral"),
lBrace: define-sym("⦃"),
ldotp: define-sym("."),
leadsto: define-sym("arrow.r.squiggly"),
lessapprox: define-sym("⪅"),
lesseqqgtr: define-sym("⪋"),
llcorner: define-sym("⌞"),
llless: define-sym("<<<"),
lnapprox: define-sym("⪉"),
lneq: define-sym("⪇"),
lrcorner: define-sym("⌟"),
lq: define-sym("quote.l.single"),
Lsh: define-sym("↰"),
maltese: define-sym("maltese"),
mathellipsis: define-sym("..."),
mathsterling: define-sym("pound"),
mho: define-sym("ohm.inv"),
minuscolon: define-sym("dash.colon"),
minuscoloncolon: define-sym("−::"),
minuso: define-sym("⦵"),
newline: define-sym("\\"),
nVDash: define-sym("⊯"),
nVdash: define-sym("⊮"),
OE: define-sym("Œ"),
oe: define-sym("œ"),
origof: define-sym("⊶"),
oslash: define-sym("⊘"),
owns: define-sym("in.rev"),
pitchfork: define-sym("⋔"),
ratio: define-sym(":"),
rBrace: define-sym("⦄"),
real: define-sym("Re"),
Reals: define-sym("RR"),
reals: define-sym("RR"),
restriction: define-sym("harpoon.tr"),
risingdotseq: define-sym("≓"),
rmoustache: define-sym("⎱"),
rq: define-sym("'"),
Rsh: define-sym("↱"),
simcolon: define-sym("tilde.op:"),
simcoloncolon: define-sym("tilde.op::"),
spades: define-sym("suit.spade"),
sqsubset: define-sym("subset.sq"),
sqsupset: define-sym("supset.sq"),
sub: define-sym("subset"),
sube: define-sym("subset.eq"),
subseteqq: define-sym("⫅"),
succneqq: define-sym("succ.nequiv"),
supe: define-sym("supset.eq"),
supseteqq: define-sym("⫆"),
supsetneqq: define-sym("⫌"),
textasciitilde: define-sym("~"),
textasciicircum: define-sym("\\^"),
textbackslash: define-sym("\\\\"),
textbar: define-sym("\\|"),
textbardbl: define-sym("‖"),
textbraceleft: define-sym("{"),
textbraceright: define-sym("}"),
textdagger: define-sym("dagger"),
textdaggerdbl: define-sym("dagger.double"),
textdegree: define-sym("degree"),
textdollarsign: define-sym("\\$"),
textellipsis: define-sym("..."),
textemdash: define-sym("---"),
textendash: define-sym("--"),
textgreater: define-sym("gt"),
textless: define-sym("lt"),
textquotedblleft: define-sym("quote.l.double"),
textquotedblright: define-sym("quote.r.double"),
textquoteleft: define-sym("quote.l.single"),
textquoteright: define-sym("quote.r.single"),
textregistered: define-sym("®"),
textsterling: define-sym("pound"),
textunderscore: define-sym("\\_"),
thetasym: define-sym("theta.alt"),
Uarr: define-sym("arrow.t.double"),
uArr: define-sym("arrow.t.double"),
uarr: define-sym("arrow.t"),
ulcorner: define-sym("⌜"),
unlhd: define-sym("lt.tri.eq"),
unrhd: define-sym("gt.tri.eq"),
urcorner: define-sym("⌝"),
varpropto: define-sym("prop"),
varsubsetneq: define-sym("subset.neq"),
varsubsetneqq: define-sym("⫋"),
varsupsetneq: define-sym("supset.neq"),
varsupsetneqq: define-sym("⫌"),
vcentcolon: define-sym(":"),
veebar: define-sym("⊻"),
yen: define-sym("yen"),
arcctg: of-sym(math.op("arcctg")),
begingroup: ignore-sym,
cosec: of-sym(math.op("cosec")),
cotg: of-sym(math.op("cotg")),
injlim: of-sym(math.op("inj\u{2009}lim", limits: true)),
mathclap: define-cmd(1, handle: it => box(width: 0pt, $it$)),
mathring: define-cmd(1, handle: it => math.circle(it)),
nobreak: ignore-sym,
noexpand: ignore-sym,
overgroup: define-cmd(1, handle: it => $accent(it, \u{0311})$),
undergroup: define-cmd(1, handle: it => $accent(it, \u{032e})$),
overleftharpoon: define-cmd(1, handle: it => $accent(it, \u{20d0})$),
overleftrightarrow: define-cmd(1, handle: it => $accent(it, \u{20e1})$),
overlinesegment: define-cmd(1, handle: it => $accent(it, \u{20e9})$),
overrightharpoon: define-cmd(1, handle: it => $accent(it, \u{20d1})$),
underbar: define-cmd(1, handle: it => $underline(it)$),
plim: of-sym(math.op("plim", limits: true)),
projlim: of-sym(math.op("proj\u{2009}lim", limits: true)),
raisebox: define-cmd(2, handle: (sp, it) => text(baseline: -eval(get-tex-str(sp)), it)),
sh: of-sym(math.op("sh")),
smallint: of-sym($inline(integral)$),
thickapprox: of-sym($bold(approx)$),
thicksim: of-sym($bold(tilde)$),
varDelta: of-sym($italic(Delta)$),
varGamma: of-sym($italic(Gamma)$),
varLambda: of-sym($italic(Lambda)$),
varOmega: of-sym($italic(Omega)$),
varPhi: of-sym($italic(Phi)$),
varPi: of-sym($italic(Pi)$),
varPsi: of-sym($italic(Psi)$),
varSigma: of-sym($italic(Sigma)$),
varTheta: of-sym($italic(Theta)$),
varUpsilon: of-sym($italic(Upsilon)$),
varXi: of-sym($italic(Xi)$),
// xarrows
xleftarrow: arrow-handle(math.arrow.l.long),
xrightarrow: arrow-handle(math.arrow.r.long),
xLeftarrow: arrow-handle(math.arrow.l.double.long),
xRightarrow: arrow-handle(math.arrow.r.double.long),
xleftrightarrow: arrow-handle(math.arrow.l.r),
xLeftrightarrow: arrow-handle(math.arrow.l.r.double),
xhookleftarrow: arrow-handle(math.arrow.l.hook),
xhookrightarrow: arrow-handle(math.arrow.r.hook),
xtwoheadleftarrow: arrow-handle(math.arrow.l.twohead),
xtwoheadrightarrow: arrow-handle(math.arrow.r.twohead),
xleftharpoonup: arrow-handle(math.harpoon.lt),
xrightharpoonup: arrow-handle(math.harpoon.rt),
xleftharpoondown: arrow-handle(math.harpoon.lb),
xrightharpoondown: arrow-handle(math.harpoon.rb),
xleftrightharpoons: arrow-handle(math.harpoons.ltrb),
xrightleftharpoons: arrow-handle(math.harpoons.rtlb),
xtofrom: arrow-handle(math.arrows.rl),
xmapsto: arrow-handle(math.arrow.r.bar),
xlongequal: arrow-handle(math.eq),
pmod: define-cmd(1, handle: it => $quad (mod thick it)$),
pod: define-cmd(1, handle: it => $quad (it)$),
"set": define-cmd(1, handle: it => $\{it\}$),
Set: define-cmd(1, handle: it => $lr(\{it\})$),
bra: define-cmd(1, handle: it => $angle.l it|$),
Bra: define-cmd(1, handle: it => $lr(angle.l it|)$),
ket: define-cmd(1, handle: it => $|it angle.r$),
Ket: define-cmd(1, handle: it => $lr(|it angle.r)$),
braket: define-cmd(1, handle: it => $angle.l it angle.r$),
Braket: define-cmd(1, handle: it => $lr(angle.l it angle.r)$),
fbox: define-cmd(1, handle: it => box(stroke: 0.5pt, $it$)),
hbox: define-cmd(1, handle: it => it),
// Matrices
matrix: matrix-handle(delim: none),
pmatrix: matrix-handle(delim: "("),
bmatrix: matrix-handle(delim: "["),
Bmatrix: matrix-handle(delim: "{"),
vmatrix: matrix-handle(delim: "|"),
Vmatrix: matrix-handle(delim: "||"),
smallmatrix: matrix-handle(handle: (..args) => math.inline(math.mat.with(delim: none, ..args))),
array: define-env(1, kind: "is-matrix", alias: "mitexarray", handle: (arg0: ("l",), ..args) => {
if args.pos().len() == 0 {
return
}
if type(arg0) != str {
if arg0.has("children") {
arg0 = arg0.children.filter(it => it != [ ] and it != [#math.zws])
.map(it => it.text)
.filter(it => it == "l" or it == "c" or it == "r")
} else {
arg0 = (arg0.text,)
}
}
let matrix = args.pos().map(row => if type(row) == array { row } else { (row,) } )
let n = matrix.len()
let m = calc.max(..matrix.map(row => row.len()))
matrix = matrix.map(row => row + (m - row.len()) * (none,))
let array-at(arr, pos) = {
arr.at(calc.min(pos, arr.len() - 1))
}
let align-map = ("l": left, "c": center, "r": right)
set align(align-map.at(array-at(arg0, 0)))
pad(y: 0.2em, grid(
columns: m,
column-gutter: 0.5em,
row-gutter: 0.5em,
..matrix.flatten().map(it => $it$)
))
}),
subarray: define-env(1, kind: "is-matrix", alias: "mitexarray"),
// Environments
aligned: define-env(none, kind: "is-math", alias: "aligned", handle: call-or-ignore(it => pad(y: 0.2em, block(math.op(math.display(it)))))),
alignedat: define-env(1, kind: "is-math", alias: "alignedat", handle: (arg0: none, it) => pad(y: 0.2em, block(math.op(it)))),
align: define-env(none, kind: "is-math", alias: "aligned"),
"align*": define-env(none, kind: "is-math", alias: "aligned"),
equation: define-env(none, kind: "is-math", alias: "aligned"),
"equation*": define-env(none, kind: "is-math", alias: "aligned"),
split: define-env(none, kind: "is-math", alias: "aligned"),
gather: define-env(none, kind: "is-math", alias: "aligned"),
gathered: define-env(none, kind: "is-math", alias: "aligned"),
cases: define-env(none, kind: "is-cases", alias: "cases"),
rcases: define-env(none, kind: "is-cases", alias: "rcases", handle: math.cases.with(reverse: true)),
// Specials
notag: ignore-sym,
relax: ignore-sym,
cr: ignore-sym,
expandafter: ignore-sym,
hskip: ignore-sym,
mskip: ignore-sym,
kern: ignore-sym,
mkern: ignore-sym,
mathstrut: ignore-sym,
nonumber: ignore-sym,
KaTeX: of-sym(math.upright($kai A T E X$)),
LaTeX: of-sym(math.upright($L A T E X$)),
TeX: of-sym(math.upright($T E X$)),
middle: define-cmd(1, handle: it => math.mid(it)),
operatorname: define-cmd(1, handle: it => math.op(math.upright(it))),
operatornamewithlimits: define-cmd(1, alias: "operatornamewithlimits", handle: operatornamewithlimits),
"operatorname*": define-cmd(1, alias: "operatornamewithlimits", handle: operatornamewithlimits),
vspace: define-cmd(1, handle: it => v(eval(get-tex-str(it)))),
hspace: define-cmd(1, handle: it => h(eval(get-tex-str(it)))),
text: define-cmd(1, alias: "#textmath", handle: it => it),
textmd: define-cmd(1, alias: "#textmd", handle: it => it),
textnormal: define-cmd(1, alias: "#textnormal", handle: it => it),
textbf: define-cmd(1, alias: "#textbf", handle: math.bold),
textit: define-cmd(1, alias: "#textit", handle: math.italic),
textrm: define-cmd(1, alias: "#textrm", handle: math.upright),
textup: define-cmd(1, alias: "#textup", handle: math.upright),
textsf: define-cmd(1, alias: "#textsf", handle: math.sans),
texttt: define-cmd(1, alias: "#texttt", handle: math.mono),
over: define-infix-cmd("frac"),
atop: define-infix-cmd("atop", handle: (a, b) => $mat(delim: #none, #a; #b)$),
choose: define-infix-cmd("binom", handle: math.binom),
brace: define-infix-cmd("brace", handle: (n, k) => $mat(delim: "{", #n;; #k)$),
brack: define-infix-cmd("brack", handle: (n, k) => $mat(delim: "[", #n;; #k)$),
sqrt: define-glob-cmd("{,b}t", "mitexsqrt", handle: (..args) => {
if args.pos().len() == 1 {
$sqrt(#args.pos().at(0))$
} else if args.pos().len() == 2 {
$root(
#args.pos().at(0).children.filter(it => it != [\[] and it != [\]]).sum(),
#args.pos().at(1)
)$
} else {
panic("unexpected args in sqrt")
}
}),
// todo: macros
def: ignore-sym,
newcommand: ignore-sym,
"newcommand*": ignore-sym,
renewcommand: ignore-sym,
"renewcommand*": ignore-sym,
DeclareRobustCommand: ignore-sym,
"DeclareRobustCommand*": ignore-sym,
DeclareTextCommand: ignore-sym,
DeclareTextCommandDefault: ignore-sym,
ProvideTextCommand: ignore-sym,
ProvideTextCommandDefault: ignore-sym,
providecommand: ignore-sym,
"providecommand*": ignore-sym,
newenvironment: ignore-sym,
"newenvironment*": ignore-sym,
renewenvironment: ignore-sym,
"renewenvironment*": ignore-sym,
AtEndOfClass: ignore-sym,
AtEndOfPackage: ignore-sym,
AtBeginDocument: ignore-sym,
AtEndDocument: ignore-sym,
"@ifstar": ignore-sym,
"if": ignore-sym,
ifdim: ignore-sym,
iffalse: ignore-sym,
ifnum: ignore-sym,
ifodd: ignore-sym,
iftrue: ignore-sym,
ifx: ignore-sym,
DeclareOption: ignore-sym,
"DeclareOption*": ignore-sym,
CurrentOption: ignore-sym,
ProcessOptions: ignore-sym,
ExecuteOptions: ignore-sym,
RequirePackage: ignore-sym,
RequirePackageWithOptions: ignore-sym,
documentclass: ignore-sym,
PassOptionsToClass: ignore-sym,
PassOptionsToPackage: ignore-sym,
IfFileExists: ignore-sym,
InputIfFileExists: ignore-sym,
ProvidesFile: ignore-sym,
ignorespaces: ignore-sym,
ignorespacesafterend: ignore-sym,
ifvoid: ignore-sym,
ifinner: ignore-sym,
ifhbox: ignore-sym,
ifvbox: ignore-sym,
ifhmode: ignore-sym,
ifmmode: ignore-sym,
ifvmode: ignore-sym,
CheckCommand: ignore-sym,
"CheckCommand*": ignore-sym,
newcounter: ignore-sym,
newlength: ignore-sym,
newsavebox: ignore-sym,
newtheorem: ignore-sym,
newfont: ignore-sym,
ProvidesClass: ignore-sym,
LoadClass: ignore-sym,
LoadClassWithOptions: ignore-sym,
))
// export: include package name, spec and scope
#let package = (name: "latex-std", spec: (commands: spec), scope: scope)
|
https://github.com/saurabtharu/Internship-repo | https://raw.githubusercontent.com/saurabtharu/Internship-repo/main/Internship%20Report%20-%20typst/chapters/chapter-3-intern%20activities.typ | typst | #import "../template.typ": *
= Chapter 3: Internship Activities
\
== 3.1. Roles and Responsibilities
#v(15pt, weak: true)
/*
Even though I had been a DevOps Engineer during my internship at F1Soft International, I was taught all the concepts and practices of DevOps since the responsibilities that were entrusted to me were quite many.
The following are some of the duties I was required to undertake:
#set enum(numbering: "i)")
+ *CI/CD Pipeline Implementation*: This involved setting up continuous integration and continuous deployment (CI/CD) pipelines that automate software building, testing, and deployment processes. Jenkins CI/CD was among the tools I had to configure for this purpose.
+ *Infrastructure Management*: I had to create and deploy scalable infrastructure solutions using bare-metal servers. Additionally, I was supposed to set up servers, manage networks as well as storage systems.
+ *Monitoring and Alerting*: My role also included implementing monitoring tools like Prometheus, Grafana, and Uptime-Kuma to ensure system reliability and performance. On top of this I was expected to put in place alerting mechanisms that would help us identify incidents as soon as they occur.
// + *Security Enhancements*: I integrated security best practices into the CI/CD pipelines while at the same time making sure that our infrastructure met industry security standards. To do this, I configured firewalls, enforced SSL/TLS encryption for secure communication channels and managed access controls.
+ *Containerization*: Employing Docker for application containerization; this entailed setting up docker containers and registries as well as their management. I also participated in deploying containerized applications using Kubernetes (K3s) and managing these clusters through Rancher.
+ *Automation and Scripting*: Writing and maintaining Bash scripts to automate tasks which happen again and again for example deployments; backups and system monitoring.
+ *Documentation and Reporting*: Creating a well-detailed documentation for all processes carried out during the attachment period such configurations done thus changes made. In addition to this I was involved in generating reports on how reliable or efficient our systems were performing.
*/
While working as a DevOps Engineer intern for F1Soft International, my main focus was on bringing together software development and IT operations. I had the following tasks:
#set enum(numbering: "i)")
+ *CI/CD Pipeline Implementation*: \ I automated software build, test, and deployment processes by setting up Jenkins CI/CD pipelines.
+ *Infrastructure Management*: \ I designed infrastructure solutions that could be scaled using physical servers.
+ *Monitoring and Alerting*: \ To ensure system reliability and performance, I implemented monitoring tools such as Grafana, Prometheus, Uptime Kuma as well as set up alerting systems.
+ *Containerization*: \ I utilized Kubernetes (K3S) for managing Docker containers which were orchestrated using Rancher.
+ *Automation and Scripting*: \ My duties also involved writing Bash scripts that would automate routine tasks like deployment processes’ execution or system checks for anomalies detection.
+ *Documentation & Reporting*: \ I kept records of every procedure undertaken along with their configurations before finally compiling performance reports at the end of each month.
+ *Collaboration*: \ Additionally, I worked hand in hand with developers, sysadmins and other team players so as to smoothen integration points between development and deployment workflows
+ *Continuous learning*: \ Staying updated with industry trends and applying new knowledge to improve existing systems.
// + *Security Enhancements*: \ I enforced CI/CD pipeline security measures while making sure our setup met industry standard security requirements which included configuring firewalls or SSL/TLS implementation among others.
// DevOps skills development through practical experience gained while performing these duties.
/*
While working at F1Soft International as a DevOps Engineer intern, I concentrated mainly on bridging the gap between software development and IT operations. I had to work in different facets which were very crucial in this activity aimed at making certain processes are not only simplified but also automated for efficiency purposes. My primary obligation lay with creating CI/CD pipelines using Jenkins; however, my undertakings did not end there.
In addition, I was also deeply involved into managing infrastructure. I made sure that any physical servers put in place had ability to accommodate larger loads without compromising on their performance levels thus coming up with scalable infrastructure solutions. This meant setting up servers, networks and storage systems capable of supporting a growing number of users for an organization while maintaining high speed connectivity among others.
Monitoring along with alerting formed another significant part of what I did during that time period when I worked as such a personnel at Firm. Grafana Promethus Uptime Kuma were among monitoring tools implemented by me so far to oversee system's performance and reliability With my hands-on attitude towards things, therefore, it was important for me also to set up alerting systems which would enable quick identification and resolution of any problems hence minimizing downtimes in general while improving overall efficiency at these levels.
Moreover, containers were not left out in this case. Docker came in handy where I had to containerize different applications before deploying them using Kubernetes (K3s) which were orchestrated through Rancher. As a result, scalability and reliability were enhanced at the same time making updates management much easier than before within the said applications themselves..
While during the internship I was involved in writing Bash scripts that helped automate daily tasks such as deployment processes and system checks, I was also documenting all procedures and configurations in details, which were then used compile monthly performance reports. In order for these development and deployment workflows to seamlessly integrate and operate, it was important that there is collaboration between developers, system administrators as well as other team members. At the same time, I kept an eye on what was going on in the industry so as not be left behind by any new trend since knowledge is power and applied every bit of it towards making things better where necessary thus my experience became very practical thereby greatly boosting skills related with DevOps which has in turn made me better placed for upcoming job opportunities within this particular field.
*/
#v(10pt)
== 3.2. Weekly log
#v(15pt, weak: true)
Following table shows the weekly activities the intern performed throughout their internship period.
*#tbl(
[],
"3.1",
[Weekly Log],
)*
#table(
columns: (0.1fr, 0.4fr ),
inset: (x:5pt, y: 15pt),
align: horizon,
[Week], [Activities],
[ Week 1], [
- Orientation
- Installed CentOS with automatic as well as manual partition and got familiar with Linux commands
- Learned hosting HTML, CSS on nginx and tomcat webserver
- Setup nginx for reverse proxy and load balancing
],
[ Week 2], [
- Explored about HAProxy for load balancing
- Configured firewalld in CentOS for allowing traffic
- Got familiar with SELinux policies
- Hosted tomcat website with Dockerfile
- Learned basic commands used in redis for retrieving and inserting data
- Configured keepalived for loadbalancing and high-availability
- Configured self hosted git server without GUI
- Configured nginx hosted website with SSL certificate
],
[ Week 3], [
- Learned to create own Certificate Autority and generate SSL certificate for client
- Setup mysql database
- Installed and configured MinIO for managing unstructured object data
- Installed monit for process monitoring and configured to send alert email
- Hosted git service like github, gitlab
- Configured uptime-kuma for monitoring services over HTTP/S, TCP, DNS and other protocols
- Learned to create bash script for send email using curl
- Achieved file synchronization between master with worker nodes using lsyncd
- Learned about Network File System for sharing files between nodes within a network
- Learned about traefik for reverse proxy and load balancing
],
[ Week 4], [
- Configured MySQL replication for data backup
- Setup self-hosted registry for docker images i.e. Harbor
- Configured jenkins to push to the self-hosted registry
- Learned to create ansible playbooks
- Configured grafana, loki and prometheus for log collection and their visualization
- Studies about cryptography and PKI
- Setup k3s with rancher to manage kubernetes cluster
],
[ Week 5], [
- Deploy website in nginx using k3s pod
- Learned about kubernetes concepts
- Deployed sidecar contanier in k3s
- Learned to manage LVM partition of linux system
- Deployed a website synchronized with git repo
- Learned about awk and sed command
],
[ Week 6], [
- Configured k3s deployed website with SSL certificate using k3s TLS Secrets
- Learned about ArgoCD for continuous delivery
],
// [ Week 7], [],
// [ Week 8], [],
// [ Week 9], [],
// [ Week 10], [],
// [ Week 11], [],
// [ Week 12], [],
)
#v(10pt)
== 3.3. Description of the Project(s) Involved During Internship
#v(15pt, weak: true)
One of the highlights which really helped me in understanding DevOps principles was working on two minor projects during my internship both using local infrastructure.
*Project 1: Setting up Jenkins and Self-Hosted Docker Registry *
In this project, my main goal was to automate the build and deployment processes by using Jenkins as well as a self-hosted docker registry.
+ *Under Jenkins Configuration*: I installed Jenkins on a local server then did its setup for managing CI/CD pipelines which were continuous integration and continuous deployment. This involved creating Jenkins jobs that would automate building and testing phases of application development.
+ *Setting Up Self-Hosted Docker Registry*: I established an internal docker registry within a server environment so that we could host our docker images locally instead of relying on external registries where we have less control over them or their security levels.
+ *Image Push To Registry*: Thereafter, I configured jenkins pipelines; these would pull source codes from different repositories then build corresponding docker images before pushing these artifacts into my own registry which I had set up before hand thus ensuring all necessary files for deployment are stored in one place for both security
The result was a complete automation of CI/CD pipeline which eliminated manual intervention, reduced errors and made deployment faster within our premises.
*Project 2: Using git-sync with Nginx Deployed In K3S*
During this project work centered around syncing websites hosted on self hosted git services (Gitea/Gogs) with nginx servers deployed inside K3s clusters as well adding SSL certificates deployment along side Mysql replication also .
+ *Git-sync Implementation*: Configured git-sync within the local K3s environment to automatically pull the latest changes from the Git repository (hosted on a local Gitea or Gogs instance). This ensured that the website content was always up-to-date with the latest code changes.
+ *Nginx Deployment*: Deployed Nginx as a reverse proxy in the local K3s cluster to serve the website. Configured Nginx to serve the synchronized content from the Git repository.
+ *SSL Certificates*: Utilized Kubernetes Ingress with TLS secrets to implement SSL certificates for secure HTTPS access to the website. This was done using Let's Encrypt to automatically issue and renew certificates.
// + *MySQL Replication*: Set up MySQL replication locally to synchronize the data of Gitea across different nodes, ensuring high availability and fault tolerance of the version control data.
+ *Monitoring and Logging*: Implemented monitoring and logging solutions using Grafana, Prometheus, and Loki. These tools were configured to monitor the performance and health of the applications, collect logs, and visualize metrics, enabling proactive management and troubleshooting of the deployed applications.
The project demonstrated a robust, automated deployment process with real-time synchronization, secure access, and reliable data replication, all managed within the local infrastructure.
These projects provided hands-on experience with several key DevOps tools and practices, such as Jenkins, Docker, K3s, git-sync, Nginx, SSL certificates. The practical knowledge gained from these projects significantly enhanced my skills in automating, managing, and securing deployments in a production environment, all within the scope of local infrastructure.
#v(10pt)
== 3.4. Tasks / Activities Performed
#v(15pt, weak: true)
*i) Pushing docker image to self hosted container registry* \
In this task, Docker images have been pushed to self hosted container registry using self hosted jenkins by running shell script. Given steps were being followed to do the task:
- Install Jenkins and it's dependencies using following shell script:
#set raw(align: start)
*`File: Jenkins-install.sh`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```bash
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
sudo dnf upgrade
# Add required dependencies for the jenkins package
sudo dnf install fontconfig java-17-openjdk
sudo dnf install jenkins
sudo systemctl enable jenkins
sudo systemctl start jenkins
JENKINS_PORT=8080
PERM="--permanent"
SERV="$PERM --service=jenkins"
firewall-cmd $PERM --new-service=jenkins
firewall-cmd $SERV --set-short="Jenkins ports"
```
)
#box(
width: 1fr,
stroke: black,
```bash
firewall-cmd $SERV --set-description="Jenkins port exceptions"
firewall-cmd $SERV --add-port=$JENKINS_PORT/tcp
firewall-cmd $PERM --add-service=jenkins
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
```
)
- Install and configure Harbor which is self hosted registry using docker with following script and create a new project from Harbor Dashboard.
*`File: Harbor-install-and-configure.sh`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```bash
mkdir -p harbor-setup; cd harbor-setup
wget https://github.com/goharbor/harbor/releases/download/v2.11.0/harbor-online-installer-v2.11.0.tgz
tar xvf harbor-online-installer-v2.11.0.tgz
openssl genrsa -out ca.key 4096
echo -e "\n------------\n Creating Root CA Certificate \n-----------------\n "
openssl req -x509 -new -nodes -sha512 -days 3650 \
-subj "/C=NP/ST=Bagmati Pradesh/L=Kathmandu/O=MeroOrganization/OU=Personal/CN=merodomain.com" \
-key ca.key \
-out ca.crt
echo -e "\n------------\n Generating Server Certificate \n-----------------\n"
openssl genrsa -out meroharbor.com.key 4096
openssl req -sha512 -new \
-subj "/C=NP/ST=Mero State/L=Mero Thau/O=Mero Organization/OU=Personal/CN=meroharbor.com" \
-key meroharbor.com.key \
-out meroharbor.com.csr
cat > meroharbor.com.v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=meroharbor.com
EOF
echo -e "\n------------\n Signing Server Certificate with CA's Certificate \n-----------------\n"
```
)
#box(
width: 1fr,
stroke: black,
```bash
openssl x509 -req -sha512 -days 3650 \
-extfile meroharbor.com.v3.ext \
-CA ca.crt -CAkey ca.key -CAcreateserial \
-in meroharbor.com.csr \
-out meroharbor.com.crt
echo -e "\n------------\n Converting crt to cert \n-----------------\n"
openssl x509 -inform PEM -in meroharbor.com.crt -out meroharbor.com.cert
mkdir -p /etc/docker/certs.d/meroharbor.com:443/
cp meroharbor.com.cert /etc/docker/certs.d/meroharbor.com:443/
cp meroharbor.com.key /etc/docker/certs.d/meroharbor.com:443/
cp ca.crt /etc/docker/certs.d/meroharbor.com:443/
cd harbor; cp harbor.yml.tmpl harbor.yml
sed -i 's|hostname: reg.mydomain.com|hostname: meroharbor.com|; s|certificate: /your/certificate/path|certificate: /etc/docker/certs.d/meroharbor.com:443/meroharbor.com.cert|; s|private_key: /your/private/key/path|private_key: /etc/docker/certs.d/meroharbor.com:443/meroharbor.com.key|' harbor.yml
./prepare
docker compose up -d
```
)
Following picture provide the output of the above shell script:
*#img(
image("report_images/docker compose up.png"),
"3.1",
"Harbor Installation"
)*
*#img(
image("report_images/harbor-project.png"),
"3.2",
"Harbor Project Creation"
)*
\
- Create Dockerfile to build docker image
*`File: Dockefile`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```Dockerfile
FROM nginx:latest
COPY ./mysite /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
```
)
\
// #pagebreak()
*Step 4*: Create a Freestyle Project in Jenkins
*#img(
image("report_images/jenkins-project-creation.png"),
"3.3",
"Creating Jenkins Freestyle Project"
)*
\ \
- Configure the jenkins project by adding *"Exectue shell"* build step and use the following shell script and save the configuration.
#box(
width: 1fr,
stroke: black,
```bash
DOCKER_REGISTRY='meroharbor.com:443'
DOCKER_REPO='my-project'
IMAGE_NAME='my_web'
TAG="build-${BUILD_NUMBER}"
cd /var/lib/jenkins/workspace/MyWeb-DockerFile/
ls -al
docker build -t ${DOCKER_REGISTRY}/${DOCKER_REPO}/${IMAGE_NAME}:${TAG} .
# here password to login is stored in some.txt file
cat some.txt | docker login ${DOCKER_REGISTRY} -u saurab --password-stdin
docker push ${DOCKER_REGISTRY}/${DOCKER_REPO}/${IMAGE_NAME}:${TAG}
docker logout
```
)
- Finally build the project and check the *"Console Output"* to verify if build was successful or not.
*#img(
image("report_images/jenkins-console-output.png"),
"3.4",
"Jenkins Console Output"
)*
#pagebreak()
* ii) Dockerizing nginx hosted website and providing SSL certificate to the website * \
Hosting a website using Nginx and securing it with an SSL certificate is one of the fundamental task DevOps needs to understand. This involved preparing a Dockerfile and configuring the Nginx server to serve the website content and setting up virtual hosts. To ensure secure communication, SSL certificates were generated and installed. openssl tool is used for generating certificates which includes certificate.crt file and private key .key file. Following files were used for dockerization of nginx website:
*`File: generate_certificate.sh`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```bash
#!/bin/bash
set -x
openssl genrsa -out ca.key 4096
echo -e "\n------------\n Creating Root CA Certificate \n-----------------\n "
openssl req -x509 -new -nodes -sha512 -days 3650 \
-subj "/C=NP/ST=Bagmati Pradesh/L=Kathmandu/O=MeroOrganization/OU=Personal/CN=meroCA.com" \
-key ca.key \
-out ca.crt
echo -e "\n------------\n Generating Server Certificate \n-----------------\n"
openssl genrsa -out merowebsite.com.key 4096
openssl req -sha512 -new \
-subj "/C=NP/ST=Mero State/L=Mero Thau/O=Mero Organization/OU=Personal/CN=merowebsite.com" \
-key merowebsite.com.key \
-out merowebsite.com.csr
cat > merowebsite.com.v3.ext <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1=merowebsite.com
EOF
```
)
#box(
width: 1fr,
stroke: black,
```bash
echo -e "\n------------\n Signing Server Certificate with CA's Certificate \n-----------------\n"
openssl x509 -req -sha512 -days 3650 \
-extfile merowebsite.com.v3.ext \
-CA ca.crt -CAkey ca.key -CAcreateserial \
-in merowebsite.com.csr \
-out merowebsite.com.crt
```
)
\
*`File: nginx.conf`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```bash
server {
listen 443;
server_name merowebsite.com;
ssl on;
ssl_certificate /usr/share/nginx/certificates/merowebsite.com.crt;
ssl_certificate_key /usr/share/nginx/certificates/merowebsite.com.key;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
```
)
\
*`File: Dockerfile`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
````Dockerfile
FROM nginx:1.10.1-alpine
COPY jd /usr/share/nginx/html
COPY merowebsite.com.crt /usr/share/nginx/certificates/
COPY merowebsite.com.key /usr/share/nginx/certificates/
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 443
CMD ["nginx", "-g", "daemon off;"]
````
)
#pagebreak()
*iii) Configuring up load balancing* \
Suppose we have four website hosted using nginx at port 1111, 2222, 3333, 4444 with following nginx configuration
*`File: website-for-load-balancing.conf`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```bash
############################################################
# This is for loadbalancing
############################################################
# localhost:1111
server {
listen 1111;
server_name localhost;
root /usr/share/nginx/digital-trend;
index index.html index.htm
}
# localhost:2222
server {
listen 2222;
server_name localhost;
root /usr/share/nginx/jackpiro;
index index.html index.htm
}
# localhost:3333
server {
listen 3333;
server_name localhost;
root /usr/share/nginx/memorial;
index index.html index.htm
}
# localhost:4444
server {
listen 4444;
server_name localhost;
root /usr/share/nginx/shiphile;
index index.html index.htm
}
```
)
#pagebreak()
*a) Using Nginx* \
The following Nginx configuration can be used to set up a load balancer that distributes traffic across multiple backend servers. This setup ensures that requests are balanced between the servers specified in the upstream block.
*`File: haproxy.cfg`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```bash
upstream myapp1 {
server localhost:1111;
server localhost:2222;
server localhost:3333;
server localhost:4444;
}
server {
listen 80;
server_name nginx-load-balancer.com; # domain-name
location / {
proxy_pass http://myapp1;
}
}
```
)
*b) Using HAProxy* \
The following configuration can be used for HAProxy to load balance traffic across multiple nodes, ensuring that if any node goes down, the other nodes will continue to serve the website. This setup distributes incoming traffic using the round-robin algorithm and checks the health of each node to maintain high availability.
*`File: haproxy.cfg`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```
frontend main
bind *:80
timeout client 60s
mode http
default_backend backend_name # <- name of backend specified below
backend backend_name
timeout connect 30s
timeout server 100s
mode http
balance roundrobin
http-request set-header Host load-balanced-website.com
server node1 127.0.0.1:1111 check
server node2 127.0.0.1:2222 check
server node3 127.0.0.1:3333 check
server node4 127.0.0.1:4444 check
```
)
#pagebreak()
*v) Configuring k3s for synchronizing deployed website with code in Gitea* \
K3s, a lightweight Kubernetes distribution, was used for managing containerized applications efficiently. Synchronizing a deployed website with a GitHub repository ensures continuous integration and deployment, allowing the website to reflect the latest code changes automatically.At first setting up the environment involves installing k3s, a lightweight Kubernetes distribution that simplifies cluster setup and management. By running a single command, we install k3s and initiate the server. Configuring `kubectl` ensures that we can manage the k3s cluster efficiently, setting the stage for deploying applications. This streamlined setup process demonstrates k3s’s ease of use and quick deployment capabilities.
To install k3s, execute the following command in your terminal. This command downloads and installs the k3s binary and starts the k3s server.
#box(
width: 1fr,
stroke: black,
```bash
$ curl -sfL https://get.k3s.io | sh -
```
)
Deploying a sample website on k3s involves creating a deployment configuration file (`deployment.yaml`) that defines the desired state of the application, including the number of replicas, container images, and service specifications. Applying this configuration with `kubectl` deploys the website on the k3s cluster.
*`File: nginx-deploymentgit.yaml`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```yaml
apiapiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deploy-resturan
namespace: nginx
labels:
app: nginx-cc
spec:
replicas: 1
selector:
matchLabels:
app: nginx-cc
template:
metadata:
labels:
app: nginx-cc
spec:
containers:
- name: git-sync
image: registry.k8s.io/git-sync/git-sync:v4.2.3
```
)
#box(
width: 1fr,
stroke: black,
```yaml
volumeMounts:
- name: www-data
mountPath: /data
env:
- name: GITSYNC_REPO
value: "http://192.168.33.11:3000/saurab/website-for-git-sync.git"
- name: GIT_SYNC_BRANCH
value: "main"
- name: GITSYNC_ROOT
value: /data
- name: GIT_SYNC_DEST
value: "html"
- name: GITSYNC_ONE_TIME
value: "false"
- name: GIT_SYNC_COMMAND_AFTER
value: "nginx -s reload"
securityContext:
runAsUser: 0
- name: nginx-resturan
image: nginx
ports:
- containerPort: 80
volumeMounts:
- mountPath: "/usr/share/nginx/"
name: www-data
volumes:
- name: www-data
emptyDir: {}
```
)
This `nginx-ingress.yaml` file defines an Ingress resource named nginx-ingress using the Traefik controller, with TLS termination via tls-secret for roltu.com. It routes all HTTP requests to roltu.com to the nginx-service on port 80.
// #pagebreak()
*`File: ingnx-ingress.yaml`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
annotations:
kubernetes.io/ingress.class: "traefik"
```
)
#box(
width: 1fr,
stroke: black,
```yaml
spec:
tls:
- secretName: tls-secret
hosts:
- "roltu.com"
rules:
- host: roltu.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-service
port:
number: 80
```
)
// #pagebreak()
This `nginx-service.yaml` defines a Kubernetes `Service` named `nginx-service` in the `nginx` namespace. It uses a `NodePort` to expose port 80, forwarding traffic from the service on port 80 to the pods labeled `app: nginx-cc` on port 80, accessible via node IP on port 30002.
*`File: nginx-namespace.yaml`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```yaml
apiVersion: v1
kind: Namespace
metadata:
name: nginx
```
)
*`File: nginx-service.yaml`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```yaml
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: nginx
spec:
type: NodePort
selector:
app: nginx-cc
ports:
- port: 80
targetPort: 80
nodePort: 30002
```
)
// #box(
// width: 1fr,
// stroke: black,
// ```yaml
// ```
// )
\
Apply the configuration to the k3s cluster using kubectl using commands as below:
#box(
width: 1fr,
stroke: black,
```bash
$ kubectl apply -f nginx-namespace.yaml
$ kubectl apply -f nginx-deploymentgit.yaml
$ kubectl apply -f nginx-ingress.yaml
$ kubectl apply -f nginx-service.yaml
```
)
The above deployment file to work we need a git repo so for that self hosted Gitea was used. To install the Gitea following bash script is used:
*`File: gitea-installation.sh`*
#v(-11pt)
#box(
width: 1fr,
stroke: black,
```bash
#!/bin/bash
# Create a directory and navigate into it
mkdir gitea
cd gitea
wget -O gitea https://dl.gitea.com/gitea/1.22.0/gitea-1.22.0-linux-amd64
chmod +x gitea
useradd git
groupadd gitservice
chown -R root:gitservice gitea
chmod g+s gitea
mkdir -p /usr/local/bin/gitea
mv gitea /usr/local/bin/gitea
cat > /etc/systemd/system/gitea.service <<-EOF
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
#After=mysqld.service
#After=postgresql.service
#After=memcached.service
#After=redis.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
```
)
#box(
width: 1fr,
stroke: black,
```sh
User=git
Group=gitservice
WorkingDirectory=/usr/local/bin/gitea
ExecStart=/usr/local/bin/gitea/gitea web
Restart=always
Environment=USER=git HOME=/home/git
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
EOF
systemctl start gitea.service
systemctl enable gitea.service
```
)
After installation, the gitea can be accessed using ipaddress along with the port as below:
*#img(
image("report_images/gitea-repo-image.png"),
"3.5",
"Git Repo Locally Hosted"
)*
#pagebreak() |
|
https://github.com/htlwienwest/da-vorlage-typst | https://raw.githubusercontent.com/htlwienwest/da-vorlage-typst/main/lib/elements.typ | typst | MIT License | #import "settings.typ" as settings
// finds the first level one header on this or some previous page
#let heading_near_to_here = context {
let here = here()
let page = here.page()
// get all headings of level 1 after this one
let next_headings = query(heading.where(level: 1).after(here))
// check if there is at least one heading ahead
if (next_headings.len() != 0) {
let n = next_headings.first()
let np = n.location().position().page
// check if the heading is on the same page as we are
if np == page {
// return if so
return n.body
}
}
// if we haven't found any header on this page, we take the
// nearest previous one
let nearest_prev = query(heading.where(level: 1).before(here))
.last()
.body
return nearest_prev
}
// the common header that is used on all pages except the first one
#let common_header(title) = {
// insert the header reference if needed
// header_reference
v(settings.HEADER_INNER_MARGIN)
set text(10pt)
set align(top)
block(
grid(
columns: (1fr, auto),
column-gutter: 2mm,
pad(top: 3mm)[
#grid(
row-gutter: 2mm,
title,
[#heading_near_to_here],
{
v(1mm)
line(length: 100%, stroke: rgb("#c80404"))
},
)
],
pad(top: 1mm, right: -1mm,
image("images/HTLWienWest.png", height: 1.91cm)
)
)
)
}
// the common footer with page number that is used on all pages except the
#let common_footer(participants) = {
set text(10pt)
set align(top)
v(settings.FOOTER_INNER_UPPER_MARGIN)
let page_num = context {
let c = counter(page)
let num = here().page-numbering()
if num == "i" {
c.display(num)
} else {
let n = c.display()
let f = numbering(num, c.final().first())
[#n von #f]
}
}
let authors = participants.map(e => e.vorname + " " + e.nachname).join(", ")
context {
// page number and author side switching on each page
let pair = if calc.rem(here().page(), 2) == 0 {
(page_num, authors)
} else {
(authors, page_num)
}
grid(
columns: (1fr, auto),
inset: 1mm,
stroke: (top: rgb("#c80404")),
..pair
)
}
}
// returns the `Ausgearbieted von ...` string for some heading
#let elaborated_by = context {
let currPage = here().page()
let startOfBody =locate(<startOfBody>).page()
if startOfBody > currPage {
return []
}
let endOfBody =locate(<endOfBody>).page()
if endOfBody <= currPage {
return []
}
// select next heading with level 1 or 2
let next_header_sel = selector(heading.where(level: 1)
.or(heading.where(level: 2)))
.after(here())
// select metadata between this heading and next heading
let meta_sel = selector(metadata)
.before(next_header_sel)
.and()
.after(here())
// get those metadata and filter for author ones
let meta_q = query(meta_sel)
.filter(e => e.value.keys().contains("type"))
.filter(e => e.value.type == "author")
let author = if meta_q.len() != 0 {
meta_q.first().value.value
} else {
return []
}
return [Ausgearbeitet von #author]
}
|
https://github.com/barrel111/readings | https://raw.githubusercontent.com/barrel111/readings/main/problems/external/1910SU/week6.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: Computing Limits",
subtitle: "Solutions",
contents: false,
)
= Compute the following limits.
\
== $lim_(x->oo) (x^2 + 1)/(2 + cos(4x))$
Note that as $2 + cos(4x) <= 3$,
$ (x^2 + 1)/3 <= (x^2 + 1)/(2 + cos(4x)). $
The lower bound tends to infinity as $x -> infinity$. Hence, $lim_(x -> infinity) (x^2 + 1)/(2 + cos(4x)) = oo$ by the Squeeze Theorem.
== $lim_(x -> oo) (2x + sin(x))/(x + 4)$
Consider,
$ lim_(x -> infinity) (2x + sin(x))/(x + 4) = lim_(x -> infinity) (2 + (sin x)/x)/(1 + 4/x) = 2. $
We justify $lim_(x -> infinity) sin(x)/x = 0$ by using the Squeeze Theorem again, nothing that
$ -1/x <= sin(x)/x <= 1/x $
and both $-1/x$ and $1/x$ tend to $0$ as $x -> infinity$.
== $lim_(x -> pi) (sin(x))/(x - pi)$
We can use L'Höpital's rule as this is a $0/0$ indeterminate. So,
$ lim_(x -> pi) (sin x)/(x - pi) = lim_(x -> pi) cos x = -1. $
== $lim_(x -> oo) (3x)/(x^2 - 1)$
We can do this by using L'Höpital's rule or just dividing the numerator and denominator by $x^2$ as follows:
$ lim_(x -> infinity) (3x)/(x^2 - 1) = lim_(x -> infinity) (3/x)/(1 - 1/x^2) = 0/1 = 0. $
= More Limits
== $lim_(x-> 0^+, 1^-, 1^+) 1/(x ln x)$
We consider each limit seperately. First, we just apply L'Höpital's rule to evaluate the limit for $x -> 0^+$.
$ lim_(x -> 0^+) 1/(x ln x) = lim_(x -> 0^+) (1\/x)/(ln x) = lim_(x -> 0^+) (-1/x^2)/(1/x) = lim_(x -> 0^+) -1/x=-oo $.
Next, we consider the limit as $x -> 1^-$. We start by noting that
$ lim_(x -> 1^-) 1/(ln x) = -oo $
as $ln x -> 0$ acquiring just negative values as $x -> 0$. Thus,
$ lim_(x -> 1^-) 1/(x ln x) = lim_(x -> 1^-) 1/x lim_(x -> 1^-) 1/(ln x) = -oo. $
Finally, consider the limit as $x -> 1^-$. Again, as $ln x -> 0$ acquiring just positive values as $x -> 0$. Then,
$ lim_(x -> 1^+) 1/(ln x) = oo. $
Thus,
$ lim_(x -> 1^+) 1/(x ln x) = lim_(x -> 1^+) 1/x lim_(x->1^+) 1/(ln x) = oo. $
A slight remark, we can justify $lim_(x -> 1^+) 1/(ln x) = infinity$ and $lim_(x -> 1^-) 1/(ln x) = -oo$ by using the Squeeze Theorem on the fact that
$ ln x <= x - 1 => 1/(x - 1) <= 1/(ln x). $
== $lim_(x->0) (x^(40) + 2 ln x)/(sqrt(x^(90) + 1) + x^(20))$
$ lim_(x->0) (x^(40) + 2 ln x)/(sqrt(x^(90) + 1) + x^(20)) = (lim_(x -> 0) x^(40) + 2 ln x)/(lim_(x -> 0) sqrt(x^(90) + 1) + x^(20)) = lim_(x -> 0) x^40 + 2 ln x = -oo. $
== $lim_(x->oo) (4e^x - 1)/(4 - e^x)$
Note,
$ lim_(x -> oo) (4e^x - 1)/(4 - e^x) = lim_(x -> oo) (4 - 1/(e^x))/(4/(e^x) - 1) = (4 - lim_(x -> oo)1/e^x)/(-1 + lim_(x -> oo) 4/e^x) = -4. $
== $lim_(x->-1) (ln (x + 2))/(e^(-x) - e)$
We use L'Höpital's rule
$ lim_(x->-1) (ln (x + 2))/(e^(-x) - e) = lim_(x -> -1) (1/(x + 2))/(-e^(-x)) = -1/e. $
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/014%20-%20Khans%20of%20Tarkir/001_The%20Madness%20of%20Sarkhan.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"The Madness of Sarkhan",
set_name: "Khans of Tarkir",
story_date: datetime(day: 27, month: 08, year: 2014),
author: "<NAME>",
doc
)
#emph[The Planeswalker Sarkhan Vol has never had it easy. Born on a windswept, war-torn world where dragons are extinct, he became a Planeswalker as a young man and set out to find and worship the greatest dragons in the Multiverse. ]
#emph[He eventually ran afoul of the one of the oldest and most powerful dragons in existence: the ancient and malevolent elder dragon Planeswalker, <NAME>. With his will broken and his mind unraveling, he became Bolas's servant. In Bolas's thrall, he traveled to Zendikar, entered the mysterious chamber called the Eye of Ugin, and unwittingly helped unleash the plane-ravaging Eldrazi. ]
#emph[Unable to trust his own mind, fearful of Bolas's retribution, and cast out by his own people, Sarkhan Vol has returned to Tarkir. ]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
So I am home again. I look out over the ragged hills and the smoking steppes. This world roars life and screams death, a panorama of struggle and violence. It could be so strong. Yet it is so full of pain. It is damaged, just as I am.
#figure(image("001_The Madness of Sarkhan/01.jpg", width: 100%), caption: [Art by Eytan Zana], supplement: none, numbering: none)
I wandered for so long. What purpose lies before me now? The Eye is empty. The worlds are empty. I return in disgrace because no other plane will have me.
And yet...I hear something. Echoes of thought. What do they say? Do they call my name?
#emph[It all began with dragon's fire, Sarkhan. And dragon's fire will be witness to the end.]
Who are you, unwelcome voice? You have whispered in my brain for so long, but now you shout. Are you an echo from the past? A now that never was? Or perhaps I am mad, just as Bolas said.
#figure(image("001_The Madness of Sarkhan/02.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
Bolas sent me to the Eye. He told me to wait. To stand watch. But when the others came, and when the...Others...left, I was left blinded. Sleeping. And when I confessed my failure, I found that I was a mere witness all along.
The Eye was closed. My eyes were tricked. He left me there to watch. Watch what? Mere images on a cave wall, that writhed and spoke to me. Whispers in the dark. And when the challenge came, all I could do was fail. To fail was to succeed?
I thought Bolas was the one. Old, powerful, foremost among his kind.I sought his service, and he granted it. Fool to think that I was favored in his view. A mere pawn. Now I understand: an intellect as vast as the Multiverse itself sees all the worlds as his playthings.
I am dismissed, a dragon's toy, tossed aside and useless. Rags of thought over dishonored bones. Such is my reward for service.
But a dragon spoke to me once. Whisper to me, King. What is the nature of sacrifice?
#emph[You can heal this place. You can heal yourself.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
I grew up longing for the dragons. My world was—is—torn apart by constant fighting. The clans clashed amid the old ones' bones, as much part of Tarkir as the bloody battlefields. We were savage, but part of me always wondered: how much more fierce had the old ones been?
Like all of my people, I was born to war. Some embraced the warrior's path. They rejoiced in the furious charge and the spray of blood, hurling themselves into battle at the forefront of the Mardu. Others entered the fray out of duty. Not to fight meant cruel death at the hands of the war leaders. And there were the scavengers who tumbled about at the feet of the horses and snatched up what spoils they could in the wake of the warriors.
I was none of these. The song of battle did not fill my heart. To me, warfare was just the reality of life. One wakes, one rides, one fights. That is the daily existence of the Horde. Survival depends on victory: to conquer is to eat.
Still, I had a killer's way. Talent with battle magic, and natural ferocity, made me feared among the Horde. I ripped gaps in the enemy lines and drove foes before my wrath. Those who fought beside me caught my fury and swept over the opposing ranks. Grandfather said my will was unmatched among our people.
The hinterlands. We scorched their clans.
#figure(image("001_The Madness of Sarkhan/03.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
What did we fight for, though, in the end? A scrap of land? A paltry store of foodstuffs? Such conflicts were always so petty, although so many fought and so many died. Wherever we conquered, we did not stay long. Always up and riding with the wind.
I grew sick of the endless blood. Although Grandfather warned against it, I set down my spear and traveled away from the tents. Up into the Qal Sisma Mountains I traveled, seeking a call whose words I did not understand. I wandered alone through the snow, sometimes fighting the huge beasts that prowled there, but I did not know what it was I heard.
#emph[You know what you seek.]
Do I? No, do not speak to the voice. Yet...it seems somehow familiar.
Then one night, under the rainbow curtain, I found a strange thing, like a woven turtle's shell resting on a frozen river. As I approached, a figure rose from the ice and took my own shape! It whispered to me in words that echoed deep within, speaking of the dragons and their might. I reached to touch it, sealing a vow I didn't even realize I had made.
The figure vanished, and I faced a youth seated on the ice, unclothed but for the shell-like headgear covering his face. He rose and draped himself in a bearskin. Then he silently gestured. I followed him into the trees.
#figure(image("001_The Madness of Sarkhan/04.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
There was a cave there, where had gathered a number of others. They regarded me wordlessly from under their hoods until the youth spoke and made motions toward me. Then they all revealed their faces and began a low, murmuring chant. The voice of ages was in it. The voice of...kings.
They remembered the old ones. Although the dragons flew no more, these folk heard the roaring and whispered songs of claws and blood. There was a word. A memory. A name I should know. Do I hear it now?
I spent many moons there among the whisperers, but in the end I could not stay. Talk of memories, echoes of voices: these were not enough to sustain me. I had found a kind of peace, though. Maybe I could carry it with me.
#emph[The whispers are no echo.]
Stay out of my mind, ghost! I deny you. The old ones are gone. Only the one remains. And he was false.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
I returned to my clan to the welcome of my warriors but not of my hordechief. Zurgo's face was dark as I approached. "You dare to return?"
"I required rest and contemplation."
"Are you some Jeskai sandalfoot, then, to sit and think? I require total obedience."
"I am a wing leader. To command best I must be sure of myself."
"To rule is to bleed. So the Edicts say. You will bleed for the Horde."
#figure(image("001_The Madness of Sarkhan/05.jpg", width: 100%), caption: [Art by <NAME>wood], supplement: none, numbering: none)
The Helmsmasher grudgingly sent me forth with a wing of riders to challenge the Sultai, on the border where their stinking swamps fouled our wild lands.
Perhaps those Zurgo assigned me were the dregs of the Horde. Perhaps they did not value my leadership. Whatever the reason, when we joined battle we did not sweep the snakes into the muck. The two sides scuffled like ants at war. None prevailed. At last, in frustration, I charged through the confusion and cleaved the sorcerer who led them.
That should have ended it, but like a serpent with its head cut off, the enemy did not know they were dead. The pointless battle went on and on.
Rage welled up in me. And with it, an inner voice that spoke of stillness. In the midst of the carnage, I found the quiet point.
And there I heard a voice. I knew it was an ancient. I could hear the ages in its words.
#emph[Do you hear it now, Sarkhan?]
The voice spoke in the tongue of dragons. And I replied.
My hands burst into flame. From my soul, a being of pure fire burst into the sky. The dragon raced across the battlefield, burning everything in its path. Flesh crisped, bones cracked. None were spared: horses, riders, naga. Rage and violence incarnate were born within me. I welcomed my fiery child. And I roared!
I fell through dragonfire, glorying in the destruction. The world blazed around me in an endless moment of pure joy. Such passion! I had never felt so alive.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Something must have called to me from beyond my world: the scream of the predator, perhaps? Maybe I have always heard a dragon in my mind. But which dragon?
I was standing in the midst of an endless desert. A red sun clawed my shoulders. The sky was purple. This was no land I had known or even imagined.
As I surveyed the alien landscape, a great shadow fell over me. Overhead wheeled the huge form of a beast I had never seen except in trances and in shamans' paint. Wonder and joy filled me. Cut off from my own world, I had at last found my true kin.
I spent the next years watching and following, learning all I could about the dragons. I had thought the one I saw in my first moments to be a lord of the skies. How foolish and naïve I was then! It was but a lesser breed of their kind. I soon discovered its weakness. It fell to the fire of a mightier beast. I followed the conqueror.
Years passed, and I sought ever larger, older, and more cunning individuals. I tracked them. I learned their names. I marked their roosts. And I saw them all meet their end. But the death of each only spurred me to find one even more powerful, one who was fit to honor as a true king.
#figure(image("001_The Madness of Sarkhan/06.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
One day I came to a fierce new world. Cinders crunched beneath my boots. The sky shuddered with storms. Tangled trees crawled down the slopes to boiling pools of tar. Red rivers clawed through the tortured rock.
As I surveyed the savage landscape, I heard the screeches of countless wild beasts. The air and even the earth reverberated with the growls of carnivores and the death cries of prey. A hot wind scoured my cheeks, and I looked up. The air was filled with mighty wings and fire.
Ah, he was magnificent! Even at distance, his power was evident, in the thick muscles of his neck and jaw, in the forceful stroke of his wings. He was garbed in ash, like the royal robes of a khan.
Then the great predator stooped on some unseen prey. He unleashed a shriek so raw it seemed to tear the land itself. Fire burst from the peaks as the master of the sky dived to meet them.
I had arrived in paradise.
There on Jund also I found tribes of humans, braided and painted hunters who stalked the dragons and took their strength as trophies. Their ways were simple, but their spirit and their daring were unmatched by any but my own folk. An entire hunting party might be lost in the chase, only to be followed by others just as eager. They were strong, in a way so many others were not. I crossed paths with them at times, but never joined their pursuits.
Except once. Old Malactoth—#emph[he] had been a true challenge. The one against whom I would test myself, to offer my fealty. But even he fell.
The sky tyrants of Jund were mere beasts, no matter how powerful. None there deserved my service. And I began to wonder if any dragon lived in all the worlds who could be what I sought. One who could lead me, instruct me, bring out all my potential.
#emph[One did. But you did not listen.]
"I put him where he lies." Did not Bolas tell me this? Or maybe it is Bolas who lies. What dragon did I hear? Who do I hear now? Maybe the mountain seers were right. The world remembers what its people have forgotten.
A name.
Ugin.
I am here now, phantom. You tell me to return. To a world that rejects me, as my master rejected me? What awaits me here?
#emph[Find the doorway.]
Nothing but riddles! Trickery! What doorway? This world is a battleground. Nothing stands for long. What would you have me do?
Tarkir is a place with no future and a contended present. In the long past, though...we humans had built something to endure. Our civilization had lasted for centuries despite the constant attacks of dragons. Or was it because of them? To compete together against a powerful enemy—that was what made us strong. But when the storms stopped, and the sky kings fell, that was the start of our fatal weakness.
I hear the hunters' horns. I feel the arrows' wind. The dust of numberless hooves sweeps across my sight. The battle is on me, as it has always been. The answer is here, somewhere on my world, but not in this place. My travels are not yet at an end.
I hear your voice. I will seek again the whisperers of the mountaintops. Maybe they hear you as well. I will find the door.
I will make us strong again.
#figure(image("001_The Madness of Sarkhan/07.jpg", width: 100%), caption: [Art by Daarken], supplement: none, numbering: none)
|
|
https://github.com/sofianedjerbi/Resume | https://raw.githubusercontent.com/sofianedjerbi/Resume/main/modules_fr/professional.typ | typst | Apache License 2.0 | #import "../brilliant-CV/template.typ": *
#cvSection("Expérience")
#cvEntry(
title: [Ingénieur R&D Microservices | Expert Kotlin/Android],
society: [Ingenico],
date: [Oct 2023 - Présent],
location: [Valence, France (Hybride)],
description: list(
[Développé des bibliothèques Android avec *Kotlin Multiplatform (KMM)* pour terminaux de paiement],
[Architecturé des microservices, améliorant significativement la fiabilité du système],
[Mentoré l'équipe sur les bonnes pratiques *Java/Kotlin*, augmentant la productivité],
)
)
#cvEntry(
title: [Architecte Cloud E-commerce | Développeur Java/Kotlin],
society: [Fiverr],
date: [Juin 2023 - Oct 2023],
location: [Grenoble, France (Télétravail)],
description: list(
[Construit une plateforme e-commerce avec *AWS ECS* et *Fargate*, gérant des centaines de micro-transactions quotidiennes],
[Optimisé les requêtes *DynamoDB* pour améliorer les performances en scénarios de forte charge],
[Créé des tableaux de bord avec *Amazon QuickSight* pour l'analyse des ventes en temps réel],
)
)
#cvEntry(
title: [Architecte Performance Cloud | Développeur Java/Go],
society: [Kaiiju],
date: [Jan 2023 - Oct 2023],
location: [Grenoble, France (Télétravail)],
description: list(
[Architecturé l'infrastructure et la plateforme cloud, réduisant les coûts de 25% pour un service de jeu à fort trafic],
[Conçu un algorithme de compression comme *microservice Go*, réduisant les fichiers de stockage *S3* d'environ 90%],
[Développé un système serverless avec *Lambda* et *DynamoDB* pour les achats in-game],
)
)
#cvEntry(
title: [Ingénieur DevOps Cloud | Administrateur Système],
society: [Kugge],
date: [Août 2021 - Oct 2023],
location: [Grenoble, France (Hybride)],
description: list(
[Conçu des architectures cloud pour hébergeurs, améliorant significativement la disponibilité du système],
[Implémenté l'IaC avec *CloudFormation* et *EKS* pour des déploiements optimisés],
[Développé une solution de sauvegarde avec *S3 Glacier*, réduisant les coûts annuels de sauvegarde de 60%],
)
)
#cvEntry(
title: [Architecte Logiciel Cloud | Développeur Java/Go],
society: [Fiverr],
date: [Jan 2022 - Juil 2022],
location: [Grenoble, France (Télétravail)],
description: list(
[Développé une plateforme d'optimisation d'élevage utilisant des algorithmes génétiques avancés et des modèles statistiques],
[Créé un backend *Java Spring Boot* avec frontend *React* pour une interface éleveur conviviale],
[Implémenté une base de données *PostgreSQL* pour un stockage et une récupération efficaces des données d'élevage],
)
)
#cvEntry(
title: [Ingénieur R&D Sécurité Embarquée | Développeur C++/Python],
society: [CEA],
date: [Déc 2021 - Juin 2022],
location: [Grenoble, France (Sur site)],
description: list(
[Conçu un outil de surveillance d'attaques par rayons X en *C++* et *Python* pour la sécurité des microcontrôleurs],
[Servi comme *développeur principal*, guidant l'équipe et assurant l'atteinte efficace des jalons du projet],
[Développé une *API REST* pour l'analyse de la mémoire RAM et Flash dans les systèmes embarqués],
)
)
#cvEntry(
title: [Développeur Java | Analyste Performance],
society: [Fiverr],
date: [Juin 2019 - Jan 2021],
location: [Grenoble, France (Télétravail)],
description: list(
[Créé un système d'optimisation des performances en *Java 11* pour une plateforme e-learning],
[Implémenté des tests unitaires complets avec *JUnit* pour assurer la fiabilité du code],
[Mis en place un pipeline CI/CD robuste avec *Jenkins*, *Docker*, et *BitBucket*, automatisant les cycles de build, test et déploiement],
)
)
|
https://github.com/typst-community/guidelines | https://raw.githubusercontent.com/typst-community/guidelines/main/src/chapters/api/simplicity.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/src/util.typ": *
#import mantys: *
= Simplicity <sec:api:simple>
Good APIs should be simple, easy to use and aware of their primary use case. Flexibility as discussed in @sec:api:flex should not interfere with the usability of an API.
== Higher Order Templates
A common pattern for Typst templates is to provide a single top level function, which a user imports and applys with a show-all rule, i.e. `show: func`.
This makes for a simple API in the case of no arguments, but requires extra thought when arguments have to be applied.
This idiom also comes with additional boilerplate in almost any template, templates are almost never appled without any arguments.
By using functions as values, a template author can provide a simpler API for the most common use case of applying this function as a template.
Consider returning a function which is applied in the show-all rule from your template function, instead of taking the content itself.
#do-dont[
```typst
#let doc(..args) = body => {
// .. use args
body
}
```
][
```typst
#let doc(..args, body) = {
// .. use args
body
}
```
]
What was previously this:
#codesnippet(
```typst
#import "@preview:template:0.1.0": doc
#show: doc.with(..args)
```
)
Can now be used like this:
#codesnippet(
```typst
#import "@preview:template:0.1.0": doc
#show: doc(..args)
```
)
This also comes with the benefit of being future proof, as current discussions on the #discord[Typst Community Discord] indicate that templates will likely be sets of rules instead of functions in the future.
A template using this idiom can then simply return the styles instead of a function, requiring no other change from a downstream user.
|
https://github.com/vEnhance/1802 | https://raw.githubusercontent.com/vEnhance/1802/main/src/opt.typ | typst | MIT License | #import "@local/evan:1.0.0":*
= Optimization problems
Now that we understand both critical points of $f$ and regions $cal(R)$,
we turn our attention to the problem of finding global minimums and maximums.
== [TEXT] The easy and hard cases
Suppose you have a function $f : RR^n -> RR$ that you can compute $nabla f$ for,
and a region $cal(R)$.
We're going to distinguish between two cases:
- The *easy case* is if $cal(R)$ has dimension $n$ as well.
The rule of thumb says there should be zero "=" constraints.
- The *hard case* is if $cal(R)$ has dimension $n-1$.
Rule of thumb says there should be one "=" constraint.
In the hard case, we will use *Lagrange multipliers*.
We won't cover the case where $cal(R)$ has dimension $n-2$ or less in 18.02
(i.e. two or more constraints), although it can be done.
== [RECIPE] The easy case <sec-recipe-opt-easy>
#recipe(title: [Recipe for optimization without Lagrange Multipliers])[
Suppose you want to find the optimal values of $f : RR^n -> RR$ over a region $cal(R)$,
and $cal(R)$ has dimension $n$.
0. Figure out the boundary and limit cases for the region $cal(R)$.
(You don't need to look at $f$ for this step.)
1. Evaluate $f$ on all the *critical points* of $f$ in the region $cal(R)$.
2. Evaluate $f$ on all the *boundary points* of $f$ in the region $cal(R)$.
3. Evaluate $f$ on all the *limit cases* of $f$ in the region $cal(R)$.
4. Output the points in the previous steps that give the best values,
or assert the optimal value doesn't exist (if points in step 3 do better than steps 1-2).
If there are any points at which $nabla f$ is undefined, you should check those as well.
However, these seem to be pretty rare for the examples that show up in 18.02.
]
#warning(title: [Warning: Don't underestimate the boundary!])[
In 18.01, you probably only optimized functions over intervals $I = [a,b]$,
in which case the boundary was just two inputs $a$ and $b$.
In 18.02, the situation is completely different:
the boundary (if it is nonempty) will often have _infinitely many_ points.
So it can take a lot of work to do the boundary case!
Don't underestimate the possible complexity of Step 2.
In particular, Step 2 might even require you to use Lagrange multipliers,
i.e. that one step of the easy case is an entire instance of the hard case.
For that reason, the naming "easy case" and "hard case" is a bit of a misnomer.
]
We'll start with an example with no boundary for which the limit cases are easy to examine,
so Step 2 and Step 3 are mostly harmless.
Later on we'll do more examples where Step 2 and Step 3 are more intricate.
#sample[
Find the minimum and maximum possible value, if they exist of
$ f(x,y) = x + y + 8/(x y) $
over $x,y > 0$.
]
#soln[
The region $cal(R)$ is the first quadrant
which is indeed two-dimensional (no $=$ constraints),
so we're in the easy case and the recipe applies here.
We check all the points in turn:
0. $cal(R)$ has no boundary and limit cases when any variable approaches $0$ or $+oo$.
1. To find the critical points, calculate the gradient
$ nabla f (x,y) = vec(1 - 8 / (x^2 y), 1 - 8 / (x y^2)) $
and then set it equal to $vec(0,0)$.
This gives us the simultaneous equations
$ 1 = 8 / (x^2 y) = 8 / (x y^2). $
This implies $x^2 y = x y^2$ or $x = y$
(we have $x,y > 0$ in $cal(R)$, so we're not worried about division by zero)
and so the only critical point is $(x,y) = (2,2)$.
2. The region $cal(R)$ has no boundary, so there are no boundary points to check.
3. The region $cal(R)$ has four different kinds of limit cases:
- $x -> 0^+$
- $y -> 0^+$
- $x -> +oo$
- $y -> +oo$.
In fact all four of these cases cause $f -> +oo$.
In each of the first two cases, the term $8 / (x y)$ in $f$ causes $f -> +oo$.
In the case $x -> oo$, the term $x$ causes $f -> +oo$.
In the case $y -> oo$, the term $y$ causes $f -> +oo$.
Putting these together:
- The global minimum is $(2,2)$, at which $f(2,2) = 6$.
- There is no global maximum, since we saw limit cases where $f -> +oo$. #qedhere
]
== [TEXT] Lagrange multipliers
Let $f : RR^n -> RR$ be a function we're optimizing over some region $cal(R)$.
We now turn to the case where $cal(R)$, is dimension $n-1$,
because of a single constraint of the form $g(x,y) = c$ or $g(x,y,z) = c$.
We need a new definition of critical point.
To motivate it, let's consider a particular example in @fig-lm.
Here $n = 2$, and
- $f(x,y) = x^2 + y^2$, and
- $g(x,y) = c$ is the red level curve shown in the picture below;
- $cal(R)$ is just the level curve $g(x,y) = c$ (no further $<$ or $<=$ constraints).
Trying to optimize $f$ subject to $g(x,y) = c$ in this picture is the same as
finding the points on the level curve which are furthest or closest to the origin.
I've marked those two points as $P$ and $Q$ in the figure.
The trick to understanding how to get them is to _also_ draw the level curves for $f$
that pass through $P$ and $Q$: then we observe that the level curves for $f$
that get those minimums and maximums ought to be tangent to $g(x,y) = c$ at $P$ and $Q$.
#figure(
image("figures/minmax-lm.png", width: auto),
caption: [An example of a LM-type optimization problem, where one finds points on $g(x,y) = c$
which optimize $f$],
) <fig-lm>
Now how can we check whether there's a tangency?
Answer: look at the gradient!
We expect that $nabla f$ and $nabla g$, at the points $P$ and $Q$, should point in the same direction.
So that gives us the strategy: look for the points where $nabla f$ and $nabla g$ point the same way.
I don't think the following term is an official name, but I like it, and I'll use it:
#definition[
An *LM-critical point* is a point $P$ on the curve/surface $g(P) = c$ such that _either_
- $nabla f(P) = lambda nabla g(P)$ for some scalar $lambda$; OR
- $nabla g(P) = 0$.
]
Note that there are _two_ possible situations.
If you want, you can think about this as requiring that $nabla f (P)$ and $nabla g (P)$
are _linearly dependent_, so it's only one item.
However, in practice, people end up usually breaking into cases like this.
#digression[
The parameter $lambda$ is the reason for the name "Lagrange multipliers";
it's a scalar multiplier on $nabla g$.
Personally, I don't think this name makes much sense.
Also, some sources will define an LM-critical point in the following
(in my opinion, more confusing) way.
Let's say $f(x,y,z)$ is a three-variable function.
Define a _four-variable_ "Lagrangian function"
$L(x,y,z,lambda) = f(x,y,z) - lambda g(x,y,z)$.
Then an LM-critical point is a point for which either $nabla g = bf(0)$
or $nabla L = 0$, i.e. a normal critical point of $L$.
It can be checked this is equivalent to the original definition,
but I personally find this unnatural.
However, if you like this definition, feel free to use it instead.
]
Now that we have this, we can describe the recipe for the "hard" case.
The only change is to replace the old critical point definition (where $nabla f (P) = 0$)
with the LM-critical point definition.
== [RECIPE] Lagrange multipliers
#recipe(title: [Recipe for Lagrange multipliers])[
Suppose you want to find the optimal values of $f : RR^n -> RR$ over a region $cal(R)$,
and $cal(R)$ has dimension $n-1$ due to a single constraint $g = c$ for some $g : RR^n -> RR$.
0. Figure out the boundary and limit cases for the region $cal(R)$.
(You don't need to look at $f$ for this step.)
1. Evaluate $f$ on all the *LM-critical points* of $f$ that lie on the region $cal(R)$.
2. Evaluate $f$ on all the *boundary points* of $f$ of the region $cal(R)$.
3. Evaluate $f$ on all the *limit cases* of $f$ of the region $cal(R)$.
4. Output the points in the previous steps that give the best values,
or assert the optimal value doesn't exist (if points in step 3 do better than steps 1-2).
If there are any points at which $nabla f$ or $nabla g$ are undefined,
you should check those as well.
However, these seem to be pretty rare for the examples that show up in 18.02.
]
Again, this is the same recipe as @sec-recipe-opt-easy, except we changed "critical point"
to "LM-critical point".
#tip[
Remember how finding critical points could lead to systems of equations that
required quite a bit of algebraic skill to solve?
The same is true for Lagrange multipliers, but even more so,
because of the new parameter $lambda$ that you have to care about.
So the reason this is called the "hard case" isn't because the 18.02 ideas needed are different,
but because the algebra can become quite involved in finding LM-critical points.
In fact, in high school math competitions, the algebra can sometimes become so ugly
that the method of Lagrange multipliers is sometimes jokingly called "Lagrange _murderpliers_"
to reflect the extreme amount of calculation needed for some problems.
]
#sample[
Find the minimum and maximum possible value, if they exist, of
$ f(x,y,z) = x + y + z $
over $x,y,z > 0$ satisfying the condition $x y z = 8$.
]
#soln[
We carry out the recipe.
0. The region $cal(R)$ is two-dimensional, consisting of strict inequalities
$x, y, z > 0$ and the condition $g(x,y,z) = x y z = 8$.
So there is no boundary, but there are limit cases if any variables approaches $0$ or $+oo$.
1. To find the LM-critical points, we need to compute both $nabla f$ and $nabla g$.
We do so:
$ nabla f (x,y,z) &= vec(1,1,1) \ nabla g &= (y z, z x, x y). $
Now, there are no points with $nabla g = vec(0,0,0)$ in the region $cal(R)$,
because in $cal(R)$ all the variables are constrained to be positive.
So we now solve the system
$
1 &= lambda y z \
1 &= lambda z x \
1 &= lambda x y
$
and see what values it takes.
The trick to solving the system of equations is to divide the first two to get
rid of the parameter $lambda$, which we don't really care about, to get
$ 1 / 1 = (lambda y z)/(lambda z x) = y / x. $
So we must have $x = y$.
Similarly, we find $y = z$ and $z = x$.
Hence the LM-critical point must have $x = y = z$.
Since $x y z = 8$, it follows the only LM-critical point is $(2,2,2)$.
Evaluating $f$ here gives $f(2,2,2) = 6$.
2. The region $cal(R)$ has no boundary, because no $<=$ or $>=$ constraints are present.
3. The region $cal(R)$ has limit cases when any of the variables $x,y,z$
either approach $0$ or $+oo$.
However, remember that $x y z = 8$.
So if any variable approaches $0$, some other variable must become large.
Consequently, in every limit case, we find that $f -> +oo$.
Collating all these results:
- The unique global minimum is $(2,2,2)$ at which $f(2,2,2) = 6$.
- There is no global maximum. #qedhere
]
#remark[
If you're paying close enough attention, you might realize this sample question we just did
is a thin rewriting of the example in @sec-recipe-opt-easy.
This illustrates something: sometimes you can rewrite a hard-case optimization problem in $3$
variables to an easy-case one with $2$ variables.
]
== [TEXT] Advice for solving systems of equations (reprise)
Back in @sec-system-advice, when we were finding all the critical points,
I reminded you to be careful about division-by-zero, handle cases carefully,
and gave you some advice for solving systems.
Solving the system for _LM-critical_ points is a similar situation: systems of equations are hard,
and you have to treat it like a self-contained high school algebra puzzle.
For systems of equations generated by Lagrange multipliers,
there's a new feature: a variable $lambda$ whose value is never used,
but which appears in every equation besides the constraint $g = c$.
So a couple tips specific to Lagrange Multiplier systems:
#tip(title: [Tip: Advice for Lagrange Multiplier systems])[
In addition to the tips in @sec-system-advice,
here are some strategies that sometimes help:
- It might make sense to try to get rid of $lambda$ ASAP, if that's easy to do.
After all, we don't actually care what $lambda$ is.
- Alternatively, you can try to kill every variable _except_ $lambda$!
This is commonly used if your equations only involve one non-$lambda$ variable.
That is, solve for $x$ in terms of $lambda$; do the same for $y$ and $z$.
Then plug these in the original constraint equation to solve for $lambda$,
and hence extract $(x,y,z)$.
]
#warning(title: [Warning: Make sure you only divide by nonzero things!])[
Remember: watch out for division by zero!
For example, if you get to the equation $2 lambda y = 10 y$,
for example, this implies EITHER $lambda = 5$ OR $y = 0$.
During the 2024 midterm, an equation like this appeared
as part of a step in a standard Lagrange multipliers question.
Something like 50%-80% of students who got this equation would forget one of the two cases
(which one they forgot about varied).
Don't let this be you!
Whenever you try to cancel, check if it could be zero!
]
Note the second advice bullet is the opposite of the first advice bullet!
Again, systems of equations can't be solved by blindly following recipes.
You should use whatever method you think makes sense for the given problem.
You don't need anyone's permission to use so-and-so approach.
Here's an example where a good idea is to kill $lambda$ ASAP:
#sample[
Use Lagrange multipliers to find the smallest possible value of
$x^2 + x y + y^2 + y$ subject to the constraint $x + 2 y = 3$.
]
#soln[
We want to minimize the function $f (x , y) = x^2 + x y + y^2 + y$
subject to the constraint $g(x , y) = x + 2 y = 3$.
0. The constraint region has no boundary, but limit cases along the line $x + 2y = 3$
if either $x -> +oo$ and $y -> -oo$ and either $x -> -oo$ and $y -> +oo$.
1. Computing the gradients gives
$ nabla f &= vec(2 x + y , x + 2 y + 1) \
nabla g &= vec(1 , 2). $
Note $nabla g$ is never $bf(0)$.
Thus, the Lagrange multiplier equation becomes:
$ vec(2 x + y , x + 2 y + 1) = lambda vec(1 , 2) . $
This gives the following system of equations:
$ 2 x + y &= lambda \
x + 2 y + 1 &= 2 lambda . $
Combining these two equations gives us an easy way to get rid of $lambda$:
$ x + 2y + 1 = 2 dot underbrace((2 x + y), = lambda) = 4x + 2y. $
Cancel out $2 y$ on both sides gives us $x$: $ x + 1 = 4 x ==> x = 1/3 $
Now substitute $x = 1 / 3$ into the constraint $x + 2 y = 3$ to get:
$ 2 y = 3 - 1 / 3 = 8 / 3 ==> y = 4 / 3. $
In other words, the only LM-critical point is $(1/3, 4/3)$, at which point we have
$ f(1/3, 4/3) = (1 / 3)^2 + (1 / 3) (4 / 3) + (4 / 3)^2 + 4 / 3 =
1 / 9 + 4 / 9 + 16 / 9 + 4 / 3 = 11/3. $
2. There is no boundary to check.
3. If any of the variables goes to $+oo$ (and hence the other goes to $-oo$),
the value of $f$ will become large too.#footnote[This is actually a bit tricky to see,
because in this limit case
you have two positive terms $x^2$ and $y^2$ and one negative term $x y$
one idea is to write
$ f(x,y) approx 3 x^2 / 4 + (x / 2 + y)^2 = 3 y^2 / 4 + (x + y / 2)^2 $
for large $x$ and $y$.
The first expression shows that if $x$ is big, then so is $f$;
The first expression shows that if $y$ is big, then so is $f$.
]
In conclusion, the global minimum is $f(1/3, 4/3) = 11/3$.
]
And here's an example where we kill every variable _except_ $lambda$:
#sample[
Use Lagrange multipliers to find the smallest possible value of
$x^2 + y^2 + z^2 + y - z$ subject to the constraint $x + 2 y + 3 z = 4$.
]
#soln[
We want to minimize the function
$f (x , y , z) = x^2 + y^2 + z^2 + y - z$ subject to the constraint
$ (x , y , z) = x + 2 y + 3 z = 4$.
0. The $g = 4$ region is a plane with no boundary but
limit cases if any variable becomes $pm oo$.
1. Let's find all the LM-critical points.
We start by calculating all the gradients:
$ nabla f &= vec(2 x , 2 y + 1 , 2 z - 1) \
nabla g &= vec(1 , 2 , 3) . $
Note the gradient $nabla g$ is never $bf(0)$.
Thus, the Lagrange multiplier equation becomes:
$ vec(2 x , 2 y + 1 , 2 z - 1) = lambda vec(1 , 2 , 3) $
or
$ 2 x &= lambda, \ 2 y + 1 &= 2 lambda , \ 2 z - 1 &= 3 lambda . $
Let's get rid of every variable besides $lambda$, by solving in $lambda$:
$ 2x = lambda &==> x = lambda / 2 \
2 y + 1 = 2 lambda &==> y = lambda - 1 / 2 \
2 z - 1 = 3 lambda &==> z = (3 lambda + 1) / 2. $
Now substitute $x = lambda / 2$, $y = lambda - 1 / 2$, and
$z = (3 lambda + 1) / 2$ into the constraint $x + 2 y + 3 z = 4$:
$ lambda / 2 + 2 (lambda - 1 / 2) + 3 (frac(3 lambda + 1, 2)) &= 4 \
==> lambda / 2 + 2 lambda - 1 + frac(9 lambda + 3, 2) &= 4 \
==> frac(10 lambda + 3, 2) + 2 lambda - 1 &= 4 \
==> 10 lambda + 3 + 4 lambda - 2 &= 8 \
==> 14 lambda + 1 &= 8 \
==> lambda &= 1/2. $
Now that we have $lambda$, plug back in to get $(x,y,z)$:
$ x = lambda / 2 = 1 / 4 , $
$ y = lambda - 1 / 2 = 1 / 2 - 1 / 2 = 0 , $
$ z = frac(3 lambda + 1, 2) = frac(3 (1 / 2) + 1, 2) = frac(3 / 2 + 1, 2) = 5 / 4 . $
This gives a single LM-critical point $(x,y,z) = (1/4, 0, 5/4)$,
where $f(1/4, 0, 5/4) = 3/8$.
2. There are no boundary cases to consider.
3. The limit cases are if one of the variables goes to $pm oo$.
However, in such a situation $f$ obviously becomes large,
so there are no minimums in the situation.
In conclusion, the global minimum is $f(1/4, 0, 5/4) = 3/8$.
]
#digression(title: [Digression: Clever geometric approach for observant students])[
We show a way you can skip all the calculus steps in the previous problem
if you can see how to rewrite the question as a geometry one.
This approach is so clever that you don't even need to find $(1/4, 0, 5/4)$;
it will directly tell you the minimum value.
Don't try this on an exam unless you really know what you're doing.
Let if $P := (x,y,z)$ be a point. Let $cal(H)$ denote the plane $x+2y+3z=4$.
The magic trick is to rewrite
$ f = x^2 + y^2 + z^2 + y - z = x^2 + (y+1/2)^2 + (z-1/2)^2 - 1/2 = P Q^2 - 1/2 $
where $Q := (0, -1/2, 1/2)$.
In other words, $f(P)$ is a shift of the squared distance of $P$ from $Q$.
So actually, the global minimum we found $(1/4, 0, 5/4)$
is the point on the plane $cal(H)$ closest to $Q = (0, -1/2, 1/2)$.
But if all you care about is the distance from $Q = (0, -1/2, 1/2)$ to the $cal(H)$,
then using calculus is overkill: instead use the recipe from way back in @sec-distance-plane:
$ min (P Q) = (|1 dot 0 + 2 dot -1/2 + 3 dot 1/2 - 4|)/(sqrt(1^2+2^2+3^2))
= 7/(2sqrt(14)). $
So the minimum is
$ min(f) = min(P Q)^2 - 1/2 = (7/(2sqrt(14)))^2 - 1/2 = 3/8. $
Thus, an extremely clever student could have bypassed the entire problem
by translating it into a geometry question.
Don't worry, you won't be expected to come up with something like this in 18.02.
]
To top all that of, here is a Lagrange multipliers example that requires
considering tons of cases.
This is probably too lengthy of a calculation for 18.02
because of the amount of arithmetic required; it's here just to illustrate.
#sample[
Find the minimum and maximum possible of $x^3 + 3y^3 + 4z^3$ subject to $x^4 + y^4 + z^4 = 2$.
]
#soln[
The region has no boundary nor limit cases.
So, we will only focus on calculating the LM-critical points.
The gradients of $f(x,y,z) = x^3+3y^3+4z^3$ and $g(x,y,z) = x^4+y^4+z^4$ are given by
$ nabla f &= vec(3x^2, 9y^2, 12z^2) \
nabla g &= vec(4x^3, 4y^3, 4z^3). $
We begin by simplifying each equation:
- $3 x^2 - 4 lambda x^3 = 0$ becomes: $x^2 (3 - 4 lambda x) = 0$.
This gives two possibilities:
- $x = 0$, or
- $lambda = (3) / (4 x)$ (assuming $x != 0$).
- $9 y^2 - 4 lambda y^3 = 0$ becomes: $y^2 (9 - 4 lambda y) = 0$.
This gives two possibilities:
- $y = 0$, or
- $lambda = (9) / (4 y)$ (assuming $y != 0$).
- $12 z^2 - 4 lambda z^3 = 0$ becomes: $z^2 (12 - 4 lambda z) = 0$.
This gives two possibilities:
- $z = 0$, or
- $lambda = 3 / z$ (assuming $z != 0$).
This gives a total of eight cases!
We will go through them all individually.
/ Case 1 where $x = 0$, $y = 0$, $z != 0$:
From the constraint $z^4 = 2$, we get: $ z = pm root(4, 2) . $
Thus, $lambda = 3 / z = pm 3 / root(4, 2)$.
/ Case 2 where $x = 0$, $y != 0$, $z = 0$:
From the constraint $y^4 = 2$, we get: $ y = pm root(4, 2) . $
Thus, $lambda = (9) / (4 y) = pm frac(9, 4 root(4, 2))$.
/ Case 3 where $x != 0$, $y = 0$, $z = 0$:
From the constraint $x^4 = 2$, we get: $ x = pm root(4, 2) . $
Thus, $lambda = (3) / (4 x) = pm frac(3, 4 root(4, 2))$.
/ Case 4 where $x = 0$, $y != 0$, $z != 0$:
From the constraint $y^4 + z^4 = 2$, we solve using
$lambda = (9) / (4 y)$ and $lambda = 3 / z$. Equating these, we get:
$ (9) / (4 y) = 3 / z ==> z = 4 / 3 y . $
Substitute into the constraint:
$ y^4 + (4 / 3 y)^4 = 2 ==> y^4 + 256 / 81 y^4 = 2 . $
This simplifies to:
$ 337 / 81 y^4 = 2 ==> y^4 = 162 / 337 ==> y = pm root(4, 162 / 337) . $
Thus, $z = pm 4 / 3 root(4, 162 / 337)$.
/ Case 5 where $x != 0$, $y = 0$, $z != 0$:
From the constraint $x^4 + z^4 = 2$, we solve using
$lambda = (3) / (4 x)$ and $lambda = 3 / z$. Equating these, we get:
$ (3) / (4 x) = 3 / z ==> z = 4 x . $ Substitute
into the constraint:
$ x^4 + (4 x)^4 = 2 ==> x^4 + 256 x^4 = 2 ==> 257 x^4 = 2 . $
Thus, $x^4 = 2 / 257$, and:
$ x = pm root(4, 2 / 257) , quad z = pm 4 root(4, 2 / 257) . $
/ Case 6 where $x != 0$, $y != 0$, $z = 0$:
From the constraint $x^4 + y^4 = 2$, we solve using
$lambda = (3) / (4 x)$ and $lambda = (9) / (4 y)$. Equating these, we
get: $ (3) / (4 x) = (9) / (4 y) ==> y = 3 x . $
Substitute into the constraint:
$ x^4 + (3 x)^4 = 2 ==> x^4 + 81 x^4 = 2 ==> 82 x^4 = 2 . $
Thus, $x^4 = 1 / 41$, and:
$ x = pm root(4, 1 / 41) , quad y = pm 3 root(4, 1 / 41) . $
/ Case 7 where $x != 0$, $y != 0$, $z != 0$:
Equating the three expressions for $lambda$:
$ (3) / (4 x) = (9) / (4 y) = 3 / z . $ From
$(3) / (4 x) = (9) / (4 y)$, we get $y = 3 x$, and from
$(3) / (4 x) = 3 / z$, we get $z = 4 x$. Substitute into the
constraint:
$ x^4 + (3 x)^4 + (4 x)^4 = 2 ==> x^4 + 81 x^4 + 256 x^4 = 2 ==> 338 x^4 = 2 . $
Thus, $x^4 = 2 / 338$, and:
$ x = pm root(4, 1 / 169) , quad y = pm 3 root(4, 1 / 169) , quad z = pm 4 root(4, 1 / 169) . $
Since $169 = 13^2$ is a square, this could be written more simply as
$ x = pm 1 / sqrt(13) , quad y = pm 3 / sqrt(13) , quad z = pm 4 / sqrt(13) . $
/ Case 8 where $x = 0$, $y = 0$, $z = 0$:
This doesn't yield a valid solution because it doesn't like on the constraint $x^4+y^4+z^4=2$.
Hence there are a whopping total of $26$ LM-critical points.
They are:
- $x = 0$, $y = 0$, $z = pm root(4, 2)$,
- $x = 0$, $y = pm root(4, 2)$, $z = 0$,
- $x = pm root(4, 2)$, $y = 0$, $z = 0$,
- $x = 0$, $y = pm root(4, 162 / 337)$, $z = pm 4 / 3 root(4, 162 / 337)$.
- $x = pm root(4, 2 / 257)$, $z = pm 4 root(4, 2 / 257)$, $y = 0$,
- $x = pm root(4, 1 / 41)$, $y = pm 3 root(4, 1 / 41)$, $z = 0$,
- $x = pm 1 / sqrt(13)$, $y = pm 3 / sqrt(13)$, $z = pm 4 / sqrt(13)$.
When searching for the maximum, we should always take $+$ for $pm$ to maximize $f(x,y,z)$;
similarly, the minimum uses only $-$ for $pm$.
Note also that plugging in all $-$'s is the negative of plugging in all $+$'s.
So this reduces us from $26$ cases to just $7$.
If we actually try all seven, we find that the last one is the optimal one;
that is, the maximum and minimums are
$ f(1/sqrt(13), 3/sqrt(13), 4/sqrt(13)) &= 2sqrt(13) \
f(-1/sqrt(13), -3/sqrt(13), -4/sqrt(13)) &= -2sqrt(13). #qedhere $
]
== [TEXT] Example of easy case with a "common-sense" boundary
As we alluded to earlier, the boundary of the so-called "easy case" can have infinitely
many points, so you cannot just plug them in one by one to inspect them all.
In some situations, it will still be doable just by inspection,
because the function is really easy to describe on the boundary.
We give one such example below.
#sample[
Find the minimum possible value of
$ f(x,y) = x^2 + y^2 + x y - 6 y $
in the first quadrant $x,y >= 0$.
]
#soln[
Follow the recipe:
0. The first quadrant has limit cases if either $x -> +oo$ or $y -> +oo$.
The boundary consists of two rays: the positive $x$ axis (from $(0,0)$ due east)
and the positive $y$ axis (from $(0,0)$ due north).
1. We calculate the critical points.
The gradient is given by
$ nabla f = vec(4x + y, 2y + x - 6). $
Setting the gradient to the zero vector, we need to solve the system
$ 4x + y = 0 \ x + 2y - 6 = 0 $
which is an easy linear system.
If we let $y = -4x$ from the first equation, we get
$ 2 (- 4 x) + x - 6 = 0 ==> - 8 x + x - 6 = 0 ==> - 7 x = 6 ==> x = - 6 / 7 . $
Since we are working in the first quadrant where $x gt.eq 0$, this value is not valid.
Therefore, there are no critical points in our region $cal(R)$.
2. As we saw, we have two boundaries.
There are infinitely many points on the positive $x$ and $y$ axis,
so we cannot just plug them all in one by one.
In principle, you could redo the entire easy-case recipe for each boundary parts,
and it will work.
However, luckily, the function is quite easy to analyze on each part,
and we can do it with just high school algebra, no calculus needed.
This way we don't need to go through the whole recipe again.
/ The boundary of $x = 0$ and $y >= 0$:
Substitute $x = 0$ into the function:
$f (0 , y) = 2 (0)^2 + y^2 + 0 dot y - 6 y = y^2 - 6 y$.
In other words, we need to see what the smallest value of
$ f(0,y) = y^2-6y " across all " y >= 0 $
could be.
You _could_ use the derivative of $y$,
but I think the fastest thing to do is actually complete the square: the function
$ f(0,y) = (y-3)^2 - 9 $
obviously has the smallest value at $f(0,3) = -9$.
(And $f(0,0) = 0$ and $f(0,+oo) = +oo$ are both worse.)
/ The boundary of $y = 0$ and $x >= 0$:
Substitute $y = 0$ into the function:
$ f (x , 0) = 2 x^2 + 0^2 + x (0) - 6 (0) = 2 x^2 . $
It's obvious that $f(x,0)$ is minimized at $x = 0$.
(Note that $f(+oo,0) = +oo$ is worse.)
3. In the limit case where either $x -> +oo$ and $y -> +oo$ it's clear that $f -> +oo$.
In conclusion, the best value is actually the one from Step 2: we have $f(0,3) = -9$
being the smallest possible value.
]
== [TEXT] Example of easy case that ends up using Lagrange multipliers for the boundary
Now here's a case where the boundary requires Lagrange multipliers.
So, it's really a hard-case optimization problem _within_ an easy-case optimization problem.
If you've seen the movie _Inception_, yes, one of those.
#sample[
Find the minimum and maximum possible value, if they exist, of
$ f(x,y,z) = x^4 + y^4 + z^4 $
over the region $x^2 + y^2 + z^2 <= 1$.
]
#soln[
At first glance, this seems like it should be in the easy case!
The region $cal(R)$ consisting of the closed ball $x^2 + y^2 + z^2 <= 1$ is indeed three-dimensional.
But the reason this sample question is in this section is because
we will find that checking the boundary case requires another application of Lagrange multipliers.
Let's carry out the easy case recipe.
0. There are no limit cases, but a boundary $x^2 + y^2 + z^2 = 1$, the unit sphere (not filled).
1. First let's find the critical points of $f(x,y,z) = x^4 + y^4 + z^4$.
Write $ nabla f = vec(4x^3, 4y^3, 4z^3). $
Solving the insultingly easy system of equations $4x^3 = 4y^3 = 4z^3 = 0$
we see the only critical point is apparently $x=y=z=0$.
The value there is $f(0,0,0) = 0$.
2. The boundary of $cal(R)$ is $x^2 + y^2 + z^2 = 1$, the unit sphere;
we denote this sphere by $cal(S)$.
So now we have to evaluate $f$ on this boundary.
The issue is that there are too many points on this unit sphere!
We can't just check them one by one.
And unlike the previous example,
the function is not simple enough that we can use common sense to deal with it.
Therefore, we will use Lagrange multipliers
with the constraint function $g(x,y,z) = x^2+y^2+z^2$
to find the minimum possible value of $f$ on this new region $cal(S)$.
0. The new region $cal(S)$ has no boundary and no limit cases.
1. Let's find the LM-critical points for $f$ on $cal(S)$.
Take the gradient of $g$ to get
$ nabla g = vec(2x, 2y, 2z). $
The only point at which $nabla g = bf(0)$ is $x=y=z=0$ which isn't on the sphere $cal(S)$,
so we don't have to worry about $nabla g = bf(0)$ the case.
Now we instead solve
$ vec(4x^3, 4y^3, 4z^3) = lambda vec(2x, 2y, 2z). $
This requires some manual labor to solve, because there are lots of cases.
The equation for $x$ says that
$ 4x^3 = lambda dot 2 x <==> x = 0 " or " x = pm sqrt(lambda/2) $
and similarly for $y$ and $z$:
$ 4y^3 = lambda dot 2 y &<==> y = 0 " or " y = pm sqrt(lambda/2) \
4z^3 = lambda dot 2 z &<==> z = 0 " or " z = pm sqrt(lambda/2) $
A priori, this seems like it will require us to take a lot of cases.
However, we can take advantage of symmetry to reduce the amount of work we have to do.
The trick is to get rid of $lambda$ as follows:
#align(center)[
_Observation: All the nonzero variables $x$, $y$, $z$ should have the same absolute value._
]
To spell it out:
- If all three variables are nonzero, then $|x| = |y| = |z| = 1/(sqrt(3))$
(because $x^2+y^2+z^2=1$ as well).
- If two variables are nonzero, then their absolute values are $1/(sqrt(2))$ by the same token.
- And if only one variable is nonzero, it is $pm 1$.
(Note of course that $(0,0,0)$ does not lie on $cal(S)$.)
Think about why this works.
So there are *26 LM-critical points* given by the following list:
- $(pm 1/(sqrt(3)), pm 1/(sqrt(3)), pm 1/(sqrt(3)))$; there are 8 points in this case.
The $f$-values are all $1/3$.
- $(pm 1/(sqrt(2)), pm 1/(sqrt(2)), 0)$; there are 4 points in this case.
The $f$-values are all $1/2$.
- $(pm 1/(sqrt(2)), 0, pm 1/(sqrt(2)))$; there are 4 points in this case.
The $f$-values are all $1/2$.
- $(0, pm 1/(sqrt(2)), pm 1/(sqrt(2)))$; there are 4 points in this case.
The $f$-values are all $1/2$.
- $(pm 1, 0, 0)$; there are 2 points in this case.
The $f$-values are all $1$.
- $(0, pm 1, 0)$; there are 2 points in this case.
The $f$-values are all $1$.
- $(0, 0 pm 1)$; there are 2 points in this case.
The $f$-values are all $1$.
Phew! Okay. The other cases are much shorter:
2. $cal(S)$ has no boundary to consider.
3. $cal(S)$ has no limit cases to consider.
3. $cal(R)$ has no limit cases to consider.
Okay, marathon done. Collate everything together.
The values of $f$ we saw were $0$, $1/3$, $1/2$ and $1$,
and there were no limit cases of any sort. So:
- $f(0,0,0) = 0$ is the global minimum.
- $f(pm 1,0,0) = f(0,pm 1,0) = f(0,0, pm 1) = 1$ are the global maximums. #qedhere
]
== [SIDENOTE] A little common sense can you save you a lot of work
If you step back and think a bit before you try to dive into calculus,
you might find that having a bit of "common sense" might save you a lot of work.
What I mean is, imagine you gave the question to your high school self
before you learned _any_ calculus at all.
Would they be able to say anything about what properties the answer could have?
The answer is, yes, pretty often.
Let's take the example we just did: we asked for the minimum and maximum of
$ f(x,y,z) = x^4 + y^4 + z^4 $
over the region $x^2 + y^2 + z^2 <= 1$.
To show the recipe, I turned off my brain and jumped straight into a really long calculation.
But it turns out you can cut out a lot of the steps if you just use some common sense,
not involving any calculus:
- The _minimum_ is actually obvious: it's just $0$,
because fourth powers are always nonnegative!
So $f >= 0$ is obvious even to a high schooler, and $f(0,0,0) = 0$.
- For the _maximum_ you can actually see
_a priori_ that it must occur on the boundary $x^2 + y^2 + z^2 = 1$.
Why is this?
Suppose you had a point in the strict interior $P = (0.1, 0.2, 0.3)$ with $f > 0$.
Then $f(P) = f(0.1, 0.2, 0.3)$ is some number.
But you could obviously increase the value of $f$ just by scaling the absolute value
of things in $P$!
For example, if I double all the coordinates of $P$ to get $Q = (0.2, 0.4, 0.6)$,
then $f(Q) = 16 f(P)$.
As long as $Q$ stays within the sphere, this will be a better value.
So any point in the interior is obviously not a maximum:
if you have a point $P$ strictly the interior,
you could increase $f(P)$ by moving $P$ farther from the origin.
That means if we had used a bit of common sense,
we could have gotten the minimum with no work at all,
and we could have skipped straight to the LM step for the maximum.
So if you aren't too overwhelmed by material already in this class,
look for shortcuts like this when you can.
#digression(title: [Digression: Even faster solution for observant students])[
We saw the minimum is obviously $0$ if you just thought about it.
In fact, you can _also_ similarly find the maximum with no calculus at all
if you realize the answer should be $f(1,0,0) = 1$.
Here's how. What we're trying to prove is that
$ x^4 + y^4 + z^4 <= 1 $
whenever $x^2+y^2+z^2 <= 1$.
Because $y^2$ and $z^2$ are nonnegative, it's obvious that $x^2 <= 1$.
But in fact it's easy to see that $ x^4 <= x^2 " is true whenever " x^2 <= 1. $
Similarly, $y^4 <= y^2$ and $z^4 <= z^2$.
Thus
$ x^4 + y^4 + z^4 <= x^2 + y^2 + z^2 = 1. $
]
== [SIDENOTE] Compactness as a way to check your work
This is an optional section containing a nice theorem from
18.100 that could help you check your work,
but isn't necessary in theory if you never make mistakes.
(But in practice...)
I need a new word called "compact", and like before,
it's beyond the scope of 18.02 to give a proper definition.
However, I will hazard the following one: for 18.02 examples,
*$cal(R)$ is compact if there are no limit cases*.
That is,
- All the constraints are $=$, $<=$, or $>=$; no $<$ or $>$,
- None of the variables can go to $pm oo$.
#tip(title: [Tip: Compact optimization theorem])[
If $cal(R)$ is a compact region,
and $f$ is a function to optimize on the region which is continuously defined everywhere,
then there must be at least one global minimum, and at least one global maximum.
]
This works in both the easy case (no Lagrange multipliers) and the hard case (with Lagrange multipliers).
Here's some examples of how this theorem can help you:
#example[
- Suppose you are asked to optimize a continuous function $f(x,y)$
on the square $-1 <= x <= 1$, $-1 <= y <= 1$.
We saw this square has no limit cases.
Then the compact optimization theorem promises you that the answer
"no global minimum" or "no global maximum" will never occur.
- Suppose you are asked to optimize a continuous function $f(x,y,z)$
on the sphere $x^2 + y^2 + z^2 = 1$
(which means you are probably going to use Lagrange multipliers).
We saw this sphere has no limit cases (and not even a boundary).
Then the compact optimization theorem promises you that the answer
"no global minimum" or "no global maximum" will never occur.
- Suppose you are asked to optimize a continuous function $f(x,y,z)$
on the closed ball $x^2 + y^2 + z^2 <= 1$, like in the last example.
This closed ball also has no limit cases,
so the compact optimization theorem promises you that the answer
"no global minimum" or "no global maximum" will never occur.
]
== [RECAP] Recap of Part Foxtrot on Optimization
- We introduced the notion of critical points as points where $nabla f = bf(0)$.
- We saw that critical points could be local minimums, local maximums, or saddle points.
- We introduced the second derivative test as a way to tell some of these cases apart,
although the second derivative test can be inconclusive.
- We talked about how regions have dimensions, limit cases, and boundaries.
Although we didn't give a proper definition, we explain rules of thumb that work in 18.02.
- For optimization problems with no $=$ constraints,
we check the critical points, limit cases, and boundaries.
- For optimization problems with one $=$ constraints,
we check the LM-critical points, limit cases, and boundaries.
- Finding either critical points or LM-critical points involves solving systems of equations.
There is no fixed recipe for this, but we gave some possible strategies
that you can try depending on the exact shape of the system you get.
== [EXER] Exercises
#exer[
Let $A B C$ be the triangle in the $x y$-plane with vertices
$A = (-5,0)$, $B = (0,12)$, $C = (9,0)$.
For what point $P$ in the plane is the sum
$ P A ^ 2 + P B ^ 2 + P C ^ 2 $
as small as possible?
] <exer-opt-geo>
#exer[
Compute the minimum possible value of $x+y$ given that $sin(x)+sin(y)=1$ and $x,y >= 0$.
] <exer-opt-lm-sin>
#exerstar[
Compute the maximum possible value of
$ 15x^2 + 12 x y + 16 x z + 6 y^2 + 8 z^2 $
subject to $x,y,z >= 0$ and $x^3 + (x+y)^3 + (x+z)^3 = 1$.
] <exer-opt-lm-hell>
#pagebreak()
|
https://github.com/heloineto/utfpr-tcc-template | https://raw.githubusercontent.com/heloineto/utfpr-tcc-template/main/template/title-page.typ | typst | #let title-page(
title: "",
authors: (),
city: "",
year: "",
english-title: "",
advisor: "",
goal: []
) = {
[
#set align(center)
#set text(weight: "bold")
#block(
width: 100%,
height: 10em,
(authors.map(author => upper(author)).join("\n"))
)
#block(
width: 100%,
height: 6em,
upper(title)
)
#block(
width: 100%,
height: 5em,
english-title
)
#align(right)[
#block(width: 52.5%)[
#set text(size: 10pt, weight: "regular")
#set align(left)
#set par(justify: true)
#goal
#linebreak()
#advisor
]
]
#align(bottom)[
#upper(city)
#linebreak()
#year
]
]
pagebreak()
} |
|
https://github.com/toihr/array.typ | https://raw.githubusercontent.com/toihr/array.typ/main/README.md | markdown | MIT License | # array.typ
A collection of advanced array functions for the typst language
|
https://github.com/WinstonMDP/math | https://raw.githubusercontent.com/WinstonMDP/math/main/cfg.typ | typst | #let cfg(it) = {
show math.equation.where(block: false): math.display
it
}
#let all(c) = $forall #c thick$
#let ex(c) = $exists #c thick$
#let exo(c) = $exists! #c thick$
#let nex(c) = $exists.not #c thick$
|
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/style-05.typ | typst | Other | // Test different font.
#show math.equation: set text(font: "Fira Math")
$ v := vec(1 + 2, 2 - 4, sqrt(3), arrow(x)) + 1 $
|
https://github.com/jamesrswift/pixel-pipeline | https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/src/pipeline/lib.typ | typst | The Unlicense | #import "../math/vector.typ"
#import "../utility/lib.typ" as utility
#import "sorting/lib.typ" as sorting
#import "stages/lib.typ" as stages
#import "primitives.typ"
#import "middleware.typ"
#import "space.typ"
#let stages-render(commands, middleware) = {
commands.map(cmd=>cmd + middleware(cmd,(:)))
}
#let stages-measure(commands, middleware) = {
commands.map(cmd=>cmd + middleware(cmd,(:)))
}
#let stages-layout(commands, middleware, scale: 1em) = {
commands.map(cmd=>cmd + middleware(cmd,(:)))
}
///
#let factory(
layers: (),
anchor-sorter: sorting.dependency,
) = {
let active-middleware = layers.map(layer=>layer.keys())
.flatten()
.dedup()
// TODO: There must be a better way of doing this without going through
// layers multiple times
let validate-middleware = middleware.through-layers(layers, "validation")
let compute-middleware = middleware.through-layers(layers, "compute")
let vertex-middleware = middleware.through-layers(layers, "vertex")
let render-middleware = middleware.through-layers(layers, "render")
let layout-middleware = middleware.through-layers(layers, "layout")
/// - commands (array): Test
return (commands, scale: 1em) => {
// Early exit where there aren't any commands. This is usually
// the case when someone is still declaring things in code, so
// lets not have this be a fatal error
if type(commands) != array {return}
if commands.len() == 0 {return}
// TODO: Input assembly stage
// Stage: Validation ------------------------------------------------------
if "validation" in active-middleware {
let results = validate-middleware(commands, ())
if results.len() > 0 {panic(results)}
}
// Stage: Compute ---------------------------------------------------------
if "compute" in active-middleware {
commands = stages.compute(commands, compute-middleware)
}
// Stage: Vertex ----------------------------------------------------------
// This stage takes every position, and attempts to transform it from one
// space to another. Where a point is relative to another, for each space,
// it is checked whether both points exist in the same space. If so, the
// position that is relative is made relative to the point (if any) the anchor
// itself is relative to.
if "vertex" in active-middleware {
if anchor-sorter != none {commands = anchor-sorter(commands)}
let available-anchors = (:)
// TODO: Make into mapping or otherwise refactor
// for (index, cmd) in commands.enumerate() {
// let resolved-named = (:)
// let resolved-positioned = ()
// for (name, position) in cmd.positions.named() {
// if "relative" in position {
// }
// resolved-named.insert(name, position)
// }
// for (position) in cmd.positions.pos(){
// if "relative" in position {
// let (obj, anchor) = position.relative.split(".")
// if obj == "" {
// anchor = anchor.slice(1)
// } else {
// }
// }
// resolved-positioned.push(position)
// }
// available-anchors += resolved-named
// commands.at(index).positions = arguments(
// ..resolved-named,
// ..resolved-positioned
// )
// }
// let x = available-anchors
}
// transformation
// Anchor shader (pipeline space - relative)
// BVH sorted (structured)
// Intersection tests
// Final vertex projection
commands = commands.map( cmd => {
if "positions" not in cmd {return cmd}
cmd.positions = utility.arguments.map(cmd.positions, (pos) => {
primitives.position(
vector.scale(pos.position, scale),
space: "screen",
relative: pos.at("relative", default: none),
)
})
return cmd
})
// Stage: Render ----------------------------------------------------------
if "render" in active-middleware {
commands = stages-render(commands, render-middleware)
}
// Stage: Layout ----------------------------------------------------------
commands = commands.filter(cmd => cmd != none)
context if "layout" in active-middleware {
let commands = commands.filter(
cmd => cmd.at("content", default: none) != none
)
if commands.len() == 0 {return}
// Provide measure of content, but allow it to be overriden
commands = commands.map(cmd => (: measures: measure(cmd.content)) + cmd)
// Invoke layout middleware and pass to typesetter
commands = stages-layout(commands, layout-middleware, scale: scale)
stages.typeset(commands)
// return commands
}
}
} |
https://github.com/CHHC-L/JI-Lab-Report-Typst | https://raw.githubusercontent.com/CHHC-L/JI-Lab-Report-Typst/master/template.typ | typst | #import "@preview/physica:0.9.3": *
#let project(course: "", code: "", lab: 0, title: "", authors: (), date: none, body) = {
// Set the document's basic properties.
set document(author: authors.map(a => a.name), title: title)
set page(
margin: (left: 30mm, right: 30mm, top: 30mm, bottom: 30mm),
number-align: right,
)
set text(font: "New Computer Modern", lang: "en")
show math.equation: set text(weight: 400)
set heading(numbering: "1.")
show heading.where(level: 1): it=>{
v(0.4em)
text(weight: 700, size: 1.2em)[#it]
v(0.4em)
}
show heading.where(level: 2): it=>{
v(0.4em)
text(weight: 700, size: 1.1em)[#it]
v(0.4em)
}
// cover header row
align(center)[
#line(length: 100%)
#show: smallcaps
#block(text(1.5em, "UM–SJTU Joint Institute"))
#v(1.5em)
#block(text(1.5em, course))
#block(text(1.5em, "("+code+")"))
#line(length: 100%)
]
// title
align(center)[
#v(15em)
#show: smallcaps
#block(text(1.5em, "Laboratory Report"))
#v(1.5em)
#block(text(1.5em, "Lab " + str(lab)))
]
align(center)[
#block(text(1.5em, title))
]
// Author information.
align(left+bottom)[
#grid(
columns: (1fr,) * calc.min(3, authors.len()),
gutter: 1em,
..authors.map(author => align(center,{align(left)[
Name: #author.name \
ID: #author.affiliation
]}),
))
#v(1em)
#date
#v(2em)
]
pagebreak()
set page(
numbering: "1",
header: [
#code Lab #lab #h(1fr) Laboratory Report
],
header-ascent: 50%,
)
// Main body.
set par(justify: true)
[
#counter(page).update(1)
#body
]
}
|
|
https://github.com/linhduongtuan/BKHN-Thesis_template_typst | https://raw.githubusercontent.com/linhduongtuan/BKHN-Thesis_template_typst/main/README.md | markdown | Apache License 2.0 | # BKHN-Thesis_template_typst
The *Typst* template for writting the (under)graduation thesis at Hanoi University of Science and Technology.
## Why use typst
Compared with Latex, typst has a more concise [grammar](https://typst.app/docs/reference/syntax/), and a more user-friendly [tutorial and documentation](https://typst.app/docs/tutorial/ ). In addition to its syntax for supporting user-defined styles, typst has a syntax that is highly similar to markdown, enabling non-template editors to better focus on document writing itself. Moreover, typst has a fast compilation speed, and with [vscode typst lsp](https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp) the function of monitoring and modifying automatic compilation, you can preview the compiled files in real time pdf file.
Another way you can edit and compile your files using *Typstudio* [at here](https://github.com/Cubxity/typstudio).
You can speed through typst from [here](https://typst.app/docs/tutorial)
## Usage Typst and this repository
### Install typst
[typst Github homepage](https://github.com/typst/typst) provides a detailed installation tutorial.
#### Use your local machine
``` shell
# macOS or Linux using Homebrew
brew install typst
# Arch Linux
pacman -S typst
```
### How to compile
``` shell
# for linux and macos
$ make
# for Windows
$ .\make.bat
```
### An example thesis
Please check file `thesis.pdf`
### How you can compose your documents?
Modify the files in the `contents` directory
## License
This template is released under the Apache License. See the [LICENSE](./LICENSE) file for more details.
### If you want to learn how to create another thesis template, please refer to [my other repository](https://github.com/linhduongtuan/DTU-Thesis-template).
### If you want to learn how to create presentation slides, please refer to [my other repository](https://github.com/linhduongtuan/DTU-typst-presentation).
### If you want to learn how to create a scientific poster, please refer to [my other repository](https://github.com/linhduongtuan/VNUHCM-typst-poster).
### For further reference:
- *If you want to learn how to create a poster template, please refer to [my other repository](https://github.com/linhduongtuan/VNUHCM-typst-poster).*
- *If you want to learn how to create presentation slides, please refer to [my other repository](https://github.com/linhduongtuan/DTU-typst-presentation).*
- *If you want to learn how to create another thesis template, please refer to [my other repository](https://github.com/linhduongtuan/DTU-Thesis-template).*
#### Acknowledgements:
- (1) https://github.com/jujimeizuo/ZJGSU-typst-template
- (2) https://github.com/werifu/HUST-typst-template
- (3) https://github.com/QQKdeGit/bupt-typst
- (4) https://github.com/shuosc/SHU-Bachelor-Thesis-Typst
- (5) **https://github.com/linhduongtuan/DTU-Thesis-template**
|
https://github.com/AU-Master-Thesis/thesis | https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/sections/5-discussion/study-3.typ | typst | MIT License | #import "../../lib/mod.typ": *
#pagebreak(weak: true)
== #study.H-3.full.n <s.d.study-3>
Here the results from the third contribution #study.H-3.name are deliberated. The results of the global planning layer and the tracking factor are discussed in @s.d.global-planning and @s.d.tracking-factor, respectively.
// 1. about the global planning layer
=== On the Global Planning Layer <s.d.global-planning>
The global planner has successfully been implemented with the pseudo-optimal #acr("RRT*") methodology, which provides very satisfactory results in a highly complex maze-like environment. The robots' ability to navigate in these environment by themselves has been introduced with this contribution, which was not a possibility with #gbpplanner@gbpplanner.
//which is completely manual in this aspect.
// Stuff about the gathered results
The results of the global planning layer are covered in @s.r.study-3, which compares the two approaches described in the #nameref(<s.m.planning.path-adherence>, "Path Adherence") methodology. The path tracking approach seems to be the most appealing alternative, as it only adds an extra linear, $cal(O)(|V|)$ computation time for each robot, each timestep, but still provides up to $#strfmt("{0:.0}", solo-gp-mean-decrease)%$ reduced path deviation error. The #scen.collaborative-gp.s scenario, shows that even with a dynamic environment, with many robots; path tracking is still able to lower the path deviation error. Comparing the solo and collaborative scenarios, it is clear that the variance is much higher as soon as more robots are introduced, which is both expected and desired. It should always be a harder constraint to avoid other robots, than to track closely to the path.
It is important to note that the combination of a sporadic, and random approach to global planning does not seem to mesh well with the path tracking approach. Looking at the number of collisions that happen at the cost of lowering path deviation, we see an increase of around $#strfmt("{0:.0}", (11.9 / 2.8) * 100)%$ in collisions, which is not a desirable trade-off. Path tracking would be more suitable for paths that are either pre-planned, or some level of predictability is present. These kinds of constraints can to be introduced through the global planner by limiting the possible sample-space, or by, in the context of #acr("RRT*"), introducing a bias towards pre-defined lanes; e.g. towards the right side of designated driving areas. A system made this way could possibly reach a level of adherence that resembles the #scen.solo-gp.n scenario, but with many robots, only having to rely on deviating from their path in crossings, or merging scenarios.
Another critical detail, is how notion of speed, and movement is currently handled both in `gbpplanner`@gbpplanner@gbpplanner-code and in #acr("MAGICS"). The horizon variable is simply moved along the given path at a static rate, not influenced by the robot's actual progress along the path. This is a double-edged sword, as it provides a way of _pulling_ on the robot until it escapes a local minima, but it also provides instability to the factor graph. In case the robot gets stuck, either between other robots or the environment, the horizon variable will keep moving, which stretches out the spacing of the variables, essentially asking the robot to go at a increasingly higher speed. This _will_ sometimes result in the obstacle or interrobot collision factors, to lose to the dynamic factor, meaning the robot will drive straight through the obstacles or robots that are in the way.
It would be beneficial to look at a smarter way to move this horizon variable. In the context of the tracking factor, one suggestion could be to attach a tracking factor to the horizon state while removing its pose factor. This might be able to pull the horizon state along the path, while also being impacted by the how far behind the robot is through the dynamic factors. Much more development is needed in this area, as the tracking factors are currently not able to guarantee _pulling_ on variables at a rate that will reach the target speed. This is a possible path of future work.
// 2. About the tracking factor
=== On the Tracking Factor <s.d.tracking-factor>
As seen in the results; it has been possible to the extend the underlying factor graph with an extra factor to combat path deviation issues. The tracking factor, $f_t$, provides a stable way to reach a lower path deviation error. This tracking factor is very useful when you want to guarantee, with soft constraints, a level of path adherence. Being able to reason about such a property is very useful in a multi-agent system, where you want to ensure that the agents are not only reaching their goals, but also doing so in a way that is not disruptive to the environment or other agents. This can be achieved by constricting the global planner to only plan paths that do not intersect with each other. It could for example be the case that, in a large facility you want trafficesque rules; where robots travelling in one direction stay on the right side, and vice versa. These constraints can be the global planner's responsibility, instead of overloading the #acr("GBP") with unnecessary local complexity. Not that the #acr("GBP") is unable to handle these issues, but with many robots, having an overall structure, or underlying plan embedded as a pre-step will likely avoid many local minima hold-ups, where robots are struggling to get past each other.
// #todo[About the balance of tracking vs. interrobot vs obstacle]
As is evident from earlier discussion about the global planning integration with the tracking factor, and the results from the #scen.collaborative-gp.s scenario, the tracking factor is able to impact the factor graph positively and negatively. Sometimes, even both at once, which is specifically shown with $sigma_t = 0.15$. This likely stems from the fact that adding another factor to the graph simply increases its complexity, and also the number of possible local minima. Furthermore, instead of balancing three factors as before, four certainties, ${sigma_d, sigma_i, sigma_o, sigma_t}$, have to be balanced to interact with each other in a way that is beneficial to the overall system. This balance is very hard to achieve, especially when factors are working against each other in a three or four-way relationship. Even though the interrobot certainty $sigma_i=0.1$ is much higher than that of the tracking factor $sigma_t=0.5$ in the last experiment, the amount of collisions was still increased with $#strfmt("{0:.0}", 3.4 / 2.8 * 100 - 100)%$, which, though lower than with $sigma_t=0.15$, is still very much undesirable. Thus, the tracking factor proves very difficult to balance while keeping a safe system, free of collisions. The earlier discussed notion of pseudo-preplanned paths, or a global planning bias in some way would help to alleviate this issue. Nevertheless, it is important to have the dynamic factor have a higher certainty than the tracking factor. This is due to the design of the tracking factor measurement function.
As deliberated in @s.m.tracking-factor, the measurement will enable the tracking factor to pull towards the corner when the linearization point is close enough. This is once again a double-edged sword, as shown in @f.solo-plot, this behaviour eliminates most of the corner-cutting behaviour, however this specific detail also makes the factor graph more prone to local minima, where the robot gets stuck in a corner if most of its tracking factors are pulling towards it. This is however mostly alleviated by making sure that the tracking factor's certainty is not close to or higher than the dynamic factor's. This way the dynamic factors have more pull on each individual variable, enabled them to _overpower_ the tracking factors when necessary.
|
https://github.com/DVDTSB/dvdtyp | https://raw.githubusercontent.com/DVDTSB/dvdtyp/main/dvd.typ | typst | MIT License | #import "@preview/ctheorems:1.1.2": *
#import "@preview/showybox:2.0.1": showybox
#let colors = (
rgb("#9E9E9E"),
rgb("#F44336"),
rgb("#E91E63"),
rgb("#9C27B0"),
rgb("#673AB7"),
rgb("#3F51B5"),
rgb("#2196F3"),
rgb("#03A9F4"),
rgb("#00BCD4"),
rgb("#009688"),
rgb("#4CAF50"),
rgb("#8BC34A"),
rgb("#CDDC39"),
rgb("#FFEB3B"),
rgb("#FFC107"),
rgb("#FF9800"),
rgb("#FF5722"),
rgb("#795548"),
rgb("#9E9E9E"),
)
#let dvdtyp(
title: "",
subtitle: "",
author: "",
abstract: none,
body,
) = {
set document(title: title)
show: thmrules
set page(
numbering: "1",
number-align: center,
header: locate(loc => {
if loc.page() == 1 {
return
}
box(stroke: (bottom: 0.7pt), inset: 0.2em)[#text(font: "New Computer Modern Sans")[#author #h(1fr)#title]]
}),
)
set heading(numbering: "1.")
show heading: it => {
set text(font: "New Computer Modern Sans")
set par(first-line-indent: 0em)
if it.numbering != none {
text(rgb("#2196F3"), weight: 500)[#sym.section]
text(rgb("#2196F3"))[#counter(heading).display() ]
}
it.body
v(0.6em)
}
set text(font: "New Computer Modern", lang: "en")
show math.equation: set text(weight: 400)
// Title row.
align(center)[
#set text(font: "New Computer Modern Sans")
#block(text(weight: 700, 25pt, title))
#v(0.4em, weak: true)
#if subtitle != none [#text(18pt, weight: 500)[#subtitle]]
#v(0.3em, weak: true)
#if author != none [#text(14pt)[by #author]]
]
if abstract != none [#align(center)[#abstract]]
set outline(fill: repeat[~.], indent: 1em)
show outline: set heading(numbering: none)
show outline: set par(first-line-indent: 0em)
show outline.entry.where(level: 1): it => {
text(font: "New Computer Modern Sans", rgb("#2196F3"))[#strong[#it]]
}
show outline.entry: it => {
h(1em)
text(font: "New Computer Modern Sans", rgb("#2196F3"))[#it]
}
// Main body.
set par(
justify: true,
first-line-indent: 1em,
)
body
}
#let thmtitle(t, color: rgb("#000000")) = {
return text(font: "New Computer Modern Sans", weight: "semibold", fill: color)[#t]
}
#let thmname(t, color: rgb("#000000")) = {
return text(font: "New Computer Modern Sans", fill: color)[(#t)]
}
#let thmtext(t, color: rgb("#000000")) = {
let a = t.children
if (a.at(0) == [ ]) {
a.remove(0)
}
t = a.join()
return text(font: "New Computer Modern", fill: color)[#t]
}
#let thmbase(
identifier,
head,
..blockargs,
supplement: auto,
padding: (top: 0.5em, bottom: 0.5em),
namefmt: x => [(#x)],
titlefmt: strong,
bodyfmt: x => x,
separator: [#h(0.1em).#h(0.2em) \ ],
base: "heading",
base_level: none,
) = {
if supplement == auto {
supplement = head
}
let boxfmt(name, number, body, title: auto, ..blockargs_individual) = {
if not name == none {
name = [ #namefmt(name)]
} else {
name = []
}
if title == auto {
title = head
}
if not number == none {
title += " " + number
}
title = titlefmt(title)
body = bodyfmt(body)
pad(
..padding,
showybox(
width: 100%,
radius: 0.3em,
breakable: true,
padding: (top: 0em, bottom: 0em),
..blockargs.named(),
..blockargs_individual.named(),
[#title#name#titlefmt(separator)#body],
),
)
}
let auxthmenv = thmenv(
identifier,
base,
base_level,
boxfmt,
).with(supplement: supplement)
return auxthmenv.with(numbering: "1.1")
}
#let styled-thmbase = thmbase.with(titlefmt: thmtitle, namefmt: thmname, bodyfmt: thmtext)
#let builder-thmbox(color: rgb("#000000"), ..builderargs) = styled-thmbase.with(
titlefmt: thmtitle.with(color: color.darken(30%)),
bodyfmt: thmtext.with(color: color.darken(70%)),
namefmt: thmname.with(color: color.darken(30%)),
frame: (
body-color: color.lighten(92%),
border-color: color.darken(10%),
thickness: 1.5pt,
inset: 1.2em,
radius: 0.3em,
),
..builderargs,
)
#let builder-thmline(color: rgb("#000000"), ..builderargs) = styled-thmbase.with(
titlefmt: thmtitle.with(color: color.darken(30%)),
bodyfmt: thmtext.with(color: color.darken(70%)),
namefmt: thmname.with(color: color.darken(30%)),
frame: (
body-color: color.lighten(92%),
border-color: color.darken(10%),
thickness: (left: 2pt),
inset: 1.2em,
radius: 0em,
),
..builderargs,
)
#let problem-style = builder-thmbox(color: colors.at(16), shadow: (offset: (x: 2pt, y: 2pt), color: luma(70%)))
#let problem = problem-style("problem", "Problem")
#let theorem-style = builder-thmbox(color: colors.at(6), shadow: (offset: (x: 3pt, y: 3pt), color: luma(70%)))
#let theorem = theorem-style("theorem", "Theorem")
#let lemma = theorem-style("lemma", "Lemma")
#let corollary = theorem-style("corollary", "Corollary")
#let definition-style = builder-thmline(color: colors.at(8))
#let definition = definition-style("definition", "Definition")
#let proposition = definition-style("proposition", "Proposition")
#let remark = definition-style("remark", "Remark")
#let observation = definition-style("observation", "Observation")
#let example-style = builder-thmline(color: colors.at(16))
#let example = example-style("example", "Example").with(numbering: none)
#let proof(body, name: none) = {
thmtitle[Proof]
if name != none {
[ #thmname[#name]]
}
thmtitle[.]
body
h(1fr)
$square$
}
|
https://github.com/antran22/typst-cv-builder | https://raw.githubusercontent.com/antran22/typst-cv-builder/main/lib/resume/skills.typ | typst | MIT License | #import "@preview/cmarker:0.1.0"
#import "./components.typ": *
#import "../util.typ": *
#let ResumeSkillItem(name: "", description: content, keywords: ()) = {
set block(below: 0.65em)
stack(
dir: ttb,
spacing: 10pt,
[== #name],
text(description, size: 10pt, weight: "light"),
text(keywords.join(", "), size: 8pt, weight: "medium")
)
}
#let ResumeSkillsSection(skills, title: "Technical Skills", column_count: 2) = [
#let layout = range(column_count).map(_ => 1fr)
#stick_together(
threshold: 60pt,
[= #title],
[
#grid(
columns: layout,
column-gutter: 24pt,
rows: (auto),
row-gutter: 18pt,
..skills.map(skill=> {
[
#ResumeSkillItem(
name: skill.name,
description: cmarker.render(skill.at("description", default: "")),
keywords: skill.at("keywords", default: ())
)
]
})
)
]
)
] |
https://github.com/compsci-adl/Constitution | https://raw.githubusercontent.com/compsci-adl/Constitution/master/src/constitution.typ | typst | #let adopted-date = datetime(
year: 2024,
month: 10,
day: 15,
)
#let endorsement = (
"from": "<NAME>",
"position": "President",
"date": datetime(
year: 2024,
month: 10,
day: 20,
),
)
#set document(
title: "CS Club Constitution",
author: "The University of Adelaide Computer Science Club",
)
#set page(
paper: "a4",
margin: 2cm,
)
#set text(
lang: "en",
region: "AU",
font: "New Computer Modern",
size: 10pt,
)
#set heading(
numbering: "1.1",
)
#show heading: it => {
set block(below: 1em)
if it.numbering == none {
it
} else {
block(counter(heading).display(it.numbering) + h(1em) + it.body)
}
}
#show heading.where(
level: 1,
): it => {
set block(above: 2em)
smallcaps(it)
}
#set enum(
numbering: "(a.i.A)",
indent: 1em,
body-indent: 1em,
)
/* -------------------- start content -------------------- */
#v(1fr)
#align(
center,
image(
"img/csc-logo.svg",
width: 50%,
)
)
#v(1fr)
#align(
center,
[
#set par(leading: 1.15em)
#text(size: 32pt)[*THE CONSTITUTION*] \
#text(size: 20pt)[#line(length: 80%)] \
#text(size: 22pt)[*THE UNIVERSITY OF ADELAIDE COMPUTER SCIENCE CLUB*]
]
)
#v(3fr)
#pagebreak()
#set page(
margin: 3cm,
numbering: "i"
)
#counter(page).update(1)
#show outline.entry.where(
level: 1,
): it => {
v(16pt, weak: true)
strong(it)
}
#outline(indent: 1.5em)
#pagebreak()
#set page(numbering: "1")
#counter(page).update(1)
= Principles and Objectives of the Club <principles>
== Primary objectives
The primary objective of the Club is to provide collaboration, networking, intellectual stimulation, and social opportunities, as well as any other pursuit reasonably suited for students studying computer science at the University of Adelaide and other interested people.
== Not for profit clause
The assets and income of the Club shall be applied solely in furtherance of its above-mentioned objects and no portion shall be distributed directly or indirectly to the members of the Club except as bona fide compensation for services rendered or expenses incurred on behalf of the Club.
== Status of Constitution
All rules, regulations, requirements and steps outlined by the YouX and the Clubs Policy take precedence over anything outlined in this constitution.
= Name
+ The legal and formal name of the club is *The University of Adelaide Computer Science Club*.
+ For the purposes of publicity, publication, or other purposes as approved by the President or their delegate, the name of the Club may be written as "CS Club". It may also be written as a syntactically valid source code statement or equivalent for any self-hosting computer programming language which calls a zero-parameter callable unit named "club" contained or referenced within a first-class object named "cs", discarding any returned value. These names need not be capitalised as described.
= Definitions
Unless a contrary intention is evident, the following definitions apply to this Constitution and all other club documents:
#set terms(indent: 1em)
/ _Academic day_: means a weekday defined by the University of Adelaide to be within a semester;
/ _AGM_: means an Annual General Meeting of the Club;
/ _Club_: means The University of Adelaide Computer Science Club;
/ _Committee_: means the Committee of the Club;
/ _Constitution_: means this constitution;
/ _Executive_: means the Executive Body as defined in @executive-body;
/ _GM_: means a General Meeting of the Club;
/ _Office_: means an elected position in the Club provided for in @committee.composition;
/ _Officer_: means a member who has been elected to an office;
/ _SGM_: means a Special General Meeting of the Club;
/ _University_: means the University of Adelaide;
/ _YouX_: means the student union of the University.
= Membership <membership>
== General membership <membership.general>
General membership in the Club is open to any current undergraduate or postgraduate student at the University of Adelaide who:
+ pays the membership fee as determined under @membership.fee; and
+ submits to the committee the following information:
+ full name; and
+ student ID number; and
+ preferred email address.
== Associate membership
+ Associate membership in the Club is open to any person not a student of the University of Adelaide, only if the applicant may satisfy any possible reasonable objections the Committee may raise.
+ Associate members must also satisfy the criteria under @membership.general.
== Honorary membership <membership.honorary>
Honorary membership in the Club is open to any person upon whom the Club has conferred. Such a membership may only be conferred by a resolution at a GM.
== Refusal and revocation of membership
+ The Committee has the right to refuse or revoke the membership of any potential or current member if:
+ the applicant or member has proven detrimental to the interests of the Club; or
+ violates the Code of Conduct of the University of Adelaide; or
+ is otherwise causing serious issues within the Club for its members and/or Committee.
+ Membership may only be refused or revoked after a passing motion of a two-thirds majority during a Committee meeting. The person to whom membership is being refused or revoked will be given an opportunity to attend the meeting and present their case to the Committee, whether in person, electronically, or in writing. The Committee will make reasonable efforts to hold the meeting during a time in which the person may attend to plead their case.
+ In the event that membership is refused or revoked due to issues arising out of interpersonal conflict, the other parties seeking the refusal or revocation will also be permitted to attend the Committee meeting and present their arguments.
== Membership fee <membership.fee>
+ The Club's membership fee is determined at each AGM for the following year.
+ The membership fee provides membership until the 1st of January in the following year.
+ Honorary members of the Club are exempt from membership fees as set out in @membership.honorary.
== Termination of membership <membership.term>
=== Ordinary membership termination <membership.term.ord>
The Committee may suspend any membership for whatever reason if:
+ the member is given a written notice of suspension; and
+ a Committee meeting is held to vote on the revocation within 3 weeks of suspension; and
+ the member is notified in writing within 48 hours of the conclusion of the Committee meeting.
=== Suspended members
During the process as described in @membership.term.ord:
+ suspended members may not attend Club events or otherwise take part in Club activities until a resolution is reached; and
+ if the Committee meetings result in the revocation of a member's membership, their membership is terminated immediately.
=== Member's own choice
Members of the Club may terminate their own membership by writing to the Committee.
=== Fee refund
Members who have their membership terminated, whether by their own accord or through a decision of the Committee, are no longer affiliated with the Club and cannot have their membership fee refunded.
= The Committee
== Composition <committee.composition>
+ The composition of the Committee is to be laid out in Schedule 1 to the Constitution, while the composition and responsibilities of the Executive Body are defined in @executive-body.
+ In order of precedence, the Committee members are the President, the Vice-President, the Treasurer, the Secretary, and the Partnerships & Sponsorships Manager, who form the Executive Committee.
+ The order of precedence for the remaining Committee members is to be laid out in Schedule 1 to the Constitution, in accordance with the rules outlined in @executive-body.schedule.
== Election
+ A Committee is to be elected to office at the AGM, with any exceptions for non-executive positions to be laid out in Schedule 1.
+ A turnover meeting must be held within one month of any general meeting where a new Committee member is elected to train the new Committee member(s). This time frame may be extended if it clashes with exams or major assessment deadlines.
== Duties
The Committee acts on behalf of the Club in the general day-to-day running of the Club and must not act to the detriment of the Club's interests.
== Casual vacancies <committee.casual-vacancy>
The Committee has the power to fill any casual vacancies arising from circumstances outlined in @committee-change during its term of office. All members shall be given reasonable ability, time and opportunity to apply for casual vacancies. The ability of the Committee to fill casual vacancies shall not be restricted by this constitution.
== Expiration
All offices expire at the AGM, but former officers may re-run and hold office any number of times.
== Committee meetings
The Committee must meet at least once a month during the academic year. The Committee will make reasonable efforts to ensure maximal attendance by Committee members, including but not limited to:
+ provisions to attend meetings electronically; or
+ partial attendance in order to raise their proposed motions; or
+ sending in a representative upon written notice to and approval by the President and Secretary; or
+ sending in a written summary of their motions, reports, and voting desires for other motions and positions; or
+ polls by the President, through a messaging platform or on a voting website, to permit Committee meetings to be held during times of maximum availability.
== Removal of Committee members due to absences <committee.absences>
+ If a Committee member fails to attend three Committee meetings in a row without providing an apology, being on a leave of absence, or having alternative arrangements put in place, the Committee member will be immediately removed from their position.
+ The rules for resetting the count are as follows:
+ An attendance will reset the count.
+ Apologies will not be counted towards the three absences count.
+ Apologies will not reset the count.
== Removal of Committee members due to misconduct
+ If a Committee member has demonstrable interests against the Club, actively works to undermine the Club and its interests, is continually absent from meetings throughout the year, is consistently failing to fulfil their duties or tasks, is causing conflict within the Committee or Club, or is otherwise proven to be difficult to work with, they may be removed from their position.
+ A Committee vote of no less than half of the Committee will result in the removal of the Committee member with immediate effect.
+ Should the Committee vote fail, the affected team may appeal to the Executive Committee to have the individual removed from the team, but not the Committee. The Committee may then choose to fill the position with a casual vacancy in accordance with @committee-change.vacancy or hold a General Meeting.
+ If a Committee member is accused of harassment against another Committee member, they will be suspended from their position and may be removed after a Committee meeting subject to a vote of no less than two-thirds of the Committee.
+ The accused will not be allowed to attend the Committee meeting in person should the victim be present, to allow the victim to safely attend the meeting.
+ The accused will be allowed to attend electronically and will be allowed to submit a written statement.
+ If a Committee member is convicted of violating a University Code of Conduct resulting in their suspension from the University, they will be immediately removed from their position as a Committee member.
+ If a Committee member commits a crime resulting in jail time, they will be immediately removed from their position as a Committee member.
+ If a Committee member is found to be committing fraudulent activities using the Club bank account, they will be immediately suspended from their position as a Committee member, and a meeting with YouX will be held to discuss the offence.
+ If the funds are not returned, the Club will terminate both their position and their membership.
+ The Committee will pursue all reasonable pathways to have the funds returned and may seek legal advice in the event that other pathways have been exhausted.
== Eligibility to hold office
+ Committee members must fulfil all eligibility requirements in order to hold office.
+ Committee members must be current members of the Club.
+ The Committee reserves the right to prohibit the election of a nominee that has been previously removed from the Committee for reasons of misconduct, as outlined in Section 5.8(b), 5.8(c), 5.8(d), and 5.8(e), by a vote of no less than half of the Committee.
+ Eligibility to hold Executive positions is outlined in @executive-body.eligibility.
= Special Resolutions of the Committee
== Definition
A special resolution is a motion put forth by the Committee on a specific matter which is not:
+ related to the day-to-day running of the Club; or
+ already accounted for by constitutional or Executive powers.
== Process
A special resolution must be raised during a Committee meeting as set out in @committee-meetings and voted upon as in @committee-meetings.voting. A special resolution is required for a matter to be brought to a GM to be decided.
For the resolution to take effect, the resolution must be put to vote in a GM as set out in @general-meetings.
= Committee Meetings <committee-meetings>
== Calling a meeting
A meeting is called by the President or the Vice-President to discuss the day-to-day running of the Club and any issues for the Committee to decide. The meeting must be called at least 1 week in advance; if they are not, Committee members may be absent without reason and suffer no consequence as set out in @committee.absences.
== Voting procedure <committee-meetings.voting>
+ The President has a deliberative vote and in the case of an equality of votes, may exercise a casting vote. This means they effectively have 2 votes, 1 in the capacity of a member and another in the capacity of the chair of the meeting.
+ The President chairs all Committee meetings and GMs of the Club. In their absence, the chair of the meeting will follow in the order of precedence stated in @committee.composition.
+ No Committee member may delegate his/her voting right in absentia.
+ The quorum of a Committee meeting is 10 distinct voting members of the Committee.
+ If a quorum is not present, then the Executive has general decisive power.
== Minutes
Minutes of all meetings must be kept and they must include:
+ the names of the persons that attended that meeting; and
+ discussion points; and
+ decisions of the Committee.
== Special circumstances
Upon receiving a written petition of 3 voting Committee members, the President, or in their absence the Vice-President, must call a meeting of the committee within 14 days.
= Extraordinary Committee Changes <committee-change>
== Cessation of office
A member of the Committee ceases holding their office if:
+ the President or Vice-President receives a written notice of resignation from that member; or
+ the member is absent, without leave of absence being granted by resolution of the Committee, for 3 consecutive meetings of the Committee of which the member was notified; or
+ their membership in the Club is terminated as set out in @membership.term; or
+ a motion of no-confidence in a Committee member's ability to perform their duties is expressed by at least half of Club members or 50 Club members, whichever is fewer, whereby an SGM must be called to vote on the matter of changing the Committee.
== Filling a vacancy <committee-change.vacancy>
+ When an office becomes vacant, a GM must called to fill the position within 6 weeks unless:
+ the AGM is to be held within 8 weeks of the position becoming vacant; or
+ there is no Academic Day within the next 6 weeks. In this instance, the GM is to be held within 2 weeks of the next Academic Day; or
+ the office is filled as a casual vacancy as specified in @committee.casual-vacancy.
+ The President, or in their absence, the Vice-President, may appoint any volunteering Club member to fill the office in the interim.
= The Executive Body <executive-body>
== Composition
The Executive consists of:
+ the President; and
+ the Vice-President; and
+ the Treasurer; and
+ the Secretary; and
+ the Partnerships & Sponsorships Manager.
== General power
The Executive has general power to make regulations necessary to put into effect this constitution, provided that such regulations are consistent with this Constitution and the objectives of the Club.
== Maintaining a Committee composition schedule <executive-body.schedule>
+ The Executive shall be responsible for maintaining Schedule 1, titled "Committee Composition".
+ The Schedule shall detail the composition of non-Executive offices in the Committee and must include:
+ the positions that exist and the number of positions available; and
+ the eligibility requirements for each position; and
+ the duties for each position; and
+ the order of precedence for each position.
+ The Schedule may contain additional details about the composition, but not in replacement to the aforementioned clauses.
+ The Schedule may contain information about the Executive Committee, pertaining to their duties and eligibility criteria. However, this does not replace the rules as outlined in this Constitution.
+ Minor typographical and formatting changes may be made to the Schedule without the need for a resolution of the Committee.
== Acting presidencies
In the event the President is unable to fulfil their duties, the Executive has the power to promote, in the order of precedence set out in @committee.composition, a member of the executive to acting President subject to ratification at a General Meeting.
== Eligibility to hold positions <executive-body.eligibility>
+ Those serving in an Executive office must have previously served in another position on the Committee for at least five months prior to the Annual General Meeting. An ordinary member of the Club may only hold this office where no other valid nomination has been received.
+ All members of the Executive must be current students of the University of Adelaide and must be studying a computer science, software engineering, or information technology-related degree at the time of their appointment and through the entirety of their term of office.
+ Should no valid nominations be received that satisfy the aforementioned requirements, the requirements may be made less strict at the discretion of the Committee, with the exception of the President and Treasurer who must fulfil the requirement of being a current student of the University of Adelaide.
== Working groups
The Executive has the power to appoint working groups from within the membership to perform duties associated with a specific agenda. Such working groups are, at all times, answerable to the Executive.
== Duties
=== The President
The President is responsible for:
+ presiding over all meetings of the Club, the Committee, and the Executive; and
+ representing the Club in all official matters; and
+ ensuring that the Club is run in accordance with the Constitution and its Schedules; and
+ ensuring that the Club is run in accordance with the Clubs Policy of YouX; and
+ calling meetings of the Committee, the Executive, and General Meetings; and
+ the overall management of the Club.
=== The Vice-President
The Vice-President is responsible for:
+ assisting the President in the overall management of the Club; and
+ acting as President in the absence of the President.
=== The Treasurer
The Treasurer is responsible for:
+ the financial management of the Club; and
+ the safekeeping of the Club's funds; and
+ ensuring that the Club's financial records are kept up to date; and
+ delivering a financial report to the Annual General Meeting; and
+ delivering a financial report to the Executive at the end of the first semester.
=== The Secretary
The Secretary is responsible for:
+ the administrative management of the Club; and
+ the safekeeping of the Club's records; and
+ minuting all meetings of the Club, the Committee, and the Executive; and
+ minuting all General Meetings; and
+ ensuring that the Club's records are kept up to date.
=== The Partnerships & Sponsorships Manager
The Partnerships & Sponsorships Manager is responsible for:
+ the management of the Club's partnerships and sponsorships; and
+ the establishment of new partnerships and sponsorships; and
+ the maintenance of existing partnerships and sponsorships; and
+ delivering a report to the Annual General Meeting.
= Club Finances
== Bank account
The Club must hold a bank account for the purpose of holding the Club's funds.
== Signatories
The signatories of the Club's bank account are the President and Treasurer.
== Minimum balance
The Committee shall endeavour to maintain a minimum bank balance of \$2,000, except where there is an essential need for the spending of this money to run events and essential functions as approved in a Committee meeting.
== Authority to access funds
+ Any one signatory may withdraw funds from the bank account with written approval from the rest of the Executive by any means of communication, such communication must be recorded in the Club's records for auditing purposes.
+ The use of these funds must then be approved by a majority of no less than half of the Committee at the subsequent Committee meeting or the funds must be returned immediately.
+ All members of the Executive will have the authority to view the bank account and challenge unauthorised transactions.
+ Should the Executive fail to unanimously authorise the withdrawal of funds, a Committee meeting must be held before funds can be withdrawn. Upon a successful motion of no less than half of the Committee, the funds may then be withdrawn.
= General Meetings <general-meetings>
== Purpose
A General Meeting of the Club is the ultimate decision-making body of the Club and has the power to direct the Committee, the Executive and the officers of the Club. It is reserved for only important decisions which concern the Club as a whole.
== Calling a meeting
A General Meeting is considered "called" as long as the Committee has reasonably made efforts to advertise the meeting to its members.
== Timing
+ A president must call a meeting within 14 days when:
+ the Committee directs them to do as such; or
+ they receive a petition calling for a GM from at least half of the Club members or 50 Club members, whichever is fewer.
+ The meeting must be held no sooner than 10 working days after it is called.
+ The meeting must be held not later than 1 calendar month after it is called.
== Conducting a meeting
The General Meeting is directed by the Committee regarding whatever reason for which it was convened.
== Voting
If a matter must be put to vote, then each member has 1 vote which they may not delegate to another. The quorum for a General Meeting in which a matter must be voted is 10 members.
== Record keeping
The Secretary must record all the attending members in the minutes of the General Meeting.
= The Annual General Meeting
== Definition
The AGM is a special GM specifically for the purpose of conducting concluding business for the year. This includes reports from the President, Treasurer, and the Partnerships & Sponsorships Manager, along with the election of a new Committee. The process and rules are otherwise the same as a GM.
== Annual occurrence
The AGM must be held during an Academic Day during the second semester every year.
== Returning Officer
A Returning Officer must be appointed by the Committee prior to the AGM. The returning officer cannot be a candidate for that election, but can otherwise be any willing member.
== Electing Officers
A new Committee must be formed at each AGM. The officers as stated in @committee.composition must be elected by members of the Club.
= The Trustees Upon Winding Up
In the event that the Club winds up or lapses, the assets remaining, after the paying of debts and liabilities, shall be transferred to YouX, and those assets shall be used by YouX in accordance with the YouX constitution.
= The Constitution
== Interpretation
This Constitution is to be interpreted with close regard to the principles and objectives of the Club as set out in @principles.
== Effectiveness
This Constitution takes effect when it is ratified by Club members in a GM.
== Amendments
+ Amendments to this Constitution may be proposed by a resolution of the Committee or a petition from at least 10 members of the Club. Any amendments to this Constitution must be ratified by Club members in a GM in order for the amendment to take effect.
+ Minor typographical and formatting changes may be made to this Constitution without the need for ratification by Club members in a GM.
#pagebreak()
*THIS CONSTITUTION HAS BEEN REVIEWED AND RATIFIED BY CLUB MEMBERS IN A GENERAL MEETING.*
#v(0.5cm)
*DATE OF GENERAL MEETING:* #adopted-date.display("[day]th of [month repr:long], [year]")
#v(0.5cm)
*THIS CONSTITUTION HAS BEEN ENDORSED AND SIGNED BY*
#block(
above: 3cm,
[
#line(length: 50%, stroke: 0.5pt)
#endorsement.from \
#endorsement.position
]
)
#v(0.5cm)
*DATE OF ENDORSEMENT:* #endorsement.date.display("[day]th of [month repr:long], [year]")
|
|
https://github.com/onefact/letterhead-template | https://raw.githubusercontent.com/onefact/letterhead-template/main/README.md | markdown | Apache License 2.0 | # letter-template
One Fact Foundation letter template
# Typesetting
We use https://typst.app/ with the following Visual Studio code extensions:
* https://marketplace.visualstudio.com/items?itemName=OrangeX4.vscode-typst-sympy-calculator
* https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp
# Typography
The font is "Fairfax HD" which can be downloaded and installed from the releases here: https://github.com/kreativekorp/open-relay/tree/master/FairfaxHD or here: https://www.kreativekorp.com/software/fonts/fairfaxhd/
# Generating image
```bash
magick -density 1200 -quality 100 example-document-on-letterhead.pdf example-document-on-letterhead.webp
``` |
https://github.com/hei-templates/hevs-typsttemplate-thesis | https://raw.githubusercontent.com/hei-templates/hevs-typsttemplate-thesis/main/00-templates/items.typ | typst | MIT License | //
// Description: Creating nice looking item list with different icons
// Author : <NAME>
//
#import "constants.typ": *
#let item-list(
content: none,
height: normal,
icon: icon-check-square,
) = {
if content != none {
v(-9pt)
table(
stroke: none,
columns: 2,
align: left+horizon,
column-gutter: -2pt,
image(icon, height:normal), content
)
v(-9pt)
}
}
#let item-checkbadge(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-check-badge,
)
}
#let item-checkcircle(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-check-circle,
)
}
#let item-checksquare(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-check-square,
)
}
#let item-check(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-check,
)
}
#let item-circle(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-circle,
)
}
#let item-file(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-file,
)
}
#let item-folder(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-folder,
)
}
#let item-xcircle(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-x-circle,
)
}
#let item-xsquare(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-x-square,
)
}
#let item-x(
content: none,
height: normal,
) = {
item-list(
content: content,
height: height,
icon: icon-x,
)
}
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-10330.typ | typst | Apache License 2.0 | #let data = (
("GOTHIC LETTER AHSA", "Lo", 0),
("GOTHIC LETTER BAIRKAN", "Lo", 0),
("GOTHIC LETTER GIBA", "Lo", 0),
("GOTHIC LETTER DAGS", "Lo", 0),
("GOTHIC LETTER AIHVUS", "Lo", 0),
("GOTHIC LETTER QAIRTHRA", "Lo", 0),
("GOTHIC LETTER IUJA", "Lo", 0),
("GOTHIC LETTER HAGL", "Lo", 0),
("GOTHIC LETTER THIUTH", "Lo", 0),
("GOTHIC LETTER EIS", "Lo", 0),
("GOTHIC LETTER KUSMA", "Lo", 0),
("GOTHIC LETTER LAGUS", "Lo", 0),
("GOTHIC LETTER MANNA", "Lo", 0),
("GOTHIC LETTER NAUTHS", "Lo", 0),
("GOTHIC LETTER JER", "Lo", 0),
("GOTHIC LETTER URUS", "Lo", 0),
("GOTHIC LETTER PAIRTHRA", "Lo", 0),
("GOTHIC LETTER NINETY", "Nl", 0),
("GOTHIC LETTER RAIDA", "Lo", 0),
("GOTHIC LETTER SAUIL", "Lo", 0),
("GOTHIC LETTER TEIWS", "Lo", 0),
("GOTHIC LETTER WINJA", "Lo", 0),
("GOTHIC LETTER FAIHU", "Lo", 0),
("GOTHIC LETTER IGGWS", "Lo", 0),
("GOTHIC LETTER HWAIR", "Lo", 0),
("GOTHIC LETTER OTHAL", "Lo", 0),
("GOTHIC LETTER NINE HUNDRED", "Nl", 0),
)
|
https://github.com/piepert/philodidaktik-hro-phf-ifp | https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/parts/ephid/operatoren/main.typ | typst | Other | #import "/src/template.typ": *
= #ix("Operatoren", "Operator")
#author[<NAME>]
Die einheitlichen Prüfungsanforderungen für das Abitur im Fach Philosophie legen einheitliche #ix("Operatoren", "Operator") für das Fach Philosophie fest.#en[Vgl. @KMK2006_EPAPhil[S. 10 ff]] Die Oepratoren fallen unter bestimmte #ix("Anforderungsbereiche", "Anforderungsbereich") und haben somit zum Ziel die #ix("Problemerfassung"), #ix("-bearbeitung", "Problembearbeitung") oder #ix("-verortung", "Problemverortung"). Es ist möglich, dass ein #ix("Operator") je nach Aufgabenstellung bzw. Bearbeitung der SuS unter mehrere Anforderungsbereiche fallen kann.
// #let ix(..a) = a.pos().first()
#set par(justify: false)
#table(columns: (20%, auto, auto, auto),
inset: (top: 10pt, bottom: 10pt, rest: 5pt),
stroke: none,
..range(0, 20).map(e => table.hline(y: e)),
strong[#ix("Operator")], strong[AFB], strong[Definition], strong[Beispiele],
[
Analysieren
],[
II
], [
- sprachliche Gestaltung und die Argumentationsstruktur eines Textes bzw. die Gestaltungsmittel und deren Komposition in einem Material untersuchen und interpretierend darstellen
- explizite und implizite Prämissen, Denkvoraussetzungen und Thesen werden erfassen und fomulieren
- Begründungszusammenhäne und intendierte Folgerungen klären
], [
Analysieren Sie den folgenden Ausschnitt aus #ix([Descartes'], "Descartes, René") erster Meditation!
Analysieren Sie Picassos Bild "Guernica"!
],
[
Auseinanersetzen mit / \
diskutieren
],[
III
], [
- explizit kritische Stellungnahme entwickeln auf Grundlage ausgewiesener Kriterien
], [
Setzen Sie sich kritisch mit #ix([Descartes'], "<NAME>") #ix("Wachsbeispiel") auseinander!
Diskutieren Sie #ix([Descartes'], "<NAME>") Position zum #ix("Fremdpsychischen", "Fremdpsychisches")!
],
[
Begründen
],[
III
], [
- hinsichtlich der Ursachen und Folgerungen schlüssige Zusammenhänge ausführlich und differenziert darlegen
], [
Begründen Sie Ihre Auffassung zur Anwendbarkeit von #ix([Descartes'], "<NAME>") #ix("methodischem Zweifel", "Zweifel, methodisch") mit Blick auf mögliche Konsequenzen im Alltag!
],
[
Beschreiben
],[
I
], [
- Sachverhalte in eigenen Worten in ihrem Zusammenhang darlegen (i.d.R. mit Bezug zu Materialien)
], [
Beschreiben Sie die wesentlichen Elemente Ihrer präsentativen Gestaltung!
Beschreiben Sie den Versuch, den #ix([Descartes'], "<NAME>") in den ersten beiden Meditationen unternimmt!
],
[
Beurteilen
],[
III
], [
- selbständiges Urteil unter Verwendung von Fachwissen und Fachmethoden auf Basis ausgewiesener Kriterien formulieren
], [
Beurteilen Sie die Plausibilität der vorliegenden erkenntnistheoretischen Positionen!
Beurteilen Sie, ob #ix([Descartes'], "<NAME>") #ix("Wachsbeispiel") als Modell für das Wiedererkennen derselben Sachen benutzt werden kann!
],
[
Darstellen
],[
I, II
], [
- einen Zusammenhang strukturiert und sachlich formulieren
], [
*AFB I:* Stellen Sie #ix([Descartes'], "<NAME>") Argumentationsstruktur des cogito-Arguments dar!
*AFB II:* Stellen Sie die wesentlichen Aspekte der rationalistischen Auffassung von #ix("Descartes", "<NAME>") und der empiristischen Auffassung von Locke vergleichend dar!
],
[
Eine philosophische Problemreflexion durchführen
],[
I, II und III
], [
- umfassende und differenzierte Erörterung eines philosophischen Problems eigenständig konzipieren und darlegen
- philosophische Implikationen des vorgelegten Materials bestimmen
- das Problem formulieren und Relevanz erläutern
- Einordnung in einen philosophischen Zusammenhang
- argumentative und gestalterische Auseinandersetzung entwickeln
- begründete Stellungnahme
], [
Führen Sie eine philosophische Problemreflexion zu #ix("Descartes", "<NAME>") #ix("methodischem Zweifel", "Zweifel, methodisch") durch!
Führen Sie eine philosophische Problemreflexion durch, indem Sie eine kontrastierende Präsentation zu Vorstellungen von "sicherer Erkenntnis" anhand der Materialien gestalten!
],
[
Einordnen
],[
II
], [
- mit eigenständigen Erläuterungen in einen bekannten Kontext einfügen
], [
Ordnen Sie #ix([Descartes'], "<NAME>") #ix("Wachsbeispiel") in seine Meditationen ein!
],
[
Entwerfen
],[
III
], [
- ein Konzept in seinen wesentlichen Grundzügen erarbeiten und darstellen
], [
Entwerfen Sie einen eigenen Diskussionsbeitrag zur Frage der möglichen Legitimität des #ix("methodischen Zweifels", "Zweifel, methodisch")!
],
[
Erläutern
],[
II
], [
- nachvollziehbar und verständlich erklären
], [
Erläutern Sie den Unterschied zwischen "cogito ergo sum" und "ego sum, ego existo"!
],
[
Erörtern
],[
II
], [
- ein Beurteilungsproblem erkennen und darstellen
- unterschiedliche Positionen sowie Pro- und Kontra-Argumente abwägen und eine Schlussfolgerung erarbeiten
], [
Erörtern Sie, ob und inwiefern #ix("Descartes", "<NAME>") #ix("Zweifel", "Zweifel, methodisch") an der Existenz des #ix("Fremdpsychischen", "Fremdpsychisches") eine Bedeutung für die alltägliche Lebensgestaltung hat!
],
[
Erschließen
],[
II
], [
- etwas Neues oder nicht eplizit Formuliertes durch Schlussfolgerungen aus etwas Bekanntem herleiten
], [
Erschließen Sie mögliche Konsequenzen aus #ix([Descartes'], "<NAME>") cogito-Argument als Grundlage des Erkenntnisgewinns!
],
[
Gestalten
],[
II, III
], [
- einen konzeptionellen Beitrag nach ausgewiesenen Kriterien ausführlich und differenziert erarbeiten
], [
*AFB II:* Gestalten Sie eine Einleitung für ein philosophisches Essay mit dem Thema "Wie beeinflussen optische Täuschungen unsere Möglichkeit zur sicheren Erkenntnis aus den Sinnen?"
*AFB III:* Gestalten Sie einen Text für ein Flugblatt zum Thema "Ungewissheit", das sich auf verschiedene philosophische Positionen bezieht und Ihre eigene Position verdeutlicht.
],
[
In Beziehung setzen
],[
II
], [
- Zusammenhänge unter vorgegebenen oder selbst gewählten Gesichtspunkten begründen
], [
Setzen Sie #ix([Descartes'], "<NAME>") Traumargument in Beziehung mit der letzten Szene aus dem Film "Inception"!
],
[
Stellung nehmen
],[
III
], [
- eine explizit persönliche Einschätzung eines Problems oder einer gegebenen Problemstellung differenziert erarbeiten
], [
Nehmen Sie begründet Stellung zu der #ix([Descartes'], "<NAME>") These, dass der Satz "Ich bin, ich existiere" immer dann wahr ist, wenn man ihn denkt oder ausspricht.
],
[
Vergleichen
],[
II
], [
- nach vorgegebenen oder selbst gewählten philosophischen Aspekten Unterschiede, Ähnlichkeiten und Gemeinsamkeiten ermitteln und darstellen
], [
Vergleichen Sie die Positionen von #ix("Descartes", "<NAME>") und Lockes in Bezug auf die Verlässlichkeit der Sinne!
],
[
Wiedergeben
],[
I
], [
- einen (gedanklichen) Zusammenhang in eigenen Worten nachvollziehen
], [
Geben Sie die drei Stufen von #ix([Descartes'], "<NAME>") #ix("methodischem Zweifel", "Zweifel, methodisch") in eigenen Worten wieder!
],
[
Zusammenfassen
],[
I
], [
- wesentliche Aspekte (des Materials) in eigenen Worten strukturiert und komprimiert wiedergeben
], [
Fassen Sie #ix([Descartes'], "<NAME>") Argumente in eigenen Worten zusammen!
]
) |
https://github.com/liuguangxi/suiji | https://raw.githubusercontent.com/liuguangxi/suiji/main/examples/random-bitmap-fast.typ | typst | MIT License | #set document(date: none)
#import "/src/lib.typ": *
#set page(width: auto, height: auto, margin: 0pt)
#{
let seed = 0
let unit = 1mm
let (width, height) = (200,) * 2
let rng = gen-rng-f(seed)
let data = ()
for i in range(width * height * 3) {
rng = randi-f(rng)
data.push(rng.bit-rshift(23))
}
grid(columns: (unit,)*width, rows: unit,
..data.chunks(3).map(((r,g,b)) => grid.cell(fill: rgb(r,g,b))[])
)
}
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/GR_old/oktoich/0_all/1hlas.typ | typst | #import "/styleMenlive.typ": *
#import "/GR/texts.typ": *
= #translation.at("HLAS") α' (1)
#import "../Hlas1/0_Nedela.typ": *
#import "../Hlas1/1_Pondelok.typ": *
#import "../Hlas1/2_Utorok.typ": *
#import "../Hlas1/3_Streda.typ": *
#import "../Hlas1/4_Stvrtok.typ": *
#import "../Hlas1/5_Piatok.typ": *
#import "../Hlas1/6_Sobota.typ": *
// TODO: N - Ypakoj?
#hlas_all(M_Ne, V_Ne, none, N_Ne, U_Ne, L_Ne,
V_Po, none, U_Po, L_Po,
V_Ut, none, U_Ut, L_Ut,
V_Sr, none, U_Sr, L_Sr,
V_St, none, U_St, L_St,
V_Pi, none, U_Pi, L_Pi,
V_So, none, U_So, L_So,
h_st, s_st, p_st, n_st,
typs, pripivy,
sd_st, ch_st, su_st, b_st,
id => translation.at(id),
(true, true, false, true, true, true)) |
|
https://github.com/davidmasp/cv | https://raw.githubusercontent.com/davidmasp/cv/master/cv.typ | typst |
#let lead_articles = ("mas2024mutation",
"mas2022spectrum",
"mas2020dna",
"mas2017lncatlas")
#let confkeys = ("mts24","eshg23", "eacr21")
#set page(
paper: "us-letter",
margin: 2.1cm,
footer: [
#align(center)[
#text(9pt, weight: "thin")[
#text("<NAME> - Curriculum Vitae - Page")
#counter(page).display()
#text("- Updated: ")
#datetime.today().display()
]
]
],
number-align: center,
)
#let type_author(name, author, prelast: false, last: false) = {
if (name == author) {
text(name, weight: "bold")
} else {
text(name, weight: "regular")
}
if (prelast) {
text(" & ")
} else if (last) {
text("")
} else {
text(", ")
}
}
#let insert_authors(authorlist, author: "DMP") = {
let alength;
let authors_str;
if (type(authorlist) == "array") {
alength = authorlist.len()
for i in range(alength) {
let name_auth = authorlist.at(i)
let is_pre_last = alength == (i + 2);
let is_last = alength == (i + 1);
type_author(name_auth, author, prelast: is_pre_last, last: is_last)
}
} else {
alength = 1
type_author(authorlist, author, last: true)
}
}
#let insert_works(yamlfn: "test.yaml",
author: "<NAME>",
type: "preprint",
leadkeys: ("mas2023mutation")) = {
let content = yaml(yamlfn)
let counter = content.len()
let journals_preprint = ("bioRxiv", "medRxiv", "arXiv")
for el in content {
let journal = el.at(1).at("parent").at("title")
if (type == "preprint" and journals_preprint.contains(journal)) or (type != "preprint" and journal not in journals_preprint) {
let url = el.at(1).at("url")
let status_str = ""
if (el.at(1).keys().contains("submitted")) {
status_str = [
#text(fill: gray, style: "italic")[
\- #el.at(1).at("submitted").at("status") in #el.at(1).at("submitted").at("journal")
]
]
}
grid(
columns: (5%, 95%),
[
#if (leadkeys.contains(el.at(0))){
text(str(counter))
text("*")
} else {
text(str(counter))
}
],
[
#insert_authors(el.at(1).at("author"), author: author)
(
#text(str(el.at(1).at("date")))
)
#el.at(1).at("title")
#text(journal, style: "italic")
//#chain
#h(2pt)
\-
#text(fill: blue)[
#underline([
#link(url)[link]
])
]
#status_str
]
)
}
counter = counter - 1
}
}
#let insert_conferences(yamlfn: "test.yaml",
author: "<NAME>",
talkkeys: ("mas2023mutation")) = {
let content = yaml(yamlfn)
let counter = content.len()
for el in content {
let url
let conference = el.at(1).at("parent").at("title")
if el.at(1).keys().contains("url") {
let url = text(fill: blue)[
#underline([
#link(el.at(1).at("url"))[link]
])
]
} else {
let url = []
}
grid(
columns: (15%, 85%),
[
#text(str(el.at(1).at("date")))
#if (talkkeys.contains(el.at(0))){
text("*")
}
],
[
#el.at(1).at("title") -
#el.at(1).at("parent").at("title") (
#el.at(1).at("parent").at("location")
)
#url
]
)
}
counter = counter - 1
}
#let sectiontitle(title, annotation) = {
v(2pt)
grid(columns: (75%, 25%),
column-gutter: 3pt,
rows: 1,
text(15pt, weight: "regular")[#title],
align(right)[#text(9pt, weight: "thin")[#annotation]]
)
v(-10pt)
line(length: 100%)
}
#let award(timerange, name, institution, url) = {
grid(columns: (15%, 65%, 20%),
[#timerange],
[
#align(center)[
#text(style: "italic")[#name],
#institution
]
],
[
//#chain
#text(fill: blue)[
#underline([
#link(url)[website]
])
]
]
)
}
#let item(timerange, name, place) = {
grid(
columns: (15%, 85%),
column-gutter: 3pt,
row-gutter: 5pt,
rows: 2,
align(left)[#timerange],
align(left)[
#name
],
align(center)[],
align(left)[
#place
]
)
}
#let item_full_date(timerange1, timerange2, name, place) = {
grid(
columns: (15%, 85%),
column-gutter: 3pt,
row-gutter: 5pt,
rows: 2,
align(left)[#timerange1],
align(left)[
#name
],
align(left)[#timerange2],
align(left)[
#place
]
)
}
#let researhsupervision(year, name, type, institution) = {
grid(
columns: (15%, 85%),
column-gutter: 3pt,
rows: 1,
align(left)[#year],
align(left)[
#name, #type, #text(style: "italic")[#institution]
]
)
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#text(20pt, weight: "bold")[<NAME>, PhD]
#v(-15pt)
#line(length: 100%)
#set text(11pt)
#grid(
columns: (70%, 30%),
row-gutter: 5pt,
rows: 3,
[Department of Genome Sciences, University of Washington],
align(right)[<EMAIL>],
[Foege Building (S420) - 3720 15th Ave NE],
align(right)[
#link("https://david.masponte.com/")[david.masponte.com]
],
[Seattle, WA 98195 (USA)],
align(right)[
\@davidmasp -
#box(
height: 9pt,
image("assets/twitterlogo.svg")
)
#box(
height: 9pt,
image("assets/github-mark.svg")
)
]
)
#sectiontitle([Academic positions], [\* Current]);
#item(
[06/2023-\*],
[Postdoctoral Scholar],
[
<NAME> lab, Genome Sciences Deptartment, University of Washington
])
#item(
[01-06/2022],
[Visiting Student Researcher],
[
<NAME> lab, Biology Deptartment, Stanford University
])
#item(
[2017-2023],
[PhD Student],
[
<NAME> lab, Cancer Biology, Institute for Research in Biomedicine Barcelona
])
#item(
[2016-2017],
[MSc Thesis Project],
[
<NAME> lab (tutored by <NAME>), Bioinformatics Deptartment, Centre for Genomic Regulation
])
#sectiontitle([Education], []);
#item(
[2017-2022],
[PhD, Biomedicine],
[
Universitat de Barcelona, Barcelona, Spain
])
#item(
[2015-2017],
[
MSc, Bioinformatics for Health Sciences,
#text(size: 8pt, weight: "thin")[GPA: 9/10]
],
[
Universitat Pompeu Fabra, Barcelona, Spain
])
#item(
[2011-2015],
[
BS, Biotechnology,
#text(size: 8pt, weight: "thin")[GPA: 8.5/10]
],
[
Universitat Autonoma de Barcelona, Spain
])
#item(
[2014],
[International Exchange Student (undergrad)],
[
McGill University, Montreal, Canada
])
#sectiontitle([Preprints and Submitted manuscripts], [\* lead or co-lead author]);
#insert_works(yamlfn: "dmas.yaml",
type : "preprint",
leadkeys: lead_articles)
#block(breakable: false)
#sectiontitle([Peer-Reviewed Publications], [\* lead or co-lead author]);
#insert_works(yamlfn: "dmas.yaml",
type : "peer",
leadkeys: lead_articles)
#sectiontitle([Conferences], [\* Talks ]);
#insert_conferences(yamlfn: "talks.yaml",
talkkeys: confkeys)
#sectiontitle([Research Fellowships], []);
// funding
// jae intro
// FPI
#item(
[2023-2025],
[
Mahan Postdoctoral Fellowship -
#text(fill: blue)[
#underline([
#link("https://www.fredhutch.org/en/research/divisions/public-health-sciences-division/research/computational-biology/mahan-fellowship.html")[website]
])
]
],
[
Herbold Computational Biology Program of the
& Institute for Research in Biomedicine (
#text(style: "italic")[Fred Hutchinson Cancer Center]
)
//
])
#item(
[2017-2022],
[
<NAME> - Formacion de Personal Investigador (SO-FPI) Fellowship - BES-2017-079820 -
#text(fill: blue)[
#underline([
#link("https://www.aei.gob.es/sites/default/files/stfls/eSede/Ficheros/2018/RC_PREDOC_2017.pdf")[website]
])
]
],
[
Ministerio de Ciencia
& Institute for Research in Biomedicine (
#text(style: "italic")[IRB Barcelona]
)
//
])
#item(
[2015],
[
JAE Intro Fellowships (undergraduate research) -
#text(fill: blue)[
#underline([
#link("https://jaeintro.csic.es/")[website]
])
]
],
[
Consejo Superior de Investigaciones Cientificas (
#text(style: "italic")[CSIC]
)
& Institute for Evolutionary Biology (
#text(style: "italic")[IBE]
)
//
])
#item(
[2014],
[
"Passa l’Estiu al Parc!" Summer Fellowship (undergraduate research) -
#text(fill: blue)[
#underline([
#link("https://www.pcb.ub.edu/sobre-la-convocatoria-per-participar-a-la-13a-edicio-de-passa-lestiu-al-parc/")[website]
])
]
],
[
Parc Cientific de Barcelona (
#text(style: "italic")[PCB]
)
& Institute Of Molecular Biology of Barcelona (
#text(style: "italic")[IBMB]
)
//
])
#sectiontitle([Research Supervision], []);
#researhsupervision(
[2023-],
[<NAME>],
[MSc student],
[U. Washington]
)
// year, name, type, institution
#researhsupervision(
[2017-2018],
[<NAME>],
[MSc student],
[U. <NAME> (Bioinformatics)]
)
#sectiontitle([Academic Service & Awards], []);
#award(
[2021],
[Best scientific article (finalist)],
[Societat Catalana de Biologia],
"https://febs-iubmb-enableconference.org/nmg-2019/"
)
#award(
[2018-2019],
[Scientific Organizing Committee],
['19 ENABLE Conference (Nijmegen, Netherlands)],
"https://scb.iec.cat/wp-content/uploads/2021/11/Document_assemblea2021.pdf"
)
Referee for Evolution, Medicine, and Public Health ('23, '24), WoSid: #text(fill: blue)[ #link("https://www.webofscience.com/wos/author/record/JPL-3000-2023")[JPL-3000-2023]].
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/009%20-%20Born%20of%20the%20Gods/008_The%20Oracle%20of%20Ephara.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"The Oracle of Ephara",
set_name: "Born of the Gods",
story_date: datetime(day: 19, month: 03, year: 2014),
author: "<NAME>",
doc
)
Iris, the Oracle of Ephara, leaned forward in the wooden armchair and carefully probed the small side table until her fingertips touched the clay drinking vessel. She gingerly lifted the cup to her mouth, a thin stain of purple remaining on her lips as she tentatively placed the cup back on the table.
"I do not want to run and hide like a fawn," she said. "If we are to avoid war with those who have sided with the other gods, then I must be here to interrogate captives. You know my gift of foresight only comes from a touch. I cannot be of help if I am hiding far away."
"The enemies' agents have infiltrated the city," said Perisophia, the current head of the ruling council of philosophers known as the Twelve. The Twelve were arrayed in a circle in the center of the great hall of governance. Iris could hear their voices echo off of the massive marble pillars that stretched to the dome far above their heads.
"If you are captured or killed," Perisophia continued, "then you will be of no help to Meletis or Ephara. If we are to avoid open conflict among humankind, we must also prevent the renegade factions loyal to Purphoros from provoking it. We have conferred with the Temple and agreed that you will be moved to the garrison at Soli, where you will be safe until we call for you. The decision is final."
"How am I to get there?" Iris asked, resigned to the command. From one gilded cage to another. Although she lived in servitude to her god and her polis, at least she knew her way around Meletis. Learning the garrison at Soli would be challenging. She would be even more like a captive there.
"You will be escorted by a bodyguard, overland," Perisophia replied.
"Overland, by a single guard?" she scoffed. "Do you #emph[hope] to get me killed?"
"The two of you are unlikely to be discovered on the way, and thus it is the safer option. If we send you with a patrol of soldiers, you will be a target. Besides," Perisophia continued, "your guard is no ordinary soldier. You will be quite safe."
Iris sat back in her chair, feeling the grain of the wood with her hands, her milky, useless eyes staring into nothingness, as always.
"Send him in," Perisophia commanded. The massive carved wooden doors at the front of the hall swept open. Iris heard the rubbing of wood on the huge bronze hinges and felt the subtle breeze as outside air pushed its way in. An armored man strode into the hall and approached Iris, the metal trim on his boots and skirt clinking with each step. He knelt before her. She felt his breath on her hand.
#figure(image("008_The Oracle of Ephara/01.jpg", width: 100%), caption: [Akroan Skyguard | Art by Mark Winters], supplement: none, numbering: none)
"Your ladyship," he began, in the deep voice of the very tall. "I am Alexio, Skyknight of Meletis. My duty is to see you safely to the garrison at Soli."
He took her hand in his. Iris ran her fingers and palm over it, then up his arm, feeling the hair and muscles. When she reached his shoulders she felt a scar from an old, deep cut. She followed the wound over the top of his shoulder until she felt something brush against the back of her fingers. She slowly reached out until she could feel for certain the nearly intangible, etheral mass of what she knew were wings of light, a gift of the gods. She smoothed them gently. He remained perfectly still, waiting for her to finish examining him.
Her fingers left his wings and probed his face so that she could understand what he looked like—his aquiline nose, square jaw, full lips, protruding brow, short curly hair. Her hand lingered in the side of his face for a moment. That's when the vision came.
#figure(image("008_The Oracle of Ephara/02.jpg", width: 100%), caption: [Oracle's Insight | Art by Raymond Swanland], supplement: none, numbering: none)
She did not see a particular event from the future. It was more like a feeling, like being in Alexio's dream and feeling the same emotions as he. He was in love with her. Not now, of course, for they had just met, but sometime in the future. And she felt him being taken from her, and his sadness, and then his nothingness.
The thought repulsed her. Not because he was repulsive, but because she knew how it would end. He was an exalted soldier of the polis and she was a blind oracle of Ephara. Never in a thousand years could they be together. If his love for her would kill him, then she must prevent it.
She withdrew her hand suddenly and drew a sharp breath.
"Is everything all right, My Lady?" he asked.
"Yes," she replied. "We will leave at dawn. The journey takes at least three days, and we must hurry." Above all else, she wanted to get to the garrison as soon as possible, before her prophecy had time to manifest.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
By the time the faintest light cracked the horizon, Iris was mounted on a government horse, her travel cloak wrapped tightly against the chill and her essential belongings packed securely in the saddlebags. Alexio held the reins. Perisophia stood in the courtyard, and held her hand for a moment.
"May Ephara grant you a safe and swift journey, Iris of the Sight," she said, gravely. "We will send for you as soon as it is safe to return. Godspeed."
Perisophia let go of Iris's hand as Alexio led her horse away, through the city, out the stone gates and onto the road south. They avoided the highway, taking instead the smaller, more ancient path through the forest. By the end of the day, they would be at the foot of the mountains they would have to cross in order to reach the garrison.
#figure(image("008_The Oracle of Ephara/03.jpg", width: 100%), caption: [Forest | Art by Adam Paquette], supplement: none, numbering: none)
The day warmed as it lightened and Alexio soon drew her into conversation as they travelled.
"Should anything happen, My Lady—"
"Please, you may call me Iris."
"My lady Iris," he continued, "should we be ambushed, or endangered, trust to your horse and I will protect you. Know that if I must fly, I will come back to you, on my life."
"Of course," she acknowledged graciously.
"What are your hopes for peace, My Lady... Iris?" he asked.
"I daresay I want it. But the gods have abandoned us, leaving us to our own base desires—and that rarely ends well."
"It is an unfortunate thing," he replied.
"Fortune has little to do with it. It is the gods who play our strings like a harp. Although they have not answered my call in many nights, I know they still hear. I'm just not sure they care."
"Many believe that soldiers are born for battle," Alexio said. "But it is not always the truth. I would give anything to avoid war. I would rather converse with you by the fire, goblet in hand, than die on a battlefield for gods' own reasons."
"Does not your training teach you that you are already dead?" she said coldly in an effort to keep her emotional distance. "That is how a soldier must wake up every morning—with the certainty that his life has already been sacrificed."
"My lady," he responded, formally. "I will scout the area around us to ensure we are not being followed. Continue on and I will meet you up the path." She heard him open his cloak and stretch his wings, and suddenly, with a deep beating of the air, he was gone.
She rode in silence, thinking of the previous day's vision. Yes, he had drawn her into conversation, was even charming in his way, but she knew she must keep him at arm's length, lest her vision of his love for her manifest too soon. Perhaps she could avoid this fate. If the gods were going to be silent, then maybe fate was on hold as well. For Alexio to fall in love with her... she shook the thought from her mind. It simply must not be allowed to happen.
She spurred her horse into a trot, feeling relief in the freedom from the city, from the oppressive magnitude of the government and its imposing stone, its formal customs and grave responsibilities. She quickly offered a prayer for safety and encouraged her horse into a gallop that it was eager to oblige.
The warm wind of the afternoon whipped her cloak and peppered her face. She actually laughed for the first time in ages, holding the reins loosely in one hand and gripping the pommel of the saddle in the other. The landscape of her mind flew by. She could hear the trees pass on either side. Everything felt gloriously out of control. It was the first time she had been alone without an escort or handler in ages.
"Iris!" she heard Alexio shout from somewhere above. Before she even had the chance to rein in her horse, Alexio's powerful arms swept her out of the saddle and carried her through the air before roughly depositing her onto the grass. She heard her horse neigh violently and cry out. She heard the ringing of Alexio's sword as it left the scabbard and the shouts of two other men as they were cut down by his blade, one of them putting up a fight, sword to sword, before being silenced. Quiet returned to the world, except the labored breathing of her horse some distance away.
Iris felt around her trying to regain her orientation. Alexio beat down to the ground by her side.
"Are you injured, My Lady?"
"No, just surprised, and disoriented."
"It was an ambush. Two highwaymen, or what we are meant to think were highwaymen. Judging by the markings on their weapons, I would guess they were worshipers of Purphoros." He took Iris's hand and helped her to her feet.
"Thank you, Sir," she smiled.
"Unfortunately, they used a tripwire to fell your horse, who appears to have a broken leg. If I hadn't shown up just in time, you might have had a broken head. What were you thinking racing away like that?" He scolded her, gently, but seriously.
"I'm sorry," she said. "I don't know what I was thinking. I was just reveling in a moment of freedom."
"Wait here," he said, "while I put your horse down."
She cursed herself, silently, for losing control of her emotions. It had cost her horse, and it had almost cost her life. If only she could always have a bodyguard like Alexio, keeping a sharp and trusted watch over her, instead of the usual sniveling bureaucrats. She imagined the freedom she could have, and then pushed the thought away. It could never happen. The air changed, and she realized she could no longer hear her horse's labored breathing.
She heard Alexio's footsteps approach and he gently took her hand.
"It is done, <NAME>. Now we must continue on foot."
He led her by the hand as they walked side-by-side down the forest path, his great, strong hand tenderly engulfing hers.
"We must keep our senses sharp. I know that your hearing is very keen. You must help me sense danger. Now that we are on foot, we are much more vulnerable."
"I am sorry," she said again. "I have been a fool."
"It is not true, Iris," he replied, squeezing her hand so gently she wasn't sure it was even intentional. "You were only enjoying a fleeting moment of freedom that most people take for granted their entire lives. Not only do I not blame you, I respect you all the more for it. Your life is not so different from mine, always in service to Meletis, never to ourselves."
She withdrew her hand from his. "I can follow you by sound. You do not need to lead me like a child."
"As you wish."
She detected a hint of disappointment in his voice.
"I will try to find you another mount tomorrow. I know of a herd that roams the mountainside. Since the sun grows wan, we will make camp soon and continue in the dawn. If you will allow me to carry you, I can fly us for a while. My wings are strong enough."
"That will not be necessary," she replied. "I am blind, not helpless."
They walked in silence until Iris's legs grew tired. Alexio led her away from the path to a forest clearing where they could sleep undetected. He made a small, hidden fire and a makeshift tent for her. They shared some food from the saddlebags and a sip of wine before Iris retired and Alexio flew to the treetops to stand watch.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
"They came through here only hours ago," the commander said, rolling his dead comrade over. "This is clearly the work of the Skyguard."
"Look, sir, a horse," said one of the rangers.
"Ah," replied the commander. "It must be hers. Excellent. If they are on foot we should be able to overtake them tomorrow."
Two of the other rangers conferred farther up the path before turning back toward their commander.
"Two tracks continue in this direction," one of them said. "One is the woman, the other the Skyguard. There doesn't appear to be anyone else with them."
"The Oracle of Ephara, alone with a single Skyguard? What could they have been thinking? Men, we will be home with our captive and the head of a Skyguard before the moon is full."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
By the time full daylight filtered down through the trees, they had reached the foothills of the mountains. They had already travelled many miles, Iris, again, refusing to be carried aloft in the arms of Alexio. He led her off the path to the base of a large tree, where he bade her to sit and eat while he went to look for a mount. She was grateful for the rest. Spending most of her time in the luxuries of Ephara's Temple, she was not used to this much travelling.
Leaning against the moss-covered trunk of the tree in a beam of sunlight with food in her belly, she could not help but to drift off to the dream world for a moment.
She awoke to the sounds of a horse whinnying and the deep beating of large wings. She could also hear Alexio's smaller wings beating down to the ground nearby. She recognized the particular quality and cadence of the way he landed, but she did not recognize the other set of wings. The sunbeam was gone, and in its place a cold shadow lay across her body. She could smell moisture in the air.
"I have returned with a mount," he said triumphantly. She could hear the smile in his voice. "He is willing, and friendly to the Skyguard."
#figure(image("008_The Oracle of Ephara/04.jpg", width: 100%), caption: [Loyal Pegasus | Art by <NAME>], supplement: none, numbering: none)
Iris rose from her seat and approached the sound of the pegasus's breathing, hand outstretched. The creature pushed it head against her hand and she stroked its neck, moving alongside it until she could feel the huge feathers of its wing. She smiled, anticipating what it would be like to fly.
"How wonderful, Sir. I am speechless."
"We shall make haste now," Alexio said. "Are you ready?"
Iris nodded and he picked her up by her waist and hoisted her onto the back of the great mount. This time, she didn't mind his strong hands on her body. With a flying mount, they were more like equals.
"Hold fast, but know that he will not let you fall." Alexio let out a guttural encouragement and the pegasus beat its wings and leaped from the ground. Iris gave an involuntary squeal at the sudden movement and wrapped her arms around its neck, holding on for dear life.
"This is amazing," she laughed. "I have never felt this sensation before."
"It is heartening to see you happy," Alexio replied.
"Describe for me what you see," she requested.
Alexio described the mountains ahead, the forest below, the river snaking down from the highlands toward the city far behind them. Iris imagined it all in her head.
"The sky is dark," Alexio added, flying beside her. "I hope to get across the mountains before it rains, but I am not so sure."
As if a jealous god was listening to him, thunder rumbled from a distance. Iris offered a prayer to the gods to keep the skies closed until they were across the mountains.
All too soon, the rain began to fall. Misty at first, it slowly turned into a gentle shower, wetting her face.
"Are you all right, Iris?" Alexio asked.
"Yes," she replied, "we should continue on."
They flew in silence, concentrating. The rain came down heavier, soaking Iris's cloak and pelting her face as they cut through it. She grew cold, her body weary from gripping her mount, afraid of falling.
"Perhaps we should stop and take shelter," she shouted over the rain.
"If you can, I recommend we push on. Your mount has the stamina."
"Yes, but I do not. Please, if we could find a place to rest, I would be grateful, and more able to continue tomorrow."
"Of course. I will see what I can find." They banked to the right as thunder cracked again, much closer than before. Iris shivered and clung to her mount's wet hair.
They spent some minutes twisting to and fro, occasionally doubling back in the pelting wind and rain.
"Down there," Alexio said after a while. He seemed to be talking to the pegasus.
She was relieved when they gently touched down on solid ground and Alexio led them into a cave on the side of the mountain. The cave was cold, but dry. Alexio quickly reconnoitered the cavern, reporting that it had only two chambers, bent around a rocky outcropping, with entrances on either side.
Iris dismounted and shook out her cloak, shivering. Alexio quickly unpacked the saddlebags, and set about building a fire while Iris divided food between them. The pegasus clopped to the other chamber, shook himself out and settled down with a whinny.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
"We'll never find them in this mess," one of the rangers complained to the captain.
"Nonsense," the captain replied
He pulled his men aside, under the relative shelter of a spreading oak tree and dismounted. His men watched as he retrieved a golden goblet from his pack. The captain scooped water from a clear puddle into the goblet and crouched over it, covering his head with his cloak and sheltering the water until the surface settled and became glassy. Concentrating, he uttered the incantation, repeating it until the water inside the goblet turned silver, like the surface of a mirror. In the mirror, he could see the Oracle and Skyguard descend toward the mountain pass and slip into the entrance of a cave.
#figure(image("008_The Oracle of Ephara/05.jpg", width: 100%), caption: [Astral Cornucopia | Art by <NAME>], supplement: none, numbering: none)
A drop of water rolled off the captain's hood and splashed into the goblet, shattering the mirrored surface and wiping away the image. The captain dumped the goblet on the ground and stood up.
"I know where they are," he said to his patrol. "But we'll need to make haste if we want to get to them before dawn. We will ambush them in the cave. With luck, we can bribe one of the spiders of the upper forest to help us."
He swung up onto his horse and spurred it into a gallop.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
After being warmed by food and fire, Iris found the wineskin she had buried at the bottom of her belongings and offered it to Alexio.
"<NAME>," he said after a drink, "I am glad you talked me into stopping. Seeing you glow in the firelight, warm and dry, is a beautiful contrast to the weather outside. Let's enjoy one more night of freedom before we must resume your duties."
"Yes," she agreed. "Another hour in that storm would have been the death of me. I, as well, would rather spend a night in a cave on a mountainside with you, than hurry to my continuing servitude."
Alexio moved closer to Iris and handed her the wine skin. She drank eagerly and wrapped her blanket over her shoulders.
"Will we be safe here?" she asked, quietly. The fire crackled, heating her face.
"You will be safe with me. You will always be safe with me..." he trailed off.
She reached out and took hold of his hand, hoping for a vision. Hoping for a sign of what may come. But there was nothing. Nothing but her own thoughts, desires, and the grip of his warrior's hand squeezing her back.
She moved next to him, their bodies touching, side by side. Her hands trembled.
"Are you all right, Iris?" he asked, voice soft, almost a whisper.
In that moment, she realized that her vision of his fate was incomplete. She had seen him fall in love with her, and be taken away, but she had not seen her part in the prophecy. Had the gods decreed this, or could her own actions change the future? What if they #emph[could] be together, flying free over the world? Perhaps if she loved him back, she could change his fate—and he, hers.
She tilted her head toward him and parted her lips. No, she thought, this cannot be. But the aching inside her pushed its way out. Before she could control herself, she felt his lips touch hers. He wrapped her in his strong arms and laid her down on the blanket next to the fire.
No man had ever put his hands on her like that before. She let go of her earthly concerns and lived for a while in a cocoon of safety, pleasure, and release.
Eventually, she fell asleep in his arms, wrapped in a warm blanket by a gently crackling fire, a smile on her face and a warm glow in her belly. In the moment, right before the dream world took her, she felt happier and freer than she had ever been, or thought possible.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
She awoke from a dream. A strange dream. Not the beautiful one she had hoped for. A large hand pressed down on her mouth. She let out a gasp and the hand pressed harder.
"Quiet," Alexio whispered. "Get up and get ready to go out the back of the cave."
Iris heard two things: the pegasus exhaling beside her, and the faint clink of metal, like a coin being dropped on a rock outside the cave entrance. She quietly shrugged the blanket off and felt around for her boots. The fire must have burned down to coals; she could barely feel its heat.
Alexio slowly drew his sword from its scabbard. She could hear him moving around the chamber. He dropped her cloak over her shoulders while she pushed her feet into her boots. Over the rain still falling outside, she heard the definite sounds of men whispering.
Iris pointed toward the cave entrance, indicating she heard them. Alexio lifted her onto the back of her mount.
"Let's go out the back entrance. I'll lead the way," he whispered.
Just then, an arrow whizzed past them and clattered into the back wall of the cave. Iris could tell by the direction of the sound that it had come from the cave entrance.
Alexio ran ahead, to the back entrance, the pegasus following behind. Iris heard at least two men enter the cave, swords and armor clattering. She offered a silent prayer to Ephara to deliver them both safely from this cavern.
"Gods," Alexio shouted suddenly. She could hear struggle in his voice. "A spider web has been strung across the back entrance."
#figure(image("008_The Oracle of Ephara/06.jpg", width: 100%), caption: [Graverobber Spider | Art by <NAME>], supplement: none, numbering: none)
Iris's mount stopped short and grunted, cutting back and forth nervously. She could hear Alexio's sword swinging wildly as he struggled to cut the web away. Some horrible creature squealed and hissed before retreating.
"You must go, now!" Alexio shouted.
"I won't leave you," Iris replied, desperately, the horrible thought sinking in that she was completely helpless.
Another arrow twanged through the cavern, this time finding its mark. Iris shuddered as she heard the shaft sink into something soft. Alexio grunted and continued to struggle in the spider's web.
"Take my hand," she cried, reaching out into the dark, touching nothing.
"I have cleared the web. Your mount knows where to go." His voice quivered, he gasped.
"Please," she cried. The pegasus shifted forward nervously, barely able to hold back.
"Fly," he shouted, slapping the pegasus's rump with the flat of his sword.
The pegasus took a mighty leap across the cave entrance. Iris could feel the temperature and pressure change as they crossed the threshold of the cave. With a massive beat of wings they were airborne into the rainy sky.
"No!" she cried, "please, no."
"I love you," she heard him say, his voice fading away in the wind.
The ambushers were upon Alexio. She heard the receding clash of swords and felt the brittle fingers of death brush past her. She knew he would never make it out of that cave, his mighty body and heavenly wings doomed.
She buried her face in the pegasus's mane and cried, knowing in her heart that she was the one who killed him. What a fool she had been to think that she could change his fate. Where were the gods then? For the first time in her life, she had tasted love. For the first time in her life she had experienced enough freedom to even hope for love, and Alexio was dying for that love. If she returned to her old life, to grow old and die in servitude, his death would be for nothing.
She turned her mount, not toward the garrison at Soli or toward Meletis, but westward into the unknown. The Oracle of Ephara flew blindly through the rain toward freedom, unseeing and alone, as she had always truly been.
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-3190.typ | typst | Apache License 2.0 | #let data = (
("IDEOGRAPHIC ANNOTATION LINKING MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION REVERSE MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION ONE MARK", "No", 0),
("IDEOGRAPHIC ANNOTATION TWO MARK", "No", 0),
("IDEOGRAPHIC ANNOTATION THREE MARK", "No", 0),
("IDEOGRAPHIC ANNOTATION FOUR MARK", "No", 0),
("IDEOGRAPHIC ANNOTATION TOP MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION MIDDLE MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION BOTTOM MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION FIRST MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION SECOND MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION THIRD MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION FOURTH MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION HEAVEN MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION EARTH MARK", "So", 0),
("IDEOGRAPHIC ANNOTATION MAN MARK", "So", 0),
)
|
https://github.com/felsenhower/kbs-typst | https://raw.githubusercontent.com/felsenhower/kbs-typst/master/examples/04.typ | typst | MIT License | + Foo
- Foobar
- Foobaz
+ Bar
+ Baz
|
https://github.com/Clamentos/FabRISC | https://raw.githubusercontent.com/Clamentos/FabRISC/main/src/spec/Section7.typ | typst | Creative Commons Attribution Share Alike 4.0 International | ///
#import "Macros.typ": *
///
#section(
[Instruction List (WORK IN PROGRESS) ],
[This section is dedicated to provide the full and extensive list of all the proposed instructions in the ISA divided into their corresponding module.],
[Systems that don't support certain modules must generate the `INCI` fault whenever an unimplemented or incompatible instruction is fetched or attempted to be processed in any other way. The `ILLI` fault whenever a combination of all zeros, all ones or an otherwise illegal combination is fetched in order to increase safety against buffer overflows exploits or accidental accesses of uninitialized memory locations.],
[As mentioned in previous sections, since some instructions can generate flags, they are not stored in any sort of flag register and they can be ignored unless the `EXC`, `HLPR` or both modules are implemented.],
[Unused bits, designated with "-" or "x", must have a value of zero by default for convention.],
)
///.
#subSection(
[Computational Integer Scalar Basic (`CISB`)],
[This module provides simple integer scalar instructions to perform a variety of arithmetic and logical operations with registers or immediate values. The `SGPRB` is mandatory for this module.],
// ADD,SUB: should have same opcode
// MIN,MAX: should have same opcode
// LSH,RSH: should have same opcode
// ADDI,SUBI: should have same opcode
// MINI,MAXI: should have same opcode
// LSHI,RSHI: should have same opcode
tableWrapper([CISB instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`ABS`], [], [2R.A], [-], [*Absolute Value*: Computes the absolute value of `rb` placing the result into `ra`. This instruction doesn't raise any flags.],
[`EXT`], [], [2R.A], [`B`], [*Sign Extend*: Computes the sign extension of `rb`, at the length specified in the class, placing the result into `ra`. This instruction doesn't raise any flags.],
[`ADD`], [], [3R.A], [`A`], [*Addition*: Computes the sum of `rb` and `rc` placing the result into `ra`. This instruction class specifies: `00` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `01` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag.],
[`SUB`], [], [3R.A], [`A`], [*Subtraction*: Computes the difference of `rb` and `rc` placing the result into `ra`. This instruction class specifies: `10` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `11` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag.],
[`MIN`], [], [3R.A], [`A`], [*Minimum*: Computes the minimum of `rb` and `rc` placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode and `01` (`.U`) as _unsigned_ mode.],
[`MAX`], [], [3R.A], [`A`], [*Maximum*: Computes the maximum of `rb` and `rc` placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `10` (`.S`) as _signed_ mode and `11` (`.U`) as _unsigned_ mode.],
[`AND`], [], [3R.A], [`A`], [*Bitwise AND*: Computes the bitwise logical AND of `rb` and `rc` placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`-`) and `01` (`.I`) as _inverted_ mode, which simply inverts the result.],
[`OR`], [], [3R.A], [`A`], [*Bitwise OR*: Computes the bitwise logical OR of `rb` and `rc` placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`-`) and `01` (`.I`) as _inverted_ mode, which simply inverts the result.],
[`XOR`], [], [3R.A], [`A`], [*Bitwise XOR*: Computes the bitwise logical XOR of `rb` and `rc` placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`-`) and `01` (`.I`) as _inverted_ mode, which simply inverts the result.],
[`LSH`], [], [3R.A], [`A`], [*Left Shift*: Computes the left shift of `rb` by the amount specified in `rc` placing the result into `ra`. This instruction class specifies: `00` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `01` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag.],
[`RSH`], [], [3R.A], [`A`], [*Right Shift*: Computes the right shift of `rb` by the amount specified in `rc` placing the result into `ra`. This instruction class specifies: `10` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `11` (`.U`) as _unsigned_ mode which can raise the `CUND` flag.],
[`SEQ`], [], [3R.A], [`A`], [*Set If Equal*: Sets `ra` to 1 or 0 depending on if `rb` and `rc` are equal or not. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode, `01` (`.U`) as _unsigned_ mode, `10` (`.IS`) as _inverted signed_ mode and `11` (`.IU`) as _inverted unsigned_ mode. The last two modes simply invert the checking condition.],
[`SLT`], [], [3R.A], [`A`], [*Set If Less Than*: Sets `ra` to 1 or 0 depending on if `rb` is less than `rc` or not. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode, `01` (`.U`) as _unsigned_ mode, `10` (`.IS`) as _inverted signed_ mode and `11` (`.IU`) as _inverted unsigned_ mode. The last two modes simply invert the checking condition.],
[`SLE`], [], [3R.A], [`A`], [*Set If Less Or Equal*: Sets `ra` to 1 or 0 depending on if `rb` is less than or equal to `rc` or not. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode, `01` (`.U`) as _unsigned_ mode, `10` (`.IS`) as _inverted signed_ mode and `11` (`.IU`) as _inverted unsigned_ mode. The last two modes simply invert the checking condition.],
[`CMV`], [], [3R.A], [`A`], [*Conditional Move*: Sets `ra` to the value of `rb` if `rc` matches the condition specified in the class, leaving `ra` unchanged otherwise. This instruction doesn't raise any flags and its class specifies: `00` (`.EZ`) as _equal to zero_ mode, `01` (`.NZ`) _not equal to zero_ mode, `10` (`.LTZ`) _less than zero_ mode and `11` (`.LTZU`) _less than zero unsigned_ mode.],
[`LDI`], [], [RI.A], [`D`], [*Load Immediate*: Sets `ra` to the sign-extended immediate value. This instruction doesn't raise any flags.],
[`HLDI`], [], [RI.A], [`D`], [*High Load Immediate*: Sets the upper `WLEN:16` bits of `ra` to the sign-extended immediate value leaving the lower 16 bits unchanged. This instruction doesn't raise any flags.],
[`ADDIHPC`], [], [RI.A], [`D`], [*Add Immediate High To PC*: Computes the sum of the `PC` with the sign-extended and right-shifted by 16 places immediate value placing the result into `ra`. This instruction doesn't raise any flags.],
[`ADDI`], [], [2RI.A], [`A`], [*Addition Immediate*: Computes the sum of `rb` and the immediate value placing the result into `ra`. This instruction class specifies: `00` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `01` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag. The immediate will be sign or zero extended according to the specified mode.],
[`SUBI`], [], [2RI.A], [`A`], [*Subtraction Immediate*: Computes the difference of `rb` and the immediate value placing the result into `ra`. This instruction class specifies: `10` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `11` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag. The immediate will be sign or zero extended according to the specified mode.],
[`MINI`], [], [2RI.A], [`A`], [*Minimum Immediate*: Computes the minimum of `rb` and the immediate value placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode and `01` (`.U`) as _unsigned_ mode. The immediate will be sign or zero extended according to the specified mode.],
[`MAXI`], [], [2RI.A], [`A`], [*Maximum Immediate*: Computes the maximum of `rb` and the immediate value placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `10` (`.S`) as _signed_ mode and `11` (`.U`) as _unsigned_ mode. The immediate will be sign or zero extended according to the specified mode.],
[`ANDI`], [], [2RI.A], [`A`], [*Bitwise AND Immediate*: Computes the bitwise logical AND of `rb` and immediate value placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) _signed_ mode which sign-extends the immediate, `01` (`.U`) _unsigned_ mode which doesn't sign-extend the immediate, `10` (`.IS`) _inverted signed_ mode which inverts the result and sign-extends the immediate and `11` (`.IU`) _inverted unsigned_ which simply inverts the result.],
[`ORI`], [], [2RI.A], [`A`], [*Bitwise OR Immediate*: Computes the bitwise logical OR of `rb` and the immediate value placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) _signed_ mode which sign-extends the immediate, `01` (`.U`) _unsigned_ mode which doesn't sign-extend the immediate, `10` (`.IS`) _inverted signed_ mode which inverts the result and sign-extends the immediate and `11` (`.IU`) _inverted unsigned_ which simply inverts the result.],
[`XORI`], [], [2RI.A], [`A`], [*Bitwise XOR Immediate*: Computes the bitwise logical XOR of `rb` and the immediate value placing the result into `ra`. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) _signed_ mode which sign-extends the immediate, `01` (`.U`) _unsigned_ mode which doesn't sign-extend the immediate, `10` (`.IS`) _inverted signed_ mode which inverts the result and sign-extends the immediate and `11` (`.IU`) _inverted unsigned_ which simply inverts the result.],
[`LSHI`], [], [2RI.A], [`A`], [*Left Shift Immediate*: Computes the left shift of `rb` by the amount specified by the immediate value placing the result into `ra`. This instruction class specifies: `00` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `01` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag.],
[`RSHI`], [], [2RI.A], [`A`], [*Right Shift Immediate*: Computes the right shift of `rb` by the amount specified by the immediate value placing the result into `ra`. This instruction class specifies: `10` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `11` (`.U`) as _unsigned_ mode which can raise the `CUND` flag.],
[`SEQI`], [], [2RI.A], [`A`], [*Set If Equal Immediate*: Sets `ra` to 1 or 0 depending on if `rb` and the sign-extended immediate value are equal or not. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode, `01` (`.U`) as _unsigned_ mode, `10` (`.IS`) as _inverted signed_ mode and `11` (`.IU`) as _inverted unsigned_ mode. The last two modes simply invert the checking condition.],
[`SLTI`], [], [2RI.A], [`A`], [*Set If Less Than Immediate*: Sets `ra` to 1 or 0 depending on if `rb` is less than the sign-extended immediate value or not. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode, `01` (`.U`) as _unsigned_ mode, `10` (`.IS`) as _inverted signed_ mode and `11` (`.IU`) as _inverted unsigned_ mode. The last two modes simply invert the checking condition.],
[`SLEI`], [], [2RI.A], [`A`], [*Set If Less Or Equal Immediate*: Sets `ra` to 1 or 0 depending on if `rb` is less than or equal to the sign-extended immediate value or not. This instruction doesn't raise any flags and its class specifies: `00` (`.S`) as _signed_ mode, `01` (`.U`) as _unsigned_ mode, `10` (`.IS`) as _inverted signed_ mode and `11` (`.IU`) as _inverted unsigned_ mode. The last two modes simply invert the checking condition.],
[`CLDI`], [], [2RI.A], [`D`], [*Conditional Load Immediate*: Sets `ra` to the sign-extended immediate value if `rc` matches the condition specified in the class, leaving `ra` unchanged otherwise. This instruction doesn't raise any flags and its class specifies: `00` (`.EZ`) as _equal to zero_ mode, `01` (`.NZ`) _not equal to zero_ mode, `10` (`.LTZ`) _less than zero_ mode and `11` (`.LTZU`) _less than zero unsigned_ mode.]
))
)
///.
#subSection(
[Computational Integer Scalar Advanced (`CISA`)], // TODO: complete
[This module provides integer scalar instructions to perform more complex arithmetic and logical operations with registers or immediate values. The `SGPRB` is mandatory for this module.],
// CZ,CLZ,CTZ: should have same opcode
// CO,CLO,CTO: should have same opcode
// MUL,HMUL: should have same opcode
// DIV,REM: should have same opcode
// LRT,RRT,BSW,BRV: should have same opcode
// MULI,HMULI: should have same opcode
// DIVI,REMI: should have same opcode
// LRTI,RRTI,BSWI,BRVI: should have same opcode
pagebreak(),
tableWrapper([CISA Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`CZ`], [], [2R.A], [`A`], [*Count Zeros*: Computes the number of zero bits in `rb` placing the result into `ra`. This instruction doesn't raise any flags and must always have a class mode value of `00`.],
[`CLZ`], [], [2R.A], [`A`], [*Count Leading Zeros*: Computes the number of leading zero bits in `rb` placing the result into `ra`. This instruction doesn't raise any flags and must always have a class mode value of `01`.],
[`CTZ`], [], [2R.A], [`A`], [*Count Trailing Zeros*: Computes the number of trailing zero bits in `rb` placing the result into `ra`. This instruction doesn't raise any flags and must always have a class mode value of `10`.],
[`CO`], [], [2R.A], [`A`], [*Count Ones*: Computes the number of one bits in `rb` placing the result into `ra`. This instruction doesn't raise any flags and must always have a class mode value of `00`.],
[`CLO`], [], [2R.A], [`A`], [*Count Leading Ones*: Computes the number of leading one bits in `rb` placing the result into `ra`. This instruction doesn't raise any flags and must always have a class mode value of `01`.],
[`CTO`], [], [2R.A], [`A`], [*Count Trailing Ones*: Computes the number of trailing one bits in `rb` placing the result into `ra`. This instruction doesn't raise any flags and must always have a class mode value of `10`.],
[`MUL`], [], [3R.A], [`A`], [*Multiplication*: Computes the product of `rb` and `rc` placing the result in `ra`. This instruction only considers the least significant `WLEN` bits of the result. This instruction class specifies: `00` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `01` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag.],
[`HMUL`], [], [3R.A], [`A`], [*High Multiplication*: Computes the product of `rb` and `rc` placing the result in `ra`. This instruction only considers the most significant `WLEN` bits of the result. This instruction class specifies: `10` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `11` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag.],
[`DIV`], [], [3R.A], [`A`], [*Division*: Computes the quotient of `rb` by `rc` placing the result in `ra`. This instruction class specifies: `00` (`.S`) as _signed_ mode and `01` (`.U`) as _unsigned_ mode and the `DIV0`, `INVOP` and `CUND` flags can be raised regardless of the class mode.],
[`REM`], [], [3R.A], [`A`], [*Remainder*: Computes the remainder of `rb` by `rc` placing the result in `ra`. In signed modes, the instruction handles the signs in the following way:
#list(tight: true,
[positive, positive: positive],
[negative, positive: negative],
[positive, negative: positive],
[negative, negative: negative]
)
This instruction class specifies: `10` (`.S`) as _signed_ mode and `11` (`.U`) as _unsigned_ mode and the `DIV0` and `INVOP`flags can be raised regardless of the class mode.],
[`LRT`], [], [3R.A], [`A`], [*Left Rotate*: Computes the bitwise left rotation of `rb` by the amount specified in `rc` placing the result in `ra`. This instruction doesn't raise any flags and must always have a class mode value of `00`.],
[`RRT`], [], [3R.A], [`A`], [*Right Rotate*: Computes the bitwise right rotation of `rb` by the amount specified in `rc` placing the result in `ra`. This instruction doesn't raise any flags and must always have a class mode value of `01`.],
[`BSW`], [], [3R.A], [`A`], [*Bit Swap*],
[`BRV`], [], [3R.A], [`A`], [*Bit Reverse*],
[`CLMUL`], [], [3R.A], [-], [*Carryless Multiplication*],
[`MAC`], [], [4R.A], [`G`], [*Multiply Accumulate*: Computes the dot product specified in the class mode:
#list(tight: true,
[`.MA`: `ra = rb + (rc * rd)`],
[`.NMA`: `ra = (-rb) + (rc * rd)`],
[`.MS`: `ra = rb - (rc * rd)`],
[`.NMS`: `ra = (-rb) - (rc * rd)`]
)
The multiplication part only considers the least significant `WLEN` bits. This instruction can raise the `OVFLn`, `UNFLn` and `COVRn` flags regardless of the class mode.],
[`MACU`], [], [4R.A], [`G`], [*Multiply Accumulate Unsigned*: Computes the dot product specified in the class mode:
#list(tight: true,
[`.MA`: `ra = rb + (rc * rd)`],
[`.NMA`: `ra = (-rb) + (rc * rd)`],
[`.MS`: `ra = rb - (rc * rd)`],
[`.NMS`: `ra = (-rb) - (rc * rd)`]
)
The multiplication part only considers the least significant `WLEN` bits and all of the steps performed are unsigned. This instruction can raise the `COVRn` flag regardless of the class mode.],
[`PER`], [], [4R.A], [`A`], [*Permute*],
[`MULI`], [], [2RI.A], [`A`], [*Multiplication Immediate*: Computes the product of `rb` and the immediate value placing the result in `ra`. This instruction only considers the least significant `WLEN` bits of the result. This instruction class specifies: `00` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `01` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag. The immediate will be sign or zero extended according to the specified mode.],
[`HMULI`], [], [2RI.A], [`A`], [*High Multiplication Immediate*: Computes the product of `rb` and the immediate value placing the result in `ra`. This instruction only considers the most significant `WLEN` bits of the result. This instruction class specifies: `10` (`.S`) as _signed_ mode which can raise the `OVFLn` or `UNFLn` flags and `11` (`.U`) as _unsigned_ mode which can raise the `COVRn` flag. The immediate will be sign or zero extended according to the specified mode.],
[`DIVI`], [], [2RI.A], [`A`], [*Division Immediate*: Computes the quotient of `rb` by the immediate value placing the result in `ra`. This instruction class specifies: `00` (`.S`) as _signed_ mode and `01` (`.U`) as _unsigned_ mode and the `DIV0`, `INVOP` and `CUND` flags can be raised regardless of the class mode. The immediate will be sign or zero extended according to the specified mode.],
[`REMI`], [], [2RI.A], [`A`], [*Remainder Immediate*: Computes the remainder of `rb` by the immediate value placing the result in `ra`. In signed modes, the instruction handles the signs in the following way:
#list(tight: true,
[positive, positive: positive],
[negative, positive: negative],
[positive, negative: positive],
[negative, negative: negative]
)
This instruction class specifies: `10` (`.S`) as _signed_ mode and `11` (`.U`) as _unsigned_ mode and the `DIV0` and `INVOP`flags can be raised regardless of the class mode. The immediate will be sign or zero extended according to the specified mode.],
[`LRTI`], [], [2RI.A], [`A`], [*Left Rotate Immediate*: Computes the bitwise left rotation of `rb` by the amount specified by the immediate value placing the result in `ra`. This instruction doesn't raise any flags and must always have a class mode value of `00`.],
[`RRTI`], [], [2RI.A], [`A`], [*Right Rotate Immediate*: Computes the bitwise right rotation of `rb` by the amount specified by the immediate value placing the result in `ra`. This instruction doesn't raise any flags and must always have a class mode value of `01`.],
[`BSWI`], [], [2RI.A], [`A`], [*Bit Swap Immediate*],
[`BRVI`], [], [2RI.A], [`A`], [*Bit Reverse Immediate*],
[`CLMULI`], [], [2RI.A], [`D`], [*Carryless Multiplication Immediate*],
[`MACI`], [], [3RI.A], [`G`], [*Multiply Accumulate Immediate*: Computes the dot product specified in the class mode:
#list(tight: true,
[`.MA`: `ra = rb + (rc * imm)`],
[`.NMA`: `ra = (-rb) + (rc * imm)`],
[`.MS`: `ra = rb - (rc * imm)`],
[`.NMS`: `ra = (-rb) - (rc * imm)`]
)
The multiplication part only considers the least significant `WLEN` bits and the immediate value is always sign-extended. This instruction can raise the `OVFLn`, `UNFLn` and `COVRn` flags regardless of the class mode.],
[`MACIU`], [], [3RI.A], [`G`], [*Multiply Accumulate Immediate Unsigned*: Computes the dot product specified in the class mode:
#list(tight: true,
[`.MA`: `ra = rb + (rc * imm)`],
[`.NMA`: `ra = (-rb) + (rc * imm)`],
[`.MS`: `ra = rb - (rc * imm)`],
[`.NMS`: `ra = (-rb) - (rc * imm)`]
)
The multiplication part only considers the least significant `WLEN` bits and, of the steps performed are unsigned and the immediate is always zero-extended. This instruction can raise the `COVRn` flag regardless of the class mode.],
[`PERI`], [], [3RI.A], [`A`], [*Permute Immediate*]
))
)
///.
#subSection(
[Computational Integer Scalar Multiword (`CISM`)],
[This module provides integer scalar instructions to perform arithmetic and logical operations with registers or immediate values on values larger than `WLEN`. The `SGPRB` is mandatory for this module.],
pagebreak(),
tableWrapper([CISM Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`BADD`], [], [4.RA], [`A`], [*Big Addition*: ],
[`BSUB`], [], [4.RA], [`A`], [*Big Subtraction*: ],
[`BMUL`], [], [4.RA], [`A`], [*Big Multiplication*: ],
[`BDIV`], [], [4.RA], [`A`], [*Big Division*: ],
[`BREM`], [], [4.RA], [`A`], [*Big Remainder*: ],
[`BLSH`], [], [4.RA], [`A`], [*Big Left Shift*: ],
[`BRSH`], [], [4.RA], [`A`], [*Big Right Shift*: ]
))
)
///.
#subSection(
[Computational Integer Vector Basic (`CIVB`)],
[This module provides integer vector instructions to perform basic arithmetic and logical operations with registers or immediate values in a data-parallel manner. The `SGPRB` and `VGPRB` are mandatory for this module.],
pagebreak(),
tableWrapper([CIVB Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`VABS`], [], [3R.A], [`E`], [*Vector Absolute Value*: ],
[`VADD`], [], [4R.B], [`A`], [*Vector Addition*: ],
[`VSUB`], [], [4R.B], [`A`], [*Vector Subtraction*: ],
[`VMIN`], [], [4R.B], [`A`], [*Vector Minimum*: ],
[`VMAX`], [], [4R.B], [`A`], [*Vector Maximum*: ],
[`VAND`], [], [4R.B], [`A`], [*Vector Bitwise AND*: ],
[`VOR`], [], [4R.B], [`A`], [*Vector Bitwise OR*: ],
[`VXOR`], [], [4R.B], [`A`], [*Vector Bitwise XOR*: ],
[`VLSH`], [], [4R.B], [`A`], [*Vector Left Shift*: ],
[`VRSH`], [], [4R.B], [`A`], [*Vector Right Shift*: ],
[`VSEQ`], [], [4R.B], [`A`], [*Vector Set If Equal*: ],
[`VSLT`], [], [4R.B], [`A`], [*Vector Set If Less Than*: ],
[`VSLE`], [], [4R.B], [`A`], [*Vector Set If Less Or Equal*: ],
[`VEXTR`], [], [4R.B], [`B`], [*Vector Extract*: ],
[`VINJ`], [], [4R.B], [`B`], [*Vector Inject*: ],
[`VADDI`], [], [3RI.B], [`A`], [*Vector Addition Immediate*: ],
[`VSUBI`], [], [3RI.B], [`A`], [*Vector Subtraction Immediate*: ],
[`VMINI`], [], [3RI.B], [`A`], [*Vector Minimum Immediate*: ],
[`VMAXI`], [], [3RI.B], [`A`], [*Vector Maximum Immediate*: ],
[`VANDI`], [], [3RI.B], [`A`], [*Vector Bitwise AND Immediate*: ],
[`VORI`], [], [3RI.B], [`A`], [*Vector Bitwise OR Immediate*: ],
[`VXORI`], [], [3RI.B], [`A`], [*Vector Bitwise XOR Immediate*: ],
[`VLSHI`], [], [3RI.B], [`A`], [*Vector Left Shift Immediate*: ],
[`VRSHI`], [], [3RI.B], [`A`], [*Vector Right Shift Immediate*: ],
[`VSEQI`], [], [3RI.B], [`A`], [*Vector Set If Equal Immediate*: ],
[`VSLTI`], [], [3RI.B], [`A`], [*Vector Set If Less Than Immediate*: ],
[`VSLEI`], [], [3RI.B], [`A`], [*Vector Set If Less Or Equal Immediate*: ],
[`VEXTRI`], [], [3RI.B], [`B`], [*Vector Extract Immediate*: ],
[`VINJI`], [], [3RI.B], [`B`], [*Vector Inject Immediate*: ],
[`VLDI`], [], [3RI.B], [`D`], [*Vector Load Immediate*: ]
))
)
///.
#subSection(
[Computational Integer Vector Advanced (`CIVA`)],
[This module provides integer vector instructions to perform more complex arithmetic and logical operations with registers or immediate values in a data-parallel manner. The `VGPRB` is mandatory for this module.],
pagebreak(),
tableWrapper([CIVA Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`VCZ`], [], [3R.A], [`E`], [*Vector Count Zeros*],
[`VCLZ`], [], [3R.A], [`E`], [*Vector Count Leading Zeros*],
[`VCTZ`], [], [3R.A], [`E`], [*Vector Count Trailing Zeros*],
[`VCO`], [], [3R.A], [`E`], [*Vector Count Ones*],
[`VCLO`], [], [3R.A], [`E`], [*Vector Count Leading Ones*],
[`VCTO`], [], [3R.A], [`E`], [*Vector Count Trailing Ones*],
[`VMUL`], [], [4R.B], [`A`], [*Vector Multiplication*],
[`VHMUL`], [], [4R.B], [`A`], [*Vector High Multiplication*],
[`VDIV`], [], [4R.B], [`A`], [*Vector Division*],
[`VREM`], [], [4R.B], [`A`], [*Vector Remainder*],
[`VLRT`], [], [4R.B], [`A`], [*Vector Left Rotate*],
[`VRRT`], [], [4R.B], [`A`], [*Vector Right Rotate*],
[`VBSW`], [], [4R.B], [`A`], [*Vector Bit Swap*],
[`VBRV`], [], [4R.B], [`A`], [*Vector Bit Reverse*],
[`VCMUL`], [], [4R.B], [`A`], [*Vector Carryless Multiplication*],
[`VMAC`], [], [4R.B], [`G`], [*Vector Multiply Accumulate*],
[`VMACU`], [], [4R.B], [`G`], [*Vector Multiply Accumulate Unsigned*],
[`VPER`], [], [4R.B], [`A`], [*Vector Permute*],
[`VMULI`], [], [3RI.B], [`A`], [*Vector Multiplication Immediate*],
[`VHMULI`], [], [3RI.B], [`A`], [*Vector High Multiplication Immediate*],
[`VDIVI`], [], [3RI.B], [`A`], [*Vector Division Immediate*],
[`VREMI`], [], [3RI.B], [`A`], [*Vector Remainder Immediate*],
[`VLRTI`], [], [3RI.B], [`A`], [*Vector Left Rotate Immediate*],
[`VRRTI`], [], [3RI.B], [`A`], [*Vector Right Rotate Immediate*],
[`VBSWI`], [], [3RI.B], [`A`], [*Vector Bit Swap Immediate*],
[`VBRVI`], [], [3RI.B], [`A`], [*Vector Bit Reverse Immediate*],
[`VCMULI`], [], [3RI.B], [`A`], [*Vector Carryless Multiplication Immediate*],
[`VMACI`], [], [4R.B], [`G`], [*Vector Multiply Accumulate Immediate*],
[`VMACIU`], [], [4R.B], [`G`], [*Vector Multiply Accumulate Immediate Unsigned*],
[`VPERI`], [], [3RI.B], [`A`], [*Vector Permute Immediate*],
[`VPCKUPCK`], [], [3RI.B], [`A`], [*Vector Pack Unpack*]
))
)
///.
#subSection(
[Computational Integer Vector Reductions (`CIVR`)],
[This module provides integer vector instructions to perform arithmetic and logical reductions operations on registers values in a data-parallel manner. The `SGPRB` and `VGPRB` are mandatory for this module.],
pagebreak(),
tableWrapper([CIVR Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`RADD`], [], [3R.A], [`A`], [*Reduced Addition*: ],
[`RSUB`], [], [3R.A], [`A`], [*Reduced Subtraction*: ],
[`RMIN`], [], [3R.A], [`A`], [*Reduced Minimum*: ],
[`RMAX`], [], [3R.A], [`A`], [*Reduced Maximum*: ],
[`RAND`], [], [3R.A], [`A`], [*Reduced Bitwise AND*: ],
[`ROR`], [], [3R.A], [`A`], [*Reduced Bitwise OR*: ],
[`RXOR`], [], [3R.A], [`A`], [*Reduced Bitwise XOR*: ]
))
)
///.
#subSection(
[Computational Integer Compressed (`CIC`)],
[This module provides integer compressed instructions to perform arithmetic and logical operations on registers and immediate values with a smaller code footprint. The `SGPRB` is mandatory for this module.],
pagebreak(),
tableWrapper([CIC Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`CADD`], [], [2R.B], [`F`], [*Compressed Addition*: ],
[`CSUB`], [], [2R.B], [`F`], [*Compressed Subtraction*: ],
[`CMOV`], [], [2R.B], [`F`], [*Compressed Move*: ],
[`CAND`], [], [2R.B], [`F`], [*Compressed Bitwise AND*: ],
[`CLSH`], [], [2R.B], [`F`], [*Compressed Left Shift*: ],
[`CRSH`], [], [2R.B], [`F`], [*Compressed Right Shift*: ],
[`CADDI`], [], [RI.B], [-], [*Compressed Addition Immediate*: ],
[`CANDI`], [], [RI.B], [-], [*Compressed Bitwise AND Immediate*: ],
[`CLSHI`], [], [RI.B], [-], [*Compressed Left Shift Immediate*: ],
[`CRSHI`], [], [RI.B], [-], [*Compressed Right Shift Immediate*: ],
[`CLDI`], [], [RI.B], [-], [*Compressed Load Immediate*: ]
))
)
///.
#subSection(
[Computational FP Scalar Basic (`CFSB`)],
[This module provides floating point instructions to perform arithmetic operations on registers and immediate values. The `SGPRB` is mandatory for this module.],
pagebreak(),
tableWrapper([CFSB Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`CFI`], [], [2R.A], [`B`], [*Cast FP To Integer*],
[`CFIT`], [], [2R.A], [`B`], [*Cast FP To Integer Truncated*],
[`CIF`], [], [2R.A], [`B`], [*Cast Integer To FP*],
[`CFF1`], [], [2R.A], [`B`], [*Cast FP To FP1*],
[`CFF2`], [], [2R.A], [`B`], [*Cast FP To FP2*],
[`CFF4`], [], [2R.A], [`B`], [*Cast FP To FP4*],
[`CFF8`], [], [2R.A], [`B`], [*Cast FP To FP8*],
[`FADD`], [], [3R.A], [`B`], [*FP Addition*],
[`FSUB`], [], [3R.A], [`B`], [*FP Subtraction*],
[`FMUL`], [], [3R.A], [`B`], [*FP Multiplication*],
[`FDIV`], [], [3R.A], [`B`], [*FP Division*],
[`FMIN`], [], [3R.A], [`B`], [*FP Minimum*],
[`FMAX`], [], [3R.A], [`B`], [*FP Maximum*],
[`FSLT`], [], [3R.A], [`B`], [*FP Set If Less Than*],
[`FSLE`], [], [3R.A], [`B`], [*FP Set If Less Or Equal*],
[`FSGT`], [], [3R.A], [`B`], [*FP Set If Greater Than*],
[`FSGE`], [], [3R.A], [`B`], [*FP Set If Greater Or Equal*],
[`FMADD`], [], [4R.A], [`B`], [*FP Multiply Add*],
[`FNMADD`], [], [4R.A], [`B`], [*FP Negative Multiply Add*],
[`FMSUB`], [], [4R.A], [`B`], [*FP Multiply Subtract*],
[`FNMSUB`], [], [4R.A], [`B`], [*FP Negative Multiply Subtract*],
[`FADDI`], [], [2RI.A], [`B`], [*FP Addition Immediate*],
[`FSUBI`], [], [2RI.A], [`B`], [*FP Subtraction Immediate*],
[`FMULI`], [], [2RI.A], [`B`], [*FP Multiplication Immediate*],
[`FDIVI`], [], [2RI.A], [`B`], [*FP Division Immediate*],
[`FMINI`], [], [2RI.A], [`B`], [*FP Minimum Immediate*],
[`FMAXI`], [], [2RI.A], [`B`], [*FP Maximum Immediate*],
[`FSLTI`], [], [2RI.A], [`B`], [*FP Set If Less Than Immediate*],
[`FSLEI`], [], [2RI.A], [`B`], [*FP Set If Less Or Equal Immediate*],
[`FSGTI`], [], [2RI.A], [`B`], [*FP Set If Greater Than Immediate*],
[`FSGEI`], [], [2RI.A], [`B`], [*FP Set If Greater Or Equal Immediate*],
[`FMADDI`], [], [3RI.A], [`B`], [*FP Multiply Add Immediate*],
[`FNMADDI`], [], [3RI.A], [`B`], [*FP Negative Multiply Add Immediate*],
[`FMSUBI`], [], [3RI.A], [`B`], [*FP Multiply Subtract Immediate*],
[`FNMSUBI`], [], [3RI.A], [`B`], [*FP Negative Multiply Subtract Immediate*]
))
)
///.
#subSection(
[Computational FP Scalar Advanced (`CFSA`)],
[This module provides floating point instructions to perform more complex arithmetic operations on registers. The `SGPRB` is mandatory for this module.],
pagebreak(),
tableWrapper([CFSA Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`FSQRT`], [], [2R.A], [`B`], [*FP Square Root*]
))
)
///.
#subSection(
[Computational FP Vector Basic (`CFVB`)],
[This module provides floating point vector instructions to perform basic arithmetic and logical operations with registers or immediate values in a data-parallel manner. The `SGPRB` and `VGPRB` are mandatory for this module.],
pagebreak(),
tableWrapper([CFVB Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`VCFI`], [], [3R.A], [`?`], [*Vector Cast FP. To Integer*],
[`VCFIT`], [], [3R.A], [`?`], [*Vector Cast FP. To Integer Truncated*],
[`VCIF`], [], [3R.A], [`?`], [*Vector Cast Integer To FP.*],
[`VCFF1`], [], [3R.A], [`?`], [*Vector Cast FP. To FP. 1*],
[`VCFF2`], [], [3R.A], [`?`], [*Vector Cast FP. To FP. 2*],
[`VCFF4`], [], [3R.A], [`?`], [*Vector Cast FP. To FP. 4*],
[`VCFF8`], [], [3R.A], [`?`], [*Vector Cast FP. To FP. 8*],
[`VFADD`], [], [4R.B], [`?`], [*Vector FP. Addition*],
[`VFSUB`], [], [4R.B], [`?`], [*Vector FP. Subtraction*],
[`VFMUL`], [], [4R.B], [`?`], [*Vector FP. Multiplication*],
[`VFDIV`], [], [4R.B], [`?`], [*Vector FP. Division*],
[`VFMIN`], [], [4R.B], [`?`], [*Vector FP. Minimum*],
[`VFMAX`], [], [4R.B], [`?`], [*Vector FP. Maximum*],
[`VFSLT`], [], [4R.B], [`?`], [*Vector FP. Set If Less Than*],
[`VFSLE`], [], [4R.B], [`?`], [*Vector FP. Set If Less Or Equal*],
[`VFMAC`], [], [4R.B], [`?`], [*Vector FP. Multiply Accumulate*],
[`VFADDI`], [], [3RI.B], [`?`], [*Vector FP. Addition Immediate*],
[`VFSUBI`], [], [3RI.B], [`?`], [*Vector FP. Subtraction Immediate*],
[`VFMULI`], [], [3RI.B], [`?`], [*Vector FP. Multiplication Immediate*],
[`VFDIVI`], [], [3RI.B], [`?`], [*Vector FP. Division Immediate*],
[`VFMINI`], [], [3RI.B], [`?`], [*Vector FP. Minimum Immediate*],
[`VFMAXI`], [], [3RI.B], [`?`], [*Vector FP. Maximum Immediate*],
[`VFSLTI`], [], [3RI.B], [`?`], [*Vector FP. Set If Less Than Immediate*],
[`VFSLEI`], [], [3RI.B], [`?`], [*Vector FP. Set If Less Or Equal Immediate*],
[`VFMACI`], [], [3RI.B], [`?`], [*Vector FP. Multiply Accumulate Immediate*]
))
)
///.
#subSection(
[Computational FP Vector Advanced (`CFVA`)],
[This module provides floating point vector instructions to perform more complex arithmetic and logical operations with registers values in a data-parallel manner. The `SGPRB` and `VGPRB` are mandatory for this module.],
pagebreak(),
tableWrapper([CFVA Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`VSQRT`], [], [3R.A], [`E`], [*Vector FP. Square Root*]
))
)
///.
#subSection(
[Computational FP Vector Reductions (`CFVR`)],
[This module provides integer vector instructions to perform arithmetic and logical reductions operations on registers values in a data-parallel manner. The `SGPRB` and `VGPRB` are mandatory for this module.],
pagebreak(),
tableWrapper([CFVR Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`RFADD`], [], [3R.A], [`E`], [*Reduced FP. Addition*],
[`RFSUB`], [], [3R.A], [`E`], [*Reduced FP. Subtraction*],
[`RFMUL`], [], [3R.A], [`E`], [*Reduced FP. Multiplication*],
[`RFDIV`], [], [3R.A], [`E`], [*Reduced FP. Division*],
[`RFMIN`], [], [3R.A], [`E`], [*Reduced FP. Minimum*],
[`RFMAX`], [], [3R.A], [`E`], [*Reduced FP. Maximum*]
))
)
///.
#subSection(
[Data Scalar Basic (`DSB`)],
[This module provides basic scalar memory transfer operations. The `SGPRB` is mandatory for this module],
pagebreak(),
tableWrapper([DSB Instructions.], table(
columns: (auto, auto, auto, auto, auto),
align: (x, y) => (left + horizon, center + horizon, center + horizon, center + horizon, left + horizon).at(x),
[#middle([*Mnemonic*])], [#middle([*Opcode*])], [#middle([*Format*])], [#middle([*Class*])], [#middle([*Description*])],
[`MLD`], [], [2RI.A], [`B`], [*Memory Load*],
[`MLDU`], [], [2RI.A], [`B`], [*Memory Load Unsigned*],
[`MST`], [], [2RI.A], [`B`], [*Memory Store*]
))
)
#pagebreak()
///
|
https://github.com/Zarox28/TypstTemplate | https://raw.githubusercontent.com/Zarox28/TypstTemplate/main/Term.typ | typst | #let inset_size = 10pt
#let radius_size = 10pt
#let button_size = 10pt
#let button_spacing = 10pt
#let button_red_color = rgb("FF605C")
#let button_orange_color = rgb("FFBD44")
#let button_green_color = rgb("00CA4E")
#let toolbar_bg_color = rgb("282C34")
#let stroke_color = rgb("21252B")
#let main_bg_color = rgb("323842")
#let text_color = rgb("D4D8DF")
#let button(color: none) = {
return box(
width: button_size,
height: button_size,
radius: button_size,
fill: color
)
}
#let title(titletext) = {
return text(
fill: text_color,
weight: "bold",
size: 1.2em,
baseline: 0.1em
)[#titletext]
}
#let toolbar(titletext) = {
return block(
width: 100%,
inset: inset_size,
radius: (top: radius_size),
fill: toolbar_bg_color,
stroke: stroke_color,
stack(
dir: ltr,
spacing: button_spacing,
button(color: button_red_color),
button(color: button_orange_color),
button(color: button_green_color),
align(center, move(dx: -20pt, title(titletext)))
)
)
}
#let main(ps1: "", input: "", output: "") = {
return block(
width: 100%,
inset: inset_size,
radius: (bottom: radius_size),
fill: main_bg_color,
stroke: stroke_color,
[
#text(fill: rgb("56B6C2"), ps1)
#text(fill: rgb("E5C07B"), input) \
#text(fill: text_color, output)
]
)
}
#let term(ps1: "", input: "", title: "", output: "") = {
return align(left,
box(
width: auto,
stack(
dir: ttb,
align(left, toolbar(title)),
main(
ps1: ps1,
input: input,
output: output
)
)
)
)
} |
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/PianoDiProgetto/sections/ModelloDiSviluppo.typ | typst | MIT License | #import "../functions.typ": glossary, team
= Modello di sviluppo
Il team ha deciso di adottare il modello di sviluppo agile Scrum come approccio principale per la gestione e lo sviluppo del progetto. Tale metodologia promuove un'approccio adattativo, permettendo l'evoluzione dei requisiti e una ridefinizione costante del perimetro del progetto. Il modello assicura anche feedback regolari, consentendo adattamenti rapidi, riducendo gli sprechi e garantendo la soddisfazione degli obiettivi individuati dalla Proponente a ogni iterazione.
Il #glossary[framework Scrum] si basa su principi fondamentali che riflettono la filosofia di lavoro del team. Attualmente, molte delle pratiche proprie di Scrum sono già in atto e vengono applicate quotidianamente nello svolgimento delle attività del progetto.
== Pratiche attualmente implementate
=== Iterazioni
- *#glossary[Sprint]*: durante questo periodo, lungo 1 settimana, il team pianifica, sviluppa, testa e completa una quantità concordata di lavoro, consegnando un risultato tangibile alla fine di ogni #glossary[sprint]. Questa lunghezza di tempo è stata considerata ottimale per completare le attività previste per lo #glossary[sprint], offrendo un equilibrio tra un periodo abbastanza breve da mantenere un allineamento frequente con la Proponente, e un periodo sufficientemente lungo da permettere lo sviluppo di un incremento di lavoro utilizzabile.
=== Eventi
- *#glossary[Sprint planning]*: durante questa fase, il team identifica le #glossary("user stories") del #glossary("product backlog") che si impegna a completare, tenendo conto della capacità e delle risorse disponibili. Questi elementi vengono successivamente aggiunti allo #glossary("sprint backlog"), una lista creata dal team in modo collaborativo, che contiene le attività relative allo #glossary[sprint]. Queste attività diventano le issue all'interno dell'#glossary("ITS"). In seguito, il team si dedica alla stima della complessità delle issue, valutandone sia la dimensione in termini di ore produttive che il livello di priorità;
- *#glossary[Daily Scrum] meeting*: di breve durata, si aggira attorno ai 15 minuti, e coinvolge tutto il team. Durante questo incontro, i membri del team esaminano lo stato di avanzamento del lavoro, discutendo di ciò che è stato completato dall'ultimo meeting, cosa verrà affrontato entro il prossimo, e se ci sono eventuali ostacoli che potrebbero impattare il lavoro;
- *#glossary("Sprint review")*: incontro chiave nel #glossary[framework Scrum] che si tiene alla fine di ogni #glossary[sprint]. Questo incontro si focalizza sull'esame del lavoro completato e sulla raccolta dei feedback. La presenza attiva della Proponente è di importanza cruciale in questo contesto, poiché contribuisce in modo significativo a garantire una comprensione accurata degli obiettivi raggiunti e a facilitare una comunicazione diretta e fruttuosa con il team. Ciò consente un allineamento più preciso sulle sue aspettative;
- *#glossary("Sprint retrospective")*: incontro chiave nel #glossary[framework Scrum] che si tiene alla fine di ogni #glossary[sprint]. In questo momento, il team riflette sullo #glossary[sprint] appena concluso e identifica possibili miglioramenti. I membri del team esaminano ciò che è andato bene e ciò che ha margine di miglioramento, studiando possibili soluzioni. Non ci si concentra sul prodotto vero e proprio, ma principalmente sul #glossary[way of working].
== Vantaggi nell'adozione di Scrum
L'approccio Scrum offre numerosi vantaggi che il team ritiene fondamentali per il successo del progetto:
- *Adattabilità*: la natura incrementale di Scrum consente di adattarsi a cambiamenti e requisiti emergenti in modo tempestivo;
- *Trasparenza e comunicazione*: le pratiche di Scrum promuovono la trasparenza, migliorando la comunicazione interna ed esterna;
- *Consegna incrementale*: i rilasci frequenti consentono alla Proponente di visionare il prodotto in via di sviluppo e fornire feedback tempestivi.
|
https://github.com/MrToWy/Bachelorarbeit | https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Code/structureItem.typ | typst | #import("../Template/customFunctions.typ"): *
#codly(
highlights:(
(line:2, fill:green, label: <structureItemTakeTwoColumns>),
(line:6, fill:red, label: <structureItemPath>),
(line:13, label: <structureItemSuffix>),
(line:20, label: <structureItemName>),
)
)
```json
{
"position": 7,
"takeTwoColumns": false,
"paths": [
{
"field": {
"path": "hoursPresence",
"suffix": " h / "
}
},
{
"field": {
"path": "hoursSelf",
"suffix": " h"
}
}
],
"translations": [
{
"id": 39,
"name": "Präsenzstunden / Selbststudium",
"languageId": 1,
"pdfStructureItemId": 20
}
]
}
``` |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/nassi/0.1.2/assets/example-cetz.typ | typst | Apache License 2.0 | #import "../src/nassi.typ"
#import nassi: cetz
#set page(width: auto, height: auto, margin: 5mm)
#let strukt = nassi.parse(```
function inorder(tree t)
if t has left child
inorder(left child of t)
end if
process(root of t)
if t has right child
inorder(right child of t)
end if
end function
```.text)
#figure(
cetz.canvas({
import nassi.draw: diagram
import cetz.draw: *
diagram((4, 4), strukt)
circle((rel: (.65, 0), to: "nassi.e1-text"), stroke: red, fill: red.transparentize(80%), radius: .5, name: "a")
content(
(5, 5),
"current subtree",
name: "b",
frame: "rect",
padding: .1,
stroke: red,
fill: red.transparentize(90%),
)
line("a", "b", stroke: red)
content((1, 2), "recursion", name: "rec", frame: "rect", padding: .1, stroke: red, fill: red.transparentize(90%))
line("rec", (rel: (.15, 0), to: "nassi.e3.west"), stroke: red, mark: (end: ">"))
line("rec", (rel: (.15, 0), to: "nassi.e7.west"), stroke: red, mark: (end: ">"))
content(
(17, 2.7),
[empty\ branches],
name: "empty",
frame: "rect",
padding: .1,
stroke: red,
fill: red.transparentize(90%),
)
line("empty", (rel: (.15, 0), to: "nassi.e4-text.east"), stroke: red, mark: (end: ">"))
line("empty", (rel: (.15, 0), to: "nassi.e8"), stroke: red, mark: (end: ">"))
}),
caption: "Nassi-Shneiderman diagram of a inorder tree traversal.",
)
// #cetz.canvas({
// import nassi.draw: diagram
// import nassi.elements: *
// import cetz.draw: *
// diagram((0,0), {
// branch("a > b", {
// empty(name: "empty-1")
// }, {
// empty(name: "empty-2")
// })
// })
// arc-through(
// "nassi.empty-1",
// (
// rel:(0,-.5),
// to: (
// a:"nassi.empty-1",
// b:"nassi.empty-2",
// number:.5
// )
// ),
// "nassi.empty-2",
// mark:(start:">", end:">"),
// stroke:red+2pt
// )
// })
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/alignment_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test alignment step functions.
#set page(width: 225pt)
$
"a" &= c \
&= c + 1 & "By definition" \
&= d + 100 + 1000 \
&= x && "Even longer" \
$
|
https://github.com/Zuttergutao/Typstdocs-Zh-CN- | https://raw.githubusercontent.com/Zuttergutao/Typstdocs-Zh-CN-/main/Typst-markdown/test.typ | typst | #underline[#hide[hello] joe] |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/modern-technique-report/0.1.0/lib.typ | typst | Apache License 2.0 | #let modern-technique-report(
title: [Report Title],
subtitle: [Report Subtitle],
series: [Report Series],
author: [Report Author],
date: [Report Date],
background: "bg.jpg",
theme-color: rgb(128, 128, 128),
font: "New Computer Modern",
title-font: "Noto Sans",
doc
) = {
set text(font: font)
let bg-color = theme-color.lighten(90%)
let font-color = theme-color.darken(30%)
set heading(
numbering:
(..nums) => [
#nums.pos().map(str).join(".")
#h(0.5em)
#box(width: 1.2pt, height: 1.1em, fill: gray.darken(20%), baseline: 20%)
#h(0.2em)
]
)
show heading: it => text(fill: font-color, font: title-font)[#it #v(0.5em)]
show heading.where(level: 1): set text(15pt)
show heading.where(level: 2): set text(12pt)
show heading.where(level: 1): it => {pagebreak(weak: true);it}
// Cover begin
// Background
place(
bottom + center,
dy: 71pt
)[#scale(x: 132%, y: 132%, origin: bottom)[#background]]
place(
top + left,
dy: -71pt,
dx: -71pt
)[
#polygon(
fill: rgb(254, 254, 254),
(0pt, 0pt),
(596pt, 0pt),
(596pt, 650pt),
(0pt, 550pt),
)
]
// Series
box(fill: theme-color, width: 3pt, height: 43pt)
h(5pt)
box[#par(leading: 0.65em)[#text(size: 15pt)[*#series*]] #v(5pt)]
v(100pt)
// Titles & Author
align(center)[
#set par(leading: 1em)
#text(25pt, tracking: 2pt, font: title-font)[*#title*]
#text(15pt)[#subtitle]
#v(25pt)
#text(15pt)[#author]
]
v(4em)
text(size: 14pt)[#align(right)[#date]]
pagebreak()
// Cover end
// Outline begin
show outline.entry.where(
level: 1
): it => {
set text(13pt, font: title-font)
v(10pt)
if type(it.body) == content {
let cont = it.body
strong(cont)
h(1fr)
strong(it.page)
} else {
let cont = it.body.children
grid(
columns: 7,
strong(cont.slice(0, 4).join(none)), h(0.4em), strong(cont.slice(6).join()), h(0.5em), h(1fr), h(0.5em), strong(it.page),
)
}
v(-20pt)
}
show outline.entry.where(
level: 2
): it => {
set text(font: font, size: 10pt)
let cont = it.body.children
h(1em)
cont.slice(0, 4).join(none)
cont.slice(6).join()
h(0.3em)
box(width: 1fr)[#it.fill]
h(0.3em)
it.page
v(-18pt)
}
outline(
depth: 2,
fill: repeat[#text(fill: gray)[.]]
)
// Outline end
doc
}
|
https://github.com/barrel111/readings | https://raw.githubusercontent.com/barrel111/readings/main/notes/toolkit.typ | typst | #import "@local/preamble:0.1.0": *
#show: project.with(
course: "",
sem: "",
title: "toolkit",
subtitle: "we will see how it goes.",
authors: ("<NAME>",),
authors_label: "authors:",
)
#set heading(numbering: "i.")
= asymptotics
== introduction
For simplicity, all our functions are of the type $NN to RR$.
#definition[We say that $f(n)$ is _asymptotically equivalent_ to $g(n)$ and write $f(n) tilde g(n)$ if $f(n) slash g(n) arrow 1$ as $n arrow infinity$.]
#definition[We write $f(n) in O(g(n))$ when there is a $C > 0$ such that for all
sufficiently large $n$, $ abs(f(n)) <= C abs(g(n)). $]
#remark[Technically, $O(dot)$ represents a set of functions. Still, we may write expressions involving $O(dot)$ (for eg. $f = O(g)$) in which case $O(dot)$ represents some function from this asymptotic class. This remark holds for all the other asymptotic classes we will define. ]
#definition[We write $f(n) in Omega(g(n))$ when there is a $c > 0$ such that for all
sufficiently large $n$, $ abs(f(n)) >= c abs(g(n)). $]
#lemma[ Equivalently, $f(n) = O(g(n))$ if and only if $limsup_(n to infinity) abs(f(n)) slash abs(g(n)) < infinity.$ ]
#proof[ For convenience, let $Q(n) = abs(f(n)) slash abs(g(n))$. First, the foward
direction. We note that we have $0 <= Q(n) <= C$. As $Q(n)$ is bounded, $limsup Q(n)$ clearly
exists and is finite (the sequence ${sup_(n >= k) Q(n)}_(k in N)$ is decreasing
and as it is bounded by below, must converge).
Conversely, assume $limsup Q(n) < infinity$. Let $C = lim sup Q(n) + 1$.
As $C > limsup Q(n)$, it is an eventual upper bound for $Q(n)$. That is to say,
there exists $N in NN$ such that for all $n >= N$ $ abs(f(n)) <= C abs(g(n)). $]
#lemma[ Equivalently, $f(n) = Omega(g(n))$ if and only if $liminf_(n to infinity) abs(f(n)) slash abs(g(n)) > 0. $ ]
#proof[ For convenience, let $Q(n) = abs(f(n)) slash abs(g(n))$. For the forward direction, we note that there exists $N in NN$ and $c > 0$ such that for all $n >= N$ $ abs(f(n)) >= c abs(g(n)) \ ==> Q(n) >= c. $ Note that $c$ is a lower bound for ${Q(n)}_(n in NN)$. Consequently, it must be a lower bound for the tailing sequences ${Q(n)}_(n >= m)$ for any $m$. Then, we have $ liminf_(n -> infinity) Q(n) = sup_(m in NN) inf_(n >= m) Q(n) >= c > 0. $ Conversely, assume $lim inf Q(n) > 0$. Choose any $c in (0, lim inf Q(n))$. Then, such a $c$ is an eventual lower bound for $Q(n)$. That is, there exists $N in NN$ such that for all $n >= N$, we have $ abs(f(n)) >= c abs(g(n)). $ ]
#definition[We write $f(n) = Theta(g(n))$ when there are constants $c, C > 0$ such that $ c abs(g(n)) <= f(n) <= C abs(g(n)). $ Equivalently, $f(n) = Theta(g(n))$ iff $f(n) = Omega(g(n))$ and $f(n) = O(g(n))$. ]
#lemma[If $f_1, f_2 in O(g)$ then $f_1 + f_2 in O(g)$.]
#proof[ There exists $C_1, C_2, N_1, N_2 > 0$ such that for $n >= N_1$ and $n >= N_2$ $ abs(f_1) &<= C_1 abs(g) #h(20pt) "and" #h(20pt) abs(f_2) &<= C_2 abs(g). $ Then,
for $N = max(N_1, N_2)$, we can say that if $n >= N$ then $ |f_1 + f_2| <= (C_1 + C_2) |g|. $ ]
#lemma[ If $f_1, f_2 in Omega(g)$ then $f_1 + f_2 in Omega(g)$ too. ]
#proof[ Same idea as above. \ ]
#remark[A stronger statement is possible: if $f_1 in Omega(g)$ and $f >= f_1$ then $f in Omega(g)$.]
#lemma[ If $f_1, f_2 in Theta(g)$ then $f_1 + f_2 in Theta(g)$ too. ]
#proof[ Follows from prior two lemmas and definition of $Theta$. \ ]
#definition[We write $f(n) in (g(n))$ (or $f(n) << g(n)$) if $f(n) slash g(n) arrow 0$ as $n arrow infinity$.
]
#definition[We write $f(n) in omega(g(n))$ (or $f(n) >> g(n)$) if $f(n) slash g(n) arrow infinity$ as $n arrow infinity$.
]
#lemma[If $f_1, f_2 in o(g)$ then $f_1 + f_2 = o(g)$.]
#proof[$ lim_(n -> infinity) (f_1(n) + f_2(n))/g(n) = lim_(n -> infinity) (f_1(n))/g(n) + lim_(n -> infinity) (f_2(n))/g(n) = 0. $]
#lemma[If $f_1, f_2 in omega(g)$ then $f_1 + f_2 = omega(g)$.]
#proof[Same idea as above.]
#remark[A stronger statement is possible: if $f_1 in omega(g)$ and $f >= f_1$ then $f in omega(g)$.]
#remark[Note that $O(dot)$ and $Omega(dot)$ both induce a _pre order_ (a reflexive, transitive relation) on functions $NN -> RR$. Similarly, $o(dot)$ and $omega(dot)$ induce a _strict partial order_ (an irreflexive, transtive relation). Finally, $Theta(dot)$ induces an _equivalence relation_ (a reflexive, symmetric, transitive relation). Consequently, $O(dot)$ and $Omega(dot)$ induce a _non-strict partial order_ (an antisymmetric preorder) on these equivalence classes.]
We think of $O(dot), Omega(dot), Theta(dot)$ as making claims about the _asymptotic bounds_ of functions. We think of $o(dot), omega(dot)$ as making claims about the _relative growth_ of functions. The following lemmas should illustrate this point.
#lemma[ If $f = o(g)$ then $f = O(g)$. In fact, any positive constant $C > 0$ can be used to satisfy the definition of $O(g)$.]
#proof[
By definition, we have $lim_(n to infinity) (f(n))/(g(n)) = 0$. So for any $C > 0$, there exists $N in NN$ such that for all $n >= N$, we have $ abs(f(n)/g(n)) <= C \ => abs(f(n)) <= C abs(g(n)). $
]
#lemma[ If $f = omega(g)$ then $f = Omega(g)$. In fact, any positive constant $c > 0$ can be used to satisfy the definition of $Omega(g)$.]
#proof[
By definition, we have $lim_(n to infinity) (f(n))/(g(n)) = infinity$. That is to say for every $c > 0$, there exists $N in NN$ such that for all $n >= NN$, $ abs(f(n)/g(n)) >= c \ implies abs(f(n)) >= c abs(g(n)). $
]
The following is a common way to denote asymptotic equivalence.
#lemma[$f tilde g$ if and only if $f(n) = g(n) (1 + o(1)) $.]
#proof[$ lim_(n to infinity) f(n)/g(n) = 1 <==> lim_(n to infinity) [f(n)/g(n) - 1] = 0 <==> f(n)/g(n) - 1 = o(1) $. ]
A convenient result is that we can _sandwich_ our function to obtain a result of asymptotic equivalence.
#lemma[Suppose there are functions $"LB" tilde g, "UB" tilde g$ such that $ "LB"(n) <= f(n) <= "UB"(n). $ Then, $f tilde g$. ]
#proof[
$ lim_(n->infinity) ("LB"(n))/g(n) <= &lim_(n -> infinity) f(n)/g(n)<= lim_(n -> infinity) "UB"(n)/g(n) \ ==> 1 <= &lim_(n -> infinity) f(n)/g(n) <= 1 \ ==> &lim_(n -> infinity) f(n)/g(n) = 1. $
]
Usually, we end up decomposing a function into two terms---one which is asymptotically equivalent to our target and one that is negligble with respect to it.
#lemma[If $f = f_1 + f_2$ where $f_1 tilde g$ and $f_2 = o(g)$, then $f tilde g$]
#proof[
$ lim_(n -> infinity) f(n)/g(n) = lim_(n -> infinity) (f_1(n))/g(n) + lim_(n -> infinity) (f_2(n))/g(n) = 1. $
]
== the hierarchy
Here is the dream.
#definition[A function is $g(n)$ is said to be in _standard form_ if it is the product of the following types
+ Constants #h(1fr) (eg. #h(3pt) $sqrt(2 pi), 6, e^(-2)$)
+ Constant powers of $n$ #h(1fr) (eg. #h(3pt) $n, sqrt(n), n^(5/2), n^(-3)$)
+ Constant powers of $ln n$ #h(1fr) (eg. #h(3pt) $ln n, sqrt(ln n), 1/(ln n)$)
+ Exponentials #h(1fr) (eg. #h(3pt) $2^n, e^(-n), 2^(n/2)$ )
+ $n^(c n)$ for constant $c$ #h(1fr) (eg. #h(3pt) $n^n$)]
#prop[For all $K > 0$ and $epsilon > 0$
$ ln^K n << n^epsilon, \ n^K << (1 + epsilon)^n, \ K^n << n^(epsilon n). $]
#proof[Start with $f(n) = n^K$ and $g(n) = (1 + epsilon)^n$. Note that, $ lim_(n -> infinity) (f(n + 1))/f(n) = lim_(n -> infinity) (1 + n^(-1))^K = 1^K = 1. $
Take any $c$ such that $1 < c < 1 + epsilon$. There exist $n_0$ such that for all $n > n_0$, $(f(n + 1))/f(n) < c$. Then,
$ (f(n_0 + m))/(g(n_0 + m)) <= (c^m f(n_0))/((1 + epsilon)^m g(n_0)) -> 0 $ as $m -> infinity$.
Note that under the parametrization $n = e^m$, $ln^K n << n^epsilon$ becomes $m^K << (e^epsilon)^m$. Note that from the above result, $ m^K << (1 + epsilon)^K << (e^epsilon)^K $
using the fact that $1 + x <= e^x$.
Finally, for the last result, fix $c > K$ and $n_0$ with $n_0^epsilon >= c$. For $n >= n_0$, $n^(epsilon n) >= c^n >> K^n$. \ ]
Sometimes we see a $(1 + o(1))$ factor in the exponent. This gives very crude bounds. For example, $f(n) = g(n)^(1 + o(1))$ is equivalent to saying that
+ for any $epsilon > 0$, for $n$ sufficiently large, $f(n) > g(n)^(1 - epsilon)$.
+ for any $epsilon > 0$, for $n$ sufficiently large, $f(n) < g(n)^(1 + epsilon)$.
This is a much weaker claim then $f tilde g$. For example, if we have $g(n) = n^2$ then $f(n)$ could be any of $n^2, n^2 ln n, n^2 ln^5 n, n^2 ln^(-3) n$.
Working with asymptotics can simplify issues quite a bit. Consider the following theorem.
#prop[Let $a, c > 0$ and and $b in RR$. Define, for $x > 1$, $f(x) = c x^a ln^b x$. For $y$ sufficiently large, there is a unique $x$ with $y = f(x)$. Write $x = g(y)$ for such $y$. Asymptotically in $y$, $ x tilde d y^(1\/a)(ln y)^(-b\/a), $ where $d = a^(a\/b)c^(- 1\/a)$.]
#proof[
Start by noting that, eventually the $x^a$ term dominates the polylogarithmic term to make $f$ increasing. More formally, note that
$ f'(x) = a c x^(a - 1) ln^b x + b c x^(a - 1) ln^(b - 1) x \ = c x^(a - 1) ln^b x dot (a + b/(ln x)). $
There exists $x_0 > 1$ such that for all $x > x_0$, we have $abs(b)/a < ln x$. So, for all $x > x_0$, we have $f'(x) > 0$. Thus, $f'$ is eventually increasing.
For large $x$,
$ ln y = ln c + a ln x + b ln ln x tilde a ln x. $
where the asymptotic equivalence is justified by $ln c, ln ln x in o(ln x). $
Now, consider
$ y &= c x^a ln^b x \ ==> x &= c^(-1 slash a) y^(1 slash a)(ln x)^(-b slash a) \ &tilde a^(a slash b) c^(-1 slash a) y^(1 slash a) (ln y)^(-b slash a). $
]
#prop[ If $y = Theta(x^a ln^b x)$ then $x = Theta(y^(1 slash a) ln^(-b slash a) x)$.]
== stirling's approximation
The following is the main result also known as Stirling's formula.
#prop[ $ n! tilde n^n e^(-n) sqrt(2 pi n) . $ ]
The proof of this theorem is slightly technical and so, has been omitted in favor of weaker results with shorter proofs. I would still recommend studying a proof of this-- I like the exposition in Spencer and Florescu's _Asymptopia_ as well as Keith Conrad's notes.
We estimate the logarithm of $n!$ via the formula
$ S_n = ln(n!) = sum_(k = 1)^n ln k. $
We expect $S_n$ to be close to the integral of the function $ln x$ between $x = 1$ and $x = n$. Define $ I_n = integral_1^n ln x #h(3pt) d x = [x ln x - x]_1^n = n ln n - n + 1. $
Let $T_n$ be the value for the approximation of the integral $I_n$ via the trapezoidal rule using step size $1$. That is, estimate $integral_i^(i + 1) f(x) d x$ by $1/2 (f(i) + f(i + 1))$. Summing up over $1 <= i <= n - 1$,
$ T_n = 1/2 ln 1 + sum_(k = 2)^(n - 1) ln k + 1/2 ln n = S_n - 1/2 ln n. $
We estimate the error in this approximation by definine $ E_n = I_n - T_n. $
Furthermore, for $1 <= k <= n - 1$, let $S_k$ denote the _sliver_ of area under the curve $y = ln x$ for $k <= x <= k + 1$ but over the straight line between $(k, ln k)$ and $(k + 1, ln (k + 1))$. As the curve $ln x$ is concave, the curve is over the straight line and we have, $ E_n = sum_(k = 1)^(n - 1) mu(S_k) $ with $mu$ denoting the area.
#lemma[$ lim_(n -> infinity) E_n = c < infinity. $]
#proof[
Let $P = (k, ln k)$ and let $Q = (k + 1, ln(k + 1))$. Furthermore, let $C$ denote the curve $f(x) = ln x$ in the interval $[k, k + 1]$. Furthermore, $f$ has derivative between $1/k$ and $1/(k + 1)$ on the interval $[k, k + 1]$. Let $U$ denote the straight line segment starting at $P$ with slope $1/k$ and ending at $x = k + 1$. Let $L$ be the straight line segment starting at $P$ with slope $1/(k + 1)$, ending at $x = k + 1$.
As the derivative of $C$ is always between those of $U$ and $L$, the curve $C$ is under $U$ and over $L$. That is to say, at $x = k + 1$, $L$ then is below the curve $C$, below the point $Q$. Thus, the straight line $P Q$ lies above the line $L$ and we can bound $mu(S_k)$ by the area between $U$ and $L$. The latter is a triangle with height being $1$ and base being the line from $U$ to $L$ at $x = k + 1$ which has length $1/k - 1/(k + 1)$. Thus,
$ mu(S_k) <= 1/2 (1/k - 1/(k + 1)). $
This value is $O(k^(-2))$ and we achieve convergence. We even obtain the explicit upper bound,
$ sum_(k = 1)^infinity mu(S_k) <= sum_(k = 1)^infinity 1/2 (1/k - 1/(k + 1)) = 1/2. $
]
#prop[ There is some positive constant $K$, such that $ n! tilde K n^n e^(-n) sqrt(n). $]
#proof[
From the definitions above,
$ ln (n!) &= T_n + 1/2 ln n \ &= I_n - E_n + 1/2 ln n $
The lemma above gives us,
$ &= n ln n - n + 1/2 ln n + 1- c + o(1) $
Exponentiating this gives us,
$ n! tilde n^n e^(-n) sqrt(n) e^(1 - c). $
]
We can get a more precise approximation by putting more effort into estimating the error and using the fact that $K = sqrt(2 pi)$.
#prop[$ e^(1\/(12n + 1)) dot n^n e^(-n) sqrt(2 pi n) <= n! <= e^(1\/(12n)) dot n^n e^(-n) sqrt(2 pi n) $]
Proving this requires a bit of care, we will be proving something a bit simpler of a similar flavor.
#lemma[ $ (n!)/(n^n e^(-n) sqrt(2 pi n)) = (1 + (1 + o(1))/(12n)). $ ]
#proof[
From Stirling's formula, we know that $e^(1 - c) = sqrt(2 pi n)$. Define $F_n = c - E_n$. Then,
$ ln(n!) = n ln n - n + 1/2 ln n + 1 - c + 1/2 ln n + F_n \ implies (n!)/(n^n e^(-n) sqrt(2 pi n)) = e^(F_n) $
Thus, $e^(F_n)$ gives us the _error term_ in the approximation given by Stirling's formula. Since $F_n -> 0$, $e^(F_n) = 1 + F_n ( 1 + o(1))$. While we don't know $F_n$ in closed form, we may find it asymptotitcally.
We start by considering $mu(S_k)$ explicitly.
$ mu(S_k) = integral_k^(k + 1) ln x - [ ln k + (ln(k + 1) - ln k) (x - k) ] #h(2pt) d x $
Parametrizing by $y = k + x$ for convenience, this becomes
$ = integral_0^1 ln (y + k) - [(1 - y) ln k + y ln (k + 1)] #h(2pt) d x. $
From the Taylor series, considering the asymptotics as $k -> oo$, uniformly over $y in [0, 1]$.
$ ln(k + y) = ln k - 1 $
]
== taylor's theorem
= binomial coefficients
== introduction
== bounds
= primes
== using asymptotics
== prime number theorem
== bertrand's postulate
= integrals
== approximating sums
== harmonic numbers
= just some beautiful results
Of course subjective, but for whatever reasons I think the results below are quite striking.
== greshgorin's circles
simplicity
== amitsur-levitzki
shocking
== prüfer encoding
elegant
== dft
neat 'things fit in'
== mastering floors and ceilings
master theorem, also sunk cost
== moore bound for irregular graphs
nice information theoretic proof
== hardin-taylor theorem
surprising, platonic, axiom of choice
|
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/064.%20copy.html.typ | typst | copy.html
Copy What You Like
July 2006
When I was in high school I spent a lot of time imitating bad
writers. What we studied in English classes was mostly fiction,
so I assumed that was the highest form of writing. Mistake number
one. The stories that seemed to be most admired were ones in which
people suffered in complicated ways. Anything funny or
gripping was ipso facto suspect, unless it was old enough to be hard to
understand, like Shakespeare or Chaucer. Mistake number two. The
ideal medium seemed the short story, which I've since learned had
quite a brief life, roughly coincident with the peak of magazine
publishing. But since their size made them perfect for use in
high school classes, we read a lot of them, which gave us the
impression the short story was flourishing. Mistake number three.
And because they were so short, nothing really had to happen; you
could just show a randomly truncated slice of life, and that was
considered advanced. Mistake number four. The result was that I
wrote a lot of stories in which nothing happened except that someone
was unhappy in a way that seemed deep.For most of college I was a philosophy major. I was very impressed
by the papers published in philosophy journals. They were so
beautifully typeset, and their tone was just captivating—alternately
casual and buffer-overflowingly technical. A fellow would be walking
along a street and suddenly modality qua modality would spring upon
him. I didn't ever quite understand these papers, but I figured
I'd get around to that later, when I had time to reread them more
closely. In the meantime I tried my best to imitate them. This
was, I can now see, a doomed undertaking, because they weren't
really saying anything. No philosopher ever refuted another, for
example, because no one said anything definite enough to refute.
Needless to say, my imitations didn't say anything either.In grad school I was still wasting time imitating the wrong things.
There was then a fashionable type of program called an expert system,
at the core of which was something called an inference engine. I
looked at what these things did and thought "I could write that in
a thousand lines of code." And yet eminent professors were writing
books about them, and startups were selling them for a year's salary
a copy. What an opportunity, I thought; these impressive things
seem easy to me; I must be pretty sharp. Wrong. It was simply a
fad. The books the professors wrote about expert systems are now
ignored. They were not even on a path to anything interesting.
And the customers paying so much for them were largely the same
government agencies that paid thousands for screwdrivers and toilet
seats.How do you avoid copying the wrong things? Copy only what you
genuinely like. That would have saved me in all three cases. I
didn't enjoy the short stories we had to read in English classes;
I didn't learn anything from philosophy papers; I didn't use expert
systems myself. I believed these things were good because they
were admired.It can be hard to separate the things you like from the things
you're impressed with. One trick is to ignore presentation. Whenever
I see a painting impressively hung in a museum, I ask myself: how
much would I pay for this if I found it at a garage sale, dirty and
frameless, and with no idea who painted it? If you walk around a
museum trying this experiment, you'll find you get some truly
startling results. Don't ignore this data point just because it's
an outlier.Another way to figure out what you like is to look at what you enjoy
as guilty pleasures. Many things people like, especially if they're
young and ambitious, they like largely for the feeling of virtue
in liking them. 99% of people reading Ulysses are thinking
"I'm reading Ulysses" as they do it. A guilty pleasure is
at least a pure one. What do you read when you don't feel up to being
virtuous? What kind of book do you read and feel sad that there's
only half of it left, instead of being impressed that you're half
way through? That's what you really like.Even when you find genuinely good things to copy, there's another
pitfall to be avoided. Be careful to copy what makes them good,
rather than their flaws. It's easy to be drawn into imitating
flaws, because they're easier to see, and of course easier to copy
too. For example, most painters in the eighteenth and nineteenth
centuries used brownish colors. They were imitating the great
painters of the Renaissance, whose paintings by that time were brown
with dirt. Those paintings have since been cleaned, revealing
brilliant colors; their imitators are of course still brown.It was painting, incidentally, that cured me of copying the wrong
things. Halfway through grad school I decided I wanted to try being
a painter, and the art world was so manifestly corrupt that it
snapped the leash of credulity. These people made philosophy
professors seem as scrupulous as mathematicians. It was so clearly
a choice of doing good work xor being an insider that I was forced
to see the distinction. It's there to some degree in almost every
field, but I had till then managed to avoid facing it.That was one of the most valuable things I learned from painting:
you have to figure out for yourself what's
good. You can't trust
authorities. They'll lie to you on this one.
Comment on this essay.Chinese TranslationRomanian TranslationSpanish TranslationRussian Translation
|
|
https://github.com/jneug/schule-typst | https://raw.githubusercontent.com/jneug/schule-typst/main/src/themes/catppuccin.typ | typst | MIT License | // TODO: Improve theme support
// TODO: Add more theme style keys
#let typst-text = text
// General colors
#let primary = rgb("#dc8a78")
#let secondary = rgb("#04a5e5")
#let muted = rgb("#dce0e8")
// General backgrounds
#let bg = (
primary: primary.lighten(90%),
secondary: secondary.lighten(90%),
muted: rgb("#eff1f5"),
code: rgb("#e6e9ef"),
solution: rgb("#e6e9ef"),
)
// Text colors
#let text = (
default: rgb("#4c4f69"),
header: rgb("#5c5f77"), // primary
footer: rgb("#ccd0da"),
title: primary,
subject: rgb("#4c4f69"),
primary: white,
secondary: white
)
// Font settings
#let fonts = (
default: ("Charter", "Georgia", "Apple Color Emoji"),
headings: (
"Avenir Next",
"Avenir",
"Helvetica Neue",
"Helvetica",
"Apple Color Emoji",
),
code: ("Fira Code", "Liberation Mono", "Courier New"),
serif: ("EB Garamond 12", "Garamond", "Charter", "Georgia"),
sans: ("Fira Sans", "Liberation Sans", "Avenir Next", "Avenir", "Helvetica Neue", "Helvetica"),
)
// Table colors and styles
#let table = (
header: bg.primary,
even: bg.muted,
odd: white,
stroke: .6pt + muted,
)
#let cards = (
type1: rgb("#40a02b"),
type2: rgb("#df8e1d"),
type3: rgb("#d20f39"),
help: rgb("#8839ef"),
back: rgb("#ffffb2"),
)
#let init(body) = {
body
}
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/软件分析/hw/2100012990-郭子荀-软分第一次作业.typ | typst | #import "../../template.typ": proof, note, corollary, lemma, theorem, definition, example, remark
#import "../../template.typ": *
#show: note.with(
title: "作业12",
author: "YHTQ",
date: datetime.today().display(),
logo: none,
withOutlined : false,
withTitle : false,
withHeadingNumbering: false
)
= 1.
是一种下近似
- 对于可能抛出异常的程序,其必在某一个输入抛出异常,这个输入一定会被遍历到。然而异常未必在前一百句抛出,因此该算法无法确定所有可能抛出异常的程序。
- 另一方面,若某个程序被该算法检查到抛出异常,则该程序当然会抛出异常。
因此该算法只能回答“是”或“不知道”,是下近似。 |
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/packages/typst.angular/projects/typst.angular/README.md | markdown | Apache License 2.0 | # Typst.angular
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.0.
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/link_03.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Check that unbalanced brackets are not included in links.
#[https://example.com/] \
https://example.com/)
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/place-nested_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
#box(
fill: aqua,
width: 30pt,
height: 30pt,
place(bottom,
place(line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 3pt))
)
)
|
https://github.com/saYmd-moe/note-for-statistical-mechanics | https://raw.githubusercontent.com/saYmd-moe/note-for-statistical-mechanics/main/utils/custom-numbering.typ | typst | // 只能排两个的 Part I 罗马数字
#let custom-numbering(..nums) = {
numbering(
(..nums) => {
if nums.pos() == (1,) {
[Part I]
} else {
[Part II]
}
},
..nums
)
} |
|
https://github.com/02hyc/Group-Meeting-Typst | https://raw.githubusercontent.com/02hyc/Group-Meeting-Typst/master/main.typ | typst | #import "/globals.typ": *
#show: init
#let nontight(lst) = {
let fields = lst.fields()
fields.remove("children")
fields.tight = false
return (lst.func())(..fields, ..lst.children)
}
#show list.where(tight: true): nontight
#show enum.where(tight: true): nontight
#show terms.where(tight: true): nontight
#show: slides
#include "sections/weekly-report.typ"
|
|
https://github.com/FkHiroki/ex-B2_typst | https://raw.githubusercontent.com/FkHiroki/ex-B2_typst/main/sections/preparation.typ | typst | MIT No Attribution | // タイトル
#align(center, text(18pt, "量子コンピューティング アニーリング レポート")) \
#align(right, text(12pt, "62217149 福原博樹"))
// = [A1-1]
// $ E(s_1,s_2) = -J_(1,2) s_1 s_2 - h_1 s_1 - h_2 s_2, space s_i in {-1, 1} \
// E_("QUBO") = a_1 x_1 + a_2 x_2 + b_(1,2) x_1 x_2 + "const", space x in {0, 1} \
// x_i = (1 - s_i) / 2, space <=> space s_i = 1 - 2 x_i \ $
// $ E(x_1,x_2) &= -J_(1,2) (1 - 2 x_1) (1 - 2 x_2) - h_1 (1 - 2 x_1) - h_2 (1 - 2 x_2) \
// &= 2(J_(1,2) + h_1) x_1 + 2(J_(1,2) + h_2) x_2 - 4 J_(1,2) x_1 x_2 + "const" \
// therefore a_1 &= 2(J_(1,2) + h_1), space a_2 = 2(J_(1,2) + h_2), space b_(1,2) = -4 J_(1,2) \ $
= [A2-2] 問題: 数独
|
https://github.com/vEnhance/1802 | https://raw.githubusercontent.com/vEnhance/1802/main/src/ipep.typ | typst | MIT License | #import "@local/evan:1.0.0":*
= A zoomed out pep talk of Part Golf
This whole section is a pep talk.
We'll get to recipes and details in subsequent sections.
== [TEXT] The big table of integrals
The rest of 18.02 is going to cover a bunch of different integrals.
If you've been following my advice to pay attention to type safety so far, it'll help you here.
I'll freely admit that I (Evan) often make type-errors in this part of 18.02 as well,
so don't let your guard down.
Remember that:
#idea[
Suppose $f : RR^n -> RR$ is given, and $0 <= d <= n$.
The point of a $d$-dimensional integral of $f$
is to add up all the values of $f$ among some $d$-dimensional object living in $RR^n$.
]
For example, this idea even makes sense for $d = 0$!
In 18.02, a $0$-dimensional object is a point (or a bunch of points),
and you can evaluate $f$ at a point by just plugging it in.
So philosophically, a $0$-dimensional integral is just a finite sum of $f$ at some points.
This might seem stupid that I bring up this degenerate case,
but it turns out later when we cover div/grad/curl the $0$-dimensional case is relevant.
Here's a giant chart in @fig-int-chart-triangle.
(The chart is so big it doesn't quite fit in the page,
but you can download a
#link("https://web.evanchen.cc/upload/1802/integrals-triangle.pdf")[large PDF version]).
#figure(
image("figures/integrals-triangle.png", width: 100%),
caption: [
For each $0 <= d <= n <= 3$, the kind of integral is drawn and named.
Download at #url("https://web.evanchen.cc/upload/1802/integrals-triangle.pdf").
]
) <fig-int-chart-triangle>
This chart has ten different kinds of integrals,
one for each $(d,n)$ with $0 <= d <= n <= 3$.
Here's a rundown of the things in the chart.
- The case $d = 0$ is stupid, as I just said,
and it's only here because I'll reference it later.
- The case $d = 1$ and $n = 1$ was covered in 18.01.
Good old single-variable integral computed using the antiderivative,
via the fundamental theorem of calculus.
- After that, the conceptually simplest cases are actually $d = n = 2$ and $d = n = 3$
--- the ones on the diagonal.
In general, these might be called *double/area integrals* for $n=2$
and *triple/surface integrals* for $n = 3$.
We'll say a bit in a moment about how to compute these in practice,
but the good news is that often you can just chain together old 18.01 integrals;
you don't even need a parametrization some of the time.
- When $d = 1$ and $2 <= n <= 3$, what you get are *line integrals*.
The idea is that you have a trajectory in $RR^n$
which is defined by some parametric equation $bf(r) : RR -> RR^n$.
You also have a function $f : RR^n -> RR$.
The line integral lets you add up the values of $f$ along the trajectory.
This is just turns out to be a _single_ 18.01 integral.
Usually your path is parametrized by a single variable $t$.
So even though the expression inside the integral
$ int_(t_0)^(t_1) f(bf(r(t))) |bf(r)'(t)| dif t $
inside the integral might look intimidating,
if you are really given a concrete $f$ and $bf(r)(t)$, then what you _really_ have is
$ int_(t_0)^(t_1) ["expression involving only " t] dif t $
which is an 18.01 integral!
And so that's something you already know how to do.
In other words, if you have $d=1$ and $n > 1$,
you basically replace it right away with a single integral
over the parametrizing line segment.
In other words *line integrals translate directly into single 18.01 integrals*
- When $d = 2$ and $n = 3$, we have the *surface integral*.
To compute these, you usually have to parametrize a _surface_;
but since a surface is two-dimensional,
rather than $bf(r)(t)$ for a time parameter $t$
you have $bf(r)(u,v)$ for two parameters $u$ and $v$ to describe the surface.
That makes these a little more annoying.
But like the line integral, after you work out the parametrization stuff,
the surface integral will transform into a $2$-variable area integral.
In other words *surface integrals translate directly into area integral*.
So the bottom trio --- 2D/3D line integral and surface integral ---
end up being special instances of the single and double integrals.
We'll see some examples of this later;
but it'll actually be the _last_ thing we cover in part Golf.
Most of part Golf will be dedicated towards double and triple integrals instead.
== [TEXT] Idea of how these are computed when $d = n$ and $n >= 2$
So as I just said, focus for now on $d = n = 2$ or $d = n = 3$
(the double and triple integral cells in chart @fig-int-chart-triangle).
The easiest cases are when the region you're integrating is a rectangle or prism.
Despite looking scary because of the number of integral signs,
they are actually considered the "easy case" to think about for practical calculations:
- A double integral over a rectangle is two 18.01 integrals followed one after another.
- A triple integral over a rectangular prism
really is three 18.01 integrals followed one after another.
Then there are cases where $d = n = 2$ or $d = n = 3$
but the region is not rectangular.
For example, maybe in $RR^2$ you are trying to do an *area integral* over the disk $x^2+y^2 <= 1$
or you are trying to do a *volume integral* over the ball $x^2+y^2+z^2 <= 1$ for example.
- Even in this case, sometimes you could still set up a double integral
or triple integral without having to change variables.
For example, an integral over the disk
$ iint_(x^2+y^2<=1) f(x,y) dif x dif y $
might actually be rewritten a double integral
$ int_(-1)^1 int_(-sqrt(1-y^2))^(sqrt(1-y^2)) f(x,y) dif x dif y. $
Although it looks more frightening because the limits of integration are
expressions and not numbers, it doesn't require any new techniques.
It really is just two 18.01 integrals, one after another.
- If rewriting as a double or triple integral fails,
then the strategy is instead to *change variables*.
This method will be covered extensively later.
So to summarize
#idea[
Whenever you try to compute a multivariable integral in @fig-int-chart-triangle,
your goal is to translate it into a rectangular-looking single/double/triple integral,
then evaluate by using your old 18.01 methods multiple times.
]
This is actually really, really good news!
You might have remembered from 18.01 that computing integrals of single-variable functions
like $integral e^x sin(x)$ was, well, hard!#footnote[It's $1/2 e^x (sin(x) - cos(x)) + C$, by the way.]
Computing antiderivatives was not easy at all; in fact, it's so nontrivial that MIT students
made an #link("https://en.wikipedia.org/wiki/Integration_Bee")[event called the integration bee]
that's like the spelling bee but for integrals (I'm not kidding).
You might have feared that in 18.02, you might need to learn something even more horrifying.
But no, you don't!
It's a lot like how you might have been scared of multivariate differentiation at first,
with the symbols $nabla f$ or partial derivatives,
until you realize that calculating partial derivatives is something
_actually already know how to do_ from 18.01.
The same will be true for multivariable integrals.
The challenge won't actually be the anti-derivatives, which are unchanged for 18.01.
The hard part will actually be figuring out the _limits_ of integration!
|
https://github.com/JakMobius/courses | https://raw.githubusercontent.com/JakMobius/courses/main/mipt-os-basic-2024/sem06/main.typ | typst |
#import "@preview/polylux:0.3.1": *
#import "@preview/cetz:0.2.2"
#import "@preview/suiji:0.3.0": *
#import "../theme/theme.typ": *
#import "./utils.typ": *
#show: theme
#title-slide[
#align(horizon + center)[
= Виртуальная память
АКОС, МФТИ
17 октября, 2024
]
]
#show: enable-handout
#focus-slide[
#text(size: 25pt)[*Как разные процессы используют одни и те же адреса?*]
]
#slide(header: [В былые времена...])[
#place(right + horizon, dx: 2cm, dy: -1.5cm)[#image(width: 13cm, "doscomputer.png")]
#place(horizon, dy: -0.5cm)[
16-битные компьютеры на DOS использовали *сегменты*:
- *#raw("CS")* - сегмент кода;
- *#raw("DS")* - сегмент данных;
- *#raw("SS")* - сегмент стека;
- *#raw("ES")* - пользовательский сегмент;
*Сегмент* в x86 - постоянное слагаемое к адресу.
Разным процессам выдавались разные сегменты.
*Современные компьютеры используют виртуальную адресацию.*
]
]
#slide(
background-image: none,
place-location: horizon + center)[
#cetz.canvas(length: 1cm, {
cetz.draw.content((0, 0), (30, -17), [])
let virtual_bg = cell-color(blue).background-color;
let virtual_stroke = cell-color(blue).stroke-color;
let physical_bg = cell-color(red).background-color;
let physical_stroke = cell-color(red).stroke-color;
let arrow_color = gray;
let virt_addr_pos(i) = {
let section = 0
if i >= 4 { section = 1 }
if i >= 8 { section = 2 }
if i >= 12 { section = 3 }
return (3.75 + i * 1.15 + section * 2, -6)
}
let phys_addr_pos(i) = {
return (3 + i * 1, -11.5)
}
cetz.draw.content((0, 0), (30, -8.5))[
#box(width: 100%, height: 100%, fill: virtual_bg)
]
cetz.draw.content((0, -8.5), (30, -17))[
#box(width: 100%, height: 100%, fill: physical_bg)
]
let rng = gen-rng(42)
let used_phys_addrs = ()
for i in range(17) {
let phys_addr = -1;
while phys_addr < 0 or phys_addr in used_phys_addrs {
(rng, phys_addr) = integers(rng, low: 0, high: 25)
}
used_phys_addrs = used_phys_addrs + (phys_addr,)
let a_pos = virt_addr_pos(i);
let b_pos = phys_addr_pos(phys_addr);
let c_pos = (a_pos.at(0), a_pos.at(1) - 1.5)
let d_pos = (b_pos.at(0), b_pos.at(1) + 1.5)
cetz.draw.bezier(a_pos, b_pos, c_pos, d_pos, stroke: 3pt + gray, mark: (end: ">"))
}
cetz.draw.content((0, 0), (30, -8.5))[
#box(
width: 100%, height: 100%, inset: 20pt,
)[
#align(left)[
= Виртуальные адреса
]
#let memdescr(content, pages) = {
return table.cell(colspan: pages)[
#set text(size: 24pt, fill: black, weight: "bold")
#raw(content)
]
}
#let addr(content, pages) = {
return table.cell(colspan: pages)[
#set text(size: 18pt, fill: blue, weight: "bold")
#raw(content)
]
}
#let dots = {
set text(size: 20pt, fill: black, weight: "black")
$dots.h.c$
}
#place(horizon + center)[
#table(
columns: 21,
rows: 3,
align: (x, y) => {
if y == 1 { horizon + center }
else { left }
},
inset: (x, y) => {
if y == 0 {
(left: 5pt, bottom: 10pt, right: 20pt, top: 5pt)
}
else if y == 1 {
(left: 20pt, right: 20pt, top: 20pt, bottom: 15pt)
}
else { (bottom: 7pt, left: 33pt) }
},
stroke: (x, y) => {
let st = 3pt + virtual_stroke
if y == 0 {
if x == 0 { none }
else {
(left: (dash: "dashed", paint: virtual_stroke))
}
}
else if y == 1 {
if x == 0 {
(right: st, top: st)
} else{
(left: st, top: st)
}
} else {
if x == 0 {
(right: st, bottom: st)
} else{
(left: st, bottom: st)
}
}
},
// Top row without borders
addr("", 1),
addr("0x100000000", 4),
addr("", 1),
addr("0x100001000", 4),
addr("", 1),
addr("0x300000000", 4),
addr("", 1),
addr("0x7f0000000000", 5),
// Bottom row with borders except left and right
dots,
memdescr("code", 4),
dots,
memdescr("data", 4),
dots,
memdescr("stack", 4),
dots,
memdescr("heap", 5)
)
]
]
]
// Нижняя часть: Физические адреса
cetz.draw.content((0, -8.5), (30, -17))[
#box(
width: 100%, height: 100%, inset: 20pt
)[
#align(left)[
#box(outset: 10pt, fill: physical_bg, radius: 5pt)[
= Физические адреса
]
]
#place(horizon + center)[
// Add a blue dot to used physical address
#show table.cell: it => {
if (it.x - 1) in used_phys_addrs {
set text(size: 100pt, fill: blue)
sym.dot.c
} else {
none
}
}
#table(
rows: 1.5cm,
columns: (1.5cm,) + (1cm,) * 25 + (1.5cm,),
align: horizon + center,
stroke: (x, y) => {
let st = 3pt + physical_stroke
if x == 0 {
(top: st, right: st, bottom: st)
} else {
(top: st, left: st, bottom: st)
}
},
[$dots.c.h$],
..([], ) * 25,
[$dots.c.h$]
)
]
]
]
})
#place(center + bottom)[
#set block(spacing: 15pt)
Адреса, которые используются процессами, называются *вирутуальными*.
*Физический адрес* -- уже реальный индекс байта в оперативной памяти.
]
]
#slide(
background-image: none,
place-location: horizon + center)[
#cetz.canvas(length: 1cm, {
cetz.draw.content((0, 0), (30, -17), [])
let virtual_bg = cell-color(blue).background-color;
let virtual_stroke = cell-color(blue).stroke-color;
let virtual_2_bg = cell-color(green).background-color;
let virtual_2_stroke = cell-color(green).stroke-color;
let physical_bg = cell-color(red).background-color;
let physical_stroke = cell-color(red).stroke-color;
let arrow_color = gray;
let virt_addr_pos(i, offset) = {
let section = 0
if i >= 4 { section = 1 }
if i >= 8 { section = 2 }
if i >= 12 { section = 3 }
return (offset + 3.75 + i * 1.15 + section * 2, -6)
}
let phys_addr_pos(i) = {
return (3 + i * 1, -10.5)
}
cetz.draw.content((0, 0), (15, -7))[
#box(width: 100%, height: 100%, fill: virtual_bg)
]
cetz.draw.content((15, 0), (30, -7))[
#box(width: 100%, height: 100%, fill: virtual_2_bg)
]
cetz.draw.content((0, -7), (30, -17))[
#box(width: 100%, height: 100%, fill: physical_bg)
]
let rng = gen-rng(26)
let used_phys_addrs = ()
for i in range(2) {
let phys_addr = -1;
while phys_addr < 0 or phys_addr in used_phys_addrs {
(rng, phys_addr) = integers(rng, low: 0, high: 25)
}
used_phys_addrs = used_phys_addrs + (phys_addr,)
let a_pos = if i == 0 {
(7, -5)
} else {
(23, -5)
}
let b_pos = phys_addr_pos(phys_addr);
let c_pos = (a_pos.at(0), a_pos.at(1) - 1.5)
let d_pos = (b_pos.at(0), b_pos.at(1) + 1.5)
cetz.draw.bezier(a_pos, b_pos, c_pos, d_pos, stroke: 4pt + black, mark: (end: ">"))
}
cetz.draw.content((0, 0), (15, -7))[
#box(
width: 100%, height: 100%, inset: 20pt,
)[
#align(left)[
= Процесс 1
]
#place(horizon + center)[
#set text(size: 30pt, fill: blue, weight: "bold")
#raw("0x100001020")
]
]
]
cetz.draw.content((15, 0), (30, -7))[
#box(
width: 100%, height: 100%, inset: 20pt,
)[
#align(left)[
= Процесс 2
]
#place(horizon + center)[
#set text(size: 30pt, fill: blue, weight: "bold")
#raw("0x100001020")
]
]
]
// Нижняя часть: Физические адреса
cetz.draw.content((0, -7), (30, -17))[
#box(
width: 100%, height: 100%, inset: 20pt
)[
#align(left)[
#box(outset: 10pt, fill: physical_bg, radius: 5pt)[
= Физические адреса
]
]
#place(horizon + center)[
#let dot-colors = (blue, green, none)
#let rng = gen-rng(42)
#let random_colors = integers(rng, low: 0, high: 3, size: 25).at(1)
#show table.cell: it => {
if it.x == 0 or it.x > 25 { return }
let pos = used_phys_addrs.position((x) => x == it.x - 1)
if pos == none {
let num = random_colors.at(it.x - 2)
if num < 2 {
pos = num
}
}
if pos != none {
set text(size: 100pt, fill: dot-colors.at(pos))
sym.dot.c
} else {
none
}
}
#table(
rows: 1.5cm,
columns: (1.5cm,) + (1cm,) * 25 + (1.5cm,),
align: horizon + center,
stroke: (x, y) => {
let st = 3pt + physical_stroke
if x == 0 {
(top: st, right: st, bottom: st)
} else {
(top: st, left: st, bottom: st)
}
},
[$dots.c.h$],
..([], ) * 25,
[$dots.c.h$]
)
]
]
]
})
#place(center + bottom)[
*Одинаковые виртуальные адреса могут указывать на разные физические.*
]
]
#slide(background-image: none)[
= Как связать виртуальный адрес с физическим?
== #codebox(lang: "c", "mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)")
#text(weight: "semibold")[
#set list(marker: none)
- #codebox(lang: "c", "void* start") -- Виртуальный адрес или #codebox("NULL") (кратно #codebox(lang: "c", "PAGE_SIZE"));
- #codebox(lang: "c", "size_t len") -- Сколько байт связать (кратно #codebox(lang: "c", "PAGE_SIZE"));
- #codebox(lang: "c", "int prot") -- Права доступа к памяти;
- #codebox(lang: "c", "int flags") -- Нужно установить в #codebox(lang: "c", "MAP_ANONYMOUS") ;
- #codebox(lang: "c", "int fd") -- Нужно установить в #codebox(lang: "c", "-1") ;
- #codebox(lang: "c", "off_t off") -- Может быть любым.
]
- Ядро выберет свободный физический адрес и свяжет его с виртуальным. Самому выбрать физический адрес нельзя.
- #codebox(lang: "c", "malloc()") и #codebox(lang: "c", "calloc()") делают то же самое, когда им нужны новые страницы памяти.
- Когда страницы больше не нужны, используйте #codebox(lang: "c", "munmap()").
]
#slide(header: [Таблицы страниц], place-location: horizon)[
- *Хранят соответствие* виртуальных адресов физическим и *права доступа* к ним.
- Модифицируются *только ядром*. Конвертацией адресов занимается *процессор*.
- #codebox(lang: "c", "mmap()") просит ядро создать новую запись в таблице страниц.
- Связаны *иерархически*, как директории и файлы.
- Минимально адресует *страницу памяти* (обычно 4 КБ).
- Таблицу страниц любого процесса можно увидеть в #codebox("/proc/PID/maps").
]
#let horizontal-bezier(a, b) = {
cetz.draw.bezier((a.x, a.y), (b.x, b.y), (b.x, a.y), (a.x, b.y))
}
#let draw-page-table(position, values, more: true) = {
let column-width = 2
let index-node-height = 2.5
let margin = 1.0
let dirent-start = index-node-height + margin
let dirent-height = 1.8 * values.len()
if (more) {
dirent-height += 1
}
let left = position.x - column-width / 2
let right = position.x + column-width / 2
cetz.draw.set-style(mark: (end: ">"), stroke: 5pt + black, fill: none)
cetz.draw.content(
(left, position.y - dirent-start), (right, position.y - dirent-start - dirent-height), padding: none, {
set align(center)
set block(spacing: 0pt)
set text(size: 25pt)
let colors = cell-color(palette.at(1))
grid(
rows: (1.8cm,) * values.len(), columns: 100%, align: horizon + center, stroke: 2pt + colors.stroke-color, fill: colors.background-color, ..values,
)
if (more) {
text(size: 25pt)[*...*]
}
},
)
}
#slide(background-image: none)[
= Конвертация виртуального адреса в x86 (PAE)
#cetz.canvas(
length: 1cm, {
cetz.draw.set-style(
content: (padding: .2), fill: gray.lighten(70%), stroke: gray.lighten(70%),
)
cetz.draw.content((0, -3), (28, -6), padding: none, {
box(width: 100%, height: 100%, inset: (y: 10pt),{
set text(size: 30pt, weight: "bold")
text(fill: blue)[#raw("0x40401aaa")]
raw(" = ")
let num(i) = {
text(fill: blue)[#raw(str(i))]
}
let index(i) = {
raw("[")
num(i)
raw("]")
}
box(baseline: 1.25em,
table(
columns: 4,
stroke: (x, y) => {
if y == 0 {
return (bottom: 2pt + black)
}
},
inset: (x, y) => {
if(y == 0) { return (bottom: 10pt)}
else { return (top: 10pt)}
},
column-gutter: 10pt,
align: horizon + center,
num("01"), num("000000010"), num("000000001"), num("101010101010"),
index(1), index(2), index(1), index("0xaaa")
)
)
})
})
let indices = (1, 2, 1)
let index-node-positions = (
7.35,
10.8,
15.72,
21.6,
)
let data = (
(`[0]`, [*`[1]`*], `[2]`),
(`[0]`, `[1]`, [*`[2]`*]),
(`[0]`, [*`[1]`*], `[2]`),
)
for (i, pos) in index-node-positions.enumerate() {
if i == 3 {
continue
}
draw-page-table((x: pos, y: -4.5), data.at(i))
}
cetz.draw.content((x: index-node-positions.at(3) - 2.5, y: -7.75), (rel: (x: 5, y: -5)), {
box(width: 100%, height: 100%, fill: cell-color(palette.at(0)).background-color, inset: 10pt, radius: 10pt, stroke: 2pt + cell-color(palette.at(1)).stroke-color)[
#set text(size: 20pt, fill: black, weight: "bold")
#align(horizon + center)[
Физический адрес
]
]
})
cetz.draw.set-style(mark: (end: none))
cetz.draw.line((0, -6.8), (7, -6.8), name: "root", stroke: luma(80) + 5pt)
cetz.draw.content((name: "root", anchor: 50%), anchor: "south", padding: .4, [
#text(size: 20pt, fill: luma(80))[*Регистр CR3*]
])
for (i, dirent-index) in ((-1, none),) + indices.enumerate() {
let position = index-node-positions.at(i)
let end = (x: index-node-positions.at(i + 1) - 0.5, y: -6.8)
let arrow = (x: end.x + 0.5, y: end.y - 0.5)
let plus = (x: end.x + 0.5, y: end.y)
if i >= 0 {
let start = (x: 1.2 + position, y: -9 - 1.8 * dirent-index)
let arc1 = (x: 1.8 + position - 0.5, y: -9 - 1.8 * dirent-index)
let arc2 = (x: 1.8 + position, y: -6.8 - 0.5)
cetz.draw.merge-path({
cetz.draw.line(start, arc1)
cetz.draw.arc((), start: 270deg, delta: 90deg, radius: 0.5)
cetz.draw.arc(arc2, start: 180deg, delta: -90deg, radius: 0.5)
cetz.draw.line((), end)
})
}
cetz.draw.line(arrow, (rel: (0, -0.7)))
cetz.draw.line(arrow, (rel: (0, 1.6)))
cetz.draw.content(plus, [
#let fill-color = cell-color(blue).background-color
#box(width: 1cm, height: 1cm, radius: 10pt, stroke: 5pt + black, fill: fill-color)[
#set text(size: 30pt, weight: "black", baseline: -0.05em)
#place(horizon + center)[
#raw("+")
]
]
])
}
})
#place(bottom + left)[
#set block(spacing: 15pt)
#set text(weight: "semibold")
- Каждый уровень хранит #link("https://www.sandpile.org/x86/paging.htm")[кучу флажков]. Например о том, что адрес действителен;
- Если нужно замаппить много памяти, можно опустить третий уровень;
- Частоиспользуемые адреса кешируются в #link("https://ru.wikipedia.org/wiki/Буфер_ассоциативной_трансляции")[TLB].
]
]
#focus-slide[
#text(size: 25pt)[*Что произойдет, если записи в таблице не существует?*]
]
#slide(header: "Page Fault", background-image: none)[
#v(0.5em)
*Исключение процессора*, возникающее при ошибке доступа к виртуальному адресу.
#line(length: 100%)
*Возникает, если:*
- Ваша программа сделала #codebox(lang: "c", "*((int*)0) = 0") . Тогда ядро отправит вам #codebox("SIGSEGV");
- Ядро *выгрузило* эту страницу из памяти *в своп*. Тогда ядро загрузит страницу обратно и вы ничего не заметите;
- Ядро *лениво скопировало* эту страницу, а вы собрались её изменять. Тогда ядро создаст новую страницу и скопирует туда данные. (Copy-on-write).
- Вы *переполнили стек*, замапленный с #codebox("MAP_GROWSDOWN"). Тогда ядро незаметно замаппит вам ещё памяти.
- ...
]
#slide(
background-image: none,
place-location: horizon + center)[
#cetz.canvas(length: 1cm, {
cetz.draw.content((0, 0), (30, -17), [])
let virtual_bg = cell-color(blue).background-color;
let virtual_stroke = cell-color(blue).stroke-color;
let physical_bg = cell-color(red).background-color;
let physical_stroke = cell-color(red).stroke-color;
let device_bg = cell-color(gray).background-color;
let device_stroke = cell-color(gray).stroke-color;
let arrow_color = gray;
let virt_addr_pos(i) = {
let section = 0
if i >= 4 { section = 1 }
if i >= 8 { section = 2 }
if i >= 12 { section = 3 }
if i >= 17 { section = 4 }
return (3.3 + i * 0.955 + section * 1.35, -6)
}
let phys_addr_pos(i) = {
return (1.7 + i * 0.5, -11.5)
}
cetz.draw.content((0, 0), (30, -8.5))[
#box(width: 100%, height: 100%, fill: virtual_bg)
]
cetz.draw.content((0, -8.5), (15, -17))[
#box(width: 100%, height: 100%, fill: physical_bg)
]
cetz.draw.content((15, -8.5), (30, -17))[
#box(width: 100%, height: 100%, fill: device_bg)
]
let rng = gen-rng(44)
let used_phys_addrs = ()
for i in range(17) {
let phys_addr = -1;
while phys_addr < 0 or phys_addr in used_phys_addrs {
(rng, phys_addr) = integers(rng, low: 0, high: 25)
}
used_phys_addrs = used_phys_addrs + (phys_addr,)
let a_pos = virt_addr_pos(i);
let b_pos = phys_addr_pos(phys_addr);
let c_pos = (a_pos.at(0), a_pos.at(1) - 1)
let d_pos = (b_pos.at(0), b_pos.at(1) + 4.0)
cetz.draw.bezier(a_pos, b_pos, c_pos, d_pos, stroke: 3pt + gray, mark: (end: ">"))
}
for i in range(17, 21) {
let disk_position = (21, -11);
let gpu_position = (25, -11);
let a_pos = virt_addr_pos(i);
let b_pos = if i < 19 { disk_position } else { gpu_position };
let c_pos = (a_pos.at(0), a_pos.at(1) - 4)
let d_pos = (b_pos.at(0), b_pos.at(1) + 2)
cetz.draw.bezier(a_pos, b_pos, c_pos, d_pos, stroke: 3pt + gray, mark: (end: ">"))
}
cetz.draw.content((0, 0), (30, -8.5))[
#box(
width: 100%, height: 100%, inset: 20pt,
)[
#align(left)[
= Виртуальные адреса
]
#let memdescr(content, pages) = {
return table.cell(colspan: pages)[
#set text(size: 24pt, fill: black, weight: "bold")
#raw(content)
]
}
#let addr(content, pages) = {
return table.cell(colspan: pages)[
#set text(size: 18pt, fill: blue, weight: "bold")
#raw(content)
]
}
#let dots = {
set text(size: 20pt, fill: black, weight: "black")
$dots.h.c$
}
#place(horizon + center)[
#table(
columns: 26,
rows: 3,
align: (x, y) => {
if y == 1 { horizon + center }
else { left }
},
inset: (x, y) => {
if y == 0 {
(left: 5pt, bottom: 10pt, right: 10pt, top: 5pt)
}
else if y == 1 {
(left: 10pt, right: 10pt, top: 20pt, bottom: 15pt)
}
else { (bottom: 7pt, left: 28pt) }
},
stroke: (x, y) => {
let st = 3pt + virtual_stroke
if y == 0 {
if x == 0 { none }
else {
(left: (dash: "dashed", paint: virtual_stroke))
}
}
else if y == 1 {
if x == 0 {
(right: st, top: st)
} else{
(left: st, top: st)
}
} else {
if x == 0 {
(right: st, bottom: st)
} else{
(left: st, bottom: st)
}
}
},
// Top row without borders
addr("", 1),
addr("0x100000000", 4),
addr("", 1),
addr("0x100001000", 4),
addr("", 1),
addr("0x300000000", 4),
addr("", 1),
addr("0x7f0000000000", 5),
addr("", 1),
addr("0x????", 4),
// Bottom row with borders except left and right
dots,
memdescr("code", 4),
dots,
memdescr("data", 4),
dots,
memdescr("stack", 4),
dots,
memdescr("heap", 5),
dots,
memdescr("mmio", 4)
)
]
]
]
// Нижняя часть: Физические адреса
cetz.draw.content((0, -8.5), (15, -17))[
#box(
width: 100%, height: 100%, inset: 20pt
)[
#align(left)[
#box(outset: 10pt, fill: physical_bg, radius: 5pt)[
= Физические адреса
]
]
#place(horizon + center)[
// Add a blue dot to used physical address
#show table.cell: it => {
if (it.x - 1) in used_phys_addrs {
set text(size: 50pt, fill: blue)
sym.dot.c
} else {
none
}
}
#table(
rows: 1.5cm,
columns: (0.7cm,) + (0.5cm,) * 25 + (0.7cm,),
align: horizon + center,
stroke: (x, y) => {
let st = 3pt + physical_stroke
if x == 0 {
(top: st, right: st, bottom: st)
} else {
(top: st, left: st, bottom: st)
}
},
[$dots.c.h$],
..([], ) * 25,
[$dots.c.h$]
)
]
]
]
cetz.draw.content((15, -8.5), (30, -17))[
#box(
width: 100%, height: 100%, inset: 20pt
)[
#align(left)[
#box(outset: 10pt, fill: device_bg, radius: 5pt)[
= Устройства
]
]
#place(horizon + center)[
#set text(weight: "bold", size: 20pt)
#table(
rows: 3cm,
columns: (4cm, ) * 2 + (1cm, ),
align: horizon + center,
column-gutter: 0.5cm,
stroke: none,
box(stroke: 3pt + black, width: 100%, height: 100%, radius: 10pt)[Диск],
box(stroke: 3pt + black, width: 100%, height: 100%, radius: 10pt)[GPU],
[...]
)
]
]
]
})
#place(center + bottom)[
#set block(spacing: 15pt)
#box(fill: luma(240), radius: 10pt, stroke: 1pt + black, inset: 10pt)[
*Виртуальные адреса можно связать не только с памятью, но и с устройствами.*
]
]
]
#slide(background-image: none)[
= Как связать виртуальный адрес с файлом на диске?
== #codebox(lang: "c", "mmap(void *start, size_t len, int prot, int flags, int fd, off_t off)")
#set list(marker: none)
#set text(weight: "semibold")
#v(1em)
- #codebox(lang: "c", "void* start") -- Виртуальный адрес или #codebox("NULL") (кратно #codebox(lang: "c", "PAGE_SIZE"));
- #codebox(lang: "c", "size_t len") -- Сколько байт связать (кратно #codebox(lang: "c", "PAGE_SIZE"));
- #codebox(lang: "c", "int prot") -- Права доступа к памяти;
- #codebox(lang: "c", "int flags") -- Флаги;
- #codebox(lang: "c", "int fd") -- Дескриптор открытого файла;
- #codebox(lang: "c", "off_t off") -- Смещение в файле.
#v(1em)
В зависимости от флагов, запись в эти адреса будет влиять на файл на диске. При этом оперативная память может вообще не использоваться.
]
#slide(background-image: none)[
= Флаги #codebox(lang: "c", "mmap()"):
#set list(marker: raw("|="))
#codebox(lang: "c", "int flags =")
- #codebox(lang: "c", "MAP_SHARED") -- изменения будут видны другим процессам;
- #codebox(lang: "c", "MAP_PRIVATE") -- изменения будут видны только текущему процессу;
- #codebox(lang: "c", "MAP_ANONYMOUS") -- не связывать с файлом;
- #codebox(lang: "c", "MAP_FIXED") -- использовать указанный адрес;
- #codebox(lang: "c", "MAP_GROWSDOWN") -- выделить стек, растущий вниз;
#set list(marker: raw("="))
#codebox(lang: "c", "int prot")
- #codebox(lang: "c", "PROT_READ") -- разрешить чтение выделенных адресов;
- #codebox(lang: "c", "PROT_WRITE") -- разрешить запись выделенных адресов;
- #codebox(lang: "c", "PROT_EXEC") -- разрешить исполнение выделенных адресов;
- #codebox(lang: "c", "PROT_NONE") -- запретить всё.
]
#focus-slide[
#set block(spacing: 30pt)
#text(size: 50pt)[
*Бонус*
]
#text(size: 25pt)[
*Используем видеопамять как оперативную память*
]
]
#title-slide[
#place(horizon + center)[
= Спасибо за внимание!
]
#place(
bottom + center,
)[
// #qr-code("https://github.com/JakMobius/courses/tree/main/mipt-os-basic-2024", width: 5cm)
#box(
baseline: 0.2em + 4pt, inset: (x: 15pt, y: 15pt), radius: 5pt, stroke: 3pt + rgb(185, 186, 187), fill: rgb(240, 240, 240),
)[
🔗 #link(
"https://github.com/JakMobius/courses/tree/main/mipt-os-basic-2024",
)[*github.com/JakMobius/courses/tree/main/mipt-os-basic-2024*]
]
]
] |
|
https://github.com/freundTech/typst-typearea | https://raw.githubusercontent.com/freundTech/typst-typearea/main/typearea.typ | typst | MIT License | #let typearea(
div: 9,
binding-correction: 0mm,
two-sided: true,
font-size: 11pt,
header-include: false,
footer-include: false,
header-height: 1.25em,
header-sep: 1.5em,
footer-height: 1.25em,
footer-sep: 3.5em,
..rest,
body
) = {
if div < 4 {
panic("div must be at least 4. Was " + div)
}
let width = 100% - binding-correction
let height = 100%
let content-height = height / div * (div - 3)
let header-space = header-height + header-sep
let footer-space = footer-height + footer-sep
let overwrite = (:)
if "header" in rest.named() {
overwrite.insert(
"header",
block(
above: 0pt,
below: 0pt,
breakable: false,
height: header-height,
rest.named().at("header"),
)
)
}
if "footer" in rest.named() {
overwrite.insert(
"footer",
block(
above: 0pt,
below: 0pt,
breakable: false,
height: footer-height,
rest.named().at("footer"),
)
)
}
let h-div = height / div
let w-div = width / div
let top-margin = h-div + if header-include { header-space } else { 0pt }
let bottom-margin = h-div * 2 + if footer-include { footer-space } else { 0pt }
set page(
..rest,
..overwrite,
header-ascent: header-sep,
footer-descent: footer-sep,
margin: if two-sided {
(
"top": top-margin,
"bottom": bottom-margin,
"inside": w-div + binding-correction,
"outside": w-div * 2,
)
// Auto currently defaults to left, as there is no way to check the text language
} else if rest.named().at("binding", default: auto) != right {
(
"top": top-margin,
"bottom": bottom-margin,
"left": w-div * 1.5 + binding-correction,
"right": w-div * 1.5,
)
} else {
(
"top": top-margin,
"bottom": bottom-margin,
"left": w-div * 1.5,
"right": w-div * 1.5 + binding-correction,
)
}
)
body
} |
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/VerbaliInterni/VerbaleInterno_231215/content.typ | typst | MIT License | #import "meta.typ": inizio_incontro, fine_incontro, luogo_incontro
#import "functions.typ": glossary, team
#let participants = csv("participants.csv")
= Partecipanti
/ Inizio incontro: #inizio_incontro
/ Fine incontro: #fine_incontro
/ Luogo incontro: #luogo_incontro
#table(
columns: (3fr, 1fr),
[*Nome*], [*Durata presenza*],
..participants.flatten()
)
= Sintesi Elaborazione Incontro
== Controllo Ortografico
Durante l'incontro, uno dei punti centrali è stato l'introduzione di un sistema automatizzato per il controllo ortografico all'interno della repository. Il team procederà con una fase di valutazione per determinare quale strumento possa risultare più idoneo.
== Gestione delle issue
È emersa una proposta significativa per la gestione delle attività con maggior efficienza: creare issue al manifestarsi delle necessità, svolgendo anche tutto il lavoro di assegnazione delle priorità, delle grandezze, sia durante le riunioni, sia durante gli stand-up. Inoltre è stato creato il nuovo tag "Ruolo" all'interno delle issue al fine di agevolare coloro responsabili di quella attività. La decisione è stata accolta positivamente dai partecipanti, che hanno visto in questa pratica un modo per ottimizzare il tempo durante le riunioni.
== Tecnologie
La tecnologia "Pydantic" per il linguaggio Python è stata riconosciuta come parte integrante per l'MVP, in modo da semplificare la verifica e la validazione del software, anche attraverso l'ampio uso di type hints, facilitando la dichiarazione e l'uso di tipi di dati all'interno del codice.
== Gestione del tempo
È stata presa un'altra significativa decisione riguardo l'adozione dell'assegnazione delle ore in multipli di trenta minuti (0.5 h), all'interno del foglio condiviso di time tracking, con l'obiettivo di evitare complicazioni non necessarie e garantire una gestione più precisa del tempo.
A questo si collega lo sviluppo di un'automazione in grado di aggiornare il _Piano di Progetto_ secondo quanto svolto dal team durante gli sprint. Oltre che a far risparmiare tempo ai Responsabili e agli Amministratori, questo script comporterà un notevole vantaggio in termini di sicurezza nell'elaborazione dei calcoli del consuntivo.
== Terminologia
Una discussione è stata condotta per esaminare la terminologia utilizzata nei documenti, e si è raggiunto un consenso sull'adozione del termine "Verificatore" anziché "Revisore", per essere più consistenti in tutti i documenti.
== Assegnazione dei ruoli
Su proposta dei componenti e a seguito di quanto indicato precedentemente, è stata assegnata la seguente distribuzione dei ruoli:
- <NAME>: Amministratore, Analista;
- <NAME>: Programmatore, Verificatore;
- <NAME>: Amministratore, Verificatore;
- <NAME>: Amministratore;
- <NAME>: Responsabile, Amministratore;
- <NAME>: Verificatore, Amministratore. |
https://github.com/takotori/PhAI-Spick | https://raw.githubusercontent.com/takotori/PhAI-Spick/main/sections/weiteres.typ | typst | #import "../utils.typ" : *
= Weiteres
== Differential Equations
1. *Bewegungsgleichung aufstellen:*\
Die Bewegungsgleichung für eine harmonische Schwingung lautet:
$ m dot.double(s)(t) \= -D s(t) $
Umgestellt ergibt sich:
$ dot.double(s)(t) \= -frac(D, m) s(t) $
2. *Lösung der Differentialgleichung:*\
Eine allgemeine Lösung dieser Differentialgleichung ist:
$ s(t) = A sin(sqrt(frac(D,m))t) + B cos(sqrt(frac(D,m)) t) $
Dabei sind $A$ und $B$ Konstanten, die durch die Anfangsbedingungen bestimmt werden.
3. *Erste Ableitung der Lösung:* $ dot(s) lr((t)) = A sqrt(D / m) cos lr((sqrt(D / m) t)) - B sqrt(D / m) sin lr((sqrt(D / m) t)) $
4. *Zweite Ableitung der Lösung:* $ dot.double(s) lr((t)) = - A lr((D / m)) sin lr((sqrt(D / m) t)) - B lr((D / m)) cos lr((sqrt(D / m) t)) $ $ dot.double(s) lr((t)) = - D / m lr((A sin lr((sqrt(D / m) t)) + B cos lr((sqrt(D / m) t)))) $ Dies ist konsistent mit der ursprünglichen Differentialgleichung.
5. *Anfangsbedingungen berücksichtigen:*
Setzen wir die Anfangsbedingungen ein, um $A$ und $B$ zu bestimmen.
- *Erste Anfangsbedingung:*
$s\(0) \= s_0$ $ s lr((0)) = A sin lr((0)) + B cos lr((0)) $ $ s_0 = B dot.op 1 arrow.r.double.long B = s_0 $
- *Zweite Anfangsbedingung:* $dot(s) lr((0)) = v_0$ $ dot(s) lr((0)) = A sqrt(D / m) cos lr((0)) - B sqrt(D / m) sin lr((0)) $ $ v_0 = A sqrt(D / m) arrow.r.double.long A = v_0 / sqrt(D / m) = frac(v_0 m, sqrt(D)) $
Zusammenfassend ergibt sich die Lösung der Bewegungsgleichung unter Berücksichtigung der Anfangsbedingungen: $ s lr((t)) = frac(v_0 m, sqrt(D)) sin lr((sqrt(D / m) t)) + s_0 cos lr((sqrt(D / m) t)) $
Diese Gleichung beschreibt die Bewegung eines harmonischen Oszillators unter Berücksichtigung der Anfangsbedingungen $s lr((0)) = s_0$ und $dot(s) lr((0)) = v_0$.
== Taschenrechner
- *Menu → 3 → 1* für solve()
- *Menu → 3 → 7 → 1* für Gleichungsystem lösen
- *doc → 7 → 2* für Umstellung von Grad auf Rad
- *Menu → 4 → 1* für Ableitungen
== Fundamentum Mathematik und Physik Inhalt
- *Trigometrie:* Seite 26
- *Ableitungen:* Seite 60
- *Kinematik:* Seite 81
- *Kräfte:* Seite 83
- *Energie:* Seite 85 |
|
https://github.com/CGMossa/extendr_presentation | https://raw.githubusercontent.com/CGMossa/extendr_presentation/main/main.typ | typst | // #import "@preview/polylux:0.3.1": *
#import "polylux/polylux.typ": *
#import themes.minimetropolis: *
#set math.text(font: "Fira Sans",
weight: "medium",
ligatures: true)
#set text(
font: "New Computer Modern",
ligatures: true, weight: "medium")
#set page(paper: "presentation-16-9")
// #show: university-theme.with(aspect-ratio: "16-9")
#show: metropolis-theme.with(
aspect-ratio: "16-9"
)
#set text(size: 25pt)
// #set strong(delta: 100)
#show link: set text(fill: fuchsia)
// #set par(justify: true)
#set footnote.entry(gap: 9pt, clearance: 0pt)
#show footnote.entry: set text(size: 15pt)
#show raw: set text(
font: "Cascadia Code",
weight: "medium",
ligatures: true)
#let r = body => [
// #show raw: set text(ligatures: true)
#let body = if type(body) == content and body.func() == raw { body.text } else { body }
#raw(lang: "r", body)
]
#let rust = body => [
// #show raw: set text(ligatures: true)
// SUGGESTION by PgSuper
#let body = if type(body) == content and body.func() == raw { body.text } else { body }
//
#raw(lang: "rust", body)
]
#[
#set text(size: 45pt)
#title-slide(
title: [`extendR`],
subtitle: [Seamless integration between R and Rust],
author: [
#set text(size: 23pt)
// #set text(justify: false)
#set par(justify: false)
<NAME>, and others
// "andy-thomason <andy<EMAIL>>",
// "<NAME>",
// "<NAME> <<EMAIL>>",
// "<NAME> <<EMAIL>>",
// "<NAME>",
// "<NAME> <<EMAIL>>",
// "<NAME> <<EMAIL>>",
#box([
#set text(size: 12pt)
_Others_: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
])
]
)
]
#slide(title: [What / Who uses R??])[
#quote([R is a _free_ software environment for _statistical_ computing and graphics.]) -- #link("https://www.r-project.org/", "r-project.org").
#pause
- R is an interpreted language written in C.
- R is the successor of S
- Functional? Object-oriented? Imperative?
// Multi-paradigm? Robust? Stable? Etc.
]
#slide(
title: [I'm Mossa.]
)[
// #set align()
// Formula training in (mathematical) Statistics,
// (not )
PhD Student in Veterinary Epidemiology,
MSc. in (mathematical) Statistics
Interests: Simulator-based inference, Statistical inference
Thesis is on Agent-based modelling of African Swine Fever between wild boars and domestic pigs
// #v(3em)
#grid(rows: 1, columns: 3,
column-gutter: 3.5em,
v(1.4em),
// #image("media/image7.png", width: 3em)
grid(
columns: 3,
image("media/image11.png", height: 3em),
[ `<==>` ],
image("media/image6.png", height: 3em)
),
box(fill: red, height: 1.1em, clip: true, stroke: black)[
DEADLINE: March 2024
]
)
Supervisors: <NAME>, <NAME> <NAME>
]
#slide(title: [Why not R?])[
R has many shortcomings, but for _us_..
// But in the context of disease modelling,
//space efficient programs are impossible
- Resource management;
- Concurrency support: Logging a model-run, should happen irrespective of the model calculations.
// Vectorised operations are great, but it doesn't vectorise custom
// written operations, like monte carlo-like procedures,
- No auto-vectorisation, even summing flat numbers is difficult, see #link("https://www.wikiwand.com/en/Kahan_summation_algorithm", [Kahan Summation Algorithm])
- Performance critical code is a multi-faceted challenge...
// Clarity suffers at the alter of performance.
// It is not unusual in R-circles to suggest things, that will
// increase the performance, to the detrement of clarity, modularity,
// to the extent that it obfuscates
]
#slide(title: [Worry not, R is meant to be extended])[
#set pad(right: 2em)
- Official documentation for extending R (#link("https://cran.r-project.org/doc/manuals/R-exts.html", "R-exts")) supporting `C/C++/Fortran`
// examples of automatically generate bindings from one language,
// to R
- Rcpp, cpp11, rJava, reticulate (python), RJulia,
// #link("https://cran.r-project.org/web/packages/Rcsdp/index.html", "Rcsdp")
R provides a C-API#footnote([R lingo: C-facilities]) that can be used as an ABI
]
#slide(title: [Why Rust?])[
- Compiled language like C/C++ with comparable performance
- Declarative memory management (no pointers!)
- No exceptions (#r(`tryCatch`) / #r(`on.exit`))
- No object-oriented programming, trait-based dispatch
- No garbage collector / heavy runtime
Rust's sales pitch is: Safety & security critical code for systems programming. Or "if it compiles, it works"
// References:
// #link("https://github.com/thoughtworks/epirust/wiki/Motivation-Behind-EpiRust", [Motivation Behind `EpiRust`]), by @kshirsagarEpiRustFrameworkLargescale2021, evaluating rust for ABMs
// @antelmiEvaluatingRustProgramming2019; Lange group uses Rust for their ASF wild boar model
]
// #slide()[
// // There are several frameworks for using agent-based modelling:
// // @correaRustagentbasedmodels2023,
// // @KrABMaga2023,
// // @kshirsagarEpiRustFrameworkLargescale2021
// The goal isn't to make general-purpose framework.
// Instead, custom-built models in Rust, and have the ability to amend / interact with these in R...
// Hence, `extendR`!
// ]
// #slide(title: [Why not our R models?])[
// They are convoluted, by design, as to make them work with R's computational constraints.
// // A "simple" construction will not be fast, i.e. using lists, and for-loops
// // An idea that comes in is using matrices / arrays, that
// // entails making all operations in that way
// // which makes the model unreadable, as the operations performed are non-standard to R, (like shuffling)
// They are still slow.
// - No ABC / SMC procedure can be built on top (to estimate epidemiological parameters on the available data)
// - No sufficiently complex mechanism can be implemented in them.
// // Advanced dispersal for WB gets too complicated
// // - Running the WB Model together with the DPP Model wasn't going to work anyways
// ]
#slide(title: [Use case])[
Problem: Logging some state of a complex simulator.
Solution:
```R
write.table(file = logging_file_name[['state_name']],
current_state, append = TRUE, col.names = FALSE)
```
(1) Initialize the table with #r(`col.names = TRUE`), (2) ensure that state can flattened, (3) ensure that the file matches the state being processed
]
#slide(title: [Use case ])[
- `if`-statement to determine whether to log (hot path)
#text(size: 0.8em)[
_Actual_: You could use #link("https://github.com/r-lib/debugme", "{debugme}"), and depend on `.onLoad`-behavior
]
- Buffered IO operation even in the case of a crash
- _Serialisation of state_
- Logging in another thread // than main thread
All of this can be done in Rust, with less effort and more guarantees
#pause
(skipping this unfortunately)
]
#slide(title: [What is `extendR`?])[
#align(center)[
`extendR` is composed of 3 parts
]
\[Rust / requires C\] \
System bindings through `libR-sys`
// Exposing R's C-API / C-facilities
\[Rust\] \
`extendr` that contains an API, procedural macros, and engine.
\[R\] \
`rextendr` an r-package interface to extendr
See #link("https://extendr.github.io/").
]
#slide(title: [Getting started with `extendR`])[
```r
remotes::install_github("extendr/rextendr")
usethis::create_package("vetEpiRust")
rextendr::use_extendr()
```
Rust project is in `./vetEpiRust/src/rust/`
#pause
Daily tool: #r("rextendr::document()").
#pause
`rextendr` also have `rust_source` and `rust_function` equivalent to `Rcpp`'s functions..
]
#slide(title: [`extendr`: Example])[
// explain rust syntax, mention lifetimes, doc-comment, last
// expressions has an implicit return
```rs
/// Return string `"Hello world!"` to R.
/// @export
#[extendr]
fn hello_world() -> &'static str {
"Hello world!"
}
```
#pause
`#[extendr]` exports the function to the surrounding r-package
`@export` exports the function to importing r-packages
// that updates the `NAMESPACE`-file when invoking `rextendr::document()`.
]
#slide(title: [Concludes the sales pitch for extendR!])[
That's it!
#pause
Rest of the talk is on extendR internals.
]
#slide(title: [Let's inspect the R's internals...])[
// #set text(size: 20pt)
```r
> hello_world()
[1] "Hello world!"
> .Internal(inspect(hello_world()))
@0x000001f379d4d6b0 16 STRSXP g0c1 [] (len=1, tl=0)
@0x000001f3747398c8 09 CHARSXP g1c2 [MARK,REF(5),gp=0x60,ATT] [ASCII] [cached] "Hello world!"
```
Regular R:
```r
> .Internal(inspect("Hello world!"))
@0x000001f3797b0510 16 STRSXP g0c1 [REF(2)] (len=1, tl=0)
@0x000001f3747398c8 09 CHARSXP g1c2 [MARK,REF(6),gp=0x60,ATT] [ASCII] [cached] "Hello world!"
```
]
#slide(title: [String interning])[
// #set align(horizon)
Strings in R are interned, i.e. they are static!
`=>` same address on the two strings!
#pause
#v(1em)
A string-vector is a vector of strings
`=>` String-vectors are not interned!
`==>` Different pointers
// Therefore the element in the string-type is the same
// data, but not the string vector!
]
// #slide(title: [ExtendR features])[
// - Conversions between R and Rust types.
// - Interfacing from R into Rust, by generating wrappers / `.Call`
// - Interfacing from Rust to R, by emulating R inside of Rust, and accessing R's C-API single-threaded
// - Running R inside of Rust
// - Publishing Rust-powered R-packages on CRAN
// ]
// #slide(title: [`extendr`: Conversions])[
// There are only #r("integer()") / #rust("i32") and #r("numeric()") / #rust("f64").
// For R to use a value, it needs to be allocated by R.
// For Rust to use a value, it can be allocated in either.
// *But R's API is single-threaded.*
// ]
// #slide(title: [`extendr` allocations])[
// Currently, `extendr` protects everything it allocates via R's C-API.
// Thus, `extendr` protects things that don't need protection.
// `R` supports local protection mechanism, which are efficient, and global protection mechanism, which are slower.
// ExtendR provides `Logicals`, `Integers`, `Doubles`, etc.
// and we can access them as native Rust slices, i.e. `&[T]` / `&mut [T]`.
// ]
// #slide(title: [`extendr`'s protection / `ownership`-module])[
// Currently, `extendr` treats `SEXP`s as Reference Counted variables.
// My proposal is to move into #rust("Box<_>") / #raw(lang:"c++", "std::unique_ptr") way of thinking.
// ]
#slide(title: [Overview!])[
1. Call a C-function from R.
2. Call a Rust-function from C.
#pause
Load the library (`.so`/`.dll`) in R, using `dyn.load("shlib_file")`.
// .so in unix and dll in windows
Then:
#pad(left: 1em)[
```R
// Help: .Call(.NAME, ..., PACKAGE)
return_value <- .Call("c_function_name", args)
```
]
]
#slide(title: [Overview])[
A C-function in Rust:
```rs
#[no_mangle]
pub extern "C" fn c_function_name() {
rust_function_name()
}
```
#pause
What about the data??
]
#slide(title: [Overview])[
In R:
- Fundamental types: #r(`integer()`) / #rust(`i32`) and #r(`numeric()`) / #rust("f64")
- `logical()` is a derivative of #rust("i32")
// - Strings are complicated
#pause
In R's C-API:
- Everything in R is a pointer-type called `SEXP`.
- R uses integers to indiciate types (C-style)
- e.g. `list()` is a vector of `SEXP`s.
]
#slide(title: [Overview])[
A C-function in Rust:
```rs
#[no_mangle]
pub extern "C" fn c_function_name(arg1: SEXP, arg2: SEXP) -> SEXP {
// convert arg1, arg2 from `SEXP`s to concrete types
let rust_return_value = rust_function_name(arg1, arg2);
let result = // same here..
result
}
```
]
#slide(title: [Requirements for the abstractions])[
Goal: Adapt the C-style API to a idiomatic rust API
- Define marshalling between R and Rust...
i.e. go from an r-type to a rust-type in a zero-cost manner
- Use R's GC protection mechanisms
// but don't annoy the user about this.
#pause
Minimal definition:
#pad(left: 1em)[
```rs
pub struct Robj {
inner: SEXP,
}
```
]
// can't include anything else, because then we break the seamless conversion from a pointer to a slice..
// Creating `Robj` incurs a registration in `ownership-module`, encurs a registration, not an increase in RC.
]
#slide(title: [Slices are vectors?])[
C-style `(ptr, len)` is represented as a slice in Rust #rust(`&[T]`) / #rust(`&mut [T]`).
// A rust pointer is either #rust(`*const T`) or #rust(`*mut T`)
// ... but this distinction is lost on R's C-api
#pause
`=>` `Robj` can only contain the pointer then!
Rust conversion:
```rs
pub const unsafe
fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T]
```
// it is here where you define all the specific conversions adopted
// also what about owned vectors?
#pause
Unprotect R-data (owned by Rust), once Rust is done with them
`=>` Add a `Drop`-mechanism to `Robj`
]
#slide(title: [Is this accurate?])[
R's protection mechanism are specific
- You allocate it, you protect it
- Returning to R means that _R now protects it_
- A protected _thing_ protects everything it contains
There is a stack-based fast protection mechanism in R...
But it has a vaguely undocumented limit of 10k-calls or so
`=>` Rust has to know about the protection
// There is an efficient protection mechanism to use in case of
// data intensive
]
#slide(title: [Strategies? [Audience question]])[
As an `extendR` contributor, \
#h(1em) you'll have to uncover what strategy works:
- Amend `Robj` with protection status?
- Use an `enum` / `union` instead to represent `Robj`?
- Amend the pointer `SEXP` with the protection information?
Any ideas from the audience?
]
#slide(title: [Proposal: the `enum`])[
```rs
pub enum Robj {
/// Protected by R, or a symbol
Permanent(RawRobj),
/// Unprotected / free R object
Raw(RawRobj),
/// Owned (by Rust), meaning it has to be freed by Rust
Owned(RawRobj),
}
```
// A permanent is like the internet strings, should we do string comparison or just look up the pointer? what is faster?
// We can have one result that is protected, and if we need
// to make micro protections
More on this on #link("https://github.com/extendr/extendr/issues/608", "#608") on GitHub...
]
// #slide(title: [Why is this an issue?])[
// - Allocating large vectors requires that we protect / unprotect locally.
// Using `PROTECT` / `UNPROTECT` is not possible, because there is an arbitrary limit of #sym.approx 10k on `PROTECT`-calls.
// - Benchmarks against `{Rcpp}`...
// ]
#slide(title: [Another topic: Embedding Rust types in R])[
Coarsing a granular rust-data to R is very limited
How about embedding rust data `T` in R?
// collapsing a granular Rust object to R might not be beneficial
// if that structure is needed for further processing
// Thus it should have parts where the rust code interacts with R data
// to have a state that is consumable by R
// See
// #link("https://github.com/gmbecker/SearchTrees", `{searchTrees}`).
]
#slide(title: [Embedding `T` in R])[
Embedding Rust data in R is done through
#rust(`ExternalPtr<T>`)#footnote(link("https://cran.r-project.org/doc/manuals/R-exts.html#External-pointers-and-weak-references", [External pointers and Weak references in R-exts.]))
```C
SEXP R_MakeExternalPtr(void *p, SEXP tag, SEXP prot);
```
`tag` is an identifier for type,
`prot` are accompanying R-data that is protected as long as `ExternalPtr<T>` is alive.
... there are other stuff
]
#slide(title: [Vision / Today])[
#side-by-side(
[
```rust
#[extendr]
struct Scenario {
rust_data: Vec<i32>,
#[extendr]
r_data: Integers
#[extendr(readonly)]
r_data_2: Rint,
// ???
ambigious_data: LikeRobj,
}
```
],
[
For methods, we already have
```rs
#[extendr]
impl Scenario {
pub fn update(&mut self) {
todo!()
}
}
```
]
)
// Register `r_data` in `prot`, and respect `pub`-status.
]
#slide(title: [Next steps])[
Writing self-protected types
Enable S4/RC/R6/S7 objects to use the above
]
// #slide(title: [Vision])[
// This enables composing R and Rust function, because both can interact with each other.
// \ \
// _ Prerequisites for this: Emulating R-data in Rust, interfacing without reallocation, generation of wrappers..
// _]
#slide(title: [Call for Participation])[
- Add instrumentation to our current r-object gc/protection
- Integrate with #link("https://docs.r-wasm.org/webr/latest/", "webR")
- #strike([Make `extendR` thread-safe], stroke: gray) write multithreading tests
- Integrate S7#footnote([
#link("https://cran.r-project.org/web/packages/S7/vignettes/S7.html", "Official S7 documentation") and
#link("https://www.jumpingrivers.com/blog/r7-oop-object-oriented-programming-r/", "What is S7? A New OOP System for R", )])
- Proc-macro for custom ALTREP#footnote([
#link("https://github.com/ALTREP-examples", "ALTREP examples")
])
#pause
We have a (friendly!) Discord!
#link("https://discord.gg/XAjKbDCW")
]
#slide(title: [References])[
#set text(size: 18pt)
// #bibliography("assessment.bib", title: none)
]
#focus-slide([
#set text(size: 69pt)
_*Graveyard*_])
#slide(title: [`extendr`'s R Exporting / Namespace])[
An R-package is a `DESCRIPTION` + `NAMESPACE`.
// a description is which namespaces are imported,
// and which are names are exported
An R-package has only one namespace #sym.subset module.
`#[extendr]` exports to R, and `@export` exports to `NAMESPACE`, i.e. other R-packages.
```rust
extendr_module! {
mod vetEpiRust;
fn hello_world;
}
```
]
#slide(title: [`extendr` another module?])[
```rs
extendr_module! {
mod wild_boar_model;
use landscape_generation;
use distance_weights_function;
impl sir_model;
fn run_until_outbreak;
}
```
`mod` defines current module, `use` exports another module, `fn` exports a function, `impl` exports a Rust `struct`.
]
#slide(title: [Challenges])[
Open problems:
- Can `#[extendr]`-functions call other `#[extendr]`-functions?
Esoteric API design: Embedding R abstractions in Rust
]
#slide(title: [What's an ECS])[
ECS is analogous to a database, i.e. `World`-type.
By describing entities (ids), to components (data), and systems (functions that requests `(id, data)`), it infers the *tables*#footnote("Archetypal storage") that the database should contain.
Functions describe which table they require, and the database caches this.
]
#slide(title: [Advantages of an ECS])[
Use an Entity Component System to build the model, and configure it with and w/e self-correcting processes
Describe and demonstrate:
- Concurrent logging & sparse logging due to change-detection in ECS frameworks
- Batched scenario repetitions by using Entity Relations in ECS framework
]
// #slide(title: [Flecs])[
// ]
|
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/复变函数/作业/hw6.typ | typst | #import "../../template.typ": proof, note, corollary, lemma, theorem, definition, example, remark, proposition,der, partialDer, Spec, seqLimit, seqLimitn
#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: note.with(
title: "作业6",
author: "YHTQ",
date: none,
logo: none,
withOutlined : false,
withTitle :false,
)
#set heading(numbering: none)
(应交时间为4月12日)
= p80
== 1
对于任意 $r > R$,$norm(f(x)) <= M R, forall norm(x) = r$ 给出柯西估计:
$
norm(f^(n) (0)) <= n! (M r^n)/r^n = n! M
$
而 $f^(n) (0)$ 在有界闭区域上当然有界,因此是有界的整函数,继而是常数,得证
== 3
设 $f$ 满足要求,令 $g(z) = e^(-z) f(z)$,则 $g(z)$ 是整函数且 $g(RR) = {1}$\
上式可以给出 $g$ 在 $0$ 处的任意阶导数为零,因此只能是 $1$,进而 $f = e^z$
== 4
设 $f(z, a) = e^(z + a)/(e^z e^a)$,则:
$
forall a in RR, z in RR, f(z, a) = 1
$
- 先设 $a in RR, g_a (z) := f(z, a)$,则 $g_a (RR) = {1}$,类似上面习题给出 $g_a = 1$
- 对称的,$forall z in RR$ 均有 $f(z, a) = 1$
- 对所有的 $a$,将有 $g_a (RR) = {1}$,同理可得 $g_a = 1$,这就完成了论证
== 5
假设 $overline(f) g$ 解析且 $g$ 不恒为零,此时注意到 $g$ 的零点集 $Z_g$ 是 $G$ 中离散的闭集,断言 $G - Z_g$ 仍是连通开集
- 首先,注意到 $Z_g$ 在 $G$ 中没有聚点,因此当然 $G - Z_g$ 中每个点是 $G$ 的内点,也是 $G - Z_g$ 的内点
- 其次,考虑到欧式空间中的开集连通等价于道路连通。而任取 $G$ 中一条道路,$Z_g$ 在其上的点至多有限个(否则在该道路上存在聚点,矛盾),而开集中有限个离散点当然可以绕开,因此 $G - Z_g$ 也是道路连通的
因此,$(overline(f) g)/g = overline(f)$ 是区域 $G - Z_g$ 上解析函数,继而:
$
"Re"(f) = (f + overline(f))/2
$
也是解析函数,然而它的值域只在 $RR$ 上,由之前的习题得它只能是常数。类似也可得 $"Im"(f)$ 也是常数,进而 $f$ 在 $G - Z_g$ 上是常数\
同时,注意到 $G - Z_g$ 在 $G$ 中稠密,因此 $f$ 是常数
= p83
== 1
=== a
注意到 $integral_(gamma)^() = - integral_(-gamma)^()$,由定义知结论成立
=== b
注意到 $integral_(gamma + sigma)^() = integral_(gamma)^() + integral_sigma$,由定义知结论成立 |
|
https://github.com/Icxolu/typst-qr | https://raw.githubusercontent.com/Icxolu/typst-qr/main/Readme.md | markdown | MIT License | # Typst-QR
This is a [`typst`](https://github.com/typst/typst) WASM plugin for generating QR code:
The plugin is implemented in Rust and is only a thin wrapper around
[`qrcode-rs`](https://crates.io/crates/qrcode-rs). It does not much more than
exposing the relevant customization options to `typst` and handle the serialization of the
arguments between WASM and `typst`. The resulting QR code is passed back to `typst` as a svg string,
which is then rendered as an image.
The plugin can be compiling using `cargo b --release`.
The `typst` file can be compiled using `typst c example.typ`.
> ℹ️ WASM plugins haven't landed in a released version of the `typst` compiler yet. So currently this requires a self compiled version from the master branch!
```typst
#set page(width: auto, height: auto)
#let typst_qr = plugin("target/wasm32-unknown-unknown/release/typst_qr.wasm")
#let qr(data, dark_color: black, light_color: white, has_quiet_zone: true, width: auto) = image.decode(
str(typst_qr.qr(
cbor.encode((
data,
dark_color.hex(),
light_color.hex(),
has_quiet_zone,
))
)),
format: "svg",
width: width
)
#figure(
qr("This QR code was generated dynamically by a typst plugin!", width: 200pt),
caption: [
A qr code generated by a typst wasm plugin!!
],
)
#figure(
qr(
"This QR code was generated dynamically by a typst plugin!",
dark_color: green,
light_color: blue,
has_quiet_zone: false,
width: 200pt
),
caption: [
A qr code with custom colors!
],
)
```
 |
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/layout/block-spacing.typ | typst | Apache License 2.0 | // Test block spacing.
---
#set block(spacing: 10pt)
Hello
There
#block(spacing: 20pt)[Further down]
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/root-02.typ | typst | Other | // Test precomposed vs constructed roots.
// 3 and 4 are precomposed.
$sqrt(x)$
$root(2, x)$
$root(3, x)$
$root(4, x)$
$root(5, x)$
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/VerbaliEsterni/VerbaleEsterno_231124/content.typ | typst | MIT License | #import "meta.typ": inizio_incontro, fine_incontro, luogo_incontro, company
#import "functions.typ": glossary, team
#let participants = csv("participants.csv")
#let participants_company = csv("participants_company.csv")
= Partecipanti
/ Inizio incontro: #inizio_incontro
/ Fine incontro: #fine_incontro
/ Luogo incontro: #luogo_incontro
== Partecipanti di #team
#table(
columns: (3fr, 1fr),
[*Nome*], [*Durata presenza*],
..participants.flatten()
)
== Partecipanti di #emph[#company]
#for member in participants_company.flatten() [
- #member
]
= Sintesi Elaborazione Incontro
== Argomenti affrontati
Di seguito si riportano gli argomenti affrontati durante la riunione:
=== Esposizione dei progressi avvenuti nello sprint
La Propontente ha da subito rivolto la sua attenzione verso i progressi compiuti nel corso dello sprint appena concluso.
La discussione si è articolata in due fasi distinte: inizialmente si sono discussi gli aspetti relativi al codice, successivamente si è discusso della parte relativa alla documentazione.
=== Avanzamenti nel codice
Per quanto concerne il codice gli obiettivi che si erano concordati erano l'*Implementazione di uno script di simulazione* e la *Creazione di un Ambiente Containerizzato*.
Il team ha presentato in modo chiaro e compatto i progressi ottenuti: e' stato implementato un file Docker Compose che orchestra un ambiente di esecuzione composto da uno script di simulazione scritto in Python che invia dati simulati a un'istanza di Kafka.
La Proponente ha affermato che il prodotto mostrato corrispondeva pienamente alle loro aspettative per questo sprint.
=== Progressi documentali
L'attenzione si è focalizzata sul documento di analisi dei requisiti.
Si sono discussi i casi d'uso riportati all'interno del documento e il team ne ha approfittato per esprimere alcuni dubbi irrisolti.
Si riportano i momenti salienti della discussione:
- *Necessità di interagire con i Sensori*: il team ha espresso il dubbio relativo all'inserimento di un caso d'uso che permetta all'attore di interagire direttamente con il singolo sensore. La Proponente ha affermato che per fare ciò servirebbe andare a realizzare un flusso inverso (da sistema di controllo a sensore) e dunque non si tratta di un requisito necessario ma al più opzionale. In aggiunta viene affermato che solitamente gli strumenti di Asset Management non vengono integrati nelle dashboard, ma trovano spazio in sezioni distinte;
- *Sistemi di allerting*: la Proponente ha invitato il team a riflettere sulle modalità di _allerting_ in quanto non erano state definite all'interno del documento. Si sono poi discusse alcune strategie per generare dati che possano effettivamente innescare il sistema di allerte. La Proponente ha affermato che tali dati non devono necessariamente provenire dal simulatore stesso, ma possono anche essere inviati a Kafka manualmente con lo scopo di scatenare un'allerta.
Non è stata espressa una vera e propria opinione, ma i requisiti riportati nel documento sembrano essere in linea con l'idea della Proponente.
=== Incontro di formazione su Docker
Alla luce del fatto che la quasi totalità dei componenti del nostro team ritiene che le proprie competenze in ambito Docker e tecnologie di containerizzazione siano ridotte, e che l'impiego di tali tecnologie rimane fondamentale al fine della buona riuscita del progetto, è stata avanzata l'idea di organizzare un incontro di allineamento sul tema in maniera tale da colmare le lacune esistenti.
La Proponente ha accettato la proposta e l'incontro è stato fissato per mercoledì 29 novembre.
=== Obiettivi dello sprint
L'intenzione iniziale della Proponente per questo sprint era quella di introdurre nel sistema la componente di persistenza dei dati simulati.
Una volta confermata l'intenzione del team di effettuare la prima revisione entro il 18 dicembre, è stato invece deciso di accorpare nello _Sprint Backlog_ anche la componente di visualizzazione che era stata inizialmente pianificata come parte dello sprint successivo. In altre parole, il team avrà realizzato una prima versione completa del _Proof of Concept_ entro la fine dello sprint attuale, programmata per il 7 Dicembre.
La decisione di cui sopra è stata motivata dalla volontà di consentire un ulteriore sprint, dedicato alla risoluzione di eventuali problemi.
Il team ha inoltre dichiarato la volontà di continuare la stesura della documentazione relativa al _Requirements and Technology Baseline_ (RTB).
=== Chiarimenti tecnici
- *Persistenza di Grafana:* La Proponente consiglia di assicurare la persitenza delle visualizzazioni in Grafana utilizzando i volumi Docker;
- *Formato JSON o divisione in colonne:* Viene consigliato di indagare sul comportamento di ClickHouse ed effettuare una scelta sulla base delle operazioni sui dati che si intendono effettuare;
- *ZooKeeper e KRaft:* La Proponente ha fatto notare che ZooKeeper quest'anno è stato sostituito in produzione da Kafka stesso con KRaft. I metadati erano inizialmente gestiti tramite ZooKeeper, ora vengono gestiti dal Broker stesso tramite KRaft. La necessità di rimuovere la dipendenza da ZooKeeper era dovuta alla presenza di alcune limitazioni relative alla scalabilità. Per quanto riguarda il progetto InnovaCity, mantenere ZooKeeper non sarebbe comunque problematico.
=== Prossimo Incontro
Il prossimo incontro è stato fissato per giovedì 7 dicembre. |
https://github.com/0x1B05/nju_os | https://raw.githubusercontent.com/0x1B05/nju_os/main/lecture_notes/content/29_持久数据的可靠性.typ | typst | #import "../template.typ": *
#pagebreak()
= 持久数据的可靠性
== 持久数据的可靠性
=== 持久存储:性能
存储:只要 CPU (DMA) 能处理得过来,我就能提供足够的带宽!
- Computer System 的 “industry” 传统——做真实有用的系统
=== 持久存储:可靠性
任何物理存储介质都有失效的可能
- 临时失效:Kernel panic;断电
- 永久失效
- 极小概率事件:战争爆发/三体人进攻地球/世界毁灭 😂
- 小概率事件:硬盘损坏 (大量重复 = 必然发生)
=== Failure Model (1): Fail-stop
磁盘可能在某个时刻忽然彻底无法访问
- 机械故障、芯片故障……
- 磁盘好像就 “忽然消失” 了 (数据完全丢失)
- 假设磁盘能报告这个问题 (如何报告?)
你的磁盘发生 fail-stop 会对你带来什么影响?
=== Failure Model (2): System Crash
真实的磁盘
- `bwrite` 会被磁盘缓存,并且以不可控的顺序被 persist
- 在任何时候,系统都可能 crash
- `bsync` 会等待所有 `bwrite` 落盘
#image("images/2024-02-27-12-10-06.png")
System crash 会对你带来什么影响? 真的没有影响?(Model checker 告诉你影响)
=== 更多的 Failure Mode
Data corruption
- 磁盘看起来正常,但一部分数据坏了
- [ An analysis of data corruption in the storage stack
](https://www.usenix.org/conference/fast-08/analysis-data-corruption-storage-stack)
(FAST'08)
Fail-slow
- Firmware bug; device error; wear-out; configuration; environment; ...
- [ Fail-slow at scale: Evidence of hardware performance faults in large
production systems
](https://www.usenix.org/system/files/login/articles/login_summer18_06_gunawi.pdf)
(FAST'18)
#image("images/2024-02-27-12-11-20.png")
== Redundant Array of Inexpensive Disks (RAID)
=== RAID: 存储设备的虚拟化
性能和可靠性,我们能不能全都要呢?
- Redundant Array of Inexpensive (Independent) Disks (RAID)
- 把多个 (不可靠的) 磁盘虚拟成一块非常可靠且性能极高的虚拟磁盘
- [ A case for redundant arrays of inexpensive disks
](https://dl.acm.org/doi/10.1145/971701.50214) (RAID) (SIGMOD'88)
- 一个 “反向” 的虚拟化
- 类比:进程/虚存/文件把 “一个设备” 虚拟成多份
遍地是黄金的年代:凑几块盘,掀翻整个产业链!
- “Single Large Expensive Disks” (IBM 3380), v.s.
- “Redundant Array of Inexpensive Disks”
=== RAID: Design Space
RAID (虚拟化) = 虚拟磁盘块到物理磁盘块的 “映射”。
- 虚拟磁盘块可以存储在任何虚拟磁盘上
- 虚拟磁盘可以并行
- 存储 >1 份即可实现容错
- RAID-0:更大的容量、更快的速度
- 读速度 x 2;写速度 x 2
- RAID-1:镜像 (容错)
- 保持两块盘完全一样
- 读速度 x 2;写速度保持一致
- 容错的代价
=== 容错的代价
浪费了一块盘的容量……
- 如果我们有 100 块盘
- 但假设不会有两块盘同时 fail-stop?
能不能只用 1-bit 的冗余,恢复出一个丢失的 bit?
- x = a ⊕ b ⊕ c ⊕ d
- a = x ⊕ b ⊕ c ⊕ d
- b = a ⊕ x ⊕ c ⊕ d
- c = a ⊕ b ⊕ x ⊕ d
- d = a ⊕ b ⊕ c ⊕ x
- 100 块盘里,99 块盘都是数据!
- Caveat: random write 性能
=== RAID-5: Rotating Parity
“交错排列” parity block!
#image("images/2024-02-27-12-14-37.png")
=== RAID: 讨论
更快、更可靠、近乎免费的大容量磁盘
- 革了 “高可靠性磁盘” 的命
- 成为今天服务器的标准配置
- 类似的里程碑
- #link("https://dl.acm.org/doi/10.1145/1165389.945450")[ The Google file system ]
(SOSP'03) 和 [ MapReduce: Simplified data processing on large clusters
](https://dl.acm.org/doi/10.5555/1251254.1251264) (OSDI'04) 开启 “大数据” 时代
RAID 的可靠性
- RAID 系统发生断电?
- 例子:RAID-1 镜像盘出现不一致的数据
- 检测到磁盘坏?
- 自动重组
== 崩溃一致性与崩溃恢复
=== 崩溃一致性 (Crash Consistency)
> Crash Consistency: Move the file system from one consistent state (e.g.,
before the file got appended to) to another atomically (e.g., after the inode,
bitmap, and new data block have been written to disk). >
(你们平时编程时假设不会发生的事,操作系统都要给你兜底)
磁盘不提供多块读写 “all or nothing” 的支持
- 甚至为了性能,没有顺序保证
- `bwrite` 可能被乱序
- 所以磁盘还提供了 `bflush` 等待已写入的数据落盘
=== File System Checking (FSCK)
根据磁盘上已有的信息,恢复出 “最可能” 的数据结构
#image("images/2024-02-27-12-16-11.png")
- [ SQCK: A declarative file system checker
](https://dl.acm.org/doi/10.5555/1855741.1855751) (OSDI'08)
- #link("https://dl.acm.org/doi/10.1145/3281031")[ Towards robust file system checkers ]
(FAST'18)
- “widely used file systems (EXT4, XFS, BtrFS, and F2FS) may leave the file system
in an uncorrectable state if the repair procedure is interrupted unexpectedly”
😂
=== 重新思考数据结构的存储
两个 “视角”
- 存储实际数据结构
- 文件系统的 “直观” 表示
- crash unsafe
- Append-only 记录所有历史操作
- “重做” 所有操作得到数据结构的当前状态
- 容易实现崩溃一致性
二者的融合
- 数据结构操作发生时,用 (2) append-only 记录日志
- 日志落盘后,用 (1) 更新数据结构
- 崩溃后,重放日志并清除 (称为 redo log;相应也可以 undo log)
=== 实现 Atomic Append
用 `bread`, `bwrite` 和 `bflush` 实现 `append()`
#image("images/2024-02-27-12-17-42.png")
1. 定位到 journal 的末尾 (bread)
2. bwrite TXBegin 和所有数据结构操作
3. bflush 等待数据落盘
4. bwrite TXEnd
5. bflush 等待数据落盘
6. 将数据结构操作写入实际数据结构区域
7. 等待数据落盘后,删除 (标记) 日志
=== Journaling: 优化
现在磁盘需要写入双份的数据
- 批处理 (xv6; jbd)
- 多次系统调用的 Tx 合并成一个,减少 log 的大小
- jbd: 定期 write back
- Checksum (ext4)
- 不再标记 TxBegin/TxEnd
- 直接标记 Tx 的长度和 checksum
- Metadata journaling (ext4 default)
- 数据占磁盘写入的绝大部分
- 只对 inode 和 bitmap 做 journaling 可以提高性能
- 保证文件系统的目录结构是一致的;但数据可能丢失
=== Metadata Journaling
从应用视角来看,文件系统的行为可能很怪异
- 各类系统软件 (git, sqlite, gdbm, ...) 不幸中招
- [ All file systems are not created equal: On the complexity of crafting
crash-consistent applications
](https://cn.bing.com/search?q=All+file+systems+are+not+created+equal%3A+On+the+complexity+of+crafting+crash-consistent+applications&form=APMCS1&PC=APMC)
(OSDI'14)
- (os-workbench 里的小秘密)
- 更多的应用程序可能发生 data loss
- 我们的工作: GNU coreutils, gmake, gzip, ... 也有问题
- [ Crash consistency validation made easy
](https://dl.acm.org/doi/10.1145/2950290.2950327) (FSE'16)
更为一劳永逸的方案:TxOS
- xbegin/xend/xabort 系统调用实现跨 syscall 的 “all-or-nothing”
- 应用场景:数据更新、软件更新、check-use……
- [ Operating systems transactions
](https://dl.acm.org/doi/10.1145/1629575.1629591) (SOSP'09)
|
|
https://github.com/HKFoggyU/hkust-thesis-typst | https://raw.githubusercontent.com/HKFoggyU/hkust-thesis-typst/main/mythesis.typ | typst | LaTeX Project Public License v1.3c | #import "hkust-thesis/imports.typ": *
#import "hkust-thesis/template.typ": documentclass
#let (
doc,cover-page,authorization,signature-page,abstract-page,toc-page,lof-page,lot-page,mainmatter,refmatter,reference-body,postmatter,appendix
) = documentclass(
config: (
twoside: true,
),
info: (
degree: "PhD",
title: ("Triggering", "the Forth Impact"),
keywords: ("Neon", "Genesis", "Evangelion"),
author: "<NAME>",
program: "Human Instrumentality Project",
department: "Department of NERV",
school: "School of SEELE",
supervisors: (
main: (
name: "<NAME>",
role: "Thesis Supervisor",
),
co: (
name: "Prof. Lilith",
role: "Thesis Co-supervisor",
),
),
department-head: (
name: "Prof. <NAME>",
position: "Head of Department",
),
committee: (
(
name: "Prof. AAA (Chairperson)",
department: "Department of Electronic and Computer Engineering"
),
(
name: "Prof. BBB (Supervisor)",
department: "Department of ECE"
),
(
name: "Prof. CCC (Co-Supervisor)",
department: "Department of ISD"
),
(
name: "Prof. DDD",
department: "Division of LIFS"
),
(
name: "Prof. EEE",
department: "Department of Physics"
),
(
name: "Prof. FFF (External Examiner)",
department: "Department of EE, University of UU"
),
),
submit-date: (
date: "13",
month: "August",
year: "2021",
),
defend-date: (
date: "8",
month: "March",
year: "2021",
),
city: "Geo Front",
bib-filename: "mythesis.bib",
),
)
/* ============================================================ */
#show: doc
#cover-page()
#authorization()
#signature-page()
#toc-page()
#lof-page()
#lot-page()
/* ============================================================ */
// Abstract
#[
#show: abstract-page
// Please write your abstract text *after* this line.
#lorem(250)
// Please write your abstract text *before* this line.
]
/* ============================================================ */
// Main matter
#[
#show: mainmatter
// Please write your main text *after* this line.
= Introduction <ch-introduction>
== Background <sec-background>
#lorem(100)
$ Delta E = m c^2 $ <EinsteinEM>
#lorem(40)
$ i hbar pdv(, t) ket(Psi(hat(r),t)) = [-hbar^2/(2m) nabla^2 + V] ket(Psi(hat(r),t)) = hat(H) ket(Psi(hat(r), t)) $ <Schrodinger>
#lorem(40)
@eqn-EinsteinEM and @eqn-ParPhy are both the energy and mass relation.
@eqn-Schrodinger is the Schrödinger equation.
#lorem(100)
== Recent Advancement
#lorem(100)
#figure(
rect(width: 20pt, height: 20pt, fill: blue),
caption: [A blue square. #lorem(40)],
) <blueSquare>
#lorem(20)
@fig-blueSquare is a blue square.
#lorem(100)
= Theory <ch-theory>
#lorem(30)
As discussed in @ch-introduction, @ch-theory, @sec-background, @sec-laser-intreaction-with-matter, @sec-LIFT, XXX.
Some inline equation $E^2 = p^2 + m^2$ and $E^2 = p^2 + m^2$ show something.
$ E^2 = p^2 + m^2 $ <ParPhy>
== Laser intreaction with matter <sec-laser-intreaction-with-matter>
#lorem(60)
#lorem(50)
=== laser induced forward transfer (LIFT) <sec-LIFT>
#lorem(50)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
) <redSquare>
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
) <redSquare2>
#lorem(20)
@fig-redSquare is a red square.
=== laser induced backward transfer (LIBT) <sec-LIBT>
#lorem(50)
==== LIBT on Cu and glass
#lorem(50)
= Experiment
#lorem(60)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
) <redSquare3>
#lorem(20)
#lorem(50)
== Laser induced graphene (LIG)
#lorem(80)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
) <redSquare4>
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
#lorem(20)
#lorem(50)
= Conclusion
#lorem(50)
// I cite some papers@andren_Microscopicmetavehicles_2021 @dong_Programmableheating_2022 @duy_Laserinducedgraphene_2018.
#lorem(100)
// Please write your main text *before* this line.
]
/* ============================================================ */
// Ref matter: Bibliography settings
#[
#show: refmatter
= References
#reference-body(
bib-filename: "mythesis.bib",
style: "institute-of-electrical-and-electronics-engineers",
full: true,
)
]
/* ============================================================ */
#[
#show: appendix
= List of Publications
// #reference-body(
// bib-filename: "mypublications.bib",
// style: "institute-of-electrical-and-electronics-engineers",
// full: true,
// )
*Known issue*: Typst does not support multiple bib files currently. We cannot simply feed two bib files into typst and get two bibliography pages at once. Hope it will be solved in future releases of typst!
= FYTGS requirements of thesis preparation
== TEC
== Writing
== Formatting
=== font
=== page
= Laser parameters
= Electronic circuits
#figure(
rect(width: 20pt, height: 20pt, fill: red),
caption: [A red square. #lorem(20)],
)
] |
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/foundations-07.typ | typst | Other | // Test failing assertions.
// Error: 9-15 expected boolean, found string
#assert("true")
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/layout/place-float-auto.typ | typst | Apache License 2.0 | // Test floating placement.
---
#set page(height: 140pt)
#set place(clearance: 5pt)
#lorem(6)
#place(auto, float: true, rect[A])
#place(auto, float: true, rect[B])
#place(auto, float: true, rect[C])
#place(auto, float: true, rect[D])
---
// Error: 2-20 automatic positioning is only available for floating placement
// Hint: 2-20 you can enable floating placement with `place(float: true, ..)`
#place(auto)[Hello]
---
// Error: 2-45 floating placement must be `auto`, `top`, or `bottom`
#place(center + horizon, float: true)[Hello]
---
// Error: 2-36 floating placement must be `auto`, `top`, or `bottom`
#place(horizon, float: true)[Hello]
---
// Error: 2-27 floating placement must be `auto`, `top`, or `bottom`
#place(float: true)[Hello]
---
// Error: 2-34 floating placement must be `auto`, `top`, or `bottom`
#place(right, float: true)[Hello]
|
https://github.com/mriganksagar/cv | https://raw.githubusercontent.com/mriganksagar/cv/main/metadata.typ | typst | Apache License 2.0 | // NOTICE: Copy this file to your root folder.
/* Personal Information */
#let firstName = "Mrigank"
#let lastName = "Sagar"
#let personalInfo = (
github: "mriganksagar",
phone: "+91 9069168030",
email: "<EMAIL>",
linkedin: "mrigank-sagar",
)
/* Language-specific */
// Add your own languages while the keys must match the varLanguage variable
#let headerQuoteInternational = (
"": [Experienced Full-Stack Engineer looking for a full time job],
"en": [Experienced Full-Stack Engineer looking for a full time job],
)
#let cvFooterInternational = (
"": "Curriculum vitae",
"en": "Curriculum vitae",
"fr": "Résumé",
"zh": "简历",
)
#let letterFooterInternational = (
"": "Cover Letter",
"en": "Cover Letter",
"fr": "Lettre de motivation",
"zh": "申请信",
)
#let nonLatinOverwriteInfo = (
"customFont": "Heiti SC",
"firstName": "王道尔",
"lastName": "",
// submit an issue if you think other variables should be in this array
)
/* Layout Setting */
#let awesomeColor = "darkblue" // Optional: skyblue, red, nephritis, concrete, darknight
#let profilePhoto = "../src/avatar.png" // Leave blank if profil photo is not needed
#let varLanguage = "" // INFO: value must matches folder suffix; i.e "zh" -> "./modules_zh"
#let varEntrySocietyFirst = false // Decide if you want to put your company in bold or your position in bold
#let varDisplayLogo = true // Decide if you want to display organisation logo or not
#let ifAIInjection = false // Decide if you want to inject AI prompt or not
#let keywordsInjectionList = ("Data Analyst", "GCP", "Python", "SQL", "Tableau",) // Leave blank if you don't want to inject keywords |
https://github.com/matetamasi/Medve-Automata-9 | https://raw.githubusercontent.com/matetamasi/Medve-Automata-9/master/arus.typ | typst | #let fickle = [
== Kalap nélkül
Ha *almát* kér,\
adj almát és vedd fel a kalapot.\
Ha *banánt* kér,\
adj banánt.
== Kalappal
Ha *almát* kér,\
adj banánt és vedd le a kalapot.\
Ha *banánt* kér,
adj almát.
]
#let frustrating = [
== Kalap nélkül
Ha *almát* kér,\
adj almát és vedd fel a kalapot.\
Ha *banánt* kér,\
adj banánt.
== Kalappal
Ha *almát* kér,\
adj banánt és vedd le a kalapot.\
Ha *banánt* kér,
adj banánt.
]
#let fancy = [
== Kalap nélkül, ülve
Ha *almát* kér,\
adj almát és vedd fel a kalapod.\
Ha *banánt* kér,\
adj banánt, és állj fel.
== Kalappal, ülve
Ha *almát* kér,\
adj almát és állj fel.\
Ha *banánt* kér,\
adj almát.
== Kalap nélkül, állva
Ha *almát* kér,\
adj banánt és ülj le.\
Ha *banánt* kér,\
adj banánt.
== Kalappal, állva
Ha *almát* kér,\
adj almát és ülj le.\
Ha *banánt* kér,\
adj banánt, és vedd le a kalapod.
]
#table( columns: 3,
[#fickle],
[#fickle],
[#fickle],
[#fickle],
[#fickle],
[#fickle],
[#fickle],
[#fickle],
[#fickle],
[#frustrating],
[#frustrating],
[#frustrating],
)
#pagebreak()
#table(columns: 3,
[#frustrating],
[#frustrating],
[#frustrating],
[#frustrating],
[#frustrating],
[#frustrating],
[#fancy],
[#fancy],
[#fancy],
)
#pagebreak()
#table(columns: 3,
[#fancy],
[#fancy],
[#fancy],
[#fancy],
[#fancy],
[#fancy],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
[#figure(image("./alma.jpg"))],
)
#table(columns: 2,
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
[#figure(image("./banan.jpg"))],
)
|
|
https://github.com/Myriad-Dreamin/tinymist | https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/syntaxes/textmate/tests/unit/basic/call-ident.typ | typst | Apache License 2.0 | #let f(..args) = f
#let g = (f: f)
#g.insert("g", g)
#f()
#f() []
#f() ()
#f ()
#f []
#f[] []
#(f())()
#( f())()
#(f() )()
#((f())(f()))
#f()()
#f(f)(f, f)
#(g.g.f)()
#list.item[]
#list[]
#{ f }()
#({ f })()
#{ f } ()
#({ f }) ()
#(list./*g*/item[])
#(list./*g*/ item[])
#(f /*g*/ ())
#{
("").join()
}
#test([#": "])
#{}
#assert(str(it.fields().label))
#{}
#table(..range(6))
|
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/05-features/feature-hierarchy.typ | typst | Other | #import "/lib/draw.typ": *
#import "/lib/glossary.typ": tr
#let start = (0, 0)
#let end = (1600, 1000)
#let big-card-width = 850
#let big-card-height = 700
#let big-card-radius = 50
#let big-card-fill = theme.bg
#let big-card-stroke-size = 5
#let big-card-stroke-color = gray
#let big-card-start-point = (400, 900)
#let big-card-offset = (50, -30)
#let big-card-count = 3
#let arrow-left = 200
#let arrow-right = 1400
#let arrow-y = {
let (_, sy) = big-card-start-point
sy - big-card-height / 2
}
#let big-card = (start) => with-unit((ux, uy) => rect(
start,
width: big-card-width,
height: big-card-height,
radius: big-card-radius,
fill: big-card-fill,
stroke: big-card-stroke-size * ux + big-card-stroke-color,
shadow: (dx: 8, dy: -8, fill: big-card-stroke-color, darken: 50%),
))
#let big-cards = {
for times in range(big-card-count - 1, -1, step: -1) {
let p = big-card-start-point.zip(big-card-offset.map(x => x * times)).map(((a, b)) => a + b)
if times == 0 {
arrow((arrow-left, arrow-y), (arrow-right, arrow-y), head-scale: 5)
}
big-card(p)
}
}
#let feature-card-width = 350
#let feature-card-height = 220
#let feature-card-radius = 30
#let feature-card-stroke-size = 3
#let feature-card-stroke-color = theme.main
#let feature-card = (start, color: none) => with-unit((ux, uy) => rect(
start,
width: feature-card-width,
height: feature-card-height,
radius: feature-card-radius,
fill: color,
stroke: feature-card-stroke-size * ux + feature-card-stroke-color,
))
#let feature-cards = with-unit((ux, uy) => {
let (bx, by) = big-card-start-point
let card-start = (bx + 50, by - 100)
let card-offset = (400, -300)
let title-text-size = 42
let title-text-y-offset = -30
let small-text-size = 24
let small-text-x-offset = -80
let small-text-y-offset = -70
let last-text-color = rgb("bdbcbc")
let data = (
bg-color: (rgb("b3b2b2"), rgb("c7c6c6"), rgb("ededed"), white),
title: (
[ccmp feature],
[scmp feature],
[kern feature],
[swsh feature],
),
rules: [
#set par(leading: 10 * ux)
lookup 1#linebreak()
#h(1em)rule 1#linebreak()
lookup 2#linebreak()
#h(1em)rule 1#linebreak()
#h(1em)rule 2
],
desc: (
[(必要,永远启用)],
[(用户明确要求启用)],
[(除非用户明确关闭,否则启用)],
[(用户未启用)],
)
)
for row in range(0, 2) {
for col in range(0, 2) {
let offset = card-offset.zip((col, row)).map(((v, t)) => v * t)
// card
let (ltx, lty) = card-start.zip(offset).map(((a, b)) => a + b)
let index = 2 * row + col
feature-card((ltx, lty), color: data.bg-color.at(index))
// title
let (cx, cy) = (ltx + feature-card-width / 2, lty)
let text-color = if index == 3 { last-text-color } else { black }
txt(text(fill: text-color, data.title.at(index)), (cx, cy), anchor: "cc", dy: title-text-y-offset, size: title-text-size * ux)
// rules
txt(text(fill: text-color, data.rules), (cx, cy), anchor: "lt", dx: small-text-x-offset, dy: small-text-y-offset, size: small-text-size * ux)
// description
let (cbx, cby) = (cx, cy - feature-card-height)
txt(data.desc.at(index), (cbx, cby), anchor: "ct", size: small-text-size * ux, dy: -small-text-size * 0.7)
// x cross for last card
if index == 3 {
let offset = feature-card-radius * (1 - calc.sqrt(2) / 2)
let (rbx, rby) = (ltx + feature-card-width, lty - feature-card-height)
segment(
(ltx + offset, lty - offset),
(rbx - offset, rby + offset),
stroke: 1 * ux + black,
)
segment(
(rbx - offset, lty - offset),
(ltx + offset, rby + offset),
stroke: 1 * ux + black,
)
}
}
}
})
#let graph = with-unit((ux, uy) => {
// mesh(start, end, (100, 100))
big-cards
feature-cards
let (ltx, lty) = big-card-start-point
let (rtx, rty) = (ltx + big-card-width, lty)
txt([_DFLT_], (ltx + 50, lty - 50), anchor: "lc", size: 42 * ux)
txt([_#tr[scripts]代码_], (ltx + 50, lty + 60), anchor: "cb")
arrow((ltx + 50, lty + 50), (ltx + 50 + 50, lty - 50 + 20), head-scale: 5)
txt([_dflt_], (rtx - 50, lty - 50), anchor: "rc", size: 42 * ux)
txt([_语言代码_], (rtx - 50 - 300, rty + 60), anchor: "rb")
bezier((rtx - 50 - 300, rty + 60 + 20), (rtx - 50 - 100, rty + 60 + 20), none, (rtx - 50 - 60, lty - 30))
arrow-head((rtx - 50 - 60, lty - 30), 1pt/ux * 5, theta: -60deg)
txt([_为其他语言#tr[script]#linebreak()设计的特性集_], (580, 50), anchor: "lc", size: 42 * ux)
bezier((580, 50), (530, 50), none, (520, 130))
arrow-head((520, 130), 1pt/ux * 5, theta: 90deg, point-at-center: true)
txt([Abcd], (arrow-left, arrow-y), anchor: "rc", dx: -20, size: 72 * ux)
txt(text(features: ("smcp",))[Abcd], (arrow-right, arrow-y), anchor: "lc", dx: 20, size: 72 * ux)
txt(image("smcp-icon.jpg", width: 100 * ux), (arrow-left + 50, arrow-y), anchor: "lc")
})
#canvas(end, start: start, width: 100%, graph)
|
https://github.com/zurgl/typst-resume | https://raw.githubusercontent.com/zurgl/typst-resume/main/resume/fr/education.typ | typst | #import "../../templates/resume/section.typ": *
#import "../../templates/resume/entry.typ": *
#import "@preview/fontawesome:0.1.0": *
#v(10pt)
#cvSection("Formation")
#cvEntry(
title: [Master en Mathématiques Appliquées],
society: [Université de Reims Champagne-Ardenne],
date: [2003 - 2006],
location: [France],
description: list(
[Mathématiques appliquées à la finance et à l'industrie: modélisation statistique, processus stocastiques, réseaux de neurones.],
[Thèse de Master: Application de l'équation de Black scholes pour le pricing de produits dérivés.],
),
logo: "reims.png",
tags: ("C++", "Langage R", "MATHLAB", "Pricing de produits financiers", "SAS", "Réseaux de neurones")
)
$/* ----------------------------- */$
#cvEntry(
title: [<NAME> Roosevelt, Reims],
society: [CPGE],
date: [2000 - 2003],
location: [France],
description: list(
[Classe de mathématiques Spéciales, option science de l'ingénieur.],
[Classe de mathématiques Supérieures, option informatique.],
),
logo: "cpge.png",
)
|
|
https://github.com/Lucas-Wye/tech-note | https://raw.githubusercontent.com/Lucas-Wye/tech-note/main/TechNote.typ | typst | #align(
center,
text(24pt)[
*TechNote*
],
)
#align(
center,
text(21pt)[
*Lucas-Wye*
],
)
#let date = datetime.today()
#align(
center,
text(17pt)[
#date.display()
],
)
#set heading(numbering: "1.1.1")
#show outline.entry.where(level: 1): it => {
v(12pt, weak: true)
strong(it)
}
#outline(indent: auto)
#pagebreak()
#include "src/ask.typ"
#pagebreak()
#include "src/howtosearch.typ"
#pagebreak()
#include "src/git.typ"
#pagebreak()
#include "src/Linux.typ"
#pagebreak()
#include "src/Kali.typ"
#pagebreak()
#include "src/cli_net_work.typ"
#pagebreak()
#include "src/Tmux.typ"
#pagebreak()
#include "src/docker.typ"
#pagebreak()
#include "src/vi_vim.typ"
#pagebreak()
#include "src/gcc.typ"
#pagebreak()
#include "src/java.typ"
#pagebreak()
#include "src/Python.typ"
#pagebreak()
#include "src/matlab.typ"
#pagebreak()
#include "src/LaTeX.typ"
#pagebreak()
#include "src/openmp.typ"
#pagebreak()
#include "src/Zotero.typ"
#pagebreak()
#include "src/ic.typ"
|
|
https://github.com/Sematre/typst-kit-thesis-template | https://raw.githubusercontent.com/Sematre/typst-kit-thesis-template/main/sections/02_abstract_de.typ | typst | = Zusammenfassung
#lorem(100) |
|
https://github.com/GYPpro/Java-coures-report | https://raw.githubusercontent.com/GYPpro/Java-coures-report/main/.VSCodeCounter/2023-12-15_05-15-05/results.md | markdown | # Summary
Date : 2023-12-15 05:15:05
Directory d:\\Desktop\\Document\\Coding\\JAVA\\Rep\\Java-coures-report
Total : 52 files, 7709 codes, 180 comments, 1740 blanks, all 9629 lines
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
## Languages
| language | files | code | comment | blank | total |
| :--- | ---: | ---: | ---: | ---: | ---: |
| Typst | 15 | 5,015 | 65 | 1,292 | 6,372 |
| Java | 35 | 2,591 | 103 | 436 | 3,130 |
| C++ | 1 | 102 | 12 | 10 | 124 |
| Markdown | 1 | 1 | 0 | 2 | 3 |
## Directories
| path | files | code | comment | blank | total |
| :--- | ---: | ---: | ---: | ---: | ---: |
| . | 52 | 7,709 | 180 | 1,740 | 9,629 |
| . (Files) | 3 | 236 | 9 | 56 | 301 |
| Report | 14 | 4,836 | 63 | 1,253 | 6,152 |
| rubbish | 1 | 76 | 0 | 17 | 93 |
| sis1 | 1 | 26 | 0 | 3 | 29 |
| sis10 | 7 | 823 | 49 | 114 | 986 |
| sis2 | 2 | 192 | 0 | 21 | 213 |
| sis3 | 2 | 63 | 5 | 11 | 79 |
| sis4 | 1 | 34 | 0 | 4 | 38 |
| sis5 | 5 | 501 | 31 | 81 | 613 |
| sis6 | 1 | 102 | 12 | 10 | 124 |
| sis7 | 2 | 124 | 8 | 19 | 151 |
| sis8 | 3 | 261 | 1 | 35 | 297 |
| sis9 | 10 | 435 | 2 | 116 | 553 |
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md) |
|
https://github.com/QijingLi/resume-template-in-typst | https://raw.githubusercontent.com/QijingLi/resume-template-in-typst/main/resume.typ | typst | MIT License | #let content = yaml("content.yaml")
#let par-leading = 4pt
#let font-highlight = "Helvetica Neue"
#let heading-font-size = 13pt
#let font-general = "Helvetica Neue"
#let font-size = (
heading-huge : 19pt,
heading-large : 16pt,
heading : 12pt,
desc : 8pt,
contact : 8pt
)
#show link : set text(blue)
#show heading : h => [
#set text(
size : 16pt,
font : font-highlight
)
#h
]
#let main = {
[
#line(length : 100%)
= Profile
#content.profile
= Education
#{
for place in content.education [
#par[
#set text(
size : font-size.heading,
font : font-general
)
#place.degree #place.major
#grid(
columns : (5fr, 2fr),
column-gutter : 3em,
link( place.university.link )[ #place.university.name ],
[ #place.from - #place.to ]
)
]
]
}
= Skills
#{
for skill in content.skills [
#par[
#set text(
size : font-size.desc,
)
#set text(
font : font-highlight,
)
*#skill.name*
#linebreak()
#skill.items.join(" • ")
]
]
}
= Work experiences
#{
for job in content.jobs [
#par(justify : false)[
#set text(
size : font-size.heading,
font : font-general
)
#grid(
columns : (5fr, 2fr, 3fr),
column-gutter : 3em,
[*#job.position* \ #link(job.company.link)[\@ #job.company.name]],
[#job.job-type],
[#job.from – #job.to ]
)
]
#par(
justify : false,
leading : par-leading
)[
#set text(
size : font-size.desc,
font : font-general
)
#{
for project in job.projects {
par[
#let descpt = project.description
#if descpt.len() > 0 [
#descpt \
]
#let key-achievs = project.key-achievements
#if key-achievs.len() > 0 {
[ \ *Highlights:* \ ]
for point in key-achievs [
• #point \
]
}
]
}
}
]
]
}
]}
#set page(numbering: "1/1")
/* Name, title and contact */
#{
grid(
columns : (5fr, 3fr),
column-gutter : 3em,
par()[
#text(
size : font-size.heading-huge,
font : font-general,
)[ *#content.name* ]
#text(
size : font-size.heading,
font : font-highlight,
top-edge : 0pt
)[ #content.title ]
],
par()[
#set text(
size : 8pt,
font : font-highlight,
)
/* The contacts are key-value pairs */
#for (k, v) in content.contacts {
/* Capitalize the first letter*/
let item = upper(k.first()) + k.slice(1)
if "email" in lower(k) [
#item : #link("mailto:" + v) \
] else if "phone" in lower(k) or "tel" in lower(k) [
#item : #link("tel:" + v) \
] else if "linkedin" in lower(k) [
#item : #link(v)
] else [
#item : #v \
]
}
]
)
}
/* Profile, Skills, Education, Work Experiece */
#main
|
https://github.com/Otto-AA/definitely-not-tuw-thesis | https://raw.githubusercontent.com/Otto-AA/definitely-not-tuw-thesis/main/tests/bachelor/test.typ | typst | MIT No Attribution | #import "/src/thesis.typ": *
#show: general-styles
#show: thesis.with(
lang: "en",
title: (en: "An ode for Lord Ipsum", de: "Eine Ode an Lord Ipsum"),
subtitle: (:),
thesis-type: (en: "Bachelor’s thesis", de: "Bachelorarbeit"),
academic-title: (en: "Bachelor of Science", de: "Bachelor of Science"),
curriculum: (en: "Media Informatics and Visual Computing", de: "Medieninformatik und Visual Computing"),
author: (name: "<NAME>", student-number: 11223344),
advisor: (name: "<NAME>", pre-title: "Univ.Prof.Dr."),
assistants: ((name: "Ipsinator", pre-title: "Sir"), (name: "Ipsi 2.0"), (name: "Ipsi 3.0")),
reviewers: (),
keywords: ("Lorem Ipsum"),
font: "DejaVu Sans",
date: datetime(year: 2024, month: 12, day: 1),
) |
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/list-08.typ | typst | Other | // Alignment shouldn't affect marker
#set align(horizon)
- ABCDEF\ GHIJKL\ MNOPQR
|
https://github.com/MrToWy/Bachelorarbeit | https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Template/customFunctions.typ | typst | #import "@preview/gloss-awe:0.0.5": *
#import "../abbreviations.typ": *
#import "../glossary.typ": *
#import "@preview/treet:0.1.0": *
#import "@preview/big-todo:0.2.0": *
#import "@preview/gentle-clues:0.9.0": *
#import "@preview/wrap-it:0.1.0": wrap-content
#import "@preview/hydra:0.3.0": hydra
#import "@preview/codly:1.0.0": *
#let colorize = true
#let useCaseColor = rgb("E28862")
#let useCaseColorLight = rgb("EEC0AB")
#let requirementColor = silver
#if not colorize {
useCaseColor = rgb("AAAAAA")
useCaseColorLight = rgb("CCCCCC")
}
#let sidePadding = 1em
#let topBotPadding = 3em
#let smallLine = line(length: 100%, stroke: 0.045em)
#let exampleText(content: none) = {
if(content == none){
return
}
[
#linebreak()
#text(weight: "semibold")[Beispiel: ]
#content
]
}
#let track(title, padding: topBotPadding/8, type: "E", example: none, label:none, content) = {
let c = counter(type)
c.step()
[
#box[
#context[
#pad(top: padding, bottom: padding)[
#text(weight: "semibold")[
#heading(outlined: false, depth: 9, numbering: (..nums) => {
let nums = nums.pos()
// the number to actually display
let num = nums.last()
// combine indent and formatted numbering
h(0em)
numbering(type + "1", num)
})[#smallcaps(title)]#label
] #linebreak()
#content
#exampleText(content: example)
]]]]
}
#let narrowTrack(title, type: "Info", label:none, content) = [
#track(title, padding: 0em, type: type, label:label, content)
]
#let useCase(nummer, name, kurzbeschreibung, akteur, vorbedingungen, hauptszenario) = [
#pad(left: 0em, right: 0em, rest: topBotPadding/2)[
#figure()[
#block()[
#show table.cell.where(x: 0): set text(weight: "bold")
#table(
columns: (0.4fr, 1fr),
fill: (x, y) => if calc.even(x) { useCaseColor } else { useCaseColorLight },
stroke: (x: none, y: 2.5pt + rgb("FFFF")),
[Name], text([UC] + str(nummer) + " - " + name, weight: "semibold"),
[Kurzbeschreibung], kurzbeschreibung,
[Akteur], akteur,
[Vorbedingungen], vorbedingungen,
[Hauptszenario], hauptszenario,
// [Nachbedingung], nachbedingung
)
]]]
]
#show figure: set block(breakable: true)
#let anforderung(funktional: true) = [
#let prefix = if(funktional) {"F"} else {"N"}
#figure(caption: if funktional {"Funktionale Anforderungen"} else {"Nicht-Funktionale Anforderungen"})[
#show table.cell.where(x: 0): set text(weight: "bold")
#let results = if(funktional) {csv("../anforderungen.csv")} else {csv("../nichtFuntionaleAnforderugen.csv")}
#let counter = 1
#table(
columns: (1fr, 9fr),
fill: (x, y) => if calc.even(x) { rgb("E28862") } else { rgb("EEC0AB") },
stroke: (x: none, y: 2.5pt + rgb("FFFF")),
[*Name*], [*Beschreibung*],
..results.enumerate(start: 1).map(((i, row)) => ([#prefix#(i)#label(row.first())],
row.last()
)).flatten(),
)
]
]
#let attributedQuote(label, body) = [
#pad(left: sidePadding, right: sidePadding, rest: topBotPadding)[
// use a box to prevent the quote from beeing split on two pages
#box(
quote(
block: true, quotes: true, attribution: [#cite(label.target, form: "author") #label])[
#body
])
]
]
#let diagramFigure(caption, plabel, filename, rendered:true) = [
#pad(left: sidePadding, right: sidePadding, rest: topBotPadding)[
#figure(
caption: caption,
kind: "diagram",
supplement: [Diagramm],
include "../Diagrams/" + (if (rendered){"rendered/"} else {""}) + filename + ".typ"
) #plabel
]]
#let codeFigure(caption, plabel, filename, annotations: none) = [
#pad(left: 0em, right: 0em, rest: topBotPadding/4)[
#figure(
caption: caption,
kind: "code",
supplement: [Code],
include "../Code/" + filename + ".typ"
) #plabel
]]
#let imageFigure(plabel, filename, pCaption, height: auto, width: auto) = [
#align(center)[
#pad(left: sidePadding, right: sidePadding, rest: topBotPadding)[
#figure(
image("../Images/" + filename, height: height, width: width),
caption: pCaption
) #plabel
]]]
#let imageFigureNoPad(plabel, filename, pCaption, height: auto, width: auto) = [
#align(center)[
#figure(
image("../Images/" + filename, height: height, width: width),
caption: pCaption
) #plabel
]]
#let treeFigure(pLabel, pCaption, content) = [
#pad(left: sidePadding, right: sidePadding, rest: topBotPadding)[
#par(leading: 0.5em)[
#figure(caption: pCaption)[
#align(left)[
#tree-list(content)]] #pLabel ]]
]
// header
#let getCurrentHeadingHydra(loc, topLevel: false, topMargin) = {
if(topLevel){
return hydra(1, top-margin:topMargin)
}
return hydra(2, top-margin:topMargin)
}
#let getCurrentHeading(loc, topLevel: false, topMargin) = {
let chapterNumber = counter(heading).display()
if(topLevel){
chapterNumber = str(counter(heading).get().at(0))
}
let topLevelElems = query(
selector(heading).before(loc),
loc,
)
if(topLevel){
topLevelElems = query(
selector(heading.where(level: 1)).before(loc),
loc,
)
}
let currentTopLevelElem = ""
if topLevelElems != () {
currentTopLevelElem = topLevelElems.last().body
}
return chapterNumber + " " + currentTopLevelElem
} |
|
https://github.com/vEnhance/1802 | https://raw.githubusercontent.com/vEnhance/1802/main/r03.typ | typst | MIT License | #import "@local/evan:1.0.0":*
#show: evan.with(
title: [Notes for 18.02 Recitation 3],
subtitle: [18.02 Recitation MW9],
author: "<NAME>",
date: [11 September 2024],
)
#quote(attribution: [Monokuma in _Danganropa_])[
Every human has regrets, has things they'd like to go back and change.
But I don't! 'Cause I'm a bear!
]
This handout (and any other DLC's I write) are posted at
#url("https://web.evanchen.cc/1802.html").
= Housekeeping
- *Office hours both Monday and Wednesday 10am*; rooms posted on Evan's site.
- *You can now check recitation answers on Evan's site.*
After the disaster that was the end of R02,
I have pre-uploaded a quick answer key to R03 this time.#footnote[This time I just used ChatGPT.
For future recitations, I might just type answers only,
continue using ChatGPT more, or something else; undecided.
Anyway, ChatGPT can make mistakes, so if you think something's wrong, flag me.]
So, now you can check your answer on your phone/tablet/laptop/etc.
But still feel free to check answers with me the old fashioned-way too.
(Figured it's better to give people more options.)
I'll try to also yap less today and give you time to actually talk to people more 1:1
as I move around, since that seemed more useful.
(Though Wed recitation is nicer than Mon, half as much stuff to cover.)
= Follow-ups from R02
- Errata from R02:
Last week in R02 I mistakenly claimed that $arrow(A B) times arrow(A C)$
is the area of the triangle $A B C$,
but it's actually the parallelogram's area.
Divide by $2$ to get the area of the triangle instead.
- Maulik says any drawing of $x$, $y$, $z$ axes satisfying right-hand rule is OK.
I'll follow Maulik.
- Remember that every vector has both a *direction* and a *magnitude*,
which both have geometric meaning (or insignificance); see table below.
#figure(
table(
columns: 3,
table.header([Object], [Direction], [Magnitude]),
[Normal vector to plane], [Perpendicular to plane], [_Irrelevant!_],
[Vector projection of $bf(v)$ to $bf(w)$], [Same as $bf(w)$], [Scalar projection],
[Cross product $bf(a) times bf(b)$], [Perpendicular to both $bf(a)$ and $bf(b)$], [Area of parallelogram]
),
kind: table
)
- Remember: *the $RR^2$ concept of slope is overridden by the concept of normal vector for $RR^3$*.
This is an important lesson from last time that I didn't call enough attention to,
so I want to re-emphasize it.
Anything you used to rely on slopes for, you should try to retrain yourself
to think of in terms of normal vector.
(I'll say this yet again when $nabla f(x,y)$ is introduced.)
= Some abstraction on linear maps <lintransf>
Matrices are super confusing because they're actually the "wrong" way to think about things.
Again, take 18.700 or 18.701 or
#link("https://web.evanchen.cc/napkin.html")[read my Napkin book], or come to office hours.
For now, a summary:
- A _linear transform_ $T : RR^n -> RR^m$ is _any_ map obeying $T(c bf(v)) = c T(bf(v))$
and $T(bf(v) + bf(w)) = T(bf(v)) + T(bf(w))$.
It's a chonky boy: for every $v in RR^n$, there's an output value $T(bf(v)) in RR^m$.
- A _matrix_ is a way of _encoding_ the _outputs_ of $T$ using as few numbers as possible.
- Pop quiz: if $T : RR^2 -> RR^2$ is a linear transform and
it's given that
$ T( vec(3,4) ) = vec(pi, 9) " and " T( vec(100, 100) ) = vec(0, 12) $
what are the vectors for $T( vec(103,104) )$ and $T( vec(203, 204) )$?
- More generally, if you know the outputs $T( vec(1,0) )$ and $T( vec(0,1) )$, then
that gives you enough information to figure out all other outputs of $T$, because
#eqn[
$ T( vec(a,b) ) = a T( vec(1,0) ) + b T( vec(0,1) ). $
<t-apply>
]
So the really, really important principle to understand is:
#idea[
A matrix *encodes all outputs* of a linear transformation $T$
by *writing the outputs* of $T(bf(e)_1)$, ..., $T(bf(e)_n)$ as a list of *column vectors*.
]
There's a philosophical axe I'm grinding.
In 18.02, a linear transform is defined as "act by a matrix".
I've never liked this definition for ten years.
I would rather define it as in the first bullet above (as in 18.701);
then say the matrix is a way to succinctly _encode_ or _identify_ the transformation.
(Think how that every human has a name that identifies them.)
If that made sense, you can explain the following two sentences
(the last page of Maulik's L3 notes):
- Multiplication of matrix by vector is defined so that
$M bf(v) = T(bf(v))$. (This is @t-apply.)
- Multiplication of two matrices defined so that $A B$ corresponds to _function composition_.
= Recitation problems from official course
/ 1: Consider the $2 times 2$ matrices $A = mat(2, 1; 1, 2)$ and $B = mat(- 3, 1; 2, 0)$.
/ 1a: Calculate $A B$ and $B A$.
/ 1b: Calculate the matrix $A^(- 1)$.
/ 1c: Check directly that $A A^(- 1) = A^(- 1) A = I$.
/ 1d: Consider the linear system of equations: $2 x + y = 7$ and $x + 2 y = 11$.
Write this system of equations as a single matrix equation and solve it
using $A^(- 1)$ from the previous question.
Check that your solution satisfies the original equations.
/ 2a: Viewed as a linear transformation, how does the matrix
$mat(2, 3; 0, 1)$ transform the unit square with vertices
$(0 , 0)$, $(0 , 1)$, $(1 , 0)$, $(1 , 1)$?
/ 2b: What is the $2 times 2$ matrix $A$ associated with reflection across the line $y = - x$?
/ 2c: Find the $3 times 3$ matrix corresponding to the linear transformation
$f$: $vec(x, y, z) arrow.r.bar vec(3 x - 2 z, x + y + z, 4 y + z)$.
/ 2d: Consider the linear transformation $f : bb(R)^2 arrow.r bb(R)^2$ where
$f (bf(v))$ is the vector projection of $bf(v)$ in the direction
$bf(w) = vec(1, 2)$. What is the $2 times 2$ matrix $A$ associated with
this linear transformation?
= Post-recitation notes
If you #strike[overslept] couldn't make it to recitation,
here's an elaboration of @lintransf as I presented it today.
== One matrix
Here's the answer to the pop quiz in @lintransf (I'll restate the question first):
#prob[
If $T : RR^2 -> RR^2$ is a linear transform and it's given that
$ T( vec(3,4) ) = vec(pi, 9) " and " T( vec(100, 100) ) = vec(0, 12) $
what are the vectors for $T( vec(103,104) )$ and $T( vec(203, 204) )$?
] <pop1>
#solution[
$
T( vec(103,104) ) = vec(pi, 9) + vec(0, 12) = vec(pi, 21) \
T( vec(203,204) ) = vec(pi, 9) + 2 vec(0, 12) = vec(pi, 33). #qedhere
$
/* (If you're using the 18.02 definition of linear transform,
then the above equations hold because matrix multiplication is distributive over addition.
Whereas in 18.700/18.70, the equations hold _by definition_.) */
]
Now more generally, here's the example with the made-up numbers
(I forget which random numbers the audience gave me for the actual recitation, sorry).
#prob[
If $T : RR^2 -> RR^2$ is a linear transform and it's given that
$ T( vec(1,0) ) = vec(1, 3) " and " T( vec(0,1) ) = vec(2, 4) $
what is $T( vec(50, 70) )$?
] <pop2>
#solution[
$ T( vec(50, 70) ) = 50 vec(1,3) + 70 vec(2,4) = vec(190, 430). #qedhere $
]
More generally, the second question shows that if you know
$T( vec(1,0) )$ and $T( vec(0,1) )$
you ought to be able to _calculate_ the output of $T$ at any other vector like $vec(50,70)$.
More generally, if $T : RR^n -> RR^m$,
then telling you the output of $T(bf(e)_1)$, ..., $T(bf(e)_n)$
is the smallest amount of information I can give you that lets you reconstruct any other output.
Now, I told you a linear transformation $T$ can be _encoded_ as a matrix.
This is really easy: glue the outputs of $T$ at the basis vectors and format it as an array:
$ T( vec(1,0) ) = vec(1, 3) " and " T( vec(0,1) ) = vec(2, 4)
<==> T " encoded as " mat(1,2;3,4) $
The matrix multiplication rule is then rigged to correspond to evaluation:
$ T( vec(50,70) ) = vec(190, 430) <==> mat(1,2;3,4) vec(50,70) = vec(190, 430). $
And indeed, you can now verify that if you calculate $mat(1,2;3,4) vec(50,70)$
as you were told to do in high school,
you get the same answer (and do the same calculations)
as we did for @pop2.
(In recitation, I actually circled where $1 dot 50$ and $2 dot 70$ showed up
in the solution to @pop2 on the board.)
#example(title: [Example: the identity matrix deserves its name])[
This also gives a "better" reason why the identity matrix is the one
with $1$'s on the diagonal than the "well try multiplying by it".
Let $I : RR^3 -> RR^3$ denote the 3d identity function.
To encode it, we look at its values at $bf(e)_1$, $bf(e)_2$, $bf(e)_3$:
$
I(bf(e)_1) = bf(e)_1 = vec(1,0,0),
#h(1em)
I(bf(e)_2) = bf(e)_2 = vec(0,1,0),
#h(1em)
I(bf(e)_3) = bf(e)_3 = vec(0,0,1).
$
We encode it as a matrix by writing the columns side by side, getting what you expect:
$ I " encoded as " mat(1,0,0;0,1,0;0,0,1). $
]
== Two matrices
Any time we have functions in math, we can _compose_ them.#footnote[
The $compose$ symbol means the function where you apply $T$ first then $S$ first.
So for example, if $f(x) = x^2$ and $g(x) = x+5$, then
$(f compose g)(x) = f(g(x)) = (x+5)^2$.
We mostly use that circle symbol if we want to refer to $f compose g$ itself without the $x$,
since it would look really bad if you wrote "$f(g$" or something.
]
So let's play the same game with a pair of functions $S$ and $T$,
and think about their composition $S compose T$.
#prob[
Let $T : RR^2 -> RR^2$ be a linear transform such that
$ T( vec(1,0) ) = vec(1, 3) " and " T( vec(0,1) ) = vec(2, 4). $
Then let $S : RR^2 -> RR^2$ be the linear transform such that
$ S( vec(1,0) ) = vec(5, 7) " and " S( vec(0,1) ) = vec(6, 8). $
Evaluate $S(T(vec(1, 0)))$ and $S(T(vec(0, 1)))$.
] <pop3>
#solution[
$
S(T(vec(1, 0))) = S(vec(1, 3)) = 1 vec(5,7) + 3 vec(6, 8) = vec(23, 31) \
S(T(vec(0, 1))) = S(vec(2, 4)) = 2 vec(5,7) + 4 vec(6, 8) = vec(34, 46). #qedhere
$
]
Now, $S compose T$ is _itself_ a function, so it makes sense to encode $S compose T$ as a matrix
too, using the answer to @pop3:
$
S(T(vec(1, 0))) = vec(23, 31) " and "
S(T(vec(0, 1))) = vec(34, 46)
<==>
S compose T " encoded as " mat(23, 34; 31, 46).
$
The matrix multiplication rule is then rigged to give the same answer
through the same calculation again:
$
mat(5,6;7,8) mat(1,2;3,4) = mat(23, 34; 31, 46).
$
This shows why the 18.700/18.701 definitions are better than the 18.02 ones.
In 18.02, the recipe for matrix multiplication is a _definition_:
"here is this contrived rule about taking products of columns and rows, trust me bro".
But in 18.700/18.701, the matrix multiplication recipe is a _theorem_;
it's what happens if you generalize @pop3 to eight variables
(or $n^2+n^2 = 2n^2$ variables for $n times n$ matrices).
As an aside, this should explain why matrix multiplication is associative but not commutative:
- Because #link("https://w.wiki/BAHh")[function composition is associative],
so is matrix multiplication.
- Because function composition is _not_ commutative in general,
matrix multiplication isn't either.
== Remark on recitation question 2
I want to point out that 2b/2c/2d are all doing the same thing:
they take the general shape
#quote[
Here is a particular linear transformation described in words;
please encode it as a matrix.
]
And you do all three problems by calculating the value of the transformation
at $bf(e)_i$, and then encoding it by just gluing them together.
Conceptually, you can fit those into the following table.
It's important to realize *all the work of the problem is the "values at basis"*;
and that *only uses up to R02 material*.
The only new step introduced in R03 is "to encode as matrix, glue your answers together".
#figure(
table(
columns: 4,
table.header([Q], [Transf.], [Values at basis], [Encoded matrix]),
[2b],
[$T = $ "Reflect around $y=-x$"],
[$ T(bf(e)_1) = vec(0,-1) \ T(bf(e)_2) = vec(-1,0) $],
[$mat(0,-1;-1,0)$],
[2c],
[$T = $ "ugly 3d equation above"],
[$ T(bf(e)_1) = vec(3,1,0) \ T(bf(e)_2) = vec(0,1,4) \ T(bf(e)_3) = vec(-2,1,1) $],
[$mat(3,0,-2;1,1,1;0,4,1)$],
[2d],
[$T = $ "vector projection as in R02"],
[$ T(bf(e)_1) = vec(1/5,2/5) \ T(bf(e)_2) = vec(2/5,4/5) $],
[$mat(1/5,2/5;2/5,4/5)$],
),
kind: table
)
= TODO
Note to self: write up the following things.
1. Rotation matrix example (this seems to give a lot of people trouble).
2. Analogous table with "is zero" and "is not zero" for numbers (corr to vectors above).
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/.VSCodeCounter/2024-10-17_10-15-14/results.md | markdown | # Summary
Date : 2024-10-17 10:15:14
Directory /home/yhtq/学习/课程
Total : 104 files, 39765 codes, 706 comments, 1463 blanks, all 41934 lines
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
## Languages
| language | files | code | comment | blank | total |
| :--- | ---: | ---: | ---: | ---: | ---: |
| Typst | 104 | 39,765 | 706 | 1,463 | 41,934 |
## Directories
| path | files | code | comment | blank | total |
| :--- | ---: | ---: | ---: | ---: | ---: |
| . | 104 | 39,765 | 706 | 1,463 | 41,934 |
| . (Files) | 2 | 472 | 125 | 42 | 639 |
| 代数学二 | 17 | 8,985 | 71 | 204 | 9,260 |
| 代数学二 (Files) | 2 | 394 | 4 | 2 | 400 |
| 代数学二/作业 | 12 | 3,025 | 54 | 82 | 3,161 |
| 代数学二/章节 | 3 | 5,566 | 13 | 120 | 5,699 |
| 几何学 | 1 | 2,646 | 10 | 123 | 2,779 |
| 复变函数 | 11 | 3,435 | 24 | 68 | 3,527 |
| 复变函数 (Files) | 1 | 2,358 | 4 | 46 | 2,408 |
| 复变函数/作业 | 10 | 1,077 | 20 | 22 | 1,119 |
| 常微分方程 | 9 | 5,222 | 42 | 71 | 5,335 |
| 常微分方程 (Files) | 1 | 2,911 | 8 | 37 | 2,956 |
| 常微分方程/作业 | 8 | 2,311 | 34 | 34 | 2,379 |
| 并行与分布式计算 | 1 | 140 | 0 | 3 | 143 |
| 抽象代数 | 15 | 7,509 | 258 | 464 | 8,231 |
| 抽象代数 (Files) | 1 | 13 | 6 | 2 | 21 |
| 抽象代数/作业 | 11 | 4,101 | 252 | 180 | 4,533 |
| 抽象代数/章节 | 3 | 3,395 | 0 | 282 | 3,677 |
| 数学模型 | 11 | 5,050 | 145 | 213 | 5,408 |
| 数学模型 (Files) | 1 | 2,443 | 3 | 50 | 2,496 |
| 数学模型/作业 | 6 | 937 | 30 | 19 | 986 |
| 数学模型/论文 | 4 | 1,670 | 112 | 144 | 1,926 |
| 数学模型/论文/pkuthss-typst | 4 | 1,670 | 112 | 144 | 1,926 |
| 数理逻辑 | 6 | 1,197 | 1 | 29 | 1,227 |
| 数理逻辑 (Files) | 1 | 484 | 0 | 10 | 494 |
| 数理逻辑/作业 | 5 | 713 | 1 | 19 | 733 |
| 机器学习数学导引 | 4 | 731 | 0 | 22 | 753 |
| 机器学习数学导引 (Files) | 1 | 286 | 0 | 8 | 294 |
| 机器学习数学导引/作业 | 3 | 445 | 0 | 14 | 459 |
| 经济学原理 | 13 | 1,149 | 10 | 42 | 1,201 |
| 经济学原理 (Files) | 1 | 315 | 2 | 28 | 345 |
| 经济学原理/hw | 12 | 834 | 8 | 14 | 856 |
| 计算方法B | 3 | 616 | 3 | 11 | 630 |
| 计算方法B (Files) | 1 | 418 | 3 | 10 | 431 |
| 计算方法B/code | 2 | 198 | 0 | 1 | 199 |
| 计算方法B/code/hw1 | 1 | 98 | 0 | 0 | 98 |
| 计算方法B/code/hw2 | 1 | 100 | 0 | 1 | 101 |
| 计算机网络 | 5 | 1,836 | 2 | 128 | 1,966 |
| 软件分析 | 6 | 777 | 15 | 43 | 835 |
| 软件分析 (Files) | 1 | 424 | 0 | 13 | 437 |
| 软件分析/hw | 5 | 353 | 15 | 30 | 398 |
Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md) |
|
https://github.com/NwaitDev/Typst-Accessibility-Template | https://raw.githubusercontent.com/NwaitDev/Typst-Accessibility-Template/main/Components/title.typ | typst | #let print_title(title, subtitle, font:"Droid Sans", colour:black) = {
if title=="" {
return []
}
set text(
font: font,
)
set par(
leading: 0.55em
)
set align(center)
rect(
width: 100%,
stroke: colour + 1pt,
)[
#text(
weight: "black",
size: 20pt,
)[
#title
]
\
#text(
size: 12pt,
fill: rgb(0, 0, 0, 150)
)[
#subtitle
]
]
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.