repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/visualize/shape-fill-stroke-02.typ
typst
Other
// Test stroke composition. #set square(stroke: 4pt) #set text(font: "Roboto") #square( stroke: (left: red, top: yellow, right: green, bottom: blue), radius: 100%, align(center+horizon)[*G*], inset: 8pt )
https://github.com/felsenhower/kbs-typst
https://raw.githubusercontent.com/felsenhower/kbs-typst/master/presentation.typ
typst
MIT License
#import "typst-modules/typst-slides/slides.typ": * #import "typst-modules/notes.typ/notes.typ": note, notes #import "typst-modules/typst-cd/typst-cd.typ": node, arr, commutative_diagram #import "typst-modules/typst-tablex/tablex.typ": tablex, cellx, colspanx, rowspanx #import "typst-modules/typst-algorithms/algo.typ" : * #import "typst-modules/typst-physics/physics.typ": * #import "hamburg.typ": * #import "latex-logo.typ": LaTeX #show "LaTeX": name => LaTeX #set page(fill: white) #show: slides.with( authors: "<NAME>", short-authors: "<NAME>", title: "Typst", subtitle: "Der LaTeX-Killer?", short-title: "Typst – Der LaTeX-Killer?", date: "02.05.2023", theme: slides-hamburg-theme() ) #let slides_font = ("Latin Modern Sans", "DejaVu Sans") #let small_size = 17pt #set text( font: slides_font, lang: "de" ) #show link: content => underline[#content] #let footnote = note #let footnotes() = notes( size: small_size, font: slides_font, line: line(length: 100%, stroke: 1pt + black) ) #let yes = text(blue, sym.checkmark) #let no = text(red, [*#sym.times*]) #let side-by-side-example( height: auto, a, b ) = [ #let box_params = ( radius: 5mm, stroke: 2pt + luma(235), height: height, width: 100%, inset: 5mm ) #text(size: small_size)[ #grid( gutter: 5mm, columns: 2, box(..box_params)[#a], box(..box_params)[#b] ) ] ] #let typst-example( height: 64%, filename ) = [ #let color = luma(235) #let box_params = ( radius: 5mm, stroke: 2pt + color, height: height, width: 100%, inset: 5mm ) #text(size: small_size)[ #grid( gutter: 5mm, columns: 2, box(..box_params)[ #raw(read(filename + ".typ"), lang: "typ") ], box(..box_params, fill: color)[ #box(fill: white, width: 100%, height: auto, inset: 2mm)[ #image(filename + ".svg", width: 100%) ] ] ) ] ] #let typst-source( filename ) = [ #let color = luma(235) #let box_params = ( radius: 5mm, stroke: 2pt + color, height: auto, width: 100%, inset: 5mm ) #text(size: small_size)[ #box(..box_params)[ #raw(read(filename + ".typ"), lang: "typ") ] ] ] #let quirk-slide(content) = { let num_images = 20 let images = num_images * (image("assets/vz123.svg"), ) let image_grid = grid(columns: num_images, ..images) slide()[ #align(center + horizon)[ #box(width: 110%, height: 88%)[ #align(center + top)[#image_grid] #align(center + horizon)[ #content ] #align(center + bottom)[#image_grid] ] ] ] } #new-section("Einführung") #slide(title: "Disclaimer")[ #one-by-one[ - Ich laber möglicherweise Müll. - Ich liebe LaTeX! ][ - (und jetzt auch Typst) ] ] #slide(title: "Agenda")[ + Einführung + Benutzung + Typesetting + Scripting + Module ($eq.est$ Packages) + Fazit ] #slide[ #align(center + horizon)[ #grid(columns: (50%, 30%), align(center + horizon)[ #image(height: 85%, "assets/reddit.png") ], align(center + horizon)[ #uncover("2-")[ #image(height: 85%, "assets/github.png") ] ] ) ] ] #slide(title: "Was ist Typst?")[ - Typst ist… #uncover("2-")[#line-by-line(start: 2)[ - ein Textsatzsystem und eine Markup-Sprache - superneu (Open Source Beta-Release: März 2023) - superschnell - supereinfach - typisiert - geschrieben ist Rust ]] ] #slide()[ #align(center + horizon)[ #image("assets/family_tree.png", height: 80%) #v(-5mm) #text(size: small_size)[ "Bild: Freepik.com". Dieses Cover wurde mit Ressourcen von Freepik.com erstellt. ] ] ] #slide(title: "Word vs. Markdown vs. LaTeX vs Typst")[ #table( columns: (auto, 1fr, 1fr, 1fr, 1fr), align: center + horizon, [], [*Word#footnote[oder LibreOffice, Google Docs, …]*], [*Markdown*], [*LaTeX*], [*Typst*], [WYSIWYG], yes, no, no, no, [sieht gut aus], no, [(#yes)], yes, yes, [Inhalt / Format getrennt], no, [(#yes)], yes, yes, [gut versionierbar], no, yes, yes, yes, [gut für Teamarbeit], no, [(#yes)], [(#yes)], yes, ) #footnotes() ] #slide(title: "LaTeX vs Typst")[ #let latex-no-typst-yes(text) = (uncover("1-")[#text], uncover("1-")[#no], uncover("1-")[#yes],) #let latex-yes-typst-no(text) = (uncover("2-")[#text], uncover("2-")[#yes], uncover("2-")[#no],) #let latex-maybe-typst-yes(text) = (uncover("3-")[#text], uncover("3-")[(#yes)], uncover("3-")[#yes],) #let latex-yes-typst-yes(text) = (uncover("4-")[#text], uncover("4-")[#yes], uncover("4-")[#yes],) #table( columns: (auto, 1fr, 1fr), align: center + horizon, [], [*LaTeX*], [*Typst*], ..latex-no-typst-yes[kompiliert schnell], ..latex-no-typst-yes[Gute Fehlermeldungen], ..latex-no-typst-yes[Einfache Syntax], ..latex-no-typst-yes[Einfaches Scripting], ..latex-yes-typst-no[Viele Packages], ..latex-yes-typst-no[Verbreitung], ..latex-maybe-typst-yes[UTF-8], ..latex-yes-typst-yes[Beschissener Name], ) ] #slide()[ #align(center + horizon)[ #image("assets/google-latex.png", height: 40%) #v(-5mm) #uncover("2-")[ #image("assets/google-typst.png", height: 40%) ] ] ] #slide()[ #align(center + horizon)[ #image("assets/chatgpt.png", height: 80%) ] ] #new-section("Benutzung") #slide(title: "Benutzung")[ + Command Line #uncover("2-")[ - https://github.com/typst/typst - `typst compile foo.typ` ] + Online App #uncover("3-")[ - https://typst.app ] + Visual Studio Code #uncover("4-")[ - https://github.com/nvarner/typst-lsp ] + IDE? #uncover("5-")[ - https://github.com/Cubxity/typstudio ] + ... ] #slide(title: "Tutorial")[ - Die folgenden Folien orientieren sich teilweise am #link( "https://typst.app/docs/tutorial/" )[Typst-Tutorial]. ] #new-section("Typesetting") #slide(title: "Mein erstes Dokument")[ #typst-example(height: 50%, "examples/01") ] #slide(title: "Mein erstes Dokument")[ #typst-example(height: 50%, "examples/02") ] #slide(title: "Mein erstes Dokument")[ #typst-example(height: 50%, "examples/14") ] #slide(title: "Aufzählungen")[ #typst-example(height: 50%, "examples/04") ] #slide(title: "Bilder")[ #typst-example(height: 50%, "examples/05") - Unterstützt wird PNG, JPG, GIF, und SVG ] #quirk-slide()[ PDF wird nicht unterstützt ಠ_ಠ ] #slide(title: "Bilder")[ #typst-example(height: 50%, "examples/06") ] #slide(title: "Bilder")[ #typst-example(height: 50%, "examples/07") ] #slide(title: "Bibliographie")[ #show "LaTeX": name => [#text[La]#text[TeX]] // wtf... #typst-example(height: 50%, "examples/08") - Format: Hayagriva oder BibLaTeX ] #slide(title: "Bibliographie")[ `bibliography.yml`: #text(size: small_size)[ #raw(read("examples/bibliography.yml"), lang: "yaml") ] ] #slide(title: "Mathe")[ #typst-example(height: 50%, "examples/09") ] #slide(title: "Tabellen")[ #typst-example(height: 50%, "examples/23") ] #slide(title: "Tabellen")[ #typst-example(height: 50%, "examples/25") ] #slide(title: "Tabellen")[ #typst-example(height: 50%, "examples/24") ] #slide(title: "Tabellen")[ #typst-example(height: 50%, "examples/26") ] #slide(title: "Formatierung")[ #typst-example(height: 66%, "examples/01") ] #slide(title: "Formatierung")[ #typst-example(height: 66%, "examples/10") ] #slide(title: "Formatierung")[ #typst-example(height: 66%, "examples/11") ] #slide(title: "Formatierung")[ #typst-example(height: 66%, "examples/12") ] #slide(title: "Formatierung")[ #typst-example(height: 66%, "examples/17") ] #slide(title: "Formatierung")[ #typst-example(height: 66%, "examples/18") ] #slide(title: "Formatierung")[ #typst-example(height: 66%, "examples/19") ] #slide(title: "Formatierung")[ #typst-source("examples/13") ] #quirk-slide[ Bisher gibt es keine `datetime`-Funktionalität. ] #new-section[Scripting] #slide(title: "Fibonacci")[ #v(4mm) #typst-example(height: 72%, "examples/16") ] #slide(title: "Fibonacci")[ #v(4mm) #typst-example(height: 72%, "examples/15") ] #slide(title: "Data Loading")[ #text(size: small_size)[ #raw(read("examples/sample.json"), lang: "json") ] #v(4mm) #typst-example(height: 45%, "examples/27") ] #slide(title: "Data Loading")[ - Typst unterstützt nativ - Plain Text - CSV - JSON - YAML - XML ] #slide(title: "Scripting")[ - Typen - Primitives und praktische Datenstrukturen - Kontrollstrukturen - `if`, `for`, `while`, … - Variablen werden explizit deklariert. - Scoping - Module ] #slide(title: "Typen")[ - Es gibt die Typen #align(right)[ #box(width: 95%, height: 35%)[ #align(left)[ #columns(4, [ - none - boolean - integer - float #colbreak() - length - angle - ratio - relative length #colbreak() - fraction - color - symbol - array #colbreak() - dict - function - *string* - *content* - … ]) ] ] ] - *Alles* ist implizit zu *content* konvertierbar ] #quirk-slide[ Bisher gibt es keine Type Hints o.ä. für \ benutzerdefinierte Funktionen und Variablen. ] #slide(title: "Lorem Ipsum")[ #typst-example(height: 66%, "examples/01") ] #slide( title: "Lorem Ipsum")[ /*title: "Lorem Ipsum" + footnote("https://de.wikipedia.org/wiki/Lorem_ipsum") )[*/ #side-by-side-example(height: 72%, raw(read("examples/lorem.py"), lang: "py"), uncover((beginning: 2))[ #raw(read("examples/lorem2.typ"), lang: "typ") ] ) /* #v(-5mm) #footnotes()*/ ] #new-section("Module") #slide(title: "Module")[ #v(10mm) - Viele#footnote( "(eigentlich selbstverständliche)" ) Dinge müssen über Module "nachgerüstet" werden - Derzeit gibt es *keinen* Package-Manager. - Viele hilfreiche Module gibt es hier: \ https://github.com/qjcg/awesome-typst #v(10mm) #footnotes() ] #slide(title: "Module")[ #typst-example(height: 50%, "examples/01") ] #slide(title: "Module")[ #typst-example(height: 50%, "examples/20") ] #slide(title: "Module")[ #typst-example(height: 50%, "examples/21") ] #slide(title: "Module")[ #typst-example(height: 50%, "examples/22") ] #slide(title: "Planned Features")[ #align(center + horizon)[ #image("assets/planned_features.png", width: 80%) ] ] #slide(title: "Templates")[ Es gibt Templates für jeden Scheiß: - Paper (IEEE, MLA, …) - Thesis - CV - Hausaufgaben - Briefe - Poster - Slides - … ] #slide(title: "Slides")[ - https://github.com/andreasKroepelin/typst-slides - Seht ihr hier gerade - Unterstützt Themes - https://github.com/lvignoli/diapo - Einfacher ] #slide(title: "Footnotes")[ - https://github.com/tbug/notes.typ - Konfigurierbar#footnote("foo") - https://github.com/saadulkh/typst-notes - Einfach #footnotes() ] #slide(title: "Bessere Tabellen")[ - https://github.com/PgBiel/typst-tablex #v(10mm) #align(center + horizon)[ #tablex( columns: 3, fill: red, align: right, colspanx(2)[a], (), [beeee], [c], rowspanx(2)[d], cellx(fill: blue, align: left)[e], [f], (), [g], // place this cell at the first column, seventh row cellx(colspan: 3, align: center, x: 0, y: 6)[hi I'm down here] ) ] ] #slide(title: "Diagramme")[ - https://github.com/johannes-wolf/typst-plot #v(-10mm) #grid( columns: 3, image("assets/typst-plot/tic-label.png", width: 110%), image("assets/typst-plot/parametric.png", width: 110%), image("assets/typst-plot/multi.png", width: 110%) ) #v(-50mm) ] #slide(title: "Diagramme")[ - https://github.com/johannes-wolf/typst-canvas #align(center + horizon)[ #image("assets/typst-canvas/3d-diagram.svg", width: 40%) ] ] #slide(title: "Diagramme")[ - https://gitlab.com/giacomogallina/typst-cd #v(-30mm) #text(size: small_size)[ #align(center + horizon)[ #commutative_diagram(width: 300pt, height: 200pt, node((0, 0), [$pi_1(X sect Y)$]), node((0, 1), [$pi_1(Y)$]), node((1, 0), [$pi_1(X)$]), node((1, 1), [$pi_1(Y) ast.op_(pi_1(X sect Y)) pi_1(X)$]), arr((0, 0), (0, 1), [$i_1$], label_pos: -1em, "inj"), arr((0, 0), (1, 0), [$i_2$], "inj"), arr((1, 0), (2, 2), [$j_1$], curve: -15deg, "surj"), arr((0, 1), (2, 2), [$j_2$], label_pos: -1em, curve: 20deg, "def"), arr((1, 1), (2, 2), [$k$], label_pos: 0, "dashed", "bij"), arr((1, 0), (1, 1), [], "dashed", "inj", "surj"), arr((0, 1), (1, 1), [], "dashed", "inj"), node((2, 2), [$pi_1(X union Y)$]) ) ] ] ] #slide(title: "Algorithmen")[ - https://github.com/platformer/typst-algorithms #side-by-side-example( [ #algo( title: "Fibonacci", parameters: ("n",) )[ if $n < 0$:#i\ return null#d\ if $n = 0$ or $n = 1$:#i\ return $n$#d\ return #smallcaps("Fibonacci")$(n-1) +$ #smallcaps("Fibonacci")$(n-2)$ ] ], [ #code()[ ```py def fibonacci(n): if n < 0: return None if n == 0 or n == 1: return n return fibonacci(n-1) + fibonacci(n-2) ``` ] ] ) ] #slide(title: "Physik")[ - https://github.com/Leedehai/typst-physics #typst-example(height: 50%, "examples/03") ] #slide(title: "Raytracer ಠ_ಠ")[ #v(-30mm) - https://github.com/SeniorMars/typst-raytracer #v(-20mm) #align(center + horizon)[ #rotate(90deg)[ #image("assets/typst-raytracer/mandel.png", height: 80%) ] ] #v(-100mm) ] #new-section[Fazit] #slide(title: "Fazit")[ #uncover("2")[ #v(-30mm) #align(center + horizon)[ #image("assets/thumbs-thumbs-up-kid.jpg", width: 65%) ] #v(-100mm) ] #uncover("3")[ - Typst ist überraschend ausgereift - Vermutlich passiert da in den nächsten Monaten noch was... - Das Scripting macht Spaß ] ]
https://github.com/artemist/typstcard
https://raw.githubusercontent.com/artemist/typstcard/canon/cards_a6_lettersheet.typ
typst
#{ set page("us-letter", margin: 0em) import "common.typ" let options = json("options.json") let cards = options.cards let args = options.args common.card_sheets(148mm, 105mm, 1in/16, args, cards) }
https://github.com/tshu-w/CV
https://raw.githubusercontent.com/tshu-w/CV/main/tmpl.typ
typst
/* References: 1. https://typst.app/project/p_Bky8MIksPGK39OpsflJw */ #import "@preview/fontawesome:0.2.0" as fa #let entry( tl: lorem(4), // "Role | Employer/Project", tr: datetime.today().display(), dl: [], // "Summary" dr: [], // "Location" details, ) = { tl; h(1fr); tr; linebreak(); if dl != [] or dr != [] { dl; h(1fr); dr; linebreak(); } details; } #let tmpl( author: "", lang: "en", // https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes use-serif: true, align: "left", inline-heading: true, textsize: 11pt, // The recommend resume text size is from `10pt` to `12pt` margin: (x: 1.5cm, y: 2cm), body ) = { let fonts = () if lang == "en" { if use-serif { fonts = ( "Georgia", "Palatino", "Garamond", "Linux Libertine", ) } else { fonts = ( "Helvetica Neue", "Gill Sans", "Optima", ) } } else if lang == "zh" { if use-serif { fonts = ( "Garamond", "Times New Roman", "Noto Serif CJK SC", "Source Han Serif SC", ) } else { fonts = ( "Helvetica Neue", "Gill Sans", "Optima", "Noto Sans CJK SC", "Source Han Sans SC", ) } } set document( title: author, author: author, ) set text( font: fonts, lang: lang, size: textsize, ) set page( paper: "a4", margin: margin, numbering: "1 / 1", ) set par( justify: true, leading: if lang == "en" {0.65em} else {0.65em}, ) show heading.where(level: 1): it => block([ #set text(size: 22pt, weight: "regular") #smallcaps(it.body) ]) show heading.where(level: 2): it => block([ #set text(size: textsize * 1.4, weight: "bold") #let hline = line(length: 100%, stroke: 1pt) #if inline-heading [ #it.body #box(width: 1fr, hline) ] else [ #pad(bottom: -15pt, it.body) #hline ] ]) show link: underline show bibliography: set text(lang: "en") body } #let TeX = style(styles => { // set text(font: "New Computer Modern") let e = measure("E", styles) let T = "T" let E = text(1em, baseline: e.height * 0.31, "E") let X = "X" box(T + h(-0.15em) + E + h(-0.125em) + X) }) #let LaTeX = style(styles => { // set text(font: "New Computer Modern") let a-size = 0.66em let l = measure("L", styles) let a = measure(text(a-size, "A"), styles) let L = "L" let A = box(scale(x: 105%, text(a-size, baseline: a.height - l.height, "A"))) box(L + h(-a.width * 0.67) + A + h(-a.width * 0.25) + TeX) })
https://github.com/rdboyes/resume
https://raw.githubusercontent.com/rdboyes/resume/main/modules_en/education.typ
typst
// Imports #import "@preview/brilliant-cv:2.0.2": cvSection, cvEntry, hBar #let metadata = toml("../metadata.toml") #let cvSection = cvSection.with(metadata: metadata) #let cvEntry = cvEntry.with(metadata: metadata) #cvSection("Education") #cvEntry( title: [Doctor of Philosophy: Public Health Sciences], society: [Queen's University], date: [2016 - 2023], location: [Kingston, ON], logo: image("../src/logos/QueensLogo_colour.png"), description: list( [Thesis: Development of a Canadian Index of Playability], [Courses: Statistics #hBar() Epidemiology], ), ) #cvEntry( title: [Master of Science: Epidemiology], society: [Queen's University], date: [2013 - 2015], location: [Kingston, ON], logo: image("../src/logos/QueensLogo_colour.png"), description: list( [Thesis: Patterns of Use and Comparative Safety of New and Old Anticholinergic Medications in Older Adults: a Population-Based Study], [Courses: Statistics #hBar() Public Health #hBar() Pharmacoepidemiology], ), ) #cvEntry( title: [Bachelor of Science (Honors)], society: [Queen's University], date: [2009 - 2013], location: [Kingston, ON], logo: image("../src/logos/QueensLogo_colour.png"), description: list( [Thesis: Caregiver Out-of-Pocket Costs for Octogenarian Intensive Care Unit Patients in Canada], [Courses: Life Sciences #hBar() Epidemiology #hBar() Mathematics #hBar() Statistics], ), )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/features-03.typ
typst
Other
// Test ligatures. fi vs. #text(ligatures: false)[No fi]
https://github.com/AU-Master-Thesis/thesis
https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/sections/3-methodology/study-4/mod.typ
typst
MIT License
#import "../../../lib/mod.typ": * == #study.H-4.full.n <s.m.study-4> // #jonas[Put the path tracking here separate from the global planning stuff?] // #include "expectation.typ"
https://github.com/Zuttergutao/Typstdocs-Zh-CN-
https://raw.githubusercontent.com/Zuttergutao/Typstdocs-Zh-CN-/main/Typst-markdown/Typst-一款rust编写的文档排版工具.md
markdown
# Typst-超越$LaTeX$的文档排版工具 ## 前言 > ***今天学了一天Typst,给我的感觉就是相较于$LaTeX$ ,Typst就是神!*** 我日常做笔记使用的软件是typora,typora的好处是所见即所得,即时渲染你所写的markdown语法。在日常使用中是十分便捷的。但是进行论文撰写的时候,文字排版显得格外重要,最常用的就是word。Word软件排版虽然很强大,但是需要下功夫去操作,与$\LaTeX$相比就稍微逊色一点。 $\LaTeX$ 具有专业的排版输出能力,产生的文档看上去就像“印刷品”一样,具有方便而强大的数学公式排版能力,很容易生成复杂的专业排版元素,如脚注、交叉引用、参考文献、目录等,强大的可扩展性。世界各地的人开发了数以千计的$\LaTeX$宏包用于补充和扩展 $\LaTeX$的功 能,能够促使用户写出结构良好的文档——而这也是$\LaTeX$ 存在的初衷<sup>[1]</sup>。同时,也存在着一些问题,(1) 安装包过大,安装相对较难;(2)相比“所见即所得”的模式有一些不便,为了查看生成文档的效果,用户总要不停地编译,这是最大的鸡肋(虽然也有插件可以即时查看,但是编译的速度过慢)。我之前也参照别人的模板写过一个天津大学的$\LaTeX$模板<sup>[2]</sup>。 最近,有团队开发了[typst](https://github.com/typst/typst)<sup>[3]</sup>,宣称“Typst 是一种新的基于标记的文档排版系统,其设计与 $\LaTeX$一样强大,同时更易于学习和使用”,可以创建和使用更加强大的模板。Typst 是编写任何长篇文本(如论文、文章、科学论文、书籍、报告和家庭作业)的不错选择。此外,Typst 非常适合任何包含数学符号的文档,例如数学、物理和工程领域的论文。最后,由于其强大的样式和自动化功能,它是任何具有共同样式的文档集(例如丛书)的绝佳选择。 作为喜欢吃螃蟹的人,第一时间就尝试了一下,感觉还行,就在此做一下介绍。 ## 安装 Typst提供预编译版和源码供开发者使用, 对于Linux或者macos可以使用如下命令安装: ```bash # macOS or Linux using Homebrew brew install typst # Arch Linux pacman -S typst ``` 对于windows用户直接去他们的[仓库](https://github.com/typst/typst/releases/tag/v23-03-28)<sup>[4]</sup>下载编译好的文件放到自己的目录,并添加环境变量即可使用。 Typst官方也提供了网页版(https://typst.app/)供使用 当安装了Typst之后,可以使用如下命令将撰写的代码转换为pdf: ```bash typst file.typ # 指定生成目录 typst path/to/source.typ path/to/output.pdf ``` 也可以一边修改源文件一边编译: ```bash typst --watch file.typ ``` 因为我使用的是vscode,最近有开发者开发了`Typst LSP` vscode插件(vscode扩展仓库下载),结合pdf预览插件就可以实现即时预览。效果如下图所示: ![1](C:\Users\CASEA\Desktop\Typst\1.gif) ## 使用 ### 简单的示例 如下为官方给出的例子,具体效果见上图。 ```typst #set page(width: 10cm, height: auto) #set heading(numbering: "1.") = Fibonacci sequence The Fibonacci sequence is defined through the recurrence relation $F_n = F_(n-1) + F_(n-2)$. It can also be expressed in _closed form:_ $ F_n = round(1 / sqrt(5) phi.alt^n), quad phi.alt = (1 + sqrt(5)) / 2 $ #let count = #let nums = range(1, count + 1) #let fib(n) = ( if n <= 2 { 1 } else { fib(n - 1) + fib(n - 2) } ) The first #count numbers of the sequence are: #align(center, table( columns: count, ..nums.map(n => $F_#n$), ..nums.map(n => str(fib(n))), )) ``` ### Markdown|$LaTeX$|Typst对比 | | Typst | $LaTeX$ | Markdown | | -------- | ------------------- | ------------------------------------------ | -------------------------- | | 标题 | \=,\=\=,\=\=\= | \section,\subsection,\subsubsection | \#,\##,\### | | 有序列表 | + | \begin{enumerate} \item[ ] \end{enumerate} | 1. 2. | | 无序列表 | - | \begin{itemize} \item[+] \end{itemize} | -,+ | | 图片引用 | #image("file") | \includegraphics{file} | !\[filename\]\("file"\) | | 斜体 | \_ \_ | \textit | \_ \_ | | 加粗 | \* \* | \textbf | \*\* \*\* | | 代码块 | ``` | \begin{verbatim} \end{verbatim} | ``` | | 公式 | \$ \$ | \begin{equation} \end{equation} | 行内\$ \$,行间\$\$ \$\$ | | 链接 | #link("x.com")[des] | \href{x.com}{des} | \[des\]\(x.com\) | | 表格 | #table() | \begin{tabular} \end{tabular} | \| \| \| | 从上表可得,相对来说Typst的使用命令还是比较简洁的。 ### 语法 #### 图片 直接引用图片 `#image("1.png",width:70%)` 使用`#figure`设置图片格式,在figure后面可以添加`<>`label并在文中使用@引用。 ```typst #figure( image("glacier.jpg", width: 70%), caption: [ _Glaciers_ form an important part of the earth's climate system. ], ) ``` ```typst Glaciers as the one shown in @glaciers will cease to exist if we don't take action soon! #figure( image("glacier.jpg", width: 70%), caption: [ _Glaciers_ form an important part of the earth's climate system. ], ) <glaciers> ``` <img src="2.png" style="zoom:75%;" /> #### 公式 Typst与markdown不同,有自己的公式语法,一个是不管是行间还是行内公式,都是用\$ \$,另一个是不需要在特殊变量名前加斜杠\\。如果想不改变字体,可以使用""引用 ``` The equation $Q = rho gamma A v + C$ defines the glacial flow rate. The flow rate of a glacier is given by the following equation: $ Q = rho A v + "time offset" $ Total displaced soil by glacial flow: $ 7.32 beta + sum_(i=0)^nabla (Q_i (a_i - epsilon)) / 2 $ ``` <img src="3.png" style="zoom:75%;" /> #### 文字 使用text自定义文本样式,有两种定义方法:(1) `#set text(font:"18pt")` 之后的文字都按此格式;(2)`#text(font:18pt)[text ]`,只修改此处的文字。 text具有如下的参数,需要注意的是,如果使用键值对需要加引号\"! ```python text( set font: stringarray, set fallback: boolean, set style: string, set weight: integerstring, set stretch: ratio, set size: length, set fill: color, set tracking: length, set spacing: relative length, set baseline: length, set overhang: boolean, set top-edge: lengthstring, set bottom-edge: lengthstring, set lang: string, set region: nonestring, set dir: autodirection, set hyphenate: autoboolean, set kerning: boolean, set alternates: boolean, set stylistic-set: noneinteger, set ligatures: boolean, set discretionary-ligatures: boolean, set historical-ligatures: boolean, set number-type: autostring, set number-width: autostring, set slashed-zero: boolean, set fractions: boolean, set features: arraydictionary, content, ) -> content ``` ```typst #set text( font: "New Computer Modern", size: 10pt, style:"italic", ) With a set rule. #emph(text(blue)[ With a function call. ]) #text(28pt)[With a set rule.] With a set rule. ``` <img src="4.png" style="zoom:50%;" /> #### 页面 通过`#set page()`设置页面格式 ```typst page( set paper: string, set width: autolength, set height: autolength, set flipped: boolean, set margin: autorelative lengthdictionary, set columns: integer, set fill: nonecolor, set numbering: nonestringfunction, set number-align: alignment2d alignment, set header: nonecontent, set header-ascent: relative length, set footer: nonecontent, set footer-descent: relative length, set background: nonecontent, set foreground: nonecontent, content, ) -> content ``` ```typst #set page( paper: "a6", margin: (x: 1.8cm, y: 1.5cm), ) ``` #### 段落 通过`#set par()`设置段落格式 ```typst par( set leading: length, # 行间距 set justify: boolean, # 是否行中对齐文本 set linebreaks: autostring, # 如何确定换行符 set first-line-indent: length, # 首行缩进 set hanging-indent: length, # 除首行外其余行的缩进 set body: content, ) -> content ``` ```typst #set par(first-line-indent: 2em, justify: true) We proceed by contradiction. Suppose that there exists a set of positive integers $a$, $b$, and $c$ that satisfies the equation $a^n + b^n = c^n$ for some integer value of $n > 2$. Without loss of generality, let $a$ be the smallest of the three integers. Then, we ... ``` <img src="5.png" style="zoom:75%;" /> #### 标题 通过`#set heading()`设置标题格式 ```typst heading( set level: integer, # 标题深度 set numbering: nonestringfunction, # 标题序号 set outlined: boolean, # 下划线 content, ) -> content ``` ``` #set heading(numbering: "1.a)") = Introduction In recent years, ... == Preliminaries To start, ... #set heading(numbering: "1.") = Introduction #lorem(10) == Background #lorem(12) == Methods #lorem(15) ``` <img src="6.png" style="zoom:50%;" /> ```typst // 高度自定义标题格式 #show heading.where( level: 1 ): it => block(width: 100%)[ #set align(center) #set text(12pt, weight: "regular") #smallcaps(it.body) ] #show heading.where( level: 2 ): it => text( size: 11pt, weight: "regular", style: "italic", it.body + [.], ) ``` #### 函数 函数调用是typst的特色,用户可以定义并调用函数来自定义输出格式。 可以通过指定参数列表后跟 => 和函数体来创建匿名函数。如果您的函数只有一个参数,则参数列表周围的括号是可选的。匿名函数主要用于显示规则。 使用`#let`设置变量,通过`#`调用 ```typst // 调用函数 #list([A], [B]) #enum(start: 2)[A][B] #list[A][B] #let alert(body, fill: red) = { set text(white) set align(center) rect( fill: fill, inset: 8pt, radius: 4pt, [*Warning:\ #body*], ) } #alert[ Danger is imminent! ] #alert(fill: blue)[ KEEP OFF TRACKS ] # 匿名函数 #show "once?": it => [#it #it] once? #let amazed(term) = box[✨ #term ✨] You are #amazed[beautiful]! ``` <img src="7.png" style="zoom:50%;" /> ```typst #let amazed(term, color: blue) = { text(color, box[✨ #term ✨]) } You are #amazed[beautiful]! I am #amazed(color: purple)[amazed]! #show: amazed I choose to focus on the good in my life and let go of any negative thoughts or beliefs. In fact, I am amazing! ``` <img src="8.png" style="zoom:75%;" /> 进一步地,可以结合let、set和show定义排版规则 ``` #let template(doc) = [ #set text(font: "Inria Serif") #show "something cool": [Typst] #doc ] #show: template I am learning something cool today. It's going great so far! ``` 用户可以将自定义的一些规则储存在typ文件中,然后使用`import`命令导入该文件,从而使主文件保持整洁 ## 实践 写了一个简陋的天大毕业论文模板(只实现了标题和段落格式,图表等内容待定)。 ```typst // 设置页面 #set page( paper:"a4", margin: ( top:27.5mm, bottom:25.4mm, left:35.7mm, right:27.7mm ), numbering:"1", number-align:center, ) // 设置正文文字格式 #set text( font:("Times New Roman","SimSun"), style:"normal", weight:"regular", size: 12pt, ) // 设置段落 #set par( leading:20pt, justify: true, first-line-indent: 2em, ) // 设置标题格式 #set heading(numbering: "1.1.1.1") #show heading: it => locate(loc => { let levels = counter(heading).at(loc) let deepest = if levels != () { levels.last() } else { 1 } set text(12pt) if it.level == 1 [ #if deepest !=1 { pagebreak() } #set par(first-line-indent: 0pt) #let is-ack = it.body in ([Acknowledgment], [Acknowledgement]) #set align(center) #set text(if is-ack { 15pt } else { 15pt },font:"SimHei") #v(36pt, weak: true) #if it.numbering != none and not is-ack { numbering("第1章.", deepest) h(7pt, weak: true) } #it.body #v(36pt, weak: true) ] else if it.level == 2 [ #set par(first-line-indent: 0pt) #set text(size:14pt,font:"SimHei") #v(24pt, weak: true) #if it.numbering != none { numbering("1.1.",..levels) h(7pt, weak: true) } #it.body #v(24pt, weak: true) ] else if it.level == 3 [ #set par(first-line-indent: 0pt) #set text(size:14pt,font:"SimHei") #v(15pt, weak: true) #if it.numbering != none { numbering("1.1.1.",..levels) h(7pt, weak: true) } #it.body #v(15pt, weak: true) ] else [ #set par(first-line-indent: 0pt) #set text(size:12pt,font:"SimHei") #v(12pt, weak: true) #if it.numbering != none { numbering("1.1.1.1.",..levels) h(7pt, weak: true) } #it.body #v(12pt, weak: true) ] }) = 一级标题 //每页第一行的段落不会被缩进,需要额外设置 // #h(2em)两个字符的空格 #h(2em)#lorem(30) \ == 二级标题 chatgpt:阳光明媚的早晨,一只小鸟在树枝上欢快地唱着歌,远处传来了儿童的欢笑声,空气中弥漫着花香和新鲜的草味,这是一个充满生机和活力的日子。突然间,一阵微风吹来,树叶沙沙作响,让人感到一阵舒爽。这个美好的早晨让人心情愉悦,让人感受到大自然的魅力和美妙。\ === 三级标题 == 二级标题 === 三级标题 #lorem(30) \ ==== 四级标题 ==== 四级标题 #lorem(30) \ = 一级标题 == 二级标题 === 三级标题 ==== 四级标题 ``` ## 后话 Typst的文档做得很好,对于列表,可以使用`+`进行创建,也可以使用函数`#enum`进行自定义,总体而言,Typst的可玩性很强。本文只是对某些方面进行了简单的介绍,如果感兴趣的话,可以查阅其[官方文档](https://typst.app/docs/)<sup>[5]</sup>。 对于像word或者$LaTeX$那样分开设置中英文字体以及页眉页脚根据页码设置,可以使用Typst内的函数进行控制,但这有些高阶玩法了,需要自行探索。 本文所述内容对于日常做做笔记啥的来说绰绰有余,相信随着Typst的不断更新,必将有代替$LaTeX$的一天。 ## 链接 [1] https://zhuanlan.zhihu.com/p/369311806 [2] https://github.com/Zuttergutao/Latex [3] https://github.com/typst/typst [4] https://github.com/typst/typst/releases/tag/v23-03-28 [5] https://typst.app/docs/
https://github.com/crd2333/crd2333.github.io
https://raw.githubusercontent.com/crd2333/crd2333.github.io/main/src/docs/Courses/数据库系统/事务处理.typ
typst
--- order: 5 --- #import "/src/components/TypstTemplate/lib.typ": * #show: project.with( title: "数据库系统", lang: "zh", ) #let null = math.op("null") #let Unknown = math.op("Unknown") #counter(heading).update(4) = 第五部分:事务处理 - 这一部分感觉和操作系统关系比较密切 == 事务和并发控制 === 基本的概念 - 事务的概念 - 事务时程序执行的基本单位,会引起一些数据项的更新,需要解决的两个问题: - 数据库系统的硬件问题和系统崩溃导致的失败 - 多事务的并行执行 - 事务开始和结束的时候数据库都必须是 consistent 的 - 事务的四个性质 ACID: - 事务的原子性 *Atomicity* - 事务中的所有步骤只能完全执行(commit)或者回滚(rollback) - 事务的一致性 *Consistency* - 单独执行事务可以保持数据库的一致性 - 事务的隔离性 *Isolation* - 事务在并行执行的时候不能感知到其他事务正在执行,执行中间结果对于其他并发执行的事务是隐藏的 - 事务的持久性 *Durability* - 更新之后哪怕软硬件出了问题,更新的数据也必须存在 - 一个简单的事务模型,只包含 read, write 两个操作 #fig("/public/assets/Courses/DB/img-2024-05-20-13-35-30.png") - 事务的状态 - active 初始状态,执行中的事务都处于这个状态 - partially committed 在最后一句指令被执行之后 - failed 在发现执行失败之后 - aborted 回滚结束,会选择是*重新执行事务*还是结束 - committed 事务被完整的执行 #diagram( node((0,0), [active]), edge(), node((1,-0.5), [partially committed]), edge(), node((2,-0.5), [committed]), edge((0,0),(1,0.5)), node((1,0.5), [failed]), edge(), node((2,0.5), [aborted]), edge((1,-0.5),(1,0.5)), ) === 事务的并发执行 - 并发执行的*好处*,可以提高运行的效率,减少平均执行时间 - 并发执行的*异常*,丢失修改(Lost Update),读脏数据(Dirty Read),不可重复读(Unrepeatable Read),幽灵问题(Phantom Problem) - 并发控制处理机制:让并发的事务独立进行,控制并发事务之间的交流 - Schedules 调度 - 一系列用于指定并发事务的执行顺序的指令 - 需要包含事务中的所有指令,需要保证单个事务中的指令的相对顺序(常识) - 事务的最后一步 - 成功执行,最后一步是 commit instruction;执行失败,最后一步是 abort instruction - serial schedule 串行调度:一个事务调度完成之后再进行下一个 - equivalent schedule 等价调度:改变处理的顺序但是和原来等价 - *Serializability*可串行化 - 基本假设:事务不会破坏数据库的一致性,只考虑读写两种操作 ==== 冲突可串行化调度 conflict serializable schedules - 两个事务是冲突的,当它们含有*冲突的操作*: + 来自两个不同的事务 + 对同一个对象操作 + 两个 operations 至少有一个是 write 操作 - 冲突等价(*conflict equivalent*):两个调度可以通过改变一些不冲突指令来转换 - 冲突可串行化:当且仅当一个调度$S$可以和一个串行调度等价 - *Precedence graph* 前驱图 - 图中的顶点是各个事务,当事务$T_i, T_j$ 的某两个操作冲突并且 $T_i$ 先访问出现冲突的数据的时候,就画一条边$T_i -> T_j$ - 一个调度是*冲突可串行化*的当且仅当前驱图是*无环图* - 对于无环图,可以使用*拓扑排序*获得一个合适的执行顺序 #fig("/public/assets/Courses/DB/img-2024-05-20-14-36-37.png") ==== 视图可串行化调度 view serializability schedules - 事务之间读到和写回的数据是一样的(对数据) - 由事务 $T$ 最先读到的数据依旧是 $T$ 最先读到 - 事务 $T'$ 产生的数据由事务 $T$ 最先读到,则依旧是 $T$ 最先读到 - 由事务 $T$ 最后写回的数据依旧是 $T$ 最后写回 #fig("/public/assets/Courses/DB/img-2024-05-20-14-44-19.png") - 冲突可串行化的调度一定是视图可串行化的,反之不一定 - 比如下图,与 $T_27 -> T_28 -> T_29$ 视图等价,但是不冲突等价 #fig("/public/assets/Courses/DB/img-2024-05-20-14-48-03.png") - 其判定似乎不要求(?),也是画一个前驱图 #v(1em) - 此外还有其它评价方式的 serializability(不是三好学生、五好学生,也可以是好学生) ==== 可恢复调度 Recoverable Schedules - 如果一个事务 $T_1$ 要读取某一部分数据,而 $T_2$ 要写入同一部分的数据,则 $T_1$ 必须在 $T_2$ commit 之前就 commit,否则就会造成 dirty read - 如下图,如果 $T_8$ fails,$T_9$ 读到的数据将 inconsistent #fig("/public/assets/Courses/DB/img-2024-05-20-15-09-24.png") - *Cascading Rollbacks* 级联回滚 - 单个事务的 fail 造成了一系列的事务回滚 - 如下图,如果 $T_10$ fails,$T_11, T_12$ 必须也要 roll back #fig("/public/assets/Courses/DB/img-2024-05-20-15-08-29.png") - *Cascadeless Schedules* 避免级联回滚的调度 - 对于每一组事务 $a$ 和 $b$ 并且 $b$ 需要读入一个 $a$ 写入的数据,那么 $a$ 必须在 $b$ 的读操作开始之前 commit - *Cascadeless Schedules* 属于可恢复的调度的一种 - Transaction Isolation Levels - 有时候我们会放低要求来换取性能(trade-off) #tbl( columns: 7, [事务\ 隔离级别],[描述],[脏读],[不可\ 重复读],[丢失\ 修改],[幻读],[锁持续时间], [Read\ Uncommitted],[一个事务会读到另一个*未提交*事务修改过的数据。],[是],[是],[是],[是],[当前事务], [Read\ Committed],[如果数据被另一个事务修改,只有它提交后才能读取],[否],[是],[是],[是],[当前事务], [Repeatable\ Read],[如果数据被另一个事务修改,只有它提交后才能读取;且该事务读过某条记录后,在提交之前,其它事务均不能够改动或删除当前事务已读取的数据。],[否],[否],[否],[是],[该事务\ 提交前], [Serializable],[可重复读仅仅是说,不可以改动和删除,但没说不能再往这个范围内插入数据。即引入范围锁],[否],[否],[否],[否],[该事务\ 提交前] ) - 这个 Serializable 可串行化隔离级别似乎和冲突可串行化、视图可串行化等不是一回事。 === Concurrency Control 并发控制 - 有三种并发控制协议 + Lock-Based Protocols + \* Timestamp-Based Protocols + \* Validation-Based Protocols ==== Lock-Based Protocols 基于锁的协议 - lock 是一种控制并发访问同一数据项的机制,分为两种 lock mode + exclusive(X):表示数据项可以读和写,用 lock-X 表示 + shared(S):表示数据项只能读,用 lock-S 表示 - 两个事务的冲突矩阵: #tbl( columns: 3, [],[S],[X], [S],[true],[false], [X],[false],[false] ) - 如果请求的锁与其他事务对这个数据项已有的锁不冲突,那么可以给该事务批准该锁 - 对于一个数据项,可以有任意多的事务持有 S 锁,但是如果有一个事务持有 X 锁,其他的事务都不可以持有这个数据项的锁 - 如果一个锁没有被批准,就会产生一个请求事务,等到所有冲突的锁被 release 之后再申请 - 锁协议中的特殊情况 - dead lock 死锁:两个事务中的锁互相等待造成事务无法执行,比如事务 $2$ 的锁需要事务 $1$ 先 release,但是事务 $1$ 的 release 步骤在事务 $2$ 的申请锁后面,就会造成事务 $1,2$ 的死锁 - Starvation 饥荒:一个事务在等一个数据项的Xlock,一群别的事务在等他release,造成饥荒 ==== Two-Parse Locking Protocol 两阶段锁协议 - 两个阶段 growing 和 shrinking,growing 只接受锁而不释放,shrinking 反之。简单来说,就是:*每个事务放锁后就不再加锁* #fig("/public/assets/Courses/DB/img-2024-05-27-13-28-47.png") - 二阶段锁协议确保冲突可串行化的调度(思考其证明),并且按照每个事务的 lock point 排序就是一个合法的串行调度 - 无法确保可恢复(可能级联回滚),为此添加扩展(并且也无法避免死锁问题) - *strict two-phase locking* - 每个事务都要保持所有的exclusive锁直到该事务结束 - 为了解决级联回滚的问题 - *Rigorous two-phase locking* - 所有的锁必须保持到事务commit或者abort - 两阶段锁协议是可串行化的充分但非必要条件 - 如,按照右图每个事务的 lock point 判断,不是可串行调度,但实际上是可串行的 #grid(columns: 2, fig("/public/assets/Courses/DB/img-2024-05-27-13-46-36.png"), fig("/public/assets/Courses/DB/img-2024-05-27-13-51-20.png")) ==== 锁的实现与转换 - Lock Conversions锁转换:提供了一种将S锁升级为X锁的机制 - 两个阶段 - 第一个阶段可以设置 S 和 X 锁,也可以升级 S 锁 - 第二个阶段可以释放 S 和 X 锁,也可以降级 X 锁 - 所有的锁在事务 commit 或者 abort 之后再被释放 - 事务不需要显式调用锁的请求,比如 read 和 write 的执行过程如下 ```c // read operation if Ti has a lock on D then read(D) else begin if necessary wait until no other transaction has a lock-X on D grant Ti a lock-S on D; read(D) end ``` ```c // write operation if Ti has a lock-X on D then write(D) else begin if necessary wait until no other trans. has any lock on D, if Ti has a lock-S on D then upgrade lock on D to lock-X else grant Ti a lock-X on D write(D) end; ``` - 锁的实现:Lock Manager 可以被作为一个独立的进程来接收事务发出的锁和解锁请求 - Lock Manager 会回复申请锁的请求,发出请求的事务会等待请求被回复再继续处理 - lock manager 维护一个内存中的数据结构 lock-table 来记录已经发出的批准 #grid(columns: (1fr, 0.7fr), [ - Lock table 是一个 *in-memory 的 hash 表* - 通过被上锁的数据项作为索引,蓝框代表上锁,而白框表示在等待 - 新的上锁请求被放在队列的末端,并且在和其他锁兼容的时候会被授权上锁 - 解锁的请求会删除之前对应的上锁请求,并且检查后面的请求是否可以被授权 - 如果一个事务 aborts 了,所有该事务的请求都会被删除 - lock-manager 会维护一个记录每个事务上锁情况的表来提高操作的效率 ], fig("/public/assets/Courses/DB/img-2024-05-27-14-07-16.png") ) ==== Deadlock prevention protocols 死锁保护协议 - 死锁保护协议,保证系统不会困于死锁 - 两阶段封锁协议无法避免死锁 #fig("/public/assets/Courses/DB/img-2024-05-27-14-12-00.png",width: 50%) - Deadlock Handling,一种想法是预防死锁,一种想法是死锁发生后检测并处理 - *Deadlock Prevention* 死锁预防 - predeclaration 执行之前先检查会不会出现死锁,保证一个事务开始执行之前对涉及到的所有的数据项都上锁(要么不锁,要么一下全锁上) - graph-based protocol:使用偏序来确定数据项上锁的顺序。例如,上图中我们规定先 $X$ 后 $Y$,那么事务 $T_2$ 就必须先申请 $X$ 的锁(后 $Y$ 的锁)而无法开始,从而避免死锁。 - 一个例子是 Tree-Protocol,它完全不同于两阶段锁协议,只使用 exclusive locks;任何时候都可以释放锁;任何数据项只能被上锁解锁一次;非 first lock 的加锁要求其祖先已经被锁上 - Advantages: 确保冲突可串行化;避免死锁;并且相对两阶段锁协议释放锁更早 - Disadvantages: 不确保可恢复性;可能会比需要的申请了更多的锁 - *Timeout-Based Schemes* 超时机制 - 只等待一段时间,过了时间就直接回滚(直接视为失败);容易实现,但是会导致starvation - *Deadlock Detection* 死锁检测 - wait-for 图: 所有的事务表示图中的节点,如果事务 $i$ 需要 $j$ 释放一个 data item,则图中画一条 $i$ 到 $j$ 的有向边,如果图中有环,说明系统存在死锁(跟前驱图很相似) - lock manager 定期生成一个 wait-for 图来检测。选择其中一个事务(victim)杀掉(释放它的所有锁并回滚)以解决死锁 - *Deadlock Recovery* 死锁恢复 - total rollback 将事务 abort 之后重启 - partial rollback 不直接 abort 而是仅回滚到能解除死锁的状态 - 同一个事务经常发生死锁会导致starvation,因此避免starvation的过程中cost要考虑回滚的次数 ==== Multiple Granularity 多粒度 - 数据项具有不同的大小,并定义数据粒度的层次结构,其中小粒度嵌套在大粒度中。我们可以对不同粒度的数据项加锁解锁。 - 可以用树形结构来表示 #fig("/public/assets/Courses/DB/img-2024-05-27-15-09-02.png") - 锁的粒度 (level in tree where locking is done) - fine granularity(lower in tree)细粒度,高并发,高开销 - coarse granularity(higher in tree)粗粒度,低并发,低开销 - 高至整个DB,低至区域,文件和记录(甚至对一个谓词,对一个值) - 扩展的Lock Modes - *intention-shared* (IS): 想要对更低层加 S 锁 - *intention-exclusive* (IX): 想要对更低层加 X 锁 - *shared and intention-exclusive* (SIX): 对这一层加 S 锁,想要对更低层加 X 锁(比如对整个表加共享锁,对其中某一行加排它锁) - 冲突矩阵如下 #let tbl_false = [#text(fill: red, "false")] #tbl(columns: 6, fill: (x,y) => if y == 0 or x == 0 {rgb(202, 237, 250)}, [],[IS],[IX],[S],[SIX],[X], [IS],[true],[true],[true],[true],tbl_false, [IX],[true],[true],tbl_false,tbl_false,tbl_false, [S],[true],tbl_false,[true],tbl_false,tbl_false, [SIX],[true],tbl_false,tbl_false,tbl_false,tbl_false, [X],tbl_false,tbl_false,tbl_false,tbl_false,tbl_false, ) ==== Insert and Delete Operations - handling phantom phenomenon - Index Locking Protocol 来防止幻读 - Next-Key Locking 来防止幻读 - 略 ==== Multiversion Concurrency Control Schemes(不考) - 有点引入时间戳的感觉(?) - 多版本并发控制 - 多版本的两阶段封锁协议 - 略 === \* Validation-Based Protocols 验证协议 - sjl 老师讨论区题目,不要求掌握 - 基于验证的协议,属于 Optimistic Concurrency Control,适用于读多写少的情况 - 每个事务 $T_i$ 被分为 $2$ 或 $3$ 个阶段和三个时间点: - $"ReadTS"(T_i)$ 时间点,标志事务 $T_i$ 开始 1. Read Phase 读阶段:事务 $T_i$ 读取所有的数据项并存在本地变量;同时也执行写操作,但只写在本地 - $"ValidationTS"(T_i)$ 时间点,标志事务 $T_i$ 结束读阶段并进入验证阶段 2. Validation Phase 验证阶段:事务 $T_i$ 根据所有 $"ValidationTS"(T_j)$ 小于 $"ValidationTS"(T_i)$ 的事务进行合法性测试 3. Write Phase 写阶段:事务 $T_i$ 把本地写好的数据复制到数据库中。只读事务可跳过 - $"FinishTS"(T_i)$ 时间点,标志事务 $T_i$ 结束 - 具体而言,$T_i$ validation test 通过,需要对上述每个 $T_j$ 满足以下两个条件之一 - $"FinishTS"(T_j) < "StartTS"(T_i)$,这很显然不会发生冲突 - $"StartTS"(T_i) > "FinishTS"(T_j) < "ValidationTS"(T_i)$,并且 $T_j$ 的写操作与 $T_i$ 的读操作不相交 - 基于锁和时间戳的并发控制是悲观的,因为它们探测到冲突时总是让事务等待或回滚,即使它们可能是冲突可串行化的(优先假设冲突);而基于验证的并发控制总是让事务先执行,等到验证后发现会冲突才回滚(优先假设不冲突) #v(1em) - 总结 #tbl( columns: 4, table.cell(rowspan: 2)[协议],table.cell(colspan: 3)[是否能避免问题(空着为不知道)], [冲突可串行],[可恢复性],[死锁], [2PL],[可],[否],[否], [Strict 2PL],[可],[可],[否], [Rigorous 2PL],[可],[可],[否], [Graph-based Protocol],[],[],[可], [Tree-Protocol],[可],[否],[可], ) == Recovery System 事务恢复 - 故障的分类 - Transaction failure 事务错误:包含逻辑错误和系统错误,死锁属于后者 - System crash 系统崩溃导致的故障(磁盘没出事) - Disk failure 磁盘中的问题导致磁盘存储被销毁 #fig("/public/assets/Courses/DB/img-2024-06-03-13-29-21.png") - 存储结构 - Volatile storage 易失存储 - Nonvolatile storage 非易失存储 - Stable storage 稳定存储,实际上并不存在,但可以用 multiple copies 近似实现 - 恢复算法 + 在普通事务处理中要保证有足够的信息保证可以从故障中恢复(恢复准备) + 在故障发生之后要保持数据库的 consistency,事务的 atomicity 和 durability - 恢复算法需要满足 idempotent 幂等性,即如果恢复过程中又故障了,或者恢复恢复过程中的故障……最终的结果都是一样的 // - Data Access 数据访问回顾 // - 物理block是磁盘上的区分 // - 缓冲block是在主存中的block // - 磁盘和主存之间的数据移动依赖input和output操作 // - 每个事务$T_i$ 在内存中有自己的work-area,并且拷贝了一份该事务要用到的全部数据 // - 事务通过read和write操作把数据在自己的工作区域和buffer blocks区间之间进行传递 - 如何在事务failure的情况下仍然保证原子性 - 先把数据存储在磁盘上,而不是直接存到数据库中 - 然后在提交点对数据库进行修改,如果发生错误就立马回滚 - 但这个方法效率太低了,事实上没有被采用 === log-based Recovery 基于日志的恢复 - 日志(log)被存储在 stable storage 中,包含一系列的日志记录 - 事务开始 `<T start>` - 写操作之前之前的日志记录 `<Ti,X,V1,V2>`,X 是写的位置,V1,V2 分别是写之前和之后的 X 处的值 - 事务结束的时候写入 `<Ti commit>` - $T_i$ 需要 undone,当 log 包含 `<Ti start>` 而不包含 `<Ti commit>` or `Ti abort` #fig("/public/assets/Courses/DB/img-2024-06-03-13-47-38.png") - 更新事务导致的不一致性 - 新的数据在提交的时候不一定是安全的:错误发生时难以保护改变后的值不变 - 旧的数据在提交之前不一定是安全的:在 commit 之前发生错误将无法回滚到原来的值 - 对于更新事务的两条规则 - commit rule:新的数据在 commit 之前必须被写在*非易失性*的存储器中 - logging rule:旧的值在新的写入之前需要被写在日志里 - 日志中写入 commit 的时候视为一个事务被提交了,但此时 buffer 中可能还在进行 write 操作,因为 log 的写入先于操作 - 两种思路: - *deferred database modification* 延迟数据库更新:先把所有的更新写在日志里,在写入 commit 之后再开始写入数据库 - 假设事务是串行执行的 - 事务开始的时候要写入`<Ti start>` - *write*(*X*) 操作对应的日志是 `<Ti, X, V>` ,V表示X新的值 - 事务 partially commits 的时候需要写入 commit - 然后根据日志来实际执行一些 write 的操作 - 当错误发生时,当且仅当日志中 start 和 commit 都有的时候,事务需要 redo - *immediate database modification* 直接修改数据库 - 先要写好日志记录,假设日志记录直接 output 到稳定的存储中 - block 的输出可以发生在任何时间点,包括事务 commit 前和 commit 后,block 输出的顺序和 write 的顺序不一定相同 - 恢复的过程中有两种操作 - undo:撤回,将事务$T_i$ 中已经更新的值变回原本的值 - undo 的条件:日志中包含这个事务的 start 而不包含 commit,即事务进行到一半中断了 - redo:从事务 $T_i$ 的第一步开始重新做,将所有值设定为新的值 - redo 的条件:日志中包含这个事务的 start 和 commit - 两种操作都需要 *idempotent* —— 也就是操作执行多次和执行一次的效果相同 - 我们采用第二种 - 并行控制和恢复 - 所有事务共用一个日志和 disk buffer - 基本的假设(由锁机制实现) - 如果一个事务改变了某个数据项,其他的事务直到这个事务 commit 或者 abort 之前都不能改变这个数据项的值 - 没有 commite 的事务引起的更新不能被其他事务更新 - 日志中不同事务的日志可能会相交 - check point - 通过定期执行 checkpoint 操作来完成简化的恢复 1. 将内存中的记录都写到 stable storage 中(先写日志原则) 2. 将所有更改过的 block 写入磁盘中(脏页面写入,保证这之前的事务都写入) 3. 写入日志记录< *checkpoint* $L...$> ,其中 L 是在 checkpoint 时依然处于进行状态的事务 - 通过checkpoint,在日志处理的时候就不需要处理所有的日志,只需要关注异常时正在活跃的事务,恢复的步骤如下 - 从日志的末尾向前扫描,直到发现最近的checkpoint记录 - 只有L中记录的,或者在L之后发生的事务需要redo或者undo - checkpoint之前的记录已经生效并保存在了稳定的存储中 - 日志中更早的部分*或许需要*undo,但一定不需要redo - 继续向前扫描直到发现一个事务的start日志 - 最早的start之前的日志不需要进行恢复操作,并且可以清除 - 单个事务回滚时的基本操作 - 从后往前扫描,当发现记录 $<T_i,X_i,V_1,V_2>$ 的时候 - 将 X 的值修改为原本的值 - 在日志的末尾写入记录 $<T_i,X_i,V_1>$ - 发现 start 记录的时候,停止扫描并在日志中写入 abort 记录 - 普通恢复算法 - 从后往前找到第一个 checkpoint 记录,然后开始 redo - redo 需要先找到最后一个 check point 并且设置 undo-list 1. 从 checkpoint 开始往下读 2. 当发现修改值的记录的时候,redo 一次将 X 设置为新的值 3. 当发现 start 的时候将这个事务加入 undo-list 4. 当发现 commit 或者 abort 的时候将对应的事务从 undo-list 中移除 - undo 1. 从日志的末尾开始往回读 2. 当发现记录 $<T_i, X_j, V_1, V_2>$ 并且 Ti 在 undo-list 中的时候,进行一次回滚 3. 当发现 Ti start 并且 Ti 在 undo-list 中的时候,写入 abort 日志并且从undo-list 中移除 Ti 4. 当 undo-list 空了的时候停止 undo - 在下面这个图中 $T_1,T_3$ ignored,$T_2$ 需要 redo,$T_4$ undo #fig("/public/assets/Courses/DB/img-2024-06-03-14-00-21.png") - log record buffering 缓冲日志记录 - 日志记录一开始在主存的缓冲区中,当日志在 block 中满了的时候或者进行了 log force 操作(上面提到的 checkpoint)时写入稳定的存储中 - 需要遵守的规则 - 写入稳定存储中的时候日志记录按照原本的顺序写入 - 在 commit 记录被写入稳定存储的时候,$T_i$ 才算进入 commit 状态 - WAL(write-ahead logging)规则:在数据 block 写入数据库之前,必须先把日志写入稳定的存储中 - group commit 策略 #fig("/public/assets/Courses/DB/img-2024-06-03-14-17-12.png") - 中间有几页先留着慢慢学习,这几页看起来不太像考试内容,buffer 这一部分应该了解就好 - Fuzzy Checkpoint 策略 - 为了避免 checkpoint 时 I/O 过于密集,可以采用 fuzzy checkpoint 策略 + Temporarily stop all updates by transactions + Write a <*checkpoint* *L*> log record and force log to stable storage + Note list M of modified buffer blocks + Now permit transactions to proceed with their actions + Output to disk all modified buffer blocks in list M - blocks should not be updated while being output - Follow WAL: all log records pertaining to a block must be output before the block is output + Store a pointer to the *checkpoint* record in a fixed position *last_checkpoint* on disk - Check point 现在是一个过程,而不是一个点,但仍需要一个点来记录,也就是 disk 中的 last_checkpoint #fig("/public/assets/Courses/DB/img-2024-06-03-14-25-47.png") === Recovery with Early Lock Release and Logical Undo Operations - 逻辑 Undo,比如 `A+=10` 已经被执行了,而且过了一段时间(没有办法 physical undo 了),之后又要 undo 这个操作怎么办? - 只需采用 logical undo,再执行一个 `A-=10` 即可 - 注意 logical undo 并不适用于所有情况,比如不满足交换律的操作 - 这种方法允许提早释放 lock,不一定要在 commit 或 abort 时释放 - 如果发生了 abort(normal process) #fig("/public/assets/Courses/DB/img-2024-06-03-14-48-20.png") - 如果发生了 crash - 这里的 checkpoint 不是 fuzzy 的(为了简单) #fig("/public/assets/Courses/DB/img-2024-06-03-14-56-51.png") === ARIES Recovery Algorithm —— Aries 恢复算法 - 这部分考试常考,但上课讲得又快又不清楚 - 这篇文章写得挺好,但似乎有点超出我们的要求 #link("https://blog.csdn.net/yanglingwell/article/details/131484407")[万字长文解析最常见的数据库恢复算法: ARIES - CSDN博客] ==== 和普通恢复算法的区别 - ARIES is a state-of-the-art - 使用 LSN(log sequence number)来标注日志 - 把 LSN 存到每个 page 来标注哪些日志对应的操作已经被写到 disk 中 - physiologically redo(使用物理逻辑日志的 redo) - 使用脏页表(dirty page table) 来避免不必要的 redo - fuzzy checkpoint 机制 - ARIES supports *partial rollback* ==== ARIES 中的数据结构 - Log sequence number (LSN) - 用于标识*每一条日志记录*,需要是线性增长的 - 其实是一个 offset,方便从文件的起点开始访问 - Page LSN 每个 Page 的 LSN - 是每一页中对该页*起作用的最后一条*日志记录的 LSN 编号 - 在 update page 时:申请 X-lock,写入日志,更新 page(包括把 Page LSN 更新为日志的 LSN),释放 X-lock - 在 flush page(写入磁盘)时:首先申请 S-lock(避免写操作申请 X-lock?) - 在 recovery 的 undo 阶段,LSN 值不超过 PageLSN 的日志记录将*不会在该页上执行*,因为其动作已经在该页上了 - 可以避免重复的 redo $=>$ idempotence - log record 日志记录 - 每一条日志记录包含自己的 LSN 和*同一个事务中前一步操作*的 LSN —— PreLSN - CLR(compensation log record):补偿事务记录,在恢复期间不需要 undo,是 redo-only 的日志记录 - 它起到的作用类似于之前恢复算法中的 operation-abort - 有一个 UndoNextLSN 区域用于记录下一个(更早,往前搜索)的需要 undo 的记录 - 如果当前日志不是 CLR 日志,则下一个待 UNDO 的日志为当前日志的 PrevLSN;如果当前日志是 CLR 日志,则下一个待 UNDO 的日志为当前日志的 UndoNxtLSN(这将跳过中间已经被 UNDO 的日志)。 - 【似乎是这样】如下图,我们先 undo 日志 4,这时需要写 CLR 4',将其 UndoNextLSN 指向 3(即为 4 的 PrevLSN);假如这个时候掉电了,我们就需要 redo 这个 CLR 4'(相当于 undo 4),它指向的 3 则是需要接着 undo 的日志(也要继续生成 CLR 3') #fig("/public/assets/Courses/DB/img-2024-06-03-17-09-49.png") #quote()[ #tab 每个日志记录都有一个唯一标识该记录的日志顺序号(LSN)。LSN:由一个文件号以及在该文件中的偏移量组成。 每一页也维护一个叫页日志顺序号(PageLSN)的标识。每当一个更新操作发生在某页上时,该操作将其日志记录的LSN存储在该页的PageLSN域中。在恢复的撤销阶段,LSN值小于或等于PageLSN值的日志记录将不在该页上执行,因为它的动作已经在该页上了。 每个日志记录包含同一事务的前一日志记录的LSN,放在PrevLSN中,使得一个事务可以由后向前提取,而不必读整个日志。事务回滚中会产生一些特殊的redo-only的日志,称为补偿日志记录(Compensation Log Record, CLR)。CLR中还有额外的(?)称为UndoNextLSN的字段,记录下一个需要undo的日志的LSN。 ] - Dirty Page Table 脏页表 - 存储在缓冲区的,记录已经被更新过的 page 的表 - 每个 page 包含 - PageLSN - RecLSN(recover LSN) - 所有操作该 page 的 log record,如果 LSN 小于它说明已经*被写入磁盘中*了 - 当 page 被插入脏页表的时候,*初始化为当前的 PageLSN* - 会被记录在 checkpoint 中,用于减少 redo 的次数 - 只要该 page 被写入磁盘,就从脏页表中移除该页 - checkpoint处的日志记录 - 包含:DirtyPageTable 和 active transactions table - 对每一个活跃的事务,记录了 LastLSN,即这个事务在日志中写下的*最后一条记录* - 在 checkpoint 的时间点,脏页的信息还没写入磁盘(fuzzy) - 一个示例图如下,当发生掉电的时候,三个 table 得数据都会丢失,但 log 和 disk 不会 #fig("/public/assets/Courses/DB/img-2024-06-03-15-32-56.png") #hline() - ARIES 算法在正常情况下的执行操作和回滚操作(和恢复中的 redo 一样),没讲 ==== ARIES 算法的恢复操作 - 分为三个阶段:Analysis 阶段,redo 阶段和 undo 阶段 - 分析阶段需要得到 undo-list, RedoLSN,以及 crash 时哪些 page 是 dirty 的 - redo 阶段从 RedoLSN 开始,RecLSN and PageLSNs 用于避免不必要的 redo #fig("/public/assets/Courses/DB/img-2024-06-03-15-39-09.png") - 或者另一张网上的图 #fig("/public/assets/Courses/DB/img-2024-06-03-21-01-10.png", width: 70%) - 分析阶段: - 从*最后一条完整的checkpoint日志记录*开始 + 从 checkpoint 读取脏页表的信息 + 设置 RedoLSN = min RecLSN in DirtyPageTable,如果脏页表是空的就设置为checkpoint 的 LSN + 设置 undo-list 为 checkpoint 中记录的事务,以及读取每个事务最后记录的 LSN - 从 checkpoint 开始正向扫描 - 如果发现了不在 undo-list 中的记录就写入 undo-list - 当发现一条*更新记录*的时候,如果这一页*不在脏页表*中,用该记录的 LSN 作为 RecLSN 写入脏页表中(以后的 RedoLSN = min(xxx) 会更大);如果它在脏页表中,就更新 PageLSN 为更大值 - 如果发现了标志事务*结束*的日志记录(commit, abort) 就从 undo-list 中*移除*这个事务 - 持续更新 undo-list 中的每一个事务的最后一条记录 LSN - 分析结束之后 - RedoLSN 决定了从哪里开始 redo - DirtyPageTable 中每个 page 的 RecLSN 用于减少 redo - 所有 undo-list 中的事务都需要回滚(现在这个 undo-list 实际上就是程序正常执行情况下的,亦即 redo 做完之后的 ATT),同时我们记录了这些事务的最后记录,也即第一个需要 undo 的记录 - Redo 阶段 - 从 RedoLSN 开始*正向扫描*日志,当发现更新记录的时候 + 如果这一页不在脏页表中;或者这一条记录的 LSN 小于 DPT 中的 RecLSN 就忽略这一条(已经写入磁盘) + 否则从磁盘中读取这一页,如果磁盘中得到的这一页的 PageLSN 比这一条记录的 LSN 小,就 redo,否则也忽略这一条记录 #quote(caption: " * 为什么某个 Page 的 PageLSN 可能会不小于它在 DPT 的 RecLSN?")[ 因为 PageLSN 记录的是实际 flush 到 Page 的 LSN, 而 RecLSN 记录的是 Checkpoint 恢复的 Dirty Page 信息。由于 Page Flush 和 Checkpoint 的 Flush 完全并行,互不影响,因此可能存在 Checkpoint Flush 之后,再次执行了 Page Flush ,导致恢复的 Checkpoint Dirty Page 信息延迟于实际 Page Flush 的信息。因此实际的 PageLSN 不小于 DPT 的 RecLSN ] - Undo 阶段 - 从日志末尾向前搜索,undo 所有 undo-list 中有的事务 - 通过如下操作实现优化,跳过不必要的记录: + 用分析阶段“每个事务最后一条记录的 LSN”来找到“每个事务下一个需要 undo 的 LSN”,每次从这些 LSN 里选择一个最大的,把它 undo 掉 + 在 undo 一条记录之后,如果是 start 日志,把它从 undo-list 删掉;否则更新该事务下一个将要 undo 的 LSN - 对于普通的记录,设置为 PrevLSN - 对于 CLR 记录,设置为 UndoNextLSN - 一个例子(注意是反过来的) #fig("/public/assets/Courses/DB/img-2024-06-03-19-26-33.png") - Aries 算法的其他特性 - Recovery Independence 恢复的独立性 - Savepoints 存档点 - Fine-grained locking 细粒度的锁 - Recovery optimizations 恢复的优化 #v(1em) - check: - [ ] 普通恢复算法 - [ ] 逻辑恢复算法 - [ ] ARIES 恢复算法
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/191.%20early.html.typ
typst
early.html Early Work October 2020One of the biggest things holding people back from doing great work is the fear of making something lame. And this fear is not an irrational one. Many great projects go through a stage early on where they don't seem very impressive, even to their creators. You have to push through this stage to reach the great work that lies beyond. But many people don't. Most people don't even reach the stage of making something they're embarrassed by, let alone continue past it. They're too frightened even to start.Imagine if we could turn off the fear of making something lame. Imagine how much more we'd do.Is there any hope of turning it off? I think so. I think the habits at work here are not very deeply rooted.Making new things is itself a new thing for us as a species. It has always happened, but till the last few centuries it happened so slowly as to be invisible to individual humans. And since we didn't need customs for dealing with new ideas, we didn't develop any.We just don't have enough experience with early versions of ambitious projects to know how to respond to them. We judge them as we would judge more finished work, or less ambitious projects. We don't realize they're a special case.Or at least, most of us don't. One reason I'm confident we can do better is that it's already starting to happen. There are already a few places that are living in the future in this respect. Silicon Valley is one of them: an unknown person working on a strange-sounding idea won't automatically be dismissed the way they would back home. In Silicon Valley, people have learned how dangerous that is.The right way to deal with new ideas is to treat them as a challenge to your imagination � not just to have lower standards, but to switch polarity entirely, from listing the reasons an idea won't work to trying to think of ways it could. That's what I do when I meet people with new ideas. I've become quite good at it, but I've had a lot of practice. Being a partner at Y Combinator means being practically immersed in strange-sounding ideas proposed by unknown people. Every six months you get thousands of new ones thrown at you and have to sort through them, knowing that in a world with a power-law distribution of outcomes, it will be painfully obvious if you miss the needle in this haystack. Optimism becomes urgent.But I'm hopeful that, with time, this kind of optimism can become widespread enough that it becomes a social custom, not just a trick used by a few specialists. It is after all an extremely lucrative trick, and those tend to spread quickly.Of course, inexperience is not the only reason people are too harsh on early versions of ambitious projects. They also do it to seem clever. And in a field where the new ideas are risky, like startups, those who dismiss them are in fact more likely to be right. Just not when their predictions are weighted by outcome.But there is another more sinister reason people dismiss new ideas. If you try something ambitious, many of those around you will hope, consciously or unconsciously, that you'll fail. They worry that if you try something ambitious and succeed, it will put you above them. In some countries this is not just an individual failing but part of the national culture.I wouldn't claim that people in Silicon Valley overcome these impulses because they're morally better. [1] The reason many hope you'll succeed is that they hope to rise with you. For investors this incentive is particularly explicit. They want you to succeed because they hope you'll make them rich in the process. But many other people you meet can hope to benefit in some way from your success. At the very least they'll be able to say, when you're famous, that they've known you since way back.But even if Silicon Valley's encouraging attitude is rooted in self-interest, it has over time actually grown into a sort of benevolence. Encouraging startups has been practiced for so long that it has become a custom. Now it just seems that that's what one does with startups.Maybe Silicon Valley is too optimistic. Maybe it's too easily fooled by impostors. Many less optimistic journalists want to believe that. But the lists of impostors they cite are suspiciously short, and plagued with asterisks. [2] If you use revenue as the test, Silicon Valley's optimism seems better tuned than the rest of the world's. And because it works, it will spread.There's a lot more to new ideas than new startup ideas, of course. The fear of making something lame holds people back in every field. But Silicon Valley shows how quickly customs can evolve to support new ideas. And that in turn proves that dismissing new ideas is not so deeply rooted in human nature that it can't be unlearnt. ___________ Unfortunately, if you want to do new things, you'll face a force more powerful than other people's skepticism: your own skepticism. You too will judge your early work too harshly. How do you avoid that?This is a difficult problem, because you don't want to completely eliminate your horror of making something lame. That's what steers you toward doing good work. You just want to turn it off temporarily, the way a painkiller temporarily turns off pain.People have already discovered several techniques that work. Hardy mentions two in A Mathematician's Apology: Good work is not done by "humble" men. It is one of the first duties of a professor, for example, in any subject, to exaggerate a little both the importance of his subject and his importance in it. If you overestimate the importance of what you're working on, that will compensate for your mistakenly harsh judgment of your initial results. If you look at something that's 20% of the way to a goal worth 100 and conclude that it's 10% of the way to a goal worth 200, your estimate of its expected value is correct even though both components are wrong.It also helps, as Hardy suggests, to be slightly overconfident. I've noticed in many fields that the most successful people are slightly overconfident. On the face of it this seems implausible. Surely it would be optimal to have exactly the right estimate of one's abilities. How could it be an advantage to be mistaken? Because this error compensates for other sources of error in the opposite direction: being slightly overconfident armors you against both other people's skepticism and your own.Ignorance has a similar effect. It's safe to make the mistake of judging early work as finished work if you're a sufficiently lax judge of finished work. I doubt it's possible to cultivate this kind of ignorance, but empirically it's a real advantage, especially for the young.Another way to get through the lame phase of ambitious projects is to surround yourself with the right people � to create an eddy in the social headwind. But it's not enough to collect people who are always encouraging. You'd learn to discount that. You need colleagues who can actually tell an ugly duckling from a baby swan. The people best able to do this are those working on similar projects of their own, which is why university departments and research labs work so well. You don't need institutions to collect colleagues. They naturally coalesce, given the chance. But it's very much worth accelerating this process by seeking out other people trying to do new things.Teachers are in effect a special case of colleagues. It's a teacher's job both to see the promise of early work and to encourage you to continue. But teachers who are good at this are unfortunately quite rare, so if you have the opportunity to learn from one, take it. [3]For some it might work to rely on sheer discipline: to tell yourself that you just have to press on through the initial crap phase and not get discouraged. But like a lot of "just tell yourself" advice, this is harder than it sounds. And it gets still harder as you get older, because your standards rise. The old do have one compensating advantage though: they've been through this before.It can help if you focus less on where you are and more on the rate of change. You won't worry so much about doing bad work if you can see it improving. Obviously the faster it improves, the easier this is. So when you start something new, it's good if you can spend a lot of time on it. That's another advantage of being young: you tend to have bigger blocks of time.Another common trick is to start by considering new work to be of a different, less exacting type. To start a painting saying that it's just a sketch, or a new piece of software saying that it's just a quick hack. Then you judge your initial results by a lower standard. Once the project is rolling you can sneakily convert it to something more. [4]This will be easier if you use a medium that lets you work fast and doesn't require too much commitment up front. It's easier to convince yourself that something is just a sketch when you're drawing in a notebook than when you're carving stone. Plus you get initial results faster. [5] [6]It will be easier to try out a risky project if you think of it as a way to learn and not just as a way to make something. Then even if the project truly is a failure, you'll still have gained by it. If the problem is sharply enough defined, failure itself is knowledge: if the theorem you're trying to prove turns out to be false, or you use a structural member of a certain size and it fails under stress, you've learned something, even if it isn't what you wanted to learn. [7]One motivation that works particularly well for me is curiosity. I like to try new things just to see how they'll turn out. We started Y Combinator in this spirit, and it was one of main things that kept me going while I was working on Bel. Having worked for so long with various dialects of Lisp, I was very curious to see what its inherent shape was: what you'd end up with if you followed the axiomatic approach all the way.But it's a bit strange that you have to play mind games with yourself to avoid being discouraged by lame-looking early efforts. The thing you're trying to trick yourself into believing is in fact the truth. A lame-looking early version of an ambitious project truly is more valuable than it seems. So the ultimate solution may be to teach yourself that.One way to do it is to study the histories of people who've done great work. What were they thinking early on? What was the very first thing they did? It can sometimes be hard to get an accurate answer to this question, because people are often embarrassed by their earliest work and make little effort to publish it. (They too misjudge it.) But when you can get an accurate picture of the first steps someone made on the path to some great work, they're often pretty feeble. [8]Perhaps if you study enough such cases, you can teach yourself to be a better judge of early work. Then you'll be immune both to other people's skepticism and your own fear of making something lame. You'll see early work for what it is.Curiously enough, the solution to the problem of judging early work too harshly is to realize that our attitudes toward it are themselves early work. Holding everything to the same standard is a crude version 1. We're already evolving better customs, and we can already see signs of how big the payoff will be. Notes[1] This assumption may be too conservative. There is some evidence that historically the Bay Area has attracted a different sort of person than, say, New York City.[2] One of their great favorites is Theranos. But the most conspicuous feature of Theranos's cap table is the absence of Silicon Valley firms. Journalists were fooled by Theranos, but Silicon Valley investors weren't.[3] I made two mistakes about teachers when I was younger. I cared more about professors' research than their reputations as teachers, and I was also wrong about what it meant to be a good teacher. I thought it simply meant to be good at explaining things.[4] <NAME> points out that you can go past treating something as a hack in the sense of a prototype and onward to the sense of the word that means something closer to a practical joke: I think there may be something related to being a hack that can be powerful � the idea of making the tenuousness and implausibility a feature. "Yes, it's a bit ridiculous, right? I'm just trying to see how far such a naive approach can get." YC seemed to me to have this characteristic. [5] Much of the advantage of switching from physical to digital media is not the software per se but that it lets you start something new with little upfront commitment.[6] <NAME> adds: The value of a medium without a vast gulf between the early work and the final work is exemplified in game mods. The original Quake game was a golden age for mods, because everything was very flexible, but so crude due to technical limitations, that quick hacks to try out a gameplay idea weren't all that far from the official game. Many careers were born from that, but as the commercial game quality improved over the years, it became almost a full time job to make a successful mod that would be appreciated by the community. This was dramatically reversed with Minecraft and later Roblox, where the entire esthetic of the experience was so explicitly crude that innovative gameplay concepts became the overriding value. These "crude" game mods by single authors are now often bigger deals than massive professional teams' work. [7] <NAME> suggests that we treat new things as experiments. That way there's no such thing as failing, since you learn something no matter what. You treat it like an experiment in the sense that if it really rules something out, you give up and move on, but if there's some way to vary it to make it work better, go ahead and do that [8] <NAME> points out that the internet has made this easier, because you can see programmers' first commits, musicians' first videos, and so on.Thanks to <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this.
https://github.com/Jollywatt/typst-wordometer
https://raw.githubusercontent.com/Jollywatt/typst-wordometer/master/tests/word-count-callback/test.typ
typst
MIT License
#import "/src/lib.typ": * #set page(width: 15cm, height: auto) #word-count-callback(stats => box(stroke: blue, inset: 1em)[ Guess what, this box contains #stats.words words! Full statistics: #stats ]) #rect[ #show: word-count One two three four. There are #total-words total words and #total-characters characters. ]
https://github.com/matsumo0922/typst-keio-b2-template
https://raw.githubusercontent.com/matsumo0922/typst-keio-b2-template/master/template.typ
typst
#import "@preview/physica:0.9.2": * #let textL = 1.8em #let textM = 1.6em #let font = ("Hiragino Kaku Gothic ProN") #let reportInfo( title: "", experimentDateTime: "", experimentDayOfWeek: "", experimentPartOfDay: "", ) = { table( align: center + horizon, columns: (0.3fr, 1fr), inset: 8pt, [実験日], [ #experimentDateTime #h(0.5cm) (#experimentDayOfWeek) (#experimentPartOfDay) ], [実験題目], [#title], ) } #let authorInfo( author: "", department: "", class: "", studentId: "", ) = { rect( stroke: ( bottom: 1.5pt, top: 1.5pt, left: 1.5pt, right: 1.5pt, ), height: auto, width: 100%, inset: 0pt, grid( [ #table( align: center + horizon, columns: (1.5cm, 1fr, 2cm, 1.5cm, 2.5cm, 3cm), inset: 8pt, [学科], [#department], [クラス], [#class], [学籍番号], [#studentId], ) ], [ #table( align: center + horizon, columns: (0.3fr, 1fr), inset: 16pt, [*報告者氏名*], [#text(textM)[#author]], ) ], ), ) } #let coExperimenterInfo(valuse) = { grid( stroke: ( bottom: 1pt, top: 1pt, left: 1pt, right: 1.5pt, ), columns: (0.3fr, 1fr), [ #align(horizon)[ 共同実験者 ] ], stack(..for v in valuse { (rect(width: 100%, inset: 8pt, [#v]),) }), ) } #let fillingInfo( fillingDateTime: "", ReFillingDateTime: "", ) = { table( align: center + horizon, columns: (0.3fr, 1fr), inset: 8pt, [提出日], [#fillingDateTime], [再提出日], [#ReFillingDateTime], ) } #let climateInfo( temperature: "", humidity: "", atomosphericPressure: "", ) = { align(left)[ #block(width: 40%)[ #table( align: center + horizon, columns: (0.3fr, 1fr), inset: 8pt, [気温], [$#temperature degree.c$], [湿度], [$#humidity percent$], [気圧], [$#atomosphericPressure "hPa"$], ) ] ] } #let project( title: "", author: "", coExperimenter: none, experimentDateTime: none, experimentDayOfWeek: none, experimentPartOfDay: none, fillingDateTime: none, ReFillingDateTime: none, department: none, class: none, studentId: none, temperature: "", humidity: "", atomosphericPressure: "", body, ) = { set document(author: author, title: title) // start page number set page(numbering: "1", number-align: center) counter(page).update(1) // Font set text(font: font, lang: "ja") // Heading set heading(numbering: (..nums) => { if nums.pos().len() > 1 { nums.pos().map(str).join(".") + " " } else { text(cjk-latin-spacing: none)[#str(nums.pos().first()) ] h(1em) } }) show heading: set text(font: font, weight: "bold", lang: "ja") show heading.where(level: 1): it => { set text(size: 1.2em) pad(top: 1em, bottom: 1em)[ #it ] } show heading.where(level: 2): it => pad(top: 1em, bottom: 0.6em, it) show heading.where(level: 3): it => pad(top: 0.6em, bottom: 0.6em, it) // Figure show figure: it => pad(y: 1em, it) show figure.caption: it => pad(top: 0.5em, it) show figure.where(kind: table): set figure.caption(position: top) show figure: set block(breakable: true) // Outline show outline.entry: set text(font: font, lang: "ja") show outline.entry.where(level: 1): it => { v(0.2em) set text(weight: "semibold") it } // Math set math.equation(numbering: "(1)") align(center)[ #v(6em) #block(text(textL, "理工学基礎実験レポート")) #v(4em) #reportInfo( title: title, experimentDateTime: experimentDateTime, experimentDayOfWeek: experimentDayOfWeek, experimentPartOfDay: experimentPartOfDay, ) #v(2em) #authorInfo( author: author, department: department, class: class, studentId: studentId, ) #v(2em) #coExperimenterInfo(coExperimenter) #v(2em) #fillingInfo(fillingDateTime: fillingDateTime, ReFillingDateTime: ReFillingDateTime) #v(2em) #climateInfo(temperature: temperature, humidity: humidity, atomosphericPressure: atomosphericPressure) ] pagebreak(weak: true) set par(justify: true) body }
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/PianoDiProgetto/sections/PreventivoSprint/QuindicesimoSprint.typ
typst
MIT License
#import "../../const.typ": Re_cost, Am_cost, An_cost, Ve_cost, Pr_cost, Pt_cost #import "../../functions.typ": prospettoOrario, prospettoEconomico, glossary ==== Quindicesimo preventivo *Inizio*: Venerdì 29/03/2024 *Fine*: Giovedì 04/04/2024 #prospettoOrario(sprintNumber: "15") #prospettoEconomico(sprintNumber: "15")
https://github.com/TGM-HIT/typst-protocol
https://raw.githubusercontent.com/TGM-HIT/typst-protocol/main/template/main.typ
typst
MIT License
#import "@preview/tgm-hit-protocol:0.1.0": * #set text(lang: "de") #show: template( title: [Protokolle in Typst], course: [5xHIT 20yy/yy], subtitle: [Laborprotokoll], subject: [Systemtechnik Labor], author: "<NAME>", teacher: [<NAME>], version: [1.0], begin: parse-date("2024-10-07"), finish: parse-date("2024-10-07"), date: parse-date("2024-10-09"), bibliography: bibliography("bibliography.bib"), ) #import "assets/mod.typ" as assets #include "glossaries.typ" = Einführung Diese Protokollvorlage soll helfen den Laborübungsteil entsprechend dokumentieren zu können. Diese Vorlage ist in Typst verfasst. == Ziele Hier werden die zu erwerbenden Kompetenzen und deren Deskriptoren beschrieben. Diese werden von den unterweisenden Lehrkräften vorgestellt. Dies kann natürlich auch durch eine Aufzählung erfolgen: - Dokumentiere wichtige Funktionen - Gib eine Einführung zur Verwendung von Typst == Voraussetzungen Welche Informationen sind notwendig um die Laborübung reibungslos durchführen zu können? Hier werden alle Anforderungen der Lehrkraft detailliert beschrieben und mit Quellen untermauert. == Aufgabenstellung Hier wird dann die konkrete Aufgabenstellung der Laborübung definiert. == Bewertung Hier wird die Bewertung für das Beispiel auf die jeweiligen Kompetenzen aufgeteilt. Diese soll zur leichteren Abnahme auch nicht entfernt werden. Nun kommt ein Seitenumbruch, um eine klare Trennung der Schülerarbeit zu bestimmen. #pagebreak() = Anwendung Hier sollen die Schritte der Laborübung erläutert werden. Hier sind alle Fragestellungen der Lehrkraft zu beantworten. Etwaige Probleme bzw. Schwierigkeiten sollten ebenfalls hier angeführt werden. In diesem Fall werden einige Typst-Elemente dokumentiert, welche bei der Kreation von Protokollen behilflich sein könnten. == Figures Wenn man etwas in ein figure packt, dann kann es in einem Abbildungsverzeichnis (oder ähnliches) später aufgelistet werden. #figure( "Auch Text ist möglich!", caption: [Figure mit Text], ) <text-figure> Man kann ihnen Labels (\<text-figure>) geben, und referenzieren (@text-figure). Die folgenden Features können auch ohne figures verwendet werden. == Abbildungen #figure( assets.just-do-it-logo(width: 50%), caption: [Mit Beschreibung und Label], ) == Mathe :) === Inline Die coole Formel: $e^(i*pi)+1=0$ === Zentriert $ e^(i*pi)+1=0 $ === Figure #figure( $ e^(i*pi)+1=0 $, caption: [Eulersche Identität], ) == Tabellen #figure( table( columns: (1fr, 9fr), table.header([*Header*], [*Kopf*]), [#lorem(2)], [#lorem(10)], [#lorem(2)], [uwu], ), caption: [Tabellen], ) == Aufzählung - Element einer Aufzählung - Erstes eingerücktes Element einer Aufzählung - Zweites eingerücktes Element einer Aufzählung + Element einer Aufzählung + Erstes eingerücktes Element einer Aufzählung + Zweites eingerücktes Element einer Aufzählung == Glossar Das Glossar enthält Erklärungen von Begriffen und Abkürzen, die im Fließtext keinen Platz haben. In der Datei `glossaries.typ` werden Begriffe -- oder in diesem Fall eine Abkürzung -- in der folgenden Form definiert: #figure( ```typ #glossary-entry( "ac:tgm", short: "TGM", long: "Technologisches Gewerbemuseum", ) ```, caption: [Eintrag einer Abkürzung in `glossaries.typ`], ) Verwendet werden kann dieser Glossareintrag ähnlich einer Quellenangabe durch ```typ @ac:tgm```. Bei der ersten Verwendung wird die Langform automatisch auch dargestellt: @ac:tgm. Bei weiteren Verwendungen wird dagegen nur die Kurzform angezeigt: @ac:tgm. Mit der Funktion ```typc gls()``` kann auch die Langform erzwungen werden: #gls("syt") ist beim ersten mal auch ausgeschrieben, aber hier wird es manuell erwirkt: #gls("syt", long: true). == Quelltext #figure( ```cpp #include <iostream> int main() { // Ich bin ein Kommentar! std::cout << "Hello World! :3\n"; } ```, caption: [C++ Code], )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/supercharged-dhbw/1.0.0/README.md
markdown
Apache License 2.0
# Supercharged DHBW Unofficial [Typst](https://typst.app/) template for DHBW students. The template is currently only available in English. You can see an example PDF [here](https://github.com/DannySeidel/typst-dhbw-template/blob/main/example.pdf). ## Usage You can use this template in the Typst web app by clicking "Start from template" on the dashboard and searching for `supercharged-dhbw`. Alternatively, you can use the CLI to kick this project off using the command ```shell typst init @preview/supercharged-dhbw ``` Typst will create a new directory with all the files needed to get you started. ## Fonts This template uses the following fonts: - [Montserrat](https://fonts.google.com/specimen/Montserrat) - [Open Sans](https://fonts.google.com/specimen/Open+Sans) If you want to use typst locally, you can download the fonts from the links above and install them on your system. Otherwise, when using the web version add the fonts to your project. For further information on how to add fonts to your project, please refer to the [Typst documentation](https://typst.app/docs/reference/text/text/#parameters-font). ## Contents - Title page - Confidentiality Statement - Declaration of Authorship - List of figures - List of tables - Code snippets - Table of contents - Abstract - Bibliography - Appendix A more detailed explanation of the features can be found in the `main.typ` file. ## Configuration This template exports the `supercharged-dhbw` function with the following named arguments: `title`: Title of the document `authors`: List of authors with the following named arguments: - name: Name of the author - student-id: Student ID of the author - course: Course of the author - course-of-studies: Course of studies of the author - company: Company of the author `at-dhbw`: Whether the document is written at the DHBW or not, default is false `show-confidentiality-statement`: Whether the confidentiality statement should be shown, default is true `show-declaration-of-authorship`: Whether the declaration of authorship should be shown, default is true `show-table-of-contents`: Whether the table of contents should be shown, default is true `show-acronyms`: Whether the list of acronyms should be shown, default is true `show-list-of-figures`: Whether the list of figures should be shown, default is true `show-list-of-tables`: Whether the list of tables should be shown, default is true `show-code-snippets`: Whether the code snippets should be shown, default is true `show-appendix`: Whether the appendix should be shown, default is false `show-abstract`: Whether the abstract should be shown, default is true `abstract`: Content of the abstract `university`: Name of the university `university-location`: Campus or city of the university `supervisor`: Name of the supervisor at the university or company `date`: Date of the document `logo-left`: Path to the logo on the left side of the title page `logo-right`: Path to the logo on the right side of the title page `bibliography`: path to the bibliography file If you want to change an existing project to use this template, you can add a show rule like this at the top of your file: ```typst #import "@preview/supercharged-dhbw:1.0.0": * #show: supercharged-dhbw.with( title: "Exploration of Typst for the Composition of a University Thesis", authors: ( (name: "<NAME>", student-id: "1234567", course: "TIM21", course-of-studies: "Mobile Computer Science", company: ( (name: "ABC AG", post-code: "08005", city: "Barcelona", country: "Spain") )), (name: "<NAME>", student-id: "7654321", course: "TIS21", course-of-studies: "IT-Security", company: ( (name: "YXZ GmbH", post-code: "70435", city: "Stuttgart", country: "") )), ), at-dhbw: false, // if true the company name on the title page and the confidentiality statement are hidden show-confidentiality-statement: true, show-declaration-of-authorship: true, show-table-of-contents: true, show-acronyms: true, show-list-of-figures: true, show-list-of-tables: true, show-code-snippets: true, show-bibliography: true, show-appendix: false, show-abstract: true, abstract: abstract, // displays the abstract defined above university: "Cooperative State University Baden-Württemberg", university-location: "Ravensburg Campus Friedrichshafen", supervisor: "<NAME>", date: datetime.today(), logo-left: image("assets/logos/dhbw.svg"), // logo-right: image("assets/logos/company.svg") ) // Your content goes here ```
https://github.com/hongjr03/shiroa-page
https://raw.githubusercontent.com/hongjr03/shiroa-page/main/DSA/chapters/7图.typ
typst
#import "../template.typ": * #import "@preview/pinit:0.1.4": * #import "@preview/fletcher:0.5.0" as fletcher: diagram, node, edge #import "/book.typ": book-page #show: book-page.with(title: "图 | DSA") = 图 <图> == 图的定义和术语 <图的定义和术语> #definition[ *图*:有向图是由一个顶点集 $V$ 和一个弧集 $R$ 组成的二元组 $G = (V, R)$。无向图是由一个顶点集 $V$ 和一个边集 $E$ 组成的二元组 $G = (V, E)$。 ] *术语*: - *网*:带权的图 - *子图*:$G = (V', E')$ 是 $G = (V, E)$ 的子图,当 $V' subset.eq V$ 且 $E' subset.eq E$。 - *完全图*:每两个顶点之间都有边的图,无向图中有 $n(n-1)/2$ 条边,有向图中有 $n(n-1)$ 条边。 - *稀疏图*:边数小于 $n log n$ 的图。 - *稠密图*:不是稀疏图的图。 - *邻接*:两个顶点之间有边,两个顶点互为邻接点。 - *关联*:边与顶点之间有关系,关联的边的数目称为顶点的*度*。 - *连通图*:无向图中任意两个顶点之间都有路径。 - *连通分量*:非连通图中的极大连通子图。 - *强连通图*:有向图中任意两个顶点之间都有路径。 - *强连通分量*:非强连通图中的极大强连通子图。 - *生成树*:连通图的生成树是一个极小连通子图,包含图中所有顶点,但只有足以构成一棵树的 $n-1$ 条边。 - *生成森林*:非连通图的生成森林是它的各连通分量的生成树的集合。 == 图的存储结构 === 邻接矩阵 #definition[ *邻接矩阵*:对于一个有 $n$ 个顶点的图,可以用一个 $n times n$ 的矩阵来表示,矩阵的元素 $a_(i j)$ 表示顶点 $v_i$ 和顶点 $v_j$ 之间是否有边,以及边的权值。 ] 对于无向图,邻接矩阵是对称的;对于有向图,邻接矩阵不一定对称。 === 邻接表 弧结点结构: #table( columns: (5em, 5em, 5em), rows: 2em, align: center + horizon, [adjvex], [nextarc], [info], ) ```c typedef struct ArcNode { int adjvex; // 该弧所指向的顶点的位置 struct ArcNode *nextarc;// 指向下一条弧的指针 InfoType *info; // 该弧相关信息的指针 } ArcNode; ``` 顶点结点结构: #table( columns: (5em, 5em), rows: 2em, align: center + horizon, [data], [firstarc], ) ```c typedef struct VNode { VertexType data; // 顶点信息 ArcNode *firstarc;// 指向第一条依附该顶点的弧 } VNode, AdjList[MAX_VERTEX_NUM]; ``` 图的结构: ```c typedef struct { AdjList vertices; int vexnum, arcnum;//图的当前顶点数和弧数 int kind; // 图的种类标志 } ALGraph; ``` #grid( columns: 2, )[#image("../assets/2024-06-25-19-00-40.png")][#image("../assets/2024-06-25-19-01-06.png")][#image("../assets/2024-06-25-19-01-33.png")] == 图的遍历 === 深度优先搜索 DFS #definition[ *深度优先搜索*:从图中某个顶点 $v$ 出发,访问此顶点,然后从 $v$ 的未被访问的邻接点 $w$ 出发深度优先搜索 $w$ 的邻接点,直至图中所有和 $v$ 有路径相通的顶点都被访问到。 ] 基本思想:模仿树的先序遍历,从一个顶点出发,沿着一条路径访问到最深的顶点,然后回溯,访问其他路径。 如何判别 $V$ 的邻接点是否被访问? #note_block[ 为了避免重复访问,可以设置一个访问标志数组 `visited`,每次访问一个顶点时,将其标志位置为已访问。 ] ```c void DFS(Graph G, int v) { // 从顶点v出发,深度优先遍历图 G visited[v] = TRUE; VisitFunc(v);//访问第v个顶点 for (w = FirstAdjVex(G, v); w != 0; w = NextAdjVex(G, v, w)) if (!visited[w]) DFS(G, w); // 对v的尚未访问的邻接顶点w递归调用DFS }// DFS void DFSTraverse(Graph G, Status (*Visit)(int v)) { // 对图 G 作深度优先遍历。 VisitFunc = Visit; for (v = 0; v < G.vexnum; ++v) visited[v] = FALSE;// 访问标志数组初始化 for (v = 0; v < G.vexnum; ++v) if (!visited[v]) DFS(G, v); // 对尚未访问的顶点调用DFS } ``` 非递归算法: ```C void DFS(Graph G, int v) {//从v出发深度优先搜索图G int w; InitStack(S);//初始化栈 Push(S, v); visited[v] = TRUE; while (!StackEmpty(S)) { Pop(S, v); visit(w); w = FirstAdjVertex(G, v);//求v的第一个邻接点 while (w != -1) { if (!visited[w]) { Push(S, w); visited[w] = TRUE; } w = NextAdjVertex(G, v, w); //求v相对于w的下一个邻接点 }//end while } //end while } //DFS ``` 遍历顺序取决于邻接表中顶点的顺序。 === 广度优先搜索 BFS #definition[ *广度优先搜索*:从图中某个顶点 $v$ 出发,访问此顶点,然后访问 $v$ 的所有邻接点,再依次访问邻接点的邻接点,直至图中所有和 $v$ 有路径相通的顶点都被访问到。 ] 基本思想:模仿树的层次遍历,从一个顶点出发,依次访问其邻接点,然后再访问邻接点的邻接点。 #image("../assets/2024-06-25-19-13-30.png") ```c void BFSTraverse(Graph G, Status (*Visit)(int v)) { //按广度优先非递归遍历图G,使用辅助队列Q和 //访问标志数组visited for (v = 0; v < G.vexnum; ++v) visited[v] = FALSE;//初始化访问标志 InitQueue(Q); // 置空的辅助队列Q for (v = 0; v < G.vexnum; ++v) if (!visited[v]) {// v 尚未访问 visited[u] = TRUE; Visit(u); // 访问u EnQueue(Q, v);// v入队列 while (!QueueEmpty(Q)) { DeQueue(Q, u); // 队头元素出队并置为u for (w = FirstAdjVex(G, u); w >= 0; w = NextAdjVex(G, u, w)) if (!visited[w]) {//W为u的尚未访问的邻接顶点 visited[w] = TRUE; Visit(w); EnQueue(Q, w);// 访问的顶点w入队列 } // if } // while } }// BFSTraverse ``` == 最小生成树 #definition[ *最小生成树*:带权图中,权值之和最小的生成树称为最小生成树。 ] 两种常用的算法: - *Prim 算法*:从一个顶点出发,每次选择与当前顶点*集合*相邻的最短边,直到所有顶点都被包含在最小生成树中。(归并*顶点*,适用于稠密网) - *Kruskal 算法*:按照边的权值从小到大的顺序选择 $n-1$ 条边,并保证这 $n-1$ 条边不构成回路,如此重复,直至加上 $n-1$ 条边为止。。(归并*边*,适用于稀疏网) == 有向无环图及其应用 #definition[ *有向无环图*:无回路的有向图称为有向无环图。 ] === 拓扑排序 #definition[ *拓扑排序*:将有向无环图中的所有顶点排成一个线性序列,使得图中任意一条边 $(v_i, v_j)$,$v_i$ 在序列中出现在 $v_j$ 之前。 ] 拓扑排序的算法: 1. 从有向图中选择一个没有前驱的顶点并输出。(入度为 $0$) 2. 从图中删除该顶点和所有以它为*尾*的弧。(弧头的入度减一) === 关键路径 #note_block[ *问题*: 假设以有向网表示一个施工流图,其中,*顶点表示事件*,弧表示活动,弧上的权值表示活动的持续时间。该网络称之为AOE网络。 假设以该AOE网络表示一个施工流图,则有待研究的问题是: + 完成整项工程至少需要多少时间? + 哪些工程是影响整个工程进度的关键? *解*: 1. 从源点到汇点的最长路径长度即为完成整项工程所需的最短时间。 2. 关键活动是指影响整个工程进度的活动,即最长路径上的活动,该弧上的权值增加将使有向图上的最长路径长度增加。 ] #definition[ *关键路径*:AOE网络中,最长路径上的活动称为关键活动,最长路径的长度称为关键路径的长度。 ] 求关键活动: - 事件的最早发生时间 $v e(j)$:从源点到该事件的*最长*路径长度,决定了所有以 $v_j$ 为尾的弧的最早开始时间。 - 事件的最迟发生时间 $v l(k) = "工程完成时间" - "从顶点" v_k "到汇点的"underline("最长")"路径长度"$:表示在不推迟整个工程完成的前提下,事件*最迟*发生的时间,取的是最迟发生时间*最小*的那个。 - 活动的最早发生时间 $e e(i)$:即活动起点事件的最早发生时间。 - 活动的最迟发生时间 $l l(i) = "活动终点事件的最迟发生时间" - "活动持续时间"$:即活动终点事件的最迟发生时间减去活动持续时间,也就是活动起点事件的最迟发生时间。 当活动的最早发生时间等于最迟发生时间时,该活动为关键活动。 实现要点: - 求 $v e$ 的顺序是按拓扑序的。 - 求 $v l$ 的顺序是*逆*拓扑序的,所以要另设一个栈存储拓扑序。 == 最短路径 #definition[ *最短路径*:在图中,从一个顶点到另一个顶点的路径中,边的权值之和最小的路径称为最短路径,其权值之和称为最短路径长度。 ] 两种常用的算法: - *Dijkstra 算法*:单源最短路径,适用于边权值为正的图。 - *Floyd 算法*:所有顶点间的最短路径,适用于边权值为任意的图。 === Dijkstra 算法 算法步骤: 1. 初始化 $"dist"$ 数组,$"dist"[i]$ 表示从源点到顶点 $i$ 的最短路径长度,$"dist"[s] = 0$,$"dist"[i] = +infinity$。 2. 从 $"dist"$ 数组中选择一个未被访问的顶点 $u$,使得 $"dist"[u]$ 最小,标记 $u$ 为已访问。 3. 更新 $"dist"$ 数组,对于 $u$ 的所有邻接点 $v$,如果 $"dist"[u] + w(u, v) < "dist"[v]$,则更新 $"dist"[v] = "dist"[u] + w(u, v)$。 4. 重复 2 和 3,直到所有顶点都被访问。 === Floyd 算法 算法步骤: 1. $D^(-1)$ 初始化为邻接矩阵 $A$,$P^(-1)$ 初始化为图中的弧。$D$ 表示最短路径长度,$P$ 表示最短路径。 2. 对于每一对顶点 $i$ 和 $j$,如果 $D^(-1)[i][j] > D^(-1)[i][k] + D^(-1)[k][j]$,则更新 $D^(-1)[i][j] = D^(-1)[i][k] + D^(-1)[k][j]$,$P^(-1)[i][j] = P^(-1)[k][j]$。 #grid( columns: 2, )[#image("../assets/2024-06-25-20-55-59.png")][#image("../assets/2024-06-25-20-55-46.png")]
https://github.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53A-Notebook-Over-Under-2023-2024/master/Vex%20Robotics%2053A%20Notebook%202023%20-%202024/Entries/Build%20Entry/Catapult-Assembly.typ
typst
#set page(header: [VR #h(1fr) November 11, 2023 ]) = CATAPULT ASSEMBLY \ == Stand-Up Notes #let cell = rect.with( inset: 8pt, fill: rgb("#E3E3E3"), width: 100%, radius: 10pt ) #grid( columns: (170pt, 170pt, 170pt), rows: (90pt, 90pt), gutter: 3pt, cell(height: 100%)[*Veena*:\ - Akif and I will slip the gears that drive the catapult and redesign our brain mount], cell(height: 100%)[*Michael*:\ - I will disassemble the old catapult, cut new towers to mount the new catapult], cell(height: 100%)[*Jacob*: - I will assemble the new arm of the catapult], cell(height:100%)[*Zoey*: \ - I will work on the typst notebook and update pros to pros 4] ) \ == Assembly Today we finished assembling our catapult. #figure( image("/Images/Build Images/CataBack.png", width: 76.942%), caption: [Back of Catapult] ) #figure( image("/Images/Build Images/Catapult Inside.png", width:87% ), caption: [Front of Catapult] ) #figure( image("/Images/Build Images/12ToothRatchet.png", width:86.4%), caption: [Ratchet] ) == Battery Mount See original mount on pg 45 of Volume 2. #block( width: 100%, fill: rgb("FFEAE8"), inset: 8pt, radius: 4pt, [ *Problem Analysis* - During our last tournament, our battery got unplugged by our opponent during a critical match (see pg []) - The mount also gradually loosened itself throughout the tournament ], ) #block( width: 100%, fill: rgb("EEEEFF"), inset: 8pt, radius: 4pt, [ *Solution* \ - With the new space under our catapult, we decided to replace our previous battery “cage” (see pg []) with battery clips - This is more inconspicuous and space efficient ]) // Vertical intake sketch.png #block( width: 100%, fill: rgb("FFFEEB"), inset: 8pt, radius: 4pt, [*Design* #figure( image("/Images/Build Images/battery Mount Side.png", width: 100%), caption: [Intake Initial Design] ) ] )
https://github.com/csimide/SEU-Typst-Template
https://raw.githubusercontent.com/csimide/SEU-Typst-Template/master/CHANGELOG.md
markdown
MIT License
# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.3.0] - 2024-07-07 - 尝试弃用大部分自造轮子,改为通过引入第三方 package 实现相关功能。 - 规范化模板参数/变量名。 - 校对毕设模板的间距。 [^1] [^1]: 由于 Typst 使用的行距模型与 Word 不同,行距难以保持完全一致。 ### Breaking Changes 破坏性变更 - `#import` 方式改变:由原来的 ```typst // 毕设 #import "@preview/cheda-seu-thesis:0.2.2": bachelor-conf, thanks, appendix // 学位 #import "@preview/cheda-seu-thesis:0.2.2": degree-conf, thanks, appendix ``` 更改为 ```typst // 毕设 #import "@preview/cheda-seu-thesis:0.3.0": bachelor-conf, bachelor-utils #let (thanks, show-appendix) = bachelor-utils // 学位 #import "@preview/cheda-seu-thesis:0.3.0": degree-conf, degree-utils #let (thanks, show-appendix) = degree-utils ``` 本模板暂未计划完全改为闭包。 - 进入附录章节的方式改变: - 由 `#appendix()` 变为 `#show: shou-appendix`; - `#bibliography` 不再会自动进入附录。 - 引用图表的方式改变: - 由自造轮子改为使用 `i-figured` ; - 需要将旧版本的 `@xxx` 修改为对应类型的 `@tbl:xxx` `@fig:xxx` `@eqt:xxx` 。 - 模板参数格式改变:详见对应模板的 demo 。 - 不再使用 `state` 储存章节标题与章节编号。 ### 改进 - 使用 `i-figured` 代替自造的公式编号引用轮子。 - 使用自带的 `outline` 代替自造的目录页轮子。 - 统一变量、参数等的命名风格。 - 不再使用大量 `state` 。 - 更新学位论文授权声明文字。 ### 修复 - 修复学位论文页眉读取章节号、名称时可能取到 `none` 的问题。 - 修复毕设引用文献中不显示末尾 `.` 的问题。 ## [0.2.2] - 2024-05-18 ### 改进 - 学位论文改为使用 Typst 0.11.0 增加的公式编号位置参数代替原有的公式编号对齐轮子。 - 拆分 CSL 文件,按本研不同的要求分为两个文件。 ## [0.2.1] - 2024-05-02 ### 新功能 - 允许控制学位论文的一级标题页面是否显示页眉。 ### 改进 - 优化资源文件大小。 ## [0.2.0] - 2024-04-15 此版本重构了目录结构,合并两个模板的大部分工具函数,并按 Typst template package 组织文件。 [0.3.0]: https://github.com/csimide/SEU-Typst-Template/compare/c44b5172178c0c2380b322e50931750e2d761168...v0.3.0 [0.2.2]: https://github.com/csimide/SEU-Typst-Template/compare/908a28c7da02b260f04dcf31ed22278a212cad19...c44b5172178c0c2380b322e50931750e2d761168 [0.2.1]: https://github.com/csimide/SEU-Typst-Template/compare/42b34b829bb9816d89a0955e2196346ab6e39ad4...908a28c7da02b260f04dcf31ed22278a212cad19
https://github.com/El-Naizin/cv
https://raw.githubusercontent.com/El-Naizin/cv/main/modules/education.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Education") #cvEntry( title: [Master of Data Science], society: [University of California, Los Angeles], date: [2018 - 2020], location: [USA], logo: "../src/logos/ucla.png", description: list( [Thesis: Predicting Customer Churn in Telecommunications Industry using Machine Learning Algorithms and Network Analysis], [Course: Big Data Systems and Technologies #hBar() Data Mining and Exploration #hBar() Natural Language Processing] ) ) #cvEntry( title: [Bachelors of Science in Computer Science], society: [University of California, Los Angeles], date: [2018 - 2020], location: [USA], logo: "../src/logos/ucla.png", description: list( [Thesis: Exploring the Use of Machine Learning Algorithms for Predicting Stock Prices: A Comparative Study of Regression and Time-Series Models], [Course: Database Systems #hBar() Computer Networks #hBar() Software Engineering #hBar() Artificial Intelligence] ) )
https://github.com/vsheg/intermediate-ml
https://raw.githubusercontent.com/vsheg/intermediate-ml/main/defs.typ
typst
#let const = $"const"$ #let hr = { line() } #let xb = math.bold("x") #let tb = math.bold(math.theta) #let ub = math.underbrace #let ob = math.overbrace #let Tr = math.sans("T ") #let accent-color = eastern #let hg(content) = text(fill: accent-color, $#content$) #let RSS = "RSS" #let Pr = math.bb("P") #let Ex = math.bb("E") #let Var = "Var" #let Cov = "Cov" #let Cor = "Cor" #let supp = "supp" #let bra = sym.angle.l #let ket = sym.angle.r #let dmat(a, b, c) = $mat(#a, thin, thin;thin, #b, thin;thin, thin, #c)$
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/002%20-%20Return%20to%20Ravnica/008_The%20Great%20Concourse.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Great Concourse", set_name: "Return to Ravnica", story_date: datetime(day: 24, month: 10, year: 2012), author: "<NAME>", doc ) The three dryads sat in a circle as they had done for the past three months, hoping they could make contact. They did it alone, in a small grove where the branches of the trees curved about them to create a quiet, interior space apart from the massive granite and brick buildings that sprawled about them like an ancient, fallen golem. They awoke from their trance and allowed the world to come back into focus—the wind rustling through the leaves; the short song of a bird; and the constant, far-away drone of Ravnica and its inhabitants moving like some endless ocean. #figure(image("008_The Great Concourse/01.jpg", width: 100%), caption: [Gatecreeper Vine | Art by Trevor Claxton], supplement: none, numbering: none) They were an inseparable trio but far from identical. Oba was wild and full of life, her hair tangled with leaves and vines, her eyes shifting with her moods—from green like flecks of emerald and jade to smoky brown. Ses, unlike her sister, was ordered in manner and speech; her hair was held in place by a headpiece made of goldenwood, and fell to her shoulders in a cascade of auburn. Cim was both the eldest and the bridge between the other two sisters; even though she was a small, slight dryad, a power existed within her that everyone in the Conclave could feel. Cim could find paths where none could be seen and always found a way to balance the needs of one with the other. Cim was the first to speak. "I was close. Really close this time, but it's so confusing. She's there in that giant web, I know it. It's just like she can't focus... or I can't focus." Cim ran her slender fingers through close-cropped hair and then pulled a green hood over her head to close off the outside world. "We saw it too..." Oba said, looking at her other sister Ses, who finished her sentence. "...but it's too big." They fell back into the grass, letting the coolness of it bring them further out of trance. Cim stared at the skyline, her chin resting on her knees. "We've got to reach her," Cim said. "Or she'll leave us all." "It's getting dangerous," Ses said. "It was harder to get you back this time," Oba echoed. "All of Selesnya are counting on us and we can't fail them." Cim furrowed her brows. "We can't let the guild dissolve. We can't give up on her." "What if she doesn't want to be brought back, Cim?" Ses asked. "Are any of us strong enough to go against her will?" "What if it's a test?" Oba looked at her sisters. "Maybe she wants something from us." After a moment of silence, an invisible understanding passed between the sisters. Cim got up. "Suniel will want to know what we saw." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Suniel sat among the high priests of Selesnya and could see it written on their faces. The empathic link of the Worldsoul exposed in its subtle, nonverbal way a truth they could not turn away from: Mat'Selesnya was inexorably fading like the light of a dying candle. After the initial grim reports of more lost members, withering belief, and factional rumblings were listened to by the members, the elf priest Molander slowly stood up and addressed the assembly. He looked haggard for an elf, Suniel thought, but then again, Molander had always looked haggard. "We have to think the unthinkable," Molander said in his orderly, matter-of-fact way. "As much as we would like to continue wishing for some random miracle to fall from the skies, we have to prepare. Selesnya must go on with or without our #emph[parun] , Mat'Selesnya." Molander waited for a moment for his words to sink in while an assistant brought an ornate scroll to the table. "Since the attack on Vitu-Ghazi, I have begun work on a way to keep the guild alive by teaching our precepts at an academy. A place where the structure and ethos of our guild can be taught, refined and carried out by future members of our—" "And now it comes out!" Troslon rose and planted his boulder-like fists on the table. "You can't wait to impose your little grid of rules over us all." He turned to address the others. "Where there is life, there is Selesnya, and that is all anyone in this guild needs to know. You want rules and academies, go to the Azorius." #figure(image("008_The Great Concourse/02.jpg", width: 100%), caption: [Temple Garden | Art by Volkan Baga], supplement: none, numbering: none) "Not rules, Troslon. Order." Molander replied in the tone of one who has had this same argument with the same person hundreds of times. "Our guild is breaking apart. Members are leaving. Even our most devoted are losing their connection to the Worldsoul. We need something to build around. Something tangible." "I'll show you tangible," Troslon rumbled, balling up a massive fist. "Spoken like a Gruul," Molander shot back. "You'd have us all living in rubble within a year." "Gentlemen," Alcarus said, just loud enough to pull their attention from each other. "If you have forgotten, not long ago they dragged Rakdos through the streets like a butchered indrik and threw him into a bloody hellpit. No one knows if he's dead or alive. Why is it those maniacs can figure it out and we sit here shooting slurs at each other?" "If you think that running about like a pack of wild dogs while cannibalizing one another is 'figuring it out,'" Sadruna said, "then by all means, use them as a model of success." Her face held a look that emphasized her point. "We are nothing like those murderers." Suniel watched as the old arguments inevitably began to arise. The high council began to break down into quarreling factions along well-worn lines of dissent—those who were for returning to nature, allowing the trees to grow wild and worshiping the ancient rites of life, and those who were for order, making sure that upholding the structure of the guild was made paramount. As the discussion devolved into the emotionally charged noise of confusion and righteousness, Suniel sighed and looked out the window at a wooded hill in the distance surrounded by peaks and spires—a small, insignificant place where three young dryads sought to make contact with one of the most ancient beings on Ravnica. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Suniel's house was a sculptural masterpiece. Amid the angular bricks and hard edges of Ravnican architecture, the sensuous curves and organic flow of Suniel's home made it seem like something from another world. Suniel had formed his house out of several nearby cedars, bending and calling their material to grow in particular ways pleasing to the eye and to the hand. It was said that Suniel's home was a visual representation of the Lattice of the Worldsoul—the empathic energy that connected all Selesnya—but the woodshaper humbly maintained that he only followed the silent guidance of Mat'Selesnya when creating his works. Cim sat on a comfortable chair big enough to hold her, Oba, and Ses. The three dryads looked pale but resolute as they sipped tea made from wildwire and pallis root. "I was close to her, Suniel. I could feel her in there, like she's trapped within web, but I can't seem to get close enough to touch it. I feel like I'm diving for shells and I run out of air." #figure(image("008_The Great Concourse/03.jpg", width: 100%), caption: [Druid’s Deliverance | Art by <NAME>cott], supplement: none, numbering: none) "We can't hold her in there long enough,"Oba said over her cup of tea. "The Lattice is too far away. We don't have the energy to get her there." "You need more mana," Suniel said, pensively pulling on his beard and looking out at the carefully sculpted gardens that surrounded his home. "That's all there is to it. There has to be a way." After a silence, Ses asked, "Why won't she come back?" Suniel turned and sat down. "It could be many things, Ses. She could be lost. She could be dying, although I highly doubt that. Perhaps it is an ebb and flow cycle that we are too short-lived to understand. My own feeling is that she wants to be there and she's waiting for us." "A test!" Oba piped in. "That's what I thought." She sat back in the chair. "Waiting?" Ses looked puzzled. "Waiting for what?" "I don't know, but I too feel like it is a test for our guild." Oba smiled and elbowed her sister while Suniel continued. "Chaos is reigning on Ravnica. The guilds are in disarray. Some have collapsed, and our own guild is fracturing over... stupidity. If only we could truly come together as our #emph[parun] has instructed us. If only we could harness the power that is all around us, but without her leadership, we are breaking apart into separate visions of what Selesnya is." Suniel went deep into thought and Cim watched him as her sisters nodded off. She saw him pick up a piece of wood and begin to imbue it with mana, molding it as a potter would a piece of clay. After an hour of this, and with even Cim's eyes drifting shut, Suniel finally looked up. "I have an idea," he said, holding up his piece of wood before Cim's nose. "The key to being a woodshaper is allowing the lines to blur between you and what you are creating. As I am sculpting, the wood and my hands become blended together so there is no point where the wood ends and where my hands begin. When that happens, I am actually drawing power from the lifeforce of the wood and using that to help me shape it. If I connected you to a tree in this way, you could draw power from it and use that power to help you move deeper and touch the Lattice. There would be no risk, flesh and wood are not that dissimilar." "Sounds like fun," Oba said, wide awake. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Early in the morning, before the sun could even be seen above the towering buildings, Suniel led the sisters through a series of winding streets and alleys that finally led to a cobblestone path before a wood of oaks. They walked into the woods and after a while felt as if there were no buildings around them. Cim imagined they were surrounded by miles upon miles of forests. Soon, they arrived at a circle of particularly old and gnarled oak trees. They stopped and sat beneath the canopy as Suniel prepared himself. After a moment, he nodded at Cim. #figure(image("008_The Great Concourse/04.jpg", width: 100%), caption: [Forest | Art by Yeong-Hao Han], supplement: none, numbering: none) "Are you ready?" He asked. "We will do our best," Cim replied. After incanting an ancient spell known only to the dryads of the Conclave, Cim, Ses, and Oba entered the trance. Once they became grounded in it they went deeper and saw the Lattice spread before them. #emph["We're ready. Bind us to it." ] Cim spoke wordlessly, hoping Suniel could sense them empathically through the Worldsoul. Cim could feel Oba and Ses around her like ripples in water. She could feel their excitement; apprehension; and, above all, hope. Whatever happened, they were together. It was all that mattered. Then Suniel's magic flowed into them. As he bound the roots of the trees to them, Cim could feel the life pour into her being. As if in response, strands of the Lattice reached out and began to weave through them like glowing thread. At first there was a pleasant tingle as the root-like strands melded into their skin, but Cim began to feel a small seed of panic as more threads interwove and began pulling them closer to the Lattice. She could feel its power and a sudden sense of suffocation rushed up within her. A primal part of her brain struggled blindly to break free of its web. #emph["I can't breathe..."] Then in a wave, millions of tendrils streamed into Cim and flooded her consciousness with an ocean of energy. In an act of desperation she reached out for her sisters, hoping to grab on to something solid in the roaring torrent. Somehow she found them, their presences vague and blurred within the myriad network of fibers and light. She could feel them, their memories, thoughts, and emotions. They clung to each other as the storm of energy blew through them. After a timeless moment, the vibrations slowed and harmonized. She looked around from within the web of the Lattice, feeling its pulsating thrum. Their connection was complete. And then, in a voice as clear as a crystal bell, Mat'Selesnya spoke. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) "You have delved deep little seed. I wonder if you have the strength to bear the fruit of the message I have to give you?" The voice was like a great bell, but only a web of light pulsed before them. "Yes, Great Mother, I will bear any burden for you," Cim said into the Lattice. "For too long I slept within the Great Tree, speaking without words to faraway ears. Ambition of the rootless ones proved too powerful. For my seedlings to survive we must grow an army capable of stopping such ambitions. Even those of the scheming dragon." "I will root you to the Lattice. As a tree grows from a seed so will you pull armies from the source of all life. You will populate Selesnya with a sacred host willing to perish so that the greater good may thrive." #figure(image("008_The Great Concourse/05.jpg", width: 100%), caption: [Growing Ranks | Art by <NAME>], supplement: none, numbering: none) "All life returns to the Lattice. Do not covet your own particular life as the ghost dealers would covet a purse of coins. Do not hold back in your sacrifice. Give freely to the whole and spread this message far and wide." "I will now complete the woodshaper's work and bond you with all the trees of Ravnica. Their roots will be the new power of Selesnya. But be warned, this is a door through which the three of you can never return. Do you understand?" Cim looked at her sisters. "We understand, Great Mother." Under the oaks, Suniel sat with the three sisters. They were cradled in the base of the great tree, its roots bound to their flesh. He could feel the distant pulse of the Worldsoul, some feeling he couldn't quite put his finger on. But he knew, somehow, that the dryads had made contact with Mat'Selesnya. A great excitement washed over him and he scanned the faces of the sisters for any sign of them returning from their trance. The instant they awoke, he would separate them from the roots of the ancient oak, go straight to the Conclave for an emergency session, and hopefully tell the assembly the good news of the #emph[parun] 's return. As Suniel imagined the restoration of Selesnya, Cim gasped and her eyes snapped open. As he began to summon the mana in order to release them, Cim grasped his arm. "No need, woodshaper. It is done." Cim choked out the words. "We are one." Like a ball of writhing snakes, the roots began to cocoon and absorb the dryads, their small forms quickly pulled toward the trunks. Suniel struggled to pull them free but in spite of his magic, his attempts were futile. He could only claw at the glowing snarl of limbs and roots, and watch helplessly as the three sisters disappeared into the oaks. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) In the great hall within Vitu-Ghazi, the high priests and dignitaries of Selesnya were finally gathered. There, grown from the living wood of the World Tree, were the three dryads. Earlier that day they had magically materialized before a stunned crowd, sending a pulse throughout the Worldsoul to gather. No one in the guild had felt such a surge for a long time and hurried to the Conclave in great hope. Little did they know that they would gaze upon their new guildmaster for the first time. When Suniel arrived, he recognized Cim, the central figure of the three, but as soon as she spoke, he realized the Cim he knew was no more. #figure(image("008_The Great Concourse/06.jpg", height: 80%), caption: [], supplement: none, numbering: none) "I am Trostani. As a demonstration of the founding principle and power of our guild, we have gone beyond our selves and have become one being. We are the Great Concourse between Mat'Selesnya and all who follow her will. We have come from the heart of the Lattice to alter the course of Selesnya forever. A new age of glorious growth awaits our guild."
https://github.com/lcharleux/LCharleux_Teaching_Typst
https://raw.githubusercontent.com/lcharleux/LCharleux_Teaching_Typst/main/src/templates/drawing.typ
typst
MIT License
#import "@preview/cetz:0.2.2" #import cetz.draw: * // DRAWABLE VECTOR #let dvec(start, end, label: none, padding: 2pt, anchor: "center", rev: false, color: black, shrink: 1pt, thickness: 2pt, rotate_label: false, mark: (end: ">"), label_fill: white, anchor_at: 50%) = { hide(line(start, end, on-layer: -2, name: "shadow")) hide(line(end, start, on-layer: -2, name: "shadow-rev")) line((name: "shadow", anchor: shrink), (name: "shadow-rev", anchor: shrink), mark: mark, on-layer: -1, name: "vec", stroke: (paint: color, thickness: thickness)) let clabel = [#text(color, label)] let rangle = 0deg if rotate_label == true and rev == false { rangle = "vec.end" } if rotate_label == true and rev == true { rangle = "vec.start" } if label != none { if not rev { content((name: "shadow", anchor: anchor_at), clabel, anchor: anchor, offset: 4pt, angle: rangle, padding: padding, fill: label_fill, frame: "rect", stroke: none) } else { content((name: "shadow-rev", anchor: anchor_at), clabel, anchor: anchor, offset: 8pt, angle: rangle, padding: padding, fill: label_fill, frame: "rect", stroke: none) } } } #let dpoint(coords, label: none, anchor: "north", radius: 2pt, color: black, padding:8pt) = { circle(coords, radius: radius, fill: color) content(coords, anchor: anchor, padding:padding)[#text(fill:color)[#label]] } #let dangle3p(p0, p1, p2, right: false, label: none, radius: 3, label-radius: 110%, color: black, thickness: 1pt, on-layer: 0, mark:(end:">")) = { hide(line(p0, p1, stroke: (paint: red, thickness: 1pt), name: "l0")) hide(line(p0, p2, stroke: (paint: blue, thickness: 1pt), name: "l1")) if not right { cetz.angle.angle("l0.start", "l0.end", "l1.end", label: text(color)[#label], label-radius: label-radius, mark: mark, radius: radius, stroke: (paint: color, thickness: thickness), on-layer: on-layer) } else { cetz.angle.right-angle("l0.start", "l0.end", "l1.end", radius: radius, label: text(color)[#label], stroke: (paint: color, thickness: thickness), on-layer: on-layer) } } // ARRAY SUBSTRACTION #let arrmul(a0, a1) = { let out = () for (v0, v1) in a0.zip(a1) { out.push(v0 * v1) } out } // ARRAY SUBSTRACTION #let arradd(a0, a1) = { let out = () for (v0, v1) in a0.zip(a1) { out.push(v0 + v1) } out } #let arrnumprod(a, num) = { let out = () for v in a { out.push(v * num) } out } // ARRAY SUBSTRACTION #let arrsub(a0, a1) = { let out = () for (v0, v1) in a0.zip(a1) { out.push(v0 - v1) } out } #let anorm(a) = { let out = 0 for v in a { out += v * v } calc.sqrt(out) } #let normalize(a) = { let norm = anorm(a) a.map(v => v / norm) } #let rotmat2D(angle) = { let c = calc.cos(angle) let s = calc.sin(angle) ((c, -s), (s, c)) } #let dispvcol(a, basis: 0) = { let ma = a.map(v => ($#v$,)) let m = math.mat(delim: "[", ..ma) $attach(#m, br: #str(basis))$ } #let arotz90(a, inv: false) = { let k = if inv { 1 } else { -1 } (k * a.at(1), -k * a.at(0)) } #let arrcrossprod(a0, a1) = { let out = ( a0.at(1) * a1.at(2) - a0.at(2) * a1.at(1), a0.at(2) * a1.at(0) - a0.at(0) * a1.at(2), a0.at(0) * a1.at(1) - a0.at(1) * a1.at(0), ) out } #let arrdotprod(a0, a1) = { let out = 0 for (v0, v1) in a0.zip(a1) { out += v0 * v1 } out } #let dimension_line(start, end, inv: false, label: none, offs: 2, ratio: 90%, invert_label: false, anchor:"center") = { let AB = arrsub(end, start) let u = normalize(AB) let v = arotz90(u, inv: inv) let v2 = arrnumprod(v, offs) let C = arradd(end, v2) let D = arradd(start, v2) line(start, D, stroke: (paint: black, thickness: 0.5pt), name: "l0") line(end, C, stroke: (paint: black, thickness: 0.5pt), name: "l1") if invert_label { dvec((name: "l1", anchor: ratio), (name: "l0", anchor: ratio), label: label, color: black, shrink: 1pt, rotate_label: true, mark: (end: "straight", start: "straight"), thickness: 1pt, anchor:anchor) } else { dvec((name: "l0", anchor: ratio), (name: "l1", anchor: ratio), label: label, color: black, shrink: 1pt, rotate_label: true, mark: (end: "straight", start: "straight"), thickness: 1pt, anchor: anchor) } } #let mvec(what) = $accent(what, ->)$ #let torseur6(rx: 0, ry: 0, rz: 0, mx: 0, my: 0, mz: 0, p: [$O_0$], basis: 0) = { let m = math.mat(delim: "{", (rx, mx), (ry, my), (rz, mz)) $attach(#m, br: #p "," cal(B)_(basis) )$ } #let torseur2(R: mvec[0], M: mvec[0], p: [$O_0$]) = { let m = math.mat(delim: "{", (R,), (M,)) $attach(#m, br: #p )$ } #let torseur1(T: "0") = { let m = math.mat(delim: "{", (T,)) $attach(#m)$ } #let part_label(coord, label, color:black, anchor: "south", padding: .1) = content(coord, text(color, label), anchor:anchor, frame:"rect", padding: padding, stroke: (paint: color, thickness: 2pt), fill: white)
https://github.com/angelacorte/slides-master-thesis
https://raw.githubusercontent.com/angelacorte/slides-master-thesis/master/slides-master-thesis.typ
typst
Apache License 2.0
#import "@preview/polylux:0.3.1": * #import "@preview/fontawesome:0.1.0": * #import themes.metropolis: * #show: metropolis-theme.with( aspect-ratio: "16-9", // footer: [<EMAIL>] ) #set text(font: "Inter", weight: "light", size: 20pt) #show math.equation: set text(font: "Fira Math") #set strong(delta: 190) #set par(justify: true) #set raw(tab-size: 4) #show raw.where(block: true): block.with( fill: luma(240), inset: 1em, radius: 0.7em, width: 100%, ) #let authors = box[ #table(inset: 0.5em, stroke: none, columns: (1fr, auto), align: (left, right), [_Supervisor:_ Prof. *<NAME>*], [_Candidate:_ *<NAME>*], [_Co-supervisor:_ Dr. *<NAME>*], [<EMAIL>] ) ] #title-slide( title: [A Kotlin Multiplatform implementation of\ Aggregate Computing based on XC], author: authors, ) #new-section-slide("Context") #let devices = box[ #table(inset: 1em, stroke: none, columns: (1fr, 1fr), align: (left, left), [ #figure( image("figures/device-centric.png", width: 60%), ) ] , [ #figure( image("figures/aggregate-centric.png", width: 60%), ) ], [ Managing single devices in a distributed system can be challenging due to *scalability* and *heterogeneity*. ], [ Coordinating a macroscopic behaviour can lead to advantages as *adaptability to dynamic changes* and *robustness*. ] ) ] #slide(title: "From device-centric to aggregate-centric approach")[ Computational devices can find usages in various scenarios, like *smart cities*, *crowd management*, and so on, leading to more complex systems. #devices ] // Aggregate Computing is a paradigm that allows to program the behaviour of a distributed system by defining the interaction between devices, rather than the behaviour of each device. #slide(title: "Aggregate Computing")[ #table(inset: 1.2em, stroke: none, columns: (2fr, 1.1fr), align: (left, left), [ - *Aggregate Computing* is a paradigm for the compositional development of self-adaptive IoT services. - It allows to program the behaviour of a distributed system by defining the interaction *between devices*, rather than the behaviour _of each device_. ], [ #figure( image("figures/aggregate.png", width: 120%), ) ] ) ] #let messages = box[ #table(inset: 1.5em, stroke: none, columns: (1fr, 1fr), align: (center, center), [ #figure( image("figures/isotropic.svg", width: 60%), ) ] , [ #figure( image("figures/anisotropic.svg", width: 60%), ) ], [Isotropic communication], [Anisotropic communication] ) ] #slide(title: "XC")[ *XC* is an experimental programming language design to develop homogeneous distributed based on the *Aggregate Computing* paradigm. #messages ] #let collektive = box[ #table(inset: 1.5em, stroke: none, columns: (0.4fr, 1fr), align: (left, left), [ #figure( image("figures/collektive-logo.svg", width: 70%), ) ] , [ *Collektive* is a minimal DSL for aggregate programming in _Kotlin Multiplatform_, to simplify the development of distributed systems, providing high-level abstractions for collective coordination and communication. ] ) ] #slide(title: "What is Collektive?")[ #collektive ] #slide(title: "Goals")[ - Re-thinking the architecture of *Collektive* making it *XC*-based. - Verify that performance are at least comparable with the state of the art _ScaFi_ and _Protelis_. ] #new-section-slide("Contributions") #let repEx = box[ #table(inset: 1em, stroke: none, columns: (0.9fr, 1.1fr, 1.3fr), align: (left, left, left), [ #figure( image("figures/rep.svg", width: 45%), ) ],[ #figure( image("figures/nbr.svg", width: 69%), ) ],[ #figure( image("figures/share.svg", width: 55%), ) ],[ *repeat*: allows to model the state evolution of the device over time. ],[ *neighboring*: allows to access the values of the neighbours and send them information. ], [ *share*: _repeat_ and _neighboring_ operators composition modelling the device space-time evolution. ] ) ] #let exch = box[ #table(inset: 0.4em, stroke: none, columns: (1fr), align: (left), [ #figure( image("figures/exchange.svg", width: 25%), ) ],[ *exchange*: is the foundation of *XC*, has the crucial aspect that can _send different values to each neighbour_, allowing custom interaction between them. It models the space-time evolution of the device. ] ) ] #slide(title: "Operators rivisited and implemented based on XC")[ #exch ] #slide(title: "Operators rivisited and implemented based on XC")[ #repEx ] #let incarnation = box[ #table(inset: 0.1em, stroke: none, columns: (1fr, 1fr), align: (left, left), [ #figure( image("figures/gradient-2.png", width: 75%), ) ] , [ - *Alchemist* is a meta-simulator for distributed systems. - Simulating the behaviour of a distributed system is crucial to verify the correctness of the system and to understand its behaviour in different scenarios. - An _incarnation_ serves as interpreter for the Alchemist Simulator. ] ) ] #slide(title: "Alchemist Incarnation Collektive")[ #incarnation ] #let benchmarks = box[ #figure( table(inset: 0.3em, stroke: none, columns: (2fr, 2fr, 2fr, 2fr, 0.5fr), align: (center, center), [ #figure( image("figures/neighborCounter.svg", width: 200%), ) ],[ #figure( image("figures/branching.svg", width: 200%), ) ],[ #figure( image("figures/gradient_g.svg", width: 200%), ) ],[ #figure( image("figures/channel.svg", width: 200%), ) ], [ #figure( image("figures/legend.png", width: 200%), ) ] ), caption: [In complex programs, *Collektive* results 6.90 times faster than _Protelis_ and 3.70 times faster than _ScaFi_.] ) ] #new-section-slide("Validation") #slide(title: "Benchmarks")[ #benchmarks Note that performance results may have been influenced by the incarnation of the language and should be further investigated. ] #new-section-slide("Live demo") #new-section-slide("Conclusions") #slide(title: "Recap")[ - Re-engineerization of *Collektive* based on *XC*. - Integration with a _simulation platform_. - Evaluation of the viability of the approach via _benchmarking_. ] #slide(title: "Future Works")[ To be developed in the next year, as the project won a public *GARR* grant: - Implementation of a *standard library*; - Creation of _demonstrations_ with *heterogeneous devices* (Android + iOS + native + wearables). ] #title-slide( title: [A Kotlin Multiplatform implementation of\ Aggregate Computing based on XC], )
https://github.com/MrToWy/Bachelorarbeit
https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Code/FrontendDockerfile.typ
typst
#import("../Template/customFunctions.typ"): * #codly( highlights:( (line:0, fill:blue, label: <fromNodeAlpine>), (line:6, fill:red, label: <copyPackage>), (line:10, fill:blue, label: <copyAll>), (line:15, fill:blue, label: <copyFromBuild>), ), annotations:( (start: 14, end: 18, label: <secondStage>), ) ) ```Dockerfile FROM node:alpine as build WORKDIR /project RUN npm install -g @angular/cli # only copy the package.json and package-lock.json to install dependencies (Efficient Layer Caching) COPY package*.json ./ RUN npm ci # copy the rest of the files COPY . . RUN npm run build FROM nginx:alpine COPY --from=build /project/dist/study-modules/browser /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] ```
https://github.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024
https://raw.githubusercontent.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024/neko/实验/6.typ
typst
#set text(lang: "zh", font: "Noto Serif CJK SC") #show "。": "." = 实验六 步进电动机 == 单步运行状态 == 角位移和脉冲数的关系 #figure( align(center)[#table( columns: 4, align: (auto, auto, auto, auto), table.header([表格], [序号], [实际电机偏转角度], [理论电机偏转角度]), table.hline(), table.cell(rowspan: 2)[步数=100步], [1], [45°], [45°], [2], [40°], [40°], table.cell(rowspan: 2)[步数=200步], [1], [85°], [90°], [2], [92°], [90°], )], ) == 空载突跳频率的测定 电机不失步启动的最高频率为步进电机的空载突跳频率。记为 $13750" Hz"$。 == 定子绕组中电流和频率的关系 #table( columns: 9, table.header([序号], [1], [2], [3], [4], [5], [6], [7], [8]), [f (Hz)], [1000], [2500], [4000], [5500], [7000], [8500], [1000], [1150], [I (A)], [2.012], [2.000], [1.879], [1.283], [0.824], [0.526], [0.381], [0.193], ) == 平均转速和脉冲频率的关系 #let ns = (222, 442, 674, 895, 1122, 1340, 1563, 1793) #let real_ns = ns.map(x => x / 3) #figure( align(center)[#table( columns: 4, table.header([序号], [$f$ (Hz)], [$n$ (r/min)], [$n / 3$ (r/min)]), table.hline(), ..range(1, 9).map(i => ( [#i], [#(i * 1000)], [#ns.at(i - 1)], [#calc.round(real_ns.at(i - 1), digits: 1)], )).flatten() )], ) 转速表显示的转速单位为 r/min,由于皮带传动的原因,其值为步进电机实际转速的 3 倍。根据 #let NP = $n = (60 f) / N_p$ $ NP, $ #let nps = real_ns.enumerate().map(((i, x)) => x / (i + 1)) #let average_np = nps.sum() / nps.len() $ N_p = #calc.round(average_np). $ == 实验报告 经过上述实验后,须对照实验内容写出数据总结并对电机试验加以小结。 + 单步运行状态 + 角位移和脉冲数的关系:角位移与脉冲数成正比 + 空载突跳频率的测定 + 转子振荡状态的观察 + 定子绕组中电流和频率的关系:电流随频率增大而减小 + 平均转速和脉冲频率的关系:本实验中电机步距角为 $1.8°$,根据 $1.8 degree = theta_b = theta_t / N = (360 degree) / (Z_r N) $ 得 $ Z_r = (360 degree) / (N theta_b) = 360 / (2 times 1.8) = 100. $ 实验测得 $N_p = 74$,与理论值有一定偏差,可能是出现失步所致。 == 思考题 + 影响步进电机步距的因素有哪些?对实验用步进电机,采用何种方法步距最小? - $theta = frac(360 degree, Z_r N)$,步距与转子齿数和拍数有关。 - 增加齿数和定子相数可以减小步距。 + 平均转速和脉冲频率的关系怎样?为什么特别强调是平均转速? - #NP,平均转速和脉冲频率成正比。 - 步进电机由电脉冲控制,运动是离散的,因此需要用平均转速来描述其运动特性。
https://github.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024
https://raw.githubusercontent.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024/neko/实验/7.typ
typst
#set text(lang: "zh", font: "Noto Serif CJK SC") #show "。": "." #include "7-table.typ" == 实验七 正余弦变压器 1. 根据表7-1、表7-2、表7-3和表7-4的数据,在同一图中绘制空载、负载、二次侧补偿后、一次侧补偿后时正余弦旋转变压器空载时输出电压 $U_(r 0)$ 与转子转角 $ɑ$ 的关系曲线,即 $U_(r 0) = f(alpha)$。 #figure( caption: "正余弦旋转变压器输出电压与转子转角关系曲线", image("dist/7.svg"), ) 2. 根据表7-5的实验记录数据,绘制正余弦旋转变压器作线性应用时输出电压Ur与转子转角ɑ的关系曲线,即 $U_r = f(alpha)$。 #figure( caption: "正余弦旋转变压器线性应用时输出电压与转子转角关系曲线", image("dist/7-2.svg", width: 85%, height: 9.8cm), ) == 思考题 1. 试分析旋转变压器一、二次侧补偿的原理。 旋转变压器一次侧补偿通过短接交轴绕组,抵消交轴磁通对输出的影响,从而达到补偿目的。二次侧补偿则是通过在副边接对称负载,使得输出电压与转角保持严格的正余弦关系,消除交轴磁场。 2. 试分析正余弦旋转变压器作线性变压器的原理。 将正余弦旋转变压器的定子励磁绕组和转子余弦输出绕组串联,并作为励磁的原边。当 $k μ approx 0.52$ 时,在 $θ= ±60$ 范围内,输出电压和转角成线性关系,并且与理想直线相比较,误差不超过 $0.1%$。
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/program-finish-driver-control/entry.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #show: create-body-entry.with( title: "Program: Driver Control", type: "program", date: datetime(year: 2023, month: 10, day: 27), author: "<NAME>", witness: "Violet Ridge", ) We finished the controller layout for all of the subsystems. Here's an image of the current layout: #image("./control-layout.svg") #heading[Implementation] We decided to rumble the controller every time a button is pressed in order to give the driver more haptic feedback. #heading(level: 2)[Intake] We do not rumble the controller because the intake buttons are held, not toggles. This would lead to the controller repeatedly rumbling instead of rumbling once. ```cpp if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_R1)) { intake.set_state(lib::IntakeState::Running); } else if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_R2)) { intake.set_state(lib::IntakeState::Reversed); } else { intake.set_state(lib::IntakeState::Idle); } ``` #heading(level: 2)[Wings] The wings control is also a held button press. ```cpp if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_L1)) { flaps.set_state(lib::FlapState::Expanded); } else { flaps.set_state(lib::FlapState::Idle); } ``` #heading(level: 2)[Catapult] The code controlling the catapult is much more complex, and cannot be represented by a single state change, so we've abstracted it with another method. ```cpp // Catapult control if (controller.get_digital(pros::E_CONTROLLER_DIGITAL_L2)) { controller.rumble("."); catapult.fire(); } if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_A)) { controller.rumble("."); catapult.toggle_repeating(); } if (controller.get_digital_new_press(pros::E_CONTROLLER_DIGITAL_B)) { controller.rumble("."); catapult.toggle_disabled(); } ``` #heading(level: 2)[Drivetrain] Now that LemLib supports driver control functions we can use their functions instead of our own. ```cpp // Drivetrain control int left = controller.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y); int right = controller.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y); chassis.tank(left, right, 5); ``` This Implementation is overall much cleaner than what we had before.
https://github.com/Yzx7/public_study_files
https://raw.githubusercontent.com/Yzx7/public_study_files/main/Monografía FIEE/main.typ
typst
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Aplicaciones de las ecuaciones diferenciales ordinarias", t-tipo:"Monografía", t-para:"Para obtener nota en el curso de EDO", cursoName:"EDO", // docenteName:"<NAME>", authors: ( "<NAME> 23190107", "<NAME> 23190346", "<NAME> 23190015", "<NAME> 23190346", ), add:( ("Semestre","2024-II"), // ("Horario","Miércoles 4 - 6 pm"), ("Docente","<NAME>") ) ) // We generated the example code below so you can see how // your document will look. Go ahead and replace it with // your own content! #include "chapters/intro.typ" #include "chapters/objetivos.typ" #include "chapters/procedimiento.typ" #include "chapters/questionnaires.typ" // #pagebreak() // #bibliography("bib.bib", style: "institute-of-electrical-and-electronics-engineers", title: "Referencias bibliográficas")
https://github.com/gongke6642/tuling
https://raw.githubusercontent.com/gongke6642/tuling/main/语境/上下文.typ
typst
#set par( justify: true, leading: 0.52em, ) = 语境 = 有时,我们希望创建对其在文档中的位置做出反应的内容。这可以是取决于配置的文本语言的本地化短语,也可以是像标题编号这样简单的东西,它根据前面有多少个标题打印正确的值。然而,Typst 代码并不直接知道它在文档中的位置。源文本开头的某些代码可能会产生最终出现在文档后面的内容。 为了生成对其周围环境做出反应的内容,我们必须专门指示 Typst:我们使用关键字来执行此操作context,该关键字位于表达式之前并确保它是根据其环境的知识进行计算的。作为回报,上下文表达式本身最终变得不透明。我们无法在代码中直接访问它的任何结果,正是因为它是上下文相关的:没有一个正确的结果,文档的不同位置可能有多个结果。因此,依赖于上下文数据的所有内容都必须发生在上下文表达式内部。 除了显式上下文表达式之外,上下文还在某些位置隐式建立,这些位置也知道它们在文档中的位置:显示规则提供上下文1和大纲中的编号,例如,还提供正确的上下文来解析计数器。 = == 风格背景 通过设置规则,我们可以调整部分或整个文档的样式属性。如果没有已知的上下文,我们就无法访问这些内容,因为它们可能会在文档的整个过程中发生变化。当上下文可用时,我们只需将它们作为相应元素函数上的字段进行访问即可检索它们。 #image("1.png", width: 100%) 如上所述,上下文表达式对其所处的不同环境做出反应。在下面的示例中,我们创建一个上下文表达式,将其存储在value变量中并多次使用它。每次使用都会对当前环境做出适当的反应。 #image("2.png", width: 100%) #image("22.png", width: 100%) 至关重要的是,在创建后,内容就变成了我们无法窥视的value不透明内容。它只有在放置在某个地方时才能得到解决,因为只有这样才能知道上下文。上下文表达式的主体可以被计算零次、一次或多次,具体取决于它被放入多少个不同的位置。 = == 位置背景 上下文不仅可以让我们访问设置的规则值。它还可以让我们知道当前在文档中的位置(相对于其他元素)以及绝对在页面上的位置。我们可以使用此信息在不同文档部分之间创建非常灵活的交互。这支撑了标题编号、目录或依赖于章节标题的页眉等功能。 有些函数例如counter.get隐式访问当前位置。在下面的示例中,我们要检索标题计数器的值。由于它在整个文档中都会发生变化,因此我们需要首先输入上下文表达式。然后,我们用来get检索计数器的当前值。该函数从上下文访问当前位置以解析计数器值。计数器有多个级别,并get返回一个包含已解析数字的数组。因此,我们得到以下结果: #image("3.png", width: 100%) #image("33.png", width: 100%) 为了更加灵活,我们还可以使用该here函数直接从上下文中提取当前位置。下面的示例演示了这一点: -- 我们首先有,它像以前一样解析为。counter(heading).get()(2,) -- 然后我们使用更强大的counter.atwith here,它的组合相当于get,从而得到。(2,) -- 最后,我们使用at标签来检索文档中不同位置的计数器值,在我们的例子中是介绍标题。这产生. Typst 的上下文系统为我们提供了时间旅行能力,并让我们能够检索文档中任何位置的任何计数器和状态的值。(1,) #image("4.png", width: 100%) #image("44.png", width: 100%) 如前所述,我们还可以使用上下文来获取元素在页面上的物理位置。我们使用该函数执行此locate操作,其工作原理类似于counter.at:它采用一个位置或其他选择器来解析为唯一元素(也可以是标签)并返回该元素在页面上的位置。 #image("5.png", width: 100%) #image("55.png", width: 100%) 还有其他一些函数也利用了位置上下文,其中最为突出的是query。查看内省类别以获取有关这些内容的更多详细信息。 = == 嵌套上下文 还可以从嵌套在上下文块中的函数调用内访问上下文。在下面的示例中,foo它本身成为一个上下文函数,就像to-absoluteis 一样。 #image("6.png", width: 100%) 上下文块可以嵌套。然后,上下文代码将始终访问最内部的上下文。下面的示例演示了这一点:第一个text.lang将访问外部上下文块的样式,因此,它将看不到的效果。然而,第二个周围的嵌套上下文块在设置的规则之后开始,因此将显示其效果。set text(lang: "fr")text.lang #image("7.png", width: 100%) text.lang您可能想知道为什么 Typst 在计算上例中的第一个时忽略 French set 规则。原因是,在一般情况下,Typst 无法知道将应用的所有样式,因为设定的规则可以在构建后应用于内容。下面,text.lang是在应用模板函数时已经计算出来的。因此,它不可能知道模板中的语言更改为法语。 #image("8.png", width: 100%) text.lang然而,第二个确实对语言变化做出反应,因为对其周围上下文块的评估被推迟,直到它的样式已知为止。这说明了为上下文选择正确插入点以访问精确正确样式的重要性。 对于位置上下文来说也是如此。下面,第一个调用将访问外部上下文块,因此不会看到第二个调用访问内部上下文的效果,因此会看到它。c.display()c.update(2)c.display() #image("9.png", width: 100%) = == 编译器迭代 为了解决上下文交互,Typst 编译器会多次处理您的文档。例如,为了解决locate调用,Typst 首先提供占位符位置,布局文档,然后使用完成布局中的已知位置重新编译。采用相同的方法来解析计数器、状态和查询。在某些情况下,Typst 甚至可能需要两次以上的迭代来解决所有问题。虽然这有时是必要的,但它也可能是滥用上下文功能(例如state)的迹象。如果 Typst 在五次尝试内无法解决所有问题,它将停止并输出警告“布局在 5 次尝试内未收敛”。 非常细心的读者可能已经注意到,并非上面介绍的所有函数实际上都使用了当前位置。虽然肯定取决于它,但例如,却并非如此。然而,它仍然需要上下文。虽然它的值在一次编译迭代中始终相同,但它可能会在多次编译迭代过程中发生变化。如果可以直接在模块的顶层调用它,则整个模块及其导出可能会在多次编译器迭代的过程中发生变化,这是不可取的。counter(heading).get()counter(heading).at(<intro>) = #image("10.png", width: 100%)
https://github.com/dainbow/MatGos
https://raw.githubusercontent.com/dainbow/MatGos/master/themes/21.typ
typst
#import "../conf.typ": * = Прямые и плоскости в пространстве. Формулы расстояния от точки до прямой и плоскости, между прямыми в пространстве. Углы между прямыми и плоскостями. == Прямые и плоскости в пространстве #definition[ *Линейной комбинацией* элементов $v_1, ..., v_n$ (для которых определены сложение и умножение на числа) с коэффициентами $alpha_1, ..., alpha_n in RR$ называется следующая величина: #eq[ $sum_(i = 1)^n alpha_i v_i = alpha_1 v_1 + ... + alpha_n v_n$ ] ] #definition[ *Направленным отрезком* называется отрезок, концы которого упорядочены. Обозначение $overline(A B)$. Направленные отрезки называются равными, если они сонаправлены и равны. ] #definition[ *Вектором* называется #strike("элемент векторного пространства") класс эквивалентности направленных отрезков. Формульно, если $overline(A B)$ -- представитель класса $bold(v)$, то $overline(A B) in bold(v)$, но в дальнейшем это будет обозначаться как $overline(A B) = bold(v)$. ] #definition[ Ниже перечислены обозначения множеств векторов и точек: - $V_0$ -- нулевое пространство, состоящее только из нулевого вектора $bold(0)$ - $V_1, P_1$ -- множества всех векторов и всех точек *на прямой* - $V_2, P_2$ -- множества всех векторов и всех точек *на плоскости* - $V_3, P_3$ -- множества всех векторов и всех точек *в пространстве* ] #definition[ Система $(bold(v_1), ..., bold(v_2))$ векторов из $V_n$ называется *линейно независимой*, если для любых $alpha_1, ..., alpha_n in RR$ выполнено следующее условие: #eq[ $sum_(i = 1)^n alpha_i bold(v_i) = bold(0) <=> alpha_1 = ... = alpha_n = 0$ ] ] #definition[ Система $(bold(v_1), ..., bold(v_n))$ векторов из $V_n$ называется *линейно зависимой*, если существует её нетривиальная линейная комбинация, равная $bold(0)$. ] #definition[ *Базисом* в $V_n$ называется линейно независимая система векторов, через которую выражаются все векторы $V_n$. ] #definition[ Пусть $e$ -- базис в $V_n, bold(v) = alpha e in V_n$. Столбец коэффициентов $alpha$ называется *координатным столбцом* вектора $bold(v)$ в базисе $e$. Обозначение $bold(v) <->_e alpha$. ] #definition[ *Скалярным произведением* ненулевых векторов $bold(a), bold(b) in V_n$ называется следующая величина: #eq[ $(bold(a), bold(b)) = abs(bold(a))abs(bold(b)) cos(angle(bold(a), bold(b)))$ ] ] #definition[ Векторы $bold(a), bold(b) in V_n$ называются *перпендикулярными (ортогональными)*, если $(bold(a), bold(b)) = 0$. Обозначение $bold(a) bot bold(b)$. ] #definition[ Пусть $bold(a), bold(b) in V_n, bold(b) != bold(0)$, от точки $O in P_n$ отложны направленные отрезки $overline(O A) = bold(a); overline(O B) = bold(b)$. *Проекцией* вектора $bold(a)$ на вектор $bold(b)$ называется такой класс эквивалентности, представителем которого является вектор $overline(O A')$, где $A'$ -- ортогональная проекция точки $A$ на прямую $O B$. Обозначение $"pr"_bold(b) bold(a)$ ] #proposition[ Для любых $bold(a), bold(b) in V_n, bold(b) != bold(0)$ выполнено следующее равенство: #eq[ $"pr"_bold(b) bold(a) = ((bold(a), bold(b))) / ((bold(a), bold(a))) bold(b)$ ] ] #definition[ Базис в $V_n$ называется: - *Ортогональным*, если его векторы попарно ортогональны - *Ортонормированным*, если он ортогонален и все его векторы имеют длину $1$. ] #definition[ *Декартовой системой координат* в $P_n$ называется набор $(O, e)$, где $O in P_n$ -- начало системы координат, $e$ -- базис в $V_n$. Точка $A in P_n$ имеет координатный столбец $alpha$ в данной системе координат, если $overline(O A) <->_e alpha$. Обозначение $A <->_((O, e)) alpha$. Декартова система координат называется прямоугольной, если базис $e$ -- ортонормированный. ] #definition[ *Направляющим вектором* прямой $l subset P_3$ называется вектор $bold(a) in V_3, bold(a) != 0$, представителем которого является направленный отрезок, лежащий в $l$. ] #definition[ Пусть $bold(a), bold(b) in V_3$. *Векторным произведением* векторов $bold(a), bold(b)$ называется единственный вектор $bold(c) := [bold(a), bold(b)]$ такой, что выполнены следующие условия: + $bold(c) bot bold(a) and bold(c) bot bold(b)$ + $abs(c) = S(bold(a), bold(b))$, где $S(bold(a), bold(b))$ -- площадь паралелограма, натянутого на вектора $bold(a), bold(b)$ + $\ det mat(a_1, b_1, c_1;a_2, b_2, c_2;a_3, b_3, c_3) > 0$ Альтернативное обозначание $bold(a) times bold(b)$ ] #definition[ Пусть $l subset P_3$ -- прямая, с направляющим вектором $bold(a) in V_3, M in l$ и в декартовой системе координат $(O, e)$ в $P_3$ выполнены соотношения $bold(a) <->_e alpha$, $M <->_((O, e)) vec(x_0, y_0, z_0), bold(r_0) := overline(O M)$. Тогда - *Векторно-параметрическим* уравнением прямой называется следующее семейство уравнений: #eq[ $bold(r) = bold(r_0) + t bold(a), t in RR$ ] - *Параметрическим* уравнением прямой называется следующее семейство систем: #eq[ $cases(x = x_0 + t alpha_1, y = y_0 + t alpha_2, z = z_0 + t alpha_3); quad t in RR$ ] - *Каноническим* уравнением прямой называется следующая система уравнений: #eq[ $(x - x_0) / alpha_1 = (y - y_0) / alpha_2 = (z - z_0) / alpha_3$ ] ] #definition[ Пусть $l subset P_3$ -- прямая с направляющим вектором $bold(a)$, и пусть $M in l, bold(r_0) := overline(O M)$. *Векторным* уравнением прямой называется следующее уравнение: #eq[ $[bold(r) - bold(r_0), bold(a)] = bold(0)$ ] ] #definition[ Пусть $nu subset P_3$ -- плоскость, $bold(a), bold(b) in V_3$ -- не сонаправленные векторы, представители которых лежат в $nu$, $M in l$ и в декартовой системе координат $(O, e)$ в $P_3$ выполнены соотношения $bold(a) <->_e alpha, bold(b) <->_e beta, M <->_((O, e)) vec(x_0, y_0, z_0), bold(r_0) := overline(O M)$. Тогда - *Векторно-параметрическим* уравнением плоскости называется следующее семейство уравнений: #eq[ $bold(r) = bold(r_0) + t bold(a) + s bold(b); quad t,s in RR$ ] - *Параметрическим* уравнением плоскости называется следующее семейство систем: #eq[ $cases( x = x_0 + t alpha_1 + s beta_1, y = y_0 + t alpha_2 + s beta_2, z = z_0 + t alpha_3 + s beta_3, );quad s, t in RR$ ] ] #definition[ Пусть $A, B, C, D in RR; A^2 + B^2 + C^2 != 0$. *Общим* уравнением плоскости называется следующее уравнение: #eq[ $A x + B y + C z + D = 0$ ] ] #definition[ *Вектором нормали плоскости* $nu subset P_3$ называется вектор $bold(n) in V_3, bold(n) != 0$, представителем которого является направленный отрезок, ортогональный каждой прямой из плоскости $nu$. ] #definition[ Пусть $nu subset P_3$ -- плоскость с вектором нормали $bold(n) in V_3$ и пусть $M in nu, bold(r_0) := overline(O M)$. *Нормальным* уравнением плоскости называется следующее уравнение: #eq[ $(bold(r) - bold(r_0), bold(n)) = 0$ ] ] == Формулы расстояния от точки до прямой и плоскости, между прямыми в пространстве #proposition( "Расстояние от точки до прямой", )[ Пусть прямая $l subset P_3$ задана векторно-параметрическим уравнением $bold(r) = bold(r_0) + bold(a) t, A in P_3, bold(r_A) := overline(O A)$. Тогда расстояние $rho$ от точки $A$ до прямой $l$ равно следующей величине: #eq[ $rho = abs([bold(r_A) - bold(r_0), bold(a)]) / abs(bold(a))$ ] ] #proof[ Искомое расстояние $rho$ является длиной высоты параллелограмма, построенного на векторах $bold(a)$ и $bold(r_A) - bold(r_0)$, проведённой к стороне, образованной вектором $bold(a)$ и имеющей длину $bold(a)$, из чего и следует требуемое. ] #proposition( "Расстояние от точки до плоскости", )[ Пусть в прямоугольной декартовой системе координат $(O, e)$ в $P_3$ плоскость $nu$ задана уравнением $A x + B y + C z + D = 0, M in P_3, M <->_((O, e)) vec(x_0, y_0, z_0)$. Тогда расстояние $rho$ от точки $M$ до плоскости $nu$ равно следующей величине: #eq[ $rho = abs(A x_0 + B y_0 + C z_0 + D) / sqrt(A^2 + B^2 + C^2)$ ] ] #proof[ Пусть $bold(n) in V_3, bold(n) <->_e vec(A, B, C)$ -- вектор нормали плоскости $nu, bold(r_0) := overline(O M)$, и пусть $X in nu, bold(r) := overline(O X)$. Тогда #eq[ $rho = abs("pr"_bold(n) (bold(r_0) - bold(r))) = abs(((bold(r_0) - bold(r), bold(n))) / abs(bold(n))^2 bold(n)) = abs((bold(r_0) - bold(r), bold(n))) / abs(bold(n)) = abs(A x_0 + B y_0 + C z_0 + D) / sqrt(A^2 + B^2 + C^2)$ ] ] #proposition( "Расстояние между прямыми в плоскости", )[ Пусть скрещивающиеся прямые $l_1, l_2 subset P_3$ заданы уравнениями $bold(r) = bold(r_1) + bold(a_1) t, bold(r) = bold(r_2) + bold(a_2) t$. Тогда расстояние $rho$ между ними равно следующей величине: #eq[ $rho = abs(([bold(a_1), bold(a_2)], bold(r_1) - bold(r_2))) / abs([bold(a_1), bold(a_2)])$ ] ] #proof[ Искомое расстояние $rho$ является длиной высоты параллелепипеда, построенного на векторах $bold(a_1), bold(a_2)$ и $bold(r_1) - bold(r_2)$, проведённой к грани, образованной векторами $bold(a_1), bold(a_2)$ и имеющей площадь $abs(bold(a_1))abs(bold(a_2))sin angle(bold(a_1), bold(a_2))$, из чего и следует требуемое. ] == Углы между прямыми и плоскостями #proposition( "Углы между прямыми", )[ Пусть прямые $l_1, l_2 subset P_3$ имеют направляющие вектора $bold(a_1), bold(a_2)$. Тогда угол $phi$ между ними удовлетворяет следующему равенству: #eq[ $cos phi = abs((bold(a_1), bold(a_2))) / (abs(bold(a_1))abs(bold(a_2)))$ ] ] #proof[ Углом между прямыми по определению является угол $phi$ равный меньшему из углов $alpha$ и $pi - alpha$, где $alpha$ -- угол между их направляющими векторами, поэтому в числителе именно модуль скалярного произведения. Дальнейшие рассуждения очевидны из определения скалярного произведения. ] #proposition( "Углы между плоскостями", )[ Пусть в прямоугольной декартовой системе координат $(O, e)$ в $P_3$ плоскости $nu_1, nu_2$ заданы уравнениями $A_1 x + B_1 y + C_1 z + D_1 = 0; A_2 x + B_2 y + C_2 z + D_2 = 0$. Тогда угол $phi$ между ними удовлетворяет равнеству: #eq[ $cos phi = abs(A_1 A_2 + B_1 B_2 + C_1 C_2) / (sqrt(A_1^2 + B_1^2 + C_1^2) sqrt(A_2^2 + B_2^2 + C_2^2))$ ] ] #proof[ Пусть $bold(n_1), bold(n_2) in V_3; bold(n_1) <->_e vec(A_1, B_1, C_1); bold(n_2) <->_e vec(A_2, B_2, C_2)$ -- нормальные векторы плоскостей $nu_1, nu_2, alpha := angle(bold(n_1), bold(n_2))$. Тогда угол $phi$ равен меньшему из углов $alpha$ и $pi - alpha$. В каждом из случае выполнено следующее: #eq[ $cos phi = abs(cos alpha) = abs((bold(n_1), bold(n_2))) / (abs(n_1) abs(n_2)) = abs(A_1 A_2 + B_1 B_2 + C_1 c_2) / (sqrt(A_1^2 + B_1^2 + C_1^2)sqrt(A_2^2 + B_2^2 + C_2^2))$ ] ]
https://github.com/flechonn/interface-typst
https://raw.githubusercontent.com/flechonn/interface-typst/main/docs/README.md
markdown
<span style="color:#7B7D7D;">[ FRENCH VERSION BELOW ] ## INFO4 PROJECT : Exercise Document Composition with Typst ### Introduction Our project aims to develop an innovative tool dedicated to composing personalized documents from various sub-documents. This software, based on the document composition technology Typst, will be specially designed to meet the diverse needs of teachers, particularly in the field of exercise sheet editing. ### Project context and objectives Imagine a teacher having access to a rich set of exercises including solutions and various levels of hints. Our goal is to simplify the process of creating customized exercise sheets, tailored to a specific audience and intended to be converted into PDF documents and/or integrated into a website. We will use Typst, an advanced document composition software, to accomplish this project. ### Project breakdown into several steps * **Project expectations definition:** Phase dedicated to researching the exact definition of the project and the expectations of the concerned teachers. (Initial drafts of project-related questions, retrieval of typical exercise sheets, etc.) <br> * **Getting started with Typst:** Phase devoted to getting acquainted with Typst, where we will explore its functionalities and understand the manipulation of LaTeX documents. <br> * **Building an exercise base:** We will start by creating an exercise base, which will serve as a reference for future composition. *See more details: [Exercise Base](./Base_exercices.md).* <br> * **Manual composition sequence development:** Assembly of 2 .typ exercises to create a single file. ![Exemple](./img/Exemple.png "Simple use exemple") * **Conversion of a LaTeX exercise into exercise object:** Parsing a LaTeX exercise to turn it into an Exercise object. Metadata is retrieved at the beginning of the file. <br> * **Adding/Removing an exercise:** Addition/Deletion of an exercise to/from the database via command lines. *See more details: [Command Line Documentation](./Doc_Commandes.md).* <br> * **Translation of a LaTeX figure code into Typst:** Parser allowing the composition of LaTeX figures (using the Tikz library) into Typst. Example of LaTeX figure code to be translated: ```tex \begin{tikzpicture}[->, %yscale=1.3 ] \tikzstyle{lab}=[fill=white,inner sep=1pt]; \node[circle,draw] at (0,0) (A) {$x_1$};% \node[circle,draw] at (2,0) (B) {$x_2$};% \node[circle,draw] at (4,0) (C) {$x_3$};% \node[circle,draw] at (0,-2) (D) {$x_4$};% \node[circle,draw] at (2,-2) (E) {$x_5$};% \node[circle,draw] at (4,-2) (F) {$x_6$};% \draw (A) edge node[lab]{\scriptsize 16} (B); \draw (A) edge node[lab]{\scriptsize 14} (D); \draw (A) edge node[lab]{\scriptsize 8} (E); \draw (B) edge node[lab]{\scriptsize 2} (C); \draw (D) edge node[lab]{\scriptsize 3} (E); \draw (E) edge node[lab]{\scriptsize 7} (B); \draw (E) edge node[lab]{\scriptsize 1} (F); \draw (F) edge node[lab]{\scriptsize 5} (B); \draw (F) edge node[lab]{\scriptsize 6} (C); \end{tikzpicture} ``` * **Database exercise modification:** Modification of a single exercise in the database. <br> * **Exercise sheet modification:** Modification/Deletion/Addition of one or more exercises in an already designed exercise sheet. <br> * **Output format:** Addition of the possibility to obtain a document in multiple formats: HTML, PDF, etc. <br> * **Adding a graphical user interface (GUI):** Transitioning from command-line instructions to a user interface (UI). For example, visualization of the final file, the database, document dragging for composition, etc. <br> ### Forecasted steps accomplished in 2024 We won't be able to complete all the steps of this project in one and a half months. Therefore, we will focus on the following parts: ![Steps](./img/Steps.png "Steps") ### Predicted Gantt chart ![Gantt](./img/GANTT.png "Predicted Gantt chart") ### Predicted code architecture ![Code](./img/Schema_Code.png "Code architecture") ### Project automaton ![Automaton](./img/Automaton.png "Project automaton") <br> <br> <span style="color:#7B7D7D;">[ FRENCH VERSION ] ## PROJET INFO4 : Composition de documents d'exercices avec Typst ### Introduction Notre projet vise à développer un outil innovant dédié à la composition de documents personnalisés à partir de différents sous-documents. Ce logiciel, reposant sur la technologie de composition de documents Typst sera spécialement conçu pour répondre aux besoins variés des enseignants, notamment dans le domaine de l'édition de fiches d'exercices. ### Contexte et objectifs du projet Imaginez un enseignant disposant d'un riche ensemble d'exercices comprenant solutions et niveaux d'indices variés. Notre objectif est de simplifier le processsus d'élaboration de fiches d'exercices sur mesure, adaptées à un public spécifique et destinées à être converties en document PDF et/ou intégrées à un site web. Nous utiliseront Typst, un logiciel de composition de documents avancés pour réaliser ce projet. ### Le projet se découpe en plusieurs étapes * **Définition des attentes du projet :** Phase dédiée à la recherche de la définition exacte du projet, et des attentes des professeurs concernés. (Premières ébauches des questions concernant le projet, récupération de fiches d'exercices type, etc...) <br> * **Prise en main de Typst :** Phase consacrée à la prise en main de Typst, où nous explorerons ses fonctionnalités et comprendrons la manipulation de documents LaTeX. <br> * **Constitution d'une base d'exercices :** Nous débuterons en créant une base d'exercices, qui servira de référence pour la composition ultérieure.\ *Voir plus de détails : [Base d'exercices](./Base_exercices.md).* <br> * **Élaboration manuelle de séquences de composition :** Assemblage de 2 exercices .typ pour en faire un seul fichier. ![Exemple](./img/Exemple.png "Exemple utilisation simple") * **Conversion d'un exercice LaTeX en objet Exercise :** Parsing d'un exercice LaTeX pour en faire un objet Exercise. On récupère les métadonnées en début de fichier. <br> * **Ajout/suppression d'un exercice :** Ajout/Suppression d'un exercice à la base de données via lignes de commandes. *Voir plus de détails : [Documentation ligne de commandes](./Doc_Commandes.md).* <br> * **Traduction du code figures LaTeX en Typst :** Parseur permettant de composer les figures LaTex (utilisant la librairie Tikz) en Typst. Exemple d'un code figure à traduire : ```tex \begin{tikzpicture}[->, %yscale=1.3 ] \tikzstyle{lab}=[fill=white,inner sep=1pt]; \node[circle,draw] at (0,0) (A) {$x_1$};% \node[circle,draw] at (2,0) (B) {$x_2$};% \node[circle,draw] at (4,0) (C) {$x_3$};% \node[circle,draw] at (0,-2) (D) {$x_4$};% \node[circle,draw] at (2,-2) (E) {$x_5$};% \node[circle,draw] at (4,-2) (F) {$x_6$};% \draw (A) edge node[lab]{\scriptsize 16} (B); \draw (A) edge node[lab]{\scriptsize 14} (D); \draw (A) edge node[lab]{\scriptsize 8} (E); \draw (B) edge node[lab]{\scriptsize 2} (C); \draw (D) edge node[lab]{\scriptsize 3} (E); \draw (E) edge node[lab]{\scriptsize 7} (B); \draw (E) edge node[lab]{\scriptsize 1} (F); \draw (F) edge node[lab]{\scriptsize 5} (B); \draw (F) edge node[lab]{\scriptsize 6} (C); \end{tikzpicture} ``` * **Modification d'un exercice de la base de données :** Modification d'un seul exercice de la base de données. <br> * **Modification d'une fiche d'exercice :** Modification/Suppression/Ajout d'un ou plusieurs exercices d'une fiche d'exercices déjà conçue. <br> * **Format de sortie :** Ajout de la possibilité d'obtenir un document en sortie de plusieurs extentions : HTML, PDF... <br> * **Ajout d'une interface graphique :** Passage des instructions en ligne de commande sur un terminal, à une interface utilisateur (IHM). Par exemple, visualisation du fichier final, de la base de donnée, glissage de documents pour composition... <br> ### Projection des étapes réalisées en 2024 Nous ne pourrons pas réaliser toutes les étapes de ce projet en un mois et demi. Nous allons donc nous contenter des parties suivantes : ![Étapes](./img/Etapes.png "Prévision des étapes réalisées") ### Diagramme de Gantt prévisionnel ![Gantt](./img/GANTT.png "Diagramme de Gantt") ### Architecture prévisionnelle du code ![Code](./img/Schema_Code.png "Architecture code") ### Automate du projet ![Automate](./img/Automate.png "Automate du projet")
https://github.com/detjensrobert/arch-pandoc-container
https://raw.githubusercontent.com/detjensrobert/arch-pandoc-container/main/README.md
markdown
MIT License
# arch-pandoc-container Ubuntu's version of [Pandoc](https://pandoc.org) is old and doesn't like some raw LaTeX macros I use for some classes, and the official [`pandoc/latex`](https://hub.docker.com/repository/docker/pandoc/latex) image does not have all of the needed LaTeX packages for those macros either. This Docker container provides Arch's versions of Pandoc and TeXLive, which work just fine. Additionally, this bundles MLA, APA, and IEEE [CSLs](https://github.com/citation-style-language/styles) for citations, along with some Pandoc filters: - [`pantable`](https://github.com/ickc/pantable) - [`pandoc-include`](https://github.com/DCsunset/pandoc-include) ## Tags Images are tagged based on the Pandoc version and the LaTeX engine included. The `:latest` tag ships with [Tectonic](https://tectonic-typesetting.github.io) as the LaTeX engine for a much smaller container size, but may not work for all LaTeX packages. - `:latest` - `:<version>` (e.g. `:3.1.3`) - `:tectonic` - `:<version>-tectonic` (e.g. `:3.1.3-tectonic`) The `-texlive` tags have the more 'standard' [TeXLive](https://www.tug.org/texlive) installation, but at a much larger container size (over 2GB!). - `:texlive` - `:<version>-texlive` (e.g. `:3.1.3-texlive`) The `-typst` tags use the new [Typst](https://typst.app/) system, which can be much nicer to use than LaTeX. Note this is its own system and **not** compatible with LaTeX! - `:typst` - `:<version>-typst` (e.g. `:3.1.3-typst`) Images are available both on [Dockerhub](https://hub.docker.com/r/detjensrobert/arch-pandoc) and on [GHCR](https://github.com/detjensrobert/arch-pandoc-container/pkgs/container/arch-pandoc): ```sh docker pull docker.io/detjensrobert/arch-pandoc docker pull ghcr.io/detjensrobert/arch-pandoc ``` ## Usage Use this as a drop-in for standard `pandoc`: ```bash docker run --rm -v $(pwd):/data -u $(id -u):$(id -g) detjensrobert/arch-pandoc:latest -s file.md -o file.pdf ... ``` - This container expects all necessary files to be mounted at `/data` in the container: `-v $(pwd):/data` - To avoid output being owned by `root`, run the entrypoint as your UID/GID: `-u $(id -u):$(id -g)` > NOTE: if using rootless containers, e.g. `podman`, this is not needed! `root` in the container is already mapped to > your normal user. > NOTE 2: If this causes permission errors with a Tectonic image, try switching to the TeXLive image instead. Add this shell function to your shell config for convenience: ```bash pandoc-docker () { docker run --rm -v $(pwd):/data -u $(id -u):$(id -g) detjensrobert/arch-pandoc $@ } md2pdf-docker () { pandoc-docker -s "$1" -o "${1%%.md}.pdf" -V geometry:margin=1in --highlight=tango --citeproc ${@:2} } # usage: md2pdf-docker some-document.md --filter pantable # -> creates some-document.pdf ```
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/label-fields-dict_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test whether the label is accessible through the has method #show heading: it => { assert(it.has("label")) it } = Hello, world! <my_label>
https://github.com/strayMat/cv_fr
https://raw.githubusercontent.com/strayMat/cv_fr/master/README.md
markdown
# CVs Version française TODO: Ajouter la version anglaise ## Usage Le cv se base sur le paquet typst [modern-cv](https://typst.app/universe/package/modern-cv/). Pour générer le cv, il suffit de lancer la commande suivante: ```bash typst compile resume_fr.typ ```
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/common-policy/tool_status_tags.typ
typst
#import "/meta-environments/env-templates.typ": * = Tool Status Tags Every tool at Protohaven has a status to let you know if the tool is safe to use. If the tool status is _green_, the tool is safe to use. All features should be expected to work, and no extra care should need to be taken while using the tool. #grid(columns: (1fr, 1in), gutter: 2em, [If the tool status is _yellow_, the tool may still be used, but with extra caution. The information on the physical tag or in the online maintenance history will indicate what special care needs to be taken while using the tool. If the physical tag and the maintenance log disagree, alert a tech.], image("/common-graphics/visuals/shop_tag-caution.png") ) #grid(columns: (1fr, 1in), gutter: 2em, [If the tool status is _red_: #warning[DO NOT USE THE TOOL]. The tool is not safe to use. The information on the physical tag or in the online maintenance history will indicate what fixes are pending, and when a repair is expected.], image("/common-graphics/visuals/shop_tag-stop.png") ) Some tools in the shop are explicitly green tagged to let you know they are working. Other tools in the shop are not explicitly green tagged when they are working to reduce sign fatigue. If you are in doubt about the status of a tool with no visible tag, check the tool status by following the link in the QR code attached to the tool, or check the Protohaven website for the tool status page: https://www.protohaven.org/equipment/
https://github.com/AU-Master-Thesis/thesis
https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/sections/4-results/metrics.typ
typst
MIT License
#import "../../lib/mod.typ": * == Metrics <s.r.metrics> // #jonas[This section mostly is simply missing some layouting concern. And also some equations other than that please do comment on content.] To objectively compare our reimplementation with the original #gbpplanner, the same four metrics: distance travelled, makespan, smoothness, and interrobot collisions@gbpplanner are measured and compared: #set enum(numbering: box-enum.with(prefix: "M-")) // #let metric(name) = text(accent, style: "italic", [#name:]) #let metric(name) = [*#name:* ] // #let metric(name) = [_ #name _ #h(1em)] + #metric[Distance travelled] The cumulative distance covered by the robot until it reaches its destination. Effective trajectories aim to minimize this measure. + #metric[Makespan] The overall duration for all robots to achieve their objectives. A collaborative system of numerous robots should strive to reduce this measure. + #metric[Inter Robot Collisions] Number of collisions between robots. The physical size of each robot is represented by a bounding circles, equal in radius to the robot's radius. A collision between two robots happen when their circles intersect. That is a collision is only registered if robots $R_a$ and $R_b$ intersect at timestep $t_n$ but not at $t_(n - 1)$. + #[#metric[Smoothness] Continuous smooth trajectories are required in most cases, in order to be realizable for the dynamics model of a robot. Smoothness is inherently a geometric property of the path traversed. To quantify this, the #acr("LDJ") metric is used@ldj-metric. It is a dimensionless metric that looks at how the jerk of a movement changes over a timespan. The equation for it is defined in @equ.ldj. Values lie in the interval $[0, -infinity]$ where closer to $0$ is better. $ L D J attach(=, t: Delta) -ln( (t_("final") - t_("start"))^3 / v^2_("max") integral_(t_("start"))^(t_("final")) abs((d^2 v(t))/(d t))^2 d t) $ <equ.ldj> - $t in [t_("start"), t_("final")]$ is the time interval the metric is measured over. - $v_("max")$ is the maximum velocity along the trajectory. - $v(t)$ is the velocity of a robot at time $t$. - $attach(limits(v), t: dot.double)(t)$ is change in acceleration at time $t$. Also known as jerk. Each robot's velocity is sampled and recorded with an interval of $20"Hz"$. For numerical integration Simpson's rule is used@simpsons-rule. The code for how the metric is computed can be found in the accompanying source code@repo under #source-link("https://github.com/AU-Master-Thesis/gbp-rs/blob/main/scripts/ldj.py", "./scripts/ldj.py") and in @appendix.ldj-metric-computation. ] In addition to the metrics used by by Patwardhan _et al._@gbpplanner metrics #boxed[*M-5*]-#boxed[*M-7*] are introduced. #let explanation = [ At each sampled position, the distance between it and the closest projection onto each line segment of the planned path is measured and accumulated, using the #acr("RMSE") score. A visual depiction of this is shown in @f.perpendicular-path-deviation. This is measured to test the effect of the proposed tracking factor, presented in @s.m.planning.path-adherence, as some applications might require that robots follow a dictated path with little deviation. Written mathematically the metric is defined as shown in @equ.perpendicular-path-deviation. ] // #explanation // 5. #metric[#acr("RMSE") of Perpendicular Path Deviation] #explanation // std-block( // breakable: false, // )[ // #image("../../../figures/out/rrt-optimization-no-env.svg") // #v(0.5em) // #text(theme.text, [A: Path Optimization]) // ], #let math-explanation = [ // #align(left)[ // $ "RMSE" = sqrt(1/n sum_(j=1)^(n) (min_i {"d"(P_j, L_i)})^2 ) $ // ] ] #grid( columns: (5fr, 5fr), column-gutter: 1em, // [#lorem(50)], [5. #metric[#acr("RMSE") of Perpendicular Path Deviation] #explanation], // math-explanation, std-block( breakable: false, )[ #figure( rotate(180deg, image("../../figures/out/perpendicular-path-deviation.svg")), // caption: figure.caption( // position: top, // [Illustration of how the perpendicular path deviation error is calculated. The green#sg line segments are the optimal path between waypoints. The red#sr line segments are the planned path. The dashed gray#sgr lines show the projection with the shortest distance to one of the waypoint segments, from a sampled position.] // ) caption: [Illustration of how the perpendicular path deviation error is calculated. The green line #inline-line(stroke: theme.green + 2pt) segments are the optimal path between waypoints. The red line #inline-line(stroke: theme.red + 2pt) segments represent the driven path. The dashed gray lines #inline-line(stroke: (paint: theme.overlay2, thickness: 2pt, dash: "dashed", cap: "round")) show the projection with the shortest distance to one of the waypoint segments, from a sampled position.] ) <f.perpendicular-path-deviation> ] // [#figure( // image("../../figures/out/perpendicular-path-deviation.svg"), // caption: [Illustration of how the perpendicular path deviation error is calculated. The green#sg line segments are the optimal path between waypoints. The red#sr line segments are the planned path. The dashed gray#sgr lines show the projection with the shortest distance to one of the waypoint segments, from a sampled position.] // ) <f.perpendicular-path-deviation>] // // ) // $ proj $ // $ d = ||P - P'|| = || P - (A + "proj"_(A B) A P) $ // $ { L_1, L_2, ..., L_m } $ // $ { P_1, P_2, ..., P_n } $ // $ d_j = min_i {"distance"(P_j, L_i)} $ // $ "RMSE" = sqrt(1/n sum_(j=1)^(n) (min_i {"d"(P_j, L_i)})^2 ) $ #grid( columns: (2.25em, 1fr), [], [ $ "RMSE" = sqrt(1/n sum_(j=1)^(n) (min_i {||P_j - p(P_j, L_i)||^2})^2 ) $ <equ.perpendicular-path-deviation> - $L_i in {L_1, L_2, ..., L_m}$ is the set of line segments making up the planned path. - $P_j in {P_1, P_2, ..., P_n}$ is the set of sampled positions. - $||P_j - p(P_j, L_i)||^2$ is the squared distance between the sampled position $P_j$ and the projection of $P_j$ onto the line segment $L_i$. ] ) The code for how the metric is computed can be found in the accompanying source code@repo under #source-link("https://github.com/AU-Master-Thesis/gbp-rs/blob/main/scripts/perpendicular-path-deviation.py", "./scripts/perpendicular-path-deviation.py") and in @appendix.perpendicular-path-deviation-metric-code. 6. #metric[Environment Robot Collisions] Number of collisions between robots and the environment. Similar to _Inter Robot Collisions_ bounding circles are used for the robots. Each environment obstacle is equipped with a collider of the same geometric layout. The same detection registration used for _Inter Robot Collisions_ is used here. // Opposite to _Inter Robot Collisions_ #acrpl("AABB") are used to check for intersections. The reason for this is that _parry2d_ the library used for checking intersection of geometric shapes do not support checking intersections between bounding circles and #acrpl("AABB")@parry2d#footnote([As of version 0.13.7]). To be conservative the minimum #acr("AABB") is used for both robots and obstacles, instead of bounding spheres, which would cover a significantly larger area in some of the environment obstacles in the _*Circle*_ experiment are non-rectangular, see @s.r.scenarios.circle, 7. #metric[Maximum Task Completion Time Difference] This metric represents the largest difference between the end times of each robot's task. In a collaborative setting, it is desirable for robots with similar tasks to finish in roughly the same amount of time to ensure high task throughput. Especially when there is inter-task dependencies between robots. // #todo[we do not have a script for this yet]
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/scripting/params.typ
typst
--- param-underscore-missing-argument --- // Error: 17-20 missing argument: pattern parameter #let f(a: 10) = a() + 1 #f(a: _ => 5) --- params-sink-named --- // ... but this was. #let f(..x) = {} #f(arg: 1) --- params-sink-unnamed --- // unnamed spread #let f(.., a) = a #test(f(1, 2, 3), 3) // This wasn't allowed before the bug fix ... #let f(..) = 2 #test(f(arg: 1), 2) --- params-sink-bool-invalid --- // Error: 10-14 expected pattern, found boolean #let f(..true) = none --- params-sink-multiple-invalid --- // Error: 13-16 only one argument sink is allowed #let f(..a, ..b) = none --- params-sink-at-start --- // Spread at beginning. #{ let f(..a, b) = (a, b) test(repr(f(1)), "((), 1)") test(repr(f(1, 2, 3)), "((1, 2), 3)") test(repr(f(1, 2, 3, 4, 5)), "((1, 2, 3, 4), 5)") } --- params-sink-in-middle --- // Spread in the middle. #{ let f(a, ..b, c) = (a, b, c) test(repr(f(1, 2)), "(1, (), 2)") test(repr(f(1, 2, 3, 4, 5)), "(1, (2, 3, 4), 5)") } --- params-sink-unnamed-empty --- // Unnamed sink should just ignore any extra arguments. #{ let f(a, b: 5, ..) = (a, b) test(f(4), (4, 5)) test(f(10, b: 11), (10, 11)) test(f(13, 20, b: 12), (13, 12)) test(f(15, b: 16, c: 13), (15, 16)) } --- params-sink-missing-arguments --- #{ let f(..a, b, c, d) = none // Error: 3-10 missing argument: d f(1, 2) } --- issue-1029-parameter-destructuring --- // Test that underscore works in parameter patterns. #test((1, 2, 3).zip((1, 2, 3)).map(((_, x)) => x), (1, 2, 3)) --- issue-1351-parameter-dictionary --- // Error: 17-22 expected pattern, found string #let foo((test: "bar")) = {}
https://github.com/kdog3682/mathematical
https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/examples/anchoring.typ
typst
#import "@preview/cetz:0.2.0" #cetz.canvas({ import cetz.draw: * grid((0,0), (4,4)) cetz.decorations.brace((1,1), (2,1), name: "a", flip: false) let anchor-pos = "a.k" circle(anchor-pos, radius: 3pt, fill: black) let b = (rel: (0, 0), to: "b.k") let content-anchor = "south-west" content(anchor-pos, box(inset: 5pt, fill: none, height: 30pt, align(center + horizon, "CONTENT"), stroke: red), anchor: content-anchor) }) /// the content-anchor is a game-changer /// i was having troubles placing the labels for the slope-triangle /// the answer is using content-anchor /// in this example, it is set at south-west /// this means the point of connection happens at it's southwestern point
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/meta/link-10.typ
typst
Other
// Error: 2-20 label does not exist in the document #link(<hey>)[Nope.]
https://github.com/gabrielrovesti/UniPD-Swiss-Knife-Notes-Slides
https://raw.githubusercontent.com/gabrielrovesti/UniPD-Swiss-Knife-Notes-Slides/main/Slides/Generic%20Typst/main.typ
typst
MIT License
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "File", authors: ( "<NAME>", ), ) #set heading(numbering: "1.") #show outline.entry.where( level: 1 ): it => { v(12pt, weak: true) strong(it) } #outline(indent: auto) #pagebreak() = Disclaimer #lorem(60) #pagebreak()
https://github.com/eduardz1/Bachelor-Thesis
https://raw.githubusercontent.com/eduardz1/Bachelor-Thesis/main/chapters/smol.typ
typst
#import "../utils/common.typ": * = SMOL <smol-heading> SMOL (Semantic Micro Object Language) is an imperative, object-oriented language with integrated semantic state access. It can be used as a framework for creating digital twins. The interpreter can be used to examine the state of the system with SPARQL, SHACL, and OWL queries. It can be seen conceptually as a subset of Java. SMOL uses _Functional Mock-Up Objects_ (FMOs) as a programming layer to encapsulate simulators compliant with the #link("https://fmi-standard.org")[FMI standard] into object-oriented structures @smol. One of the key features of SMOL is the choice to treat FMUs as first-order concepts and integrate them into its type system. The project is in its early stages of development, during our internship one of our objectives was to demonstrate the capabilities of the language and help with its development by being some of the first users and submitting issues (and eventually fixes) when they arise on the main repository. Details on our usage of the language can be found in @smol-twinning-program. #_content( [ == A Functional Mock-Up Object Language To develop cyber-physical systems, it's imperative to have language and tool support for the core technologies involved, in particular simulators (integrated as FMUs) and knowledge graphs. To achieve this, one needs to leverage a language that encompasses both of those technologies. SMOL, as presented by Kamburjan et al. in 2021, is a syntactically standard, statically typed, object-oriented language that achieves support for both @ksosu. SMOL goes beyond what would be achievable by extending any traditional language with packages or libraries by incorporating FMUs as Functional Mock-Up Objects in its runtime and treating them as first-order types. In an FMO the in and out ports of the #v(600pt) /* FIXME: remove once issue #466 is implemented */ corresponding FMI become the fields of the object and the functions are converted in class methods, for example, the $mono("doStep")$ operation @fmi-section is translated to a method that accepts a floating point number as parameter (the time). For instance, to initialize an FMO `gr` in SMOL that accepts a Boolean as input and returns a Double as output, one would write: ```smol FMO[in Boolean i, out Double o] gr = simulate( "Greenhouse.fmu", i = True ); ``` The number of inputs and outputs is not limited and their name has to match the name of the corresponding variable in the FMU. Each one has a `tick` method that accepts a floating point number as a parameter to advance the simulation by a given time. == Semantical Lifting <semantical-lifting> Semantical Lifting maps a program state to a knowledge graph, to see the program state through the lens of domain knowledge @ksosu.#v(600pt) /* FIXME: remove once issue #466 is implemented */ At any point at runtime, the state of the program can be queried and lifted states can be used to check the consistency of the program with the domain constraints. ], )
https://github.com/rangerjo/tutor
https://raw.githubusercontent.com/rangerjo/tutor/main/README.md
markdown
MIT License
# tutor Utilities to write exams and exercises with integrated solutions. Set the variable `#(cfg.sol = true)` to display the solutions of a document. Currently the following features are supported: * Automatic total point calculation through the `#points()` and `#totalpoints()` functions. * Checkboxes that are either blank or show the solution state using eg. `#checkbox(cfg, true)`. * Display blank lines allowing students to write their answer using eg. `#lines(cfg, 3)`. * A proposition for a project structure allowing self-contained exercises and a mechanism to show or hide the solutions of an exercise. ## Usage ### Minimal Example ```typst #import "@local/tutor:0.6.1": points, totalpoints, lines, checkbox, default-config #let cfg = default-config() // enable solution mode #(cfg.sol = true) // display 3 lines (for hand written answer) #lines(cfg, 3) // checkbox for multiple choice (indicates correct state) #checkbox(cfg, true) // show achievable points Max. points: #points(2) Max. points: #points(3) // show sum of all total achievable points (will show 5) Total points: #totalpoints(cfg) ``` ### Practical Example Check [example](https://github.com/rangerjo/tutor/tree/main/example) for a more practical example. `tutor` is best used with the following directory and file structure: ``` ├── main.typ ├── src │   ├── ex1 │   │   └── ex.typ │   └── ex2 │   └── ex.typ └── tutor.toml ``` Every directory in `src` holds one self-contained exercise. The exercises can be imported into `main.typ`: ```typst #import "@local/tutor:0.6.1": totalpoints, lines, default-config #import "src/ex1/ex.typ" as ex1 #import "src/ex2/ex.typ" as ex2 #let cfg = default-config() #ex1.exercise(cfg) #ex2.exercise(cfg) ``` Supporting self-contained exercises is one of `tutor`s primary design goals. Each exercise lives within a folder and can easily be copied or referenced in a new document. An exercise is a folder that contains an `ex.typ` file along with any other assets (images, source code aso). The following exercise shows a practical usage of the `#checkbox()` and `#points()` functions. `src/ex1/ex.typ` ```typst #import "@local/tutor:0.6.1": points, checkbox #let exercise(cfg) = [ #heading(level:cfg.lvl, [Abbreviation FHIR (#points(1) point)]) What does FHIR stand for? #set list(marker: none) - #checkbox(cfg, false) Finally He Is Real - #checkbox(cfg, true) Fast Health Interoperability Resources - #checkbox(cfg, false) First Health Inactivation Restriction #if cfg.sol { [ Further explanation: FHIR is the new standard developed by HL7. ] } ] ``` Finally this second example shows the `#lines()` function. `src/ex2/ex.typ` ```typst #import "@local/tutor:0.6.1": points, lines #let exercise(cfg) = [ #heading(level:cfg.lvl, [FHIR vs HL7v2 (#points(4.5) points)]) List two differences between HL7v2 and FHIR: + #if cfg.sol { [ HL7v2 uses a non-standard line format, where as FHIR uses XML or JSON] } else { [ #lines(cfg, 3) ] } + #if cfg.sol { [ FHIR specifies various resources that can be queried, where as HL7v2 has a number of fixed fields that are either filled in or not]} else { [ #lines(cfg, 3) ] } ] ``` This would then give the following output in question mode (`#(cfg.sol=false)`) and in solution mode (`#(cfg.sol=true)`): ![Example document in solution mode](https://raw.githubusercontent.com/rangerjo/tutor/main/imgs/example_mod.png) ## Utilities ### lines `#lines(cfg, count)` prints `count` lines for students to write their answer. Configuration: ```typst // Vertical line spacing between rows. #(cfg.utils.lines.spacing = 8mm) ``` ### grid `#grid(cfg, width, height)` prints a grid for students to write their answer. Configuration: ```typst // Grid spacing. #(cfg.utils.grid.spacing = 4mm) ``` ### checkbox `#checkbox(cfg, answer)` shows a checkbox. In solution mode, the checkbox is shown filled out. Configuration: ```typst // Symbol to show if answer is true #(cfg.utils.checkbox.sym_true = "☒") // Symbol to show if answer is false #(cfg.utils.checkbox.sym_false = "☐") // Symbol to show in question mode #(cfg.utils.checkbox.sym_question = "☐") ``` ### points `#points(cfg, num)` displays the given `num` while adding its value to the total points counter. Configuration: none ### totalpoints `#totalpoints(cfg)` shows the final value of the total points counter. Configuration: ```typst // If points() is used in the outline, totalpoints value becomes doubled. // By setting outline to true, totalpoints gets divided by half. #(cfg.utils.totalpoints.outline = false) ``` ## Modes `tutor` comes with a solution and a test mode. ### solution mode Solution mode controls wheter solutions are shown or not. This mode controls eg. the utility `#checkbox(cfg, answer)`. 1. `(cfg.sol = false)`: Solutions are hidden. This is used for the actual exam handed out to students. 2. `(cfg.sol = true)`: Solutions are shown. This is used to create the exam solutions. ### test mode Test mode can be used to show or hide additional information. In test mode, one might want 1. `(cfg.test = true)`: Test information are shown. Use this eg. to display `#points(4)`. This is used in case the document is used as an exam/test. 2. `(cfg.test = false)`: Test information are hidden. This is used in case the document is used as an excerise. The following would show the points only in test mode. ```typst #if cfg.test { #points(4) } ``` ## Configuration `tutor` is designed to create exams and solutions with one single document source. Furthermore, the individual utilities provided by `tutor` can be configured. This can be done in one of three ways: 1. Use the `#default-config()` function and patch your configuration. The following example would configure the solution mode and basic line spacings to 8 millimeters: ```typst #let cfg = default-config() #(cfg.sol = false) #(cfg.utils.lines.spacing = 8mm) ``` 2. Use an external file to hold the configurations in your prefered format. See [tutor.toml](https://github.com/rangerjo/tutor/blob/main/example/tutor.toml) for a configuration in TOML. Load the configuration into your main document using ```typst #let cfg = toml("tutor.toml") ``` 3. Use typst's input feature added with compiler version 0.11.0. Add the following snippet to load the configuration, then overwrite it from the CLI like this: `typst compile --input tutor_sol=true main.typ` ```typst #let cfg = toml("tutor.toml") #if sys.inputs.tutor_sol == "true" { (cfg.sol = true) } else if sys.inputs.tutor_sol == "false" { (cfg.sol = false) } ```
https://github.com/shunichironomura/iac-typst-template
https://raw.githubusercontent.com/shunichironomura/iac-typst-template/main/README.md
markdown
MIT No Attribution
# Typst Template for the International Astronautical Congress (IAC) Manuscript This is an unofficial Typst template for the International Astronautical Congress (IAC) manuscript, which is based on [the 74th IAC Manuscript Guidelines (PDF file)](https://www.iafastro.org/assets/files/IAC%202023%20Manuscript%20Guidelines.pdf) and [the Manuscript Template and Style Guide (MS Word file)](https://www.iafastro.org/assets/files/IAC%202023_Manuscript-Template.doc). ## Usage To initialize a project with this template, run the following command: ```bash typst init @preview/stellar-iac ``` Or, you can manually add the following line at the beginning of your Typst file: ```typst #import "@preview/stellar-iac:0.4.1": project ``` The `project` function exported by this template has the following named arguments: - `paper-code` (default: `""`): The paper code of the manuscript. - `title` (default: `""`): The title of the manuscript. - `authors` (default: `()`): The authors of the manuscript. Each item in the array should be a dictionary with the following keys: - `name` (required): The name of the author. - `email` (required): The email address of the author. - `affiliation` (required): The affiliation of the author. The value must match one of the affiliation names defined in the `organizations` argument. - `corresponding` (default: `false`): Whether the author is the corresponding author. - `organizations` (default: `()`): The organizations of the authors. Each item in the array should be a dictionary with the following keys: - `name` (required): The name of the organization. This name should be used in the `affiliation` field of the `authors` argument. - `display` (required): The display name of the organization, including its address. - `keywords` (default: `()`): The keywords of the manuscript. - `header` (default: `[]`): The header of the manuscript. For IAC 2024, it should be `[75#super[th] International Astronautical Congress (IAC), Milan, Italy, 14-18 October 2024.\ Copyright #{sym.copyright}2024 by the International Astronautical Federation (IAF). All rights reserved.]`. - `abstract` (default: `""`): The abstract of the manuscript. See [`main.typ`](template/main.typ) for more details. ## Notable differences from the official template - The citation style is not exactly the same as the official template. This could be fixed by manually preparing a CSL file, but it is "good enough." ## Directory Structure and Licensing - The `lib.typ` file and all other files in this package, except for the content in the `template` directory, are licensed under the MIT License. See [LICENSE-MIT.txt](./LICENSE-MIT.txt) for details. - The content in the `template` directory is licensed under the MIT-0 License, which allows for unlimited reuse without any restrictions. See [LICENSE-MIT-0.txt](./LICENSE-MIT-0.txt) for more information. - The `reproduction` directory is included in this repository to demonstrate how the Typst template in `lib.typ` can be used to reproduce a layout similar to [the original MS Word template](https://www.iafastro.org/assets/files/IAC%202023_Manuscript-Template.doc) copyrighted by the International Astronautical Federation (IAF). **This content is not part of the distributed package and is provided here solely for demonstration purposes.** It is not licensed for use, modification, or distribution without permission from the copyright holder.
https://github.com/silent-dxx/typst-color-emoji
https://raw.githubusercontent.com/silent-dxx/typst-color-emoji/main/cm.typ
typst
MIT License
#let t-cm(id) = box(baseline: 14.5%)[ #image(width: 1.0em, "twemoji/assets/svg/" + id + ".svg") ] #let o-cm(id) = box(baseline: 14.5%)[ #image(width: 1.0em, "openmoji/color/svg/" + upper(id) + ".svg") ] #let cm-dic = ( "ABCD": "1f520", "a": "1f170", "ab": "1f18e", "abacus": "1f9ee", "abc": "1f524", "abcd": "1f521", "accordion": "1fa97", "aesculapius": "2695", "airplane": "2708", "airplane.landing": "1f6ec", "airplane.small": "1f6e9", "airplane.takeoff": "1f6eb", "alembic": "2697", "alien": "1f47d", "alien.monster": "1f47e", "ambulance": "1f691", "amphora": "1f3fa", "anchor": "2693", "anger": "1f4a2", "ant": "1f41c", "apple.green": "1f34f", "apple.red": "1f34e", "arm.mech": "1f9be", "arm.muscle": "1f4aa", "arm.selfie": "1f933", "arrow.r.filled": "27a1", "arrow.r.hook": "21aa", "arrow.r.soon": "1f51c", "arrow.l.filled": "2b05", "arrow.l.hook": "21a9", "arrow.l.back": "1f519", "arrow.l.end": "1f51a", "arrow.t.filled": "2b06", "arrow.t.curve": "2934", "arrow.t.top": "1f51d", "arrow.b.filled": "2b07", "arrow.b.curve": "2935", "arrow.l.r": "2194", "arrow.l.r.on": "1f51b", "arrow.t.b": "2195", "arrow.bl": "2199", "arrow.br": "2198", "arrow.tl": "2196", "arrow.tr": "2197", "arrows.cycle": "1f504", "ast": ("002a-fe0f-20e3", "2a-20e3"), "ast.box": "2733", "atm": "1f3e7", "atom": "269b", "aubergine": "1f346", "avocado": "1f951", "axe": "1fa93", "b": "1f171", "baby": "1f476", "baby.angel": "1f47c", "baby.box": "1f6bc", "babybottle": "1f37c", "backpack": "1f392", "bacon": "1f953", "badger": "1f9a1", "badminton": "1f3f8", "bagel": "1f96f", "baggageclaim": "1f6c4", "baguette": "1f956", "balloon": "1f388", "ballot.check": "2611", "ballotbox": "1f5f3", "banana": "1f34c", "banjo": "1fa95", "bank": "1f3e6", "barberpole": "1f488", "baseball": "26be", "basecap": "1f9e2", "basket": "1f9fa", "basketball": "26f9", "basketball.ball": "1f3c0", "bat": "1f987", "bathtub": "1f6c0", "bathtub.foam": "1f6c1", "battery": "1f50b", "battery.low": "1faab", "beach.palm": "1f3dd", "beach.umbrella": "1f3d6", "beads": "1f4ff", "beans": "1fad8", "bear": "1f43b", "beaver": "1f9ab", "bed": "1f6cf", "bed.person": "1f6cc", "bee": "1f41d", "beer": "1f37a", "beer.clink": "1f37b", "beetle": "1fab2", "beetle.lady": "1f41e", "bell": "1f514", "bell.ding": "1f6ce", "bell.not": "1f515", "bento": "1f371", "bicyclist": "1f6b4", "bicyclist.mountain": "1f6b5", "bike": "1f6b2", "bike.not": "1f6b3", "bikini": "1f459", "billiards": "1f3b1", "bin": "1f5d1", "biohazard": "2623", "bird": "1f426", "bison": "1f9ac", "blood": "1fa78", "blouse": "1f45a", "blowfish": "1f421", "blueberries": "1fad0", "boar": "1f417", "boat.sail": "26f5", "boat.row": "1f6a3", "boat.motor": "1f6e5", "boat.speed": "1f6a4", "boat.canoe": "1f6f6", "bolt": "1f529", "bomb": "1f4a3", "bone": "1f9b4", "book.red": "1f4d5", "book.blue": "1f4d8", "book.green": "1f4d7", "book.orange": "1f4d9", "book.spiral": "1f4d2", "book.open": "1f4d6", "bookmark": "1f516", "books": "1f4da", "boomerang": "1fa83", "bordercontrol": "1f6c2", "bouquet": "1f490", "bow": "1f3f9", "bowl.spoon": "1f963", "bowl.steam": "1f35c", "bowling": "1f3b3", "boxing": "1f94a", "boy": "1f466", "brain": "1f9e0", "bread": "1f35e", "brick": "1f9f1", "bride": "1f470", "bridge.fog": "1f301", "bridge.night": "1f309", "briefcase": "1f4bc", "briefs": "1fa72", "brightness.high": "1f506", "brightness.low": "1f505", "broccoli": "1f966", "broom": "1f9f9", "brush": "1f58c", "bubble.speech.r": "1f4ac", "bubble.speech.l": "1f5e8", "bubble.thought": "1f4ad", "bubble.anger.r": "1f5ef", "bubbles": "1fae7", "bubbletea": "1f9cb", "bucket": "1faa3", "buffalo.water": "1f403", "bug": "1f41b", "builder": "1f477", "burger": "1f354", "burrito": "1f32f", "bus": "1f68c", "bus.front": "1f68d", "bus.small": "1f690", "bus.stop": "1f68f", "bus.trolley": "1f68e", "butter": "1f9c8", "butterfly": "1f98b", "button": "1f532", "button.alt": "1f533", "button.radio": "1f518", "cabinet.file": "1f5c4", "cablecar": "1f6a0", "cablecar.small": "1f6a1", "cactus": "1f335", "cake": "1f382", "cake.fish": "1f365", "cake.moon": "1f96e", "cake.slice": "1f370", "calendar": "1f4c5", "calendar.spiral": "1f5d3", "calendar.tearoff": "1f4c6", "camel": "1f42b", "camel.dromedar": "1f42a", "camera": "1f4f7", "camera.flash": "1f4f8", "camera.movie": "1f3a5", "camera.movie.box": "1f3a6", "camera.video": "1f4f9", "camping": "1f3d5", "can": "1f96b", "candle": "1f56f", "candy": "1f36c", "cane": "1f9af", "car": "1f697", "car.front": "1f698", "car.pickup": "1f6fb", "car.police": "1f693", "car.police.front": "1f694", "car.racing": "1f3ce", "car.rickshaw": "1f6fa", "car.suv": "1f699", "card.credit": "1f4b3", "card.id": "1faaa", "cardindex": "1f4c7", "carrot": "1f955", "cart": "1f6d2", "cassette": "1f4fc", "castle.eu": "1f3f0", "castle.jp": "1f3ef", "cat": "1f408", "cat.face": "1f431", "cat.face.angry": "1f63e", "cat.face.cry": "1f63f", "cat.face.heart": "1f63b", "cat.face.joy": "1f639", "cat.face.kiss": "1f63d", "cat.face.laugh": "1f638", "cat.face.shock": "1f640", "cat.face.smile": "1f63a", "cat.face.smirk": "1f63c", "chain": "1f517", "chains": "26d3", "chair": "1fa91", "champagne": "1f37e", "chart.bar": "1f4ca", "chart.up": "1f4c8", "chart.down": "1f4c9", "chart.yen.up": "1f4b9", "checkmark.heavy": "2714", "checkmark.box": "2705", "cheese": "1f9c0", "cherries": "1f352", "chess": "265f", "chestnut": "1f330", "chicken": "1f414", "chicken.baby": "1f425", "chicken.baby.egg": "1f423", "chicken.baby.head": "1f424", "chicken.leg": "1f357", "chicken.male": "1f413", "child": "1f9d2", "chipmunk": "1f43f", "chocolate": "1f36b", "chopsticks": "1f962", "church": "26ea", "church.love": "1f492", "cigarette": "1f6ac", "cigarette.not": "1f6ad", "circle.black": "26ab", "circle.blue": "1f535", "circle.brown": "1f7e4", "circle.green": "1f7e2", "circle.orange": "1f7e0", "circle.purple": "1f7e3", "circle.white": "26aa", "circle.red": "1f534", "circle.yellow": "1f7e1", "circle.stroked": "2b55", "circus": "1f3aa", "city": "1f3d9", "city.dusk": "1f306", "city.night": "1f303", "city.sunset": "1f307", "cl": "1f191", "clamp": "1f5dc", "clapperboard": "1f3ac", "climbing": "1f9d7", "clip": "1f4ce", "clipboard": "1f4cb", "clips": "1f587", "clock.one": "1f550", "clock.one.thirty": "1f55c", "clock.two": "1f551", "clock.two.thirty": "1f55d", "clock.three": "1f552", "clock.three.thirty": "1f55e", "clock.four": "1f553", "clock.four.thirty": "1f55f", "clock.five": "1f554", "clock.five.thirty": "1f560", "clock.six": "1f555", "clock.six.thirty": "1f561", "clock.seven": "1f556", "clock.seven.thirty": "1f562", "clock.eight": "1f557", "clock.eight.thirty": "1f563", "clock.nine": "1f558", "clock.nine.thirty": "1f564", "clock.ten": "1f559", "clock.ten.thirty": "1f565", "clock.eleven": "1f55a", "clock.eleven.thirty": "1f566", "clock.twelve": "1f55b", "clock.twelve.thirty": "1f567", "clock.alarm": "23f0", "clock.old": "1f570", "clock.timer": "23f2", "cloud": "2601", "cloud.dust": "1f4a8", "cloud.rain": "1f327", "cloud.snow": "1f328", "cloud.storm": "26c8", "cloud.sun": "26c5", "cloud.sun.hidden": "1f325", "cloud.sun.rain": "1f326", "cloud.thunder": "1f329", "coat": "1f9e5", "coat.lab": "1f97c", "cockroach": "1fab3", "cocktail.martini": "1f378", "cocktail.tropical": "1f379", "coconut": "1f965", "coffee": "2615", "coffin": "26b0", "coin": "1fa99", "comet": "2604", "compass": "1f9ed", "computer": "1f5a5", "computermouse": "1f5b1", "confetti": "1f38a", "construction": "1f6a7", "controller": "1f3ae", "cookie": "1f36a", "cookie.fortune": "1f960", "cooking": "1f373", "cool": "1f192", "copyright": ("00a9", "a9"), "coral": "1fab8", "corn": "1f33d", "couch": "1f6cb", "couple": "1f491", "cow": "1f404", "cow.face": "1f42e", "crab": "1f980", "crane": "1f3d7", "crayon": "1f58d", "cricket": "1f997", "cricketbat": "1f3cf", "crocodile": "1f40a", "croissant": "1f950", "crossmark": "274c", "crossmark.box": "274e", "crown": "1f451", "crutch": "1fa7c", "crystal": "1f52e", "cucumber": "1f952", "cup.straw": "1f964", "cupcake": "1f9c1", "curling": "1f94c", "curry": "1f35b", "custard": "1f36e", "customs": "1f6c3", "cutlery": "1f374", "cyclone": "1f300", "dancing.man": "1f57a", "dancing.woman": "1f483", "dancing.women.bunny": "1f46f", "darts": "1f3af", "dash.wave.double": "3030", "deer": "1f98c", "desert": "1f3dc", "detective": "1f575", "diamond.blue": "1f537", "diamond.blue.small": "1f539", "diamond.orange": "1f536", "diamond.orange.small": "1f538", "diamond.dot": "1f4a0", "die": "1f3b2", "dino.pod": "1f995", "dino.rex": "1f996", "disc.cd": "1f4bf", "disc.dvd": "1f4c0", "disc.mini": "1f4bd", "discoball": "1faa9", "diving": "1f93f", "dodo": "1f9a4", "dog": "1f415", "dog.face": "1f436", "dog.guide": "1f9ae", "dog.poodle": "1f429", "dollar": "1f4b2", "dolphin": "1f42c", "donut": "1f369", "door": "1f6aa", "dove.peace": "1f54a", "dragon": "1f409", "dragon.face": "1f432", "dress": "1f457", "dress.kimono": "1f458", "dress.sari": "1f97b", "drop": "1f4a7", "drops": "1f4a6", "drum": "1f941", "drum.big": "1fa98", "duck": "1f986", "dumpling": "1f95f", "eagle": "1f985", "ear": "1f442", "ear.aid": "1f9bb", "egg": "1f95a", "eighteen.not": "1f51e", "elephant": "1f418", "elevator": "1f6d7", "elf": "1f9dd", "email": "1f4e7", "excl": "2757", "excl.white": "2755", "excl.double": "203c", "excl.quest": "2049", "explosion": "1f4a5", "extinguisher": "1f9ef", "eye": "1f441", "eyes": "1f440", "face.grin": "1f600", "face.angry": "1f620", "face.angry.red": "1f621", "face.anguish": "1f627", "face.astonish": "1f632", "face.bandage": "1f915", "face.beam": "1f601", "face.blank": "1f636", "face.clown": "1f921", "face.cold": "1f976", "face.concern": "1f626", "face.cool": "1f60e", "face.cover": "1f92d", "face.cowboy": "1f920", "face.cry": "1f62d", "face.devil.smile": "1f608", "face.devil.frown": "1f47f", "face.diagonal": "1fae4", "face.disguise": "1f978", "face.dizzy": "1f635", "face.dotted": "1fae5", "face.down": "1f61e", "face.down.sweat": "1f613", "face.drool": "1f924", "face.explode": "1f92f", "face.eyeroll": "1f644", "face.friendly": "263a", "face.fear": "1f628", "face.fear.sweat": "1f630", "face.fever": "1f912", "face.flush": "1f633", "face.frown": "2639", "face.frown.slight": "1f641", "face.frust": "1f623", "face.goofy": "1f92a", "face.halo": "1f607", "face.happy": "1f60a", "face.heart": "1f60d", "face.hearts": "1f970", "face.heat": "1f975", "face.hug": "1f917", "face.inv": "1f643", "face.joy": "1f602", "face.kiss": "1f617", "face.kiss.smile": "1f619", "face.kiss.heart": "1f618", "face.kiss.blush": "1f61a", "face.lick": "1f60b", "face.lie": "1f925", "face.mask": "1f637", "face.meh": "1f612", "face.melt": "1fae0", "face.money": "1f911", "face.monocle": "1f9d0", "face.nausea": "1f922", "face.nerd": "1f913", "face.neutral": "1f610", "face.open": "1f603", "face.party": "1f973", "face.peek": "1fae3", "face.plead": "1f97a", "face.relief": "1f60c", "face.rofl": "1f923", "face.sad": "1f614", "face.salute": "1fae1", "face.shock": "1f631", "face.shush": "1f92b", "face.skeptic": "1f928", "face.sleep": "1f634", "face.sleepy": "1f62a", "face.smile": "1f604", "face.smile.slight": "1f642", "face.smile.sweat": "1f605", "face.smile.tear": "1f972", "face.smirk": "1f60f", "face.sneeze": "1f927", "face.speak.not": "1fae2", "face.squint": "1f606", "face.stars": "1f929", "face.straight": "1f611", "face.suffer": "1f616", "face.surprise": "1f62f", "face.symbols": "1f92c", "face.tear": "1f622", "face.tear.relief": "1f625", "face.tear.withheld": "1f979", "face.teeth": "1f62c", "face.think": "1f914", "face.tired": "1f62b", "face.tongue": "1f61b", "face.tongue.squint": "1f61d", "face.tongue.wink": "1f61c", "face.triumph": "1f624", "face.unhappy": "1f615", "face.vomit": "1f92e", "face.weary": "1f629", "face.wink": "1f609", "face.woozy": "1f974", "face.worry": "1f61f", "face.wow": "1f62e", "face.yawn": "1f971", "face.zip": "1f910", "factory": "1f3ed", "fairy": "1f9da", "faith.christ": "271d", "faith.dharma": "2638", "faith.islam": "262a", "faith.judaism": "2721", "faith.menorah": "1f54e", "faith.om": "1f549", "faith.orthodox": "2626", "faith.peace": "262e", "faith.star.dot": "1f52f", "faith.worship": "1f6d0", "faith.yinyang": "262f", "falafel": "1f9c6", "family": "1f46a", "fax": "1f4e0", "feather": "1fab6", "feeding.breast": "1f931", "fencing": "1f93a", "ferriswheel": "1f3a1", "filebox": "1f5c3", "filedividers": "1f5c2", "film": "1f39e", "finger.r": "1f449", "finger.l": "1f448", "finger.t": "1f446", "finger.t.alt": "261d", "finger.b": "1f447", "finger.front": "1faf5", "finger.m": "1f595", "fingers.cross": "1f91e", "fingers.pinch": "1f90c", "fingers.snap": "1faf0", "fire": "1f525", "firecracker": "1f9e8", "fireengine": "1f692", "fireworks": "1f386", "fish": "1f41f", "fish.tropical": "1f420", "fishing": "1f3a3", "fist.front": "1f44a", "fist.r": "1f91c", "fist.l": "1f91b", "fist.raised": "270a", "flag.black": "1f3f4", "flag.white": "1f3f3", "flag.goal": "1f3c1", "flag.golf": "26f3", "flag.red": "1f6a9", "flags.jp.crossed": "1f38c", "flamingo": "1f9a9", "flashlight": "1f526", "flatbread": "1fad3", "fleur": "269c", "floppy": "1f4be", "flower.hibiscus": "1f33a", "flower.lotus": "1fab7", "flower.pink": "1f338", "flower.rose": "1f339", "flower.sun": "1f33b", "flower.tulip": "1f337", "flower.white": "1f4ae", "flower.wilted": "1f940", "flower.yellow": "1f33c", "fly": "1fab0", "fog": "1f32b", "folder": "1f4c1", "folder.open": "1f4c2", "fondue": "1fad5", "foot": "1f9b6", "football": "26bd", "football.am": "1f3c8", "forex": "1f4b1", "fountain": "26f2", "fox": "1f98a", "free": "1f193", "fries": "1f35f", "frisbee": "1f94f", "frog.face": "1f438", "fuelpump": "26fd", "gachi": "1f237", "garlic": "1f9c4", "gear": "2699", "gem": "1f48e", "genie": "1f9de", "ghost": "1f47b", "giraffe": "1f992", "girl": "1f467", "glass.clink": "1f942", "glass.milk": "1f95b", "glass.pour": "1fad7", "glass.tumbler": "1f943", "glasses": "1f453", "glasses.sun": "1f576", "globe.am": "1f30e", "globe.as.au": "1f30f", "globe.eu.af": "1f30d", "globe.meridian": "1f310", "gloves": "1f9e4", "go": "1f234", "goal": "1f945", "goat": "1f410", "goggles": "1f97d", "golfing": "1f3cc", "gorilla": "1f98d", "grapes": "1f347", "guard.man": "1f482", "guitar": "1f3b8", "gymnastics": "1f938", "haircut": "1f487", "hammer": "1f528", "hammer.pick": "2692", "hammer.wrench": "1f6e0", "hamsa": "1faac", "hamster.face": "1f439", "hand.raised": "270b", "hand.raised.alt": "1f91a", "hand.r": "1faf1", "hand.l": "1faf2", "hand.t": "1faf4", "hand.b": "1faf3", "hand.ok": "1f44c", "hand.call": "1f919", "hand.love": "1f91f", "hand.part": "1f596", "hand.peace": "270c", "hand.pinch": "1f90f", "hand.rock": "1f918", "hand.splay": "1f590", "hand.wave": "1f44b", "hand.write": "270d", "handbag": "1f45c", "handball": "1f93e", "handholding.man.man": "1f46c", "handholding.woman.man": "1f46b", "handholding.woman.woman": "1f46d", "hands.folded": "1f64f", "hands.palms": "1f932", "hands.clap": "1f44f", "hands.heart": "1faf6", "hands.open": "1f450", "hands.raised": "1f64c", "hands.shake": "1f91d", "hash": ("0023-fe0f-20e3", "23-20e3"), "hat.ribbon": "1f452", "hat.top": "1f3a9", "headphone": "1f3a7", "heart": "2764", "heart.arrow": "1f498", "heart.beat": "1f493", "heart.black": "1f5a4", "heart.blue": "1f499", "heart.box": "1f49f", "heart.broken": "1f494", "heart.brown": "1f90e", "heart.double": "1f495", "heart.excl": "2763", "heart.green": "1f49a", "heart.grow": "1f497", "heart.orange": "1f9e1", "heart.purple": "1f49c", "heart.real": "1fac0", "heart.revolve": "1f49e", "heart.ribbon": "1f49d", "heart.spark": "1f496", "heart.white": "1f90d", "heart.yellow": "1f49b", "hedgehog": "1f994", "helicopter": "1f681", "helix": "1f9ec", "helmet.cross": "26d1", "helmet.military": "1fa96", "hi": "3299", "hippo": "1f99b", "hockey": "1f3d1", "hole": "1f573", "honey": "1f36f", "hongbao": "1f9e7", "hook": "1fa9d", "horn.postal": "1f4ef", "horse": "1f40e", "horse.carousel": "1f3a0", "horse.face": "1f434", "horse.race": "1f3c7", "hospital": "1f3e5", "hotdog": "1f32d", "hotel": "1f3e8", "hotel.love": "1f3e9", "hotspring": "2668", "hourglass": "231b", "hourglass.flow": "23f3", "house": "1f3e0", "house.derelict": "1f3da", "house.garden": "1f3e1", "house.multiple": "1f3d8", "hundred": "1f4af", "hut": "1f6d6", "ice": "1f9ca", "icecream": "1f368", "icecream.shaved": "1f367", "icecream.soft": "1f366", "icehockey": "1f3d2", "id": "1f194", "info": "2139", "izakaya": "1f3ee", "jar": "1fad9", "jeans": "1f456", "jigsaw": "1f9e9", "joystick": "1f579", "juggling": "1f939", "juice": "1f9c3", "ka": "1f251", "kaaba": "1f54b", "kachi": "1f239", "kadomatsu": "1f38d", "kangaroo": "1f998", "kara": "1f233", "kebab": "1f959", "key": "1f511", "key.old": "1f5dd", "keyboard": "2328", "kiss": "1f48f", "kissmark": "1f48b", "kite": "1fa81", "kiwi": "1f95d", "knife": "1f52a", "knife.dagger": "1f5e1", "knot": "1faa2", "koala": "1f428", "koinobori": "1f38f", "koko": "1f201", "kon": "1f232", "label": "1f3f7", "lacrosse": "1f94d", "ladder": "1fa9c", "lamp.diya": "1fa94", "laptop": "1f4bb", "leaf.clover.three": "2618", "leaf.clover.four": "1f340", "leaf.fall": "1f342", "leaf.herb": "1f33f", "leaf.maple": "1f341", "leaf.wind": "1f343", "leftluggage": "1f6c5", "leg": "1f9b5", "leg.mech": "1f9bf", "lemon": "1f34b", "leopard": "1f406", "letter.love": "1f48c", "liberty": "1f5fd", "lightbulb": "1f4a1", "lightning": "26a1", "lion": "1f981", "lipstick": "1f484", "litter": "1f6ae", "litter.not": "1f6af", "lizard": "1f98e", "llama": "1f999", "lobster": "1f99e", "lock": "1f512", "lock.key": "1f510", "lock.open": "1f513", "lock.pen": "1f50f", "lollipop": "1f36d", "lotion": "1f9f4", "luggage": "1f9f3", "lungs": "1fac1", "mage": "1f9d9", "magnet": "1f9f2", "magnify.r": "1f50e", "magnify.l": "1f50d", "mahjong.dragon.red": "1f004", "mail": "2709", "mail.arrow": "1f4e9", "mailbox.closed.empty": "1f4ea", "mailbox.closed.full": "1f4eb", "mailbox.open.empty": "1f4ed", "mailbox.open.full": "1f4ec", "mammoth": "1f9a3", "man": "1f468", "man.box": "1f6b9", "man.crown": "1f934", "man.guapimao": "1f472", "man.levitate": "1f574", "man.old": "1f474", "man.pregnant": "1fac3", "man.turban": "1f473", "man.tuxedo": "1f935", "mango": "1f96d", "map.world": "1f5fa", "map.jp": "1f5fe", "martialarts": "1f94b", "masks": "1f3ad", "mate": "1f9c9", "matryoshka": "1fa86", "meat": "1f969", "meat.bone": "1f356", "medal.first": "1f947", "medal.second": "1f948", "medal.third": "1f949", "medal.sports": "1f3c5", "medal.military": "1f396", "megaphone": "1f4e2", "megaphone.simple": "1f4e3", "melon": "1f348", "merperson": "1f9dc", "metro": "24c2", "microbe": "1f9a0", "microphone": "1f3a4", "microphone.studio": "1f399", "microscope": "1f52c", "milkyway": "1f30c", "mirror": "1fa9e", "mixer": "1f39b", "money.bag": "1f4b0", "money.dollar": "1f4b5", "money.euro": "1f4b6", "money.pound": "1f4b7", "money.yen": "1f4b4", "money.wings": "1f4b8", "monkey": "1f412", "monkey.face": "1f435", "monkey.hear.not": "1f649", "monkey.see.not": "1f648", "monkey.speak.not": "1f64a", "moon.crescent": "1f319", "moon.full": "1f315", "moon.full.face": "1f31d", "moon.new": "1f311", "moon.new.face": "1f31a", "moon.wane.one": "1f316", "moon.wane.two": "1f317", "moon.wane.three.face": "1f31c", "moon.wane.three": "1f318", "moon.wax.one": "1f312", "moon.wax.two": "1f313", "moon.wax.two.face": "1f31b", "moon.wax.three": "1f314", "mortarboard": "1f393", "mosque": "1f54c", "mosquito": "1f99f", "motorcycle": "1f3cd", "motorway": "1f6e3", "mountain": "26f0", "mountain.fuji": "1f5fb", "mountain.snow": "1f3d4", "mountain.sunrise": "1f304", "mouse": "1f401", "mouse.face": "1f42d", "mousetrap": "1faa4", "mouth": "1f444", "mouth.bite": "1fae6", "moyai": "1f5ff", "muryo": "1f21a", "museum": "1f3db", "mushroom": "1f344", "musicalscore": "1f3bc", "nails.polish": "1f485", "namebadge": "1f4db", "nazar": "1f9ff", "necktie": "1f454", "needle": "1faa1", "nest.empty": "1fab9", "nest.eggs": "1faba", "new": "1f195", "newspaper": "1f4f0", "newspaper.rolled": "1f5de", "ng": "1f196", "ningyo": "1f38e", "ninja": "1f977", "noentry": "26d4", "nose": "1f443", "notebook": "1f4d3", "notebook.deco": "1f4d4", "notepad": "1f5d2", "notes": "1f3b5", "notes.triple": "1f3b6", "numbers": "1f522", "o": "1f17e", "octopus": "1f419", "office": "1f3e2", "oil": "1f6e2", "ok": "1f197", "olive": "1fad2", "oni": "1f479", "onion": "1f9c5", "orangutan": "1f9a7", "otter": "1f9a6", "owl": "1f989", "ox": "1f402", "oyster": "1f9aa", "package": "1f4e6", "paella": "1f958", "page": "1f4c4", "page.curl": "1f4c3", "page.pencil": "1f4dd", "pager": "1f4df", "pages.tabs": "1f4d1", "painting": "1f5bc", "palette": "1f3a8", "pancakes": "1f95e", "panda": "1f43c", "parachute": "1fa82", "park": "1f3de", "parking": "1f17f", "parrot": "1f99c", "partalteration": "303d", "party": "1f389", "peach": "1f351", "peacock": "1f99a", "peanuts": "1f95c", "pear": "1f350", "pedestrian": "1f6b6", "pedestrian.not": "1f6b7", "pen.ball": "1f58a", "pen.fountain": "1f58b", "pencil": "270f", "penguin": "1f427", "pepper": "1fad1", "pepper.hot": "1f336", "person": "1f9d1", "person.angry": "1f64e", "person.beard": "1f9d4", "person.blonde": "1f471", "person.bow": "1f647", "person.crown": "1fac5", "person.deaf": "1f9cf", "person.facepalm": "1f926", "person.frown": "1f64d", "person.hijab": "1f9d5", "person.kneel": "1f9ce", "person.lotus": "1f9d8", "person.massage": "1f486", "person.no": "1f645", "person.ok": "1f646", "person.old": "1f9d3", "person.pregnant": "1fac4", "person.raise": "1f64b", "person.sassy": "1f481", "person.shrug": "1f937", "person.stand": "1f9cd", "person.steam": "1f9d6", "petri": "1f9eb", "phone": "1f4f1", "phone.arrow": "1f4f2", "phone.classic": "260e", "phone.not": "1f4f5", "phone.off": "1f4f4", "phone.receiver": "1f4de", "phone.signal": "1f4f6", "phone.vibrate": "1f4f3", "piano": "1f3b9", "pick": "26cf", "pie": "1f967", "pig": "1f416", "pig.face": "1f437", "pig.nose": "1f43d", "pill": "1f48a", "pin": "1f4cc", "pin.round": "1f4cd", "pinata": "1fa85", "pineapple": "1f34d", "pingpong": "1f3d3", "pistol": "1f52b", "pizza": "1f355", "placard": "1faa7", "planet": "1fa90", "plant": "1fab4", "plaster": "1fa79", "plate.cutlery": "1f37d", "playback.down": "23ec", "playback.eject": "23cf", "playback.forward": "23e9", "playback.pause": "23f8", "playback.record": "23fa", "playback.repeat": "1f501", "playback.repeat.once": "1f502", "playback.repeat.v": "1f503", "playback.restart": "23ee", "playback.rewind": "23ea", "playback.shuffle": "1f500", "playback.skip": "23ed", "playback.stop": "23f9", "playback.toggle": "23ef", "playback.up": "23eb", "playingcard.flower": "1f3b4", "playingcard.joker": "1f0cf", "plunger": "1faa0", "policeofficer": "1f46e", "poo": "1f4a9", "popcorn": "1f37f", "post.eu": "1f3e4", "post.jp": "1f3e3", "postbox": "1f4ee", "potato": "1f954", "potato.sweet": "1f360", "pouch": "1f45d", "powerplug": "1f50c", "present": "1f381", "pretzel": "1f968", "printer": "1f5a8", "prints.foot": "1f463", "prints.paw": "1f43e", "prohibited": "1f6ab", "projector": "1f4fd", "pumpkin.lantern": "1f383", "purse": "1f45b", "quest": "2753", "quest.white": "2754", "rabbit": "1f407", "rabbit.face": "1f430", "raccoon": "1f99d", "radio": "1f4fb", "radioactive": "2622", "railway": "1f6e4", "rainbow": "1f308", "ram": "1f40f", "rat": "1f400", "razor": "1fa92", "receipt": "1f9fe", "recycling": "267b", "reg": ("00ae", "ae"), "restroom": "1f6bb", "rhino": "1f98f", "ribbon": "1f380", "ribbon.remind": "1f397", "rice": "1f35a", "rice.cracker": "1f358", "rice.ear": "1f33e", "rice.onigiri": "1f359", "ring": "1f48d", "ringbuoy": "1f6df", "robot": "1f916", "rock": "1faa8", "rocket": "1f680", "rollercoaster": "1f3a2", "rosette": "1f3f5", "rugby": "1f3c9", "ruler": "1f4cf", "ruler.triangle": "1f4d0", "running": "1f3c3", "sa": "1f202", "safetypin": "1f9f7", "safetyvest": "1f9ba", "sake": "1f376", "salad": "1f957", "salt": "1f9c2", "sandwich": "1f96a", "santa.man": "1f385", "santa.woman": "1f936", "satdish": "1f4e1", "satellite": "1f6f0", "saw": "1fa9a", "saxophone": "1f3b7", "scales": "2696", "scarf": "1f9e3", "school": "1f3eb", "scissors": "2702", "scooter": "1f6f4", "scooter.motor": "1f6f5", "scorpion": "1f982", "screwdriver": "1fa9b", "scroll": "1f4dc", "seal": "1f9ad", "seat": "1f4ba", "seedling": "1f331", "shark": "1f988", "sheep": "1f411", "shell.spiral": "1f41a", "shield": "1f6e1", "shin": "1f238", "ship": "1f6a2", "ship.cruise": "1f6f3", "ship.ferry": "26f4", "shirt.sports": "1f3bd", "shirt.t": "1f455", "shoe": "1f45e", "shoe.ballet": "1fa70", "shoe.flat": "1f97f", "shoe.heel": "1f460", "shoe.hike": "1f97e", "shoe.ice": "26f8", "shoe.roller": "1f6fc", "shoe.sandal.heel": "1f461", "shoe.ski": "1f3bf", "shoe.sneaker": "1f45f", "shoe.tall": "1f462", "shoe.thong": "1fa74", "shopping": "1f6cd", "shorts": "1fa73", "shoshinsha": "1f530", "shower": "1f6bf", "shrimp": "1f990", "shrimp.fried": "1f364", "shrine": "26e9", "shuku": "3297", "sign.crossing": "1f6b8", "sign.stop": "1f6d1", "silhouette": "1f464", "silhouette.double": "1f465", "silhouette.hug": "1fac2", "silhouette.speak": "1f5e3", "siren": "1f6a8", "skateboard": "1f6f9", "skewer.dango": "1f361", "skewer.oden": "1f362", "skiing": "26f7", "skull": "1f480", "skull.bones": "2620", "skunk": "1f9a8", "sled": "1f6f7", "slide": "1f6dd", "slider": "1f39a", "sloth": "1f9a5", "slots": "1f3b0", "snail": "1f40c", "snake": "1f40d", "snowboarding": "1f3c2", "snowflake": "2744", "snowman": "26c4", "snowman.snow": "2603", "soap": "1f9fc", "socks": "1f9e6", "softball": "1f94e", "sos": "1f198", "soup": "1f372", "spaghetti": "1f35d", "sparkle.box": "2747", "sparkler": "1f387", "sparkles": "2728", "speaker": "1f508", "speaker.not": "1f507", "speaker.wave": "1f509", "speaker.waves": "1f50a", "spider": "1f577", "spiderweb": "1f578", "spinach": "1f96c", "sponge": "1f9fd", "spoon": "1f944", "square.black": "2b1b", "square.black.tiny": "25aa", "square.black.small": "25fe", "square.black.medium": "25fc", "square.white": "2b1c", "square.white.tiny": "25ab", "square.white.small": "25fd", "square.white.medium": "25fb", "square.blue": "1f7e6", "square.brown": "1f7eb", "square.green": "1f7e9", "square.orange": "1f7e7", "square.purple": "1f7ea", "square.red": "1f7e5", "square.yellow": "1f7e8", "squid": "1f991", "stadium": "1f3df", "star": "2b50", "star.arc": "1f4ab", "star.box": "2734", "star.glow": "1f31f", "star.shoot": "1f320", "stethoscope": "1fa7a", "store.big": "1f3ec", "store.small": "1f3ea", "strawberry": "1f353", "suit.club": "2663", "suit.diamond": "2666", "suit.heart": "2665", "suit.spade": "2660", "sun": "2600", "sun.cloud": "1f324", "sun.face": "1f31e", "sunrise": "1f305", "superhero": "1f9b8", "supervillain": "1f9b9", "surfing": "1f3c4", "sushi": "1f363", "swan": "1f9a2", "swimming": "1f3ca", "swimsuit": "1fa71", "swords": "2694", "symbols": "1f523", "synagogue": "1f54d", "syringe": "1f489", "taco": "1f32e", "takeout": "1f961", "tamale": "1fad4", "tanabata": "1f38b", "tangerine": "1f34a", "tap": "1f6b0", "tap.not": "1f6b1", "taxi": "1f695", "taxi.front": "1f696", "teacup": "1f375", "teapot": "1fad6", "teddy": "1f9f8", "telescope": "1f52d", "temple": "1f6d5", "ten": "1f51f", "tengu": "1f47a", "tennis": "1f3be", "tent": "26fa", "testtube": "1f9ea", "thermometer": "1f321", "thread": "1f9f5", "thumb.up": "1f44d", "thumb.down": "1f44e", "ticket.event": "1f39f", "ticket.travel": "1f3ab", "tiger": "1f405", "tiger.face": "1f42f", "tm": "2122", "toilet": "1f6bd", "toiletpaper": "1f9fb", "toku": "1f250", "tomato": "1f345", "tombstone": "1faa6", "tongue": "1f445", "toolbox": "1f9f0", "tooth": "1f9b7", "toothbrush": "1faa5", "tornado": "1f32a", "tower.tokyo": "1f5fc", "trackball": "1f5b2", "tractor": "1f69c", "trafficlight.v": "1f6a6", "trafficlight.h": "1f6a5", "train": "1f686", "train.car": "1f683", "train.light": "1f688", "train.metro": "1f687", "train.mono": "1f69d", "train.mountain": "1f69e", "train.speed": "1f684", "train.speed.bullet": "1f685", "train.steam": "1f682", "train.stop": "1f689", "train.suspend": "1f69f", "train.tram": "1f68a", "train.tram.car": "1f68b", "transgender": "26a7", "tray.inbox": "1f4e5", "tray.mail": "1f4e8", "tray.outbox": "1f4e4", "tree.deciduous": "1f333", "tree.evergreen": "1f332", "tree.palm": "1f334", "tree.xmas": "1f384", "triangle.r": "25b6", "triangle.l": "25c0", "triangle.t": "1f53c", "triangle.b": "1f53d", "triangle.t.red": "1f53a", "triangle.b.red": "1f53b", "trident": "1f531", "troll": "1f9cc", "trophy": "1f3c6", "truck": "1f69a", "truck.trailer": "1f69b", "trumpet": "1f3ba", "tsukimi": "1f391", "turkey": "1f983", "turtle": "1f422", "tv": "1f4fa", "ufo": "1f6f8", "umbrella.open": "2602", "umbrella.closed": "1f302", "umbrella.rain": "2614", "umbrella.sun": "26f1", "unicorn": "1f984", "unknown": "1f9b3", "up": "1f199", "urn": "26b1", "vampire": "1f9db", "violin": "1f3bb", "volcano": "1f30b", "volleyball": "1f3d0", "vs": "1f19a", "waffle": "1f9c7", "wand": "1fa84", "warning": "26a0", "watch": "231a", "watch.stop": "23f1", "watermelon": "1f349", "waterpolo": "1f93d", "wave": "1f30a", "wc": "1f6be", "weightlifting": "1f3cb", "whale": "1f40b", "whale.spout": "1f433", "wheel": "1f6de", "wheelchair": "1f9bd", "wheelchair.box": "267f", "wheelchair.motor": "1f9bc", "wind": "1f32c", "windchime": "1f390", "window": "1fa9f", "wine": "1f377", "wolf": "1f43a", "woman": "1f469", "woman.box": "1f6ba", "woman.crown": "1f478", "woman.old": "1f475", "woman.pregnant": "1f930", "wood": "1fab5", "worm": "1fab1", "wrench": "1f527", "wrestling": "1f93c", "xray": "1fa7b", "yarn": "1f9f6", "yo": "1f23a", "yoyo": "1fa80", "yubi": "1f22f", "yuryo": "1f236", "zebra": "1f993", "zodiac.aquarius": "2652", "zodiac.aries": "2648", "zodiac.cancer": "264b", "zodiac.capri": "2651", "zodiac.gemini": "264a", "zodiac.leo": "264c", "zodiac.libra": "264e", "zodiac.ophi": "26ce", "zodiac.pisces": "2653", "zodiac.sagit": "2650", "zodiac.scorpio": "264f", "zodiac.taurus": "2649", "zodiac.virgo": "264d", "zombie": "1f9df", "zzz": "1f4a4", ) #let o(id) = { let s = cm-dic.at(id) if type(s) == "array" { o-cm(s.at(0)) } else { o-cm(s) } } #let t(id) = { let s = cm-dic.at(id) if type(s) == "array" { t-cm(s.at(1)) } else { t-cm(s) } }
https://github.com/kdog3682/mathematical
https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/factorial.typ
typst
#import "@local/typkit:0.1.0": * #let factorial(n, cancels: none, limit: 10, left: 3, right: 3, delimiter: "times", connector: "dots", highlight-remaining: false, highlight-color: "blue", early-stop: false) = { let delimiters = ( "times": marks.math.times, "dot": marks.math.dot, ) let delimiter = delimiters.at(delimiter) let connectors = ( "dots": marks.math.dots + marks.math.dots + marks.math.dots ) let connector = connectors.at(connector) let singleton = n > limit // panic(singleton) let callback(n) = { let mc = resolve-content(n) if cancels == none { return mc } else if cancels >= n { return math.cancel(mc) } else if singleton == false { let value = math.bold(mc) return tern(highlight-remaining, colored(value, highlight-color), value) } else { mc } } if singleton == true { let a = range(n, n - left, step: -1).map(callback) let b = range(right, 0, step: -1).map(callback) let d = a.join(delimiter) let e = b.join(delimiter) return math.equation((d, e).join(connector)) } else { let numbers = range(n, 0, step: -1) return math.equation(numbers.map(callback).join(delimiter)) } }
https://github.com/GolemT/BA-Template
https://raw.githubusercontent.com/GolemT/BA-Template/main/lib/glossar-lib.typ
typst
#import "shared-lib.typ": display, display-link #let prefix = "glossary-state-" #let glossary-state = state("glossary", none) #let init-glossary(glossary) = { glossary-state.update(glossary) } // Display acronym. Expands it if used for the first time #let gls(element, link: true) = { display("glossary", glossary-state, element, element, link: link) } // Print an index of all the acronyms and their definitions. #let print-glossary(title: "Glossar", glossary-spacing) = { heading(level: 1, outlined: false, numbering: none)[#title] glossary-state.display(glossary => { let glossary-keys = glossary.keys() let max-width = 0pt for key in glossary-keys { let result = measure(key).width if (result > max-width) { max-width = result } } let glossary-list = glossary-keys.sorted() for element in glossary-list { grid( columns: (max-width + 1em, auto), gutter: glossary-spacing, [*#element#label("glossary-" + element)*], [#glossary.at(element)], ) } }) }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/align-01.typ
typst
Other
// Test that multiple paragraphs in subflow also respect alignment. #align(center)[ Lorem Ipsum Dolor ]
https://github.com/university-makino/Microcomputer-control-and-exercises
https://raw.githubusercontent.com/university-makino/Microcomputer-control-and-exercises/master/report/本レポート1/report.typ
typst
// ライブラリの実装 // #import "@preview/codelst:2.0.1": sourcecode //フォント設定// #let gothic = "YuMincho" //本文フォント// #set text(11pt, font: gothic, lang: "ja") //タイトル・見出しフォント// #set heading(numbering: "1.1") #let heading_font(body) = { show regex("[\p{scx: Han}\p{scx: Hira}\p{scx: Kana}]"): set text(font: gothic) body } #show heading: heading_font // ページ設定 // #set page( paper: "a4", margin: (x: 25mm, y: 25mm), columns: 1, //fill: 背景色, numbering: "1", number-align: center, header: [ #set text(8pt) ] ) // 数式の表示の仕方を表示 // #set math.equation(numbering: "(1)") //本文ここから// = 演習の目的 実験を通して、Cdsセルの使い方と仕組みの習得を目的とする。 = 演習の使用部品 == この電子部品 (Cds セル 5 φ,@CdsCell ) を次のような点から調べなさい。 #figure( image("./img/Cds.png",width: 50%), caption: "Cds セル" )<CdsCell> === どのような部品か CdS(硫化カドミウム)を使用した光センサーで、光の強さに応じて電気抵抗が低下する抵抗器である。 人の目の特性に近い特性(緑色の光に対して高感度)を持っているため、各種明るさセンサーに最適である@cds_akituki 。 === どのような仕組みか CdSセルは、カドミウムと硫黄の化合物である。 カドミウム(Cd)は毒性のある重金属で最外殻の電子は原子核との結合が弱く、自由電子となり導電性である。 これに硫黄(S)を結合させるとカドミウムの自由電子を硫黄原子が捕捉して絶縁体に変化する。 この自由電子の捕捉力は非常に弱く、光があたると自由電子を放出して導体に変化する。 したがって、光の量によって放出する自由電子の量が変化し、抵抗値が変化する。 これを「内部光電効果」と呼ぶ @cds_ir 。 === どのような入力を取り扱うのか GL5528では、受講部に入る光の量、照度(Lux) を入力として取り扱う。 === 入力に応じて出力がどう変化するのか (データシートや仕様書を参考に) GL5528では、暗い時は約1MΩ、明るい時は約10~20kΩの抵抗値を持つ。 グラフは比例関係になっており、照度が高いほど抵抗値が低くなる。 @CdsGraph では、Cdsセルの照度による抵抗値の変化を示している@cds_datasheet 。 #figure( image("./img/CdsGraph.png",width: 50%), caption: "Cds グラフ" )<CdsGraph> === どのようなピンアサイン (各ピンの役割) か 特に抵抗のように動作をするためピンアサインなどはないが、@CdsStructure 構造図を示すと、2つの端子がある@cds_datasheet 。 #figure( image("./img/CdsStructure.png",width: 50%), caption: "Cds 構造" )<CdsStructure> === 正しい動作の条件,範囲は何か 秋月電子によると、GL5528の仕様は以下の通りである@cds_akituki 。 + ピーク波長: 540nm + 最大電圧: 150VDC + 最大電力: 100mW + 明抵抗: 10k~20kS2(10Lux時) + 暗抵抗: 1MΩ + 反応時間: 上昇時間 20ms、下降時間 30ms #pagebreak() // ページを分ける = 課題内容 == 明るさをはかる === 実験その1(動作の理解) 光センサを以下のようにした場合、アナログ入力はどのような値をとるか調べ、照度計から得られた値との関係値をグラフに示しなさい。 - 蛍光灯の明かりを手で遮る - 机の下に隠す - 光センサを両手で覆う *回路図* @実験1回路図 は、実験1の回路図を示す。 抵抗とCdsセルの抵抗分圧を行い、マイコンにかかる電圧を測定する。 #figure( image("./img/実験1回路図.png",width: 70%), caption: "実験1回路図" )<実験1回路図> #pagebreak() // ページを分ける *プログラム* @値の取得をするソースコード は、実験1で使用したアナログ入力値を取得するソースコードを示している。 #figure( sourcecode[```c //プログラムに必要な変数の宣言及び定義 import processing.serial.*; import cc.arduino.*; Arduino arduino; PFont myFont; int usePin0 = 0; //Arduino A0ピン //Arduino 及びプログラムの初期設定 void setup(){ size(600, 250); arduino = new Arduino( this, "/dev/cu.usbserial-14P54810" ); myFont = loadFont("CourierNewPSMT-48.vlw"); textFont(myFont, 30); frameRate(30); } // 入力値の格納用変数 int input0; //プログラム本体 (以下を繰り返し実行) void draw(){ background(120); input0 = arduino.analogRead(usePin0); //入力値を表示 text("A0: " + input0, 50, 100); } ```], caption: "値の取得をするソースコード" )<値の取得をするソースコード> - プログラムの概要 センサから ArduinoA0 ピンへの入力値をアナログ入力として読み込む。読み込んだ値を数値として表示する。 - プログラムの説明 - 1–7 行目: プログラムに必要な変数の宣言および定義またはライブラリのインポート - 8 行目で ArduinoA0 ピンの使用を usePin0 = 0 として定義している。 - 11–20 行目: Arduino およびプログラムの初期設定 - 10 行目で画面表示に用いるウィンドウサイズを横 600px,縦 250px と定義している。 - 11 行目で"/dev/cu.usbserial-14P54810"のポートと 57600 の速度で通信する arduino インスタンスを生成する。 - 14 行目でフレームレートを 30 としている。 - 23–32 行目:プログラムの動作 - 23 行目で入力用の変数 input0 を宣言している。 - 27 行目で背景色を灰色に設定する。 - 28 行目で ArduinoA0 ピンのアナログ入力を input0 に入れる。 - 31 行目で input0 を数値として表示する。 *実験結果* @マイコンの値と照度計の値の特性グラフ では、実験1におけるマイコンへのアナログ入力値と照度計の値の特性グラフを示している。 グラフより、Cdsセルは、明るい状況下では抵抗値が低くなり、暗くなると抵抗値が上昇する。また感度は非常に高く、強い光を当てても抵抗値が完全に0にはならない。逆に、非常に暗い状況でも抵抗値が無限大にならない。また、センサーの反応速度は非常に速い。 #figure( image("./img/マイコンの値と照度計の値の特性グラフ.png",width: 75%), caption: "マイコンの値と照度計の値の特性グラフ" )<マイコンの値と照度計の値の特性グラフ> *考察* センサーの特性は、比例関係ではなく、対数関係を持ったグラフに近い。また、暗いほど感度が高く、明るくなると感度が落ちる。 また、センサーの特性は、対数関係を持っているため、マイコンのアナログ入力値をLuxに変換できる。 #pagebreak() // ページを分ける === 実験その2(回路の理解と抵抗分圧) 抵抗器と光センサの配置を逆にすると、アナログ入力も変化する。 どのように変化するか調べ変化 した値を参考にグラフに示しなさい。 また,なぜそのような結果になるのか、プレ・レポートで調 べた「抵抗分圧」という用語と計算式を使って説明しなさい。 *回路図・プログラム* @実験2回路図 は、実験2の回路図を示す。 実験1とは抵抗とCdsセルの順番を逆にして、抵抗とCdsセルの抵抗分圧を行い、マイコンにかかる電圧を測定する。 プログラムは実験その1 と同じものを使用する。 #figure( image("./img/実験2回路図.png",width: 70%), caption: "実験2回路図" )<実験2回路図> #pagebreak() // ページを分ける *結果* @照度計とマイコンの値の特性グラフ_抵抗とCDSを逆にしたバージョン では、抵抗とCDSを逆にした場合の特性グラフを示している。 グラフより、実験1とは動作が異なり、明るい状況下ではマイコンにかかる電圧が上昇し、暗い状況下ではマイコンにかかる電圧が減少する。それ以外の動作については実験1と同様である。 #figure( image("./img/照度計とマイコンへのアナログ入力値の特性グラフ.png",width: 75%), caption: "照度計とマイコンの値の特性グラフ (抵抗とCDSを逆にしたバージョン)" )<照度計とマイコンの値の特性グラフ_抵抗とCDSを逆にしたバージョン> *なぜそのような結果となったのか,プレレポートで調べた「抵抗分圧」という用語を使って説明しなさい* 抵抗分圧とは、電圧を分圧するために抵抗を使用する回路である。 抵抗分圧回路は、2つの抵抗を直列に接続し、その間に電圧をかけると、電圧が分圧される。 抵抗分圧回路の出力電圧は、@分圧 で計算できる。 $ V_o = V_i * (R_2 / (R_1 + R_2)) $<分圧> R2を変化させると、抵抗値が変化するため、出力電圧も変化する。 R2を大きくすると、出力電圧は小さくなり、R2を小さくすると、出力電圧は大きくなる。 今回は、R2の値はCDSの抵抗値に依存するため、明るさが明るくなると電圧値が下がり、暗くなると電圧値が上がる回路ができた。 #pagebreak() // ページを分ける // bibファイルの指定 // #bibliography("./bibliography.bib")
https://github.com/neunenak/typst-leipzig-glossing
https://raw.githubusercontent.com/neunenak/typst-leipzig-glossing/master/leipzig-gloss.typ
typst
MIT License
#import "abbreviations.typ" #let gloss-count = counter("gloss_count") #let build-gloss(item-spacing, formatters, gloss-line-lists) = { assert(gloss-line-lists.len() > 0, message: "Gloss line lists cannot be empty") let len = gloss-line-lists.at(0).len() for line in gloss-line-lists { assert(line.len() == len) } assert(formatters.len() == gloss-line-lists.len(), message: "The number of formatters and the number of gloss line lists should be equal") let make_item_box(..args) = { box(stack(dir: ttb, spacing: 0.5em, ..args)) } for item_index in range(0, len) { let args = () for (line_idx, formatter) in formatters.enumerate() { let formatter_fn = if formatter == none { (x) => x } else { formatter } let item = gloss-line-lists.at(line_idx).at(item_index) args.push(formatter_fn(item)) } make_item_box(..args) h(item-spacing) } } // a workround so we can use `label` as a variable name where it is shadowed by the function param `label` // Once typst version 0.12 with https://github.com/typst/typst/pull/4038 is released we should be able // to replace this workaround with `std.label` #let cmdlabel = label #let gloss( header: none, header-style: none, source: (), source-style: none, transliteration: none, transliteration-style: none, morphemes: none, morphemes-style: none, additional-lines: (), //List of list of content translation: none, translation-style: none, label: none, label-supplement: [example], item-spacing: 1em, gloss-padding: 2.0em, //TODO document these left-padding: 0.5em, numbering: false, breakable: false, ) = { assert(type(source) == "array", message: "source needs to be an array; perhaps you forgot to type `(` and `)`, or a trailing comma?") if morphemes != none { assert(type(morphemes) == "array", message: "morphemes needs to be an array; perhaps you forgot to type `(` and `)`, or a trailing comma?") assert(source.len() == morphemes.len(), message: "source and morphemes have different lengths") } if transliteration != none { assert(transliteration.len() == source.len(), message: "source and transliteration have different lengths") } let gloss_items = { if header != none { if header-style != none { header-style(header) } else { header } linebreak() } let formatters = (source-style,) let gloss-line-lists = (source,) if transliteration != none { formatters.push(transliteration-style) gloss-line-lists.push(transliteration) } if morphemes != none { formatters.push(morphemes-style) gloss-line-lists.push(morphemes) } for additional in additional-lines { formatters.push(none) //TODO fix this gloss-line-lists.push(additional) } build-gloss(item-spacing, formatters, gloss-line-lists) if translation != none { linebreak() if translation-style == none { translation } else { translation-style(translation) } } } if numbering { gloss-count.step() } let gloss_number = if numbering { [(#context gloss-count.display())] } else { none } style(styles => { block(breakable: breakable)[ #figure( kind: "ling-example", supplement: label-supplement, numbering: it => [#gloss-count.display()], stack( dir: ltr, //TODO this needs to be more flexible left-padding, [#gloss_number], gloss-padding - left-padding - measure([#gloss_number],styles).width, align(left)[#gloss_items], ), ) #if label != none {cmdlabel(label)} ] } ) } #let numbered-gloss = gloss.with(numbering: true)
https://github.com/galaxia4Eva/galaxia4Eva
https://raw.githubusercontent.com/galaxia4Eva/galaxia4Eva/main/notes/reading-lists/Open%20Science.md
markdown
## Open Science 1. [MacTeX - TeX Users Group](https://tug.org/mactex/) 2. [GitHub - lervag/vimtex: VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.](https://github.com/lervag/vimtex) 3. [teaserbot-labs/delightful-open-science: Curated list of resources, organizations and free software that are supporting the field of open science. - delightful-open-science - Codeberg.org](https://codeberg.org/teaserbot-labs/delightful-open-science) 4. [Department of Computer Science and Technology: Recordings](https://www.cl.cam.ac.uk/seminars/wednesday/video/) 5. [NaturalLanguage/ALTA - CL Wiki (read only)](http://www.wiki.cl.cam.ac.uk/rowiki/NaturalLanguage/ALTA) 6. [talks.cam : CUED Speech Group Seminars](http://talks.cam.ac.uk/show/index/39731) 7. [GitHub - typst/typst: A new markup-based typesetting system that is powerful and easy to learn.](https://github.com/typst/typst) 8. [GitHub - amaxwell/tlutility: TeX Live Utility, a Mac OS GUI for the TeX Live Manager](https://github.com/amaxwell/tlutility) 9. https://twitter.com/scientistswrite/status/1684939984267030528?s=20 10. https://www.edwardfrenkel.com 11. https://gograd.binghamton.edu/portal/watson-ssie-info 12. https://researchrabbitapp.com 13. https://iraf.noirlab.edu 14. # meta-irony 1. https://jabde.com 2. https://annas-archive.org/ 3. https://youtu.be/kya_LXa_y1E?si=QRoXEVQYn2O_WW8y 4.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/deco_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test default highlight bounds. #highlight[ace], #highlight[base], #highlight[super], #highlight[phone #sym.integral]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/fontawesome/0.2.0/README.md
markdown
Apache License 2.0
# typst-fontawesome A Typst library for Font Awesome icons through the desktop fonts. ## Usage ### Install the fonts You can download the fonts from the official website: https://fontawesome.com/download Or you can use the helper script to download the fonts and metadata: `python helper.py -dd -v {version}` Here `-dd` means to download and extract the zip file. You can use `-d` to only download the zip file. After downloading the zip file, you can install the fonts depending on your OS. #### Typst web app You can simply upload the `otf` files to the web app and use them with this package. #### Mac You can double click the `otf` files to install them. #### Windows You can right-click the `otf` files and select `Install`. ### Import the library #### Using the typst packages You can install the library using the typst packages: `#import "@preview/fontawesome:0.2.0": *` #### Manually install Copy all files start with `lib` to your project and import the library: `#import "lib.typ": *` There are three files: - `lib.typ`: The main entrypoint of the library. - `lib-impl.typ`: The implementation of `fa-icon`. - `lib-gen.typ`: The generated icons. I recommend renaming these files to avoid conflicts with other libraries. ### Use the icons You can use the `fa-icon` function to create an icon with its name: `fa-icon("chess-queen")` Or you can use the `fa-` prefix to create an icon with its name: `fa-chess-queen()` You can also set `solid` to `true` to use the solid version of the icon: `fa-icon("chess-queen", solid: true)` #### Full list of icons You can find all icons on the [official website](https://fontawesome.com/search?o=r&m=free) #### Different sets By default, the library uses two sets: `Free` and `Brands`. That is, three font files are used: - Font Awesome 6 Free (Also named as _Font Awesome 6 Free Regular_) - Font Awesome 6 Free Solid - Font Awesome 6 Brands Due to some limitations of typst 0.11.0, the regular and solid versions are treated as different fonts. In this library, `solid` is used to switch between the regular and solid versions. To use `Pro` or other sets, you can pass the `font` parameter to the inner `text` function: \ `fa-icon("github", font: "Font Awesome 6 Pro Solid")` But you need to install the fonts first and take care of `solid` yourself. #### Customization The `fa-icon` function passes args to `text`, so you can customize the icon by passing parameters to it: `#fa-icon("chess-queen", fill: blue)` ## Example See the [`example.typ`](https://typst.app/project/rQwGUWt5p33vrsb_uNPR9F) file for a complete example. ## Contribution Feel free to open an issue or a pull request if you find any problems or have any suggestions. ### Python helper The `helper.py` script is used to download fonts and generate typst code. I aim only to use standard python libraries, so running it on any platform with python installed should be easy. ### Repo structure - `helper.py`: The helper script to download fonts and generate typst code. - `lib.typ`: The main entrypoint of the library. - `lib-impl.typ`: The implementation of `fa-icon`. - `lib-gen.typ`: The generated functions of icons. - `example.typ`: An example file to show how to use the library. - `gallery.typ`: The generated gallery of icons. It is used in the example file. ## License This library is licensed under the MIT license. Feel free to use it in your project.
https://github.com/rabotaem-incorporated/probability-theory-notes
https://raw.githubusercontent.com/rabotaem-incorporated/probability-theory-notes/master/sections/03-characteristic-functions/!sec.typ
typst
= Метод характеристических фукнций #include "01-characteristic-functions.typ" #include "02-convergence-in-distribution.typ" #include "03-central-limit-theorem.typ" #include "04-big-deviations.typ"
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-20A0.typ
typst
Apache License 2.0
#let data = ( ("EURO-CURRENCY SIGN", "Sc", 0), ("COLON SIGN", "Sc", 0), ("CRUZEIRO SIGN", "Sc", 0), ("FRENCH FRANC SIGN", "Sc", 0), ("LIRA SIGN", "Sc", 0), ("MILL SIGN", "Sc", 0), ("NAIRA SIGN", "Sc", 0), ("PESETA SIGN", "Sc", 0), ("RUPEE SIGN", "Sc", 0), ("WON SIGN", "Sc", 0), ("NEW SHEQEL SIGN", "Sc", 0), ("DONG SIGN", "Sc", 0), ("EURO SIGN", "Sc", 0), ("KIP SIGN", "Sc", 0), ("TUGRIK SIGN", "Sc", 0), ("DRACHMA SIGN", "Sc", 0), ("GERMAN PENNY SIGN", "Sc", 0), ("PESO SIGN", "Sc", 0), ("GUARANI SIGN", "Sc", 0), ("AUSTRAL SIGN", "Sc", 0), ("HRYVNIA SIGN", "Sc", 0), ("CEDI SIGN", "Sc", 0), ("LIVRE TOURNOIS SIGN", "Sc", 0), ("SPESMILO SIGN", "Sc", 0), ("TENGE SIGN", "Sc", 0), ("INDIAN RUPEE SIGN", "Sc", 0), ("TURKISH LIRA SIGN", "Sc", 0), ("NORDIC MARK SIGN", "Sc", 0), ("MANAT SIGN", "Sc", 0), ("RUBLE SIGN", "Sc", 0), ("LARI SIGN", "Sc", 0), ("BITCOIN SIGN", "Sc", 0), ("SOM SIGN", "Sc", 0), )
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/tournament-loyola/entry.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator, diagraph #import notebookinator: * #import themes.radial.components: * #import "/utils.typ": tournament-from-csv #import diagraph: * #show: create-body-entry.with( title: "Tournament: Blakefield Robotics Challenge", type: "test", date: datetime(year: 2024, month: 1, day: 27), author: "<NAME>", witness: "<NAME>", ) = Qualifications #let qual-data = tournament-from-csv( read("./RE-VRC-23-1581-Division 1-Results-2024-02-13.csv"), team-name: "53E", section: "qualifications", ) #(qual-data.at(0).auton = true) #(qual-data.at(1).auton = true) #(qual-data.at(2).auton = true) #(qual-data.at(3).auton = true) #(qual-data.at(4).auton = true) #tournament(..qual-data) = Alliance Selection We were in 13th place in eliminations so we planned on choosing our alliance partner. Our two top choices were 9080C and 53C, which was a tough choice to call. #raw-render[```dot digraph { rankdir=LR; start->"We pick 9080C" "We pick 9080C"->"We pick 53C" [label = "no"] "We pick 9080C"->"end" [label = "yes"] "We pick 53C" ->"end"[label = "yes"] start[shape=Mdiamond] end[shape=Msquare] } ```] We had contemplated picking 53C to bring them up and possibly qualify them for states but ultimately we went with 9080C who had a bot very compatible to ours and had us as their number one option too. = Eliminations #let elims-data = tournament-from-csv( read("./RE-VRC-23-1581-Division 1-Results-2024-02-13.csv"), team-name: "53E", section: "eliminations", ) #tournament(..elims-data) = Reflection #grid( columns: (1fr, 1fr), pie-chart( (value: 6, color: green, name: "wins"), (value: 2, color: red, name: "losses"), ), [ Overall we're extremely happy with the performance of our robot. We won nearly all of our qualification matches, and got all the way to semifinals. ], ) Our overall robot performance was as follows: #pro-con( pros: [ - Autonomous worked very well in most of our matches and we were able to learn more about winpoint importance. - Hang mechanism worked well and lifted our bot sturdily! ], cons: [ - Our robot could not elevate if the pistons ran out of air. - The intake of our robot was extremely janky and needed to be braced properly. - We only had three team members present, so we were forced to rush several times and be aware of what was going on. ], ) Overall, our robot needed several improvements, the most important being the hang mechanism and supplying it with enough air to be able to retract it down and up multiple times, which it previously wasn't able to do. Another improvement we wanted to add was a stable intake as well as stronger intake banding.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/stack-2_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(height: 2cm) #set text(white) #rect(fill: forest)[ #v(1fr) #h(1fr) Hi you! ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/codelst/0.0.3/example.typ
typst
Apache License 2.0
#import "./codelst.typ": sourcecode, sourcefile, lineref, codelst-styles #let codelst = text(fill: rgb(254,48,147), smallcaps("codelst")) #let cmd( name ) = text(fill: rgb(99, 170, 234), raw(block:false, sym.hash + name.text + sym.paren.l + sym.paren.r)) Normal #cmd[raw] works as expected: ```typc #show "ArtosFlow": name => box[ #box(image( "logo.svg", height: 0.7em, )) #name ] This report is embedded in the ArtosFlow project. ArtosFlow is a project of the Artos Institute. ``` Using #cmd[sourcecode] will add line numbers: #sourcecode[```typc #show "ArtosFlow": name => box[ #box(image( "logo.svg", height: 0.7em, )) #name ] This report is embedded in the ArtosFlow project. ArtosFlow is a project of the Artos Institute. ```] Sourcecode can be loaded from a file and passed to #cmd[sourcefile]. Any #codelst sourcecode can be wrapped inside #cmd[figure] as expected. #codelst blocks can be formatted via a #cmd[show] rules like: ```typc #show <codelst>: (code) => { ... } ``` Line numbers can be formatted, too. #[ #show <codelst>: (code) => grid( columns: (25%, 1fr), gutter:.75em, [To the right in @lst-sourcefile you can see the `typst.toml` file of this package.], code ) #figure( caption: "typst.toml", sourcefile(numbers-style: (i) => text(fill: blue, emph(i)), numbers-side:right, read("typst.toml"), file:"typst.toml") )<lst-sourcefile> ] #codelst does add a minimal amount of formatting. Using #cmd[show] rules allows you to add your own styles. For easy formatting, some default styles like a colored block can be applied using #cmd[codelst-styles]: ```typc #show : codelst-styles ``` #cmd[sourcecode] accepts a number of arguments to afffect the output., e.g. highlighting lines, restirct the line range or place labels in specific lines to reference them later. #[ #show: codelst-styles #sourcecode( numbers-start: 9, highlighted: (14,), highlight-labels: true, gutter: 2em, label-regex: regex("<([a-z-]+)>") )[```typc #"hello world!" \ #"\"hello\n world\"!" \ #"1 2 3".split() \ <split-example> #"1,2;3".split(regex("[,;]")) \ #(regex("\d+") in "ten euros") \ #(regex("\d+") in "10 euros") ```] To reference a line use #cmd[lineref]: See #lineref(<split-example>) for an example of the `split()` function. ]
https://github.com/Shedward/dnd-charbook
https://raw.githubusercontent.com/Shedward/dnd-charbook/main/dnd/page/spells.typ
typst
#import "../core/core.typ": * #import "../game/game.typ": * #let spellRow(spell) = ( table.cell(rowspan: 2, align: horizon + center)[#spell.prep], table.cell(rowspan: 2, align: horizon + left)[ #par(justify: false)[ #spell.name\ #spellCaption(spell.school) ] ], table.cell(align: left)[#spell.castTime], spell.duration, spell.range, spell.components, table.cell(align: right, inset: (top: paddings(0.25)))[ #if (spell.castType == none) [-] else [#spell.castType] ], table.cell(colspan: 3, inset: (top: paddings(0.25)), par(spell.body)) ) #let spellPropBox(caption, topContent: none, dy: -0.5em) = { box(height: 15mm)[ #framed(fitting: expand)[] #place(bottom + center, dy: dy)[ #propCap(caption) ] #place(top + center, dy: -dy)[ #propCap(topContent) ] ] } #let spellcasting(character) = { let propBox = ( ( [Ability], [Atk Bonus], [Save DC], if character.spellcasting.prepearing [Max Prep.] ) + character.spellcasting.resources ).filter(v => v != none) framed(fitting: expand-h)[ #grid( row-gutter: paddings(1), grid( columns: (1fr, 1fr, 1fr), inset: 0.25em, character.class, grid.hline(stroke: strokes.thin), character.spellcasting.focus, grid.cell(rowspan: 2)[ #if character.spellcasting.ritualCasting [ Ritual Casting ] ], propCap[Class], propCap[Focus] ), grid( columns: (1fr,) * propBox.len(), column-gutter: paddings(1), ..(propBox.map(spellPropBox)) ) )] } #let spellsTable(..spells) = { show: spellBody set text(hyphenate: false) table( columns: (9mm, 20mm, 8mm, 1fr, 1fr, 1fr), align: top + left, stroke: (x, y) => ( top: if (y > 0 and calc.rem(y, 2) == 1) { strokes.hairline } else { 0pt }, bottom: none ), inset: paddings(0.75), table.cell(align: center, tableHeader[Pr.]), tableHeader[Name], table.cell(align: center, tableHeader[Time]), tableHeader[Dur], tableHeader[Range], tableHeader[Comp.], ..(spells.pos().map(spellRow).flatten()), ) } #let spellsSection( level: none, bottom: none, ..spells ) = { let levelRow = if level == none {()} else { ( grid( columns: (1fr, 1fr), align: (left, right), level.name, level.slots ), ) } framed(fitting: expand-h, insets: (x: paddings(1), y: paddings(0.5)))[ #grid( columns: 1, inset: paddings(1), ..levelRow, spellsTable(..spells) ) ] }
https://github.com/donabe8898/typst-slide
https://raw.githubusercontent.com/donabe8898/typst-slide/main/opc/RustProgramming/02.typ
typst
MIT License
#import "@preview/polylux:0.3.1": * #import themes.metropolis: * #import emoji: crab #import emoji: magnify #show: metropolis-theme.with( aspect-ratio: "16-9", footer: "The Rust programming." // short-title: "The Rust programming.", // short-author: "donabe8898", // short-date: none, // color-a: rgb("#2196f3"), // color-b:rgb("#FF4A00"), // color-c:rgb("#FBFEF9"), // progress-bar: true ) #show link: set text(blue) #set text(font: "Noto Sans CJK JP",weight: "light", size: 18pt) #show heading: set text(font: "Hack") #show raw: set text(font: "Hack") #show raw.where(block: true): block.with( fill: luma(240), inset: 10pt, radius: 4pt ) // タイトル #title-slide( title:"プログラミング Rust", subtitle: "変数と基礎構文", author: "<NAME>", date: "2024-hoge-hoge", extra: "OECU Programming Circle " ) #slide(title:"この講義の目的")[ #v(1em) + 変数について理解する + 基礎構文を書けるようになる #v(5em) = 備考 #v(1em) - #crab: 実践項目 - プログラミング, ターミナルでの作業など - #magnify.r :検索したりして是非調べてほしいもの ] #new-section-slide("変数") #slide(title: "束縛")[ - 変数束縛は`let`キーワードを使う - 再代入は不可能 ```rs let hoge; let huga = 2; let ham: i32 = 2; ``` ] #slide(title: "束縛")[ ```rs let p = 3; // (1) let m = p; println("{}",p); { // (2) let m = 2; println!("{}",m); // 2 } // ここで(2)のmは解放 println!("{}", m) // 3 ``` - pという変数に3という数字を縛る - mという変数にpという変数の中身を縛る(ここでは値はコピーされます) - mという変数に2を縛る(もとの縛りは無かったことに) ] #slide(title: "可変性")[ - `mut`をつけると再代入可能になる - 型の変更は基本受け付けない ```rs let mut huga = 3; huga = 2; huga = 2.22; //これはエラー ``` ] #slide(title: "基本の型")[ - 符号あり整数型: `i8`, `i16`, `i32`, `i64`, `isize` - 符号なし整数型: `u8`, `u16`, `u32`, `u64`, `u128`, `usize` - 浮動小数点数型: `f32`, `f64` - 文字型: `char` - ブール型: `bool` - タプル: `(char, u64, bool)` ] #slide(title: "定数")[ - `const`キーワードは定数 - 普通に不変なので`mut`は使えない - 型は決めておく必要がある #crab ```rs const PI:f32 = 3.14; println!("ゆとり教育だと{:.0}になるとか嘘やで。",PI); ``` ] #slide(title: "所有権")[ - Rustは1つの変数につき所有権を1つ持っている - 1つの所有権を、複数の変数が持つことができない - 所有権の移動(譲渡) - 変数を別の変数に束縛したとき - 関数に値を渡したとき #crab ```rs let p = String::from("ちくわ"); // 以下のprintはエラー // println("{}",p); // これはOK println("{}",m); ``` ] #slide(title: "コピートレイト")[ - `Trait` データ型を分類するための概念 - トレイトに対してメソッドを定義できる - 標準で実装されたトレイトがある - `Copy trait`: 変数別の変数に束縛するときは所有権は移動せず、値をコピーして新しいオブジェクトを作成する。 - 整数や浮動小数点数、ブール、文字型は`Copy trait`を実装している ] #slide(title: "コピー")[ - `.clone()`をつけることで、値のコピーを取れる - メモリを消費する(m,pそれぞれにメモリが割り当てられる) - コピーに時間がかかる #crab ```rs let p = 3; let m = p.clone(); println("{}",p); println("{}",m); ``` ] #slide(title: "参照")[ - 一時的に値を*借りる* ```rs let p = ``` ] #slide(title:"ライフタイムとスコープ")[ - 変数の束縛時にライフタイムが決まる - 変数がメモリに保存されていて、解放されていない状態 ``` x``` ]
https://github.com/SillyFreak/typst-crudo
https://raw.githubusercontent.com/SillyFreak/typst-crudo/main/gallery/thumbnail.typ
typst
MIT License
// make the PDF reproducible to ease version control #set document(date: none) // #import "/src/lib.typ" #import "@preview/crudo:0.1.1" #import "@preview/codly:1.0.0": * #set page(width: 10cm, height: auto, margin: 5mm) #show: codly-init #codly() From #let preamble = ```typ #import "@preview/crudo:0.1.1" ``` #preamble and #let example = ````typ #crudo.r2l(```c int main() { return 0; } ```) ```` #example we get #let full-example = crudo.join(preamble, example) #full-example If you execute that, you get #eval(full-example.text, mode: "markup")
https://github.com/kiwiyou/algorithm-lecture
https://raw.githubusercontent.com/kiwiyou/algorithm-lecture/main/basic/03-linear-data.typ
typst
#import "@preview/cetz:0.1.2" #import "@preview/algorithmic:0.1.0" #import "../slide.typ" #show: slide.style #show link: slide.link #show footnote.entry: slide.footnote #let algorithm(..args) = text(font: ("linux libertine", "Pretendard"), size: 17pt)[#algorithmic.algorithm(..args)] #let func(body) = text(font: ("linux libertine", "Pretendard"))[#smallcaps[#body]] #align(horizon + center)[ = 알고리즘 기초 세미나 03: 선형 자료구조 #text(size: 0.8em)[ 연세대학교 전우제#super[kiwiyou] \ 2023.12.06.r1 ] ] #slide.slide[선형 자료구조][ - 자료(data)의 선형 위치 관계를 준 것 - 한 자료의 위치로 다른 자료의 위치를 알 수 있음 - 선형 #sym.dash.em 자료끼리 일직선, 등간격 #align(center)[ #cetz.canvas({ import cetz.draw: * grid((0, 0), (1.5, 6), step: 1.5, name: "vert") grid((rel: (1, -.75), to: "vert.right"), (rel: (7, .75), to: "vert.right"), step: 1.5) }) ] ] #slide.slide[정렬][ - 자료에 순서를 부여하는 방법 - 자료의 위치와 자료의 순서가 연관됨 (단조성) - 중복과 관련된 처리가 용이 - 일반적으로 표준 라이브러리에는 배열에 대한 $cal(O)(N log N)$ 구현 존재 ] #slide.slide[과제][ - #slide.problem("27522", "카트라이더: 드리프트") - #slide.problem("29723", "브실이의 입시전략") - #slide.problem("30684", "모르고리즘 회장 정하기") ] #slide.slide[동적 배열][ - 컴퓨터는 값을 메모리 공간에 저장 - 메모리 공간은 일반적으로 커다란 배열 - 메모리 주소 = 배열의 인덱스 - 인덱스 접근은 $cal(O)(1)$ - 자료를 하나 저장하는 데 필요한 인덱스의 개수를 알면 $cal(O)(1)$ 시간에 $i$번째 자료의 메모리 주소를 알 수 있음 $ "addr"(i) = i times "count" + "base" $ #pagebreak() - 값을 저장하기 위해서는 메모리 공간의 사용을 미리 허락받아야 함 = 할당 - "동적" #sym.dash.em 허락받을 공간의 크기가 자꾸 변해요 #align(center)[ #cetz.canvas({ import cetz.draw: * let memory = (top-left, count, ..opt) => { group({ set-origin(top-left) grid((0, 0), (1.5 * 15, 1.5), step: 1.5) content((1.5 * (2 + count / 2), 0.75), [배열], frame: "rect", stroke: none, fill: white, padding: 0.25) rect((1.5 * 2, 0), (1.5 * (2 + count), 1.5), fill: rgb(100%, 0, 0, 20%)) content((1.5 * (7 + 6 / 2), 0.75), [사용 중인 영역], frame: "rect", stroke: none, fill: white, padding: 0.25) rect((1.5 * 7, 0,), (1.5 * (7 + 6), 1.5), fill: rgb(0, 0, 100%, 20%)) }, ..opt) } memory((0, 6), 4, name: "size-4") set-style( mark: ( end: ">", size: 0.3, fill: black, ) ) group({ set-origin("size-4.bottom") line((0, -0.25), (0, -1.25)) content((0.5, -0.75), [원소 추가], anchor: "left") }) memory((0, 3), 5, name: "size-5") group({ set-origin("size-5.bottom") line((0, -0.25), (0, -1.25)) content((0.5, -0.75), [원소 추가?], anchor: "left") }) memory((0, 0), 6) }) ] #pagebreak() - 매번 새로운 공간을 할당하고 *기존 원소를 복사* #sym.dash.em $cal(O)(N)$? - 할당하는 크기를 항상 $2^K$으로! - 크기가 $2^K$에 도달하기 위해서는 복사가 $2^0 + 2^1 + 2^2 + dots.c + 2^(K-1)$번 $ sum_(i=0)^(K-1) 2^i = (2^K - 1) / (2 - 1) = 2^K - 1 $ - 크기가 $N$일 때 복사가 $cal(O)(N)$번 - 크기가 $1$ 늘어날 때 전체 복사 수가 $cal(O)(1)$ 증가한다고 생각하기 ] #slide.slide[스택][ - 자료구조의 한 끝을 정해, 그곳에서만 추가와 삭제가 일어나는 자료구조 - 많은 언어의 동적 배열은 스택의 기능을 가짐 - 자료구조의 끝에 추가 $cal(O)(1)$ - 자료구조의 끝에서 삭제 $cal(O)(1)$ - 가장 최근에 본 자료에 초점을 맞출 때 사용 #pagebreak() - *짝 맞추기 유형* - 여러 종류의 괄호가 포함된 문자열에서 각 괄호의 짝이 맞는지 판단하기 #align(center)[ `(The quick {brown fox} jumps over [the lazy (dog)])` \ #text(fill: red)[`(`]`The quick {brown`#text(fill: red)[`)`]` fox} jumps over {[the lazy dog]}` ] - 괄호마다 들어 있는 원소의 개수를 출력하기 - 문제를 괄호 문제로 환원하는 것이 중요 #pagebreak() - *스택을 정렬된 상태로 유지하기* - 어렵기 때문에 생략 - 생각해보면 좋아요 ] #slide.slide[과제][ - #slide.problem("30047", "함수 문자열") - #slide.problem("17952", "과제는 끝나지 않아!") - #slide.problem("11899", "괄호 끼워넣기") ] #slide.slide[덱][ - 자료구조의 양쪽 끝에서 추가와 삭제가 가능한 자료구조 ($cal(O)(1)$) - 정렬된 상태로 유지하기 외에는, 양쪽에서 추가 및 삭제하는 요구사항이 비교적 명시적 ] #slide.slide[과제][ - #slide.problem("28066", "타노스는 요세푸스가 밉다") - #slide.problem("28107", "회전초밥") ] #slide.slide[누적 합][ - 수열 $a_1, a_2, dots.c, a_N$이 주어질 때, 구간 합 $a_l + a_(l+1) + dots.c + a_r$을 구하기 - $cal(O)(N)$보다 빠르게 할 수 있을까? #align(center)[ #cetz.canvas({ import cetz.draw: * import cetz.decorations: brace grid((0, 0), (1.5 * 15, 1.5), step: 1.5) rect((1.5 * 2, 0), (1.5 * (2 + 6), 1.5), fill: rgb(100%, 0, 0, 20%)) rect((1.5 * 5, 0), (1.5 * (5 + 10), 1.5), fill: rgb(0, 0, 100%, 20%)) rect((1.5 * 7, 0), (1.5 * (7 + 6), 1.5), fill: rgb(100%, 100%, 0, 20%)) brace((1.5 * 2, -.2), (1.5 * (2 + 6), -.2), flip: true) brace((1.5 * 5, 1.7), (1.5 * (5 + 10), 1.7), amplitude: 1.5, pointiness: 45deg) brace((1.5 * 7, 1.7), (1.5 * (7 + 6), 1.7)) for i in range(15) { content((1.5 * (i + 0.5), 0.9), $a_#{i+1}$, anchor: "center") } }) ] - 아이디어: 겹치는 부분을 줄이려면 여러 개를 모아서 저장하면 좋지 않을까? #pagebreak() - $S_i = a_1 + a_2 + dots.c + a_i$를 저장하자! #align(center)[ #cetz.canvas({ import cetz.draw: * import cetz.decorations: brace grid((0, 0), (1.5 * 15, 1.5), step: 1.5) rect((1.5 * 2, 0), (1.5 * (2 + 6), 1.5), fill: rgb(100%, 0, 0, 20%)) rect((1.5 * 5, 0), (1.5 * (5 + 10), 1.5), fill: rgb(0, 0, 100%, 20%)) rect((1.5 * 7, 0), (1.5 * (7 + 6), 1.5), fill: rgb(100%, 100%, 0, 20%)) brace((1.5 * 2, -.2), (1.5 * (2 + 6), -.2), flip: true) let mid1 = (1.5 * 2 + 7, -1.2) grid((rel: (-1 * 8, -1), to: mid1), (rel: (0, 0), to: mid1), step: 1) content((rel: (0.5, -0.4), to: mid1), $-$, anchor: "center") grid((rel: (-1 * 2 + 3, -1), to: mid1), (rel: (3, 0), to: mid1), step: 1) brace((1.5 * 5, 1.7), (1.5 * (5 + 10), 1.7), amplitude: 3, pointiness: 45deg) let mid2 = (1.5 * 5 + 8, 4) grid((rel: (-1 * 15, 1), to: mid2), (rel: (0, 2), to: mid2), step: 1) content((rel: (0.5, 1.6), to: mid2), $-$, anchor: "center") grid((rel: (-1 * 5 + 6, 1), to: mid2), (rel: (6, 2), to: mid2), step: 1) brace((1.5 * 7, 1.7), (1.5 * (7 + 6), 1.7)) let mid3 = (1.5 * 7 + 3, 1.75) rect((rel: (-1 * 13, 1), to: mid3), (rel: (8, 2), to: mid3), stroke: none, fill: white) grid((rel: (-1 * 13, 1), to: mid3), (rel: (0, 2), to: mid3), step: 1) content((rel: (0.5, 1.6), to: mid3), $-$, anchor: "center") grid((rel: (-1 * 7 + 8, 1), to: mid3), (rel: (8, 2), to: mid3), step: 1) for i in range(15) { content((1.5 * (i + 0.5), 0.9), $a_#{i+1}$, anchor: "center") } }) ] #pagebreak() $ S_r &= a_1 + a_2 + dots.c + a_(l - 1) &+ a_l + dots.c + a_r \ S_(l - 1) &= a_1 + a_2 + dots.c + a_(l - 1) \ S_r - S_(l - 1) &= &a_l + dots.c + a_r $ - $S_i$를 $cal(O)(N)$에 미리 계산해 두면 구간 합이 $cal(O)(1)$ - 하지만 $a_i$가 중간에 바뀐다면? #sym.dash.em 고급에서 만나요 ] #slide.slide[과제][ - #slide.problem("23827", "수열 (Easy)") - #slide.problem("21921", "블로그") - #slide.problem("25947", "선물할인") - #slide.problem("28427", "Tricknology") ]
https://github.com/crd2333/crd2333.github.io
https://raw.githubusercontent.com/crd2333/crd2333.github.io/main/README.md
markdown
# crd233's Blog and Notebook Blog 和 Notebook 二合一 主页:[https://crd2333.github.io/](https://crd2333.github.io/) 笔记本:[https://crd2333.github.io/note/](https://crd2333.github.io/note/) *** 基于 [Frosti](https://github.com/EveSunMaple/Frosti) 模板改的一个博客,然后往里加了个孩子随便乱搓的、基于 [astro-typst](https://github.com/OverflowCat/astro-typst) 的笔记本
https://github.com/Rhinemann/mage-hack
https://raw.githubusercontent.com/Rhinemann/mage-hack/main/src/chapters/True%20Magick.typ
typst
#import "../templates/interior_template.typ": * #show: chapter.with(chapter_name: "Spheres") = True Magick #show: columns.with(2, gutter: 1em) True Magick represents a character's ability to manipulate reality through their Awakened Will. Depending on the character's approach to magick alternative names for the trait set are possible, such as: Spheres, Enlightened Science, Ars Magia, Heka. #block(breakable: false)[ == Using True Magick Whenever a PC is attempting working their Will upon the world they must determine the possibility of an effect based on the Sphere rank they possess and the descriptions of their abilities and add the Sphere employed in the effect to the dice pool. ] Every Working of magick opens a mage to all of the associated dangers, such as Paradox. #block(breakable: false)[ === Affinity Sphere The affinity Sphere is a mage's initial field of study and connection. It's a Sphere that a mage has the strongest connection to, the Sphere that is a mage's first connection to the greater truth of the world. The pull of an affinity Sphere can be felt form the childhood by most magi. ] Every character has an affinity Sphere they choose at character creation depending on their Tradition and natural talent. Whenever a character is casting an effect that involves their affinity Sphere they may spend a #spec_c.pp to double the Sphere die in a roll. #block(breakable: false)[ === Conjunctional Effects Despite being immensely powerful even on their own, different Spheres can be combined to achieve truly spectacular and complicated effects. ] Casting a conjunctional effect is no different from using one Sphere for creating an effect, a player must evaluate their Sphere ranks and descriptions to determine whether a desired effect is possible, then add only one Sphere die to the pool. Seeing as there are multiple Spheres involved, the choice of a Sphere is up to the player. Normally they can simply choose the highest Sphere available for the best success potential, but it might be more beneficial to choose a lower Sphere for a specific SFX it might have or if it's an affinity Sphere and can be doubled. #block(breakable: false)[ == The Spheres True Magick consists of 9 Spheres, each represents a character's ability to influence the specific area of the Tapestry. ] #block(breakable: false)[ === Rating Spheres Spheres are ranked #spec_c.d4 to #spec_c.d12, representing the depth and intricacies of the mage's understanding of it, and therefore their power to control it. ] Powers provided by every Sphere's rank are unique, but tend to follow this overall progression: / #spec_c.d4 Initiate: An initiate grasps the essential principles and begins to perceive the ways in which that Sphere behaves. The mage can't alter anything just yet, but they can put their observations to good use. / #spec_c.d6 Apprentice: The mage begins to use the Sphere to make small alterations in their local reality. The mage begins to use the Sphere to make small alterations in their local reality. / #spec_c.d8 Disciple: Achieving a greater level of accomplishment, the mage can make notable changes to elements connected with the Sphere. Remarkable feats become possible, and the mage approaches the realm of true wizardry. / #spec_c.d10 Adept: An impressive command of the Sphere in question allows the mage to perform dramatic feats. / #spec_c.d12 Master: Magnificent feats become possible with such dominion within the Sphere. Literally godlike miracles greet the master of a Sphere, and Reality literally shapes itself to their whim. #block(breakable: false)[ === Sphere Talents True Magick is a powerful trait set, so every Sphere has a number of talents associated with it. These talents are unlocked automatically as a character gains the corresponding Sphere rank. ] The specific talents for every Sphere are given after the rank description, but they follow this overall structure: / Sphere Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Sphere or create a related asset. You unlock this talent at Sphere rating #spec_c.d4 for that Sphere. / Sphere Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Sphere rating, add #spec_c.d6 and step up your effect die. You unlock this talent at Sphere rating #spec_c.d6 for that Sphere. / Sphere Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Sphere rating. You unlock this talent at Sphere rating #spec_c.d8 for that Sphere. / Sphere Command: Spend a #spec_c.pp to step up or double your Sphere die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Sphere rating. You unlock this talent at Sphere rating #spec_c.d10 for that Sphere. / Sphere Mastery: Take #spec_c.d6 appropriate stress or complication to double your Sphere die for for a roll. On a failure, step up the same stress or complication you took to activate. You unlock this talent at Sphere rating #spec_c.d12 for that Sphere. #show heading.where(level: 3): set align(center) #block(breakable: false)[ === Correspondence #quote[Connections and Dimensions] By manipulating the ties between places, objects, and people, the Correspondence Sphere allows a mage to sidestep distances, sense things that would normally be out of range, pull objects out of thin air, levitate or fly, or connect an Effect to some other place or character. Some magi proclaim this Sphere is proof that distance is an illusion, whereas others view it as the Art of pulling strings between different places and people. ] Most Effects require touch or close contact, but Correspondence lets the mage reach across distances and affect hidden or faraway targets. Tenuous connections require several successes, but spanning close connections is easy for a mage who understands this Art. On its own, Correspondence allows the mage to reach across distances, even to places they cannot see or touch. At Rank #spec_c.d6 or higher, they can grasp items and work with them from a distance. To manipulate other objects or beings in ways other than physical contact, however, that mage must combine Correspondence with another Sphere -- typically a Pattern Sphere (Forces, Life, or Matter). Despite its ability to warp space and distance, Correspondence deals only with whole Patterns, unless a target has been altered by another Pattern Sphere; Correspondence alone, for example, cannot teleport someone's head off -- the mage would need to use Life magick to separate the head from its body. A gun, on the other hand, could be snatched away by a Correspondence/Matter Effect. Mages who specialize in Correspondence tend to have a faraway look. To them, the separations of space and form are meaningless illusions that disappear when you understand how the universe truly fits together. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Immediate Spatial Perceptions/Landscape of the Mind] Basic spatial understanding allows a mage to sense things in their immediate vicinity even if they cannot perceive them with their normal senses. Using that perception, they can estimate the distances between objects; intuitively find a direction (North, South, East, West); notice hidden objects or characters; and spot spatial instabilities -- warps, anomalies, wormholes, etc. -- especially the ones caused by other Correspondence Effects. ] / Correspondence Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Correspondence or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Sense, Touch, Thicken & Reach Through Space/Correspondence Sensing] That mage can now extend their senses across intervening space, sensing things in other locations. Such extensions, however, leave minor ripples in space... the kind noticed by Rank #spec_c.d4 Correspondence. Fortunately, they can also thicken space to cover their tracks. ] By adding Life or Matter to Rank #spec_c.d6 Correspondence, the mage can grasp small items or organisms (housecat-sized or smaller) and then pull them through tiny holes in space. This lets them snatch business cards, guns, rabbits, and such from another location, apparently pulling them out of nowhere. / Correspondence Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Correspondence rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Pierce Space/Open or Close Gates/Co-locality Perceptions] Now the mage can tear holes in space, large enough for them to step through. These minor gates are small and temporary, but they allow that character to step from one place to another, so long as they are alone and are lightly encumbered. (Teleporting large items, or while carrying heavy loads, demands Correspondence #spec_c.d10.) Scoping out the new location is a good idea, of course. A close, familiar destination is easier than a distant, unfamiliar one. ] Using the Co-locality Perceptions Effect, the mage can also perceive several places at once. Those locations all appear as ghosts overlapping each other, as if they had been layered on top of the closest location. In addition, by combining Correspondence #spec_c.d8 with Forces, Life, or Matter, the mage can move things around from a distance, levitating, manipulating or teleporting them without physical contact. / Correspondence Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Correspondence rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Rend Space/Ward/Co-locate Self] Creating larger holes in space, the mage can now open permanent gates between locations; isolate forces, spaces, objects, or people into their own tiny realms (by combining Correspondence #spec_c.d10 with Forces, Life, Mind, or Matter); and ward certain locations against specific Patterns (again, combining Forces, Life, Mind, or Matter with Correspondence) or Resonance energies (combining this Sphere with Prime #spec_c.d10). This warding effect can impede or even block the forbidden elements from crossing into, or out of, the protected space. (For extensive details about wards, see the sourcebook How Do You DO That?) ] Using the Co-location Effect, mage can also appear in several different places at once. To function, however, they must add Mind #spec_c.d4 to that Effect. Each self mirrors the original's actions unless they also add Life #spec_c.d6 to that Effect, granting independence to every self. / Correspondence Command: Spend a #spec_c.pp to step up or double your Correspondence die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Correspondence rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Spatial Mutation/Co-Location] Distance and dimensions become child's play to a mage at this Rank. they can distort space; alter sizes and stretch or compress objects (Matter), bodies (Life), or forces (Forces); connect different Patterns to one another across intervening space; or even superimpose places or objects on top of one another (extremely vulgar). Combining this Rank with Life #spec_c.d8, the mage may also expand their senses to perceive many different places at once. ] / Correspondence Mastery: Take #spec_c.d6 appropriate stress or complication to double your Correspondence die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Entropy #quote[Chance and Mortality] Controlling the energies of probability and decay, an Entropy-schooled mage can manipulate random factors, observe and influence flaws within a system, tap into the energies of the Low Umbra, induce or remove corruption, and otherwise exert their Will through the unpredictable process of chaos. ] Entropy describes what should or must happen, but not precisely when or how that result will come about (those are the province of Time). Fate governs blessings, curses, destiny, fortune, oaths, probability, luck, and intent. This is no easy discipline. The Entropic mage assumes some of the Resonance of decay within their own Pattern, and bears the weight of mortality within their mind and soul. Still, the powers of this Sphere -- though less obviously destructive than those of other Arts -- give that mage subtle but pervasive control over Creation as a whole. For obvious reasons, Entropy-schooled magi tend to be fatalistic, disassociated, or uncannily cheerful. To them, the saying “all things must pass” is no simple sentiment but an intrinsic fact. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Sense Flaws, Fate & Fortune/Ring of Truth] Basic Entropic understanding allows a mage to see the currents of probability, spot flaws in Patterns, and note the subtle yet telling details in a person's speech and behavior that suggest whether or not they're telling what they believe to be the truth. Although they cannot yet control such phenomena, the mage can predict dice throws, card draws, and other apparently random events; spot weak spots in objects, people, or arguments; and use those imperfect yet profound insights to their advantage. ] / Entropy Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Entropy or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Control Probability] Now the mage can control the factors they could only sense before. Pulling the strings of apparently random events, they can influence activities and results -- directing the fall of dice or cards, repeatedly hitting weak spots, and directing people and things toward a conclusion of their choice. Of course, it is easier to control small events (the winner of a horse race) than large ones (causing a six-car pileup). In game terms, large alterations have higher difficulty than small ones do. ] / Entropy Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Entropy rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Affect Predictable Patterns] Things eventually break down. At this Rank, the mage can control the speed at which material objects fail or decay. That is easier to do with complex machines (cars, computers) than it is with simple ones (walls, stones) -- after all, more things can go wrong with complicated things. ] At this Rank, the mage can also start controlling the fate and fortune of objects and people, giving them good or bad luck by controlling the probability of events around them. Again, large feats have higher difficulty than smaller ones. / Entropy Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Entropy rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Affect Living Things] At this Rank, the mage assumes the awesome power of blessing, cursing, and conferring outright health or decay. By influencing the flow of entropy within a living body, that mage can grant outstanding vitality to, or inflict sudden disease upon, their subject. Such influence may grant long-term luck or misfortune. (GM's option as to how this manifests.) ] / Entropy Command: Spend a #spec_c.pp to step up or double your Entropy die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Entropy rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Affect Thought/Shape Memes/Binding Oath] The most esoteric applications of Entropy allow the mage to alter ideas, strengthening or breaking down concepts. Although they do not affect the actual workings of consciousness, they can cause synapses to misfire (thus confusing perceptions and mental processing, inflicting penalties on an enemy's dice rolls), bind someone to an oath, or degrade the patterns of thought. By doing so, that Entropic Master can create, perpetrate, reinforce, and undermine arguments, beliefs, and even memories. ] To do such things, the Master merely speaks to, or glances at, the subject of their attention. Chaos Masters can scramble someone's perceptions with a few weird utterances, and Masters of Order can present arguments with apparently perfect logic. By offering compelling statements, the Master can create or destroy memes, thus influencing whole patterns of belief. An oath, meanwhile, ties the subject's fate to their loyalty; if they break the oath, then their luck goes really, really bad. / Entropy Mastery: Take #spec_c.d6 appropriate stress or complication to double your Entropy die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Forces #quote[Raising Storms] Although modern physics disputes the old lines between matter and energy, the venerable study of Forces transcends human politics. This Sphere commands the energies of Creation, and its specialists are among the most powerful magi alive. ] On a metaphysical level, the Forces Sphere commands energetic Patterns: fire, air, momentum, gravity, radiation, light, sound, and radio waves... the kinetic elements that shape and channel Earthly forces. Quintessence flows within such Patterns, so a mage can conjure new forces simply by adding some Quintessence to “empty space.” Different practices view such powers differently. Are they elemental spirits? Gods? Particles? Waves? Every Master has their or their own pet theory. In practical terms, however, this Sphere controls the Patterns of such forces -- directing, transmuting, enhancing, or banishing their effects upon this world. Simple manifestations and manipulations are limited to the lower Sphere Ranks, whereas large-scale Effects demand higher levels of expertise. Most large Effects can become Paradox magnets for careless magi. Masters of Forces tend to carry a palpable aura of energetic command, with a Resonance that often alters their environments in uncanny, elemental ways. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Perceive Forces] Unlocking basic perceptions of the elements, a Forces-savvy mage can sense the flow of forces in their environment. they can boost their perceptions into the infrared or ultraviolet spectrums, notice electrons, see in the dark, view X-rays, discern the flow of sound or radio waves, spot kinetic energies, and hear frequencies beyond the normal human range. ] / Forces Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Forces or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Manipulate Forces/Elemental Touch] Although they cannot conjure energies just yet, the mage may now alter the flow of existing forces. Sound can be muted or amplified; shadows can be gathered, shaped, or dispelled. The mage can warp light to make things invisible, change their colors by altering the spectrum of localized light, or render them silent by bending sound waves in their vicinity. With a wave of their hand, they can disrupt electrical currents; flare flames; or direct the course of winds, momentum, or gravity. ] Combining this Rank with other Spheres, that mage could also make an object (Matter) or organism (Life) attract or repel forces. Thus, they could weave minor protection spells or force fields... or, conversely, turn that target into a magnet (perhaps literally) for the forces in question. Despite its powers, this Rank is limited in scale. Assume that the mage can command energies around a single human-sized character or within a small area (20' or less). To affect a larger area, you need a higher Rank in Forces. / Forces Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Forces rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Transmute Minor Forces/Telekinetics/The Dragon's Touch] Now the mage can alter and invoke the energies they could only touch before. By adding Prime #spec_c.d6, they may conjure winds, fire, electricity, gravitational wells, and so forth. Combining this Rank with Life or Matter, they can transform people into electricity (Life #spec_c.d12/Forces #spec_c.d8); change water into air (Forces #spec_c.d8/Matter #spec_c.d8), or attach elemental force to material forms -- making them fly, pinning them to the ground, and having other, similar effects (generally with Life or Matter #spec_c.d8). In addition, by adding an ephemeral Sphere to this Rank, they might erode or enhance energies (Entropy #spec_c.d8); manifest thoughts into energies (Mind #spec_c.d8); transmute spirit-stuff into physical energies (Spirit #spec_c.d8); or set triggers for energy fluctuations at some later interval (Time #spec_c.d10). At this Rank, the scale of effect grows larger, now encompassing several dozen yards or a handful of characters. ] / Forces Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Forces rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Control Major Forces/Gift of Zeus/Weather-Witching] Larger Effects become possible. Our mage may now use the lower-Rank Effects over larger areas -- a mile or more -- to change weather patterns; conjure darkness; drop or raise temperatures; protect locations... or destroy them; and otherwise employ the previous levels on a much greater scale. For obvious reasons, such Effects tend to be vulgar and have higher difficulty to achieve. ] / Forces Command: Spend a #spec_c.pp to step up or double your Forces die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Forces rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Transmute Major Forces/Conjuring Infernos] With godlike power, a Forces Master works their Will upon vast areas. they can conjure tornados on a clear day, calm tides, and ignite the very air into a firestorm. Such magi earn the title “Nuke,” though few of them survive long enough to enjoy it. It's easier to invoke such forces under the right conditions, of course -- a cold snap comes more easily in winter than in summer -- and such radical alterations have repercussions that often outlast the original Effect. In game terms, massive Forces spells should disrupt the weather and leave massive Resonance echoes behind. ] / Forces Mastery: Take #spec_c.d6 appropriate stress or complication to double your Forces die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Life #quote[The Living Form] Life grows, transforming over time until some final incident renders it into inert matter. magi who specialize in Life, therefore, master the complex principles of organic transformation. Beginning with the simplest Patterns, they evolve their understanding toward godlike ends. A true Master, therefore, may end life, but they may also create it from pure energy (that is, from Quintessence) or turn it, literally, to dust. ] Whereas other Spheres grapple with abstract theories, Life focuses on literally bone-deep facts. As a Life mage knows, however, those facts remain susceptible to change. In conjunction with other Pattern Spheres (Forces, Matter), life forms can be changed into elements, turned to stone or metal, or else created from such substances. Even without additional Spheres, however, Life allows a mage to transmute those life forms in startling, even apparently impossible ways. As a whole, this Sphere embraces everything that has living cells within itself, even if that object is technically dead. Generally, assume that anything that is still alive enough to transplant, preserve, or cultivate is governed by Life Arts. If it is inert enough to be irrevocably dead, then it is governed by Matter. Thus, preserved blood and organs, still-living plants, live-culture cheese, and so forth contain Life, but cotton fibers, withered organs, or cut wood become Matter. An organism that has been radically altered by Life magick (given new limbs or other characteristics that are not part of the creature's original Pattern) suffers Pattern bleeding: an inexorable Quintessence leak that inflicts #spec_c.d6 Hurt stress per day. Unless the caster uses Prime magick to refill that Pattern with fresh energy, or alters that Pattern permanently, the damage continues until the subject dies. Given their ability to heal illness, age, and harm, Life-skilled magi enjoy great health and vibrant beauty. Truly accomplished ones understand the mutable potential of organic existence and work to correct -- or exploit -- its ever-changing states. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Sense Life] Basic Life knowledge allows a person to read the presence and health of nearby life forms. With such knowledge, the mage can discern a living being's age, sex, and overall health. By combining those perceptions with other Spheres, they can also sense distant organisms (Correspondence #spec_c.d6), guess their potential for sickness or misfortune (Entropy #spec_c.d4), perceive them through past or future states (Time #spec_c.d6), or read the streams of Quintessence that bind them to the universe (Prime #spec_c.d4). ] / Life Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Life or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Alter Simple Life-Forms/Heal Self] Simple organisms -- viruses, mollusks, insects, plants, etc. -- become clay in the mage's hands. They learn to adjust their Patterns (giving a crab wings, for example), and heal or kill them. Although they cannot yet transmute them into other states of being, they can cause flowers to bloom or wither, help trees bear fruit, and so on. Focusing on their own Pattern, they can also heal themselves or perform small alterations (hair color, skin tone, height, weight, and so on) to their basic form. ] / Life Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Life rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Transform Simple Life-Forms/Alter Self/Heal Others] Advanced understanding allows the mage to radically alter simple organisms (turning a tree inside out); transform one into another (changing fruit into insects); or -- with Prime #spec_c.d6 -- conjure them from raw energy. ] Working with their own Pattern, that mage can work substantial alterations on themselves, growing gills, claws, armor and so forth. They remain essentially human, but begin to master the definition of “human.” Meanwhile, they also gain the ability to heal damage to other complex organisms, put them to sleep, or inflict harm upon their living Pattern forms. / Life Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Life rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Alter Complex Life-Forms/Transform Self] At this Rank, the mage may enact radical changes on any complex organism -- people, dogs, horses, and so forth. They can uplift other species with new limbs, opposable thumbs, increased brain capacity, etc., so long as they do not change their intrinsic nature. ] Working with their own Pattern, that mage can transform themselves into other life forms of similar size and mass; they could become a Great Dane, for example, but not a hummingbird. The new body might require an adjustment period before the mind and reflexes reflect the new form. / Life Command: Spend a #spec_c.pp to step up or double your Life die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Life rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Transform & Create Complex Life-Forms/Perfect Metamorphosis] Now the Master of Life may adopt any form they wish to achieve and may transform other complex organisms the same way. His expertise allows them to make permanent changes to life-Patterns, create complex life-forms from energy (with Prime #spec_c.d6), give them consciousness (with Mind #spec_c.d12), transmute them into other elements (Forces or Matter #spec_c.d8) or raw energy (Prime #spec_c.d12), radically age or de-age them (Entropy #spec_c.d10 or Time #spec_c.d8), or instill them with spirits (Spirit #spec_c.d8 or #spec_c.d12). Without such measures, however, their creations remain mindless, soulless sacks of life -- alive, but nothing more. ] / Life Mastery: Take #spec_c.d6 appropriate stress or complication to double your Life die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Matter #quote[Shaping the Materials] To a mystic, nothing is truly inert. Still, the Sphere of Matter deals with substances that possess no active agency of their own -- materials, not life forms or energies. The third aspect of the Pattern Trinity, Matter works best when combined with other Spheres. Prime and Matter create solid forms from energy; Correspondence and Matter connect objects across space; Entropy erodes or reinforces Matter; Forces transmutes inert elements into active ones. Spirit plus Matter renders ephemera into matter or matter into ephemera. Time alters the temporal state of Matter, and high-Rank Mind Effects (Rank #spec_c.d12) imbue inanimate materials with consciousness. Although Forces, Prime, and Spirit reflect primal energies and Life addresses organic animation, Matter represents the base of the physical world. ] Matter-wise magi tend to share a literally hands-on approach to their Art. Solid workers of their practice, they favor practical results with even the most theoretical applications. Sometimes regarded as dull and simple by their more esoteric peers, these artisans merge quality and integrity with surprising levels of ingenuity. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Matter Perceptions] A Primary understanding of Matter allows the initiate to perceive the intrinsic properties of base materials -- their underlying structure, innate properties, and integral stability or lack thereof. With that knowledge, they can view the material composition of an object, note its less-obvious structures, find its hidden layers or -- when combining this perception with Entropy -- spot its weak points. Combined with Life, this Sphere detects implants, enhancements, and other integrations of living tissue and inert materials. ] / Matter Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Matter or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Basic Transmutation] With advanced knowledge, the mage can transmute one substance into another, so long as they do not alter its essential shape, temperature, or basic state (gas, liquid, solid). Depending upon that mage's practice, they might reshape lead into gold through alchemy, wood into stone through a hyper petrification process, or water into wine (and, with Life #spec_c.d8, wine into blood) through a sacred miracle. Rare and/or complex materials are more difficult to fabricate than simple ones; it is easier to turn stone into iron, for example, than into gold. ] (On a related note, the mage cannot yet fabricate radioactive materials. Such elements merge their essence into the Sphere of Forces, and thus demand a greater level of expertise.) When combined with other Spheres, this basic level of understanding allows a mage to conjure base materials from energy or dissolve them into Quintessence (Prime #spec_c.d6); transmute matter into living tissue (Life #spec_c.d10 or higher); move an object through space (Correspondence #spec_c.d6 or higher) or time (Time #spec_c.d8 or higher); change ephemera into matter and matter into ephemera, or awaken the slumbering spirit within material objects (Spirit #spec_c.d8 or higher). In all cases, Matter #spec_c.d6 allows the mage to work with simple, homogenous, non-living substances. Complex mixtures of various elements usually require Rank #spec_c.d8 or higher, although simple combinations (like those found in bread, milk, paper, or gunpowder) are possible albeit more difficult. / Matter Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Matter rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Alter Form] At this Rank, the mage can alter the shape of materials in whatever ways they desire, and they can temporarily transform their essential state into a different one -- steel, for example, into fog or water into glass. (Permanent changes require Matter #spec_c.d12.) That crafter may change an item's density, fuse broken pieces together, or rip solid ones apart. ] By mixing Matter #spec_c.d8 with other Spheres, the mage can join inert matter with living tissue, disintegrate it into dust, shift objects with the power of thought, or otherwise perform amazing transformations upon apparently solid materials. / Matter Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Matter rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Complex Transmutation] Complex and radical transformations now become possible, especially with the addition of other Spheres. Pumpkins can be changed into carriages (Life #spec_c.d6), people into thrones (Life #spec_c.d12), cars into robots (combinations of Forces and Prime), or thin air into banquets, so long as the mage does not mind racking up a little (or a lot...) of Paradox. Different principles can be combined in complicated ways, creating cybernetic machines or electrified gold. Complicated devices (guns, cars, computers) may be conjured out of empty space if the mage understands the principles behind such things (in game terms, possesses the proper Skills). As usual, though, complicated creations demand extended. ] / Matter Command: Spend a #spec_c.pp to step up or double your Matter die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Matter rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Alter Properties] With Mastery, the crafter can create substances that transcend the limitations of scientific possibility, conjure materials unknown to Earthly reality, or share the deadly legacies of radioactive matter. Such Masters can shape armor out of air (with Prime #spec_c.d6), turn vampires into lawn furniture (Matter #spec_c.d12), or melt steel with a thought (Mind #spec_c.d8). Again, such deeds remain incredibly vulgar, but they recall the godlike feats of legendry. ] / Matter Mastery: Take #spec_c.d6 appropriate stress or complication to double your Matter die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Mind #quote[Art of Consciousness] Human beings perceive reality through complex interplays of consciousness. The Mind-mage, therefore, alters the realities of their fellow beings. Skillfully applied, such Arts can make a sane man mad, soothe demented minds, or even shuck the boundaries of flesh. ] Though limited in its physical capacities, Mind is the ultimate coincidental Art. Its Effects remain essentially invisible unless they are combined with other Spheres. And although Mind Adepts can leave their physical bodies behind, such abilities remain unseen by mortal eyes. Drastic acts of mind control (suicide, for instance) have especially high difficulty, as do Mind-based attacks against Night-Folk or other magi with the Mind Sphere. Therefore, weak-willed people may be influenced easily; determined folks can shrug aside the influence of all but the most dedicated Will-workers. Mind-based Effects are generally coincidental, although especially flamboyant feats might be vulgar instead. Literally “thought-full,” Mind-savvy magi possess mental clarity and unnerving perceptiveness. Some appear to drift in a sea of distractions, but the majority of them view the world with laser-focus intensity that penetrates illusions to reach their deeper truth. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Sense Thoughts & Emotions/Mind Shield/Empower Self] With basic mental magick, the mage learns to sense the emotions and surface impulses of other people. Although they cannot read specific thoughts, they are able to perceive psychic impressions about a person or (with Matter #spec_c.d4) a place or object. Through this perception, they can guess at the nature of weak Resonance signatures and read the stronger ones outright. Even without Resonance, that mage can scan auras, note mood shifts, discern truth from lies, or grasp someone's overall state of mind by way of a successful roll. ] Meanwhile, the mage also learns to shield their own mind from the thoughts and emotions of other people, constructing mental barriers around their aura, emotions, and consciousness. On a related note, they also learn how to multitask and absorb data with startling acuity. For a scene or two, they can even create a Mind Empowerment asset that concentrates their mental faculties. / Mind Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Mind or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Read Surface Thoughts/Empathic Bond/Create Impressions/Mental Impulse] Now the mage begins to skim the contents of unshielded minds, discern emotional states, read memories that have been left behind on objects or places, and project single words or emotional impulses to other people. The simpler the emotional content, the easier it is to send or read; a flash of rage, for instance, is easy to project or receive, but the complex stew of reflective melancholy presents a challenge to inexperienced Mind-mages. ] / Mind Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Mind rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Mental Link/Project Illusions/Dreamwalk/Psychic Blast] With increasing skill, the mage learns to link minds, forge telepathic communications, read or influence another person's thoughts, craft mental illusions, enter someone's dreams and explore dream Realms, and blast psychic assaults into an unwilling rival's consciousness. At this stage, Mind attacks can inflict painful -- though rarely fatal -- damage. Combined with Correspondence, Forces, Matter, or Life, they are able to employ telekinesis, pyrokinetics, and psychophysical assault, influencing objects, elements, or people with the power of their mind. Unlike most other Effects, this sort of thing is not coincidental, although such talents do have a place within popular culture. ] / Mind Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Mind rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Control Conscious Mind/Alter Consciousness/Astral Projection] The fearsome power of Black Suits and psychic assailants allows the mage to command another person's actions as well as their thoughts, alter their perceptions or mental state, and project their own mind from their physical form. At this Rank, a mage can change someone's memories, drive them crazy (or sane), overlay their aura with a desired impression, and set up posthypnotic suggestions and commands. In addition, by using internal rather than external powers, they can project their astral form. ] / Mind Command: Spend a #spec_c.pp to step up or double your Mind die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Mind rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Control Subconscious/Forge Psyche/Untether Consciousness] A true Mind Master commands not only their own conscience but other minds as well. They may alter someone's mind forever, raising (or lowering) their Traits, rewriting their personality, changing their Distinction Trait, or (with Life #spec_c.d10) switching their mind into another body. They can do the same things to their own mind as well, and they can untether that mind to explore the deeper reaches of astral space for hours or even days at a time. His greatest power, though, is the ability to fabricate entire consciousnesses, creating minds where no mind had been before. ] / Mind Mastery: Take #spec_c.d6 appropriate stress or complication to double your Mind die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Prime #quote[Essence of all Things] By studying the raw energy of Creation, a student of the Prime Sphere learns to understand, manipulate, and absorb the Fifth Essence within all things. Also known as Odylic Force, Primal Energy, and Quintessence, this baseline energy fuels the Patterns of other forms -- Forces, Life, Matter -- and flows through the sublime essence of Spirit. A Prime-skilled mage, therefore, can create and destroy things at their essential level, power items of enchanted or Enlightened creation, and sustain their own life essence through their understanding of Primal Force. ] Ripe with such energies, a Prime Sphere specialist pulsates with Primal Force. Unless they are working to suppress it (or has wiped their aura clean with high-Rank magicks), their Resonance bears strong signatures from their deeds. For better and worse, such a person embodies the primal Otherness that most magi possess -- the sense of being something more than most people ever dream of being. For an optional Technocratic approach to Prime, see Primal Utility, (pp. 526-527). #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Etheric Senses/Consecration/Infuse Personal Quintessence] A beginning study of Prime allows the mage to perceive and channel Quintessence from Nodes, Tass, Wonders, and magickal Effects. they may spot energetic ebbs and flows, can sense and at least try to read Resonance and Synergy signatures, and could absorb additional Quintessence into their personal Pattern as an asset. ] When infusing their Quintessence into an object, that mage may also consecrate the object with their personal energy. When they shapeshift, steps sideways, or otherwise alters their Pattern's metaphysical nature, that consecrated object will then change with their. In the process, it also picks up their personal Resonance... which, because it both identifies them and becomes essentially connected to them, is not always a good thing. / Prime Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Prime or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Fuel Pattern/Construct Patterns/Enchant Patterns/Body of Light] Attaining a degree of control over Prime energies, the mage may divert Quintessence into new or existing forms. Combined with other Spheres, this allows that mage to create new Forces, Life, or Matter Patterns (conjuring them from thin air), and to infuse existing items with Primal Force to strengthen them or enhance their protective or destructive power. ] Weapons or attacks infused with Quintessence through Prime #spec_c.d6 Effects may hurt and substances infused the same way may protect against such harm. On a related note, they may also -- with Life #spec_c.d6 for simple organisms, or Life #spec_c.d8 for complex ones -- consecrate a living thing at this Rank, as if that life form were an object described above. Through similar applications of energy, the mage can also conjure a simple Body of Light: an idealized self-projected from ephemeral energy. Although this Body of Light has no substance or special properties (unlike the astral form described in Chapter Nine, p. 477), it presents a glowing holograph of the mage themselves. / Prime Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Prime rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Channel Quintessence/Enchant Life/Energy Weapon/Craft Periapts & Temporary Wonders] By tapping into the flow of Quintessence around them, the Prime-skilled mage can draw both free and raw Quintessence from Nodes, Junctures (special times), and Tass (solidified Quintessence)... and they may channel that energy into new and existing Patterns as well. With such powers, they could (with Life #spec_c.d8) pull small amounts of life force from a living sacrifice or (with Matter #spec_c.d6) from inert objects; instill Quintessence into a vessel called a Periapt; or -- with other Spheres -- craft temporary Talismans or Devices by infusing them with Primal Force. ] In desperate circumstances, a Prime-schooled mage can also create temporary weapons out of pure concentrated energy -- blasts of Quintessence or swords of light. Such weapons inflict #spec_c.d6 Quintessence on user per use... or, for weapons that last for a length of time, #spec_c.d6 Quintessence stress per turn. Unless channeled through energy-guns or conjured as miracles among the faithful, such attacks are inevitably vulgar. / Prime Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Prime rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Expel or Infuse Energy/Tap Wellspring/Craft Tass & Permanent Wonders] The terrible power of draining Quintessence from objects or forces (though not yet from living things) can disintegrate those targets, consume them in Primal flames, or decay them almost instantly. Reversing that flow, the mage can create objects that cannot be broken, or bond organic and inorganic materials together to create cybernetic implants, nanotech, and other Wonders. At this stage, they are able to enchant items permanently and draw Quintessence from the energetic Wellsprings of exciting events. By infusing their personal Quintessence into a Periapt, the mage might use Matter #spec_c.d10 to create a Soulgem - a portable vessel that is filled with their own Resonance and energy. ] / Prime Command: Spend a #spec_c.pp to step up or double your Prime die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Prime rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Infuse or Withdraw Life Force/Create Node & Soulflower/Nullify Paradox] A Prime Master can draw Quintessence from anywhere, at any time, and channel it into other vessels as well. A dark, vulgar aspect of that power allows them to obliterate a living being by consuming all of their life force, whereas the reverse of that power infuses them with life force so strong that they are essentially blessed. Combining that ability with Life #spec_c.d12, they may turn complex organisms into Soulflowers - living Periapts who become walking batteries of boosted Quintessence. Such Mastery also allows the mage to create Nodes in significant places, and to nullify Paradox. ] / Prime Mastery: Take #spec_c.d6 appropriate stress or complication to double your Prime die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Spirit #quote[Art of the Otherworlds] Reaching into the essence beyond Earthly life and matter, the Spirit mage explores the Otherworlds and deals with creatures beyond mortal understanding. One of the most primal forms of the mystic Arts, Spirit Sphere magick traffics in the hidden side of the natural realm. As a result, its Effects typically use the Gauntlet Ratings to determine the difficulty of their associated rolls. ] Often affiliated with the shaman, Spirit magick is more eclectic than it often appears. A mage who specializes in this Sphere could be a primal devotee, a sophisticated theologian, a medicine-worker deeply versed in cultural traditions, an eclectic metaphysician, a modern Pagan, or anyone else who comprehends the rich world beyond material physics. Almost inevitably, they will look deeper than most modern people do, grasping for the spiritual forces behind apparently mundane events. For an optional Technocratic approach to Spirit, see Dimensional Science, pp. 525-526. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Spirit Sight/Spirit Sense] To most of humanity, the spirit world remains invisible. Not to a mage who knows the Spirit Sphere. Although they'll be most attuned to spirits with Resonance similar to their own, that mage can read the local Gauntlet's thickness, discern auras, sense spirits of all types, peek into the Penumbra through the Vidare (see Chapters Three and Four), and determine whether or not a material object has a spiritual component (as mystic Fetishes do). ] Combined with other Spheres, that mage can spot forces, places, or items with unusual ties to the spirit world, such as Awakened objects, elemental spirits, possessed organisms, Shallowings, Nodes, and so forth. / Spirit Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Spirit or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Touch Spirit/Manipulate Gauntlet] Perception moves to contact. The Spirit-savvy mage can now reach through the Gauntlet for a turn or two; call across the Gauntlet; speak to spirit entities, or touch them for a brief moment; and thin or thicken the local Gauntlet. That said, a human mage cannot lower the Gauntlet to less than #spec_c.d10 within the mortal world. ] By adding other Spheres, that mage could project thoughts across the barrier (Mind #spec_c.d10 or #spec_c.d12); stir up elemental disturbances within the Otherworlds (Forces #spec_c.d6 or higher); imbue material objects with ephemeral power (Matter #spec_c.d6); drain Essence from a spirit (Prime #spec_c.d8); or help other living creatures sense or contact the spirit realms (Life #spec_c.d6). / Spirit Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Spirit rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Pierce Gauntlet/Step Sideways/Rouse & Lull Spirit] Now the mage can cross over, transmuting their living tissue to ephemera. They may carry a few material possessions, although transmuting them as well raises the difficulty of the roll. (Normal clothing and items step up the Gauntlet rating once; bulky clothing and items step up rating twice.) That traveler must step sideways on their own; bringing large items or other people across demands a higher Spirit Rank. Meanwhile, a combined Spirit #spec_c.d8/Mind #spec_c.d6 Effect allows the mage to read Resonance, Synergy, and other spiritual energies (Essence, a spirit's place within a hierarchy, etc.). ] At this Rank, a mortal mage can also harm an Umbral entity as if they were using Life #spec_c.d8 against that entity. While Spirit #spec_c.d6 allows the mage to touch that entity, Spirit #spec_c.d8 lets them actually damage its ephemeral Pattern's integrity the way that Life #spec_c.d8 damages a physical creature's form. By combining this Rank with Matter #spec_c.d8 and Prime #spec_c.d6, the mage can also create short-lived objects from ephemera; such creations must be constructed as if they were material things, and they fade away at the end of the Effect's duration. Finally, this Rank helps the mage rouse the slumbering spirits within objects or places, or else put active spirits to sleep. (See Awakening Substances in Chapter Nine, p. 443). / Spirit Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Spirit rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Rend Gauntlet/Seal Breach/Bind Spirit] As the mage approaches Mastery, they can tear Gateways in the Gauntlet, allowing groups or large objects to pass through... or close such breaches, too. Both applications, of course, are deeply vulgar. ] At this Rank, the mage may also compel spirits to appear, bind them into Fetish objects, or tie them to certain spots or prisons. For obvious reasons, such bondage is risky, especially if the spirit is powerful. A brave or foolish Spirit mage can even turn themselves into a temporary Fetish, channeling a spirit entity into their mortal body; in such cases, they lose their ability to use true magick, but they may employ the capabilities of the spirit inside them. On the flipside, they can also exorcise a spirit that has possessed a mortal host. In all cases, the mage enters a series of resisted rolls against the spirit, pitting their Willpower against that spirit's own. / Spirit Command: Spend a #spec_c.pp to step up or double your Spirit die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Spirit rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Forge Ephemera/Gilgul/Break the Dreamshell] The Spirit Master is now able to command ephemera itself, creating, challenging, and destroying spirit matter as they Will. With such power, they may create Realms, imbue or drain a spirit of Essence, instill a soul within an empty shell of Life or Matter, and bestow the awful sentence of Gilgul -- the destruction of a mage's Avatar. Such powers are always vulgar and feature devastating consequences even when the mage succeeds. ] This power also allows the mage to break the Dreamshell and venture beyond the Horizons, wandering into the Deepest of Umbrae. / Spirit Mastery: Take #spec_c.d6 appropriate stress or complication to double your Spirit die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Time #quote[Tricking the Flow] The esoteric Arts of Time demand a flexible mindset. Possibly the most confounding Sphere, Time involves dizzying temporal metaphysics that defy the most apparently determined aspect of reality: time itself. Yet, initiates of this Sphere understand that time is fluid... difficult to manipulate, but not as rigid as it might appear. ] In conjunction with other Spheres, Time allows a mage to set triggers on other Effects, stretch out their duration, see into other times and places, or otherwise warp the threads of time. When prolonging an Effect, they could either increase Duration, or else add Entropy #spec_c.d8 in order to hold the Effect until a certain circumstance occurs. It has been said that time travel is impossible; however, that is not entirely true... it is just extremely difficult. Effects that involve going backwards in time are always vulgar, and stack the effects of Paradox. No wonder people who go back in time rarely return to speak of it! As one might expect, a mage who manipulates the Time Sphere tends to appear distant from the moment at hand. Although they might have excellent timing, their sense of the importance of past/present/future events seems to be a bit more... fluid than usual for a person living by the clock in today's world. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Time Sense] Temporal understanding begins with the mage's own perceptions of time. At this stage, they develop a precise internal clock and can spot the temporal ripples left behind by (or, in many cases, developing ahead of) Time Effects. Other phenomena, too, leave disturbances in the time-stream, and the mage can notice them as well. Combined with additional Spheres, this Rank allows the mage to detect the influence of the Time Sphere on other spells or Patterns too. ] / Time Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Time or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Past & Future Sight Thicken the Walls of Time] Now the mage can look forward or backward through time. Although those impressions are fleeting, hazy, not entirely accurate, and bound by the limitations of that time and place (that is, what a bystander in that specific time and location could sense under the circumstances), they allow the Time-seer to catch glimpses of the past or future. ] By itself, this Effect allows the mage to see in their present location only. By combining Past/Future Sight with other Spheres, however, they could read the probable past or future impressions of objects or places (Matter), living things (Life), and alternate locations (Correspondence). Entropy #spec_c.d6 even allows them to glimpse multiple futures and pick out the one most likely to occur. Reversing their powers of perception, that same mage can thicken the walls of time, which makes other Time Effects more difficult. / Time Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Time rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Time Contraction or Dilation/“Bullet Time”/Rewind Time] Speeding or slowing their relationship with time, the mage can now gain multiple actions, slow other characters or phenomena, or rewind small snatches of time. Or else slow another character, object, or even themselves. ] By rewinding time, the mage can also move their immediate surroundings -- an Effect that pulls them out of the normal flow of time and allows them to retcon an action or two. Combining this Rank with other Spheres, the mage can affect other Patterns (Forces, Life, or Matter #spec_c.d6), cast Effects across distance and time (Correspondence #spec_c.d8), move back in time while recalling events from the future they just left (Life #spec_c.d8/Mind #spec_c.d4), or even invoke multiple probabilities (Entropy #spec_c.d8). Again, such attempts are Paradox magnets with awful long-term consequences. / Time Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Time rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Time Determinism/Trigger Effect/Time Bubble/Anchor Point] Now the mage learns to withdraw themselves from the normal flow of time, hold Effects until they are triggered by events, or -- by adding in Correspondence, Forces, Life, Matter, and/or Spirit -- capture other beings or phenomena in bubbles of time. Thus, a mighty (vulgar) Time/Forces/Entropy Effect could capture a tornado and shunt it off into no-time space until some trigger sets it free. At this level of expertise, the mage can also set a temporal anchor point for themselves for when they dare to travel through time at Rank #spec_c.d12. ] / Time Command: Spend a #spec_c.pp to step up or double your Time die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Time rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Temporal Travel/Time Immunity] The “Dr. Who Effect” allows the mage to exist outside of time; immunize people, places or things from time's passage; or travel forward or backward through time. Such godlike feats... feats that often cause a mage to become forever lost to history... are often best left to the GM's discretion. Even for Masters, Time travel is a mysterious and maddeningly imprecise art. For extensive details about such things, see the sourcebook How Do You DO That? ] / Time Mastery: Take #spec_c.d6 appropriate stress or complication to double your Time die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Data (Correspondence) #quote[Accessing Reality Metacode] Data is reality. Anyone who thinks otherwise is fooling themselves. Although this reality extends only about as far as electronic data or media, that reach is damned near worldwide these days. And through that connection, Data Sphere specialists can find, contact, and reach out to anyone on the grid. All it takes is time and a little bit of information, plus the knowledge and the Will to work it properly. ] A Technocratic refinement of the Correspondence Sphere, Data remains the province of the Virtual Adepts, the New World Order, and the various allies they choose to share it with. Like all Spheres, its properties are meta-physical, extending beyond the realms of conventional reality. Although the Data specialist is, theoretically, just using the tools at their disposal, the greater reaches of this Sphere extend beyond the bounds of what should be possible, according to the Masses. It's not "magick", of course --- stop thinking such unmutual thoughts! It does, however, pull the strands of Information-Age technology in some pretty impressive ways. In most regards, Data functions like Correspondence with regards to the powers at its disposal. The primary differences come through the elements of connection and the methods of its employment. To use Data-based Effects, the technomancer must collate data about the person or location they're trying to reach, and then have gear in place that can reach the subject of their attention. The more expertise that specialist brings to bear on the situation (that is, the higher the Data rating they have ), the easier it is for them to establish a connection with minimal amounts of data. Because Data depends upon technological methods of information and connection, a target who's not on the grid cannot be affected by this Sphere. Given the current (and growing) extent of information technology, however, the Data can reach most people within the industrialized world... especially if they participate in social media, modern banking, or government processes. A Data specialist knows their way around the technology of our age. Though they might not be the humorless grunt so often associated with number-crunching disciplines, they've certainly got intense focus, an eye for detail, and a ruthless capacity for exploiting the bounds and bindings of information technologies. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[On the Ones and Zeros] Through a haze of code, the Data initiate begins to see the interconnectedness of all things. Bringing that esoteric level of comprehension to the world beyond their keyboard, the specialist can determine the exact distance between points or the connections between visible objects. Their understanding allows them to work on base-level projects without instruments, thanks to a growing familiarity with relationship information. ] / Data Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Data or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[The Reach and the View] With a few quick calculations, the specialist can assess theoretical and practical space -- assessments that allow them to perceive what's happening elsewhere. Expanding the metaphysical elements of this discipline, this understanding allows the agent to see and touch places in other areas of the world, so long as he they instruments that allow them access to distant locations. ] Combining Data with other Spheres, the specialist can extend the practical range of Technocratic Effects. Matter allows them to modify Union tech from a distance; Mind lets them communicate with agents or targets worldwide; Forces lets them attack distant targets; and Entropy allows them to predict and alter probability patterns and spot flaws in objects that they can perceive. As with regular Correspondence, the operator's Data Rank must be equal to, or higher than, the highest Rank in a connected Effect. / Data Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Data rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Quantum Teleportation/Firewalling/Surveillance Hub] Advanced Data transfer techniques allow the specialist to more or less sidestep conventional physics of spatial dimensions. In practical terms, this allows them to download themselves into quantum teleportation mode; erect firewalls of particle physics that effectively ward objects, places, or people; and divide their perceptions across a multilocational surveillance hub. Combined with other Spheres, this expertise helps the agent move things, forces, and living beings through intervening space. ] Again, however, these Procedures demand the appropriate gear on either side of the Effect. Such violations of conventional physics demand the proper technology. / Data Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Data rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Between Space/Dimensional Cohabitation/Multilocation Access] With such technology in place, the expert specialist can open quantum gateways between locations, create pocket dimensions between conventional space-time continuums, and disperse holographic manifestations of themselves into several concurrent locations. With the appropriate Life, Mind, and Primal Force Procedures, those manifestations can even become as solid as the agent themselves and perform different tasks in the finest Agent Smith tradition. ] / Data Command: Spend a #spec_c.pp to step up or double your Data die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Data rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Redistribute Physical Properties/Fold Space/Hyperdispersed Perceptions] Data Mastery merges conventional physics with sophisticated hypermath. The few specialists at this level can stack physical locations into the same space, alter the spatial dimensions and properties of a target, or disperse their perceptions into so many concurrent locations that a specialist may truthfully be said to have eyes and ears everywhere. ] / Data Mastery: Take #spec_c.d6 appropriate stress or complication to double your Data die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Dimensional Science (Spirit) #quote[Parsing Alternate Reality Spectrums] Based upon the Tychoidian cosmology theories of the Void Engineers, Dimensional Science posits an Anthropic Principle Field in which the conscious human mind exerts a degree of control over its metaphysical reality space. Because of that Principle, lesser subdimensions have collected outside of Earthly space, losers in some contest of metaphysical Darwinism. The entities native to those subdimensions -- extradimensional entities, or EDEs -- strive to pass the Earthly barriers and infect the human world. And that's where Dimensional Science comes in, a method of asserting the Enlightened elements of the Anthropic Principle and keeping those EDEs out of human space. ] In game terms, Dimensional Science is largely the same as the Spirit Sphere. Like other Technocratic Spheres of Influence, however, its Effects are bound to technological gear and viewed through a lens of science, not mysticism. Although Void Engineers still apply the term Umbrae to these subdimensions (considering them mathematical shadows of the human Consensus), the Dimensional Specialist's approach lacks animistic reverence, even though it features scientific awe. Unlike Data, Dimensional Science remains largely exclusive to a single Convention: the Void Engineers. In many regards, it's a well-kept secret, propagated only through intense training at VE facilities. The Dimensional Specialist, then, is a man or woman of intense focus within a multilevel framework of thinking and perception. By outside standards, they appear paranoid... but of course, if you knew the things they knows about the pervasive nature of subdimensions and EDEs, you'd be paranoid too... #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[EDE Scan/Evaluate Gauntlet/Map Dimensional Region] Through applied principles and technologies, the specialist learns to perceive EDE presence and potential incursions, evaluate the characteristics of alternate dimensions and thickness of the barrier that keeps them outside the Consensus, and perceive the essential terrain in the pocket dimensions on the other side of that Gauntlet. ] / Dimensional Science Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Dimensional Science or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Dimensional Vibration/Modify Dimensional Gauntlet/Transdimensional Field] At this level of expertise, the specialist can use radiation pulses, hypermath, and samples of transdimensional matter to grant access to those alternate dimensions. With the correct instruments, that specialist can send out artificial ripples into nearby subdimensions in order to attract EDEs and leave signals for other Dimensional Specialists. ] Thanks to the hypermathematical models and recordings involved in Dimensional Science, a specialist can also manipulate the Gauntlet, raising or lowering it, even as low as 0 -- a feat mystic mages cannot duplicate. The Gauntlet 0 Effect lasts for only one scene, but it counters the punishment of the Dimensional Anomaly (that is, the Avatar Storm) if that phenomenon is still in play. However, the specialist themselves still suffers feedback damage as they work the Effect. (In game terms, they take the usual Avatar Storm damage, though they prevents other characters from taking it during that scene.) On a related note, the specialist learns to also surround themselves (or, with the appropriate Spheres, other people or objects) with a transdimensional field; this, in turn, allows them to interact with subdimensions on a limited level (brief touch) without suffering harm from the Dimensional Anomaly. / Dimensional Science Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Dimensional Science rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Dimensional Shift/Manipulate Paraphysical Phenomena/Phase Disruption Field] Increased understanding allows the specialist to step sideways into alternate dimensions, manipulate the paraphysical matter (that is, ephemera) of those dimensions, and -- with the correct weaponry -- send out destructive phase disruption fields of vibrations that disorient, injure, or disintegrate EDEs. (In short, their attacks can harm spirit entities.) Thanks to the Stun/Kill/Disintegrate settings on those weapons, they can choose whether to inflict different levels damage on Umbral targets... and although EDE's experience all forms of damage the same way, dimension-hopping humans and Deviant werebeasts do not. ] / Dimensional Science Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Dimensional Science rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Alter Dimensional Topography/Dimensional Gateway/Stabilize Dimensional Field] Increased understanding and appropriate technologies help the specialist make lasting changes to alternate dimensions. Reworking the paraphysical constraints of a given space, they may craft pocket domains and dimensional walls in order to block or catch EDEs. A skilled specialist can do this even from the Earthly side of the Gauntlet, thus avoiding the effects of the Dimensional Anomaly. Using similar techniques, the specialist can also carve out rapid-transit paths; in game terms, this Effect cuts down the specialist's travel time within the Otherworlds. ] The specialist can also open large gateways into the subdimensions, although the people passing through those gates suffer the effects of the Anomaly unless the Gauntlet has already been lowered to 0 by a Dimension Science #spec_c.d6 Procedure. Channeling Primal Energy (Quintessence) through appropriate technology, the specialist can also strengthen the Enlightened Anthropic Principle enough to prevent Void Adaptation. / Dimensional Science Command: Spend a #spec_c.pp to step up or double your Dimensional Science die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Dimensional Science rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Anthropic Field/Breach Spatial Horizon/Cosmogenesis] Utilizing the ultimate applications of Anthropic Principle Fields, the specialist can generate their own Anthropic Field (with the right instruments, of course) that allows them to venture beyond both Horizons and venture into the Deep Universe. By crafting a reality bubble around themselves, that specialist can keep other Earthly beings alive with them as well and can engineer and pilot vehicles for Deep Universe travel. ] Employing the arcane technologies of Cosmogenesis, that Master Specialist may also engineer and create Horizon Constructs and custom-designed and constructed EDE organisms. They must employ Primal Utility energies as well (often including Life and Matter if the EDE construct is to survive outside the subdimensions... that is, if it's going to be more than simple ephemera), but these cosmic computations allow Void Engineers to harness powers not unlike those of legendary gods. / Dimensional Science Mastery: Take #spec_c.d6 appropriate stress or complication to double your Dimensional Science die for for a roll. On a failure, step up the same stress or complication you took to activate. #block(breakable: false)[ === Primal Utility (Prime) #quote[Investing Essential Energies] To the Enlightened Hypereconomist, Prime is not some ephemeral energy bubbling up from the cracks of the world. Instead, it's an energy field generated by Homo economicus: the ambitiously conscious human being who acts to further their self-interest. Related to the VE theory of Enlightened Anthropic Principle Fields (although they don't know it by that name), the Syndicate's hypereconomic theories see Quintessence energy rising from human interest and activity. People literally invest themselves in such ventures, and although they might not see the energy they create through such transactions, they can feel it... hence the sensations involved in feeling valued or worthless. ] Whereas other Technocratic Conventions stick close to the “essential energies” model of Prime, the Syndicate's Primal Utility specialists understand the Sphere differently. In game terms, the applications are more or less the same. For a Syndicate character, however, Prime flows through investing and withdrawing energetic currency through Ventures (value-generating Nodes) that manipulate the metaphysical economies of human value. By accessing what they call “creation's credit rating”, the hypereconomist controls that currency, investing it where it does the most good... for them. Perhaps the greatest edge granted to those who understand Primal Utility comes from the aforementioned Ventures. By investing in a Venture, the hypereconomist can draw Primal Energy (Quintessence) from a mundane business. In game terms, that business becomes a Node; if the character has a lasting personal connection with that Venture, then he's got access to that Node as well. Only a character with at least one dot in Primal Utility can access the Quintessence from that Venture; another mage might sense the energies but remain unable to access their power. Prime-savvy hypereconomists always watch for invisible bottom lines. Attuned to the effects of Market Correction (Paradox) and the perpetual exchange of energies conducted through human intercourse (sexual and otherwise), they can spot value -- or the lack of it -- in the least obvious situations, and he knows how to get the most for their investments in whatever form they might manifest. #block(breakable: false)[ ==== #spec_c.d4 Initiate #quote[Assess Primal Utility/Deposit Primal Utility/Exploit Primal Venture] Assessment analysis gives the hypereconomist a view of Prime flows, Resonance signatures, and applied metaphysical processes (that is, magick) in their vicinity. As with all other Technocratic Sphere Effects, this demands the correct instruments and training, although certain practices and instruments (especially dominion and hypereconomics) simply give the specialist a hunch about the energies in play. Some specialists see colorful flows of energy but dismiss such visions as simply mental constructs for an otherwise invisible process. ] As with Prime #spec_c.d4, the hypereconomist can also invest such energies and can utilize the Prime Force generated by Ventures as well as other, more mystical sources of Quintessence. / Primal Utility Perception: Step up your lowest die on any roll to perceive any phenomena under the purview of Primal Utility or create a related asset. #block(breakable: false)[ ==== #spec_c.d6 Apprentice #quote[Create Gadgets/Perfect Material Exploitation/Primal Innovation] Through sophisticated uses of instruments and principles, the hypereconomist can modify existing materials with an energized-value buzz; they can even create something from nothing, thanks to the principle of increased worth. In game terms, this allows them to use the normal Prime #spec_c.d6 Effects, although the character still needs to have some technological source to facilitate their conjurations. ] / Primal Utility Manipulation: On rolls to create an asset that can be produced by a #spec_c.d6 or lower Primal Utility rating, add #spec_c.d6 and step up your effect die. #block(breakable: false)[ ==== #spec_c.d8 Disciple #quote[Create Stable Extraordinary Devices/Living-Asset Exploitation/Use Currency & Primal Storage] Utilizing energetic manifestations called Currency (in mystic terms, Tass), plus efficient managerial skills, the specialist can employ a team to create permanent Devices with their Currency, restore their personal stock (Pattern) with Currency, and drain or refill Devices and storage batteries called Matrices (that is, Periapts) with their available Currency. ] / Primal Utility Control: Spend a #spec_c.pp to create a #spec_c.d8 asset that can be produced by a #spec_c.d8 or lower Primal Utility rating. #block(breakable: false)[ ==== #spec_c.d10 Adept #quote[Create Tass/Exploit Opportunity/Liquidate Assets] Skillful use of hypereconomics now allows the specialist to create Currency from free-flowing energy. Typically, this Tass involves precious materials, paper money, credit cards, or other items of value (paintings, stock certificates, bearer bonds, drugs, etc.). Unlike mystic mages (or other Technocrats), however, they can use only the energy generated by Primal Utility activities... and not, for example, charge up their Platinum card at the nearest Node. ] By exploiting the Primal Opportunities called “wellsprings” in superstitionist jargon, that hypereconomist can also draw energy out of an exciting event rather than a consistent source. On the flipside, they can also destroy material objects while divesting them of their value (Quintessence). Although the specialist cannot access this energy, they can keep other people from utilizing those resources. (“I'd sooner burn this warehouse down than let you have it…”) / Primal Utility Command: Spend a #spec_c.pp to step up or double your Primal Utility die on a roll for an effect that can be accomplished by a #spec_c.d10 or lower Primal Utility rating. #block(breakable: false)[ ==== #spec_c.d12 Master #quote[Create Living Assets/Generate Primal Conflux & Ventures/Liquidate Living Assets/Market Compensation] Like Mastery of the mystic Prime, Mastery of this Rank allows the specialist to create permanent Devices, open new Confluxes (Nodes) and Ventures, liquidate living things (typically through vulgar applications of disintegration technology -- although they could simply shoot someone and then burn the body), and negate the effects of Market Correction (Paradox) as if he were a Master of Prime Arts... though, of course, they have more technological finesse. ] / Primal Utility Mastery: Take #spec_c.d6 appropriate stress or complication to double your Primal Utility die for for a roll. On a failure, step up the same stress or complication you took to activate.
https://github.com/imkochelorov/ITMO
https://raw.githubusercontent.com/imkochelorov/ITMO/main/src/linear-algebra/s2/lecture/main.typ
typst
#import "../../../template.typ": * #set page(margin: 0.45in, height: auto) #set par(leading: 1em, first-line-indent: 0em) #set text(font: "New Computer Modern") #set heading(numbering: "1.1.") #show raw: set text(font: "New Computer Modern Mono") #show par: set block(spacing: 0.55em) #show heading: set block(above: .5em, below: 1em) #show heading.where(level: 1): set align(center) #show heading.where(level: 1): set text(1.44em) #show outline.entry.where( level: 1 ): it => { v(15pt, weak: true) text(weight: "bold", size: 1.35em, it) } #show: project.with( title: "Линейная алгебра\nII семестр", authors: ( "_scarleteagle", "imkochelorov" ), date: "зима/весна 2024", subtitle: "Лектор: <NAME>" ) #let make = sym.supset.sq #let see = $angle.spheric quad$ #let proof=par(strong("Доказательство:")) #let sum=$limits(sum)$ #let product=$limits(product)$ #let dp(first, second)=$angle.l #first, #second angle.r$ #let def=strong("Определение:") #let nb=par(strong("Замечание: ")) #let ex=strong("Пример: ") #let exs=par(strong("Примеры: ")) #let dp(first, second)=$angle.l #first, #second angle.r$ #let th=strong("Теорема:") #let proof=par(strong("Доказательство:")) #let qed = $space qed$ #let lm=par(strong("Лемма:")) #let apply=$op(circle.small)$ #let nl=v(0.2cm) #let sp=0.2cm #let slash=$op(slash)$ #outline(title: "Оглавление", indent: auto) #pagebreak() // спойлеры: 1. Полилинеальная и тензорная геометрия, 2. Спектральная теория типов, 3. Евклидова геометрия = Полилинейная и тензорная алгебра == Перестановки _см. курс дискретной математики первого семестра_ == Пространство полилинейных форм (пространство ПЛФ) $make X(KK)$ --- ЛП над $KK$, $dim_KK X=n, $\ $make X^* (KK)$ --- пр-во ЛФ над $X(KK)$ \ \ #def полилинейная форма \ ПЛФ называется отображение \ $u: limits(underbrace(X times X times dots times X))_p times limits(underbrace(X^* times X^* times dots times X^*))_q -> KK$\ Обладающее следующщими свойствами (полилинейность - _линейность по всем агрументам_):\ 1. $u(...space x_1 + x_2 space... ) = u (... space x_1 space ...) + u (... space x_2 space ...)$ 2. $u(dots, lambda x, dots) = lambda u(dots, x, dots)$ #nb пара $(p, q)$ --- валентность ПЛФ \ \ #exs 1. $f in X^*(KK)$ --- ПЛФ $(1, 0)$ 2. $hat(x) in X^(**)$ --- ПЛФ $(0, 1)$ 3. $E_3 quad g(x, space y) = dp(x, y)$ --- ПЛФ $(2, 0)$ 4. $E_3 quad omega (x, space y, space z)$ --- ПЛФ $(3, 0)$ #nb $make Omega_p^q$ --- мн-во ПЛФ $(p, q)$ \ \ 1. Равенство линейных форм $ u, v in Omega_p^q : u = v <=> u(x_1, space x_2,dots, space x_p; space y^1, y^2, dots, space y^q) = v(x_1, space x_2,dots, space x_p; space y^1, y^2, dots, space y^q) \ forall x_1, space dots, x_p in X, space y^1, space dots, space y^q in X^* $ 2. Сумма линейных форм \ $ omega = u + v <=> omega (x_1, dots, x_p; space y^1,dots, space y^q)=(u+v)(x_1, dots, space x_p; space y^1, dots, space y^q) =\ u(x_1, dots, space x_p; space y^1, dots, space y^q) +v(x_1, dots, space x_p; space y^1, dots, space y^q) \ forall x_1, dots, x_p in X, space y^1, dots, space y^q in X^* $\ $forall u,v,omega in Omega_p^q quad u+(v+omega)=(u+v)+omega $ --- _ассоциативность_\ $exists Theta in Omega_p^q quad Theta (x_1, dots, x_p;y^1, dots, y^q)=0, quad forall u in Omega_p^q quad u+Theta=u=Theta+u$ -- _существование нейтрального_\ $forall u in Omega_p^q quad exists (-u): u+(-u)=Theta$ --- _существование обратного_ 3. Произведение ПЛФ на скаляр $ w=lambda u <=> w(x_1,dots, x_p; y^1,dots,y^q)=(lambda u)(x_1,dots, x_p; y^1,dots,y^q) = lambda u(x_1,dots, x_p; y^1,dots,y^q) $ // не наврал?... #th \ $Omega_p^q = Omega_p^q (KK)$ --- ЛП \ \ #proof Проверка аксиом ЛП $qed$ == Тензор ПЛФ $make {e_i}_(i=1)^n$ --- базис $X(KK), {f^j}_(j=1)^n$ --- базис $X^* (KK)$\ $see u(x_1, space dots, space x_p, space y^1, space dots, space y^q) eq.circle$\ \ $x_1 = sum_(i_1 = 1)^n xi_1^(i_1) e_i_1 quad dots quad x_p=sum_(i_p=1)^n xi_p^(i_p) e_i_p$\ \ $y_1 = sum_(j_1 = 1)^n mu_(j_1)^1 f ^(j_1) quad dots quad y^q = sum_(j_p=1)^n mu_(j_1)^(q) f^(j_q)$\ \ $eq.circle u(sum_(i_1 = 1)^n xi_1^(i_1) e_i_1 dots sum_(i_p=1)^n xi_p^(i_p) e_i_p; sum_(j_1 = 1)^n mu_(j_1)^1 f ^(j_1) dots sum_(j_q = 1)^n mu_(j_q)^q f ^(j_q))$\ \ $=sum_(i_1 = 1)^n dots sum_(i_p = 1)^n sum_(j_1 = 1)^n dots sum_(j_q = 1)^n xi_1^(i_1) dots xi_p^(i_p) mu_(j_1)^1 dots mu_(j_q)^q u(e_i_1 dots e_i_p f^(j_1) dots f^(j_q)) = sum_(i_1 = 1)^n dots sum_(i_p = 1)^n sum_(j_1 = 1)^n dots sum_(j_q = 1)^n xi_1^(i_1) dots xi_p^(i_p) mu_(j_1)^1 dots mu_(j_q)^q u_(i_1 dots i_p)^(j_1 dots j_q).$ \ \ $u_(i_1 dots i_p)^(j_1 dots j_q)$ --- _тензор линейной формы_\ \ #lm Задание тензора $u_(i_1 dots i_p)^(j_1 dots j_q)$ в паре базисов пр-в $X$ и $X^*$ эквивалентно заданию самой ПЛФ $u$: $ u <->_({e^i})^({f_j}) u_(i_1 dots i_p)^(j_1 dots j_q) $ #proof cм. выше. $qed$ == Базис пространства ПЛФ $Omega_p^q (KK)$ --- пространство ПЛФ над полем $KK$ \ \ #nb $"Mat"_KK (2) quad limits(mat(1,0;0,0))^(=e^1)_(=e_11), space limits(mat(0,1;0,0))^(=e_2)_(=e_12), space limits(mat(0,0;1,0))^(=e_3)_(=e_21), space limits(mat(0,0;0,1))^(=e_4)_(=e_22)$ \ $(e_11)_(i j)=attach(e, bl: 11, tr: i j)$\ \ $attach(e, bl: alpha beta, tr: i j) = delta_alpha^i delta_beta^j = cases(1\, i = alpha\, j = beta, 0\, "иначе")$\ \ \ $see {attach(W, tl: s_1 s_2 dots s_p space, bl: t_1 t_2 dots t_q space)}$ --- набор ПЛФ в $Omega_p^q (KK)$, такой, что:\ \ $attach(W, tl: s_1 s_2 dots s_p space, bl: t_1 t_2 dots t_q space ) (x_1 dots x_p; y^1 dots y^q)=xi_1^(s_1) xi_2^(s_2) dots xi_p^(s_p) mu_(t_1)^1 dots mu_(t_q)^q$ \ \ #nb $attach(W, tl: s_1 dots s_p space, bl: t_1 dots t_q space, tr: space j_1 dots j_q, br: space i_1 dots i_p) = delta_(i_1)^(s_1) dots delta_(i_p)^(s_p) delta_(t_1)^(j_1) dots delta_(t_q)^(j_q)$ \ \ #th \ Набор ${attach(W, tl: s_1 s_2 dots s_p space, bl: t_1 t_2 dots t_q space)}$ --- базис в $Omega_p^q (KK)$\ \ #proof _Докажем полноту_\ $make u in Omega_p^q (KK)$\ $see u(x_1 dots x_p; y^1 dots y^q) = xi_1^(i_1) dots xi_p^(i_p) mu_(j_1)^1 dots mu_(j_q)^q u_(i_1 dots i_p)^(j_1 dots j_q)=attach(W, tl: i_1 dots i_p space, bl: j_1 dots j_q space) (x_1 dots x_p; y^1 dots y^q) u_(i_1 dots i_p)^(j_1 dots j_q)$\ $=> u=attach(W, tl: i_1 dots i_p space, bl: j_1 dots j_q space) u_(i_1 dots i_p)^(j_1 dots j_q)$ \ \ _Докажем ЛНЗ_\ $see attach(W, tl: s_1 s_2 dots s_p space, bl: t_1 t_2 dots t_q space) alpha_(s_1 dots s_p)^(t_1 dots t_q) = theta.$ Рассмотрим на поднаборе базисов $(e_i_1 dots e_i_p; f^(j_1) dots f^(j_q))$\ \ $attach(W, tl: s_1 s_2 dots s_p space, bl: t_1 t_2 dots t_q space) (e_i_1 dots e_i_p ; f^(j_1) dots f^(j_q)) alpha_(s_1 dots s_p)^(t_1 dots t_q) = 0$\ \ $delta_(i_1)^(s_1) dots delta_(i_p)^(s_p) delta_(t_1)^(j_1) dots delta_(t_q)^(j_q) alpha_(s_1 dots s_p)^(t_1 dots t_q) = 0 => alpha_(s_1 dots s_p)^(t_1 dots t_q) = 0 qed$ \ \ #nb $dim_KK Omega_p^q = n^(p+q)$ = Симметричные и антисимметричные ПЛФ $see Omega_p^0(KK)$\ #def симметрическая форма \ Форма $u in Omega_p^0 (KK)$ --- симметрическая, если ее значения не зависят от порядка аргументов $ u(x_sigma(1), x_sigma(2), dots, x_sigma(p)) = u(x_1,x_2,dots, x_p) \ forall sigma in S_p italic("(группа перестановок)") $ \ \ #ex \ $E_3 (RR) space g(x, y) = dp(x, y) quad g(x, y) = g(y, x)$ \ \ #lm $make u$ --- симметричная $=> u_(i_1 dots i_p) = u_(i_sigma(1) dots i_sigma(p))$ \ \ $make Sigma^p$ --- множество симметричных форм #image("1.png", width: 30%) \ #lm $Sigma^p = Sigma^p (KK) <= Omega_p^0 (KK)$ \ \ #def антисимметричная форма \ $V in Omega_p^0 (KK)$ --- антисимметричная, если $forall sigma in S_p quad v(x_(sigma(1)), dots, x_sigma(p)) = (-1)^([sigma] - "чётность") v(x_1, x_2, dots, x_p)$ \ \ #ex\ $E_3, omega(x, y, z) = (x, y, z), quad omega(x, z, y) = -omega(x, y, z)$ \ \ #lm Тензор антисимметричной формы антисимметричен по индексам $ v_(i_sigma(1) dots i_sigma(p)) = (-1)^([sigma]) v_(i_1 dots i_p) $ \ $make Lambda$ --- мн-во антисимметричных форм \ \ #lm $Lambda^p = Lambda^p (KK) <= Omega_p^0 (KK)$ \ \ #nb $Lambda^p sect Sigma^p = Theta$ \ \ #lm $v in Lambda^p <=> v$ обнуляется на паре одинаковых аргументов \ \ #proof $arrow.l.double: see v(dots x_i dots x_i dots) = -v(dots x_i dots x_i dots) => v=0$\ $=>: see v(dots x'_i + x''_i dots x'_i+x''_i dots)=0$\ $v(dots x'_i dots x'_i dots) + v(dots x'_i...x''_i dots) + v(dots x''_i dots x'_i dots) + v(dots x''_i dots x''_i dots) = 0$\ $v(dots x'_i dots x''_i dots) = -v(dots x''_i dots x'_i dots) qed$ \ \ #lm ${x_i}_(i=1)^p$ --- ЛЗ $=> forall v in Lambda^p (KK) quad v(x_1, dots, x_p)=0$ == Симметризация и антисимметризация $make W in Omega_p^0 (KK), quad KK : "char" KK = 0 quad (QQ$ и "больше") \ \ \ #lm Следующая форма является симметричной $ u(x_1, dots, x_p) = 1/p! sum_(sigma in S_p) W(x_sigma(1), dots, x_sigma(p)) $ #proof $see u(x_chi(1), dots, x_chi(p)) = 1/p! sum_(sigma in S_p) W(x_(sigma chi(1)), dots, x_(sigma chi(p))) = $\ $angle.l sigma apply chi = phi, quad sigma = phi apply chi^(-1) angle.r$\ $= 1/p! sum_(phi apply chi^(-1)\ phi in S_p) W(x_phi(1), dots, x_phi(p)) = u(x_1, dots, x_p) qed$ \ \ \ #def симметризация\ Процесс изготовления симметрической формы из произвольной\ $ ("Sym" W)(x_1, dots, x_p) = 1/p! sum_(sigma in S_p)W(x_(sigma(1)), dots, x_sigma(p)) $ \ \ #nb Коэффициент $1/p!$ --- нормировка: $W in Sigma^p => "Sym" W = W$ \ \ #nb $"Sym" "Sym" = "Sym"$\ $"Sym" (u+v)="Sym" u + "Sym" v$\ $"Sym" (lambda u) = lambda "Sym"(u)$ \ \ #lm Следующая форма является антисимметричной $ v(x_1, dots, x_p) = 1/p! sum_(sigma in S_p) (-1)^[sigma] W(x_sigma(1), dots, x_sigma(p)) $\ \ #def антисимметризация (альтернирование)\ Процесс изготовления антисимметричной формы из произвольной $ ("Alt" W) (x_1, dots, x_p) = 1/p! sum_(sigma in S_p) (-1)^[sigma]W(x_sigma(1), dots, x_sigma(p)) $ \ \ #nb $"Alt Alt"="Alt"$\ $"Alt"(u+v)="Alt" u + "Alt" v$\ $"Alt"(lambda u) = lambda "Alt"(u)$\ $"Alt Sym" = "Sym Alt"=0$ \ \ #nb $"Sym" + "Alt" != id$ $v(p = 2)$ \ $A^((s)) = (A+A^T)/2$\ $A^((a)) = (A-A^T)/2$ == Базис $Lambda^p$ $dim _KK Lambda ^p = space ?$\ $make {attach(W, tl: s_1 dots s_p space)}$ --- базис в $Omega_p^0(KK)$\ \ $see attach(F, tl: s_1 dots s_p)= p!"Alt"(attach(W, tl:s_1 dots s_p))$\ \ ${attach(F, tl: s_1 dots s_p)}$ --- набор в $Lambda^p$ --- ПН, но не ЛНЗ \ \ #lm Форма $attach(F, tl: s_1 dots s_p)$ --- антисимметрична по своим индексам\ $attach(F, tl: dots s_i dots s_j dots) = - attach(F, tl: dots s_j dots s_i dots)$ \ \ #proof $D attach(F, tl: dots s_i dots s_j dots) (dots x_i dots x_j dots) = p!"Alt" attach(W, tl: dots s_i dots s_j dots) (dots x_i dots x_j dots)=p!("Alt" attach(W, tl: dots s_i dots s_j dots))(dots x_i dots x_j dots) =$$=-p! ("Alt" attach(W, tl: dots s_j dots s_i dots))(dots x_i dots x_j dots)=-attach(F, tl: dots s_j dots s_i dots) (dots x_i dots x_j dots)$ #pagebreak() #nb + $attach(F, tl: dots s_i dots s_j dots), space attach(F, tl: dots s_j dots s_i dots)$ --- ЛЗ + $attach(F, tl: dots s_i dots s_j dots) = - attach(F, tl: dots s_j dots s_i dots)$ #see ${attach(F, tl: s_1 dots s_p) | underbrace(1 <= s_1 < s_2 < s_3 < dots < s_p <= n, arrow(s))}$ \ \ #th ${attach(F, tl: arrow(s))}$ --- базис в $Lambda^p$ \ \ #proof _ПН_: $make U in Lambda^p$\ \ $U = attach(W, tl: s_1 dots s_p) u_(s_1 dots s_p)$\ \ $"Alt" U = U = "Alt" (attach(W, tl: s_1 dots s_p) u_(s_1 dots s_p))$\ \ $=("Alt" attach(W, tl: s_1 dots s_p)) u_(s_1 dots s_p)$\ \ $=1/p! attach(F, tl: s_1 dots s_p) u_(s_1 dots s_p)=1/p! sum_arrow(s) sum_(sigma in S_p) attach(F, tl: s_sigma(1) dots s_sigma(p)) u_(s_sigma(1) dots s_sigma(p))$\ \ $=1/p! sum_arrow(s) sum_(sigma in S_p) (-1)^[sigma] attach(F, tl: s_1 dots s_p) (-1)^[sigma] u_(s_sigma_((1)) dots s_sigma_((p))) = 1/p! p! sum_arrow(s) attach(F, tl: s_1 dots s_p) u_(s_sigma_((1)) dots s_sigma_((p)))$\ \ _ЛНЗ_: #see $attach(F, tl: arrow(s)) alpha_arrow(s) = theta quad | (e_i_1 dots e_i_p)$\ \ $F(e_i_1, dots, e_i_p) alpha_arrow(s) = 0$\ \ $p! "Alt" attach(W, tl: s_1 dots s_p) (e_i_1, dots, e_i_p) alpha_(s_1, dots, s_p) = 0$\ \ $p! sum_(sigma in S_p) attach(W, tl: s_1 dots s_p) (e_i_sigma_((1)), dots, e_i_sigma_((1))) alpha_(s_1, dots, s_p)$\ \ $p! sum_(sigma in S_p) delta^(s_1)_i_sigma_((1)) delta^(s_2)_i_sigma_((2)) dots delta^(s_p)_i_sigma_((p)) alpha_(s_1, dots, s_p) = 0$\ \ $sum_(sigma in S_p) alpha_(i_sigma_((1)) dots i_sigma_((p))) = 0 quad (arrow(s))$\ \ $alpha_(i_phi_((1)) dots i_phi_((p))) = 0$ \ \ #ex\ $"char" K = 2 quad {0, 1}$\ \ #nb $!V(dots, x_i, dots, x_j, dots) = -V(dots, x_j, dots, x_i, dots)$\ $"char" K = 0 quad K supset QQ$\ \ *Базис:*\ ${attach(F, tl: s_1 dots s_p) | 1 <= s_1 < s_2 dots < s_p <= n}$ \ \ #nb $dim_K Lambda^p = C_n^p$\ \ #nb $&Lambda^0 quad dim_K Lambda^0 = 1 quad K\ &Lambda^1 quad dim_K Lambda^1 = n quad X^*(K)\ &Lambda^2 quad dim_K Lambda^1 = (n(n-1))/2 quad "Mat"^"alt"_n (2)\ &space dots.v \ &Lambda ^n quad dim_k Lambda^n = 1 \ "Базис" &Lambda^n quad {attach(F, tl: 1 2 3 dots n)} => forall U in Lambda^n quad U = alpha dot attach(F, tl: 1 2 3 dots n)}, alpha in K$\ \ #nb $make p > n => Lambda^p = {theta}$\ \ #def определитель \ $see attach(F, tl: 1 2 3 dots n) (x_1 dots x_n) = n! "Alt" attach(W, tl: 1 2 3 dots n) (x_1 dots x_n) = n! 1/n! sum_(sigma in S_n) attach(W, tl: sigma_((1)) dots sigma_((n))) (x_1 dots x_n) (-1)^[sigma]$\ $= sum_(sigma in S_n) (-1)^[sigma] xi_1^(sigma_((1))) xi_2^(sigma_((2))) dots xi_p^(sigma_((n))) eq.delta det {x_1 dots x_n}$ --- _определитель_\ \ #nb $x_i <-> xi_i$\ $see A = mat(xi_1^1, xi_2^1, dots, xi_n^1; xi_1^2, xi_2^2, dots, xi_n^2; dots.v, dots.v, dots.down, dots.v; xi_1^n, xi_2^n, dots, xi_n^n) quad det {x_1 dots x_n} equiv det A$ \ \ \- Понятно?\ \- \*молчание\* \ \- Понятно. Всем понятно? \ \- \*нервный смешок\* \ \- Нет, не всем...\ \- \*смех погромче\*\ \- Ну ладно. На экзамене станет понятно. #pagebreak() = Произведение ПЛФ == Определения $make U in Omega_(p_1)^ q_1 (K) quad V in Omega_(p_2)^q_2(K)$ \ #def произведение ПЛФ \ $U$ и $V$ --- ПЛФ $quad$ форма $W = U dot V$ --- _произведение ПЛФ_:\ $W(x_1, dots, x_p, x_(p_1+1), dots, x_(p_1 + p_2) , y^1, dots, y^q, dots y^(q_1 + q_2) )$ // че \ $= U(x_1, dots, x_p; y^1, dots, y^(q_1)) dot V(x_(p_1 + 1), dots, x_(p_1 + p_2); y ^(q_1+1), dots, y^(q_1 + q_2)$ \ \ #nb $W$ --- ПЛФ $(p_1 + p_2, q_1 + q_2)$\ #lm $U <-> u_(i_1, dots, i_p_1)^(j_1, dots j_q_1), quad V <-> v_(i_(p_1+1), dots, i_(p_1 + p_2))^(j_(q_1 + 1), dots, j_(q_1 + q_2))$\ \ $U V <-> u_(i_1, dots, i_p_1)^(j_1, dots j_q_1) v_(i_(p_1+1), dots, i_(p_1 + p_2))^(j_(q_1 + 1), dots, j_(q_1 + q_2)) = w_(i_1, dots, i_(p_1 + p_2))^(j_1, dots, j_(q_1 + q_2)) <-> W$ \ \ *Свойства:*\ 1. $U dot V != V dot U$\ #ex\ $&f, g in X^*(K)$ \ $ x, y in X(K)$\ $(f dot g)(x, y) = f(x) dot g(y) != (g dot f)(x, y) = g(x) dot f(y)$\ \ 2. $U in Omega_(p_1)^(q_1) (K)quad V in Omega_(p_2)^q_2(K) quad U dot V in Omega_(p_1 + p_2)^(q_1 + q_2) <-> $ внешнее произведение \ \ 3. $U in Omega_(p_1)^(q_1) (K) quad theta in Omega_(p_2)^(q_2) (K) quad U dot theta = theta dot U = theta in Omega_(p_1+p_2)^(q_1+q_2) (K)$ \ \ 4. $forall U, V, W: (U dot V) dot W = U dot (V dot W)$ \ \ 5. $U dot (V + W) = U dot V + U dot W$ \ \ 6. $forall alpha in K quad U dot (alpha V) = (alpha U) dot V = alpha dot (U dot V)$ \ \ 7. $make {attach(W, tl: s_1 dots s_p)}$ --- базис $Omega_p^0 (K)$\ \ $make {f^j}$ --- базис $X^* (K) =>$\ \ $attach(W, tl: s_1 dots s_p) = f^(s_1) dot f^(s_2) dot dots dot f^(s_p)$\ \ $see attach(W, tl: s_1 dots s_p) (x_1 dots x_p) = xi_1^(s_1) xi_2^(s_2) dots xi_p^(s_p)$\ \ $= <{e_i} "- базис, сопр. " {f^j}> = f^(s_1) (x_1) dot dots f^(s_p) (x_p)$\ \ $= (f^(s_1) dot f^(s_2) dot dots dot f^(s_p))(x_1, x_2, dots, x_p)$ \ \ #nb \ ${attach(W, tl: s_1 dots s_p, bl: t_1 dots t_q)}$ --- базис $Omega_p^q (K) quad $ $quad {attach(W, tl: s_1 dots s_p, bl: t_1 dots t_q)} (x_1 dots x_p y^1 dots y^q) = xi_1^(s_1) dots xi_p^(s_p) eta^1_(t_1) dots eta^q_(t_q)$\ \ ${f_j}$ --- базис $X^* (K),$\ \ ${hat(e)_m}$ --- базис $X^(**) (K)quad quad => quad quad attach(W, tl: s_1 dots s_p, bl: t_1 dots t_q) = f^(s_1) dot dots dot f^(s_p) hat(e)_(t_1) dot dots dot hat(e)_t_q$\ \ \ _Пространство, в котором эта операция является внутренней:_\ #def внешняя алгебра полилинейных форм \ #see $Omega = Omega_0^0 plus.dot Omega_0^1 plus.dot Omega_1^0 plus.dot Omega_1^1 plus.dot dots = limits(plus.circle.big)_(i=0)^(infinity) limits(plus.circle.big)_(j=0)^(infinity) Omega_i^j$\ $omega in Omega quad quad &omega_1 = V_1 + W_1 \ &omega_2 = V_2 + W_2 quad quad omega_1 +omega_2 = (V_1 + V_2) dot (W_1 + W_2)$ $(Omega, +, dot)$ --- _внешняя алгебра ПЛФ_ \ \ == Алгебра Грассмана *Вступление:*\ $make &U in Lambda^p, quad V in Lambda^q$ \ $space quest &U dot V in Lambda^(p+q) space quad space$ неправда.\ $make &U dot V = W$\ $W(x_1, dots, x_p, space space x_(p+1), dots, x_(p+q)) = U(x_1, dots, x_p) dot V(x_(p+1), dots, x_(p + q))$ \ \ #def антисимметричное произведение ПЛФ\ $U and V = "Alt"(U dot V) dot (p + q)!/(p! dot q!) $ --- _антисимметричное произведение ПЛФ_ \ \ #lm $"Sym"("Sym" U dot V) = "Sym"(U dot "Sym" V) = "Sym"(U dot V)$\ $"Alt"("Alt" U dot V) = "Alt"(U dot "Alt" V) = "Alt"(U dot V)$ \ \ *Доказательство* _(для альтернирования)_*:*\ $"Alt"("Alt" U dot V)(x_1, dots, x_p, space x_(p+1), dots, x_(p+q))="Alt" [1/p! sum_(sigma in S_p) (-1)^[sigma] U dot V] (x_sigma_((1)) x_sigma_((p)) x_(p+1) dots x_(p+q))$\ \ $=1/p! sum_(sigma in S_p) (-1)^[sigma] ["Alt" (U dot V)] (x_sigma_((1)), x_sigma_((p)), x_(p+1), dots, x_(p+q))$\ \ $=1/p! sum_(sigma in S_p) (-1)^[sigma] (-1)^[sigma] ["Alt" (U dot V)] (x_1, dots ,x_p, space x_(p+1), dots, x_(p+q))$ \ \ $= 1/p! dot p! ("Alt" U dot V)(x_1, dots ,x_p, space x_(p+1), dots, x_(p+q))$ \ \ \ *Свойства внешнего произведения:*\ #v(0.15cm) $make U in Omega_p^0 quad V in Omega_q^0$\ 1. Суперкоммутативность:\ $U and V = (-1)^(p dot q)space V and U$ #v(0.2cm)#proof $(U and V) (x_1, dots ,x_p, space x_(p+1), dots, x_(p+q))= (p+q)!/(p!q!) "Alt" (U dot V) (x_1, dots ,x_p, space x_(p+1), dots, x_(p+q))$\ #v(0.15cm) $=(-1)^(p dot q) (p+q)!/(p! q!) "Alt" (V dot U) (x_(p+1), dots, x_(p+q), space x_1, dots ,x_p)$ #v(0.2cm)#nb $f and g = -g and f quad forall f, g in X^* (K)$\ $v and omega^((2m)) = omega^((2m)) and v$\ 2. Ассоциативность:\ $U and (V and W) = (U and V) and W$ #v(0.2cm)#proof _очевидно_ (доказательство оставлено читателям в качестве простого, но обязательного упражнения) 3. $U and (alpha V) = (alpha U) and V = alpha(U and V) quad quad forall alpha in K$ 4. $U and (V + W) = U and V + U and W$ 5. ${attach(F, tl: s_1 dots s_p)}$ --- базис $Lambda^p => attach(F, tl: s_1 dots s_p) = f^(s_1) and f^(s_2) and dots and f^(s_p)$ #v(0.2cm)#proof $attach(F, tl: s_1 dots s_p) = p! "Alt"(attach(W, tl: s_1dots s_p))= p! "Alt" (f^(s_1) dot f^(s_2) dot dots dot f^(s_p))$\ #v(0.15cm) $=p! (1 (p-1)!)/(p!) dot f^(s_1) and "Alt"(f^(s_2) dot dots f^(s_p)) = (p-1)! dot f^(s_1) and "Alt"(f^(s_2) dot dots dot f^(s_p)) = dots$\ #v(0.15cm) $= f^(s_1) and f^(s_2) and dots f^(s_p)$ 6. $U in Lambda^p, space v in Lambda^q$\ #v(0.15cm) $u and v = 0 quad quad p + q > n$\ #v(0.15cm) #see $Lambda in limits(plus.big)_(j=0)^n Lambda^j quad dim_K Lambda^j = C_n^j$\ #v(0.15cm) $dim_K Lambda = 2^n$ #quote([Всё, что было до этого --- детский сад. Ну может начальная школа], attribution: "<NAME>", block: true) // там на задних рядах люди плачут // о чем // о детском садике ну может о начальной школе // :( $(Lambda, +, and)$ --- алгебра Грассмана \ \ #def градуированная алгебра\ #v(0.1cm) $Lambda$ --- _градуированная алгебра_, если:\ #v(0.15cm) $U in Lambda^P, V in Lambda^q => U dot V in Lambda^(p+q)$\ $Lambda^p Lambda^q subset Lambda^(p+q)$ \ \ #ex \ \А\л\г\е\б\р\а \м\н\о\г\о\ч\л\е\н\о\в // а всех остальных уже отчислили? // ? // сколько там людей из 34-37 // хз // но всего сидит 15 ровно #pagebreak() = Определитель $see dim_K Lambda^n=1 => {attach(F, tl: 12 dots n)}$ --- базис $Lambda^n$ \ \ #def определитель\ Определитель набора векторов ${x_i}^n_(i = 1)$ --- "число" \ $det{x_1 dots x_n} &= attach(F, tl: 12dots n)(x_1 x_2 dots x_n) \ &= n! "Alt" attach(W, tl: 12dots n)(x_1 x_2 dots x_n) \ & = n! dot 1/(n!) limits(sum)_(sigma in S_n) (-1)^[sigma] attach(W, tl: 12dots n)(x_sigma(1) x_sigma(2) dots x_sigma(n)) \ & = sum_(sigma in S_n) (-1)^[sigma] xi^1_sigma(1) xi^2_sigma(2) dots xi^n_sigma(n)$ \ \ #nb Альтернативная форма:\ #v(0.2cm) $C := [x_1 x_2 dots x_n] = mat(delim: "[", xi_1^1, xi_2^1, dots, xi_n^1; xi_1^2, xi_2^2, dots, xi_n^2; dots.v, dots.v, dots.down, dots.v; xi_1^n, xi_2^n, dots, xi_n^n)$ \ #v(0.2cm) $det C := det {x_1 dots x_n}$ == Определитель как форма объёма $make {x_i}^n_(i = 1)$ --- набор в $X(K)$\ #v(0.2cm) #def параллелепипед, построенный на векторах набора ${x_i}^n_(i = 1)$\ #v(0.2cm) Множество следующего вида: $T_n{x_1 dots x_n} = {sum_(i = 1)^n lambda^i x_i | lambda^i in [0, space 1] space forall i}$\ #v(0.2cm) $make omega$ --- форма объёма в $X(K) space(K=RR)$\ #v(0.2cm) _Свойства:_ \ + $"codom" omega in RR$ + $omega T{dots x'_i + x''_i dots} = omega T {dots x'_i} + omega T {dots x''_i dots}$\ $omega T { dots lambda x_i dots} = lambda omega T {dots x_i dots}$ + $omega T {x_1 dots x_n} = 0 <=> {x_i}_(i = 1)^n$ --- ЛЗ $=> omega in Lambda^n => omega tilde det$\ _Вычисление определителя --- вычисление объёма параллелепипеда, построенного на векторах набора_ == Свойства определителя #nb $det{x_1 dots x_n} = limits(sum)_(sigma in S_n) (-1)^[sigma] xi^1_sigma(1) xi^2_sigma(2) dots xi^n_sigma(n) = mat(delim: "|", xi_1^1, dots, xi_1^n; xi_2^1, dots, xi_2^n; dots.v, dots.down, dots.v; xi_n^1, dots, xi_n^n)$\ \ *1.* \ $det C^T = det C$\ #v(0.2cm) #proof #v(0.2cm) $sum_(sigma in S_n) (-1)^[sigma] xi^1_sigma(1) xi^2_sigma(2) dots xi^n_sigma(n) = det C\ = sum_(sigma in S_n) (-1)^[sigma] xi^sigma(1)_1 xi^sigma(2)_2 dots xi^sigma(n)_n eq.delta det C^T$\ $display(mat( sum_(sigma) attach(W, tl: 1 2 dots n) (x_sigma(1) dots x_sigma(n)) = xi_sigma(1)^1 dots xi_sigma(n)^n; sum_(sigma) attach(W, tl: sigma(1) sigma(2) dots sigma(n)) (x_1 dots x_n) = xi^sigma(1)_1 dots xi^sigma(n)_n))$ *2.* \ $det {dots x'_i + x''_i dots} = det{dots x'_i dots} + det{dots x''_i dots } $\ $det{dots lambda x_i dots} = lambda det{dots x_i dots} $ \ $det{lambda C} = lambda^n det C $\ $det(C_1 + C_2) eq.not det C_1 + det C_2$\ *3.*\ $det {dots x_i dots x_j dots} = det{dots x_i dots x_j + lambda x_i}$\ *4.*\ $det{dots x_i dots x_j dots} = - det{dots x_j dots x_i dots}$ \ *5.*\ _Рекуррентная формула_\ #v(0.2cm) $det C = sum_(i= 1)^n (-1)^(i + j) xi_j^i M ^i _j$ --- разложение по $j$-му столбцу\ #v(0.2cm) $det C = sum_(j= 1)^n (-1)^(i + j) xi_j^i M ^i _j$ --- разложение по $i$-ой строке #v(0.2cm) #proof #v(0.2cm) #columns(2, gutter: 6cm)[ $det C &= attach(F, tl: 1 2 dots n)(x_1 x_2 dots x_n) = \ &= f^1 and f^2 and dots and f^n (x_1 x_2 dots x_n)$\ #v(0.2cm) $= f^1 and f^2 and dots and f^m and dots and f^n (x_1 dots x_m dots x_n)$\ #v(0.2cm) $= < x_m = sum_(i=1)^n xi_m^i e_i; f^j (e_i) = delta_i^j >$\ $= f^1 and dots and f^m and dots and f^n (x_1 dots sum_(i = 1)^n xi_m^i e _i dots x_n)$\ #v(0.2cm) $=sum_(i=1)^n f^1 and dots and f^m and dots and f^n (x_1 dots limits(underline(e_i))_(m arrow.t.curve) dots x_n)$\ #v(0.2cm) $=sum_(i=1)^n xi_m^i (-1)^(i + m) f^1 and dots and f^(m - 1) and f^(m + 1) and dots and f^n (x_1 dots x_(m-1) x_(m+1) dots x_n))$\ #v(0.2cm) $=sum_(i=1)^n xi_m^i (-1)^(i + m) M_m^i quad quad quad quad quad quad quad quad quad quad quad quad quad quad quad quad quad quad quad quad quad eq.circle$\ #colbreak() $f and g = f dot g - g dot f$\ #v(0.2cm) $f and g and h &= f dot g dot h + h dot f dot g + g dot h dot f - \ &- f dot h dot g - g dot f dot h - h dot g dot f$ #align(center)[#image("2.png", width: 60%)]] #def алгебраическое дополнение\ Алгебраическим дополнением элемента $xi_m^i$ называется "число": $ A_m^i = (-1)^(i+m) M_m^i $ #nb #v(0.2cm) $det C = sum_(i=1)^n xi_m^i A_m^i$ \ \ #th (_Лапласа_)\ _Определитель матрицы равен сумме произведений миноров матрицы на их алгебраических дополнениях_\ #v(0.2cm) $det C = sum_(i_1 dots i_p) (-1)^(i_1 + dots + i_p + j_1 + dots j_p) M_(j_1 dots j_p)^(i_1 dots i_p) L_(j_1 dots j_p)^(i_1 dots i_p)$ \ \ #ex\ #v(0.2cm) $mat(delim: "|", 1,2,3,4;3,4,2,1;1,-1,2,1;0,1,2,3) = mat(delim: "|", 3,4;1,-1) dot (-1)^(2+3+1+2) mat(delim: "|", 3,4;2,3) + mat(delim: "|", 3,2;1,2) dot (-1)^(2+3+1+3) dot mat(delim: "|", 2,4;1,3) + dots$ ("_кому интересно, дома досчитаете_")\ \ #proof #v(0.2cm) Продолжаем "доказательство" предыдущего свойства \ #v(0.2cm) $eq.circle sum_(i=1)^n xi_m^i (-1)^(i+m) sum_(j=1)^n xi_l^j (-1)^(j+l) M_(m l)^(i j) = sum_(i, j =1)^n underbracket(xi_m^i xi_l^j, L_(m l)^(i j)) (-1)^(i + m + j + l) M_(m l)^(i j)$ #nb #v(0.2cm) $det "diag" {lambda_1 dots lambda_n} = product_(i=1)^n lambda_i$\ $det "diag" {C_1 C_2 dots C_m} = product_(i=1)^m det C_i$\ $det mat(delim: "[", C_1, *, dots, *; 0, C_2, dots, *; dots.v, dots.v, dots.down, dots.v; 0, dots, dots, C_m) = product_(i=1)^m det C_i$ #nb $sum_(i=1)^n xi^i a_i = b$ --- система Крамера\ $=> xi^i = Delta_i/Delta$, где $Delta = det {a_i dots a_n}, Delta_i = det {a_1 dots limits(b)_(i arrow.t.curve) dots a_n}$ #proof $Delta_i = det {a_1 dots b dots a_n} = det {a_1 dots sum_(i=1)^n xi^i a_i dots a_n} = det {a_1 dots xi^i a_i dots a_n} = xi^i Delta$ = Ранг матрицы $make {x_i}_(i = 1)^n$ --- набор в $X(K)$\ #v(0.2cm) $det{x_1 dots x_n} = 0 => {x_i}_(i=1)^n$ --- ЛЗ\ #v(0.2cm) Сколько ЛНЗ векторов в наборе ${x_i}_(i = 1)^n ?$ \ \ #lm ${x_i}_(i = 1)^m$ --- ЛЗ $arrow.l.double forall V in Lambda^M space V (x_1 dots x_m)= 0$ \ \ #proof От противного: $make {x_i}_(i=1)^m$ --- ЛНЗ (при #sym.arrow.t этом условии)\ $x_1 x_2 dots x_m$\ $arrow.b space arrow.b space space arrow.b$\ $e_1 e_2 quad e_m e_(m+1) dots e_n$ --- базис $X(K)$\ #v(0.2cm) $make {f^j}_(j=1)^n$ --- базис, сопряженный к ${e_i}_(i=1)^n$: $f^j (e_i) = delta_i^j$\ #v(0.2cm) $see f^1 and f^2 and dots and f^m (x_1 x_2 dots x_m) = sum_(sigma in S_m) (-1)^[sigma] f^sigma(1) dot f^sigma(2) dot dots dot f^sigma(m) (x_1 x_2 dots x_m) tilde$\ #v(0.2cm) $tilde C dot sum_(sigma in S_m) (-1)^[sigma] xi_1^sigma(1) xi_2^sigma(2) dots x_m^sigma(m) $\ #v(0.2cm) $= C dot delta_1^sigma(1) delta_2^sigma(2) dots delta_m^sigma(m) = C != 0$\ #v(0.2cm) Нашли $m$-форму, которая не обнуляется. Противоречие\ $attach(F, tl: 1 2 dots m) = m! ("Alt" attach(W, tl: 1 2 dots m)) = m! 1/m! sum$ #nb Если хотя бы одна $m$-форма отлична от нуля, то набор ${x_i}_(i=1)^m$ --- ЛНЗ\ \ $V in Lambda^m quad make {attach(F, tl: s_1 dots s_m)}$ --- базис $Lambda^m$ #nb Для проверки ЛЗ достаточно проверить базисные формы\ ${x_i}_(i=1)^n: forall s_1 dots s_p, 1 <= s_1 < s_2 < dots < s_m <= n quad attach(F, tl: s_1 dots s_p) (x_1 dots x_m) = 0 => {x_i}_(i=1)^m$ --- ЛЗ\ \ $see C = mat(delim: "[", xi_1^1, xi_2^1, dots, xi_m^1; xi_2^1, xi_2^2, dots, xi_m^2; dots.v, dots.v, dots.down, dots.v; xi_1^n, xi_2^n, dots, xi_m^n) <--$ сколько ЛНЗ\ $attach(F, tl: s_1) quad attach(F, tl: s_1 s_2) quad attach(F, tl: s_1 s_2 s_3)$ // wtf is that \ \ #def ранг матрицы\ Рангом матрицы $C$ называется её наибольший порядок отличного от нуля минора\ $"rg" (C) quad "rank"(C) quad "rk"(C)$ \ \ #ex\ #columns(2)[ #image("3.png", width: 60%) #colbreak()\ \ $B = mat(delim: "[", b_1, *, *, dots, *; 0, b_2, *, dots, *; dots.v, dots.v, dots.v, dots.down, dots.v; 0, 0, 0, dots, b_c)$ + $b_1 != 0 => "rank" C >= 1$ #v(0.2cm) + $b_1 b_2 != 0 => "rank" C >= 2$ $dots.v$\ #v(0.2cm) $l. space product_(i=1)^l b_i != 0 => "rank" C >= l$\ #v(0.2cm) $l+1. space V space attach(L, tr: i_1 dots i_(l+1), br: j_1 dots j_(l+1)) => "rank" C = l$ ] \ \ #def базисные столбцы (строки)\ Базисными столбцами (строками) матрицы $C$ называются столбцы (строки), входящие в базисный минор \ \ #lm Любая строка (столбец) матрицы $C$ является линейной комбинацией базисных строк (столбцов) #proof Очевидно. #emoji.face.cool \ \ #th (_о ранге_)\ Ранг матрицы равен кол-ву ЛНЗ строк или столбцов матрицы \ \ *Свойства ранга:*\ // стоп а где пункт 1 был // "пока не будем" 1. ```py pass``` 2. == Теорема Крамера и Кронекера-Капелли $make sum_(i=1)^n xi^1 a_1 = b$ --- СЛАУ\ $A = [a_1 a_2 dots a_n], xi = vec(delim: "[", xi_1, xi_2, dots.v, xi_m)$\ В матричной форме $A xi = b quad (*)$\ #th (_Крамер_)\ $(*)$ совместна и определена $<=> det A != 0$ #proof $=>: {a_1 a_2 dots a_n}$ --- базис $K^n => {a_i}_(i=1)^n$ --- ЛНЗ $=> det {a_1 dots a_n} != 0$\ $arrow.l.double: det {a_1 dots a_n} = det A != 0 => {a_i}_(i=1)^n$ --- ЛНЗ $=> max +$ ЛНЗ $=>$ базис $=>$ $exists$ решение $forall b$\ $xi^i = Delta_i/Delta$\ \ #th (_Кронекера-Капелли_)\ $see A xi = b quad (*)$\ $A, [A | b]$ --- расширенная матрицы\ Система $(*)$ совместна $<=> "rank" A = "rank" [A | b]$\ #proof $=>: (*)$ совместна $=> b in angle.l a_1 dots a_n angle.r =>$ добавление столбца $b$ не меняет ранга $A$\ $=> "rank" A = "rank" [A | B]$\ $arrow.l.double: "rank" [A | b] = "rank" A => b in angle.l a_1 dots a_n angle.r =>$ совместна == Вычисление ранга #lm Гауссовы (элементарные) преобразования не меняют ранг матрицы 1. Сложение строк (не меняет определитель)\ 2. Умножение строки на число $eq.not 0$ (определитель умножается на $lambda$) 3. Перестановка строк (меняет только знак определителя) \ *Приведение к верхнему треугольному виду*\ #v(0.2cm) $mat(delim: "[", a_1^1, a_2^1, dots, a_n^1; dots.v, dots.v, dots.down, dots.v; a_1^n, a_2^n, dots, a_n^n) tilde mat(delim: "[", tilde(a)_1^1, tilde(a)_2^1, dots, tilde(a)_n^1; 0, tilde(a)_2^2, dots, tilde(a)_n^2; dots.v, dots.v, dots.down, dots.v; 0, 0, dots, ?)$\ $"rank" A$ --- кол-во отличных от нуля строк #pagebreak() = Тензорное произведение $make X(K), space Y(K)$ --- ЛП над $K$ #nl $dim_K X = n$ #nl $dim_K Y = m$ #nl $make Z(K)$ --- ЛП над $K$ #nl $make b: X times Y -> Z$ --- билинейное отображение #nl $forall x_1, x_2, x in X(K) quad y_1, y_2, y in Y(K) quad forall lambda in K$ - $b(x_1 + x_2, y) = b(x_1, y) + b(x_2, y)$ - $b(x, y_1 + y_2) = b(x, y_1) + b(x, y_2)$ - $b(lambda x, y) = lambda b(x, y) = b(x, lambda y)$ #nl #nb $x in X(K) quad exists {e_i}_(i=1)^n$ --- базис $X(K)$ #nl $display(y in Y(K) quad exists {g_j}_(j=1)^m)$ --- базис $Y(K)$ #nl $x = display(sum_(i=1)^n xi^i e_i quad y = sum_(j=1)^m eta^j g_j)$ #nl $b(x, y) = sum_(i=1)^n sum_(j=1)^n xi^i eta^j b(e_i, g_j) = sum_(i=1)^n sum_(j=1)^n xi^i eta^j h_(i j), quad h_(i j) in Z(K)$ #nl #nl #nl #nb $b(x_1, y_1) + b(x_2, y_2) = b(?, ?)$ #nl#nl#nl // может следать переменную для длины и писать типа #v(3 f")? //ниасилил // 3*sp? #lm Следующие условия эквивалентны: + ${b(e_i, g_j)}_(i=1dots n)^(j=1dots m)$ --- базис $Z(K)$ + $forall z in Z(K) quad exists! z = sum_(i=1)^n b(e_i, y_i), quad y_i in Y(K)$ + $forall z in Z(K) quad exists! z = sum_(j=1)^m b(x_j, g_j), quad x_j in X(K)$ #proof $(1) <=> (2)$:\ ${b(e_i, g_j)}$ --- базис $Z(K) => forall z quad z eq^! sum_(i=1)^n sum_(j=1)^m zeta^(i j) b(e_i, g_j) = sum_(i=1)^n b(e_i, sum_(j=1)^m zeta^(i j) g_j) = sum_(i=1)^n b(e_i, y_i)$ $(1) <=> (3)$ аналогично. #v(3*sp) #def тензорное произведение #nl $X(K), space Y(K)$ --- линейные пространства #nl $times.circle: X times Y --> X times.circle Y$ --- билинейное отображение, такое что:#nl Если ${e_i}^n_(i = 1)$ --- базис $X(K)$ и ${g_j}_(j = 1)^m$ --- базис $Y(K) quad => {e_i times.circle g_j}_(i = 1 dots n)^(j = 1 dots m)$ --- базис $T = X times.circle Y$ #nl $T(K)= X(K) times.circle Y(K)$ --- _тензорное произведение_ #v(0.6cm) #nb #nl $x in X(K), space y in Y(K)$#nl $x times.circle y = (sum_(i=1)^n xi^i e_i) times.circle (sum_(j=1)^m eta^j g _j) = sum_(i = 1)^n sum_(j = 1)^m limits(xi^i eta^j)_(" координаты тензора" z " ") limits((e_i times.circle j_j))_(" базис" T=X times.circle Y " ")$ #v(0.6cm) #def разложимый (факторизуемый) элемент #nl Элемент $z in T$ называется разложимым, если $exists x in X(K), y in Y(K)$, что $z = x times.circle y$, иначе $z$ называется неразложимым #v(0.6cm) #ex #nl Неразложимый: $z = x_1 times.circle y_1 + x_2 times.circle y_2$ #nl Разложимый: $z = x_1 times.circle y_1 + x_1 times.circle y_2 = x_1 times.circle (y_1 + y_2)$\ #v(0.6cm) #nb #nl Общий вид элемента $Z(K)$: #nl $z = sum_(i=1)^n sum_(j=1)^m zeta^(i j) e_i times.circle g_j$ #v(0.6cm) #ex #nl $n=3, space m=2$#nl $[zeta^(i j)] = mat(delim: "[", 1, 2; 3, 1; 4, 2)$#nl $z=e_1 times.circle g_1 + 2 e_1 times.circle g_2 + 3 e_2 times.circle g_1 + e_2 times.circle g_2 + 4 e_3 times.circle g_1 + 2 e_3 times.circle g_2$ #v(0.6cm) #nb #nl // ты хоть что-нибудь понимаешь? //? //ну я чё-то выпадаю из темы // я еще не вошел $dim_K T = dim_K X dot dim_K Y$ #v(0.6cm) #th (_основная теорема тензорной алгебры_)#nl Для любого билинейного отображения $b: X times Y -> Z $#nl $exists! $ билинейное отбражение $tilde(b): X times.circle Y -> Z$ такое, что следующая диаграмма коммутативна #nl $X times Y -->^times.circle X times.circle Y$\ $#h(0.6cm)b arrow.br Z arrow.bl tilde(b)$ #nl #see $b space = space tilde(b) space circle.small space times.circle$ #v(0.6cm) #proof #nl $tilde(b)(e_i times.circle g_j) = b(e_i, space g_j)$ и продолжим по линейности #v(0.6cm) #lm #nl $X times.circle Y tilde.eq Y times.circle X$ #nl $X times.circle (Y times.circle Z) tilde.eq (X times.circle Y) times.circle Z$ #v(0.6cm) #nb #nl Обобщение теоремы: #nl $make X_1 dots X_p$ --- ЛП над $K$ #nl Для любого $p$-линейного отображения $omega space exists! space tilde(omega)$ --- линейное, такое что следующая диаграмма коммутативна: $x_1 times dots times x_p -->^times.circle x_1 times.circle dots times.circle x_p$\ $#h(1.2cm)omega arrow.br quad z quad arrow.bl tilde(omega)$ // можешь пока закидывать скриншоты лекции как диаграммы, я потом с этим что-нибудь сделаю // чем тебе это не нравится? #v(0.6cm) #nb #nl $make X^*(K), space Y(K)$ #nl $see X^* times Y -> X^* times.circle Y$ #nl $(alpha, space y) |-> alpha(*) y in "Hom"_K (X, Y)$ #nl $make x in X quad x|-> alpha(x)y$#nl #rect($X^* times.circle Y tilde.eq "Hom"_K (X, Y)$) $X^* tilde.eq "Hom" (X, K)$ #v(0.6cm) #nb #nl $X^* (K), Y^* (K)$#nl $X^* times Y^* -> X^* times.circle Y^*$#nl $(alpha, beta) |-> alpha times.circle beta in "Hom"_K (X, Y; K)$\ #rect($X^* times.circle Y^* tilde.eq "Hom" (X, Y; K)$) $alpha times.circle beta <-> omega in Omega_0^2 (K) quad omega(x, y) = alpha(x) dot beta(y)$ #v(0.6cm) $X times Y -> X times.circle Y tilde.eq "Hom"(X^* Y^*; ???)$ #nl//? $(x, y) -> x times.circle y$ #nl $(x times.circle y) (alpha, beta) = alpha(x) dot beta(y)$\ $alpha in X^*$\ $beta in Y^*$\ $x times.circle y <-> omega in Omega_0^2 (K)$\ = Пространство тензоров #def пространство тезноров#nl $make X(K)$ --- ЛП над $K$ #nl $limits(underbrace(X^* times.circle X^* times.circle dots times.circle X^*))_p times.circle limits(underbrace(X times.circle X times.circle dots times.circle X))_q$ #v(0.6cm) #nb #nl Обозначение $T_q^p (K) (Omega_p^q)$\ #v(0.6cm) #ex\ $T_0^1 (K) = X^*$ #nl $T_1^0 (K) = X$ #nl $T_1^1 = X^* times.circle X tilde.eq "End"_K (X)$ #v(0.6cm) #def тензор ранга $(p, q)$#nl Тензором ранга $(p, q)$ называется элемент пространства тензоров $T_q^p (K)$ #nl #v(0.6cm) #ex #nl #let tens = $op(times.circle)$ $alpha^1 tens alpha^2 tens dots tens alpha^P tens y_1 tens y_2 tens dots tens y_q in T^p_q (K)$ #v(0.6cm) == Операции с тензорами + Транспонирование #nl $t_(i j): T^p_q -> T^p_q$ #nl $dots tens x_i tens dots tens x_j tens dots |-> dots tens x_j tens dots tens x_i tens dots$#nl $t^(i j): T^p_q -> T^p_q$#nl $dots tens alpha^i tens dots tens alpha^j tens dots |-> dots tens alpha^j tens dots tens alpha^i tens dots$#nl + Свёртка #nl $hat(c)_j^i: T^p_q -> T^(p-1)_(q-1)$ #nl $dots tens alpha^i tens dots tens x_j tens dots |-> dots tens alpha^i(x_j) in K tens dots$#nl + $make T$ --- пр-во вех тензоров (всех рангов) #nl $u = alpha^1 tens alpha^2 tens dots tens alpha^(p_1) tens x_1 tens dots tens x_(q_1) $#nl $v = beta^1 tens beta^2 tens dots tens beta^(p_2) tens y_1 tens dots tens y_(q_2) $#nl $u tens v = alpha^1 tens dots tens alpha^(p_1) tens beta^1 tens dots tens beta^(p_2) tens x_1 tens dots tens x_(q_1) tens y_1 tens dots tens y_(q_2)$#nl #v(0.6cm) #lm #nl $Omega_p^q (K) tilde.eq T_q^p (K)$ #nl #v(0.6cm) #proof $make omega in T_q^p (K) => omega = alpha^1 tens dots tens alpha^p tens y_1 tens dots tens y_q$ #nl $#h(0.25cm) make W in Omega_p^q (K)$ #nl $x_1, dots, x_p in X; quad beta^1, dots, beta^q in X^*$\ #nl $W(x_1, x_2, dots, x_p, beta^1, beta^2, dots, beta^q) eq.circle alpha^1 (x_1) alpha^2 (x_2) dots alpha^p (x_p) beta^1 (y_1) beta^2 (y_2) dots beta^q (y_q)$ #v(0.6cm) #nb Базис $T^p_q (K)$: $f^(i_1) tens f^(i_2) tens dots tens f^(i_p) tens e_(j_1) tens e_(j_2) tens dots tens e_(j_q)$\ #nl Базис $Omega_p^q (K)$: $f^(i_1) dot f^(i_2) dot dots dot f^(i_p) dot hat(e)_(j_1) dot hat(e)_(j_2) dot dots dot hat(e)_(j_q)$\ #v(0.6cm) #ex\ #nl $hat(c)^i_j: X^* tens X -> K$\ #nl $#h(0.65cm)alpha tens x |-> alpha(x)$ #nl // бля // я даже если перестаю конспектить и просто пытаюсь понять не догоняю // ебать че происходит // это были последние строчки этого конспекта... $see T^0_p (K)$\ #nl $x_1 tens x_2 tens dots tens x_p$\ #nl $"char" K = 0$\ #nl $"Sym": T^0_p (K) -> Sigma_p (K)$\ #nl $"Sym" (x_1 tens x_2 tens dots tens x_p) = 1/p! sum_(sigma in S_p) x_sigma(1) tens x_sigma(2) tens dots tens x_sigma(p)$\ #nl $"Alt": T_p^0 (K) -> Lambda_p (K)$\ #nl $"Alt" (x_1 tens x_2 tens dots tens x_p) = 1/p! sum_(sigma in S_p) (-1)^[sigma] x_sigma(1) tens x_sigma(2) tens dots tens x_sigma(p)$\ #nl #nb $make omega in T^p_q (K)$\ #nl $v = underbracket(tilde(v)_(i_1 i_2 dots i_p)^(j_1 j_2 dots j_q), "коорд.тензора"\ omega "в базисах" {e_i}_(i=1)^n\ и {f^j}_(j=1)^n) space f^(i_1) tens f^(i_2) tens dots tens f^(i_p) tens hat(e)_(j_1) tens dots tens hat(e)_(j_q)$\ #nl #nl $v = tilde(v)_(i_1 i_2 dots i_p)^(j_1 j_2 dots j_q) quad attach(W, tl: i_1 dots i_p, bl: j_1 dots j_q)$\ #nl #nl $(1, 2, 3)^T <-> 1 + 2 t + 3 t^2$\ #nl #v(0.2cm) == Тензорная алгебра $make X(K)$ --- ЛП над $K$\ #nl $see T^p_q (K) = (limits(times.circle.big)_(i=1)^p X^*) tens (limits(times.circle.big)_(j=1)^q X)$\ #nl $see T(K) = limits(plus.big)_(p=0)^infinity limits(plus.big)_(q=0)^infinity T^p_q (K)$\ #nl #v(0.4cm) #ex\ #nl $make X, Y$ --- ЛП\ #nl $#h(0.4cm)X plus.circle Y$ --- ЛП\ #nl $#h(0.4cm) (x_1, y_1) + (x_2, y_2) = (x_1 + x_2, y_1 + y_2)$\ #nl $#h(0.4cm) lambda(x, y) = (lambda x, lambda y)$\ #nl $(T, +, tens, lambda)$ --- тензорная алгебра\ $omega_01 in T^0_1, v_01 in T^0_1 => omega_01 tens v_01 in T^0_2$\ $x tens (y+z)=x tens y + x tens z$\ $(Lambda, +, and, lambda)$ --- алгебра антисимм. тензоров\ $(Sigma, +, or, lambda)$ --- алгебра симметр. тензоров\ // допишешь? мне еще до итмо добраться надо // welp #pagebreak() // я пришедший без ручек и листочков //no way <NAME> // и ушёл // :( // Лев привет = Определитель линейного оператора $make X(K), space Y(K)$ --- ЛП над $K$\ $see phi: X(K) -> Y(K)$ --- линейное\ $forall space x_1, space x_2, space x in X(K)$\ $phi(X_1 + x_2) = phi(x_1) + phi(x_2)$\ $phi(lambda x) = lambda phi(x)$\ \ #nb $phi in "Hom"_K (X, Y)$\ $"Hom"_K (X, X) =: "End"_K (X)$\ // пиздец заебался болеть == Тензорное произведение операторов #def тензорное произведение линейных операторов\ $make phi in "End"_K (X), space psi in"End"(Y)$\ $chi: phi times.circle psi$ --- _тензорное произведение линейных операторов_, если\ $chi: X tens Y -> X tens Y$\ $chi(x tens y) |-> (chi tens psi) (x tens y) = phi(x) tens psi(y)$\ \ #lm $chi in "End"_(X tens Y)$\ \ #proof - $chi(x tens (y_1 + y_2)) = chi(x tens y_1 + x tens y_2)$\ $chi(x tens (y_1 + y_2)) = phi(x) tens psi(y_1 + y_2) = phi(x) tens (psi(y)_1 + psi(y_2))=phi(x)tens psi(y_1) + psi(x) tens psi(y_2)=$\ $=chi(x tens y_1 + chi(x tens y_2))$\ $chi(lambda x tens y) = chi ((lambda x) tens y) = phi(lambda x) tens psi(y) = lambda[phi(x) tens psi(y)] = lambda dot chi(x tens y)$ \ \ == Матрица линейного оператора $make {e_i}^n_(i = 1)$ --- базис X $make phi in "End"_K (X)$\ $e_i = sum_(j=1)^n a_i^j e_j$\ \ #def матрица линейного оператора\ Набор $A_phi = norm(a_i^j)$ --- матрица линейного оператора в базисе $(e_i)_(i=1)^n$\ #v(0.5cm) $A_phi = limits(display(mat(delim: "[", a_1^1, a_2^1, dots, a_n^1; a_1^2, a_2^2, dots, a_n^2; dots.v, dots.v, dots.down, dots.v; a_1^n, a_2^n, dots, a_n^n)))_(arrow.t quad quad arrow.t quad quad quad space arrow.t\ phi e_1 space phi e_2 space dots space space phi e_n)$\ #v(0.5cm) $make {g_l}^m_(l=1)$ --- базис $Y(K)$\ $make psi in "End"_K (Y)$\ $make B_psi = ||b_l^k||$ --- матрица $psi$ в базисе ${g_l}_(l=1)^m$ \ \ #nb #grid( columns: (95pt, 1fr), [${e_i}_(i=1)^n$ --- базис $X$\ ${g_j}_(j=1)^m$ --- базис $Y$\ ], [#v(0.35cm) #align(left)[ $=> {e_i tens g_j}_(i=1 dots n)^(j=1 dots m)$ --- базис $X tens Y$\ ]]) #v(0.2cm) $(phi tens psi)(e_i tens g_j) = phi(e_i) tens psi(g_j) = (sum_(k=1)^n a_i^k e_k) tens (sum_(l=1)^m) b_j^l g_l = sum_(k=1)^n sum_(l=1)^m a_i^k b_j^l (e_k tens g_l)$\ $C_(phi tens psi) = norm(a_i^k tens b_j^l)_(i,k=1 dots n)^(j,l=1 dots m)$ --- матрица тензорного произведения.\ В кронекеровской форме:\ $display(mat(delim: "[", a_1^1 B_psi, a_2^1 B_psi, dots; a_2^1 B_psi, a_2^2 B_psi, dots; dots.v, dots.v, dots.down))$ \ \ == Тензорная степень $make X(k)$ --- ЛП над $K$\ $phi in "End"_K (X)$\ $see T_p (K) = limits(times.circle.big)_(i=1)^n X := underbrace(X tens X tens dots tens X, p)$ // крокодильчик \ \ #nb Элементы (разложимые) имеют вид:\ $x_1 tens x_2 tens dots x_p$ \ \ #def тензорная степень\ Тензорная степень оператора $phi$ --- линейное отображение вида:\ $ phi^(tens p): limits(times.circle.big)_(i=1)^p X -> limits(times.circle.big)_(i=1)^p X $ $ phi ^(tens p) (x_1 tens x_2 tens dots tens_p) = phi x_1 tens phi x_2 tens dots tens phi x_p $ \ == Внешняя степен#text(fill: rgb(80%, 80%, 80%))[ь] оператора //(ь)??? а ты посмотри что на доске // ахаха, степен //пиздец $see Lambda^p := underbrace(X and X and dots and X, p) = limits(and.big)_(i=1)^p X$\ #v(0.5cm) $dim_K X = n quad => quad dim_K Lambda^p = C_n^p$ \ \ #nb Элементы $Lambda^p$ имеют вид:\ $ x_1 and x_2 and dots x_p $ \ #def определитель набора векторов\ Определителем набора векторов ${x_i}_(i=1)^n$ называется величина такая, что в базисе ${e_i}_(i=1)^n$ имеет место \ $ x_1 and x_2 and dots and x_n = det [x_1 x_2 dots x_n] e_1 and e_2 and dots and e_n $ #lm $det {x_1 dots x_n} = det [x_1 dots x_n]$\ \ #proof $x_1 and x_2 and dots and x_n = xi_1^(i_1) e_i_1 and xi_2^(i_2) e_i_2 and dots and xi_n^(i_n) e_i_n = xi_1^(i_1) xi_2^(i_2) dots xi_n^(i_n) e_i_1 and e_i_2 and dots and e_i_n$ \ $=display( sum_(sigma in S_n) (-1)^[sigma] xi_1^sigma(1) xi_2^sigma(2) dots xi_3^sigma(3) e_1 and e_2 and dots and e_n) = det {x_1 dots x_n}e_1 and e_2 and dots and e_n $ \ \ #nb $det [x_1 dots x_n]$ зависит от базиса\ $make z in Lambda^n => z = alpha dot e_1 and e_2 and dots and e_n$ #image("4.png", width: 20%) // да, кста, лев // сюда картинки на изи через контроол-в закидываются // переименовывать только ${e'_j}_(j=1)^n <-^T {e_i}_(i=1)^n, e'_j = sum_(i=1)^n tau^i_j e_i$\ $e'_1 and e'_2 and dots and e'_n = tau_1^(i_1) e_i_1 and tau_2^(i_2) e_i_2 and dots and tau_n^(i_n) e_i_n = tau_1^(i_1) tau_2^(i_2) dots tau_n^(i_n) e_i_1 and e_i_2 and dots and e_i_n=$\ $=sum_(sigma in S_n) tau_1^sigma(1) tau_2^sigma(2) dots tau_n^sigma(n) e_1 and e_2 and dots and e_n$ \ \ \ #def внешняя степень оператора\ Внешняя степень оператора $phi$ --- лиphiйное отображение вида: // лирhiйное отображение? $ t phi(and p): and.big_(i=1)^p X -> and.big_(i=1)^p X $\ $ phi^(and p) (x_1 and x_2 and dots and x_p) = phi x_1 and phi x_2 and dots and phi x_p $ \ #def определитель линейного оператора\ Определитель линейного оператора $phi$ --- величина $det phi$, такая, что: $ phi(e_1 and e_2 and dots and e_n) = phi e_1 and phi e_2 and dots and phi e_n = det phi e_1 and e_2 and dots and e_n $ \ #lm $phi, psi in "End"_K (X) => det (phi apply psi) = det (phi) dot det (psi)$ \ \ #proof $(phi apply psi) (e_1 and e_2 and dots and e_n) = (phi apply psi) e_1 and (phi apply psi) e_2 and dots and (phi apply psi) e_n = phi(psi(e_1)) and phi(psi(e_2)) and dots and phi(psi(e_n))=$\ $=phi^(and n) (psi e_1 and psi e_2 and dots and psi e_n = det phi dot (psi e_1 and psi e_2 and dots and psi e_n)= det psi dot psi^(and n) (e_1 and e_2 and dots and e_n)=$\ $=det phi dot det psi (e_1 and e_2 and dots and e_n)$ \ \ #nb Определитель $det phi$ равен определителью матрицы $A_phi$ соответствующего оператора в базисе ${e_i}_(i=1)^n$ \ \ #lm $det phi$ сто пудов не зависит от базиса // сто пудов это тяжело \ \ #proof $make z in Lambda^n quad => quad phi^(and n) z = det phi dot z $\ если $z = underbracket(alpha space underbracket(e_1 and e_2 and dots and e_n, "верно"), "верно")$ \ \ *ДЗ:* \ // выучить ебаные команды // можешь это в принципе поделать :) $tilde(A)phi - S A_phi T quad quad det S = (det T)^(-1)$ // Привет Тимур // привет // че происходит // ваня опзадывает // а ты тоже дома? // да // интересно получилось))) // я встал минут 15 назад // +++ я проспал, и решил что нахер оно надо идти, Ваня точно трансляцию сделает // :DDDDDD // че, расходимся? //это пиздец //я встал в 9:50 //в 10 я уже был на улице //я никогда так быстро не бегал с тяжёлым ноутом за спиной // в принципе даже успел #pagebreak() = Линейный оператор == Основные определения $make X(K), Y(K)$ --- ЛП над $K$\ $see X(K) -> Y(K)$ --- отображения\ $forall x, x_1, x_2 in X(K) quad forall alpha in K$\ 1. $phi(x_1 + x_2) = phi(x_1) + phi(x_2)$ 2. $phi(alpha x) = alpha phi(x)$ #ex #columns(2)[ + $make I: X(K) -> X(K) - "тождественный оператор" $\ $forall x in X(K) quad I x =x $\ + $Theta: X(K) -> X(K):$ \ $forall x in X(K) quad Theta x = 0_x$ + $make f in X^(*) (RR) $ \ $space f:X -> RR $ + $X(K) = L xor M => forall x in X$\ $see cal(P)_L^(parallel M) (x) = x_L$ --- проектор,\ аналогично $cal(P)_M^(parallel L) (x) = x_M$ + $X = K[x]_n$\ $see D: X(K) -> X(K)$\ $forall p in K[x]_n quad (D p)(x) = (dif p)/(dif x)$ + $X(K) = "Mat"_K (n)$\ $tau: X(K) -> X(K)$\ $forall A in "Mat"_K (n) quad tau(A) = A^T$ + $X = C[a, b] в$\ $(L f)(x) = display(limits(integral)_a^b) underbrace(l(x, y), " ядро инт.\nоператора\n (core)") f(y) dif y$\ #ex\ $f(x) = sin x$\ $l(x, y) = e^(x + y)$\ $(L f)(x) = display(limits(integral)_0^pi) e^(x + y) sin y dif y$ #colbreak() $"Ker" I = {0}$\ $"Im" I = X$\ #v(0.3cm) $"Ker" Theta = {X}$\ $"Im" Theta = {0}$\ #v(0.3cm) $dim_K "Ker" f = n-1$\ $dim_K "Im" f = L$\ #v(0.3cm) $"Ker" cal(P)_L^(parallel M) = M$\ $"Im" cal(P)_L^(parallel M) = L$\ #v(01cm) $"Ker" D = {q in K[x]_n | deg q = 0}$\ $"Im" D = K[x]_(n-1)$\ #v(0.7cm) $"Ker" tau = {0}$\ $"Im" tau = "Mat"_K (n)$\ ] \ #nb Обозначение $phi in "Hom"_K (X, Y), phi in "End"_K (X)$ \ \ #def _Ядро линейного оператора_ \ $phi in "Hom"_K(X,Y)$ --- множество: $"Ker"phi = {x in X(K) | phi(x) = 0_Y}$ \ \ #lm $"Ker" phi <= X(K)$ \ \ #def _Образ линейного опреатора_\ Образ линейного оператора --- это множество $"Im"phi = {phi(x) | x in X(K)} = phi(X)$ \ \ #lm $"Im" phi <= Y(K)$ \ \ == (Первая) теорема о ядре и образе $make L(K) <= X(K)$ --- подпространство\ $see X slash L$ --- фактор-пространство вида ${limits(underbrace(x + L))_overline(x) | x in X}$\ $make{overline(v)_j}_(j = 1)^m$ --- базис фактора $X slash L$\ #v(0.4cm) $#h(18.5pt) arrow.t$ ЛНЗ в $X slash L => sum_(j = 1)^m lambda^j overline(v) = overline(0)<=> lambda^j = 0$\ #h(18.5pt) $arrow.t$ ПН\ #h(18.5pt) _Переформулируем:_\ #v(0.2cm) #h(18.5pt) Мы знаем, что $overline(v)_j = v_j + L, space overline(0) = L$, тогда\ #h(18.5pt) #box(stroke: 1pt, inset: (x: 3pt, y: 9pt))[$limits(sum)_(j = 1)^m lambda^j v_j in L <=> lambda^j = 0$] $#pad(top: -25pt, $(*)$)$ \ \ #def ЛНЗ относительно L\ //написано же уже здесь Набор ${v_j}_(j = 1)^m$, обладающий свойством (\*) //называется ЛНЗ относительно L \ \ #def набор "порождает" $X$ относительно $L$\ ${v_j}_(j = 1)^m$ порождает $X$ относительно $L <=>$ любой элемент может быть представлен в виде ЛК ${v_j}_(j = 1)^m$ и элементов из $L$ \ \ #th _следующие условия эквивалнтны_\ + ${v_j}_(j = 1)^m$ порождает $X$ относительно $L$ + ${overline(v)_j}_(j = 1)^m$ --- базис $X slash L$ + $X = angle.l v_1 dots v_m angle.r_K plus.circle L$\ \ #nb $dim_K X = dim_K L + dim_K X slash L quad (**)$\ \ #v(0.4cm) $make phi: X(K) -> Y(K)\ #h(27pt)X slash "Ker"tilde.eq "Im" phi$ _(теорема об изоморфизме)_ \ \ #th (О ядре и образе)\ $dim_K "Ker" phi + dim_K "Im" phi = dim_K X$ \ \ #proof В формуле ($* *$) положим $L = "Ker" Y$ и вспомним теорему об изоморфизме \ \ #nb $"Hom"_K (X, Y)$ --- линейное пространство над $K$\ $make phi, psi in "Hom"_K(X, Y)$\ + $phi = psi <=> forall x in X(K) quad phi(x) = psi(x)$ + $zeta = phi + psi,space$если\ $zeta(x) = (phi + psi)(x) = phi(x) + psi(x)$ // + $xi = lambda dot phi,space$если\ // $xi(x) = (lambda dot phi)(x) = lambda dot phi(x)$\ + $chi = lambda dot phi$, если\ $chi(x) = (lambda dot phi)(x) = lambda dot phi(x)$ \ $quest quad dim_K"Hom"(X, Y) = space ?$\ #columns(2)[ $make {e_i}_(i = 1)^n$ --- базис $X(K)$\ $make {g_j}_(j=1)^m$ --- базис $Y(K)$ #colbreak() $phi(e_i) = sum_(j=1)^m a_i^j g_j$\ ] \ #def матрица линейного оператора\ Набор $norm(a_i^j) = A_phi$ называется матрицей линейного оператора в паре базисов ${e_i}_(i=1)^n$ и ${g_j}_(j=1)^m$ \ \ $see x in X(K) quad x = sum_(i=1)^n xi^i e_i space => space$ $phi(x) = phi(sum_(i=1)^n xi^i e_i) = sum_(i=1)^n xi^i phi(e_i) = sum_(i=1)^n sum_(j=1)^m xi^i a_i^j g^j$\ \ $phi(x) = y in Y(K) quad y = sum_(j=1)^m eta^j g_j => eta^j = sum_(i=1)^n a_i^j xi^i => eta = A_phi xi$\ \ \ #def оператор матричной единицы\ ${attach(epsilon, bl: j, tl: i)}: space attach(epsilon, bl: j, tl: i)(x) = xi^i g_j, space x = limits(sum)_(i = 1)^n xi^i e_i$ \ \ #lm $attach(epsilon, bl: j, tl: i) in "Hom"_K (X, Y)$ \ \ #proof $forall x_1, x_2 in X(K): quad attach(epsilon, bl: j, tl: i)(x_1 + x_2) = (xi_1 + xi_2)&i g_j = xi_1^i g_j + xi_2^i g_j =attach(epsilon, bl: j, tl: i)(x_1) + attach(epsilon, bl: j, tl: i) (x_2)$\ $forall x in X(K) quad forall lambda in K: quad attach(epsilon, tl: i, bl: j) (lambda x) = (lambda xi)^i g_j = lambda dot xi^i g_j = lambda attach(epsilon, tl: i, bl: j) (x)$\ \ #nb $A_phi = [phi(e_1) space phi(e_2) space dots space phi(e_n)] quad quad attach(epsilon, bl: j, tl: i)(e_k) = e^i_k g_j = delta^i_k g_j$\ #h(45pt)$dots.v$#h(20pt)$dots.v$#h(45pt)$dots.v$\ #h(44pt)$arrow.t$#h(17pt)$arrow.t$#h(42pt)$arrow.t$\ #h(20pt)координаты в базисе $Y(K)$ \ \ #th\ ${attach(epsilon, bl: j, tl: i)}_(i = 1 dots n)^(j = 1 dots m)$ --- базис $"Hom"_K (X, Y)$ \ \ #proof ПН:\ $make phi in "Hom"_K (X, Y)$\ $see phi(x) = sum_(i=1)^n sum_(j=1)^m xi^i a_i^j g_j = sum_(i=1)^n sum_(j=1)^m a_i^j dot attach(epsilon, tl: i, bl: j) (x) => phi = sum_(i=1)^n sum_(j=1)^m attach(epsilon, tl: i, bl: j) dot a_i^j$\ \ ЛНЗ:\ $see sum_(i=1)^n sum_(j=1)^m attach(epsilon, bl: j, tl: i) beta_i^j = Theta quad | e_k$\ \ $sum_(i=1)^n sum_(j=1)^m attach(epsilon, tl: i, bl: j) (e_k) beta_i^j = 0$\ \ $sum_(i=1)^n sum_(j=1)^m delta_k^i g_j beta_i^j = 0$\ \ $sum_(j = 1)^m g_j beta_k^j = 0 => beta_k^j = 0 space forall j$ \ \ //#quote("За 10 минут мы ничего не узнаем, а вот в столовку опоздаем", attribution: "Трифанов", block: true) $attach(epsilon, tl:i, bl: j)$ --- базис $"Hom"_K (X, Y)$\ \ #nb $dim_K "Hom" (X, Y) = m n$\ \ #nb $make phi in "End"_K (X)$\ #v(0.4cm) $make {e_i}_(i=1)^n -->^T {tilde(e)_j}_(j=1)^n$ --- базисы $X$\ $#h(20pt)arrow.t#h(50pt)arrow.t$\ $#h(18pt)A_phi#h(40pt)tilde(A)_phi$\ #box(stroke: 1pt, inset: (x: 3pt, y: 9pt))[$tilde(A)_phi = S A_phi T$] \ \ #proof\ $phi(tilde(e)_j) = phi(limits(sum)_(i = 1)^n tau^i_j e_i) = limits(sum)_(i = 1)^n tau_j^i phi(e_i) = limits(sum)_(i = 1)^n limits(sum)_(s = 1)^n tau_j^i a_i^s e_s$\ \ $phi(tilde(e)_j) = sum_(i=1)^n tilde(a)_j^i tilde(e)_i = sum_(i=1)^n sum_(s=1)^n tilde(a)_j^i tau_i^s e_s$ \ \ $limits(sum)_(i = 1)^n limits(sum)_(s = 1)^n tau_j^i a_i^s e_s = limits(sum)_(i=1)^n limits(sum)_(s=1)^n tilde(a)_j^i tau_i^s e_s$ \ \ $A_phi T = T tilde(A)_phi => tilde(A)_phi = S A_phi T $ \ \ #quote("Представьте себе, что у вас все гораздо хуже")\ \ *Д/З:*\ $phi in "Hom"_K (X, Y)$\ ${e_i}_(i=1)^n -->^(T_1) {tilde(e)_j}_(j=1)^n$\ ${g_s}_(s=1)^m -->^(T_2) {tilde(g)_t}_(t=1)^m$\ \ $A_phi -->^? tilde(A)_phi$\ \ // ДЗ писать вообще? = Алгебра линейных операторов $#make X(K), space Y(K), space Z(K)$\ $make phi in "Hom"_K (X, Y), space psi in "Hom"_K (Y, Z)$ $ X -->^phi Y -->^psi Z $ #def коядро\ $Y slash "Im" phi = "coker" phi$ --- коядро\ \ #def _композиция операторов_\ Композицией операторов $phi$ и $psi$ называется отображение $chi = psi apply phi$, такое что\ $forall x in X(K) quad chi(x)=(psi apply phi)(x) = psi(phi(x))$\ \ #lm $chi in "Hom"_K (X, Z)$\ \ #proof $chi(x_1 + x_2) = (psi apply phi)(x_1 + x_2) = psi(phi(x_1 + x_2)) = psi(phi(x_1) + phi(x_2)) = psi(phi(x_1)) + psi(phi(x_2)) = chi(x_1) + chi(x_2)$\ $chi(lambda x) = (psi apply phi)(lambda x) = psi(phi(lambda x)) = psi(lambda phi(x)) = lambda psi(phi(x)) = lambda chi(x)$\ \ $make {e_i}_(i=1)^n$ --- базис $X$\ $make {g_j}_(j=1)^m$ --- базис $Y$\ $make {h_s}_(s=1)^p$ --- базис $Z$\ \ ${e_i}_(i=1)^n -->^(phi <-> A_phi) {g_j}_(j=1)^m$\ ${g_j}_(j=1)^m -->^(psi <-> B_psi) {h_s}_(s=1)^p$\ ${e_i}_(i=1)^n -->^(chi <-> ? space C_chi) {h_s}_(s=1)^p$\ $chi(e_i) = (psi apply phi)(e_i) = psi(phi(e_i)) = psi(sum_(j=1)^n a_i^j g_j) = sum_(j=1)^m a_i^j psi(g_j) = sum_(j=1)^m sum_(s=1)^p a_i^j b_j^s h_s$\ $chi(e_i) = sum_(s=1)^p c_i^s h_s$\ \ $=> c_i^s = sum_(j=1)^m a_i^j b_j^s$\ #box(stroke: 1pt, inset: (x: 3pt, y: 7pt))[$C_chi = B_psi A_phi$]\ \ \ $phi in"End"_K(X)$ \ \ *Свойства* "$apply$" на $"End"_K (X)$: + $forall phi, psi, chi in "End"_K (X) quad phi apply (psi apply chi) = (phi apply psi) apply chi$ + $exists I in "End"_K (X): forall phi in "End"_K (X) quad I apply phi = phi = phi apply I$ #nb $("End"_K (X), apply)$ --- моноид + абелева группа, а значит кольцо операторов над $X(K)$, а значит $"End"_K(X)$ --- алгебра эндоморфизмов пространства $X$.\ $phi apply psi != psi apply phi$ --- некоммутативная алгебра \ \ #nb $A$ --- алгебра (например $RR, CC, HH$)\ \ *Кватернионы*\ $z = a + i b, space a,b in RR$\ $q = z + j w, space z,j in CC$\ $i space j quad i dot j =: k$\ $q = a + b i + c j + d k$\ Таблица Кэли для произведения: #grid(inset: 4pt, align: center, stroke: 1pt, columns: (auto, auto, auto, auto, auto), $dot$, $1$, $i$, $j$, $k$, $i$, $i$, $-1$, $k$, $-j$, $j$, $j$, $-k$, $-1$, $i$, $k$, $k$, $j$, $-i$, $-1$) \ \ *Об алгебре*\ $make {e_j}_(j = 1)^n$ --- базис алгебры $A$\ \ $x = sum_(i = 1)^n xi^i e_i quad y = sum_(j = 1)^n eta^u e_j$\ $x dot y = (sum_(i = 1)^n xi^i e_i) dot (sum_(j = 1)^n eta^j e_j) = sum_(i = 1)^n sum_(j = 1)^n xi^i eta^j overbrace((e_i dot e_j), =sum_(s=1)^n m_(i j)^s e_s)$\ \ $norm(m_(i j)^s)$ --- структурные константы алгебры\ $"End"_K (X)$ --- алгебра\ ? $(phi + psi) apply chi = phi apply chi + psi apply chi$\ ? $phi apply (lambda psi) = (lambda phi) apply psi = lambda (phi apply psi)$\ $"End"_K (X) tilde.eq "Mat"_K (n), quad n = dim_k X$\ $phi quad {e_j}_(j=1)^n quad attach(epsilon, tl: i, bl: j) quad phi = attach(epsilon, tl: i, bl: j) a_i^j --> A = norm(a_i^j)$\ $phi <--> A_phi, space psi <--> B_psi => phi + psi <--> A_psi + B_psi, space phi apply psi <--> A_phi dot B_psi$\ $"Mat"_K (n)$ --- алгебра матриц $n times n$\ $cal(P)_L x = cal(P)_L (x_L + x_M) = x_L$\ \ // В этой алгебре есть ВСЁ) _Обратный оператор_\ $make phi in "Hom"_K (X, Y)$\ $attach(see, tl: ?) tilde(phi): "Im" phi --> X$ --- отображение\ $forall x in X quad (tilde(phi) apply phi) x = x$\ $forall y in "Im" phi quad (tilde(phi) apply phi) y = y$\ Получилось, что $tilde(phi)$ --- линейный операторр:\ $see phi(tilde(phi)(y_1) +tilde(phi)(y_2)) = phi(tilde(phi)(y_1)) + phi(tilde(phi)(y_2)) = y_1 + y_2$\ $tilde(phi)(y_1) + tilde(phi)(y_2) = tilde(phi)(y_1 + y_2)$\ \ #def Обратимый оператор\ Оператор $phi$ называется обратимым, если существует оператор $tilde(phi)$, обладающий всеми перечисленными выше свойствами\ \ #def Обратный оператор\ Оператор $phi^(-1)$ называется обратным к оператору $phi$, если:\ + $forall x in X quad (phi^(-1) apply phi)x = x <=> phi ^(-1) apply phi = id_X$ + $forall y in Y quad (phi apply phi^(-1)) y = y <=> phi apply phi^(-1) = id_Y$ \ #lm Чтобы существовал обратный оператор, необходимо, чтобы $Y tilde.eq X$\ \ #proof $exists phi^(-1) => phi$ --- биекция $=> phi$ --- изоморфизм \ \ #th $exists space phi^(-1) <=> $ выполнено одно из (эквивалентных) условий: + $"Ker" phi = {0}$ + $dim_K "Im" phi = dim_K X$ // победа // можно собираться ехать на праку #pagebreak() //хрррр... ми-ми-ми (-\_- $)^(z space z space z dots)$ ``` z z z... (_ _ ) ``` #image("image.png", width: 10%) // understandable, have a nice night залил на гит прямо со спунами #pagebreak() = Обратная матрица == Общие положения $A(K)$ --- алгебра над $K$\ #columns(2)[ #def унитальная алгебра\ Алгебра A(K) --- _унитальная_, если\ $exists space 1 in A(K)$\ $forall a in A(K): quad a dot 1 = a = 1 dot a$\ #colbreak() *Примеры единиц:* + $RR quad 1_RR = 1$ + $CC quad 1_CC = (1, 0) <-> 1+0_i$\ + $HH quad 1_HH = (1, 0p, 0) <-> 1+0_i + 0_j + 0_k$\ + $K[x] quad 1_(K[x]) = 1 + 0t + 0t^2 + dots$ + $X, "End"_K(X) quad 1 = id_x$\ + $"Mat"_K (n) quad 1 = E = "diag"{1 space 1 space dots space 1}$\ \ ] #columns(2)[ #def обратный элемент\ Элемент $b$ называется обратным к элементу $a in A$, если\ $a b = 1_A$ (правый обратный)\ $с a = 1_A$ (левый обратный)\ #colbreak() #nb Если $b$ является правым обратным и левым обратным, то\ $b = c = : a^(-1)$ ]\ == Обратимость в $"Mat"_k (n)$ $make A in "Mat"_K (n)$\ #columns(2)[ #def обратимая матрица\ $A$ --- _обратимая матрица_, если\ $exists space B, C in "Mat"_K (n): quad A B = E quad C A = E$\ \ #colbreak() #nb $B = C =: A^(-1)$ ] #columns(2)[ #th\ $exists space A^(-1) <=> det A eq.not 0$\ \ #colbreak() #nb $A$, если $det A eq.not 0$ называется _невырожденной_ ] #proof $=> quad make exists B: quad A B = E$\ #v(0.4cm) $A = norm(a_j^i) quad B = norm(b_j^i) quad E = norm(delta_j^i)$ --- _символ Кронекера_\ #v(0.4cm) $sum_(j = 1)^n a_j^i dot b _k^j = delta_k^i, quad make k$ --- фиксированный\ #v(0.4cm) $make b_k^j = : xi^j, quad delta_k^i = c^i = (0 space 0 space dots space limits(1)^limits(or)^k space 0 space 0)$\ #v(0.4cm) $<=>$ $sum_(j = 1)^n a_j^i dot xi^j = c^i$ --- СЛАУ на $k$-й столбец $B$\ #columns(2)[ #h(3.1cm) - неоднородная (по построению)\ #h(3.1cm) - совместная\ #h(3.1cm) - определенная (по условию)\ #colbreak() \ #v(0.4cm) $=>$ Система Крамера ] $<=>$ по теореме Крамера $det norm(a_j^i) = det A eq.not 0$\ \ #nb $exists space c ? quad C A = E space quad A^T C^T = E^T = E quad space det A^T = det A eq.not 0$ \ \ == Вычисления обратной матрицы #columns(2)[ === Метод Крамера #v(0.2cm) $A^(-1) = 1/(det A) dot tilde(A)^T,$ где $tilde(A)$ --- матрица алгебраического дополнения матрицы $A$\ #v(0.4cm) $A = norm(a_j^i), space tilde(A) = norm(A_j^i), space A_j^i = (-1)^(i + j)M_j^i$\ #v(0.4cm) $(star)$ --- система Крамера\ #v(0.4cm) $xi^j = (Delta j)/Delta = det(c -> a_j)/(det A)$\ #v(.55cm) $det(c -> a_j) = display(attach(mat(delim: "|", dots, dots, 0, dots, dots; dots, dots, 0, dots, dots; dots, dots, dots.v, dots, dots; dots, dots, 1, dots, dots; dots, dots, dots.v, dots, dots; dots, dots, 0, dots, dots; ), br: #pad(top: -65.5pt)[$<- k$], b: arrow.t\ k)) = A_j^k$ \ \ #colbreak() === Метод Гаусса $(A|E) limits(-->)_("преобразования Гаусса (элементарные)") (E|A^(-1))$\ #v(0.4cm) *Элементарные преобразования* 1. перестановка строк\ 2. умножение строки на число $!= 0$ 3. составление линейной комбинации строк $see A dot B = C <--> C_k^i = sum_(j=1)^n a^i_j b^j_k$\ $attach(display(mat(delim: "[", #text(white)["t"], #text(white)["t"] ; #text(white)["t"], #text(white)["t"] ; #text(white)["t"], #text(white)["t"])), tl: #pad(top: 10pt)[$j -->$]) attach(limits(display(mat(delim: "[", #text(white)["t"], #text(white)["t"] ; #text(white)["t"], #text(white)["t"] ; #text(white)["t"], #text(white)["t"]))), b: arrow.t\ k) = attach(limits(display(mat(delim: "[", #text(white)["t"], #text(white)["t"] ; #text(white)["t"], #text(white)["t"] ; #text(white)["t"], #text(white)["t"]))), b: arrow.t\ k, tr: #pad(top: 10pt)[$<-- j$])$ \ \ #lm + Перестановка строк в A ведёт ту же перестановку в $C$ + Если строку $A$ умножить на $lambda in K =>$ то же происходит в $C$ + Составление линейной комбинации строк в $A =>$ то же в матрице $C$ #proof Очевидно. ] \ \ #def элементарная матрица\ $Q$ --- _элементарная_ матрица, если получена из матрицы $E$ элементарными пребразованиями\ #v(0.4cm) $Q = display(mat(delim: "[", 1, "", "", ""; "", 1, "", ""; "", "", dots.down, ""; "", "", "", 1 )) quad quad attach(underline(Q'), bl: 1) = display(mat(delim: "[", augment: #(vline: 2, hline: 2), 0, 1, "", "", ""; 1, 0, "", "", ""; "", "", 1, "", ""; "", "", "", dots.down, ""; "", "", "", "", 1 ))$\ $attach(underline(Q''), bl: 2) = display(mat(delim: "[", lambda, "", "", "", ""; "", 1, "", "", ""; "", "", 1, "", ""; "", "", "", dots.down, ""; "", "", "", "", 1 )) quad quad attach(underline(Q'''), bl: 3) = display(mat(delim: "[", 1, 0, 0, dots, dots; lambda, 1, 0, dots, dots; #text(white)["t"], "", "", "", ""; "", "", "", #text(white)["t"], ""; "", "", "", "", #text(white)["t"] ))$\ $A |-> underbrace(Q_n Q_(n-1) Q_(n-2) dots Q_1, A^(-1)) A = E$\ $E |-> A^(-1) E = A^(-1)$ \ \ = Сопряженный оператор #columns(2)[ $make phi in "Hom"_K (X, Y)$\ #v(0.4cm) $make X^*$ --- пространство, сопряженное $X$\ #v(0.4cm) $make Y^*$ --- пространство, сопряженное $Y$\ #v(0.4cm) $see phi^*: quad forall f in Y^* quad forall x in X$\ #v(0.4cm) #h(1.9cm)#box(stroke: 1pt, inset: 6pt)[$f(phi x) = (phi^* f) (x)$]\ #v(0.4cm) *Замечание: * $space phi^*: Y^* -> X^*$ #colbreak() *Лемма: * $space phi^*$ --- линейное отображение\ $see phi^*(f + g) /*limits(=)^? */ = phi^* f + phi^* g$\ #v(0.4cm) $forall x #h(.2cm) [phi^*(f + g)] (x) = (f+g)(phi x) = f(phi(x)) + g(phi(x)) = (phi^* f) (x) + (phi^* g)(x) = (phi^* f + phi^*g)(x)$\ #v(0.4cm) $see phi^*(lambda f) = lambda(phi^* f)$\ #v(0.4cm) $forall x #h(.2cm) [phi^* (lambda f)](x) = (lambda f)(phi(x)) = lambda(phi^* f) (x)$\ \ *Замечание: * $phi^* in "Hom"_K (Y^*, space X^*)$ ] #def сопряженный оператор\ Линейный оператор $phi^*$ называется сопряженным к $phi$\ \ $make {e_j}_(j=1)^n$ --- базис $X(K)$\ $make {g_i}_(i=1)^m$ --- базис $Y(K)$\ $phi <--> A_phi$\ $make {f^s}_(s=1)^n$ --- базис $X^* (K)$\ $make {h^t}_(t=1)^m$ --- базис $Y^* (K)$\ $phi^* <--> A_(phi^*)$\ $A_(phi^*) =^? dots A_phi$\ \ $f(phi(x)) = sum_(t=1)^m eta_t sum_(i=1)^n a^t_i xi^i = sum_(i=1)^n sum_(t=1)^m eta_t a^t_i xi^i = eta^T A_phi xi$\ $f <--> (eta_1 eta_2 dots eta_m)$\ $x <--> (xi^1 xi^2 dots xi^n)^T$\ // 1:03:39 #image("image.png") #pagebreak() = Алгебра скалярных полиномов #columns(2)[ $make phi in "End"_K (X)$\ *Определены*:\ - $phi + phi = 2 phi$ - $lambda phi, quad lambda in K$ - $phi^0 = id_X, phi^i = phi^(i-1) apply phi$\ #colbreak() #nb В $"End"_K (X)$ возникает кольцо $R_phi$:\ $ R_phi = {p(phi) | p in K[x]} =: K[phi] $ #nb $make p in K[x]: p(phi) = Theta$ ]\ \ == Основные конструкции #v(0.4cm) $K[x] = {sum_(n=0)^N a_n x^n | a_n in K, N in NN}$ --- кольцо многочленов над $K$\ #v(0.4cm) $forall p, q in K[x]:$ #columns(3)[ - $p + q in K[x]$\ $(p+q)(x) = p(x)+q(x)$ #colbreak() - $lambda p in K[x]$\ $(lambda p)(x) = lambda p(x)$ #colbreak() - $p q in K[x]$\ $(p q)(x) = p(x) q(x)$ ] Получилась коммутативная алгебра.\ - $0 in K[x] quad$ $0(t) = 0 + 0x + dots$\ $1 in K[x] quad$ $1(t) = 1 + 0x + dots$\ \ #def идеал в $K[x]$\ Идеалом в алгебре $K[x]$ называется линейное подпространство $J$/*от Jideal*/, которое обрадает следующим свойством: $ forall p in K[x] quad forall q in K quad p q in J\ J K[x] subset.eq J, 1 in K[x] => J K[x] = J $ #ex + $J_alpha = {p in K[x] | p(alpha) = 0}$ + $J_q = q K[x] = {p in K[x] | p op(dots.v) q}$\ $J_alpha = (x-alpha) K[x]$\ \ #def главный идеал\ Идеал вида $J_q = q K[x]$ называется _главным идеалом_: $ (q) = J_q = {q p | p in K[x]} $\ *Контрпример:* не главный идеал:\ #v(0.2cm) $(q_1 q_2) = {p_1 q_1 + p_2 q_2 | p_1, p_2 in K[x]}$\ \ #th\ $K[x]$ --- кольцо главных идеалов (PID) \ \ #proof #v(0.2cm) $K[x]$ --- евклидово кольцо: $deg p$\ #v(0.4cm) $forall p, q in K[x] quad exists p = g q + r, deg r < deg q$\ #v(0.4cm) $see J lt.eq.tri K[x]$\ #v(0.4cm) $make q in J, deg q$ --- наименьший в $J$\ #v(0.4cm) $see p in J => exists! p_(in J) = underbracket(g q, in K) + r_(in J), quad deg r < deg q$\ #v(0.4cm) $=> r = 0 => p = g dot q in q dot K[x]$\ \ $see J_q = q K[x]$\ \ #def порождающий многочлен идеала\ Многочлен $q$ называется порождающим многочленом идеала $J_q$\ \ *Контрпример:* Не PID: $K[x, y]$\ $(x, y) = alpha x + beta y + gamma x y + dots$\ \ #nb $J_q equiv (q)$ --- существует мин. многочлен $p = min(J_q)$\ \ #lm $q tilde p$ ($exists alpha in K[x]^*: p = alpha q$)\ \ #proof $q op(dots.v) p$, т.к. $p$ --- $min$\ $p op(dots.v) q arrow.l.double p in q K[x] quad exists g in K[x]: p = q g$\ \ #nb $q$ будем называть минимальным порождающим полиномом идеала $J_q$\ \ == Операции с идеалами $make alpha, beta lt.eq.tri K[x]$\ #def сумма идеалов\ $alpha + beta = {p = p_1 + p_2 | p_1 in alpha, p_2 in beta}$\ \ #lm $alpha + beta lt.eq.tri K[x]$\ \ #proof $make q in K[x], p in alpha + beta => p = p_1 + p_2$\ $q p = underbrace(q p_1, in alpha) + underbrace(q p_2, in beta) = tilde(p_1) + tilde(p_2)$\ $make p, p' in alpha + beta => p = p_1 + p_2, p' = p'_1 + p'_2 => p + p' = (p_1 + p'_1) + (p_2 + p'_2)$\ \ #def пересечение идеалов\ $alpha sect beta = { p | p in alpha, p in beta}$\ \ #lm $alpha sect beta lt.eq.tri K[x]$\ \ #proof $make q in K[x], p in alpha sect beta => p in alpha sect p in beta$\ $q p in alpha, q p in beta => q p in alpha sect beta$\ \ #def произведение идеалов\ $alpha dot beta = {sum p_i q_i | p_i in alpha, q_i in beta}$\ $alpha dot beta subset.eq alpha sect beta$\ $alpha dot beta = alpha sect beta <=> alpha + beta = 1$\ \ #def радикал идеала\ $r(alpha) = sqrt(alpha) = {p in K[x] | p^n in alpha, n in NN}$\ \ // "зачем я вам вообще это рассказываю?" #def частное идеалов\ $(a : b) = {p in K[x] | beta p subset.eq alpha}$\ \ #lm $make alpha = (p), beta = (q)$, тогда $alpha subset.eq beta => p op(dots.v) q$\ \ #proof $p in alpha subset.eq beta => p in beta = q K[x] => exists g in K[x], p = g q$\ \ #lm $alpha = (p), beta = (q)=> alpha + beta = (r), r = gcd(p, q)$\ \ #proof $tilde(r) = gcd(p, q)$\ $r in alpha + beta$, но $alpha + beta in.rev alpha => p op(dots.v) r$\ #h(2.32cm)$alpha + beta in.rev beta => q op(dots.v) r$\ $=> r = "cd"(p, q)$\ $p op(dots.v) tilde(r), q op(dots.v) tilde(r) => tilde(r) in alpha + beta, tilde(r) = p_(op(dots.v) r) a + q_(op(dots.v) r) b => tilde(r) op(dots.v) r => tilde(r) tilde r$\ \ #ex\ $alpha = (8), beta = (6) => alpha + beta = (2)$\ $alpha = (5), beta = (4) => alpha + beta = (1) = ZZ$\ \ #lm $alpha = (p), beta = (q) => alpha sect beta = (r) => r = "lcm"(p,q)$\ \ #proof $tilde(r) = "lcm"(p, q)$\ $alpha sect beta subset.eq alpha quad r op(dots.v) p$\ $alpha sect beta subset.eq beta quad r op(dots.v) q$\ $=> r = "cm"(p, q)$\ $tilde(r) in alpha sect beta => tilde(r) op(dots.v) r$\ \ #nb $make p_1, p_2 in K[x]: gcd(p_1, p_2) = d => exists q_1, q_2 in K[x]: p_1 q_1 + p_2 q_2 = d$\ \ #proof $alpha = (p_1), beta = (p_2)$\ $alpha + beta = (d)$\ \ #lm $make p_1, p_2 in K[x]: gcd(p_1, p_2) = 1 => exists q_1 q_2 subset.eq K[x]: p_1 q_1 + p_2 p_2 = 1$\ \ #th\ $make p_1, p_2, dots, p_m in K[x]: gcd(p_i, p_(j!=i)) = 1 => exists {q_i}_(i=1)^m in K[x]: sum_(i=1)^m p'_i q_i = 1, quad p'_i = p/p_i = (p_1 p_2 dots p_m)/p_i$\ \ #pagebreak() = Кольцо операторных полиномов == Введение $K[x]$ --- кольцо (алгебра) скалярных полиномов\ $K[x]$ --- кольцо главных идеалов\ $forall J lt.eq.tri K[x] quad exists p_J in K[t] quad J = (p_J)$\ ($p_J$ --- минимальный порождающий полином идеала $J$)\ \ #lm $make p_1, p_2 in K[t]: gcd(p_1, p_2) = 1 =>$\ $exists q_1, q_2 in K[t] quad p_1 q_1 + p_2 q_2 = 1$\ \ $make X(K)$ --- линейное пространство над $K$\ $make phi in "End"_K (X)$\ $forall sigma_phi quad K[x] --> "End"_K (X)$\ $p(x) = sum_(m=0)^infinity a_m x^m |->p(phi) = sum_(m=0)^infinity a_m phi^m$ \ \ #lm $sigma_y in "Hom"(K[x], "End"_K (x))$\ \ #proof $forall p, q in K[x]$\ $sigma_phi (p+q) = sigma_phi (p) + sigma_phi (q)$\ $sigma_phi (1) = cal(I) quad sigma_phi (1) = sigma_phi (x^0) = phi^0 = cal(I)$\ $sigma_phi (lambda p) = lambda sigma_phi (p)$ \ \ #nb $"Im" sigma_phi = K[phi] lt.eq.tri "End"_K (X)$ \ #v(0.2cm) #nb $"Ker" sigma_phi = {p in K[x] | p(phi) = theta}$\ $"Ker" sigma_phi$ --- пространство полиномов, аннулирующих оператор $phi$ \ \ #lm $"Ker" sigma_phi$ --- нетривиально\ #proof $make dim_K X = n => dim_K "End"_K (x) = n^2$\ $see {cal(I), phi, phi^2, dots, phi^n^2}$ --- ЛЗ набор $=> exists {lambda_m}_(m=0)^n^2: sum_(m=0)^n^2 lambda_m phi^m = theta => p(x) = sum_(m=0)^n^2 lambda_m x^m in "Ker" sigma_phi$ #nb $"Ker" sigma_phi lt.eq.tri K[t] => exists p_phi in "Ker" sigma_phi: "Ker" sigma_phi = (p_phi)$ #def минимальный аннулирующий многочлен\ Многочлен $p_phi$ называется _минимальным аннулирующим многочленом_ оператора $phi$.\ $ p_phi (phi) = theta $ #nb $make p, q in K[t] quad p-q quad p_phi <=> p(phi) = q(phi)$\ $make p = g p_phi + r => p(phi) = r(phi)$\ #box(stroke: 1pt, inset: 6.5pt)[$K[phi] tilde.eq K[t] slash (p_phi)$] == Структурная теорема $make phi in "End"_K (X)$\ $make p_phi$ --- мин. аннулир. полином $phi$\ $make p_phi = p_1 p_2: gcd(p_1, p_2) = 1$\ \ #lm $X = "Ker" p_1 (phi) xor "Ker" p_2 (phi)$ #proof $exists q_1, q_2 in K[x]: p_1 q_1 + p_2 q_2 = 1$\ #box(stroke: 1pt, inset: 6.5pt)[$p_1 (phi) + q_1 (phi) + p_2 (phi) q_2 (phi) = cal(I)$]\ $forall x in X(K)$\ $see cal(I) x = underbracket(p_1 (phi) q_1 (phi) x, x_2) + underbracket(p_2 (phi) q_2 (phi) x, x_1) = x_1 + x_2$\ $see p_1 (phi) x_1 = p_1 (phi) p_2 (phi) q_2 (phi) x = p_phi (phi) q_2 (phi) x = theta q_2 (phi) x = 0 => underline(x_1 in "Ker" p_1 (phi))$\ $p_2 (phi) x_2 = p_2 (phi) p_1 (phi) q_1 (phi) x = p_phi (phi) q_1 (phi) x = 0 => underline(x_2 in "Ker" p_2 (phi))$\ Итак, $forall x in X(K) quad x in "Ker" p_1 (phi) + "Ker" p_2 (phi)$\ \ $make z in "Ker" p_1 (phi) sect "Ker" p_2 (phi) => z in "Ker" p_1 (phi) and z in "Ker" p_2 (phi) => p_1 (phi) z = 0, p_2 (phi) z = 0$\ $z = p_1 (phi) q_1 (phi) z + p_2 (phi) q_2 (phi) z = 0$\ \ #lm $"Ker" p_1 (phi) = "Im" p_2 (phi)$\ $"Ker" p_2 (phi) = "Im" p_1 (phi)$\ #nb $p_phi (phi) = theta quad forall x in X(k) quad p_phi (phi) x = 0$\ $p_1 (phi) underbracket(p_2 (phi) x, in "Im" p_2 (phi)) = 0$\ $=> "Im" p_2 (phi) subset.eq "Ker" p_1 (phi)$ #proof $dim_K (X) = dim_K "Ker" p_1 (phi) + dim_K "Ker" p_2 (phi)$ (из пред. леммы)\ $dim_K (X) = dim_K "Ker" p_2 (phi) + dim_K "Im" p_2 (phi)$\ $dim_K "Ker" p_1 (phi) = dim_K "Im" p_2 (phi) => "Ker" p_1 (phi) tilde.eq "Im" p_2 (phi) =>^((*)) "Ker" p_1 (phi) = "Im" p_2 (phi)$\ \ #nb $X = "Ker" p_1 (phi) xor "Ker" p_2 (phi) = "Im" p_1 (phi) xor "Im" p_2 (phi)$, но $"Im" p_i (phi) tilde.eq X slash "Ker" p_i (phi)$\ $X tilde.eq X slash "Ker" p_1 (phi) xor X slash "Ker" p_2 (phi)$\ \ #lm $p_1 (phi) q_1 (phi)$ --- проектор на $"Ker" p_2 (phi)$\ $p_2 (phi) q_2 (phi)$ --- проектор на $"Ker" p_1 (phi)$\ #proof $cal(P)_1 = p_2 (phi) q_2 (phi), cal(P)_2 = p_1 (phi) q_1 (phi)$\ + $cal(P)_i cal(P)_i = cal(P)_i space (i = 1,2)$\ $cal(P)_1 = cal(I) cal(P)_1 = (underbracket(p_1 (phi) q_1 (phi), cal(P)_2) + underbracket(p_2 (phi) q_2 (phi), cal(P)_1)) cal(P_1) = (cal(P)_2 + cal(P)_1) cal(P)_1 = cal(P)_1 cal(P)_1$\ $cal(P)_1 cal(P)_2 = p_1 (phi) q_1 (phi) p_2 (phi) q_2 (phi) = p_phi (phi) q_1 (phi) q_2 (phi) = theta$\ $cal(P)_1 + cal(P)_2 = cal(I) <=> forall x in X(K) quad x = x_1 + x_2 = cal(P)_1 x + cal(P)_2 x = (cal(P)_1 + cal(P)_2) x = cal(I) x$\ \ #th $make phi in "End"_K (x)$\ $make p_phi in K[x]: p_phi = theta$\ $make p_phi = p_1 p_2: gcd(p_1, p_2) = 1$\ Тогда: + $X = L_1 xor L_2, L_i = "Ker" p_1 (phi)$ + $cal(P)_1 = p_2 (phi) q_2 (phi)$ --- проектор на $L_1$\ $cal(P)_2 = p_1 (phi) q_1 (phi)$ --- проектор на $L_2$ + $"Ker" p_1 (phi) = "Im" p_2 (phi) quad X = "Ext" (L_1, L_2)$ #nb По индукции получаем:\ $p_phi = product_(i=1)^m p_i: gcd(p_i, p_(j!=i)) = 1$\ Тогда: + $X = limits(plus.circle.big)_(i=1)^m L_i$, где $L_i = "Ker" p_i (phi)$ + $cal(P)_i = p'_i (phi) q_i (phi)$ --- проектор на $L_i$\ $p'_i = p_phi slash p_i$ + $sum_(i=1)^m cal(P)_i = cal(I) <=> exists q_i in K[x]: sum_(i=1)^m p_i q_i = 1$ = Инвариантные подпространства $make X(K)$ --- ЛП над $K$\ $make phi in "End"_K (X)$\ #def инвариантное подпространство\ Подпространство $L(K) lt.eq X(K)$ называется инвариантным подпространством оператора $phi$, если $ forall x in L(K) quad phi(x) in L(x) <=> phi(L) subset.eq L $ #exs + $cal(I) x = x$ --- любое подпространство $X$ является инвариантным + $theta x = 0$ --- любое подпространство $X$ является инвариантным + $X = L_1 xor L_2, cal(P)_1$ --- проектор на $L_1$\ $L_1$ и $L_2$ --- инвариантны для $cal(P)_1$ + $K^n quad A = "diag"(lambda_1, lambda_2, dots, lambda_n)$ --- в базисе ${e_i}_(i=1)^n$ $L_i = <e_i>$ --- инвариантное подпространство $A quad 2^n$ подпространств #def ультраинвариантное пространство\ Пространство называется ультраинвариантно, если оно инвариантно и его дополнение также инвариантно\ *Контрпример:*\ $K[x]_n$\ $<x^n> <= K[x]_n = K[x]_(n-1) xor <x^n>_K$\ $phi: dif/(dif x)$\ $dif/(dif x) x^n = n x^(n-1) in.not <x^n>_K$\ $forall p in K[x]_(n-1) dif/(dif x) p in K[x]_(n-1)$\ #nb $x = L_1 xor L_2 => L_1$ --- ультраинвариантное $=> L_2$ --- ультраинвариантное #proof Симметричность определения.\ #def компонента оператора в УИПП\ $make L <= X(K)$ --- УИПП $phi$\ Оператор $phi_L$ называется компонентой оператора $phi$ в УИПП $L$, если $phi_L = phi lr(|, size: #200%)_#pad(bottom: -13pt)[$L$]$ --- сужение $phi$ на $L$\ \ #lm $make X = L_1 xor L_2, L_1, L_2$ --- УИПП $phi$, $phi_i$ --- компонента $phi$ в $L_i$\ Тогда $phi = phi cal(P)_1 + phi cal(P)_2 = phi_1 xor phi_2$ #proof $forall x in X(K) quad x x^! x_1 + x_2, x_i in L_i$\ $x = cal(P)_1 x+ cal(P)_2 x$, $cal(P)_i$ --- проектор на $L_i$\ $phi(x) = phi(cal(P)_1 x + cal(P)_2 x) = phi(cal(P)_1 + cal(P)_2) x = (phi cal(P)_1 + phi cal(P)_2) x$\ $phi = phi cal(P)_1 + phi cal(P)_2 = phi_1 xor phi_2$\ $phi(x) = (phi_1 xor phi_2) (x_1 xor x_2)$\ $forall x in X(K) quad x = (x_1, x_2), x_1 in L_1, x_2 in L_2$\ $phi in "End" (X), phi = (phi_1, phi_2)$\ \ $make phi in "End"_K (X)$\ $p_phi (phi) = theta$\ $make p_phi = p_1 p_2: gcd(p_1, p_2) = 1$\ $=> X=L_1 xor L_2, L_i = "Ker" p_i (phi)$\ #lm $L_1, L_2$ --- ИПП $phi$ #proof $forall x in L_1 quad phi(x) in L_1 ?$\ $x in L_1 = "Ker" p_1 (phi) => p_1 (phi) x = 0$\ $see p_1 (phi) (phi x) = (p_1 (phi) phi)(x) = (phi p_1 (phi))x = 0 => phi x in L_1$\ Для $L_2$ аналогично #nb $L_1$ и $L_2$ --- УИПП #lm $L_1$ и $L_2$ --- нетривиальные УИПП ($!= X, {0}$)\ #proof От противного: $make L_1 = X => L_1 = "Ker" p_1 (phi) = X$\ $forall x in X quad p_1 (phi) x = 0 => p_1 (phi) = 0, p_1 = min (phi), deg p_1 < deg p_phi$\ $make L_1 = {0} => L_2 = X$, противоречие\ \ #lm $X = L_1 xor L_2, L_1 = "Ker" p_1 (phi)$\ $make phi_i$ --- компонента $phi$ в $L_1$\ Тогда $p_i$ --- минимальный аннулирующий полином для $phi_i$\ #proof $forall x in L_i quad p_i (phi_i) x = 0$\ $arrow.curve "Ker" p_i (phi) => p_i (phi) x = 0$\ $p_i (phi) x = p_i (phi) cal(P)_i x = p_i (phi_i) x$\ $make tilde(p)_i - min (phi_i) => tilde(p)_i (phi_i) = 0$\ $p_i, tilde(p_i) => exists g: p_i = g tilde(p)_i, deg g > 0$\ $p_phi = p_1 p_2 = tilde(p)_1 g p_2, tilde(p)_1 p_2 - min(phi), deg tilde(p)_1 p_2 < deg p_phi$, противоречие\ = Спектральная теорема #th $phi in "End"_K (X), p_phi = p_1 p_2: gcd(p_1, p_2) = 1$\ + $X = L_1 xor L_2, L_i = "Ker" p_i (phi)$ --- УИПП + $cal(P)_i = p'_i (phi) q_i (phi)$ --- проектор на $L_i$\ Здесь $p'_1 (x) q_1 (x) + p'_2 (x) q_2 (x) = 1$ + $phi = phi_1 cal(P)_1 + phi_2 cal(P)_2 = sum_(i=1)^2 phi_i cal(P)_i = phi_1 xor phi_2$\ $p_i = min(phi_i)$ #nb Обобщение:\ $make p_phi (x) = product_(i=1)^m (x - x_i)^(r_i) => p_i (x) = (x - x_i)^(r_i) => L_i = "Ker" p_i (phi) = "Ker" (phi - x_i cal(I))^(r_i)$\ $X = limits(xor.big)_(i=1)^m L_i, quad cal(P_i) = p'_i (phi) q_i (phi)$\ $phi = sum_(i=1)^m phi_i cal(P)_i$\ $see L_i = "Ker" (phi - x_i cal(I))^(r_i)$\ $forall x in L_i quad (phi - x_i cal(I))^(r_i) x = 0$\ $arrow.curve (phi - x_i cal(I))^(r_i) x = 0 => (phi - x_i cal(I))^(r_i) = theta => phi_i - x_i cal(I) = cases(delim: "[", theta, tau_i\, tau_i^(r_i) = theta)$\ ($tau_i$ --- нильпотент)\ $phi_i = tau_i + x_i cal(I)$\ #box(inset: (x: 6pt, y: 10pt), stroke: 1pt)[$phi = sum_(i=1)^m (tau_i + x_i cal(I)) cal(P)_i$]\ $p_phi = p_1 p_2 dots p_m$ // dead (T=12:48) #pagebreak() _Напоминание:_\ \ #th $phi in "End"_K (X)$\ #v(0.4cm) $make p_phi = product_(i = 1)^m p_i = product_(i = 1)^m (lambda - lambda_i), quad lambda_i eq.not lambda_(j eq.not i)$\ #v(0.4cm) Тогда: + $exists {q_i}_(i=1)^m in K[lambda]: sum_(i=1)^m p'_i (phi) q_i (phi) = cal(I)$ #v(0.2cm) + $X = limits(xor.big)_(i=1)^m L_i, space L_i = "Ker"p_i (phi) = "Ker"(phi_i - lambda_i cal(I))$ --- УИПП #v(0.2cm) + $p_i - min(phi_i), space cal(P)_i = p'_i (phi) q_i (phi)$ #v(0.2cm) + $phi = sum_(i = 1)^m phi_i cal(P)_i = space sum_(i = 1)^m (tau_i + lambda_i cal(I)) cal(P)_i, space tau_i^r_i = theta$ #v(0.2cm) Два случая: 1. $(phi_i - lambda_i cal(I))^(r_i) x = 0 cancel(0)?/ => (phi_i - lambda_i cal(I)) x = 0 quad (r_i = 1)$ 2. $(phi_i - lambda_i cal(I))^(r_i) = 0 => tau_i^(r_i) = theta$ \ \ = Спектральный анализ оператора $make r_i = 1 => "Ker"(phi_i - lambda_i cal(I)) = {x in X(K) | underline((phi_i - lambda_i cal(I)) x=0)} => phi x = lambda x <==> underline((phi - lambda cal(I))x = 0)$\ #v(0.4cm) $make {e_i}_(i = 1)^n$ --- базис $X(K) => phi <-> A_phi, space x <-> xi$\ #v(0.4cm) $(A_phi - lambda E)xi = 0$ --- СЛАУ (однородная)\ \ #nb #v(0.2cm)Система $(A_phi - lambda E)xi = 0$ имеет нетривиальные решения, если $(A_phi - lambda E)$ --- вырождена $=>$\ $ det (A_phi - lambda E) = 0$\ \ #def характеристический многочлен\ Многочлен $chi_phi (lambda) = det (A_phi - lambda E)$ \ \ //называется характеристическим многочленом оператора $phi$\ \ #lm #v(0.2cm)$make {tilde(e)_j}_(j=1)^n$ --- другой базис $X(K) => det (tilde(A)_phi - lambda E) = (A_phi - lambda E)$ \ \ #proof #v(0.2cm) $phi <-> tilde(A)_phi$\ #v(0.4cm) $det (tilde(A)_phi - lambda E) = det(S A_phi T - lambda E) =det(S A_phi T - lambda S T) =\ det[S (A_phi - lambda E) T] = det S space det (A_phi - lambda E) space det T = det(A_phi - lambda E)$\ \ #nb #v(0.2cm) $cal(X) = det (phi- lambda cal(I))$\ \ #th _(Гамильтон-Кэли)_ $quad cal(X)_phi in (p_phi)$\ #v(0.4cm) $cal(X)_phi (phi) = 0 <=> cal(X)_phi dots.v p_phi$\ \ #proof #v(0.2cm) $make cal(X)_phi (lambda) = a_0 + a_1 lambda + a_2 lambda^2 + dots + a_n lambda^n$\ #box(stroke: 1pt, inset: 6pt)[$A^(-1) = 1/(det A) tilde(A)^T => det(A) E = A tilde(A)^T$] \ \ $phi <-> A_phi$\ #v(0.4cm) $det(A_phi - lambda E) dot E - (A_phi - lambda E) tilde((A_phi - lambda E)^T)$\ #v(0.4cm) $tilde((A_phi - lambda E)^T) = C_0 + C_1 lambda + C_2 lambda_2 + dots + C_(n-1) lambda^(n-1)$\ #ex $A_lambda = mat(delim: "[", lambda, lambda^2 + 1; lambda - lambda^2, 1) = mat(delim: "[", 0, 1; 0, 1) + lambda mat(delim: "[", 1, 0; 1, 0) + lambda^2 mat(delim: "[", 0, 1; -1, 0)$\ $see (A_phi - lambda E) (C_0 + C_1 lambda + C_2 lambda^2 + dots + C_(n-1) lambda^(n-1))$\ $lambda^0: A_phi C_0$\ $lambda^1: A_phi C_1 - C_0$\ $lambda^2: A_phi C_2 - C_1$\ $dots.v$\ $lambda^(n-1): A_phi C_(n-1) - C_(n-2)$\ $lambda^n: - C_(n-1)$ $cal(X) phi ()$
https://github.com/NMD03/CV
https://raw.githubusercontent.com/NMD03/CV/main/templates/cover_letter.typ
typst
#let default_font = "Source Sans Pro" #let accent_color = orange #let light_grey = rgb("#7f7f7f") #let dark_grey = rgb("#3f3f3f") #let text_color = rgb("#131A28") #let textsize = 9pt #let date = datetime.today().display("[month repr:long] [day], [year]"); #let cover_letter(author: (), body) = { let align_footer(left_body, center_body) = { block[ #box(width: 1fr)[ #align(left)[ #left_body ] ] #box(width: 1fr)[ #align(center)[ #center_body ] ] #box(width: 1fr)[ #align(right)[ ] ] ] } show par: set block(above: 0.75em, below: 0.75em) set document( title: "cover_letter", author: author.first_name + " " + author.last_name, ) set text( font: default_font, size: 12pt, lang: "en", fill: text_color, fallback: false, ) set page( paper: "a4", margin: (top: 1cm, bottom: 1.5cm, left: 2cm, right: 2cm), flipped: false, footer: [ #set text(fill: light_grey, size: 8pt) #align_footer[ #text(smallcaps[#date]) ][ #text(smallcaps(author.first_name + " " + author.last_name)) ] ] ) set par(justify: true) set heading( numbering: none, outlined: false, ) let name = { align(center)[ #pad(bottom: 5pt)[ #block[ #set text(size: 32pt, style: "normal", fill: light_grey) #text(weight: "regular")[#author.first_name] #set text(fill: dark_grey) #text(weight: "bold")[#author.last_name] ] ] ] } let positions = { set text( size: 9pt, weight: "regular", fill: accent_color ) align(center)[ #smallcaps[ #author.positions.join( text[#" "#sym.dot.c#" "] ) ] ] } let contacts = { set box(height: 8pt) let linkedin_icon = box(image("../assets/icons/linkedin.svg")) let github_icon = box(image("../assets/icons/github.svg")) let email_icon = box(image("../assets/icons/email.svg")) let phone_icon = box(image("../assets/icons/phone.svg")) let homepage_icon = box(image("../assets/icons/homepage.svg")) let separator = box(width: 10pt)[#line(angle: 90deg, length: 8pt)] align(center)[ #block[ #set text(size: 8pt) #align(horizon)[ #if author.phone != ""{ phone_icon box[#link("tel:" + author.phone)[#text(" " + author.phone)]] } #if author.email != ""{ separator email_icon box[#link("mailto:" + author.email)[#text(" " + author.email)]] } #if author.github != ""{ separator github_icon box[#link("https://github.com/" + author.github)[#text(" " + author.github)]] } #if author.linkedin != ""{ separator linkedin_icon box[ #link(author.linkedin_link)[#text(" " + author.linkedin)] ] } #if author.website != ""{ separator homepage_icon box[ #link(author.website)[#text(" " + author.website)] ] } ] ] ] } name positions contacts box(height: 20pt) body } #let align_address(left_body, rigth_body) = { block[ #box(width: 1fr)[ #align(left)[ #left_body ] ] #box(width: 1fr, baseline: -1010%)[ #align(right)[ #rigth_body ] ] ] } #let address(company: str, street: str, city: str, zip: str, country: str, person: str) = { set text( size: 8pt, weight: "regular", fill: dark_grey ) align_address[ #text(size: 10pt, fill: dark_grey, weight: "bold", smallcaps(person)) #linebreak() #linebreak() #text(smallcaps(company)) #linebreak() #text(smallcaps(street)) #linebreak() #text(smallcaps(city + ", " + zip)) #linebreak() #text(smallcaps(country)) ][ #text(smallcaps(date), fill: light_grey, style: "italic") ] } #let opening(headline: str, name: str) = { set text( size: textsize, weight: "regular", fill: text_color ) text(fill: dark_grey, weight: "bold")[#underline(headline)] linebreak() text("Dear " + name + ",") linebreak() linebreak() } #let content(body) = { set text( size: textsize, weight: "regular", fill: text_color ) text(body) linebreak() } #let closing(name: str) = { set text( size: textsize, weight: "regular", fill: text_color ) linebreak() text("Sincerely,") linebreak() linebreak() text(name, weight: "bold", fill: dark_grey) }
https://github.com/AU-Master-Thesis/thesis
https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/sections/3-methodology/study-3/figure-tracking.typ
typst
MIT License
#import "@preview/cetz:0.2.2" #import "@preview/funarray:0.4.0": windows #import "../../../lib/vec2.typ" #import "../../../lib/mod.typ": * #{ let sc = 55% let color-counter = 0 let settings = ( variable: ( radius: 0.2, spacing: 1.5 ), robot: ( radius: 0.5, ), rrt: ( step-length: 2, ), path: ( color: theme.overlay0, waypoint: ( radius: 0.2 ) ), tracking: ( color: theme.peach, area: theme.green, ) ) let draw-robot(name, position, color: theme.lavender) = { import cetz.draw: * // let color = settings.robot.colors.at(color-counter) // color-counter = calc.rem(color-counter + 1, settings.robot.colors.len()) circle(position, radius: settings.robot.radius, fill: color.lighten(80%), stroke: color + 2pt, name: name) content(position, text(color, font: "JetBrainsMono NF", weight: "bold", name)) } let draw-variable(position, color: theme.lavender) = { import cetz.draw: * circle(position, radius: settings.variable.radius, fill: color, stroke: color + 2pt) } let robot(name, center, variables: none, color: theme.lavender) = { import cetz.draw: * // make sure the denter is a 2D vector assert(center.len() == 2) for i in range(2) { let t = type(center.at(i)) assert(t == float or t == int) } // make sure that variables is an array of angles for variable in variables { assert(type(variable) == "angle") } let cx = center.at(0) let cy = center.at(1) if variables != none { let variable_points = vec2.points-relative-from(center, ..variables.map(it => (it, settings.variable.spacing))) for (v1, v2) in windows(variable_points, 2) { line(v1, v2, stroke: color + 2pt) draw-variable(v2, color: color) } } draw-robot(name, center, color: color) } let drawing-1 =cetz.canvas({ import cetz.draw: * scale(x: sc, y: sc) let robots = ( ( name: "A", color: theme.lavender, position: (0.5, 2), variables: ( (10deg), (0deg), (-5deg), (-5deg), (5deg), (15deg), (30deg), (25deg), (5deg), (-20deg), (-35deg), (-55deg), ) ), ) // Path let first-waypoint = (0, 0) let sl = settings.rrt.step-length let waypoints = vec2.points-relative-from( first-waypoint, (15, 5), (3, -5), ) // draw corner attachment range let l1 = vec2.normalize(vec2.sub(waypoints.at(1), waypoints.at(0))) let l2 = vec2.normalize(vec2.sub(waypoints.at(2), waypoints.at(1))) let n1 = vec2.normals(l1) let n2 = vec2.normals(l2) let ns = 2.5 let ns2 = -2 let ns3 = 2.5 let ns4 = 2.5 let s1 = vec2.add(vec2.add(waypoints.at(1), vec2.scale(2, vec2.sub((0, 0), l1))), vec2.scale(ns3, n1.counter)) let s2-1 = vec2.add(vec2.add(waypoints.at(1), vec2.scale(2, vec2.sub((0, 0), l1))), vec2.scale(ns, n1.clockwise)) let s2-2 = vec2.add(vec2.add(waypoints.at(1), vec2.scale(2, l2)), vec2.scale(ns, n2.clockwise)) let s2-3 = vec2.add(vec2.add(waypoints.at(1), vec2.scale(ns2, vec2.sub((0, 0), l1))), vec2.scale(ns3, n1.counter)) let s2-4 = vec2.add(vec2.add(waypoints.at(1), vec2.scale(ns2, l2)), vec2.scale(ns4, n2.counter)) let s3 = vec2.add(vec2.add(waypoints.at(1), vec2.scale(2, l2)), vec2.scale(ns4, n2.counter)) let c = settings.tracking.area.lighten(60%) circle(s1, radius: 0.1, fill: c, stroke: none) circle(s2-1, radius: 0.1, fill: c, stroke: none) circle(s2-2, radius: 0.1, fill: c, stroke: none) circle(s2-3, radius: 0.1, fill: c, stroke: none) circle(s2-4, radius: 0.1, fill: c, stroke: none) circle(s3, radius: 0.1, fill: c, stroke: none) line(s1, s2-1, s3, s2-3, close: true, fill: c.lighten(70%), stroke: (paint: c, thickness: 2pt, cap: "round", dash: "dashed")) let r = settings.path.waypoint.radius let c = settings.path.color circle(first-waypoint, radius: r, fill: c, stroke: none) content(vec2.add(first-waypoint, (0, 1)), text(c, size: 15pt, $w_0$)) for (i, (p1, p2)) in windows(waypoints, 2).enumerate() { circle(p2, radius: r, fill: c, stroke: none) line(p1, p2, stroke: c + 2pt) content(vec2.add(p2, (0.8, 0.8)), text(c, size: 15pt, $w_#{i + 1}$)) } for r in robots { let variable-positions = vec2.points-relative-from(r.position, ..r.variables.map(it => (it, settings.variable.spacing))) variable-positions = variable-positions.slice(1, variable-positions.len()) // project onto line segment 1 let (a, b) = vec2.line-from-line-segment(..waypoints.slice(0, 2)) let variables1 = variable-positions.slice(0, 8) let proj1 = variables1.map(v => { let dir = vec2.normalize(vec2.sub(waypoints.at(1), waypoints.at(0))) let proj = vec2.add(vec2.projection-onto-line(v, a, b), vec2.scale(0.75, dir)) proj }) // project onto line segment 2 let (a, b) = vec2.line-from-line-segment(..waypoints.slice(1, 3)) let variables2 = variable-positions.slice(10, 12) let proj2 = variables2.map(v => { let dir = vec2.normalize(vec2.sub(waypoints.at(2), waypoints.at(1))) let proj = vec2.add(vec2.projection-onto-line(v, a, b), vec2.scale(0.75, dir)) proj }) // draw tracking points let c = settings.tracking.color let tracking-points = proj1 + (waypoints.at(1), waypoints.at(1)) + proj2 for (proj, v) in tracking-points.zip(variable-positions) { line(proj, v, stroke: (paint: c, thickness: 2pt, cap: "round")) circle(proj, radius: 0.1, fill: c, stroke: c) } // draw variables for v in variable-positions { circle(v, radius: settings.variable.radius, fill: r.color, stroke: r.color + 2pt) } } }) let drawing-2 = cetz.canvas({ import cetz.draw: * scale(x: sc, y: sc) rotate(-90deg) let robots = ( ( name: "R", color: theme.lavender, position: (0.5, -1.5), variables: ( (-80deg + 90deg), (-70deg + 90deg), (-70deg + 90deg), (-75deg + 90deg), (-90deg + 90deg), (-95deg + 90deg), ) ), ) let waypoints = ( (0, 0), (10, 0), ) // draw path let r = settings.path.waypoint.radius let c = settings.path.color circle(waypoints.first(), radius: r, fill: c, stroke: none) for (p1, p2) in windows(waypoints, 2) { circle(p2, radius: r, fill: c, stroke: none) line(p1, p2, stroke: c + 2pt) } let variable-positions = vec2.points-relative-from(robots.at(0).position, ..robots.at(0).variables.map(it => (it, settings.variable.spacing))) let projs = variable-positions.map(v => { let (a, b) = vec2.line-from-line-segment(..waypoints) let dir = vec2.normalize(vec2.sub(waypoints.at(1), waypoints.at(0))) let proj = vec2.add(vec2.projection-onto-line(v, a, b), vec2.scale(0.75, dir)) proj }) for (proj, v) in projs.zip(variable-positions) { line(proj, v, stroke: (paint: settings.tracking.color, thickness: 2pt, cap: "round")) circle(proj, radius: 0.1, fill: settings.tracking.color, stroke: settings.tracking.color) } for r in robots { robot(r.name, r.position, variables: r.variables, color: r.color) } content(vec2.add(waypoints.first(), (0, 1)), text(c, size: 15pt, $w_0$)) content(vec2.add(waypoints.last(), (0, 1)), text(c, size: 15pt, $w_1$)) }) set text(theme.text) set align(center) grid( columns: (3fr, 1fr), std-block(height: 70mm, [#drawing-1 #place(bottom + center, [A: Tracking Along Path])]), std-block(height: 70mm, [#drawing-2 #place(bottom + center, [B: Exemplification])]), ) }
https://github.com/FkHiroki/ex-B3
https://raw.githubusercontent.com/FkHiroki/ex-B3/main/sections/section2.typ
typst
MIT No Attribution
#import "@preview/codelst:2.0.0": sourcecode = 3. 実験結果 == 3.1. 電気抵抗測定 まず、室温($298$ K)でのPb-Inの寸法測定、抵抗測定の結果を@tab:pb-in に示す。次に、YBCOの寸法測定、抵抗測定の結果を@tab:ybco に示す。 #figure( caption: [Pb-Inの寸法測定、抵抗測定の結果], table( columns: 7, stroke: (none), table.hline(), table.header( [$L$ /mm], [$t$ /mm], [$w$ /mm], [$V$ /mV], [$I$ /mA], [$R$ /m$ohm$], [$rho$ /$ohm$ $dot$ m], ), table.hline(), [1.50], [0.10], [2.40], [0.201], [100], [$2.01$], [$3.22 times 10^(-7)$], table.hline(), ) ) <tab:pb-in> #figure( caption: [YBCOの寸法測定、抵抗測定の結果], table( columns: 7, stroke: (none), table.hline(), table.header( [$L$ /mm], [$t$ /mm], [$w$ /mm], [$V$ /mV], [$I$ /mA], [$R$ /m$ohm$], [$rho$ /$ohm$ $dot$ m], ), table.hline(), [1.20], [0.80], [3.15], [0.182], [20.0], [$9.1$], [$1.91 times 10^(-5)$], table.hline(), ) ) <tab:ybco> 次に、室温以外での抵抗測定について、与えられたデータから求めたPb-In、YBCOにおける温度と低効率の値を@tab:resistance に示す。ここで、温度の換算方法については、熱電対の起電力の小数第2位までの値だけだと、起電力の値は異なるが温度の値が同じになる場合があったため、小数第3位までの値と、小数第2位まで見た時の温度とその隣の温度の差から、温度を換算した。そして、@tab:pb-in 、@tab:ybco 、@tab:resistance から、Pb-In、YBCOそれぞれの温度と抵抗率の値をプロットし、そのグラフからゼロ抵抗の特性を確認した。その結果を@fig:pbin 、@fig:ybco に示す。 #figure( caption: [室温以外での抵抗測定におけるPb-In、YBCOそれぞれの温度と抵抗率の値], table( columns: 4, stroke: (none), table.hline(), table.header( table.cell(colspan: 2, [Pb-In]), table.cell(colspan: 2, [YBCO]), ), [温度 /K], [抵抗率 /$ohm$ $dot$ m], [温度 /K],[抵抗率 /$ohm$ $dot$ m], table.hline(), [$78.7$], [$2.82 times 10^(-7)$], [$177.6$], [$3.00 times 10^(-5)$], [$69$], [$2.73 times 10^(-7)$], [$172$], [$2.96 times 10^(-5)$], [$59$], [$2.62 times 10^(-7)$], [$167.8$], [$2.95 times 10^(-5)$], [$48$], [$2.53 times 10^(-7)$], [$164.3$], [$2.91 times 10^(-5)$], [$38.8$], [$2.50 times 10^(-7)$], [$153.4$], [$2.86 times 10^(-5)$], [$26.3$], [$2.45 times 10^(-7)$], [$141.1$], [$2.78 times 10^(-5)$], [$15$], [$2.45 times 10^(-7)$], [$113.3$], [$2.65 times 10^(-5)$], [$8.6$], [$2.38 times 10^(-7)$], [$90.6$], [$2.53 times 10^(-5)$], [$8.4$], [$2.36 times 10^(-7)$], [$77.6$], [$2.36 times 10^(-5)$], [$7.1$], [$5.46 times 10^(-8)$], [$66$], [$2.23 times 10^(-5)$], [$7.1$], [$3.87 times 10^(-9)$], [$60.5$], [$2.18 times 10^(-5)$], [$6.4$], [$2.82 times 10^(-9)$], [$55.5$], [$2.09 times 10^(-5)$], [$6.4$], [$2.46 times 10^(-9)$], [$43.9$], [$0$], [$5.7$], [$2.64 times 10^(-9)$], [$37.7$], [$0$], [$5.2$], [$2.99 times 10^(-9)$], [$30.9$], [$2.52 times 10^(-7)$], [$4.8$], [$2.82 times 10^(-9)$], [$29.3$], [$1.26 times 10^(-7)$], [$4.4$], [$2.82 times 10^(-9)$], [$23$], [$1.26 times 10^(-7)$], [$4.3$], [$3.17 times 10^(-9)$], [$12.9$], [$1.26 times 10^(-7)$], [$4.2$], [$3.17 times 10^(-9)$], [$4.2$], [$1.26 times 10^(-7)$], table.hline(), ) ) <tab:resistance> #figure( image("../figs/pbin.png", width: 90%), caption: [Pb-Inの温度と抵抗率の値], ) <fig:pbin> #figure( image("../figs/ybco.png", width: 90%), caption: [YBCOの温度と抵抗率の値], ) <fig:ybco> == 3.2. 超伝導体と磁石の相互作用 まず、零磁場冷却における、磁石とYBCOの距離に対する磁石にかかる力の関係を@tab:zero_field に示す。そして、@tab:zero_field から、距離と磁石にかかる力の関係をプロットした結果を@fig:zero_field に示す。 #figure( caption: [零磁場冷却における、磁石とYBCOの距離に対する磁石にかかる力の関係], table( columns: 6, stroke: (none), table.hline(), table.header( table.cell(colspan: 2, [近づける向き(1回目)]), table.cell(colspan: 2, [遠ざける向き(1回目)]), table.cell(colspan: 2, [近づける向き(2回目)]) ), table.hline(), [距離 /cm], [力 /N], [距離 /cm], [力 /N], [距離 /cm], [力 /N], table.hline(), [$11.8$], [$0$], [$0.1$], [$0.499$], [$10.05$], [$0$], [$10.8$], [$0$], [$0.2$], [$0.365$], [$9.05$], [$0$], [$9.8$], [$0$], [$0.3$], [$0.261$], [$8.05$], [$0$], [$8.8$], [$0$], [$0.4$], [$0.208$], [$7.05$], [$0$], [$7.8$], [$0$], [$0.5$], [$0.154$], [$6.05$], [$-9.80 times 10^(-4)$], [$6.8$], [$0$], [$0.6$], [$0.120$], [$5.05$], [$-1.96 times 10^(-3)$], [$5.8$], [$0$], [$0.7$], [$8.92 times 10^(-2)$], [$4.05$], [$-2.94 times 10^(-3)$], [$4.8$], [$9.80 times 10^(-4)$], [$0.8$], [$6.47 times 10^(-2)$], [$3.05$], [$-3.92 times 10^(-3)$], [$4.3$], [$1.96 times 10^(-3)$], [$0.9$], [$5.19 times 10^(-2)$], [$2.55$], [$-2.94 times 10^(-3)$], [$3.8$], [$2.94 times 10^(-3)$], [$1$], [$3.43 times 10^(-2)$], [$2.05$], [$3.92 times 10^(-3)$], [$3.3$], [$6.86 times 10^(-3)$], [$1.5$], [$9.80 times 10^(-4)$], [$1.55$], [$2.25 times 10^(-2)$], [$2.8$], [$1.27 times 10^(-2)$], [$2$], [$-6.86 times 10^(-3)$], [$1.05$], [$7.94 times 10^(-2)$], [$2.3$], [$2.45 times 10^(-2)$], [$2.5$], [$-8.82 times 10^(-3)$], [$0.95$], [$9.41 times 10^(-2)$], [$1.8$], [$5.00 times 10^(-2)$], [$3$], [$-7.84 times 10^(-3)$], [$0.85$], [$0.122$], [$1.3$], [$0.102$], [$4$], [$-4.90 times 10^(-3)$], [$0.75$], [$0.153$], [$0.8$], [$0.219$], [$5$], [$-2.94 times 10^(-3)$], [$0.65$], [$0.182$], [$0.7$], [$0.256$], [$6$], [$-9.80 times 10^(-4)$], [$0.55$], [$0.230$], [$0.6$], [$0.299$], [$7$], [$-9.80 times 10^(-4)$], [$0.45$], [$0.286$], [$0.5$], [$0.349$], [$8$], [$0$], [$0.35$], [$0.347$], [$0.4$], [$0.397$], [$9$], [$0$], [$0.25$], [$0.436$], [$0.3$], [$0.483$], [$10$], [$0$], [$0.15$], [$0.540$], [$0.2$], [$0.553$], [], [], [$0.05$], [$0.651$], [$0.1$], [$0.630$], [], [], [], [], [$0$], [$0.745$], [], [], [], [], table.hline(), ) ) <tab:zero_field> #figure( image("../figs/zero-field.png", width: 90%), caption: [零磁場冷却における、磁石とYBCOの距離に対する磁石にかかる力の関係], ) <fig:zero_field> 次に、磁場中冷却における、磁石とYBCOの距離に対する磁石にかかる力の関係を@tab:magnetic_field に示す。そして、@tab:magnetic_field から、距離と磁石にかかる力の関係をプロットした結果を@fig:magnetic_field に示す。 #figure( caption: [磁場中冷却における、磁石とYBCOの距離に対する磁石にかかる力の関係], table( columns: 6, stroke: (none), table.hline(), table.header( table.cell(colspan: 2, [遠ざける向き(1回目)]), table.cell(colspan: 2, [近づける向き(1回目)]), table.cell(colspan: 2, [遠ざける向き(2回目)]) ), table.hline(), [距離 /cm], [力 /N], [距離 /cm], [力 /N], [距離 /cm], [力 /N], table.hline(), [$0$], [$1.18 times 10^(-2)$], [$10$], [$0$], [$0$], [$0.204$], [$0.1$], [$-0.112$], [$9$], [$0$], [$0.1$], [$1.57 times 10^(-2)$], [$0.2$], [$-0.184$], [$8$], [$-9.80 times 10^(-4)$], [$0.2$], [$-7.94 times 10^(-2)$], [$0.3$], [$-0.220$], [$7$], [$-1.96 times 10^(-3)$], [$0.3$], [$-0.128$], [$0.4$], [$-0.240$], [$6$], [$-4.90 times 10^(-3)$], [$0.4$], [$-0.164$], [$0.5$], [$-0.245$], [$5$], [$-9.80 times 10^(-3)$], [$0.5$], [$-0.184$], [$0.6$], [$-0.243$], [$4$], [$-1.96 times 10^(-2)$], [$0.6$], [$-0.191$], [$0.7$], [$-0.236$], [$3$], [$-3.82 times 10^(-2)$], [$0.7$], [$-0.194$], [$0.8$], [$-0.225$], [$2.5$], [$-5.49 times 10^(-2)$], [$0.8$], [$-0.190$], [$0.9$], [$-0.216$], [$2$], [$-7.64 times 10^(-2)$], [$0.9$], [$-0.185$], [$1$], [$-0.200$], [$1.5$], [$-0.123$], [$1$], [$-0.176$], [$1.5$], [$-0.140$], [$1$], [$-0.123$], [$1.5$], [$-0.128$], [$2$], [$-9.31 times 10^(-2)$], [$0.9$], [$-0.123$], [$2$], [$-8.82 times 10^(-2)$], [$2.5$], [$-6.37 times 10^(-2)$], [$0.8$], [$-0.120$], [$2.5$], [$-6.08 times 10^(-2)$], [$3$], [$-4.41 times 10^(-2)$], [$0.7$], [$-0.115$], [$3$], [$-4.21 times 10^(-2)$], [$4$], [$-2.16 times 10^(-2)$], [$0.6$], [$-0.101$], [$4$], [$-2.06 times 10^(-2)$], [$5$], [$-1.08 times 10^(-2)$], [$0.5$], [$-8.23 times 10^(-2)$], [$5$], [$-9.80 times 10^(-3)$], [$6$], [$-5.88 times 10^(-3)$], [$0.4$], [$-5.19 times 10^(-2)$], [$6$], [$-4.90 times 10^(-3)$], [$7$], [$-2.94 times 10^(-3)$], [$0.3$], [$-1.76 times 10^(-2)$], [$7$], [$-1.96 times 10^(-3)$], [$8$], [$-1.96 times 10^(-3)$], [$0.2$], [$2.94 times 10^(-2)$], [$8$], [$-9.80 times 10^(-4)$], [$9$], [$0$], [$0.1$], [$0.116$], [$9$], [$0$], [$10$], [$0$], [$0$], [$0.215$], [$10$], [$0$], table.hline(), ) ) <tab:magnetic_field> #figure( image("../figs/In_field.png", width: 90%), caption: [磁場中冷却における、磁石とYBCOの距離に対する磁石にかかる力の関係], ) <fig:magnetic_field> == 3.3. 磁場上での超伝導体の運動 まず、零磁場冷却をしたYBCOをレールに乗せると、YBCOはレール上を浮遊した。そして、ある程度の力でYBCOを押してみると、YBCOは押された方向に動いた。この時、YBCOはレール上を滑り、レールから外れることはなかった。しかし、ある一定の力を超えた力で押してみると、YBCOはレールから外れてしまった。次に、磁場中冷却をしたYBCOをレールに乗せると、YBCOはレールに引っ付いていて、持ち上げようとすると、YBCOがレールに引っ付こうとする引力を感じることができた。そして、YBCOがレールに引っ付いている状態でレールを反転させると、YBCOはレールから少し離れた位置で浮遊し、YBCOを押してみると、YBCOは押された方向に動いた。この時、運動の速さは零磁場冷却をした時よりも速く、軽い力でより簡単に動いた。
https://github.com/dadn-dream-home/documents
https://raw.githubusercontent.com/dadn-dream-home/documents/main/contents/04-use-case-scenarios/index.typ
typst
= Use case scenarios <sec:uc-scenarios> #let use-cases = { // manually update this let number-of-use-cases = 9 let i = 1 let use-cases = (:) while (i <= number-of-use-cases) { // pad left i with 0 let file-name = str(i) if (i < 10) { file-name = "0" + file-name } if (i < 100) { file-name = "0" + file-name } i = i + 1 let use-case = yaml("../../use-cases/" + file-name + ".yml") use-cases.insert(file-name, use-case) } use-cases } Danh sách các use case được đặc tả ở phần này: #for (filename, use-case) in use-cases [ - UC#filename #sym.dot #use-case.name (#ref(label("fig:UC" + filename))) ] #for (filename, use-case) in use-cases [ == UC#filename #sym.dot #use-case.name #let eval-content = s => eval("[" + s + "]") #figure( align(left, table( columns: (auto, 1fr), inset: 8pt, stroke: gray + .5pt, // [*Use case*], [*#eval-content(use-case.name)*], [*Author*], eval-content(use-case.author), [*Date*], eval-content(use-case.date), [*Description*], eval-content(use-case.description), [*Actor*], eval-content(use-case.actor), [*Trigger*], eval-content(use-case.trigger), [*Pre-condition*], eval-content(use-case.precondition), [*Post-condition*], eval-content(use-case.postcondition), [*Normal flow*], eval-content(use-case.normal-flow), [*Alternative flow*], eval-content(use-case.alternative-flow), [*Exception flow*], eval-content(use-case.exception-flow), )), caption: [UC#filename #sym.dot #use-case.name], ) #label("fig:UC" + filename) ]
https://github.com/Many5900/aau-typst
https://raw.githubusercontent.com/Many5900/aau-typst/main/template.typ
typst
#set text(region: "GB") // Utility to convert from snake_case to Title Case #let snake-to-titlecase(str) = str.split("_").map(str => upper(str.slice(0, 1)) + lower(str.slice(1))).join(" ") // The project function defines how your document looks. // It takes your content and some metadata and formats it. // Go ahead and customize it to your liking! #let project( abstract: [], department: "", meta: ( title: "P3 - ...", theme: "ALG & IWP", project_period: "Autumn 2024", project_group: "cs-24-sw-3-xx", participants: (), supervisor: (), date: "December 20th", ), body, ) = { // Set the document's basic properties. set document(author: meta.participants.map(a => a.name), title: meta.title) set page(numbering: "I", number-align: center) // Save heading and body font families in variables. let aau-blue = rgb(33, 26, 82) let body-font = "New Computer Modern" let sans-font = "New Computer Modern Sans" let mono-font = "New Computer Modern Mono" set par(leading: 0.55em, justify: true) // Set document preferences, font family, heading format etc. set text(font: body-font, lang: "en") set heading(numbering: "1.1") show math.equation: set text(weight: 400) show heading: set text(font: sans-font) show raw: set text(font: mono-font) show link: underline // Front/cover page. page(background:image("AAUgraphics/aau_waves.svg", width: 100%, height: 100%), numbering: none, grid(columns: (100%), rows: (50%, 20%, 30%), align(center + bottom, box(fill: aau-blue, inset: 18pt, radius: 1pt, clip: false, { set text(fill: white, 12pt) align(center)[ #text(font: sans-font, 2em, weight: 700, meta.title)\ \ #meta.project_group\ #((..meta.participants.map(author => author.name)).join(", ", last: " and ")) ] } )), none, align(center, image("AAUgraphics/aau_logo_circle_en.svg", width: 25%)) ) ) pagebreak() // Abstract page. page( grid( columns: (50%, 50%), rows: (30%, 70%), image("AAUgraphics/aau_logo_en.svg"), align(right + horizon)[ *#(department)*\ Aalborg University\ http://cs.aau.dk ], box(width: 80%, height: 100%)[ // List all key-value pairs from 'meta' map. #(meta.pairs().map(data => [*#(snake-to-titlecase(data.at(0))):*\ #( if type(data.at(1)) == array { data.at(1).map(d => [#(d.name)]).join("\n") } else { data.at(1) } )] ).join("\n\n")) \ *Copies:* 1\ \ *Number of Pages:* #(locate(loc => counter(page).final(loc).at(0)))\ \ ], [ *Abstract:*\ #box(width: 100%, height: auto, stroke: black, inset: 12pt)[ #abstract ]] ) ) pagebreak() // Table of contents. page(outline(depth: 3, indent: true)) pagebreak() // Main body. set page(numbering: "1", number-align: center) counter(page).update(1) set par(justify: true) // Chapter Styling show heading.where(level: 1): h => { pagebreak(weak: true) v(1em) let c = luma(70) set text(fill: c, size: 80pt) place(left, counter(heading).display()) set text(fill: c, size: 20pt) place(right, dy: 1.6em, {h.body}) place(right, dy: 2.7em, {line(length: 80%, stroke: 0.7pt + c)}) v(6em) } // Increment header for bibliography show bibliography: body => { counter(heading).step() body } body }
https://github.com/lxl66566/my-college-files
https://raw.githubusercontent.com/lxl66566/my-college-files/main/信息科学与工程学院/template.typ
typst
The Unlicense
// This typst template is made by absolutex (github.com/lxl66566), works well on typst 0.10.0 #let 字号 = ( 初号: 42pt, 小初: 36pt, 一号: 26pt, 小一: 24pt, 二号: 22pt, 小二: 18pt, 三号: 16pt, 小三: 15pt, 四号: 14pt, 中四: 13pt, 小四: 12pt, 五号: 10.5pt, 小五: 9pt, 六号: 7.5pt, 小六: 6.5pt, 七号: 5.5pt, 小七: 5pt, ) #let 字体 = ( 仿宋: ("Times New Roman", "FangSong"), 宋体: ("Times New Roman", "Songti SC", "Songti TC", "SimSun"), 黑体: ("Times New Roman", "SimHei"), 楷体: ("Times New Roman", "KaiTi"), 代码: ("Fira Code", "Consolas", "monospace", "WenQuanYi Zen Hei Mono", "FangSong"), ) #let 中文数字(num) = { ("零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十").at(int(num)) } // 带边框代码块 #let frame(title: none, body) = { let stroke = black + 1pt let radius = 5pt let txt = (font: 字体.代码) set text(..txt) let name = block( breakable: false, fill: color.linear-rgb(0, 0, 0, 10), stroke: stroke, inset: 0.5em, below: -1.5em, radius: (top-right: radius, bottom-left: radius), title, ) block( stroke: stroke, width: 100%, inset: (rest: 0.5em), radius: radius, )[ #if title != none { place(top + right, dx: radius + stroke.thickness, dy: -(radius + stroke.thickness), name) } #body ] } // 引入外部代码块 #let include_code(file_path) = { let name = file_path.split("/").at(-1) let lang = name.split(".").at(-1) frame(title: name)[ #raw(read(file_path), lang: lang) ] } // 设置假缩进 #let fake_par = { v(-0.5em) box() } // 提取 text #let get_text(knt) = { knt.at("body", default: knt.at("text", default: "anything")) } #let project( title: "", authors: (), body ) = { set document(author: authors, title: title) set page(numbering: "1", number-align: center, margin: 0.7in) // 水印 // set page(background: rotate(24deg,text(80pt, fill: rgb("FFCBC4"))[*SAMPLE*])) // 正文,两端对齐,段前缩进2字符 set text(font: 字体.宋体, size: 字号.小四, lang: "zh", region: "cn") set par(first-line-indent: 2em) show heading: it => { it par()[#text(size:0.5em)[#h(0.0em)]] } // heading,一级标题换页且不显示数字,首行居中 set heading(numbering: "1.1") show heading: it => { set text(font: 字体.黑体) if it.level == 1 { pagebreak(weak: true) align(center)[#text(size: 字号.小二, it.body)] } else if it.level == 2 { text(size: 字号.四号, it) } else if it.level == 3 { text(size: 字号.小四, it) } else{ text(size: 字号.五号, it) } } // figure(image) show figure.where(kind: image): it => { set align(center) it.body { set text(font: 字体.宋体, size: 字号.五号, weight: "extrabold") h(1em) it.caption } } // raw with frame show raw: set text(font: 字体.代码) show raw.where(block: true): it => frame()[#it] body }
https://github.com/DashieTM/ost-5semester
https://raw.githubusercontent.com/DashieTM/ost-5semester/main/patterns/weeks/week3.5.typ
typst
#import "../../utils.typ": * #subsection([Strategy]) *Problem* | You need different algorithms depending on various factors.\ *Solution* | Make the algorithms modular.\ *Example* | A list can use various sorting algorithms.\ // images #align(center, [#image("../uml/strategy.jpg", width: 100%)]) ```java /* Encapsulated family of Algorithms * Interface and its implementations */ public interface IBrakeBehavior { public void brake(); } public class BrakeWithABS implements IBrakeBehavior { public void brake() { System.out.println("Brake with ABS applied"); } } public class Brake implements IBrakeBehavior { public void brake() { System.out.println("Simple Brake applied"); } } /* Client that can use the algorithms above interchangeably */ public abstract class Car { private IBrakeBehavior brakeBehavior; public Car(IBrakeBehavior brakeBehavior) { this.brakeBehavior = brakeBehavior; } public void applyBrake() { brakeBehavior.brake(); } public void setBrakeBehavior(IBrakeBehavior brakeType) { this.brakeBehavior = brakeType; } } /* Client 1 uses one algorithm (Brake) in the constructor */ public class Sedan extends Car { public Sedan() { super(new Brake()); } } /* Client 2 uses another algorithm (BrakeWithABS) in the constructor */ public class SUV extends Car { public SUV() { super(new BrakeWithABS()); } } /* Using the Car example */ public class CarExample { public static void main(final String[] arguments) { Car sedanCar = new Sedan(); sedanCar.applyBrake(); // This will invoke class "Brake" Car suvCar = new SUV(); suvCar.applyBrake(); // This will invoke class "BrakeWithABS" // set brake behavior dynamically suvCar.setBrakeBehavior( new Brake() ); suvCar.applyBrake(); // This will invoke class "Brake" } } ``` #columns(2, [ #text(green)[Benefits] - flexibility #colbreak() #text(red)[Liabilities] - overhead -> indirection ]) #subsection([Observable]) *Problem* | You need updates from another service, which is independent, without relying on polling.\ *Solution* | The client pushes updates to something that is available to you.\ *Example* | list of transactions -> update pushed to list.\ *Participants* | Subject -> Observable, Observer -> oversees state of subject // images #align(center, [#image("../uml/observer.jpg", width: 100%)]) ```java import java.util.ArrayList; import java.util.List; import java.util.Scanner; interface Observer { void update(String event); } class EventSource { List<Observer> observers = new ArrayList<>(); public void notifyObservers(String event) { observers.forEach(observer -> observer.update(event)); } public void addObserver(Observer observer) { observers.add(observer); } public void scanSystemIn() { Scanner scanner = new Scanner(System.in); while (scanner.hasNextLine()) { String line = scanner.nextLine(); notifyObservers(line); } } } public class ObserverDemo { public static void main(String[] args) { System.out.println("Enter Text: "); EventSource eventSource = new EventSource(); eventSource.addObserver(event -> System.out.println("Received response: " + event)); eventSource.scanSystemIn(); } } ``` Explanation: One subject can have multiple observers, these observers will execute an update function for each state change in the subject. (usually via injection) #columns(2, [ #text(green)[Benefits] - flexibility - reduced communication -> no poll #colbreak() #text(red)[Liabilities] - indirection - memory increase ]) #subsection([Decorator]) *Problem* | Specific object should have various behavior at runtime.\ *Solution* | Create wrappers for object that can be used as said object and adds behavior on top.\ *Example* | protocol V1 -> protocol V1.5, aka protocol 1 plus some stuff\ // images #align(center, [#image("../uml/decorator.jpg", width: 100%)]) ```cs namespace WikiDesignPatterns; public interface IBike { string GetDetails(); double GetPrice(); } public class AluminiumBike : IBike { public double GetPrice() => 100.0; public string GetDetails() => "Aluminium Bike"; } public class CarbonBike : IBike { public double GetPrice() => 1000.0; public string GetDetails() => "Carbon"; } public abstract class BikeAccessories : IBike { private readonly IBike _bike; public BikeAccessories(IBike bike) { _bike = bike; } public virtual double GetPrice() => _bike.GetPrice(); public virtual string GetDetails() => _bike.GetDetails(); } public class SecurityPackage : BikeAccessories { public SecurityPackage(IBike bike):base(bike) { } public override string GetDetails() => base.GetDetails() + " + Security Package"; public override double GetPrice() => base.GetPrice() + 1; } public class SportPackage : BikeAccessories { public SportPackage(IBike bike) : base(bike) { } public override string GetDetails() => base.GetDetails() + " + Sport Package"; public override double GetPrice() => base.GetPrice() + 10; } public class BikeShop { public static void UpgradeBike() { var basicBike = new AluminiumBike(); BikeAccessories upgraded = new SportPackage(basicBike); upgraded = new SecurityPackage(upgraded); Console.WriteLine($"Bike: '{upgraded.GetDetails()}' Cost: {upgraded.GetPrice()}"); } } ``` Explanation: Decorators are simply wrappers around an object that can be used as said object. Wrapping can be done indefinitely, therefore providing unlimited expansion options. #columns(2, [ #text(green)[Benefits] - flexibility - expandability #colbreak() #text(red)[Liabilities] - indirection - memory usage -> object in object ]) #subsection([Factory Method]) *Problem* | Creation of objects without needing to pass default parameters and runtime change of what is instantiated.\ *Solution* | Creation class that handles default initialization etc.\ // images #align(center, [#image("../uml/factory.jpg", width: 100%)]) ```cs // Empty vocabulary of actual object public interface IPerson { string GetName(); } public class Villager : IPerson { public string GetName() { return "Village Person"; } } public class CityPerson : IPerson { public string GetName() { return "City Person"; } } public enum PersonType { Rural, Urban } /// <summary> /// Implementation of Factory - Used to create objects. /// </summary> public class PersonFactory { public IPerson GetPerson(PersonType type) { switch (type) { case PersonType.Rural: return new Villager(); case PersonType.Urban: return new CityPerson(); default: throw new NotSupportedException(); } } } ``` #columns(2, [ #text(green)[Benefits] - ease of use - factories can be swapped -> polymorphism #colbreak() #text(red)[Liabilities] - enum and types have to be added separately - possible over-abstraction ]) #subsubsection([Abstract Factory Method]) *Explanation* | Name is dumb, what it actually does, it creates groups of objects the factory creates which are not defined, e.g. the implementations have to define it, hence the need for abstract.\ *Example* | *two* or more *types* of objects need to be created with one factory. // images #align(center, [#image("../uml/abstractfactory.jpg", width: 100%)]) ```cs public interface IProduct { string GetName(); bool SetPrice(double price); } public class Phone : IProduct { private double _price; public string GetName() { return "Apple TouchPad"; } public bool SetPrice(double price) { _price = price; return true; } } /* Almost same as Factory, just an additional exposure to do something with the created method */ public abstract class ProductAbstractFactory { protected abstract IProduct MakeProduct(); public IProduct GetObject() // Implementation of Factory Method. { return this.MakeProduct(); } } public class PhoneConcreteFactory : ProductAbstractFactory { protected override IProduct MakeProduct() { IProduct product = new Phone(); // Do something with the object after you get the object. product.SetPrice(20.30); return product; } } ``` compared to regular factory #columns(2, [ #text(green)[Benefits] - Grouping of objects without duplication #colbreak() #text(red)[Liabilities] ]) #subsection([Adapter]) *Problem* | How can i make incompatible interfaces compatible?\ *Solution* | Put a wrapper around the object, which implements the incompatible endpoint. On these functions, you can then convert whatever you already have to the endpoint.\ #align(center, [#image("../uml/adapter.jpg", width: 100%)]) ```java interface ILightningPhone { void recharge(); void useLightning(); } interface IMicroUsbPhone { void recharge(); void useMicroUsb(); } class Iphone implements ILightningPhone { private boolean connector; @Override public void useLightning() { connector = true; System.out.println("Lightning connected"); } @Override public void recharge() { if (connector) { System.out.println("Recharge started"); System.out.println("Recharge finished"); } else { System.out.println("Connect Lightning first"); } } } class Android implements IMicroUsbPhone { private boolean connector; @Override public void useMicroUsb() { connector = true; System.out.println("MicroUsb connected"); } @Override public void recharge() { if (connector) { System.out.println("Recharge started"); System.out.println("Recharge finished"); } else { System.out.println("Connect MicroUsb first"); } } } /* exposing the target interface while wrapping source object */ class LightningToMicroUsbAdapter implements IMicroUsbPhone { private final ILightningPhone lightningPhone; public LightningToMicroUsbAdapter(ILightningPhone lightningPhone) { this.lightningPhone = lightningPhone; } @Override public void useMicroUsb() { System.out.println("MicroUsb connected"); lightningPhone.useLightning(); } @Override public void recharge() { lightningPhone.recharge(); } } public class AdapterDemo { static void rechargeMicroUsbPhone(IMicroUsbPhone phone) { phone.useMicroUsb(); phone.recharge(); } static void rechargeLightningPhone(ILightningPhone phone) { phone.useLightning(); phone.recharge(); } public static void main(String[] args) { Android android = new Android(); Iphone iPhone = new Iphone(); System.out.println("Recharging android with MicroUsb"); rechargeMicroUsbPhone(android); System.out.println("Recharging iPhone with Lightning"); rechargeLightningPhone(iPhone); System.out.println("Recharging iPhone with MicroUsb"); rechargeMicroUsbPhone(new LightningToMicroUsbAdapter (iPhone)); } } ``` #columns(2, [ #text(green)[Benefits] - flexibility #colbreak() #text(red)[Liabilities] - indirection ]) #subsection([Facade]) *Problem* | How can I hide complex logic from users and provide a simpler interface?\ *Solution* | Create a facade that will be used by clients instead of the underlying system.\ #align(center, [#image("../uml/facade.png", width: 100%)]) ```cpp struct CPU { void Freeze(); void Jump(long position); void Execute(); }; struct HardDrive { char* Read(long lba, int size); }; struct Memory { void Load(long position, char* data); }; class ComputerFacade { public: void Start() { cpu_.Freeze(); memory_.Load(kBootAddress, hard_drive_.Read(kBootSector, kSectorSize)); cpu_.Jump(kBootAddress); cpu_.Execute(); } private: CPU cpu_; Memory memory_; HardDrive hard_drive_; }; int main() { ComputerFacade computer; computer.Start(); } ``` #columns(2, [ #text(green)[Benefits] - easier to read and use - generalization or context specific usage with different facades - allows for a non-specific base implementation #colbreak() #text(red)[Liabilities] - indirection - can be too much -> black magic ]) #subsection([Proxy]) *Problem* | How can I manage access to a resource indirectly?\ *Context* | Often access should not happen directly for security reasons, or for potential unavailability -> remote resource.\ *Solution* | Introduce a proxy that will interact with the resource on your behalf.\ #align(center, [#image("../uml/proxy.jpg", width: 100%)]) ```java // Internet interface public interface Internet { public void connectTo(String serverhost) throws Exception; } // Implementation public class RealInternet implements Internet { @Override public void connectTo(String serverhost) { System.out.println("Connecting to "+ serverhost); } } // Proxy import java.util.ArrayList; import java.util.List; public class ProxyInternet implements Internet { private Internet internet = new RealInternet(); private static List<String> bannedSites; static { bannedSites = new ArrayList<String>(); bannedSites.add("abc.com"); bannedSites.add("def.com"); bannedSites.add("ijk.com"); bannedSites.add("lnm.com"); } @Override public void connectTo(String serverhost) throws Exception { if(bannedSites.contains(serverhost.toLowerCase())) { throw new Exception("Access Denied"); } internet.connectTo(serverhost); } } // usage in client public class Client { public static void main (String[] args) { Internet internet = new ProxyInternet(); try { internet.connectTo("geeksforgeeks.org"); internet.connectTo("abc.com"); } catch (Exception e) { System.out.println(e.getMessage()); } } } ``` Variations:\ - *Remote Proxy*: Proxy that ensures remote point is either available or proper error handling is used instead. - *Virtual Proxy*: Proxy that ensures efficient access to a resource that is costly to interact with. - *Protection Proxy*: Ensures authentication and authorization for a certain resource. #columns(2, [ #text(green)[Benefits] - ease of use - example: no need to know about security or availability #colbreak() #text(red)[Liabilities] - indirection ]) #subsection([Bridge]) *Problem* | How can I make interfaces for objects interchangeable?\ *Solution* | Create an interface for the object and another for the behavior. Then the object will hold a reference to the implementation, which can be exchanged at will.\ *Example* | interface animal has a behavior. Monkey -> Monkeybehavior, Peng -> pengereng\ #align(center, [#image("../uml/bridge.jpg", width: 100%)]) ```cs // Helps in providing truly decoupled architecture public interface IBridge { void Function1(); void Function2(); } public class Bridge1 : IBridge { public void Function1() { Console.WriteLine("Bridge1.Function1"); } public void Function2() { Console.WriteLine("Bridge1.Function2"); } } public class Bridge2 : IBridge { public void Function1() { Console.WriteLine("Bridge2.Function1"); } public void Function2() { Console.WriteLine("Bridge2.Function2"); } } public interface IAbstractBridge { void CallMethod1(); void CallMethod2(); } public class AbstractBridge : IAbstractBridge { public IBridge bridge; public AbstractBridge(IBridge bridge) { this.bridge = bridge; } public void CallMethod1() { this.bridge.Function1(); } public void CallMethod2() { this.bridge.Function2(); } } ``` #columns( 2, [ #text(green)[Benefits] - flexibility -> objects can exchange interfaces at will - similar to pointer to implementation -> can also be exchanged - Reduces the amount of objects necessary to implement all combinations - each animal to each behavior, etc. #colbreak() #text(red)[Liabilities] - indirection - unclear what the behavior will do exactly - you would need to know the exact implementation ], ) #subsection([Composite]) *Problem* | How can I model the existance of subnodes within classes?\ *Solution* | One interface, 2 implementations, one is the leaf, the other is the node(composite).\ *Example* | Representation of tree structures\ #align(center, [#image("../uml/composite.jpg", width: 100%)]) #align(center, [#image("../uml/composite2.jpg", width: 100%)]) ```cpp #include <iostream> #include <string> #include <list> #include <memory> #include <stdexcept> typedef double Currency; // declares the interface for objects in the composition. class Equipment { // Component public: // implements default behavior for the interface common to all classes, as appropriate. virtual const std::string& getName() { return name; } virtual void setName(const std::string& name_) { name = name_; } virtual Currency getNetPrice() { return netPrice; } virtual void setNetPrice(Currency netPrice_) { netPrice = netPrice_; } // declares an interface for accessing and managing its child components. virtual void add(std::shared_ptr<Equipment>) = 0; virtual void remove(std::shared_ptr<Equipment>) = 0; virtual ~Equipment() = default; protected: Equipment() :name(""), netPrice(0) {} Equipment(const std::string& name_) :name(name_), netPrice(0) {} private: std::string name; Currency netPrice; }; // defines behavior for components having children. class CompositeEquipment : public Equipment { // Composite public: // implements child-related operations in the Component interface. virtual Currency getNetPrice() override { Currency total = Equipment::getNetPrice(); for (const auto& i:equipment) { total += i->getNetPrice(); } return total; } virtual void add(std::shared_ptr<Equipment> equipment_) override { equipment.push_front(equipment_.get()); } virtual void remove(std::shared_ptr<Equipment> equipment_) override { equipment.remove(equipment_.get()); } protected: CompositeEquipment() :equipment() {} CompositeEquipment(const std::string& name_) :equipment() { setName(name_); } private: // stores child components. std::list<Equipment*> equipment; }; // represents leaf objects in the composition. class FloppyDisk : public Equipment { // Leaf public: FloppyDisk(const std::string& name_) { setName(name_); } // A leaf has no children. void add(std::shared_ptr<Equipment>) override { throw std::runtime_error("FloppyDisk::add"); } void remove(std::shared_ptr<Equipment>) override { throw std::runtime_error("FloppyDisk::remove"); } }; class Chassis : public CompositeEquipment { public: Chassis(const std::string& name_) { setName(name_); } }; int main() { // The smart pointers prevent memory leaks. std::shared_ptr<FloppyDisk> fd1 = std::make_shared<FloppyDisk>("3.5in Floppy"); fd1->setNetPrice(19.99); std::cout << fd1->getName() << ": netPrice=" << fd1->getNetPrice() << '\n'; std::shared_ptr<FloppyDisk> fd2 = std::make_shared<FloppyDisk>("5.25in Floppy"); fd2->setNetPrice(29.99); std::cout << fd2->getName() << ": netPrice=" << fd2->getNetPrice() << '\n'; std::unique_ptr<Chassis> ch = std::make_unique<Chassis>("PC Chassis"); ch->setNetPrice(39.99); ch->add(fd1); ch->add(fd2); std::cout << ch->getName() << ": netPrice=" << ch->getNetPrice() << '\n'; fd2->add(fd1); } ``` Note:\ #text( orange, )[A composite is essentially just a class with one or more of the same class within it. -> aka composition] #columns(2, [ #text(green)[Benefits] - nodes and leafs can be interchanged #colbreak() #text(red)[Liabilities] ]) #subsection([Template Method]) *Problem* | How can I create a template for a class so that users can easily implement what is needed?\ *Solution* | Create an interface......\ #align(center, [#image("../uml/template.jpg", width: 100%)]) ```cpp #include <iostream> #include <memory> class View { // AbstractClass public: // defines abstract primitive operations that concrete subclasses define to implement steps of an algorithm. virtual void doDisplay() {} // implements a template method defining the skeleton of an algorithm. The template method calls primitive operations as well as operations defined in AbstractClass or those of other objects. void display() { setFocus(); doDisplay(); resetFocus(); } virtual ~View() = default; private: void setFocus() { std::cout << "View::setFocus\n"; } void resetFocus() { std::cout << "View::resetFocus\n"; } }; class MyView : public View { // ConcreteClass // implements the primitive operations to carry out subclass-specific steps of the algorithm. void doDisplay() override { // render the view's contents std::cout << "MyView::doDisplay\n"; } }; int main() { std::unique_ptr<View> myview = std::make_unique<MyView>(); myview->display(); } ``` Note:\ #text( orange, )[Note, this can also be done with traits in rust, or interfaces for languages that allow default implementations. For something like jafuck, this is not applicable as it doesn't allow default implementations. Hence, for java you *need* to use subclassing to achieve template method pattern.] #columns(2, [ #text(green)[Benefits] - templated classes - users know what needs to be implemented #colbreak() #text(red)[Liabilities] - template has required functions ]) #subsection([Builder]) *Problem* | How can a class (the same construction process) create different representations of a complex object?\ *Solution* | Encapsulate creating and assembling the parts of a complex object in a separate Builder object.\ *Intent* |The intent of the Builder design pattern is to separate the construction of a complex object from its representation. By doing so, the same construction process can create different representations.\ #align(center, [#image("../uml/builder.jpg", width: 100%)]) ```cs /// <summary> /// Represents a product created by the builder. /// </summary> public class Bicycle { public Bicycle(string make, string model, string colour, int height) { Make = make; Model = model; Colour = colour; Height = height; } public string Make { get; set; } public string Model { get; set; } public int Height { get; set; } public string Colour { get; set; } } /// <summary> /// The builder abstraction. /// </summary> public interface IBicycleBuilder { Bicycle GetResult(); string Colour { get; set; } int Height { get; set; } } /// <summary> /// Concrete builder implementation. /// </summary> public class GTBuilder : IBicycleBuilder { public Bicycle GetResult() { return Height == 29 ? new Bicycle("GT", "Avalanche", Colour, Height) : null; } public string Colour { get; set; } public int Height { get; set; } } /// <summary> /// The director. /// </summary> public class MountainBikeBuildDirector { private IBicycleBuilder _builder; public MountainBikeBuildDirector(IBicycleBuilder builder) { _builder = builder; } public void Construct() { _builder.Colour = "Red"; _builder.Height = 29; } public Bicycle GetResult() { return this._builder.GetResult(); } } public class Client { public void DoSomethingWithBicycles() { var director = new MountainBikeBuildDirector(new GTBuilder()); // Director controls the stepwise creation of product and returns the result. director.Construct(); Bicycle myMountainBike = director.GetResult(); } } ``` #columns(2, [ #text(green)[Benefits] - Allows you to vary a product's internal representation. - Encapsulates code for construction and representation. - Provides control over the steps of the construction process. #colbreak() #text(red)[Liabilities] - A distinct ConcreteBuilder must be created for each type of product. - Builder classes must be mutable. - May hamper/complicate dependency injection. ]) #subsection([Prototype]) *Problem* | How can I have rust functionality without using rust? (clone function)\ *Solution* | Implement a "prototype" interface with the clone method in it. Then implement the clone method for all classes that should be cloneable.\ #align(center, [#image("../uml/prototype.jpg", width: 100%)]) ```cpp #include <iostream> enum Direction {North, South, East, West}; class MapSite { public: virtual void enter() = 0; virtual MapSite* clone() const = 0; virtual ~MapSite() = default; }; class Room : public MapSite { public: Room() :roomNumber(0) {} Room(int n) :roomNumber(n) {} void setSide(Direction d, MapSite* ms) { std::cout << "Room::setSide " << d << ' ' << ms << '\n'; } virtual void enter() {} virtual Room* clone() const { // implements an operation for cloning itself. return new Room(*this); } Room& operator=(const Room&) = delete; private: int roomNumber; }; class Wall : public MapSite { public: Wall() {} virtual void enter() {} virtual Wall* clone() const { // copy constructor on clone return new Wall(*this); } }; class Door : public MapSite { public: Door(Room* r1 = nullptr, Room* r2 = nullptr) :room1(r1), room2(r2) {} Door(const Door& other) :room1(other.room1), room2(other.room2) {} virtual void enter() {} virtual Door* clone() const { return new Door(*this); } virtual void initialize(Room* r1, Room* r2) { room1 = r1; room2 = r2; } Door& operator=(const Door&) = delete; private: Room* room1; Room* room2; }; class Maze { public: void addRoom(Room* r) { std::cout << "Maze::addRoom " << r << '\n'; } Room* roomNo(int) const { return nullptr; } virtual Maze* clone() const { return new Maze(*this); } virtual ~Maze() = default; }; class MazeFactory { public: MazeFactory() = default; virtual ~MazeFactory() = default; virtual Maze* makeMaze() const { return new Maze; } virtual Wall* makeWall() const { return new Wall; } virtual Room* makeRoom(int n) const { return new Room(n); } virtual Door* makeDoor(Room* r1, Room* r2) const { return new Door(r1, r2); } }; class MazePrototypeFactory : public MazeFactory { public: MazePrototypeFactory(Maze* m, Wall* w, Room* r, Door* d) :prototypeMaze(m), prototypeRoom(r), prototypeWall(w), prototypeDoor(d) {} virtual Maze* makeMaze() const { // creates a new object by asking a prototype to clone itself. return prototypeMaze->clone(); } virtual Room* makeRoom(int) const { return prototypeRoom->clone(); } virtual Wall* makeWall() const { return prototypeWall->clone(); } virtual Door* makeDoor(Room* r1, Room* r2) const { Door* door = prototypeDoor->clone(); door->initialize(r1, r2); return door; } MazePrototypeFactory(const MazePrototypeFactory&) = delete; MazePrototypeFactory& operator=(const MazePrototypeFactory&) = delete; private: Maze* prototypeMaze; Room* prototypeRoom; Wall* prototypeWall; Door* prototypeDoor; }; // If createMaze is parameterized by various prototypical room, door, and wall objects, which it then copies and adds to the maze, then you can change the maze's composition by replacing these prototypical objects with different ones. This is an example of the Prototype (133) pattern. class MazeGame { public: Maze* createMaze(MazePrototypeFactory& m) { Maze* aMaze = m.makeMaze(); Room* r1 = m.makeRoom(1); Room* r2 = m.makeRoom(2); Door* theDoor = m.makeDoor(r1, r2); aMaze->addRoom(r1); aMaze->addRoom(r2); r1->setSide(North, m.makeWall()); r1->setSide(East, theDoor); r1->setSide(South, m.makeWall()); r1->setSide(West, m.makeWall()); r2->setSide(North, m.makeWall()); r2->setSide(East, m.makeWall()); r2->setSide(South, m.makeWall()); r2->setSide(West, theDoor); return aMaze; } }; int main() { MazeGame game; MazePrototypeFactory simpleMazeFactory(new Maze, new Wall, new Room, new Door); game.createMaze(simpleMazeFactory); } ``` Note:\ #text( orange, )[cloning can lead to performance hits, so use it only when needed.] #columns(2, [ #text(green)[Benefits] - both shallow and deep copy possible - can be implemented for every class #colbreak() #text(red)[Liabilities] - needs an implementation for something simple - rust doesn't, hehe, derive kekw ])
https://github.com/rabotaem-incorporated/algebra-conspect-1course
https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/04-linear-algebra/11-rank.typ
typst
Other
#import "../../utils/core.typ": * == Ранг матрицы #ticket[Ранг набора векторов. Столбцовый и строчный ранг матрицы] #def[ Пусть $sq(v) in V$. _Рангом_ набора векторов $sq(v)$ называется размерность его линейной оболочки: $ rk(sq(v)) = Dim Lin(sq(v)) $ ] #lemma[ $rk(sq(v))$ равен наибольшему числу линейно независимых векторов из $sq(v)$. ] #proof[ $W = Lin(sq(v)).$ Найдутся индексы $sq(i, r)$ такие, что $sq(v, i_1, i_r)$ --- базис $W$. Очевидно, $r = rk(sq(v))$. Если $sq(w, l)$ --- ЛНС в $W$, то учитывая что $sq(v, i_1, i_r)$ --- ЛНС в $W$ получаем $l <= Dim W = r$. ] #notice[ Для удобства будем обозначать $i$-ю строку матрицы как $mrow(A, i)$, а $j$-й столбец как $mcol(A, j)$. ] #def[ _Столбцовым рангом_, или просто _рангом_, матрицы $A in M_(m, n)(K)$ называется ранг совокупности ее столбцов. $ rk A = rk(mcol(A, 1), ..., mcol(A, n)). $ Строчным рангом матрицы называется ранг совокупности ее строк. $ rk A^T = rk(mrow(A, 1), ..., mrow(A, m)). $ Совокупности рассматриваются как векторы в пространстве $K^n$ или $K^m$. ] #ticket[Равенство столбцового и строчного ранга] #lemma[ Столбцовый ранг матрицы не изменяется при элементарных преобразованиях ее строк и столбцов. ] #proof[ Пусть произошло преобразование $A ~~> B$. + Рассмотрим элементарные преобразования столбцов. Тогда линейные оболочки столбцов не изменятся, так как при любом элементарном преобразовании получающиеся столбцы будут выражаться через старые. (Точнее, из этого следует одно включение. Второе получается из симметрии.) $ Lin(mcol(A, 1), ..., mcol(A, n)) = Lin(mcol(B, 1), ..., mcol(B, n)) ==> rk A = rk B. $ + #[ Преобразование замены строк местами тривиально, рассмотрим остальные элементарные преобразования строк. Пусть $rk A = r$. Тогда $exists j_1, ..., j_r: space mcol(A, j_1), ..., mcol(A, j_n)$ --- ЛНС. Покажем, что $mcol(B, j_1), ..., mcol(B, j_n)$ --- ЛНС. Предположим, что $ lambda_1 mul mcol(B, j_1) + ... + lambda_r mul mcol(B, j_r) = 0, "где найдется" lambda_* != 0. $ $ B mul underbrace(vec(0, 0, dots.v, lambda_1, dots.v, 0, dots.v, lambda_r, dots.v, 0), d) = 0, space A = U B ==> A d = U B d = 0 ==> A d = 0. $ Но тогда $lambda_1 = ... = lambda_n = 0$, что противоречит предположению. Значит $rk B >= r = rk A$. Аналогично получается обратное неравенство. Значит $rk A = rk B$. ] ] #follow[ Строчный ранг матрицы не меняется при элементарных преобразованиях ее строк и столбцов. ] #proof[ $rk A^T = rk B^T.$ ] #th[ Строчный и столбцовый ранг матрицы совпадают. ] #proof[ Рассмотрим матрицу $A$. Ее можно превратить в окаемленную единичную матрицу $D$. $A ~~> D$. И строчный, и столбцовый ранг матрицы $D$ совпдает и равен количеству единиц $r$ в матрице. Значит $rk A = rk D = r = rk D^T = rk A^T$. ] #notice[ Если $A = P D Q$, то $rk A = rk D = #[количество единиц в $D$]$. ] #ticket[Ранг произведения матриц. Связь ранга с PDQ-разложением] #lemma[ Пусть $A in M_(m, n)(K)$, $B in M_(n, p)(K)$. Тогда $rk(A B) <= min(rk A, rk B)$. ] #proof[ $ cases( mcol(A B, 1) &= A mul mcol(B, 1), mcol(A B, 2) &= A mul mcol(B, 2), & dots.v, mcol(A B, p) &= A mul mcol(B, p), ) ==> Lin(mcol(A B, 1), ..., mcol(A B, p)) subset Lin(mcol(A, 1), ..., mcol(A, n)) ==> rk A B <= rk A. $ $ rk(A) >= rk(A B) = rk((A B)^T) = rk (B^T A^T) <= rk B^T = rk B. $ ] #follow[ $ U in GL_n (K), A in M_(m, n)(K) ==> rk(A U) = rk(A) $ ] #proof[ $ rk(A U) &<= rk A \ rk(A) = rk(A U mul U^(-1)) &<= rk(A U) $ ] #ticket[Условия эквивалентные обратимости матрицы] #pr[ Пусть $U in M_n (K)$. Тогда следующие условия равносильны: + $U in GL_n (K).$ + $exists V in M_n (K): space U V = E_n.$ + $exists V in M_n (K): space V U = E_n.$ + $det(U) != 0.$ + $rk U = n.$ ] #proof[ - "$4 <=> 1$": знаем - "$1 => 2, 3$": тривиально - "$2 => 4$": $ det(U) det(V) = det(U V) = det(E_n) = 1 ==> det(U) != 0 $ - "$3 => 4$": $ det(U) det(V) = det(V U) = det(E_n) = 1 ==> det(U) != 0 $ - "$1 => 5$": $ U V = E_n, V in GL_n (K) ==> rk U = rk (U V) = rk E_n = n $ - "$5 => 1$": $ U = P D Q, rk D = n space "и" space P, Q in GL_n (K) $ ] #ticket[Минорный ранг] #def[ _Подматрицей_ матрицы $A$ называется матрица из которой выбраны некоторые строки и столбцы. ] #def[ _Минором порядка $r$_ матрицы $A$ называется определитель подматрицы $A$ размера $r times r$. ] #th(name: "О минорном ранге")[ Пусть $rk A = r$. Тогда: + В $A$ есть ненулевой минор порядка $r$. + В $A$ нет ненулевого минора порядка $s > r$. ] #proof[ + #[ Так как $rk A = r$, $exists j_1, ..., j_(r): (mcol(A, j_1), ..., mcol(A, j_r))$ --- ЛНС. Оставим только эти столбцы. $ A' = A[;sq(j, r)]. $ Тогда $rk A' = r$, так как все оставшиеся столбцы --- ЛНС. Значит в $A'$ есть $r$ линейно независимых строк, то есть $ exists i_1, ..., i_r: mrow(A', i_1), ..., mrow(A', i_r_1) #[--- ЛНС] $ Из этих строк можно составить матрицу $A''$. Ее ранг равен $r$, а значит определитель этого минора не равен 0. ] + #[ Пусть $s > r$. $B = A[sq(i, s); sq(j, s)]$. $rk B = s$. Значит $B$ имеет $s$ линейно независимых строк, то есть и в $A$ есть $s$ линейно независимых строк. Но $rk A = r < s$. Значит такого минора не найдется. ] ] #follow(name: "Эквивалентное определение ранга")[ Ранг --- это максимальный порядок ненулевого минора. ] #ticket[Теорема Кронекера-Капелли] #th(name: "Кронекера-Капелли")[ Система линейных уравнений $ A mul vec(x_1, dots.v, x_n) = b quad $ Совместна тогда и только тогда, когда $rk A = rk (A | b)$. ] #proof[ - "$==>$": Если система совместна, то $exists sq(x)$: $ x_1 mcol(A, 1) + ... + x_n mcol(A, n) = b space ==> space b in Lin(mcol(A, 1), ..., mcol(A, n)) space ==> \ Lin(mcol(A, 1), ..., mcol(A, n)) = Lin(mcol(A, 1), ..., mcol(A, n), b) space ==> space rk A = rk (A | b). $ - "$<==$": $ rk A = rk(A | b) imply^(A <= (A | b)) Lin(mcol(A, 1), ..., mcol(A, n)) = Lin(mcol(A, 1), ..., mcol(A, n), b) ==> \ b in Lin(mcol(A, 1), ..., mcol(A, n)) space ==> space exists sq(x): space x_1 mcol(A, 1) + ... + x_n mcol(A, n) = b. $ ]
https://github.com/SillyFreak/typst-scrutinize
https://raw.githubusercontent.com/SillyFreak/typst-scrutinize/main/src/task-kinds/mod.typ
typst
MIT License
#import "choice.typ" #import "free-form.typ" #import "gap.typ"
https://github.com/OrangeX4/typst-pinit
https://raw.githubusercontent.com/OrangeX4/typst-pinit/main/README.md
markdown
MIT License
# Pinit Relative positioning by pins, especially useful for making slides in typst. ## Example ### Pin things as you like Have a look at the source [here](./examples/example.typ). ![Example](./examples/example.png) ### Dynamic Slides Pinit works with [Touying](https://github.com/touying-typ/touying) or [Polylux](https://github.com/andreasKroepelin/polylux) animations. Have a look at the pdf file [here](https://github.com/OrangeX4/typst-pinit/blob/main/examples/example.pdf). ![Example Pages](./examples/example-pages.png) ## Usage ### Examples The idea of pinit is pinning pins on the normal flow of the text, and then placing the content on the page by `absolute-place` function. For example, we can highlight text and add a tip by pins simply: ```typ #import "@preview/pinit:0.2.2": * #set text(size: 24pt) A simple #pin(1)highlighted text#pin(2). #pinit-highlight(1, 2) #pinit-point-from(2)[It is simple.] ``` ![simple-demo](./examples/simple-demo.png) If you want to place the content relative to the center of some pins, you use a array of pins: ```typ #import "@preview/pinit:0.2.2": * #set text(size: 12pt) A simple #pin(1)highlighted text#pin(2). #pinit-highlight(1, 2) #pinit-point-from((1, 2))[It is simple.] ``` ![simple-demo2](./examples/simple-demo2.png) A more complex example, Have a look at the source [here](./examples/equation-desc.typ). ![equation-desc](./examples/equation-desc.png) ### Fletcher edge support [Fletcher](https://github.com/Jollywatt/typst-fletcher) is a powerful Typst package for drawing diagrams with arrows. We can use fletcher to draw more complex arrows. [`pinit-fletcher-edge`](#pinit-fletcher-edge) ```typst #import "@preview/pinit:0.2.2": * #import "@preview/fletcher:0.5.1" Con#pin(1)#h(4em)#pin(2)nect #pinit-fletcher-edge( fletcher, 1, end: 2, (1, 0), [bend], bend: -20deg, "<->", decorations: fletcher.cetz.decorations.wave.with(amplitude: .1), ) ``` ![fletcher](./examples/fletcher.png) ### Pinit for raw In the code block, we need to use a regex trick to get pinit to work, for example ```typst #show raw: it => { show regex("pin\d"): it => pin(eval(it.text.slice(3))) it } `print(pin1"hello, world"pin2)` #pinit-highlight(1, 2) ``` ![equation-desc](./examples/pinit-for-raw.png) Note that typst's code highlighting breaks up the text, causing overly complex regular expressions such as '#pin\(.*?\)' to not work properly. However, you may want to consider putting it in a comment to avoid highlighting the text and breaking it up. ## Notice **Since Typst does not provide a reliable `absolute-place` function, you may consider taking the following steps if a MISALIGNMENT occurs:** 1. **You could try to add a `#box()` after the `#pinit-xxx` function call, like `#pinit-xxx()#box()`.** 2. **You should add a blank line before the `#pinit-xxx` function call, otherwise it will cause misalignment.** 3. **You can try moving `#pinit-xxx()` in front of or behind `#pin()`, or otherwhere, in short, try more.** 4. **Try to add a offset to the `dx` or `dy` argument of `#pinit-xxx` function by yourself.** 5. **Open an issue if you have any questions you can't solve.** ## Outline - [Pinit](#pinit) - [Example](#example) - [Pin things as you like](#pin-things-as-you-like) - [Dynamic Slides](#dynamic-slides) - [Usage](#usage) - [Examples](#examples) - [Fletcher edge support](#fletcher-edge-support) - [Pinit for raw](#pinit-for-raw) - [Notice](#notice) - [Outline](#outline) - [Reference](#reference) - [`pin`](#pin) - [`pinit`](#pinit-1) - [`absolute-place`](#absolute-place) - [`pinit-place`](#pinit-place) - [`pinit-rect`](#pinit-rect) - [`pinit-highlight`](#pinit-highlight) - [`pinit-line`](#pinit-line) - [`pinit-line-to`](#pinit-line-to) - [`pinit-arrow`](#pinit-arrow) - [`pinit-double-arrow`](#pinit-double-arrow) - [`pinit-point-to`](#pinit-point-to) - [`pinit-point-from`](#pinit-point-from) - [`simple-arrow`](#simple-arrow) - [`double-arrow`](#double-arrow) - [`pinit-fletcher-edge`](#pinit-fletcher-edge) - [Changelog](#changelog) - [0.2.2](#022) - [0.2.1](#021) - [0.2.0](#020) - [0.1.4](#014) - [0.1.3](#013) - [0.1.2](#012) - [0.1.1](#011) - [0.1.0](#010) - [Acknowledgements](#acknowledgements) - [License](#license) ## Reference ### `pin` Pinning a pin in text, the pin is supposed to be unique in one page. ```typ #let pin(name) = { .. } ``` **Arguments:** - `name`: [`int` or `str` or `any`] &mdash; Name of pin, which can be any types with unique `repr()` return value, such as integer and string. ### `pinit` Query positions of pins in the same page, then call the callback function `callback`. ```typ #let pinit(callback: none, ..pins) = { .. } ``` **Arguments:** - `..pins`: [`pin`] &mdash; Names of pins you want to query. It is supposed to be arguments of pin or a group of pins. - `callback`: [`(..positions) => { .. }`] &mdash; A callback function accepting an array of positions (or a single position) as a parameter. Each position is a dictionary like `(page: 1, x: 319.97pt, y: 86.66pt)`. You can use the `absolute-place` function in this callback function to display something around the pins. ### `absolute-place` Place content at a specific location on the page relative to the top left corner of the page, regardless of margins, current containers, etc. > This function comes from [typst-drafting](https://github.com/ntjess/typst-drafting). ```typ #let absolute-place( dx: 0em, dy: 0em, body, ) = { .. } ``` **Arguments:** - `dx`: [`length`] &mdash; Length in the x-axis relative to the left edge of the page. - `dy`: [`length`] &mdash; Length in the y-axis relative to the top edge of the page. - `content`: [`content`] &mdash; The content you want to place. ### `pinit-place` Place content at a specific location on the page relative to the pin. ```typ #let pinit-place( dx: 0pt, dy: 0pt, pin-name, body, ) = { .. } ``` **Arguments:** - `dx`: [`length`] &mdash; Offset X relative to the pin. - `dy`: [`length`] &mdash; Offset Y relative to the pin. - `pin-name`: [`pin`] &mdash; Name of the pin to which you want to locate. - `body`: [`content`] &mdash; The content you want to place. ### `pinit-rect` Draw a rectangular shape on the page **containing all pins** with optional extended width and height. ```typ #let pinit-rect( dx: 0em, dy: -1em, extended-width: 0em, extended-height: 1.4em, pin1, pin2, pin3, // Optional ..pinX, ..args, ) = { .. } ``` **Arguments:** - `dx`: [`length`] &mdash; Offset X relative to the min-left of pins. - `dy`: [`length`] &mdash; Offset Y relative to the min-top of pins. - `extended-width`: [`length`] &mdash; Optional extended width of the rectangular shape. - `extended-height`: [`length`] &mdash; Optional extended height of the rectangular shape. - `pin1`: [`pin`] &mdash; One of these pins. - `pin2`: [`pin`] &mdash; One of these pins. - `pin3`: [`pin`] &mdash; One of these pins, optionally. - `...args`: Additional named arguments or settings for [`rect`](https://typst.app/docs/reference/visualize/rect/), like `fill`, `stroke` and `radius`. ### `pinit-highlight` Highlight a specific area on the page with a filled color and optional radius and stroke. It is just a simply styled `pinit-rect`. ```typ #let pinit-highlight( fill: rgb(255, 0, 0, 20), radius: 5pt, stroke: 0pt, dx: 0em, dy: -1em, extended-width: 0em, extended-height: 1.4em, pin1, pin2, pin3, // Optional ..pinX, ...args, ) = { .. } ``` **Arguments:** - `fill`: [`color`] &mdash; The fill color for the highlighted area. - `radius`: [`length`] &mdash; Optional radius for the highlight. - `stroke`: [`stroke`] &mdash; Optional stroke width for the highlight. - `dx`: [`length`] &mdash; Offset X relative to the min-left of pins. - `dy`: [`length`] &mdash; Offset Y relative to the min-top of pins. - `extended-width`: [`length`] &mdash; Optional extended width of the rectangular shape. - `extended-height`: [`length`] &mdash; Optional extended height of the rectangular shape. - `pin1`: [`pin`] &mdash; One of these pins. - `pin2`: [`pin`] &mdash; One of these pins. - `pin3`: [`pin`] &mdash; One of these pins, optionally. - `...args`: Additional arguments or settings for [`pinit-rect`](#pinit-rect). ### `pinit-line` Draw a line on the page between two specified pins with an optional stroke. ```typ #let pinit-line( stroke: 1pt, start-dx: 0pt, start-dy: 0pt, end-dx: 0pt, end-dy: 0pt, start, end, ) = { ... } ``` **Arguments:** - `stroke`: [`stroke`] &mdash; The stroke for the line. - `start-dx`: [`length`] &mdash; Offset X relative to the start pin. - `start-dy`: [`length`] &mdash; Offset Y relative to the start pin. - `end-dx`: [`length`] &mdash; Offset X relative to the end pin. - `end-dy`: [`length`] &mdash; Offset Y relative to the end pin. - `start`: [`pin`] &mdash; The start pin. - `end`: [`pin`] &mdash; The end pin. ### `pinit-line-to` Draw an line from a specified pin to a point on the page with optional settings. ```typ #let pinit-line-to( stroke: 1pt, pin-dx: 5pt, pin-dy: 5pt, body-dx: 5pt, body-dy: 5pt, offset-dx: 35pt, offset-dy: 35pt, pin-name, body, ) = { ... } ``` **Arguments:** - `stroke`: [`stroke`] &mdash; The stroke for the line. - `pin-dx`: [`length`] &mdash; Offset X of arrow start relative to the pin. - `pin-dy`: [`length`] &mdash; Offset Y of arrow start relative to the pin. - `body-dx`: [`length`] &mdash; Offset X of arrow end relative to the body. - `body-dy`: [`length`] &mdash; Offset Y of arrow end relative to the body. - `offset-dx`: [`length`] &mdash; Offset X relative to the pin. - `offset-dy`: [`length`] &mdash; Offset Y relative to the pin. - `pin-name`: [`pin`] &mdash; The name of the pin to start from. - `body`: [`content`] &mdash; The content to draw the arrow to. ### `pinit-arrow` Draw an arrow between two specified pins with optional settings. ```typ #let pinit-arrow( start-dx: 0pt, start-dy: 0pt, end-dx: 0pt, end-dy: 0pt, start, end, ..args, ) = { ... } ``` **Arguments:** - `start-dx`: [`length`] &mdash; Offset X relative to the start pin. - `start-dy`: [`length`] &mdash; Offset Y relative to the start pin. - `end-dx`: [`length`] &mdash; Offset X relative to the end pin. - `end-dy`: [`length`] &mdash; Offset Y relative to the end pin. - `start`: [`pin`] &mdash; The start pin. - `end`: [`pin`] &mdash; The end pin. - `...args`: Additional arguments or settings for [`simple-arrow`](#simple-arrow), like `fill`, `stroke` and `thickness`. ### `pinit-double-arrow` Draw an double arrow between two specified pins with optional settings. ```typ #let pinit-double-arrow( start-dx: 0pt, start-dy: 0pt, end-dx: 0pt, end-dy: 0pt, start, end, ..args, ) = { ... } ``` **Arguments:** - `start-dx`: [`length`] &mdash; Offset X relative to the start pin. - `start-dy`: [`length`] &mdash; Offset Y relative to the start pin. - `end-dx`: [`length`] &mdash; Offset X relative to the end pin. - `end-dy`: [`length`] &mdash; Offset Y relative to the end pin. - `start`: [`pin`] &mdash; The start pin. - `end`: [`pin`] &mdash; The end pin. - `...args`: Additional arguments or settings for [`double-arrow`](#double-arrow), like `fill`, `stroke` and `thickness`. ### `pinit-point-to` Draw an arrow from a specified pin to a point on the page with optional settings. ```typ #let pinit-point-to( pin-dx: 5pt, pin-dy: 5pt, body-dx: 5pt, body-dy: 5pt, offset-dx: 35pt, offset-dy: 35pt, double: false, pin-name, body, ..args, ) = { ... } ``` **Arguments:** - `pin-dx`: [`length`] &mdash; Offset X of arrow start relative to the pin. - `pin-dy`: [`length`] &mdash; Offset Y of arrow start relative to the pin. - `body-dx`: [`length`] &mdash; Offset X of arrow end relative to the body. - `body-dy`: [`length`] &mdash; Offset Y of arrow end relative to the body. - `offset-dx`: [`length`] &mdash; Offset X relative to the pin. - `offset-dy`: [`length`] &mdash; Offset Y relative to the pin. - `double`: [`bool`] &mdash; Draw a double arrow, default is `false`. - `pin-name`: [`pin`] &mdash; The name of the pin to start from. - `body`: [`content`] &mdash; The content to draw the arrow to. - `...args`: Additional arguments or settings for [`simple-arrow`](#simple-arrow), like `fill`, `stroke` and `thickness`. ### `pinit-point-from` Draw an arrow from a point on the page to a specified pin with optional settings. ```typ #let pinit-point-from( pin-dx: 5pt, pin-dy: 5pt, body-dx: 5pt, body-dy: 5pt, offset-dx: 35pt, offset-dy: 35pt, double: false, pin-name, body, ..args, ) = { ... } ``` **Arguments:** - `pin-dx`: [`length`] &mdash; Offset X relative to the pin. - `pin-dy`: [`length`] &mdash; Offset Y relative to the pin. - `body-dx`: [`length`] &mdash; Offset X relative to the body. - `body-dy`: [`length`] &mdash; Offset Y relative to the body. - `offset-dx`: [`length`] &mdash; Offset X relative to the left edge of the page. - `offset-dy`: [`length`] &mdash; Offset Y relative to the top edge of the page. - `double`: [`bool`] &mdash; Draw a double arrow, default is `false`. - `pin-name`: [`pin`] &mdash; The name of the pin that the arrow to. - `body`: [`content`] &mdash; The content to draw the arrow from. - `...args`: Additional arguments or settings for [`simple-arrow`](#simple-arrow), like `fill`, `stroke` and `thickness`. ### `simple-arrow` Draw a simple arrow on the page with optional settings, implemented by [`polygon`](https://typst.app/docs/reference/visualize/polygon/). ```typ #let simple-arrow( fill: black, stroke: 0pt, start: (0pt, 0pt), end: (30pt, 0pt), thickness: 2pt, arrow-width: 4, arrow-height: 4, inset: 0.5, tail: (), ) = { ... } ``` **Arguments:** - `fill`: [`color`] &mdash; The fill color for the arrow. - `stroke`: [`stroke`] &mdash; The stroke for the arrow. - `start`: [`point`] &mdash; The starting point of the arrow. - `end`: [`point`] &mdash; The ending point of the arrow. - `thickness`: [`length`] &mdash; The thickness of the arrow. - `arrow-width`: [`int` or `float`] &mdash; The width of the arrowhead relative to thickness. - `arrow-height`: [`int` or `float`] &mdash; The height of the arrowhead relative to thickness. - `inset`: [`int` or `float`] &mdash; The inset value for the arrowhead relative to thickness. - `tail`: [`array`] &mdash; The tail settings for the arrow. ### `double-arrow` Draw a double arrow on the page with optional settings, implemented by [`polygon`](https://typst.app/docs/reference/visualize/polygon/). ```typ #let double-arrow( fill: black, stroke: 0pt, start: (0pt, 0pt), end: (30pt, 0pt), thickness: 2pt, arrow-width: 4, arrow-height: 4, inset: 0.5, tail: (), ) = { ... } ``` **Arguments:** - `fill`: [`color`] &mdash; The fill color for the arrow. - `stroke`: [`stroke`] &mdash; The stroke for the arrow. - `start`: [`point`] &mdash; The starting point of the arrow. - `end`: [`point`] &mdash; The ending point of the arrow. - `thickness`: [`length`] &mdash; The thickness of the arrow. - `arrow-width`: [`int` or `float`] &mdash; The width of the arrowhead relative to thickness. - `arrow-height`: [`int` or `float`] &mdash; The height of the arrowhead relative to thickness. - `inset`: [`int` or `float`] &mdash; The inset value for the arrowhead relative to thickness. - `tail`: [`array`] &mdash; The tail settings for the arrow. ### `pinit-fletcher-edge` Draw a connecting line or arc in an fletcher arrow diagram. ```typ #let pinit-fletcher-edge( fletcher, start, end: none, start-dx: 0pt, start-dy: 0pt, end-dx: 0pt, end-dy: 0pt, width-scale: 100%, height-scale: 100%, default-width: 30pt, default-height: 30pt, ..args, ) = { ... } ``` **Arguments:** - `fletcher` (module): The Fletcher module. You can import it with something like `#import "@preview/fletcher:0.5.1"` - `start` (pin): The starting pin of the edge. It is assumed that the pin is at the *origin point (0, 0)* of the edge. - `end` (pin): The ending pin of the edge. If not provided, the edge will use default values for the width and height. - `start-dx` (length): The x-offset of the starting pin. You should use pt units. - `start-dy` (length): The y-offset of the starting pin. You should use pt units. - `end-dx` (length): The x-offset of the ending pin. You should use pt units. - `end-dy` (length): The y-offset of the ending pin. You should use pt units. - `width-scale` (percent): The width scale of the edge. The default value is 100%. If you set the width scale to 50%, the width of the edge will be half of the default width. Then you can use `"r,r"` which is equivalent to single `"r"`. - `height-scale` (percent): The height scale of the edge. The default value is 100%. - `default-width` (length): The default width of the edge. The default value is 30pt, which will only be used if the end pin is not provided or the width is 0pt or 0em. - `default-height` (length): The default height of the edge. The default value is 30pt, which will only be used if the end pin is not provided or the height is 0pt or 0em. - `..args` (any): An edge's positional arguments may specify: - the edge's #param[edge][vertices], each specified with a CeTZ-style coordinate - the #param[edge][label] content - arrow #param[edge][marks], like `"=>"` or `"<<-|-o"` - other style flags, like `"double"` or `"wave"` ## Changelog ### 0.2.2 - Fix bugs. ### 0.2.1 - To be compatible with Typst 0.12. ### 0.2.0 - **Breaking changes**: `#pinit(pins, func)` is replaced by `#pinit(callback: none, ..pins)` and the callback argument will receive an `(..positions) => { .. }` function instead of a `(positions) => { .. }` function. - **Migration**: you need to use a named argument `callback: (..positions) => { .. }` to specify the callback function. - **Migration**: you cannot use a array as a pin name. Now `#pinit((pin1, pin2), callback: func)` means that we use `pin1` and `pin2` as a group of pins, and the callback function will receive **a single position** (the center of the bounding box of `pin1` and `pin2`). - **Benefit**: you can use `#pinit(pin1, pin2, callback: func)` to query the positions of `pin1` and `pin2` separately, and `#pinit((pin1, pin2), callback: func)` to query the position of the center of the bounding box of `pin1` and `pin2`. - Add `pinit-fletcher-edge` function to draw a connecting line or arc in an fletcher arrow diagram. - Add `double-arrow` function and `pinit-double-arrow` function. - Add `double` argument for `pinit-point-to` and `pinit-point-from` functions. - Better comments and documentation. ### 0.1.4 - Update documentation. ### 0.1.3 - Add `pinit-line-to` function. ### 0.1.2 - Add em unit support for `simple-arrow`. ### 0.1.1 - Fix some bugs. ### 0.1.0 - Initial release. ## Acknowledgements - Some of the inspirations and codes comes from [typst-drafting](https://github.com/ntjess/typst-drafting). - The concise and aesthetic example slide style come from course *Data Structures and Algorithms* of [Chaodong ZHENG](https://chaodong.me/). - Thank [PaulS](https://github.com/psads-git) for double arrow feature. - Thank [Jollywatt](https://github.com/Jollywatt) for fletcher package. ## License This project is licensed under the MIT License.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/chronos/0.1.0/README.md
markdown
Apache License 2.0
# chronos A Typst package to draw sequence diagrams with CeTZ --- This package lets you render sequence diagrams directly in Typst. The following boilerplate code creates an empty sequence diagram with two participants: <table> <tr> <td><strong>Typst</strong></td> <td><strong>Result</strong></td> </tr> <tr> <td> ```typst #import "@preview/chronos:0.1.0" #chronos.diagram({ import chronos: * _par("Alice") _par("Bob") }) ``` </td> <td><img src="./gallery/readme/boilerplate.png"></td> </tr> </table> > *Disclaimer*\ > The package cannot parse PlantUML syntax for the moment, and thus requires the use of element functions, as shown in the examples. > A PlantUML parser is in the TODO list, just not the top priority ## Basic sequences You can make basic sequences using the `_seq` function: <table> <tr> <td><strong>Typst</strong></td> <td><strong>Result</strong></td> </tr> <tr> <td> ```typst #chronos.diagram({ import chronos: * _par("Alice") _par("Bob") _seq("Alice", "Bob", comment: "Hello") _seq("Bob", "Bob", comment: "Think") _seq("Bob", "Alice", comment: "Hi") }) ``` </td> <td><img src="./gallery/readme/simple_sequence.png"></td> </tr> </table> You can make lifelines using the following parameters of the `_seq` function: - `enable-dst`: enables the destination lifeline - `create-dst`: creates the destination lifeline and participant - `disable-dst`: disables the destination lifeline - `destroy-dst`: destroys the destination lifeline and participant - `disable-src`: disables the source lifeline - `destroy-src`: destroy the source lifeline and participant <table> <tr> <td><strong>Typst</strong></td> <td><strong>Result</strong></td> </tr> <tr> <td> ```typst #chronos.diagram({ import chronos: * _par("A", display-name: "Alice") _par("B", display-name: "Bob") _par("C", display-name: "Charlie") _par("D", display-name: "Derek") _seq("A", "B", comment: "hello", enable-dst: true) _seq("B", "B", comment: "self call", enable-dst: true) _seq("C", "B", comment: "hello from thread 2", enable-dst: true, lifeline-style: (fill: rgb("#005500"))) _seq("B", "D", comment: "create", create-dst: true) _seq("B", "C", comment: "done in thread 2", disable-src: true, dashed: true) _seq("B", "B", comment: "rc", disable-src: true, dashed: true) _seq("B", "D", comment: "delete", destroy-dst: true) _seq("B", "A", comment: "success", disable-src: true, dashed: true) }) ``` </td> <td><img src="./gallery/readme/lifelines.png"></td> </tr> </table> ## Showcase Several features have already been implemented in Chronos. Don't hesitate to checkout the examples in the [gallery](./gallery) folder to see what you can do. #### Quick example reference: <table> <tr> <td><strong>Example</strong></td> <td><strong>Features</strong></td> </tr> <tr> <td> `example1` <br>([PDF](./gallery/example1.pdf)|[Typst](./gallery/example1.typ)) </td> <td>Simple cases, color sequences, groups, separators, gaps, self-sequences</td> </tr> <tr> <td> `example2` <br>([PDF](./gallery/example2.pdf)|[Typst](./gallery/example2.typ)) </td> <td>Lifelines, found/lost messages, synchronized sequences, slanted sequences</td> </tr> <tr> <td> `example3` <br>([PDF](./gallery/example3.pdf)|[Typst](./gallery/example3.typ)) </td> <td>Participant shapes, sequence tips, hidden partipicant ends</td> </tr> <tr> <td> `notes` <br>([PDF](./gallery/notes.pdf)|[Typst](./gallery/notes.typ)) </td> <td>Notes (duh), deferred participant creation</td> </tr> </table> > [!NOTE] > > Many examples were taken/adapted from the PlantUML [documentation](https://plantuml.com/sequence-diagram) on sequence diagrams
https://github.com/Cyclone-Robosub/ocean-report-crs
https://raw.githubusercontent.com/Cyclone-Robosub/ocean-report-crs/main/0.1.0/template/main.typ
typst
#import "@preview/ocean-report-crs:0.1.0": * #show: report.with( title: "This is the Title", subtitle: "This is the Subtitle", // date: "Don't want the auto date? Add your own date here!", // org: "Add your own org here!", // logo: "Add the path to your own logo file here!", ) // Add your content below to get started!
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/linebreak-obj-00.typ
typst
Other
// Test punctuation after citations. #set page(width: 162pt) They can look for the details in @netwok, which is the authoritative source. #bibliography("/works.bib")
https://github.com/oliversssf2/do-math
https://raw.githubusercontent.com/oliversssf2/do-math/main/Grimmett_Strizaker/Ch1.typ
typst
#set page("a5") #set heading(numbering: "1.1") #set math.equation(numbering: "(1)") = Events and their probabilities == Introduction == Event as sets *Definition.* sample space is all the possible outcomes of an experiment, and it is denoted by $Omega$. *Definition.* Events are subsets of $Omega$. Let $cal(F)$ be the subcollection (or the collection of events) of the set of all subsets of $Omega$. This subcollection should have the following properties: + if $A, B in cal(F)$ then $A union B in cal(F)$ and $A sect B in cal(F)$; + if $a in cal(F)$ then $A^C in cal(F)$; + the empty set $emptyset in cal(F)$. *Definition.* A collection $cal(F)$ of subsets of $Omega$ is called a $bold(sigma"-field")$ if it satisfies the following conditions: + $emptyset in cal(F)$; + if $A_1, A_2, dots, in cal(F)$, then $union.big_(i=1)^infinity A_i in cal(F)$; + if $A in cal(F)$, then $A^C in cal(F)$. === Exercises 1. skipped 2. Let $A in cal(F), B in cal(F)$. We know that $A sect B in cal(F)$ by the definition of a $sigma"-field"$. For $A backslash B$, we know that $A backslash B = A sect B^C in cal(F)$. For $A Delta B$, we know that $A Delta B = (A backslash B) U (B backslash A) in cal(F)$. 3. 4. (a) $union (A_i sect B) = (union A_i) sect B in cal(G)$. (b) $sect (A_i sect B) = (sect A_i) sect B in cal(G)$. (c) $emptyset in cal(G)$ obviously. (d) $(A sect B)^C = B backslash (A sect B) = B sect A^C in cal(G)$. == Probability *Definition.* A *probability measure* $PP$ on $(Omega, cal(F))$ is a function $PP: cal(F) arrow [0,1]$ statisfying (a) $PP(emptyset) = 0, PP(Omega) = 1$; (b) if $A_1, A_2, dots$ is a collection of disjoint members of $cal(F)$, in that $A_i sect A_j = emptyset$ for all pairs $i, j$ satisfying $i eq.not j$, then $ PP(union.big_(i=1)^infinity A_i) = sum_(i=1)^infinity PP(A_i). $ The triple $(Omega, cal(F), PP)$, comprising a set $Omega$, a $sigma"-field" cal(F)$ of subsets of $Omega$, and a probability measure $PP$ on $(Omega, cal(F)$), is called a probability space. *Lemma.*\ (a) $PP(A^C) = 1-PP(A)$ \ (b) if $B supset.eq A "then" PP(B) = PP(A) + P(B backslash A) gt.eq PP(A)$,\ (c) $PP(A union B) = PP(A) + PP(B) - PP(A sect B)$,\ (d) *(inclusion-exclusion principle)* more generally, if $A_1, A_2, dots, A_n$ are events, then $ PP(union.big_(i=1)^n A_i) &= sum_i PP(A_i) - sum_(i lt j) PP(A_i sect A_j) + sum_(i<j<k) PP(A_i sect A_j sect A_k) \ &- dots + (-1)^(n+1) PP(A_1 sect A_2 sect dots sect A_n) $ == conditional probability *Lemma.* Let $B_1, B_2, dots, B_n$ be a partition of $Omega$ such that $PP(B_i) > 0$ for all $i$. Then $ PP(A) = sum_(i=1)^n PP(A|B_i)PP(B_i) $. == Independence *Definition.* Events $A$ and $B$ are called *independent* if $ PP(A sect B) =PP(A)PP(B) $. More generally, a family ${A_i: i in I}$ is called *independent* if $ PP(sect.big_(i in J) A_i) = product_(i in J) PP(A_i) $ for all finite subsets $J$ of $I$. == Completeness and Product Spaces
https://github.com/neeruuppalapati/MATH-Notes
https://raw.githubusercontent.com/neeruuppalapati/MATH-Notes/main/README.md
markdown
All notes written in typst-app
https://github.com/rabotaem-incorporated/algebra-conspect-1course
https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/01-number-theory/07-diophantine-equations.typ
typst
Other
#import "../../utils/core.typ": * == Линейные диофантовы уравнения #def[ _Линейным диофантовым уравнением_ с двумя неизвестными называется уравнение вида $a x + b y = c$, где $a, b, c in ZZ$. ] #def[ _Решением линейного диофантова уравнения_ называется множество всех пар $(x, y) in ZZ^2: space a x + b y = c$. ] #notice[ Если $gcd(a, b) divides.not c$, то решение --- пустое множество, так как все линейные комбинации $a, b$ делятся на $gcd(a, b)$. ] #notice[ Теперь заметим следующее: если $a x_1 + b y_1 = c$ и $a x_2 + b y_2 = c$, то $a(x_1 - x_2) + b(y_1 - y_2) = 0$. Иными словами, разность двух решений линейного диофантова уравнения --- решение соответствующего однородного уравнения. ] А значит все решения линейного диофантова уравнения можно найти, решив однородное уравнение и прибавив ко всем его решениям какое-то решение исходного уравнения. Решим однородное уравнение: $a x + b y = 0 <==> a x = -b y$ Пусть $d = gcd(a, b), space a = d a', space b = d b'$ $a x = -b y <==> d a'x = -d b'y <==> a'x = -b'y limits(<==>)^star.op cases( x = b'k, y = -a'k ), space k in ZZ$ $(star.op) space gcd(a', b') = 1 ==> a' divides y, space b' divides x ==> x = b'k, space k in ZZ ==> y = -a'k$ Теперь найдём какое-то решение исходного уравнения, вспомнив о линейном представлении $gcd$: $gcd(a, b) = d = a x_0 + b y_0 ==> c = d c' = a(c'x_0) + b(c'y_0)$ Таким образом, решение исходного уравнения: ${(c'x_0 + b'k, space c'y_0 -a'k) divides k in ZZ}$, где: $x_0, y_0$ --- коэффициенты при $a, b$ в линейном представлении $gcd(a, b)$, $a' = (a)/(gcd(a, b)), space b' = (b)/(gcd(a, b)), space c' = (c)/(gcd(a, b))$ *Код на языке c++ который находит решение диофантового уравнения:* ```cpp int extgcd(int a, int b, int &x, int &y) { if (b == 0) { x = 1, y = 0; return a; } int x1, y1; int tmp = extgcd(b, a % b, x1, y1); x = y1, y = x1 - (a / b) * y1; return tmp; } void solve() { int a, b, c; cin >> a >> b >> c; int x, y; int gcd = extgcd(a, b, x, y); if (c % gcd != 0) { cout << "No solutions\n"; } else { int k = c / gcd; cout << x * k << ' ' << b / gcd << '\n'; // c' * x_0 + b' * k cout << y * k << ' ' << -(a / gcd) << '\n'; // c' * y_0 - a' * k } } ```
https://github.com/Mouwrice/resume
https://raw.githubusercontent.com/Mouwrice/resume/main/modules/projects.typ
typst
#import "../brilliant-CV/template.typ": * #cvSection("Projects") #cvEntry( title: [REST-API using Rust, OpenAPI and Postgres], society: [Personal Group Project], date: [Present], location: [Ghent, Belgium], description: list( [A project I am quite passionate about, which builds the backend for a mobile- and web application. The application is currently a master thesis project on facilitating routines and planning for children with an autism spectrum disorder (ASD) and their parents or caregivers.], [The web api is built using Rust and the Poem OpenAPI web framework, leveraging the power of Rust to build a REST-API that is conform to the OpenAPI specification.], [Using Postgres and Sqlx for SQL Database migrations and compile-time checked queries.], [As the project requires storing sensitive data, we built the authentication and authorization schemes following the OWASP Foundation recommendations.] ) )
https://github.com/HarryLuoo/sp24
https://raw.githubusercontent.com/HarryLuoo/sp24/main/431/hw/1/hw3.typ
typst
= HW 3\ <NAME> #set math.equation(numbering: "(1)") == ex2.14 \ A and B being disjont events means that $P(A sect B)=(A sect B)/ Omega = 0$. Since A and B are independent iff $P(A sect B)=P(A)P(B)$, we have $P(A)P(B)=0$, which means either $P(A)=0$ or $P(B)=0$. \ == ex2.18 \ - (a) Given that there are 90 numbers to choose from with replacement, each outcome has a probability of $1/90$. We observe that $P(X = k) = 1/9 "for" k in {1,2,...,9}$. Similarly, $P(Y = k) = 1/10 "for" k in {0,1,2,...,9}$. For each pair of possible values $x,y$, we have $ cases( P(X = x, Y = y) = P(10x+y)=1/90, P(X = x)P(Y = y) =1/9 * 1/10 = 1/90)=>P(X = x, Y = y) = P(X = x)P(Y = y). $ Therefore, X and Y are independent random variables. - (b) Consider the case where we pick the number 10 from the set. Since this is the only number for $Z=1+0=1$, we have $P(Z=1)=P(10)=1/90$. However, as argued in (a), $P(X=1)=1/9$. It follows that: $ cases(P(X=1)P(Z=1)=1/9 * 1/90 = 1/810, P(X=1 sect Z=1)=P(10)=1/90)=>P(X=1 sect Z=1) != P(X=1)P(Z=1). $ Therefore, by the virtue of the counterexample, X and Z are not independent random variables. == ex2.23 \ - (a) Given that the event of having an accident on a given day is independent of the event of having an accident on any other day, the probability of no accidents in 7 days is $0.95^7=0.6983$ - (b) Denote random variable of having k days with at least one accident as A_k, with a success probability of $1-0.95=0.05$. $A_k ~ "Bin"(30,0.05)$. Therefore, having k=2 days with accident, we write$ P(A_k=2)=binom(30,2)*0.05^2*0.95^28=0.259 $ - (c) We mark N as the number of days, or trials, until the first day with accident occurs. N now has a geometric distrubution $N ~ "Geom"(0.05)$. We need to find the probability of having an accident after day 4 but on or before the 10th day, i.e. $P(4<N<=10)$. \ According to the probability mass function of the geometric distribution, we have $ P(4<N<=10)=sum_(k=5)^10 (1-p)^(k-1)p=sum_(k=5)^10 0.95^(k-1)*0.05=0.216 $ == ex2.52 \ To check for mutual independence, we need to verify the follwoing:$ P(A sect B)=P(A)P(B )\ P(A sect C )=P(A )P(C )\ P(B sect C )=P(B )P(C )\ P(A sect B sect C )=P(A )P(B )P(C ) $ \ Check: - $P(A sect B)=P(A)+P(B)-P(A union B)=0.3+0.2-0.44=0.06\ P(A)P(B)=0.3*0.2=0.06=P(A sect B)\ $ $P(A sect C) = P(C)-P(A^c sect C)= 0.03 = P(A )P(C ) $ $P(B sect C) =0.02= P(B )P(C ) $\ $P(A sect B sect C) &= P(A union B union C) - P(A)-P(B)-P(C)+P(A sect B)+P(A sect C)+P(B sect C)\ &=0.06=P(B)P(A)P(C) $ All of the above equations hold, so A, B, and C are mutually independent. == ex2.54 \ - (a) Recognizing that $A=(A sect B) union (A sect B^c)$ while $A sect B "and" A sect B^c$ are disjont, we have $P(A)=P(A sect B)+P(A sect B^c)=P(A|B)P(B)+P(A|B^c)P(B^c)=1/3(P(B)+P(B^c))\ = #rect()[1/3] $ - (b) From (a), $P(A)=P(A|B)=P(A|B^c)=1/3$. Consider that $ cases(P(A|B)=P(A sect B)/P(B)=1/3, P(A)=P(A|B))=> #rect()[$P(A sect B)=P(A)P(B)$] $ Independence of A and B is thus established. == ex2.58 \ - (a) We need to check the following for pariwise independence:$ P(A sect B)= P(A)P(B)\ P(A sect C)= P(A)P(C)\ P(B sect C)= P(B)P(C)\ $ The events $A sect B, A sect C, B sect C$ all mean that all three people have the same birthday. For three people to have the same birthday, the first person have 365 choices, the second person has 1 choice out of 365, and the third person has 1 choice out of 365. Therefore, $P(A sect B)= P(A sect C)=P(B sect C) =1/365^2$.\ Meanwhile, for two people to have the same birthday, the first person has 365 choices, the second person has 1 choice out of 365. Therefore, $P(A)=P(B)=P(C)=1/365$.\ It follows that $ P(A sect B)= P(A)P(B)=1/365^2 $ $ P(A sect C)= P(A)P(C)=1/365^2 $and $ P(B sect C)= P(B)P(C)=1/365^2 $ Therefore, A, B, and C are pairwise independent. - (b) No. Since the event $A sect B sect C "is the same as" A sect B$ since they both mean all three people have the same birthday, we have $P(A sect B sect C)=P(A sect B)=1/365^2$. \ However, $P(A)P(B)P(C)=1/365^3!=P(A sect B sect C)$.\ Therefore, A, B, and C are *not mutually independent.* == ex2.61\ - (a)Mark drawing green ball as success. Since the balls are drawn with replacement, each trials are independent. Therefore, the success rate of each trial is $P(G)=3/7$. With nine draws, the number of success, or green draws, follows a binomial distribution $X ~ "Bin"(9,3/7)$.\ $ P(X>=1)=1-P(X=0)=1-binom(9,0)*(3/7)^0*(4/7)^9=1-(4/7)^9 = #rect()[0.994] $ $ P(X<= 5)=sum_(k=0)^5 binom(9,k)*(3/7)^k*(4/7)^(9-k)=0.865 $ - (b) Mark the number of trials before drawing the first green ball as N. N follows a geometric distribution $N ~ "Geom"(3/7)$. We need to find the probability of drawing the first green ball on or before the 9th draw, so, $ P(N<=9)=sum_(k=1)^9 (1-p)^(k-1)p=sum_(k=1)^9 (4/7)^(k-1)*(3/7)=1-(4/7)^9 = #rect()[0.994] $ - (c) $ P(X>=1)=P(N<=9) $ are the same. This is because that the probability of drawing the first green ball on or before the 9th draw is the same as the probability of drawing at least one green ball in 9 draws. == ex2.71 \ We make the following notations: $T_k$ as the event of the kth flip is a tail. Denote $R_n=A_1 sect A_2 sect...sect A_n$representing the first n flips are tails.\ $B$ as the event of the coin is biased, and $F$ as the event of the coin is fair. - (a)Using baye's law, $ P(B|R_n)&=P(R_n|B)P(B)/P(R_n)= P(R_n|B)P(B)/(P(R_n|B)P(B)+P(R_n|F)P(F))\ &=((3/5)^n 1/10)/((3/5)^n 1/10+(1/2)^n 9/10)= ((3/5)^n )/((3/5)^n+(1/2)^n 9) $ When n=1, $P(B|R_1)=2/17$\ when n=2, $P(B|R_2)=4/29$ - (b) setting equation (15) equal to 0.9, we get $n=24.1027$. Since n is an integer, we can say with 90% confidence that the coin is biased if the first 25 flips are tails. - (c) $ P(T_n+1|R_n)= &(P(R_n+1)/P(R_n)\ =&(P(R_(n+1)|B)P(B)+P(R_(n+1)|F)P(F))/(P(R_n|B)P(B)+P(R_n|F)P(F))\ =& (( (3/5)^(n+1) *1/10 ) + ( (1/2)^(n+1) * 9/10 ))/( ( (3/5)^n *1/10 ) + ( (1/2)^n * 9/10 )) $
https://github.com/seapat/markup-resume-lib
https://raw.githubusercontent.com/seapat/markup-resume-lib/main/README.md
markdown
Apache License 2.0
Typst code to build resumes from structured data. This is intended to be used as a git submodule, see [markup-resume](https://github.com/seapat/markup-resume) for an example.
https://github.com/0xPARC/0xparc-intro-book
https://raw.githubusercontent.com/0xPARC/0xparc-intro-book/main/old-stuff/h-mpc.typ
typst
#import "preamble.typ":* #todo[write this]
https://github.com/VadimYarovoy/Networks2
https://raw.githubusercontent.com/VadimYarovoy/Networks2/main/lab1/report/typ/task.typ
typst
#import "@preview/colorful-boxes:1.2.0": * = Практические задание == Задание 1 #colorbox( title: "TODO", color: "blue", radius: 2pt, width: auto )[ Какую информацию можно узнать с помощью команд *ifconfig* (или ip) и *netstat*. Приведите примеры] Команды *ifconfig* (или ip) и *netstat* предоставляют информацию о сетевых интерфейсах, IP-адресах, маршрутах и открытых сетевых соединениях. В зависимости от операционной системы могут быть различия в синтаксисе команд. Ниже приведены примеры для Linux. пример *ifconfig*: ```bash br-23ef8c0ffb84: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255 ether 02:42:eb:6f:85:63 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 ether 02:42:b0:59:9e:6d txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.100.14 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::c3b0:b42a:5d25:8e57 prefixlen 64 scopeid 0x20<link> ether ac:1f:6b:12:e4:78 txqueuelen 1000 (Ethernet) RX packets 204073 bytes 196777986 (187.6 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 35868 bytes 5544923 (5.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0xfb300000-fb37ffff eno2: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 ether ac:1f:6b:12:e4:79 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0xfb200000-fb27ffff lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 1767 bytes 13431796 (12.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1767 bytes 13431796 (12.8 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ``` + br-23ef8c0ffb84: - flags=4099: Этот интерфейс поддерживает различные опции, такие как UP (включен), BROADCAST (разрешает отправку широковещательных сообщений), MULTICAST (поддерживает многоадресную рассылку). - mtu 1500: Максимальный размер пакета данных, который может быть передан через этот интерфейс. - inet 172.18.0.1: IP-адрес интерфейса. - netmask 255.255.0.0: Маска подсети для определения, какие биты IP-адреса относятся к сети и хост-части. - ether 02:42:eb:6f:85:63: MAC-адрес интерфейса. txqueuelen 0: Длина очереди передачи. - RX/TX packets, bytes: Статистика приема и передачи пакетов. + docker0: - Аналогичная информация для виртуального интерфейса, который используется Docker. + eno1: - flags=4163: UP, BROADCAST, RUNNING, MULTICAST. Интерфейс включен, поддерживает широковещательные сообщения, активен, поддерживает многоадресную рассылку. - inet 192.168.100.14: IP-адрес интерфейса. - netmask 255.255.255.0: Маска подсети. - ether ac:1f:6b:12:e4:78: MAC-адрес интерфейса. - RX/TX packets, bytes: Статистика приема и передачи пакетов. - inet6 fe80::c3b0:b42a:5d25:8e57: IPv6-адрес. + eno2: - Аналогичная информация для другого сетевого интерфейса. + lo: - flags=73: UP, LOOPBACK, RUNNING. Интерфейс включен, является интерфейсом обратной связи (loopback), активен. - inet 127.0.0.1: IP-адрес интерфейса. - netmask 255.0.0.0: Маска подсети. - inet6 ::1: IPv6-адрес. - RX/TX packets, bytes: Статистика приема и передачи пакетов по интерфейсу обратной связи. пример вывода *netstat*: ```bash unix 3 [ ] STREAM CONNECTED 64868 unix 2 [ ] DGRAM CONNECTED 55603 unix 3 [ ] STREAM CONNECTED 18069 unix 3 [ ] STREAM CONNECTED 19190 unix 3 [ ] STREAM CONNECTED 7730 unix 3 [ ] STREAM CONNECTED 21254 unix 3 [ ] STREAM CONNECTED 46646 /run/dbus/system_bus_socket unix 3 [ ] STREAM CONNECTED 10635 unix 3 [ ] STREAM CONNECTED 76869 unix 3 [ ] STREAM CONNECTED 43999 unix 3 [ ] STREAM CONNECTED 24434 unix 3 [ ] STREAM CONNECTED 3489 unix 3 [ ] STREAM CONNECTED 22631 @/tmp/.X11-unix/X0 unix 3 [ ] STREAM CONNECTED 13752 unix 3 [ ] STREAM CONNECTED 68000 unix 3 [ ] SEQPACKET CONNECTED 13237 unix 3 [ ] STREAM CONNECTED 18032 unix 3 [ ] STREAM CONNECTED 73042 unix 3 [ ] STREAM CONNECTED 12101 /run/user/1000/bus unix 3 [ ] STREAM CONNECTED 17768 unix 3 [ ] SEQPACKET CONNECTED 21047 unix 3 [ ] STREAM CONNECTED 11537 unix 3 [ ] STREAM CONNECTED 86103 unix 3 [ ] STREAM CONNECTED 7843 /run/user/1000/bus unix 3 [ ] STREAM CONNECTED 138377 unix 3 [ ] STREAM CONNECTED 53052 ``` + Столбцы: - Proto: Протокол (в данном случае, "unix" для сокетов Unix). - Recv-Q и Send-Q: Длина очереди приема и отправки данных. - Локальный адрес и состояние: Локальный адрес сокета и его текущее состояние. - Удаленный адрес: Удаленный адрес (если соединение удаленное). + Строки: - CONNECTED: Состояние, в котором соединение установлено. - DGRAM: Датаграммный сокет (без установления соединения). - SEQPACKET: Последовательный пакет (для надежной и упорядоченной передачи данных). + Примеры строк из вывода: - unix 3 [ ] STREAM CONNECTED 64868: Сокет Unix в состоянии CONNECTED с локальным адресом. Номер сокета 64868. - unix 2 [ ] DGRAM CONNECTED 55603: Датаграммный сокет (без установления соединения) с номером 55603. - unix 3 [ ] SEQPACKET CONNECTED 13237: Сокет Unix типа SEQPACKET в состоянии CONNECTED с номером 13237. - unix 3 [ ] STREAM CONNECTED 46646 /run/dbus/system_bus_socket: Сокет Unix в состоянии CONNECTED с путем к файлу (здесь это файл сокета системной шины D-Bus) == Задание 2 #colorbox( title: "TODO", color: "blue", radius: 2pt, width: auto )[ Посмотрите файлы /etc/services, /etc/protocols, расскажите на каких портах работают основные сервисы (ssh, ftp, http, smtp и др.)] etc/services: ```bash ftp 21/tcp ftp 21/udp ftp 21/sctp ... ssh 22/tcp ssh 22/udp ssh 22/sctp ... http 80/tcp http 80/udp http 80/sctp ... smtp 25/tcp smtp 25/udp ... https 443/tcp https 443/udp https 443/sctp ``` etc/protocols: ```bash # Full data: /usr/share/iana-etc/protocol-numbers.iana hopopt 0 HOPOPT icmp 1 ICMP igmp 2 IGMP ggp 3 GGP ipv4 4 IPv4 st 5 ST tcp 6 TCP cbt 7 CBT egp 8 EGP igp 9 IGP bbn-rcc-mon 10 BBN-RCC-MON nvp-ii 11 NVP-II pup 12 PUP emcon 14 EMCON xnet 15 XNET ... ``` == Задание 3 #colorbox( title: "TODO", color: "blue", radius: 2pt, width: auto )[ Настройте подключение по ssh к какому-либо серверу (в крайнем случае к localhost) с использованием ключей шифрования.] \ В рамках задания будем подключаться к виртуальной машине \ Создаем ключи: ```bash ssh-keygen -t rsa ``` Проверяем их наличие: ```bash -rw------- 1 vadim vadim 2602 фев 17 12:29 netlab -rw-r--r-- 1 vadim vadim 573 фев 17 12:29 netlab.pub ``` включаем ssh на сервере: ```bash sudo systemctl enable sshd service Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service → /usr/lib/systemd/system/sshd.service. sudo systemctl start sshd.service sudo systemctl status sshd.service ● sshd.service - OpenSSH Daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: disabled) Active: active (running) since Sat 2024-02-17 12:35:21 MSK; 3s ago Main PID: 17516 (sshd) Tasks: 1 (limit: 4669) Memory: 2.1M (peak: 2.3M) CPU: 21ms CGroup: /system.slice/sshd.service └─17516 "sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups" фев 17 12:35:21 vadim-virtualbox systemd[1]: Started OpenSSH Daemon. фев 17 12:35:21 vadim-virtualbox sshd[17516]: Server listening on 0.0.0.0 port 22. фев 17 12:35:21 vadim-virtualbox sshd[17516]: Server listening on :: port 22. ``` Копируем ключи на сервер и вводим пароль: ```bash ssh-copy-id [email protected] ``` Результат подключения: ```bash [vadim@vadim-virtualbox ~]$ ``` Если ssh-copy-id недоступен, вы можете скопировать содержимое публичного ключа вручную и добавить его в файл ~/.ssh/authorized_keys на сервере. \ Подключаемся к серверу с помощью ключа: ```bash ssh [email protected] ``` #figure( image("../pics/1.png", width: 100%), caption: [ Узнаем IP адрес ], ) #figure( image("../pics/2.png", width: 100%), caption: [ Подключаемся ], ) Отключаем аутентификацию по паролю в файле конфигурации SSH (/etc/ssh/sshd_config на сервере) ```bash PasswordAuthentication no ``` Перезапускаем службу SSH на сервере == Задание 4 Настройка параметров подключения по SSH может улучшить безопасность и эффективность соединения. Ниже приведены некоторые параметры конфигурации SSH, которые могут быть полезны в различных сценариях: + Порт SSH: - Опция: Port - Пример: Port 2222 - Когда использовать: Изменение порта SSH может обеспечить дополнительный уровень безопасности, уменьшив количество неудачных попыток входа, но также может усложнить подключение. Используйте это, если хотите уменьшить количество неудачных попыток входа. + Отключение аутентификации по паролю: - Опция: PasswordAuthentication no - Когда использовать: Используйте это, если хотите разрешить только аутентификацию по ключам, усиливая безопасность. + Ограничение пользователя: - Опция: AllowUsers username - Пример: AllowUsers vadim yarovoy - Когда использовать: Ограничьте доступ только определенным пользователям, что полезно для управления доступом. + Ограничение IP-адресов: - Опция: AllowUsers username\@ip_address - Пример: AllowUsers [email protected] - Когда использовать: Ограничьте доступ по определенным IP-адресам, уменьшая поверхность атаки. + Использование только протокола SSHv2: - Опция: Protocol 2 - Когда использовать: Отключите устаревший протокол SSHv1 в пользу более безопасного SSHv2. + Отключение удаленного входа для root: - Опция: PermitRootLogin no - Когда использовать: Отключите возможность входа в систему непосредственно под пользователем root для усиления безопасности. Для внесения этих изменений, отредактируем файл /etc/ssh/sshd_config на сервере. После внесения изменений, перезапускаем службу SSH для применения новых настроек. #pagebreak()
https://github.com/loqusion/typix
https://raw.githubusercontent.com/loqusion/typix/main/checks/simple-with-typst-packages/main.typ
typst
MIT License
#import "@preview/example:0.1.0" #lorem(100)
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/058%20-%20Duskmourn%3A%20House%20of%20Horror/002_Welcome%20Home.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Welcome Home", set_name: "Duskmourn: House of Horror", story_date: datetime(day: 19, month: 08, year: 2024), author: "<NAME>", doc ) Welcome, harrowed—I mean, honored—guests. I heard the commotion you were making in the parlor and had hoped you'd make it all the way to me before you fell afoul of some of our less … civilized residents. We've been in here ever so long, you see, and it's only recently that we've been able to find doors to anywhere else. Manners do erode after too much time in isolation, don't you think? Mine as well, it seems. Please, have a seat. You're safe here, for the moment. I can't promise how long that condition will last—safety is a temporary thing here in Duskmourn—but I can promise you the time you need to catch your breath. That's better than anyone else is offering right now, you'll find. Please, rest. This is my dining room. I've claimed it, and I defend it from the other residents, and they've learned to leave me be, if they know what's good for them. This part of the house is called the Boilerbilge. I do apologize for the heat. Turning it down is quite impossible, but, as few linger here long enough to feel any ill effects, it's a small complication in a world that's made of them. #figure(image("002_Welcome Home/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) A world? Yes. Duskmourn. Oh, you thought that name referred to the House? It does. The House is the world, the world is the House, and the word for both is Duskmourn, the grief of the sun slipping out of your hands, the coming of the cold and sorrow. Oh, it wasn't always like this. Once, this was a plane like any other, safe and dangerous and welcoming and hostile. It had mountains and seas, cities and coasts. There are pictures in some of the books, if you can find a library. I believe that it was beautiful. But the people were discontent. Magic was a scarce resource, controlled by very few, and others yearned for the ease that it could bring, the way it could smooth the ridges in the plaster of life. They sought to find ways to harness power for themselves, and, to their great eventual regret, they found it. The people of what became Duskmourn learned the art of summoning creatures from the lifeless void, beings of hunger and raw strength. They weren't evil, necessarily, but they were ravenous. They fed on contracts and consent. They yearned for invitation and could do nothing without its offer. It was small at first: creatures to enable strange machines to function, to ease lives, to power lights and preserve food. Maybe, if they had stopped there, Duskmourn could have been a paradise. A paradise built on the starvation of the void, but a paradise all the same. But alas, greed is a fact of intelligent life, and people began to summon greater and greater beings, never thinking ahead to what would happen if those beings ever broke free. And then one day, something too great to be controlled was bound here into a perfectly ordinary house on the outskirts of a perfectly ordinary city. Even then, things could have gone very differently. But someone came across the creature—the demon, if you will—and when it offered them a contract, they accepted. They paid its price, and it was finally free to feed. Duskmourn was born in a summoning, a binding, and a contract, a slaughter, a betrayal, and a consequence. This place became inevitable when the first person called for something they didn't understand. The creature did what it was made to do. It consumed, and it kept its bargain. The House was safe. The House was preserved. The House was a bloated corpse swallowing the rest of the world, until there was nothing left to eat, and all that remained was Duskmourn itself and the survivors in its walls, like rats. Then, something changed. We didn't know what, only that all at once, the House could open new doors, in new places. Could reach out for companionship where there had been none before. Could feast on flesh that wasn't ours. Oh, yes, it #emph[is] difficult to stand up after you've been sitting for too long. The chairs tend to hold what's given to them, you see, and you sat willingly. Contracts and consequences. But you caught your breath some time ago, and that was all the safety I promised you. The House is hungry, you see. And if I can convince people not to fight it long enough for it to take the first few bites, it lets me keep my little space and my little pretense of freedom. I don't want to die. I suppose no one does, but I was clever enough to learn how to survive in here, while you seem to have missed that lesson in whatever world you came from. It must have been far kinder there. It must have been less hungry. But I wasn't quite finished, was I? What's left to say? Duskmourn woke, and Duskmourn hungered, and it grew to swallow all those other pieces of the void, keeping them safe within its walls, all those little appetites, eating and eating and never fed. They serve the House. After this long, they #emph[are] the House. Just like you'll be, very shortly. Oh, don't scream. It's so tiresome, and we were having such a #emph[pleasant] conversation before this all began. But if you must, you must, and I suppose that's your prerogative. Duskmourn likes the sound of screams. Now, then. It's so nice of you to stay for dinner. But I'm delighted to say that I won't be joining you just yet. As long as I can keep feeding my dining hall, it won't feel the need to feed on me. So, this is where we say farewell, I suppose, unless your ghost comes back for a second helping. I'll be waiting, if it does.
https://github.com/LugsoIn2/typst-htwg-thesis-template
https://raw.githubusercontent.com/LugsoIn2/typst-htwg-thesis-template/main/lib/listOfTables.typ
typst
MIT License
#import "textTemplate.typ": * #let listOfTables(lang: "") = { let languageText = textTemplate(pagetype: "listOfTables" ,lang: lang) // --- -------------- ---- // --- -------------- ---- // --- list of tables --- outline( title: languageText.at(0), target: figure.where(kind: table) ) }
https://github.com/goshakowska/Typstdiff
https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_complex/ordered_list/ordered_list.typ
typst
+ The climate - Precipitation - Temperature + degree - hot - cold - warm + sun + The geology
https://github.com/505000677/2060-hw5
https://raw.githubusercontent.com/505000677/2060-hw5/main/sample-page.typ
typst
#import "/book.typ": book-page #show: book-page.with(title: "Hello, CS 2060") This is a ✨WEB✨ project made by <NAME>! $ integral^a_b lim_(x -> oo) $
https://github.com/ivaquero/lang-romanic
https://raw.githubusercontent.com/ivaquero/lang-romanic/main/fr-3-adj+adv.typ
typst
#import "@local/scibook:0.1.0": * #show: doc => conf( title: "形容词与副词", author: ("github@ivaquero"), footer-cap: "github@ivaquero", header-cap: "音速法语", outline-on: false, doc, ) = 颜色 #let data = csv("fr/fr-adj-color.csv") #figure( ktable(data, 4), caption: "颜色", supplement: [表], kind: table, ) = 反义词对 #let data = csv("fr/fr-adj-pair.csv") #figure( ktable(data, 4), caption: "反义词对", supplement: [表], kind: table, ) = 比较级 - plus = 副词
https://github.com/grnin/Zusammenfassungen
https://raw.githubusercontent.com/grnin/Zusammenfassungen/main/Bsys2/01_Betriebssystem_API.typ
typst
// Compiled with Typst 0.11.1 #import "../template_zusammenf.typ": * #import "@preview/wrap-it:0.1.0": wrap-content /* #show: project.with( authors: ("<NAME>", "<NAME>"), fach: "BSys2", fach-long: "Betriebssysteme 2", semester: "FS24", tableofcontents: (enabled: true), language: "de" ) */ = Betriebssystem API Aufgaben eines Betriebssystems: - _Abstraktion_ und damit _Portabilität_ #hinweis[(von Hardware, Protokollen, Software-Services)] - _Resourcenmanagement_ und _Isolation_ der Anwendungen #hinweis[(Rechenzeit, RAM- & Speicherverwendung etc.)] - _Benutzerverwaltung_ und Sicherheit ==== Grenzen der Portierbarkeit Applikation muss auf allen Bildschirmgrössen, mit allen verschiedenen Bedienarten (Maus vs. Touchscreen) etc. funktionieren. Moderne Betriebssysteme bieten dafür Mechanismen an, es obliegt aber der Applikation, diese zu verwenden. Das OS kann nicht entscheiden, was die Applikation meint. ==== Grenzen der Isolierbarkeit Applikationen, die auf einem Bildschirm laufen, konkurrieren zwangsläufig um Bildschirm und Tastatur. Häufiges Problem: Fokus-Diebstahl über Popups ==== Prozessor Privilege Level Moderne OS benötigen Prozessor mit mindestens zwei Privilege Levels: - _Kernel-Mode:_ Darf jede Instruktion ausführen #hinweis[(Ring 0)] - _User-Mode:_ Darf nur eine beschränkte Menge an Instruktionen ausführen #hinweis[(Ring 3)] Das OS läuft im Kernel-Mode und bestimmt über Software. == Grundaufbau eines Betriebssystems OS werden typischerweise in einen _Kern_ und einen _Nicht-Kernbereich_ aufgeteilt. Kern umfasst die Komponenten, die im Kernel-Mode laufen müssen, alle anderen Komponenten sollten im User-Mode laufen. === Microkernel Kernelfunktionalität _reduziert_ auf ein Minimum. Selbst Gerätetreiber laufen im User-Mode, nur _kritische Teile_ des Kernels laufen im Kernel-Mode. _Stabil_ und Analysierbar, jedoch _Performance-Einbussen_. === Monolithische Kernel Die meisten OS-Kernel sind monolithisch. _Vorteil:_ weniger Wechsel zwischen den Modi #sym.arrow bessere Performance. _Nachteil:_ weniger Schutz vor Programmierfehlern, da weniger Isolierung. === Unikernel Ein "normales" Programm als Kernel, die Kernelfunktionalität ist in einer Library. Keine Trennung zwischen Kernel- und User-Mode. _Vorteil:_ Echte Minimalität, extrem kompakt. _Nachteil:_ Single Purpose, Applikationsentwickler muss sich mit Hardware auseinandersetzen. === Wechsel des Privilege Levels vom User zum Kernel Mode Die `syscall` Instruktion auf Intel x86 Prozessoren veranlasst den Prozessor, in den _Kernel Mode zu schalten_ und den IP auf OS-Code (System Call Handler) umzusetzen. Dadurch ist gewährleistet, dass im Kernel Mode immer Kernel-Code läuft. === Zusammenspiel von Applikation und Kernel Code Da es nur einen `syscall`-Befehl gibt, muss jede OS-Kernel-Funktion mit einem _Code_ versehen werden. Dieser Code muss in einem Register übergeben werden. Zusätzlich müssen je nach Funktion _Parameter_ in anderen Registern übergeben werden. Z.B. System Call `exit`: Hat den Code 60 und erwartet den Exit-Code des Programms in einem Register. #pagebreak() === ABI vs. API #table( columns: (1fr, 1fr), table.header( [Application Binary Interface - ABI], [Application Programming Interface - API], ), [ - Abstrakte Schnittstellen - Plattformunabhängige Aspekte - Kann für diverse OS gleich sein ], [ - Konkrete Schnittstellen - Calling Convention - Abbildung von Datenstrukturen ], ) Linux-Kernels sind API-, aber nicht ABI-kompatibel. Die API-Kompabilität ist dadurch gegeben, dass Applikationen nicht direkt Syscalls aufrufen, sondern C-Wrapper-Funktionen verwenden. Diese verwenden zum Kernel passenden Binärcode. === POSIX (Portable Operating System Interface) Jedes OS hat eigene API und ABI. Der OS-spezifische Teil der UNIX/C-API ist jedoch als POSIX standardisiert. macOS und Linux sind POSIX-konform, Windows nicht. ==== Man Pages Man pages #hinweis[(manual pages)] enthalten Dokumentation für die Programme auf einem POSIX-System. Liefert viele Informationen über ein POSIX-System. Ist in 9 Kapitel aufgeteilt, z.b. Kapitel 3 für Libraries. ==== Shell Programm, das es erlaubt, über Texteingabe Betriebssystemfunktionen aufzurufen. Gibt viele verschiedene Shells mit unterschiedlichem Syntax. Benötigt keine besonderen Rechte oder spezielle Vorkehrungen. Benötigt nur Ausgabe- und Eingabe-Stream. #wrap-content( image("img/bsys_1.png"), align: bottom + right, columns: (70%, 30%), )[ == Programmargumente Wird ein Programm gestartet, kann es Programmargumente erhalten.\ _Beispiel:_ ```sh clang -c abc.c -o abc.o``` ] === Programmargumente aus der Shell Shell teilt Programmargumente in _Strings_ auf. Fast alle Shells verwenden _Leerzeichen als Trennung_ zwischen Programmargumenten. Viele Shells erlauben Spaces in Programmargumenten durch die Verwendung von _Quotes_. Das OS interessiert sich _nicht_ für den _Inhalt_ der Argumente. #wrap-content( image("img/bsys_2.png"), align: top + right, columns: (59%, 41%), )[ === Calling Convention Beim Start schreibt das OS die Programmargumente als _null-terminierte Strings_ in den Speicherbereich des Programms. Zusätzlich legt das OS ein _Array_ `argv` an, dessen Elemente jeweils auf das _erste Zeichen eines Programmarguments_ zeigen. Der Pointer auf dieses Array und die Anzahl der Elemente `argc` wird dem Programm an _einer vom OS definierten Stelle_ zur Verfügung gestellt, z.B. in Registern oder auf dem Stack. Die Art und Weise wie/wo dies gehandhabt wird, ist die Calling Convention. ] === Programmargumente in C In C wird dieser Umstand durch die beiden Parameter der Funktion ```c main()``` ausgedrückt. ```c int argc``` enthält die Anzahl der Programmargumente + 1. ```c char **argv``` enthält den Pointer auf das Array. _Achtung:_ `argv[0]` ist der Programmname, die Argumente selbst folgen als `argv[1]` bis `argv[argc - 1]` ```c int main(int argc, char ** argv) { ... }``` #wrap-content( image("img/bsys_4.png"), align: bottom + right, columns: (64%, 36%), )[ == Umgebungsvariablen Die Umgebungsvariablen eines Programms sind eine Menge an Strings, die jeweils mindestens ein `=` enthalten, z.B.: ```sh OPTER=1 OPTIND=1 OSTYPE=linux-gnu PATH=/home/ost/bin:/home/ost/.local/bin ``` ] - Der Teilstring vor dem `=` wird als _Key_ bezeichnet - Der Teilstring nach dem `=` wird als _Value_ bezeichnet - Jeden Key kann es _höchstens einmal_ geben Unter POSIX verwaltet das OS die Umgebungsvariablen innerhalb jedes laufenden Prozesses. Sie werden _initial_ vom erzeugenden Prozess festgelegt, also z.B. der Shell #hinweis[(die Shell kopiert ihre Umgebungsvariablen in den Prozess)]. Das OS legt die Umgebungsvariablen als ein _null-terminiertes Array von Pointern auf null-terminierte Strings_ ab. Unter C zeigt die Variable ```c extern char **environ``` auf dieses Array. _`environ`_ sollte nicht direkt verwendet werden, sondern nur über folgende Funktionen manipuliert werden: _`getenv()`_, _`putenv()`_, _`setenv()`_ und _`unsetenv()`_. ==== Abfragen einer Umgebungsvariable: ```c char * getenv (const char * key)``` durchsucht die Umgebungsvariablen nach dem Key `key` und gibt die Adresse des ersten Zeichens des entsprechenden Values zurück falls vorhanden, ansonsten `0`. ```c char *value = getenv("PATH"); // value = "/home/ost/bin:/home/ost/.local/bin" ``` ==== Setzen einer Umgebungsvariable:\ ```c int setenv (const char *key, const char *value, int overwrite)``` Wenn `key` schon in einer Umgebungsvariable `v` enthalten ist _und_ `overwrite != 0`: überschreibt den Wert von `v` mit `value`. Wenn `key` noch nicht in einer Umgebungsvariable enthalten ist: fügt eine neue Umgebungsvariable hinzu und kopiert `key` und `value` dort hinein. Gibt `0` zurück wenn alles OK, ansonsten Fehlercode in `errno`. ```c int ret = setenv("HOME", "/usr/home", 1);``` ==== Entfernen einer Umgebungsvariable: ```c int unsetenv (const char *key)``` entfernt die Umgebungsvariable mit dem Key `key`. Gibt `0` zurück wenn alles OK, ansonsten Fehlercode in `errno`. ```c int ret = unsetenv("HOME");``` ==== Hinzufügen einer Umgebungsvariable: ```c int putenv (char * kvp)``` fügt den Pointer `kvp` #hinweis[(key-value-pair)] dem Array der Umgebungsvariablen hinzu. Der String, auf den `kvp` zeigt, wird _nicht_ kopiert. Wird der String nach dem Setzen der Umgebungsvariabel geändert, wird diese ebenfalls geändert. Wenn der Key schon vorhanden ist, wird der String gelöscht, auf den der existierende Pointer zeigt. D.h. der Pointer verweist anschliessend auf eine leere Stelle. Gibt `0` zurück wenn alles OK, ansonsten Fehlercode in `errno`. _Gefährliche Funktion!_ ```c int ret = putenv("HOME=/usr/home");``` == Zweck von Programmargumenten und Umgebungsvariablen #table( columns: (1fr, 1fr), table.header([Programmargumente], [Umgebungsvariablen]), [ - werden explizit angegeben - nützlich für Informationen, die bei jedem Aufruf anders sind #hinweis[(z.B. die Datei, die kompiliert werden soll)] ], [ - werden implizit bereitgestellt - nützlich für Informationen, die bei jedem Aufruf gleich sind #hinweis[(z.B. Pfade für Hilfsprogramme, Libraries)] ], ) _Grössere Konfigurationsinformationen_ sollten bevorzugt über _Dateien_ übermittelt werden. Das ist häufig nötig wegen Beschränkungen der Zeilenlänge. Datenformat völlig in der Hand des Programms; keine Unterstützung durch das OS. Der Dateiname kann als Umgebungsvariable oder Programmargument übergeben werden. Manche Betriebssysteme kennen noch andere Mechanismen, z.B. Windows Registry, die eher einer Datenbank gleicht.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/repeat_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test multiple repeats. #let sections = ( ("Introduction", 1), ("Approach", 1), ("Evaluation", 3), ("Discussion", 15), ("Related Work", 16), ("Conclusion", 253), ) #for section in sections [ #section.at(0) #box(width: 1fr, repeat[.]) #section.at(1) \ ]
https://github.com/a-camarillo/resume
https://raw.githubusercontent.com/a-camarillo/resume/main/resume.typ
typst
#set page(width: 8.5in, height: 11in, margin: 0.5in) #show par: set block(spacing: 0.75em) #set text(size: 11pt) #show link: underline #let align-date(date) = { set align(right) [#date] } #show heading.where( level: 1 ): it => align( center, text( size: 14pt, it.body ), ) #show heading.where( level: 2 ): it => text( weight: "bold", upper(it.body + [:]) ) #show heading.where( level: 3 ): it => text( weight: "bold", it.body ) = <NAME> #align(center, [ #grid( columns: (auto, auto, auto, auto), gutter: 5pt, align(center)[ #link("mailto:<EMAIL>") | ], align(center)[ #link("linkedin.com/in/a-camarillo") | ], align(center)[ #link("github.com/a-camarillo") | ], align(center)[ #link("a-camarillo.dev") ], ) ]) == objective Graduate robotics student with a background in mechanical engineering, applied mathematics, and software development. Eager to learn and contribute to innovative engineering solutions in the field of control and robotics. == skills #grid( columns:(1fr, .75fr), align: (left, start), [*Programming Languages:* C++, MATLAB, Python, Rust, SQL\ *Software:* AutoCAD, Fusion360, ROS, SolidWorks\ *Simulation:* CoppeliaSim, MuJoCo, Simulink], [*Developer Tools:* Docker, GDB, Git, Nix\ *Hardware:* Arduino, ESP32] ) == education #block(below: 0.65em,[*California State University, Long Beach*]) #grid(columns: (1fr, .5fr), align: (left, right), rows: 2, row-gutter: 0.65em, [Masters of Science., Mechanical Engineering, Control and Robotics], [Expected Graduation: December 2025], [Bachelors of Science., Mechanical Engineering, Minor: Applied Mathematics], [December 2019] ) == projects #grid( columns: (1fr, .5fr), align: (left, right), [*Trajectory Planning of Robotic Manipulators* - _PACK Lab, CSULB_], [September 2024 - Present] ) #block(above: 0.75em, [Technologies: MuJoCo, Python\ #list( marker: [•], indent: 0.5em, [Designing simulations of robotic manipulators to analyze different control algorithm effects on trajectory generartion.], [Researching implementations of reinforcement learning for trajectory planning to improve adaptability of manipulators in environments with obstacles.] )] ) #grid( columns: (1fr, .5fr), align: (left, right), [*Control Of Robotic Manipulator* - _Personal Project_], [June 2024 - August 2024] ) #block(above: 0.65em, [https://github.com/a-camarillo/HiWonder-Max-Arm\ Technologies: ESP32, C++\ #list( marker: [•], indent: 0.5em, [Leveraged a commercial 4-DOF robotic manipulator to study physical applications of inverse kinematics, increasing knowledge in control algorithms for robotics.], [Developed algorithms in C++ to enable both manual and automonous control of the manipulator, integrating various sensors, allowing the manipulator to perform pick and place tasks.], )] ) #grid( columns: (1fr, .5fr), align: (left, right), [*Servo Motor Driver* - _Personal Project_], [June 2024] ) #block(above: 0.65em,[ https://github.com.com/a-camarillo/embedded-rust/tree/main/esp32c6-test/servo-motor\ Technologies: ESP32C6, SG90 Servo Motor, Rust, esp-hal\ #list( marker: [•], indent: 0.5em, [Programmed a custom module for the ESP32C6 microcontroller, allowing the microcontroller to communicate with and operate an SG90 servo motor.], [Integrated existing ESP library for configuring onboard timers and generating pulse-width modulation signals to control motor position.] )] ) == additional experience #grid( columns: (1fr, .5fr), align: (left, right), [*Emergency Rental Assistance Case Manager* - _<NAME>_], [September 2020 - December 2022] ) #block( above: 0.75em, [#list( marker: [•], indent: 0.5em, [Communicated with applicants of an Emergency Rental Assistance Program to ensure they met program requirements, providing over one million dollars of rent and utility assistance.], [Collected and organized sensitive documents from clients to simultaneously process an average of 20 cases per week, guaranteeing a constant flow of applicants receiving assistance.] ) ])
https://github.com/mem-courses/linear-algebra
https://raw.githubusercontent.com/mem-courses/linear-algebra/main/template.typ
typst
// The project function defines how your document looks. // It takes your content and some metadata and formats it. // Go ahead and customize it to your liking! #let project(title: "", authors: (), date: none, body) = { // Set the document's basic properties. set document(author: authors.map(a => a.name), title: title) set page( paper: "a4", margin: (left: 15mm, right: 15mm, top: 20mm, bottom: 20mm), numbering: "1", number-align: center, ) set text(font: ("New Computer Modern", "Source Han Serif SC", "Simsun"), lang: "zh", size: 11pt) show math.equation: set text(weight: 400) // Set paragraph spacing. show par: set block(above: 1em, below: 1em) set heading(numbering: "1.1)") set par(leading: 0.8em) // Title row. align(center)[ #block(text(weight: 700, 1.75em, title)) #v(1.2em, weak: true) #date ] // Author information. pad( top: 0.8em, bottom: 2.8em, x: 2em, grid( columns: (1fr,) * calc.min(3, authors.len()), gutter: 1em, ..authors.map(author => align(center)[ *#author.name* \ #author.email \ #author.phone ]), ), ) // Main body. set par(justify: true) body } #import "@preview/xarrow:0.1.1": xarrow #let cas(..args) = math.cases(..args) #let dxarrow(..args) = xarrow(math.display(..args)) #import "./functions.typ": * #import "./global.typ": *
https://github.com/thornoar/lambda-calculus-course
https://raw.githubusercontent.com/thornoar/lambda-calculus-course/master/main-lectures/template.lib.typ
typst
#import "@preview/quick-maths:0.1.0": shorthands #import "@preview/ouset:0.2.0": * // Shortcut definitions #let l = math.lambda #let be = $beta eta$ #let L = math.Lambda #let impl = $#h(5pt) => #h(5pt)$ #let proves = $#l tack.r$ #let TV(expr) = $"TV"(#expr)$ #let FV(expr) = $"FV"(#expr)$ #let BV(expr) = $"BV"(#expr)$ #let Sub(expr) = $"Sub"(#expr)$ #let Con(expr) = $"Con"(#expr)$ #let CR(expr) = $"CR"(#expr)$ #let SN(expr) = $"SN"(#expr)$ #let Gr(expr) = $"Gr"(#expr)$ #let Trans(expr) = $"Trans"lr((#expr), size: #0.5cm)$ #let Equiv(expr) = $"Equiv"lr((#expr), size: #0.5cm)$ #let Refl(expr) = $"Refl"lr((#expr), size: #0.5cm)$ #let Preord(expr) = $"Preord"lr((#expr), size: #0.5cm)$ #let empty = math.diameter #let acongr = $eq^alpha$ #let inc = math.op("#") #let rrel = math.subset.sq #let rrel1 = math.attach(rrel, br: [1]) #let rrel2 = math.attach(rrel, br: [2]) #let rel = math.supset.sq #let rel1 = math.attach(rel, br: [1]) #let rel2 = math.attach(rel, br: [2]) #let rel3 = math.attach(rel, br: [3]) #let rel4 = math.attach(rel, br: [4]) #let ul = symbol("\u{231c}") #let ur = symbol("\u{231d}") #let num(expr) = $ul #expr ur $ #let nums(expr) = $#h(3pt) ul #expr ur #h(3pt)$ #let ite(b, m, n) = $underline("if") #h(5pt) #b #h(5pt) underline("then") #h(5pt) #m #h(5pt) underline("else") #h(5pt) #n$ #let A = $cal(A)$ #let B = $cal(B)$ #let arr = math.arrow.r.squiggly #let combinator = it => math.bold(math.upright(math.sans(it))) #let Ap = combinator($A_+$) #let Am = combinator($A_*$) #let Ae = combinator($A_("exp")$) #let I = combinator([I]) #let K = combinator([K]) #let T = combinator([T]) #let KK = combinator($K_*$) #let F = combinator([F]) #let S = combinator([S]) #let Y = combinator([Y]) #let Th = combinator(math.Theta) #let O = combinator(math.Omega) #let P = combinator([P]) #let Sp = combinator($S^+$) #let Pm = combinator($P^-$) #let Zero = combinator([Zero]) #let formatting = doc => { set page( "a4", margin: (x: 0.5in, y: 0.5in), numbering: none ) set text(12pt, lang: "ru") show "л-": name => $lambda"-"$ show "ал-": name => $alpha"-"$ show "бэ-": name => $be"-"$ show "б-": name => $beta"-"$ show "эт-": name => $eta"-"$ set heading(numbering: "1.1.") show heading.where(level:1): it => { counter(math.equation).update(0) it } show: shorthands.with( ($>=$, math.gt.eq.slant), ($<=$, math.lt.eq.slant), ($<<$, math.angle.l), ($>>$, math.angle.r), ($==>$, $#h(5pt) arrow.r.double #h(5pt)$), ($<==$, $#h(5pt) arrow.l.double #h(5pt)$), ($,,$, $,#h(5pt)$), ($@$, math.lambda), ($~~$, math.tilde), ($==$, math.equiv), ($!==$, math.equiv.not), ($%$, $,#h(.5pt)$), ($..$, $.#h(3pt)$) ) show outline.entry.where(level: 1): it => { v(1em, weak: true) strong(it) } set outline(indent: auto, fill: repeat([.#h(3pt)])) set figure(gap: 1.5em) doc } #let head(str) = align(center)[ #text(18pt)[*#str*]\ #text(14pt)[_$lambda$-исчисление, 2024_] ] #let problemlist(num, title) = doc => { show: formatting set page(background: image("pictures/troubles-faded.jpg", width: 100%, height: 100%, fit: "stretch")) set enum(numbering: n => [ #num.#n. ]) head([ Лист №#num. #title ]) doc } // Routines for drawing reduction diagrams #import "@preview/fletcher:0.4.5" as fletcher: diagram, node, edge #let lnode(A, radius: 0.06cm) = node(A, shape: circle, fill: black, radius: radius, outset: 2*radius) #let ledge(A, B, bend: 0deg, marks:"-stealth") = edge(A, B, marks: marks, bend: bend) #let add((a,b),(c,d)) = (a+c, b+d) #let mult(r, (a,b)) = (r*a, r*b) #let self(A, angle: -90deg, bend: -160deg, marks: "stealth-") = edge(A, add(A, mult(0.001,(calc.cos(angle+90deg), calc.sin(angle+90deg)))), marks: marks, bend: bend) #let lambda-diagram(spacing: 1cm, block) = { diagram( axes: (ltr,btt), spacing: spacing, node-stroke: none, edge-stroke: 0.7pt, node-outset: 0pt, block ) } #let diamond-diagram(prepad: -15pt, spacing: 1cm, r1, r2, r3, r4) = { v(prepad) align(center, lambda-diagram( spacing: spacing, { edge((0,0), (2,0), "-", label: r1, label-side: left) edge((0,0), (0,-1), "-", label: r2, label-side: right) edge((0,-1), (2,-1), "--", label: r3, label-side: right) edge((2,0), (2,-1), "--", label: r4, label-side: left) } )) }
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/about.md
markdown
MIT License
# Typst Examples Book This book provides an extended _tutorial_ and lots of [Typst](https://github.com/typst/typst) snippets that can help you to write better Typst code. <div class="warning"> This is an unofficial book. Some snippets & suggestions here may be outdated or useless (please let me know if you find some). </div> However, _all of them should compile on last version of Typst[^1]_. **CAUTION:** the book is (probably forever) a **WIP**, so don't rely on it. If you like it, consider [giving a star on GitHub](https://github.com/sitandr/typst-examples-book)! This will help me to stay motivated and continue working on this book. ## Navigation The book consists of several chapters, each with its own goal: 1. [Typst Basics](./basics/index.md) 2. [Typst Snippets](./snippets/index.md) 3. [Typst Packages](./packages/index.md) 4. [Typstonomicon](./typstonomicon/index.md) ## Contributions Any contributions are very welcome! If you have a good code snippet that you want to share, feel free to submit an issue with snippet or make a PR in the [repository](https://github.com/sitandr/typst-examples-book). I will especially appreciate submissions of active community members and compiler contributors! However, I will also really appreciate feedback from beginners to make the book as comprehensible as possible! ## Acknowledgements Thanks to everyone in the community who published their code snippets! If someone doesn't like their code and/or name being published, please contact me. [^1]: When a new version launches, it may take some time to update the book, feel free to tag me to speed up the process.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/par-justify_06.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test that justification cannot lead to a leading space #set par(justify: true) #set text(size: 12pt) #set page(width: 45mm, height: auto) lorem ipsum 1234, lorem ipsum dolor sit amet #" leading whitespace should still be displayed"
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/enum-align-01.typ
typst
Other
// Enum number alignment should be 'end' by default 1. a 10. b 100. c #set enum(number-align: start) 1. a 8. b 16. c
https://github.com/ckunte/m-one
https://raw.githubusercontent.com/ckunte/m-one/master/inc/viv.typ
typst
= Vortex induced vibration Effects of vortex shedding@williamson_1996 can be problematic for slender structural members. Shedding frequencies and their interactions, together with other hydrodynamic quantities (e.g. (a) added mass@blevins_1990 and damping@lamb_1932, (b) Reynolds number@reynolds_1883, (c) lift coefficient@white_2011 and (d) correlation of force components) have the potential to impair. Given that vortex induced vibration (VIV) continues to be an area of contemporary research, the slender elements are commonly engineered to prevent VIV, and where unavoidable, countermeasures (VIV suppression devices e.g. strakes) are introduced. Following the industry recognised recommended practice, _DNVGL-RP-C205 -- Environmental conditions and environmental loads_,@dnvgl_rp_c205 the _viv.py_ script below checks for the occurrence of VIV for a range of user-specified pipe sizes subjected to current(s) in the water column. #figure( table( columns: (auto, 1fr), inset: 10pt, align: horizon, [_Excitation_], [_Lock-in_], [Inline], [$1.0 lt.eq v_r lt.eq 4.5$, and $K_s lt.eq 1.8$], [Crossflow], [$3.0 lt.eq v_r lt.eq 16.0$], ), caption: [Vortex shedding resonance], ) <vi1> The script requires the following inputs (together with consistent units). These are to be provided by the user by editing the `viv.py` and updating input parameters marked under _User inputs_ section: + Current velocity, v (m/s) --- typically for a 1-year environment + Marine growth thickness, tm (m) + Flooding condition, f (`1` for flooded; `0` for buoyant) + End (boundary) conditions of the pipe (fixed: `22.2`; clamped: `15.4`; simply-supported: `9.87`; cantilevered: `3.52`) #figure( image("/img/vivc.svg", width: 100%), caption: [ Vortex induced vibration check for a range of pipe diameters and span lengths ] ) <vi2> The way to read the above graph is pretty simple: + Unshaded area (or area in white background) is the safe area. + The intersection of the curve (for each pipe size of D$times$t) with the upper boundary of the non-shaded area (i.e., $V_r$ = 1.0) indicates the max. possible pipe length (span) that is unlikely to experience VIV from (ocean) current. For example, 762OD$times$22WT pipe can span up to 40m, while a 406OD$times$22WT only up to 22m before VIV occurs. + The shaded overlap is a zone in which both inline as well as crossflow VIV excitations occur. (See range of occurrences in @vi1.) Code for generating the plot shown in @vi2 is as follows. #let viv = read("/src/viv.py") #{linebreak();raw(viv, lang: "python")} While the upper limit for cross-flow VIV lock-in is 16 (according to RP-C205), the plot may be set to a lower maximum value of say 5.0 --- e.g. as done in the plot above to keep the curvatures of plots more readable (in `plt.axhspan()` in the script) as so. Change the following line: ```python plt.axhspan(3.0, 16.0, facecolor='orange', alpha=0.18) ``` to: ```python plt.axhspan(3.0, 5.0, facecolor='orange', alpha=0.18) ``` One may use the UNIX@ritchie_kernighan_1974 command seq@gnu_seq to generate a range of diameters like so: `seq <initval> <incr> <endval>`. Here is an example: ```bash $ seq 0.4064 0.0508 0.7620 ``` This generates: ``` 0.4064 0.4572 0.508 0.5588 0.6096 0.6604 0.7112 0.762 ``` $ - * - $