repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/Zeta611/simplebnf.typ
https://raw.githubusercontent.com/Zeta611/simplebnf.typ/main/examples/lambda.typ
typst
MIT License
#import "../simplebnf.typ": * #set page( width: auto, height: auto, margin: .5cm, fill: white, ) #bnf( Prod( $e$, annot: $sans("Expr")$, { Or[$x$][_variable_] Or[$λ x. e$][_abstraction_] Or[$e$ $e$][_application_] }, ), )
https://github.com/jassielof/typst-templates
https://raw.githubusercontent.com/jassielof/typst-templates/main/upsa-bo/estudio-de-factibilidad/template/capítulos/13.evaluación económica y financiera.typ
typst
MIT License
= Evaluación Económica y Financiera == Escenario Sin Financiamiento === Cálculo del Costo de Oportunidad === Flujo de Caja Sin Financiamiento === Análisis de los Indicadores Financieros == Escenario Con Financiamiento === Calculo del Costo Promedio Ponderado del Capital === Flujo de Caja Con Financiamiento === Análisis de los Indicadores Financieros == Análisis de Sensibilidad
https://github.com/Zeratoxx/typst-polylux-theme-frankenstein
https://raw.githubusercontent.com/Zeratoxx/typst-polylux-theme-frankenstein/main/demo/main.typ
typst
#import "@preview/polylux:0.3.1": * #import "../theme/frankenstein.typ": * #show: frankenstein-theme.with( cover: true, aspect-ratio: "16-9", title: [Frankenstein theme], abstract: [A theme about navigation and customization], authors: (frankenstein-author("Theme Author 1", "123456/title of author", "<EMAIL>"),), version: "1.0.0", date: datetime(year: 2024, month: 8, day: 28), keywords: ("progress", "customization", "short informations"), lang: "de", dark-logo-filename: "logo-black.svg", light-logo-filename: "logo-white.svg", options: (show-authors-in-short-info: true), ) #frankenstein-option-register((short-title: [#lorem(10)])) #centered-slide(none, header: frankenstein-bar("progress"))[#heading(outlined: false)[Welcome!]] #frankenstein-outline-slide("Outline") #slide("Theme setup", depth: 2)[ The title page was the result of: ```typ #import themes.frankenstein: * #show: frankenstein-theme.with( cover: true, aspect-ratio: "16-9", title: [frankenstein theme], abstract: [A theme about navigation and customization], authors: (frankenstein-author("Theme Author", "Typst Community", "<EMAIL>"),), version: "1.0.0", date: datetime(year: 2024, month: 4, day: 4), keywords: ("navigation", "customization"), lang options: (:), ) ``` Which automatically generates a cover page if `cover` is set to `true`. ] #new-section-slide("Navigation", subtitle: "kekw")[#enum(numbering: "I.")[mach][mach][mach]] #slide("Navigation")[ Have you noticed the navigation bar at the top? You can press the main section titles, or just one of the subsection dots. Also, there's a progress bar at the bottom by default. == Subsections become dots The current section's dot is always "alight". == So there's two dots for "Navigation"! And they're both alight since we're on this page. ] #slide(none)[ The last subsection is still active because we haven't registered a new section yet! #text(weight: "extrabold", font: "Segoe UI")[extrabold] ] #slide(none)[ #utils.register-section("Manual sections") == Adding manual subsections You can also manually register a new section using: ```typ #utils.register-section("Manual sections") ``` Which is what we did at the start of this slide's code. == Toggle headings registration If you don't want headings to be registered by default, you can switch it on/off: ```typ #frankenstein-update((register-headings: false)) ``` ] #centered-slide(none)[ // #heading(depth: 2)[Hello there!] #text()[Hello there!] ] #slide("Customization")[ We all know that layouts work all of the time 99% of the time. The `frankenstein-update` function updates option dictionaries *recursively* and thus only updates what you specify. The `frankenstein-register` function replaces values *completely*. There's a handy `frankenstein-palette` variable with a pre-configured color palette, but feel free to bring your own! ```typ // Only update the heading color, not it's size: #frankenstein-update((title-text: (fill: frankenstein-palette.warning))) // <- Notice the palette! // Next title slide will feature a green background. #frankenstein-register((title-hero-color: color.hsl(green))) // Let's add some foreground and background content this time. We can place it anywhere! #let fg = place(horizon + left, block(inset: 10%, width: 100%)[foreground.]) #let bg = place( horizon + left, block(inset: 30%, width: 100%)[#text(weight: "bold")[background.]], ) #title-slide(title: "Green", register-section: true, foreground: fg, background: bg) // This becomes...=> ``` ] #new-section-slide("Slide Layout")[] #frankenstein-option-update((title-text: (fill: _frankenstein-palette.warning))) #frankenstein-option-register((title-hero-color: color.hsl(green))) // #let fg = place(horizon + left, block(inset: 10%, width: 100%)[foreground.]) // #let bg = place( // horizon + left, // block(inset: 30%, width: 100%)[#text(weight: "bold")[background.]], // ) // #title-slide(title: "Green", register-section: true, foreground: fg, background: bg) #slide("Slide layout")[ == Alignment grid By default frankenstein uses a 7x7 `grid` wrapped in a content `box` that fills the page's space \ between the header and footer. The grid has the following specifications: ```typ #let slide-grid = ( rows: (auto, 1em, 3fr, auto, 5fr, 1em, auto), columns: (auto, 2em, 1fr, auto, 1fr, 2.5em, auto), gutter: 0pt, ) ``` Which achieves: - edge content possible using placements in the first and last columns - followed by padding around the main content - content in the middle `(auto, auto)` cell - "spring-loaded" positioning using the `fr` rows and columns - The defaults roughly center the content on screen and push it slightly above the horizon. ] #slide("Customizing the grid", depth: 2, grid-children: (grid.cell(x: 6, rowspan: 7, fill: red, align: horizon)[cell]))[ The default slide function `#slide` allows for customization of this grid using the `grid-args` and `grid-cell` keyword arguments per slide. - `grid-args` fully customize the grid. - `auto` means to use the grid settings from theme options. - `none` means to disable the grid. - anything else is treated as keyword arguments to `#grid` - `grid-cell` the cell at which to put the body. - `auto` means to put it at the cell as defined in theme options. - `none` means to check if the body is an array: - if it's an array, pass the array to `#grid` as the contents. - if not, disable the grid functionality and use body as is. - `grid-children` children to place on the grid. The bar on the right was achieved with:\ `grid-children: (grid.cell(x: 6, rowspan: 7, fill: red),)` ] #slide("Customizing the grid", depth: 2, grid-args: ( rows: (auto, 2em, 3fr, auto, 5fr, 1em, auto), columns: (auto, 2em, 1fr, 10fr, 1fr, 2em, 2fr), gutter: 0pt, ), grid-children: (grid.cell(x: 6, rowspan: 7, fill: red, align: horizon)[cell]))[ The default slide function `#slide` allows for customization of this grid using the `grid-args` and `grid-cell` keyword arguments per slide. - `grid-args` fully customize the grid. - `auto` means to use the grid settings from theme options. - `none` means to disable the grid. - anything else is treated as keyword arguments to `#grid` - `grid-cell` the cell at which to put the body. - `auto` means to put it at the cell as defined in theme options. - `none` means to check if the body is an array: - if it's an array, pass the array to `#grid` as the contents. - if not, disable the grid functionality and use body as is. - `grid-children` children to place on the grid. The bar on the right was achieved with:\ `grid-children: (grid.cell(x: 6, rowspan: 7, fill: red),)` ] #frankenstein-option-register(( slide-grid: (columns: (5em, auto, 10em), rows: (1em, auto, 2em)), slide-grid-cell: (x: 1, y: 1), )) #slide("Custom grid", depth: 2)[ If you're not satisfied with the default grid, you can tweak things in the init function, too. ```typ #show: frankenstein-theme.with( //.., options: ( slide-grid: ( columns: (5em, auto, 10em), rows: (1em, auto, 2em), ), slide-grid-cell: (x: 1, y: 1), ), ) ``` ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/fireside/1.0.0/lib.typ
typst
Apache License 2.0
#let _title-size = 44pt #let fireside( background: rgb("f4f1eb"), title: "", from-details: none, to-details: none, margin: 2.1cm, vertical-center-level: 2, body ) = { set page(fill: background, margin: margin) set text(font: ("HK Grotesk", "Hanken Grotesk")) let body = [ #set text(size: 11pt, weight: "medium") #show par: set block(spacing: 2em) #body ] let header = { grid( columns: (1fr, auto), [ #set text(size: _title-size, weight: "bold") #set par(leading: 0.4em) #title ], align(end, box( inset: (top: 1em), [ #set text(size: 10.2pt, fill: rgb("4d4d4d")) #from-details ] )), ) v(_title-size) text(size: 9.2pt, to-details) v(_title-size) } layout(size => context [ #let header-sz = measure(block(width: size.width, header)) #let body-sz = measure(block(width: size.width, body)) #let ratio = (header-sz.height + body-sz.height) / size.height #let overflowing = ratio > 1 #if overflowing or vertical-center-level == none { header body } else { // If no overflow of the first page, we do a bit of centering magic for style grid( rows: (auto, 1fr), header, box([ #v(1fr * ratio) #body #v(vertical-center-level * 1fr) ]), ) } ]) }
https://github.com/Enter-tainer/mino
https://raw.githubusercontent.com/Enter-tainer/mino/master/typst-package/tetris.typ
typst
MIT License
#let default-color = ( "Z": rgb("#ef624d"), "S": rgb("#66c65c"), "L": rgb("#ef9535"), "J": rgb("#1983bf"), "T": rgb("#9c27b0"), "O": rgb("#f7d33e"), "I": rgb("#41afde"), "X": rgb("#686868"), ) #let default-highlight-color = ( "Z": rgb("#ff9484"), "S": rgb("#88ee86"), "L": rgb("#ffbf60"), "J": rgb("#1ba6f9"), "T": rgb("#e56add"), "O": rgb("#fff952"), "I": rgb("#43d3ff"), "X": rgb("#949494"), ) #let is-upper(c) = upper(c) == c #let process-text(string-field) = { string-field.trim().split("\n").rev() } #let get-field(field) = { if type(field) == array { field } else if type(field) == str { process-text(field) } else if type(field) == content { process-text(field.text) } else { panic("unknown type of field") } } #let render-field( field, rows: 20, cell-size: 10pt, bg-color: rgb("#f3f3ed"), stroke: none, radius: auto, shadow: true, highlight: true, color-data: default-color, highlight-color-data: default-highlight-color, shadow-color: rgb("#6f6f6f17"), overdraw: 5, ) = { let field = get-field(field) let actual-radius = if radius == auto { cell-size / 4 } else { radius } let highlight-height = cell-size / 5 let shadow-offset-vertical = cell-size * 0.4 let shadow-offset-horizontal = cell-size / 4 block( width: 10 * cell-size, height: rows * cell-size, inset: 0pt, stroke: stroke, radius: actual-radius, clip: true, fill: bg-color, breakable: false, { let max-row = calc.min(rows, field.len()) if shadow { for i in range(max-row) { let cells = field.at(i).len() let loop-max = calc.min(10, cells) for j in range(loop-max) { if field.at(i).codepoints().at(j) == "_" { continue } let block = field.at(i).codepoints().at(j) if is-upper(block) { place( top + left, dx: cell-size * j + shadow-offset-horizontal, dy: cell-size * (rows - 1 - i) + shadow-offset-vertical, rect( width: cell-size, height: cell-size, fill: shadow-color, ), ) } } } } for i in range(max-row) { let cells = field.at(i).len() let loop-max = calc.min(10, cells) for j in range(loop-max) { if field.at(i).codepoints().at(j) == "_" { continue } let block = field.at(i).codepoints().at(j) for _ in range(overdraw) { if is-upper(block) { place( top + left, dx: cell-size * j, dy: cell-size * (rows - 1 - i), rect( width: cell-size, height: cell-size, fill: color-data.at(upper(block)), ), ) if highlight and block != "_" { place( top + left, dx: cell-size * j, dy: cell-size * (rows - i - 1) - highlight-height, rect( width: cell-size, height: highlight-height, fill: highlight-color-data.at(upper(block)), ), ) } } else { // operation mino is displayed in lower case place( top + left, dx: cell-size * j, dy: cell-size * (rows - 1 - i), rect( width: cell-size, height: cell-size, fill: bg-color, ), ) place( top + left, dx: cell-size * j + cell-size * 0.1, dy: cell-size * (rows - 1 - i) + cell-size * 0.1, rect( width: cell-size * 0.8, height: cell-size * 0.8, stroke: color-data.at(upper(block)) + cell-size * 0.1, ), ) } } } } }, ) }
https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis
https://raw.githubusercontent.com/fuchs-fabian/typst-template-aio-studi-and-thesis/main/CHANGELOG.md
markdown
MIT License
# [v0.1.0](https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis/releases/tag/v0.1.0) Initial Release
https://github.com/rose-pine/typst
https://raw.githubusercontent.com/rose-pine/typst/main/lib.typ
typst
MIT License
#import "src/apply.typ": apply, apply-theme #import "src/themes/rose-pine.typ" : rose-pine #import "src/themes/rose-pine-dawn.typ" : rose-pine-dawn #import "src/themes/rose-pine-moon.typ" : rose-pine-moon
https://github.com/dyc3/senior-design
https://raw.githubusercontent.com/dyc3/senior-design/main/protocol.typ
typst
= Protocol <Chapter::Protocol> == Messaging Protocol The Monolith must maintain a maximum of one WebSocket connection to each Balancer. The client communicates over the WebSocket with messages in JSON format, so the Balancer should do the same. The Balancer will send messages to the Monolith in the following format: ```json { "token": string // the client's auth token "room": string // the room the client is in "id": string // a unique identifier for the connection "message": <JSON object> // literal JSON object received from the client } ``` This will allow the server to relay the message without having to do a serialization round trip. The Monolith can send messages to individual clients by sending the message to the Balancer in the following format: ```json { "room": string // the room the client is in "id": string // a unique identifier for the connection "message": <JSON object> // the literal JSON object to send to the client. } ``` For broadcast messages, the Monolith can omit the `id` field. ```json { "room": string // the room to broadcast to "message": <JSON object> // literal JSON object to send to all clients } ``` === Messages sent during Join and Leave When a client opens a WebSocket connection, the client must immediately send an "auth" message. This is because the browser's WebSocket API does not allow for the client to send headers with the initial connection request. ```json { "action": "auth", "token": string // the client's auth token } ``` Once the the Balancer receives this message, it must send a message to the Monolith to update the room's state. ```json { "token": string // the client's auth token "room": string // the room the client is joining "message": { "action": "req", "request": { type: RoomRequestType.JoinRequest; } } } ``` #figure( image("figures/client-connection-state.svg", width: 50%), caption: "State diagram for Websocket connections from clients to the Balancer." ) <Figure::client-connection-state> Similarly, when a client disconnects, the Balancer must send a message to the Monolith to update the room's state. ```json { "token": string // the client's auth token "room": string // the room the client is leaving "message": { "action": "req", "request": { type: RoomRequestType.LeaveRequest; } } } ``` These messages conform to the the protocol defined by the #link("https://github.com/dyc3/opentogethertube/blob/master/common/models/messages.ts")[types in the OTT monolith here]. == Messages sent during Monolith connection startup When a Monolith starts up and load balancing is enabled, it must listen on a separate port for incoming balancer connections. Balancers will initiate connections based on their configured Monolith discovery method. Upon accepting a new connection, the Monolith must send an "init" message to the Balancer to inform it of the port that it is listening for normal HTTP requests on, an auth token to verify authenticity, and a MonolithID to identify specific Monolith instances (@Figure::monolith-id-sequence). The MonolithID is generated as a UUID. While it's theoretically possible for UUIDs to be duplicated due to the finite space of possible values, the probability of such an event is so incredibly low that it's considered practically negligible. Once the Balancer receives this message, the connection is considered fully established, and the Monolith and Balancer can begin sending messages to each other. #figure( image("figures/manage-balanacer-connections-class.svg", width: 450pt), caption: "Class diagram for how Balancer connections are managed and initialized" ) <Figure::manage-balanacer-connections-class> #figure( image("figures/monolith-id-sequence.svg", width: 80%), caption: "Sequence diagram for how Monolith IDs are sent to the Balancer" ) <Figure::monolith-id-sequence>
https://github.com/crd2333/crd2333.github.io
https://raw.githubusercontent.com/crd2333/crd2333.github.io/main/src/docs/Courses/数据库系统/ER 模型和NF.typ
typst
--- order: 3 --- #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(2) = 第三部分:ER 模型和 Normal Form == E-R模型 - 软件工程中,设计一个系统的时候,其步骤一般为:\ requirement specification $=>$ *conceptual-design* $=>$ logical-design $=>$ physical-design - 其在数据库设计中的对应为:\ user requirement specification $=>$ *E-R diagram* $=>$ logical schema $=>$ physical schema - E-R模型由 enitites(实体)和 relations among entities(关系)组成 === Entity set 实体集 #wrap-content( align: right, fig("/public/assets/Courses/DB/img-2024-04-01-14-23-25.png", width: 45%), )[ - 一个实体是一个独特的 object,并且 distinguishable from other objects,拥有一系列 attributes - 同一类实体共享相同的 attributes,实体集就是由同类型的实体组成的集合 - 表示方法:长方形代表实体集合;属性写在长方形中,*primary key用下划线*标注 - 实体集中对于属性的定义和之前的几乎一样 - 实体集中属性定义可以存在组合与继承的关系(Composite,有点像细化的感觉) - 多值(Multivalued)属性,可以拆分出一个表 - 一个复杂的例子如右图 #figure(none) <attr> ] === Relationship set 关系集 - 一个 relationship 是几个实体之间的联系,关系集就是同类关系之间构成的集合 - 一个 relationship 至少需要两个及以上的实体,一个关系集至少和两个实体集有关联(即 degree 至少为 $2$) - relationship 可以带有属性,带有 $N$ 个属性的关系可以看做是 $N+"degree"$ 元组 - 一个关系集所关联的实体集的个数称为 *degree*,其中以二元关系集为主(且任何一个多元关系都可以转化为二元关系) - Roles: 关系集不一定得是不同的两个实体集之间,同一个实体集中的某一个 label 在关系中作为不同的 *role* === E-R model constraints 约束 - mapping cardinalities *映射基数* - 二元关系中映射基数只有四种:#redt[一对一,一对多,多对一,多对多] #grid( columns: (auto, auto), gutter: 2pt, [#figure(image("/public/assets/Courses/DB/img-2024-04-01-19-03-03.png"), caption: "一对一") <map-card>], [#figure(image("/public/assets/Courses/DB/img-2024-04-01-19-03-20.png"), caption: "一对多")], [#figure(image("/public/assets/Courses/DB/img-2024-04-01-19-03-34.png", width: 90%), caption: "多对一")], [#figure(image("/public/assets/Courses/DB/img-2024-04-01-19-03-47.png", width: 110%), caption: "多对多")], ) - E-R模型中表示映射关系:箭头表示有且只有一,直线表示多 - 还有一种数字表示法,应该不做要求 - 多对多关系实现代价比一对多要高,因为多对多中的关系需要一个新的表来存储 - 三元(或更高)关系中:*箭头只能出现一次*,否则会出现*二义性* - 下面的例子表示,每个学生的每个 project 只能有一位老师指导(学生可以开展多个 project,每个 project 可以有多个学生参与,导师可以指导多个学生、多个 project) #fig("/public/assets/Courses/DB/img-2024-04-01-19-13-33.png", width: 70%) - 但是上面的映射基数是对参与关系的实体而言,但不一定每个实体都参与 - 参与度约束 - total participation:若一个实体集全部参与到关系中,要用*双线* - partical participation:部分参与 - key约束: - 对 entity set 而言,和以往定义基本一样,即足够区分 - 对 relationship set 而言: - 关系集 $R$ 关联了实体集 $E_1, E_2, dots, E_n$,那么$R$ 的 primary key 应该是 $E_1, E_2, dots, E_n$ 各自 primary key 的 *Union*;如果关系集带有属性 $a_1, a_2, dots, a_m$,则属性也应该被加到 primary key 里(?) - 上面这个说法是一般情况下(均视为多对多),实际上 primary key 的选取还要考虑到映射基数,比如@map-card[图]中,四种情况的 primary key 为: #tbl( columns: 2, [either one], [{student_id}], [{instructor_id}], [{instructor_id, student_id}]) - 弱实体集weak entity set:一些实体集的属性不足以形成主键,就是弱实体集,与之相对的是强实体集 - 用于表示一些关系中的依赖性,弱实体集需要和强实体集关联才有意义 - 经常出现在一对多的关系中,在E-R图中需要用*虚线*标注(判别器) - 例子:primary key for $"section" - {"course_id", "sec_id", "semester", "year"}$ #fig("/public/assets/Courses/DB/img-2024-04-01-14-33-25.png", width: 65%) - 注意到,如果我们将 $"course_id"$ 也写进 $"section"$,它就能变成 strong entity set,但是造成了 redundant attribute - Redundant Attributes(冗余属性) - 一般来说,不允许冗余信息,即——拥有相同属性的两个实体集,这个属性应该在某一边被删掉,然后用关系集来表示,比如下图 $"student"$ 中的 $"dept_name"$ #fig("/public/assets/Courses/DB/img-2024-04-01-20-10-34.png", width: 60%) - 但是回到 SQL,我们往往又会把这个冗余写回去,然后用一个 foreign key 表示联系 - E-R Diagram for a University Enterprise(一个复杂的例子) #fig("/public/assets/Courses/DB/img-2024-04-01-14-03-21.png", width: 70%) === Reduction to Relational Schemas - 从 E-R 模型归约(转化)到 relational schemas - weak entity set 的转化,依赖属性拿过来,加上虚线属性一起变为 primary key #fig("/public/assets/Courses/DB/img-2024-04-01-15-18-30.png", width: 60%) - many-to-many relationship set 的转化 #fig("/public/assets/Courses/DB/img-2024-04-01-15-19-42.png", width: 60%) - Many-to-one and one-to-many relationship set 的转化 - 有两种方式,关系集独立或归到 many 的那一边 #fig("/public/assets/Courses/DB/img-2024-04-01-14-54-41.png", width: 60%) - 一般来说下面那种好一些,但也不绝对,比如,当 instructor 成为多元关系或非常复杂的时候…… - one-to-one relationship set 的转化 - 两边中的任意一边可以被选为“many” side(extra attribute can be added to either one) - 当 participation is partial,没有参与关系的置为 null - Composite and Multivalued Attributes(如 @attr) - Composite Attributes - Creating a separate attribute for each component attribute(展开,flatten) - 丢失了部分信息(属性间的继承关系) - Multivalued Attributes - A multivalued attribute $M$ of an entity $E$ is represented by separate schemas $E, M$(原表的主键和多值属性) - 增添了一个新表,略冗余 - 从这里也可以看出关系数据库的局限性,后面我们会介绍关系数据库的面向对象拓展—— inherit 和仅在这提了一嘴的 method(如 `age()`) - Special Case of Multivalued Attributes: - 实体集除了主键外只有一个属性,且这个属性是多值的。按照之前的规则,这个多值需要被拆分出去,留下只有一个属性的实体集,思考这种情况下原实体集是否有保留的必要? #fig("/public/assets/Courses/DB/img-2024-04-01-15-10-43.png", width: 60%) === Design Issues - Common Mistakes in E-R Diagrams - 属性冗余 - 关系集中的同一条关系有多个实例 - Use of entity sets $v.s.$ attributes & Use of entity sets $v.s.$ relationship sets - 把 relationship set 或其属性实体化成 entity set 增强了表达能力 - Placement of relationship attributes - relationship set 之所以要设置 attributes 是有原因的,同样的 attribute 放在 entity set 和 relationship set 中表达不同的含义 - Binary Vs. Non-Binary Relationships & Converting Non-Binary Relationships to Binary Form - 有时 n-ary 更清楚,有时 2-ary 更适合,具体情况具体分析 - n-ary 到 2-ary 的转化: #fig("/public/assets/Courses/DB/img-2024-04-01-21-00-28.png") === Extended ER Features - 吸收面向对象的思想: Specialization / Generalization - 可以参照 “第四章*面向对象数据库*” 体会更多 DB 吸收的 OOP 特性 - 吸收面向对象的思想: Specialization / Generalization - Generalization 泛化 - 自底向上的设计过程 - 从下往上,下层的内容合成上层的内容 - Specialization 特殊化 - 自顶向下的设计过程 - Attribute inheritance: overlapping, disjoint - Completeness constraint(完全性约束): total, partial - 画图的方式就是从上往下画,Entity 的内容逐渐细分,然后考虑如何继承上一阶的 attribute #fig("/public/assets/Courses/DB/img-2024-04-01-15-42-03.png", width: 60%) - Representing Specialization via Schemas(三种方式) + 把 higher-level 的 primary key 拿过来,和本地的 attributes 组成 schema #tbl( stroke: none, columns: 2, align: left, [schema], table.vline(), [attributes], table.hline(), [person], [ID, name, street, city], [student], [ID, tot_credits], [employee], [ID, salary], ) + 把 higher-level 整个拿过来,和本地的 attributes 组成 schema #tbl( stroke: none, columns: 2, align: left, [schema], table.vline(), [attributes], table.hline(), [person], [ID, name, street, city], [student], [ID, name, street, city, tot_credits], [employee], [ID, name, street, city, salary], ) + 用单个 schema 表示所有 entity sets,新加一个 attribute 用以标识 #tbl( stroke: none, columns: 2, align: left, [schema], table.vline(), [attributes], table.hline(), [person], [ID, name, street, city, #redt[person_type], tot_cred, salary], ) === UML - 参见 “第四部分*半结构数据*” == 关系数据库设计 === 数据库设计的目标 - When reduce to relational schemas, there are several pitfalls + Information repetition (信息重复) + Insertion anomalies (插入异常) + Update difficulty (更新困难) - 我们通过各种范式(normal form)来实现好的设计方式 - 一般来说我们希望将大的关系模式分解 - Normal Forms(NF)的演进: 1NF $->$ 2NF $->$ 3NF $->$ *BCNF(3NF)* $->$ 4NF - 我们将会重点讨论 *BCNF*和 *3NF* - Our theory is based on: - functional dependencies - multivalued dependencies === Decomposition - 分解(decomposition)分为 lossy-join decomposition & lossless-join decomposition - Lossy Decomposition 有损分解:不能用分解后的几个关系重建原本的关系 #definition(title: "Lossless join 无损分解的定义")[ - R 被分解为 (R_1, R_2) 并且$R=R_1 union R_2$ - 对于任何关系模式 R 上的关系 r 有 $r=Pi_(R_1)(r) join Pi_(R_2)(r)$ - 同时,lossless join 要求下列至少一项成立(至少有一项在 $R_1 sect R_2$ 的闭包中) $ R_1 sect R_2 -> R_1 "(共同属性决定R1)"\ R_1 sect R_2 -> R_2 "(共同属性决定R2)" $ ] - 注意 $r subset Pi_(R_1)(r) join Pi_(R_2)(r)$ 是有损分解(看起来信息变多了,实际上反而引入不确定性) === Functional dependency 函数依赖 #definition(title: [函数依赖的定义])[ - 对关系模式 $R$,如果 $alpha subset R, beta subset R$,则函数依赖 $alpha -> beta$ 定义在 $R$ 上,当且仅当: - 如果对于 $R$ 的任意关系 $r(R)$,当其中的任意两个元组 $t_1$ 和 $t_2$,如果他们的 $alpha$ 属性值相同可以推出他们的 $ beta$ 属性值也相同(函数的 x 定了,那么 y 也就定了) - 如果某个属性集 $A$ 可以*决定*另一个属性集 $B$ 的值,就称$A -> B$ 是一个函数依赖 ] - 函数依赖和键的关系:函数依赖实际上是键的概念的一种泛化(推广) - K是关系模式R的*超键*(super key)当且仅当 $K -> R$ - K 是R上的*候选主键*(candidate key)当且仅当 $K -> R$ 并且不存在 $alpha subset.neq K, alpha -> R$ - 平凡(trivial)的函数依赖:$alpha -> beta "and" beta subset.eq alpha$,它并不包含有用的信息,一般来说我们在讨论函数依赖时可以默认不考虑这种情形 === 闭包 #definition(title: "Closure(闭包)")[ - 函数依赖 $F$ 的闭包,原始的函数依赖集合 $F$ 可以推出的所有函数依赖关系的集合就是*$F$ 的闭包*,用 $F^+$ 表示 - 例如,$A -> B, B -> C, "then" A -> C$,它们都包含在 $F^+$ 中,此外还有 $A B -> B "(平凡)", A B -> C "等"$ - 属性集的闭包 - 闭包中所有函数依赖于 $alpha$ 的属性集构成的集合,即若 $(alpha -> beta) in F^+$,则 $ beta in alpha^+$ ] - 函数依赖的性质 + reflexity(自反律):$alpha$ 的子集一定关于$alpha$函数依赖 + augmentation(增补律):如果$alpha -> beta$ 则有$ lambda alpha -> lambda beta$ + transitivity(传递律):如果$a -> beta and beta -> gamma$ 则有$a -> gamma$ - 这三条构成函数依赖的公理系统,确保其 sound(正确有效) and complete(完备) + union(合并):如果$alpha -> beta and alpha -> gamma$ 则有$alpha -> beta gamma$ + decomposition(分解):如果$alpha -> beta gamma$ 则有$alpha -> beta and alpha -> gamma$ + pseudotransitivity(伪传递):如果$alpha -> beta and beta gamma -> delta$ 则有$alpha gamma -> delta$ - 这三条是由前三条推导出来的 additional rules - 计算闭包的方法 - 两种闭包的计算差不多是一回事 - 根据初始的函数依赖关系集合 $F$ 和函数依赖的性质,计算出所有的函数依赖构成闭包(纸面公式推导) - 通过特定算法推导(机器) - 对人类而言,画个*有向图*表示属性之间的关系,通过图写出所有的函数依赖是最快的 - 属性集闭包的作用 - 测试是否为超键:如果 $alpha$ 的闭包包含了所有属性$(alpha^+ -> R)$,则 $alpha$ 就是超键 - 测试函数依赖存在性:为了验证 $alpha -> beta$ 是否存在,只需要验证 $beta$ 是否在 $alpha$ 的闭包中 - 计算 $F^+$:通过每个属性的闭包可以得到整个关系模式的闭包 === Canonical Cover 正则覆盖 - 为了定义正则覆盖,首先定义无关属性 #definition(title: "Extraneous Attributes(无关属性)")[ - 定义:对于函数依赖集合F中的一个函数依赖$alpha -> beta$ - $alpha$ 中的属性 $A$ 是多余的,如果 $F$ 逻辑上可以推出$(F- {alpha -> beta}) union {(alpha-A) -> beta}$ - $beta$ 中的属性 $B$ 是多余的,如果$(F-{alpha -> beta}) union {alpha -> (beta-B) }$ 逻辑上可以推出 $F$ - 更强的函数逻辑上可以推导出更弱的函数 ] - 判断$alpha -> beta$中的一个属性是不是多余的(理论上) - 测试 $alpha$ 中的属性 $A$ 是否为多余的 - 计算$(alpha-A)^+$,检查结果中是否包含 $beta$,如果有就说明 $A$ 是多余的 - 测试 $beta$ 中的属性 $B$ 是否为多余的 - 只用$(F- { alpha -> beta }) union { alpha ->( beta-B)}$中有的依赖关系计算$alpha^+$,如果结果包含 B,就说明 B 是多余的 #definition(title: "Canonical Cover(正则覆盖)")[ - 跟闭包相对,正则覆盖(最小覆盖)是等价的最小的函数依赖集合(也就是没有冗余,和 $F$ 等价可以推导出 $F^+$ 的关系集合),记作 $F_c$ - 最小覆盖$F_c$的定义 - 和 $F$ 可以互相从逻辑上推导,并且最小覆盖中没有多余的信息 - 最小覆盖中的每个函数依赖中左边的内容都是 unique 的 ] - 如何计算最小覆盖(理论上) - 先令 $F_c = F$ - 用 Union rule 将 $F_c$ 中所有满足$alpha -> beta_1 and alpha -> beta_2$的函数依赖替换为$alpha -> beta_1 beta_2$ - 找到 $F_c$ 中的一个函数依赖去掉里面重复的属性 - 重复 2,3 两个步骤直到 $F_c$ 不再变化 - 而实际上,对人类而言,判断属性多余和计算最小覆盖都可以像之前那样画一个有向图来快速解决 === BCNF #definition(title: "BCNF(Boyee-Codd Normal Form)")[ - BC范式的条件是:闭包$F^+$中的所有函数依赖$alpha -> beta$ 至少满足下面的一条 - $alpha -> beta$ 是平凡的(也就是β是α的子集) - $alpha$ 是关系模式R的一个*超键*,即$alpha -> R$ - 换句话说,如果一个函数依赖是非平凡的,那么它左边的属性集一定是个 key ] - 如何验证 BCNF: - 检测一个非平凡的函数依赖 $alpha -> beta$ 是否违背了 BCNF 的原则 - 计算 $alpha$ 的属性闭包 - 如果这个属性闭包包含了所有的元素,那么 $alpha$ 就是一个*超键* - 如果 $alpha$ 不是超键而这个函数依赖又不平凡,就打破了 BCNF 的原则 - 简化的检测方法: - 只需要看关系模式 $R$ 和已经给定的函数依赖集合*F中的各个函数依赖*是否满足 BCNF 的原则 - 不需要检查 F 闭包中所有的函数独立 - 可以证明如果 F 中没有违背 BCNF 原则的函数依赖,那么 F 的闭包中也没有 - 这个方法不能用于检测 R 的分解 - BCNF 分解 #algo(caption: "BCNF的分解算法伪代码")[ ```typ result={$R$}; done=false; compute $F^+$ by $F$ while (!done) do if exist $R_i$ in result that is not a BCNF then begin let $alpha -> beta$ be a non-trivial function dependency holds on $R_i$ such that $a->R_i in.not F^+$ and $(alpha and beta)$=$emptyset$; $"result"=("result"-R_i) union (R_i-beta) union (alpha,beta)$; end else done=true end end ``` ] - 例如下图中,$A->B$ 满足 BCNF 但 $B->C D$ 不满足 #fig("/public/assets/Courses/DB/img-2024-06-17-11-43-46.png",width:75%) - 当我们对关系模式 $R$ 进行分解的时候,我们的目标是 - 没有冗余,每个关系都是一个 BCNF - 无损分解 - 可能会想要:独立性保护 - Denpendency preservation 独立性保护,把 R 和 F 的闭包按照关系的对应进行划分 - 用 $F_i$ 表示只包含在 $R_i$ 中出现的元素的函数依赖构成的集合 - 我们希望的结果是 $(F_1 union F_2 union dots union F_n)^+=F^+$,也就是——重视每一条函数依赖 - 上述 BCNF 分解算法保证无损性,但是不保证独立性保护,为此放宽限制使用 3NF - BCNF 一定是 3NF === Third normal form 第三范式 #definition(title: "第三范式的定义")[对于函数依赖的闭包$F^+$中的所有函数依赖$alpha -> beta$ 下面三条至少满足一条 - $alpha -> beta$ 是平凡的 - $alpha$是关系模式 $R$ 的超键 - \* $beta - alpha$ 中的每一个属性 $A$ 都包含在 $R$ 的一个候选主键(candidate key)中 ] - 3NF有冗余,某些情况需要设置一些空值 - 3NF的判定 - 不需要判断闭包中的所有函数依赖,只需要对已有的 F 中的所有函数依赖进行判断 - 用闭包可以检查 $alpha -> beta$ 中的 $alpha$ 是不是超键 - 如果不是,就需要检查 $beta$ 中的每一个属性包含在R的候选键中 - 3NF decomposition algorithm - 简单来说就是先算 $F_c$作为分解,然后加入 candidate key,最后可选地删除冗余 #algo(caption: "3NF的分解算法伪代码")[ ```typ Let $F_c$ be a canonical cover for $F$; $i$ = 0; for each functional dependency $alpha -> beta$ in $F_c$ do $i = i + 1$; $R_i = alpha beta$ end if none of the schemas $R_j, 1 =< j =< i$ contains a candidate key for $R$ then $i = i + 1$; $R_i$ = any candidate key for $R$; end repeat #comment[Optionally, remove redundant relations] if any schema $R_j$ is contained in another schema $R_k$ then /* delete $R_j$ */ $R_j = R_i$; $i=i-1$; end end until no more $R_j$ s can be deleted return ($R_1, R_2, ..., R_i$) ``` ] - ER modeling and Normal Forms - 一个例子 #fig("/public/assets/Courses/DB/img-2024-04-08-20-19-08.png", width: 70%) - 由此也可以得到之前说的三元关系需要转化成三个表的结论 - 思考,是否 schemas in BCNF or 3NF 已经足够好了?考虑下面的例子 $ "inst_info"(underline("ID"), underline("child_name"), underline("phone")) $ - 它是一个 BCNF,但是当我们为某个 ID 插入一个 phone_number 时,需要多一个 child_name 的信息(Insertion anomalies) - 这引出 *multivalued dependencies* 和 *fourth normal form* === Multivalued denpendency #definition(title: "Multivalued dependency")[ - 对关系模式 $R$,如果 $alpha subset R, beta subset R$,则函数依赖 $alpha ->-> beta$ 定义在 $R$ 上,当且仅当它们满足表格所显示关系 #tbl( columns: 4, stroke: none, table.hline(start: 1), table.vline(start: 1), [], table.vline(), [$alpha$], table.vline(), [$beta$], table.vline(), [$R-alpha-beta$], table.vline(), table.hline(), [$t_1$], [$a_1$], [$beta_1$], [$gamma_1$], [$t_2$], [$a_1$], [$beta_2$], [$gamma_2$], table.hline(), [$t_3$], [$a_1$], [$beta_1$], [$gamma_2$], [$t_4$], [$a_1$], [$beta_2$], [$gamma_1$], table.hline(), ) ] - 两个性质 + 考虑仅含三属性的集合 $a, b, c$,$a->->b <=> a->->c$ + If $a -> b$, then $a ->-> b$(称函数依赖是多值依赖的特殊形式) - 类似之前函数依赖的 $F$,我们定义 $D$ 表示多值依赖集,定义 $D^+$ 表示所有 $D$ 逻辑蕴含的*函数依赖*和*多值依赖* - 类似 BCNF,定义 *Fourth Normal Form* 为 - 每个 $alpha ->-> beta$ 是平凡的($beta subset.eq alpha$ or $alpha union beta = R$);或者 $alpha$ 是超键 - 4NF 是 BCNF 的窄化,它一定会是 BCNF(?) - 4NF 分解算法和 BCNF 分解算法几乎一模一样,不赘述 - 一个例子 #fig("/public/assets/Courses/DB/img-2024-04-15-14-58-13.png") - Denormalization for Performance:有时候我们需要引入冗余,来保持性能。 #fig("/public/assets/Courses/DB/img-2024-04-08-21-44-45.png", width: 80%) - 简单做个归纳(其中 1NF 和 2NF 课上没有强调) - 这四者是层层递进,层层归属的关系) #tbl( columns: 2, [1NF], [消除多值属性], [2NF], [非主属性完全函数依赖于候选键(候选键决定 $R$)], [3NF], [消除非主属性对候选键的*传递*函数依赖(候选键*直接*决定 $R$)], [BCNF], [消除主属性对候选键的*传递*函数依赖和*部分*函数依赖], [4NF], [消除非平凡且非函数依赖的多值依赖], )
https://github.com/RaphGL/ElectronicsFromBasics
https://raw.githubusercontent.com/RaphGL/ElectronicsFromBasics/main/DC/chap8/1_whats_a_meter.typ
typst
Other
#import "../../core/core.typ" === What is a meter? A #emph[meter] is any device built to accurately detect and display an electrical quantity in a form readable by a human being. Usually this \"readable form\" is visual: motion of a pointer on a scale, a series of lights arranged to form a \"bargraph,\" or some sort of display composed of numerical figures. In the analysis and testing of circuits, there are meters designed to accurately measure the basic quantities of voltage, current, and resistance. There are many other types of meters as well, but this chapter primarily covers the design and operation of the basic three. Most modern meters are \"digital\" in design, meaning that their readable display is in the form of numerical digits. Older designs of meters are mechanical in nature, using some kind of pointer device to show quantity of measurement. In either case, the principles applied in adapting a display unit to the measurement of (relatively) large quantities of voltage, current, or resistance are the same. The display mechanism of a meter is often referred to as a #emph[movement], borrowing from its mechanical nature to #emph[move] a pointer along a scale so that a measured value may be read. Though modern digital meters have no moving parts, the term \"movement\" may be applied to the same basic device performing the display function. The design of digital \"movements\" is beyond the scope of this chapter, but mechanical meter movement designs are very understandable. Most mechanical movements are based on the principle of electromagnetism: that electric current through a conductor produces a magnetic field perpendicular to the axis of electron flow. The greater the electric current, the stronger the magnetic field produced. If the magnetic field formed by the conductor is allowed to interact with another magnetic field, a physical force will be generated between the two sources of fields. If one of these sources is free to move with respect to the other, it will do so as current is conducted through the wire, the motion (usually against the resistance of a spring) being proportional to strength of current. The first meter movements built were known as #emph[galvanometers], and were usually designed with maximum sensitivity in mind. A very simple galvanometer may be made from a magnetized needle (such as the needle from a magnetic compass) suspended from a string, and positioned within a coil of wire. Current through the wire coil will produce a magnetic field which will deflect the needle from pointing in the direction of earth\'s magnetic field. An antique string galvanometer is shown in the following photograph: #image("static/50030.jpg") Such instruments were useful in their time, but have little place in the modern world except as proof-of-concept and elementary experimental devices. They are highly susceptible to motion of any kind, and to any disturbances in the natural magnetic field of the earth. Now, the term \"galvanometer\" usually refers to any design of electromagnetic meter movement built for exceptional sensitivity, and not necessarily a crude device such as that shown in the photograph. Practical electromagnetic meter movements can be made now where a pivoting wire coil is suspended in a strong magnetic field, shielded from the majority of outside influences. Such an instrument design is generally known as a #emph[permanent-magnet, moving coil], or #emph[PMMC] movement: #image("static/00146.png") In the picture above, the meter movement \"needle\" is shown pointing somewhere around 35 percent of full-scale, zero being full to the left of the arc and full-scale being completely to the right of the arc. An increase in measured current will drive the needle to point further to the right and a decrease will cause the needle to drop back down toward its resting point on the left. The arc on the meter display is labeled with numbers to indicate the value of the quantity being measured, whatever that quantity is. In other words, if it takes 50 microamps of current to drive the needle fully to the right (making this a \"50 µA full-scale movement\"), the scale would have 0 µA written at the very left end and 50 µA at the very right, 25 µA being marked in the middle of the scale. In all likelihood, the scale would be divided into much smaller graduating marks, probably every 5 or 1 µA, to allow whoever is viewing the movement to infer a more precise reading from the needle\'s position. The meter movement will have a pair of metal connection terminals on the back for current to enter and exit. Most meter movements are polarity-sensitive, one direction of current driving the needle to the right and the other driving it to the left. Some meter movements have a needle that is spring-centered in the middle of the scale sweep instead of to the left, thus enabling measurements of either polarity: #image("static/00147.png") Common polarity-sensitive movements include the D\'Arsonval and Weston designs, both PMMC-type instruments. Current in one direction through the wire will produce a clockwise torque on the needle mechanism, while current the other direction will produce a counter-clockwise torque. Some meter movements are polarity-#emph[in]sensitive, relying on the attraction of an unmagnetized, movable iron vane toward a stationary, current-carrying wire to deflect the needle. Such meters are ideally suited for the measurement of alternating current (AC). A polarity-sensitive movement would just vibrate back and forth uselessly if connected to a source of AC. While most mechanical meter movements are based on electromagnetism (electron flow through a conductor creating a perpendicular magnetic field), a few are based on electrostatics: that is, the attractive or repulsive force generated by electric charges across space. This is the same phenomenon exhibited by certain materials (such as wax and wool) when rubbed together. If a voltage is applied between two conductive surfaces across an air gap, there will be a physical force attracting the two surfaces together capable of moving some kind of indicating mechanism. That physical force is directly proportional to the voltage applied between the plates, and inversely proportional to the square of the distance between the plates. The force is also irrespective of polarity, making this a polarity-insensitive type of meter movement: #image("static/00148.png") Unfortunately, the force generated by the electrostatic attraction is #emph[very] small for common voltages. In fact, it is so small that such meter movement designs are impractical for use in general test instruments. Typically, electrostatic meter movements are used for measuring very high voltages (many thousands of volts). One great advantage of the electrostatic meter movement, however, is the fact that it has extremely high resistance, whereas electromagnetic movements (which depend on the flow of electrons through wire to generate a magnetic field) are much lower in resistance. As we will see in greater detail to come, greater resistance (resulting in less current drawn from the circuit under test) makes for a better voltmeter. A much more common application of electrostatic voltage measurement is seen in an device known as a #emph[Cathode Ray Tube], or #emph[CRT]. These are special glass tubes, very similar to television viewscreen tubes. In the cathode ray tube, a beam of electrons traveling in a vacuum are deflected from their course by voltage between pairs of metal plates on either side of the beam. Because electrons are negatively charged, they tend to be repelled by the negative plate and attracted to the positive plate. A reversal of voltage polarity across the two plates will result in a deflection of the electron beam in the opposite direction, making this type of meter \"movement\" polarity-sensitive: #image("static/00149.png") The electrons, having much less mass than metal plates, are moved by this electrostatic force very quickly and readily. Their deflected path can be traced as the electrons impinge on the glass end of the tube where they strike a coating of phosphorus chemical, emitting a glow of light seen outside of the tube. The greater the voltage between the deflection plates, the further the electron beam will be \"bent\" from its straight path, and the further the glowing spot will be seen from center on the end of the tube. A photograph of a CRT is shown here: #image("static/50001.jpg") In a real CRT, as shown in the above photograph, there are two pairs of deflection plates rather than just one. In order to be able to sweep the electron beam around the whole area of the screen rather than just in a straight line, the beam must be deflected in more than one dimension. Although these tubes are able to accurately register small voltages, they are bulky and require electrical power to operate (unlike electromagnetic meter movements, which are more compact and actuated by the power of the measured signal current going through them). They are also much more fragile than other types of electrical metering devices. Usually, cathode ray tubes are used in conjunction with precise external circuits to form a larger piece of test equipment known as an #emph[oscilloscope], which has the ability to display a graph of voltage over time, a tremendously useful tool for certain types of circuits where voltage and/or current levels are dynamically changing. Whatever the type of meter or size of meter movement, there will be a rated value of voltage or current necessary to give full-scale indication. In electromagnetic movements, this will be the \"full-scale deflection current\" necessary to rotate the needle so that it points to the exact end of the indicating scale. In electrostatic movements, the full-scale rating will be expressed as the value of voltage resulting in the maximum deflection of the needle actuated by the plates, or the value of voltage in a cathode-ray tube which deflects the electron beam to the edge of the indicating screen. In digital \"movements,\" it is the amount of voltage resulting in a \"full-count\" indication on the numerical display: when the digits cannot display a larger quantity. The task of the meter designer is to take a given meter movement and design the necessary external circuitry for full-scale indication at some specified amount of voltage or current. Most meter movements (electrostatic movements excepted) are quite sensitive, giving full-scale indication at only a small fraction of a volt or an amp. This is impractical for most tasks of voltage and current measurement. What the technician often requires is a meter capable of measuring high voltages and currents. By making the sensitive meter movement part of a voltage or current divider circuit, the movement\'s useful measurement range may be extended to measure far greater levels than what could be indicated by the movement alone. Precision resistors are used to create the divider circuits necessary to divide voltage or current appropriately. One of the lessons you will learn in this chapter is how to design these divider circuits. #core.review[ - A \"#emph[movement]\" is the display mechanism of a meter. - Electromagnetic movements work on the principle of a magnetic field being generated by electric current through a wire. Examples of electromagnetic meter movements include the D\'Arsonval, Weston, and iron-vane designs. - Electrostatic movements work on the principle of physical force generated by an electric field between two plates. - #emph[Cathode Ray Tubes] (CRT\'s) use an electrostatic field to bend the path of an electron beam, providing indication of the beam\'s position by light created when the beam strikes the end of the glass tube. ]
https://github.com/alikindsys/aula
https://raw.githubusercontent.com/alikindsys/aula/master/Core/prelude.typ
typst
#import "base.typ": aula, color-table, attn #import "alias.typ": * #import "packages.typ": gloss-awe, oxifmt, acrostiche, cetz #import gloss-awe: gls, gls-add #import oxifmt: strfmt #import acrostiche: *
https://github.com/lucifer1004/typst-poetry
https://raw.githubusercontent.com/lucifer1004/typst-poetry/main/README.md
markdown
# typst-poetry A simple package for typesetting poems in Typst. ![Example](./example.png)
https://github.com/Meisenheimer/Notes
https://raw.githubusercontent.com/Meisenheimer/Notes/main/src/NumberTheory.typ
typst
MIT License
#import "@local/math:1.0.0": * = Number Theory == Prime Number #env("Definition")[ A *prime number* (or a *prime*) is a natural number greater than $1$ that is not a product of two smaller natural numbers. ] #env("Definition")[ A *composite number* (or a *composite*) is a natural number greater than $1$ that is a product of two smaller natural numbers. ] === Primality testing #env("Theorem")[ For a integer $n in NN$, if it is a product of two natural number $a$ and $b$ thar $a <= b$, then $ 1 <= a <= sqrt(n) <= b <= n. $ ] #env("Method", name: "Trial division")[ Given a integer $n$, the *trial division method* divides $n$ by each integer from $2$ up to $sqrt(n)$. Any such integer dividing $n$ evenly establishes $n$ as composite, otherwise it is prime. ] #env("Theorem", name: "Fermat's little theorem")[ For a prime number $p$ and a number $a$ that $upright("gcd") (a, p) = 1$, then $a^(p-1) equiv 1 (upright("mod") p)$ ] #env("Method")[ The *Miller-Rabin* algorithm is a method of primality testing, where given a number $n$, where we + determine directly for small numbers such as $p = 2$. + factorize the number $p = u times 2^t$; + choose a number $a$ that $upright("gcd") (a, p) = 1$, and calculate $a^u, a^(u times 2), a^(u times 2^2), dots, a^(u times 2^(t-1))$; + if $a^u equiv 1 (upright("mod") p)$, or $exists a^(u times k), k < t$ that $a^(u times k) equiv p-1 (upright("mod") p)$ then $p$ passes the test, otherwise, $p$ is a composite number; + repeat above steps to eliminate error. For numbers less than $2^32$, choose $a in { 2, 7, 61 }$ is enough, for numbers less than $2^{64}$, choose $a in { 2, 325, 9375, 28178, 450775, 9780504, 1795265022 }$ is enough. ] === Sieves #env("Method", name: "Sieve of Eratosthenes")[ Given a upper limit $n$, the *sieve of Eratosthenes* solves all the prime numbers up to $n$ by marking composite numbers, where we + create a list of consecutive integers from $2$ to $n$: ${2, 3, 4, dots, n}$; + initially, let $p = 2$, the smallest prime number; + enumerate the multiples of $p$ by counting in increments of $p$ from $2p$ to $n$, and mark them in the list; + find the smallest number in the list greater than $p$ that is not marked; + if there was no such number, the method is terminated and the numbers remaining not marked in the list are all the primes below $n$, otherwise let $p$ now equal the new number which is the next prime, and repeat from step (3). ]
https://github.com/wuespace/vos
https://raw.githubusercontent.com/wuespace/vos/main/vo/vogo.typ
typst
#import "@preview/delegis:0.3.0": * #show: it => delegis( title: "Geschäftsordnung des Vorstands des WüSpace e. V.", abbreviation: "VoGO", resolution: "1. Beschluss des Vorstands vom 18. Juli 2024, 2024/V-43", in-effect: "18.07.2024", logo: image("wuespace.svg"), it ) #outline() = Allgemeiner Teil § 1 Geschäftsordnung (1) Der Vorstand des WüSpace e. V. gibt sich für seine Arbeit die im Folgenden beschriebene Geschäftsordnung. (2) Änderungen dieser Geschäftsordnung können mit einstimmigen Beschluss durch den Vorstand beschlossen werden. § 2 Telegram als Kommunikationsmittel Der Vorstand benutzt Telegram als hauptsächliches Kommunikationsmittel untereinander. = Beschlussfassung § 3 Beschlussfassung im Vorstand #s~Der Vorstand beschließt über ihm übertragene Angelegenheiten mit einfacher Mehrheit der abgegebenen Stimmen. #s~Enthaltungen zählen als nicht-abgegebene Stimmen. § 4 Virtuelle Beschlüsse (1) Beschlüsse können virtuell und asynchron in Textform beschlossen werden. (2) Virtuelle Anträge gelten als beschlossen, wenn drei Vorstandsmitglieder ihre Zustimmung bekundet haben. (3) Virtuelle Beschlüsse sind in der nächsten regulären Vorstandssitzung zu bestätigen und protokollieren. § 5 Beschlüsse über Finanzausgaben (1) Der Vorstand entscheidet satzungsgemäß über Ausgaben bis zu 5000,00 € alleine. (2) Der Finanzvorstand ist ermächtigt, über Augaben bis zu 100,00 € alleine zu entscheiden. (3) #s~Der Finanzvorstand kann in begründeten Einzelfällen, in denen dem Verein oder seinen Mitgliedern anderenfalls rechtliche oder gesundheitliche Risiken drohen, selbstständig Zahlungen bis zu 5000,00 € im Namen des Vereins durchführen. #s~Diese sind in der nächsten Vorstandssitzung durch den Vorstand zu bestätigen. #s~Bestätigt der Vorstand die Zahlung nicht, ist eine außerordentliche Mitgliederversammlung zu berufen, die final darüber entscheidet. #s~Gewährt auch diese die Zahlung nicht als Zahlung des Vereins haftet der Finanzvorstand persönlich. § 6 Protokollierung von Beschlüssen (1) #s~Über Beschlüsse des Vorstands ist ein schriftliches Ergebnisprotokoll zu führen. #s~Genaue Abstimmungsergebnisse müssen nicht protokolliert werden. (2) Das Protokoll muss allen Vereinsmitgliedern zugänglich gemacht werden. (3) Protokolliert wird ausschließlich die Behandlung vereinsöffentlicher Tagesordnungspunkte im Sinne des §~10. (4) #s~Alle Beschlüsse des Vorstands werden zusätzlich in einem zentralen Dokument festgehalten. #s~Dieses Dokument muss mindestens einmal pro Jahr aktualisiert und allen Mitgliedern des Vereins zugänglich gemacht werden. = Vorstandssitzungen § 7 Vorstandssitzungen (1) #s~Der Vorstand trifft sich wöchentlich zu Vorstandssitzungen. #s~Hiervon kann im Einzelfall abgewichen werden. (2) Vorstandssitzungen sind beschlussfähig, wenn mind. zwei Vorstansmitglieder anwesend sind. § 8 Berufung der Vorstandssitzung (1) Zur Vorstandssitzung lädt ein beliebiges Vorstandsmitglied. (2) Eine Berufung auf Grundlage eines regelmäßigen Termins ist ohne weitere formale Ladung zulässig, soweit sich dieser Umstand aus einem Protokoll nach §~6 festgehalten ist. § 9 Sitzungsleitung (1) Die Vorstandssitzung wird durch den Vorstandsvorsitz geleitet. (2) Im Falle der Verhinderung des Vorstandsvorsitzes wird die Sitzungsleitung durch den stellvertretenden Vorstandsvorsitz übernommen. (3) Anderenfalls ist zu Beginn der Sitzung eine Sitzungsleitung zu definieren. (4) Abweichend kann die vorgesehene Sitzungsleitung ein beliebiges anderes, anwesendes Vorstandsmitglied als Sitzungsleitung für einen bestimmten Tagesordnungspunkt oder die vollständige Sitzung ernennen. § 10 Öffentlichkeit von Vorstandssitzungen (1) #s~Vorstandssitzungen sind grundsätzlich für alle Vereinsmitglieder öffentlich. #s~Die Sitzungsleitung hat dafür zu sorgen, dass es Vereinsmitgliedern möglich ist, räumlich an den Sitzungen teilzunehmen. (2) Über einen Geschäftsordnungsantrag kann beantragt werden, dass auch einzelne Nicht-Vereins-Mitglieder der Vorstandssitzung beiwohnen dürfen. (3) Von dieser Vereinsöffentlichkeit kann für einzelne Tagesordnungspunkte abgewichen werden durch + Beschluss der Sitzungsleitung, oder + Antrag von zwei Vorstandsmitgliedern. (4) #s~Die Vereinsöffentlichkeit ist grundsätzlich ausgeschlossen für Tagesordnungspunkte, welche vertrauliche Daten behandeln. #s~Dazu gehören insbesondere: 1. personenbezogene Daten von Mitgliedern, 2. Personalentscheidungen, sowie 3. Themen, deren vereinsöffentliche Behandlung Auswirkungen auf die Sicherheit des Vereins oder seiner Mitglieder haben. #s~Durch einstimmigen Beschluss des Vorstands kann von dieser Regelung abgewichen werden, soweit dadurch nicht der satzungsgemäße Schutz personenbezogener Daten verletzt wird. § 11 Anträge Jedes Vereins- und Vorstandsmitglied hat bei Vorstandssitzungen das Recht, Anträge zu stellen. § 12 Abstimmungen (1) Über Anträge wird im Vorstand offen abgestimmt. (2) Stimmrecht haben alle amtierenden Vorstandsmitglieder des WüSpace e. V. (3) Gibt es keine Gegenrede, zählt ein Antrag ohne weitere Abstimmung als einstimmig angenommen. § 13 Geschäftsordnungsanträge (1) #s~Vorstandsmitglieder können während Vorstandssitzungen Anträge zur Geschäftsordnung stellen. #s~Diese sind durch die Sitzungsleitung unmittelbar zu behandeln. (2) Über Anträge zur Geschäftsordnung entscheidet die Sitzungsleitung. (3) Eine Entscheidung der Sitzungsleitung kann mit einfacher Mehrheit der anwesenden Mitglieder überstimmt werden.
https://github.com/dainbow/MatGos
https://raw.githubusercontent.com/dainbow/MatGos/master/themes/30.typ
typst
#import "../conf.typ": * = Линейные обыкновыенные дифференциальные уравнения с переменными коэффициентами. Фундаментальная система решений. Определитель Вронского. Формула Лиувилля-Остроградского. #definition[ Вектор-функции $bold(y_1)(x), ..., bold(y_k)(x)$, определённые на промежутке $I$, называются *линейно зависимыми*, если #eq[ $exists alpha_1, ..., alpha_k in RR : exists i : alpha_i != 0 : space sum_(j = 1)^k a_j bold(y_j)(x) equiv 0$ ] ] #definition[ Пусть $bold(y_1)(x),...,bold(y_n)(x)$ -- вектор-функции с $n$ компонентами. Тогда *определителем Вронского* для заданных вектор-функций называется функция #eq[ $W(x) := det mat( y_1^1 (x), y_2^1 (x), ..., y_n^1 (x);..., ..., ..., ...;y_1^n (x), y_2^n (x), ..., y_n^n (x) )$ ] ] #lemma[ Если вронскиан системы $bold(y_1)(x),...,bold(y_n)(x)$ отличен от нуля хотя бы в одной точке, то все эти функции линейно независимы. ] #lemma[ Если вектор-функции $bold(y_1)(x),...,bold(y_n)(x)$ -- решения некоторой системы линейных уравнений на промежутке $I$ и $exists x_0 in I : W(x_0) = 0$, то $bold(y_1)(x),...,bold(y_n)(x)$ линейно зависимы на $I$. ] #definition[ *Фундаментальная система решений* для СЛДУ -- набор $n$ линейно независимых решений системы. ] #theorem( "Лиувилля-Остроградского", )[ Пусть $W(x)$ -- вронскиан решений $y_1 (x), ..., y_n (x)$ системы $y' (x) = A(x) y(x)$ на промежутке $I$, $x_0 in I$. Тогда $forall x in I$ имеет место формула Лиувилля-Остроградского: #eq[ $W(x) = W(x_0) exp(integral_(x_0)^x tr A(t) dif t)$ ] ] #proof[ Докажем, что $W(x)$ удовлетворяет дифференциальному уравнению #eq[ $W'(x) = tr A(x) dot W(x)$ ] Пусть $y_(i j)(x), i in overline("1, n")$ -- компоненты решения $y_j (x), j in overline("1, n")$. Тогда $W(x)$ является функцией от всех этих компонент: #eq[ $W(x) = W[y_(1 1)(x), y_(2 1)(x), ..., y_(n n)(x)]$ ] По формуле производной сложной функции получаем, что #eq[ $W'(x) = sum_(p, q = 1)^n (partial W) / (partial y_(p q))(x) y'_(p q)(x)$ ] Пусть $W_(p r)(x)$ -- алгебраическое дополнение $y_(p r)(x)$ в $W(x)$. Тогда разложение $W(x)$ по $p$-й строке даёт #eq[ $W(x) = sum_(r = 1)^n y_(p r)(x) W_(p r)(x)$ ] Отсюда получим, что #eq[ $(partial W) / (partial y_(p q))(x) = W_(p q)(x)$ ] А так как каждая вектор-функция удовлетворяет системе $y'(x) = A(x)y(x)$, то есть #eq[ $y'_q (x) = A(x) y_q (x) ; quad q in overline("1, n")$ ] Отсюда по определению матричного умножения: #eq[ $y'_(p q) = sum_(r = 1)^n a_(p r) (x) y_(r q) (x)$ ] Подставляя найденные выражения в формулу $W' (x)$ получим, что #eq[ $W'(x) = sum_(p, q = 1)^n W_(p q) (x) sum_(r = 1)^n a_(p r) (x) y_(r q) (x) = sum_(p, r = 1)^n a_(p r) (x) sum_(q = 1)^n y_(r q) W_(p q) (x)$ ] Но по кососимметричности определителя мы знаем, что #eq[ $sum_(q = 1)^n y_(r q) W_(p q) (x) = delta_(p r) W(x)$ ] А значит #eq[ $W'(x) = W(x) sum_(p, r = 1)^n a_(p r) sigma_(p r) = W(x) sum_(i = 1)^n a_(p p) (x) = W(x) dot tr A(x)$ ] Интегрирование этого линейного однородного первого порядка даёт искомую формулу. ]
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/call-03.typ
typst
Other
// Error: 2-6 expected function, found boolean #true()
https://github.com/liuguangxi/erdos
https://raw.githubusercontent.com/liuguangxi/erdos/master/Problems/typstdoc/figures/p217.typ
typst
#import "@preview/cetz:0.2.1" #cetz.canvas({ import cetz.draw: * let a = 2.5 set-style(stroke: 3pt) line((0, -a), (a*calc.cos(210deg), a*calc.sin(210deg)), (a*calc.cos(150deg), a*calc.sin(150deg)), (0, a), (a*calc.cos(30deg), a*calc.sin(30deg)), (a*calc.cos(-30deg), a*calc.sin(-30deg))) content((-1.4,-2.2), [*1*]) content((-2.6,0), [*2*]) content((-1.4,2.2), [*3*]) content((1.4,2.2), [*4*]) content((2.6,0), [*5*]) })
https://github.com/neNasko1/typst-template
https://raw.githubusercontent.com/neNasko1/typst-template/main/template.typ
typst
#let conf( title: none, authors: (), doc, ) = { set page( paper: "a4", margin: 0.5in, // header: align( // right + horizon, // title // ), ) set heading(numbering: "1.") set text(font: "New Computer Modern") show raw: set text(font: "New Computer Modern Mono") set par(justify: true) set align(center) text(17pt, title) let count = authors.len() let ncols = calc.min(count, 3) grid( columns: (1fr,) * ncols, row-gutter: 24pt, ..authors.map(author => [ #author.name \ #author.affiliation ]), ) v(1em) set align(left) columns(1, doc) } #let rewreq(..lines) = { let reasoning_expr(cont) = { if cont == "" [ $ \ $ ] else [ $ && quad (#cont) \ $ ] } $ #if lines.pos().len() != 0 [$ #lines.pos().at(0) $] #if calc.rem(lines.pos().len(), 2) == 0 [$ &= #reasoning_expr(lines.pos().at(1)) $] #for i in range( 2-calc.rem(lines.pos().len(), 2), lines.pos().len()-1, step: 2 ) { $ &= #lines.pos().at(i) #reasoning_expr(lines.pos().at(i+1)) $ } $ } #let mono_font = "DejaVu Sans Mono" #let source_code( src, lang: none, detab: true, title: none ) = { let raw_text = read(src) if lang == none { lang = src.split(".").last() } if detab { raw_text = raw_text.replace("\t", " ") } let element = { text( raw( raw_text, lang: lang, ) ) } block( breakable: false, { title block( fill: luma(240), inset: 8pt, radius: 5pt, element ) } ) } #let Jac(fs) = { $ upright(bold(J))(fs) $ } #let Hess(fs) = { $ upright(bold(H))(fs) $ } #let keyword(kwrd) = { $upright(bold(#kwrd))$ } #let NOTE(txt, col: red) = block(text(col, "[NOTE: " + txt + "]")) #let TODO = block(text(red, "TODO"))
https://github.com/GYPpro/DS-Course-Report
https://raw.githubusercontent.com/GYPpro/DS-Course-Report/main/Rep/17.typ
typst
#import "@preview/tablex:0.0.6": tablex, hlinex, vlinex, colspanx, rowspanx #import "@preview/codelst:2.0.1": sourcecode // Display inline code in a small box // that retains the correct baseline. #set text(font:("Times New Roman","Source Han Serif SC")) #show raw: set text( font: ("consolas", "Source Han Serif SC") ) #show raw.where(block: false): box.with( fill: luma(230), inset: (x: 3pt, y: 0pt), outset: (y: 3pt), radius: 2pt, ) #set page( paper: "a4", ) #set text( font:("Times New Roman","Source Han Serif SC"), style:"normal", weight: "regular", size: 13pt, ) #let nxtIdx(name) = box[ #counter(name).step()#counter(name).display()] #set math.equation(numbering: "(1)") #show raw.where(block: true): block.with( fill: luma(240), inset: 10pt, radius: 4pt, ) #set math.equation(numbering: "(1)") #set page( paper:"a4", number-align: right, margin: (x:2.54cm,y:4cm), header: [ #set text( size: 25pt, font: "KaiTi", ) #align( bottom + center, [ #strong[暨南大学本科实验报告专用纸(附页)] ] ) #line(start: (0pt,-5pt),end:(453pt,-5pt)) ] ) /*----*/ = 算数表达式求值(栈) \ #text( font:"KaiTi", size: 15pt )[ 课程名称#underline[#text(" 数据结构 ")]成绩评定#underline[#text(" ")]\ 实验项目名称#underline[#text(" ") 算数表达式求值(栈) #text(" ")]指导老师#underline[#text(" 干晓聪 ")]\ 实验项目编号#underline[#text(" 17 ")]实验项目类型#underline[#text(" 设计性 ")]实验地点#underline[#text(" 数学系机房 ")]\ 学生姓名#underline[#text(" 郭彦培 ")]学号#underline[#text(" 2022101149 ")]\ 学院#underline[#text(" 信息科学技术学院 ")]系#underline[#text(" 数学系 ")]专业#underline[#text(" 信息管理与信息系统 ")]\ 实验时间#underline[#text(" 2024年6月13日上午 ")]#text("~")#underline[#text(" 2024年7月13日中午 ")]\ ] #set heading( numbering: "1.1." ) = 实验目的 基于逆波兰式求算术表达式值 = 实验环境 计算机:PC X64 操作系统:Windows + Ubuntu20.0LTS 编程语言:C++:GCC std20 IDE:Visual Studio Code = 程序原理 逆波兰式指的是不包含括号,运算符放在两个运算对象的后面,所有的计算按运算符出现的顺序,严格从左向右进行的运算式。 将前缀表达式转换为逆波兰式,使用两个栈,按以下流程: + 数字:入临时栈 + 左括号:入符号栈 + 右括号:重复弹出符号栈内容插入临时栈,直到遇到左括号 + 其他运算符:重复弹出栈内符号直到栈顶运算符优先级不低于自身,入符号栈 #pagebreak() = 程序代码 == `linnerCaculate.cpp` #sourcecode[```cpp #include <iostream> #include <vector> #include <stdlib.h> #include <map> #include <algorithm> #include <stack> #include <math.h> using namespace std; using pii = pair<int,int>; #define int long long #define pb push_back #define F first #define S second #define all(x) x.begin(),x.end() #define loop(i,n) for(int i = 0; i < n; i++) const int mod = 1e9 + 7; const int INF = 1e18; bool ifdigit(string &s){ if(s.size() >= 2) return 1; else return (s[0] > '0' && s[0] < '9'); } int str2int(string &s) { int t = 0; for(int i = 0;i < s.size();i ++) { t += pow(10LL,i) * (s[s.size()-1-i] - '0'); } return t; } int getPri(string s){ if(s[0] == '+' || s[0] == '-') return 0; else return 1; } // void solve() { string s; cout << ">>>>"; getline(cin,s); // cin.get(); s.push_back('\n'); vector<string> RES; stack<string> sign,tmpl,rbc; string tmp; for(auto x:s) { if(x == ' ' || x == '\n'){ if(tmp.size()) RES.push_back(tmp); tmp.clear(); } else tmp.push_back(x); } for(auto x:RES){ if(ifdigit(x)) tmpl.push(x); else{ if(x[0] == '(') sign.push(x); else if(x[0] == ')') { while(sign.top()[0] != '(' && sign.size()){ tmpl.push(sign.top()); sign.pop(); } sign.pop(); } else { while(1) { if (sign.size() == 0 || sign.top()[0] == '('){ sign.push(x);break;} else { if(getPri(x) > getPri(sign.top())){ sign.push(x);break;} else {tmpl.push(sign.top());sign.pop();} } } } } } while(sign.size()) { tmpl.push(sign.top()); sign.pop(); } vector<string> gt; while(tmpl.size()){ gt.push_back(tmpl.top()); tmpl.pop(); } vector<string> cacu; for(int i = 0;i < gt.size();i ++)cacu.push_back(gt[gt.size()-1-i]); stack<int> nums; for(auto x:cacu) { if(ifdigit(x)) nums.push(str2int(x)); else { int a = nums.top(); nums.pop(); int b = nums.top(); nums.pop(); char c = x[0]; switch (c) { case '+': nums.push(a+b); break; case '-': nums.push(a-b); break; case '*': nums.push(a*b); break; case 'x': nums.push(a*b); break; case '/': nums.push(a/b); break; default: break; } } } cout << nums.top() << "\n"; } signed main() { // std::ios::sync_with_stdio(false); // std::cin.tie(nullptr); // std::cout.tie(nullptr); // int T = 1; // cin >> T; while(1) solve(); return 0; } ```] = 测试数据与运行结果 运行上述`_PRIV_TEST.cpp`测试代码中的正确性测试模块,得到以下内容: ``` >>>>1 + 1 2 >>>>2 * 3 + 1 7 >>>>2 * ( 3 + 1 ) 8 >>>>115 * 514 59110 >>>>( 1 + 1 ) / 2 * 2 + 2 4 >>>>( 1 + 1 ) / 2 * ( 2 + 2 + 2 ) 4 >>>>( 1 + 1 ) / 2 * ( 2 + 2 + 2 ) 6 ``` 可以看出,代码运行结果与预期相符,可以认为代码正确性无误。
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-103A0.typ
typst
Apache License 2.0
#let data = ( ("OLD PERSIAN SIGN A", "Lo", 0), ("OLD PERSIAN SIGN I", "Lo", 0), ("OLD PERSIAN SIGN U", "Lo", 0), ("OLD PERSIAN SIGN KA", "Lo", 0), ("OLD PERSIAN SIGN KU", "Lo", 0), ("OLD PERSIAN SIGN GA", "Lo", 0), ("OLD PERSIAN SIGN GU", "Lo", 0), ("OLD PERSIAN SIGN XA", "Lo", 0), ("OLD PERSIAN SIGN CA", "Lo", 0), ("OLD PERSIAN SIGN JA", "Lo", 0), ("OLD PERSIAN SIGN JI", "Lo", 0), ("OLD PERSIAN SIGN TA", "Lo", 0), ("OLD PERSIAN SIGN TU", "Lo", 0), ("OLD PERSIAN SIGN DA", "Lo", 0), ("OLD PERSIAN SIGN DI", "Lo", 0), ("OLD PERSIAN SIGN DU", "Lo", 0), ("OLD PERSIAN SIGN THA", "Lo", 0), ("OLD PERSIAN SIGN PA", "Lo", 0), ("OLD PERSIAN SIGN BA", "Lo", 0), ("OLD PERSIAN SIGN FA", "Lo", 0), ("OLD PERSIAN SIGN NA", "Lo", 0), ("OLD PERSIAN SIGN NU", "Lo", 0), ("OLD PERSIAN SIGN MA", "Lo", 0), ("OLD PERSIAN SIGN MI", "Lo", 0), ("OLD PERSIAN SIGN MU", "Lo", 0), ("OLD PERSIAN SIGN YA", "Lo", 0), ("OLD PERSIAN SIGN VA", "Lo", 0), ("OLD PERSIAN SIGN VI", "Lo", 0), ("OLD PERSIAN SIGN RA", "Lo", 0), ("OLD PERSIAN SIGN RU", "Lo", 0), ("OLD PERSIAN SIGN LA", "Lo", 0), ("OLD PERSIAN SIGN SA", "Lo", 0), ("OLD PERSIAN SIGN ZA", "Lo", 0), ("OLD PERSIAN SIGN SHA", "Lo", 0), ("OLD PERSIAN SIGN SSA", "Lo", 0), ("OLD PERSIAN SIGN HA", "Lo", 0), (), (), (), (), ("OLD PERSIAN SIGN AURAMAZDAA", "Lo", 0), ("OLD PERSIAN SIGN AURAMAZDAA-2", "Lo", 0), ("OLD PERSIAN SIGN AURAMAZDAAHA", "Lo", 0), ("OLD PERSIAN SIGN XSHAAYATHIYA", "Lo", 0), ("OLD PERSIAN SIGN DAHYAAUSH", "Lo", 0), ("OLD PERSIAN SIGN DAHYAAUSH-2", "Lo", 0), ("OLD PERSIAN SIGN BAGA", "Lo", 0), ("OLD PERSIAN SIGN BUUMISH", "Lo", 0), ("OLD PERSIAN WORD DIVIDER", "Po", 0), ("OLD PERSIAN NUMBER ONE", "Nl", 0), ("OLD PERSIAN NUMBER TWO", "Nl", 0), ("OLD PERSIAN NUMBER TEN", "Nl", 0), ("OLD PERSIAN NUMBER TWENTY", "Nl", 0), ("OLD PERSIAN NUMBER HUNDRED", "Nl", 0), )
https://github.com/Mc-Zen/pillar
https://raw.githubusercontent.com/Mc-Zen/pillar/main/src/pillar.typ
typst
MIT License
#import "impl.typ": cols, table
https://github.com/awsomearvinder/scheduler-paper
https://raw.githubusercontent.com/awsomearvinder/scheduler-paper/master/paper.typ
typst
#set page("us-letter", numbering: "1 of 1") #align(center)[ = Scheduler Report <NAME> | <NAME> ] #pagebreak() #set block(spacing: 1.5em) #set text( font: "New Computer Modern", size: 1em ) #set par( justify: true, leading: 1em, first-line-indent: 2em ) #show heading: it => { it par()[#text(size:0.5em)[#h(0.0em)]] } = Introduction Schedulers are an important part of computer science, focusing on balancing and juggling tasks, deciding which task deserves how much time. Implementing these schedulers was an educational experience, both from a programmer's perspective as well as from a theoretical point of view. This was a good chance to both familiarize one of us with a new programming language (Steven), while still limiting how many dependencies / environment we had to interact with. Watching these schedulers work also lead to us understanding more the emergent behavior these algorithms have, and a better foundational logic on the tradeoffs these algorithms make. = Contributions Before talking about specifically what characteristics our implementations of our schedulers had, it's worth noting what each of us did. The majority of the schedulers were written by Steven, while Arvinder wrote most of the driver, and GUI / logging logic. With that said, there are some design decisions we made early on that likely weren't ideal in the long term. = Implementation Our implementation was done in rust. We specifically chose rust since it would be a good programming language to choose for real operating system schedulers. It gives explicit control over memory much like C/C++, while still benefiting from higher level APIs and safer programming ideas that have come out since the advent of these languages. Specifically, the memory safe aspect of rust allowed us to debug far easier - since it meant we never ran into any kind of segfault or undefined behavior. We did run into issues with the "borrow checker", or the model rust uses to check the correct usage of memory (e.g. absence of use after frees, double frees, out of bounds memory access, etc.), but these issues were relatively easy to resolve. The core implementation detail of our model was the `Scheduler` trait. Our schedulers all shared this singular interface. Our `Scheduler` trait worked for both our Ready and I/O queue, and as a result allowed the *implementation* to not care about which kind of Scheduler it was. We could trivially add other kinds of Schedulers as well, and the implementations would have to largely be unchanged to accomodate that. Despite that, we did run into issues with duplicating logic outside of the implementation, specifically in our logger - but we don't believe the Scheduler trait to be entirely at fault here. A scheduler, atleast according to us, is a type that implements two functions, as well as a function that helps us understand the internal state of the Scheduler: #pagebreak() ```rs pub trait Scheduler { fn tick(&mut self, system_state: &SystemState) -> SchedulerResult; fn enqueue(&mut self, proc: Process); // this is here so we can see the internal state. fn get_queue(&self) -> Vec<&Process>; } ``` A `tick()` represents a single unit time passing \- *not* a quantum time. Each time tick() is called, the Scheduler makes some progress on an underlying process (or rather, the `PCB`, which we just call `Process` here), and returns information about what it did. Specifically, it can say the following: ```rs pub enum SchedulerResult { Finished(Process), // remaining burst Processing(Process), Idle, WrongKind, NoBurstLeft, } ``` `Finished(Process)` represents having finished working on a burst on a Process, and giving it back to the caller of `tick()` to choose what to do with the `Process` next. `Processing(Process)` informs the caller that it did some work on the given Process, and will continue to do so the next time it calls `tick()`. `Idle` simply means that for some reason the Scheduler didn't do any work that run, while `NoBurstLeft` means that the Scheduler queue is empty. `WrongKind` is a programmer error, and it means that the Scheduler was given a process with the wrong kind of Burst. E.G. a `Process` needs `IO` bursts next, but was given to a `CPU` scheduler. For a scheduler that cares about Quantum Time, the Quantum Time must be stored internally, as well as how long inside this quantum time has passed as well. This isn't exposed to the caller. A practical and simple implementation is the FCFS scheduler, which simply takes the front process in it's queue, does work on the burst if it's of the right type, and then returns whether it finished or not. For the sake of keeping all the code on one page, this code is shown on the next page. #pagebreak() ```rust match process.burst.front_mut() { Some(Burst(kind, burst_amt)) if self.kind == *kind => { // if the burst kind matches, (both the scheduler and the // process are of the same type), remove 1 from the burst. // Then, either get rid of the burst and return Finished(proc) // or return Processing(proc) depending on whether the burst // is over. *burst_amt -= 1; if *burst_amt == 0 { let mut proc = self.processes.pop_front().unwrap(); proc.burst.pop_front().unwrap(); SchedulerResult::Finished(proc) } else { SchedulerResult::Processing(self.processes[0].clone()) } }, // in this case this is burst is meant for a different kind of // scheduler. Something went wrong. Some(Burst(_, _)) => SchedulerResult::WrongKind, // and we're out of bursts to process on this process! // something went wrong. None => SchedulerResult::NoBurstLeft, }``` The job of the Driver then is to take a scheduler, a list of processes, and if any processes have arrived (that is the current system time $>=$ arrival time for any given process), you schedule it on the according scheduler that it requires. You then call `tick()` on all schedulers after. When a `tick()` returns `Finished(Process)`, you check what burst it needs next, and queue it to go on that scheduler at the end of the tick as well. This design worked relatively well. It was intuitive to think about, and in practice just about everything a `Scheduler` would care about functioned in terms of our `tick`s well. The caller didn't really have to worry about how the Scheduler worked, and the abstraction was relatively clean. A harder aspect to juggle, was actually getting statistics of our Scheduler. While our Schedulers themselves didn't care about what kind of item they were scheduling, this aspect of our code *definetly* did. What we did in order to gather statistics about our code, was take the status of the entire system state (that is, the finished processes, processes left to schedule, the queues of the schedulers, and what they did), and added them to a list of log entries. Our GUI, and logging implementation, then worked backwards to figure out what events were occuring. They looked at the state of the system at the previous `tick`, and the state of the current `tick`, and worked backwards to figure out what must of occured on the current tick. For instance, if previously no process was scheduled by the system, and one arrived this tick, a new process must have arrived. A benefit of this approach was that because it stored the state of the *entire* system in the logs, it was trivial to make the GUI be able to work forwards or backwards in time, since that just meant passing a different subset of logs. Our `draw_frame` took a list of log entries, and drew what it wanted to show on screen based off of that historical context. getting the nth frame is just `Self::draw_frame(&mut self.term, &log_entries[0..n])` We then let the user manipulate `n` with keyboard input and that allowed both forwards and backwards time travel. = Exploring the Simulations #image("round-robin-equal.svg") The above is a round robin run with all processes using a CPU burst of 4, followed by an IO burst of 4, and then a CPU burst of 4. As we can see, an interesting thing to note with round robin seems to be that it works to complete all CPU work that arrived at the same time all at once, given that they're similar work loads. This results in starving I/O until it gets flooded all at once, and the round robin CPU scheduler is left with no work to do until the I/O finishes on a process. Over time, this should even out (and although not graphed above, we have tested it and seen that it does happen), but the wait time / throughput of round robin isn't ideal. It *does* happen to be particularly good at guaranteeing your process will get CPU time eventually, unlike what we expect of SJF. This means that if your process count is bounded, it can guarantee you get a certain amount of cpu time after a certain amount of quantum ticks, which is ideal for real time systems. Although SJF isn't implemented, we'd expect it to have the opposite tradeoff, where it would constantly try it's best to keep both CPU / IO fed, at the drawback of not guaranteeing any longer CPU time processes any (or atleast, less) cpu time. Our guess is round robin would struggle with processes with similar large CPU bursts and IO bursts, since it would starve itself when all processes get put on the IO queue at around the same time. #image("fcfs-equal.svg") The above is FCFS under the same conditions. In this case we can see that it performs exceptionally well where everything has equal bursts, since it keeps everything fed. This results in it performing slightly better then round robin in terms of cpu utilization, where round-robin performed at a 97%, FCFS got 100%. Priority isn't included since in this case it performs exactly the same as FCFS (since all the processes have the same priority). It's worth noting as far as the priority goes - We'd expect that generally high priority processes wouldn't take much CPU / IO time. Things like OS services which want to run *regularly*, but not nessecarily a lot of load in of themselves. Assuming this holds true, we can see a huge benefit to using priority in terms of it's low wait times for these high priority tasks, and in this case larger tasks for your actual workload aren't terribly adversely affected. We tested this on 4 processes, 3 being high priority and 1 being low. The high priority processes had 2 cpu bursts of 2 unit time, and 2 IO bursts of 2 unit time. The low priority process had a far higher 8 cpu and 8 IO. The result was a wait of 11 on the low priority process and turn around of 43. The lowest a high priority process did was a turn around of 13 and a wait of 5. We didn't graph the execution due to how large the graph would be, but overall we thought this matched our expectations for how it would play out - low priority processes that wanted a large chunk of resources did relatively fine. Oddly enough, when doing the same test with Round Robin, we get the same scores for wait and turnaround for the processes overall. We speculate the reason why round robin does as well as priority in this case is because the high priority processes kept both CPU and I/O saturated in both round robin and priority regardless. When they finished, the low priority process was the only one left \- and because it was the last, it's wait was the sum of half of all the high priority process's bursts. Because both CPU and I/O were saturated in either case, the only thing that mattered would be whichever process finished last must have the greater of the sum of the bursts of the CPU \/ IO processes infront of it. = Conclusions Implementing this scheduler was an intersting problem, and we learned a lot from it. We did have some design choices we regretted (this is the second itteration of our logger, but we still aren't quite happy with it), but overall we considered it largely a success. Our project implemented everything we wanted too, and although we didn't implement threads or multicore support - we did mostly succeed in every aspect the assignment we wanted too in. Seeing how different (and maybe more importantly how similar), these schedulers were from one another in terms of behavior was useful.
https://github.com/Coekjan/parallel-programming-learning
https://raw.githubusercontent.com/Coekjan/parallel-programming-learning/master/template.typ
typst
#let project(title: "", authors: (), body) = { // Set the document's basic properties. set document(author: authors.map(a => a.name), title: title) set text(lang: "zh", font: ("linux libertine", "SimSun")) set heading(numbering: "1.1.1") set par(leading: 0.55em, first-line-indent: 1.8em, justify: true) set page(numbering: "1", number-align: center, margin: 1.2in) set math.equation(numbering: "(1)") show strong: text.with(font: ("linux libertine", "SimHei")) show emph: text.with(font: ("linux libertine", "STKaiti")) show par: set block(spacing: 0.55em) show heading: it => context [ #if it.level == 1 and counter(page).get().at(0) != 1 { pagebreak(weak: true) } #strong(it) #if it.outlined { par[#text(size:0.0em)[#h(0.0em)]] } ] show heading: set block(above: 1.4em, below: 1em) show figure: set block(breakable: true) // Title row. align(center)[ #block(text(weight: 700, 1.75em, title)) ] // Author information. pad( top: 0.5em, bottom: 0.5em, x: 2em, grid( columns: (1fr,) * calc.min(3, authors.len()), gutter: 1em, ..authors.map(author => align(center)[ *#author.name* \ #author.email \ #author.affiliation ]), ), ) body }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-2D30.typ
typst
Apache License 2.0
#let data = ( ("TIFINAGH LETTER YA", "Lo", 0), ("TIFINAGH LETTER YAB", "Lo", 0), ("TIFINAGH LETTER YABH", "Lo", 0), ("TIFINAGH LETTER YAG", "Lo", 0), ("TIFINAGH LETTER YAGHH", "Lo", 0), ("TIFINAGH LETTER BERBER ACADEMY YAJ", "Lo", 0), ("TIFINAGH LETTER YAJ", "Lo", 0), ("TIFINAGH LETTER YAD", "Lo", 0), ("TIFINAGH LETTER YADH", "Lo", 0), ("TIFINAGH LETTER YADD", "Lo", 0), ("TIFINAGH LETTER YADDH", "Lo", 0), ("TIFINAGH LETTER YEY", "Lo", 0), ("TIFINAGH LETTER YAF", "Lo", 0), ("TIFINAGH LETTER YAK", "Lo", 0), ("TIFINAGH LETTER TUAREG YAK", "Lo", 0), ("TIFINAGH LETTER YAKHH", "Lo", 0), ("TIFINAGH LETTER YAH", "Lo", 0), ("TIFINAGH LETTER BERBER ACADEMY YAH", "Lo", 0), ("TIFINAGH LETTER TUAREG YAH", "Lo", 0), ("TIFINAGH LETTER YAHH", "Lo", 0), ("TIFINAGH LETTER YAA", "Lo", 0), ("TIFINAGH LETTER YAKH", "Lo", 0), ("TIFINAGH LETTER TUAREG YAKH", "Lo", 0), ("TIFINAGH LETTER YAQ", "Lo", 0), ("TIFINAGH LETTER TUAREG YAQ", "Lo", 0), ("TIFINAGH LETTER YI", "Lo", 0), ("TIFINAGH LETTER YAZH", "Lo", 0), ("TIFINAGH LETTER AHAGGAR YAZH", "Lo", 0), ("TIFINAGH LETTER TUAREG YAZH", "Lo", 0), ("TIFINAGH LETTER YAL", "Lo", 0), ("TIFINAGH LETTER YAM", "Lo", 0), ("TIFINAGH LETTER YAN", "Lo", 0), ("TIFINAGH LETTER TUAREG YAGN", "Lo", 0), ("TIFINAGH LETTER TUAREG YANG", "Lo", 0), ("TIFINAGH LETTER YAP", "Lo", 0), ("TIFINAGH LETTER YU", "Lo", 0), ("TIFINAGH LETTER YAR", "Lo", 0), ("TIFINAGH LETTER YARR", "Lo", 0), ("TIFINAGH LETTER YAGH", "Lo", 0), ("TIFINAGH LETTER TUAREG YAGH", "Lo", 0), ("TIFINAGH LETTER AYER YAGH", "Lo", 0), ("TIFINAGH LETTER YAS", "Lo", 0), ("TIFINAGH LETTER YASS", "Lo", 0), ("TIFINAGH LETTER YASH", "Lo", 0), ("TIFINAGH LETTER YAT", "Lo", 0), ("TIFINAGH LETTER YATH", "Lo", 0), ("TIFINAGH LETTER YACH", "Lo", 0), ("TIFINAGH LETTER YATT", "Lo", 0), ("TIFINAGH LETTER YAV", "Lo", 0), ("TIFINAGH LETTER YAW", "Lo", 0), ("TIFINAGH LETTER YAY", "Lo", 0), ("TIFINAGH LETTER YAZ", "Lo", 0), ("TIFINAGH LETTER TAWELLEMET YAZ", "Lo", 0), ("TIFINAGH LETTER YAZZ", "Lo", 0), ("TIFINAGH LETTER YE", "Lo", 0), ("TIFINAGH LETTER YO", "Lo", 0), (), (), (), (), (), (), (), ("TIFINAGH MODIFIER LETTER LABIALIZATION MARK", "Lm", 0), ("TIFINAGH SEPARATOR MARK", "Po", 0), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ("TIFINAGH CONSONANT JOINER", "Mn", 9), )
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/docs/proposals/7-inplacement-plugin-for-mathjax-users.md
markdown
Apache License 2.0
### In-place Replacement Plugin for MathJax Users Example code: ```html <head> <script type="module"> import { TypstJax } from '@myriaddreamin/typst-math'; TypstJax.Config = { tex: { inlineMath: [ ['$', '$'], ['\\(', '\\)'], ], }, svg: { fontCache: 'global', }, }; </script> </head> <body> $$mono(Y) = lambda f. (lambda x. f (x space x)) (lambda x . f (x space x))$$ </body> ```
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Documentazione%20interna/Verbali/24-01-17/24-01-17.typ
typst
#import "/template.typ": * #show: project.with( date: "17/01/24", subTitle: "Meeting di pianificazione RTB", docType: "verbale", authors: ( "<NAME>", ), timeStart: "10:00", timeEnd: "11:00", ); = Ordine del giorno - Valutazione progresso generale; - Verifica avanzamenti per colloquio RTB; - Candidatura RTB. == Valutazione progresso generale Ogni membro del gruppo ha esposto lo stato di avanzamento delle proprie attività assegnate. === Analisi dei Requisiti Il documento è completo e revisionato, sono state apportate le ultime modifiche ed ora è pronto per la presentazione RTB. === Comunicazioni con il Proponente Il gruppo ha inviato una mail al Proponente corredata di video dimostrativo sul funzionamento del PoC. Il gruppo resta in attesa di risposta da parte dello stesso. == Verifica avanzamenti per colloquio RTB === Presentazione PowerPoint La presentazione prodotta è stata revisionata da tutti i membri del gruppo. I contenuti sono stati accettati con solo alcune modifiche minori da segnalare, mentre il tema della stessa risulta ancora "acerbo" e pertanto va migliorato. === Disponibilità per colloquio RTB Vista l'imminente sessione d'esami il gruppo ha unanimamente concordato delle date in cui il colloquio RTB non può essere svolto causa impegni universitari inderogabili. Le date sono: - La mattina del 22/01/24; - Tutta la giornata del 24/01/24; - La mattina del 26/01/24. === Lettera di presentazione La lettera di presentazione non risulta ancora redatta. == Candidatura RTB Il gruppo si ritiene pronto per effettuare la candidatura al colloquio RTB entro i termini precedentemente stabiliti, cioè entro il 19/01/24. Essa verrà inviata non appena terminata la lettera di presentazione richiesta e dopo aver migliorato il tema della presentazione Powerpoint. == To Do - Redigere lettera di presentazione; - Revisione Norme di Progetto; - Ampliazione Glossario.
https://github.com/neunenak/typst-leipzig-glossing
https://raw.githubusercontent.com/neunenak/typst-leipzig-glossing/master/CHANGELOG.md
markdown
MIT License
# Changelog ## 0.3.0 * Added `label` and `label-supplement` arguments to `gloss` function * Added borders around code + rendered example in documentation pdf ## 0.2.0 * renamed `numbered_gloss` to `numbered-gloss`, `gloss_count` to `gloss-count`, in light of the Typst style preference for kebab-case. Also renamed their arguments to use snake-case as well. * Documented standard abbreviations * Removed all default gloss line formatting
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/table-row-missing_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(height: 70pt) #table( rows: 16pt, ..range(6).map(str).flatten(), )
https://github.com/StandingPadAnimations/papers
https://raw.githubusercontent.com/StandingPadAnimations/papers/main/quadratic-complex-factoring/main.typ
typst
Given a quadratic in the form $ "a"x^2 + "b"x + c $ where $a=1$ and no real solutions exist, the factored form of the quadratic is: $ (x + b/2 + sqrt(c - (b/2)^2)i) (x + b/2 - sqrt(c - (b/2)^2)i) $ When multiplied out through the distributive property, the following table is produced: #align(center, [ #table( columns: (auto, auto, auto, auto), inset: 10pt, align: horizon, [], $x$, $b/2$, $-sqrt(c - (b/2)^2)i$, $x$, $x^2$, $(b/2)x$, $-"x"sqrt(c - (b/2)^2)i$, $b/2$, $(b/2)x$, $(b/2)^2$, $-(b/2)sqrt(c - (b/2)^2)i$, $sqrt(c - (b/2)^2)i$, $"x"sqrt(c - (b/2)^2)i$, $(b/2)sqrt(c - (b/2)^2)i$, $-(c - (b/2)^2)i^2$, ) ]) The leftover imaginary terms cancel out: #align(center, [ #table( columns: (auto, auto, auto, auto), inset: 10pt, align: horizon, [], $x$, $b/2$, $-sqrt(c - (b/2)^2)i$, $x$, $x^2$, $(b/2)x$, $cancel(-"x"sqrt(c - (b/2)^2)i)$, $b/2$, $(b/2)x$, $(b/2)^2$, $cancel(-(b/2)sqrt(c - (b/2)^2)i)$, $sqrt(c - (b/2)^2)i$, $cancel("x"sqrt(c - (b/2)^2)i)$, $cancel((b/2)sqrt(c - (b/2)^2)i)$, $-(c - (b/2)^2)i^2$, ) ]) Leaving the following: $ x^2 + 2(b/2)x + (b/2)^2 - (c - (b/2)^2)i^2 $ $-(c - (b/2)^2)i^2$ simplifies to $(-1)(-1)(c - (b/2)^2)$, or $c - (b/2)^2$, which gets us the following: $ x^2 + cancel(2)(b/cancel(2))x + cancel((b/2)^2) + c - cancel((b/2)^2) $ or: $ x^2 + "b"x + c $
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/group_dynamics/lectures/2024-09-03.typ
typst
#import "/utils/math.typ": * = Команда Команда: - имеет общую цель - *TODO* Команда эффективнее одиночки #def[ #defitem[Эффект Синергии] --- совместная эффективность людей, работающих вместе, выше, чем сумма эффективностей отдельных людей ] Реймонд <NAME> придумал теория создания эффективных комманд #figure( table( columns: (3cm, 1fr, 1fr), table.header([*Роль*], [*Характеристика*], [*Недостаток*]), // Роли на действие [*Мотиваторы*], [помогают задействовать все возможные ресурсы для достижения цели], [любят спорить и навязывать свое мнение], [*Исполнитель*], ["рабочие челки", делают работу и выполняют задачу], [консервативны], [*Педант*], [выполняют работу с большой тщательностью], [могут необоснованно проявлять беспокойство], // Социальные роли [*Координаторы*], [Выполняют роль руководителя], [Могут возложить на подчиненного слишком много ответственности, склонны манипулировать людьми], [*Душа команды*], [Сглаживают конфликты в команде], [Бывают нерешительны], [*Исследователи ресурсов*], [Крайне нестандартны и любопытны. Расследуют возможные альтернативы.], [Могут быстро потерять энтузиазм. Часто чрезмерно оптимистичны.], [*Генератор идей*], [Творческие люди. Придумывают новые идеи и подходы], [Часто сложно с ними взаимодействовать. Часто высокомерны. Могут пренебрегать ограничениями и требованиями], [*Аналитики-стратеги*], [Анализируют и оценивают идеи. Взвешивают все "за" и "против"], [Воспринимаются членами команды как не эмоциональные и отстраненные. Иногда черствые и чрезмерно критичные.], [*Специалисты*], [Разбираются в узкой специальности. Часто отсутствует в команде.], [Вклад ограничен из-за узкой специализации. Часто высокомерны.], ), caption: [9 командных ролей], ) Принципы формирования эффективной команды: - В команде должны быть заняты все роли (кроме, возможно специалистов). Роли могут совпадать: у каждого человека есть главная роль и поддерживающая. - Мотиватор и координатор должен быть у одного человека. Если они у разных людей, то одна роль должна быть главной, а другая --- поддерживающей. - Тестирование должно быть честным. - Сильные и поддерживающие роли не должны пересекаться. Роли по тесту Хони-Мамфорда: - Деятель - Мыслитель - Теоретик - Прагматик Роли по тесту Майерс-Бриггс: - Экстраверт -- Интровертный - Сенсорный -- Интуитивный - Логический (Мыслящий) -- Этический (Чувствующий) - Рациональный (Решающий) -- Иррациональный (Воспринимающий)
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/syntaxes/textmate/tests/unit/basic/raw_nest.typ
typst
Apache License 2.0
````typ ```typ abc ``` ```` `````typ ````md ```typ abc ``` ```` `````
https://github.com/fenjalien/mdbook-typst-doc
https://raw.githubusercontent.com/fenjalien/mdbook-typst-doc/main/readme.md
markdown
Apache License 2.0
# mdbook Typst Doc Preprocessor A preprocess for mdbook's html renderer to aid in writing Typst documentation. This is currently still a work in progress. ## Features - [x] Display Typst types as colored pills, like in the Typst documentation. - [x] Typst code block: - [x] Highlighting - [x] Rendering - [x] Examples (highlighting code and rendering) - [x] Parameter descriptions - [ ] Function definitions ## Setup Install the preprocessor through `cargo`'s `--git` flag: ``` cargo install --git https://github.com/fenjalien/mdbook-typst-doc.git ``` It is recommended to copy and include `example/typst-doc.css` in your book as it contains the recommended styling, feel free to modify it how you see fit. See `example/book.toml` for more recommeded setup. ## Usage ### Typst Types Converts `{{#type ...}}` into a link to the type's web page with the same styling as the official Typst documentation. You can add new types by adding them to the `preprocessor.typst-doc.types` key in the `book.toml`: ```toml [preprocessor.typst-doc.types] int = {class = "num", link = "https://typst.app/docs/reference/foundations/int/"} ``` - `link`: The link to the type's definition. You can use a realtive url if you define your own types within the book (`"/type_definition.html"`). If no link is given the output HTML element will not be a link. - `class`: The text to append to `"type-"` to make up the CSS class of the HTML element. This is to aid in the styling of the element. This is required unless the key `default-type-class` is given, in which case the default class will be used. Normally the preprocessor will panic if a type is used that is not in the config table. That is, unless the `default-type-class` key has been given, in which case an element with the given class and no link will be placed. For some reason having a link in the default template breaks when used within a heading. You can place an exclamation mark `!` between the hash and the type (`{{#!type ...}}`) to not use a link. If you know/find a way to fix this without having to turn off the link please let me know :) ### Typst Code Blocks Code blocks that have a language `typ` or `typc` can be processed. A `typ` block is in markup mode while a `typc` block is in code mode. By default syntax highlighting will be applied to the code and nothing else. To render the code instead you can include the `render` option on the code block like this: ```typ,render Hello, world! ``` To show the code block and the rendered output include the `example` option instead of `render`. Rendering Typst code blocks requires the Typst CLI 0.11.0 to be installed on the system. By default the `typst` command will be used but this can be changed by setting the `typst-command` option. The root folder will be the book's folder (`example/`) but the `root-arg` option will be given as the `--root` argument if present. Rendered images are named after the first 5 characters of the md5 sum of their source code. They will first be rendered to `mdbook-typst-doc/` then moved all at once into `src/mdbook-typst-doc/`. This will trigger a re-render if the `serve` or `watch` command is being used. However if the file already exists in `src/mdbook-typst-src/` the file it will not be rendered and moved again. ### Parameter Defintions Stylised and formatted parameter descriptions! It should be written as an html block like so: ```html <parameter-definition name="name" types="int,float" default="default"> Some description </parameter-definition> ``` The `name` attribute and text inside the tags will be left alone. The `types` attribute will be split on commas and formatted to use the `{{#type ...}}` preprocessor. The `default` attribute will be highlighted. ## Custom Templates You can override the default look of the above features by providing handlebar templates in `themes/typst-doc` with the following names. The keys and values of the data passed to the template is also described: - `type.hbs`: Template for the Typst types. - `link` The url to the type's definition - `class` The css class to apply to the type - `name` The name of the type. - `use_link` A boolean that is false when `!` is added after the hash. It should not use the link if false. - `code.hbs`: Template for a Typst code block with no options. - `source` The highlighted code block. - `render.hbs`: Template for a rendered Typst code block. - `image` The markdown link to the generated image. - `example.hbs`: Template for a Typst code block with a rendered image. - `source` The highlighted code block. - `image` The markdown link to the generated image. - `parameter.hbs`: Template for the parameter description. - `name` The string given by the `name` attribute. - `types` An array of strings formatted to use the type preprocessor feature given by splitting the `types` attribute on commas. - `default` The default value given by the `default` attribute. - `description` The text between the tags. The default templates are kept in `/src/themes/`. You can also specify a code template to use before a Typst code block is rendered. They should be stored in a table with the key `code-templates`. You can specify a unique template for `typ` code and `typc` code. The `{{input}}` will be replaced by the source code to be rendered. See the example book toml for more details.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/delimited_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test that symbols aren't matched automatically. $ bracket.l a/b bracket.r = lr(bracket.l a/b bracket.r) $
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/README.md
markdown
<img alt="Logo di Error_418" src="https://github.com/Error-418-SWE/Documenti/blob/7778de3e750a90db96204acb8b7942b2876769a8/logo.png" width="128"/> # Sorgenti della documentazione di Error_418 Il branch `src` contiene i file sorgente della documentazione di **Error_418** (gruppo 7). I documenti sono prodotti nell'ambito del corso di **Ingegneria del Software** del corso di Laurea in Informatica dell'Università degli Studi di Padova (A.A. 2023/2024). ## Documenti I documenti sono redatti in italiano con [Typst](https://typst.app). ### Caratteristiche dei documenti Il preambolo di ciascun file sorgente contiene i parametri di configurazione del modello (`/template.typ`). Il contenuto del documento segue il preambolo. ### Categorizzazione dei documenti I file sorgente, così come i documenti compilati (PDF), sono organizzati per milestone. Ciascun file sorgente risiede in una sottocartella dedicata, assieme al proprio registro delle modifiche (`./log.csv`). ## Modalità di modifica Ogni modifica ai documenti deve essere soggetta a *pull request*, secondo le modalità previste dalle Norme di Progetto del Gruppo. ### Generazione automatica del changelog All'apertura di una PR, un automatismo aggiorna il registro delle modifiche e assegna un numero di versione secondo i criteri definiti dalle Norme di Progetto del Gruppo. ### Compilazione automatica del documento All'apertura di una PR e dopo l'aggiornamento automatico del registro delle modifiche, un automatismo compila il documento `.typ` per verificare l'assenza di errori nel markup. Il documento prodotto è scaricabile in formato PDF da: - pagina della PR; - pagina di report dell'esecuzione della GitHub Action. ### Pubblicazione automatica del documento Una PR che superi i controlli automatici e del verificatore può essere chiusa. Con la chiusura, il file sorgente confluisce nel branch `src` e il documento compilato viene pubblicato nel branch `main`.
https://github.com/kiwiyou/algorithm-lecture
https://raw.githubusercontent.com/kiwiyou/algorithm-lecture/main/basic/06-optimization.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)[ = 알고리즘 기초 세미나 06: 최적화 문제의 접근 방법 #text(size: 0.8em)[ 연세대학교 전우제#super[kiwiyou] \ 2023.01.25.r1 ] ] #slide.slide[그리디][ - 문제가 단계별로 나누어져 있을 때, 각 단계의 최적을 통해 전체의 최적을 구하는 방법 - $N$개의 정수 중 합이 가장 작은 세 수를 고르기 - $cal(O)(N^3)$ - $cal(O)(N^2)$ - $cal(O)(N)$ - $K$개 수 고르기 - $cal(O)(N log N)$ - $cal(O)(N)$ #pagebreak() - $N$명의 사람이 한 화장실을 $A_(i)$초 이용할 때, 각 사람이 화장실을 다 쓰고 나올 때까지 걸린 시간의 합의 최솟값 - $A_(i)$를 적절히 재배열한 수열 $B_(i)$에 대해서, 기다리는 시간의 합은 $ N B_(1) + (N - 1) B_(2) + dots.c + 1 B_(N) $ - 직관적으로? #pagebreak() - 교환 논법#super[Exchange Argument] - 최소가 되는 배치 $B$에서, 어떤 인접한 두 원소 $B_(i)$와 $B_(j)$가 $i < j$이고 $B_(i) >= B_(j)$를 만족한다고 가정 - 필요한 시간은 $2B_(i) + B_(j)$ - 순서를 바꾸면 $B_(i) + 2B_(j) <= 2B_(i) + B_(j)$ - 앞쪽이 작도록 정렬하는 게 절대 손해가 되지 않음: 반드시 최적해 중 하나! #pagebreak() - 시작 시각이 $S_(i)$, 종료 시각이 $E_(i)$인 회의 $N$개가 하나의 회의실을 사용하려고 할 때, 진행 가능한 회의의 최대 수 - 길이 $N$의 문자열이 `(`, `)`, `?`로 이루어져 있을 때, `?`를 모두 적당히 바꿔서 괄호 짝이 모두 맞도록 하기 - $N$종류의 동전이 있을 때 $M$원을 거슬러 주기 위한 동전 수의 최솟값 ] #slide.slide[과제][ - #slide.problem("29615", "알파빌과 베타빌") - #slide.problem("29767", "점수를 최대로") - #slide.problem("28353", "고양이 카페") ] #slide.slide[재귀][ - 자기 자신을 참조하는 것 - 크기 $M$의 문제를 풀어서 크기 $N > M$의 문제를 풀 수 있는 경우 - 주로 그리디로 풀기 어려운 문제를 해결 - $n! = n times (n - 1)!$ - $F_(n) = F_(n - 1) + F_(n - 2)$ #pagebreak() - 원판이 $N$개인 하노이 탑을 옮기는 방법 - $N - 1$개인 탑을 옮긴다 - 원판을 옮긴다 - $N - 1$개인 탑을 다시 옮긴다 #pagebreak() - 함수의 동작 과정 대신 의미 혹은 반환값만을 생각해야 헷갈리지 않음 #algorithm({ import algorithmic: * Function([Hanoi], args: ($N$, $"from"$, $"to"$, $"mid"$), { If(cond: $N = 0$, { Return[] }) Call([Hanoi], [$N$, $"from"$, $"mid"$, $"to"$]) State[*print* $"from" -> "to"$] Call([Hanoi], [$N$, $"mid"$, $"to"$, $"from"$]) }) }) - $cal(O)(2^N)$ ] #slide.slide[과제][ - #slide.problem("1074", "Z") ] #slide.slide[다이나믹 프로그래밍][ - 문제를 재귀 형식으로 풀 때, 같은 인자를 주어 여러 번 실행하는 경우 $ f(n) &= f(n - 1) + f(n - 2) \ f(2) &= 1 \ f(1) &= 1 $ - $f(6)$을 구하기 위한 $f(1)$의 실행 횟수는? - -> 배열에 함숫값을 저장해 두자! #pagebreak() - $cal(O)(n)$ #algorithm({ import algorithmic: * Function([Fibonacci], args: ($n$, $"cache"$), { If(cond: [$"cache"$ *not contains* $n$], { Assign[$"cache"[n]$][ #CallI("Fibonacci", [$n - 1$, $"cache"$]) + #CallI("Fibonacci", [$n - 2$, $"cache"$]) ] }) Return[$"cache"[n]$] }) }) #algorithm({ import algorithmic: * Function([Fibonacci], args: ($n$, ), { Assign[$"cache"[1]$][$1$] Assign[$"cache"[2]$][$1$] For(cond: [$i$ *from* $3$ *upto* $n$], { Assign[$"cache"[i]$][$"cache"[i - 1]$ + $"cache"[i - 2]$] }) Return[$"cache"$[n]] }) }) ] #slide.slide[과제][ - #slide.problem("14916", "거스름돈") - #slide.problem("9656", "돌 게임 2") - #slide.problem("9095", "1, 2, 3 더하기") ]
https://github.com/isaacholt100/isaacholt
https://raw.githubusercontent.com/isaacholt100/isaacholt/main/public/maths-notes/4-cambridge%3A-part-III/information-theory/information-theory.typ
typst
MIT License
#import "../../template.typ": * #show: doc => template(doc, hidden: (), slides: false) #let Bern = math.op("Bern") #let sim = sym.tilde = Entropy == Introduction #notation[ Write $x_1^n := (x_1, ..., x_n) in {0, 1}^n$ for an length $n$ bit string. ] #notation[ We use $P$ to denote a probability mass function. Write $P_1^n$ for the joint proability mass function of a sequence of $n$ random variables $X_1^n = (X_1, ..., X_n)$. ] #definition[ A random variable $X$ has a *Bernoulli distribution*, $X sim Bern(p)$, if for some fixed $p in (0, 1)$, $ X = cases( 1 & "with probability" p, 0 & "with probability" 1 - p ), $ i.e. the probability mass function (PMF) of $X$ is $P: {0, 1} -> RR$, $P(0) = 1 - p$, $P(1) = p$. ] #notation[ Throughout, we take $log$ to be the base-$2$ logarithm, $log_2$. ] #definition[ The *binary entropy function* $h: (0, 1) -> [0, 1]$ is defined as $ h(p) := -p log p - (1 - p) log(1 - p) $ ]<def:binary-entropy-function> #example[ Let $x_1^n in {0, 1}^n$ be an $n$ bit string which is the realisation of binary random variables (RVs) $X_1^n = (X_1, ..., X_n)$, where the $X_i$ are independent and identically distributed (IID), with common distribution $X_i sim Bern(p)$. Let $k = abs({i in [n]: x_i = 1})$ be the number of ones in $x_1^n$. We have $ Pr(X_1^n = x_1^n) := P^n (x_1^n) = product_(i = 1)^n P(x_i) = p^k (1 - p)^(n - k). $ Now by the law of large numbers, the probability of ones in a random $x_1^n$ is $k\/n approx p$ with high probability for large $n$. Hence, $ P^n (x_1^n) approx p^(n p) (1 - p)^(n (1 - p)) = 2^(-n h(p)). $ Note that this reveals an amazing fact: this approximation is independent of $x_1^n$, so any message we are likely to encounter has roughly the same probability $approx 2^(-n h(p))$ of occurring. ] #remark[ By the above example, we can split the set of all possible $n$-bit messages, ${0, 1}^n$, into two parts: the set $B_n$ of *typical* messages which are approximately uniformly distributed with probability $approx 2^(-n h(p))$ each, and the non-typical messages that occur with negligible probability. Since all but a very small amount of the probability is concentrated in $B_n$, we have $abs(B_n) approx 2^(n h(p))$. ] #remark[ Suppose an encoder and decoder both already know $B_n$ and agree on an ordering of its elements: $B_n = {x_1^n (1), ..., x_1^n (b)}$, where $b = abs(B_n)$. Then instead of transmitting the actual message, the encoder can transmit its index $j in [b]$, which can be described with $ ceil(log b) = ceil(log abs(B_n)) approx n h(p) $ bits. ] #remark[ - The closer $p$ is to $1/2$ (intuitively, the more random the messages are), the larger the entropy $h(p)$, and the larger the number of typical strings $abs(B_n)$. - Assuing we ignore non-typical strings, which have vanishingly small probability for large $n$, the "compression rate" of the above method is $h(p)$, since we encode $n$ bit strings using $n h(p)$ strings. $h(p) < 1$ unless the message is uniformly distributed over all of ${0, 1}^n$. - So the closer $p$ is to $0$ or $1$ (intuitively, the less random the messages are), the smaller the entropy $h(p)$, so the greater the compression rate we can achieve. ] == Asymptotic equipartition property #notation[ We denote a finite alphabet by $A = {a_1, ..., a_m}$. ] #notation[ If $X_1, ..., X_n$ are IID RVs with values in $A$, with common distribution described by a PMF $P: A -> [0, 1]$ (i.e. $P(x) = Pr(X_i = x)$ for all $x in A$), then write $X sim P$, and we say "$X$ has distribution $P$ on $A$". ] #notation[ For $i <= j$, write $X_i^j$ for the block of random variables $(X_i, ..., X_j)$, and similarly write $x_i^j$ for the length $j - i + 1$ string $(x_i, ..., x_j) in A^(i - j + 1)$. ] #notation[ For IID RVs $X_1, ..., X_n$ with each $X_i sim P$, denote their joint PMF by $P^n: A^n -> [0, 1]$: $ P^n (x_1^n) = Pr(X_1^n = x_1^n) = product_(i = 1)^n Pr(X_i = x_i) = product_(i = 1)^n P(x_i), $ and we say that "the RVs $X_1^n$ have the product distribution $P^n$". ] #definition[ A sequence of RVs $(Y_n)_(n in NN)$ *converges in probability* to an RV $Y$ if $forall epsilon > 0$, $ Pr(abs(Y_n - Y) > epsilon) -> 0 quad "as" n -> oo. $ ]<def:convergence-in-probability> #definition[ Let $X sim P$ be a discrete RV on a countable alphabet $A$. The *entropy* of $X$ is $ H(X) = H(P) := -sum_(x in A) P(x) log P(x) = EE[-log P(X)]. $ ]<def:entropy> #remark[ - We use the convention $0 log 0 = 0$ (this is natural due to continuity: $x log x -> 0$ as $x arrow.b 0$, and also can be derived measure-theoretically). - Entropy is technically a functional the probability distribution $P$ and not of $X$, but we use the notation $H(X)$ as well as $H(P)$. - $H(X)$ only depends on the probabilities $P(x)$, not on the values $x in A$. Hence for any bijective $f: A -> A$, we have $H(f(X)) = H(X)$. - All summands of $H(X)$ are non-negative, so the sum always exists and is in $[0, oo]$, even if $A$ is countable infinite. - $H(X) = 0$ iff all summands are $0$, i.e. if $P(x) in {0, 1}$ for all $x in A$, i.e. $X$ is *deterministic* (constant, so equal to a fixed $x_0 in A$ with probability $1$). ] #theorem[ Let $X = {X_n: n in NN}$ be IID RVs with common distribution $P$ on a finite alphabet $A$. Then $ -1/n log P^n (X_1^n) --> H(X_1) quad "in probability" quad "as" n -> oo $ ]<thm:convergence-to-common-entropy-in-probability> #proofhints[ Straightforward. ] #proof[ We have $ P^n (X_1^n) & = product_(i = 1)^n P(X_i) \ ==> 1/n log P^n (X_1^n) & = 1/n sum_(i = 1)^n log P(X_i) -> EE[-log P(X_1)] quad "in probability" $ by the weak law of large numbers (WLLN) for the IID RVs $Y_i = -log P(X_i)$. ] #corollary(name: "Asymptotic Equipartition Property (AEP)")[ Let ${X_n: n in NN}$ be IID RVs on a finite alphabet $A$ with common distribution $P$ and common entropy $H = H(X_i)$. Then - $(==>)$: for all $epsilon > 0$, the set of *typical strings* $B_n^* (epsilon) subset.eq A^n$ defined by $ B_n^* (epsilon) := {x_1^n in A^n: 2^(-n(H + epsilon)) <= P^n (x_1^n) <= 2^(-n(H - epsilon))} $ satisfies $ abs(B_n^* (epsilon)) <= 2^(n(H + epsilon)) quad & forall n in NN, quad "and" \ P^n (B_n^* (epsilon)) = Pr(X_1^n in B_n^* (epsilon)) --> 1 quad & "as" n -> oo $ - $(<==)$: for any sequence $(B_n)_(n in NN)$ of subsets of $A^n$, if $P(X_1^n in B_n) -> 1$ as $n -> oo$, then $forall epsilon > 0$, $ abs(B_n) & >= (1 - epsilon) 2^(n(H - epsilon)) quad "eventually" \ "i.e." exists N in NN: forall n >= N, quad abs(B_n) & >= (1 - epsilon) 2^(n(H - epsilon)). $ ]<cor:aep> #proofhints[ - $(==>)$: straightforward. - $(<==)$: show that $P^n (B_n sect B_n^* (epsilon)) -> 1$ as $n -> oo$. ] #proof[ - $(==>)$: - Let $epsilon > 0$. By @thm:convergence-to-common-entropy-in-probability, we have $ Pr(X_1^n in.not B_n^* (epsilon)) = Pr(abs(-1/n log P^n (X_1^n) - H) > epsilon) -> 0 quad "as" n -> oo. $ - By definition of $B_n^* (epsilon)$, $ 1 >= P^n (B_n^* (epsilon)) = sum_(x_1^n in B_n^* (epsilon)) P^n (x_1^n) >= abs(B_n^* (epsilon)) 2^(-n(H + epsilon)). $ - $(<==)$: - We have $P^n (B_n sect B_n^* (epsilon)) = P^n (B_n) + P^n (B_n^* (epsilon)) - P^n (B_n union B_n^* (epsilon)) >= P^n (B_n) + P^n (B_n^* (epsilon)) - 1$, so $P^n (B_n sect B_n^* (epsilon)) -> 1$. - So $P^n (B_n sect B_n^* (epsilon)) >= 1 - epsilon$ eventually, and so $ 1 - epsilon & <= P^n (B_n sect B_n^* (epsilon)) = sum_(x_1^n in B_n sect B_n^* (epsilon)) P^n (x_1^n) \ & <= abs(B_n sect B_n^* (epsilon)) 2^(-n(H - epsilon)) <= abs(B_n) 2^(-n(H - epsilon)). $ ] #remark[ - The $==>$ part of AEP states that a specific object (in this case, the $B_n^* (epsilon)$) can achieve a certain performance, while the $<==$ part states that no other object of this type can significantly perform better. This is common type of result in information theory. - @thm:convergence-to-common-entropy-in-probability gives a mathematical interpretation of entropy: the probability of a random string $X_1^n$ generally decays exponentially with $n$ ($P^n (X_1^n) approx 2^(-n H)$ with high probability for large $n$). The AEP gives a more "operational interpretation": the smallest set of strings that can carry almost all the probability of $P^n$ has size $approx 2^(n H)$. - The AEP tells us that higher entropy means more typical strings, and so the possible values of $X_1^n$ are more unpredictable. So we consider "high entropy" RVs to be "more random" and "less predictable". ] == Fixed-rate lossless data compression #definition[ A *memoryless source* $X = {X_n: n in NN}$ is a sequence of IID RVs with a common PMF $P$ on the same alphabet $A$. ]<def:source.memoryless> #definition[ A *fixed-rate lossless compression code* for a source $X$ consists of a sequence of *codebooks* ${B_n: n in NN}$, where each $B_n subset.eq A^n$ is a set of source strings of length $n$. Assume the encoder and decoder share the codebooks, each of which is sorted. To send $x_1^n$, an encoder checks with $x_1^n in B_n$; if so, they send the index of $x_1^n$ in $B_n$, along with a flag bit $1$, which requires $1 + ceil(log abs(B_n))$ bits. Otherwise, they send $x_1^n$ uncompressed, along with a flag bit $0$ to indicate an "error", which requires $1 + ceil(log abs(A)) = 1 + ceil(n log abs(A))$ bits. ]<def:fixed-rate-code> #definition[ For each $n in NN$, the *rate* of a fixed-rate code ${B_n: n in NN}$ for a source $X$ is $ R_n := 1/n (1 + ceil(log abs(B_n))) approx 1/n log abs(B_n) quad "bits/symbol". $ ]<def:code-rate> #definition[ For each $n in NN$, the *error probability* of a fixed-rate code ${B_n: n in NN}$ for a source $X$ is $ P_e^((n)) := Pr(X_1^n in.not B_n). $ ]<def:code-error-probability> #theorem(name: "Fixed-rate coding theorem")[ Let $X = {X_n: n in NN}$ be a memoryless source with distribution $P$ and entropy $H = H(X_i)$. - $(==>)$: $forall epsilon > 0$, there is a fixed-rate code ${B_n^* (epsilon): n in NN}$ with vanishing error probability ($P_e^((n)) -> 0$ as $n -> oo$) and with rate $ R_n <= H + epsilon + 2/n quad forall n in NN. $ - $(<==)$: let ${B_n: n in NN}$ be a fixed-rate with vanishing error probabilit. Then $forall epsilon > 0$, its rate $R_n$ satisfies $ R_n > H - epsilon quad "eventually". $ ] #proofhints[ $(==>)$: straightforward. $(<==)$: straightforward. ] #proof[ - $(==>)$: - Let $B_n^* (epsilon)$ be the sets of typical strings defined in AEP (@cor:aep). Then $P_e^((n)) = 1 - Pr(X_1^n in B_n^*) -> 0$ as $n -> oo$ by AEP. - Also by AEP, $R_n = 1/n (1 + ceil(log abs(B_n^*))) <= 1/n log abs(B_n^*) + 2/n <= H + epsilon + 2/n$. - $(<==)$: - WLOG let $0 < epsilon < 1\/2$. By AEP, $ R_n >= 1/n log abs(B_n^*) + 1/n >= 1/n log(1 - epsilon) + H - epsilon + 1/n = H - epsilon + 1/n log(2(1 - epsilon)) > H - epsilon $ eventually. ]
https://github.com/LorenzoCucchi/appunti_aerodinamica
https://raw.githubusercontent.com/LorenzoCucchi/appunti_aerodinamica/main/appunti_typst/main.typ
typst
MIT License
#import "template.typ": * #show: ieee.with( title: [Aerodinamica ], abstract: [ Appunti del corso di aerodinamica 22/23 ], authors: ( ( name: "<NAME>", ), ), bibliography-file: "refs.bib", ) = Corpi Tozzi Dobbiamo definire la *vorticità*: $ underline(omega)=underline(nabla)times underline(u) $ <vort> Il rotore di un campo vettoriale possiede la seguente proprietà $ underline(nabla)dot (underline(nabla)times underline(A)))=0 $ Il flusso di vorticità non può sparire, è esattamente incomprimibile. Peril teroema di _Stokes_ $ integral.cont_gamma underline(u)dot underline(tau)d l=integral_s (underline(nabla)times underline(u))dot hat(n)d s=integral_s underline(omega)dot hat(n)d s $ Ricordando l'equazione @vort della vorticità: $ (diff underline(omega))/(diff t) + underline(u)dot underline(nabla)underline(omega)=underline(omega)dot underline(nabla)underline(u)+1/(R e) nabla^2underline(omega) $ $ (D underline(omega))/(D t) = underline(omega)dot underline(nabla)underline(u) + 1/(R e) nabla^2underline(omega) $ Il primo termine è la rapidità con cui la vorticità di una particella varia nel tempo. Il secondo è il termine di *stretching* e *tilting*, stiramento o rotazione delle linee di corrente. Il terzo termine è la diffusione della vorticità ($italic(I)$ problema di Stokes). === Esempi Consideriamo il fenomeno dello scarico del lavandino. Mano a mano che ci si avvicina allo scarico le linee di corrente tendono a diventare verticali e la vorticità aumenta. Tale fenomeno può essere giustificato anche dal fatto che il momento angolare si conserva e il volume di controllo si stringe mano a mano che si avvicina allo scarico. Pertanto diminuisce il momento di inerzia a favore della velocità angolare, cioè della *vorticità*. Nelle gallerie del vento, prima della camera di prova, vengono poste reti e strutture a nido d'ape al fine di rompere le strutture vorticoseed evitare che la vorticità sia incrementata a seguito dell'accelerazione nel convergente. == Teorema di Lagrange Sotto le ipotesi di : _incomprimibilità_, _fluido newtoniano_, _forze di volume conservative_. Se $ underline(omega)(underline(r),0)=0 " ," " " " "underline(omega)(underline(r),t)bar.v_(diff omega)=0&& " " forall t, " allora" $ $ underline(omega)(underline(r),t)=0 " in" " " Omega $ Questo teorema diventa molto importante quando possiamo separare il campo di moto in una zona interna ed una zona esterna. === Dimostrazione $ underline(omega)(underline(r), t=0)=0 $ L'equazione della vorticità diviene: $ lr((D underline(omega))/(D t)|)_(t=0) =0 $ Siccome per _hp._ $underline(omega)(underline(r),t)|_(diff Omega) =0$ allora $underline(omega)$ rimarrà nullo per ogni valore di _t_ su tutto il dominio. == I th. di Helmholtz Sotto hp. $" " underline(nabla)dot underline(u)=0" "$ , _effetti viscosi trascurabili_, $" " underline(f)=underline(nabla)E$. Se una particella di fluido ha vorticità nulla nell'istante iniziale manterrà vorticità nulla anche negli istanti successivi. Le ipotesi del _th. di Helmholtz_ sono #underline[deboli] rispetto a $" "underline(omega)(underline(r),t)|_(diff Omega)=0$ di _Lagrange_. == Def. Linea Vorticosa Una linea vorticosa è una linea tangente in ogni punto al vettore vorticità. == II th. di Helmholtz Sotto hp. $" "\uunderline(nabla)dot underline(u)=0" "$ , _effetti viscosi trascurabili_, $" " underline(f)=underline(nabla)E$. Allora le linee vorticose sono *linee materiali*, ovvero linee i cui punti si muovono con velocità locale del fluido. Se una linea materiale, in qualunque istante, è anche linea vorticola, allora resta tale in tutti gli istanti. === Dimostrazione Sia $underline(x)=underline(x)(s,t)$ una linea vorticosa. Allora $ (diff underline(x)(s,0))/(diff s) times underline(omega)(underline(x)(s,0),0)=0 $ Dobbiamo dimostrare che tale tesi vale $forall t$. Supponiamo di fissare _s_ $ d/(d t)lr(((diff underline(x)(s,t))/(diff s)times underline(omega)(underline(x)(s,t),t)))=0 $ $ (diff^2 underline(x)(s,t))/(diff t diff s)times underline(omega)(underline(x)(s,t),t)+(diff underline(x)(s,t))/(diff s)times d/(d t)underline(omega)(underline(x)(s,t),t)=0 $ $ diff/(diff s)underline(u)(underline(x)(s,t),t)times underline(omega)(underline(x)(s,t),t) +\ +(diff underline(x)(s,t))/(diff s)times ((diff underline(omega))/(diff t)+underline(u)dot underline(nabla)underline(omega))=0 $ $ (hat(tau)dot underline(nabla))underline(u)times underline(omega)+hat(tau)times (underline(omega)dot underline(nabla))underline(u) $ Valutando in $t=0$. $ (hat(tau)(s,0)dot underline(nabla))underline(u)times underline(omega)(underline(x)(s,0),0) +\ + hat(tau)(s,0)times (underline(omega)(underline(x)(s,0),0)dot underline(nabla))underline(u) $ Definisco $ underline(omega)(underline(x)(s,0),0)=C(s)hat(tau)(s,0) $ Allora $ (hat(tau)(s,0)dot underline(nabla))underline(u)times C(s)hat(tau)(s,0) +\ + hat(tau)(s,0)times (C(s)hat(tau)(s,0)dot underline(nabla))underline(u) $ $ C(s)lr([(hat(tau)dot underline(nabla))underline(u)times hat(tau)- (hat(tau)dot underline(nabla))underline(u)times hat(tau)]) =0 $ L'equazione è verificata all'istante iniziale. In definitiva: $ d/(d t)lr(((diff underline(x))/(diff s) (s,t)times underline(omega)(underline(x)(s,t),t))|)_(t=0)=0 $ Dato che la funzione è nulla per $t=0$ e anche la sua derivata è nulla in $t=0$, allora rimarrà nulla $forall t$ date le _hp._ del problema. == <NAME> Sotto hp. $" "\uunderline(nabla)dot underline(u)=0" "$ , _effetti viscosi trascurabili_, $" " underline(f)=underline(nabla)E$. Allora la circolazione associata ad una linea materiale non cambia nel tempo. $ d/(d t)integral_gamma underline(u)dot hat(tau)d l = (d Gamma)/(d t)=0 $ Ricordando il teorema di derivazione sotto il segno di integrale: $ d/(d t)integral_l underline(F)dot hat(tau) d l = integral_l (diff underline(F))/(diff t) + underline(nabla)times underline(F)times underline(v_c) +\ + underline(F)(underline(x)_c (1,t),t)dot underline(v)_c (1,t) - underline(F)(underline(x)_c (0,t),t)dot underline(v)_c (0,t) $ Dove i termini $underline(v)_c$ indicano la velocità del contorno. Poichè la linea di interesse è chiusa, i termini valutati in $s=0$ e in $s=1$ sono uguali e opposti. Applicando tale teorema si ottiene: $ d/(d t)integral.cont_l underline(u)dot hat(tau)d l=integral.cont_l (diff underline(u))/(diff t) + underline(nabla)times underline(u)times underline(u)= \ =-integral.cont_l underline(nabla)(1/2 underline(u)+p/rho) = 0 $ Risulta dimostrato essendo che l'integrale di un gradiente su linea chiusa è uguale a 0. == Def. Tubo Vorticoso Il tubo vorticoso è formato da linee vorticose. Se prendiamo una porzione chiusa come volume di controllo di tale tubo possiamo scrivere: $ integral_Omega underline(nabla)dot underline(omega)=0 arrow.r.long^(D i v)integral.cont_(diff Omega)underline(omega)dot hat(n)= \ = integral_A underline(omega)dot hat(n)_A + integral_B underline(omega)dot hat(n)_B + integral_(S_l) underline(omega)dot hat(n)_(s_l) =0 $ Pertanto $ integral_A underline(omega)dot hat(n)_A = - integral_B underline(omega)dot hat(n)_B " "arrow.r.double.long " " Gamma_A = Gamma_B $ La circolazione si conserva lungo un tubo vorticoso. Se il tubo vorticoso c'è, non si elide mai, a meno che esso non si richiuda su se stesso. Tale proprietà discende dal fatto che la vorticità è per definizione un _campo perfettamente solenoidale_. == III Th. di Helmholtz Sotto hp. $" "\uunderline(nabla)dot underline(u)=0" "$ , _effetti viscosi trascurabili_, $" " underline(f)=underline(nabla)E$. Allora la circolazione, che per _Kelvin_ è costante lungo il tubo vorticoso, è costante anche nel tempo. = Correnti incomprimibili attorno a \ corpi aerodinamci Il _I th. di Helmholtz_ ci dice che una particella di fluido con $underline(omega)=0$ a monte, si mantiene a vorticità nulla finchè gli effetti viscosi sono trascurabili. Il modello matematico nella zona irrotazionale sarà dato da: $ cases( underline(nabla)times underline(u)=0, underline(nabla)dot underline(u)=0 ) " "+" " underline(u)dot underline(n)|_(diff Omega)=b $ Tali equazioni sono già sufficieti per trovare $underline(u)$, tali equazioni solo _lineari_. $ underline(nabla)dot underline(u)=(diff u)/(diff x)+(diff v)/(diff y)+(diff w)/(diff z)=0 $ $ underline(nabla)times underline(u) = mat(hat(x),hat(y),hat(z); diff/(diff x),diff/(diff y),diff/(diff z); u,v,w) $ Nel caso bidimensionale: $ cases( (diff u)/(diff x) + (diff v)/(diff y) = 0, (diff v)/(diff x) - (diff u)/(diff y) = 0 ) arrow.r.long cases( (diff)/(diff x)lr(((diff u)/(diff x) + (diff v)/(diff y)))=0, (diff)/(diff y)lr(((diff v)/(diff x) - (diff u)/(diff y)))=0 ) $ Da cui si ottiene $ (diff^2 u)/(diff x^2) + (diff^2 v)/(diff y^2) arrow.double.r.long nabla^2u=0 $ Se deriviamo in maniera opposta e sommiamo le equazioni tra loro troviamo $nabla^2 v=0$. Entrambe le componenti $u$ e $v$ soddisfano l'equazione di _Laplace_ e sono pertanto dette *funzioni armoniche*. Se il campo di velocità è irrotazionale e aggiungiamo l' _hp._ di *dominio semplicemenete connesso*, allora possiamo riscrivere il campo vettoriale $underline(u)$ come potenziale cinetico: $ underline(u)=underline(nabla)phi $ Ma tale campo vettoriale è anche solenoidale, pertanto $ underline(nabla)dot underline(u) = underline(nabla)dot (underline(nabla)phi)=nabla^2 phi=0 $ Pertanto anche il potenziale cinetico $phi$ è una funzione armonica. Per quanto riguarda la _BC_ $ underline(u)dot underline(n)=b arrow.double.r.long underline(nabla)phi dot underline(n) = (diff phi)/(diff n) = b $ Pertanto otteniamo un problema di _Neumann_ con condizione sulla derivata prima $ cases( nabla^2 phi=0, lr((diff phi)/(diff n)) = b ) $ Sapendo che esiste anche la funzione di corrente nel caso 2D. $ u = (diff psi)/(diff y) " ; "" " v= -(diff psi)/(diff x) $ Notando che $ underline(nabla)times underline(u) = (diff v)/(diff x)-(diff u)/(diff y)=(diff^2 psi)/(diff x^2)+(diff^2 psi)/(diff y^2)=nabla^2psi $ Anche $psi$ è una funzione armonica. Si considerei ora _Navier-Stokes_ per la quantità di moto: $ (diff underline(u))/(diff t)+(underline(u)dot underline(nabla))underline(u)+1/rho underline(nabla)p=-underline(nabla)E $ Sviluppando $(underline(u)dot underline(nabla))underline(u)$ $ (diff underline(u))/(diff t)+cancel(underline(nabla)times underline(u)times underline(u))+1/2underline(nabla)abs(underline(u))^2+1/rho underline(nabla)p=-underline(nabla)E $ Considerando il potenziale cinetico $underline(nabla)phi=underline(u)$ $ underline(nabla)underbrace(lr(((diff phi)/(diff t)+abs(underline(nabla)phi)^2/(2)+p/rho +E)),"Quadrinomio di Bernoulli")=0 $ == I th. di Bernoulli Sotto hp. di $" "\uunderline(nabla)dot underline(u)=0" "$ , _effetti viscosi trascurabili_, $" " underline(f)=underline(nabla)E$, _corrente irrotazionale_. Il quadrinomio di _Bernoulli_ si conserva nello spazio. \ \ Nel nostro caso le forze di volume sono spesso trascurabili e si ottiene dunque $ (diff phi)/(diff t)+abs(underline(nabla)phi)^2/(2)+p/rho = "cost" $ == Il paradosso instazionario $ cases( nabla^2phi=0, lr((diff phi)/(diff n)) = b(underline(r),t) ) $ Siccome nel modello non ci sono derivate temporali, il potenziale si adatta _istantaneamente_ alle condizioni al contorno e non è influenzato dalla storia. Tale scenario non è fisicamente plausibile. Il modello matematico è sempre dato da $ "Potenziale"+"Strato limite"+"Scia" $ In realtà, la storia di una corrente di questo tipo è nella zona rotazionale quindi nella scia. == Avviamento di un profilo Nella fase di avviamento $ underline(v) =U_infinity "sca"(t) $ Il th. di Kelvin dice che $ (d Gamma_(l m)(t))/(d t) =0 $ Dove _lm_ è la linea materiale, tale scenario è riconducibile ad un aereo fermo sulla pista che parte da fermo. Dobbiamo tenere conto dei seguenti fatti fisici $ cases( (diff underline(u))/(diff t) = -(underline(u)dot underline(nabla))underline(u)-underline(nabla)p+1/(R e)nabla^2 underline(u), underline(nabla)dot underline(u)=0 ) $ I tempi caratteristici di tali termini - $T_t=L/U_infinity$ , tempo caratteristico del trasporto - $T_m=L/c$ , tempo caratteristico della massa, onde di pressione - $T_v=L^2/nu$ , tempo caratteristico della diffusione Vediamone i rapporti $ T_t/T_nu = (L/U_infinity)/(L^2/nu)=nu/(L U_infinity)= 1/(R e) $ Nelle nostre applicazioni $R e>>1$ quindi $T_t<<T_nu$, il trasporto è molto più rapido della diffusione $ T_t/T_m = (L/U_infinity)/(L/c)=c/U_infinity= 1/(M_a) $ In campo incomprimibile $M_a<<1$ quindi $T_t>>T_m$, la conservazione della massa è molto più rapida del trasporto. In ordine: + Conservazione della massa, + Trasporto, + Diffusione = Analisi complessa Una breve introduzione ad alcuni teoremi di analisi complessa. == <NAME> Come visto la serie di _Taylor_ è valida solo se le funzioni espanse sono analitiche. Tuttavia, tipicamente le funzioni di maggiore interesse non sono analitiche in tutto il dominio. Supponiamo che $f(z)$ sia NON analitica in un disco, ma che lo sia in una regione anulare A, delimitata da due circonferenze concentriche, centrate in $z_0$ ed aventi raggio rispettivamente $r$ e $R$, con $r<R$. Assumiamo che $f(z)$ sia analitica all'interno di questi cerchi concentrici e nella regione anulare A. #set align(center) #circle(radius: 50pt, fill: red, stroke: black, inset: 10pt, )[#set align(center + horizon) #circle(radius: 15pt, stroke: black, fill: white) ] #line(start: (14pt,-60pt), length: 15pt) #line(start: (34pt,-71pt), length: 50pt, angle: -45deg) #path(fill: none, stroke: black, closed: true, (0pt,-50pt), (0pt, -90pt), (20pt, -120pt), (50pt,-100pt), (45pt, -70pt), ) #set align(left) Allora esiste un'unica rappresentazione di $f(z)$ in serie di _Laurent_: $ f(z)=sum_(n=0)^infinity a_n(z-z_0)^n + sum_(n=1)^infinity (b_n)/(z-z_0)^n $ dove, se chiamiamo $c_1:|z-z_0|<r$ e $c_2:|z-z_0|<R$ $ a_n = 1/(2 pi i)integral_(c_2)(f(xi)d xi)/((xi-z_0)^(n+1)) $ $ b_n = 1/(2 pi i)integral_(c_1)(f(xi)d xi)/((xi-z_0)^(1-n)) $ Il termine della serie $sum_(n=1)^infinity (b_n)/((z-z_0)^n)$ è detta *parte principale* in quanto in sua assenza la serie di _Laurent_ sarebbe una semplice serie di potenze. \ \ === Definizione $f(z)$ è analitica a infinito se $f(1slash tau)$ è analitica per $tau=0$ \ \ === Definizione Residuo Sia $f(z)$ una funzione analitica in un dominio a meno di una singolarità in $z_0$.Il coefficiente $b_1$ della sua serie di _Laurent_ è detto *residuo di f(z) in $z_0$* Per un polo di ordine $m$ $ "Res"(z_0) =b_1=1/(m-1)!lim_(z arrow.r z_0)(d^(m-1))/(d z^(m-1))[(z-z_0)^m f(z)] $ \ ===Teorema del Residuo di Cauchy Sia $f(z)$ analitica su un dominio semplice e chiuso C, eccetto per un numero *finito* di singolarità poste all'interno di C. Allora: $ integral_C f(z)d z= 2pi i sum_(i=1)^n "Res"(z_i) $ dove $z_i$ sono le singolarità isolate e C è percorso in senso positivo. = Aerodinamica del profilo alare Consideriamo il problema esterno dove la corrente è irrotazionale. $ cases( underline(nabla)dot underline(u)=0, underline(nabla)times underline(u)=0 ) arrow.double.r.long nabla^2phi=nabla^2psi=0 $ Dobbiamo poi ipotizzare che il campo sia _bidimensionale_ per poter definire $psi$. Inoltre, il campo deve essere _stazionario_. Definiamo un _potenziale complesso_ funzione della posizione $z$ nel piano complesso, tale che: $ f(z) = f(x+i y)=phi(x,y)+i psi(x,y)$ Essendo f(z) analitica, possiamo derivarla $ (d f)/(d z)=(diff phi)/(diff x)+ i (diff psi)/(diff x) = lr(((diff phi)/(diff y) +i(diff psi)/(diff y)))(-i) $ pertanto $ (d f)/(d z)=u-i v=u-i v = w(z) " , Velocità complessa" $ Effettivamente torna e si ha $ w(z)=overline(u)(z) $ Tra le ipotesi fatte per definire il potenzial c'era quella di *dominio monoconnesso* nel caso reale. Passando all'analisi complessa è sufficiente l'ipotesi di *irrotazionalità* per definire $phi$. Poi useremo anche l'incomprimibilità per ottenere funzioni armoniche. Dobbiamo capire come rappresentare la corrente attorno al profilo. Per le ipotesi sull'esistenza ed unicità della *serie di Laurent* possiamo vedere il profilo come una regione dove la velocità complessa è non analitica, mentre lo è in un anello grande a piacere, in quanto sotto ipotesi di _corrente stazionaria_ il campo di velocità non presenta singolarità nelle zone indisturbate. Inoltre, a meno del contorno del dominio ad anello, la serie di Laurent *converge uniformemente*. Possiamo rappresentare la velocità complessa come $ w(z)=sum_(-infinity)^(infinity) a_n z^n=sum_(-infinity)^0 c_n z^n = c_0 + sum_(n=1)^infinity c_n/z^n $ La forma più generale ed interessante è $ w(z)=sum_(n=-infinity)^0 c_n z^n $ Che è stata ottenuta sfruttando il teorema che ci dice che se tale funzione è uniformemente convergente a infinito, allora $a_n=0 "," n>=1 $. Tale teorema si applica considerando come dominio un generico contorno contenente il profilo. Siccome la corrente all'infinito ha velocità costante, la funzione è limitata. Tale velocità complessa vale per ogni profilo e può essere vista come lasomma di infinite correnti semplici della forma $ w(z) = c_0 + c_1/z + c_2/z^2 + ... $ Si noti che il termine $c_o$ sarà legato alla corrente uniforme. Al crescere di n in modulo i termini della serie decadono sempre più rapidamente. Questo significia che la cosa più evidente è la corrente uniforme, le altre sono sfumature sempre meno evidenti che però condizionano la corrente. \ \ \ == Soluzioni dell'equazione di Laplace $ f(z)=c_0z+k+c_1log(z)-c_2/z-1/2 c_3/z^2 - ... $ Passiamo in rassegna i vari coefficienti === $c_0z$ $ psi(x,y) = "Im"{c_0z} = c_0^r y+ c_0^i x $ Le linee di corrente di tale potenziale sono un fascio di rette improprio. Prendendo le linee di corrente $ y=-c_0^i/c_0^r x+k/c_0^r $ Pertanto il coefficiente angolare delle linee di corrente vale $ m=-c_0^i/c_0^r $ il meno è legato al fatto che la velocità complessa è il complesso coniugato della velocità. Tale velocità è dunque in realtà specchiata rispetto all'asse reale. Per dare incidenza al profilo possiamo ruotare $w(z)$ di $-alpha$ e porre il profilo ad "incidenza nulla" $ tilde(w)(z) = e^(-i alpha)w(z) $ Si noti che la velocità reale viene ruotata di $alpha$ in qunato è il complesso coiugato del vettore velocità reale. === $c_1/z$ $ f(z)=c_(-1)log(z)=c_(-1)(log(rho)-i theta) $ $ psi="Im"{f(z)} $ Se $c_(-1) in RR$, è una sorgente o pozzo $ psi_1 = c_(-1)theta $ Se $c_(-1) in CC$, è un vortice irrotazionale $ psi_2=c log(rho) $ Per definizione della circolazione e della portanza $ cases(Gamma=integral.cont underline(u)dot hat(tau), Q = integral.cont underline(u)dot hat(n)) $ Se vogliamo calcolarli in analisi complessa $ integral.cont w d z=integral (u-i v)(d x+d y)= \ =integral(u d x+v d y)+i integral(-v d x+u d y)=Gamma + i Q $ L'integrale $integral.cont w(z)d z$ non è pari al potenziale complesso in quanto in queste funzioni vi è sempre almeno una singolarità e se noi prendiamo un percorso chiuso che la contiene, *non* possiamo usare il teorema di *Morero* e la funzione non è detto che ammetta una primitiva. Se vogliamo calcolare circolazone e portata associati ad un profilo alare possiamo prendere un circuito che racchiuda il profilo, ad una distanza almeno pari alla corda dal suo centro, al fine di garantire la convergenza uniforme della serie di Laurent. $ Gamma+ i Q= integral.cont w d z= integral.cont(c_0+c_(-1)/z+c_(-2)/z^2+...)d z=\ Gamma +i Q=2 pi i c_(-1) $ === $c_(-2)/z^2$ $ psi = "Im"{-c_(-2)/z}="Im"{-c_(-2)(x-i y)/(x^2+y^2)} $ Se $c_(-2) in RR $ $ psi_1 = c_(-2)y/(x^2+y^2)=k $ se $ k=0 arrow.double.r.long y=0 $ \ se $ k != 0 arrow.double.r.long x^2+y^2-c_(-2)/k y=0 $ Che risula essere la soluzione della doppietta, corrispondente a due coppie di circonferenze centrate sull'asse immaginario. Se uniamo queste soluzioni possiamo ottenere delle soluzioni di particolare interesse come l'ogiva di Rankine formata da una corrente uniforme e una sorgente. Tale proprietà deriva dalla linearità del Laplaciano. \ \ == Azioni su corpi solidi Sfruttiamo un bilancio della quantità di moto con Eulero nella zona esterna $ d/(d t)integral_Omega rho underline(u)=integral.cont_(diff Omega)-p hat(n)- integral.cont_(diff Omega)rho underline(u)(underline(u)dot hat(n)) $ Se il problema è stazionario, la variazione della quantità di moto è nulla e pertanto siottiene un'equazione di bilancio $ underline(F)_c = -integral.cont_(diff Omega)p hat(n)-integral.cont_(diff Omega)rho underline(u)(underline(u)dot underline(n)) $ Tale relazione vale sotto ipotesi di: + Corrente stazionaria + Corrente incomprimibile + Viscosità trascurabile Se aggiungiamo l'ipotesi di irrotazionalità, vale Bernoulli $ p+1/2 rho abs(underline(u))^2 = c $ Sostituendo p nella conservazione della qdm e considerando che l'integrale di una costante su un circuito chiuso è nulla otteniamo: $ integral.cont_(diff Omega)-p hat(n) = integral.cont_(diff Omega=l)1/2 rho(u^2+v^2)hat(n)d l $ $ underline(F)_c=rho/2integral.cont_l lr([hat(x)(-(u^2-v^2)d y+2u v d x)+\ +hat(y)(-(u^2-v^2)d x-2 u v d y)]) $ Noi vogliamo esprimere la forza $F_c$ con i numeri complessi. $ integral.cont_l w^2d z=integral.cont_l (u-i v)^2(d x+i d y)=\ =integral.cont lr([((u^2-v^2)d x+2 u v d y)+i((u^2-v^2)d y - 2u v d x)]) $ Pertanto $ integral.cont_l w^2d z = -2/rho F_(c y)-2/rho i F_(c x) $ Provando a moltiplicare per $i$ $ F_(c x)-i F_(c y)=i rho/2 integral.cont_l w^2d z $ Abbiamo ricavato la *I formula di Blasius*. == Calcolo del momento aerodinamico Sotto le seguenti ipotesi: + Corrente stazionaria + Corrente incomprimibile + Viscosità trascurabile La II cardinale ci diche che $ (d Gamma)/(d t)=underline(M) $ dove $underline(Gamma)$ per un fluido reale vale $ underline(Gamma)=integral_Omega underline(r)times rho underline(u)d V $ Con l'ipotesi di corrente stazionaria e sapendo che dalla III legge della dinamica $underline(M)_f=-underline(M)_c$ $ underline(M)_c=-integral.cont_(diff Omega) p underline(r)times hat(n)d s- integral.cont_(diff Omega)rho (underline(r)times underline(u))(underline(u) dot hat(n))d s $ Svolgendo il calcolo vettoriale otteniamo $ M_c = integral.cont_l -p(-x d x-y d y)-integral.cont_l rho(x v-y u)(u d y-v d x) $ Introducendo l'ipotesi di irrotazionalità possiamo usare Bernoulli, $ p=c-1/2 rho(u^2+v^2) $ I calcoli non sono riportari, si procede volendo ricondursi al calcolo complesso calcolando quindi $integral.cont_l w^2z d z$ Pertanto $ M_c = -rho/2 "Re"{integral.cont_l w^2z d z} $ *II formula di Blasius* \ \ == <NAME> Calcoliamo forza e momento agenti su un generico profilo alare $ cases(F_x -i F_y=i rho/2 integral.cont w^2 d z, M_c =-rho/2 "Re"{integral.cont w^2 z d z}) $ Scrivo $w(z)$ in serie di Laurent $ w(z)=c_0 +c_(-1)/z+c_(-2)/z^2+... $ Calcolo il primo integrale ed uso il metodo del residuo $ i rho/2 integral.cont w^2 d z= i rho/2 2 c_0c_(-1)2pi i= -2pi rho c_0c_(-1) $ Ma $c_0=U_infinity$, $c_(-1)=Gamma/(2pi i)$ da cui $ F_x +i F_y = i rho Gamma U_infinity $ Pertanto $ cases(F_y=-rho Gamma U_infinity, F_x=0) $ Calcoliamo il momento, svolgiamo l'integrale ed utilizziamo nuovamente il metodo del residuo $ integral.cont w^2z d z=(c_(-1)^2+2 c_0 c_(-2))2pi i $ Da cui $ M_c = -rho/2 "Re"{(c_(-1)^2+2c_0c_(-2))2pi i} $ ma $c_0=U_infinity$ , $c_(-1)=Gamma/(2pi i)$ mentre $c_(-2)$ rimane incognito. $ M_c=-rho/2"Re"{2pi i(-Gamma^2/(4pi^2) +2U_infinity c_(-2))} $ Si osservi che il momento aerodinamico dipende da $c_(-2) in CC$. Ciò significa che $M_c$ non è indipendente dalla forma del profilo. Siccome il momento e le forze sono calcolate rispetto ad un _SR_ ed il momento $M_c$ è centrato nell' origine di tale sistema, allora la portanza non ha momento e si ottiene $ M_c=-rho/2 "Re"{4pi i U_infinity c_(-2)} $ Si noti che nel caso in cui si abba una corrente attorno ad un cilindro, $c_(-2) in RR$ ed il momento è nullo. \ \ Vogliamo ora capire come impiegare la soluzionesemplice del cilindro per il nostro caso di interesse. Prima di farlo però, si ricordi che $ a,b in CC arrow.double.r a dot b = rho e^(i theta) dot r e^(i phi)= rho r e^(i(theta+ phi)) $ Una *funzione analitica* può essere vista come una *trasformazione* da un piano complesso ad un altro. Se $z=f(xi)$ è analitica, allora la trasformazione è *conforme*, l'angolo tra due vettori si *conserva* tra i due piani. Supponendo i vettori infinitesimi, la loro posizone può essere espressa come: $ xi_i=xi_0+d xi_i $ sfruttando il fatto che $xi=rho e^(i theta)$ $ cases(xi_1=xi_0+ d rho e^(i theta_1), xi_2=xi_0+d rho e^(i theta_2)) arrow.double.r.long cases(d xi_1=d rho e^(i theta_1), d xi_2=d rho e^(i theta_2)) $ Applicando la funzione, si ha $z_0=F(xi_0)$. Sviluppando: $ cases(z_1=F(xi_1)=F(xi_0)+(d F)/(d xi) d xi_1+..., z_2=F(xi_2)=F(xi_0)+(d F)/(d xi) d xi_2+...) $ Ma siccome $ cases(d z_1=z_1-z_0=(d F)/(d xi)d xi_1+..., d z_2=z_2 - z_0 = (d F)/(d xi)d xi_2+...) $ Se vogliamo esprimere l'angolo tra i due vettori in ogni piano, possiamo farne il rapporto. In questo modo $ (d xi_2)/(d xi_1)=e^(i(theta_2-theta_1))=(d z_2)/(d z_1) $ Che conferma il fatto che _F_ sia una trasformata conforme. Si noti che la semplificazione del termine $(d F)/(d xi)$ è possibile *solo se* tale derivata è non nulla. Pertanto, le funzioni analitiche sono trasformazioni conformi se la loro derivata è non nulla. Se la funzione è anlatica ovunque, noi non possiamo passare dal cilindro alla forma del profilo, in quanto quest'ultimo presenta un punto angoloso in corrispondenza del bordo d'uscita. Dobbiamo fare in modo che la funzione non sia analitica ovunque. Dobbiamo capire come costruire lafunzione analitica corretta, che sia anche non analitica in un punto. Conosciamo il potenziale attorno al cilindro, in questo caso nel piano $xi$ $ Phi(xi(z))=f(z) $ $ w(z)=(d F)/(d z)=(d Phi(xi(z)))/(d z)=(d Phi)/(d xi)(d xi)/(d z)=(W(xi))/(d z slash d xi) $ Sapendo che $ z=F(xi) arrow.r.long (d z)/(d xi)=F^'(xi) $ da cui $ w(z)=lr((W(xi))/(F^' (xi))|)_(xi=xi(z))=w(z(xi)) $ Le proprietà che richiediamo alla funzione $z(xi)$ di trasformazione sono: + $z(xi)$ analitica fuori dalla circonferenza $abs(xi-xi_0)>a$ + Affinchè le correnti siano asintoticamente uguali richiediamo che: $ lim_(xi arrow.r infinity)W(xi)=lim_(z arrow.r infinity) w(z)=lim_(z arrow.r infinity)(W(xi))/(d z slash d xi) $ Ciò si tradue nel chiedere che $(d z)/(d xi)=1$ Queste due ipotesi ci permettono di sviluppare in serie di Laurent con $c_n=0$ per $n>1$. Pertanto $ z(xi)=c_1 xi+c_0+(c_(-1))/xi+c_(-2)/xi^2+... $ ma $c_1=1$ poichè $lim_(z arrow.r infinity) (d z)/(d xi)=1$ Vogliamo capire se la trasformazione garantisce la validità delle condizioni al contorno di non compenetrabilità. Si prendano due punti $xi_1$ e $z_1$: vogliamo vedere come variano gli angoli da un piano all'altro. $ z_1+d z=z_1(xi_1+d xi)=z(xi_1)+lr((d z)/(d xi)|)_(xi=xi_1) d xi+... $ quindi $ d z=z_1+d z-z_1=lr((d z)/(d xi)|)_(xi=xi_1)d xi=b e^(i alpha)d xi $ Dunque la superficie ruota di un angolo $alpha$ passando dal piano di studio a quello fisico. Per la velocità invece $ w(z_1)=W(xi_1)/(d z slash d xi|_(xi=xi_1))=W(xi_1)/b e^(-i alpha) $ Pertanto la velocità complessa ruota di $-alpha$, ma dunque la velocità reale ruota di $+alpha$, in accordo con la superficie. La condizione di non compenetrazione rimane valida. Tale condizione è verificata per tutti i punti di analiticità del dominio fisico. Tuttavia, i profili sono dotati di un bordo d'uscita aguzzo al fine di imporre uan circolazione *sempre nello stesso verso* e costante. Vediamo cosa succede sul bordo d'uscita. $ w(z_(b u))=W(xi_(b u))/((d z)/(d xi)|_(xi=xi_(b u))) $ Tuttavia, per avere il bordo d'uscita spigoloso, la derivata al denominatore è nulla. Tuttavia, la velocità $w(z_(b u))$ in questo modo tenderebbe all'infito. Dobbiamo quindi bilanciare, imponendo che $ W(xi_(b u))=0 $ Dove $xi_(b u)$ è il punto di ristagno sul cilindro. Tale relazione prende il nome di *condizione di Kutta*. Dunque la condizione di Kutta ci dice anche che il bordo d'uscita è un *punto di ristagno* per il cilindro. Vogliamo capire cosa succede alla circolazione quando si passa al piano fisico. $ integral.cont w d z=integral.cont W(xi)/(d z slash d xi) (d z)/(d xi) d xi= integral.cont W(xi)d xi=Gamma+i Q $ Dunque per Kutta-Joukowsky la *portanza* è la stessa. Calcoliamo ora il *momento aerodinamico* sfruttando la II relazione di Blasius. Dobbiamo prima trovare il campo di moto nel piano di riferimento. $ W(xi)=U_infinity (1-a^2/xi^2)+Gamma/(2pi i xi) $ dobbiamo inserire un parametro per regolare l'incidenza del profilo. Per farlo, ruotiamo la velocità complessa e anche il SR. $ W(xi)=U_infinity (e^(-i alpha)-(a^2 e^(i alpha))/xi^2)+Gamma/(2pi i xi) $ Inoltre, non sapendo se il centro è nell'origine dobbiamo traslaro con $(xi-xi_0)$ dove $xi_0$ è il centro della circonferenza. $ W(xi)=U_infinity (e^(-i alpha)-(a^2 e^(i alpha))/(xi-xi_0)^2)+Gamma/(2pi i (xi-xi_0)) $ Ricordando Blasius $ M_a=-rho/2 "Re"{integral.cont w^2z d z}=-rho/2"Re"{integral.cont W(xi)/(d z slash d xi) z(xi) d xi} $ Ma $ z(xi)=xi+c_0+c_(-1)/2+c_(-2)/z^2+... $ Tuttavia la derivata è al denominatore e dobbiamo calcolare l'inversa di $z^'$: $ 1=z^'dot (z^')^(-1)=1+D_(-1)/xi-C_(-1)/xi^2+D_(-2)/xi^2+... $ Da cui si ottengono le condizioni $ cases(D_(-1)=0, -C_(-1)+D_(-2)=0 arrow.r.long D_(-2)=C_(-1)) $ Pertanto trascurando i termini di ordine superiore $ z^'=1+C_(-1)/xi+... $ Se vogliamo usare il teorema del residuo, tutte le espansioni devono essere centrate nello stesso punto. Dobbiamo scrivere $W(xi)$ come espansione centrata in $xi=0$ anzichè in $xi=xi_0$- Per farlo sfruttiamo la definizione della serie geometrica per $abs(t)<1$: $ 1/(1-t)=sum_(n=0)^infinity t^n " ; " " " 1/(1-t)^2=sum_(n=1)^infinity n t^(n-1) $ Nel nostro caso: $ 1/(xi-xi_0)=1/xi + xi_0/xi^2 +... $ $ 1/(xi-xi_0)^2 = 1/xi^2 +(2 xi)/xi^3 + ... $ Tornando al momento e aggiungendo questi termini per la traslazione ed espansione otteniamo dopo una serie di calcoli il seguente risultato: $ M_0=-rho/2"Re"{2 U_infinity Gamma e^(-i alpha)(xi_0+c_0)+4 pi i c_(-1) U_infinity e^(-2 i alpha)} $ \ \ \ \ \ == Trasformazione di Joukowsky Abbiamo ora tutti gli strumenti per determinare una trasformata conforme che ci consenta di passare da un piano analitico a quello fisico $ z=xi+l^2/xi $ La quale presenta una singolarità in $xi=0$. Pertanto, il cilindro nel piano $xi$ *deve contenere* l'origine in quanto vogliamo che all'esterno del cilindro il campo sia analitico. Vediamo cosa succede alla derivata, $ (d z)/(d xi)=1-l^2/xi^2=0 arrow.double.r.long xi=plus.minus l $ Il parametro $l$ rappresenta la distanza dei punti critici dall'origine. Sapendo che $ w(z)=W(xi(z))/(d z slash d xi|_(xi(z))) $ dobbiamo capire come è fatta $xi(z)$. Invertiamo $z(xi)$ $ z= (xi^2+l^2)/xi $ $ xi_(1,2)=(z plus.minus sqrt(z^2-4 l^2))/2 $ Ma nel campo complesso la radice quadrata è una funzione polidroma. Dobbiamo cercare i branch point che, in questo caso, sono la soluzione dell'equazione che annulla il radicando $ z^2-4 l^2=0 arrow.r z_(1,2)=plus.minus 2 l $ E' fondamental ora definire il *branch cut*, che deve necessariamente congiungere i due branch point. Se ciò on viene fatto è probabile che si giunga a risultati assurdi, legati al fatto che magari la funzione ha preso la soluzione sbagliata, dato che è polidroma. Se il branch cut va fuori dal corpo, si hanno delle discontinuità nella velocità complessa. Tipicamente si esegue un branch cut diretta tra i due branch point. E' possibile centrare il cilindro in diversi punti nel piano $xi$, affinchè siano soddisfatti i seguenti requisiti: + Essa deve contenere le singolarità $xi=0$; + Essa deve contenere o al più essere tangente alle singolarità legate all'annullamento dell derivata. Vi sono vari casi, di cui sono riportate le soluzioni: + Circonferenza con $x_0=0" , " a=l$ che risulta essere $ xi=2l cos(theta)$ + Circonferenza con $x_0=0" , " a>l$ risulta un ellisse con fuochi in $plus.minus 2 l$ l'ellisse tuttavia non presenta punti angolosi pertanto non è possibile imporre la condizione di Kutta e non è possibile definire $Gamma$ + Circonferenza traslata passante per $plus.minus l" , " xi_0=i h" , "a>l$ risulta essere un arco di circonferenza che descrive la linea media del profilo. L'arco di circonferenza ottenuto risulta essere un branch cut valido. \ \ \ \ == Calcolo della portanza di un profilo di Joukowsky Noi non cosnosciamo la circolazione sul cilindro in quanto non sappiamo dove si trovano i punti di ristagno. Dobbiamo fare in modo che tale punto critico sia imposto $ W(xi)=U_infinity (e^(-i alpha)-a^2/(xi-xi_0)^2 e^(i alpha))+Gamma/(2pi(xi-xi_0)) $ Ma noi vogliamo che $W(xi=l)=0$ Il vettore $+l$ può essere scritto come somma di due vettori $ l=xi_0+a e^(i theta r) $ dunque $ Gamma=-2pi i(l-xi_0)U_infinity (e^(-i alpha)-(a^2e^(i alpha))/(l-xi_0)^2)= $ $ Gamma=-4pi U_infinity a sin(alpha-theta_r) $ Dunque imponendo la condizione di Kutta abbiamo determinato la circolazion. $ L=-rho U_infinity Gamma= 4pi rho U_infinity^2a sin(alpha-theta_r) $ Possiamo poi ricavare il coefficiente di portanza $ C_L=2pi sin(alpha-theta_r) $ Per una lastra piana $theta_r=0$ quindi ad $alpha=0$ il $C_L=0$. Nel caso di un profilo simmetrico la circonferenza ha centro sull'asse reale e comprende al suo interno il punto critico $-l$. Definendo $m$ il centro della circonferenza $ A=-m-a=-2m-l $ $ z_(b a)=((-2m-l)^2+l^2)/(-2m-l)=-2 (2m^2+2m l+l^2)/(2m+l) $ Quindi $ c=-z_(b a)+2l=4 (m+l)^2/(2m+l) $ Possiamo quindi valutare il $C_L$ $ C_L=8pi (2m+l)/(4(m+l)^2) (m+l)sin(alpha-theta_r) $ $ C_L=2pi (2m+l)/(m+l) sin(alpha-theta_r) $ Questa soluzione vale per angoli piccoli. \ \ == Trasformazione di Karman-Trefftz L'utilità della trasformazione di Joukowsky termina con quanto fatto. Dobbiamo capire come trovare una trasformazione priva del bordo d'uscita aguzzo. La trasformazione di Joukowsky può essere scritta come $ (z-2l)/(z+2l)=(xi-l)^2/(x+l)^2 arrow.r.long (z-n l)/(z+n l)=(xi-l)^n/(xi+l)^n $ dove $ n=(2pi-tau)/pi $ Pertanto si aggiunge un ulteriore parametro che ci consente di fare un passo avanti. L'idea è quella di scomporre la trasformata in più trasformazioni intermedie. La prima trasformata viene scritta mediante *serie di Fourier*, in quanto essa consente facilmente di mappare la parte della circonferenza che non presenta criticità e consente di rappresentare bene ogni tipo di profilo. La parte critica del bordo d'uscita viene effettuata, invece, da *Karman-Trefftz*. Non possiamo mappare direttamente il profilo con K-T in quanto non si riuscirebbero a cogliere tutti i dettagli del profilo. Si noti che la trasformata di _Karman-Trefftz_ presenta un'ostilità legata al fatto che se n è razionale, compare sempre una radice e quindi la funzione è polidroma. Inoltre, se $n in R$ ed in particolare se n è irrazionale si hanno infinite soluzioni . Le trasformazioni conformi ci permettono di studiare precisamente la corrente esterna su qualsiasi profilo. Tuttavia, talvolta non è semplice ed immediato lo studio di un profilo. Vogliamo cercare una teoria che ci consenta, in modo approssimato, ci dia delle *indicazioni qualitative*.
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Atomic_Habits.typ
typst
#import "@preview/bubble:0.1.0": * #import "@preview/fletcher:0.4.3" as fletcher: diagram, node, edge #import "@preview/cetz:0.2.2": canvas, draw, tree, plot #import "@preview/cheq:0.1.0": checklist #import "@preview/typpuccino:0.1.0": macchiato, latte #import "@preview/wordometer:0.1.1": * #import "@preview/tablem:0.1.0": tablem #show: bubble.with( title: "Atomic_Habits", subtitle: "13/08/2024", author: "<NAME>", affiliation: "EPFL", year: "2024/2025", class: "Génie Mécanique", logo: image("JOJO_magazine_Spring_2022_cover-min-modified.png"), ) #set page(footer: context [ #set text(8pt) #set align(center) #text("page "+ counter(page).display()) ] ) #set heading(numbering: "1.1") #show: checklist.with(fill: luma(95%), stroke: blue, radius: .2em) = Chapter 1 - Start small, gradually - Getting 1% Better each day can acccumulate to an enormous amount of change #let style = (stroke: latte.text, fill: rgb(114, 135, 253, 75)) #let improve(x) = { calc.pow(1.01, x) } #let decrease(x) = { calc.pow(0.99, x) } #figure( canvas(length: 1cm, { plot.plot(size: (8, 6), x-tick-step: 100, x-ticks: ((0, 0), (365, 365)), y-tick-step: 3, { plot.add( style: style, hypograph: true, domain: (0, 365), improve) plot.add( style: style, hypograph: true, domain: (0, 365), decrease) }) }), caption: text("Improvement or regression by 1% per day over a year") )
https://github.com/TycheTellsTales/typst-pho
https://raw.githubusercontent.com/TycheTellsTales/typst-pho/main/tests/multipage/test.typ
typst
#import "../../lib.typ": pho #pho( viewer: "<NAME>", poster: "<NAME>", date: "January 1st 1001", endPage: 2, (topic, post) => { topic( title: "Hello World!", board: "Announcements", )[ Hello World!\ \ This is a post\ ] post("<NAME>")[ Reply 1 ] post("Foo")[ Reply 2 ] post("Bar")[ Reply 3 ] post("Qaz")[ Reply 4 ] post("Baz")[ Reply 5 ] post("<NAME>")[ Reply 6 ] post("Foo")[ Reply 7 ] post("Bar")[ Reply 8 ] post("Qaz")[ Reply 9 ] post("Baz")[ Reply 10 ] post("<NAME>")[ Reply 11 ] post("Foo")[ Reply 12 ] post("Bar")[ Reply 13 ] post("Qaz")[ Reply 14 ] post("Baz")[ Reply 15 ] })
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/truthfy/0.1.0/README.md
markdown
Apache License 2.0
# truthfy Make an empty or filled truth table in Typst # Functions ``` generate-empty(info: array[math_block], data: array[str]): table Create an empty (or filled with "data") truth table. generate-table(..info: array[math_block]): table Create a filled truth table. Only "not and or xor => <=>" are consider in the resolution. ``` # Example ```typ #import "@preview/truthfy:0.1.0": generate-table #generate-table($A and B$, $B or A$, $A => B$, $(A => B) <=> A$, $ A xor B$) #generate-table($p => q$, $not p => (q => p)$, $p or q$, $not p or q$) ``` ![image](https://media.discordapp.net/attachments/751591144919662752/1160216944138518588/image.png)
https://github.com/El-Naizin/cv
https://raw.githubusercontent.com/El-Naizin/cv/main/modules_zh/projects.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("项目与协会") #cvEntry( title: [志愿数据分析师], society: [ABC 非营利组织], date: [2019 - 现在], location: [纽约, NY], description: list( [分析捐赠者和筹款数据以识别增长的趋势和机会], [创建数据可视化和仪表板以向董事会传达洞见], [与其他志愿者合作开发和实施数据驱动的策略], [向董事会和高级管理团队提供定期的数据分析报告] ) )
https://github.com/mem-courses/discrete-mathmatics
https://raw.githubusercontent.com/mem-courses/discrete-mathmatics/main/homework/week7.typ
typst
MIT License
#import "../template.typ": * #import "../functions.typ": * #show: project.with( course: "Discrete Mathmatics", course_fullname: "Discrete Mathematics and Application", course_code: "211B0010", title: "Homework #7: Fundamentals of Combinatorial Counting", authors: (( name: "<NAME>", email: "<EMAIL>", id: "A10" ),), semester: "Spring-Summer 2024", date: "April 2, 2024", ) = 6.3 Permutations and Combinations #hw("20")[ How many bit strings of length 10 have (a) exactly three 0s? (b) more 0s than 1s? (c) at least seven 1s? (d) at least three 1s? ][ #parts( a: [ $display(n_1 = C(10,3) = (10 times 9 times 8)"/"(3 times 2 times 1) = 120)$. ], b: [ $display(n_2 = (2^10 - C(10,5))"/"2 = 386)$. ], c: [ $display(n_3 = C(10,7) + C(10,8) + C(10,9) + C(10,10) = 120 + 45 + 10 + 1 = 176)$. ], d: [ $display(n_4 = 2^10 - C(10,0) - C(10,1) - C(10,2) = 1024 - 1 - 10 - 45 = 968)$. ] ) ] #hw("44")[ Find a formula for the number of ways to seat $r$ of $n$ people around a circular table, where seatings are considered the same if every person has the same two neighbors without regard to which side these neighbors are sitting on. ][ Choose one position of the circular table as the starting point, and then label $n$ seats in clockwise order. Here we can transform the given problem into a linear seating problem: $ binom(n,r) $ And since all the people is distinguishable, it would be counted for multiple times if we shift people by the circle. So the number of ways need to divied by $r$, and the answer is: $ 1/r binom(n,r) $ ] #hw("46")[ How many ways are there for a horse race with four horses to finish if ties are possible? _Note_: Any number of the four horses may tie. ][ (1) No tie: $n_1 = 4! = 24$. (2) Two horses tie and two not: $n_2 = C(4,2) times 3! = 36$. (3) Two horses tie and two tie: $n_3 = C(4,2) times C(2,2) times 2! "/" 2! = 6 times 1 times 2 "/" 2 = 6$. (4) Three horses tie: $n_4 = C(4,3) times 2! = 4 times 2 = 8$. (5) All horses tie: $n_5 = C(4,4) = 1$. $n = n_1 + n_2 + n_3 + n_4 + n_5 = 75$. ] = 6.4 Binomial Coefficients and Identities #hw("18")[ Show that if $n$ is a positive integer, then $display(1 = binom(n,0) < binom(n, 1) < dots.c < binom(n, floor(n"/"2)) = binom(n, ceil(n"/"2)) > dots.c > binom(n,n-1) > binom(n,n) = 1)$. ][ $ binom(n,k+1) "/" binom(n,k) = (n!)/((k+1)! times (n-k-1)!) times (k! times (n-k)!)/(n!) = (n-k)/(k+1) $ So that when $display(k<floor(n/2))$, $display(binom(n,k+1) "/" binom(n,k) < 1)$; and when $display(k>ceil(n/2))$, $display(binom(n,k+1) "/" binom(n,k) > 1)$。 Especially, when $n$ is even, we have $display(ceil(n/2) = floor(n/2))$,so that $ binom(n,ceil(n"/"2)) = binom(n,floor(n"/"2)) $ When $n$ is odd, assume $k=display(floor(n/2))$, then $k+1=display(ceil(n/2))$. Thus, substitute $display(k=(n-1)/2)$ into the fraction, we can obtain that $ (n-k)/(k+1) = (n-(n-1)"/"2)/((n-1)"/"2 + 1) = (2n - (n-1))/((n-1) + 2) = (n+1)/(n+1) = 1 $ Therefore, the given inequality holds. ] #hw("26")[ Prove the identity $display(binom(n,r) binom(r,k) = binom(n,k) binom(n-k,r-k))$, whenever $n,r$, and $k$ are nonnegative integers with $r<=n$ and $k<=r$. ][ - #box(width: 100%)[ Proof by counting two times: Assume we have $n$ colored distinguishable balls. Among them, $k$ ones are red, $r-k$ ones are blue, and the remaining $n-r$ ones are white. Align these balls in one line and we can paint them in two ways: (i) Choose $r$ balls from $n$ balls, and paint the other balls white. Choose $k$ balls from these $r$ balls to paint them red, and paint the other balls blue. The number of ways is $C(n,r) C(r,k)$. (ii) Choose $k$ balls from $n$ balls to paint them red, and choose $r-k$ balls from the remaining $n-k$ balls to paint them blue, and eventually paint the remaining balls white. The number of ways is $C(n,k)C(n-k,r-k)$. ] - #box(width: 100%)[ Proof by algebra: $ binom(n,r) binom(r,k) &= (n!)/(r! (n-r)!) times (r!)/(k! (r-k)!) = (n!)/(k! (r-k)! (n-r)!) = (n! (n-k)!)/(k! (r-k)! (n-r)! (n-k)!)\ &= (n!)/(k! (n-k)!) times ((n-k)!)/(r! (r-k)!) = binom(n,k) binom(n-k,r-k) $ ] ] #hw("30")[ Let $n$ and $k$ be integers with $1<=k<=n$. Show that $ sum_(k=1)^n binom(n,k) binom(n,k-1) = 1/2 binom(2n+2,n+1) - binom(2n,n) $ ][ With the conclusion we proved in the *Exercise 29*, we can derive that $ 1/2 binom(2n+2, n+1) - binom(2n, n) = binom(2n, n+1) + binom(2n, n) - binom(2n, n) = binom(2n, n+1) $ According to the Vandermonde's identity, we have: $ binom(2n, n+1) = sum_(k=0)^(n+1) binom(n, k) binom(n, n+1-k) = sum_(k=1)^n binom(n, k) binom(n, n+1-k) = sum_(k=1)^n binom(n, k) binom(n, k-1) $ And that is exactly the left side of the equation we need to prove. Thus, the equation holds. ] #hw("34")[ Give a combinatorial proof that $display(sum_(k=1)^n k binom(n,k)^2 = n binom(2n-1,n-1))$. _Hint_: Count in two ways the number of ways to select a committee, with $n$ members from a group of $n$ mathematics professors and $n$ computer science professors, such that the chairperson of the committee is a mathematics professor. ][ Proof by counting in two ways: Assume that we have to select a committee with $n$ members from $n$ mathematics professors and $n$ computer science professors, and the chairperson of the committee must be a mathematics professor. (i) Select $k$ members from $n$ mathematics professors to join the committee and select $k$ members from $n$ computer science professors not to join the committee. In this way, the number of people in the committee is exactly $n$. And for the chairperson, we have $k$ choices from selected mathematics professors. The number of ways is $k dot C(n,k)^2$. (ii) Select one person from $n$ mathematics professors to join the committee and to be the chairperson; Then select $n-1$ members from the remaining $2n-1$ people. The number of ways is $n dot C(2n-1,n-1)$. Therefore, the two ways of counting are equal, and the equation holds. ] = 6.5 Generalized Permutations and Combinations #hw("10")[ A croissant shop has plain croissants, cherry croissants, chocolate croissants, almond croissants, apple croissants, and broccoli croissants. How many ways are there to choose (a) a dozen croissants? (b) three dozen croissants? (c) two dozen croissants with at least two of each kind? (d) two dozen croissants with no more than two broccoli croissants? (e) two dozen croissants with at least five chocolate croissants and at least three almond croissants? (f) two dozen croissants with at least one plain croissant, at least two cherry croissants, at least three chocolate croissants, at least one almond croissant, at least two apple croissants, and no more than three broccoli croissants? ][ #parts( a: [$n_1 = C(12+6-1,6-1) = C(17,5) = 6,188$.], b: [$n_2 = C(3 times 12+6-1,6-1) = C(41,5) = 376,992$.], c: [$n_3 = C(2 times 12-2 times 6 +6-1,6-1) = C(17,5) = 6,188$.], d: [$n_4=C(29,5) - C(24-3+6-1,5)=C(29,5)-C(26,5)=52,975$.], e: [$n_5=C(24+6-1-5-3,5)=C(21,5)=20,349$.], f: [$n_6=C(24+6-1-1-2-3-1-2,5)-C(24+6-1-1-2-3-1-2-4,5)=C(20,5)-C(16,5)=11,136$.] ) ] #hw("16")[ How many solutions are there to the equation $ x_1+x_2+x_3+x_4+x_5+x_6=29 $ where $x_i,space i=1,2,3,4,5,6$, is a nonnegative integer such that (a) $x_i>1$ for $i=1,2,3,4,5,6$? (b) $x_1>=1, x_2>=2, x_3>=3, x_4>=4, x_5>5$ and $x_6>=6$? (c) $x_5<=5$? (d) $x_1<8$ and $x_2>8$? ][ #parts( a: [ First assign $1$ to each $x_i$, then distribute the remaining $23$ using the stars and bars method: $ n_1 = binom(22, 5) = 26,334 $ ], b: [ First assign $0,1,2,3,5,5$ to $x_1,x_2,x_3,x_4,x_5,x_6$ and then use the stars and bars methods: $ n_2=binom(12,5)=792 $ ], c: [ The answer is the total number of schemes minus the the number of schemes where the condition is not met (i.e., when $x_5>5$): $ n_3 = binom(29+6-1,6-1) - binom(29+6-1-6,6-1) = binom(34,5) - binom(28,5) = 179,976 $ ], d: [ First insure that $x_2>8$, the answer is equal to the total number of schemes with ensurement minus the total number of schemes with ensurement but where the condition $x_1<8$ is not met: $ n_4 = binom(29+6-1-9,6-1) - binom(29+6-1-9-8,6-1) = binom(25,5) - binom(17,5) = 46,942 $ ] ) ] #hw("28")[ How many positive integers less than $1,000,000$ have exactly one digit equal to $9$ and have a sum of digits equal to $13$? ][ Discuss in cases of the nonzero digits: (1) ${9,4}$: $n_1=C(6,2) dot A(2,2) = 30$. (2) ${9,3,1}$: $n_2=C(6,3) dot A(3,3) = 120$. (3) ${9,2,2}$: $n_3=C(6,3) dot A(3,3) "/" A(2,2) = 60$. (4) ${9,2,1,1}$: $n_4=C(6,4) dot A(4,4) "/" A(2,2) = 180$. (5) ${9,1,1,1,1}$: $n_5=C(6,5) dot A(5,5) "/" A(4,4) = 30$. In conclusion, the total number of possible integers is $n=n_1+n_2+n_3+n_4+n_5 = 420$. ] #hw("34")[ How many different strings can be made from the letters in _AARDVARK_, using all the letters, if all three $A$s must be consecutive? ][ Regard three $A$s as a group to shuffle with other letters. The number of strings is: $ n=(A_6^6)/(A_2^2 A_1^1 A_1^1 A_1^1 A_1^1) = (720)/2=360 $ ] #hw("48")[ A shelf holds 12 books in a row. How many ways are there to choose five books so that no two adjacent books are chosen? _Hint_: Represent the books that are chosen by bars and the books not chosen by stars. Count the number of sequences of five bars and seven stars so that no two bars are adjacent. ][ The number of ways is equal to divide 12 books into 6 consecutive intervals where only the last interval can be empty, and we choose the last book from the first five group to be the chosen books. Thus we can count the ways by the stars and bars method: $ n = binom(13-1+1-5,6-1) = binom(7,5) = 56 $ ] #hw("52")[ How many ways are there to distribute five distinguishable objects into three indistinguishable boxes? ][ Discuss in cases of the distribution of number of items in each box. (1) {5}: $n_1=C(5,5)=1$. (2) {4,1}: $n_2=C(5,4) dot C(1,1) = 5$. (3) {3,2}: $n_3=C(5,3) dot C(2,2) = 10$. (4) {3,1,1}: $n_4=C(5,3) dot C(2,1) dot C(1,1)"/"2! = 10$. (5) {2,2,1}: $n_5=C(5,2) dot C(3,2) dot C(1,1)"/"2! = 15$. In conclusion, the total number is $n=n_1+n_2+n_3+n_4+n_5=41$. ] #hw("56")[ How many ways are there to distribute five indistinguishable objects into three indistinguishable boxes? ][ As we listed in *Exercise 52*, there are a total of 5 ways. ] #hw("63")[ Suppose that a weapons inspector must inspect each of five different sites twice, visiting one site per day. The inspector is free to select the order in which to visit these sites, but cannot visit site $X$, the most suspicious site, on two consecutive days. In how many different orders can the inspector visit these sites? ][ The number of ways to visit each site twice is: $ n_1=(A_10^10)/(A_2^2 dot A_2^2 dot A_2^2 dot A_2^2 dot A_2^2) = 113,400 $ And the number of ways to visit the site $X$ in two consecutive days: $ n_2=(A_9^9)/(A_2^2 dot A_2^2 dot A_2^2 dot A_2^2) = 22,680 $ In conclusion, the number of ways is $n=n_1-n_2=90,720$. ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/layout-infinite-lengths_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // #set page(width: auto, height: auto) // // // Error: 58-59 cannot expand into infinite width // #layout(size => grid(columns: (size.width, size.height))[a][b][c][d])
https://github.com/AHaliq/CategoryTheoryReport
https://raw.githubusercontent.com/AHaliq/CategoryTheoryReport/main/chapters/appendix.typ
typst
#import "../preamble/lemmas.typ": * #import "../preamble/catt.typ": * #import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge #pagebreak() = Appendix $ &"isCategory"(Ob(""), Hom("")) =& &forall f,g in Hom(""). cod(f) = dom(g) => g comp f in Hom("") \ &&and& forall X in Ob(""). exists! 1_X in Hom("",s:X,t:X) \ &&and& forall h,g,f. h comp (g comp f) = (h comp g) comp f \ &&and& forall f. f comp 1_dom(f) = f = 1_cod(f) comp f \ &"isFunctor"(arr(F,C,D)) =& &forall f in Hom(C,s:A,t:B). F(f) in Hom(D,s:F(A),t:F(B)) \ &&and& forall 1_X in Hom(C,s:X,t:X). F(1_X) = 1_(F(X)) \ &&and& forall g,f in Hom(C). F(g comp f) = F(g) comp F(f) \ &"isIso"(arr(f,A,B)) =& &exists! g. g comp f = 1_A and f comp g = 1_B \ & A iso B = & &exists (arr(f,A,B)). "isIso"(f) \ & C times D = & &(Ob(C) times Ob(D), [(C_1,D_1), (C_2,D_2) |-> Hom(C,s:C_1,t:C_2) times Hom(D,s:D_1,t:D_2)]) \ & op(C) = & &(Ob(C), [A,B |-> {f^(-1) | f in Hom(C,s:A,t:B) }]) \ & C^(->) = & &(Hom(C), [f,f' |-> {(g,g') | g' comp f = f' comp g}]) \ & slice(C,A) = & &({X | Hom(C,s:X,t:A) cancel(=) emptyset}, Hom(C)) \ & coslice(C,A) = & &({X | Hom(C,s:A,t:X) cancel(=) emptyset}, Hom(C)) \ & "isMono"(f) =& &f comp g = f comp h => g = h \ & "isEpi"(f) =& &g comp f = h comp f => g = h \ & "isSplitMono"(m,s) =& &s comp m = 1_dom(m) \ & "isSplitEpi"(e,s) =& &e comp s = 1_cod(e) \ & "areIso"(f,g) =& &"isSplitEpi"(f,g) and "isSplitMono"(f,g) \ & "isProjective"(P) =& &forall epi(e,E,X), arr(f,P,X). exists arr(overline(f),P,E). e comp overline(f) = f \ \ & "UMP"_"freemonoid" (|overline(f)|) =& &forall i,f. exists! overline(f). |overline(f)| comp i = f \ &"UMP"_"terminal" (0_X) =& &forall X. exists! 0. 0_X in Hom("",s:0,t:X) \ &"UMP"_"initial" (1_X) =& &forall X. exists! 1. 1_X in Hom("",s:X,t:1) \ &"UMP"_"product" (p_1,p_2) =& &forall x_1, x_2. exists! u. x_1 = p_1 comp u and x_2 = p_2 comp u \ &"UMP"_"coproduct" (q_1,q_2) =& &forall x_1, x_2. exists! u. x_1 = u comp q_1 and x_2 = u comp q_2 \ &"UMP"_"equalizer" (e,f,g) =& &forall z. (f comp z = g comp z) and exists! u. e comp u = z \ &"UMP"_"coequalizer" (q,f,g) =& &forall z. (z comp f = z comp g) and exists! u. u comp q = z \ &"UMP"_"pullback" (p_1,p_2,f,g) =& & (f comp p_1 = g comp p_2) \ &&and& forall z_1, z_2. exists! u. z_1 = p_1 comp u and z_2 = p_2 comp u \ &"UMP"_"limit" ({p_i}, D) =& &forall {c_j}. exists! u. forall j. p_j comp u = c_j \ &"isExponential"(C^B, epsilon) =& &forall A, (arr(f,A times B, C)). exists! (arr(tilde(f),A,C^B)). epsilon comp (tilde(f) times 1_B) = dash(tilde(f))=f \ &"isCCC"(Ob(""), Hom("")) =& &"isCategory"(Ob(""), Hom("")) \ &&and& forall A,B. exists! A times B. "UMP"_"product" (arr(p_1,A times B, A), arr(p_2,A times B, B)) \ &&and& forall B,C. "isExponential"(C^B, epsilon) \ $ TODO LIST: list of functors: $|-|, (-)^A, Hom("",s:A,t:-), Hom("",s:-,t:A)$ and all abstract category constructors as functors; dual, arrow, slice, etc. todo in chapter4 notes - $(f)^A = tilde(f comp epsilon)$ - define Sub and Cone category
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/011%20-%20Journey%20into%20Nyx/005_The%20Path%20or%20the%20Horizon.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Path or the Horizon", set_name: "Journey into Nyx", story_date: datetime(day: 07, month: 05, year: 2014), author: "<NAME>", doc ) Zosimos walked along the dirt path that meandered around the border of the ancient woods and welcomed the cool of the shade from the tall trees. The sun was bright against the blue sky as he breathed in the fresh air, thick with the smell of spring blossoms. Then a thought crept into his awareness like a Nessian asp. It slithered around his mind and began to tighten its coils. Glory and honor. What if he never achieved anything? What if he died having never gained the favor of the gods? There were many heroes in the land, and all of them burned with the desire to please Iroas, Heliod, or Nylea. Some heroes had gained recognition, some were venerated in the temples. Their feats had been so amazing and inspiring that it made Zosimos sick just to think of it. Even if he had the chance, he felt like he would never be as great as those heroes, with their magical weapons and godly favor. Where would he find such gifts? Zosimos couldn't tear his attention away from this dilemma. It ached in his heart like a thorn. A bird sang as clear and as pure as a dryad. A golden lizard scurried across a stone, its skin glinting in the sun like a jewel, but Zosimos saw none of it, and heard only his own troubled mind. The bright world became dull, his steps heavier, as he continued his journey, weighted by his thoughts. "You want to be a hero?" a voice said. Zosimos almost jumped out of his clothes. "Who said that?" Zosimos spun around and drew his sword. "Show yourself!" A stout satyr hopped onto the path from a thick shrub and put his hands on his hairy haunches. He looked at Zosimos, squinted his eyes, and pursed his lips in study of him. "Yep. You want to be a hero. I've been watching you for a while, human. You have that worried look about you." #figure(image("005_The Path or the Horizon/01.jpg", width: 100%), caption: [Satyr Rambler | Art by John Stanko], supplement: none, numbering: none) "I'm not worried," Zosimos said. "I'm thinking... about serious things. Probably something you wouldn't understand, you being a satyr and all." "Fiddle faddle," the satyr said, then looked up and scratched his chin. "Although I can't say that I have worried a day in my life, truth be told. Actually, that's the first thing a hero needs to do." "Worry or not worry?" Zosimos asked. "It looks like you need some lessons. Sit down. Let me tell you a few things." The satyr sat in front of Zosimos. Zosimos sheathed his sword and sat on a nearby rock. The satyr looked youthful and old at the same time, with a playful glint in his eye and a bouncy demeanor, but underneath it all Zosimos could sense something else he couldn't put his finger on. "Your garden is full of weeds," the satyr said. "What garden? I don't even have a garden," Zosimos said, confused. "Your garden." The satyr poked Zosimos's head. "Full of weeds." The satyr sat back against the trunk of a small poplar tree. "And you're trying to grow a rare flower in there. Isn't going to work." The satyr took out a slender pipe, packed and lit it. He looked at Zosimos from under his bushy eyebrows. "Smoke?" "No. Thank you," Zosimos said. "Worry is Phenax's creation, a great paralytic to rival Pharika's most virulent poison, except worry affects the mind, not the muscles." The satyr flexed his arm as he let out a long trail of smoke. "You want to know something? When you worry, you're actually worshipping Phenax. Worry gives him great pleasure, did you know that?" Zosimos shook his head. "Oh. I guess I may as well tell you." The satyr leaned in and whispered. "When you worship Phenax, you spurn Iroas." #figure(image("005_The Path or the Horizon/02.jpg", width: 100%), caption: [Temple of Deceit | Art by Raymond Swanland], supplement: none, numbering: none) "By the gods," Zosimos said. "I never thought of it that way." "Don't get all caught up in it. Worry is the just the weed, but its root, ah, well, now that's worth getting at." "The root?" Zosimos asked. "Have you heard about the coinsmiths of the Underworld?" The satyr asked. "Only what the books and philosophers say." "Books and philosophers," the satyr said with a sigh. "They'll keep you from finding anything out for yourself, but that's beside the point. Deep in the Underworld, there exists a class of coinsmiths. But these are no ordinary coinsmiths. They mint coins for use in the Underworld. Now, because it is everywhere in the Underworld, gold is of little value. What the Underworld values are coins, #emph[ostraka] , made of simple clay—but not just any clay, they are struck from the clay funerary masks of those who have died." #figure(image("005_The Path or the Horizon/03.jpg", width: 100%), caption: [Underworld Coinsmith | Art by Mark Winters], supplement: none, numbering: none) "Why are clay funerary masks so valuable?" "They are valuable because a representation of who you were in life is carved into the mask, and Erebos, although he would never admit it, covets the world of the living above all else. He can never return to the land of the living, so, out of spite, he forbids anyone to return without paying a dire price." Zosimos remembered the many funerals he had seen over his life. The funeral masks flashed before his eyes, some simple, some extravagant, all of them attempting to encapsulate an entire life in a single expression. The satyr continued. "Now, you would think that a great hero's mask, or the mask of a king, would be more valuable than all the others. I mean, important people have such magnificent masks. But, at the shores of the River next to the coinsmiths, the masks of kings and heroes are mixed in with beggars, fools, and bandits. Erebos cares little for what you were in life. He only cares that you once existed." Zosimos imagined the mysterious coinsmiths, chiseling #emph[ostraka] from the masks, stacking them in great piles for the denizens of the Underworld. "Erebos is the great equalizer. He seals us within the Underworld, from which there is no return, unless we wish to forge a new identity and become one of the Returned. Any fool can see what a ghastly mistake that is." Zosimos had seen a Returned once, wandering, soulless, moaning. The memory of it still sent a chill down his spine. The satyr could see the young man's disquiet. "Before you make a judgment, Erebos is giving us a hint, a vital clue to the essence of truth." "What truth? Erebos is terrifying, merciless." "Erebos is making us find out what is truly valuable." The satyr plucked and twirled a flower by its stem, making the blossom spin in his fingers. "No matter how much we strut and crow and adorn ourselves with rank, status, and titles, it all becomes a worthless clay mask in the end. We can't take our pride or possessions with us to the Underworld. It's all useless there. So what to do, what to do?" #figure(image("005_The Path or the Horizon/04.jpg", width: 100%), caption: [Weight of the Underworld | Art by Wesley Burt], supplement: none, numbering: none) The satyr looked at Zosimos. "I don't know," Zosimos said. "That, my friend," said the satyr, pointing the flower at Zosimos, "is an excellent place to start." "Consider that it's not about what is carved into a mask or a statue," the satyr said. "The living have little use for dead things. Perhaps it's about what you leave behind. And what does a true hero leave behind? Stability, peace, a flourishing world, a place for everyone to grow. A hero is not concerned with a death mask or a fancy title or property, a hero is concerned with the flowering of goodness in all its forms." "The flowering of goodness," Zosimos repeated. The satyr gave a nearby vine a tug. An amber sap dripped from its stem. "Put this on your tongue," the satyr said. Zosimos touched his tongue to the golden droplet. A taste unlike any other gently tingled in his mouth, a mellow sweetness expanded and filled his nose with berries, earth, and wine. "That's amazing," Zosimos said. #figure(image("005_The Path or the Horizon/05.jpg", width: 100%), caption: [Font of Fertility | Art by Jack Wang], supplement: none, numbering: none) "The world is good, my boy." The satyr smiled. "That's it. This whole creation is a garden and humans are caught up in ideas, concepts, 'glory'—whatever that is—and they are missing everything: the spring breeze, singing, dancing, and the taste of nectarvine. A hero brings this awareness to the people and defends them from harm so that they can weed their own part of the garden." "I think I understand," Zosimos said. The nectarvine still warmed his insides. "That sword of yours is a good one, but you might need a knife as well." The satyr handed Zosimos a dull, rusty knife that looked as if it had been used to cut stones from a quarry. "When a hero is awakened, all manner of things come from the darkness to snuff out the hero's light. You can never be too vigilant." Zosimos took the blade out of politeness and stuck it in his belt. The satyr got up, tapped out his pipe and brushed off his rump. "Farewell, hero. It's a beautiful day." He skipped off into the woods like a deer. Zosimos sat on the stone for a while and felt the breeze blow across his skin. The warmth of the sun heated the ground and he could smell the earth and the grass. There were monsters in the world, and terrible gods, but it all felt in balance somehow, and Zosimos knew what part he was going to play in the great dance of creation. He knew that goodness burned within the core of his being. He knew himself. He stood up and walked down the path that extended out before him like a thread on the loom of fate. He was headed to Meletis, but after the encounter with the satyr, something in him had shifted. He had transformed. As he walked, he felt more and more drawn to the eastern horizon until he could bear it no further, and turned off the path. The long grass brushed along his legs as he followed the feeling that pulled him to the mountains far in the distance. Zosimos had no idea what lay in those mountains. All he knew was the feeling in his body, in his bones, that spoke to him without words. He had followed his troubled thoughts for too long, thoughts of fear and doubt, the seeds of Phenax. Now he followed his destiny. As he crested the first of many rolling hills that lay before him, he felt a flash of heat at his hip followed by a blinding light. He looked down to see that the satyr's dagger had become a shining sword forged by the gods.
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/MATLAB/光电系统集成/2.typ
typst
#import "@preview/touying:0.2.1": * #import "template.typ": * #let s = themes.simple.register(s, aspect-ratio: "16-9", footer: [Harbin Engineering University]) #let s = (s.methods.enable-transparent-cover)(self: s) #let (init, slide, slides, title-slide, centered-slide, focus-slide,touying-outline) = utils.methods(s) #show: init #let faAward = icon(data.icon.faAward) #let faBuildingColumns = icon(data.icon.faBuildingColumns) #let faCode = icon(data.icon.faCode) #let faEnvelope = icon(data.icon.faEnvelope) #let faGithub = icon(data.icon.faGithub) #let faGraduationCap = icon(data.icon.faGraduationCap) #let faLinux = icon(data.icon.faLinux) #let faPhone = icon(data.icon.faPhone) #let faWindows = icon(data.icon.faWindows) #let faWrench = icon(data.icon.faWrench) #let python = icon(data.icon.python) #let haiyang = icon(data.icon.haiyang) #let themeColor = rgb(46, 49, 124) #let head_main=info( color: black, ( icon: haiyang, content:"海洋水质监测系统", content1:"开题报告" ) ) // #align(left+top,image("icon/校标.png",width: 15em)) #slide[ #v(-1.8em) // #h(1em) #image("icon/校标.png",width: 10em) #align(center+horizon, text(size: 35pt)[ #head_main ]) #v(0.5em) #align(center,[ #for c in data.成员 [ #text(font: "FangSong",size: 0.75em)[#c #h(0.6em) ] ] #v(-0.7em) // #h(-6.8em) #for c in data.成员1 [ // #h(3.4em) #text(font: "FangSong",size: 0.75em)[#c #h(0.6em) ] ] ] ) ] #set heading(numbering: "1.") #set text(font: "FangSong",size: 0.8em) #show heading.where(level: 2):set text(themeColor, 0.9em,font: "Microsoft YaHei") // 小标题样式 #show heading.where(level: 1):set text(themeColor, 1.5em,font: "Microsoft YaHei") // 二级标题下加一条横线 #show heading.where(level: 2): it => stack( v(0.3em), it, v(0.6em), // line(length: 100%, stroke: 0.05em + themeColor), line(length: 100%,stroke: (paint: themeColor, thickness: 0.06em, dash: "dashed")), v(0.1em), ) #centered-slide(section: [背景及意义]) // #centered-slide() // = 11111 #slide[ == 背景 // section: [Let's start a new section!] 大碗大碗大碗大碗单位的护卫的部位百度的的微博杜比五点八五东北部的动物的难忘的五年的为你耽误你耽误你电脑wind难忘的的女巫的你晚点问低洼低洼逗你玩逗你玩的单位i的那位年底我年底你的单位i的那位i的那位i耽误你的那位你的 11111 #footnote([11111111111111]) ] #focus-slide[ _Focus!_ This is very important. ] #centered-slide(section: [Let's start a new section!]) #slide[ == Dynamic slide Did you know that... #pause ...you can see the current section at the top of the slide? ]
https://github.com/Isaac-Fate/booxtyp
https://raw.githubusercontent.com/Isaac-Fate/booxtyp/master/src/index.typ
typst
Apache License 2.0
// Copyright 2023 <NAME>, <NAME> // Use of this code is governed by the License in the LICENSE.txt file. // For a 'how to use this package', see the accompanying .md, .pdf + .typ documents. // Classes for index entries. The class determines the visualization // of the entries' page number. #let classes = (main: "Main", simple: "Simple") // Index Entry; used to mark an entry in the document to be included in the Index. // An optional class may be provided. #let index( content, // The text of the entry shown in the index page // If this is not provided, the content is used entry: none, // Optional class for the entry. class: classes.simple, ) ={ locate( loc => { // Override the content with the entry text if provided let content = if entry != none { entry } else { content } // Convert the content to lowercase // let content = lower(content) [#metadata((class: class, content: content, location: loc.position(), loc: loc))<jkrb_index>] }, ) [ *#content* ] } #let index-main( content, // Optional class for the entry. class: classes.main, ) = { locate( loc => [#metadata((class: class, content: content, location: loc.position(), loc: loc))<jkrb_index>], ) } /// Create the index page. #let make-index(title: none, outlined: false) = { // This function combines the text(s) of a content. let content-text(content) = { let ct = "" if content.has("text") { ct = content.text } else { for cc in content.children { if cc.has("text") { ct += cc.text } } } return ct } locate( loc => { let elements = query(<jkrb_index>, loc) let words = (:) for el in elements { let ct = content-text(el.value.content) // Have we already know that entry text? If not, // add it to our list of entry words if words.keys().contains(ct) != true { words.insert(ct, ()) } // Add the new page entry to the list. // let ent = (class: el.value.class, page: el.value.location.page) let ent = ( class: el.value.class, page: el.value.location.page, page-number: counter(page).at(el.value.loc).first(), ) if not words.at(ct).contains(ent) { words.at(ct).push(ent) } } // Sort the entries. let sortedkeys = words.keys().sorted() // Output. let register = "" if title != none { heading(outlined: outlined, numbering: none, title) } for sk in sortedkeys [ // Use class specific formatting for the page numbers. #let formattedPageNumbers = words.at(sk).map(en => { if en.class == classes.main { link((page: en.page, x: 0pt, y: 0pt))[#strong[#en.page]] } else { link((page: en.page, x: 0pt, y: 0pt))[*#en.page-number*] } }) // The first character of the entry // It should be uppercase #let firstCharacter = upper(sk.first()) #if firstCharacter != register { heading(level: 2, numbering: none, outlined: false, firstCharacter) register = firstCharacter } #sk #box(width: 1fr) #formattedPageNumbers.join(", ") ] }, ) } #let index-page(title: [Indices]) = { // The title of the index page heading(numbering: none)[#title] // Two column-layout columns(2)[ #make-index() ] }
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/lib/draw.typ
typst
Other
#import "/template/theme.typ": theme, choose #let state-size = state("size", none) #let state-start = state("tart", none) #let state-unit = state("unit", none) #let make-relative = ((w, h), (sx, sy)) => ((x, y)) => ( (x - sx) / w * 100%, 100% - (y - sy) / h * 100%, ) #let make-relative-to = rel => (a, b) => { let ra = rel(a) let rb = rel(b) ra.zip(rb).map(((a, b)) => a - b) } #let with-rel = (f) => context { let rel = make-relative(state-size.get(), state-start.get()) f(rel) } #let with-unit = (f) => context { let unit = state-unit.get() f(unit.at(0), unit.at(1)) } #let txt = (t, p, size: none, anchor: "cc", dx: 0, dy: 0) => context { let rel = make-relative(state-size.get(), state-start.get()) let final-txt = if size != none { text(size: size, t) } else { t } let (x, y) = rel((p.at(0) + dx, p.at(1) + dy)) let (width: w, height: h) = measure(final-txt) let d = ( lt: (0pt, 0pt), lc: (0pt, -h/2), lb: (0pt, -h), ct: (-w/2, 0pt), cc: (-w/2, -h/2), cb: (-w/2, -h), rt: (-w, 0pt), rc: (-w, -h/2), rb: (-w, -h), ).at(anchor) place(dx: x + d.at(0), dy: y + d.at(1), final-txt) } #let point = ( p, radius: 10, color: theme.main, thickness: 1pt, dash: none, fill: true, need-txt: false, size: none, anchor: "cc", dx: 0, dy: 0, ) => context { let rel = make-relative(state-size.get(), state-start.get()) let rel-to = make-relative-to(rel) let (x, y) = p let (w, h) = rel-to((radius, radius), (0, 0)).map(calc.abs) if need-txt { let t = "(" + str(x) + ", " + str(y) + ")" txt(t, p, size: size, anchor: anchor, dx: dx, dy: dy) } let (u, v) = rel((x, y)) place(dx: u - w, dy: v - h, ellipse( width: 2 * w, height: 2 * h, fill: if fill { color } else { none }, stroke: stroke( paint: color, thickness: thickness, dash: dash, ), )) } #let segment = (start, end, stroke: 1pt + theme.main) => context { let rel = make-relative(state-size.get(), state-start.get()) place(line(start: rel(start), end: rel(end), stroke: stroke)) } #let shape = (..args) => context { let rel = make-relative(state-size.get(), state-start.get()) let rel-to = make-relative-to(rel) let points = args.pos().map(point => { if type(point.at(0)) == array { if point.len() == 1 { rel(point.at(0)) } else if point.len() == 2 { let (p, c) = point (rel(p), rel-to(c, p)) } else if point.len() == 3 { let (p, c1, c2) = point (rel(p), rel-to(c1, p), rel-to(c2, p)) } else { panic("Unknown point format") } } else { rel(point) } }) place(path(..points, ..args.named())) } #let rect = (start, width: 0, height: 0, end: none, radius: 0, shadow: none, ..args) => context { let (ux, uy) = state-unit.get() let rel = make-relative(state-size.get(), state-start.get()) let rel-to = make-relative-to(rel) let (width, height) = if end != none { rel-to(end, start) } else { (width * ux, height * uy) } let radius = radius * ux; let (x, y) = start let (rx, ry) = rel(start) if shadow != none { let dx = shadow.at("dx", default: 3) let dy = shadow.at("dy", default: -3) let darken = shadow.at("darken", default: 50%) let fill = shadow.at("fill", default: args.named().at("fill")).darken(darken) let (sx, sy) = rel((x + dx, y + dy)) place(left + top, dx: sx, dy: sy, rect(stroke: none, width: width, height: height, radius: radius, fill: fill)) } let user-args = args.named() if user-args.at("fill", default: none) == none { if "stroke" not in user-args { user-args.insert("stroke", 1pt + theme.main) } } place(left + top, dx: rx, dy: ry, rect(width: width, height: height, radius: radius, ..user-args)) } #let bezier = (start, c1, c2, end, stroke: 1pt + theme.main) => { shape( closed: false, stroke: stroke, (start, start, c1), if c2 == none { end } else {( end, c2, end, )}, ) } #let arrow-head = (point, size, theta: 0deg, color: theme.main, point-at-center: false) => { let center = if point-at-center { point } else { let (ex, ey) = point (ex + size * calc.cos(180deg + theta), ey + size * calc.sin(180deg + theta)) } let (cx, cy) = center let (t, r, l) = for c in range(0, 3) { let alpha = theta - 120deg * c ((cx + size * calc.cos(alpha), cy + size * calc.sin(alpha)),) } shape(t, r, center, l, stroke: none, fill: color, closed: true) } #let arrow = ( start, end, relative: false, stroke: 1pt + theme.main, head-scale: 1.0, ) => with-unit((ux, uy) => context { let ((ex, ey), (rx, ry)) = if relative { (end.zip(start).map(((a, b)) => a + b), end) } else { (end, end.zip(start).map(((a, b)) => a - b)) } let theta = calc.atan2(rx, ry) let size = stroke.thickness.to-absolute() / ux * head-scale; let center = ( ex + size * calc.cos(180deg + theta), ey + size * calc.sin(180deg + theta), ) segment(start, center, stroke: stroke) arrow-head((ex, ey), size, theta: theta, color: stroke.paint) }) #let mesh = (start, end, step, stroke: 1pt + theme.main) => { let (sx, sy) = start let (ex, ey) = end let (dx, dy) = step for x in range(sx, ex + dx, step: dx) { segment((x, sy), (x, ey), stroke: stroke) } for y in range(sy, ey + dy, step: dy) { segment((sx, y), (ex, y), stroke: stroke) } } #let to-absolute = (l, all) => { if type(l) == relative { l.ratio * all + l.length } else if type(l) == ratio { l * all } else { l } } #let calc-real-size = (cw, ch, width, height, f) => layout(size => { let width = width; let height = height; if width == none and height == none { panic("must give one of width or height") } if type(width) != length { width = to-absolute(width, size.width) } if type(height) != length { height = to-absolute(height, size.height) } if width != none and height == none { height = width / cw * ch } else if height != none and width == none { width = height / ch * cw } f(width, height) }) #let tiny-block = block.with( breakable: false, fill: none, stroke: none, radius: 0pt, spacing: 0pt, inset: 0pt, outset: 0pt, clip: false, ) #let canvas = (end, body, start: (0, 0), width: none, height: none, clip: false) => { let (cw, ch) = end.zip(start).map(((a, b)) => a - b) calc-real-size( cw, ch, width, height, (rw, rh) => tiny-block(width: rw, height: rh, clip: clip, { let rel = make-relative((cw, ch), start) let rel-to = make-relative-to(rel) let r = rel-to((1, 1), (0, 0)).map(calc.abs) let unit = (r.at(0) * rw, r.at(1) * rh) state-start.update(start) state-size.update((cw, ch)) state-unit.update(unit) let (cw, ch) = end.zip(start).map(((a, b)) => a - b) tiny-block(width: 100%, height: 100%, body) }), ) }
https://github.com/hewliyang/fyp-typst
https://raw.githubusercontent.com/hewliyang/fyp-typst/main/related-work.typ
typst
#set heading(numbering: "1.") = Related Work (Part I) The main goal of this work is to investigate the feasibility and potential pitfalls of utilizing neural networks as predictors for subjective scores, primarily MOS-N or MOS for naturalness of synthetic speech. Given a dataset $D = {(x_i,y_i)}_(i=1)^N$ where $x_i$ represents the input speech signal and $y_i in {1,2,3,4,5}$ is corresponding MOS for speech naturalness, we aim to train a neural network $f_theta (x_i)$ such that the predicted score $hat(y)_i = f_theta (x_i)$ minimises the loss $ cal(L)(theta) = 1 / N sum_(i=1)^N cal(L)(hat(y)_i, y_i) $ where $cal(L)$ is the loss function which in this case can be a choice of cross entropy or MSE loss. == Evaluation Preamble In TTS evaluations, metrics such as the MOS can be calculated at different granularities. For our investigations, we define them as at the stimulus or system level. === Stimulus Level In this apporach, the MOS is calculated for each stimulus (i.e. each audio sample) seperately. If we have multiple listeners evaluating a single stimulus, we would take the mean score for that stimulus. Let: - $x_(i,j)$ be the score given by the $j$-th rather for the $i$-th stimulus - $m_i$ be the MOS for the $i$-th stimulus - $n_i$ be the number of listeners for the $i$-th stimulus. Then the MOS for stimulus $i$ is defined as: $ m_i = 1 / n_i sum_(j=1)^n_i x_(i,j) $ === System Level At the system level, the MOS is calculated across all stimuli for a given TTS system, i.e., it aggregates scores across multiple stimuli and listeners to get an overall system score. Let: - $N$ be the total number of stimuli - $m_i$ be the mean score for the $i$-th stimulus from above - $n_"total" = sum_(i=1)^N n_i$ be the total number of scores across all stimuli and listeners Then, the system-level MOS is: $ M_"system" = 1 / n_"total" sum_(i=1)^N sum_(j=1)^n_i x_(i,j) $ == MOSNet MOSNet @Lo_2019 is a deep learning based model designed for assessment of voice conversion (VC) systems, particularly on predicting the MOS of synthesized speech. The model primarily leverages three neural network architectures for feature extraction: CNN's, Bidirectional Long Short Term Memory (BLSTM) and a combination of CNN-BLSTM. MOSNet follows our formulation above. Interestingly, MOSNet takes a linear spectrogram (direct output of STFT) as input and outputs a floating point number in $[1,5]$, and is trained on a linear combination of regular MSE loss and a frame-level MSE regression objective, i.e. $ L(theta) = 1 / N sum_(i=1)^N {(hat(y)_i - y_i)^2 + alpha / T_n sum_(i=1)^(T_n) (hat(q)_(n,i) - y_i)^2} $ where: - $hat(q)_(i,n)$ denotes the frame level prediction at time $i$ - $T_n$ denotes the total number of frames in the $n$-th sample - $N$ is the number of training samples - $alpha$ is a hyperparameter controlling the impact of the frame-level MSE on the overall loss In particular, - The CNN employs 12 convolutional layers to capture temporal information within a 25-frame segment, which is about a 400ms window of the input spectrogram - The BSLTM, which utilizes a configuration identical to Quality-Net (cite) captures long-term dependencies and sequential characteristics in speech through its bidirectional nature. The authors conducted ablation studies to investigate performance switching the frame-level MSE objective with a regular MSE objective and found that it significantly improved prediction accuracy from a PRCC at the utterance level of 0.560 against the ground truth to 0.642. MOSNet was trained and evaluated using a dataset from the Voice Conversion Challenge (VCC) 2018. The dataset comprised of MOS-N assessments for 20,580 utterances. The train-test-split was: - 13,580 for training - 3,000 for evaluation - 4,000 for testing All samples were downsampled to 16 kHz before STFT with: - `sr` = 16,000 - `n_fft` = 512 - `hop_length` = 256 Training was done with the following hyperparameters: - Learning rate of $1e-4$ - Dropout rate of 0.3 - Early stopping with 5 epochs patience on vanilla MSE of validation set Evaluations show that MOSNet performs remarkably at the system-level with a PRCC of 0.957 on the held-out test set at the system-level, but poorly on the stimuli-level with only 0.642 against ground truths. The authors attribute this discrepancy to variance in listener perception for each stimuli. The authors claim that the model generalizes to unseen data by providing evidence that testing on the VCC 2016 dataset, a PRCC of 0.917 was obtained at the system-level. == NISQA NISQA for assessing synthetic speech MOS the work of @Mittag_2020, and is not be confused with their later work under the same name @Mittag_2021. Like MOSNet, NISQA also utilizes a CNN-BiLSTM framework but later in @Mittag_2021 introduces a self-attention architecture, replacing the BiLSTM module to better capture temporal interactions. In contrast to MOSNet, NISQA utilises mel spectrograms instead of linear spectrograms. They are divided into 150ms segments with 10ms hop length which are fed into the CNN encoder. The encoder output for each segment is a 20-dimensional feature vector which is then used as input for a bidirectional LSTM or self-attention network. Each framewise prediction is then average-pooled at the final output layer. Assuming a $f_s$ of 16 kHz, the mel spectrograms are firstly created using the following parameters: - `n_mels` = 48 - `n_fft` = 4048 - `win_length` = 320 - `hop_length` = 160 NISQA introduces a far larger training corpus compared to MOSNet, incorporating data from the 2008 to 2019 Blizzard Challenge @king2008blizzard @king2009blizzard @king2010blizzard @king2011blizzard @king2012blizzard @king2013blizzard @prahallad2014blizzard @prahallad2015blizzard @king2016blizzard @wu2019blizzard, in addition to VCC 2016 @toda2016voice and 2018 @lorenzotrueba2018voiceconversionchallenge2018. The additional datasets that were used were PhySyQX @7336888 for testing, and three in house TU Berlin / Kiel University German datasets for both training and testing. The datasets combined cover 12 different languages, primarily English, German, Chinese and dialects from India. Interestingly, NISQA also introduced the usage of an pretraining dataset - which is unreleased. This set consisted of 100,000 stimuli based on 5,000 English and German speech files on which distortions were augmented into in order to simulate artifacts in synthesized speech. As these stimuli did not have labels, the authors utilized the objective metric, Perceptual Objective Listening Quality Analysis (POLQA), which is an evolution of PESQ as a proxy for MOS. The model was firstly trained on the pre-training dataset for 24 epochs, after which full parameter fine tuning or transfer learning was done on the actual training set. The train-test split was not done randomly in this case. The entire training process utilized the Adam optimizer at a learning rate of $1e-3$ with a regular MSE objective. - Train set includes Blizzard Challenges 2008 to 2019 ad VCC 2018 Training sets - Validation set included subtasks from Blizzard Challenges 2008, 2009, 2010, 2012 and 2016 that were unused in the train set, and VCC 2018 Validation - Test set included VCC 2016, PhySyQX and two in-house German sets In particular, the authors wanted to use VCC 2016 as a direct comparison to MOSNet, which similarly used it as an out-of-distribution test. In terms of results, NISQA demonstrates similar behavior to MOSNet with spectacular system-level PRCC's (0.89) but still suffers from moderate correlation to ground truths at the stimuli-level (0.65) across the test set. On VCC 2016 however, NISQA with transfer learning outperforms MOSNet with a system-level correlation of 0.96 compared to 0.92. The authors conduted ablations and found that the model without pre-training achieves a similar correlation of 0.93. Note that the results claimed were computed based on the earlier CNN-BiLSTM architecture.
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/layout/page_setup.md
markdown
MIT License
# Page setup > See [Official Page Setup guide](https://typst.app/docs/guides/page-setup-guide/) ```typ #set page( width: 3cm, margin: (x: 0cm), ) #for i in range(3) { box(square(width: 1cm)) } ``` ```typ #set page(columns: 2, height: 4.8cm) Climate change is one of the most pressing issues of our time, with the potential to devastate communities, ecosystems, and economies around the world. It's clear that we need to take urgent action to reduce our carbon emissions and mitigate the impacts of a rapidly changing climate. ``` ```typ #set page(fill: rgb("444352")) #set text(fill: rgb("fdfdfd")) *Dark mode enabled.* ``` ```typ #set par(justify: true) #set page( margin: (top: 32pt, bottom: 20pt), header: [ #set text(8pt) #smallcaps[Typst Academcy] #h(1fr) _Exercise Sheet 3_ ], ) #lorem(19) ``` ```typ #set page(foreground: text(24pt)[🥸]) Reviewer 2 has marked our paper "Weak Reject" because they did not understand our approach... ```
https://github.com/angelcerveraroldan/notes
https://raw.githubusercontent.com/angelcerveraroldan/notes/main/abstact_algebra/notes/groups/intro.typ
typst
#import "../../../preamble.typ" : * #import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge #let iso = $tilde.equiv$ #let nsub = $lt.tri.eq$ == Quotient groups One way to define quotient groups, is by using a group homomorphism. Let $G$ be some group, and define some $psi : G -> H$ homomorphism. For any $g in G$, we have some $h = psi g in H$, however, there may exists another $g' in G - {g}$ such that $psi g' = psi g$. We will define the set $G_h$ as every $g in G$ such that $phi g = h$. We will call this partitionng the _fiber above $h$_, or the _$h$ fiber_. $ G_h = { g in G | phi g = h} $ Now, we can show that the set of all fibers of $G$ as a group, which we will denote with $G \/ ker(phi)$ using $phi$ to get its binary operation. Let $h, h' in H$, then we can operate its fibers as follows: $ G_h times G_(h') = G_(h h') $ #lemma([ For any $g in G$, every element in $G_(phi g)$ by $g k$ for some $k in ker phi$. $ G_(phi g) = g ker phi = {g k | k in ker phi} $ ]) #proof([ Take some element $h in H$, and its fiber $G_h$. Now take $g, hat(g) in G_h$, we claim that $G_h = g ker phi$, meaning that $hat(g) = g k$ for some $k in ker phi$. $ phi hat(g) = phi g <==> phi (inv(g)) phi (hat(g)) = 1 <==> phi (inv(g) hat(g)) = 1 <==> inv(g) hat(g) = k in ker phi <==> hat(g) = g k $ ]) We can also see that all fibers must have the exact same size. Take some $g in G_h$, then we know that $G_h = g ker phi$. If we fix said $g$, we can create a mapping from the kernel to $G_h$ as follows $k |-> g k$. This is bijection, since we know that $g ker phi = G_h$. Therefore, they must have the same size, so we know that the size of $G$ is some multiple of the size of the kernel of $phi$. == Normal Subgroups #def(title:"Normal Subgroups", [ Let $N <= G$, then the following are equivalent: + $N nsub G$ + $N_G(N) = G$ + $forall g in G$ we have that $g N = N g$ + $g N inv(g) subset.eq N$ ]) From the above, we can see that if $N <= G$, then $N$ is normal iff there exists some homomorphism $phi$ such that $ker phi = N$, so an intuitive way to think about this, is that $N nsub G$ if $N = G_(phi g)$ for some $g in G$
https://github.com/jassielof/typst-templates
https://raw.githubusercontent.com/jassielof/typst-templates/main/upsa-bo/tesis/template/tesis.typ
typst
MIT License
// #import "../lib.typ": * // #show: tesis.with( // facultad: "Facultad de Ingeniería", // carrera: "Ingeniería de Sistemas", // modalidad: "Proyecto de Grado", // titulo: "Título del trabajo\n(máximo 15 palabras)", // nombres: "Nombres", // apellidos: "Apellidos", // registro: str(datetime.today().year()) + "123456", // year: datetime.today().year() // ) // = Introducción // #lorem(500)
https://github.com/maucejo/book_template
https://raw.githubusercontent.com/maucejo/book_template/main/template/appendix/app2.typ
typst
MIT License
#import "../../src/book.typ": * #show: chapter.with( title: "Fondements mathématiques", toc: false ) #lorem(100) $ #boxeq($bold(y)_(k + 1) = bold(C) space.thin bold(x)_(k + 1)$) $ #nonumeq($ y(x) = f(x) $) La Figure @fig:B #figure( image("../images/chapitre1/cnam_region.png", width: 75%), caption: [#lorem(10)], ) <fig:B> La Figure @b3 présente la carte du Cnam. #subfigure( figure(image("../images/chapitre1/cnam_region.png"), caption: []), figure(image("../images/chapitre1/cnam_region.png"), caption: []), <b3>, columns: (1fr, 1fr), caption: [(a) Left image and (b) Right image], label: <fig:subfig3>, )
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/wedges-rebuild/brainstorm.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #show: create-body-entry.with( title: "Brainstorm: Wedges Rebuild", type: "brainstorm", date: datetime(year: 2023, month: 11, day: 29), author: "<NAME>", witness: "<NAME>", ) After brainstorming we came up with several designs for full length wedges. All three options involve some sort of plastic cover. Plastic is super easy to manipulate into the right shape we want, making it the ideal surface for wedges. = Options #grid( columns: (2fr, 3fr), gutter: 20pt, [ == Rebuild Wedge to use Plastic The wedge could be completely rebuilt to use plastic over supports. #pro-con(pros: [ - Low complexity - Easy to tune ], cons: [ - Hard to design - Hard to fabricate ]) ], image("./complete-lexan.svg"), [ == Add Plastic to Existing Wedges Plastic could be added between existing wedges to create a pushing surface. #pro-con(pros: [ - Low complexity - Easy to fabricate - Easy to design ], cons: [ - Hard to tune ]) ], image("./lexan-over-old.svg"), [ == Create Plastic Flap to Aid Existing Wedges A plastic flap could be used to aid the wedges without having to lift the bot. #pro-con(pros: [ - Easy to fabricate - Easy to design - Easy to optimize ], cons: [ - High complexity ]) ], image("./flap-over-old.svg"), )
https://github.com/typst-community/valkyrie
https://raw.githubusercontent.com/typst-community/valkyrie/main/src/schemas.typ
typst
Other
#import "schemas/author.typ": author #import "schemas/enumerations.typ": papersize
https://github.com/piepert/grape-suite
https://raw.githubusercontent.com/piepert/grape-suite/main/src/elements.typ
typst
MIT License
#import "colors.typ": * #let unbreak(body) = { set text(hyphenate: false) body } #let important-box(body, title: none, time: none, primary-color: magenta, secondary-color: magenta.lighten(90%), tertiary-color: magenta, dotted: false, figured: false, counter: none, show-numbering: false, numbering-format: (..n) => numbering("1.1", ..n), figure-supplement: none, figure-kind: none) = { if figured { if figure-supplement == none { figure-supplement = title } if figure-kind == none { panic("once paramter 'figured' is true, parameter 'figure-kind' must be set!") } } let body = { if show-numbering or figured { if counter == none { panic("parameter 'counter' must be set!") } counter.step() } set par(justify: true) show: align.with(left) block(width: 100%, inset: 1em, fill: secondary-color, stroke: (left: (thickness: 5pt, paint: primary-color, dash: if dotted { "dotted" } else { "solid" })), text(size: 0.75em, strong(text(fill: tertiary-color, smallcaps(title) + if show-numbering or figured { [ ] + context numbering(numbering-format, ..counter.at(here())) + h(1fr) + time }))) + block(body)) } if figured { figure(kind: figure-kind, supplement: figure-supplement, body) } else { body } } #let standard-box-translations = ( "task": [Task], "hint": [Hint], "solution": [Suggested solution], "definition": [Definition], "notice": [Notice!], "example": [Example], ) #let task = important-box.with( title: context state("grape-suite-box-translations", standard-box-translations).final().at("task"), primary-color: blue, secondary-color: blue.lighten(90%), tertiary-color: purple, figure-kind: "task", counter: counter("grape-suite-element-task")) #let hint = important-box.with( title: context state("grape-suite-box-translations", standard-box-translations).final().at("hint"), primary-color: yellow, secondary-color: yellow.lighten(90%), tertiary-color: brown, figure-kind: "hint", counter: counter("grape-suite-element-hint")) #let solution = important-box.with( title: context state("grape-suite-box-translations", standard-box-translations).final().at("solution"), primary-color: blue, secondary-color: blue.lighten(90%), tertiary-color: purple, dotted: true, figure-kind: "solution", counter: counter("grape-suite-element-solution")) #let definition = important-box.with( title: context state("grape-suite-box-translations", standard-box-translations).final().at("definition"), primary-color: magenta, secondary-color: magenta.lighten(90%), tertiary-color: magenta, figure-kind: "definition", counter: counter("grape-suite-element-definition")) #let notice = important-box.with( title: context state("grape-suite-box-translations", standard-box-translations).final().at("notice"), primary-color: magenta, secondary-color: magenta.lighten(90%), tertiary-color: magenta, dotted: true, figure-kind: "notice", counter: counter("grape-suite-element-notice")) #let example = important-box.with( title: context state("grape-suite-box-translations", standard-box-translations).final().at("example"), primary-color: yellow, secondary-color: yellow.lighten(90%), tertiary-color: brown, dotted: true, figure-kind: "example", counter: counter("grape-suite-element-example")) #let sentence-logic(body) = { show figure.where(kind: "example"): it => { show: pad.with(0.25em) grid(columns: (1cm, 1fr), column-gutter: 0.5em, counter(figure).display("(1)"), it.body) } body } #let sentence = figure.with(kind: "example", supplement: context state("grape-suite-element-sentence-supplement", "Example").final()) #let blockquote(body, source) = pad(x: 1em, y: 0.25em, body + block(text(size: 0.75em, source)))
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/type_check/bug_cite_func_infer.typ
typst
Apache License 2.0
#let cite_prose(labl) = ref(labl) #let cite_prose_different_name(labl) = ref(labl)
https://github.com/jamesrswift/frackable
https://raw.githubusercontent.com/jamesrswift/frackable/main/src/lib.typ
typst
The Unlicense
#import "impl.typ": frackable, generator
https://github.com/HiiGHoVuTi/requin
https://raw.githubusercontent.com/HiiGHoVuTi/requin/main/fonc/lc-nuls-old.typ
typst
#import "../lib.typ": * #show heading: heading_fct #import "@preview/gloss-awe:0.0.5": gls #show figure.where(kind: "jkrb_glossary"): it => {it.body} #import "@preview/curryst:0.3.0": rule, proof-tree #correct[ // TODO(Juliette): corriger cet exo Cet exercice se fait sans trop de difficulté, une correction sera proposée ultérieurement. ] Soit $cal(V)$ un ensemble de variables puis $Lambda$ la plus petite #gls(entry: "Classe")[classe] contenant: #align(center, grid(columns: (1fr, 1fr, 1fr), [- $x$ pour $x in cal(V)$], [- $lambda x. u$ pour $u in Lambda$], [- $u v$ pour $u, v in Lambda$] )) Par convention, $x y z eq.triple (x y)z$. On définit les ensembles $"BV"$ (pour variables liées) et $"FV"$ (pour variables libres) tels que: #align(center, grid(columns: (1fr, 1fr, 1fr), [- $"BV"(x) = emptyset$ pour $x in cal(V)$], [- $"BV"(lambda x. u) = "BV"(u) union {x}$ pour $u in Lambda$], [- $"BV"(u v) = "BV"(u) union "BV"(v)$ pour $u, v in Lambda$] )) #align(center, grid(columns: (1fr, 1fr, 1fr), [- $"FV"(x) = {x}$ pour $x in cal(V)$], [- $"FV"(lambda x. u) = "FV"(u) \\ {x}$ pour $u in Lambda$], [- $"FV"(u v) = "FV"(u) union "FV"(v)$ pour $u, v in Lambda$] )) #question(0)[ Quelles sont les variables libres et liées des termes suivants ? #align(center, grid(columns: (1fr, 1fr, 1fr, 1fr), [- $lambda x. x$], [- $lambda f. lambda x. f (f x)$], [- $lambda f. lambda x. f (f x y) y$], [- $lambda x. f (lambda f. f (f x))$] ))] On souhaite que $lambda x. u$ corresponde à `fun x -> u` en `OCaml`, et que $u v$ corresponde à `u v`. On note $u[x := v]$ la substitution dans $u$ de $x$ par $v$. _Par exemple_, $(f (x f x))[x := lambda y. y] eq.triple f ((lambda y. y) f (lambda y. y))$. #question(1)[Expliquer pourquoi simplement remplacer toutes les instances de la variable substituée ne suffirait pas à garantir le comportement attendu.] #question(1)[Proposer un algorithme renommant les variables libres _et_ liées d'un terme. _Par exemple_, ($x lambda x. x arrow.squiggly x lambda y. y$). ] #question(1)[En déduire un algorithme de substitution approprié.] #question(2)[Proposer une relation d'équivalence déterminant si deux termes sont les mêmes, au renommage près. On l'appellera _$alpha$-équivalence_.] On prendra désormais la convention qu'aucun terme ne contient de variables libres et liées, quitte à étudier un terme $alpha$-équivalent. #question(0)[Définir un algorithme de substitution plus simple, sous cette nouvelle hypothèse.] On pose $cal(R) := beta union eta$ avec #align(center, [$beta := {(lambda x. u)v arrow.squiggly u[x := v], u,v in Lambda, x in cal(V)}$ \ $eta := {lambda x. u x arrow.squiggly u, u in Lambda, x in cal(V)}$ ]) Et enfin, la _contraction_ \"$-->$\" #align(center, grid(columns: (1fr, 1fr), proof-tree(rule($u --> v$, $u arrow.squiggly v in cal(R)$, name: "Contraction")), proof-tree(rule($lambda x. u --> lambda x. v$, $u --> v$, name: $xi$)), [\ ],[\ ], proof-tree(rule($u w --> v w$, $u --> v$, name: "Congruence gauche")), proof-tree(rule($w u --> w v$, $u --> v$, name: "Congruence droite")), )) On note \"$arrow.twohead$\" la fermeture transitive et réflexive de \"$-->$\". On note \"$arrow.twohead.l arrow.twohead.r$\" la fermeture transitive, symétrique et réflexive de \"$-->$\". On dit qu'un terme est _réduit_ lorsqu'aucune règle ne s'applique plus. #pagebreak() #question(0)[ Réduire les termes suivants #align(center, grid(columns: (1fr, 1fr, 1fr), [- $lambda y. (lambda x. x)z$], [- $(lambda f. lambda x. f (f x))(lambda x. x)$], [- $(lambda f. lambda x. f (f x))(lambda f. lambda x. f x)$], ))] #question(2)[ Démontrer les sécants suivants #align(center, grid(columns: (1fr, 1fr), proof-tree(rule($lambda x. u arrow.twohead lambda x. v$, $u arrow.twohead v$)), proof-tree(rule($u v arrow.twohead w x$, $u arrow.twohead w$, $v arrow.twohead x$)) )) ] Une _forme normale_ $u$ de $v$ est telle que $u$ est irréductible et que $u arrow.twohead.l arrow.twohead.r v$. #question(1)[ Déterminer une forme normale des termes suivants #align(center, grid(columns: (1fr, 1fr, 1fr), [- $lambda x. x$], [- $(lambda x. lambda y. x) v w$], [- $(lambda x. lambda y. x v) w$ \ \ ], [- $lambda x. lambda y. x y w$], [- $(lambda x. x x) (lambda x. x x)$], [- $(lambda x. lambda y. y)(lambda x. x x)(lambda x. x x)$], )) ] On pose $cal(C) : NN -> Lambda$ telle que #align(center, grid(columns: (1fr, 1fr), [$cal(C)(0) = lambda x. x$], [$cal(C)(n+1) = lambda f. lambda x. f (cal(C)(n)f x)$] )) #question(0)[Que fait le terme $cal(C)(n)$ ?] #question(1)[Donner $cal(A) in Lambda$ tel que si $n,m in NN$, $cal(A)(cal(C)(n), cal(C)(m))=cal(C)(n+m)$.] #question(1)[Donner $cal(M) in Lambda$ tel que si $n,m in NN$, $cal(M)(cal(C)(n), cal(C)(m))=cal(C)(n times m)$.] #question(2)[Donner $cal(P) in Lambda$ tel que si $n in NN$, $cal(P)(cal(C)(n))=cal(C)(max(0, n-1))$.] On propose la construction suivante des booléens: $#true := lambda t. lambda f. t$, $#false := lambda t. lambda f. f$. #question(0)[Décrire la construction de $"if" in Lambda$.] #question(2)[Décrire la construction de $cal(X)(a,b) in Lambda$ qui représenterait la paire $a in Lambda$, $b in Lambda$.] #question(1)[En déduire la construction d'une structure de liste chaînée.] On suppose disposer de $"eq" in Lambda$ représentant l'égalité d'entiers. #question(3)[Implémenter un automate déterministe fini.] #question(3)[Implémenter une machine de Turing. (_chronophage_)]
https://github.com/Doublonmousse/pandoc-typst-reproducer
https://raw.githubusercontent.com/Doublonmousse/pandoc-typst-reproducer/main/color_issues/rotate.typ
typst
#square( fill: red.rotate(30deg) )
https://github.com/VisualFP/docs
https://raw.githubusercontent.com/VisualFP/docs/main/Presentations/Concept4/concept04.typ
typst
#import "@preview/polylux:0.3.1": * #set page(paper: "presentation-16-9", margin: (x: 1cm, y: 0.5cm)) #set text(size: 18pt) #polylux-slide[ #align(horizon + center)[ = Visual FP === Concept 04 ] ] #polylux-slide[ = Setup #v(1fr) 1. Take an exercise #v(1fr) 2. Solve it using the proposed concept step by step, including the thinking process \ (How do we want students to think about programs?) #v(1fr) 3. Compare it to a Haskell Solution #v(1fr) 4. Conclusion #v(1fr) ] #polylux-slide[ = Exercise #v(1fr) I've chosen project euler problem 6, as it seems simple to implement using just list and numeric operations. #v(1fr) #box(inset: 1cm, width: 100%, stroke: 1pt, radius: 15%, fill: rgb("e4e5ea"))[ == Project Euler Problem 6 The sum of the squares of the first ten natural numbers is, $ 1^2 + 2^2 + ... + 10^2 = 385 $ The square of the sum of the first ten natural numbers is, $ (1 + 2 + ... + 10)^2 = 55^2 = 3025 $ Hence, the difference between the sum of the squares of the first ten natural numbers, and the square of the sum is $3025 - 385 = 2640$. Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. ] #v(1fr) ] #polylux-slide[ = Mathematical Solution #v(1fr) $ "projectEuler6"(x) = (sum^x_(i=1) i)^2 - (sum^x_(i=1) i^2) $ #v(1fr) This helped me to get a feel for the problem. It shows that the problem: - Consists of 2 parts - that share some components such as: - Summing of the same sequence - Squaring #v(1fr) ] #let element_of_interest(path, width: 130pt) = image(path, width: width) #let state(name, number, description, top_right: []) = polylux-slide[ #block(height: 250pt, width: 100%, align(horizon, image("static/" + str(number) + ".png", width: 620pt))) #box(height: 130pt, width: 100%, align(horizon, description)) #place(top + right, top_right, dx: -1cm, dy: 1cm) ] #let explanation_step(explanation) = polylux-slide(explanation) #state([Start], 0, [ The exercise starts with the function definition. I would imagine some kind of type editor to appear first, where the user needs to define the type of value he wants to define. In this case, the required function has the type `Int -> Int,` which is also the type of the first type-hole. ]) #state([], 1, [ Next, we need to refine the input, since we likely can't solve the exercise using a pointless function. The $lambda$ block is colored in red; the parameter we can now use is colored in blue. _Note:_ I feel like semantic coloring really helps to get a feel for what is going on. I also often use the different colors an IDE uses to portray different identifiers when I show something to the apprentices, and they seem to catch on to colors pretty quickly. E.g., an interface is yellow, and since you can't instantiate an interface, you 'can't `new` anything in yellow'. ], top_right: element_of_interest("static/lambda.png", width: 130pt)) #explanation_step[ #v(1fr) Some thoughts before we proceed: #v(1fr) - We know that the goal is to calculate two types of sums. #v(1fr) - And we know that both sums have some components in common: - The sequence of numbers ($1,2,3,...$) - A square operation #v(1fr) - So we'll solve these problems first. #v(1fr) _Note:_ I could also have solved these parts as separate definitions, but in this case, I wanted to push the concept and see what happens when we build complex expressions. #v(1fr) ] #state([], 2, [ To define the sequence of numbers and use it in multiple expressions, a `let` expression comes in handy. I would suggest that after a `let` expression has been placed, a type editor comes up similar to the one used to define the function. In this case, `[Int]` has been chosen as the required type. Below it, the original type-hole appears again, but now we can use the newly defined value. ], top_right: element_of_interest("static/let_be_in.png", width: 130pt)) #state([], 3, [ To define the sequence, we need some kind of value generator. Since we can't use the syntactic sugar of Haskell, we'll need to use more basic constructs. One approach is to use the `iterate` generator to define an infinite sequence and then cap it with the `take` function. Thus, we'll start the definition by inserting the `take` function into the type-hole. ], top_right: element_of_interest("static/take.png", width: 90pt)) #state([], 4, [ The sequence must be `n` numbers long, so insert the `n` parameter into the first type-hole. ], top_right: element_of_interest("static/param_n.png", width: 50pt)) #state([], 5, [ As already mentioned, the infinite sequence can be created by using the `iterate` function, so we'll insert that into the second type-hole of `take`. The `iterate` function takes two parameters: - A function that computes the next values based on the previous - A starting value ], top_right: element_of_interest("static/iterate.png", width: 140pt)) #state([], 6, [ Since our target sequence is ascending, we insert the `plus` function into the first type-hole of `iterate` to calculate a value based on a sum of the previous value and a constant. ], top_right: element_of_interest("static/plus.png", width: 120pt)) #state([], 7, [ That constant is `1`. The same goes for the starting value of `iterate`, the second type-hole of `iterate`. ], top_right: element_of_interest("static/literal_1.png", width: 40pt)) #state([], 8, [ Before going into the definition of the sums, we can define another value used by both: The square function. Again, this can be solved using a let expression, this time of the type `Int -> Int`. Without sugar, we need to define the second `let` expression as a nested expression to the first `let`. To avoid making it more complicated than it needs to be, I assumed we'll find a way to combine multiple `let` values into a single expression. (This could be a point of discussion later on). ]) #state([], 9, [ The 'deduction' system (I know it's not deduction, but I forgot how you called it) rolls up the parameters from right to left, but we need to parameter to be the first argument of a power function (e.g. `x` in `x,y`). Thus, we need to refine the value using a $lambda$ block. ]) #state([], 10, [ Next, we can insert the `pow` function. ], top_right: element_of_interest("static/pow.png", width: 100pt)) #state([], 11, [ And supply `x` as the first parameter and the constant `2` as the second. ]) #state([], 12, [ Now, we can proceed to implement the difference of the sums. As a first step, we'll insert the `minus` function into the type-hole to subtract the two sums. ], top_right: element_of_interest("static/minus.png", width: 100pt)) #state([], 13, [ The first sum is the square of the sum of the sequence, so we'll insert the `pow2` function into the first type-hole. ], top_right: element_of_interest("static/pow2_param.png", width: 70pt)) #state([], 14, [ Then, the `sum` function. ], top_right: element_of_interest("static/sum.png", width: 80pt)) #state([], 15, [ Then, supply the `ns` captured by the first `let` expression. _Note:_ This part seemed very intuitive. ], top_right: element_of_interest("static/ns_param.png", width: 50pt)) #state([], 16, [ The second sum is the sum of the squared values. So we'll begin with the `sum` function. ], top_right: element_of_interest("static/sum.png", width: 80pt)) #state([], 17, [ Next, we need to transform all values in the sequence into their squared value. This is done using the common `map` function. ], top_right: element_of_interest("static/map.png", width: 120pt)) #state([], 18, [ Then, we can insert the `ns` value from the first `let` expression. ], top_right: element_of_interest("static/ns_param.png", width: 50pt)) #state([], 19, [ And finally the previously defined `pow2` function fits perfectly into the first hole to complete the exercise. ], top_right: element_of_interest("static/pow2_param.png", width: 70pt)) #polylux-slide[ = Haskell Solution #v(1fr) We can do the same exercises in Haskell. By using the syntactic sugar to the fullest, we might end up with something like this: #v(1fr) ```hs projectEuler6 :: Int -> Int projectEuler6 n = squareOfSum - sumOfSquares where squareOfSum = sum [1..n] ^ 2 sumOfSquares = sum [ x^2 | x <- [1..n] ] ``` #v(1fr) I think that the Haskell solution is much more readable, but I am also used to text-based programming. #v(1fr) Additionally, we could add the same sugar into VisualFP to come to a similar result, but I guess we would then miss the point of being a teaching tool. #v(1fr) ] #polylux-slide[ = Haskell Solution #v(1fr) A more direct comparison would be if we would compare the result with a Haskell program that does not make extensive use of syntactic sugar. A more direct comparison could be made with e.g. this Haskell program: #v(1fr) ```hs projectEuler6 :: Int -> Int projectEuler6 n = let ns = take n (iterate (+1) 1) pow2 = (\x -> x^2) in (pow2 (sum ns)) - (sum (map pow2 ns)) ``` #v(1fr) Compared to this program, I feel like the proposed concept doesn't look too bad. #v(1fr) ] #polylux-slide[ = Conclusion #v(1fr) While portraying the concept, I noticed the following things: #v(1fr) - The concept guides the user through the process of defining a function \ (it somewhat follows the _'function design recipe'_) #v(1fr) - The concept is not too verbose, or at least doesn't add much more verbosity compared to Haskell #v(1fr) - It may be hard to define functions without the possibility of 'playing with them' while defining them, as you would in Haskell using GHCi. \ We could replicate this experience using something like using a 'try-me' button. #v(1fr) - We need to carefully choose which 'sugar' we want to add: Too much and we make it too complicated, too little and it gets too verbose. #v(1fr) ]
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/PianoDiProgetto/sections/ConsuntivoSprint/DecimoSprint.typ
typst
MIT License
#import "../../const.typ": Re_cost, Am_cost, An_cost, Ve_cost, Pr_cost, Pt_cost #import "../../functions.typ": rendicontazioneOreAPosteriori, rendicontazioneCostiAPosteriori, glossary ==== Decimo consuntivo *Inizio*: Venerdì 23/02/2024 *Fine*: Giovedì 29/02/2024 #rendicontazioneOreAPosteriori(sprintNumber: "10") #rendicontazioneCostiAPosteriori(sprintNumber: "10") ===== Analisi a posteriori La retrospettiva ha evidenziato come sia il preventivo del totale delle ore per ruolo sia quello per persona, siano stati rispettati. Il gruppo, infatti, si è reso conto di aver lavorato particolarmente bene, riuscendo a portare a termine tutte le task assegnate impiegando meno tempo rispetto a quanto preventivato. A monte di questo traguardo il team ha riscontrato le seguenti motivazioni: - Una migliore spartizione delle task: più dettagliata e con degli assegnamenti più consapevoli, che tenessero conto degli impegni privati della persona; - Una comunicazione più chiara e più frequente: soprattutto tra i Progettisti, i quali hanno completato la prima stesura del documento della _Specifica Tecnica_, lavorandoci contemporaneamente tutti e quattro; - Una miglior idea delle fonti di informazioni da utilizzare per auto apprendere argomenti sconosciuti, grazie al riscontro proveniente dalla Proponente e dal Professor Cardin. Riprendendo le considerazioni del precedente #glossary[sprint], l'uso di #glossary[stand-up meeting] come strumento di mitigazione del rischio RC1 continua a funzionare in modo efficace. ===== Aggiornamento della pianificazione e gestione dei rischi Il gruppo dichiara di voler iniziare a dedicare al progetto un numero di ore produttive più ampio rispetto a quanto avvenuto fino a questo punto, cercando di arrivare ad una media di 10 ore per ciascun componente in ogni #glossary[sprint], in modo da riuscire ad allocare un giusto numero di risorse allo sviluppo dell'#glossary[MVP]. È stata presa coscienza del fatto che il cercare di variare gli orari dei meeting interni per venire incontro alle esigenze di ciascun membro del gruppo, porta a confusione nell'organizzazione e addirittura ad una ridotta partecipazione rispetto a quando i meeting avevano un orario prefissato. Di conseguenza, si è deciso di fissare l'orario di tutti i meeting interni in giorni prefissati della settimana, come strategia risolutiva rispetto a questo problema. Tale soluzione verrà quindi aggiunta ad RC1 nell'analisi dei rischi, come misura preventiva.
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Documentazione%20esterna/Verbali/23-12-15/23-12-15.typ
typst
#import "/template.typ": * #show: project.with( date: "15/12/23", subTitle: "Stato di avanzamento lavori su PoC", docType: "verbale", authors: ( "<NAME>", ), externalParticipants : ( (name: "<NAME>", role: "Membro azienda proponente"), (name: "<NAME>", role: "Referente aziendale"), (name: "<NAME>", role: "Membro azienda proponente"), ), timeStart: "12:00", timeEnd: "12:30", location: "Zoom", ); = Ordine del giorno Sono stati esposti i progressi sui PoC rispetto al precedente meeting esterno e sono sorte discussioni relativamente a: - Analisi dei Requisiti; - tecnologie da utilizzare e utilizzate; - feature dei PoC; - meeting futuri. == Considerazioni sull'Analisi dei Requisiti Sono stati discussi i requisiti non funzionali identificati. Non sono stati identificati particolari vincoli sulle performance. === Vincoli sui browser Per adottare le tecnologie da noi individuate, in particolar modo per la libreria Three.js, è necessario che i browser interessati dispongano di una versione specifica atta a supportare tale tecnologia mediante la componente grafica WebGL. Tale osservazione ha trovato conferma da parte del proponente, il quale ha approvato l'implementazione dell'applicativo per i principali browser: - Chrome; - Firefox; - Edge. Durante il meeting è stato individuato il numero di versione 89 come soglia minima di compatibilità di Chrome mentre i numeri di versione dei rimanenti browser e di WebGL sono stati individuati dal gruppo e riportati nel documento di Analisi dei Requisiti. \ Desiderabilmente è prevista la compatibilità dell'applicativo con i browser sopracitati versione mobile. === Dispositivi utilizzati dall'utente L'applicazione sarà ottimizzata per l'esecuzione su comuni PC desktop, tipicamente utilizzati negli ambienti d'ufficio, garantendo al contempo la compatibilità con dispositivi tablet. == Considerazioni su tecnologie da utilizzare e utilizzate Durante il meeting sono state discusse ulteriormente le tecnologie impiegate e in programma per una futura implementazione, in particolare è stato approvato da parte del Proponente l'utilizzo di: - Docker Compose; - Next.js; - Express; - PostgreSQL (al posto di mySQL, tecnologia inizialmente individuata). == Considerazioni su feature del PoC Relativamente ai PoC da realizzare in futuro e alla luce delle conoscenze acquisite, sono emerse con il Proponente le seguenti considerazioni: - è importante precaricare dal database una parte dei dati delle merci così da poter mostrare a schermo informazioni di base, per esempio quali sono i bin occupati. Le restanti informazioni delle singole merci potranno essere reperite mediante un'interrogazione al database on demand; - è verosimile che il piano inferiore degli scaffali coincida con il pavimento dell'area di lavoro; - è corretto che i bin all'interno degli scaffali vengano generati automaticamente alla creazione dello scaffale date le dimensioni dello stesso; - è desiderabile poter creare scaffali contenenti piani di altezze diverse; - in assenza delle API che verranno fornite dal Proponente, le loro interrogazioni possono essere simulate con risposte randomiche. == Organizzazione meeting futuri A causa delle festività natalizie non sono previsti ulteriori incontri per l'anno 2023. Il prossimo incontro è previsto per gli inizi del mese di gennaio quando lo stato dei lavori sarà prossimo al raggiungimento della milestone RTB del progetto.
https://github.com/zjutjh/zjut-report-typst
https://raw.githubusercontent.com/zjutjh/zjut-report-typst/main/template/fonts.typ
typst
#let font_style = ( heiti: "Noto Sans CJK SC", songti: "Noto Serif CJK SC", kaiti: "LXGW WenKai" ); #let font_size = ( 初号: 42pt, 小初: 36pt, 一号: 26pt, 小一: 24pt, 二号: 22pt, 小二: 18pt, 三号: 16pt, 小三: 15pt, 四号: 14pt, 小四: 12pt, 五号: 10.5pt, 小五: 9pt, 六号: 7.5pt, 小六: 6.5pt, 七号: 5.5pt, 八号: 5pt );
https://github.com/jomaway/typst-teacher-templates
https://raw.githubusercontent.com/jomaway/typst-teacher-templates/main/ttt-exam/template/exam.typ
typst
MIT License
#import "@preview/ttt-exam:0.1.2": * #set text(size: 12pt, font: ("Rubik"), weight: 300, lang: "de") #show: exam.with( ..toml("meta.toml").info, logo: image("logo.jpg"), cover: true, // true or false eval-table: false, // true or false appendix: none, // content or none ) = Part 1: Free text questions #assignment[ Answer the following questions. #question(points: 1)[ Solve the following equation for $x$: $ 3x+5=17 $] #answer(field: caro(6))[ $ 3x+5=17 $ $ 3x=17-53x=17-5 $ $ 3x=123x=12 $ $ x=123x=312 $ $ x=4x=4 $ ] ] = Part 2: Multiple and single choice #multiple-choice( prompt: "Which numbers are even", distractors: ( "1", "3", "5" ), answer: ( "2", "4", ), dir: ltr, hint: [_Two options are correct_] ) #multiple-choice( prompt: "Which number is a prime number", distractors: ( "1", "6", "15", "9", ), answer: ( "7", ), dir: ltr, )
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/diagraph/0.1.0/README.md
markdown
Apache License 2.0
# diagraph A simple graphviz binding for typst using the new webassembly plugin system ## Usage This plugin is quite simple to use, you just need to import it: ```typ #import "@preview/diagraph:0.1.0": * ``` It allows you to render a graphviz dot string to a svg image: ```typ #render("digraph { a -> b }") ``` For a simpler usage, you can setup a simple show rule: ```typ #show: raw-dotrender-rule ``` This allow you to draw a graphviz graph like this: ```typ ```dotrender digraph { a -> b } `` ` ``` You can see an example of this in the [example](https://github.com/Robotechnic/diagraph/tree/main/examples) folder. For more information about the graphviz dot language, you can check the [official documentation](https://graphviz.org/documentation/). ## Functions definitions ### render This function allow you to render a graphviz dot string to a svg image. ```typ render( dot: string, engine: string, width: auto relative, height: auto relative, fit: string ) ``` | Parameter | Description | Default value | | :-------: | :---------: | :-----------: | | dot | The dot string to render | Required | | engine | The graphviz engine to use | dot | | width | The width of the svg | auto | | height | The height of the svg | auto | | fit | The fit mode of the svg | contain | All the optional parameters are the same as the one of images, you can check the [documentation](https://typst.app/docs/reference/visualize/image/) for more details. ### raw-render This function allow you to use raw to render a graphviz dot string. ```typ raw-render( engine: string, width: auto relative, height: auto relative, fit: string, raw ) ``` | Parameter | Description | Default value | | :-------: | :---------: | :-----------: | | engine | The graphviz engine to use | dot | | width | The width of the svg | auto | | height | The height of the svg | auto | | fit | The fit mode of the svg | contain | | raw | The dot string to render | Required | This function will panic if the provided content is not a `raw`. ### raw-dotrender-rule This function is a show rule that allow you to use raw to render a graphviz dot string. ```typ raw-dotrender-rule( engine: string, width: auto relative, height: auto relative, fit: string, doc ) ``` | Parameter | Description | Default value | | :-------: | :---------: | :-----------: | | engine | The graphviz engine to use | dot | | width | The width of the svg | auto | | height | The height of the svg | auto | | fit | The fit mode of the image | contain | | doc | The document | Required | ## Build This project was built with emscripten `3.1.45`. Apart from that, you just need to run `make wasm` to build the wasm file. All libraries are downloaded and built automatically to get the right version that works. There are also some other make commands: - `make clean`: Clean the build folder - `make link`: Link the project to the typst plugin folder - `make compile_database`: Generate the compile_commands.json file - `make module`: It copy the files needed to run the plugin in a folder called `graphviz` in the current directory ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details ## Changelog ### 0.1.0 Initial working version
https://github.com/crd2333/typst-admonition
https://raw.githubusercontent.com/crd2333/typst-admonition/master/README.md
markdown
MIT License
# typst-admonition [This package](https://github.com/crd2333/typst-admonition) is admonitions in [typst](https://github.com/typst/typst). The icons are repainted from [material](https://squidfunk.github.io/mkdocs-material/reference/admonitions/). And it's easy to modify and add new icons. After version 0.3.0, the package is nearly rewritten by [showybox](https://github.com/Pablo-Gonzalez-Calderon/showybox-package). ![example](examples/example1.png) ![example](examples/example2.png) ## Usage ```typst #import "/path/to/typst-admonition/lib.typ": * #info(caption: "This is a caption", [Caption and content size can be changed.], [Currently supported types are:\ *note, abstract, info, tip, success, question, warning, failure, bug, danger, example, quote.* ] ) ``` For more information, see `examples/example.typ`.
https://github.com/wuespace/delegis
https://raw.githubusercontent.com/wuespace/delegis/main/template/main.typ
typst
MIT License
#import "@preview/delegis:0.3.0": * #show: delegis.with( // Metadata title: "Vereinsordnung zu ABCDEF", abbreviation: "ABCDEFVO", resolution: "3. Beschluss des Vorstands vom 24.01.2024", in-effect: "24.01.2024", draft: false, // Template logo: image("wuespace.jpg", alt: "WüSpace e. V."), ) /// Usage // // "§ 123abc Section title" for a section "§ 123abc" with the title "Section title" // "#section[§ 123abc][Section title]" for the same section // "#s~" for sentence numbers in multi-sentence paragraphs // (normal Typst headings) such as "= ABC" for grouping sections together // /// #unnumbered(level: 1, outlined: false)[Vorbemerkung] Fußnoten dienen als redaktionelle Anmerkungen oder Interpretationshilfen und sind nicht selbst Teil der Beschlussfassung. #v(2em) #outline() #unnumbered[Präambel] #lorem(30) = Allgemeiner Teil § 1 Grundlegendes (1) #lorem(20) (2) #s~#lorem(10) #s~#lorem(10) #s~Das beinhaltet + Listenelemente, + weitere Listenelemente, wie zum Beispiel + Kind-Listenelemente, + weitere Kind-Listenelemente, sowie + ein letztes Listenelement. § 2 Bestimmungen #lorem(30) = Spezieller Teil § 2a Ergänzende Bestimmungen (1) #lorem(5) (2) #s~#lorem(3) #s~#lorem(8) #section[§ 3][Administrator*innen] #lorem(30)
https://github.com/kdog3682/typkit
https://raw.githubusercontent.com/kdog3682/typkit/main/0.1.0/src/misc.typ
typst
#import "is.typ": * #import "typst.typ" #import "resolve.typ": * #let tern(condition, a, b) = { if is-truthy(condition) { a } else { b } } #let identity(x) = { x } #let exists(x) = { x != none and x != false } #let empty(x) = { x == none } #let unreachable() = { panic("this can never be reached") } #let create-icon(url, size: 20) = { let el = image(url) return box(width: size * 1pt, height: size * 1pt, el) } #let len(x) = { if is-number(x) { return str(x).len() } return x.len() } /// retrieves the first arg of sink.pos() or fallback /// fallback is required #let get-sink(sink, fallback) = { let args = sink.pos() return if args.len() == 0 { fallback } else if args.len() == 1 { args.first() } else { args } } #let wrap(c, ..sink) = { let args = sink.pos() if args.at(0) == none { return c } if args.len() == 1 { args.push(args.at(0)) } let ref = ( horizontal: h, vertical: v ) let key = sink.named().at("dir", default: "vertical") let resolve(x) = { if is-content(x) { x } else { let fn = ref.at(key) fn(resolve-pt(x)) } } let (a, b) = args.map(resolve) a c b } #let indent-text(x, indent: 20pt) = { set par(first-line-indent: indent, hanging-indent: indent) resolve-content(x) } #let flip-to-bottom(c) = context { let h = measure(c).height place(bottom + left, rotate(c, 180deg)) } #let hidden(length) = { hide(box(text("HI"), width: resolve-pt(length))) } #let nth(n, sup: bool, word: false) = { let ordinal-words = ( "", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", ) // modified from https://github.com/extua/nth // Conditinally define n, and if it's an integer change it to a string if word == true { return ordinal-words.at(int(n)) } let ordinal-str = if type(n) == int { str(n) } else { n } // Main if-else tree for this function let ordinal-suffix = if ordinal-str.ends-with(regex("1[0-9]")) { "th" } else if ordinal-str.last() == "1" { "st" } else if ordinal-str.last() == "2" { "nd" } else if ordinal-str.last() == "3" { "rd" } else { "th" } // Check whether sup attribute is set, and if so return suffix superscripted if sup == true { return ordinal-str + super(ordinal-suffix) } else { return ordinal-str + ordinal-suffix } } #let n-range(..sink) = { let args = sink.pos().flatten() if is-function(args.at(-1)) { typst.range(args.at(0), args.at(1) + 1).map(args.at(-1)) } else { typst.range(args.at(0), args.at(1) + 1) } } #let svg-test(..sink) = { let args = sink.pos() set page(width: auto, height: auto) if args.all(is-content) { args.join(v(10pt)) } else if is-content(args.at(0)) { args.at(0) } else if is-function(args.at(0)) { args.at(0)(..sink.named()) } } #let compass-to-degrees(key) = { // let reference = ( // "north": 90deg, // "north-east": 45deg, // "east": 0deg, // "south-east": 315deg, // "south": 270deg, // "south-west": 225deg, // "west": 180deg, // "north-west": 135deg // ) let reference = ( "north": 90deg, "north-east": 45deg, "east": 0deg, "south-east": 315deg, "south": 270deg, "south-west": 225deg, "west": 180deg, "north-west": 135deg ) let reference = ( north: 90deg, north-west: 45deg, west: 0deg, south-west: 315deg, south: 270deg, south-east: 225deg, east: 180deg, north-east: 135deg ) return reference.at(key) } #let get-width(x) = context { return measure(x).width // this doesnt work } #let shrink(c, width) = { block(c, width: width) } #let dictf(ref) = { let runner(key) = { return ref.at(key) } return runner } #let placed(c, align, inset: 10pt) = { let ref = ( "top": (sign: 1, dir: "dy"), "bottom": (sign: -1, dir: "dy"), "left": (sign: 1, dir: "dx"), "right": (sign: -1, dir: "dx"), // "horizon": (sign: -1, dir: "dx") // "center": (sign: -1, dir: "dx") ) let parts = repr(align).split(" + ") let dx = 0pt let dy = 0pt for part in parts { let m = ref.at(part, default: none) if m == none { continue } let (sign, dir) = m if dir == "dx" { dx = inset * sign } else { dy = inset * sign } } place(c, align, dx: dx, dy: dy) } #let get-year() = { datetime.today().display("[year]") } // #panic(get-year()) #let mirror-content(c) = { rotate(scale(resolve-content(c), y: -100%), 180deg) } #let stacked(..sink) = { typst.stack(dir: ltr, ..sink) } #let map-even-odd(items, ..sink) = { let args = sink.pos() let (even, odd) = if len(args) == 1 { (args.first(), none) } else { args } let callback((i, item)) = { if calc.even(i) == true and even != none { even(item) } else if odd != none { odd(item) } } return items.enumerate().map(callback) } #let opposite(value) = { let t = type(value) if t == bool { not value } else if t == int or t == float { if value == 1 { 0 } else if value == 0 { 1 } else { value } } else if t == str { let opposites = ( // Single directions "top": "bottom", "bottom": "top", "left": "right", "right": "left", // Combined directions "top-left": "bottom-right", "top-right": "bottom-left", "bottom-left": "top-right", "bottom-right": "top-left", // Other positional pairs "above": "below", "below": "above", "inside": "outside", "outside": "inside", "front": "back", "back": "front", "in": "out", "out": "in", "up": "down", "down": "up", // Boolean strings "true": "false", "false": "true" ) opposites.at(value, default: value) } else { panic("not found in opposites") } } // #panic(not not true) #let color-match(s, color: "white") = { let opposites = ( "white": "black", ) let fg-fill = resolve-color(color) let bg-fill = resolve-color(opposites.at(color)) let c = text(resolve-content(s), fill: fg-fill, weight: "bold") box(inset: 5pt, radius: 5pt, fill: bg-fill, align(c, center + horizon)) } #let colored(x, fill, key: "stroke") = { let t = type(x) if fill == none { if t == str or t == int { return text(str(x)) } return x } let paint=resolve-color(fill) if t == str or t == int { return text(str(x), fill: paint) } else if t == dictionary { let value = x.at(key, default: none) let value-type = type(value) let new-value = if value-type == stroke { stroke((dash: value.dash, thickness: value.thickness, paint: paint)) } else if value-type == length { stroke((thickness: value, paint: paint)) } else if value-type == color { stroke(paint: paint) } else { return x } x.insert(key, new-value) return x } else if t == content { return text(x, fill: resolve-color(fill)) } else if t == stroke { return stroke((dash: x.dash, thickness: x.thickness, paint: paint)) } else { unreachable() } } #let calculate-frame(numbers, k) = { let callback(n) = { let rounded = calc.floor(n / k) * k let value = if rounded == 0 { k } else { rounded } let delta = n - value return ( value: value, delta: delta, ) } let (a, b) = numbers.map(callback) return ( dx: a.delta, dy: b.delta, width: a.value, height: b.value ) // calculate-frame((686.5, 174), 30) // 660, 150 // we get the closest smallest possible integer that is a multiple of k // use this for sizing the canvas diagram }
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CU/minea/1_generated/00_all/02_oktober.typ
typst
#import "../../../all.typ": * #show: book = #translation.at("M_02_oktober") #include "../02_oktober/01.typ" #pagebreak() #include "../02_oktober/26.typ" #pagebreak()
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/anatomy/0.1.0/README.md
markdown
Apache License 2.0
# Anatomy *Anatomy of a Font*. Visualise metrics. Import the `anatomy` package: ```typst #import "@preview/anatomy:0.1.0": metrics ``` ## Samples `metrics(72pt, "EB Garamond", "Typewriter")` will be rendered as follows: ![](https://github.com/E8D08F/packages/raw/main/packages/preview/anatomy/0.1.0/img/export-1.svg) Additionally, a closure using `metrics` dictionary as parameter can be specified for further typesetting: ```typ metrics(54pt, "一點明體", "電傳打字機", typeset: metrics => table( columns: 2, ..metrics.pairs().flatten().map(x => [ #x ]) ) ) ``` It will generate: ![](https://github.com/E8D08F/packages/raw/main/packages/preview/anatomy/0.1.0/img/export-2.svg) **Remark**: To typeset CJK text, adopting font’s ascender/descender as `top-edge`/`bottom-edge` makes more sense in some cases. As for most CJK fonts, the difference between ascender and descender heights will be exact 1em. Tested with `metrics(54pt, "Hiragino Mincho ProN", "テレタイプ端末")`: ![](https://github.com/E8D08F/packages/raw/main/packages/preview/anatomy/0.1.0/img/export-3.svg)
https://github.com/benedict-armstrong/typstCV
https://raw.githubusercontent.com/benedict-armstrong/typstCV/main/readme.md
markdown
# Typst CV Typst version of my CV using a yml file with a custom template. [Current CV PDF](https://benedict-armstrong.github.io/typstCV/cv.pdf) ## Deploy The CV is deployed automatically to GitHub pages using GitHub actions.
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas8/0_Nedela.typ
typst
#let M = ( "HV": ( ("","","Večérňuju písň, i slovésnuju slúžbu, tebí Christé prinósim: jáko blahovolíl jesí pomílovati nás voskresénijem."), ("","","Večérňuju písň, i slovésnuju slúžbu, tebí Christé prinósim: jáko blahovolíl jesí pomílovati nás voskresénijem."), ("","","Hóspodi, Hóspodi, ne otvérži nás ot tvojehó licá: no blahovolí pomílovati nás voskresénijem."), ("","","Rádujsja Sijóne svjatýj, máti cérkvéj, Bóžije žilíšče: tý bo prijál jesí pérvyj, ostavlénije hrichóv, voskresénijem."), ("Dogmat","","Káko ťá ublážím Bohoródice? Káko že vospojím preblahoslovénnaja, nepostižímoje táinstvo roždénija tvojehó? Vikóv bo tvoréc, i nášeho soďíteľ jestestvá, svój óbraz uščédriv, nizvedé samahó sebé vo istoščánije neizsľídimoje, sýj v neveščéstvennych ňídrich Ótčich, vo utróbi tvojéj čístaja vselísja, i plóť neprelóžno býsť, ot tebé neiskusobráčnaja, prebýv úbo, jéže bí jestestvóm Bóh. Ťímže jemú poklaňájemsja Bóhu soveršénnu, i čelovíku soveršénnu, tomú vo obojém zráci: íbo obojé jestestvó v ném jésť voístinnu: suhúba že vsjá propovídujem jestéstvennaja jehó svójstva, po suhúbomu suščestvú, dvá počitájušče ďíjstva i choťínija. Jedinosúščen bo sýj Bóhu i Otcú, samovlástno chóščet i ďíjstvujet jáko Bóh: jedinosúščen že sýj i nám, samovlástno chóščet, i ďíjstvujet jáko čelovík. Tohó molí čístaja vseblažénnaja, spastísja dušám nášym."), ), "S": ( ("","","Vozšél jesí na krest Iisúse, snizšédyj s nebesé: prišél jesí na smérť životé bezsmértnyj, k súščym vo ťmí, svít ístinnyj: k pádšym, vsích voskresénije, prosviščénije, i Spáse náš, sláva tebí."), ("","O preslávnaho čudesé!","Rádujsja Bohoródice vsepítaja. Rádujsja istóčniče životá vírnym istočájušč. Rádujsja vsích Vladýčice, i hospožé tvári blahoslovénnaja. Rádujsja vseneporóčnaja, preproslávlennaja. Rádujsja vseprečístaja. Rádujsja paláto. Rádujsja božéstvennoje selénije. Rádujsja čístaja. Rádujsja Máti Ďívo. Rádujsja Bohonevísto."), ("","","Rádujsja, Bohomáti prečístaja. Rádujsja, vírnych nadéžde. Rádujsja, míra očiščénije. Rádujsja, vsjákija skórbi izbavľájušči rabý tvojá. Rádujsja, čelovíkov uťišénije živonósnoje. Rádujsja, zastuplénije. Rádujsja, predstólpije prizyvájuščich ťá. Rádujsja, Bóžije božéstvennoje prebyvánije, i horó svjatája."), ("","","Rádujsja Bohoródice, <NAME>. Rádujsja, jedína nadéžde, čelovíkov zastuplénije. Rádujsja, pribížišče. Rádujsja, svíščniče svíta svítlyj. Rádujsja, sviščé osvjaščénnaja. Rádujsja paláto. Rádujsja rajú. Rádujsja božéstvennoje selénije. Rádujsja istóčniče, istočájušč vódy pritekájuščym k tebí."), ("Dogmat","","Jehóže nébo ne vmestí, Ďívo Bohoródice, vo črévi tvojém neťisnomístno vmistísja: i prebylá jesí čístaja, slóvom neizrečénnym, ničímže ďívstvu oskvérnšusja. Tý bo jedína bylá jesí v ženách, i Máti, i Ďíva: i tý jedína prečístaja, vozdojíla jesí Sýna živodávca, i na objátijach tvojích nosíla jesí nedrémľuščeje óko: no ne ostávľ ňídra Ótča, jákože préžde vík predbýsť. No horí vés Bóh so ánhely, dóľi vés iz tebé s čelovíki, i vezďí neskazánno. Tohó molí, vsesvjatája Vladýčice spastísja, pravoslávno Bohoródicu čístuju ispovídajuščym ťá."), ), ) #let V = ( "HV": ( ("","","Večérňuju písň, i slovésnuju slúžbu, tebé Christé prinósim: jáko bláhovolíl jesí pomílovati nás voskresénijem."), ("","","Hóspodi, Hóspodi, ne otvérži nás ot tvojehó licá: no blahovolí pomílovati nás voskresénijem."), ("","","Rádujsja, Sijóne svjatýj, Máti cérkvéj, Bóžije žilíšče, tý bo prijál jesí pérvyj, ostavlénije hrichóv, voskresénijem."), ("","","Jéže ot Bóha Otcá Slóvo, préžde vík róždšejesja, v posľídňaja že vremená, tóježde ot neiskusobráčnyja voplóščšejesja vóleju, raspjátije smértnoje preterpí: i drévle umerščvlénnaho čelovíka spasé svoím voskresénijem."), ("","","Jéže iz mértvych tvojé voskresénije slavoslóvim Christé, ímže svobodíl jesí adámskij ród ot ádova mučíteľstva: i darovál jesí mírovi jáko Bóh žízň víčnuju, i véliju mílosť."), ("","","Sláva tebí Christé Spáse, Sýne Bóžij jedinoródnyj, prihvozdívyjsja na kresťí, i voskresýj iz hróba tridnéven."), ("","","Tebé slávim Hóspodi, vóleju nás rádi krest preterpívšaho, i tebi poklaňájemsja vsesíľne Spáse: ne otvérži nás ot licá tvojehó, no uslýši i spasí ny voskresénijem tvojím, čelovikoľúbče."), ("","Jáko dóbľa","Ánheľstiji čínove ťá Bohomáti slávjat: Bóha bo prečístaja rodilá jesí, íže so Otcém i Dúchom prisnosúščnaho, i ánheľskaja vójinstva, ot ne súščich choťínijem sostávľšaho. Jehóže molí, spastí i prosvitíti dúšy, íže pravoslávno jáko Bohoródicu vospivájuščich ťá."), ("","","Jáko istóčnik osvjaščénija, kovčéh že vsezlatýj, božéstvennym Dúchom ozarjájem, moľú i pripádaju: strastém prédannuju i okajánnuju mojú dúšu prosvití Vladýčice, izbavľájušči mjá hórkaho mučíteľstva bisóvskaho, i púť mňí spasénija podajúšči nepretknovénen."), ("","","Prestóli jehdá postávjatsja, i kníhi razhnútsja, i ďilá obličátsja, i vsják kóždo predstánet obremenén i obnažén, vés trepéščja nehodovánija Bóžija, i právednaho tohó otviščánija: tohdá mjá poščadí Vladýčice, i vsjákaho sudá ischití, vsjáčeskich tomlénij súščaho vinóvna."), ("Dogmat","","Cár nebésnyj za čelovikoľúbije na zemlí javísja, i s čelovíki poživé: ot Ďívy bo čístyja plóť prijémyj, i iz nejá prošédyj s vosprijátijem: jedín jésť Sýn, suhúb jestestvóm, no ne ipostásiju. Ťímže soveršénna tohó Bóha, i soveršénna čelovíka voístinnu propovídajušče, ispovídujem Christá Bóha nášeho: jehóže molí Máti beznevístnaja, pomílovatisja dušám nášym."), ), "S": ( ("","","Vozšél jesí na krest Isúse, snizšédyj s nebesé: prišél jesí na smérť životé bezsmértnyj, k súščym vo ťmí svít ístinnyj: k pádšym vsích voskresénije, prosviščénije, i Spáse náš, sláva tebí."), ("","","Christá slavoslóvim, voskrésšaho ot mértvych: dúšu bo i ťílo prijém, strásti otobojúdu otsičé, prečístej úbo duší vo ád sošédšej, jehóže i pľiní: vo hróbi že istľínija ne víďi svjatóje ťílo, izbáviteľa dúš nášich."), ("","","Psalmý i písňmi slavoslóvim Christé, ot mértvych tvojé voskresénije: ímže nás svobodíl jesí mučíteľstva ádova, i jáko Bóh darovál jesí žízň víčnuju, i véliju mílosť."), ("","","O Vladýko vsích nepostižíme, tvórče nebesé i zemlí, krestóm postradávyj, mňí bezstrástije istočíl jesí: pohrebénije že prijém, i voskrés vo slávi, sovoskresíl jesí Adáma rukóju vsesíľnoju. Sláva tvojemú tridnévnomu vostániju, ímže darovál jesí nám víčnuju žízň, i očiščénije hrichóv, jáko jedín blahoutróben."), ("Dogmat","","Beznevístnaja Ďívo, jáže Bóha neizrečénno začénši plótiju, Máti Bóha výšňaho, tvojích rabóv moľbý prijimí vseneporóčnaja, vsím podajúšči očiščénije prehrišénij: nýňi náša molénija prijémľušči, molí spastísja vsím nám."), ), "T": ( ("","","S vysotý snizšél jesí blahoutróbne, pohrebénije prijál jesí tridnévnoje, da nás svobodíši strastéj, životé i voskresénije náše, Hóspodi sláva tebí."), ("Bohoródičen","","Íže nás rádi roždéjsja ot Ďívy, i raspjátije preterpív blahíj, isprovérhij smértiju smérť, i voskresénije javléj jáko Bóh, ne prézri jáže sozdál jesí rukóju tvojéju: javí čelovikoľúbije tvojé mílostive, prijimí róždšuju ťá Bohoródicu moľáščujusja za ný: i spasí Spáse náš, ľúdi otčájannyja."), ), ) #let P = ( "1": ( ("","","Poím Hóspodevi, provédšemu ľúdi svojá skvozí čermnóje móre, jáko jedín slávno proslávisja."), ("","","Prijidíte tájno brátije, jáko ot načála svjaťíj Bohoródici, vnesém vírniji písň nóvu, dnés pochvaľájušče velíčija jejá."), ("","","Drévle Bohoviďínijem Mojséj ozarívsja umóm, tvojemú jásno naučášesja čístaja, Bohoľípnomu začátiju, páče jestestvá Ďívo, jávľšusja jemú v kupiňí sadú."), ("","","Tebí predlaháju serdéčnaja ďijánija, i prijátno podajú pisánije, blíz súščij božéstvennyj zastuplénija króv, ko Vladýci Christú tebé predložív."), ("","","Prikloní mi úcho tvojé čístaja, pravoslávnoju víroju, v síni licá tvojehó, čéstno ľubóviju tí pritekájuščemu, i stráchom poklaňájuščusja, molébnyj mój hlás uslýši."), ), "3": ( ("","","Tý jesí utverždénije pritekájuščich k tebí, Hóspodi: tý jesí svít omračénnych, i pojét ťá dúch mój."), ("","","Ľístvica drévle patrijárchova ťá proobražáše, preneporóčnaja: ánheľsko bo javľáše snítije Bóžije k nám, božéstvennoje sošéstvije vo utróbi tvojéj."), ("","","Júdovo koľíno vselísja, júže Jákov prorečé, ot koľína jehó prorastíti izbavlénije, Iisúsa Christá: jehóže tý róždši prečístaja, proslávilasja jesí."), ("","","Hrichmí otčájan, obritóch ťá pristánišče spasénija prečístaja Bohoródice, upovánije náše i pómošče: ťímže mjá k pokajániju nastávi."), ("","","Blíz ťá súšču Vladýki ímam, preslávnaja Vladýčice, ďijánij mojích kníhu vozložích na ťá víroju: ne premolčí uščédriti mjá."), ), "4": ( ("","","Iz horý priosinénnyja Slóve, prorók, jedínyja Bohoródicy, choťášča voplotítisja, bohovídno usmotrí, i so stráchom slavoslóvjaše sílu tvojú."), ("","","Tý jáko monísty zlatými oďíjana nevísta Ótča, blahodáť prijémši, ukráššisja dobrótoju ďívstva, Máti javílasja jesí Sýna Bóžija."), ("","","Ťá ístinnyj Sijón, Christós Slóvo, izvóli sebí v božéstvennoje selénije, jáko izbránnu izbráv Bohoródice, na obnovlénije vsehó míra."), ("","","Rádujsja, krásnaja paláto Slóva, ďívstvennyj čertóže carjá: rádujsja, pochvaló vsích bezplótnych: rádujsja, čelovíkov pómošče."), ("","","Udaľájutsja ot Bóha, ťímže i pohibájut, otmetájuščiji óbrazy Sýna tvojehó, Máti Bóžija Ďívo Bohoródice: ímiže spasájutsja čtúščiji ťá."), ), "5": ( ("","","Mrák duší mojejá razžení svitodávče Christé Bóže, načaloródnuju ťmú izhnáv bézdny: i dáruj mí svít poveľínij tvojích Slóve, da útreňuja slávľu ťá."), ("","","S božéstvennym sošédšesja Havrijílom, vozopiím Bohoródice vírno: rádujsja Ďívo svjatája, blahodátnaja, Hospóď s tobóju, íže tebé rádi potrebív pečáľ, podadé rádovanije."), ("","","Prečístoje tvojé črévo Hedeón víďi Ďívo čístaja, v néže jáko dóžď Slóvo sošéd, voplotísja božéstvennym Dúchom, Ótča nerazlúčen sýj Božestvá."), ("","","Pomóščnica míra, i zastúpnica jesí čelovíkov hríšnych, Bohorodíteľnice Ďívo: i víroju i ľubóviju pribihájuščym k tebí, preminénije spasíteľnoje, i rišílo prehrišénij mnóhich."), ("","","Prorastíla jesí bez símene, íže préžde vsjákija tvári, prozjabénije Sýna Ótča, bezľítno že i beznačáľno, Dúchom božéstvennym, Bohorodíteľnice čístaja: jehóže podóbije vída vsí počitájem."), ), "6": ( ("","","Soderžíma mjá prijimí čelovikoľúbče, hrichí mnóhimi, i pripádajušča ščedrótam tvojím, jáko proróka Hóspodi, i spasí mja."), ("","","Ďívstva ťá zercálo súščo, i prijátelišče čísto božestvá voschvaľájem, Ďívo neiskusobráčnaja, písňmi."), ("","","Bóh vo utróbi tvojéj voplotísja, bezstrástno i užásno Bohonevísto, jákože v svítci nóvi písan pérstom Ótčim."), ("","","Očiščénije ímamy pokróv tvój, i izvístnuju nadéždu i zastuplénije, Ďívo čístaja: ne posramí Vladýčice rabý tvojá."), ("","","Strastéj neustávnoje bišénije, predstánijem tvojím Bohonevísto, ustávi v tišinú: i ko pristánišču nastávi nás tišiný."), ), "S": ( ("","","Vzbránnoj vojevóďi pobidíteľnaja, jáko izbávľšesja ot zlých, blahodárstvennaja vospisújem tí rabí tvojí Bohoródice: no jáko imúščaja deržávu nepobidímuju, ot vsjákich nás bíd svobodí, da zovém tí: rádujsja nevísto nenevístnaja."), ), "7": ( ("","","Bóžija snizchoždénija óhň ustyďísja v Vavilóňi inohdá, sehó rádi ótrocy v peščí rádovannoju nohóju, jáko vo cvítnici likújušče, pojáchu: blahoslovén jesí Bóže otéc nášich."), ("","","Rádosti nášeja chodátaica javílasja jesí Ďívo, i blahodáti prinosjášče vinéc ľubóviju, rádujsja, vopijém tí, blahoslovénnaja čístaja, pochvaľájušče."), ("","","Horá svjatája jesí Bóžija priosinénnaja, horá túčna preneporóčnaja: horá usyrénna božéstvennymi sijániji: horá, v néjže Bóh blahovolí žíti."), ("","","Pobiždájaj blahodáť tvojú ňísť hrích, Máterne bo derznovénije i vóľu ímaši, i rišíši prehrišénija molítvami tvojími, i prevódiši vsjá stremlénija."), ("","","Ot Tróicy rodilá jesí jedínaho, Bohoródice, bývša neprelóžna plotskím sojedinénijem, suhúba súšča jestestvóm: jehóže vída óbraz počitájem."), ), "8": ( ("","","Na horí svjaťíj proslávľšasja, i v kupiňí ohném prisnoďívy Mojséovi tájnu jávľšaho, Hóspoda pójte, i prevoznosíte vo vsjá víki."), ("","","Kadíľnica javílasja jesí proróku, božéstvennaho úhľa súšči, hrichí otémľuščaho, Bohoródice Ďívo Máti Bóha nášeho."), ("","","Danijíl províďi ťá hóru véliju, Bohoródice Ďívo: iz nejáže čestnýj kámeň Christós, plótiju oblečésja, i lésti nizloží ídoľskija chrámy."), ("","","Velíkij kít íščet požréti mjá, ľútaho hrichá i strastéj mojích otčájanija: no predvarí i spasí rabá tvojehó Vladýčice."), ("","","Íže tobóju besídovavyj k čelovíkom, Bóh sýj vsjáčeskich, zrák čelovíka vospriját: jehóže vzór počitájem Ďívo, v pisánijich."), ), "9": ( ("","","Voístinnu Bohoródicu ťá ispovídujem spasénniji tobóju Ďívo čístaja, s bezplótnymi líki ťá veličájušče."), ("","","Vertohrád zatvorén ťá Ďívo Bohoródice, i zapečátan istóčnik Dúchom božéstvennym, premúdryj v písnech pojét: ťímže jáko sád žízni, voploščájetsja Christós."), ("","","Tvojehó neskázannaho roždestvá propisúja prorók, kníhu zapečátanu províďi, jejáže niktóže táinstvo razumí, vočelovíčenija roždestvá tvojehó."), ("","","Tebí vo umiléniji duší mólimsja vsí: ne prézri Vladýčice náša moľbý, no búdi blahouvítliv nám pokróv, i molítvu nášu uslýši."), ("","","Tvojemú i Sýna tvojehó pripádaju obrazóm: i somňáščichsja počitáti, jáko Mánentovy lžý otmetáju, Bohoródice Ďívo: ťímže pravoslávno písň skončaváju."), ), ) #let N = ( "1": ( ("","","Kolesnicehoníteľa faraóňa pohruzí, čudotvorjáj inohdá moiséjskij žézl, krestoobrázno porazív, i razďilív móre: Izráiľa že bihlecá pišechódca spasé, písň Bóhovi vospivájušča."), ("","","Trisólnečnomu carjú, i stroíteľu, i promyslíteľu vsjáčeskich, i blahómu jedínomu, jestéstvenňi súščemu, i jedínstvennuju imúščemu Božestvá slávu, Bóhu jedinonačáľnomu pripádajem, písň trisvjatúju pojúšče."), ("","","Tečénija božéstvennaja, i proróčestvija jáže svýše pómňašče jávi, Bohonačáľnoje jestestvó jedínstvennoje slávim, prisnosúščnoje, sobeznačáľnoje, v trijéch lícich, Otcé, i Sýne, i Dúsi, soďíteľnoje, vsesíľnoje."), ("","","Svjáščennotaínnik Avraám býv, svjáščennoobrázno drévle, tvorcá vsích i Bóha i Hóspoda, v trijéch úbo ipostásich priját rádujasja, i tréch ipostásej deržávu jedínstvennuju pozná."), ("Bohoródičen","","Neiskusobráčno Christá rodilá jesí, jéže po nám, nás rádi vosprijémša jestestvó prečístaja, i neprelóžna po obojú prebývša. Jehóže molí neprestánno, hrichóv mí darováti i iskušénij izbavlénije."), ), "3": ( ("","","Utverždéj v načáľi nebesá rázumom, i zémľu na vodách osnovávyj, na kámeni mjá Christé zápovidej tvojích (cérkve) utverdí, jáko ňísť svját páče tebé, jedíne čelovikoľúbče."), ("","","Tebé nepristúpnaho Bóha i carjá slávy na prestóľi Isáia víďi vysóci, i cheruvímy i serafímy slávjaščyja neprestánnymi písňmi, jedínstvennaho trijipostásnaho."), ("","","Jedínaho ot Otcá jáko ot umá roždénaho Slóva, i Dúcha proischoďášča neizhlahólanno, po kojemúždo pomyšléniji, i knížnymi učéniji postíhše, jedínaho Bóha trisólnečnaho počitájem."), ("","","Íže sýj neroždénnyj Otéc, i svojehó suščestvá sijánije rodív netľínno Sýna, svít ot svíta: ischódňi predlahájet sráslennyj svít Dúcha, vseďíteľna, i jedinočéstna."), ("Bohoródičen","","Chrám javílasja jesí číst, Ďívo Máti Maríje, vsjá vsesíľno i premúdro sostávľšemu Christú, i v číňi polóžšemu i nosjáščemu: jehóže mílostiva mí sotvorí Máternimi tvojími molítvami."), ), "S1": ( ("","Poveľínnoje tájno","Trisólnečnaho i čestnáho Bohonačálija sílu vírniji nýňi voschválim, jáko mánijem tókmo vsjá sostávil výšňaja likostojánija ánheľskaja, i nížňaja svjaščennonačálija cerkóvnaja, jéže vzyváti: svját, svját, svját jesí Bóže preblahíj: sláva i pínije deržávi tvojéj."), ("Bohoródičen","","Jáže nepremínnaho Bóha poróždšaja, premiňájemoje prísno sérdce mojé hrichóm i ľínostiju, prilóhmi ľstívaho, utverdí blahája molítvami Máternimi tvojími: jáko da i áz blahodárno slávľu ťá Bohorodíteľnice Maríje, pomíluj stádo tvojé, jéže sťažála jesí, vseneporóčnaja."), ), "4": ( ("","","Tý mojá kríposť Hóspodi, tý mojá i síla, tý mój Bóh, tý mojé rádovanije, ne ostávľ ňídra Ótča, i nášu niščetú positív. Ťím s prorókom Avvakúmom zovú ti: síľi tvojéj sláva čelovikoľúbče."), ("","","Vostók jávľšisja Božestvá súščym vo ťmí, vsjú razhná nesvítluju nóšč strastéj: i právdy sólnce vozsijá, prósto úbo po suščestvú, trisijánno že lícy: jéže pojém prísno, i slávim."), ("","","Serafímskimi ustý vospivájemaho, brénnymi ustnámi slávim jedínstvennaho, i Tróičnaho Hóspoda slávy, jestestvóm i ipostásmi, vopijúšče: o vsecarjú, tvojím rabóm podážď razlíčnych prehrišénij proščénije!"), ("","","Soderžíteľnaja vsích súščich, nevídimaja, vseščédraja, blahoutróbnaja, čelovikoľubívaja Tróice čéstnája, i Bohonačáľnaja, ne zabúdi mené tvojehó rabá v konéc: nižé razorí íže zaviščál jesí tvojím rabóm zavít, za neizrečénnuju mílosť."), ("Bohoródičen","","Krásnuju ťá vsečístaja, jedínu obrít ot víka dobrótu Jákovľu, prebeznačáľnoje Slóvo, i vselísja v ťá blahoutróbija rádi, obnoví čelovíčeskoje jestestvó: jehóže molí neprestánno, ot vsjákija mňí izbávitisja skórbi."), ), "5": ( ("","","Vskúju mjá otrínul jesí ot licá tvojehó svíte nezachodímyj, i pokrýla mjá jésť čuždája ťmá okajánnaho: no obratí mja, i k svítu zápovidej tvojích putí mojá naprávi, moľúsja."), ("","","Soprisnosúščnaja trí líca slávim, jedínaho že Hóspoda, ťá božéstvennoje jestestvó, razďiľájušče prósto, i sovokupľájušče, i vírno vopijém: Bohonačáľnaja Tróice svjatája, tvojá rabý ot skórbi izbávi."), ("","","Rydáju zíľňi za némošč mýsli mojejá, káko ne choťá straždú nevóľnoje voístinnu izminénije? sehó rádi zovú: živonačáľnaja Tróice svjatája, dóbrych v stojániji mjá učiní."), ("","","Dremánijem oťahčéna mjá hrichóvnym, i porivájema v són smértnyj, jáko čelovikoľubívaja i preblahája, i vsemílostivaja, Bohonačáľnaja Tróice svjatája, uščédri i vozstávi mjá."), ("Bohoródičen","","Máti Ďívo otrokovíce, prečístaja, vseneporóčnaja, Bohoblahodátnaja, tvojími molítvami Sýna i Bóha tvojehó i Hóspoda mílostiva sotvorí mňí: i strastéj, i prehrišénij tvojehó rabá izbávi vskóri."), ), "6": ( ("","","Očísti mjá Spáse, mnóha bo bezzakónija mojá, i iz hlubiný zól vozvedí, moľúsja: k tebí bo vozopích, i uslýši mjá, Bóže spasénija mojehó."), ("","","Nebésnych umóv činonačálija podražájušče, jedinonačáľnaja vsích Tróice presúščestvennaja, trisvjatými písňmi ťá slavoslóvim, brénnymi nášimi ustý."), ("","","Íže po óbrazu tvojemú čelovíka sozdávšemu, i ot ne súščich vsé premúdro sostávľšemu, Bóhu trijipostásnomu poklaňájusja, i čtú, i pojú, i veličáju ťá."), ("","","Vsederžíteľu Bóže, i jedíne neopreďilénnyj, vselísja v mjá za neizrečénnuju mílosť, trisólnečnyj Vladýko: i ozarí mja, i vrazumí, jáko blahoutróben."), ("Bohoródičen","","Chrám javílasja jesí Bóha nevmistímaho prečístaja, chrám i mené tohó pokaží, božéstvennyja blahodáti presvjatája Vladýčice, tvojími moľbámi, i sobľudí nevredíma."), ), "S2": ( ("","Poveľínnoje tájno","Otcá beznačáľna vírniji, Sýna sobeznačáľna, i Dúcha božéstvennaho voístinnu pisnoslóvim, neslijánňi, neprevrátňi i neizmínňi, Tróicu próstu, i svjátu, i sráslenu, vopijúšče so ánhely: svját jesí Ótče, Sýne, so Dúchom presvjátým i čéstným. Pomíluj, jáže sozdál jesí po óbrazu tvojemú, Vladýko."), ("Bohoródičen","","Blahodarím ťá prísno Bohoródice, i veličájem čístaja, i poklaňájemsja, vospivájušče roždestvó tvojé blahodátnaja, vopijúšče neprestánno: spasí nás Ďívo premílostivaja, jáko blahája v čás ispytánija, da ne posrámleni búdem rabí tvojí."), ), "7": ( ("","","Bóžija snizchoždénija óhň ustyďísja vo Vavilóňi inohdá, sehó rádi ótrocy v peščí rádovannoju nohóju, jáko vo cvítnici likújušče pojáchu: blahoslovén jesí Bóže otéc nášich."), ("","","Premúdrostiju neizhlahólannoju tvojéju, i pučínoju blahostýni, túne tvojehó rabá pomílovanna pokaží mja: i nýňi, jákože drévle, izbávi ozloblénija, Tróice jedínice Bóže, hrichóv i strastéj."), ("","","Premúdrostiju neizhlahólannoju tvojéju, i pučínoju blahostýni, túne tvojehó rabá pomílovanna pokaží mja: i nýňi, jákože drévle, izbávi ozloblénija, Tróice jedínice Bóže, hrichóv i strastéj."), ("","","Úm neroždénnyj Otéc, i Slóvo róždšejesja ot nehó, i Dúch božéstvennyj, nepostížne ischóden sýj, Bóže jedinonačáľne, trisólnečne, pojú tebí: blahoslovén Bóh otéc nášich."), ("Bohoródičen","","Umerščvlén bých prečístaja, hrichóvnym jádom napojén, i pritekáju k tebí víroju, róždšej načáľnika životá: tvojími molítvami rabá tvojehó oživí, i iskušénij i strastéj izbávi, jedína čístaja."), ), "8": ( ("","","Sedmeríceju péšč chaldéjskij mučíteľ Bohočestívym neístovno razžžé, síloju že lúčšeju spasény sijá víďiv, tvorcú i izbáviteľu vopijáše: ótrocy blahoslovíte, svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("","","Svít sýj nezachodím, trisijánen i trisólnečnyj i jedinonačálen, samoderžáven, prosťíjšij, Bóh nepostižímyj, i samoderžáven Hospóď, nýňi témnoje i omračénnoje mojé sérdce ozarí: i pokaží svitozárno i svitonósno píti ťá, i sláviti vo vsjá víki."), ("","","Svjaščénňijšimi krilý, Serafími božéstvenňijšiji, líca i nóhi blahohovíjno pokryvájut, slávy ne terpjášče nepostižímyja dobróty tvojejá, blahonačáľnaja, Bohonačáľnaja, jedinonačáľnaja Tróice presvjatája: obáče i mý vospiváti ťá derzájem, i sláviti vírno vo víki."), ("","","Hóspodonačálije beznačáľnoje, vsesíľnuju i prebláhu, soveršennonačáľnu, blahoďíjstvennu, neopreďíľnu, vinú nevinóvnu, tvoríteľnu, prisnosúščnu, promyslíteľnu i spasíteľnuju vsím jedinícu po suščestvú, i Tróicu lícy, slávľu ťá Bóže mój, vírno vo víki."), ("Bohoródičen","","Na zemlí vozsijá nevečérneje sólnce, roždestvóm jéže iz tebé ďívstvennym, prečístaja Vladýčice, i čelovíki izbávi ot ídoľskaho pomračénnaho mráka. Ťímže i nýňi mjá páče tohó Bohonačálija ozarí lučámi, i sobľudí tvojehó rabá."), ), "9": ( ("","","Užasésja o sém nébo, i zemlí udivíšasja koncý, jáko Bóh javísja čelovíkom plótski, i črévo tvojé býsť prostránňijšeje nebés. Ťím ťá Bohoródicu, ánhelov i čelovík činonačálija veličájut."), ("","","Íže vsími cárstvujuščeje, i vseďíteľnoje prenačálnoje jestestvó, vyššeľítnuju, živonačáľnuju, blahoutróbnu, čelovikoľubívuju, blahúju, jedinonačáľnuju Tróicu ťá nýňi slavoslóvjašče, hrichóv proščénija prósim, mírovi míra, i cérkvam jedinomýslija."), ("","","Íže vsími cárstvujuščeje, i vseďíteľnoje prenačálnoje jestestvó, vyššeľítnuju, živonačáľnuju, blahoutróbnu, čelovikoľubívuju, blahúju, jedinonačáľnuju Tróicu ťá nýňi slavoslóvjašče, hrichóv proščénija prósim, mírovi míra, i cérkvam jedinomýslija."), ("","","Jedíno Hospóďstvo i trisijánnoje, jedínstvennoje Bohonačálije trisólnečnoje, pivcý prijimí tvojá Bohoľípno, i prehrišénij izbávi, i iskušénij i ľútych: i vskóri mír podážď čelovikoľúbno, i cérkvam sojedinénije."), ("Bohoródičen","","Vo utróbu Christé Spáse mój, Ďivíčeskuju vséľsja, javílsja jesí míru tvojemú Bohomúžno, neprevráten, neslijánen voístinnu: i obiščál jesí vsehdá s tvojími rabý býti jávi. Ťímže tebé róždšija molítvami, mír vsemú stádu tvojemú ustrój."), ), ) #let U = ( "T": ( ("","","S vysotý snizšél jesí blahoutróbne, pohrebénije prijál jesí tridnévnoje, da nás svobodíši strastéj, životé i voskresénije náše, Hóspodi sláva tebí."), ("Bohoródičen","","Íže nás rádi roždéjsja ot Ďívy, i raspjátije preterpív blahíj, isprovérhij smértiju smérť, i voskresénije javléj jáko Bóh, ne prézri jáže sozdál jesí rukóju tvojéju: javí čelovikoľúbije tvojé mílostive, prijimí róždšuju ťá Bohoródicu moľáščujusja za ný: i spasí Spáse náš, ľúdi otčájannyja."), ), "S1": ( ("","","Voskrésl jesí iz mértvych životé vsích, i ánhel svítel ženám vopijáše: prestánite ot sléz, apóstolom blahovestíte, vozopíjte pojúščja: jáko voskrése Christós Hospóď, blahovolívyj spastí jáko Bóh ród čelovíčeskij."), ("","","Voskresýj iz hróba jáko voístinnu, prepodóbnym poveľíl jesí ženám propovídati vostánije apóstolom, jákože písano jésť: i skóryj Pétr predstá hróbu, i svít zrjá vo hróbi, užasášesja. Ťímže i uvíďiv plaščanícy, kromí božéstvennaho ťíla v ném ležáščyja, so stráchom vozopí: sláva tebí Christé Bóže, jáko spasáješi vsjá Spasé náš: Ótčeje bo jesí sijánije."), ("Bohoródičen","","Nebésnuju dvér, i kivót, vsesvjatúju hóru, svitozárnyj óblak vospojím, nebésnuju ľístvicu, slovésnyj ráj, Jévino izbavlénije, vselénnyja vsejá velíkoje sokróvišče, jáko spasénije v néj soďílasja mírovi, i ostavlénije drévnich sohrišénij. sehó rádi vopijém tí: molí Sýna tvojehó i Bóha, prehrišénij ostavlénije darováti, blahočéstno poklaňájuščymsja presvjatómu roždéstvú tvojemú."), ), "S2": ( ("","","Čelovícy Spáse, hrób tvój zapečátaša: ánhel kámeň ot dveréj otvalí: žený víďiša vostávša ot mértvych, i týja blahovistíša učenikóm tvojím v Sijóňi, jáko voskrésl jesí životé vsích, i razrišíšasja úzy smértnyja: Hóspodi sláva tebí."), ("","","Míra pohrebáteľnaja žený prinésša, hlás ánheľskij iz hróba slýšachu: prestánite ot sléz, i vmísto pečáli rádosť prijimíte, vozopíjte pojúščja: jáko voskrése Christós Hospóď, blahovolívyj spastí jáko Bóh ród čelovíčeskij."), ("Bohoródičen","","O tebí rádujetsja blahodátnaja vsjákaja tvár, ánheľskij sobór, i čelovíčeskij ród, osvjaščénnyj chráme, i rajú slovésnyj: Ďívstvennaja pochvaló, iz nejáže Bóh voplotísja, i mladénec býsť, préžde vík sýj Bóh náš: ložesná bo tvojá prestól sotvorí, i črévo tvojé prostránňije nebés soďíla. O tebí rádujetsja, blahodátnaja, vsjákaja tvár, sláva tebí."), ), "Y": ( ("","","Mironósicy žiznodávca predstojáščja hróbu, Vladýku iskáchu v mértvych bezsmértnaho, i rádosť blahovíščenija ot ánhela prijémša, apóstolom vozviščáchu: jáko voskrése Christós Bóh, podajáj mírovi véliju mílosť."), ), "A1": ( ("","","Ot júnosti mojejá vráh mjá iskušájet, slasťmí palít mjá: áz že naďíjasja na ťá Hóspodi, pobiždáju sehó."), ("","","Nenavíďaščiji Sijóna, da búdut úbo préžde istoržénija jáko travá: ssíčet bo Christós výja ích, usičénijem múk."), ("","","Svjátým Dúchom, jéže žíti vsjáčeskim: svít ot svíta, Bóh velík: so Otcém pojém jemú, i s Slóvom."), ("","","Svjátým Dúchom, jéže žíti vsjáčeskim: svít ot svíta, Bóh velík: so Otcém pojém jemú, i s Slóvom."), ), "A2": ( ("","","Sérdce mojé stráchom tvojím da pokrýjetsja smirenomúdrstvujuščeje: da ne voznésšejesja otpadét ot tebé vseščédre."), ("","","Na Hóspoda imívyj nadéždu, ne ustrašítsja tohdá, jehdá ohném vsjá sudíti ímať, i múkoju."), ("","","Svjatým Dúchom, vsják któ božéstvennyj vídit, i predhlahólet, čudoďíjstvujet výšňaja, v trijéch jedínaho Bóha pojá: ášče bo i trisijájet, jedinonačáľstvujet božestvó."), ("","","Svjatým Dúchom, vsják któ božéstvennyj vídit, i predhlahólet, čudoďíjstvujet výšňaja, v trijéch jedínaho Bóha pojá: ášče bo i trisijájet, jedinonačáľstvujet božestvó."), ), "A3": ( ("","","Vozzvách tebí Hóspodi, vonmí, prikloní mi úcho tvojé vopijúšču, i očísti, préžde dáže ne vózmeši mené otsjúdu."), ("","","K máteri svojéj zemlí otchoďáj vsják, páki razrišájetsja, prijáti múki, ilí póčesti požívšich."), ("","","Svjatým Dúchom bohoslóvije, jedínica trisvjatája: Otéc bo beznačálen: ot nehóže rodísja Sýn bezľítno, i Dúch soprestólen, soobrázen, ot otcá sprosijávšij."), ("","","Svjatým Dúchom bohoslóvije, jedínica trisvjatája: Otéc bo beznačálen: ot nehóže rodísja Sýn bezľítno, i Dúch soprestólen, soobrázen, ot otcá sprosijávšij."), ), "P": ( ("","","Vocarítsja Hospóď vo vík, Bóh tvój Sijóne, v ród i ród."), ("","","Chvalí dušé mojá Hóspoda, voschvaľú Hóspoda v živoťí mojém."), ), "K": ( "P1": ( "1": ( ("","","Kolesnicehoníteľa faraóňa pohruzí, čudotvorjáj inohdá moiséjskij žézl, krestoobrázno porazív, i razďilív móre: Izráiľa že bihlecá, pišechódca spasé, písň Bóhovi vospivájušča."), ("","","Vsesíľnu Christóvu Bóžestvú káko ne divímsja? Ot strastéj úbo vsím vírnym, bezstrástije i netľínije točášču, ot rebrá že svjatáho istóčnik bezsmértija iskápajušču, i živót iz hróba prisnosúščnyj."), ("","","Jáko blahoľípen ženám ánhel nýňi javísja, svítlyja nosjá óbrazy jestéstvennyja neveščéstvennyja čistotý, zrákom že vozviščája svít voskresénija, zovýj: voskrése Hospóď."), ("Bohoródičen","","Preslávnaja vozhlahólašasja o tebí v roďích rodóv, Bóha Slóva vo črévi vmíščšaja, čistá že prebývši Bohoródice Maríje. Ťímže ťá vsí počitájem, súščeje po Bózi zastuplénije náše."), ), "2": ( ("","","Vódu prošéd jáko súšu, i jehípetskaho zlá izbižáv, Izraiľťánin vopijáše: Izbáviteľu i Bóhu nášemu Pojím."), ("","","Vzjášasja vratá boľíznennaja, i užasóšasja vrátnicy ádovy, zrjášče v preispódňijšaja sošédšaho, íže na vysoťí vsích prevýše jestestvá."), ("","","Udivíšasja číni ánheľstiji, zrjášče na prestóľi posaždéno Ótči, otpádšeje jestestvó čelovíčeskoje, zatvorénoje v preispódnich zemlí."), ("","","Číni ťá ánheľstiji i čelovíčestiji, beznevístnaja Máti, chváľat neprestánno: ziždíteľa bo sích, jáko mladénca na objátijich tvojích nosíla jesí."), ), "3": ( ("","","Pojím Hóspodevi, provédšemu ľúdi svojá skvozí čermnóje móre, jáko jedín slávno proslávisja."), ("","","Prečístaja Bohoródice, voplóščšejesja prisnosúščnoje i prebožéstvennoje Slóvo, páče jestestvá róždši, pojém ťá."), ("","","Hrózd ťá živonósen, vsemírnaho iskápajušč sládosť spasénija, Ďíva Christé rodí."), ("","","Ród Adámľ, ko jéže páče umá blažénstvu, tobóju vozvedénnyj Bohoródice, dostójno slávit ťá."), ), ), "P3": ( "1": ( ("","","Utverždéj v načáľi nebesá rázumom, i zémľu na vodách osnovávyj, na kámeni mjá, Christé, zápovidej tvojích utverdí, jáko ňísť svját, páče tebé jedíne čelovikoľúbče."), ("","","Osuždéna bývša Adáma vkušénijem hrichá, plóti tvojejá spasíteľnoju strástiju opravdál jesí Christé: sám bo nepovínen smértnaho iskúsa býl jesí bezhríšne."), ("","","Voskresénija svít vozsijá súščym vo ťmí, i síni smértňij siďáščym, Bóh mój Iisús, i svojím Božestvóm krípkaho svjazáv, sehó sosúdy raschítil jésť."), ("Bohoródičen","","Cheruvímov i Serafímov prevýšši javílasja jesí Bohoródice: tý bo jedína prijála jesí nevmistímaho Bóha v tvojém črévi, neskvérnaja: ťímže ťá vírniji vsí písňmi čístaja, ublažájem."), ), "2": ( ("","","Nébesnaho krúha verchotvórče Hóspodi, i cérkve ziždíteľu, tý mené utverdí v ľubví tvojéj, želánij kráju, vírnych utverždénije, jedíne čelovikoľúbče."), ("","","Otvérhšahosja préžde zápovidi, Hóspodi, izrinovéna mjá ot tebé sotvoríl jesí, v nehóže voobrazívsja, poslušániju že navýk, sebí páki nazdál jesí raspjátijem."), ("","","Premúdrostiju vsjá prouvíďivyj Hóspodi, i rázumom tvojím vodruzívyj preispódňaja, ne ne spodóbil jesí snizchoždénijem tvojím Slóve Bóžij, voskresíti, jéže po óbrazu tvojemú."), ("Bohoródičen","","Vselívsja v Ďívu ťilésňi Hóspodi, javílsja jesí čelovíkom, jákože podobáše víďiti tebé: júže i pokazál jesí jáko ístinnuju Bohoródicu, i vírnych pomóščnicu, jedíne čelovikoľúbče."), ), "3": ( ("","","Tý jesí utverždénije pritekájuščich k tebí Hóspodi, tý jesí svít omračénnych, i pojét ťá dúch mój."), ("","","Dážď nám pómošč tvojími molítvami vsečístaja, prilóhi otražájušči ľútych obstojánij."), ("","","Jévi pramáteri tý ispravlénije bylá jesí, načáľnika žízni mírovi, Christá Bohoródice róždši."), ("","","Prepojáši mjá síloju vsečístaja, jáže voístinnu Bóha róždši plótiju, Ótčuju ipostásnuju sílu."), ), ), "P4": ( "1": ( ("","","Tý mojá kríposť Hóspodi, tý mojá i síla, tý mój Bóh, tý mojé rádovanije, ne ostávl ňídra Ótča, i nášu niščetú positív. Ťím s prorókom Avvakúmom zovú ti: síľi tvojéj sláva čelovikoľúbče."), ("","","Tý vrahá súšča mjá ziló vozľubíl jesí: tý istoščánijem stránnym sošél jesí na zémľu, blahoutróbne Spáse, posľídňaho mojehó dosaždénija ne otvérhsja, i prebýv na vysoťí prečístyja tvojejá slávy, préžde bezčéstvovannaho proslávil jesí."), ("","","Któ zrjá Vladýko, nýňi ne užasájetsja, strástiju smérť razrušájemu? Krestóm bižáščeje tľínije, i smértiju ád bohátstva istoščavájemyj, božéstvennoju síloju tebé raspjátaho? Čúdno ďílo, čelovikoľúbče!"), ("Bohoródičen","","Tý vírnym pochvalá jesí beznevístnaja, tý predstáteľnice, tý i pribížišče christiján, sťiná i pristánišče: k Sýnu bo tvojemú moľbý nósiši vseneporóčnaja, i spasáješi ot bíd, víroju i ľubóviju Bohoródicu čístuju tebé znájuščich."), ), "2": ( ("","","Uslýšach Hóspodi smotrénija tvojehó tájinstvo, razumích ďilá tvojá, i proslávich tvojé božestvó."), ("","","Na kresťí ťa prihvozdíša zakonoprestúpnych ďíti, Christé Bóže: ímže spásl jesí jáko blahoutróben, slávjaščyja tvojá stradánija."), ("","","Voskrés ot hróba, vsjá sovoskresíl jesí súščyja vo áďi mértvyja, i prosvitíl jesí jáko blahoutróben, slávjaščyja tvojé voskresénije."), ("Bohoródičen","","Bóha, jehóže rodilá jesí prečístaja Maríje, tohó molí darováti rabóm tvojím sohrišénij proščénije."), ), "3": ( ("","","Tý mojá kríposť Hóspodi, tý mojá i síla, tý mój Bóh, tý mojé rádovanije, ne ostávl ňídra Ótča, i nášu niščetú positív. Ťím s prorókom Avvakúmom zovú ti: síľi tvojéj sláva čelovikoľúbče."), ("","","Klás vozrastívšaja životvórnyj, neoránnaja nívo, podajúščaho mírovi žízň, Bohoródice, spasáj pojúščyja ťá."), ("","","Bohoródicu ťá vsečístaja, prosviščšijisja vsí propovídujem: sólnce bo právdy rodilá jesí prisnoďívo."), ("","","Očiščénije dáruj nášym nevíďinijem, jáko bezhríšen: i umirí mír tvój Bóže, molítvami róždšija ťá."), ), ), "P5": ( "1": ( ("","","Vskúju mjá otrínul jesí ot licá tvojehó svíte nezachodímyj, i pokrýla mjá jésť čuždája ťmá okajánnaho? No obratí mja, i k svítu zápovidej tvojích putí mojá naprávi, moľúsja."), ("","","Oďíjatisja preterpíl jesí v bahrjanícu préžde strásti tvojejá Spáse, poruhájem, pervozdánnaho pokryvája bezobráznoje obnažénije: i náh prihvozdílsja jesí na kresťí plótiju, sovlačája Christé, rízu umerščvlénija."), ("","","Ot pérsti smértnyja, tý pádšeje mojé páki nazdál jesí suščestvó, voskrés: i nestaríjuščejesja Christé ustrójil jesí, javív páki jákože cárskij óbraz, netľínija žízň blistájušč."), ("Bohoródičen","","Máterneje derznovénije, jéže k Sýnu tvojemú imúšči vsečístaja, sródnaho promyšlénija, jéže o nás, ne prézri, mólimsja: jáko tebé i jedínu christijáne ko Vladýci očiščénije mílostivno predlahájem."), ), "2": ( ("","","Prosvití nás poveľíniji tvojími Hóspodi, i mýšceju tvojéju vysókoju, tvój mír podážď nám čelovikoľúbče."), ("","","Nastávi nás síloju krestá tvojehó Christé: ťím bo tebí pripádaem, mír podážď nám čelovikoľúbče."), ("","","Okormí živót náš, jáko preblahíj pojúščich tvojé vostánije, i mír podážď nám čelovikoľúbče."), ("Bohoródičen","","umolí čístaja, Sýna tvojehó i Bóha nášeho, neiskusobráčnaja Maríje prečístaja, jéže nizposláti nám vírnym véliju mílosť."), ), "3": ( ("","","Utreňujušče vopijém tí, Hóspodi spasí ný: tý bo jesí Bóh náš, rázvi tebé inóho ne vímy."), ("","","Utolí nesterpímuju búrju strastéj mojích, jáže Bóha róždšaja okormíteľa i Hóspoda."), ("","","Slúžat roždéstvú tvojemú prečístaja Bohoródice, ánheľstiji čínove, i čelovíkov sobránije."), ("","","Maríje Bohoródice beznevístnaja, upovánija vrahóv osujetí, i pojúščyja ťá vozveselí."), ), ), "P6": ( "1": ( ("","","Očísti mjá Spáse, mnóha bo bezzakónija mojá, i iz hlubiný zól vozvedí, moľúsja: k tebí bo vozopích, i uslýši mjá, Bóže spasénija mojehó."), ("","","Drévom krípko nizloží mja načalozlóbnyj: tý že Christé, voznéssja na kresťí, krepčáje nizložíl jesí, posramív sehó, pádšaho že voskresíl jesí."), ("","","Tý uščédril jesí Sijóna, vozsijávyj ot hróba, nóvaho vmísto vétchaho soveršív, jáko blahoutróben, božéstvennoju tvojéju króviju: i nýňi cárstvuješi v ném vo víki, Christé."), ("Bohoródičen","","Da izbávimsja ot ľútych prehrišénij, moľbámi tvojími Bohorodíteľnice čístaja, i da ulučím prečístaja božéstvennoje sijánije, iz tebé neizrečénno voploščénnaho Sýna Bóžija."), ), "2": ( ("","","Molítvu prolíju ko Hóspodu, i tomú vozviščú pečáli mojá, jáko zól dušá mojá ispólnisja, i živót mój ádu priblížisja, i moľúsja jáko Jóna: ot tlí Bóže vozvedí mjá."), ("","","Dláni na kresťí rasprostérl jesí, isciľájaj neuderžánno prostértuju vo Jedémi rúku pervozdánnaho: i tvojéju vóleju žélči vkusív, i spásl jesí Christé jáko sílen, slávjaščyja tvojá stradánija."), ("","","Smérti izbáviteľ vkusí, drévňaho osuždénija, jáko da i tľínija cárstvo razrušít, i vo ádskaja sšéd, voskrése Christós, i spasé jáko sílen pojúščyja jehó voskresénije."), ("","","Ne prestáj za ný moľášči prečístaja Bohoródice Ďívo, jáko vírnym utverždénije tý jesí nadéždoju tvojéju kripímsja, i ľubóviju ťá, i iz tebé voploščénnaho neizrečénno slávim."), ), "3": ( ("","","Rízu mňí podážď svítlu, oďíjajsja svítom jáko rízoju, mnohomílostive Christé Bóže náš."), ("","","Chrám ťá Bóžij i kovčéh, i čertóh oduševlénnyj, i dvér nebésnuju, Bohoródice vírniji vozviščájem."), ("","","Trébišč razrušíteľ jáko Bóh, bývšeje roždestvó tvojé Maríje Bohonevísto, poklaňájemo jésť so Otcém i Dúchom."), ("","","Slóvo Bóžije tebé zemným, Bohoródice, pokazá nebésnuju ľístvicu: tobóju bo k nám sníde."), ), ), "K": ( ("","Jáko načátki","Voskrés iz hróba, uméršyja vozdvíhl jesí, i Adáma voskrésíl jesí, i Jéva likúet vo tvojém voskreséniji, mirstíji koncý toržestvújut, jéže iz mértvych vostánijem tvojím, mnohomílostive."), ("","","Ádova cárstvija pľinívyj, i mértvyja voskresívyj, dolhoterpilíve, žený mironósicy srítil jesí, vmísto pečáli rádosť prinesýj: i apóstolom tvojím vozvistíl jesí pobidíteľnaja Spáse mój známenija živodáteľu, i tvár prosviščáješi čelovikoľúbče. Sehó rádi i mír srádujetsja, jéže iz mértvych vostániju tvojemú mnohomílostive."), ), "P7": ( "1": ( ("","","Bóžija snizchoždénija óhň ustyďísja v Vavilóňi inohdá: sehó rádi ótrocy v peščí rádovannoju nohóju, jáko vo cvítnici likújušče pojáchu: blahoslovén jesí Bóže otéc nášich."), ("","","Slávnoje istoščánije, božéstvennoje bohátstvo tvojejá niščetý Christé, udivľájet ánhely, na kresťí zrjáščyja ťá prihvoždájema, za jéže spastí víroju zovúščyja: blahoslovén jesí Bóže otéc nášich."), ("","","Božéstvennym tvojím sošéstvijem svíta ispólnil jesí preispódňaja, i ťmá prohnána býsť préžde hoňáščaja. Otňúduže voskresóša íže ot víka júznicy, zovúšče: blahoslovén Bóh otéc nášich."), ("Tróičen","","Vsím úbo Hóspoda, jedínaho že jedínomu jedinoródnomu Sýnu pravoslávno Otcá, bohoslóvjašče ťá vozviščájem, i jedínaho víďašče ot tebé ischoďášča Dúcha právaho, sojestéstvenna i soprisnosúščna."), ), "2": ( ("","","Ot Judéji došédše ótrocy, vo Vavilóňi inohdá, víroju trójčeskoju plámeň péščnyj popráša pojúšče: otcév Bóže blahoslovén jesí."), ("","","Spasénije soďílal jesí posreďí vselénnyja, proróčeski Bóže: na drévo bo voznesén býv, vsjá prizvál jesí víroju zovúščyja: otéc nášich Bóže blahoslovén jesí."), ("","","Voskrés ot hróba, jákože ot sná ščédre, vsích izbávil jesí ot tlí, tvár že uvirjájetsja apóstoly propovídajuščimi vostánije: otcév Bóže blahoslovén jesí."), ("Bohoródičen","","Ravnoďíteľnoje róždšemu, ravnosíľnoje Slóvo i soprisnosúščnoje, vo utróbi Ďívy, Otcá blahovolénijem, i Dúcha, sozidájetsja: otcév nášich Bóže blahoslovén jesí."), ), "3": ( ("","","Bóžija snizchoždénija óhň ustyďísja v Vavilóňi inohdá: sehó rádi ótrocy v peščí rádovannoju nohóju, jáko vo cvítnici likújušče pojáchu: blahoslovén jesí Bóže otéc nášich."), ("","","Ot Ďívstvennych ložésn voplóščsja, javílsja jesí na spasénije náše. Ťímže tvojú Máter víďašče Bohoródicu pravoslávno zovém: otcév Bóže blahoslovén jesí."), ("","","Žézl prorastíla jesí Ďívo, ot kórene Jesséova vseblažénnaja, plód cvitonosjášči spasíteľnyj, víroju Sýnu tvojemú zovúščym: otcév Bóže blahoslovén jesí."), ("","","Premúdrosti ispólni vsích i síly božéstvennyja, ipostásnaja premúdroste výšňaho, Bohoródiceju, víroju tebé pojúščich: otcév nášich Bóže blahoslovén jesí."), ), ), "P8": ( "1": ( ("","","Sedmeríceju péšč chaldéjskij mučíteľ Bohočestívym neístovno razžžé, síloju že lúčšeju spasény sijá víďiv, tvorcú i izbáviteľu vopijáše: ótrocy blahoslovíte, svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("","","Iisúsova božestvá prebožéstvennaja síla, v nás Bohoľípno vozsijála jésť: plótiju vo vkúš za vsích smérť krestnuju, razruší ádovu kríposť. Jehóže neprestánno ďíti blahoslovíte , svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("","","Raspnýjsja vostá, velikovýjnyj padé, padýj i sokrušénnyj isprávisja, tľá otvéržena býsť, i netľínije procvité: žízniju vo mértvennoje požérto býsť. Ďíti blahoslovíte, svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ("Tróičen","","Trisvítloje Božestvó, jedínu sijájuščeje zarjú ot jedínaho trijipostásnaho jestestvá, rodíteľa beznačálna: jedinojestéstvenno že Slóvo Otcú, i scárstvujuščaho jedinosúščnaho Dúcha, ďíti blahoslovíte , svjaščénnicy vospójte, ľúdije prevoznosíte vo vsjá víki."), ), "2": ( ("","","Pobidíteli mučíteľa i plámene, blahodátiju tvojéju bývše, zápovidem tvojím ziló priľižáše, ótrocy vopijáchu: blahoslovíte vsjá ďilá hóspodňa Hóspoda."), ("","","Na drévi rúci mňí prostéršaho obnažénnomu, prizyvájušča mjá, svojéju blahoobráznoju sohríjati nahotóju: blahoslovíte vsjá ďilá Hospódňa, i prevoznosíte jehó vo víki."), ("","","Iz preispódňaho áda voznésša mjá pádšaho, i vysokoprestóľnoju slávoju rodíteľa počétšaho: blahoslovíte vsjá ďilá Hospódňa Hóspoda, i prevoznosíte jehó vo víki."), ("Bohoródičen","","Adáma Ďívo, pádšaho úbo javílasja jesí dščí, Bóha že Máti, obnovívšaho mojé suščestvó: jehóže pojém vsjá ďilá jáko Hóspoda, i prevoznósim vo vsjá víki."), ), "3": ( ("","","Carjá nebésnaho , jehóže pojút vóji ánheľstiji, chvalíte i prevoznosíte vo vsjá víki."), ("","","Soprotívnych razžžénnyja i plamenovídnyja na nás uhasí stríly: jáko da pojém ťá vo vsjá víki."), ("","","Prejestéstvenňi soďíteľa i Spása, Bóha slóva rodilá jesí Ďívo: ťímže ťá pojém, i prevoznósim vo vsjá víki."), ("","","Prosvitíteľnuju ťá, i zlatozárnuju, vséľšijsja v ťá svít nepristúpnyj Ďívo, pokazá sviščú vo vsjá víki."), ), ), "P9": ( "1": ( ("","","Užasésja o sém nébo, i zemlí udivíšasja koncý, jáko Bóh javísja čelovíkom plótski, i črévo tvojé býsť prostránňijšeje nebés. Ťím ťá Bohoródicu, ánhelov i čelovík činonačálija veličájut."), ("","","Božéstvennym i beznačáľnym jestestvóm próst sýj, složílsja jesí prijátijem plóti, v tebí samóm sijú sostáviv Slóve Bóžij, i postradáv jáko čelovík, prebýl jesí kromí strastéj jáko Bóh. Ťímže ťá vo dvojú suščestvú nerazďíľno i neslijánno veličájem."), ("","","Otcá po suščestvú božéstvennomu, jákože jestestvóm býv čelovík, rékl jesí Bóha výšnij rabóm snizchoďá, voskrés ot hróba, blahodátiju Otcá zemnoródnym polóž, íže po jestestvú Bóha že i Vladýku, s nímže ťá vsí veličájem."), ("Bohoródičen","","Javílasja jesí, o Ďívo Máti Bóžija, páče jestestvá róždši plótiju Bóha Slóva, jehóže Otéc otrýhnu ot sérdca svojehó préžde vsích vík, jáko bláh, jehóže nýňi i ťilés prevýšša razumíjem, ášče i v ťílo oblečésja."), ), "2": ( ("","","Ustrašísja vsják slúch neizrečénna Bóžija snischoždénija, jáko výšnij vóleju sníde dáže i do plóti, ot ďívičeskaho čréva býv čelovík. Ťímže prečístuju Bohoródicu vírniji veličájem."), ("","","Bóžija ťá jestestvóm úbo Sýna, začátaho vo utróbi svímy Bohomátere, i bývšaho nás rádi čelovíka, i zrjášče ťá na kresťí jestestvóm úbo stráždušča čelovíčeskim, bezstrástna že jáko Bóha prebyvájušča veličájem."), ("","","Razrušísja ťmá drjáchlaja, ot áda bo vozsijá sólnce právdy Christós, zemlí prosviščája vsjá koncý, sijája božestvá svítom, nebésnyj čelovík, Bóh zemnýj: jehóže vo dvojú jestestvú veličájem."), ("","","Naprjazí, i uspiváj, i cárstvuj, Sýne Bohomátere, ismáiľteskija ľúdi pokarjája, borjúščyja ný, jáko orúžije nepobidímoje, prichoďáščym k tebí krest s kopijém dáruja."), ), "3": ( ("","","Voístinnu Bohoródicu ťá ispovídujem, spasénniji tobóju Ďívo čístaja, s bezplótnymi líki ťá veličájušče."), ("","","Rádosti i vesélija ispólň jésť pámjať tvojá, pristupájuščym iscilénija točášči, i blahočéstno Bohoródicu ťá vozviščájuščym."), ("","","Psalmý ťá vospivájem blahodátnaja, i nemólčno, jéže rádujsja, prinósim: tý bo istočíla jesí vsím rádosť."), ("","","Krasén Bohoródice prorasté plód tvój, ne tlí pričaščájuščymsja chodátajstven, no žízni, víroju ťá veličájuščym."), ), ), ), "CH": ( ("","","Hóspodi, ášče i sudílišču predstál jesí ot Piláta sudímyj, no ne otstupíl jesí ot prestóla so Otcém siďá: i voskrés iz mértvych, mír svobodíl jesí ot rabóty čuždáho, jáko ščédr i čelovikoľúbec."), ("","","Hóspodi, orúžije na dijávola krest tvój dál jesí nám: trepéščet bo i trjasétsja, ne terpjá vziráti na sílu jehó: jáko mértvyja vozstavľájet, i smérť uprazdní. Sehó rádi poklaňájemsja pohrebéniju tvojemú i vostániju."), ("","","Hóspodi, ášče i jáko mértva vo hróbi judéji položíša: no jáko carjá spjášča vójini ťá strežáchu, i jáko životá sokróvišče, pečátiju pečátaša: no voskrésl jesí, i pódal jesí netľínije dušám nášym."), ("","","Ánhel tvój Hóspodi, voskresénije propovídavyj, stráži úbo ustraší, ženám že vozhlasí hlahóľa: čtó íščete živáho s mértvymi? Voskrése Bóh sýj, i vselénňij žízň darová."), ("","","Postradál jesí krestóm, bezstrástnyj Božestvóm, pohrebénije prijál jesí tridnévnoje, da nás svobodíši ot rabóty vrážija, i obezsmértiv oživotvoríši nás Christé Bóže, voskresénijem tvojím čelovikoľúbče."), ("","","Poklaňájusja, i slávľu, i vospiváju Christé tvojé iz hróba voskresénije, ímže svobodíl jesí nás ot ádovych nerišímych úz: i darovál jesí mírovi jáko Bóh žízň víčnuju, i véliju mílosť."), ("","","Žiznoprijémnaho tvojehó hróba strehúšče zakonoprestúpniji, s kustodíjeju zapečátaša tohdá: tý že jáko bezsmérten Bóh i vsesílen, voskrésl jesí tridnéven."), ("","","Došédšu tí vo vratá ádova, Hóspodi, i sijá sokrušívšu, pľínnik síce vopijáše: któ séj jésť, jáko ne osuždájetsja v preispódnich zemlí, no i jáko síň razruší smértnoje uzílišče? Prijách tohó jáko mértva, i trepéšču jáko Bóha. Vsesíľne pomíluj nás."), ), ) #let L = ( "B": ( ("","","Pomjaní nás, Christé Spáse míra, jákože razbójnika pomjanúl jesí na drévi: i spodóbi vsích jedíne ščédre, nebésnomu cárstviju tvojemú."), ("","","Slýši Adáme, i rádujsja so Jévoju: jáko obnažívyj préžde obojá, i prélestiju vzém vás pľínniki, krestóm Christóvym uprazdnísja."), ("","","Na drévi prihvoždén býv Spáse náš vóleju, jáže ot dréva kľátvy Adáma izbávil jesí, vozdajá jáko ščédr jéže po óbrazu, i rájskoje selénije."), ("","","Dnés Christós voskrés ot hróba, vsím vírnym podajá netľínije, i rádosť obnovľájet mironósicam po strásti i voskreséniji."), ("","","Rádujtesja múdryja žený mironósicy, pérvyja Christóvo voskresénije víďivša, i jehó vozvestívša apóstolom, vsehó míra vozzvánije."), ("","","Drúzi Christóvy apóstoli jávľšesja, soprestóľni jehó slávi býti imúšče, so derznovénijem tomú nám predstáti, jáko učenicý jehó molítesja."), ("Tróičen","","Beznačáľnaja Tróice, nerazďíľnoje suščestvó, soprestóľnaja jedínice, jedinočéstnaja slávoju, prenačáľnoje jestestvó i cárstvo, spasáj íže víroju vospivájuščich ťá."), ("Bohoródičen","","Rádujsja, Bóžije prostránnoje vmistílišče: rádujsja, kovčéže nóvaho zavíta: rádujsja, rúčko, iz nejáže mánna vsím dadésja nebésnaja."), ), "TKB": ( ("","","S vysotý snizšél jesí blahoutróbne, pohrebénije prijál jesí tridnévnoje, da nás svobodíši strastéj, životé i voskresénije náše, Hóspodi sláva tebí."), ("","Jáko načátki","Voskrés iz hróba, uméršyja vozdvíhl jesí, i Adáma voskrésíl jesí, i Jéva likúet vo tvojém voskreséniji, mirstíji koncý toržestvújut, jéže iz mértvych vostánijem tvojím, mnohomílostive."), ("Bohoródičen","","Íže nás rádi roždéjsja ot Ďívy, i raspjátije preterpív blahíj, isprovérhij smértiju smérť, i voskresénije javléj jáko Bóh, ne prézri jáže sozdál jesí rukóju tvojéju: javí čelovikoľúbije tvojé mílostive, prijimí róždšuju ťá Bohoródicu moľáščujusja za ný: i spasí Spáse náš, ľúdi otčájannyja."), ), "P": ( ("","","Pomolítesja, i vozdadíte Hóspodevi Bóhu nášemu."), ("","","Vídom vo Judéi Bóh, vo Izráiľi vélije ímja jehó."), ("","","Prijidíte, vozrádujemsja Hóspodevi, vosklíknem Bóhu Spasíteľu nášemu."), ("","","Predvarím licé jehó vo ispovídaniji, i vo psalmích vosklíknem jemú."), ), )
https://github.com/ljgago/typst-chords
https://raw.githubusercontent.com/ljgago/typst-chords/main/lib.typ
typst
MIT License
#import "./src/chart.typ": chart-chord #import "./src/piano.typ": piano-chord #import "./src/single.typ": single-chord
https://github.com/MatheSchool/typst-g-exam
https://raw.githubusercontent.com/MatheSchool/typst-g-exam/develop/README.md
markdown
MIT License
# g-exam This template provides a way to generate exams. You can create questions and sub-questions, header with information about the academic center, score box, subject, exam, header with student information, clarifications, solutions, watermark with information about the exam model and teacher. #### Features - Scoreboard. - Scoring by questions and subquestions. - Student information, on the first page or on all odd pages. - Question and subcuestion. - Show solutions and clarifications - List of clarifications. - Teacher's Watermark - Exam Model Watermark ## Usage For information, see the [manual](https://github.com/MatheSchool/typst-g-exam/blob/master/doc/g-exam-manual.pdf?raw=true). To use this package, simply add the following code to your document: #### A sample exam <img src="./gallery/exam-table-content.png" alt="Exam - Table of content" style="width:500px;"/> #### Source: ```typ #import "@preview/g-exam:0.3.2": * #show: g-exam.with( school: ( name: "Sunrise Secondary School", logo: read("./logo.png", encoding: none), ), exam-info: ( academic-period: "Academic year 2023/2024", academic-level: "1st Secondary Education", academic-subject: "Mathematics", number: "2nd Assessment 1st Exam", content: "Radicals and fractions", model: "Model A" ), show-student-data: "first-page", show-grade-table: true, clarifications: "Answer the questions in the spaces provided. If you run out of room for an answer, continue on the back of the page." ) #g-question(points:2.5)[Is it true that $x^n + y^n = z^n$ if $(x,y,z)$ and $n$ are positive integers?. Explain.] #v(1fr) #g-question(points:2.5)[Prove that the real part of all non-trivial zeros of the function $zeta(z) "is" 1/2$]. #v(1fr) #g-question(points:2)[Compute $ integral_0^infinity (sin(x))/x $ ] #v(1fr) ``` ## Changelog <!-- ### v0.4.0 - Change point parameter to points in g-question and g-subquestion. - Change question-points-position paramet to question-points-position. - Include documentation. - Use paper by default. - Indenting subquestion. - Include support for dutch language. - Corrections in English texts. - Draft label. --> ### v0.3.2 - Change show-studen-data to show-student-data parameter. - Change languaje to language parameter. ### v0.3.1 - Corrections in French. ### v0.3.0 - Include parameter question-text-parameters. - Show solution. - Expand documentation. - Possibility of estrablecer question-points-position to none. - Bug fix show watermark. ### v0.2.0 - Control the size of the logo image. - Convert to template - Allow true and false values in show-student-data. - Show clarifications. - Widen margin points. - Show solution. ### v0.1.1 - Fix loading image. ### v0.1.0 - Initial version submitted to typst/packages.
https://github.com/jonaspleyer/peace-of-posters
https://raw.githubusercontent.com/jonaspleyer/peace-of-posters/main/README.md
markdown
MIT License
# peace-of-posters ![Test](https://img.shields.io/github/actions/workflow/status/jonaspleyer/peace-of-posters/test.yml?style=flat-square&label=Test) ![Docs](https://img.shields.io/github/actions/workflow/status/jonaspleyer/peace-of-posters/docs.yml?style=flat-square&label=Docs) > piece of cake<br> > peace of mind<br> > peace of posters [peace-of-posters (PoP)](https://github.com/jonaspleyer/peace-of-posters) is a Typst package to help creating scientific posters. It is flexible and can be used for different sizes and layouts. To see what is possible have a look at some of my own real-world examples in the [showcase](https://jonaspleyer.github.io/peace-of-posters/showcase/) section of the documentation. ## Documentation The external [documentation](https://jonaspleyer.github.io/peace-of-posters/) is coming along slowly. Most notably, there are examples and showcases missing but I hope to be adding them over the coming months. ## License Download the [MIT License](https://www.mit.edu/~amini/LICENSE.md)
https://github.com/DaAlbrecht/lecture-notes
https://raw.githubusercontent.com/DaAlbrecht/lecture-notes/main/discrete_mathematics/greatest-common-divisor.typ
typst
MIT License
#import "../template.typ": * = Greatest Common Divisor #definition[ Each number has at least two divisors: 1 and itself. ] #statement[ #align(center)[ $d bar.v a arrow.r.double a = d * k$ for some integer $k$.] This means the divisors $d$ can not be larger than $a$ itself. ] #example[ The divisors of $12$ are $1, 2, 3, 4, 6, 12$. $1 * 12 = 12$, $2 * 6 = 12$, $3 * 4 = 12$, $4 * 3 = 12$, $6 * 2 = 12$, $12 * 1 = 12$. ] #definition[ A common divisor of two numbers is a number that divides both numbers. This means a common divisor of $a$ and $b$ is a number $d$ that divides both $a$ and $b$. ] #example[ The common divisors of $12$ and $18$ are $1, 2, 3, 6$. $1 * 12 = 12$, $2 * 6 = 12$, $3 * 4 = 12$, $6 * 2 = 12$. $1 * 18 = 18$, $2 * 9 = 18$, $3 * 6 = 18$, $6 * 3 = 18$. ] #definition[ The greatest common divisor of two numbers is the largest number that divides both numbers denoted as $gcd(a, b)$. ] In order to find the greatest common divisor of two numbers, the Euclidean Algorithm can be used. #pagebreak() == Euclidean Algorithm The Euclidean Algorithm is an efficient method to find the greatest common divisor of two numbers. It is based on the fact that a common divisor of two numbers is also a divisor of their sum and difference. #example[ $a = 42$, $b = 66$. A common divisor of $42$ and $66$ is for example $#text(fill: blue,"3")$. $#text(fill: blue,"3") * 14 = 42$ and $#text(fill: blue,"3") * 22 = 66$. For sum and difference the following holds: $108 = 42 + 66 = #text(fill: blue,"3") * 14 + #text(fill: blue,"3") * 22 = #text(fill: blue,"3") * (14 + 22) = #text(fill: blue,"3") * 36$. $24 = 66 - 42 = #text(fill: blue,"3") * 22 - #text(fill: blue,"3") * 14 = #text(fill: blue,"3") * (22 - 14) = #text(fill: blue,"3") * 8$. ] === Algorithm The Euclidean algorithm works as follows: #example[ $gcd(400,225)$ #table( columns: (1fr, 2fr), align: (left, right), [$400 - 225$],[$400 - 225 = 175$], [#h(3em) $225 - 175$],[$225 - 175 = 50$], [#h(5.8em) $175 - 50$],[$175 - 50 = 125$], [#h(5.8em) $125 - 50$],[$125 - 50 = 75$], [#h(5.8em) $75 - 50$],[$75 - 50 = 25$], [#h(8.2em) $50 - 25$],[$50 - 25 = 25$], [#h(8.2em) $25 - 25$],[$25 - 25 = 0$] ) $gcd(400,225) = 25$. ] #statement[ #align(center)[ $d bar.v (alpha * a + beta * b) quad forall alpha, beta in ZZ$. ] Every term of the form $alpha *a + beta * b$ is a multiple of $d$ if both $a$ and $b$ are multiples of $d$. Such terms are called *linear combinations* of $a$ and $b$. ] #pagebreak() == Extended Euclidean Algorithm #definition[ The Extended Euclidean Algorithm calculates in addition to the greatest common divisor (gcd) of integers $a$ and $b$, also the coefficients of Bézout's identity, which are integers $x$ and $y$ such that #align(center)[ $a * x + b * y = gcd(a, b)$. ] ] #example[ Given the same example as before: $a = 400$, $b = 225$. The Extended Euclidean Algorithm calculates the coefficients $x$ and $y$ such that $a * x + b * y = gcd(a, b)$. ] #example[ #table( columns: (1fr), align: (left), stroke: none, [$400 - 225$], [#h(3em) $225 - #text(fill: red, "175")$], [#h(5.8em) $175 - #text(fill: red,"50")$], [#h(5.8em) $#text(fill: red, "125") - 50$], [#h(5.8em) $#text(fill: red,"75") - 50$], [#h(8.2em) $50 - #text(fill: red,"25")$], [#h(8.2em) $25 - #text(fill: red,"25")$], ) $gcd(400,225) = 25$. Now the coefficients $x$ and $y$ can be calculated by working backwards: $25 = 50 - #text(fill: red,"25")\ = 50 - (75 - 50) = 2 * 50 - #text(fill: red,"75")\ = 2 * 50 - (125 - 50) = 3 * 50 - #text(fill: red,"125")\ = 3 * 50 - (175 - 50) = 4 * #text(fill: red,"50") - 175\ = 4 * (225 - 175) - 175 = 4 * 225 - 5 * #text(fill: red,"175")\ = 4 * 225 - 5 * (400 - 225)\ = 9 * 225 - 5 * 400 $ ]
https://github.com/veilkev/jvvslead
https://raw.githubusercontent.com/veilkev/jvvslead/Typst/files/4_sales.typ
typst
#import "../sys/packages.typ": * #import "../sys/sys.typ": * #import "../sys/header.typ": * #v(130pt) = Sales Reports #box(height:auto, columns(3, gutter: 15pt)[ #slantedColorbox( title: "Receipt", color: "black", radius: 0pt, width: auto, )[ Sales Category Report\ #h(5pt) --for Mon 10-Jun-2024\ Loc\#:01#h(5pt)Smart Shop \#07/559\ -----------------------------------------------------------\ Description#h(50pt)Net Sales\ #h(4pt)\#Cust#h(4pt)\#Items#h(4pt)%Sls#h(32pt)GP% -----------------------------------------------------------\ \#1:Department Sales\ \*Dpt\#004 DRUG STORE#h(8pt)3.94\ #h(16pt)2#h(25pt)2#h(18pt)12.15%#h(20pt)0.00%\ \*Dpt\#007 GROCERY\ #h(16pt)10#h(18pt)12#h(15pt)70.09%#h(20pt)0.00%\ #h(20pt)=====================\ Category Total:\ \*\*\*\*#h(20pt)17#h(22pt)100%#h(29pt)0.00%\ #h(70pt)\*\*\*\*\ #h(30pt)===================\ \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\ \#3049 06-10-24 6:29A 111/01/0559 ] #h(50pt)*POS Menu*\ #menu("MANAGER", "1 (Sales Reports)") #menu("..", "1 (Store Sales)") #stickybox( rotation: 0deg, width: 6cm )[ Key differences: \ 1. The first sales report does not include business center as part of its calculations. 2. The second report includes business center. 3. The third report includes everything fully broken down by categories/subcategories. #v(26pt) ] #colbreak() #slantedColorbox( title: "Receipt", color: "black", radius: 0pt, width: auto, )[ Sales Category Report\ #h(5pt) --for Mon 10-Jun-2024\ Loc\#:01#h(5pt)Smart Shop \#07/559\ -----------------------------------------------------------\ Description#h(50pt)Net Sales\ #h(4pt)\#Cust#h(4pt)\#Items#h(4pt)%Sls#h(32pt)GP% -----------------------------------------------------------\ \#1:Department Sales\ \*Dpt\#004 DRUG STORE#h(8pt)3.94\ #h(16pt)2#h(25pt)2#h(18pt)12.15%#h(20pt)0.00%\ \*Dpt\#007 GROCERY\ #h(16pt)10#h(18pt)12#h(15pt)70.09%#h(20pt)0.00%\ #h(20pt)=====================\ Category Total:\ \*\*\*\*#h(20pt)17#h(22pt)100%#h(29pt)0.00%\ #h(70pt)\*\*\*\*\ #h(30pt)===================\ \#2:Service Cntr Income\ \*Dpt\#008 SERVICES\ #h(5pt)1#h(20pt)1#h(25pt)0.00%#h(25pt)100.00%\ \#3:Accounts Payable\ \*Dpt\#008 SERVICES\ #h(5pt)1#h(20pt)1#h(25pt)5.82%#h(25pt)100.00%\ \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\ \#3049 06-10-24 6:29A 111/01/0559 ] #h(50pt)*Manager Menu*\ #menu("4 (Balance Reports Menu)") #menu("..", "2 (Sales Category Menu)") #menu("..", "1 (Summary Menu)") #menu("..", "1 (today) or 2 (yesterday)", ) #menu("..", "or 3 (Select Day)") #colbreak() #slantedColorbox( title: "Receipt", color: "black", radius: 0pt, width: auto, )[#pin(5), Sales Category Report\ #h(5pt) --for Mon 10-Jun-2024\ Loc\#:01#h(5pt)Smart Shop \#07/559\ -----------------------------------------------------------\ Description#h(50pt)Net Sales\ #h(4pt)\#Cust#h(4pt)\#Items#h(4pt)%Sls#h(32pt)GP% -----------------------------------------------------------\ \#1:Department Sales\ 011 Sea Food#h(50pt)2633.94\ #h(10pt)153#h(20pt)275#h(20pt)12.15%#h(13pt)8.00%\ 025 Donuts#h(60pt)0.00% #h(15pt)1#h(49pt)2#h(20pt)0.01%%#h(13pt)0.00%\ 084 Sushi\ #h(10pt)28#h(30pt)42#h(25pt)0.32%#h(11pt)0.00%\ \#3:Accounts Payable\ 401 Money Order Sales#h(9pt)224.17\ #h(10pt)2#h(20pt)2#h(20pt)0.00%#h(23pt)100.00%\ Western Union Send#h(25pt)877.07\ #h(10pt)1#h(20pt)2#h(20pt)0.00%#h(23pt)0.00%\ #h(20pt)=====================\ Category Total:\ \*\*\*\*#h(20pt)17#h(22pt)100%#h(29pt)0.00% #h(70pt)\*\*\*\*\ #h(30pt)===================\ \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\ \#3049 06-10-24 6:29A 111/01/0559 ] #h(50pt)*Manager Menu*\ #menu("4 (Balance Reports Menu)") #menu("..", "2 (Sales Category Menu)") #menu("..", "2 (Detailed Menu)") #menu("..", "1 (today) or 2 (yesterday)", ) #menu("..", "or 3 (Select Day)") ]) /* Options: #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, ) = { ... } */ #pinit-point-from(5, start-dy: -50pt, end-dy: -10pt, start-dx: 100pt, end-dx: 100pt, offset-dy: -110pt)[ Commonly used for business\ center, sushi sales, and \ manager inquiries. ]
https://github.com/daleione/typst-resume-template
https://raw.githubusercontent.com/daleione/typst-resume-template/master/README.md
markdown
MIT License
# typst-resume-template Typst Resume Template
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/docs/cookery/introduction.typ
typst
Apache License 2.0
#import "/docs/cookery/book.typ": book-page #import "/github-pages/docs/graphs.typ": data-flow-graph, ir-feature-graph #show: book-page.with(title: "Introduction") #let natural-image(img) = style(styles => { let (width, height) = measure(img, styles) layout(page => { let width_scale = 0.8 * page.width / width block(width: width_scale * width, height: width_scale * height)[ #scale(x: width_scale * 100%, y: width_scale * 100%, origin: center + top)[#img] ] }) }) = Introduction Typst.ts is a project dedicated to bring the power of #link("https://github.com/typst/typst")[typst] to the world of JavaScript. In short, it composes ways to compile and render your Typst document typically inside *Browser Environment*. In the scope of server-side rendering collaborated by #text(fill: rgb("#3c9123"), "server") and #text(fill: blue, "browser"), there would be a data flow like this: #figure( { set text(size: 12pt) natural-image(data-flow-graph()) }, caption: [Browser-side module needed: $dagger$: compiler; $dagger.double$: renderer. ], numbering: none, ) Specifically, it first presents a typst document in three typical forms: - #link("https://myriad-dreamin.github.io/typst.ts/cookery/guide/compiler/ts-cli.html")[Form1]: Render to SVG and then embed it as a high-quality vectored image directly. - #link("https://myriad-dreamin.github.io/typst.ts/cookery/guide/compiler/ts-cli.html")[Form2]: Preprocessed to a Vector Format artifact. - #link("https://myriad-dreamin.github.io/typst.ts/cookery/guide/compiler/serverless.html")[Form3]: Manipulate a canvas element directly. The #emph("Form2: Vector Format") is developed specially for typst documents, and it has several fancy features: #figure( scale( 120%, { set text(size: 12pt) v(0.5em) natural-image(ir-feature-graph()) v(0.5em) }, ), caption: [Figure: Features of the #emph("Vector Format"). ], numbering: none, ) // - Incremental Font Transfer So with *Form2*, you can continue rendering the document in different ways: #include "direction/main-content.typ" // Typst.ts allows you to independently run the Typst compiler and exporter (renderer) in your browser. // You can: // - locally run the compilation via `typst-ts-cli` to get a precompiled document, // - or use `reflexo-typst` to build your backend programmatically. // - build your frontend using the lightweight TypeScript library `typst.ts`. // - send the precompiled document to your readers' browsers and render it as HTML elements. == Application - #link("https://myriad-dreamin.github.io/typst.ts/")[A Website built with Typst.ts] - #link("https://github.com/Enter-tainer/typst-preview-vscode")[Instant VSCode Preview Plugin] - #link("https://www.npmjs.com/package/hexo-renderer-typst")[Renderer Plugin for Hexo, a Blog-aware Static Site Generator] - Renderer/Component Library for #link("https://www.npmjs.com/package/@myriaddreamin/typst.ts")[JavaScript], #link("https://www.npmjs.com/package/@myriaddreamin/typst.react")[React], and #link("https://www.npmjs.com/package/@myriaddreamin/typst.angular")[Angular] == Further reading + #link("https://myriad-dreamin.github.io/typst.ts/cookery/get-started.html")[Get started with Typst.ts] + #link("https://myriad-dreamin.github.io/typst.ts/cookery/guide/trouble-shooting.html")[Trouble shooting]
https://github.com/chillcicada/typst-dotenv
https://raw.githubusercontent.com/chillcicada/typst-dotenv/main/lib.typ
typst
MIT License
#let parse_dotenv(ctx) = { if type(ctx) == "content" { ctx = ctx.text } else if type(ctx) != "string" { return ctx } let arr = ctx.split(regex("#.*\r?\n?|\r?\n")).filter(it => it.trim() != "").map(line => { let parts = line.split("=") let key = parts.at(0).trim() if (key != "") { if (parts.len() > 1) { (key, parts.at(1).trim()) } else { (key, "") } } }).dedup() let obj = (:) for item in arr { obj.insert(item.at(0), item.at(1)) } obj }
https://github.com/mkpoli/roremu
https://raw.githubusercontent.com/mkpoli/roremu/master/docs/doc.typ
typst
The Unlicense
#import "@preview/tidy:0.2.0" #set text(font: "Noto Serif CJK JP", size: 10pt) #show raw: set text(font: ("Fira Code", "Noto Sans Mono CJK JP")) #set heading(numbering: "1.1") #set page(paper: "jis-b5") #show link: it => { set text(fill: blue) underline(it) } #let show-module = tidy.show-module // = テンプレート #let title(body) = { set text(font: "Noto Serif CJK JP", size: 20pt) align(center, body) } #let package_info = toml("../typst.toml") #let name = package_info.package.name #let version = package_info.package.version #title(raw(name + " v" + version)) #outline(title: "目次") = 概要 このパッケージは日本語のダミーテキストを生成するためのライブラリです。現在は夏目漱石『#link("https://ja.wikipedia.org/wiki/%E5%90%BE%E8%BC%A9%E3%81%AF%E7%8C%AB%E3%81%A7%E3%81%82%E3%82%8B", "吾輩は猫である")』(#link("https://www.aozora.gr.jp/cards/000148/card789.html", "青空文庫版")より一部抜粋、ルビ抜き)を元にして、特定な文字数の文章を生成できます。 = 使い方 ```typst import "@preview/roremu:0.1.0": roremu #roremu(100) ``` == 例 #include("../test/test.typ") = API Reference == 関数 #let docs = tidy.parse-module(read("../src/lib.typ")) #show-module(docs)
https://github.com/jedel1043/Math-Notes
https://raw.githubusercontent.com/jedel1043/Math-Notes/main/main.typ
typst
#import "style.typ": * #show: doc => conf( title: [ General math notes ], doc ) = Perspective Projection matrix (Reverse depth + D3D/WGPU/Metal coordinate system) Source: #link( "https://vincent-p.github.io/posts/vulkan_perspective_matrix/#classic-perspective-with-a-near-and-far-plane" )[The perspective projection matrix in Vulkan] == Quick reference #align(center)[ #table( columns: (33%, 34%, 33%), inset: 10pt, align: (horizon, horizon, left), [*Description*], [*Matrix*], [*Parameters*], [Asymmetric frustum], $ mat( (2n) / (r - l), 0, (r + l)/(r - l), 0; 0, (2n)/(t - b), (t + b)/(t - b), 0; 0, 0, n/(f - n), (n f)/(f - n); 0, 0, -1, 0 ) $, [ $n$: near plane\ $f$: far plane\ $t$: center to top\ $b$: center to bottom\ $r$: center to left\ $l$: center to right\ ], [Symmetric frustum], $ mat( (2n) / w, 0, 0, 0; 0, (2n)/h, 0, 0; 0, 0, n/(f - n), (n f)/(f - n); 0, 0, -1, 0 ) $, [ $w$: screen width\ $h$: screen height\ ], [Symmetric frustum\ (fov + aspect ratio)], $ mat( mu / r, 0, 0, 0; 0, mu, 0, 0; 0, 0, n/(f - n), (n f)/(f - n); 0, 0, -1, 0 ) $, [ $mu$: $1 slash tan("fov"_y / 2)$ (focal length)\ $r$: $w slash h$ (aspect ratio) ], [Symmetric frustum\ (infinite far plane)], $ mat( mu / r, 0, 0, 0; 0, mu, 0, 0; 0, 0, 0, n; 0, 0, -1, 0 ) $ ) ] #pagebreak() == Derivation #figure( image("./imgs/mapping.svg"), caption: [ D3D's coordinate system means bottom left corner is $(-1, -1)$. ], ) #figure( image("./imgs/frustum.svg"), caption: [ Full frustum that we need to map to clip space. ], ) #figure( image("./imgs/frustum_side.svg"), caption: [ Side view of the frustum projection. ], ) By the intercept theorem we can derive: $ x_p/x_e = y_p/y_e = z_p/z_e = (-n)/z_e $ Hence, $ x_p = (1/(-z_e))n x_e\ y_p = (1/(-z_e))n y_e\ z_p = -n = (1/(-z_e))n z_e\ $ The GPU does a perspective divide using a 4th dimension denoted by $w_c$, meaning every component of the clip coordinate is divided by the term $w_c$ automatically. This helps computing the division using the common factor $-z_e$: $ mat( dot, dot, dot, dot; dot, dot, dot, dot; dot, dot, dot, dot; 0, 0, -1, 0 ) dot mat(x_e ; y_e ; z_e ; 1) = mat(x_c; y_c; z_c; w_c) $ This normalizes the final device coordinates: $ mat(x_n ; y_n ; z_n ; w_n) = mat(x_c/w_c ; y_c/w_c ; z_c/w_c ; w_c/w_c) $ #figure( image("./imgs/corners.svg"), caption: [ Mapping from the corner coordinates of the frustum to the corresponding corners of the clip volume. ], ) The mapping must be a linear function $f(x) = alpha x + beta$ that converts a point in the near plane into a device coordinate $(x_p -> x_n, y_p -> y_n, z_p -> z_n)$. We can derive this mapping using the already known corner coordinates. For $x$: $ f(l) = -1, quad f(r) = 1 $ $ alpha &= (1 - (-1))/(r - l) = 2/(r - l)\ f(r) &= 1 = alpha r + beta = (2r)/(r - l) + beta\ <==> beta &= 1 - (2r)/(r - l) = - (r + l) / (r - l)\ <==> f(x_p) &= x_n = (2 / (r - l)) x_p - (r + l) / (r - l) $ For $y$: $ f(t) = 1, quad f(b) = -1 $ $ alpha &= (-1 - 1)/(b - t) = 2/(t - b)\ f(t) &= 1 = alpha t + beta = (2t)/(t - b) + beta\ <==> beta &= 1 - (2t)/(t - b) = - (t + b) / (t - b)\ <==> f(y_p) &= y_n = (2 / (t - b)) y_p - (t + b) / (t - b) $ Substituting $x_p$ and $y_p$: $ x_n &= (2 / (r - l)) x_p - (r + l) / (r - l)\ &= (2 / (r - l)) 1/(-z_e) n x_e - (r + l) / (r - l)\ &= (1/(-z_e)) ((2n) / (r - l) x_e + (r + l) / (r - l) z_e)\ &= (1/(-z_e)) x_c $ #parbreak() $ y_n &= (2 / (t - b)) y_p - (t + b) / (t - b)\ &= (2 / (t - b)) 1/(-z_e) n y_e - (t + b) / (t - b)\ &= (1/(-z_e)) ((2n) / (t - b) y_e + (t + b) / (t - b) z_e)\ &= (1/(-z_e)) y_c $ This fills the $x$ and $y$ mappings of our matrix: $ mat( (2n)/(r-l), 0, (r+l)/(r-l), 0; 0, (2n)/(t-b), (t+b)/(t-b), 0; dot, dot, dot, dot; 0, 0, -1, 0 ) dot mat(x_e ; y_e ; z_e ; 1) = mat(x_c; y_c; z_c; w_c) $ Finally, we can use a system of equations to deduce the mapping for $z_c$. Since the $z$ coordinate cannot depend from $x$ or $y$, we can fill those terms with zero: $ mat( (2n)/(r-l), 0, (r+l)/(r-l), 0; 0, (2n)/(t-b), (t+b)/(t-b), 0; 0, 0, A, B; 0, 0, -1, 0 ) dot mat(x_e ; y_e ; z_e ; 1) = mat(x_c; y_c; z_c; w_c) $ By definition, $ z_n = z_c / w_c = (A z_e + B) / (-z_e) $ For a reverse depth rendering, the near plane maps to $1$ and the far plane maps to $0$. We can use this fact to solve for $A$ and $B$: $ z_n = 1 => z_e = -n\ z_n = 0 => z_e = -f\ $ $ &cases( (A (-n) + B)/(-(-n)) = 1, (A (-f) + B)/(-(-f)) = 0, )\ <==> quad &cases( B - A n = n, B - A f = 0, )\ <==> quad &cases( A f - A n = n, B = A f )\ <==> quad &cases( A = n / (f - n), B = (n f) / (f - n) )\ $ Meaning $ z_n = 1/(-z_e)(n / (f - n) z_c + (n f) / (f - n)) $ $ mat( (2n) / (r - l), 0, (r + l)/(r - l), 0; 0, (2n)/(t - b), (t + b)/(t - b), 0; 0, 0, n/(f - n), (n f)/(f - n); 0, 0, -1, 0 ) dot mat(x_e ; y_e ; z_e ; 1) = mat(x_c; y_c; z_c; w_c) $ For the common case of a symmetric frustum $ l = -r, quad b = -t\ r - l = 2r, quad r + l = 0\ t - b = 2t, quad t + b = 0\ mat( (2n) / "width", 0, 0, 0; 0, (2n)/"height", 0, 0; 0, 0, n/(f - n), (n f)/(f - n); 0, 0, -1, 0 ) dot mat(x_e ; y_e ; z_e ; 1) = mat(x_c; y_c; z_c; w_c) $ Alternatively, from the FOV and aspect ratio: #figure( image("./imgs/fov.svg"), caption: [ Vertical field of view ], ) Since $"fov"_y = 2 theta$, then $ tan("fov"_y / 2) = "height" / (2n) <==> (2n) / "height" = 1 / tan("fov"_y / 2)\ (2n) / "width" = (2n) / "width" dot "height" / "height" = (2n) / "height" dot "height" / "width" = (2n) / "height" dot ("width" / "height")^(-1) $ Now define $ "focal length" = (2n) / "height" = 1 / tan("fov"_y / 2), quad "aspect ratio" = "width" / "height" $ And rewrite the matrix as such, $ mat( "focal length" / "aspect ratio", 0, 0, 0; 0, "focal length", 0, 0; 0, 0, n/(f - n), (n f)/(f - n); 0, 0, -1, 0 ) dot mat(x_e ; y_e ; z_e ; 1) = mat(x_c; y_c; z_c; w_c) $ For a symmetric frustum with infinite far plane, we just need to resolve the limits: $ lim_(f -> infinity) n / (f - n) = 0\ lim_(f -> infinity) (n f) / (f - n) = n * lim_(f -> infinity) f / (f - n) = n * 1 = n $ Which yields the equation $ mat( "focal length" / "aspect ratio", 0, 0, 0; 0, "focal length", 0, 0; 0, 0, 0, n; 0, 0, -1, 0 ) dot mat(x_e ; y_e ; z_e ; 1) = mat(x_c; y_c; z_c; w_c) $
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/ops-09.typ
typst
Other
// Test comparison operators. #test(13 * 3 < 14 * 4, true) #test(5 < 10, true) #test(5 > 5, false) #test(5 <= 5, true) #test(5 <= 4, false) #test(45deg < 1rad, true) #test(10% < 20%, true) #test(50% < 40% + 0pt, false) #test(40% + 0pt < 50% + 0pt, true) #test(1em < 2em, true)
https://github.com/OrangeX4/typst-test-sync-repo
https://raw.githubusercontent.com/OrangeX4/typst-test-sync-repo/main/packages/local/treemap/0.1.0/lib.typ
typst
#let _treemap(is-root: false, max-columns: 3, is-child-of-root: false, tree) = { if is-root { table( inset: (x: 0.2em, y: 0.6em), columns: calc.min(tree.children.len(), max-columns), ..tree.children.map(_treemap.with(is-child-of-root: true)), ) } else { if tree.children == () { box(inset: (x: 0.2em, y: 0em), rect(tree.title)) } else { let res = stack( { set align(center) set text(size: 1.25em, weight: "bold") tree.title }, v(0.8em), { tree.children.map(_treemap).sum() }, ) if is-child-of-root { res } else { box( inset: (x: 0.2em, y: 0em), rect( width: 100%, inset: (x: 0.2em, y: 0.6em), res, ), ) } } } } #let _list-title(cont) = { let res = ([],) for child in cont.children { if child.func() != list.item { res.push(child) } else { break } } res.sum() } #let _treemap-converter(cont) = { if not cont.has("children") { if cont.func() == list.item { (title: cont.body, children: ()) } else { (title: cont, children: ()) } } else { ( title: _list-title(cont), children: cont.children .filter(it => it.func() == list.item) .map(it => _treemap-converter(it.body)) ) } } #let treemap(cont) = _treemap(is-root: true, _treemap-converter(cont))
https://github.com/MasterTemple/typst-bible-plugin
https://raw.githubusercontent.com/MasterTemple/typst-bible-plugin/main/conf.typ
typst
#let conf( doc, ) = { import "bible.typ": bible_footnote, bible_quote, bible_quote_fmt // add paper formatting set text(font: "Arial") set page(numbering: "[ 1 ]", number-align: bottom + right) // add element customization show heading.where(level: 1): it => [ #it #line(length: 100%) ] show heading.where(level: 2): it => [ #pad( bottom: -0.5em, it ) #line(length: 90%, stroke: 0.8pt) ] show heading.where(level: 3): it => [ #pad( bottom: -0.5em, it ) #line(length: 90%, stroke: (thickness: 0.5pt, paint: gray)) ] let bible_regex_str = "((?:\d )?\w+(?: of Solomon)?) (\d+).(\d+(?:-\d+)?)?" // syntax for easily adding Bible footnotes // God loves the world ^ John 3.15 // let bible_footnote_regex = regex("\^ ?(\w+(?: of Solomon)?) (\d+).(\d+-?\d+)?") let bible_footnote_regex = regex("\^ ?" + bible_regex_str) show bible_footnote_regex: it => { let (book, chapter, verse) = it.text.match(bible_footnote_regex).captures [#h(1pt) #bible_footnote(book + " " + chapter + ":" + verse)] } // syntax for easily adding Bible quotes // > John 1:1-2 let bible_quote_regex = regex("> ?" + bible_regex_str) show bible_quote_regex: it => { let (book, chapter, verse) = it.text.match(bible_quote_regex).captures [#bible_quote(book + " " + chapter + ":" + verse)] } doc }
https://github.com/memset0/ZJU-Project-Report-Template
https://raw.githubusercontent.com/memset0/ZJU-Project-Report-Template/master/examples/co/report.typ
typst
MIT License
#import "../../template.typ": * #show: project.with( theme: "lab", title: "计算机组成 实验一", course: "计算机组成", name: "实验一:xxx", author: "xxx", school_id: "xxx", major: "计算机科学与技术", place: "东教 xxx", teacher: "yyy", date: "2050/01/01", ) = 实验一:(标题可以自拟) == 实验目的和要求 #lorem(100) == 实验内容和原理 === XXXX设计(实验任务) 例:(做了什么) 1. 分析基本和接口IP核 2. 设计存储器IP模块 3. 练习掌握IP核的使用方法 4. 选用第三方IP核和已有模块集成实现SOC === XXXX设计(实验原理) 可以对使用的模块展开说明(输入输出、功能等),也可以放数据通路的示意图等。 == 实验设备和环境 == 实验实现方法、步骤与调试 描述实验过程,可以放入逻辑连接图和关键代码。 == 实验结果与分析 #lorem(200) == 实验讨论、心得 心得体会 可以记录自己遇到了什么报错,以及怎么解决的
https://github.com/UriMtzF/uaemex-typst-template
https://raw.githubusercontent.com/UriMtzF/uaemex-typst-template/main/example.typ
typst
Apache License 2.0
#import "template.typ": * #show: project.with( title: "Title of the project", authors: ( "Author 1 name and surname", "Author 2 name and surname", "Author 3 name and surname", "Author 4 name and surname", ), subject: "Subject", date: ( year: 2023, month: 1, day: 10, ), isIndexed: true, ) = This is a header This is some content = This is some other header This is another example
https://github.com/Gekkio/gb-ctr
https://raw.githubusercontent.com/Gekkio/gb-ctr/main/appendix/pinouts.typ
typst
Creative Commons Attribution Share Alike 4.0 International
== Chip pinouts #columns(2)[ === CPU chips #figure( image("../images/DMG-CPU-pinout.svg", width: 100%), caption: [DMG/SGB CPU (Sharp QFP080-P-1420)] ) #figure( image("../images/MGB-CPU-pinout.svg", width: 100%), caption: [MGB/SGB2 CPU (Sharp QFP080-P-1420)] ) #colbreak() === Cartridge chips #figure( image("../images/MBC1-pinout.svg", width: 50%), caption: [MBC1 (Sharp SOP24-P-450) @tauwasser_mbc1] ) #figure( image("../images/MBC2-pinout.svg", width: 50%), caption: [MBC2 (Sharp SOP28-P-450) @tauwasser_mbc2] ) #figure( image("../images/MBC5-pinout.svg", width: 80%), caption: [MBC5 (Sharp QFP32-P-0707)] ) ]
https://github.com/jamesrswift/pixel-pipeline
https://raw.githubusercontent.com/jamesrswift/pixel-pipeline/main/src/math/lib.typ
typst
The Unlicense
#import "aabb.typ" #import "complex.typ" #import "matrix.typ" #import "vector.typ"
https://github.com/HEIGVD-Experience/docs
https://raw.githubusercontent.com/HEIGVD-Experience/docs/main/S4/ARO/docs/1-Introduction/gestion-memoire.typ
typst
#import "/_settings/typst/template-note.typ": conf #show: doc => conf( title: [ Gestion de la mémoire ], lesson: "ARO", chapter: "1 - Introduction", definition: "Comprendre la gestion de la mémoire dans le cours d'ARO vous permettera de pouvoir calculer facilement des tailles de mémoire ainsi que des adresses mémoires.", col: 1, doc, ) = Taille mémoire - Une adresse est stockée dans un mot de la mémoire d'un ordinateur. - Le nombre de bits d'un mot limite donc la taille maximale de la mémoire d'un ordinateur. == Exemple - Si un ordinateur utilise des mots de *32 bits*, la taille maximale de sa mémoire est de 4 gigabytes car, #set align(center) $2^32 = 2^2 * 2^30 = 4"GB"$ #set align(left) *NB*: comme nous le verrons plus tard, $2^30$ fait passer notre valeur en *GB* directement puis $2^2 = 4$ ce qui explique le $4"GB"$. == Taille mot mémoire La taille d'un mot mémoire est forcément un multiple de $8$. C'est pourquoi nous pouvons appliquer le tableau suivant : #image("/_src/img/docs/image.png") == Gestion des adresses En fonction de la taille de la mémoire nous aurons une taille d'adresses variables, le tableau suivant représente les possibilités : #image("/_src/img/docs/image2.png") // = Ilona mon amoureuse #colbreak() == Calculer les adresses === Calculer adresse de fin $ "Adr.Fin" = "Adr.Deb" + "Taille" - 1 $ === Calculer adresse de début $ "Adr.Deb" = "Adr.Fin" - "Taille" + 1 $ === Calculer la taille $ "Taille" = "Adr.Fin" - "Adr.Deb" + 1 $ $ "Taille" = 1 << log_2(2^n) $ $n =$ le nombre de bits alloué à la zone mémoire Exemple : $2"KB" = 2^10 * 2^1 = 2^11$ donc $n = 11$
https://github.com/FelipeCybis/quarto-physmed-template
https://raw.githubusercontent.com/FelipeCybis/quarto-physmed-template/main/physmed-poster-landscape/README.md
markdown
MIT License
## Physmed Quarto/Typst poster landscape template Check the [example PDF here](https://felipecybis.github.io/quarto-physmed-template/physmed-poster-landscape/template.pdf).
https://github.com/tingerrr/subpar
https://raw.githubusercontent.com/tingerrr/subpar/main/test/grid-cell/test.typ
typst
MIT License
// Synopsis: // - passing a grid sub element works as expected #import "/test/util.typ": * #import "/src/lib.typ" as subpar #subpar.grid( grid.cell([#figure(fake-image, caption: [Inner Caption]) <1a>], colspan: 2), figure(fake-image, caption: [Inner Caption]), <1b>, grid.vline(), figure(fake-image, caption: [Inner Caption]), <1c>, grid.hline(), columns: (1fr, 1fr), caption: [Super], label: <1>, )
https://github.com/noahjutz/AD
https://raw.githubusercontent.com/noahjutz/AD/main/uebungen/5/heap.typ
typst
#import "/config.typ": theme #import "/components/num_row.typ": single_num_row #import "/components/lefttree.typ": lefttree, draw_node, polygon_around, poly_fill, box_around, number, connect, bent_line, index_to_name, name_to_index, loop_line #import "@preview/cetz:0.3.0" #let heap( nums, bg_primary: (), bg_secondary: (), bg_tertiary: (), bg_success: (), hl_primary: (), hl_secondary: (), hl_tertiary: (), hl_success: (), swaps: (), annotations: (), detached: (), ) = { set align(center + bottom) cetz.canvas({ import cetz.tree: tree import cetz.draw: * tree( lefttree( nums.map(n => str(n)), ), spread: 1.5, draw-node: draw_node.with( hl_primary: hl_primary, hl_secondary: hl_secondary, hl_tertiary: hl_tertiary, hl_success: hl_success ), draw-edge: (from, to, ..target) => { if name_to_index(to) not in detached { line(from, to) } }, name: "tree" ) on-layer(-1, { for (indices, fill) in ( (bg_primary, theme.primary_light), (bg_secondary, theme.secondary_light), (bg_tertiary, theme.tertiary_light), (bg_success, theme.success_light), ) { if indices == range(nums.len()) { box_around(..indices, rect.with( stroke: none, fill: fill, radius: 14pt, )) } else if indices.len() >= 2 { polygon_around( ..indices, poly_fill.with(fill: fill) ) } } }) for (i, ann) in annotations { number(i, ann) } for (from, to) in swaps { if from == to { connect( from, to, loop_line.with(ang: 180deg) ) } else { connect( from, to, bent_line.with(bend: .5, mark: (symbol: ">")) ) } } }) single_num_row( nums, hl_primary: hl_primary, hl_secondary: hl_secondary, hl_tertiary: hl_tertiary, hl_success: hl_success, arrow: if swaps.len() > 0 {(from: swaps.at(0).at(0), to: swaps.at(0).at(1), direction: "bidirectional")} else {(:)} ) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-16F00.typ
typst
Apache License 2.0
#let data = ( ("MIAO LETTER PA", "Lo", 0), ("MIAO LETTER BA", "Lo", 0), ("MIAO LETTER YI PA", "Lo", 0), ("MIAO LETTER PLA", "Lo", 0), ("MIAO LETTER MA", "Lo", 0), ("MIAO LETTER MHA", "Lo", 0), ("MIAO LETTER ARCHAIC MA", "Lo", 0), ("MIAO LETTER FA", "Lo", 0), ("MIAO LETTER VA", "Lo", 0), ("MIAO LETTER VFA", "Lo", 0), ("MIAO LETTER TA", "Lo", 0), ("MIAO LETTER DA", "Lo", 0), ("MIAO LETTER YI TTA", "Lo", 0), ("MIAO LETTER YI TA", "Lo", 0), ("MIAO LETTER TTA", "Lo", 0), ("MIAO LETTER DDA", "Lo", 0), ("MIAO LETTER NA", "Lo", 0), ("MIAO LETTER NHA", "Lo", 0), ("MIAO LETTER YI NNA", "Lo", 0), ("MIAO LETTER ARCHAIC NA", "Lo", 0), ("MIAO LETTER NNA", "Lo", 0), ("MIAO LETTER NNHA", "Lo", 0), ("MIAO LETTER LA", "Lo", 0), ("MIAO LETTER LYA", "Lo", 0), ("MIAO LETTER LHA", "Lo", 0), ("MIAO LETTER LHYA", "Lo", 0), ("MIAO LETTER TLHA", "Lo", 0), ("MIAO LETTER DLHA", "Lo", 0), ("MIAO LETTER TLHYA", "Lo", 0), ("MIAO LETTER DLHYA", "Lo", 0), ("MIAO LETTER KA", "Lo", 0), ("MIAO LETTER GA", "Lo", 0), ("MIAO LETTER YI KA", "Lo", 0), ("MIAO LETTER QA", "Lo", 0), ("MIAO LETTER QGA", "Lo", 0), ("MIAO LETTER NGA", "Lo", 0), ("MIAO LETTER NGHA", "Lo", 0), ("MIAO LETTER ARCHAIC NGA", "Lo", 0), ("MIAO LETTER HA", "Lo", 0), ("MIAO LETTER XA", "Lo", 0), ("MIAO LETTER GHA", "Lo", 0), ("MIAO LETTER GHHA", "Lo", 0), ("MIAO LETTER TSSA", "Lo", 0), ("MIAO LETTER DZZA", "Lo", 0), ("MIAO LETTER NYA", "Lo", 0), ("MIAO LETTER NYHA", "Lo", 0), ("MIAO LETTER TSHA", "Lo", 0), ("MIAO LETTER DZHA", "Lo", 0), ("MIAO LETTER YI TSHA", "Lo", 0), ("MIAO LETTER YI DZHA", "Lo", 0), ("MIAO LETTER REFORMED TSHA", "Lo", 0), ("MIAO LETTER SHA", "Lo", 0), ("MIAO LETTER SSA", "Lo", 0), ("MIAO LETTER ZHA", "Lo", 0), ("MIAO LETTER ZSHA", "Lo", 0), ("MIAO LETTER TSA", "Lo", 0), ("MIAO LETTER DZA", "Lo", 0), ("MIAO LETTER YI TSA", "Lo", 0), ("MIAO LETTER SA", "Lo", 0), ("MIAO LETTER ZA", "Lo", 0), ("MIAO LETTER ZSA", "Lo", 0), ("MIAO LETTER ZZA", "Lo", 0), ("MIAO LETTER ZZSA", "Lo", 0), ("MIAO LETTER ARCHAIC ZZA", "Lo", 0), ("MIAO LETTER ZZYA", "Lo", 0), ("MIAO LETTER ZZSYA", "Lo", 0), ("MIAO LETTER WA", "Lo", 0), ("MIAO LETTER AH", "Lo", 0), ("MIAO LETTER HHA", "Lo", 0), ("MIAO LETTER BRI", "Lo", 0), ("MIAO LETTER SYI", "Lo", 0), ("MIAO LETTER DZYI", "Lo", 0), ("MIAO LETTER TE", "Lo", 0), ("MIAO LETTER TSE", "Lo", 0), ("MIAO LETTER RTE", "Lo", 0), (), (), (), (), ("MIAO SIGN CONSONANT MODIFIER BAR", "Mn", 0), ("MIAO LETTER NASALIZATION", "Lo", 0), ("MIAO SIGN ASPIRATION", "Mc", 0), ("MIAO SIGN REFORMED VOICING", "Mc", 0), ("MIAO SIGN REFORMED ASPIRATION", "Mc", 0), ("MIAO VOWEL SIGN A", "Mc", 0), ("MIAO VOWEL SIGN AA", "Mc", 0), ("MIAO VOWEL SIGN AHH", "Mc", 0), ("MIAO VOWEL SIGN AN", "Mc", 0), ("MIAO VOWEL SIGN ANG", "Mc", 0), ("MIAO VOWEL SIGN O", "Mc", 0), ("MIAO VOWEL SIGN OO", "Mc", 0), ("MIAO VOWEL SIGN WO", "Mc", 0), ("MIAO VOWEL SIGN W", "Mc", 0), ("MIAO VOWEL SIGN E", "Mc", 0), ("MIAO VOWEL SIGN EN", "Mc", 0), ("MIAO VOWEL SIGN ENG", "Mc", 0), ("MIAO VOWEL SIGN OEY", "Mc", 0), ("MIAO VOWEL SIGN I", "Mc", 0), ("MIAO VOWEL SIGN IA", "Mc", 0), ("MIAO VOWEL SIGN IAN", "Mc", 0), ("MIAO VOWEL SIGN IANG", "Mc", 0), ("MIAO VOWEL SIGN IO", "Mc", 0), ("MIAO VOWEL SIGN IE", "Mc", 0), ("MIAO VOWEL SIGN II", "Mc", 0), ("MIAO VOWEL SIGN IU", "Mc", 0), ("MIAO VOWEL SIGN ING", "Mc", 0), ("MIAO VOWEL SIGN U", "Mc", 0), ("MIAO VOWEL SIGN UA", "Mc", 0), ("MIAO VOWEL SIGN UAN", "Mc", 0), ("MIAO VOWEL SIGN UANG", "Mc", 0), ("MIAO VOWEL SIGN UU", "Mc", 0), ("MIAO VOWEL SIGN UEI", "Mc", 0), ("MIAO VOWEL SIGN UNG", "Mc", 0), ("MIAO VOWEL SIGN Y", "Mc", 0), ("MIAO VOWEL SIGN YI", "Mc", 0), ("MIAO VOWEL SIGN AE", "Mc", 0), ("MIAO VOWEL SIGN AEE", "Mc", 0), ("MIAO VOWEL SIGN ERR", "Mc", 0), ("MIAO VOWEL SIGN ROUNDED ERR", "Mc", 0), ("MIAO VOWEL SIGN ER", "Mc", 0), ("MIAO VOWEL SIGN ROUNDED ER", "Mc", 0), ("MIAO VOWEL SIGN AI", "Mc", 0), ("MIAO VOWEL SIGN EI", "Mc", 0), ("MIAO VOWEL SIGN AU", "Mc", 0), ("MIAO VOWEL SIGN OU", "Mc", 0), ("MIAO VOWEL SIGN N", "Mc", 0), ("MIAO VOWEL SIGN NG", "Mc", 0), ("MIAO VOWEL SIGN UOG", "Mc", 0), ("MIAO VOWEL SIGN YUI", "Mc", 0), ("MIAO VOWEL SIGN OG", "Mc", 0), ("MIAO VOWEL SIGN OER", "Mc", 0), ("MIAO VOWEL SIGN VW", "Mc", 0), ("MIAO VOWEL SIGN IG", "Mc", 0), ("MIAO VOWEL SIGN EA", "Mc", 0), ("MIAO VOWEL SIGN IONG", "Mc", 0), ("MIAO VOWEL SIGN UI", "Mc", 0), (), (), (), (), (), (), (), ("MIAO TONE RIGHT", "Mn", 0), ("MIAO TONE TOP RIGHT", "Mn", 0), ("MIAO TONE ABOVE", "Mn", 0), ("MIAO TONE BELOW", "Mn", 0), ("MIAO LETTER TONE-2", "Lm", 0), ("MIAO LETTER TONE-3", "Lm", 0), ("MIAO LETTER TONE-4", "Lm", 0), ("MIAO LETTER TONE-5", "Lm", 0), ("MIAO LETTER TONE-6", "Lm", 0), ("MIAO LETTER TONE-7", "Lm", 0), ("MIAO LETTER TONE-8", "Lm", 0), ("MIAO LETTER REFORMED TONE-1", "Lm", 0), ("MIAO LETTER REFORMED TONE-2", "Lm", 0), ("MIAO LETTER REFORMED TONE-4", "Lm", 0), ("MIAO LETTER REFORMED TONE-5", "Lm", 0), ("MIAO LETTER REFORMED TONE-6", "Lm", 0), ("MIAO LETTER REFORMED TONE-8", "Lm", 0), )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/regression/issue26.typ
typst
Other
#let x = (a: 4) #{ x.at("b") = 5 } #x
https://github.com/bigskysoftware/hypermedia-systems-book
https://raw.githubusercontent.com/bigskysoftware/hypermedia-systems-book/main/ch13-extending-the-hyperview-client.typ
typst
Other
#import "lib/definitions.typ": * == Extending The Hyperview Client In the previous chapter, we created a fully-featured native mobile version of our Contacts app. Aside from customizing the entry point URL, we didn’t need to touch any code that runs on the mobile device. We defined our mobile app’s UI and logic completely in the backend code, using Flask and HXML templates. This is possible because the standard Hyperview client supports all of the basic features by mobile apps. But the standard Hyperview client can’t do everything out of the box. As app developers, we want apps to have unique touches like custom UIs or deep integration with platform capabilities. To support these needs, the Hyperview client was designed to be extended with custom behavior actions and UI elements. In this section, we will enhance our mobile app with examples of both. Before diving in, let’s take a quick look at the tech stack we’ll be using. The Hyperview client is written in React Native, a popular cross-platform framework for creating mobile apps. It uses the same component-based API as React. This means developers familiar with JavaScript and React can quickly pick up React Native. React Native has a healthy ecosystem of open-source libraries. We’ll be leveraging these libraries to create our custom extensions to the Hyperview client. === Adding Phone Calls and Email #index[Hyperview][phone calls] Let’s start with the most obvious feature missing from our Contacts app: phone calls. Mobile devices can make phone calls. The contacts in our app have phone numbers. Shouldn’t our app support calling those phone numbers? And while we’re at it, our app should also support e-mailing the contacts. On the web, calling phone numbers is supported with the `tel:` URI scheme, and e-mails are supported with the `mailto:` URI scheme: #figure(caption: [`tel` and `mailto` schemes in HTML])[ ```html <a href="tel:555-555-5555">Call</a> <1> <a href="mailto:<EMAIL>">Email</a> <2> ``` ] + When clicked, prompt the user to call the given phone number + When clicked, open an e-mail client with the given address populated in the `to:` field. The Hyperview client doesn’t support the `tel:` and `mailto:` URI schemes. But we can add these capabilities to the client with custom behavior actions. Remember that behaviors are interactions defined in HXML. Behaviors have triggers ("press", "refresh") and actions ("update", "share"). The values of "action" are not limited to the set that comes in the Hyperview library. So let’s define two new actions, "open-phone" and "open-email". #figure( caption: [Phone and Email actions], )[ ```xml <view xmlns:comms="https://hypermedia.systems/hyperview/communications"> <1> <text> <behavior action="open-phone" comms:phone-number="555-555-5555" /> <2> Call </text> <text> <behavior action="open-email" comms:email-address="<EMAIL>" /> <3> Email </text> </view> ``` ] + Define an alias for an XML namespace used by our new attributes. + When pressed, prompt the user to call the given phone number. + When pressed, open an e-mail client with the given address populated in the `to:` field. Notice we defined the actual phone number and email address using separate attributes. In HTML, the scheme and data are crammed into the `href` attribute. HXML’s `<behavior>` elements give more options for representing the data. We chose to use attributes, but we could have represented the phone number or email using child elements. We’re also using a namespace to avoid potential future conflicts with other client extensions. So far so good, but how does the Hyperview client know how to interpret `open-phone` and `open-email`, and how to reference the `phone-number` and `email-address` attributes? This is where we finally need to write some JavaScript. First, we’re going to add a 3rd-party library (`react-native-communications`) to our demo app. This library provides a simple API that interacts with OS-level functionality for calls and emails. ```bash cd hyperview/demo yarn add react-native-communications <1> yarn start <2> ``` + Add dependency on `react-native-communications` + Re-start the mobile app Next, we’ll create a new file, `phone.js`, that will implement the code associated with the `open-phone` action: #figure( caption: [demo/src/phone.js], )[ ```js import { phonecall } from 'react-native-communications'; <1> const namespace = "https://hypermedia.systems/hyperview/communications"; export default { action: "open-phone", <2> callback: (behaviorElement) => { <3> const number = behaviorElement .getAttributeNS(namespace, "phone-number"); <4> if (number != null) { phonecall(number, false); <5> } }, }; ``` ] + Import the function we need from the 3rd party library. + The name of the action. + The callback that runs when the action triggers. + Get the phone number from the `<behavior>` element. + Pass the phone number to the function from the 3rd party library. Custom actions are defined as a JavaScript object with two keys: `action` and `callback`. This is how the Hyperview client associates a custom action in the HXML with our custom code. The callback value is a function that takes a single parameter, `behaviorElement`. This parameter is an XML DOM representation of the `<behavior>` element that triggered the action. That means we can call methods on it like `getAttribute`, or access attributes like `childNodes`. In this case, we use `getAttributeNS` to read the phone number from the `phone-number` attribute on the `<behavior>` element. If the phone number is defined on the element, we can call the `phonecall()` function provided by the `react-native-communications` library. There’s one more thing to do before we can use our custom action: register the action with the Hyperview client. The Hyperview client is represented as a React Native component called `Hyperview`. This component takes a prop called `behaviors`, which is an array of custom action objects like our "open-phone" action. Let’s pass our "open-phone" implementation to the `Hyperview` component in our demo app. #figure(caption: [demo/src/HyperviewScreen.js])[ ```js import React, { PureComponent } from 'react'; import Hyperview from 'hyperview'; import OpenPhone from './phone'; <1> export default class HyperviewScreen extends PureComponent { // ... omitted for brevity behaviors = [OpenPhone]; <2> render() { return ( <Hyperview behaviors={this.behaviors} <3> entrypointUrl={this.entrypointUrl} // more props... /> ); } } ``` ] + Import the open-phone action. + Create an array of custom actions. + Pass the custom actions to the `Hyperview` component, as a prop called `behaviors`. Under the hood, the `Hyperview` component is responsible for taking HXML and turning it into mobile UI elements. It also handles triggering behavior actions based on user interactions. By passing the "open-phone" action to Hyperview, we can now use it as a value for the `action` attribute on `<behavior>` elements. In fact, let’s do that now by updating the `show.xml` template in our Flask app: #figure( caption: [Snippet of `hv/show.xml`], )[ ```xml {% block content %} <view style="details"> <text style="contact-name"> {{ contact.first }} {{ contact.last }} </text> <view style="contact-section"> <behavior <1> xmlns:comms="https://hypermedia.systems/hyperview/communications" trigger="press" action="open-phone" <2> comms:phone-number="{{contact.phone}}" <3> /> <text style="contact-section-label">Phone</text> <text style="contact-section-info">{{contact.phone}}</text> </view> <view style="contact-section"> <behavior <4> xmlns:comms="https://hypermedia.systems/hyperview/communications" trigger="press" action="open-email" comms:email-address="{{contact.email}}" /> <text style="contact-section-label">Email</text> <text style="contact-section-info">{{contact.email}}</text> </view> </view> {% endblock %} ``` ] + Add a behavior to the phone number section that triggers on "press." + Trigger the new "open-phone" action. + Set the attribute expected by the "open-phone" action. + Same idea, with a different action ("open-email"). #index[Hyperview][email] We’ll skip over the implementation of the second custom action, "open-email." As you can guess, this action will open a system-level email composer to let the user send an email to their contact. The implementation of "open-email" is almost identical to "open-phone." The `react-native-communications` library exposes a function called `email()`, so we just wrap it and pass arguments to it in the same way. We now have a complete example of extending the client with custom behavior actions. We chose a new name for our actions ("open-phone" and "open-email"), and mapped those names to functions. The functions take `<behavior>` elements and can run any arbitrary React Native code. We wrapped an existing 3rd party library, and read attributes set on the `<behavior>` element to pass data to the library. After re-starting our demo app, our client has new capabilities we can immediately utilize by referencing the actions from our HXML templates. === Adding Messages #index[Hyperview][messages] The phone and email actions added in the previous section are examples of "system actions." System actions trigger some UI or capability provided by the device’s OS. But custom actions are not limited to interacting with OS-level APIs. Remember, the callbacks that implement actions can run arbitrary code, including code that renders our own UI elements. This next custom action example will do just that: render a custom confirmation message UI element. If you recall, our Contacts web app shows messages upon successful actions, such as deleting or creating a contact. These messages are generated in the Flask backend using the `flash()` function, called from the views. Then the base `layout.html` template renders the messages into the final web page. #figure(caption: [Snippet templates/layout.html], ``` {% for message in get_flashed_messages() %} <div class="flash">{{ message }}</div> {% endfor %} ```) Our Flask app still includes the calls to `flash()`, but the Hyperview app is not accessing the flashed message to display to the user. Let’s add that support now. We could just show the messages using a similar technique to the web app: loop through the messages and render some `<text>` elements in `layout.xml`. This approach has a major downside: the rendered messages would be tied to a specific screen. If that screen was hidden by a navigation action, the message would be hidden too. What we really want is for our message UI to display "above" all of the screens in the navigation stack. That way, the message would remain visible (fading away after a few seconds), even if the stack of screens changes below. To display some UI outside of the `<screen>` elements, we’re going to need to extend the Hyperview client with a new custom action, `show-message`. This is another opportunity to use an open-source library, `react-native-root-toast`. Let’s add this library to our demo app. ```bash cd hyperview/demo yarn add react-native-root-toast <1> yarn start <2> ```] + Add dependency on `react-native-root-toast` + Re-start the mobile app Now, we can write the code to implement the message UI as a custom action. #figure( caption: [demo/src/message.js], )[ ```js import Toast from 'react-native-root-toast'; <1> const namespace = "https://hypermedia.systems/hyperview/message"; export default { action: "show-message", <2> callback: (behaviorElement) => { <3> const text = behaviorElement.getAttributeNS(namespace, "text"); if (text != null) { Toast.show(text, { <4> position: Toast.positions.TOP, duration: 2000 }); } }, }; ``` ] + Import the `Toast` API. + The name of the action. + The callback that runs when the action triggers. + Pass the message to the toast library. This code looks very similar to the implementation of `open-phone`. Both callbacks follow a similar pattern: read namespaced attributes from the `<behavior>` element, and pass those values to a 3rd party library. For simplicity, we’re hard-coding options to show the message at the top of the screen, fading out after 2 seconds. But `react-native-root-toast` exposes many options for positioning, timing of animations, colors, and more. We could specify these options using extra attributes on `behaviorElement` to make the action more configurable. For our purposes, we will just stick to a bare-bones implementation. Now we need to register our custom action with the `<Hyperview>` component, by passing it to the `behaviors` prop. #figure(caption: [demo/src/HyperviewScreen.js])[ ```js import React, { PureComponent } from 'react'; import Hyperview from 'hyperview'; import OpenEmail from './email'; import OpenPhone from './phone'; import ShowMessage from './message'; <1> export default class HyperviewScreen extends PureComponent { // ... omitted for brevity behaviors = [OpenEmail, OpenPhone, ShowMessage]; <2> // ... omitted for brevity } ``` ] + Import the `show-message` action. + Pass the action to the `Hyperview` component, as a prop called `behaviors`. All that’s left to do is trigger the `show-message` action from our HXML. There are three user actions that result in showing a message: + Creating a new contact + Updating an existing contact + Deleting a contact The first two actions are implemented in our app using the same HXML template, `form_fields.xml`. Upon successfully creating or updating a contact, this template will reload the screen and trigger an event, using behaviors that trigger on "load". The deletion action also uses behaviors that trigger on "load", defined in the `deleted.xml` template. So both `form_fields.xml` and `deleted.xml` need to be modified to also show messages on load. Since the actual behaviors will be the same in both templates, let’s create a shared template to reuse the HXML. #figure(caption: [hv/templates/messages.xml])[ ```xml {% for message in get_flashed_messages() %} <behavior <1> xmlns:message="https://hypermedia.systems/hyperview/message" trigger="load" <2> action="show-message" <3> message:text="{{ message }}" <4> /> {% endfor %} ``` ] + Define a behavior for each message to display. + Trigger this behavior as soon as the element loads. + Trigger the new "show-message" action. + The "show-message" action will display the flashed message in its UI. Like in `layout.html` of the web app, we loop through all of the flashed messages and render some markup for each message. However, in the web app, the message was directly rendered into the web page. In the Hyperview app, each message is displayed using a behavior that triggers our custom UI. Now we just need to include this template in `form_fields.xml`: #figure( caption: [Snippet of hv/templates/form\_fields.xml], )[ ```xml <view xmlns="https://hyperview.org/hyperview" style="edit-group"> {% if saved %} {% include "hv/messages.xml" %} <1> <behavior trigger="load" once="true" action="dispatch-event" event-name="contact-updated" /> <behavior trigger="load" once="true" action="reload" href="/contacts/{{contact.id}}" /> {% endif %} <!-- omitted for brevity --> </view> ``` ] + Show the messages as soon as the screen loads. And we can do the same thing in `deleted.xml`: #figure( caption: [hv/templates/deleted.xml], )[ ```xml <view xmlns="https://hyperview.org/hyperview"> {% include "hv/messages.xml" %} <1> <behavior trigger="load" action="dispatch-event" event-name="contact-updated" /> <behavior trigger="load" action="back" /> </view> ``` ] + Show the messages as soon as the screen loads. In both `form_fields.xml` and `deleted.xml`, multiple behaviors get triggered on "load." In `deleted.xml`, we immediately navigate back to the previous screen. In `form_fields.xml`, we immediately reload the current screen to show the Contact details. If we rendered our message UI elements directly in the screen, the user would barely see them before the screen disappeared or reloaded. By using a custom action, the message UI remains visible even while the screens change beneath them. #figure([#image("images/screenshot_hyperview_toast.png")], caption: [ Message shown during back navigation ]) === Swipe Gesture on Contacts <_swipe_gesture_on_contacts> To add communication capabilities and the message UI, we extended the client with custom behavior actions. But the Hyperview client can also be extended with custom UI components that render on the screen. Custom components are implemented as React Native components. That means anything that’s possible in React Native can be done in Hyperview as well! Custom components open up endless possibilities to build rich mobile apps with the Hypermedia architecture. To illustrate the possibilities, we will extend the Hyperview client in our mobile app to add a "swipeable row" component. How does it work? The "swipeable row" component supports a horizontal swiping gesture. As the user swipes this component from right to left, the component will slide over, revealing a series of action buttons. Each action button will be able to trigger standard Hyperview behaviors when pressed. We will use this custom component in our Contacts List screen. Each contact item will be a "swipeable row", and the actions will give quick access to edit and delete actions for the contact. #figure([#image("images/screenshot_hyperview_swipe.png")], caption: [ Swipeable contact item ]) ==== Designing The Component <_designing_the_component> Rather than implementing the swipe gesture from scratch, we will once again use an open-source third-party library: `react-native-swipeable`. ```bash cd hyperview/demo yarn add react-native-swipeable <1> yarn start <2> ```] + Add dependency on `react-native-swipeable`. + Re-start the mobile app. This library provides a React Native component called `Swipeable`. It can render any React Native components as its main content (the part that can be swiped). It also takes an array of React Native components as a prop to render as the action buttons. When designing a custom component, we like to define the HXML of the component before writing the code. This way, we can make sure the markup is expressive but succinct, and will work with the underlying library. For the swipeable row, we need a way to represent the entire component, the main content, and one of many buttons. ```xml <swipe:row xmlns:swipe="https://hypermedia.systems/hyperview/swipeable"> <1> <swipe:main> <2> <!-- main content shown here --> </swipe:main> <swipe:button> <3> <!-- first button that appears when swiping --> </swipe:button> <swipe:button> <4> <!-- second button that appears when swiping --> </swipe:button> </swipe:row> ```] + Parent element encapsulating the entire swipeable row, with custom namespace. + The main content of the swipeable row, can hold any HXML. + The first button that appears when swiping, can hold any HXML. + The second button that appears when swiping, can hold any HXML. This structure clearly separates the main content from the buttons. It also supports one, two, or more buttons. Buttons appear in the order of definition, making it easy to swap the order. This design covers everything we need to implement a swipeable row for our contacts list. But it’s also generic enough to be reusable. The previous markup contains nothing specific to the contact name, editing the contact, or deleting the contact. If later we add another list screen to our app, we can use this component to make the items in that list swipeable. ==== Implementing The Component <_implementing_the_component> Now that we know the HXML structure of our custom component, we can write the code to implement it. What does that code look like? Hyperview components are written as React Native components. These React Native components are mapped to a unique XML namespace and tag name. When the Hyperview client encounters that namespace and tag name in the HXML, it delegates rendering of the HXML element to the matching React Native component. As part of delegation, the Hyperview Client passes several props to the React Native component: - `element`: The XML DOM element that maps to the React Native component. - `stylesheets`: The styles defined in the `<screen>`. - `onUpdate`: The function to call when the component triggers a behavior. - `option`: Miscellaneous settings used by the Hyperview client. Our swipeable row component is a container with slots to render arbitrary main content and buttons. That means it needs to delegate back to the Hyperview client to render those parts of the UI. This is done with a public function exposed by the Hyperview client, `Hyperview.renderChildren()`. Now that we know how custom Hyperview components are implemented, let’s write the code for our swipeable row. #figure( caption: [demo/src/swipeable.js], )[ ```js import React, { PureComponent } from 'react'; import Hyperview from 'hyperview'; import Swipeable from 'react-native-swipeable'; const NAMESPACE_URI = 'https://hypermedia.systems/hyperview/swipeable'; export default class SwipeableRow extends PureComponent { <1> static namespaceURI = NAMESPACE_URI; <2> static localName = "row"; <3> getElements = (tagName) => { return Array.from(this.props.element .getElementsByTagNameNS(NAMESPACE_URI, tagName)); }; getButtons = () => { <4> return this.getElements("button").map((buttonElement) => { return Hyperview.renderChildren(buttonElement, this.props.stylesheets, this.props.onUpdate, this.props.options); <5> }); }; render() { const [main] = this.getElements("main"); if (!main) { return null; } return ( <Swipeable rightButtons={this.getButtons()}> <6> {Hyperview.renderChildren(main, this.props.stylesheets, this.props.onUpdate, this.props.options)} <7> </Swipeable> ); } } ``` ] + Class-based React Native component. + Map this component to the given HXML namespace. + Map this component to the given HXML tag name. + Function that returns an array of React Native components for each `<button>` element. + Delegate to the Hyperview client to render each button. + Pass the buttons and main content to the third-party library. + Delegate to the Hyperview client to render the main content. The `SwipeableRow` class implements a React Native component. At the top of the class, we set a static `namespaceURI` property and `localName` property. These properties map the React Native component to a unique namespace and tag name pair in the HXML. This is how the Hyperview client knows to delegate to `SwipeableRow` when encountering custom elements in the HXML. At the bottom of the class, you’ll see a `render()` method. `render()` gets called by React Native to return the rendered component. Since React Native is built on the principle of composition, `render()` typically returns a composition of other React Native components. In this case, we return the `Swipeable` component (provided by the `react-native-swipeable` library), composed with React Native components for the buttons and main content. The React Native components for the buttons and main content are created using a similar process: - Find the specific child elements (`<button>` or `<main>`). - Turn those elements into React Native components using `Hyperview.renderChildren()`. - Set the components as children or props of `Swipeable`. #asciiart( read("images/diagram/hyperview-components.txt"), caption: [Rendering delegation between the client and the custom components], ) This code may be hard to follow if you’ve never worked with React or React Native. That’s OK. The important takeaway is: we can write code to translate arbitrary HXML into React Native components. The structure of the HXML (both attributes and elements) can be used to represent multiple facets of the UI (in this case, the buttons and main content). Finally, the code can delegate rendering of child components back to the Hyperview client. The result: this swipeable row component is completely generic. The actual structure and styling and interactions of the main content and buttons can be defined in the HXML. Creating a generic component means we can reuse it across multiple screens for different purposes. If we add more custom components or new behavior actions in the future, they will work with our swipeable row implementation. The last thing to do is register this new component with the Hyperview client. The process is similar to registering custom actions. Custom components are passed as a separate `components` prop to the `Hyperview` component. #figure(caption: [demo/src/HyperviewScreen.js])[ ```js import React, { PureComponent } from 'react'; import Hyperview from 'hyperview'; import OpenEmail from './email'; import OpenPhone from './phone'; import ShowMessage from './message'; import SwipeableRow from './swipeable'; <1> export default class HyperviewScreen extends PureComponent { // ... omitted for brevity behaviors = [OpenEmail, OpenPhone, ShowMessage]; components = [SwipeableRow]; <2> render() { return ( <Hyperview behaviors={this.behaviors} components={this.components} <3> entrypointUrl={this.entrypointUrl} // more props... /> ); } } ``` ] + Import the `SwipeableRow` component. + Create an array of custom components. + Pass the custom component to the `Hyperview` component, as a prop called `components`. We’re now ready to update our HXML templates to make use of the new swipeable row component. ===== Using the component <_using_the_component> Currently, the HXML for a contact item in the list consists of a `<behavior>` and `<text>` element: #figure( caption: [Snippet of `hv/rows.xml`], )[ ```xml <item key="{{ contact.id }}" style="contact-item"> <behavior trigger="press" action="push" href="/contacts/{{ contact.id }}" /> <text style="contact-item-label"> <!-- omitted for brevity --> </text> </item> ``` ] With our swipeable row component, this markup will become the "main" UI. So let’s start by adding `<row>` and `<main>` as ancestor elements. #figure( caption: [Adding swipeable row `hv/rows.xml`], )[ ```xml <item key="{{ contact.id }}"> <swipe:row <1> xmlns:swipe="https://hypermedia.systems/hyperview/swipeable"> <swipe:main> <2> <view style="contact-item"> <3> <behavior trigger="press" action="push" href="/contacts/{{ contact.id }}" /> <text style="contact-item-label"> <!-- omitted for brevity --> </text> </view> </swipe:main> </swipe:row> </item> ``` ] + Added `<swipe:row>` ancestor element, with namespace alias for `swipe`. + Added `<swipe:main>` element to define the main content. + Wrapped the existing `<behavior>` and `<text>` elements in a `<view>`. Previously, the `contact-item` style was set on the `<item>` element. That made sense when the `<item>` element was the container for the main content of the list item. Now that the main content is a child of `<swipe:main>`, we need to introduce a new `<view>` where we apply the styles. If we reload our backend and mobile app, you won’t experience any changes on the Contacts List screen yet. Without any action buttons defined, there’s nothing to reveal when swiping a row. Let’s add two buttons to the swipeable row. #figure( caption: [Adding swipeable row `hv/rows.xml`], )[ ```xml <item key="{{ contact.id }}"> <swipe:row xmlns:swipe="https://hypermedia.systems/hyperview/swipeable"> <swipe:main> <!-- omitted for brevity --> </swipe:main> <swipe:button> <1> <view style="swipe-button"> <text style="button-label">Edit</text> </view> </swipe:button> <swipe:button> <2> <view style="swipe-button"> <text style="button-label-delete">Delete</text> </view> </swipe:button> </swipe:row> </item> ``` ] + Added `<swipe:button>` for edit action. + Added `<swipe:button>` for delete action. Now if we use our mobile app, we can see the swipeable row in action! As you swipe the contact item, the "Edit" and "Delete" buttons reveal themselves. But they don’t do anything yet. We need to add some behaviors to these buttons. The "Edit" button is straight-forward: pressing it should open the contact details screen in edit mode. #figure( caption: [Snippet of `hv/rows.xml`], )[ ```xml <swipe:button> <view style="swipe-button"> <behavior trigger="press" action="push" href="/contacts/{{ contact.id }}/edit" /> <1> <text style="button-label">Edit</text> </view> </swipe:button> ``` ] + When pressed, push a new screen with the Edit Contact UI. The "Delete" button is a bit more complicated. There’s no screen to open for deletion, so what should happen when the user presses this button? Perhaps we use the same interaction as the "Delete" button on the Edit Contact screen. That interaction brings up a system dialog, asking the user to confirm the deletion. If the user confirms, the Hyperview client makes a `POST` request to `/contacts/<contact_id>/delete`, and appends the response to the screen. The response triggers a few behaviors immediately to reload the contacts list and show a message. This interaction will work for our action button as well: #figure( caption: [Snippet of `hv/rows.xml`], )[ ```xml <swipe:button> <view style="swipe-button"> <behavior <1> xmlns:alert="https://hyperview.org/hyperview-alert" trigger="press" action="alert" alert:title="Confirm delete" alert:message="Are you sure you want to delete {{ contact.first }}?" > <alert:option alert:label="Confirm"> <behavior <2> trigger="press" action="append" target="item-{{ contact.id }}" href="/contacts/{{ contact.id }}/delete" verb="post" /> </alert:option> <alert:option alert:label="Cancel" /> </behavior> <text style="button-label-delete">Delete</text> </view> </swipe:button> ``` ] + When pressed, open a system dialog box asking the user to confirm the action. + If confirmed, make a POST request to the deletion endpoint, and append the response to the enclosing `<item>`. Now when we press "Delete," we get the confirmation dialog as expected. After pressing confirm, the backend response triggers behaviors that show a confirmation message and reload the list of contacts. The item for the deleted contact disappears from the list. #figure([#image("images/screenshot_hyperview_swipe_delete.png")], caption: [ Delete from swipe button ]) Notice that the action buttons are able to support any type of behavior action, from `push` to `alert`. If we wanted to, we could have the action buttons trigger our custom actions, like `open-phone` and `open-email`. Custom components and actions can be mixed freely with the standard components and actions that come standard with the Hyperview framework. This makes the extensions to the Hyperview client feel like first-class features. In fact, we’ll let you in on a secret. Within the Hyperview client, standard components and actions are implemented the same way as custom components and actions! The rendering code does not treat `<view>` differently from `<swipe:row>`. The behavior code does not treat `alert` differently from `open-phone`. They are both implemented using the same techniques described in this section. Standard components and actions are just the ones that are universally needed by all mobile apps. But they are just the starting point. Most mobile apps will require some extensions to the Hyperview client to deliver a great user experience. Extensions evolve the client from being a generic "Hyperview client," to being a purpose-built client for your app. And importantly, this evolution preserves the Hypermedia, server-driven architecture and all of its benefits. === Mobile Hypermedia-Driven Applications <_mobile_hypermedia_driven_applications> That concludes our build of mobile Contact.app. Step back from the code details and consider the broader pattern: - The core logic of the app resides on the server. - Server-rendered templates power both the web and mobile apps. - Platform customizations are done through scripting on the web, and client customization on mobile. The Hypermedia-Driven Application architecture allowed for significant code reuse and a manageable tech stack. Ongoing app updates and maintenance for both web and mobile can be done at the same time. Yes, there is a story for Hypermedia-Driven Applications on mobile. === Hypermedia Notes: Good-Enough UX and Islands of Interactivity <_hypermedia_notes_good_enough_ux_and_islands_of_interactivity> A problem many SPA and native mobile developers face when coming to the HDA approach is that they look at their current application and imagine implementing it exactly using hypermedia. While htmx and Hyperview significantly improve the user experience available via the hypermedia-driven approach, there are still times when it won’t be easy to pull of a particular user experience. As we saw in Chapter Two, <NAME> noted this tradeoff with respect to the web’s RESTful network architecture, where "information is transferred in a standardized form rather than one which is specific to an application’s needs." Accepting a slightly less efficient and interactive solution to a particular UX can save you a tremendous amount of complexity when building your applications. Do not let the perfect be the enemy of the good. Many advantages are to be gained by accepting a slightly less sophisticated user experience in some cases, and tools like htmx and Hyperview make that compromise much more palatable when they are used properly.
https://github.com/Meisenheimer/Notes
https://raw.githubusercontent.com/Meisenheimer/Notes/main/src/Optimization.typ
typst
MIT License
#import "@local/math:1.0.0": * = Optimization == One-dimensional Line Search #env("Definition")[ Given a function $f: RR^n -> RR$, a initial point $mathbf(x)$ and a direction $mathbf(d)$, denoted by $phi(alpha) = f(mathbf(x) + alpha mathbf(d))$, a *one-dimensional line search* method solves the problem $ phi(alpha) = min_(t in RR^+) phi(t). $ ] #env("Method", name: "Success-failure method")[ For a one-dimensional line search problem, the *success-failure method* is an inexact one-dimensional line search method to solve the interval $[a, b] in [0, +infinity)$ that exact solution $alpha^* in [a, b]$, where we + Choose initial value $alpha_0 in [0, +infinity)$, $h_0 > 0$, $t > 0$(commonly choose $t = 2$), calculate $phi(alpha_0)$ and let $k = 0$; + Let $alpha_(k+1) = alpha_k + h_k$ and calculate $phi(alpha_(k+1))$, if $phi(alpha_(k+1)) < phi(alpha_k)$, then go to (3), otherwise go to (4); + Let $h_(k+1) = t h_k$, $alpha = alpha_k$, $k = k + 1$, and go to (2); + If $k = 0$, then let $h_k = -h_k$ and go to (2), otherwise stop and the solution $[a, b]$ satisfies $ a = min{alpha, alpha_k}, #h(1em) b = max{alpha, alpha_k}. $ ] #env("Definition")[ A general form of one-dimensional line search method is the following three steps: + *Initialization*: given initial point $mathbf(x)$ and acceptable error $epsilon > 0$, $delta > 0$; + *Iteration*: calculate the direction $mathbf(d)$ and step size $alpha$ that $f(mathbf(x) + alpha mathbf(d)) = limits(min)_(t in RR^+) f(mathbf(x) + t mathbf(d))$ and let $mathbf(x) = mathbf(x) + alpha mathbf(d)$; + *Stop condition*: if $||nabla f(mathbf(x))|| <= epsilon$ or $U_(RR^n) (x, delta)$ includes the exact solution, then the current $mathbf(x)$ is the solution. where the iteration step are repeated until $mathbf(x)$ satisfies the stop condition. ] #env("Definition")[ Given a method, denoted by ${mathbf(x)_k}$ the sequence of the iteration and $mathbf(x)^*$ the exact solution, the method is *(Q-)linear convergence* if $ lim_(k -> infinity) (||mathbf(x)_(k+1) - mathbf(x)^*||)/(||mathbf(x)_k - mathbf(x)^*||) in (0, 1), $ the method is *(Q-)sublinear convergence* if $ lim_(k -> infinity) (||mathbf(x)_(k+1) - mathbf(x)^*||)/(||mathbf(x)_k - mathbf(x)^*||) = 1, $ the method is *(Q-)superlinear convergence* if $ lim_(k -> infinity) (||mathbf(x)_(k+1) - mathbf(x)^*||)/(||mathbf(x)_k - mathbf(x)^*||) = 0. $ For a superlinear convergence method, the method is $r$-order linear convergence if $ lim_(k -> infinity) (||mathbf(x)_(k+1) - mathbf(x)^*||)/(||mathbf(x)_k - mathbf(x)^*||^r) in [0, +infinity), $ where when $r = 2$ is called *(Q-)quadratic convergence*. ] #env("Remark")[ There is another *R-convergence* for judging a sequence which use another Q-convergence sequence as the boundary of ${||mathbf(x)_k - x^*||}$, but is not needed here. ] #env("Method", name: "Golden section method")[ Given the initial point $mathbf(x)$, an interval $[a, b]$ and $delta > 0$, - The iteration step is: + Calculate the two testing points $lambda = a + (1 - k) (b - a)$ and $mu = a + k (b - a)$ where $k = (sqrt(5) - 1)/2$ is the golden ratio; + If $phi(lambda) > phi(mu)$, let $a = lambda$, otherwise let $b = mu$. - The stop condition is $b - a <= delta$; - The solution is $mathbf(x) + (a+b)/2 mathbf(d)$. ] #env("Theorem")[ The golden section method is a *linear convergent* method. ] #env("Method", name: "Fibonacci method")[ Given the initial point $mathbf(x)$, an interval $[a, b]$ and $delta > 0$, - The $k$-th iteration step is: + Calculate the two testing points $lambda = a + F_(k) / F_(k+2) (b - a)$ and $mu = a + F_(k+1) / F_(k+2) (b - a)$ where $F_k$ is the $k$-th fibonacci number and $k$; + If $phi(lambda) > phi(mu)$, let $a = lambda$, otherwise let $b = mu$. - The stop condition is $b - a <= delta$; - The solution is $mathbf(x) + (a+b)/2 mathbf(d)$. ] #env("Theorem")[ The Fibonacci method is a *linear convergent* method. ] #env("Method", name: "Bisection method")[ Given the initial point $mathbf(x)$, an interval $[a, b]$ and $delta > 0$, - The iteration step is: + Calculate the midpoint $m = (a + b)/2$ and $phi(m)$; + If $nabla f(m) dot.c d < 0$, let $a = m$, otherwise let $b = m$. - The stop condition is $b - a <= delta$; - The solution is $mathbf(x) + (a+b)/2 mathbf(d)$. ] #env("Theorem")[ The bisection method is a *linear convergent* method. ] #env("Method", name: "Newton's method")[ Given the initial point $mathbf(x)$ and $epsilon > 0$, - The iteration step is: + Calculate $(nabla^2 f(mathbf(x)))^T dot.c mathbf(d)$ and $(nabla f(mathbf(x)))^T dot.c mathbf(d)$; + Let $mathbf(x) = mathbf(x) - ((nabla f(mathbf(x)))^T dot.c mathbf(d))/((nabla^2 f(mathbf(x)))^T dot.c mathbf(d))$; - The stop condition is $(nabla f(mathbf(x)))^T dot.c mathbf(d) <= epsilon$; - The solution is $mathbf(x)$. ] #env("Theorem")[ The Newton's method is a *quadratic convergent* method. ] == Unconstrained Optimization #env("Definition")[ Given a convex function $f: RR^n -> RR$, a *unconstrained optimization* method solves the problem $ min_(mathbf(x) in RR^n) f(mathbf(x)) $ by + *Initialization*: given initial point $mathbf(x)$ and acceptable error $epsilon > 0$, $delta > 0$; + *Iteration*: calculate the direction $mathbf(d)$ and step size $alpha$, then let $mathbf(x) = mathbf(x) + alpha mathbf(d)$; + *Stop condition*: if $||nabla f(mathbf(x))|| <= epsilon$ or $U_(RR^n) (mathbf(x), delta)$ includes the exact solution, then the current $mathbf(x)$ is the solution. ] #env("Method", name: "Gradient descent method")[ Given the initial point $mathbf(x)$ and $epsilon > 0$, - The iteration step is: + Calculate $mathbf(d) = -nabla f(mathbf(x))$ and step size $alpha$ by a line search method; + Let $mathbf(x) = mathbf(x) + alpha mathbf(d)$; - The stop condition is $||nabla f(mathbf(x))|| <= epsilon$; - The solution is $mathbf(x)$. ] #env("Theorem")[ The gradient descent method is a *linear convergent* method. ] #env("Method", name: "Quasi-Newton method")[ Given the initial point $mathbf(x)$, $epsilon > 0$ and a matrix $H in RR^(n times n)$ (usually the identity matrix), - The $k$-th iteration step is: + Calculate $mathbf(d)_k = -H_k nabla f(mathbf(x)_k)$ and step size $alpha_k$ by a line search method; + Let $mathbf(x)_k = mathbf(x)_k + alpha_k mathbf(d)_k$ and $H_(k+1) = r_k (H_k)$ where the function $r_k$ is a *update* depends on $mathbf(x)_k$, $mathbf(x)_(k+1)$, $nabla f(mathbf(x)_k)$ and $nabla f(mathbf(x)_(k+1))$; - The stop condition is $||nabla f(mathbf(x)_k)|| <= epsilon$; - The solution is $mathbf(x)_k$ that satisfies the stop condition. ] #env("Definition")[ Let $mathbf(s)_k = mathbf(x)_(k+1) - mathbf(x)_k$ and $mathbf(y)_k = nabla f(mathbf(x)_(k+1)) - nabla f(mathbf(x)_k)$, the *Symmetric Rank-1 update (SR1)* is $ H_(k+1) = H_k + ((mathbf(s)_k - H_k mathbf(y)_k) (mathbf(s)_k - H_k mathbf(y)_k)^T) / ((mathbf(s)_k - H_k mathbf(y)_k)^T mathbf(y)_k). $ The *DFP update* is a rank-2 update defined as $ H_(k+1) = H_k + (mathbf(s)_k mathbf(s)_k^T) / (mathbf(s)_k^T mathbf(y)_k) - (H_k mathbf(y)_k mathbf(y)_k^T H_k) / (mathbf(y)_k^T H_k mathbf(y)_K). $ The *BFGS update* is a rank-2 update defined as $ H_(k+1) = H_k + (1 + (mathbf(y)_k^T H_k mathbf(y)_k) / (mathbf(s)_k^T mathbf(y)_k)) (mathbf(s)_k mathbf(s)_k^T) / (mathbf(s)_k^T mathbf(y)_k) - (mathbf(s)_k mathbf(y)_k^T H_k + H_k mathbf(y)_k mathbf(s)_k^T) / (mathbf(s)_k^T mathbf(y)_K). $ ] #env("Theorem")[ The Quasi-Newton method is a *superlinear convergent* method. ] #env("Method", name: "Newton's method")[ Given the initial point $mathbf(x)$ and $epsilon > 0$, - The iteration step is: + Calculate $mathbf(d) = -(nabla^2 f(mathbf(x)))^(-1) nabla f(mathbf(x))$ and step size $alpha$ by a line search method; + Let $mathbf(x) = mathbf(x) + alpha mathbf(d)$; - The stop condition is $||nabla f(mathbf(x))|| <= epsilon$; - The solution is $mathbf(x)$. ] #env("Theorem")[ The Newton's method is a *quadratic convergent* method. ]
https://github.com/TechnoElf/mqt-qcec-diff-presentation
https://raw.githubusercontent.com/TechnoElf/mqt-qcec-diff-presentation/main/content/implementation.typ
typst
#import "@preview/fletcher:0.5.1": diagram, node, edge #import "../template/conf.typ": slide #slide(title: "")[ #box(width: 100%, height: 80%, align(center + horizon)[ #text(size: 60pt)[*Implementation*] ]) ] #slide(title: "Visualisation")[ #figure( image(height: 90%, "../resources/kaleidoscope-diff-grover.png"), ) ] #slide(title: "Benchmarking")[ #set text(size: 20pt) #box(width: 100%, height: 80%, align(center + horizon)[ #figure( diagram( node-stroke: .1em, spacing: 5em, edge-stroke: .2em, node((-1.8, 0), [*MQT Bench*], stroke: 0pt, radius: 1em), node((-1, -0.5), [28 Circuits], stroke: 0pt, radius: 4em), node((-1, 0), [2-130 Qubits], stroke: 0pt, radius: 4em), node((-1, 0.5), [Compiler Options, Target QPUs, Intermediate Results], stroke: 0pt, radius: 4em), edge((-1, -0.5), (0, 0), [], "->", bend: 20deg), edge((-1, 0), (0, 0), [], "->", bend: 0deg), edge((-1, 0.5), (0, 0), [], "->", bend: -20deg), node((0, 0), [*MQT QCEC Bench*], radius: 3em), edge((0, 0), (1, 0), [], "->", bend: 0deg), node((1, 0), [*Data*], stroke: 0pt, radius: 2em), ) ) ]) ]
https://github.com/OCamlPro/ppaqse-lang
https://raw.githubusercontent.com/OCamlPro/ppaqse-lang/master/src/étude/C++.typ
typst
#import "defs.typ": * #import "links.typ": * #language( name: "C++", introduction: [ Le C++ est une extension du langage C créée par <NAME> en 1979. Il ajoute au C les concepts de la programmation orientée objet et la généricité (les _templates_). Pleinement compatible avec le C, le C++ peut s'utiliser dans les mêmes contextes que le C mais il est plus souvent utilisé pour écrire des applications complexes nécessitant une certaine abstraction. Il est standardisé pour la première fois en 1998 #cite(<cpp98>) puis régulièrement mis-à-jour jusqu'à la dernière version en 2020 #cite(<cpp20>). Comme pour le C, il existe des référentiels de programmation pour garantir une certaine qualité de code. Le plus connu est le référentiel MISRA-C++ #cite(<misra_cpp>). ], paradigme: [ Le C++ est un langage de programmation #paradigme[objet] et #paradigme[impératif]. Toutefois, l'un des éléments ayant particulièrement contribué au succès du C++ est l'introduction des _templates_ qui offrent une forme de (meta)programmation générique. ], runtime: [ Les analyseurs statiques cités pour le C sont indiqués comme fonctionnant également pour le C++ mais avec un niveau de support obscur. #astree supporte le standard C++17 tandis que #framac indique clairement un support balbutiant (via un _plugin_ utilisant #clang pour traduire la partie C++ en une représentation plus simple). Les autres outils ne donnent pas explicitement leur niveau de support du C++. ], wcet: [ Les outils de calcul du WCET cités pour le C fonctionnent également pour le C++. #otawa fournit notamment un cadre logiciel en C++ qui, intégré au développement, améliore l'analyse avec des données dynamiques. ], pile: [ Les outils d'analyse statique de pile cités pour le C fonctionnent également pour le C++ (tant qu'il existe un compilateur C++ pour l'architecture cible) puisqu'ils se basent sur une analyse du fichier binaire et non du code source. ], numerique: [ Comme pour le C, #astree et #polyspace détectent statiquement les erreurs à _runtime_. #cadna est aussi utilisable pour des une analyse dynamique mais #fluctuat et #gappa ne sont pas utilisable directement sur du C++. #let mpfrpp = link("http://www.holoborodko.com/pavel/mpfr/", "MPFR++") #let mpfr_real = link("http://chschneider.eu/programming/mpfr_real/", "MPFR Real") #let boost_multiprecision = link( "https://www.boost.org/doc/libs/1_86_0/libs/multiprecision/doc/html/index.html", "Boost" ) #xsc (eXtended Scientific Computing) est une bibliothèque de calcul numérique qui réimplémente les calculs sur les flottants avec une précision arbitraire. Cette implémentation donne des résultats arbitrairement précis ( en fonction de la précision choisie) mais est assez lente. #mpfr a plusieurs implémentations en C++. Les plus maintenues et à jour sont #mpfrpp et #boost_multiprecision. #mpfrpp utilise la précision maximale qu'il trouve dans une expression et arrondi le résultat à précision de la variable cible. #boost_multiprecision utilise une précision explicite avec différentes implémentations suivant les classes choisies (pur C++, basée sur #gmp, basée sur #gmp et #mpfr). ], formel: [ #let brick = link("https://github.com/bedrocksystems/BRiCk", "BRiCk") La seule meta formalisation du C++ connue est #brick qui traduit essentiellement le langage C++ vers #coq pour ensuite bénéficier du cadre logiciel #iris. Le but est de pouvoir démonter des propriétés sur des programmes C++ concurrents. ], intrinseque: [ Le C++ offre plus de garanties intrinsèques que le C à travers trois mécanismes : - la programmation objet; - les exceptions; - les _templates_. La programmation objet permet de définir des classes et des objets qui encapsulent des données et des méthodes. En C++, cette encapsulation est finement contrôlable avec des spécificateurs d'accès (`public`, `protected`, `private`) qui permettent de limiter la visibilité des membres d'une classe. Ce mécanisme, cumulé avec le polymorphisme introduit par l'héritage permet de contractualiser les interfaces. Dans l'exemple suivant : ```cpp class Animal { private: static uint32_t _count; const uint32_t _id; protected: std::string _name; static uint32_t fresh(void) { return ++_count; } virtual std::string noise(void) const = 0; virtual uint32_t id(void) const { return _id; } public: Animal(std::string name) : _id(fresh()), _name(name) {} virtual void show(void) const { std::cout << _name << std::endl; } virtual void shout(void) const { std::cout << this->noise() << "!" << std::endl; } }; uint32_t Animal::_count = 0; class Dog : public Animal { public: Dog(std::string name) : Animal(name) {} protected: std::string noise(void) const override { return "Ouaf"; } }; class Cat : public Animal { public: Cat(std::string name) : Animal(name) {} void show(void) const override { std::cout << _name << "(" << this->id() << ")" << std::endl; } protected: std::string noise(void) const override { return "Miaou"; } }; ``` on définit une classe abstraite `Animal` et deux sous classes `Dog` et `Cat`. À chaque animal est associé un identifiant (le membre `_id`), une identification (la méthode `show`) et un son (la méthode `noise`). À l'instanciation d'`Animal`, on peut attribuer un identifiant à l'objet via la méthode `fresh`. `fresh` est déclarée `private` et ne peut donc être utilisée que par l'interface `Animal`. La méthode `noise` est définie par les sous-classes mais elle reste ici `protected` de sorte qu'elle ne peut pas être appelée de manière externe à l'objet ou les classes dérivées. La classe `Cat` redéfinit la methode `show` qui permet d'identifier l'animal en y ajoutant son identifiant auquel il a le droit d'accéder que grâce à la méthode `id` déclarée `protected` (le champs `_id` est privé). Cet exemple montre bien qu'à travers un ensemble de mot clés comme les spécificateurs d'accès ou les `virtual` et `override`, on peut établir des contrats d'utilisation entre les classes et vis-à-vis du code appelant. Utilisé correctement, il est facile d'établir des invariants par construction même si ceux-ci ne sont pas explicitement formalisés. Les exceptions offrent un moyen de gérer les erreurs qui, en toute théorie, est plus robuste que les codes de retour et la programmation défensive utilisée en C. Dans cette dernière, il est facile de rater ou de mal interpréter un code de retour et obtenir un programme qui arrive dans état incohérent de manière silencieuse de sorte qu'il est difficile de déméler la situation. Avec le mécanisme d'exceptions, il est commun de lancer une exception en cas d'erreur. Celle-ci peut être rattrappée à n'importe quel moment dans le flôt de contrôle appellant et, en cas de doute, il est possible d'attrapper toutes les exceptions de sorte qu'aucune erreur levée ne peut s'échapper et conduire à une erreur à l'exécution. Enfin, le mécanisme des _templates_ et de spécialisation permet d'expliciter les contraintes de typage de sorte qu'il est possible de renforcer arbitrairement le typage du langage pour obtenir un programme fortement typé de bout en bout. Il est même possible d'encoder des propriétés plus fortes puisque le langage de _template_ est Turing complet et que les _templates_ sont évalués à la compilation. Tous ces mécanismes permettent, en théorie, de renforcer la qualité et la fiabilité d'un programme C++. En pratique cependant, la multiplicité des concepts et la sémantique complexe du langage font que tous ces mécanismes sont difficiles à bien maîtriser. Or, mal utilisés, ces mécanismes ont un effet inverse en fragilisant la fiabilité du code produit. Par ailleurs, même bien utilisés, la multiplication des abstractions prend les programmes C++ peu lisibles et posent souvent des problèmes de maintenabilité. En conséquence, les normes C++ en matière de logiciel critique (comme le MISRAC++#cite(<misra_cpp>)) sont très strictes et demandent de bien vérifier que l'usage des fonctionnalités du C++ sont utilisées de manière à laisser le moins de doutes possibles. En conséquence et comme pour le C, la fiabilité des programmes C++ va en partie dépendre de l'utilisation d'outils tiers. ], tests: [ Certains des outils cités pour le C fonctionnent également pour le C++. C'est le cas pour #cantata ou #parasoft par exemple. D'autres outils ou bibliothèques ont été conçus spécifiquement pour le C++. La plus connue des bibliothèques C++, #boost, propose également une bibliothèque facilitant l'écriture de tests. De base, elle définit sensiblement les mêmes macros que beaucoup de bibilothèques similaires mais avec quelques options de générations intéressantes sur les rapports de test ou les possibilités de _fuzzing_. Le _mocking_ est également disponible via une extension. #catch2 propose sensiblement la même chose que #boost_test. #gtest est un cadre logiciel proposé par #google pour le test unitaire. Il est très complet et utilisé pour de gros projets. Il permet de découvrir les tests automatiquement, de les exécuter et de générer des rapports de tests détaillés dans des formats personnalisables. Il est aussi extensible au fil des besoins de l'utilisateur. #safetynet permet également de générer les tests automatiquement à partir de classes décrivant les tests et à l'aide d'un script Ruby. L'outil semble cependant moins mature et complet que #gtest. #let mockpp = link("https://mockpp.sourceforge.net/index-en.html", "Mockpp") #mockpp est une bibliothèque de _mocking_ pour le C++. Elle s'utilise plutôt conjointement avec d'autres outils de tests unitaires pour simuler des comportements de fonctions ou de classes à la manière de #opmock. #testwell_ctc est un outil commercial qui, comme #cantata, #parasoft ou #vectorcast que nous avons déjà présenté dans la partie C, couvre différents types de tests (unitaires, couverture) et est adapté aux usages de l'embarqué critique. #figure( table( columns: (auto, auto, auto, auto, auto), [*Outil*], [*Tests*], [*Generation*], [*Gestion*], [_*mocking*_], [*#boost_test*], [U], [+], [✓], [], [*#catch2*], [U], [+], [✓], [], [*#cantata*], [UIRC], [+++], [✓], [], [*#criterion*], [U], [+], [], [], [*#libcester*], [U], [+], [✓], [✓], [*#gtest*], [U], [++], [✓], [✓], [*#mockpp*], [U], [+], [], [✓], [*#opmock*], [U], [++], [], [✓], [*#parasoft*], [UC], [++], [✓], [], [*#safetynet*], [U], [++], [✓], [], [*#testwell_ctc*], [UIC], [++], [✓], [], [*#TPT*], [UINC], [+++], [✓], [], [*#vectorcast*], [UC], [++], [✓], [✓], ), caption: "Outils de tests pour le C++" ) ], compilation: [ #let cppbuilder = link( "https://www.embarcadero.com/products/cbuilder", "C++ Builder" ) #let nvidia_hpc_sdk = link( "https://developer.nvidia.com/hpc-sdk", "NVIDIA HPC SDK" ) #let oracle_cpp = link( "https://docs.oracle.com/cd/E37069_01/html/E37073/gkobs.html", "Oracle C++ Compiler" ) #let ibm_xl = link( "https://www.ibm.com/products/c-and-c-plus-plus-compiler-family", "IBM XL C/C++" ) #figure( table( columns: (auto, auto, auto), [*Compilateur*], [*Architectures*], [*Licence*], [*#aocc*], [AMD x86 (32 et 64 bits)], [Propriétaire, Gratuit], [*#cppbuilder*], [x86 (32 et 64 bits)], [Commercial], [*#clang*], [AArch64, ARMv7, IA-32, x86-64, ppc64le], [Apache 2.0], [*#gcc*], [IA-32, x86_64, ARM, PowerPC, SPARC, ...], [GPLv3+], [*#icx (#intel C/C++ Compiler)*], [IA32, x86-64], [Propriétaire, Gratuit], [*#msvc*], [IA-32, x86_64, ARM], [Propriétaire], [*#nvidia_hpc_sdk*], [x86-64, ARM], [Propriétaire], [*#oracle_cpp*], [SPARC, x86 (32 et 64 bits)], [Propriétaire, Gratuit], // [*#ibm_xl*], [POWER & z, AIX, BlueGene/Q, z/OS, z/VM], [Propriétaire], ) ) #let edgcpp = link("https://www.edg.com/c/features", "EDG C++ Front End") #let open64 = link("https://sourceforge.net/projects/open64/", "Open64") Le tableau ci-dessus présente les principaux compilateurs C++ de bout en bout disponibles. Nous précisons de bout en bout car il existe des _front ends_ qui ne s'occupent que de traduire le C++ en C (comme #edgcpp). Tous les compilateurs ne sont pas listés ici car beaucoup d'entre eux ne sont plus maintenus ou sont _a priori_ moins pertinents pour des projets critiques. ], debug: [ Les mêmes débuggeurs que pour le C sont utilisables pour le C++. ], metaprog: [ La méta programmation est un des aspects mis en avant dans le C++ à travers l'utilisation des _templates_ et de la spécialisation qui peuvent être vus comme un langage de macro de haut niveau. Celui-ci est suffisamment expressif pour être Turing-complet et permet de calculer virtuellement n'importe quoi qui ne dépende pas d'une entrée dynamique. Cette façon de programmer est souvent utilisée pour précalculer des données numériques (comme des tables trigonométriques) qui pourront être utilisées instantanément à l'exécution. Le cas d'école est celui de la factorielle : ```cpp template<unsigned int N> struct Fact { enum {Value = N * Fact<N - 1>::Value}; }; template<> struct Fact<0> { enum {Value = 1}; }; unsigned int x = Fact<4>::Value; ``` Dans cet exemple, on définit un _template_ de structure `Fact` paramétré par un entier `N`. Dans cette structure, on définit un type énuméré n'ayant qu'une seule valeur `Value` à laquelle on attribue la valeur correspondant à l'expression `N * Fact<N - 1>::Value`. Le compilateur en prend note mais ne calcule rien car les _templates_ sont instanciés à l'usage. On définit également une spécialisation _template_ `Fact` pour le cas où `N` vaut 0. Dans ce cas, la valeur de `Value` est 1. Lorsque vient le moment d'instancier ce _template_ avec la définition de la valeur `x` associée à `Fact<4>::Value`, le compileur va dérouler la définition en utilisant le _template_ paramétré par `N` avec `N = 4`, c'est à dire `4 * Fact<3>::Value` puis il va continuer à dérouler `4 * (3 * Fact<2>::Value)` puis `4 * (3 * (2 * Fact<1>::Value))` puis `4 * (3 * (2 * (1 * Fact<0>::Value)))`. À ce moment là, comme `N = 0`, c'est la spécialisation `Fact<0>` qui est utilisée et donc `Fact<0>::Value = 1`. Cela donne au final l'expression `4 * (3 * (2 * 1))`. Le compilateur sait simplifier ce type d'expression statiquement et va la remplacer de lui même par 24 à la compilation de sorte qu'à l'exécution aucun calcul ne sera nécessaire pour calculer la valeur de `x`. Cette technique est un peu utilisée dans la bibliothèque standard mais est très utilisée dans la bibliothèque #boost. Bien que la technique soit très séduisante pour gagner un maximum de performance à l'éxécution, elle présente plusieurs inconvénients : - plus on l'utilise plus la compilation est longue puisqu'on demande au compilateur de calculer des choses qu'on aurait normalement calculé à l'exécution. Précalculer des tables trigonométriques peut prendre des heures, voire des jours... - La moindre erreur dans le flôt d'instanciation déroule tout le flôt d'instanciation et les messages d'erreurs sont souvent incompréhensibles pour la plupart des développeurs. La métaprogrammation en C++ s'accompagne donc un surcoût en temps ou en puissance de calcul avec un risque significatif d'augmentation de la dette technique. ], parsers: [ Les outils de _parsing_ cités pour le C fonctionnent également pour le C++ mais il en existe d'autres ciblant ce dernier. Si l'on passe les outils non maintenus, insuffisamment documentés ou trop jeunes pour être utilisés en production, on peut citer au titre des _lexers_ les outils de la @cpp-lexers. // lexers #let astir = link("https://lexected.github.io/astir/#/?id=about", "Astir") // lib #let lexertl = link("http://www.benhanson.net/lexertl.html", "Lexertl") #let reflex = link("https://github.com/Genivia/RE-flex", "RE/flex") #figure( table( columns: (auto, auto, auto, auto), [*Nom*], [*Code*], [*Plateforme*], [*License*], [*#astir*], [Astir], [Toutes], [Libre, MIT], [*#reflex*], [Flex], [Lexer], [Libre, BSD], ), caption: "Lexers pour le C++" ) <cpp-lexers> // bof #let btyacc = link("https://github.com/ChrisDodd/btyacc", "btyacc") #let msta = link("https://github.com/cocom-org/msta", "MSTA") #let styx = link("http://speculate.de/", "Styx") #let lapg = link("https://lapg.sourceforge.net/", "Lapg") #let kelbt = link("https://github.com/Distrotech/kelbt", "Kelbt") #let tgs = link( "https://www.experasoft.com/en/products/tgs/", "Tunnel Grammar Studio" ) #let myparser = link("https://github.com/hczhcz/myparser", "MyParser") #let elkhound = link("https://github.com/WeiDUorg/elkhound", "Elkhound") // ok #let syntax = link("https://github.com/DmitrySoshnikov/syntax", "Syntax") #let kdevelop_pg_qt = link( "https://github.com/KDE/kdevelop-pg-qt", "KDevelop PG-Qt" ) #let spirit = link( "https://boost-spirit.com/home/", "Boost Spirit" ) #let pegtl = link("https://github.com/taocpp/PEGTL", "PEGTL") #let lug = link("https://github.com/jwtowner/lug", "Lug") Au niveaux des _parsers_ plus généraux, beaucoup sont dynamiques : ils se présentent sous la forme de bibliothèques dont l'API permet de décrire un langage (et la manière de le parser) à l'exécution. Cette dynamicité peut être un atout pour définir des grammaires évolutives mais dans la pratiques, les _parsers_ à émission de code sont plus adaptés. Il y a toutefois des exceptions avec les bibliothèques utilisant la méta-programmation (comme #spirit ou #pegtl) pour engendrer le gros du _parsing_ à la compilation. Les _parsers_ cités pour le C fonctionnent pour le C++ et les classiques #bison et #antlr sont bien suffisants dans la plupart des cas. ], derivation: [ La dérivation de code en C++ repose sur la méta-programmation autorisée par les _templates_ et la spécialisation. Cependant, comme le langage n'est pas réflexif, on ne peut pas dériver directement du code à partir des définitions. Toutefois, le système des _traits_ (des _templates_ dirigés sur les propriétés sur les types) permet de construire des dérivations par spécialisation. ], packages: [ En plus des gestionnaires de paquets #conan et #vcpkg qui supportent les paquets écrits en C++, il y a également #buckaroo qui est dédié au C++. #figure( table( columns: (auto, auto, auto, auto), [*Gestionnaire*], [*#buckaroo*], [*#conan*], [*#vcpkg*], [*Plateformes*], [Linux, Windows, MacOS], [Toutes], [Linux, Windows, MacOS], [*Format*], [ToML], [Python], [JSON], [*Résolution des dépendances*], [✓], [✓], [✓], [*Cache binaire*], [✓], [✓], [✓], [*Nombre de paquets*], [~350], [~1750], [~2500], ) ) ], communaute: [ Le C++ est un des langages les plus populaires et les plus utilisés depuis plus de 20 ans et ce, dans tous les domaines de l'informatique. Toutefois, le langage est maintenant en concurrence directe avec Rust qui intègre la plupart de ses qualités intrinsèques ou méthodologiques. Il est donc probable qu'une partie de la communauté C++ se déplace vers la communauté Rust avec le temps. ], assurances: [ Comme pour le C, le cas du C++ est paradoxal. En effet, le langage porte en lui-même des éléments permettant d'assurer des contraintes très fortes de typage ou certains invariants à l'aide des _templates_ et les spécificateurs d'accès. Toutefois, l'ensemble est si complexe à maîtriser qu'il peut induire des surcoûts dans toutes les étapes du cycle de vie du logiciel : - au développement : une équipe hétérogène d'ingénieur peut mettre plus de temps à concevoir et débugger le logiciel tandis qu'une équipe de spécialistes diminuera le temps de développement mais coutera plus cher. - à la vérification : la vérification du C++ est plus complexe que celle du C et toutes les constructions C++ ne sont pas supportées par les outils de vérification. - à la maintenance : le code étant plus complexe, il est plus difficile à maintenir et à faire évoluer. En conséquence, lorsque le C++ est utilisé dans des domaines ou l'un de ces critèques est déterminant, il est nécessaire d'utiliser conjointement un outil de vérification de règles de codage pour s'assurer des bonnes pratiques (en plus d'une batterie de test importante). ], adherence: [ Comme pour le C, le C++ peut fonctionner sur un système nu et sans bibliothèque standard. ], interfacage: [ Le C++ peut utiliser du C nativement. Pour utiliser du C++ en C, il suffit d'indiquer que les fonctions à exporter sont `extern "C"` de sorte que le compilateur en donne une version compatible avec le C. Dès lors que l'interopérabilité avec le C est complète, celle-ci, par transitivité, l'est aussi avec tout langage s'interfaçant avec le C, c'est-à-dire la plupart des langages. ], critique: [ Comme le C, le C++ est utilisé dans tous les domaines critiques. ] )