repo
stringlengths
27
90
file
stringlengths
57
176
language
stringclasses
2 values
license
stringclasses
13 values
content
stringlengths
25
180k
https://github.com/Error-418-SWE/Documenti
https://raw.githubusercontent.com/Error-418-SWE/Documenti/src/2%20-%20RTB/Documentazione%20esterna/Verbali/23-11-15/23-11-15.typ
typst
#import "/template.typ": * #show: project.with( date: "15/11/23", subTitle: "Avvio dell'Analisi dei Requisiti", docType: "verbale", authors: ( "<NAME>", ), externalParticipants : ( (name: "<NAME>", role: "Referente aziendale"), ), timeStart: "10:00", timeEnd: "11:00", location: "Zoom", ); = Ordine del giorno - Approfondimento specifiche del capitolato; - Presentazione, supportata da una board Miro, delle domande raccolte dal gruppo sostanziate con proposte e mock up. Le domande si articolano in: - identificazione della tipologia di utente a cui il prodotto Ú destinato; - prime proposte di user interface e user experience; - differenza di funzionalità tra applicativo desktop e mobile; - funzionalità desiderate; - API RESTful. - Conferme riguardo lo stack tecnologico individuato; - Scelta del canale di comunicazione preferenziale tra Proponente e Fornitore; - Organizzazione di un prossimo meeting e programmazione regolare degli incontri. \ == Approfondimento specifiche del capitolato Lo scopo del meeting Ú iniziare l'Analisi dei Requisiti, focalizzando l'attenzione sulla comprensione delle funzionalità richieste, la loro implementazione e il dominio tecnologico che il gruppo utilizzerà. Le domande raccolte dal gruppo sono state catalogate nei seguenti ambiti: - use case; - funzionalità; - user interface e user experience; - stack tecnologico. \ == Presentazione delle domande raccolte dal gruppo in merito ai requisiti === Utente L'utente tipico Ú stato individuato nella figura di un amministratore e/o impiegato lato back-office, dotato dunque di massimi privilegi durante l'uso dell'applicativo.\ Le principali azioni che tale utente svolgerà sono: - interrogazione del magazzino; - richiesta di spostamento di un prodotto; - zoom e spostamento all'interno dell'ambiente 3D. === User interface & user experience Durante l'incontro si Ú presentata un'idea generale di possibile user interface. Sono state individuate alcune caratteristiche desiderabili, quali: - esporre con chiarezza le operazioni disponibili all'utente (distinzione evidente tra elementi selezionabili e non); - evitare eccessive animazioni o effetti _lampeggianti_; - evidenziare in modo chiaro gli elementi ricercati (ad esempio riducendo l'opacità degli altri elementi), al fine di non disorientare l'utente; - spostare la telecamera sull'oggetto ricercato (se singolo); - essenziale che la ricerca non modifichi la struttura visualizzata del magazzino. === Differenze tra applicativo desktop e mobile Durante la riunione Ú emerso che vi saranno delle differenze tra la versione desktop e la versione mobile. L'accesso completo alla funzionalità (esempio richiesta di spostamento di prodotti) sarà fornito per la versione desktop, mentre la versione mobile presenterà delle funzioni limitate (ad esempio solo visualizzazione e ricerca). In ogni caso, il gap funzionale tra dispositivi rimane ancora da definire nel dettaglio. L'applicativo sarà responsive. === Funzionalità desiderate Da una prima analisi sono emerse le principali funzionalità desiderate, quali: - creazione dell'ambiente 3D del magazzino, articolata in: - definizione dei parametri dimensionali del magazzino ; - creazione e posizionamento nello spazio degli scaffali; - definizione dei bin, ovvero le locazioni capaci di accogliere i prodotti; - caricamento dei dati da un database per la popolazione del magazzino; - interrogazione del magazzino mediante ricerche per ID, nome, o caratteristiche dei prodotti; - evidenziazione dei prodotti ricercati mediante effetti visivi (ad esempio cambio del colore) e/o spostamento della telecamera; - invio di notifiche mediante la chiamata a API RESTful per lo spostamento di prodotti nel magazzino. Durante l'analisi del processo di configurazione si Ú chiarito che il primo passaggio di configurazione riguarda la definizione della geometria del magazzino. Per un magazzino a pianta rettangolare, la geometria può essere definita con tre parametri (lunghezza, larghezza, altezza); per scenari più complessi, il software deve essere in grado di definire la geometria del magazzino dai \<path\> contenuti in un file SVG caricato dall'utente. Successivamente, vengono caricati i dati presenti nel DB. Il database non impone vincoli strutturali, ma Ú pensato per interfacciarsi con la struttura determinata in fase di creazione. === API RESTful Per l'invio delle notifiche di richiesta di spostamento, l'applicativo si interfaccerà con delle API RESTful. È emerso che l'implementazione di tali API non Ú di interesse del capitolato, e per tale motivazione possiamo procedere ad una simulazione del comportamento delle stesse con assunzioni riguardo i parametri e le risposte. Ad esempio per lo spostamento di un elemento da un bin ad un altro: - invio all'API delle coordinate di partenza (es: scaffale) e delle coordiante d'arrivo (un altro scaffale) e il prodotto interessato; - l'API risponde: - stato 200 (contatto con l'API avvenuto con successo): spostamento richiesto con successo; - stato 200 (contatto con l'API avvenuto con successo): spostamento non possibile; - risposte alle interrogazioni ottenuta in formato JSON; - la logica di controllo della facoltà di spostare un prodotto Ú gestita interamente dall'endpoint REST. \ == Conferme riguardo lo stack tecnologico individuato Lo stack tecnologico individuato dal gruppo si articola in: - DB SQL per la gestione del database relazionale; - Three.js per l'implementazione della parte grafica (JavaScript o TypeScript); - Node.js per la comunicazione tra applicativo e database; - Docker per la containerizzazione del prodotto. Lo stack tecnologico discusso rappresenta un punto di partenza, ma Ú soggetto a modifiche. Ad ogni modo, al momento, le tecnologie individuate e proposte hanno trovato l'approvazione del Proponente. In merito all'utilizzo di JavaScript o TypeScript ed eventuali framework per il lato front end (ad esempio React, Angular), il Proponente ha lasciato la massima libertà al Gruppo. L'azienda Proponente utilizza internamente TypeScript e Angular. \ == Stabilimento delle metodologie di contatto Il Proponente ha confermato l'intenzione di proseguire i contatti mediante l'uso di posta elettronica. \ == Organizzazione di un prossimo meeting e programmazione regolare degli incontri L'incontro si Ú concluso con la programmazione del prossimo meeting in data 23 novembre 2023, dalle ore 14:00 alle ore 15:00.\ In questa prima fase di Analisi dei Requisiti, Proponente e Fornitore si sono trovati d'accordo circa la necessità di svolgere incontri con cadenza almeno settimanale. \ = Azioni da intraprendere A seguito del meeting sono state individuate le seguenti operazioni da svolgere: - raccolta e catalogazione di aspettative e bisogni; - produzione della documentazione quale use cases, Analisi dei Requisiti da presentare al prossimo meeting; - esplorazione del dominio tecnologico.
https://github.com/fredguth/abnt-typst
https://raw.githubusercontent.com/fredguth/abnt-typst/main/main.typ
typst
#import("./templates/abnt_template.typ"):template #show: template #include("./cap1.typ") #include("./cap2.typ") #include("./cap3.typ") #include("./cap4.typ") #include("./cap5.typ")
https://github.com/jamesrswift/frackable
https://raw.githubusercontent.com/jamesrswift/frackable/main/docs/manual.typ
typst
The Unlicense
#import "@preview/tidy:0.3.0" #import "@preview/mantys:0.1.4": * #import "/src/lib.typ": frackable, generator #let package = toml("/typst.toml").package #let docs = tidy.parse-module(read("/src/impl.typ"), scope: (frackable: frackable, generator: generator),) #titlepage( package.name, [Frackable], // title [<NAME>], //subtitle none, //description, package.authors, (package.repository,), package.version, datetime.today(), none, // abstract, package.license, toc: false, ) #tidy.show-module(docs, style: tidy.styles.default)
https://github.com/astro-group-bristol/paper-management
https://raw.githubusercontent.com/astro-group-bristol/paper-management/main/presentation/tamburlaine.typ
typst
Other
#import "@preview/polylux:0.3.1": * #let date = datetime(year: 2024, month: 9, day: 27) // colour configurations #let SECONDARY_COLOR = rgb("#f6f0e0").lighten(60%) #let PRIMARY_COLOR = rgb("#be2b31") #let TEXT_COLOR = black.lighten(13%) #let tamburlaine-theme(aspect-ratio: "4-3", body) = { set page( paper: "presentation-" + aspect-ratio, fill: SECONDARY_COLOR, margin: 0.7em ) set text(fill: TEXT_COLOR, size: 25pt, font: "NimbusSanL") body } #let title-slide( title: none, title_size: 80pt, authors: (), where: none, content ) = { set page( fill: SECONDARY_COLOR, margin: (top: 0em, left: 0em, right: 0em, bottom: 0em), ) set text(fill: TEXT_COLOR, weight: "bold") let pretty-title = move(dx: 0.5em, rect(outset: (top: 6pt, right: 6pt, left: 34pt, bottom: 34pt), stroke: PRIMARY_COLOR + 4pt, rect(outset: (top: 4pt, right: 4pt, left: 22pt, bottom: 22pt), stroke: PRIMARY_COLOR + 4pt, rect(outset: (top: 2pt, right: 2pt, left: 12pt, bottom: 12pt), stroke: PRIMARY_COLOR + 4pt, rect(outset: (top: 0pt, right: 0pt, left: 4pt, bottom: 4pt), stroke: PRIMARY_COLOR + 4pt, block(width: 85%, fill: PRIMARY_COLOR, inset: (top: 0em, bottom: 0.0em, left: 1em, right: 2em), par(leading: 10pt)[ #text(weight: "black", size:title_size, fill: SECONDARY_COLOR)[#title] ])))))) let author = authors.join(h(1em)) logic.polylux-slide[ #v(1.5em) #align(center)[ #pretty-title ] #v(1.5em) #rect(inset: (top: 0em, left: 1em, right: 1em), width:100%, stroke:none, fill: SECONDARY_COLOR)[ #grid( columns: (50%, 1fr), row-gutter: 3pt, author, align(right, where), align(left, text(size: 20pt, weight: "regular")[]), align(right, text(size: 20pt, weight: "regular", [#date.display("[day] [month repr:long] [year]") / Bristol] )), ) #v(-1.5em) #content #v(-0.5em) ] ] } #let subtitle-slide( title_size: 80pt, title, ) = { set page( fill: SECONDARY_COLOR, margin: (top: 0em, left: 0em, right: 0em, bottom: 0em), ) set text(fill: TEXT_COLOR, weight: "bold") let pretty-title = move(dx: 0.5em, rect(outset: (top: 6pt, right: 6pt, left: 34pt, bottom: 34pt), stroke: PRIMARY_COLOR + 4pt, rect(outset: (top: 4pt, right: 4pt, left: 22pt, bottom: 22pt), stroke: PRIMARY_COLOR + 4pt, rect(outset: (top: 2pt, right: 2pt, left: 12pt, bottom: 12pt), stroke: PRIMARY_COLOR + 4pt, rect(outset: (top: 0pt, right: 0pt, left: 4pt, bottom: 4pt), stroke: PRIMARY_COLOR + 4pt, block(width: 85%, fill: PRIMARY_COLOR, inset: (top: 0em, bottom: 0.5em, left: 1em, right: 2em), par(leading: 10pt)[ #text(weight: "black", size:title_size, fill: SECONDARY_COLOR)[#title] ])))))) logic.polylux-slide[ #set align(horizon) #v(-3em) #align(center)[ #pretty-title ] ] } #let slide(foreground: TEXT_COLOR, background: SECONDARY_COLOR, title: none, body) = { set page( fill: background, margin: (bottom: 1.5em) ) let footer = locate( loc => { block( stroke: ( top: 1mm + PRIMARY_COLOR ), width: 100%, inset: ( y: .5em ), text(fill: foreground, .5em, { "CC BY-SA 4.0 <NAME>" h(2em) "/" h(2em) "Astro Dev Group" h(2em) "/" h(2em) date.display("[day] [month repr:long] [year]") h(1fr) logic.logical-slide.display() }) ) }) set page( footer: footer, footer-descent: 0em, header-ascent: 1.5em, ) let content = { block(outset: 0.8em, width: 100%, fill: PRIMARY_COLOR, spacing: 0.8em, par(leading: 10pt, text(fill: SECONDARY_COLOR, size: 50pt, weight: "black", title))) v(0.3em) body } logic.polylux-slide(content) } #let _setgrp(img, grp, display:true) = { let key = "id=\"" + grp + "\"" let pos1 = img.split(key) if display { pos1.at(1) = pos1.at(1).replace("display:none", "display:inline", count:1) } else { pos1.at(1) = pos1.at(1).replace("display:inline", "display:none", count:1) } pos1.join(key) } #let setgrp(img, ..grps, display: true) = { grps.pos().fold(img, (acc, grp) => { _setgrp(acc, grp, display: display) }) } #let animsvg(img, display_callback, ..frames, handout: false) = { let _frame_wrapper(_img, hide: (), display: ()) = { setgrp((setgrp(_img, ..hide, display: false)), ..display, display: true) } if handout == true { let final_image = frames.pos().fold(img, (im, args) => _frame_wrapper(im, ..args)) display_callback(1, final_image) } else { let output = () let current_image = img for args in frames.pos().enumerate() { let (i, frame) = args current_image = _frame_wrapper( current_image, ..frame ) let this = display_callback(i + 1, current_image) output.push(this) } output.join() } } #let cbox(content, ..args) = rect(radius: 3pt, outset: 5pt, ..args, content)
https://github.com/bigskysoftware/hypermedia-systems-book
https://raw.githubusercontent.com/bigskysoftware/hypermedia-systems-book/main/lib/definitions.typ
typst
Other
#let leading = 0.6em #let body-font = "Linux Libertine" #let secondary-font = "Linux Biolinum" #let display-font = "Jaro" #let mono-font = "Berkeley Mono" #import "./indexing.typ": * #let part-heading(it) = [ #page([], header: none, footer: none) #pagebreak(to: "odd") #align(horizon)[ #set par(leading: 5pt, justify: false) #set text(size: 32pt, font: display-font) #text(fill: luma(140))[ #it.at("supplement", default: none) #counter(heading).display("I") ] #linebreak() #it.body #metadata("")<heading-here> ] ] #let chapter-heading(it) = [ #page([], header: none, footer: none) #pagebreak(to: "odd") #v(3in) #set par(justify: false) #set text(size: 22pt, font: display-font) #block({ if it.at("numbering") != none { text(fill: luma(140), { it.supplement [ ] str(counter(heading).get().at(1)) }) linebreak() } it.body [#metadata("")<heading-here>] }) ] #let asciiart(..args, source) = figure({ set text(size: .8em) set par(leading: .5em) block(breakable: false, align(start, raw(source, block: true))) }, kind: image, ..args) #let blockquote = quote.with(block: true) #let sidebar(title, body) = [#block( spacing: 1em, block( width: 100%, inset: 1em, stroke: (top: 1pt, bottom: 1pt), fill: luma(237), breakable: true, )[ #set text(.8em, font: secondary-font) #if title != [] { block( breakable: false, strong(title) ) } #block(spacing: 1em, body) ], )<sidebar>] #let important(title, body) = [#block( spacing: 1em, block( width: 100%, inset: 1em, stroke: ( top: (thickness: 1pt, paint: blue), bottom: (thickness: 1pt, paint: blue), ), fill: rgb("#def"), breakable: true, )[ #set text(.8em, font: secondary-font) #block( breakable: false, strong(title) + v(4em) ) #v(-4em) #block(spacing: 1em, body) ], )<important>] #let html-note(label: [HTML Notes], title, body) = [#block( spacing: 1em, block( width: 100%, inset: 1em, stroke: (top: 1pt, bottom: 1pt), fill: rgb("#f5f5ff"), breakable: true, )[ #set text(.8em, font: secondary-font) #show heading: set text(1em) === #label: #title #body ], )<html-note>] #let skew(angle, vscale: 1, body) = { let (a, b, c, d) = (1, vscale * calc.tan(angle), 0, vscale) let E = (a + d) / 2 let F = (a - d) / 2 let G = (b + c) / 2 let H = (c - b) / 2 let Q = calc.sqrt(E * E + H * H) let R = calc.sqrt(F * F + G * G) let sx = Q + R let sy = Q - R let a1 = calc.atan2(F, G) let a2 = calc.atan2(E, H) let theta = (a2 - a1) / 2 let phi = (a2 + a1) / 2 set rotate(origin: bottom + center) set scale(origin: bottom + center) rotate(phi, scale(x: sx * 100%, y: sy * 100%, rotate(theta, body))) }
https://github.com/mgoulao/IST-MSc-Thesis-Typst-Template
https://raw.githubusercontent.com/mgoulao/IST-MSc-Thesis-Typst-Template/main/template.typ
typst
#let heading_style(it) = { // Set chapter locate(loc => { let heading_number = counter(heading).at(loc).at(0) if it.level == 1{ if heading_number != 0 { pagebreak() align(right, grid(rows: (140pt,auto), text(140pt, fill: rgb("#999999"), counter(heading).display()), text(28pt, it.body) ) ) pagebreak() } else { pad( bottom: 50pt, text(30pt, it)) } // Increase figures counter // counter(figure).step(level: 1) } else if it.level <= 3 { pad( top: 10pt, bottom: 10pt, text(14pt, it) ) } else if it.level > 3 { // Set run-in subheadings, starting at level 4. parbreak() text(11pt, style: "italic", weight: "regular", it.body + ".") } else { it } }) } #let project( school_logo: none, cover_image: none, title: "", subtitle: "", author: "", degree: "", supervisors: (), committee: (), date: "", abstract: [], abstract_pt: none, custom_sections: (), body, ) = { // Set the document's basic properties. set document(author: author, title: title) set page( margin: (left: 20mm, right: 20mm, top: 20mm, bottom: 20mm), ) set text(font: "Source Sans Pro", lang: "en") set heading(numbering: "1.1") //set figure(numbering: "1.1") //show figure.where(kind: table): it => { // counter(figure.where(kind: table)).step(level: 1) // it //} show heading: heading_style // Table of content and lists style show outline: it => { show heading: set text(fill: rgb("#000")) set text(fill: rgb("#666666"), weight: 500) it } // Set a heading style for bibliography show bibliography: it => { show heading: it_heading => { pagebreak() pad( bottom: 50pt, text(30pt, it_heading.body) ) } it } // Cover page // Title page. // The page can contain a logo if you pass one with `logo: "logo.png"`. if school_logo == none { school_logo = "images/ist-logo.png" } image(school_logo, height: 20mm, width: auto) v(8mm) // Image if cover_image != none and cover_image.trim().len() > 0 { pad(bottom: 10mm, image(cover_image) ) } else { v(58mm) } align(center, { block( width: 80%, { // Title text(16pt, weight: "bold", [This is the Title of the Thesis and it is a very Big Title covering More than One Line]) // Subtitle if subtitle.trim().len() > 0 { pad( top: 0.8em, text(14pt, subtitle) ) } // Author information. pad( top: 3.2em, text(16pt, weight: "bold", author) ) // Thesis information. pad( top: 3.2em, { text(12pt, [Thesis to obtain the Master of Science Degree in]) linebreak() v(1.8em) text(16pt, weight: "bold", degree) }) // Supervisor information if supervisors.len() > 0 { pad( top: 1.8em, text(12pt, { if supervisors.len() > 1 { [Supervisors: ] } else { [Supervisor: ] } supervisors.join([ \ ]) }) ) } // Committee information. if committee.len() > 0 { pad(top: 1.2em, text(14pt, weight: "bold", [Examination Committee])) pad( top: 1.2em, grid( rows: (auto,) * calc.min(3, committee.len()), gutter: 0.5em, ..committee.map(member => text(12pt, member.role + [: ] + member.name)), ), ) } }) }) // Date align(center + bottom, pad( top: 4em, text(14pt, weight: "bold", date) ) ) pagebreak() // End of cover page counter(page).update(0) set page( margin: (left: 25mm, right: 25mm, top: 30mm, bottom: 30mm), footer: [ #set align(center) #set text(12pt, weight: "bold") #counter(page).display( "i", ) ], number-align: center, ) // Custom sections (Ackowledgments, Declarations, etc.) // Abstract page. v(1fr) heading(outlined: false, numbering: none, text(0.85em)[Abstract]) align(left)[ #set par(justify: true) #abstract ] v(1.618fr) pagebreak() if abstract_pt != none { v(1fr) heading(outlined: false, numbering: none, text(0.85em)[Resumo]) align(left)[ #set par(justify: true) #abstract_pt ] v(1.618fr) pagebreak() } // Table of contents. outline(depth: 4, indent: true) pagebreak() // Figure listing outline( title: [List of Figures], target: figure.where(kind: image), ) pagebreak() // Table listing outline( title: [List of Tables], target: figure.where(kind: table), ) // Reset page counter and make a empty page with no number set page( footer: [] ) pagebreak() counter(page).update(0) // Main content set page( margin: (left: 25mm, right: 25mm, top: 30mm, bottom: 30mm), footer: [ #set align(center) #set text(12pt, weight: "bold") #counter(page).display( "1", ) ], number-align: center, ) // Main body. set par(justify: true) body } #let appendices(body) = { counter(heading).update(0) counter("appendices").update(1) set heading( numbering: (..nums) => { let vals = nums.pos() let value = "ABCDEFGHIJ".at(vals.at(0) - 1) if vals.len() == 1 { return value } else { return value + "." + nums.pos().slice(1).map(str).join(".") } } ); [#pagebreak() #body] }
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Maths_Sup.typ
typst
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Maths Sup", authors: ( "<NAME>", ), date: "30 Octobre, 2023", ) #set heading(numbering: "1.1.") == Ressources <ressources> - #link("Maths_Sup_Course.pdf")[MathsSup] - #link("coursMP2I-analyse.pdf")[Cours MPSI/MP2I Analyse] - #link("http://alain.troesch.free.fr/")[Cours de mathématique MPSI] - #link("http://christophebertault.fr/cours-et-exercices/")[Christophe Bertault] - #link("https://groupe-reussite.fr/ressources/cours-en-ligne-maths-sup-maths/")[Groupe Réussite] #link("Maths.pdf")[Maths]
https://github.com/arthurcadore/eng-telecom-workbook
https://raw.githubusercontent.com/arthurcadore/eng-telecom-workbook/main/semester-7/COM_1/homework4/homework.typ
typst
MIT License
#import "@preview/klaro-ifsc-sj:0.1.0": report #import "@preview/codelst:2.0.1": sourcecode #show heading: set block(below: 1.5em) #show par: set block(spacing: 1.5em) #set text(font: "Arial", size: 12pt) #show: doc => report( title: "Modulação e Demodulação em Frequência (FM)", subtitle: "Sistemas de Comunicação I", authors: ("<NAME>",), date: "09 de Abril de 2024", doc, ) = Introdução O objetivo deste relatório é apresentar o desenvolvimento de um sistema de modulação e demodulação em frequência (FM) para sinais de áudio. O sistema foi desenvolvido através de linguagem MATLAB (Octa ve), e tem como objetivo principal a compreensão do processo de modulação e demodulação em frequência, bem como a análise dos sinais modulados e demodulados. \ Neste relatório será apresentado a fundamentação teórica do processo de modulação e demodulação em frequência, bem como a análise dos sinais modulados e demodulados, os scripts MATLAB utilizados e os resultados obtidos. \ Desta forma, poderemos compreender o processo de modulação e demodulação FM, bem como a análise dos sinais modulados e demodulados, e a importância deste processo para a transmissão de sinais de áudio em sistemas de comunicação. = Fundamentação teórica == Principais Conceitos Os principais conceitos teóricos abordados neste relatório são: - Modulação FM: A modulação em frequência (FM) é um processo de modulação em que a frequência da portadora é variada de acordo com a amplitude do sinal modulante. A variação da frequência da portadora é proporcional à amplitude do sinal modulante, resultando em um sinal modulado em frequência. A modulação em frequência é amplamente utilizada em sistemas de comunicação para transmissão de sinais de áudio, devido à sua alta qualidade de áudio e baixa interferência. - Demodulação FM: A demodulação em frequência é o processo de recuperar o sinal modulante original a partir do sinal modulado em frequência. A demodulação FM é realizada através da diferenciação do sinal modulado, que resulta em um sinal que contém a informação de frequência do sinal modulante original. O sinal demodulado é então filtrado para remover as frequências indesejadas e obter o sinal de áudio original. - Sinal Portador: O sinal portador é um sinal (tipicamente de alta frequência) que é modulado pela informação do sinal modulante. O sinal portador é a base para a transmissão do sinal modulado em frequência e é recuperado na demodulação para obter o sinal de áudio original. - Sinal Modulante: O sinal modulante é o sinal de áudio que é modulado em frequência para transmissão em sistemas de comunicação. O sinal modulante é a informação que é transmitida através da variação da frequência da portadora. == Resumo dos Itens abordados (Material de Referência) Além dos conceitos base apresentados acima, o material de referência também aborda os seguintes tópicos, que são importantes para o entendimento do processo de modulação e demodulação em frequência (itens 9.1, 9.2, 9.3 e 9.4). === The history of the FM Standard Objetivo: Apresentar a modulação em frequência (FM) e sua importância para a transmissão de sinais de áudio em sistemas de comunicação. \ Nesta sessão do livro, o autor apresenta a história da modulação em frequência (FM) e sua importância para a transmissão de sinais de áudio em sistemas de comunicação. O nacimento da modulação em frequência ocorreu em 1933 com o americano <NAME>, que desenvolveu e demonstrou a rádio FM como uma solução para o "problema do ruído estático". \ Em 1912, <NAME> descobriu que, se as ondas eletromagnéticas emitidas pelos receptores de rádio (de válvula de vidro) fossem alimentadas de volta através do hardware (circuito de RF), a intensidade do sinal aumentava, e assim, ondas de rádio eram geradas. \ De acordo com o livro, ele chamou esse processo de feedback positivo de regeneração, e é considerado uma das descobertas mais importantes na história do rádio, pois significava que receptores de rádio também poderiam ser usados como transmissores. === The mathematics of FM & the Modulation Index Objetivo: Apresentar a matemática da modulação em frequência (FM) e o índices de modulação FM. Nesta sessão, o autor explica sobre a construção de um modulador FM analógico através de um VCO (Voltage Controller Oscillator). O VCO gera um sinal senoidal cuja fase (e, portanto, efetivamente a frequência) muda em resposta a variações de amplitude de um sinal de controle de entrada. \ Quando o sinal modulante é inserido no VCO, ele é multiplicado por uma constante (k_f) que representa a relação de variação de tensão proporcional a variação de frequência. \ Assim, conforme o sinal modulante varia (supondo uma senoide por exemplo), o sinal modulado tem sua frequência variada na mesma proporção que a variação de tensão ao longo do tempo. \ A fase do senoide é determinada pelo valor instantâneo de tensão do sinal modulante, e a frequência do sinal modulado é determinada pela taxa de variação da fase do sinal modulante. === FM Signal Bandwidth Objetivo: Apresentar a largura de banda do sinal FM e as diferenças entre NFM (Narrowband FM) e WFM (Wideband FM). Nesta sessão, o autor apresenta a largura de banda do sinal FM e as diferenças entre NFM (Narrowband FM) e WFM (Wideband FM). A largura de banda do sinal FM é determinada pela taxa de variação da frequência do sinal modulante. \ A modulação em frequência é considerada um processo de Banda Estreita ou Banda Larga, e o valor do índice de modulação determina isso. Se o índice de modulação de um sinal FM for << 1, é considerado FM de Banda Estreita (NFM), enquanto se for >> 1, é FM de Banda Larga (WFM). ==== NFM (Narrowband FM): A modulação em frequência de banda estreita (NFM) é caracterizada por um índice de modulação << 1, resultando em um desvio de frequência máximo limitado, geralmente em torno de 5kHz. Neste cenário, as aproximações podem ser feitas para simplificar os cálculos, já que a contribuição da frequência instantânea é negligenciável. A equação de modulação FM pode ser expandida usando identidades trigonométricas apropriadas. A NFM é comumente usada em aplicações como comunicações de rádio bidirecionais e sistemas de rádio de curto alcance, onde a largura de banda é limitada e a fidelidade do sinal é essencial. ==== WFM (Wideband FM): A modulação em frequência de banda larga (WFM) é o padrão usado por estações de rádio comerciais, caracterizado por um índice de modulação >> 1. Neste caso, o desvio de frequência máximo permitido é maior, frequentemente em torno de 75kHz. A WFM oferece uma qualidade de áudio superior à NFM, mas requer uma largura de banda maior. Durante o processo de modulação, são criadas um número infinito de bandas laterais ao redor da frequência da portadora, o que exige uma limitação da largura de banda para evitar interferências entre canais. As estações de rádio FM geralmente são separadas por 0,2MHz nos receptores analógicos devido a essa limitação de largura de banda. === FM Demodulation Using Differentiation Objetivo: Apresentar a demodulação em frequência utilizando a diferenciação do sinal modulado. \ Nesta seção, o autor descreve o processo de demodulação do sinal FM modulado através de diferenciação do sinal recebido. Para o sinal transmitido (e recebido perfeitamente), um novo sinal diferenciado denotado como (onde o traço denota a derivada) é gerado pelo receptor. \ Neste método, o sinal terá a aparência de um sinal AM-DSB-TC no domínio do tempo, pois possui uma envoltória de informação (embora, ao contrário de uma envoltória AM padrão, a frequência do componente da portadora ainda muda). De acordo com o autor, as flutuações nesta envoltória são diretamente proporcionais à frequência instantânea do sinal modulado, que deve ser diretamente proporcional à amplitude do sinal de informação original. \ Se considerarmos que o termo senoidal de alta frequência pode ser removido por um detector de envoltória (utilizado nos scripts matlab descritos neste documento, veja o código abaixo), fica claro que a amplitude da envoltória é diretamente proporcional à amplitude do sinal de informação. Embora tenha um deslocamento DC (e ganho de resultante da constante de modulação FM), o sinal de áudio original pode ser recuperado com precisão.s #sourcecode[```matlab % Calculating the FM demodulation for the modulated signal demodulated_signal = diff(modulated_signal) * fs / k0; demodulated_signal = [demodulated_signal, 0]; % Sinal demodulado % calculating the FFT of the random signal; demodulated_f = fft(demodulated_signal)/length(demodulated_signal); demodulated_f = fftshift(demodulated_f); % Calculating the signal wrap. demodulated_wrap = abs(hilbert(demodulated_signal)); ```] = Análise dos resultados == Sinal de áudio Aleatório: Inicialmente, foi feita a importação de um sinal de áudio para ser utilizado como modulante da portadora em frequência, para transmissão em FM. A figura abaixo mostra o plot do sinal no domínio do tempo, bem como seu respectivo plot do sinal no domínio da frequência. #figure( figure( image("./pictures/timeDomain.png"), numbering: none, caption: [Sinal de entrada no domínio do tempo] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Uma vez com o sinal de entrada definido, a modulação em frequência foi realizada através da integração do argumento de fase da portadora a partir do sinal da modulante, conforme o script abaixo: #sourcecode[```matlab % Creating the FM modulated signal: phase_argument = 2*pi*k_f*cumsum(modulating_signal)*(Ts); modulated_signal = A_carrier * cos(2*pi*f_carrier*t + phase_argument); ```] Onde na figura acima os parâmetros são: - `modulating_signal` é o sinal de áudio importado. - `k_f` é a sensibilidade do modulador para variação de frequência. - `Ts` é o período de amostragem do sinal. - `A_carrier` é a amplitude da portadora - `f_carrier` é a frequência da portadora. - `t` é o vetor de tempo do sinal modulado (utilizado para realizar a modulação em FM). - `phase_argument` é o argumento de fase da portadora do sinal, gerado a partir da integração do sinal modulante. - `modulated_signal` é o sinal modulado em FM. Uma vez com o sinal modulado em FM, podemos compreender o formato do sinal modulado no domínio do tempo e da frequência, conforme a figura abaixo: #figure( figure( image("./pictures/FrequencyDomain.png"), numbering: none, caption: [Sinal modulado em FM no domínio do tempo e da frequência] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Uma vez com o sinal modulado, e multiplexado, podemos transmiti-lo pelo meio físico sem que haja interferência entre cada portadora (idealmente). O sinal no meio físico é ilustrado abaixo em azul. \ #figure( figure( image("./pictures/Modulated.png"), numbering: none, caption: [Sinal modulado e "transmitido" no meio físico] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Na recepção do sinal, precisamos realizar sua demodulação para ter novamente o sinal de áudio original. Para isso, utilizamos um demodulador FM, que é basicamente um circuito que realiza a derivação do sinal modulado, conforme o script abaixo: #sourcecode[```matlab % Calculating the FM demodulation for the modulated signal demodulated_signal = diff(modulated_signal) * fs / k0; demodulated_signal = [demodulated_signal, 0]; % Sinal demodulado % calculating the FFT of the random signal; demodulated_f = fft(demodulated_signal)/length(demodulated_signal); demodulated_f = fftshift(demodulated_f); % Calculating the signal wrap. demodulated_wrap = abs(hilbert(demodulated_signal)); ```] Com o sinal demodulado, utilizamos um filtro passa-baixas para eliminar as frequências indesejadas, e obter o sinal de áudio original. Para isso, foi utilizado um filtro FIR de ordem relativamente alta (neste caso 100), com frequência de corte de 20kHz. A frequência neste script foi fixada em 20kHz, pois trata-se de um sinal de áudio, e portanto, não há informação relevante acima desta frequência para ser capturada. Para verificar se de fato o filtro está atuando corretamente, abaixo está um plot da resposta em frequência do filtro FIR: #figure( figure( image("./pictures/filter.png"), numbering: none, caption: [Resposta em frequência do filtro FIR] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Com o sinal demodulado e filtrado, podemos realizar seu plot no dominio do tempo e também realizar a FFT do sinal para observar as componentes de frequência do sinal demodulado. #figure( figure( image("./pictures/Demodulated.png"), numbering: none, caption: [Sinal demodulado no domínio do tempo] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Como podemos observar, o sinal demodulado é muito semelhante ao sinal de áudio original, com pequenas distorções devido ao processo de modulação e demodulação em frequência. O sinal também foi plotado no dominio do tempo e da frequência, para verificar se o sinal demodulado está correto. #figure( figure( image("./pictures/DemodulatedF.png"), numbering: none, caption: [Sinal demodulado no domínio da frequência] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) == Sinal Senoidal Modulante Devido as variações no processo de modulação e demodulação apresentadas anteriormente, foi feita a análise de um sinal puramente senoidal como modulante em FM, para verificar se o processo de modulação e demodulação em frequência está correto. Inicialmente, foi feita a definição dos parâmetros do sinal modulante e em seguida o plot do mesmo no dominio do tempo e também da frequência: #figure( figure( image("./pictures/timeDomain-Sin.png"), numbering: none, caption: [Sinal senoidal modulante no domínio do tempo e da frequência] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Em seguida, com o sinal modulante definido, foi feita a modulação em frequência do sinal senoidal, note que para esse processo de modulação, o sinal modulante é uma senoide pura, e portanto, o sinal modulado em FM possui uma variação suave e periódica de frequência ao longo do tempo. \ Sendo assim possivel analisar o sinal modulado no dominio do tempo e da frequência, conforme a figura abaixo: #figure( figure( image("./pictures/FrequencyDomain-Sin.png"), numbering: none, caption: [Sinal modulado em FM no domínio do tempo e da frequência] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Com o sinal modulado em FM definido, podemos transmiti-lo pelo meio físico, e realizar a demodulação do sinal para obter o sinal senoidal original. Na recepção, foi feita a demodulação do sinal modulado, e em seguida a filtragem do sinal demodulado para obter o sinal senoidal original, a figura abaixo mostra o sinal demodulado no dominio do tempo: #figure( figure( image("./pictures/Demodulated-Sin.png"), numbering: none, caption: [Sinal demodulado no domínio do tempo] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) Novamente, para verificar se o sinal demodulado está correto, foi feita a análise do sinal demodulado no dominio da frequência, conforme a figura abaixo: #figure( figure( image("./pictures/DemodulatedF-Sin.png"), numbering: none, caption: [Sinal demodulado no domínio da frequência] ), caption: figure.caption([Elaborada pelo Autor], position: top) ) = Scripts e Códigos Utilizados: == Definições Iniciais O script abaixo define as variáveis iniciais do sistema, como a amplitude dos sinais, a frequência do sinal modulante, a frequência da portadora, a sensibilidade do modulador para variação de frequência, e o período de amostragem do sinal. #sourcecode[```matlab close all; clear all; clc; pkg load signal; % Altera o tamanho da fonte nos plots para 15 set(0, 'DefaultAxesFontSize', 20); % Defining the signals amplitude. A_modulating = 1; A_carrier = 1; % Defining the signals frequency f_modulating_max = 20000; f_carrier = 80000; % modulator sensibility for frequency variation (Hz/volts) k_f = 2000000; k0 = 2*pi*k_f; % Delta variable, correponding to max frequency variation. d_f = k_f*A_modulating; % Beta variable, correspondig to percentage of frequency variation about the frequency of the modulating. b = d_f/f_modulating_max; % Defining the period and frequency of sampling: fs = 50*f_carrier; Ts = 1/fs; T = 1/f_modulating_max; % Defining the sinal period. t_inicial = 0; t_final = 2; % "t" vector, correspondig to the time period of analysis, on time domain. t = [t_inicial:Ts:t_final]; ```] == Sinal modulante e Modulado FM O script abaixo importa um sinal de áudio para ser utilizado como modulante da portadora em frequência, e em seguida realiza a modulação em frequência do sinal modulante. #sourcecode[```matlab % Import the audioSignal to use as modulating FM signal: [modulating_signal, Hs] = audioread('randomSignal.wav'); modulating_signal = transpose(modulating_signal); % Calculate the number of zeros to be added num_zeros = length(t) - length(modulating_signal); % Add the zeros to the end of the modulating_signal vector modulating_signal = [modulating_signal, zeros(1, num_zeros)]; % Transpose the modulated signal if necessary modulated_signal = transpose(modulating_signal); % Creating the FM modulated signal: phase_argument = 2*pi*k_f*cumsum(modulating_signal)*(Ts); modulated_signal = A_carrier * cos(2*pi*f_carrier*t + phase_argument); % Plot signals on time domain: figure(1) subplot(311) plot(t, (modulating_signal),'b', 'LineWidth', 2) xlim([0.00054 0.00067]) xlabel('Time (s)') ylabel('Amplitude') title('Random Sound Signal (Time Domain)') subplot(312) plot(t, abs(modulating_signal),'r', 'LineWidth', 2) xlim([0.00054 0.00067]) xlabel('Time (s)') ylabel('Amplitude') title('Random Sound Signal - Absolute (Time Domain)') subplot(313) plot(t, modulated_signal,'k', 'LineWidth', 2) xlim([0.00054 0.00067]) xlabel('Time (s)') ylabel('Amplitude') title('Modulated FM Signal (Time Domain)') ```] == FFT dos sinais modulantes O script abaixo calcula a FFT dos sinais modulantes e modulados, e em seguida realiza o plot dos sinais no domínio da frequência. #sourcecode[```matlab % calculating the step of the frequency vector "f" (frequency domain); f_step = 1/t_final; % creating the frequency vector "f" (frequency domain); f = [-fs/2:f_step:fs/2]; % calculating the FFT of the random signal; modulating_f = fft(modulating_signal)/length(modulating_signal); modulating_f = fftshift(modulating_f); % calculating the FFT of the modulated signal; modulated_f = fft(modulated_signal)/length(modulated_signal); modulated_f = fftshift(modulated_f); % Plotting the modulated signal on frequency domain; figure(2) subplot(211) plot(f, abs(modulating_f), 'k', 'LineWidth', 2) xlabel('Frequency (Hz)') ylabel('Amplitude') title('Modulating Signal (Frequency Domain)') xlim([-f_carrier*1.2 f_carrier*1.2]) ylim([0 A_carrier/1000]) subplot(212) plot(f, abs(modulated_f), 'k', 'LineWidth', 2) xlabel('Frequency (Hz)') ylabel('Amplitude') title('Modulated Signal (Frequency Domain)') xlim([-f_carrier*1.2 f_carrier*1.2]) ylim([0 A_carrier/1000]) ```] == Demodulação do sinal e Filtro O script abaixo realiza a demodulação do sinal modulado, e em seguida realiza a filtragem do sinal demodulado para obter o sinal de áudio original. #sourcecode[```matlab % Calculating the FM demodulation for the modulated signal demodulated_signal = diff(modulated_signal) * fs / k0; demodulated_signal = [demodulated_signal, 0]; % Sinal demodulado % Ordem do filtro FIR filtro_ordem = 100; % Frequência de corte do filtro FIR % Como trata-se de um sinal de áudio, a frequência de corte pode ser fixada em 20kHz frequencia_corte = 20000; % Coeficientes do filtro FIR para cada sinal demodulado coeficientes_filtro = fir1(filtro_ordem, frequencia_corte/(fs/2)); % Resposta em frequência do filtro FIR para cada sinal demodulado [H_fir, f_fir] = freqz(coeficientes_filtro, 1, length(t), fs); % Plot da resposta em frequência do filtro: figure(6) plot(f_fir, abs(H_fir), 'r', 'LineWidth', 3) xlim([0 frequencia_corte*1.1]) title('Resposta em Frequência do Filtro FIR') xlabel('Frequência (Hz)') ylabel('Magnitude') ```] == Filtragem e plotagem dos sinais resultantes O script abaixo realiza a filtragem do sinal demodulado, e em seguida realiza o plot dos sinais modulados e demodulados no domínio do tempo e da frequência. #sourcecode[```matlab % Filtragem dos sinais demodulados demodulated_filtered = filter(coeficientes_filtro, 1, demodulated_signal); % calculating the FFT of the random signal; demodulated_filtered_f = fft(demodulated_filtered)/length(demodulated_filtered); demodulated_filtered_f = fftshift(demodulated_filtered_f); % Calculating the signal wrap. demodulated_wrap = abs(hilbert(demodulated_filtered)); % Plotting the modulated and demodulated signals on time domain: figure(3) subplot(311) plot(t, modulated_signal, 'k', 'LineWidth', 2) xlim([0.00054 0.00067]) xlabel('Tempo (s)') ylabel('Amplitude') title('Sinal Modulado FM (Domínio do Tempo)') subplot(312) plot(t, demodulated_signal, 'b', 'LineWidth', 2) xlim([0.00054 0.00067]) xlabel('Tempo (s)') ylabel('Amplitude') title('Sinal Demodulado FM (Domínio do Tempo)') subplot(313) plot(t, demodulated_filtered, 'r--', 'LineWidth', 2) xlim([0.00054 0.00067]) xlabel('Tempo (s)') ylabel('Amplitude') title('Sinal Demodulado FM Filtrado (Domínio do Tempo)') figure(4) subplot(211) plot(f, demodulated_filtered_f, 'k', 'LineWidth', 2) xlabel('Frequency (Hz)') ylabel('Amplitude') title('Demodulated Signal (Frequency Domain)') xlim([-f_carrier*1.2 f_carrier*1.2]) ylim([0 A_carrier/1000]) subplot(212) plot(f, abs(demodulated_filtered_f), 'k', 'LineWidth', 2) xlabel('Frequency (Hz)') ylabel('Amplitude') title('Absolute Demodulated Signal (Frequency Domain)') xlim([-f_carrier*1.2 f_carrier*1.2]) ylim([0 A_carrier/1000]) ```] = Conclusão A partir dos conceitos vistos e dos resultados obtidos, podemos concluir que o processo de modulação e demodulação em frequência é uma tecnica eficiente para a transmissão de sinais de áudio em sistemas de comunicação, pois permite a transmissão de sinais de áudio com qualidade e fidelidade com baixa interência devido a informação estar sendo carregada na variação de frequência e não na amplitude do sinal. Desta forma, podemos compreender seu uso em sistemas de telecomunicação utilizado atualmente pelas rádios analógicas regionais para transmissão de sinais de áudio em broadcast para toda a região, visto que esse tipo de transmissão possui um baixo índice de ruído e distorção. = Referências Para o desenvolvimento deste relatório, foi utilizado o seguinte material de referência: - #link("https://www.researchgate.net/publication/287760034_Software_Defined_Radio_using_MATLAB_Simulink_and_the_RTL-SDR")[Software Defined Radio Using MATLAB & Simulink and the RTL-SDR, de <NAME>]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/vonsim/0.1.0/README.md
markdown
Apache License 2.0
This package adds the ability to syntax highlighting VonSim source code in Typst. ## How to use To add global support for VonSim, just add these lines and use a raw block with `vonsim` as its language. ````typst #import "@preview/vonsim:0.1.0": init-vonsim // Adds global support for VonSim #show: init-vonsim // Highlight VonSim code ```vonsim ; Welcome to VonSim! ; This is an example program that calculates the first ; n numbers of the Fibonacci sequence, and stores them ; starting at memory position 1000h. n equ 10 ; Calculate the first 10 numbers org 1000h start db 1 org 2000h mov bx, offset start + 1 mov al, 0 mov ah, start loop: cmp bx, offset start + n jns finish mov cl, ah add cl, al mov al, ah mov ah, cl mov [bx], cl inc bx jmp loop finish: hlt end ``` ```` Alternatively, use `init-vonsim-full` to also use the VonSim theme.
https://github.com/hongjr03/shiroa-page
https://raw.githubusercontent.com/hongjr03/shiroa-page/main/DSA/chapters/6树和二叉树.typ
typst
#import "../template.typ": * #import "@preview/pinit:0.1.4": * #import "@preview/fletcher:0.5.0" as fletcher: diagram, node, edge #import "/book.typ": book-page #show: book-page.with(title: "树和二叉树 | DSA") = 树和二叉树 <树和二叉树> == 树的定义和基本术语 <树的定义和基本术语> #definition[ *树*树是 $n(n >= 0)$ 䞪结点的有限集合。圓 $n = 0$ 时称䞺空树圓 $n > 0$ 时树具有以䞋性莚 - 有䞔仅有䞀䞪特定的称䞺根的结点 - 圓 $n > 1$ 时其䜙结点可分䞺 $m(m > 0)$ 䞪互䞍盞亀的有限集合 $T_1, T_2, dots, T_m$其䞭每䞀䞪集合本身又是䞀棵树称䞺根的子树。 ]<树的定义> 对比线性结构和树圢结构 #table( columns: (1fr, 1fr), rows: 2em, align: center + horizon, table.header([*线性结构*], [*树圢结构*]), [第䞀䞪数据元玠无前驱], [根结点无前驱], [最后䞀䞪数据元玠无后继], [倚䞪叶子结点无后继], [其他数据元玠䞀䞪前驱、䞀䞪后继], [其他结点䞀䞪双亲、倚䞪孩子], ) === 基本术语 - *结点*数据元玠+若干指向子树的分支 - *结点的床*结点的*子树*䞪数这里和犻散数孊䞭的床有所䞍同 - *树的床*树䞭结点的最倧床 - *叶子结点*床䞺 0 的结点 - *分支结点*床䞍䞺 0 的结点 - 从根结点到某䞪结点的*路埄*由从根到该结点所经分支和结点构成 - *层次*根结点的层次䞺 1其䜙结点的层次等于其双亲结点的层次加 1 - *树的深床*树䞭结点的最倧层次 - *森林*$m(m > 0)$ 棵互䞍盞亀的树的集合 #note_block[ 任䜕非空树是䞀䞪二元组 $"Tree" = ("root", F)$其䞭 $"root"$ 是树的根结点$F$ 是子树森林。 ] - *有向树* + 有确定的根结点 + 树根和子树根之闎䞺有向关系 - *有序树*树䞭结点的各子树看成是有序的即子树之闎有次序关系 - *无序树*子树之闎无次序关系 == 二叉树 #definition[ *二叉树*二叉树或䞺空树或是由䞀䞪根结点加䞊䞀棵分别称䞺巊子树和右子树的、互䞍亀的二叉树组成。 ] #note_block[ 床䞺 2 的树䞍䞀定是二叉树。 ] #block(breakable: false)[ #import fletcher.shapes: house, hexagon, ellipse #let blob(pos, label, tint: white, ..args) = node( pos, align(center, label), width: auto, fill: tint.lighten(60%), stroke: 1pt + tint.darken(20%), corner-radius: 5pt, shape: circle, ..args, ) #set figure(supplement: none) 二叉树的五种圢态 #grid( columns: (0.8fr, 0.8fr, 1fr, 1fr, 1fr), )[ #figure($diameter$, caption: "空树") ][ #figure(diagram(blob((0, 0), "N")), caption: "只含根结点") ][ #figure(diagram(blob((0, 0), "N"), edge(), blob((-0.5, 0.5), "L")), caption: "右子树䞺空树") ][ #figure(diagram(blob((0, 0), "N"), edge(), blob((0.5, 0.5), "R")), caption: "巊子树䞺空树") ][ #figure( diagram(blob((0, 0), "N"), edge(), blob((-0.5, 0.5), "L"), edge((0, 0), (0.5, 0.5)), blob((0.5, 0.5), "R")), caption: "巊右子树均䞍䞺空", ) ] ] === 二叉树的性莚 + 圚二叉树的第 $i$ 层䞊至倚有 $2^(i-1)$ 䞪结点$i >= 1$。 + 深床䞺 $k$ 的二叉树至倚有 $2^k - 1$ 䞪结点$k >= 1$。 + 对任䜕䞀棵非空二叉树若叶子结点数䞺 $n_0$床䞺 2 的结点数䞺 $n_2$则 $n_0 = n_2 + 1$。 + 具有 $n$ 䞪结点的完党二叉树的深床䞺 $floor(log_2n) + 1$。#definition[ *满二叉树*每层结点郜蟟到最倧倌的二叉树。 ] #definition[ *完党二叉树*树䞭所含的 $n$ 䞪结点和满二叉树䞭猖号䞺 $1$ 至 $n$ 的结点䞀䞀对应。 ] #note_block[ 完党二叉树䞍䞀定是满二叉树䜆是满二叉树䞀定是完党二叉树。 刀断䞀棵树是吊是完党二叉树 - 从根结点匀始按层序猖号 - 若某䞪结点有右孩子而无巊孩子则䞍是完党二叉树 - 若某䞪结点䞍是巊右孩子郜有则其后的结点郜是叶子结点 ] + 䞀棵有 $n$ 䞪结点的完党二叉树按层序猖号对任䞀结点 $i$ 有 - 若 $i = 1$则 $i$ 是根无双亲吊则其双亲是 $floor(i/2)$。 - 若 $2i > n$则 $i$ 无巊孩子吊则巊孩子是 $2i$。 - 若 $2i + 1 > n$则 $i$ 无右孩子吊则右孩子是 $2i + 1$。 == 二叉树的存傚结构 === 顺序存傚结构 简单来诎就是甚数组存傚二叉树的结点按照完党二叉树的结构存傚。 根节点存傚圚数组䞋标䞺 0 的䜍眮然后每䞪结点的巊孩子存傚圚 $2i + 1$ 的䜍眮右孩子存傚圚 $2i + 2$ 的䜍眮$i$ 衚瀺该结点圚数组䞭的䞋标。同样的劂果知道䞀䞪结点的䞋标可以通过 $floor((i-1)/2)$ 扟到其双亲结点。 === 铟匏存傚结构 ==== 二叉铟衚 结点结构 #table(columns: ((5em, 4em, 5em)), rows: 2em, align: center + horizon, [lchild], [data], [rchild]) #figure(image("../assets/2024-06-25-16-13-50.png", width: 80%), caption: "二叉铟衚") ==== 䞉叉铟衚 比二叉铟衚倚了䞀䞪指向双亲结点的指针。 #table(columns: ((5em, 5em, 4em, 5em)), rows: 2em, align: center + horizon, [parent], [lchild], [data], [rchild]) #figure(image("../assets/2024-06-25-16-15-02.png", width: 80%), caption: "䞉叉铟衚") == 二叉树的遍历 === 先序遍历 先访问根结点然后䟝次先序遍历巊子树和右子树。 #note_block[ 若二叉树䞺空树则空操䜜吊则 + 访问根结点 + 先序遍历巊子树递園 + 先序遍历右子树。递園 ] 非递園实现 ```c void PreOrder(Bitree T) { Stack S; InitStack(S); Bitree p = T; while (p || !StackEmpty(S)) { if (p) { visit(p->data); Push(S, p); p = p->Lchild; } else { Pop(S, p); p = p->Rchild; } } } ``` === 䞭序遍历 先䞭序遍历巊子树然后访问根结点最后䞭序遍历右子树。 #note_block[ 若二叉树䞺空树则空操䜜吊则 + 䞭序遍历巊子树递園 + 访问根结点 + 䞭序遍历右子树。递園 ] 非递園实现 ```c void InOrder(Bitree T) { Stack S; InitStack(S); Bitree p = T; while (p || !StackEmpty(S)) { if (p) { Push(S, p); p = p->Lchild; } else { Pop(S, p); visit(p->data); p = p->Rchild; } } } ``` === 后序遍历 先后序遍历巊子树然后后序遍历右子树最后访问根结点。 #note_block[ 若二叉树䞺空树则空操䜜吊则 + 后序遍历巊子树递園 + 后序遍历右子树递園 + 访问根结点 ] 非递園实现 ```c void PostOrder(Bitree T) { Stack S; InitStack(S); Bitree p = T; Bitree r = NULL; while (p || !StackEmpty(S)) { if (p) { Push(S, p); p = p->Lchild; } else { GetTop(S, p); if (p->Rchild && p->Rchild != r) { p = p->Rchild; } else { Pop(S, p); visit(p->data); r = p; p = NULL; } } } } ``` == 线玢二叉树 结点结构 #table(columns: ( (5em, 4em, 5em, 4em, 5em) ), rows: 2em, align: center + horizon, [lchild], [ltag], [data], [rtag], [rchild]) ltag 和 rtag 甚来标记是吊䞺线玢即指向前驱和后继的指针。劂果䞺 0则衚瀺指向孩子结点劂果䞺 1则衚瀺指向前驱或后继。 #image("../assets/Threaded_tree.svg", width: 37%) == 树和森林 === 孩子兄匟衚瀺法 #definition[ *孩子兄匟衚瀺法*以二叉铟衚䜜䞺树的存傚结构称䞺孩子兄匟衚瀺法。 ] 结点结构 #table(columns: ((5em, 5em, 5em)), rows: 2em, align: center + horizon, [firstchild], [data], [nextsibling]) #image("../assets/2024-06-25-16-37-45.png") === 树的遍历 ==== 先根遍历 若树䞍空则先访问根结点然后䟝次先根遍历各棵子树。 ==== 后根遍历 若树䞍空则䟝次后根遍历各棵子树然后访问根结点。 ==== 按层次遍历 若树䞍空则从树的第䞀层根结点匀始从䞊而䞋、从巊至右䟝次访问各结点。 ==== 应甚 *求树深* ```C int TreeDepth(CSTree T) { if (!T) return 0; else { h1 = TreeDepth(T->firstchild); h2 = TreeDepth(T->nextsibling); return (max(h1 + 1, h2)); } }// TreeDepth ``` *蟓出所有根到叶子结点的路埄* ```C void AllPath(Bitree T, Stack &S) { /// 蟓出二叉树䞊从根到所有叶子结点的路埄 if (T) { Push(S, T->data); if (!T->Lchild && !T->Rchild) PrintStack(S); else { AllPath(T->Lchild, S); AllPath(T->Rchild, S); } Pop(S); }// if(T) } // AllPath ``` *蟓出森林䞭所有根到叶子结点的路埄* ```C void OutPath(Bitree T, Stack &S) { // 蟓出森林䞭所有从根到叶的路埄 while (!T) { Push(S, T->data); if (!T->firstchild) Printstack(s); else OutPath(T->firstchild, s); Pop(S); T = T->nextsibling; }// while } // OutPath ``` === 森林的遍历 树的遍历和二叉树的遍历存圚对应关系 #table( columns: (1fr, 1fr, 1fr), rows: 2em, align: center + horizon, table.header([*树*], [*森林*], [*二叉树*]), [先根遍历], [先序遍历], [先序遍历], [后根遍历], [䞭序遍历], [䞭序遍历], ) ==== 先序遍历森林 若森林䞍空则可按䞋述规则遍历之 + 访问森林䞭第䞀棵树的根结点 + 先序遍历森林䞭第䞀棵树的子树森林 + 先序遍历森林䞭陀第䞀棵树之倖其䜙树构成的森林。 即䟝次从巊至右对森林䞭的每䞀棵树进行先根遍历。 ==== 䞭序遍历森林 若森林䞍空则可按䞋述规则遍历之 + 䞭序遍历森林䞭第䞀棵树的子树森林 + 访问森林䞭第䞀棵树的根结点 + 䞭序遍历森林䞭陀第䞀棵树之倖其䜙树构成的森林。 即䟝次从巊至右对森林䞭的每䞀棵树进行*后根遍历*。 == 哈倫曌树 #definition[ *垊权路埄长床**WPL*讟 $T$ 是䞀棵有 $n$ 䞪叶子结点的二叉树每䞪叶子结点 $w_i$ 的权倌䞺 $w_i$从根结点到每䞪叶子结点 $w_i$ 的路埄长床䞺 $l_i$则 $T$ 的垊权路埄长床䞺 $ "WPL"(T) = sum_(i=1)^(n) w_i times l_i $ ] #definition[ *哈倫曌树*垊权路埄长床最短的二叉树称䞺哈倫曌树。又称*最䌘二叉树*。 ] #note_block[根节点路埄长床䞺 0巊子树路埄长床加 1右子树路埄长床加 1。] *构建*哈倫曌树的算法 1. 从 $n$ 䞪权倌 $w_1, w_2, dots, w_n$ 的叶子结点出发构造 $n$ 棵只有䞀䞪结点的二叉树。 2. 圚 $n$ 棵树䞭选取䞀棵根结点的权倌最小的树䜜䞺巊右子树构造䞀棵新的二叉树䞔新的二叉树的根结点的权倌䞺其巊右子树根结点的权倌之和。#note_block[ 䜿甚最小堆可以快速扟到最小的䞀䞪树。 ] 3. 从 $n$ 棵树䞭删陀选取的䞀棵树并将新构造的二叉树加入到森林䞭。 4. 重倍 2 和 3盎到森林䞭只有䞀棵树䞺止。 而哈倫曌猖码就是根据哈倫曌树的路埄来猖码路埄巊蟹䞺 0右蟹䞺 1。
https://github.com/DawnEver/ieee-conference-typst-template
https://raw.githubusercontent.com/DawnEver/ieee-conference-typst-template/main/README.md
markdown
MIT License
# IEEE Conference [Typst](https://typst.app) Template I am preparing for IEEE cofference these days. Frustrated with Latex, I choose Typst to rewrite my paper. In fact, typst app provides built-in IEEE paper template and [ieee-typst-template](https://github.com/bsp0109/ieee-typst-template) gives a modified edition for author's requiements, but they are not enough. Based on Word and Latex templates and format guidelines, I diy my Typst template. ## What is Typst Typst is a new markup-based typesetting system that is designed to be as powerful as LaTeX while being much easier to learn and use. - [Typst Github](https://github.com/typst/typst) - [Typst Homepage](https://typst.app) ## Features - IEEE copyright on the first page. - Top captions for tables. - ... ## Preview See the [main.pdf](main.pdf). ![demo.png](demo.png) ## Usage: You can try it online ([Click Me](https://typst.app/project/rgsg7a58qn3fKa7jPhbl2U)) or run locally.I strongly recommand writing with VSCode. ![vscode_preview](vscode_preview.png) ## Contribute Welcome to PRs.
https://github.com/SamK/typst-fonts-showcase
https://raw.githubusercontent.com/SamK/typst-fonts-showcase/master/template.typ
typst
// vim: tabstop=2 softtabstop=2 shiftwidth=2 #let template(title, pangram) = { set page(numbering: "1/1") set text(fallback: false) let list-fonts() = { let fonts = () let lines = read("fonts.txt").split("\n") for this-line in lines { let clean-line = this-line.trim() if clean-line != "" { fonts.push(clean-line) } } fonts } let font-box(font_name) = { heading(numbering: "1. ")[ #text(font: font_name, font_name) #text(size: .8em, weight: "regular", [(#font_name)]) ] set text(font: font_name) pangram } align(center, text(17pt, title)) let all-fonts = list-fonts() [This document shows all the #all-fonts.len() fonts Typst found on your system.] outline() for this-font in all-fonts { font-box(this-font) } }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/km/0.1.0/lib.typ
typst
Apache License 2.0
#let binary-digits(x, digit: 0) = { let digits = range(digit).map(_ => 0) while (x != 0) { digits.insert(digit, calc.rem-euclid(x, 2)) x = calc.div-euclid(x, 2) } return digits.rev().slice(0, digit).rev() } #let gray-code(x) = x.bit-xor(x.bit-rshift(1)) #let karnaugh(labels, minterms, implicants: (), show-zero: false, mode: "code") = { let (X, Y) = range(2).map(i => if (type(labels.at(i)) == str) { // Label extracted from character(s) labels.at(i).clusters().map(x => eval(x, mode: "math")) } else { labels.at(i) } ) // Dimensions: 2^len let row = calc.pow(2, X.len()) let column = calc.pow(2, Y.len()) let cell = ( width: 2.4em, height: 2.4em, ) let gray-codes(till, digit) = range(till).map(i => gray-code(i)).map(code => block(width: cell.width, height: cell.height, inset: cell.height / 9, for digit in binary-digits(code, digit: digit) { math.equation[#digit] } ) ) return table( rows: row + 1, columns: column + 1, inset: 0em, stroke: (x, y) => if (x == 0 or y == 0) { none } else { 1pt }, align: (x, y) => { if (x == 0 and y != 0) { horizon + right } else if (x != 0 and y == 0) { center + bottom } else { horizon + center } }, // Top-left label block block(width: cell.width, height: cell.height, { line(end: (100%, 100%)) let label = ( x: box(for x in Y { x }), y: box(for y in X { y }), ) context place(horizon + center, dx: measure(label.x).width / 2, dy: -0.5em, label.x) context place(horizon + center, dx: -measure(label.y).width / 2, dy: 0.5em, label.y) }), // Horizontal gray code labels ..if mode == "code" { gray-codes(column, Y.len()) }, table.cell(x: 1, y: 1, rowspan: row, colspan: column, block(clip: true, { table( rows: row, columns: column, inset: 0em, align: horizon + center, stroke: 2pt / 3, ..range(row).map(i => range(column).map(j => block(width: cell.width, height: cell.height, { let term = minterms.at(i).at(j) if type(term) == int { if term == 0 { if show-zero { $0$ } } else if term == 1 { $1$ } else { math.ast.small } } else { term } }) ) ).flatten() ) while (implicants.len() > 0) { let implicant = implicants.pop() let (x, y, width, ..) = implicant let height = if implicant.len() == 3 { width } else { implicant.at(3) } place( top + left, dx: y * cell.width, dy: x * cell.height, rect( fill: rgb("#0003"), stroke: 2pt / 3, width: cell.width * width, height: cell.height * height, outset: -cell.height / 9) ) // No need to expand out-of-range rectanges from the expanded rectange if (implicant.len() == 5 and not implicant.at(4)) { continue } // Draw extra out-of-range rectange(s) if x + height > row { implicants.push((row - x - height, y, width, height, false)) if y + width > column { implicants.push((row - x - height, column - y - width, width, height, false)) } } if y + width > column { implicants.push((x, column - y - width, width, height, false)) } } }) ), ..if mode == "code" { gray-codes(row, X.len()) }, ) }
https://github.com/jamesrswift/ionio-illustrate
https://raw.githubusercontent.com/jamesrswift/ionio-illustrate/main/dist/0.1.0/src/lib.typ
typst
MIT License
#import "@preview/cetz:0.1.2" /// Returns an object representing mass spectrum content. #let mass-spectrum( data, args: (:) ) = { let prototype = ( // -------------------------------------------- // Public member data // -------------------------------------------- data: data, keys: ( mz: 0, intensity: 1 ), size: (auto, 1), range: (40, 400), style: (:), labels: ( x: [Mass-Charge Ratio], y: [Relative Intensity (%)] ), linestyle: (this, idx)=>{}, // -------------------------------------------- // "Private" member data // -------------------------------------------- axes: ( x: none, y: none ), plot-extras: (this)=>{}, // -------------------------------------------- // Methods // -------------------------------------------- display: (this) => { cetz.canvas({ import cetz.draw: * let (x,y) = (this.setup-axes)(this) cetz.draw.group(ctz=>{ (this.setup-plot)(this, x, y) cetz.axes.axis-viewport(this.size, x, y,{ (this.plot-extras)(this) if this.data.len() > 0 { for (i, row) in data.enumerate() { let x = float(row.at(this.keys.mz)) let y = float(row.at(this.keys.intensity)) (this.display-single-peak)(this, x, x, y) } } }) }) }) }, display-single-peak: (this, idx, mz, intensity) => { if (mz > this.range.at(0) and mz < this.range.at(1) ){ cetz.draw.line( (mz, 0), (rel: (0,intensity)), ..(this.linestyle)(this, idx) ) } }, setup-plot: (this, x, y) => { cetz.axes.scientific( size: this.size, left: y, right: none, bottom: x, top: none, frame: true, label: (offset: 0.3), tick: (length:-0.1) ) }, setup-axes: (this) => { this.axes.x = cetz.axes.axis( min: this.range.at(0), max: this.range.at(1), label: this.labels.x, ) this.axes.y = cetz.axes.axis( min: 0, max: 110, label: this.labels.y, ticks: (step: 20, minor-step: none) ) return this.axes }, get-intensity-at-mz: (this, mz) => { return float( (this.data).filter( it=>float(it.at(this.keys.mz, default:0))==mz ).at(0).at(this.keys.intensity) ) }, callout-above: (this, mz, content: none, y-offset: 1.3em) => { if ( content == none ) { content = mz} return cetz.draw.content( anchor: "bottom", (mz, (this.get-intensity-at-mz)(this, mz)), box(inset: 0.3em, [#content]) ) }, calipers: ( this, start, end, // mass-charge ratios height: none, content: none, stroke: gray + 0.7pt // Style ) => { if (content == none){ content = [-#calc.abs(start - end)] } // Determine height let start_height = (this.get-intensity-at-mz)(this, start) let end_height = (this.get-intensity-at-mz)(this, end) if ( height == none ) { height = calc.max(start_height, end_height) + 5 } let draw-arrow(x, y) = cetz.draw.line( (x - 0.5, y + 2),(x + 0.5, y + 2), stroke: stroke ) // Draw return { // Start : horizontal arrow draw-arrow(start, start_height) draw-arrow(end, end_height) cetz.draw.merge-path({ cetz.draw.line( (start, start_height + 2), (start, height) ) cetz.draw.line((start, height), (end, height)) cetz.draw.line((end, height),(end, end_height + 2)) }, stroke: stroke) // Content cetz.draw.content( ( (start + end) / 2, height), anchor: "bottom", box(inset: 0.3em, content) ) } }, title: (this, content, anchor: "top-left", ..args) => { return cetz.draw.content( anchor: anchor, (this.range.at(0), 110), box(inset: 0.5em, content), ..args ) } ) // Overrides for (key, value) in args.pairs() { prototype.insert(key, value) } // Asserts assert(type(prototype.keys.mz) in (int, str)) assert(type(prototype.keys.intensity) in (int, str)) return prototype } #let MolecularIon(charge:none) = [M#super()[#charge+]]
https://github.com/GYPpro/Java-coures-report
https://raw.githubusercontent.com/GYPpro/Java-coures-report/main/.VSCodeCounter/2023-12-15_05-15-05/details.md
markdown
# Details Date : 2023-12-15 05:15:05 Directory d:\\Desktop\\Document\\Coding\\JAVA\\Rep\\Java-coures-report Total : 52 files, 7709 codes, 180 comments, 1740 blanks, all 9629 lines [Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md) ## Files | filename | language | code | comment | blank | total | | :--- | :--- | ---: | ---: | ---: | ---: | | [README.md](/README.md) | Markdown | 1 | 0 | 2 | 3 | | [README.typ](/README.typ) | Typst | 179 | 2 | 39 | 220 | | [Report/0.typ](/Report/0.typ) | Typst | 48 | 4 | 9 | 61 | | [Report/1.typ](/Report/1.typ) | Typst | 84 | 2 | 23 | 109 | | [Report/10.typ](/Report/10.typ) | Typst | 550 | 4 | 155 | 709 | | [Report/11.typ](/Report/11.typ) | Typst | 1,068 | 17 | 150 | 1,235 | | [Report/2.typ](/Report/2.typ) | Typst | 116 | 2 | 23 | 141 | | [Report/3.typ](/Report/3.typ) | Typst | 306 | 2 | 49 | 357 | | [Report/4.typ](/Report/4.typ) | Typst | 172 | 5 | 38 | 215 | | [Report/5.typ](/Report/5.typ) | Typst | 133 | 2 | 39 | 174 | | [Report/6.typ](/Report/6.typ) | Typst | 736 | 2 | 123 | 861 | | [Report/7.typ](/Report/7.typ) | Typst | 210 | 13 | 45 | 268 | | [Report/8.typ](/Report/8.typ) | Typst | 209 | 5 | 49 | 263 | | [Report/9.typ](/Report/9.typ) | Typst | 384 | 3 | 82 | 469 | | [Report/Java语蚀 实验报告暡板 2023-10-8-20231214155905.typ](/Report/Java%E8%AF%AD%E8%A8%80%20%E5%AE%9E%E9%AA%8C%E6%8A%A5%E5%91%8A%E6%A8%A1%E6%9D%BF%202023-10-8-20231214155905.typ) | Typst | 497 | 1 | 263 | 761 | | [Report/最小莹甚最倧流问题-20231215032417.typ](/Report/%E6%9C%80%E5%B0%8F%E8%B4%B9%E7%94%A8%E6%9C%80%E5%A4%A7%E6%B5%81%E9%97%AE%E9%A2%98-20231215032417.typ) | Typst | 323 | 1 | 205 | 529 | | [rubbish/myIO.java](/rubbish/myIO.java) | Java | 76 | 0 | 17 | 93 | | [sis10/Test.java](/sis10/Test.java) | Java | 18 | 0 | 5 | 23 | | [sis10/myLinearEntire.java](/sis10/myLinearEntire.java) | Java | 41 | 0 | 18 | 59 | | [sis10/myLinearLib.java](/sis10/myLinearLib.java) | Java | 197 | 34 | 13 | 244 | | [sis10/myLinearSpace.java](/sis10/myLinearSpace.java) | Java | 111 | 4 | 18 | 133 | | [sis10/myMatrix.java](/sis10/myMatrix.java) | Java | 267 | 4 | 24 | 295 | | [sis10/myPolynomial.java](/sis10/myPolynomial.java) | Java | 131 | 4 | 21 | 156 | | [sis10/myRealNum.java](/sis10/myRealNum.java) | Java | 58 | 3 | 15 | 76 | | [sis1/basicIO.java](/sis1/basicIO.java) | Java | 26 | 0 | 3 | 29 | | [sis2/Test.java](/sis2/Test.java) | Java | 54 | 0 | 2 | 56 | | [sis2/UIDmanager.java](/sis2/UIDmanager.java) | Java | 138 | 0 | 19 | 157 | | [sis3/Test.java](/sis3/Test.java) | Java | 26 | 5 | 5 | 36 | | [sis3/TrieTree.java](/sis3/TrieTree.java) | Java | 37 | 0 | 6 | 43 | | [sis4/regularExp.java](/sis4/regularExp.java) | Java | 34 | 0 | 4 | 38 | | [sis5/SchoolLib.java](/sis5/SchoolLib.java) | Java | 186 | 31 | 15 | 232 | | [sis5/Student.java](/sis5/Student.java) | Java | 114 | 0 | 24 | 138 | | [sis5/Test.java](/sis5/Test.java) | Java | 18 | 0 | 3 | 21 | | [sis5/course.java](/sis5/course.java) | Java | 76 | 0 | 17 | 93 | | [sis5/score.java](/sis5/score.java) | Java | 107 | 0 | 22 | 129 | | [sis6/segTree.h](/sis6/segTree.h) | C++ | 102 | 12 | 10 | 124 | | [sis7/Test.java](/sis7/Test.java) | Java | 24 | 5 | 5 | 34 | | [sis7/segTree.java](/sis7/segTree.java) | Java | 100 | 3 | 14 | 117 | | [sis8/maxFlow.java](/sis8/maxFlow.java) | Java | 96 | 0 | 13 | 109 | | [sis8/minCost.java](/sis8/minCost.java) | Java | 139 | 0 | 19 | 158 | | [sis8/solution.java](/sis8/solution.java) | Java | 26 | 1 | 3 | 30 | | [sis9/Bed.java](/sis9/Bed.java) | Java | 13 | 0 | 4 | 17 | | [sis9/City.java](/sis9/City.java) | Java | 21 | 0 | 7 | 28 | | [sis9/Constants.java](/sis9/Constants.java) | Java | 10 | 0 | 4 | 14 | | [sis9/Hospital.java](/sis9/Hospital.java) | Java | 49 | 0 | 19 | 68 | | [sis9/Main.java](/sis9/Main.java) | Java | 32 | 0 | 6 | 38 | | [sis9/MoveTarget.java](/sis9/MoveTarget.java) | Java | 28 | 0 | 9 | 37 | | [sis9/MyPanel.java](/sis9/MyPanel.java) | Java | 78 | 2 | 15 | 95 | | [sis9/Person.java](/sis9/Person.java) | Java | 145 | 0 | 36 | 181 | | [sis9/PersonPool.java](/sis9/PersonPool.java) | Java | 38 | 0 | 9 | 47 | | [sis9/Point.java](/sis9/Point.java) | Java | 21 | 0 | 7 | 28 | | [test.java](/test.java) | Java | 56 | 7 | 15 | 78 | [Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md)
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/meta-environments/env-protohaven_policy.typ
typst
// Core colors and fonts for the design identity #let accent_color = rgb("#6EC7E2") #let warning_color = rgb("#900000") #let light_grey = rgb(65%,65%,65%) #let mid_grey = rgb(50%,50%,50%) #let dark_grey = rgb(38%,38%,38%) #let sans_font = ("Noto Sans") #let serif_font = ("Noto Serif") #let mono_font = ("Fira Mono") /* * Renders `content` with the module's text styling. This is useful for content * that is outside of the `template` container but which should be visually consistent. */ #let apply-text-styles(content) = { set text( font: sans_font ) set par( leading: 0.8em, ) show heading.where(level: 1): it => [ // #pagebreak(weak: true) #set text(size: 20pt, font: sans_font, number-type: "lining", weight: "bold",) #block(it.body) ] show heading.where(level: 2): it => text( size: 17pt, font: sans_font, number-type: "lining", weight: "semibold", { v(0.6em) it.body } ) show heading.where(level: 3): it => text( size: 14pt, font: sans_font, number-type: "lining", weight: "semibold", it.body ) show heading.where(level: 4): it => text( size: 12pt, font: sans_font, number-type: "lining", weight: "semibold", it.body ) show link: l => text( font: mono_font, size:10pt, box(width:6.7in)[#l.body] ) show figure: it => align(center)[ #set text(size: 9pt, font: sans_font) #it.body /*#it.supplement*/ #it.caption ] content } #let policy_document( title: "Policy Document", authors: ("Someone","<NAME>"), date: datetime.today(), draft: false, wrapper: apply-text-styles, doc, ) = { set page( background: if draft {rotate(-44deg, {text(160pt, fill: rgb("EEEEEE"), [*DRAFT*]) linebreak() text(60pt, fill: rgb("EEEEEE"), date.display())} )}) set document(title: title, author: authors, keywords: ("protohaven", "policy"), date: date, ) show outline.entry.where( level: 1 ): it => { v(12pt, weak: true) strong(it) } // Title page set text( font: sans_font, ) align(center, image("../images/Protohaven-Logo-Horizontal-Color-959069212.png")) v(1in) stack(dir: ttb, // text(weight: "bold", size: 18pt, mid_grey, smallcaps("Policy Document")), // v(1.2em), text(weight: "bold", size: 36pt, [#title]), v(3em), text(weight: "bold", size: 14pt, [Adoption Date: #date.display("[month repr:long] [day padding:none], [year]")]), v(15em), outline(depth: 2) ) v(1fr) rect(width: 100%, inset: 2em, align(center, "License Information")) pagebreak() // The rest of the content set page( margin: (top: 1in, left: 1in, bottom: 1in, right: 1in), numbering: "1", footer: [ #set text(9pt, style: "italic") #h(1fr) Protohaven Policy Document — #title — #counter(page).display( "1 of 1", both: true, ) ], ) counter(page).update(1) wrapper(doc) }
https://github.com/Shedward/dnd-charbook
https://raw.githubusercontent.com/Shedward/dnd-charbook/main/dnd/game/game.typ
typst
#import "spells.typ": * #import "character.typ": * #import "abilities.typ": * #import "proficiencies.typ": * #import "biography.typ": *
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/raw-03.typ
typst
Other
// Lots of backticks inside. ```` ```backticks``` ````
https://github.com/Coekjan/parallel-programming-learning
https://raw.githubusercontent.com/Coekjan/parallel-programming-learning/master/ex-3/report.typ
typst
#import "../template.typ": * #import "@preview/cetz:0.2.2" as cetz #import "@preview/codelst:2.0.1" as codelst #show: project.with( title: "并行皋序讟计第 3 次䜜䞚MPI 猖皋", authors: ( (name: "叶焯仁", email: "<EMAIL>", affiliation: "ACT, SCSE"), ), ) #let data = toml("data.toml") #let lineref = codelst.lineref.with(supplement: "代码行") #let sourcecode = codelst.sourcecode.with( label-regex: regex("//!\s*(line:[\w-]+)$"), highlight-labels: true, highlight-color: lime.lighten(50%), ) #let batch-of(s) = { let nodes = s.split("x").at(0) let proc-per-node = s.split("x").at(1) (int(nodes), int(proc-per-node)) } #let data-time(raw-data) = raw-data.pairs().map(data => { let (batch, time) = data let (nodes, proc-per-node) = batch-of(batch) ((nodes, proc-per-node), time.sum() / time.len()) }) #let data-speedup(raw-data) = data-time(raw-data).map(data => { let pivot = data-time(raw-data).at(0).at(1) let (batch, time) = data (batch, pivot / time) }) #let data-table(raw-data) = table( columns: (auto, 1fr, 1fr, 0.7fr, 0.7fr, 0.7fr), align: horizon + center, table.header(table.cell(rowspan: 2)[*进皋数量*], table.cell(colspan: 2)[*分垃情况*], table.cell(rowspan: 2, colspan: 3)[*运行时闎单䜍秒*], [*结点数*], [*进皋数/结点数*]), ..raw-data.pairs().enumerate().map(pair => { let (index, pair) = pair let (batch, data) = pair let nodes = batch.split("x").at(0) let proc-per-node = batch.split("x").at(1) let num-proc = int(nodes) * int(proc-per-node) if index == raw-data.keys().enumerate().find(pair => { let (i, batch) = pair let (nodes, proc-per-node) = batch-of(batch) nodes * proc-per-node == num-proc }).at(0) { ( table.cell(rowspan: raw-data.keys().filter(batch => { let (nodes, proc-per-node) = batch-of(batch) nodes * proc-per-node == num-proc }).len(), str(num-proc)), nodes, proc-per-node, data.map(str) ) } else { (nodes, proc-per-node, data.map(str)) } }).flatten() ) #let data-chart(raw-data, width, height, time-max, speedup-max) = cetz.canvas({ let color(index) = { let data = data-time(raw-data).at(index) let (batch, _) = data let (nodes, proc-per-node) = batch let procs = calc.log(nodes * proc-per-node, base: 2) ( fill: (red, orange, yellow, blue, green, purple, lime).at(int(procs)), ) } cetz.chart.columnchart( size: (width, height), data-time(raw-data).map(pair => { let (batch, time) = pair let (nodes, proc-per-node) = batch (rotate(-30deg)[ #set text(size: 0.8em) #nodes#sym.times#proc-per-node ], time) }), y-max: time-max, x-label: [_结点数量 #sym.times 每结点的进皋数量_], y-label: [_平均运行时闎单䜍秒_], bar-style: color, ) cetz.plot.plot( size: (width, height), axis-style: "scientific-auto", plot-style: (fill: black), x-tick-step: none, x-min: 0, x-max: data-time(raw-data).len() + 1, y2-min: 1, y2-max: speedup-max, x-label: none, y2-label: [_加速比_], y2-unit: sym.times, cetz.plot.add( axes: ("x", "y2"), data-speedup(raw-data).enumerate().map(pair => { let (i, pair) = pair let (_, speedup) = pair (i + 1, speedup) }), ), ) }) = 实验矩阵乘法 == 实验内容䞎方法 䜿甚 MPI 猖皋实现矩阵乘法的并行加速并圚䞍同进皋数量、䞍同结点数量䞋进行实验记圕运行时闎并进行分析。 - 矩阵倧小8192 #sym.times 8192 - 矩阵分块算法给定矩阵 $A$ 侎 $B$计算其乘积 $A B = C$通过将 $A$ 按行分块来计算劂 @equation:block-matrix 所瀺。 $ A B = mat(A_1; A_2; dots.v; A_n) B = mat(A_1 B; A_2 B; dots.v; A_n B) = C $ <equation:block-matrix> - 进皋数量1 \~ 64 - 结点数量1 \~ 64 皋序构造过皋䞭有劂䞋芁点 + 计算 $A B$ 时将 $A$ 按行分块而䞍是将 $B$ 按列分块䜿埗 MPI 分发数据地址连续时曎加方䟿。 + 劂 @code:script-code 所瀺利甚脚本 ```bash matmul.slurm.run``` 指定结点数量䞎每䞪结点的进皋数量劚态生成 Slurm 䜜䞚脚本运行时指定圢劂 `SLURM_BATCH=AxB` 的环境变量可指定 MPI 皋序运行于 `A` 䞪结点、每䞪结点 `B` 䞪进皋䞊。䟋劂 ```sh SLURM_BATCH=4x4 ./matmul.slurm.run ``` 指定 MPI 皋序运行于 4 䞪结点、每䞪结点 4 䞪进皋共 16 䞪进皋䞊。 + 䞺记圕排序时闎䜿甚 POSIX 的 ```c gettimeofday()``` 凜数 + 䞺简芁地记圕矩阵乘法结果双粟床浮点阵列䜿甚 OpenSSL 的 SHA1 算法计算其指纹。 代码劂 @code:matmul-code 所瀺其䞭 - #lineref(<line:mpi-init>)、#lineref(<line:mpi-rank>)、#lineref(<line:mpi-size>) 䜿甚 MPI 进行了初始化、获取进皋猖号、获取进皋数量等操䜜 - #lineref(<line:mpi-bcast>) 将 $B$ 矩阵广播到所有进皋 - #lineref(<line:mpi-scatter-1>)、#lineref(<line:mpi-scatter-2>)、#lineref(<line:mpi-scatter-3>) 将 $A$ 矩阵分块分发到所有进皋 - #lineref(<line:mpi-gather-1>)、#lineref(<line:mpi-gather-2>)、#lineref(<line:mpi-gather-3>) 将 $C$ 矩阵收集到进皋 0 - #lineref(<line:mpi-finalize>) 结束 MPI。 #figure( sourcecode( raw(read("matmul/matmul.c"), lang: "c"), ), caption: "并行矩阵乘法 MPI 实现代码", ) <code:matmul-code> == 实验过皋 圚劂 @chapter:platform-info 所述的实验平台䞊进行实验分别䜿甚 1 \~ 64 䞪进皋分垃圚 1 \~ 64 䞪结点䞊进行矩阵乘法记圕运行时闎测定 3 次取平均倌原始数据劂 @table:matmul-raw-data 所瀺。 == 实验结果䞎分析 #let matmul-speedup-max = data-speedup(data.matmul).sorted(key: speedup => speedup.at(1)).last() 矩阵乘法实验测定的运行时闎劂 @figure:matmul-chart 䞭的条柱所瀺盞同颜色衚瀺盞同的总进皋数并行加速比劂 @figure:matmul-chart 䞭的折线所瀺其䞭最倧加速比圚结点数䞺 #matmul-speedup-max.at(0).at(0)、每结点的进皋数䞺 #matmul-speedup-max.at(0).at(1) 时总进皋数䞺 #{matmul-speedup-max.at(0).at(0) * matmul-speedup-max.at(0).at(1)}蟟到最倧加速比䞺 #matmul-speedup-max.at(1)。 #figure( data-chart(data.matmul, 12, 8, 600, 60), caption: "矩阵乘法运行时闎", ) <figure:matmul-chart> 可见随着进皋数量增加运行时闎逐析减少。具䜓来诎 + 随着总进皋数量运行时闎逐析减少加速比呈现亚线性规埋。加速比未呈现完党线性可胜是因䞺并行本身存圚通信匀销。 + 总进皋数盞同时进皋圚集矀䞭的分垃情况结点数量对运行时闎有䞀定圱响䟋劂 - 圓总进皋数䞺 16 时将 16 䞪进皋分散圚 16 䞪结点䞊的运行时闎蟃长圓总进皋数䞺 64 时将 64 䞪进皋分散圚 32 䞪结点每结点 2 䞪进皋䞊的运行时闎蟃长。这可胜是因䞺进皋圚䞍同结点闎通信时眑络延迟蟃倧。 - 圓总进皋数䞺 64 时将 64 䞪进皋分散圚 64 䞪结点䞊的运行时闎蟃短。这可胜是因䞺集矀䞭某种拓扑结构䜿埗所分配的 64 䞪结点互联通信效率蟃高。 矩阵乘法实验䞭的原始数据劂 @table:matmul-raw-data 所瀺。 #figure( data-table(data.matmul), caption: "矩阵乘法实验原始数据", ) <table:matmul-raw-data> = 附泚 == 猖译䞎运行 代码䟝赖 MPI、OpenSSL 库若未安装这些库需手劚安装。圚准倇奜䟝赖后可䜿甚以䞋呜什进行猖译䞎运行 - 猖译```sh make``` - 运行```sh make run ``` - 可通过环境变量 ```SLURM_BATCH``` 指定结点数量䞎每䞪结点的进皋数量䟋劂 ```sh SLURM_BATCH=4x4 make run``` 指定 MPI 皋序运行于 4 䞪结点、每䞪结点 4 䞪进皋共 16 䞪进皋䞊。 - 运行结束后若提瀺错误检测到指纹错误则诎明运行结果䞍正确该检测机制的倧臎逻蟑由 @code:makefile-fingerprint 侭的 Makefile 代码给出 #figure( sourcecode( ```make # The fingerprint of the result FINGERPRINT := 00 11 22 33 44 55 66 77 88 99 99 88 77 66 55 44 33 22 11 00 # Run the program `app` and check the fingerprint .PHONY: run run: exec 3>&1; stdbuf -o0 ./app | tee >(cat - >&3) | grep -q $(FINGERPRINT) ``` ), caption: "Makefile 䞭的指纹检测代码" ) <code:makefile-fingerprint> - 枅理```sh make clean```。 - 将猖译产物、Slurm 脚本产生的蟓出文件党郚枅陀。 å…¶äž­ ```sh make run``` 实际调甚了 ```sh matmul.slurm.run``` 脚本劂 @code:script-code 所瀺。 #figure( sourcecode( raw(read("matmul/matmul.slurm.run"), lang: "bash"), ), caption: "矩阵乘法运行脚本", ) <code:script-code> == 实验平台信息 <chapter:platform-info> 本实验所倄平台䞺北航校级计算平台系统配眮 260 䞪 CPU 计算节点每䞪节点配眮 2 颗 Intel Golden 6240 系列倄理噚共 36 物理栞、384 GB 内存。所有节点通过 100Gb/s EDR Infiniband 互联组成计算和存傚眑络。系统䜿甚 Slurm 䜜䞺䜜䞚调床系统。
https://github.com/ivaquero/typst-fasvg
https://raw.githubusercontent.com/ivaquero/typst-fasvg/main/README.md
markdown
MIT License
# Typst-FASVG ![code size](https://img.shields.io/github/languages/code-size/ivaquero/typst-fasvg.svg) ![repo size](https://img.shields.io/github/repo-size/ivaquero/typst-fasvg.svg) Offline [FontAwesome](https://fontawesome.com/) Binding for [Typst](https://typst.app/docs/). ## Usage 1. Download the fasvg latest desktop version from [FontAwesome Official Site](https://github.com/FortAwesome/Font-Awesome/releases), unzip it into your workspace folder, and rename it as `fasvg`. 2. Download the `fasvg.typ` file, and place it into your workspace folder as well. 3. Import it into your Typst file, and use it with `fa()` function like the following example ```typst #import "fasvg": * #fa("brand-amazon-pay") ``` You can also customize the icon like this ```typst #import "fasvg": * #fa( "brand-amazon-pay", baseline: 0.25em, height: 1.0em, width: 1.5em) ``` Checkup [manual](https://github.com/ivaquero/typst-fasvg/blob/main/manual.pdf) for more details. ![demo](demo.png) ## Changelog ### v0.1.0 (2023-08-28) - update fasvg to v6.5.1 ### v0.0.4 (2023-08-28) - change naming pattern ### v0.0.3 (2023-08-16) - update fasvg to v6.4.2 - change naming pattern ### v0.0.2 (2023-07-28) - update structures - enable customization ### v0.0.1 (2023-07-27) - initial release - add fasvg v6.4.0
https://github.com/Enter-tainer/typstyle
https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/typstfmt/82-non-converge-list.typ
typst
Apache License 2.0
#let f(t) = t We have next things: - thing 1; - thing 2; - thing 3. #f[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore dolemus, fieri.]
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/block-01.typ
typst
Other
// Nothing evaluates to none. #test({}, none) // Let evaluates to none. #test({ let v = 0 }, none) // Evaluates to single expression. #test({ "hello" }, "hello") // Evaluates to string. #test({ let x = "m"; x + "y" }, "my") // Evaluated to int. #test({ let x = 1 let y = 2 x + y }, 3) // String is joined with trailing none, evaluates to string. #test({ type("") none }, "string")
https://github.com/pku-typst/meppp
https://raw.githubusercontent.com/pku-typst/meppp/main/lib.typ
typst
MIT License
#import ("table.typ"): meppp-tl-table #import ("template.typ"): meppp-lab-report #let pku-logo(..args) = image("pkulogo.png", ..args) #let subfigure( body, caption: none, numbering: "(a)", inside: true, dx: 10pt, dy: 10pt, boxargs: (fill: white, inset: 5pt), alignment: top + left, ) = { let lsa = counter("last-subfigure-at") let sc = counter("subfigure-counter") context if lsa.get() != counter(figure).get() { sc.update((1,)) lsa.update(counter(figure).get()) } else { sc.step() } let number = context sc.display(numbering) body if (inside) { place(alignment, box([#number #caption], ..boxargs), dx: dx, dy: dy) } else { linebreak() align(center, [#number #caption]) } }
https://github.com/dssgabriel/master-thesis
https://raw.githubusercontent.com/dssgabriel/master-thesis/main/src/chapters/5-bibliography.typ
typst
Apache License 2.0
#show bibliography: set heading(numbering: "1.") #bibliography("../references.bib", style: "ieee")
https://github.com/MatheSchool/typst-g-exam
https://raw.githubusercontent.com/MatheSchool/typst-g-exam/develop/src/g-exam.typ
typst
MIT License
#import "@preview/oxifmt:0.2.0": strfmt #import "./global.typ" : * #import "./auxiliary.typ": * #import "./g-question.typ": * #import "./g-option.typ": * #import "./g-solution.typ": * #import "./g-clarification.typ": * #import "./g-sugar.typ": * /// Template for creating an exam. /// /// - author: Infomation of author of exam. /// - name (string, content): Name of author of exam. /// - email (string): E-mail of author of exam. /// - watermark (string): Watermark with information about the author of the document. /// - school: Information of school. /// - name (string, content): Name of the school or institution generating the exam. /// - logo (none, content, bytes): Logo of the school or institution generating the exam. /// - exam-info: Information of exam. /// - academic-period (none, content, str): Academic period. /// - academic-level (none, content, str): Academic level. /// - academic-subject (none, content, str): Academic subname. /// - number (none, content, str): Number of exam. /// - content (none, content, str): Content of exam. /// - model (none, content, str): Model of exam. /// - date (none, auto, datetime): Date of generate document. /// - keywords (string): Keywords of document. /// - language (en, es, de, fr, pt, it, nl): Language of document. English, Spanish, German, French, Portuguese and Italian are defined. /// - clarifications (string, content, array): Clarifications of exam. It will appear in a box on the first page. /// - question-text-parameters: Parameter of text in question and subquestion. For example, it allows us to change the text size of the questions. /// - show-student-data (none, true, false, "first-page", "all-pages", "odd-pages"): Show a box for the student to enter their details. It can appear on the first page, all pages or on all odd-numbered pages. /// - show-grade-table: (bool): Show the grade table. /// - decimal-separator: (".", ","): Indicate the decimal separation character. /// - question-points-position: (none, left, right): Position of question points. /// - show-solution: (true, false, "space", "spacex2", "spacex3"): Show the solutions. /// - show-draft: (true, false): It shows a draft label in the background. #let g-exam( author: ( name: "", email: none, watermark: none ), school: ( name: none, logo: none, ), exam-info: ( academic-period: none, academic-level: none, academic-subject: none, number: none, content: none, model: none ), language: "en", localization: ( grade-table-queston: none, grade-table-total: none, grade-table-points: none, grade-table-grade: none, point: none, points: none, page: none, page-counter-display: none, family-name: none, given-name: none, group: none, date: none, draft-label: none, ), date: auto, keywords: none, clarifications: none, question-text-parameters: none, show-student-data: "first-page", // show-student-data: ( // given-name: true, // family-name: true, // group: true, // date: true // ), show-grade-table: true, decimal-separator: ".", question-points-position: left, show-solution: true, show-draft: false, body, ) = { if type(show-student-data) != "dictionary" and type(show-student-data) != "array" { assert(show-student-data in (none, true, false, "first-page", "all-pages", "odd-pages"), message: "Invalid show studen data") } assert(question-points-position in (none, left, right), message: "Invalid question point position") assert(decimal-separator in (".", ","), message: "Invalid decimal separator") assert(show-solution in (true, false), message: "Invalid show solution value") assert(show-draft in (true, false), message: "Invalid show draft value") assert(date == none or date == auto or type(date) == "datetime", message: "Date must be nono, auto or datetime." ) set document( title: __document-name(exam-info: exam-info).trim(" "), author: author.name, date: date ) let margin-right = 2.5cm if (question-points-position == right) { margin-right = 3cm } set page( margin: (top: 5cm, right:margin-right), numbering: "1 / 1", number-align: right, header-ascent: 20%, header: { context{ let __page-number = counter(page).at(here()).first() __show-header( page-number: __page-number, school: school, exam-info: exam-info, show-student-data: show-student-data) } }, background: { __show-draft(draft-show: show-draft, draft-label:[draft]) }, footer: { context { line(length: 100%, stroke: 1pt + gray) align(right)[ #counter(page).display(__g-localization.final().page-counter-display, both: true, ) ] // grid( // columns: (1fr, 1fr, 1fr), // if type(school) == "dictionary" { // align(left, school.at("name", default : none)) // }, // align(center)[#exam-info.academic-period], // align(right)[ // Página // #counter(page).display({ // "1 de 1"}, // both: true, // ) // ] // ) __show-watermark(author: author, school: school, exam-info: exam-info, question-points-position:question-points-position) } } ) __read-localization(language: language, localization: localization) __g-question-points-position-state.update(u => question-points-position) __g-question-text-parameters-state.update(question-text-parameters) set text(lang:language) if show-grade-table == true { context { __g-grade-table-header( decimal-separator: decimal-separator, ) } v(10pt) } __g-show-solution.update(show-solution) __g-decimal-separator.update(decimal-separator) set par(justify: true) if clarifications != none { __g-show_clarifications(clarifications: clarifications) } show: __sugar body [#hide[]<end-g-question-localization>] [#hide[]<end-g-exam>] }
https://github.com/DaAlbrecht/thesis-TEKO
https://raw.githubusercontent.com/DaAlbrecht/thesis-TEKO/main/content/Task_analysis.typ
typst
#import "@preview/tablex:0.0.5": tablex, cellx #let appendix = figure.with(kind: "appendix", numbering: "A", supplement: [Appendix]) Here, we'll cover the initial context resulting from the assignment available @a_assignment == Task description Multiple customers of Integon rely upon RabbitMQ as their designated messaging broker. Different systems write messages into a queue, the messages then need to be processed by other systems. If for some reason a specific message should be processed again, the owner of the processing system cannot retry processing the message because the messages are not persistent, once consumed the message is gone. Said owner has to contact the owner of the sending system and ask for a retransmission of the message. This is a time-consuming and costly process. The goal of this thesis is to develop a microservice that allows queueing messages again, without needing to contact the owner of the sending system. The queuing should be possible via an API call. === Out of scope<Out_of_scope> The goal is to also embed the microservice into already existing observability systems to enable requeuing of messages via UI. This is beyond the scope of this thesis and will be implemented in a follow-up project. == Initial situation The microservice needs to be developed from scratch. There is no existing architecture or codebase to build upon.
https://github.com/Besthope-Official/backend
https://raw.githubusercontent.com/Besthope-Official/backend/master/24autumn/git-tutorial.typ
typst
#import "@preview/cuti:0.2.1": show-cn-fakebold #import "@preview/cetz:0.2.2" #show: show-cn-fakebold #let title = [版本控制系统 Git] #let header = [后端郚匀发文档] #set text(font: ("Source Han Serif SC")) #set page( header: [#set text(12pt); #align(right + horizon, header)], background: image("images/backend_logo_opacity_0.25.png", fit: "cover", width: 30%), numbering: "1", number-align: right, ) #show link: underline // CONTENTS #align(center, text(20pt)[ *#title* ]) == 版本控制系统 *版本控制系统* (Version Control Systems, VCSs) 是䞀类甚于远螪源代码或其他文件、文件倹改劚的工具。顟名思义这些工具可以垮助我们管理代码的修改历史䞍仅劂歀它还可以方䟿团队协䜜猖码。 䟋劂圚实际项目匀发䞭的䞀些场景 - 需芁查看圓前版本和䞊䞀版本之闎的*差匂* - 曎细节的这䞪文件的这䞀行是什么时候被猖蟑的是谁䜜出的修改修改原因是什么 - 圓前版本䞊线出现䞥重 bug需芁*回退*到䞊䞀版本 - 还需芁知道圚哪䞀䞪版本快照富臎了单元测试倱莥 版本控制是项目管理的䞀倧关键。实践䞭我们䌚䜿甚最垞甚的版本控制工具 *Git* 来管理代码它是䞀䞪*分垃匏版本控制系统*客户端并䞍只提取最新版本的文件快照而是把代码仓库完敎地*克隆*䞋来包括完敎的历史记圕。 #figure(image("images/dvcs.png", width: 50%), caption: "分垃匏VCS的䞀䞪䌘势是就算䞭心服务噚发生故障事后郜可以甚任䜕䞀䞪镜像出来的本地仓库恢倍数据库历史。") 䜠可以指定和䞍同的远端仓库亀互圚同䞀䞪项目䞭分别和䞍同的人盞互协䜜。Git 的*分支*功胜非垞区倧它支持非线性的匀发流皋并䞔胜借有效地管理像 Linux 内栞这样庞倧的项目。 #figure(image("images/git-branch.svg", width: 50%)) 总而蚀之假若䜠将来的工䜜和计算机沟蟹Git 绝对是䜠犻䞍匀的匀发工具。 == Git 的实现 Git 的后端实现盞圓䌘雅虜然圚理解䞊确实存圚䞀定的倍杂床。我们䌚简单讲解它的原理以䟿倧家胜借真正了解 Git 的盞关抂念。劂果䜠对这郚分䞍感兎趣可以蜬至䞋䞀小节。 === 怎样记圕版本差匂: 记圕快照 #let graph(data, direction: "right", grow, node-color: gray, show-mark: true) = { cetz.canvas(length: 1cm, { import cetz.draw: * set-style(content: (padding: .2), fill: node-color.lighten(70%), stroke: node-color.lighten(70%) ) cetz.tree.tree( data, direction: direction, spread: 2.5, grow: grow, draw-node: (node, ..) => { circle((), radius: .55, stroke: none) content((), node.content) }, draw-edge: (from, to, ..) => { let (a, b) = (from + ".center", to + ".center") if show-mark { line((a, .6, b), (b, .6, a), mark: (end: ">")) } else { line((a, .6, b), (b, .6, a)) } }, name: "tree" ) }) } #let versions = ([ver 1], ([ver 2], ([ver 3], [ver 4]))) #let A-delta = ([A],([$Delta_1$],([$Delta_2$],([$Delta_3$],)))) #let B-delta = ([B], ([$Delta_1$],)) #let A-git = ([A], ([$A_1$], ([$A_2$], [$A_3$]))) #let B-git = ([B], ([B], ([B], [$B_1$]))) #figure( grid(align: center, column-gutter: auto, [#graph(versions, 2.5, node-color: red, show-mark: false) #graph(A-delta, 2.5) #graph(B-delta, 7.5)] ), caption: [基于*差匂* (delta-based) 的版本控制]) Git 䞍存傚每䞪文件䞎初始版本的差匂假讟䜠的改劚是添加了䞀行文本它并䞍䌚记圕这行新增的文本——它只存傚文件的*快照*每圓䜠提亀曎新或保存项目状态时它基本䞊就䌚对圓时的*党郚文件*创建䞀䞪快照副本并保存这䞪快照的*玢匕*。 #figure( grid(align: center, column-gutter: auto, [#graph(versions, 2.5, node-color: red) #graph(A-git, 2.5) #graph(B-git, 2.5)] ), caption: "存傚随时闎改变的快照") #let snapshot = ( ([ver 1], [A], [B], ([ver 2], ([$A_1$]), [ver 3]) ) ) #let demo = cetz.canvas(length: 1cm, { import cetz.draw: * let node-color = gray set-style(content: (padding: .2), fill: node-color.lighten(70%), stroke: node-color.lighten(70%) ) cetz.tree.tree( snapshot, direction: "down", spread: 2.5, grow: 2.0, draw-node: (node, ..) => { circle((), radius: .55, stroke: none) content((), node.content) }, draw-edge: (from, to, ..) => { let (a, b) = (from + ".center", to + ".center") line((a, .6, b), (b, .6, a), mark: (end: ">")) }, name: "tree" ) let (a, b) = ("tree.0-2", "tree.0-1") line(stroke: (paint: node-color.lighten(70%), dash: "dashed"), (a, .6, b), (b, .6, a), mark: (end: ">")) }) 给每䞪版本做快照星然埈耗空闎对歀Git 的䌘化是劂果文件没有修改就䞍再重新存傚该文件而是只保留䞀䞪*指针铟接*指向之前存傚的文件。 #figure(demo, caption: "由快照构成的历史记圕虜然版本 2 指向 B囟䞭出现了环的圢状䜆B没有其它出蟹䞍䌚出现埪环也因歀䞍构成环") 从数据结构的角床来看这种讟计历史记圕就成了䞀䞪由快照组成的有向无环囟。䞀次快照就是䞀棵*树*包含了党郚的文件每䞀次快照曎新的*提亀*(commit)包含了䞊面的树附垊了提亀信息、䜜者、时闎戳等元数据。 === 怎样存傚文件: 䞀切郜是对象 操䜜系统䞺我们抜象出*文件*的抂念我们通过文件路埄来定䜍文件元数据所圚的磁盘䜍眮再根据文件的元信息定䜍文件圚硬盘䞊的具䜓䜍眮最终访问到文件的内容。 而 Git 有着独属于它的文件*内容寻址*系统。它并䞍基于文件路埄寻址路埄䞍再䜜䞺获取文件内容的键而文件*内容本身就是这䞪键*。 Git 将项目所有受控文件内容、文件的状态通过SHA1算法进行*哈垌化*、压猩后䜜䞺 Blob 对象存傚圚 `.git\objects` 内。Git 数据库䞭保存的信息郜是以文件内容的哈垌倌来玢匕所有的数据圚存傚前郜计算校验和然后以校验和来匕甚。 我们甚䞀䞪小䟋子来䜓现哈垌化的过皋 ```py >>> import hashlib >>> data = 'hello git' >>> content = f'blob {len(data)}\x00{data}' 'blob 9\x00hello git' >>> hashlib.sha1(content.encode()).hexdigest() 'f09e9c379f5fe8f4ce718641c356df87906d87a6' $ echo -n "hello git" | git hash-object --stdin f09e9c379f5fe8f4ce718641c356df87906d87a6 ``` 对文件名、目圕等信息的保留䟝赖于先前提到的*树*。假劂䜠的最新提亀䞭曎改了䞀䞪文件的文件名而没有改变它的内容Git 䞍䌚添加新的 Blob 对象而只䌚曎改树对象䞭指向这䞪 Blob 对象的名称。 树、提亀以及标记这些元数据也是 Git 对象同样䌚经过哈垌化同文件䞀起存入 `objects` 目圕䞋。正因䞺它们共同继承“对象”的统䞀接口关联这些抂念只需芁提䟛哈垌玢匕。 #figure(image("images/data-model-3.png", width: 85%), caption: [Git 对象暡型瀺䟋第䞉次提亀的快照添加了 `bak/test.txt`内容和文件名和初次提亀䞀样。Git 䞍䌚添加新的 Blob 对象只需什其匕甚第䞀次提亀的树对象即可。]) 简掁而又高效的讟计。 === 怎样讟眮分支: 匕甚 现圚所有的快照郜可以通过它们的 SHA-1 哈垌倌来匕甚䞍过我们并䞍需芁记䜏这䞀䞲䞲 40 䜍的十六进制字笊。Git 支持短哈垌也支持对哈垌倌做*别名*(alias)*标记*(tag)快照号 ```bash $ git tag -a v0.1.0 4892c7dc -m 'version 0.1.0 released' ``` 之后我们就可以甚 `v0.1.0` 曎䟿于人类记忆的猖号来匕甚这䞪快照号了。 Git 内郚绎技*匕甚*(reference)䜿埗某䞀项别名可以指向最新的提亀圓前所圚䜍眮䌚甚䞀䞪特殊的 `HEAD` 玢匕标记。 #figure(image("images/head-to-master.png", width: 65%), caption: [䟋劂`master` 匕甚通垞䌚指向䞻分支的最新䞀次提亀歀时 `HEAD` 匕甚指向 `master`。]) 创建*分支*其实就是新建䞀䞪匕甚分支切换只需芁改变 `HEAD` 文件内分支的指向而分支合并merge则是创建䞀䞪新的提亀对象其父节点指向䞀䞪分支的最新提亀然后合并二者的文件。 #figure(image("images/basic-merging-2.png"), caption: "分支匀发的䞀䞪场景。䞺了解决出现的 bug䜠圚䞻分支之䞊新建了䞀条 iss53 分支圚修正了问题#53后䜠圚䞻分支将其合并。") === 总结 TL;DR: Git 以*快照*的圢匏记圕版本差匂将芁存傚于仓库的数据抜象䞺*对象*具䜓来诎Blob 保存了文件内容*树*保存了目圕结构和文件名*提亀*保存了䞀次快照的提亀信息、䜜者、时闎戳等元数据。对象根据其内容的*哈垌倌*进行玢匕、关联。同时Git 内郚绎技*匕甚*允讞甚䞀䞪曎甚户友奜的别名来指向最新的提亀记圕䜿埗我们可以进行区倧的*分支*操䜜。圚这种简掁的讟计之䞋Git 的操䜜就是对䞀些“对象”和“匕甚”的*囟操䜜*。 == 䜿甚 Git === 安装䞎配眮 圓前 Git 的最新皳定版本䞺 2.47.0。甚 `git --version` 查看䜠的系统䞊是吊安装了 Git。 - 对于Windows 甚户#link("https://gitforwindows.org/")[䞋蜜地址]。劂果无法䞋蜜尝试科孊䞊眑或#link("https://mirrors.tuna.tsinghua.edu.cn/github-release/git-for-windows/git/")[枅华镜像]、#link("https://registry.npmmirror.com/binary.html?path=git-for-windows/")[阿里镜像] - 对于 MacOS 甚户Git 通垞是系统自垊的工具劂果没有可以尝试䞋面这䞪囟圢化的 Git #link("http://sourceforge.net/projects/git-osx-installer/")[安装工具]或者尝试 `homebrew` 安装孊习䞋装䞀䞪包管理工具。 - 对于 Linux 甚户根据䜠系统的发行版安装包管理噚安装 Git。 - 䟋劂 Ubuntu/Debian`sudo apt-get install git` 我们对 Windows 安装包额倖做䞀些诎明通垞来诎按照默讀讟眮安装 Git 即可䜆需芁皍埮泚意䞀些䞪性化的讟眮劂换行笊、猖蟑噚。我们建议䜠参考这篇#link("https://blog.csdn.net/mukes/article/details/115693833")[文章]来蟅助䜠决策。 安装了 Git 之后圚 shell 里䜿甚劂䞋呜什配眮䜠的甚户名和邮箱。参考这篇#link("https://git-scm.com/book/zh/v2/%e8%b5%b7%e6%ad%a5-%e5%88%9d%e6%ac%a1%e8%bf%90%e8%a1%8c-Git-%e5%89%8d%e7%9a%84%e9%85%8d%e7%bd%ae")[文章]: ```bash git config --global user.name <name> git config --global user.email <email-address> ``` === Git 接口 圚孊习 Git 接口之前我们先来了解䞀䞋 Git 文件的状态 - *未跟螪*(Untracked)Git 尚未跟螪的文件即还没有纳入版本管理的文件。 - *已修改*(Modified)修改了文件䜆还没保存到数据库䞭。 - *已暂存*(Staged/Added)对䞀䞪已修改文件的圓前版本做了标记䜿之包含圚䞋次提亀的快照䞭。 - *已提亀*(Committed)数据已经安党地保存圚本地数据库䞭。 这䌚让我们的 Git 项目拥有䞉䞪阶段工䜜区、暂存区以及 Git 目圕。 #figure(image("images/areas.png", width: 75%), caption: [圚䞀次提亀䞭选䞭提亀的文件䌚从工䜜区记圕到暂存区、最后经哈垌对象化存攟到 `.git` 目圕䞋]) 创建䞀次 `commit` 的流皋劂䞋 - 圚工䜜区䞭修改文件。 - 将䜠想芁䞋次提亀的曎改选择性地暂存这样只䌚将曎改的郚分添加到暂存区。(`git add`) - 提亀曎新扟到暂存区的文件将快照氞久性存傚到 Git 目圕。(`git commit`) 䞺什么芁匕入暂存区这䞪看䌌倚䜙的步骀想象䞀䞋圓䜠匀发了䞀䞪独立的特性垌望创建䞀䞪独立的提亀这时候就可以有选择地进行提亀。 及倖䞀些垞甚的呜什行操䜜 - `git clone <repository>`: 克隆远皋仓库到本地。有些老垈也喜欢甚 Git 远皋仓库来发垃代码䜜䞚。 - `git status`: 查看圓前仓库的状态。 - `git push`: 将本地仓库的曎新掚送到远皋仓库前提是䜠已经关联奜了远皋仓库。圓䜠的 IDE 因出现眑络原因无法掚送时可以尝试圚呜什行䞭掚送。 - `git commit --amend`: 猖蟑历史提亀的 commit 信息。 - `git stash`: 暂时移陀工䜜目圕䞋的修改内容。这圚切换分支的时候埈有甚。 我们掚荐倧家阅读奇点先前猖写的#link("https://singularity-backend.gitbook.io/backend-online-doc/week1/vcs-git/interfaces")[圚线文档]来孊习曎倚的接口知识。 === IDE 里䜿甚囟圢界面 å­Šä¹  Git 操䜜的最奜是通过呜什行这也是孊习呜什行的奜机䌚。 䜆我们同时掚荐䜠去了解 IDE 里集成的 Git 䜿甚圚日垞工䜜䞭CLI 并䞍垞甚。陀了某些特定 GUI 䞍管甚的场景 #figure(image("images/ide.png", width: 65%), caption: [VSCode 里的源代码管理界面圚提䟛 Git 的囟圢化界面操䜜以倖也提䟛了对分支的良奜可视化]) #pagebreak() == Git 的工䜜流 由于 Git 的䜿甚非垞灵掻圚实践圓䞭衍生了埈倚种䞍同的工䜜流皋䞍同的项目、䞍同的团队䌚有䞍同的协䜜方匏。䞋面将介绍䞀种圚各种倧小项目䞭经过总结出来的工䜜流。 奇点的匀发团队参考的也是这䞀套流皋。 === 远皋 Git 仓库 我们提到Git 是䞀䞪分垃匏版本控制系统这意味着每䞪匀发者郜有䞀仜完敎的仓库称䞺*本地仓库*。实现同步的方匏是拥有䞀䞪可靠的䞭心*远皋仓库*䞀䞪 Git 服务噚。 䞀些垞甚的 Git 服务噚有 - GitHub䞀䞪基于Git的代码托管服务平台同时也是重芁的匀源瀟区。 - GitLab类䌌Github䜆䞻芁面向䌁䞚、组织等内郚䜿甚。也可以甚官方提䟛的镜像郚眲。 - Gitee具有䞭囜特色的代码托管平台 奇点的䞀䞪匀发郚闚目前䜿甚 Github 䜜䞺 #link("https://github.com/SingularityLab-SWUFE")[Git 远皋仓库]。 === 分垃匏匀发 ==== 源仓库 圚项目的匀始项目的发起者构建起䞀䞪项目的最原始的仓库称䞺*源仓库*。它的目的是 - 汇总参䞎该项目的各䞪匀发者的代码 - 存攟趋于皳定和可发垃的代码 ==== 匀发者仓库 源仓库建立以后每䞪匀发者需芁做的事情就是把源仓库的“倍制”圚其基础之䞊 `fork`(分叉)匀发䜜䞺自己日垞匀发的仓库。 每䞪匀发者所 `fork` 的仓库是完党独立的互䞍干扰。而圚匀发工䜜完成以后匀发者可以向源仓库发送 `Pull Request`(掚送请求)请求管理员把自己的代码合并到源仓库䞭。 #figure(image("images/pr.png", width: 75%), caption: [䞀䞪匀源项目 #link("https://github.com/Qexo/Qexo")[Qexo] 的 PR记埗圚 PR 里描述枅楚自己的莡献]) ==== 集成代码 圓然倚条 PR 可胜存圚代码冲突项目管理者銖先需芁对代码进行*代码审阅* (code review) 解决冲突以倖我们还需芁检验集成后代码的正确性。*自劚化构建工具*䌚根据流皋自劚猖译构建安装应甚并执行*单元测试框架*的自劚化测试来校验提亀的修改。 䞀䞪成熟的项目通垞包含完倇的*持续集成和持续亀付* (CI/CD)。它通过自劚化流皋和工具自劚垮助项目管理者构建应甚、测试应甚、郚眲应甚。 䟋劂Github Action 通过 YAML 文件的配眮定义工䜜流皋以构建执行 CI/CD 流氎线并可以觊发䞍同事件时劂 `push`、`Pull Request`自劚执行这些工䜜流皋。 圓䜠的 PR 通过了 CI/CD 的测试以及盞关的 code review项目管理者就可以采甚劂 squash-merge 的方匏将䜠的代码合并到䞻分支。 === 分支管理 称分支管理是 Git 的灵魂也䞍䞺过。䞊面我们提到了 Git 分垃匏匀发的基本流皋䞺了曎奜地利甚 CI/CD 工䜜流项目团队通垞对分支的呜名和权限的管理有着䞀定的规定䞋面就介绍䞀种比蟃普遍适甚的分支暡型圚这种暡型䞭分支有䞀类五种 ==== 氞久性分支 - `main`: 䞻分支它甚于存攟经过测试已经完党皳定的代码圚项目匀发以后的任䜕时刻圓䞭䞻分支存攟的代码应该是可䜜䞺产品䟛甚户䜿甚的代码。 - `develop`: 匀发分支它甚于匀发者存攟基本皳定代码。 #figure(image("images/main-dev.png", width: 50%), caption: [所有匀发者匀发奜的功胜䌚圚源仓库的 `develop` 分支䞭进行汇总经测试皳定后最后合并到 `main` 分支。这就是䞀䞪产品䞍断完善和发垃过皋。]) *提瀺*分支保技埈重芁䞍芁䞺了囟䞀时省事䞍建立匀发分支或随意合并至䞻分支 ==== 䞎时性分支 䞎时性分支类䌌于匀发分支的䞀䞪猓冲区。圚匀发完毕、合并后这些䞎时性分支䌚埗到删陀。通垞来诎各䞪匀发者䌚圚 `develop` 分支䞊继续分叉出特性分支 `feature-*`䟋劂 `feature-OAuth` 衚瀺实现 OAuth 登圕功胜的特性分支。 及倖䞀䞪䞎时分支圚曎倧规暡的团队匀发䞭䌚运甚到 - `release`: 预发垃分支圓产品即将发垃的时候芁进行最后的调敎和测试就可以匀出预发垃分支 - `hotfix`: 修倍 bug 分支圚产品䞊线之后发垃热补䞁进行玧急的 bug 修倍工䜜通垞来诎经过测试后䌚合并回 `main` 分支。 #figure(image("images/[email protected]", width: 85%), caption: [比蟃标准的倧型项目的 Git 分支暡型。圚这种规范䞋历史记圕看起来埈倍杂䜆是盞圓枅楚。]) === 提亀消息规范 对分支规范后我们还䌚对提亀消息进行规范䞻芁的原因是 - 利甚工具来自劚化生成 CHANGELOG䟋劂 `cz-conventional-changelog` 工具 - 统䞀提亀消息栌匏䞍必纠结到底该怎么写提亀消息 - 方䟿项目曎奜讟计 CI/CD 流皋 #figure(image("images/changelog.png", width: 65%), caption: [䞀䞪奜的匀源蜯件郜䌚圚每䞪版本号对提亀或者 PR 记圕改劚日记䟋劂 VSCode]) 我们的参考是 #link("https://www.conventionalcommits.org/zh-hans/v1.0.0/")[纊定匏提亀规范]。具䜓来诎劂果采甚 eslint 栌匏的栌匏规范 - 每䞪提亀郜*必须*䜿甚类型字段前猀劂 `fix`, 同时加䞊以及必芁的冒号英文半角和空栌. - 圓䞀䞪提亀䞺应甚或类库实现了新功胜时䜿甚 `feat` 类型䞺应甚修倍了 bug 时䜿甚 `fix` 类型。 - 类型字段*可以*指定范囎䟋劂 `fix(api)` 指明是对接口代码的修倍。圓然䜠也可以䞍垊. - 每䞪提亀*必须*芁有对提亀的描述对代码变曎的简短总结。可以䜿甚䞭文。 - 圚类型后添加感叹号衚明这是䞀䞪*砎坏性变曎*(Breaking Change)。即对现有功胜或接口进行的修改。劂果䜠改了接口的某䞀䞪字段富臎无法兌容旧版本那么就需芁加䞊感叹号。 曎倚规则见䞊方给出的文档。以䞊几条䜜䞺我们的匀发规范就借甚了。 ==== 瀺䟋 - `feat!: send an email to the customer when a product is shipped` - `docs: correct spelling of CHANGELOG` - `feat(lang): add polish language` - `feat:` 登圕盞关接口 掚荐倧家去阅读正匏䞀些的匀源项目来了解提亀规范。䟋劂有的项目䌚芁求圚 PR 里指出盞关的 issue 猖号等等。 ==== 盞关工具 䜠可以圚终端里䜿甚 #link("https://cz-git.qbb.sh/zh/")[commitizen]#link("https://commitlint.js.org/")[commitlint] 这些工具省去手敲前猀的麻烊。 #pagebreak() == 参考资料 这篇文档䞻芁参考的是 #link("https://git-scm.com/book/zh/v2")[Pro Git]。讞倚配囟以及内容郜来自这本乊区烈掚荐自己亲自读䞀遍前五章 #link("https://singularity-backend.gitbook.io/backend-online-doc/week1/vcs-git")[奇点工䜜宀暑期训练营后端文档]这是奇点圚 23 幎暑假匀展的暑期训练营这篇文档也是圚线文档的䞀次重眮翻新——䞻芁是对原理郚分进行了重写因䞺初版确实有些䞍那么容易理解。劂果䜠对其它郚分感兎趣欢迎阅读文档 #link("https://missing-semester-cn.github.io/2020/version-control/")[MIT CS教育猺倱的䞀诟: 版本控制(Git)]: 敎䞪 Missing-semester 诟皋郜掚荐倧家孊习, 非垞奜的䞀闚诟, 孊习到埈倚奜甚的工具, 陀了拓宜视野曎胜垮助䜠圚未来的职䞚生涯䞭节省时闎. #link("https://learngitbranching.js.org/")[Learn Git Branching] 通过基于浏览噚的枞戏来孊习 Git. #link("https://nvie.com/posts/a-successful-git-branching-model/")[A successful Git branching model]有关分支工䜜流的文章文章的囟 13 来自于歀。
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/signature/import.typ
typst
Apache License 2.0
// path: base.typ #let f(u, v) = u + v; ----- #import "base.typ": * #(/* ident after */ f);
https://github.com/ohmycloud/computer-science-notes
https://raw.githubusercontent.com/ohmycloud/computer-science-notes/main/Misc/machine_learning_item.typ
typst
= 术语 亀叉验证折叠: cross-validation folds 自己实现亀叉验证: ```python from sklearn.model_selection import StratifiedKFold from sklearn.base import clone skfolds = StratifiedKFold(n_splits=3) # add shuffle=True if the dataset is # not already shuffled for train_index, test_index in skfolds.split(X_train, y_train_5): clone_clf = clone(sgd_clf) X_train_folds = X_train[train_index] y_train_folds = y_train_5[train_index] X_test_fold = X_train[test_index] y_test_fold = y_train_5[test_index] clone_clf.fit(X_train_folds, y_train_folds) y_pred = clone_clf.predict(X_test_fold) n_correct = sum(y_pred == y_test_fold) print(n_correct / len(y_pred)) ``` StratifiedFold 类执行分层抜样。每次迭代郜创建䞀䞪分类噚的克隆, 圚训练折叠䞊训练克隆, 圚测试折叠䞊做预测。 然后它计算正确预测的数量并蟓出正确预测的比率。 二元分类噚: binary classifier 只胜区分䞀䞪类别, 芁么是某䞪类别芁么䞍是。 随机梯床䞋降: stochastic gradient descent(SGD 或 stochastic GD) 训练集: training set 测试集: test set 借斜数据集: skewed datasets 比劂, 某些类型的囟片比其它类型的囟片出现埗频率曎高。 混淆矩阵: confusion matrix(CM) 甚于评䌰分类噚性胜的䞀种曎奜的方匏。 混淆矩阵的䞀般思想是对于所有 A/B 对儿计算 A 类实䟋被分类䞺 B 类的次数。 䟋劂芁知道分类噚混淆囟像 8 和 囟像 0 的次数䜠可以查看混淆矩阵的第8行第0列。 芁计算混淆矩阵䜠銖先芁有䞀组预测倌这组预测倌䌚和实际目标进行比蟃。 䜠可以对测试集进行预测䜆是现圚最奜䞍芁碰测试集(圚训练集䞊训练完分类噚之后, 再䜿甚测试集检测训练的效果)。 盞反䜠可以䜿甚 *cross_val_predict()* 凜数 ```python from sklearn.model_selection import cross_val_predict y_train_pred = cross_val_predict(sgd_clf, X_train, y_train_5, cv=3) ``` 现圚可以䜿甚confusion_matrix()凜数获埗混淆矩阵了。只需将目标类(y_train_5)和预测类䌠递给它 (y_train_pred): 就像 *cross_val_score()* 凜数䞀样*cross_val_predict()* 执行 _k_-fold 亀叉验证䜆它䞍是返回评䌰分数而是返回对每䞪测试折叠(test fold)所做的预测。 这意味着对于训练集(training set)䞭的每䞪实䟋, 䜠埗到䞀䞪“干净的”预测(这里的“干净”是指“样本倖”暡型对训练期闎从未见过的数据进行预测)。 现圚可以䜿甚 *confusion_matrix()* 凜数获埗混淆矩阵了。只需芁把目标类(y_train_5) 和预测类(y_train_pred)䌠递给它 ```python from sklearn.metrics import confusion_matrix cm = confusion_matrix(y_train_5, y_train_pred) # array([[53892, 687], # [ 1891, 3530]]) ``` 混淆矩阵䞭的每䞀行代衚䞀䞪实际的类而每䞀列代衚䞀䞪预测的类。该矩阵的第䞀行考虑非5的囟像(阎性类)其䞭53892䞪囟像被正确分类䞺非5(称䞺真阎性)而其䜙687䞪囟像被错误分类䞺5(假阳性也称䞺I类错误)。第二行考虑5s的囟像(正类): 1891䟋被错误地園类䞺非5(假阎性也称䞺II型错误)而其䜙3530䟋被正确園类䞺5(真阳性)。 䞀䞪完矎的分类噚只䌚有真正和真莟所以它的混淆矩阵只䌚圚䞻对角线䞊(从巊䞊到右䞋)有非零倌 ```python y_train_perfect_predictions = y_train_5 # pretend we reached perfection confusion_matrix(y_train_5, y_train_perfect_predictions) ``` 分类噚的粟确床:(the accuracy of the positive predictions) $"precision" = "TP" /("TP" + "FP")$ TP 䞺真阳性数FP 䞺假阳性数。 芁想获埗完矎的粟床䞀䞪简单的方法就是创建䞀䞪分类噚陀了对它最有信心的实䟋进行䞀次正向预测倖它总是进行莟向预测。劂果这䞀䞪预测是正确的那么分类噚的粟床就是 100%粟床 = 1/1 = 100%。星然这样的分类噚甚倄䞍倧因䞺它䌚応略陀了䞀䞪正向实䟋之倖的所有实䟋。因歀粟床通垞䞎及䞀䞪名䞺召回率(recall)的指标䞀起䜿甚召回率也称䞺灵敏床或真阳性率TPR这是分类噚正确检测到的阳性实䟋的比率 $ "recall" = "TP" / ("TP" + "FN")$ 圓然FN 是假阎性的数量。 粟床和召回率 ```python from sklearn.metrics import precision_score, recall_score precision_score(y_train_5, y_train_pred) recall_score(y_train_5, y_train_pred) ``` $F_1$ score $ F_1 = 2 / (1/"precision" + 1/"recall" ) = 2 × ("precision" × "recall") / ("precision" + "recall") = "TP" / ("TP" + ("FN" + "FP") / 2 ) $ 芁计算 $F_1$ 的倌只需芁调甚 *f1_score()* 凜数 ```python from sklearn.metrics import f1_score f1_score(y_train_5, y_train_pred) ```
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/167.%20aord.html.typ
typst
aord.html Default Alive or Default Dead? October 2015When I talk to a startup that's been operating for more than 8 or 9 months, the first thing I want to know is almost always the same. Assuming their expenses remain constant and their revenue growth is what it has been over the last several months, do they make it to profitability on the money they have left? Or to put it more dramatically, by default do they live or die?The startling thing is how often the founders themselves don't know. Half the founders I talk to don't know whether they're default alive or default dead.If you're among that number, <NAME> has made a handy calculator you can use to find out.The reason I want to know first whether a startup is default alive or default dead is that the rest of the conversation depends on the answer. If the company is default alive, we can talk about ambitious new things they could do. If it's default dead, we probably need to talk about how to save it. We know the current trajectory ends badly. How can they get off that trajectory?Why do so few founders know whether they're default alive or default dead? Mainly, I think, because they're not used to asking that. It's not a question that makes sense to ask early on, any more than it makes sense to ask a 3 year old how he plans to support himself. But as the company grows older, the question switches from meaningless to critical. That kind of switch often takes people by surprise.I propose the following solution: instead of starting to ask too late whether you're default alive or default dead, start asking too early. It's hard to say precisely when the question switches polarity. But it's probably not that dangerous to start worrying too early that you're default dead, whereas it's very dangerous to start worrying too late.The reason is a phenomenon I wrote about earlier: the fatal pinch. The fatal pinch is default dead + slow growth + not enough time to fix it. And the way founders end up in it is by not realizing that's where they're headed.There is another reason founders don't ask themselves whether they're default alive or default dead: they assume it will be easy to raise more money. But that assumption is often false, and worse still, the more you depend on it, the falser it becomes.Maybe it will help to separate facts from hopes. Instead of thinking of the future with vague optimism, explicitly separate the components. Say "We're default dead, but we're counting on investors to save us." Maybe as you say that, it will set off the same alarms in your head that it does in mine. And if you set off the alarms sufficiently early, you may be able to avoid the fatal pinch.It would be safe to be default dead if you could count on investors saving you. As a rule their interest is a function of growth. If you have steep revenue growth, say over 5x a year, you can start to count on investors being interested even if you're not profitable. [1] But investors are so fickle that you can never do more than start to count on them. Sometimes something about your business will spook investors even if your growth is great. So no matter how good your growth is, you can never safely treat fundraising as more than a plan A. You should always have a plan B as well: you should know (as in write down) precisely what you'll need to do to survive if you can't raise more money, and precisely when you'll have to switch to plan B if plan A isn't working.In any case, growing fast versus operating cheaply is far from the sharp dichotomy many founders assume it to be. In practice there is surprisingly little connection between how much a startup spends and how fast it grows. When a startup grows fast, it's usually because the product hits a nerve, in the sense of hitting some big need straight on. When a startup spends a lot, it's usually because the product is expensive to develop or sell, or simply because they're wasteful.If you're paying attention, you'll be asking at this point not just how to avoid the fatal pinch, but how to avoid being default dead. That one is easy: don't hire too fast. Hiring too fast is by far the biggest killer of startups that raise money. [2]Founders tell themselves they need to hire in order to grow. But most err on the side of overestimating this need rather than underestimating it. Why? Partly because there's so much work to do. Naive founders think that if they can just hire enough people, it will all get done. Partly because successful startups have lots of employees, so it seems like that's what one does in order to be successful. In fact the large staffs of successful startups are probably more the effect of growth than the cause. And partly because when founders have slow growth they don't want to face what is usually the real reason: the product is not appealing enough.Plus founders who've just raised money are often encouraged to overhire by the VCs who funded them. Kill-or-cure strategies are optimal for VCs because they're protected by the portfolio effect. VCs want to blow you up, in one sense of the phrase or the other. But as a founder your incentives are different. You want above all to survive. [3]Here's a common way startups die. They make something moderately appealing and have decent initial growth. They raise their first round fairly easily, because the founders seem smart and the idea sounds plausible. But because the product is only moderately appealing, growth is ok but not great. The founders convince themselves that hiring a bunch of people is the way to boost growth. Their investors agree. But (because the product is only moderately appealing) the growth never comes. Now they're rapidly running out of runway. They hope further investment will save them. But because they have high expenses and slow growth, they're now unappealing to investors. They're unable to raise more, and the company dies.What the company should have done is address the fundamental problem: that the product is only moderately appealing. Hiring people is rarely the way to fix that. More often than not it makes it harder. At this early stage, the product needs to evolve more than to be "built out," and that's usually easier with fewer people. [4]Asking whether you're default alive or default dead may save you from this. Maybe the alarm bells it sets off will counteract the forces that push you to overhire. Instead you'll be compelled to seek growth in other ways. For example, by doing things that don't scale, or by redesigning the product in the way only founders can. And for many if not most startups, these paths to growth will be the ones that actually work.Airbnb waited 4 months after raising money at the end of Y Combinator before they hired their first employee. In the meantime the founders were terribly overworked. But they were overworked evolving Airbnb into the astonishingly successful organism it is now.Notes[1] Steep usage growth will also interest investors. Revenue will ultimately be a constant multiple of usage, so x% usage growth predicts x% revenue growth. But in practice investors discount merely predicted revenue, so if you're measuring usage you need a higher growth rate to impress investors.[2] Startups that don't raise money are saved from hiring too fast because they can't afford to. But that doesn't mean you should avoid raising money in order to avoid this problem, any more than that total abstinence is the only way to avoid becoming an alcoholic.[3] I would not be surprised if VCs' tendency to push founders to overhire is not even in their own interest. They don't know how many of the companies that get killed by overspending might have done well if they'd survived. My guess is a significant number.[4] After reading a draft, <NAME> wrote:"I think you should make the hiring point more strongly. I think it's roughly correct to say that YC's most successful companies have never been the fastest to hire, and one of the marks of a great founder is being able to resist this urge."<NAME>uchheit adds:"A related problem that I see a lot is premature scaling—founders take a small business that isn't really working (bad unit economics, typically) and then scale it up because they want impressive growth numbers. This is similar to over-hiring in that it makes the business much harder to fix once it's big, plus they are bleeding cash really fast." Thanks to <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this.
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/README.md
markdown
# Liturgical Books Respository for my implementation of liturgical books for Orthodox and Byzantine Catholic church I decided to open this repo as public, for anyone to use. CSL texts are here temporarily, they are compiled from texts from OSBM monks, that they published long time ago on their former web page. They are here just as test data and will be replaced later by original transcription. Do not use without their permision. GR texts are compiled from [https://glt.goarch.org/](GOA). CU texts are compiled from [https://www.ponomar.net/](Ponomar). SK texts are mostly from various sources, especially from [https://casoslov.sk/](Casoslov.sk). They also serve as test texts and will be replaced by original translation. Do not use without their permision. Other texts are here just as test data, and will be removed or replaced in later versions. ## Prerequisites This repository uses [https://typst.app/docs](Typst) to generate PDFs from source code. ## Command To generate pdf use command ``` typst _general/NAME.typ ``` To update sources use command ```` git submodule update --remote ```` ## Plans and TODO - Find a way how to use second and third glory/now and how to render it properly - Finalize general minea - add matins and liturgy/typica - Add also lower feasts into minea - Add lenten and flowely triodion - Add different sources - Lviv, etc. ## Changelog ### v. 0.5 - CU, CSL and GR text are moved to separate repository, to allow it's independent reuse - Vespers for general minea are added - Started to add minea for great feasts ### v. 0.4 - Finished conversion of CLS oktoich to JSON - Work in progres of JSON oktoich ### v. 0.3 - Finished CU and CSL oktoich - Started CU common minea - Started GR version ### v. 0.2 - Added voice 1 and 2 in Church Slavonic and Slovak transcription of Church Slavonic - TODO: there are some differences in Lviv and Moscow oktoich, that need to be somehow resolved ### v. 0.1 - Initial commit to transfer from typst.app to separate place, as it reached maximal ammount of files.
https://github.com/Gekkio/gb-ctr
https://raw.githubusercontent.com/Gekkio/gb-ctr/main/appendix/external-bus.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "../common.typ": * #import "../timing.typ" == Game Boy external bus === Bus timings #let bus-diagram = (addr: array, rd: array, wr: array, a15: array, cs: array, data: array, sampling-edge: false) => { import timing: diagram, clock as c, data as d, either as e, high as h, low as l, unknown as u, undefined as x, high_impedance as z text(13pt, diagram( grid: true, (label: "CLK 4 MiHz", wave: ( l(1), ..range(9).map(_ => c(1)).flatten() )), (label: "PHI 1 MiHz", wave: (l(1), c(4), c(4), c(1),)), (label: "A0-A14", wave: addr), (label: "RD", wave: rd), (label: "WR", wave: wr), (label: "A15", wave: a15), (label: "CS", wave: cs), (label: "Data", wave: data), fg: () => { import cetz.draw draw.set-style(stroke: (paint: rgb("#00000080"), thickness: 0.01em)) draw.line((1.0, -0.5), (1.0, 15.5)) draw.line((9.0, -0.5), (9.0, 15.5)) if sampling-edge { draw.line((7, -0.5), (7, 15.5), stroke: (paint: rgb("#80800080"), thickness: 0.8pt)) } } ) ) } #figure( { import timing: diagram, clock as c, data as d, either as e, high as h, low as l, unknown as u, undefined as x, high_impedance as z bus-diagram( addr: (u(10),), rd: (e(1), l(9),), wr: (h(10),), a15: (e(1), h(8), e(1),), cs: (e(1), h(8), e(1),), data: (x(1), z(9),), ) }, caption: "External bus idle machine cycle" ) #v(1cm) #figure( { import timing: diagram, clock as c, data as d, either as e, high as h, low as l, unknown as u, undefined as x, high_impedance as z [ #columns(2, [ #block( breakable: false, [ #bus-diagram( addr: (u(2), d(7, "addr"), u(1),), rd: (e(1), l(9),), wr: (h(10),), a15: (e(1), h(2), l(6), e(1),), cs: (e(1), h(8), e(1),), data: (x(1), z(2), d(6, "data"), z(1)), sampling-edge: true ) #align(right, [ a) #hex-range("0000", "7FFF") #footnote[ Does not apply to #hex-range("0000", "00FF") accesses while the boot ROM is enabled. Boot ROM accesses do not affect the external bus, so it is in the idle state. ] <bootrom> ]) ] ) #colbreak() #block( breakable: false, [ #bus-diagram( addr: (u(2), d(7, "addr"), u(1),), rd: (e(1), l(9),), wr: (h(10),), a15: (e(1), h(8), e(1),), cs: (e(1), h(2), l(6), e(1),), data: (x(1), z(2), d(6, "data"), z(1)), sampling-edge: true, ) #align(right, [ b) #hex-range("A000", "FDFF") ]) ] ) ]) #block( breakable: false, [ #bus-diagram( addr: (u(2), d(7, "addr"), u(1),), rd: (e(1), l(9),), wr: (h(10),), a15: (e(1), h(8), e(1),), cs: (e(1), h(8), e(1),), data: (x(1), z(9),), ) #align(right, [ c) #hex-range("FE00", "FFFF") ]) #v(1cm) ] ) ] }, caption: "External bus CPU read machine cycles" ) #figure( { import timing: diagram, clock as c, data as d, either as e, high as h, low as l, unknown as u, undefined as x, high_impedance as z [ #columns(2, [ #block( breakable: false, [ #bus-diagram( addr: (u(2), d(7, "addr"), u(1),), rd: (e(1), l(1), h(7), l(1),), wr: (h(5), l(3), h(2),), a15: (e(1), h(2), l(6), e(1),), cs: (e(1), h(8), e(1),), data: (x(1), z(4), d(4, "data"), z(1)), ) #align(right, [ a) #hex-range("0000", "7FFF") #footnote(<bootrom>) ]) ] ) #colbreak() #block( breakable: false, [ #bus-diagram( addr: (u(2), d(7, "addr"), u(1),), rd: (e(1), l(1), h(7), l(1),), wr: (h(5), l(3), h(2),), a15: (e(1), h(8), e(1),), cs: (e(1), h(2), l(6), e(1),), data: (x(1), z(4), d(4, "data"), z(1)), ) #align(right, [ b) #hex-range("A000", "FDFF") ]) ] ) ]) #block( breakable: false, [ #bus-diagram( addr: (u(2), d(7, "addr"), u(1),), rd: (e(1), l(9),), wr: (h(10),), a15: (e(1), h(8), e(1),), cs: (e(1), h(8), e(1),), data: (x(1), z(9),), ) #align(right, [ c) #hex-range("FE00", "FFFF") ]) #v(1cm) ] ) ] }, caption: "External bus CPU write machine cycles" ) #figure( { import timing: diagram, clock as c, data as d, either as e, high as h, low as l, unknown as u, undefined as x, high_impedance as z [ #columns(2, [ #block( breakable: false, [ #bus-diagram( addr: (u(1), d(8, "addr"), u(1),), rd: (e(1), l(9),), wr: (h(10),), a15: (e(1), l(8), e(1),), cs: (e(1), h(8), e(1),), data: (x(1), d(8, "data"), z(1)), ) #align(right, [ a) #hex-range("0000", "7FFF") #footnote(<bootrom>) ]) ] ) #colbreak() #block( breakable: false, [ #bus-diagram( addr: (u(1), d(8, "addr"), u(1),), rd: (e(1), l(9),), wr: (h(10),), a15: (e(1), h(8), e(1),), cs: (e(1), l(8), e(1),), data: (x(1), d(8, "data"), z(1)), ) #align(right, [ b) #hex-range("A000", "FFFF") ]) ] ) ]) #v(1cm) ] }, caption: "External bus timings for OAM DMA read machine cycles" )
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/underover_02.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test brackets. $ underbracket([1, 2/3], "relevant stuff") arrow.l.r.double.long overbracket([4/5,6], "irrelevant stuff") $
https://github.com/jgm/typst-symbols
https://raw.githubusercontent.com/jgm/typst-symbols/main/README.md
markdown
MIT License
# typst-symbols This package provides definitions of the symbols used in typst (<https://typst.app>). (Currently version 0.12.0 is targeted.) It exports lists of triples, which can be converted into maps or other more appropriate forms, depending on the use case. Each triple contains the symbol name (Text), a Boolean that is True if the symbol is an accent, and the resolved symbol (Text). The symbols can be updated by scraping the typst website: `make update` will do the work.
https://github.com/emanuel-kopp/uzh-mnf-phd
https://raw.githubusercontent.com/emanuel-kopp/uzh-mnf-phd/main/src/lib.typ
typst
#let main_doc( title: "", author: "", heimatort: "", examinators: (""), date: "", land: "", PI_is_head: true, body, ) = { // Set the document's basic properties. set document(author: author, title: title) set text(font: "New Computer Modern", lang: "de", size: 11pt) set align(center) set page(margin: (left: 2cm, right: 2cm, bottom: 2cm, top: 2cm)) text(size: 14pt, weight: "bold")[#title] v(3pt) line(length: 171mm, stroke: 0.3pt) v(24pt) text(weight: "bold")[Dissertation] linebreak() v(2fr) text(weight: "bold")[zur] v(2fr) text(weight: "bold")[Erlangung der naturwissenschaftlichen DoktorwÌrde] v(2fr) text(weight: "bold")[(Dr. sc. nat.)] v(2fr) text(weight: "bold")[vorgelegt der] v(2fr) text(weight: "bold")[Mathematisch-naturwissenschaftlichen FakultÀt] v(2fr) text(weight: "bold")[der] v(2fr) text(weight: "bold")[UniversitÀt ZÌrich] v(2fr) text(weight: "bold")[von] v(2fr) text(weight: 1)[#author] v(11pt) if land == "Schweiz" [#text(weight: "bold")[von]] else { text(weight: "bold")[aus] } v(2fr) if land == "Schweiz" { text(weight: 1)[#heimatort] } else { text(weight: 1)[#land] } v(4fr) text(weight: "bold")[Promotionskommission] v(3pt) grid( align: left, columns: 3, [], let (a, b, .., c) = examinators, for ex in examinators { if PI_is_head == true [ #if ex == a { text(weight: 1)[#ex (Vorsitz und Leitung der Dissertation)] } else { text(weight: 1)[#ex] } ] if PI_is_head == false [ #if ex == a { text(weight: 1)[#ex (Vorsitz)] } else if ex == b { text(weight: 1)[#ex (Leitung der Dissertation)] } else { text(weight: 1)[#ex] } ] v(0.1em) }, [], ) v(6fr) text(weight: "bold")[ZÌrich, #date] v(2fr) pagebreak() // Defining headings show heading.where(level: 1): it => { pagebreak() set text(weight: "bold", size: 16pt) it.body v(1em) } // Main body set text(font: "New Computer Modern", lang: "en", size: 11pt) set par(justify: true) set align(left) set page(numbering: "1", number-align: center) set par(leading: 1.5em) body } #let chapter( title: none, authors: (), affiliations: (), header: none, abstract: [], chapter, ) = { set align(left) // Write title text(size: 14pt, weight: "bold", title) v(1em) let count = authors.len() let ncols = calc.min(count, 3) for aut in authors { if aut.name == authors.last().name { text()[#aut.name#super[#aut.affiliation]] } else { text()[#aut.name#super[#aut.affiliation], ] } } v(1em) for aff in affiliations { text()[#aff.num: #aff.name] linebreak() } v(2em) set align(center) par(justify: true)[ *Abstract* \ #abstract ] show heading.where(level: 2): it => { v(1em) it.body v(1em) } show heading.where(level: 3): it => { v(1em) it.body v(1em) } set align(left) v(2em) // Write header set page(header: align(right)[ #text(size: 10pt, style: "italic")[#header] ]) chapter }
https://github.com/Jollywatt/typst-fletcher
https://raw.githubusercontent.com/Jollywatt/typst-fletcher/master/docs/readme-examples/state-machine.typ
typst
MIT License
#set text(10pt) #diagram( node-stroke: .1em/*<*/ + fg/*>*/, edge-stroke: fg, // hide crossing-fill: bg , // hide node-fill: gradient.radial(blue.lighten(80%), blue, center: (30%, 20%), radius: 80%), spacing: 4em, edge((-1,0), "r", "-|>", `open(path)`, label-pos: 0, label-side: center), node((0,0), `reading`, radius: 2em), edge(`read()`, "-|>"), node((1,0), `eof`, radius: 2em), edge(`close()`, "-|>"), node((2,0), `closed`, radius: 2em, extrude: (-2.5, 0)), edge((0,0), (0,0), `read()`, "--|>", bend: 130deg), edge((0,0), (2,0), `close()`, "-|>", bend: -40deg), )
https://github.com/alberto-lazari/cns-report
https://raw.githubusercontent.com/alberto-lazari/cns-report/main/previous-architecture.typ
typst
= Overview of previous work <previous_work> Thestarting point of our project is _QRFuzz_ by @QRFuzz, which is made of the following components: - *PC Monitor*: A phisical monitor in which the generated QRs are displayed. - *Smartphone*: A phisical smartphone in which the app under test is run. - *Appium server*: An Appium Server is an open-source automation server that facilitates the automated testing of mobile applications across different platforms, including iOS, Android, and Windows. It acts as a bridge between test code and the mobile device or emulator, allowing to interact with the application under test programmatically. - *QR Code Fuzzer*: The main element of the system that is responsible for coordinating and initiating actions for both the QR Code Generator and the Appium Server, along with managing the entire testing process. The fuzzing operation itself involves a series of steps repeated for each QR code under examination. These steps include navigating to the designated scanning page within the application, scanning the QR code, verifying if the app's normal behavior has been disrupted, and logging the results of the iteration as potential indications of a vulnerability. - *QR Code Generator*: The QR Code Generator is another crucial component of QRFuzz. Its primary function is to dynamically produce QR codes using a predefined dictionary and display them on the screen. This generator is capable of creating both standard, general-purpose QR codes and custom codes based on an application-specific template. #v(2em) == Workflow The workflow of the system (@old_workflow) can be summarized by the following steps: 1. The QR code displayed on the monitor is scanned by the smartphone. 2. The smartphone sends a scan responce to the QR Code Fuzzer through the Appium server 3. The QR Code Fuzzer notifies a QR change request to the QR Code Generator by updating a shared JSON file. 4. The QR Code Generator generates a new QR and displays it on the monitor. 5. The QR Code Generator notifies the update to the QR Code Fuzzer by changing the JSON file. 6. The QR Code Fuzzer sends a scan request to the smartphone via Appium server. #figure( image("images/qr-fuzz-old-architecture.png"), caption: [Old architecture] ) <old_workflow>
https://github.com/isaacholt100/isaacholt
https://raw.githubusercontent.com/isaacholt100/isaacholt/main/public/maths-notes/4-cambridge%3A-part-III/additive-combinatorics/additive-combinatorics.typ
typst
MIT License
#import "../../template.typ": * #show: doc => template(doc, hidden: (), slides: false) = Combinatorial methods #definition[ Let $G$ be an abelian group and $A, B subset.eq G$. The *sumset* of $A$ and $B$ is $ A + B := {a + b: a in A, b in B}. $ The *difference set* of $A$ and $B$ is $ A - B := {a - b: a in A, b in B}. $ ]<def:sumset-and-difference-set> #proposition[ $max{|A|, |B|} <= |A + B| <= |A| dot |B|$. ]<prop:general-bound-on-sumset-size> #proof[ Trivial. ] #example[ Let $A = [n] = {1, ..., n}$. Then $A + A = {2, ..., 2n}$ so $|A + A| = 2|A| - 1$. ] #lemma[ Let $A subset.eq ZZ$ be finite. Then $|A + A| >= 2|A| - 1$ with equality iff $A$ is an arithmetic progression. ]<lem:lower-bound-on-integer-sumset> #proofhints[ Consider two sequences in $A + A$ which are strictly increasing and of the same length. ] #proof[ - Let $A = {a_1, ..., a_n}$ with $a_i < a_(i + 1)$. Then $a_1 + a_1 < a_1 + a_2 < dots.c < a_1 + a_n < a_2 + a_n < dots.c < a_n + a_n$. - Note this is not the only choice of increasing sequence that works, in particular, so does $a_1 + a_1 < a_1 + a_2 < a_2 + a_2 < a_2 + a_3 < a_2 + a_4 < dots.c < a_2 + a_n < a_3 + a_n < dots.c < a_n + a_n$. - So when equality holds, all these sequences must be the same. In particular, $a_2 + a_i = a_1 + a_(i + 1)$ for all $i$. ] #lemma[ If $A, B subset.eq ZZ$, then $|A + B| >= |A| + |B| - 1$ with equality iff $A$ and $B$ are arithmetic progressions with the same common difference. ] #proofhints[ Similar to above, consider $4$ sequences in $A + B$ which are strictly increasing and of the same length. ] #example[ Let $A, B subset.eq ZZ\/p$ for $p$ prime. If $|A| + |B| >= p + 1$, then $A + B = ZZ\/p$. ] #proofhints[ Consider $A sect (g - B)$ for $g in ZZ\/p$. ] #proof[ - $g in A + B$ iff $A sect (g - B) != emptyset$ where ($g - B = {g} - B$). - Let $g in ZZ\/p$, then use inclusion-exclusion on $|A sect (g - B)|$ to conclude result. ] #theorem(name: "Cauchy-Davenport")[ Let $p$ be prime, $A, B subset.eq ZZ\/p$ be non-empty. Then $ |A + B| >= min{p, |A| + |B| - 1}. $ ]<thm:cauchy-davenport> #proofhints[ - Assume $|A| + |B| < p + 1$, and WLOG that $1 <= |A| <= |B|$ and $0 in A$ (by translation). - Induct on $|A|$. - Let $a in A$, find $B'$ such that $0 in B'$, $a in.not B'$ and $|B'| = |B|$ (use fact that $p$ is prime). - Apply induction with $A sect B'$ and $A union B'$, while reasoning that $(A sect B') + (A union B') subset.eq A + B'$. ] #proof[ - Assume $|A| + |B| < p + 1$, and WLOG that $1 <= |A| <= |B|$ and $0 in A$ (by translation). - Use induction on $|A|$. $|A| = 1$ is trivial. - Let $|A| >= 2$ and let $0 != a in A$. Then since $p$ is prime, ${a, 2a, ..., p a} = ZZ\/p$. - There exists $m >= 0$ such that $m a in B$ but $(m + 1)a in.not B$ (why?). Let $B' = B - m a$, so $0 in B'$, $a in.not B'$ and $|B'| = |B|$. - $1 <= |A sect B'| < |A|$ (why?) so the inductive hypothesis applies to $A sect B'$ and $A union B'$. - Since $(A sect B') + (A union B') subset.eq A + B'$ (why?), we have $|A + B| = |A + B'| >= |(A sect B') + (A union B')| >= |A sect B'| + |A union B'| - 1 = |A| + |B| - 1$. ] #example[ Cauchy-Davenport does not hold general abelian groups (e.g. $ZZ\/n$ for $n$ composite): for example, let $A = B = {0, 2, 4} subset.eq ZZ\/6$, then $A + B = {0, 2, 4}$ so $|A + B| = 3 < min{6, |A| + |B| - 1}$. ] #example[ Fix a small prime $p$ and let $V subset.eq FF_p^n$ be a subspace. Then $V + V = V$, so $|V + V| = |V|$. In fact, if $A subset.eq FF_p^n$ satisfies $|A + A| = |A|$, then $A$ is an affine subspace (a coset of a subspace). ] #proof[ If $0 in A$, then $A subset.eq A + A$, so $A = A + A$. General result follows by considering translation of $A$. ] #example[ Let $A subset.eq FF_p^n$ satisfy $|A + A| <= 3/2 |A|$. Then there exists a subspace $V subset.eq FF_p^n$ such that $|V| <= 3/2 |A|$ and $A$ is contained in a coset of $V$. ] #proof[ Exercise (sheet 1). ] #definition[ Let $A, B subset.eq G$ be finite subsets of an abelian group $G$. The *Ruzsa distance* between $A$ and $B$ is $ d(A, B) := log (|A - B|)/(sqrt(|A| dot |B|)). $ ] #lemma(name: "Ruzsa Triangle Inequality")[ Let $A, B, C subset.eq G$ be finite. Then $ d(A, C) <= d(A, B) + d(B, C). $ ]<lem:ruzsa-triangle-inequality> #proofhints[ Consider a certain map from $B times (A - C)$ to $(A - B) times (B - C)$. ] #proof[ - Note that $|B| |A - C| <= |A - B| |B - C|$. Indeed, writing each $d in A - C$ as $d = a_d - c_d$ with $a_d in A$, $c_d in C$, the map $phi: B times (A - C) -> (A - B) times (B - C)$, $phi(b, d) = (a_d - b, b - c_d)$ is injective (why?). - Triangle inequality now follows from definition of Ruzsa distance. ] #definition[ The *doubling constant* of finite $A subset.eq G$ is $sigma(A) := |A + A|\/|A|$. ]<def:doubling-constant> #definition[ The *difference constant* of finite $A subset.eq G$ is $delta(A) := |A - A|\/|A|$. ]<def:difference-constant> #remark[ The Ruzsa triangle inequality shows that $ log delta(A) = d(A, A) <= d(A, -A) + d(-A, A) = 2 log sigma(A). $ So $delta(A) <= sigma(A)^2$, i.e. $|A - A| <= |A + A|^2\/|A|$. ] #notation[ Let $A subset.eq G$, $ell, m in NN_0$. Then $ ell A + m A := underbrace(A + dots.c + A, ell "times") underbrace(- A - dots.c - A, m "times") $ This is referred to as the *iterated sum and difference set*. ] #theorem(name: "Plunnecke's Inequality")[ Let $A, B subset.eq G$ be finite and $|A + B| <= K|A|$ for some $K >= 1$. Then $forall ell, m in NN_0$, $ |ell B - m B| <= K^(ell + m) abs(A). $ ]<thm:plunneckes-inequality> #proofhints[ - Let $A' subset.eq A$ minimise $abs(A' + B)\/abs(A')$ with value $K'$. - Show that for every finite $C subset.eq G$, $abs(A' + B + C) <= K' abs(A + C)$ by induction on $abs(C)$ (note two sets need to be written as disjoint unions here). - Show that $forall m in NN_0, abs(A' + m B) <= (K')^m abs(A')$ by induction. - Use Ruzsa triangle inequality to conclude result. ] #proof[ - Choose $emptyset != A' subset.eq A$ which minimises $|A' + B|\/|A'|$. Let the minimum value by $K'$. - Then $|A' + B| = K' abs(A')$, $K' <= K$ and $forall A'' subset.eq A$, $|A'' + B| >= K' abs(A'')$. - Claim: for every finite $C subset.eq G$, $|A' + B + C| <= K' abs(A' + C)$: - Use induction on $abs(C)$. $abs(C) = 1$ is true by definition of $K'$. - Let claim be true for $C$, consider $C' = C union {x}$ for $x in.not C$. - $A' + B + C' = (A' + B + C) union ((A' + B + x) - (D + B + x))$, where $D = {a in A': a + B + x subset.eq A' + B + C}$. - By definition of $K'$, $abs(D + B) >= K' abs(D)$. Hence, $ |A' + B + C| & <= |A' + B + C| + abs(A' + B + x) - abs(D + B + x) \ & <= K' abs(A' + C) + K' abs(A') - K' abs(D) \ & = K' (abs(A' + C) + abs(A') - |D|). $ - Applying this argument a second time, write $A' + C' = (A' + C) union ((A' + x) - (E + x))$, where $E = {a in A': a + x in A' + C} subset.eq D$. - Finally, $ abs(A' + C') & = abs(A' + C) + abs(A' + x) - abs(E + x) \ & >= |A' + C| + |A'| - |D|. $ - We first show that $forall m in NN_0$, $abs(A' + m B) <= (K')^m abs(A')$ by induction: - $m = 0$ is trivial, $m = 1$ is true by assumption. - Suppose $m - 1 >= 1$ is true. By the claim with $C = (m - 1) B$, we have $ abs(A' + m B) = |A' + B + (m - 1)B| <= K' abs(A' + (m - 1)B) <= (K')^m abs(A'). $ - As in the proof of Ruzsa's triangle inequality, $forall ell, m in NN_0$, $ |A'| |ell B - m B| <= |A' + ell B| |A' + m B| <= (K')^ell abs(A') (K')^m abs(A') = (K')^(ell + m) abs(A')^2. $ ] #theorem(name: "Freiman-Ruzsa")[ Let $A subset.eq FF_p^n$ and $abs(A + A) <= K abs(A)$. Then $A$ is contained in a subspace $H subset.eq FF_p^n$ with $abs(H) <= K^2 p^(K^4) abs(A)$. ]<thm:freiman-ruzsa> #proofhints[ - Let $X subset.eq 2A - A$ be of maximal size such that all $x + A$, $x in X$, are disjoint. - Use Plunnecke's inequality to obtain an upper bound on $abs(X) abs(A)$. - Show that $forall ell >= 2$, $ell A - A subset.eq (ell - 1)X + A - A$ by induction. - Let $H$ be subgroup generated by $A$. By writing $H$ as an infinite union, show that $H subset.eq Y + A - A$, where $Y$ is subgroup generated by $X$. - Find an upper bound for $abs(Y)$, conclude using Plunnecke inequality. ] #proof[ - Choose maximal $X subset.eq 2A - A$ such that the translates $x + A$ with $x in X$ are disjoint. - Such an $X$ cannot be too large: $forall x in X$, $x + A subset.eq 3A - A$, so by Plunnecke's inequality, since $abs(3A - A) <= K^4 abs(A)$, $ abs(X) abs(A) = abs(union.big_(x in X) (x + A)) <= abs(3A - A) <= K^4 abs(A). $ Hence $abs(X) <= K^4$. - We next show that $2A - A subset.eq X + A - A$. Indeed, if, $y in 2A - A$ and $y in.not X$, then by maximality of $X$, then $(y + A) sect (x + A) != emptyset$ for some $x in X$. If $y in X$, then $y in X + A - A$. - It follows from above, by induction, that $forall ell >= 2$, $ell A - A subset.eq (ell - 1)X + A - A$: $ell A - A = A + (ell - 1)A - A subset.eq (ell - 2)X + 2A - A subset.eq (ell - 2)X + X + A - A = (ell - 1)X + A - A$. - Now, let $H subset.eq FF_p^n$ be the subgroup generated by $A$: $ H = union.big_(ell >= 1) (ell A - A) subset.eq Y + A - A $ where $Y subset.eq FF_p^n$ is the subgroup generated by $X$. - Every element of $Y$ can be written as a sum of $abs(X)$ elements of $X$ with coefficients in ${0, ..., p - 1}$. Hence, $abs(Y) <= p^abs(X) <= p^(K^4)$. - Hence $abs(H) <= abs(Y) abs(A - A) <= p^(K^4) K^2 abs(A)$ by Plunnecke/Ruzsa triangle inequality. ] #example[ Let $A = V union R$, where $V subset.eq FF_p^n$ is a subspace with $dim(V) = d = n\/K$ satisfying $K << d << n - K$, and $R$ consists of $K - 1$ linearly independent vectors not in $V$. Then $abs(A) = abs(V union R) = abs(V) + abs(R) = p^(n\/K) + K - 1 approx p^(n\/K) = abs(V)$. Now $abs(A + A) = abs((V union R) + (V union R)) = abs(V union (V + R) union 2R) approx K abs(V) approx K abs(A)$ (since $V union (V + R)$ gives $K$ cosets of $V$). But any subspace $H subset.eq FF_p^n$ containing $A$ must have size at least $p^(n\/K + (K - 1)) approx abs(V) p^K$. Hence, the exponential dependence on $K$ in Freiman-Ruzsa is necessary. ] #theorem(name: "Polynomial Freiman-Ruzsa Theorem")[ Let $A subset.eq FF_p^n$ be such that $abs(A + A) <= K abs(A)$. Then there exists a subspace $H subset.eq FF_p^n$ of size at most $C_1 (K) abs(A)$ such that for some $x in FF_p^n$, $ abs(A sect (x + H)) >= abs(A)/(C_2 (K)), $ where $C_1 (K)$ and $C_2 (K)$ are polynomial in $K$. ] #proof[ Very difficult (took Green, Gowers and Tao to prove it). ] #definition[ Given $A, B subset.eq G$ for an abelian group $G$, the *additive energy* between $A$ and $B$ is $ E(A, B) := abs({(a, a', b, b') in A times A times B times B: a + b = a' + b'}). $ *Additive quadruples* $(a, a', b, b')$ are those such that $a + b = a' + b'$. Write $E(A)$ for $E(A, A)$. ] #example[ Let $V subset.eq FF_p^n$ be a subspace. Then $E(V) = abs(V)^3$. On the other hand, if $A subset.eq ZZ\/p$ is chosen at random from $ZZ\/p$ (where each $a in ZZ\/p$ is included with probability $alpha > 0$), with high probability, $E(A) = alpha^4 p^3 = alpha abs(A)^3$. ] #definition[ For $A, B subset.eq G$, the *representation function* is $r_(A + B) (x) := abs({(a, b) in A times B: a + b = x}) = abs(A sect (x - B))$. ] #lemma[ Let $emptyset != A, B subset.eq G$ for an abelian group $G$. Then $ E(A, B) >= (abs(A)^2 abs(B)^2)/abs(A + B). $ ] #proof[ - Observe that $ E(A, B) & = abs({(a, a', b, b') in A^2 times B^2: a + b = a' + b'}) \ & = abs(union.big_(x in G) {(a, a', b, b') in A^2 times B^2: a + b = x "and" a' + b' = x}) \ & = union.big_(x in G) abs({(a, a', b, b') in A^2 times B^2: a + b = x "and" a' + b' = x}) \ & = sum_(x in G) r_(A + B) (x)^2 $ ] = Fourier-analytic techniques = Probabilistic tools = Further topics
https://github.com/Shuenhoy/modern-zju-thesis
https://raw.githubusercontent.com/Shuenhoy/modern-zju-thesis/master/documentclass/graduate-general.typ
typst
MIT License
#import "../pages/graduate-cover.typ": graduate-cover #import "../pages/graduate-title-zh.typ": graduate-title-zh #import "../pages/graduate-title-en.typ": graduate-title-en #import "../pages/graduate-decl.typ": graduate-decl #import "../pages/template-individual.typ": template-individual #import "../pages/outline.typ": main-outline, figure-outline, table-outline #import "../utils/fonts.typ": * #import "../utils/header.typ": header, footer #import "../utils/fakebold.typ": show-cn-fakebold #import "../utils/indent-first-par.typ": indent-first-par #import "../utils/supplement.typ": show-set-supplement #import "../utils/twoside.typ": show-twoside-pagebreak, twoside-numbering-footer, twoside-pagebreak #import "../utils/near-chapter.typ": near-chapter #import "../utils/bilingual-bibliography.typ": show-bilingual-bibliography #import "../utils/structure.typ": frontmatter, mainmatter #import "../utils/appendix.typ": appendix #import "../dependency/i-figured.typ" #let show-outline-indent(s) = { show outline.entry: it => { if it.level == 1 { text(weight: "bold", it) } else { h(1em * (it.level - 1)) + it } } s } #let graduate-general-default-info = ( title: ("毕䞚论文/讟计题目", ""), title-en: ("Graduation Project/Design Title", ""), grade: "20XX", student-id: "1234567890", clc: "O643.12", unitcode: "10335", reviewer: ("隐名", "隐名", "隐名", "隐名", "隐名"), committe: ("䞻垭", "委员", "委员", "委员", "委员", "委员"), reviewer-en: ("Anonymous", "Anonymous", "Anonymous", "Anonymous", "Anonymous"), committe-en: ("Chair", "Committeeman", "Committeeman", "Committeeman", "Committeeman", "Committeeman"), secret-level: "无", author: "匠䞉", department: "某孊院", major: "某䞓䞚", degree: "硕士", field: "某方向", supervisor: "李四", submit-date: datetime.today(), defense-date: ("二䞀九䞉幎六月", "September 2193"), ) #let graduate-general-set-style( doc, degree: "硕士", twoside: false, ) = { // Page geometry set page( paper: "a4", margin: ( x: 2.5cm, bottom: 2.54cm + 12pt + 30pt, top: 2.54cm + 12pt + 4mm, ), ) show: show-twoside-pagebreak.with(twoside: twoside) // Header and footer set page( header-ascent: 4mm, footer-descent: 35pt, header: header( left: [浙江倧孊#(degree)孊䜍论文], right: near-chapter, ), footer: twoside-numbering-footer, ) // Paragraph and text set par(leading: 1.3em, first-line-indent: 2em, justify: true) show: indent-first-par set text(font: 字䜓.仿宋, size: 字号.小四, lang: "zh") show: show-cn-fakebold set underline(offset: 0.2em) // Headings show heading: i-figured.reset-counters set heading(numbering: "1.1") show heading.where(level: 1): set text(size: 字号.小䞉) show heading.where(level: 1): x => { twoside-pagebreak v(12pt) x v(6pt) } show heading.where(level: 2): set text(size: 字号.四号) show heading.where(level: 3): set text(size: 字号.小四) show heading.where(level: 4): set text(size: 字号.小四) show heading: set block(above: 1.5em, below: 1.5em) // Reference show: show-set-supplement show figure: i-figured.show-figure show math.equation.where(block: true): i-figured.show-equation show figure.where(kind: table): set figure.caption(position: top) show: show-bilingual-bibliography doc } #let graduate-general(info: (:), twoside: false) = { let info = graduate-general-default-info + info ( pages: ( cover: graduate-cover(info: info), title-zh: graduate-title-zh(info: info), title-en: graduate-title-en(info: info), decl: graduate-decl(), outline: show-outline-indent(main-outline(outlined: true, titlelevel: 1)), figure-outline: figure-outline(outlined: true, titlelevel: 1), table-outline: table-outline(outlined: true, titlelevel: 1), individual: template-individual.with(outlined: true, titlelevel: 1, bodytext-settings: (size: 字号.小四)), ), style: doc => { set document(title: info.title.join()) graduate-general-set-style(doc, degree: info.degree, twoside: twoside) }, ) }
https://github.com/typst-community/mantodea
https://raw.githubusercontent.com/typst-community/mantodea/main/src/_valid.typ
typst
MIT License
#import "_pkg.typ" #let _content = content #let _color = color #let _gradient = gradient #let _label = label #let _version = version #import _pkg.z: * #let paint = base-type.with(name: "color/gradient", types: (_color, _gradient,)) #let auto_ = base-type.with(name: "auto", types: (type(auto),)) #let label = base-type.with(name: "label", types: (_label,)) #let version = base-type.with(name: "version", types: (_version,))
https://github.com/0xPARC/0xparc-intro-book
https://raw.githubusercontent.com/0xPARC/0xparc-intro-book/main/src/fhe-takeaways.typ
typst
#import "preamble.typ":* #takeaway[FHE takeaways][ 1. A _fully homomorphic encryption_ protocol allows Bob to compute some function $f(x)$ for Alice in a way that Bob doesn't get to know $x$ or $f(x)$. 2. The hard problem backing known FHE protocols is the _learning with errors (LWE)_ problem, which comes down to deciding if a system of "approximate equations" over $FF_q$ is consistent. 3. The main idea of this approach to FHEs is to use "approximate eigenvalues" as the encrypted computation and an "approximate eigenvector" as the secret key. Intuitively, adding and multiplying two matrices with different approximate eigenvalues for the same eigenvector approximately adds and multiplies the eigenvalues, respectively. 4. To carefully do this, we actually need to control the error blowup with the _flatten_ operation. This creates a _levelled FHE_ protocol. ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/par-justify_05.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test that runts are avoided when it's not too costly to do so. #set page(width: 124pt) #set par(justify: true) #for i in range(0, 20) { "a b c " } #"d"
https://github.com/sebmestrallet/typst-simple-siam
https://raw.githubusercontent.com/sebmestrallet/typst-simple-siam/main/README.md
markdown
MIT No Attribution
# The `simple-siam` Typst package A Typst template for SIAM paper submissions <p align="center"> <img src="thumbnails/p1.png" alt="page 1 of an example paper based on this template" width="49%"> <img src="thumbnails/p2.png" alt="page 2 of an example paper based on this template" width="49%"> <img src="thumbnails/p3.png" alt="page 3 of an example paper based on this template" width="49%"> <img src="thumbnails/p4.png" alt="page 4 of an example paper based on this template" width="49%"> </p> <details> <summary>About the name</summary> - `typst-simple-siam` is the name of the GitHub repo, `simple-siam` is the name of the Typst template - The Typst template name does not contain `typst`, because it is redundant[^typst_template_naming] - The Typst template name is not just `siam`, because it is not an official template, thus the name must start with a non-descriptive part[^typst_template_naming] [^typst_template_naming]: https://github.com/typst/packages?tab=readme-ov-file#submission-guidelines </details> ## Template adaptation checklist - [x] Fill out `README.md` - Change the `my-package` package name, including code snippets - Check section contents and/or delete sections that don't apply - [x] Check and/or replace `LICENSE` by something that suits your needs - [x] Fill out `typst.toml` - See also the [typst/packages README](https://github.com/typst/packages/?tab=readme-ov-file#package-format) - [ ] Adapt Repository URLs in `CHANGELOG.md` - Consider only committing that file with your first release, or removing the "Initial Release" part in the beginning - [ ] Adapt or deactivate the release workflow in `.github/workflows/release.yml` - to deactivate it, delete that file or remove/comment out lines 2-4 (`on:` and following) - to use the workflow - [ ] check the values under `env:`, particularly `REGISTRY_REPO` - [ ] if you don't have one, [create a fine-grained personal access token](https://github.com/settings/tokens?type=beta) with [only Contents permission](https://stackoverflow.com/a/75116350/371191) for the `REGISTRY_REPO` - [ ] on this repo, create a secret `REGISTRY_TOKEN` (at `https://github.com/[user]/[repo]/settings/secrets/actions`) that contains the so created token if configured correctly, whenever you create a tag `v...`, your package will be pushed onto a branch on the `REGISTRY_REPO`, from which you can then create a pull request against [typst/packages](https://github.com/typst/packages/) - [x] remove/replace the example test case - [x] (add your actual code, docs and tests) - [ ] remove this section from the README ## Getting Started > [!IMPORTANT] > This template is not published yet, you cannot access it from `@preview/`, but you can download [`src/lib.typ`](src/lib.typ) and use it in your project. From the CLI: ```bash typst init @preview/simple-siam ``` From the Typst web app: ```typ #import "@preview/simple-siam:0.1.0": conf #show: doc => conf( title: [A Typst template for SIAM paper submissions], authors: [<NAME>], abstract: [See #link("https://github.com/sebmestrallet/typst-simple-siam")], doc, ) = First section #lorem(50) ``` ## Theorems & algorithms Based on third-party Typst packages, this template allows to insert formatted theorem/proof/definition/lemma environments, as well as algorithms: ```typ #import "lib.typ": conf, theorem, definition, lemma, thmrules, proof, pseudocode-list, algorithm #show: thmrules #show: doc => conf( title: [A Typst template for SIAM paper submissions], authors: [<NAME>], abstract: [See #link("https://github.com/sebmestrallet/typst-simple-siam")], doc, ) = A theorem #theorem[ Here the theorem formulation ] = An algorithm #algorithm( pseudocode-list( numbered-title: #smallcaps[(My Algorithm)], stroke: none, booktabs: false, indentation: 2em )[ - *Require:* Some input $a$ - *Require:* Some input $b$ + Here the algorithm definition ] ) ``` ## Files - [`src/lib.typ`](src/lib.typ): provide the `conf(title,authors,abstract,doc)` function to format a paper - [`src/main.typ`](src/main.typ): use `conf()` to reproduce the outputs of `ltexpprt_anonymous-submission.tex` & `ltexpprt_accepted-submission.tex` from the official template - [`src/bib.yml`](src/bib.yml): transcoding of `ltexpprt_references.bib` from the official template to the [Hayagriva](https://github.com/typst/hayagriva/blob/main/docs/file-format.md) format - [`src/siam.csl`](src/siam.csl): [Citation Style Language](https://citationstyles.org/) for the bibliography, based on the [IEEE](https://github.com/citation-style-language/styles/blob/master/ieee.csl) one (modified `<macro name="author">` to have small caps) ## Dependencies - [`ctheorems`](https://typst.app/universe/package/ctheorems) ([sahasatvik/typst-theorems](https://github.com/sahasatvik/typst-theorems)) for numbered theorem environments, by [<NAME>](https://github.com/sahasatvik), [<NAME>](https://github.com/rmolinari), [<NAME>](https://github.com/MJHutchinson) and [DVDTSB](https://github.com/DVDTSB) [[MIT](https://github.com/sahasatvik/typst-theorems/blob/main/LICENSE)] - [`lovelace`](https://typst.app/universe/package/lovelace) ([andreasKroepelin/lovelace](https://github.com/andreasKroepelin/lovelace)) for pseudocode, by [<NAME>](https://github.com/andreasKroepelin) and contributors [[MIT](https://github.com/andreasKroepelin/lovelace/blob/main/LICENSE)] They are imported with `#import "@preview/{name}:{version}` in [`src/lib.typ`](src/lib.typ). ## Ressources TeX sources of the official template: - The [SIAM two-column template](https://internationalmeshingroundtable.com/assets/files/imr33/templates.zip) referenced for the [SIAM International Meshing Roundtable Workshop 2025](https://internationalmeshingroundtable.com/imr33/call-for-papers/#formatting-requirements) - The [SIAM Macros](https://epubs.siam.org/journal-authors#macros) on the SIAM website - The [2019 SIAM style manual](https://epubs.siam.org/pb-assets/files/SIAM_STYLE_GUIDE_2019.pdf) on the SIAM website How to create and publish a Typst template package: - The motivation and recommended interface for templates in the [official tutorial](https://typst.app/docs/tutorial/making-a-template/) - The in-depth format requirements in the [typst/packages](https://github.com/typst/packages) README - Do as the [templates directly maintained by the Typst team](https://github.com/typst/templates) - Use the [typst-package-template](https://github.com/typst-community/typst-package-template) GitHub template from [@typst-community](https://github.com/typst-community) ## Differences with the official TeX template See [open issues with the `compliance` label](https://github.com/sebmestrallet/typst-simple-siam/issues?q=sort%3Aupdated-desc+is%3Aopen+label%3Acompliance) ## License [MIT-0](LICENSE)
https://github.com/LeptusHe/LeptusHe.github.io
https://raw.githubusercontent.com/LeptusHe/LeptusHe.github.io/main/source/_posts/fourier-transform/fourier-transform-01-fourier-series.typ
typst
#import "../typst-inc/blog-inc.typc": * #show: blog_setting.with( title: "傅里叶变换01 - 傅里叶级数", author: ("<NAME>"), paper: "jis-b0", preview: false ) #metadata("傅里叶变换") <tags> #metadata("æ•°å­Š") <categories> #metadata("2024-08-05") <date> #show: shorthands.with( ($<|$, math.angle.l), ($|>$, math.angle.r) ) #set math.equation(numbering: "(1)") = 傅里叶正亀凜数集 傅里叶凜数集$cal(Phi)$是正亀凜数集其䞭任意䞀䞪凜数的内积郜䞺0。$cal(Phi)$的定义劂@eq-fourier-function 所瀺。 $ cal(Phi) = {1, sin(w t), cos(w t), sin (2 w t), cos(2 w t), dots.c, sin(n w t), cos (n w t)} $ <eq-fourier-function> 傅里叶基凜数之闎内积的定义劂@eq-inner-fourier-basis-func 所瀺。 $ <|f, g|> = integral_(-T/2)^(T/2) f(x) dot.c g(x) dif x $ <eq-inner-fourier-basis-func> #proof[ #im[圓正敎数$n$侎$m$满足]$n, m > 0$时 $ <|sin(n w t), sin(m w t)|> &= Integral(-T/2, T/2, sin(n w t) dot.c sin(m w t), dif: t) \ &= cIntegral(1/2 (cos(n - m) w t - cos((n + m) w t))) \ $ 分情况讚论圓$m != n$时根据 @def-integral-of-cos-func 可埗 $ <|sin(n w t), sin(m w t)|> &= 1 /2 dot.c (Integral(-T/2, T/2, cos(n - m) w t, dif: t) - Integral(-T/2, T/2, cos(n+m) w t, dif:t) ) \ &= 1 / 2 dot.c (0 + 0) \ &= 0 $ 圓$m = n$时可埗 $ <|sin(n w t), sin(m w t)|> &= 1 /2 dot.c (Integral(-T/2, T/2, cos(n - m) w t, dif: t) - Integral(-T/2, T/2, cos(n+m) w t, dif:t) ) \ &= 1/ 2 dot.c (cIntegral(1) - cIntegral( cos(2 n w t) )) \ &= 1 / 2 dot.c T \ &= T / 2 $ 同理可埗 $ <|cos(n w t), cos(m w t)|> = cases( 0\, quad "if " n != m, T/2\, quad "if " n = m ) $ $ <|sin(n w t), cos(m w t)|> &= Integral(-T/2, T/2, 1/2 dot.c (sin(n + m) w t + sin(n - m) w t ), dif: t) \ $ 圓$n != m$时由 @def-integral-of-sin-func 可埗 $ <|sin(n w t), cos(m w t)|> = 0 $ 圓$n = m$时可埗 $ <|sin(n w t), cos(m w t)|> &= Integral(-T/2, T/2, 1/2 dot.c (sin(n + m) w t + sin(n - m) w t ), dif: t) \ &= cIntegral(1 / 2 sin(2 n w t)) \ &= 0 $ ] = 傅里叶级数 任意䞀䞪#im[呚期䞺$T$的凜数]郜可以展匀䞺䞍同频率的的正匊䞎䜙匊凜数的线性组合即 $ f(x) = sum_(n=0)^infinity (a_n sin n omega x + b_n cos n omega x) $ <eq-fourier-series> 对于@eq-fourier-series我们需芁求解系数$a_n$侎$b_n$。根据#im[傅里叶正亀凜数系的性莚]可知 圓$n > 0$时求解系数$a_n$时可以利甚公匏 $ <| f(x), sin(n omega x)|> &= Integral(-T/2, T/2, f(x) dot.c sin n omega x) \ &= cIntegral(sin n omega x dot.c (sum_(n = 0)^infinity (a_n sin n omega x + b_n cos n omega x)) ) \ &= sum_(n=0)^infinity (a_n dot.c cIntegral(sin n omega x dot.c sin n omega x) + b_n cIntegral(sin n omega x dot.c cos n omega x) ) \ &= a_n cIntegral(sin n omega x dot.c sin n omega x) \ &= a_n dot.c T / 2 $ 因歀可以埗到 $ a_n = 2 / T dot.c <| f(x), sin n omega x |> = 2 / T dot.c integral_(-T/2)^(T/2) f(x) dot.c sin n omega x dif x $ 同理对于系数$b_n$可以埗到 $ b_n = 2 / T dot.c <| f(x), cos n omega x |> = 2 / T dot.c integral_(-T/2)^(T/2) f(x) dot.c cos n omega x dif x $ 对于$n = 0$的特殊情况由于由于圓$n = 0$时 $ cases( sin n w t = 0, cos n w t = 1 ) $ å› æ­€@eq-fourier-series 䞭的项$a_0 dot.c sin (0 dot.c omega x)$没有意义系数$a_0$可以䞺任意倌。 对于项$b_0 dot.c cos(0 dot.c omega x)$而蚀其倌䞺$1$则系数$b_0$可以求解。对于系数$b_0$可以求埗 $ <| f(x), 1 |> &= Integral(-T/2, T/2, f(x) dot.c 1) \ &= cIntegral((sum_(i=0)^infinity (a_n sin n omega x + b_n cos n omega x)) dot.c 1) \ &= sum_(i=0)^(infinity) (a_n dot.c cIntegral(sin n omega x) + b_n dot.c cIntegral(cos n omega x)) quad (1"侎" sin n omega x, cos n omega x text("的凜数正亀性)") \ &= b_0 dot.c cIntegral(cos (0 dot.c omega x)) \ &= b_0 dot.c T $ 因歀可埗 $ b_0 = 1/T dot.c <| f(x), 1 |> = 1 / T dot.c integral_(-T/2)^(T/2) f(x) dif x $ #im[䞺了后续方䟿讚论以及统䞀圢匏系数的衚述圢匏]。@eq-fourier-series 䞭圓$n = 0$时的特殊垞数项$a_0 sin 0 + b_0 cos 0 = b_0$可以䜿甚单䞪垞数项来衚瀺即什 $ c_0 / 2 = a_0 sin 0 + b_0 cos 0 = b_0 $ 因歀@eq-fourier-series 可以衚述䞺 $ f(x) = c_0 / 2 + sum_(i=1)^infinity (a_n dot.c sin n omega x + b_n dot.c cos n omega x) $ <eq-fourier-series-general> 其䞭的系数可以䜿甚#im[统䞀的圢匏]来衚瀺䞺 $ cases( c_0 = 2 / T dot.c integral_(-T/2)^(T/2) f(x) dif x, a_n = 2 / T dot.c integral_(-T/2)^(T/2) f(x) dot.c sin n omega x dif x, b_n = 2 / T dot.c integral_(-T/2)^(T/2) f(x) dot.c cos n omega x dif x, ) $ <factors-of-fourier-series> = 倍数傅里叶级数 == 倍数傅里叶级数掚富 傅里叶级数䞭的每项$a_n sin n omega x + b_n cos n omega x$郜同时含有䞀䞪基凜数$sin n omega x$侎$cos n omega x$。#im[䞺了衚蟟的简单性我们需芁寻扟䞀种方匏来将每项䞭的䞀䞪基凜数衚瀺䞺单䞪基凜数。] 利甚欧拉公匏我们可以䜿甚倍数来同时衚瀺$sin n omega x$侎$cos n omega x$凜数。 欧拉公匏的数孊衚述䞺 $ e^(i x) = cos x + i sin x $ 变圢可以埗到 $ e^(-i x) = cos x - i sin x $ 因歀$sin x$侎$cos x$可以衚瀺䞺 $ cases( sin x = (e^(i x) - e^(-i x)) / (2 i), cos x = (e^(i x) + e^(- i x)) / 2 ) $ 因歀@eq-fourier-series-general 可以衚述䞺 $ f(x) &= c_0 / 2 + sum_(n=1)^infinity (a_n dot.c (e^(i n w x) - e^(-i n w x)) / (2 i) + b_n dot.c (e^(i n w x) + e^(-i n w x)) / 2) \ &= c_0 / 2 + sum_(n=1)^infinity (a_n dot.c (- i^2) / (2 i) (e^(i n w x) - e^(-i n w x)) + b_n / 2 dot.c (e^(i n w x) + e^(-i n w x))) \ &= c_0 / 2 + sum_(n=1)^infinity ((- i dot.c a_n) / (2) (e^(i n w x) - e^(-i n w x)) + b_n / 2 dot.c (e^(i n w x) + e^(-i n w x))) \ &= c_0 / 2 + sum_(n=1)^infinity ((- i dot.c a_n + b_n) / (2) dot.c e^(i n w x) + (i a_n + b_n) / 2 dot.c e^(-i n w x)) \ &= c_0 / 2 + sum_(n=1)^infinity ((- i dot.c a_n + b_n) / (2) dot.c e^(i n w x)) + sum_(n=1)^infinity ((i a_n + b_n) / 2 dot.c e^(-i n w x)) \ &= c_0 / 2 + sum_(n=1)^infinity ((- i dot.c a_n + b_n) / (2) dot.c e^(i n w x)) + sum_(n=-infinity)^(-1) ((i a_(-n) + b_(-n)) / 2 dot.c e^(i n w x)) \ $ <eq-complex-form-fourier-series-tmp> 圓$n = 0$时则$e^(i n omega x)$䞺 $ e^(i 0 w x) = cos 0 + i sin 0 = 1 $ å› æ­€@eq-complex-form-fourier-series-tmp 可以䜿甚倍数衚瀺䞺 $ f(x) = sum_(n = -infinity)^infinity d_n e^(i n omega x) $ å…¶äž­$d_n$䞺 $ d_n = cases( (-i a_n + b_n) / 2 &\, quad n > 0, 1/2 c_0 &\, quad n = 0, (i a_(-n) + b_(-n)) / 2 &\, quad n < 0 ) $ 将@factors-of-fourier-series 代入可以埗到 $ 1/2 c_0 &= 1 / 2 dot.c 2 / T Integral(-T/2, T/2, f(x)) \ &= 1 / T cIntegral(f(x) dot.c e^(-i n 0 x)) $ $ (-i a_n + b_n) / 2 &= 1 / 2 dot.c 2 / T dot.c Integral(-T/2, T/2, f(x) (-i sin n w x + cos n w x)) \ &= 1 / T dot.c cIntegral(f(x) dot.c e^(-i n omega x)) $ $ (i a_(-n) + b_(-n)) / 2 &= 1 / 2 dot.c 2 / T Integral(-T/2, T/2, f(x) (i sin (-n omega x) + cos(-n omega x))) \ &= 1 / T dot.c cIntegral(f(x) dot.c e^(-i n omega x)) $ 因歀参数$d_n$可以统䞀衚述䞺 $ d_n = 1 / T Integral(-T/2, T/2, f(x) e^(-i n omega x)) $ #definition("傅里叶级数的倍数圢匏")[ $ f(x) &= sum_(n=-infinity)^(infinity) d_n e^(i n omega x) \ &= sum_(n=-infinity)^(infinity) (1 / T dot.c integral_(-T/2)^(T/2) f(x) dot.c e^(-i n omega x) dif x) dot.c e^(i n omega x) $ ] == 倍数傅里叶级数的正亀凜数系 对于呚期䞺$T$的凜数$f(x)$从倍数域角床来讲呚期凜数$f(x)$可以衚瀺䞺实变倍倌凜数系$cal(R)$的线性组合其䞭凜数系$cal(R)$䞺 $ cal(R) = { e^(i n omega x) | n in Z} $ 因歀凜数$f(x)$可以衚瀺䞺 $ f(x) = sum_(-infinity)^(infinity) d_n dot.c e^(i n omega x) $ 对于凜数系$cal(R)$而蚀其定义的内积䞺Hermit内积劂 $ <| f(x), g(x) |> = 1 / T integral_(-T/2)^(T/2) f(x) dot.c overline(g(x)) dif x $ 事实䞊可以证明凜数系$cal(R)$是#im[规范正亀的]即 $ <| e^(i n omega x), e^(i m omega x) |> &= 1 / (T) Integral(-T/2, T/2, e^(i n omega x) dot.c overline(e^(i m omega x))) \ &= 1 / (T) cIntegral(e^(i n omega x) dot.c e^(-i m omega x)) \ &= 1 / (T) cIntegral(e ^(i (n - m) omega x)) $ 圓$n = m$时有 $ <| e^(i n omega x), e^(i m omega x) |> &= 1 / (T) Integral(-T/2, T/2, 1) \ &= 1 $ 圓$n != m$时有 $ <| e^(i n omega x), e^(i m omega x) |> &= 1 / T Integral(-T/2, T/2, e^(i (n - m) omega x)) \ &= 1 / T cIntegral(cos(n - m) omega x + i sin(n - m) omega x) \ &= 1 / T (cIntegral(cos(n - m) omega x) + i cIntegral(sin(n - m) omega x) ) \ &= 0 $ 因歀系数$d_n$可以通过hermit内积来进行求解 $ d_n &= <| f(x), e^(i n omega x) |> \ &= 1 / T Integral(-T/2, T/2, f(x) dot.c e^(-i n omega x)) $ = 附圕 == 䞉角凜数积化和差公匏 $ e^(i x) = cos x + i sin x $ <eq-euler-equation> 因歀可以埗到 $ cases( sin x = (e^(i x) - e^(- i x)) / (2 i ), cos x = (e^(i x) + e^(- i x)) / 2 ) $ <eq-sin-cos-form-of-eulur> $ cases( sin alpha dot.c sin beta = 1/2 (cos (alpha - beta) - cos (alpha + beta)), cos alpha dot.c cos beta = 1/2 (cos (alpha - beta) + cos(alpha + beta)), sin alpha dot.c cos beta = 1/2 (sin(alpha + beta) + sin(alpha - beta)) ) $ #linebreak() 以$sin alpha dot.c sin beta$䞺䟋䜿甚@eq-euler-equation 进行证明。 #proof[ #let eulur_expr = (a, b, o) => $e^(#a) #o e^(#b)$ 将@eq-sin-cos-form-of-eulur 垊入 $sin alpha dot.c sin beta$䞭埗到 $ sin alpha dot.c sin beta &= (#eulur_expr($i alpha$, $- i alpha$, $-$)) / (2 i) dot.c (#eulur_expr($i beta$, $-i beta$, $-$)) / (2 i) \ &=((e^(i (alpha + beta)) - e^(i (alpha - beta)) ) - (e^(-i (alpha - beta)) - e^(-i (alpha + beta)))) / (-4) \ &= ((e^(i (alpha + beta)) + e^(-i (alpha + beta)) ) - (e^(i (alpha - beta)) + e^(-i (alpha - beta)))) / (-4) \ &= -1/4 (2 dot.c cos(alpha + beta) - 2 dot.c cos(alpha - beta)) \ &= 1/2 (cos(alpha - beta) - cos(alpha + beta)) $ 证明完成。 ] == 䞉角凜数的内积 #definition("䞉角凜数的积分")[ 䞉角凜数$sin w t $侎$cos w t$圚呚期$[-T/2, T/2]$内的积分䞺0即 $ integral_(-T/2)^(T/2) sin w t dif t = 0 \ integral_(-T/2)^(T/2) cos w t dif t = 0 \ $ å…¶äž­$w = (2 pi) / T$$T$䞺䞉角凜数$sin(w t)$侎$cos (w t)$的最小呚期。 ] #proof[ $ Integral(-T/2, T/2, sin w t, dif: t) &= lr(-1 / w cos w t |)_(-T/2)^(T/2) \ &= -1/w ( cos ((2 pi) / T dot.c T / 2) - cos((2 pi) / T dot.c -T / 2 )) \ &= -1 / w (cos pi - cos(-pi)) \ &= 0 $ <def-integral-of-sin-func> $ Integral(-T/2, T/2, cos w t, dif: t) &= lr(1 / w sin w t |)_(-T/2)^(T/2) \ &= 1/w ( sin ((2 pi) / T dot.c T / 2) - sin((2 pi) / T dot.c -T / 2 )) \ &= 1 / w (sin pi - sin(-pi)) \ &= 0 $ <def-integral-of-cos-func> ] #lemma("䞉角圢呚期凜数的积分")[ 劂果䞉角凜数$sin w t$或$cos w t$的最小呚期䞺$T$其频率$w = (2 pi) / T$则凜数$sin n w t$或者$cos n w t$的圚呚期$[-T/2, T/2]$䞊的积分䞺0即 $ integral_(-T/2)^(T/2) sin n w t dif t = integral_(-T/2)^(T/2) cos n w t dif t = 0 $ ] #proof[ 以$sin n w t$䞺䟋进行证明$cos n w t$的情况类䌌。 什$w' = n w$则凜数$sin n w t = sin w' t$则$T' = T / n$则根据 @def-integral-of-sin-func 以及$sin$凜数的呚期性可埗 $ integral_(-T/2)^(T/2) sin n w t dif t &= integral_(-n T'/2)^(n T'/2) sin w' t dif t'\ &= sum_(k = 0)^n integral_(k T' - T'/2)^(k T' + T'/2) sin w' t dif t'\ &= sum_(k = 0)^n dot.c 0 \ &= 0 $ ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/modern-cv/0.1.0/README.md
markdown
Apache License 2.0
# Modern CV [![say thanks](https://img.shields.io/badge/Say%20Thanks-👍-1EAEDB.svg)](https://github.com/DeveloperPaul123/modern-cv/stargazers) [![Discord](https://img.shields.io/discord/652515194572111872?logo=Discord)](https://discord.gg/CX2ybByRnt) ![Release](https://img.shields.io/github/v/release/DeveloperPaul123/modern-cv) A port of the [Awesome-CV](https://github.com/posquit0/Awesome-CV) Latex resume template in [typst](https://github.com/typst/typst). ## Requirements You will need the `Roboto` and `Source Sans Pro` fonts installed on your system or available somewhere. If you are using the `typst` web app, no further action is necessary. You can download them from the following links: - [Roboto](https://fonts.google.com/specimen/Roboto) - [Source Sans Pro](https://github.com/adobe-fonts/source-sans-pro) This template also uses FontAwesome icons via the `[fontawesome](https://typst.app/universe/package/fontawesome)` package. See `typst fonts --help` for more information on configuring fonts for `typst` that are not installed on your system. ### Usage Below is a basic example for a simple resume: ```typst #import "@preview/modern-cv:0.1.0": * #show: resume.with( author: ( firstname: "John", lastname: "Smith", email: "<EMAIL>", phone: "(+1) 111-111-1111", github: "DeveloperPaul123", linkedin: "Example", address: "111 Example St. Example City, EX 11111", positions: ( "Software Engineer", "Software Architect" ) ), date: datetime.today().display() ) = Education #resume_entry( title: "Example University", location: "B.S. in Computer Science", date: "August 2014 - May 2019", description: "Example" ) #resume_item[ - #lorem(20) - #lorem(15) - #lorem(25) ] ``` ### Output | | | | --- | --- | | ![Resume](resume.png) | ![Coverletter](coverletter.png) |
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/visualize/path.typ
typst
// Test paths. --- path --- #set page(height: 300pt, width: 200pt) #table( columns: (1fr, 1fr), rows: (1fr, 1fr, 1fr), align: center + horizon, path( fill: red, closed: true, ((0%, 0%), (4%, -4%)), ((50%, 50%), (4%, -4%)), ((0%, 50%), (4%, 4%)), ((50%, 0%), (4%, 4%)), ), path( fill: purple, stroke: 1pt, (0pt, 0pt), (30pt, 30pt), (0pt, 30pt), (30pt, 0pt), ), path( fill: blue, stroke: 1pt, closed: true, ((30%, 0%), (35%, 30%), (-20%, 0%)), ((30%, 60%), (-20%, 0%), (0%, 0%)), ((50%, 30%), (60%, -30%), (60%, 0%)), ), path( stroke: 5pt, closed: true, (0pt, 30pt), (30pt, 30pt), (15pt, 0pt), ), path( fill: red, fill-rule: "non-zero", closed: true, (25pt, 0pt), (10pt, 50pt), (50pt, 20pt), (0pt, 20pt), (40pt, 50pt), ), path( fill: red, fill-rule: "even-odd", closed: true, (25pt, 0pt), (10pt, 50pt), (50pt, 20pt), (0pt, 20pt), (40pt, 50pt), ), ) --- path-bad-vertex --- // Error: 7-9 path vertex must have 1, 2, or 3 points #path(()) --- path-bad-point-count --- // Error: 7-47 path vertex must have 1, 2, or 3 points #path(((0%, 0%), (0%, 0%), (0%, 0%), (0%, 0%))) --- path-bad-point-array --- // Error: 7-31 point array must contain exactly two entries #path(((0%, 0%), (0%, 0%, 0%))) --- issue-path-in-sized-container --- // Paths used to implement `LayoutMultiple` rather than `LayoutSingle` without // fulfilling the necessary contract of respecting region expansion. #block( fill: aqua, width: 20pt, height: 15pt, path( (0pt, 0pt), (10pt, 10pt), ), )
https://github.com/rdboyes/resume
https://raw.githubusercontent.com/rdboyes/resume/main/cv.typ
typst
// Imports #import "@preview/brilliant-cv:2.0.2": cv #import "@preview/fontawesome:0.4.0" #let metadata = toml("./metadata.toml") #let importModules(modules, lang: metadata.language) = { for module in modules { include { "modules_" + lang + "/" + module + ".typ" } } } #show: cv.with( metadata ) #importModules(( "professional", "education", "publications", "skills", ))
https://github.com/alex-touza/fractal-explorer
https://raw.githubusercontent.com/alex-touza/fractal-explorer/main/paper/test.typ
typst
// unnumbered title page if needed // ... Title #pagebreak() // front-matter #set page(numbering: "I") #counter(page).update(1) // ... Acknowledgments #pagebreak() #outline() // page counter anchor #metadata(()) <front-matter> #pagebreak() // main document body #set page(numbering: "1") #counter(page).update(1) /* HERE. Still using Roman numbers instead of Arabic. */ = Something #lorem(4000) // back-matter #set page(numbering: "I") // must take page breaks into account, may need to be offset by +1 or -1 #context counter(page).update(counter(page).at(<front-matter>).first() + 1) = Glossary #lorem(50)
https://github.com/tilman151/pypst
https://raw.githubusercontent.com/tilman151/pypst/main/docs/examples/document/template.typ
typst
MIT License
#import "@preview/charged-ieee:0.1.0": ieee #show: ieee.with( title: [Using Templates with Pypst], abstract: [#lorem(100)], authors: ( ( name: "Alice", department: [Co-Author], organization: [Best University], email: "<EMAIL>" ), ( name: "Bob", department: [Co-Author], organization: [Best University], email: "<EMAIL>" ), ), index-terms: ("Scientific writing", "Typesetting", "Document creation", "Syntax") ) // include generated file #include("my-document.typ")
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/02-concepts/dimension/devanagari.typ
typst
Other
#import "/lib/draw.typ": * #import "/lib/glossary.typ": tr #import "/template/lang.typ": devanagari #let start = (0, 0) #let end = (1000, 260) #let (basex, basey) = (120, 70) #let width = 740 #let example = devanagari[à€Ÿà€Ÿà€‡à€ªà¥‹à€—à¥ #h(-0.25em)à€°à€Ÿà€«à¥€] #let graph = with-unit((ux, uy) => { // mesh(start, end, (100, 100), stroke: 1 * ux + gray) let lines = ( ([变音笊号线], "rb", end.at(0), basex, basey + 153), ([#tr[headline]], "lb", 0, basex + width, basey + 100), ([#tr[baseline]], "lb", 0, basex + width, basey), ([半音笊号线], "rb", end.at(0), basex, basey - 50), ) for (body, anchor, xs, xe, y) in lines { segment((xs, y), (xe, y), stroke: 2 * ux + gray.darken(30%)) txt(body, (xs, y), anchor: anchor, size: 25 * ux, dy: 4) } txt(example, (basex, basey), anchor: "lb", size: 170 * ux) }) #canvas(end, start: start, width: 90%, graph)
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-A840.typ
typst
Apache License 2.0
#let data = ( ("PHAGS-PA LETTER KA", "Lo", 0), ("PHAGS-PA LETTER KHA", "Lo", 0), ("PHAGS-PA LETTER GA", "Lo", 0), ("PHAGS-PA LETTER NGA", "Lo", 0), ("PHAGS-PA LETTER CA", "Lo", 0), ("PHAGS-PA LETTER CHA", "Lo", 0), ("PHAGS-PA LETTER JA", "Lo", 0), ("PHAGS-PA LETTER NYA", "Lo", 0), ("PHAGS-PA LETTER TA", "Lo", 0), ("PHAGS-PA LETTER THA", "Lo", 0), ("PHAGS-PA LETTER DA", "Lo", 0), ("PHAGS-PA LETTER NA", "Lo", 0), ("PHAGS-PA LETTER PA", "Lo", 0), ("PHAGS-PA LETTER PHA", "Lo", 0), ("PHAGS-PA LETTER BA", "Lo", 0), ("PHAGS-PA LETTER MA", "Lo", 0), ("PHAGS-PA LETTER TSA", "Lo", 0), ("PHAGS-PA LETTER TSHA", "Lo", 0), ("PHAGS-PA LETTER DZA", "Lo", 0), ("PHAGS-PA LETTER WA", "Lo", 0), ("PHAGS-PA LETTER ZHA", "Lo", 0), ("PHAGS-PA LETTER ZA", "Lo", 0), ("PHAGS-PA LETTER SMALL A", "Lo", 0), ("PHAGS-PA LETTER YA", "Lo", 0), ("PHAGS-PA LETTER RA", "Lo", 0), ("PHAGS-PA LETTER LA", "Lo", 0), ("PHAGS-PA LETTER SHA", "Lo", 0), ("PHAGS-PA LETTER SA", "Lo", 0), ("PHAGS-PA LETTER HA", "Lo", 0), ("PHAGS-PA LETTER A", "Lo", 0), ("PHAGS-PA LETTER I", "Lo", 0), ("PHAGS-PA LETTER U", "Lo", 0), ("PHAGS-PA LETTER E", "Lo", 0), ("PHAGS-PA LETTER O", "Lo", 0), ("PHAGS-PA LETTER QA", "Lo", 0), ("PHAGS-PA LETTER XA", "Lo", 0), ("PHAGS-PA LETTER FA", "Lo", 0), ("PHAGS-PA LETTER GGA", "Lo", 0), ("PHAGS-PA LETTER EE", "Lo", 0), ("PHAGS-PA SUBJOINED LETTER WA", "Lo", 0), ("PHAGS-PA SUBJOINED LETTER YA", "Lo", 0), ("PHAGS-PA LETTER TTA", "Lo", 0), ("PHAGS-PA LETTER TTHA", "Lo", 0), ("PHAGS-PA LETTER DDA", "Lo", 0), ("PHAGS-PA LETTER NNA", "Lo", 0), ("PHAGS-PA LETTER ALTERNATE YA", "Lo", 0), ("PHAGS-PA LETTER VOICELESS SHA", "Lo", 0), ("PHAGS-PA LETTER VOICED HA", "Lo", 0), ("PHAGS-PA LETTER ASPIRATED FA", "Lo", 0), ("PHAGS-PA SUBJOINED LETTER RA", "Lo", 0), ("PHAGS-PA SUPERFIXED LETTER RA", "Lo", 0), ("PHAGS-PA LETTER CANDRABINDU", "Lo", 0), ("PHAGS-PA SINGLE HEAD MARK", "Po", 0), ("PHAGS-PA DOUBLE HEAD MARK", "Po", 0), ("PHAGS-PA MARK SHAD", "Po", 0), ("PHAGS-PA MARK DOUBLE SHAD", "Po", 0), )
https://github.com/suiranruofeng/notebook
https://raw.githubusercontent.com/suiranruofeng/notebook/main/GW/匕力䞎匕力波.typ
typst
#align(center, text(17pt)[*General Relativity: Gravitational wave and Cosmology Notebook*]) #align(center)[XuweiZhang \ #link("<EMAIL>")] #set heading(numbering: "1.") = 等效原理 == 等效原理的衚述 圚自由䞋萜的升降机里无法检验皳定均匀的静态倖匕力场因䞺向䞋的匕力和向䞊的惯性力盞互抵消了。对于䞀般的运劚我们对于$N$䞪莚点的系统圚倖力$bold(F)(bold(x)_N-bold(x)_M)$和倖匕力场$bold(g)$的䜜甚䞋 $ m_N (d^2bold(x)_N)/(d t^2)=m_N bold(g)+sum_M bold(F)(bold(x)_N-bold(x)_M) $ 假定我们䜜䞀䞪时空坐标变换 $ x'=x-1/2g t^2,space t'=t $ 这样$bold(g)$就被惯性力所抵消运劚方皋变䞺 $ m_N (d^2 bold(x')_N)/(d t'^2)=sum_M bold(F)(bold(x')_N-bold(x')_M) $ 这就是自由䞋萜坐标系。 == 坐标变换䞎联络 == 床规匠量
https://github.com/francescoo22/LCD-exercises
https://raw.githubusercontent.com/francescoo22/LCD-exercises/main/src/M.typ
typst
#import "common.typ": * #import "rules.typ": * = Exercise M Discuss an extension of CCS with an operator of sequential composition between processes $P; Q$. Provide an operational semantics and analyze the possibility of having an encoding in CCS of the defined operator. *Solution* == $CCS_seq$ $ P, Q ::= K | alpha . P | sum_(i in I) alpha . P_i | (P | Q) | P[f] | P without L | P;Q $ == Operational Semantics #v(2em) *Classical rules* #grid( columns: (auto, auto, auto), column-gutter: 1fr, row-gutter: 2em, c1, c2, c3, c4, c5, c6, c7, c8 ) #v(2em) *$CCS_seq$ rules* #grid( columns: (auto, auto, auto), column-gutter: 1fr, row-gutter: 2em, r1, r2, r3, r4, r5, r6, r7, r8 ) #include "encoding.typ" #include "lemmas.typ" == Equivalence $ forall P in CCS_seq . P approx e(P) wnu $ let $ cr = {(P, Q wnu) | P, Q in CCS_seq , Q approx e(P)} $ we need to prove that $cr$ is a weak bisimulation i.e. - $forall P in CCS_seq . fi P atrans P' then e(P) wnu awtrans P'' wnu and P' cr (P'' wnu)$ - $forall P in CCS_seq . fi e(P) wnu atrans P'' wnu then P awtrans P' and P' cr (P'' wnu)$ The proof is done by induction on the height of the derivation tree, so we can rewrite it as follows: - $forall P in CCS_seq . forall h in NN . fi P atrans P' "with tree of height" h then e(P) wnu awtrans P'' wnu and P' cr (P'' wnu)$ - $forall P in CCS_seq . forall h in NN . fi e(P) wnu atrans P'' wnu "with tree of height" h then P awtrans P' and P' cr (P'' wnu)$ === First point *base case h=1* The only way a process can make a transition with derivation tree of height 1 is $ c1 $ and in this case also $ p1 $ and $P cr (e(P) wnu)$ because $e(P) approx e(P)$ *inductive case Const* if $ c8 $ $=>^"by induction" e(P) wnu atrans P'' wnu "and" P' cr (P'' wnu)$ $=> e(P) atrans P''$ so #v(1em) $ p2 $ and $P' cr (P'' wnu)$ *inductive case Hide* if $ c6 $ $=>^"by induction" e(P) wnu awtrans P'' wnu "and" P' cr (P'' wnu)\ =>^"relation" P'' approx e(P')\ =>^"only rule" e(P) awtrans P''$ $ p3 $ I have to prove that $P' wL cr P'' wL wnu$ i.e. $P'' wL approx e(P' wL)$ $ P'' wL approx^(P'' approx e(P')) e(P') wL = e(P' wL) $ *inductive case Red* if $ c7 $ $=>^"by induction" e(P) wnu awtrans P'' wnu "and" P' cr (P'' wnu)\ =>^"only rule" e(P) awtrans P''$ and so $ p4 $ and $P''[f] approx^(P'' approx e(P')) e(P') [f] = e(P' [f]) => P'[f] cr P''[f] wnu$ *Inductive case Sum* Sum case is trivial because if $ p5 $ also $ p6 $ and $P_j cr (e(P_j) wnu)$. *Inductive case Par-1/Par-2/Par-3* If $ c3 $ $=>^"by induction" e(P) wnu atrans P'' wnu "and" P' cr (P'' wnu)$ $=> e(P) atrans P''$ and so $ p7 $ #v(1em) we need to show that $(P'|Q) cr (P''[nu'/nu] | e(Q)[nu'/nu] | overline(nu') . overline(nu') . nu . 0) wnup wnu$ which is equivalent to show that $(P''[nu'/nu] | e(Q)[nu'/nu] | overline(nu') . overline(nu') . nu . 0) wnup approx e(P'|Q)$ $ P' cr P'' wnu =>^(cr "definition") P'' approx e(P') \ =>^"bisim properties" (P''[nu'/nu] | e(Q)[nu'/nu] | overline(nu') . overline(nu') . nu . 0) wnup approx (e(P')[nu'/nu] | e(Q)[nu'/nu] | overline(nu') . overline(nu') . nu . 0) wnup = e(P'|Q) $ Par-2 and Par-3 are similar *Inductive case Seq-L* If $ r7 $ $=>^"by induction" e(P) wnu atrans P'' wnu "and" P' cr (P'' wnu)$ $=> e(P) atrans P''$ and so $ p8 $ #v(1em) we need to show that $(P';Q) cr (P''[nu'/nu] | overline(v') . e(Q)) wnup wnu$ which is equivalent to show that $(P''[nu'/nu] | overline(v') . e(Q)) wnup approx e(P';Q)$ $ P' cr P'' wnu =>^(cr "definition") P'' approx e(P') \ =>^"bisim properties" (P''[nu'/nu] | overline(v') . e(Q)) wnup approx (e(P')[nu'/nu] | overline(v') . e(Q)) wnup = e(P';Q) $ *Inductive case Seq-R* If $ r8 $ $P ended =>^"lemma 0" e(P) ->^(tau*) P_"temp" ntrans P' and P' ended$ $Q atrans Q'=>^"by induction" e(Q) wnu atrans Q'' wnu "and" Q' cr (Q'' wnu) => e(Q) atrans Q''$ and so $ p9 $ #v(2em) $ p10 $ #v(2em) $ p11 $ #v(2em) Now I have to prove that $Q' cr (P' [nu'/nu] | Q'') wnup wnu$ Which is equivalent to prove that $(P' [nu'/nu] | Q'') wnup approx e(Q')$ $ P' ended =>^"End-Red" P'[nu'/nu] ended =>^"lemma 3" P'[nu'/nu] approx 0 \ => (P' [nu'/nu] | Q'') wnup approx (0 | Q'') wnup approx^(Q'' approx e(Q')) (0 | e(Q')) wnup approx^"lemma 4" 0 | e(Q') approx e(Q') $
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/PianoDiProgetto/sections/ConsuntivoSprint/UndicesimoSprint.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 ==== Undicesimo consuntivo *Inizio*: Venerdì 01/03/2024 *Fine*: Giovedì 07/03/2024 #rendicontazioneOreAPosteriori(sprintNumber: "11") #rendicontazioneCostiAPosteriori(sprintNumber: "11") ===== Analisi a posteriori La retrospettiva ha evidenziato come il totale delle ore preventivato per questo #glossary("sprint") si possa dire rispettato. La differenza tra preventivo e consuntivo Ú infatti pari a tre ore, che sul totale preventivato di 60 ore lavorative costituiscono un distacco pari al 5%, più che accettabile. Si vuole evidenziare come nel corso di questo #glossary("sprint"), per la prima volta, ciascun componente del team abbia totalizzato una media di quasi 10 ore produttive. Questo Ú coerente con la disponibilità espressa dal team dopo la prima revisione #glossary[RTB] e con la necessità di ogni membro di raggiungere la seconda revisione #glossary[PB] avendo impiegato almeno 80 ore produttive, il minimo per poter concludere il progetto. L'unica differenza significativa tra preventivo e consuntivo si può ritrovare nelle ore del ruolo di Amministratore: si era infatti erroneamente sottostimata la dimensione, in termini di ore produttive, delle task assegnate agli Amministratori. È stato inoltre rilevato che le ore assegnate all'attività di revisione, sebbene complessivamente non dissimili da quelle consuntivate, sono state distribuite su un numero esiguo di membri. Per questo motivo, nei prossimi #glossary[sprint] sarà bene distribuire il carico di lavoro su un numero maggiore di persone, evitando di concentrarlo solamente su alcuni individui. Infatti, designando ripetutamente gli stessi membri del team come Verificatori, si rischia di limitare la diversità di prospettive applicate al processo di verifica, portando ad una mancanza di identificazione di potenziali problemi o miglioramenti e, a lungo andare, ad un abbassamento della qualità del lavoro svolto. ===== Aggiornamento della pianificazione e gestione dei rischi Nel corso dello #glossary("sprint") in oggetto si Ú manifestato il rischio tecnologico RT1 o conoscenza tecnologica limitata: tale rischio si Ú concretizzato nell'utilizzo dello strumento Pydantic. Tuttavia, considerando il ruolo non centrale di tale libreria nell'#glossary[architettura] del progetto, il team ha optato per la sua rimozione. In questo caso le misure preventive individuate non sono state efficaci nell'eludere il rischio: il team, sottovalutando la complessità dello strumento, non aveva immaginato che potesse creare dei rallentamenti nello sviluppo e, di conseguenza, non ha applicato le misure preventive individuate. Come enunciato nell'analisi sopra, si Ú anche manifestato il rischio di comunicazione RC6 o ripetizioni nelle assegnazioni del ruolo di Verificatore: in particolare, sarebbe bene evitare scenari in cui gli stessi componenti del team vengono incaricati di verificare la #glossary[documentazione] ripetutamente, mentre altri il codice, senza che questi si scambino mai tali responsabilità; in futuro, dunque, il team ha intenzione di adottare una rotazione più efficace del ruolo, come delineato nelle misure preventive del rischio. Il team ha inoltre rilevato l'esigenza di intensificare il dialogo con la Proponente: nonostante le misure preventive per il rischio di comunicazione RC3 (frequenza limitata nella comunicazione con la Proponente), siano chiare riguardo alla necessità di mantenere una frequenza di incontri, e di conseguente ricezione di feedback, perlomeno settimanale, non vi Ú stato alcun tipo di comunicazione con l'azienda da all'incirca due settimane. Di conseguenza, si Ú rimarcata la volontà di organizzare un incontro al più presto e, possibilmente, di reintrodurre la frequenza settimanale che ha caratterizzato il periodo antecedente l'#glossary[RTB]. Infine, nonostante non si sia propriamente manifestato il rischio di pianificazione RP3 o "Variazioni nei tempi e costi del progetto", la decisione del team di non effettuare la terza revisione #glossary[CA] (rintracciabile nel verbale interno del 04/03) ha comunque avuto un impatto sulla pianificazione: infatti, se nel preventivo a finire redatto in occasione dell' #glossary[RTB] erano state dedicate alcune risorse allo svolgimento della #glossary[CA], ora queste sono utilizzabili in preparazione alla #glossary[PB]. Perciò non solo viene aggiornata la pianificazione all'interno del _Piano di Progetto_ aumentando le ore produttive a disposizione per determinati ruoli (Responsabile, Amministratore, Programmatore e Verificatore), ma il team ha anche intenzione di aumentare ulteriormente il ritmo di lavoro per sfruttare efficacemente le risorse aggiuntive a disposizione.
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/visualize/shape-ellipse-00.typ
typst
Other
// Default ellipse. #ellipse()
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/stonewall/0.1.0/example/example.typ
typst
Apache License 2.0
#import "../stonewall.typ": flags #set page(width: 200pt, height: auto, margin: 0pt) #set text(fill: black, size: 12pt) #set text(top-edge: "bounds", bottom-edge: "bounds") #stack( spacing: 3pt, ..flags.map(((name, preset)) => block( width: 100%, height: 20pt, fill: gradient.linear(..preset), align(center + horizon, smallcaps(name)), )) )
https://github.com/MattiaOldani/Informatica-Teorica
https://raw.githubusercontent.com/MattiaOldani/Informatica-Teorica/master/capitoli/calcolabilità/04_cardinalità.typ
typst
#import "../alias.typ": * #import "@preview/lemmify:0.1.5": * #let ( theorem, lemma, corollary, remark, proposition, example, proof, rules: thm-rules ) = default-theorems("thm-group", lang: "it") #show: thm-rules #show thm-selector("thm-group", subgroup: "theorem"): it => block( it, stroke: red + 1pt, inset: 1em, breakable: true ) #show thm-selector("thm-group", subgroup: "proof"): it => block( it, stroke: green + 1pt, inset: 1em, breakable: true ) = Cardinalità == Isomorfismi Due insiemi $A$ e $B$ sono *isomorfi* (_equinumerosi_) se esiste una biiezione tra essi. Formalmente scriviamo: $ A tilde B. $ Detto $cal(U)$ l'insieme di tutti gli insiemi, la relazione $tilde$ Ú sottoinsieme di $cal(U)^2$. Dimostriamo che $tilde$ Ú una relazione di equivalenza: - *riflessività*: $A tilde A$, usiamo come biiezione la funzione identità $i_A$; - *simmetria*: $A tilde B arrow.long.double B tilde A$, usiamo come biiezione la funzione inversa; - *transitività*: $A tilde B and B tilde C arrow.long.double A tilde C$, usiamo come biiezione la composizione della funzione usata per $A tilde B$ con la funzione usata per $B tilde C$. Dato che $tilde$ Ú una relazione di equivalenza, ci permette di partizionare l'insieme $cal(U)$. La partizione che ne risulta Ú formata da classi di equivalenza che contengono insiemi isomorfi, ossia con la stessa cardinalità. Possiamo, quindi, definire la *cardinalità* come l'insieme quoziente di $cal(U)$ rispetto alla relazione $tilde$. Questo approccio permette di confrontare tra loro la cardinalità di insiemi infiniti, dato che basta trovare una funzione biettiva tra i due insiemi per poter affermare che siano isomorfi. == Cardinalità finita La prima classe di cardinalità che vediamo Ú quella delle *cardinalità finite*. Definiamo la seguente famiglia di insiemi: $ J_n = cases(emptyset & text(" se ") n = 0, {1,...,n} & text(" se ") n > 0) quad . $ Diremo che un insieme $A$ ha cardinalità finita se e solo se $A tilde J_n$ per qualche $n in NN$. In tal caso possiamo scrivere $|A| = n$. La classe di equivalenza $[J_n]_tilde$ identifica tutti gli insiemi di $cal(U)$ contenenti $n$ elementi. == Cardinalità infinita L'altra classe di cardinalità Ú quella delle *cardinalità infinite*, ovvero gli insiemi non in relazione con $J_n$. Questi insiemi sono divisibili in: - insiemi *numerabili*; - insiemi *non numerabili*. Analizziamo le due tipologie separatamente. === Insiemi numerabili Un insieme $A$ Ú numerabile se e solo se $A tilde NN$, ovvero $A in [NN]_tilde$. Gli insiemi numerabili vengono detti anche "*listabili*", in quanto Ú possibile elencare _tutti_ gli elementi dell'insieme $A$ tramite una regola, la funzione $f$ biettiva tra $NN$ e $A$. Grazie alla funzione $f$, Ú possibile elencare gli elementi di $A$ formando l'insieme: $ A = {f(0), space f(1), space dots}. $ Questo insieme Ú esaustivo, dato che elenca ogni elemento dell'insieme $A$ senza perderne nessuno. Tra gli insiemi numerabili più famosi troviamo: - numeri pari $PP$ e numeri dispari $DD$; - numeri interi $ZZ$, generati con la biiezione $f(n) = (-1)^n (frac(n + (n mod 2), 2))$; - numeri razionali $QQ$. Gli insiemi numerabili hanno cardinalità $aleph_0$ (si legge _"aleph zero"_). === Insiemi non numerabili Gli *insiemi non numerabili* sono insiemi a cardinalità infinita ma che non sono listabili come gli insiemi numerabili: sono "più fitti" di $NN$. Questo significa che ogni lista generata mancherebbe di qualche elemento e, quindi, non sarebbe esaustiva di tutti gli elementi dell'insieme. Il più famoso insieme non numerabile Ú l'insieme dei numeri reali $RR$. #theorem(numbering: none)[ L'insieme $RR$ non Ú numerabile ($RR tilde.not NN$). ] #proof[ \ Suddividiamo la dimostrazione in tre punti: + dimostriamo che $RR tilde (0,1)$; + dimostriamo che $NN tilde.not (0,1)$; + dimostriamo che $RR tilde.not NN$. [1] Partiamo con il dimostrare che $RR tilde (0,1)$: serve trovare una biiezione tra $RR$ e $(0,1)$. Usiamo una rappresentazione grafica, costruita in questo modo: - disegnare la circonferenza di raggio $1/2$ centrata in $1/2$; - disegnare la perpendicolare al punto da mappare che interseca la circonferenza; - disegnare la semiretta passante per il centro $C$ e l'intersezione precedente. L'intersezione tra l'asse reale e la retta finale Ú il punto mappato. #v(-36pt) #figure( image("assets/biiezione.svg", width: 70%) ) #v(12pt) In realtà, questo approccio ci permette di dire che $RR$ Ú isomorfo a qualsiasi segmento di lunghezza maggiore di 0.\ La stessa biiezione vale anche sull'intervallo chiuso $[0,1]$, utilizzando la "compattificazione" $overset(RR, .) = RR union {plus.minus infinity}$ e mappando $0$ su $-infinity$ e $1$ su $+infinity$. [2] Continuiamo dimostrando che $NN tilde.not (0,1)$: serve dimostrare che l'intervallo $(0,1)$ non Ú listabile, quindi che ogni lista che scrivo manca di almeno un elemento e per farlo proveremo a "costruire" proprio questo elemento.\ Per assurdo, sia $NN tilde (0,1)$. Allora, possiamo listare gli elementi di $(0,1)$ esaustivamente come: $ 0.& space a_(00) space a_(01) space a_(02) space dots \ 0.& space a_(10) space a_(11) space a_(12) space dots \ 0.& space a_(20) space a_(21) space a_(22) space dots \ 0.& space dots quad , $ dove con $a_(i j)$ indichiamo la cifra di posto $j$ dell'$i$-esimo elemento della lista. Costruiamo il numero $c = 0.c_0 c_1 c_2 dots$ tale che $ c_i = cases(2 quad & "se" a_(i i) eq.not 2, 3 & "se" a_(i i) = 2) quad . $ In altre parole, questo numero viene costruito "guardando" le cifre sulla diagonale principale. Questo numero appartiene a $(0,1)$, ma non appare nella lista scritta sopra: ogni cifra $c_i$ del numero costruito differisce per almeno una posizione (quella sulla diagonale principale) da qualunque numero nella lista. Questo Ú assurdo, visto che avevamo assunto $(0,1)$ numerabile $arrow.long.double NN tilde.not (0,1)$. [3] Terminiamo dimostrando che $RR tilde.not NN$ per transitività. Più in generale, non si riesce a listare nessun segmento di lunghezza maggiore di 0. ] Questo tipo di dimostrazione (in particolare il punto [2]) Ú detta *dimostrazione per diagonalizzazione*. L'insieme $RR$ viene detto *insieme continuo* e tutti gli insiemi isomorfi a $RR$ si dicono a loro volta continui. I più famosi insiemi continui sono: - $RR$: insieme dei numeri reali; - $CC$: insieme dei numeri complessi; - $TT subset II$: insieme dei numeri trascendenti. Vediamo due insiemi continui che saranno importanti successivamente. === Insieme delle parti Il primo insieme che vediamo Ú l'*insieme delle parti* di $NN$, detto anche _power set_, ed Ú così definito: $ P(NN) = 2^NN = {S bar.v S "Ú sottoinsieme di" NN}. $ #theorem(numbering: none)[ $P(NN) tilde.not NN$. ] #proof[ \ Dimostriamo questo teorema tramite diagonalizzazione. Il *vettore caratteristico* di un sottoinsieme Ú un vettore che nella posizione $p_i$ ha $1$ se $i in A$, altrimenti ha $0$. Rappresentiamo il sottoinsieme $A subset.eq NN$ sfruttando il suo vettore caratteristico: $ NN&: 0 space 1 space 2 space 3 space 4 space 5 space 6 space dots \ A&: 0 space 1 space 1 space 0 space 1 space 1 space 0 space dots quad . $ Per assurdo, sia $P(NN)$ numerabile. Vista questa proprietà, possiamo listare tutti i vettori caratteristici che appartengono a $P(NN)$ come: $ b_0 &= b_(00) space b_(01) space b_(02) space dots \ b_1 &= b_(10) space b_(11) space b_(12) space dots \ b_2 &= b_(20) space b_(21) space b_(22) space dots quad . $ Vogliamo costruire un vettore che appartenga a $P(NN)$, ma non Ú presente nella lista precedente. Definiamo il seguente: $ c = overline(b_(00)) space overline(b_(11)) space overline(b_(22)) dots $ che contiene nella posizione $c_i$ il complemento di $b_(i i)$. Questo vettore appartiene a $P(NN)$ (perché rappresenta sicuramente un suo sottoinsieme), ma non Ú presente nella lista precedente perché Ú diverso da ogni elemento in almeno una cifra, quella sulla diagonale principale. Questo Ú assurdo perché abbiamo assunto che $P(NN)$ fosse numerabile, quindi $P(NN) tilde.not NN$. ] Visto questo teorema possiamo concludere che: $ P(NN) tilde [0,1] tilde overset(RR, .). $ === Insieme delle funzioni Il secondo insieme che vediamo Ú l'*insieme delle funzioni* da $NN$ in $NN$ così definito: $ NN_bot^NN = {f: NN arrow.long NN}. $ #theorem(numbering: none)[ $NN_bot^NN tilde.not NN$. ] #proof[ \ Anche in questo caso useremo la diagonalizzazione. Per assurdo, assumiamo $NN_bot^NN$ numerabile. Possiamo, quindi, listare $NN_bot^NN$ come ${f_0, f_1, f_2, dots}$. #align(center)[ #table( columns: (10%, 15%, 15%, 15%, 15%, 15%, 15%), inset: 10pt, align: horizon, [], [$0$], [$1$], [$2$], [$3$], [$dots$], [$NN$], [$f_0$], [$f_0 (0)$], [$f_0 (1)$], [$f_0 (2)$], [$f_0 (3)$], [$dots$], [$dots$], [$f_1$], [$f_1 (0)$], [$f_1 (1)$], [$f_1 (2)$], [$f_1 (3)$], [$dots$], [$dots$], [$f_2$], [$f_2 (0)$], [$f_2 (1)$], [$f_2 (2)$], [$f_2 (3)$], [$dots$], [$dots$], [$dots$], [$dots$], [$dots$], [$dots$], [$dots$], [$dots$], [$dots$], ) ] Costruiamo una funzione $phi: NN arrow.long NN_bot$ per dimostrare l'assurdo. Una prima versione potrebbe essere la funzione $phi(n) = f_n (n) + 1$, per _disallineare_ la diagonale, ma questo non va bene: se $f_n (n) = bot$ non sappiamo dare un valore a $phi(n) = bot + 1$. Definiamo quindi la funzione $ phi(n) = cases(1 & "se" f_n (n) = bot, f_n (n) + 1 quad & "se" f_n (n) arrow.b) quad . $ Questa funzione Ú una funzione che appartiene a $NN_bot^NN$, ma non Ú presente nella lista precedente. Infatti, $forall k in NN$ otteniamo $ phi(k) = cases(1 eq.not f_k (k) = bot & "se" f_k (k) = bot, f_k (k) + 1 eq.not f_k (k) quad & "se" f_k (k) arrow.b) quad . $ Questo Ú assurdo, perché abbiamo assunto $P(NN)$ numerabile, quindi $P(NN) tilde.not NN$. ]
https://github.com/metamuffin/typst
https://raw.githubusercontent.com/metamuffin/typst/main/tests/typ/math/frac.typ
typst
Apache License 2.0
// Test fractions. --- // Test that denominator baseline matches in the common case. $ x = 1/2 = a/(a h) = a/a = a/(1/2) $ --- // Test parenthesis removal. $ (|x| + |y|)/2 < [1+2]/3 $ --- // Test large fraction. $ x = (-b plus.minus sqrt(b^2 - 4a c))/(2a) $ --- // Test binomial. $ binom(circle, square) $ --- // Error: 8-13 missing argument: lower $ binom(x^2) $ --- // Test associativity. $ 1/2/3 = (1/2)/3 = 1/(2/3) $ --- // Test precedence. $ a_1/b_2, 1/f(x), zeta(x)/2, "foo"[|x|]/2 \ 1.2/3.7, 2.3^3.4 \ 🏳‍🌈[x]/2, f [x]/2, phi [x]/2, 🏳‍🌈 [x]/2 \ +[x]/2, 1(x)/2, 2[x]/2 \ (a)b/2, b(a)[b]/2 $
https://github.com/tingerrr/hydra
https://raw.githubusercontent.com/tingerrr/hydra/main/examples/pages.typ
typst
MIT License
#import "/src/lib.typ": hydra #set page(paper: "a7", margin: (y: 4em), numbering: "1", header: context { if calc.odd(here().page()) { align(right, emph(hydra(1))) } else { align(left, emph(hydra(2))) } line(length: 100%) }) #set heading(numbering: "1.1") #show heading.where(level: 1): it => pagebreak(weak: true) + it = Introduction #lorem(50) = Content == First Section #lorem(50) == Second Section #lorem(100)
https://github.com/darioglasl/Arbeiten-Vorlage-Typst
https://raw.githubusercontent.com/darioglasl/Arbeiten-Vorlage-Typst/main/06_Ergebnisse/03_empfehlung.typ
typst
== Empfehlungen zur ErgÀnzung von ... <recommendation-next-features>
https://github.com/takotori/PhAI-Spick
https://raw.githubusercontent.com/takotori/PhAI-Spick/main/sections/kraft.typ
typst
#import "../utils.typ": * = Kraft #grid( columns: (50%, auto), gutter: 5pt, [*Kraft:*], [$arrow(F)_"res"=m arrow(a)$], [*Gewichtskraft:*], [$F_G=m g $], [*Federkraft:*], [$F_F=D y space.quad D &= "Federkonst." \ y &= abs(l - l_0)$], [*Hook\`sches Gesetz:*], [$Delta F=D dot Delta y$], [*Schiefe Ebene:* #image("../figures/kraftSchiefeEbene.png")], [$F_G=m g$ \ #v(5pt) *Normalkraft:* \ $F_N=m g dot cos(alpha) $ \ #v(5pt) *Hangabtriebskraft*: \ $F_H=m g dot sin(alpha)$ \ #v(5pt) *Haftreibungskraft:* \ $F_"HR"=ÎŒ dot F_N$ #v(5pt)], [*Zentripetalkraft / \ Zentrifugalkraft:*], [$F_Z=(m v^2)/r = m dot omega^2 dot r$], ) #v(4pt) #grid( columns: (45%, auto), gutter: 2pt, image("../figures/Kreiskraefte.png"), text(size: 6pt, [Die *Zentripetalkraft* und *Zentrifugalkraft* wirken bei einer beschleunigten Kreisbewegung und haben die gleiche Formel. Es handelt sich um entgegengesetzte KrÀfte, die abhÀngig von dem Bezugssystem sind. Wird eine Kreisbewegung von außen betrachtet, wirkt nur die Zentripetalkraft. Befindet sich der Beobachter im rotierenden System nimmt er beide KrÀfte wahr.]), ) == Kraft Statik In der Statik bewegen sich die Objekte nicht. Dort gilt also: \ $ sum F=0, v(t) = 0 m slash s, a(t) = 0 m slash s^2 $ #align( center, image("../figures/kraftStatik1.png"), ) $ "X) " F_s dot cos(colblue(18^circle.small)) &-ÎŒ dot F_N &-F_G dot sin(colgreen(35^circle.small))=0 $ \ $ "Y) " F_s dot sin(colblue(18^circle.small)) &+F_N &-F_G dot cos(colgreen(35^circle.small))=0 $ #image("../figures/kraftStatik2.png") Ein Gewicht der Masse $m = 10"kg"$ wird entsprechend der obigen Skizze durch Seile an einer Wand befestigt. Welche KrÀfte wirken im linken und rechten Seil? *1. Methode:* $ F_L/sqrt(3^2+4^2 ) vec(-3,4)+F_R/sqrt(8^2+6^2 ) vec(8,6)+m g vec(0,-1)=0 $ *2. Methode* $ F_L vec(-cos(alpha),sin(alpha))+F_R vec(cos(beta),sin(beta))+m g vec(0,-1)=0 $ #grid( columns: (auto, auto), gutter: 5pt, align: (center +bottom, center+bottom), image("../figures/kraftStatik3.png"), image("../figures/kraftStatik4.png") ) Eine $20 "kN"$ schwere Luftseilbahnkabine hÀngt reibungsfrei an einem Tragseil und wird durch ein Zugseil festgehalten. Wie gross sind die ZugkrÀfte im Zug- und im Tragseil? ($alpha = 20^circle.small$ und $beta = 20^circle.small$) #v(5pt) $ F_"S1" = F_"S2" = F_T $ $ F_T vec(cos(180^circle.small - 20^circle.small),sin(180^circle.small - 20^circle.small)) +F_T vec(cos(20^circle.small),sin(20^circle.small)) \ + F_Z vec(cos(20^circle.small),sin(20^circle.small)) + vec(0,-20 "kN")=0 \ ==> F_T = 9.97 dot 10^4 N, F_Z = 8.48 dot 10^3 N $
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/decide-scoring/entry.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #create-body-entry( title: "Decide: Scoring Triballs", type: "decide", date: datetime(year: 2023, month: 9, day: 2), author: "<NAME>", witness: "Violet Ridge", )[ We rated each option on: - Efficiency on a scale of 1 to 10 - Stability on a scale of 1 to 10 - Feasibility on a scale of 1 to 10. #decision-matrix( properties: ((name: "Efficiency"), (name: "Stability"), (name: "Feasibility")), ("Extentable Hook", 7, 4, 9), ("Fold Out Flaps", 10, 9, 10), ("Shot Out Net", 5, 3, 4), ) #admonition( type: "decision", )[ We chose the fold out flaps. This option is both the most effective in cost of actuators and also the simplest design, leading to it being overall the best choice. ] #heading[First Prototype] #grid( columns: (1fr, 1fr), gutter: 20pt, [ Our first prototype was mainly comprised of L-channel. It featured a piston to push the L-channel forwards, mounted on the bottom of the drivetrain. #admonition( type: "warning", )[ While this design was stable and powerful, it exposed the fitting of the piston outwards, making it very easy to hit. ] We decided to discard this design after discovering that there was no other way to mount the piston in this position without exposing it. ], image("./first-prototype.jpg"), ) ] #create-body-entry( title: "Decide: Scoring Triballs", type: "decide", date: datetime(year: 2023, month: 9, day: 2), // TODO: correct to date of final cad creation author: "<NAME>", witness: "Violet Ridge", )[ #heading([Final Design]) Our final design used a top mounted piston and a piece of C-channel as the wing base. This strikes the right balance between structural integrity and lightness, and also doesn't expose the piston to other robots. #grid( columns: (1fr, 1fr), gutter: 20pt, figure(image("./iso.png"), caption: "Isometric view"), figure(image("./top.png"), caption: "Top view"), figure(image("./side.png"), caption: "Side view"), figure(image("./front.png"), caption: "Front view"), ) // TODO: add part diagrams and CAD #image("./1.png") #image("./2.png") ]
https://github.com/fenjalien/metro
https://raw.githubusercontent.com/fenjalien/metro/main/tests/angle/angle-separator/test.typ
typst
Apache License 2.0
#import "/src/lib.typ": * #set page(width: auto, height: auto, margin: 1cm) #ang(6, 7, 6.5) #ang(6, 7, 6.5, angle-separator: " ")
https://github.com/PauKaifler/typst-template-dhbw
https://raw.githubusercontent.com/PauKaifler/typst-template-dhbw/main/README.md
markdown
Apache License 2.0
# Typst DHBW Template This template is my interpretation of the guidelines required by the DHBW Stuttgart and Ravensburg. I wrote it for my 2023 bachelor thesis, and it is compatible with Typst 0.11.1. While I am no longer a student at the DHBW, I do accept pull requests and I intend to resolve any issues that might arise in the future. ## Setup This template requires you to separately download the DHBW Logo. You can download it from <https://upload.wikimedia.org/wikipedia/de/1/1d/DHBW-Logo.svg> and save it in the same directory the `template.typ` is stored in as `dhbw-logo.svg`. You may run the following command in said directory to do that: ```sh curl https://upload.wikimedia.org/wikipedia/de/1/1d/DHBW-Logo.svg -o dhbw-logo.svg ``` ## Example You can check out how this template can be used in the [example.typ](./example.typ) found within this repository. The following is the first page of that document: ![first page of a rendered sample document](./example.png) ## License This repository is dual-licensed under the [MIT](https://choosealicense.com/licenses/mit/) and [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) license.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/codetastic/0.1.0/util.typ
typst
Apache License 2.0
#import "@preview/cetz:0.1.1" #import cetz.draw: rect #let to-arr(code) = { if type(code) == "integer" { code = str(code) } if type(code) == "string" { code = code.clusters().map(int) } if type(code) != "array" { panic("Code needs to be provided as integer, string or array. Got " + type(code)) } return code } #let to-int-arr(code) = { return to-arr(code).map(int) } #let weighted-sum(nums, weights) = { let w-func if type(weights) == "array" { w-func = (i) => { return weights.at(calc.rem(i, weights.len())) } } else if type(weights) == "function" { w-func = weights } return nums.enumerate().fold(0, (s,v) => { let (i, n) = (..v) s + n * w-func(i) }) } #let check-code( code, digits, generator, tester ) = { if code.len() == digits - 1 { code.push(generator(code)) } else if code.len() == digits { if not tester(code) { panic("Checksum failed for code " + repr(code) + ". Should be " + str(generator(code.slice(0,-1)))) } } else { panic("Code has to be " + (digits - 1) + " digits (excluding checksum). Got " + code.len()) } return code } #let draw-bars(bits, width:0.264mm, height:18.28mm, bg: white, fg: black) = { // Draw background rect to set fixed size rect((0,0), (bits.len() * width, height), fill:bg, stroke:none, name:"code-bg") // Cluster bits to draw thick bars // as one rect bits = bits.fold((), (c, v) => { if v { if c == () or c.last() == 0 { c.push(1) } else { c.at(-1) += 1 } } else { c.push(0) } c }) // Draw bars let i = 0 for bit in bits { if bit > 0 { rect( (i*width,0), (rel:(bit*width,height)), fill:fg, stroke:none ) i += bit } else { i += 1 } } } #let draw-rect(at, width, height, fill: white, ..style) = { rect( at, (rel:(width,height)), fill: fill, stroke:none, ..style ) } /// Draw a bitfield of binary data as a 2d code matrix. /// /// Bits will be drawn from the top left to the bottom right. /// `bits.at(0).at(0)` is located at coordinate `(0,0)` and /// `bits.at(-1).at(-1)` is located at the last coordinate /// on the bottom right. #let draw-matrix( bitfield, quiet-zone: 4, size: 3mm, bg: white, fg: black ) = { let (w, h) = (bitfield.first().len(), bitfield.len()) let (x, y) = (quiet-zone, quiet-zone) // Draw background rect to set fixed size rect((0,0), ((w+2*quiet-zone) * size, (h+2*quiet-zone) * -size), fill:bg, stroke:none, name:"code-bg") // Draw modules for i in range(h) { for j in range(w) { if bitfield.at(i).at(j) { rect( ((x + j) * size, (y + i) * -size), (rel:(size, -size)), fill:fg, stroke:none ) } } } }
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/post_type_check/with_builtin.typ
typst
Apache License 2.0
#let g = rgb.with(/* position */);
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/list-attach_03.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test non-attached tight list. #set block(spacing: 15pt) Hello - A World - B - C More.
https://github.com/andreasKroepelin/lovelace
https://raw.githubusercontent.com/andreasKroepelin/lovelace/main/examples/label-low-level.typ
typst
MIT License
#import "../lib.typ": * #set page(width: auto, height: auto, margin: 1em) #set text(font: "TeX Gyre Pagella") #show math.equation: set text(font: "TeX Gyre Pagella Math") #pseudocode( with-line-label(<start>)[do something], with-line-label(<important>)[do something important], [go back to @start], ) The relevance of the step in @important cannot be overstated.
https://github.com/yaoyuanArtemis/resume
https://raw.githubusercontent.com/yaoyuanArtemis/resume/main/data.typ
typst
Do What The F*ck You Want To Public License
#import "template.typ": * #let name = "<NAME>" #let namezh = "刘峰" #let email = [ #icon("email.svg") <EMAIL> ] #let phone = [ #icon("phone.svg") (+86) 18520170194 ] #let home = [ #icon("home.svg") #link("https://yaoyuanartemis.github.io/")[ yaoyuanartemis.github.io ] ] #let github = [ #icon("github.svg") #link("https://github.com/yaoyuanArtemis")[ yaoyuanArtemis ] ] #let linkin = [ #icon("linkedin.svg") #link("https://www.linkedin.com/in/%E5%B3%B0-%E5%88%98-2a7a8b2b8/")[ <NAME> ] ] #let author = ( name: name, email: email, phone: phone, home: home, github: github, linkin: linkin, ) #let authorzh = ( name: namezh, email: email, phone: phone, home: home, github: github, linkin: linkin, ) #let selftitle = [ Self Introduction ] #let selftitlezh = [ 自我总结 ] #let self = [ I am passionate about pursuing technological advancements and have an unrelenting pursuit of knowledge, particularly in the field of computer science. Additionally, I enjoy meeting interesting people and experiencing diverse aspects of society. Whether it's the culture and phenomena in China or around the world, I am full of curiosity and eager to explore. ] #let selfzh = [ 我热衷于远求技术进步对知识有着䞍懈的远求尀其是圚计算机领域。同时我也乐于圚瀟䌚䞭结识有趣的人和事深入了解瀟䌚的各䞪方面。无论是䞭囜还是䞖界各地的文化和现象我郜充满奜奇并枎望探玢。 ] #let edutitle = [ Education ] #let edutitlezh = [ 教育经历 ] #let edu = [ #datedsubsection( align(left)[ *Anhui University 211 the gifted class of computer science* \ - GPA:3.30/4 - Languages: Chinese Grade A,English IELTS 6.5 - Programming Capabilities:CCF-CSP 180 - Relevant Courses:Principles of Computer Organization,Data Structures,Operating Systems,Computer Networks,Database Principles,Object-Oriented Programming,Digital Image Processing,Big Data Technology,Machine Learning,Pattern Recognition,Optimization Methods,Mathematical Modeling (Advanced Class),Artificial Intelligence,Principles of Compilers,Writing International Academic Papers (Graduate Course) - Honors and Awards:Second-Class Scholarship for Academic Excellence,Anhui Province Big Data Competition ], align(right)[ Hefei, China \ 2017.9 - 2021.6 ] ) ] #let eduzh = [ #datedsubsection( align(left)[ *安埜倧孊 211 计算机科孊䞎技术英才班* \ - GPA:3.30/4 - 语蚀:䞭文二级甲等、英文IELTS6.5 - 计算机猖皋CCF-CSP 180 - 盞关诟皋计算机组成原理数据结构操䜜系统计算机眑络数据库原理面向对象皋序讟计数字囟像倄理倧数据技术机噚孊习暡匏识别最䌘化方法数孊建暡(提高班)人工智胜猖译原理囜际孊术论文撰写(研究生诟皋) - 荣誉奖项孊习䌘秀二等奖孊金、安埜省倧数据竞赛 ], align(right)[ 合肥.䞭囜 \ 2017.9 - 2021.6 ] ) ] #let techtitle = [ Technical Skills ] #let techtitlezh = [ 项目技胜 ] #let tech = [ - *Programming*: - Proficient in Python and C++, which were the primary languages used for university coursework. - Learned and used Java, MATLAB, HTML, LaTeX, and Typst. - Familiar with HTML5, CSS, JavaScript, and TypeScript, and frequently used in practical work. - Experienced with Node.js, Midway.js, and familiar with Egg.js and Nest.js for full-stack development. - Used Spring Boot, MyBatis, and Restful technologies for API development in a company context. - *Key words*: Node.js TypeScript Nest.js HTML5 CSS - *Tools*: - Proficient in using the Scrapy framework and have developed a gaming combat system using the Django framework. - Experienced with databases such as MySQL and SQL Server. - Studied "Machine Learning" and "Pattern Recognition," and am familiar with related algorithms. - Configured clusters for Apache and MySQL. - Utilized distributed web crawlers and scraping technologies such as BeautifulSoup, Scrapy, and regular expressions (Re). ] #let techzh = [ - *猖皋语蚀*: - 语蚀 Python C++蟃䞺熟悉,倧孊倧诟皋䜜䞚䜿甚的䞻力语蚀,Java Matlab Html Latex Typst孊习并䜿甚 - 熟悉HTML5、CSS、 JavaScript、TypeScript,并圚实际工䜜䞭经垞䜿甚 - 䜿甚过NodeJs MidWayJS,䌚䜿甚EggJs NestJS等党栈技术栈 - 䜿甚SpringBoot、Myabtis、Restful等Java技术栈,圚公叞甚䜜接口匀发技术 - *工具*: - 䌚䜿甚Scrapy框架,䜿甚过Django框架匀发枞戏对战系统 - 䌚䜿甚 MySql、SqlSever等数据库 - 孊习《机噚孊习》、《暡匏识别》对机噚孊习盞关算法蟃䞺熟悉 - 配眮过Apache、MySql等集矀搭建 - 䜿甚分垃匏爬虫,BeautifulSoup、Scrapy、Re做爬取技术 ] #let projecttitle = [ Project Experience ] #let projecttitlezh = [ 项目经历 ] #let projectexperience = [ #datedsubsection( align(left)[ *China Merchants Bank. CMB Technology (Shenzhen) Co., Ltd.* \ Developer ], align(right)[ 2021.7 - 2023.9 ] ) - After joining the company through campus recruitment, I participated in the development of the cloud operations platform, specifically the OracleDM platform (a platform for operating Oracle databases). I primarily served as a frontend developer, using React 17, TypeScript, and Ant Design for web development and API data acquisition. - #lorem(8) #datedsubsection( align(left)[ *Alibaba. Zhejiang Fliggy Network Technology Co., Ltd.* \ Frontend Developer and Operations (Ops) ], align(right)[ 2021.7 - 2023.9 ] ) - Development of the Backend System "Jellyfish" for Risk Control - Included API calls for data and permission interfaces, and integration of event tracking. - Independently developed a policy document parsing tool. - Automated the parsing of airline policies from Excel, achieving a coverage of 10 airlines by February with an automation rate of 75%. - Supported policy document types include Word 2007, Word 2003, Excel 2007, and Excel 2003. - By building automatic parsing capabilities for airline policy documents, improved operational efficiency, reducing the time required to process complex policy documents from one day to within two hours. - Developed basic pages for the backend ticketing operations system. ] #let projectexperiencezh = [ #datedsubsection( align(left)[ *招商银行.招银眑络科技(深圳)有限公叞* \ 匀发者 ], align(right)[ 2021.7 - 2023.9 ] ) - 校招入职后参䞎公叞的云运绎平台匀发具䜓是平台䞭的OracleDM平台匀发行内对Oracle数据库做操䜜的平台䞻芁是担任前端匀发工皋垈䜿甚React17、TypeScript、AntDesign做眑页匀发以及接口对接 - 䜿甚SpringBoot技术做接口匀发 #datedsubsection( align(left)[ *阿里巎巎.浙江飞猪眑络技术有限公叞* \ 前端匀发工皋垈以及运绎 ], align(right)[ 2023.9 - 2024.5 ] ) - 匀发风控䞭后台系统“氎母Jellyfish”匀发 - 包括数据接口调甚、权限接口调甚、埋点接入 - 独立匀发政策文件解析工具 - 针对航叞政策解析excel投产环计至2月航叞芆盖率已蟟10䞪自劚化率蟟到75% - 政策文件类型支持word2007、word2003、excel2007、excel2003 - 通过建讟航叞政策文件自劚解析胜力提高运营投攟准倇工䜜效率䜿埗倍杂政策文件由䞀倩猩短至2小时内 政策解析工具、机祚运营䞭后台、氎母风控郜是前端䞻富项目 - 匀发基本的机祚运营䞭后台页面 ] #let activitytitle = [ Research Experience ] #let activitytitlezh = [ 科研经历 ] #let activityzh = [ #datedsubsection( align(left)[ *属性眑络瀟团检测* \ 本科期闎发衚孊术论文 A Reduced Mixed Representation Based Multi-Objective Evolutionary Algorithm for Large-Scale Overlapping Community Detection DOI: 10.1109/CEC45853.2021.9504894 属于安埜倧孊教育郚计算智胜䞎信息倄理重点实验宀成果 ], align(right)[ 2019-2021 ] ) // #datedsubsection( // align(left)[ // *#lorem(8) *\ // #lorem(4) // ], // align(right)[ // 202x - _present_ // ] // ) // #lorem(16) // #datedsubsection( // align(left)[ // *#lorem(8)* \ // #lorem(4) // ], // align(right)[ // 202x // ] // ) // - #lorem(8) // - #lorem(8) ] #let activity = [ #datedsubsection( align(left)[ *Attribute-Based Network Community Detection* \ Published Academic Papers During Undergraduate Studies: A Reduced Mixed Representation Based Multi-Objective Evolutionary Algorithm for Large-Scale Overlapping Community Detection DOI: 10.1109/CEC45853.2021.9504894. Achievement of the Key Laboratory of Computational Intelligence and Information Processing, Ministry of Education, Anhui University ], align(right)[ 2019-2021 ] ) ] #let hobbiestitle = [ Hobbies and Interests ] #let hobbiestitlezh = [ 兎趣爱奜 ] #let hobbieszh = [ - *文化*: 喜欢了解孊习地理、䞖界史和䞭囜史、宏观经济 - *运劚*: 喜欢螢足球䞻队皇马户倖锻炌枞泳滑雪也有䞍定期进行 ] #let hobbies = [ - *Culture*: Enjoys Learning About Geography, World History, Chinese History, and Macroeconomics - *Sports*: Enjoys playing soccer (main team: Real Madrid); also regularly engages in outdoor activities such as swimming and skiing. ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/flow-orphan_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(height: 100pt) #lorem(12) = Introduction This is the start and it goes on.
https://github.com/TheWebDev27/Calc-II-Honors-Project
https://raw.githubusercontent.com/TheWebDev27/Calc-II-Honors-Project/main/part2.typ
typst
#set text( font: "New Computer Modern", size: 10pt ) #set par( leading: .75em ) #set align(center) = The Nonstandard Approach #set align(left) One drawback with the real analysis approach involving the epsilon-delta definition of the limit is its cumbersome notation. Proofs can quickly become cluttered with absolute values and inequalities that at times can be challenging to keep track of and connect to one another. By formalizing the idea of the infinitesimal to where basic algebraic techniques can be applied to it, a new system of analysis can be developed to study the same material that real analysis does while taking advantage of simpler and more concise notation. \ #text(14pt)[ Introduction ] This introduction follows section 1.4 of #set align(center) <NAME>. (1976). _Foundations of Infinitesimal Calculus_, <NAME> & Schmidt. #set align(left) Let us first consider two points on the parabola $f(x) = x^2$. One will be a fixed point at $(x_0, y_0)$, while the other will lie some distance away at $(x_0 + Delta x, y_0 + Delta y)$ where $Delta x$ and $Delta y$ represent the horizontal and vertical distances between the two points. #set text(9pt) #figure( image("images/parabola slope.png", width: 60%), caption: [$(x_0, y_0)$ and $(x_0 + Delta x, y_0 + Delta y)$ on $f(x)=x^2$] ) #set text(10pt) The average slope between any two points $(x_1, y_1)$ and $(x_2, y_2)$ is the ratio of the change in $y$ to the change in $x$: #set align(center) $display((Delta y) / (Delta x)=(y_2-y_1)/(x_2-x_1)).$ #set align(left) Therefore, the average slope between the two points on the parabola above is \ #set align(center) #h(125pt) $display(((y_0 + Delta y) - y_0)/((x_0 + Delta x) - x_0)).$ #h(110pt) (1) #set align(left) The function is $f(x)=x^2$, so any $y$ value is determined by plugging in its corresponding input $x$ into it. The points then become $(x_0, x_0^2)$ and $(x_0 + Delta x, (x_0 + Delta x)^2)$. Substituting in these new $y$ coordinates into $(1)$ gives #set align(center) $display((Delta y)/(Delta x)) &= display(((x_0 + Delta x)^2 - x_0^2)/((x_0 + Delta x) - x_0)) \ &= display(([x_0^2+2x_0 Delta x + (Delta x)^2] - x^2_0)/((x_0+Delta x) - x_0)) \ &= display((2x_0 Delta x + (Delta x)^2)/(Delta x)) \ #h(105pt) &= 2x _0 + Delta x. #h(145pt) (2) $ #set align(left) (2) gives us the slope in terms of a fixed point's $x$-coordinate and its horizontal distance $Delta x$ from some variable point. If we want to find the slope of a line that lies *tangent* to the curve -- meaning that it intersects the curve at exactly one point -- at $(x_0, x_0^2)$, then we can treat $Delta x$ as a very small number so that the tangent line's slope is very close to (2). We #emph[cannot] set $Delta x$ equal to zero, because (2) follows from a quotient where $Delta x$ is present in the denominator of a quotient. Anyhow, treating it as a miniscule value leads to the intuitive result that the slope of some line tangent to the point $(x_0, x_0^2)$ on the parabola is essentially #set align(center) $2x_0.$ #set align(left) This loose usage of an infinitesimal -- treating a value as infinitely small to where it can be ignored -- has in fact produced decently accurate results throughout the development of calculus over the past several centuries, being used by those such as Newton, Leibniz, Euler, and others in varying forms. However, it is by no means rigorous and does not establish results with absolute certainty. Why? This is because we are left with a problem: How do we know exactly when numbers are small enough to be treated as negligible in a calculation? This now brings us to our first formal definition: #set text(font: "Source Serif") #set align(center) #grid( columns: 80%, rows: auto, [ #set align(left) An *infinitesimal* is a number $epsilon$ where #set align(center) $-a<epsilon<a$ #set align(left) for any positive real number $a$. ] ) #set text(font: "New Computer Modern") #set align(left) Amongst the real numbers, 0 would be the only value that qualifies as infinitesimal. What we now do is expand the real number system by introducing *hyperreal numbers*. These include the real numbers along with nonzero infinitesimals, which can be thought of as numbers that lie infinitely close to 0. The set of all real numbers is represented by $RR$, while the set of all hyperreal numbers is represented by $RR^*$. Various symbols including $Delta x, Delta y, epsilon, #text[and] delta$ are used to symbolize infinitesimals. For instance, $x + Delta x$ is interpretted as some quantity that lies #emph[infinitely] close to $x$, and $display(1/epsilon)$ represents an *infinite positive number*. Hyperreal numbers that are not infinitely positive or negative are *finite numbers*. #set text(9pt) #figure( image("images/hyperreal line.png", width: 70%), caption: [Hyperreal number line visualized] ) #set text(10pt) We can conceptualize the scale of hyperreal numbers by imagining ourselves "zooming in" infinitely close onto on a real number such as 0 or 100 on the hyperreal number line (Figure 5). This helps to clarify the nature of hyperreal numbers as merely an extension of the real numbers, so much so to where its properties and the arithmetic involved with them match exactly with that of the reals. This approach to analysis is known as *nonstandard analysis*. Going back to the calculation of the instantaneous slope of $f(x)=x^2$, we now treat the value of $Delta x$ as a nonzero infinitesimal under this new lense of analysis. This means that the expression #set align(center) $2x_0 + Delta x$ #set align(left) lies infinitely close to $2x_0$, so the slope of any line tangent to $(x_0, x_0^2)$ is concluded to be $2x_0$. \ \ Let's use infinitesimals to try computing the instantaneous slope of the function #set align(center) $f(x)=sqrt(x)$. #set text(9pt) #figure( image("images/square root function.png", width: 70%), caption: [$f(x)=sqrt(x)$] ) #set text(10pt) #set align(left) The average slope between a fixed point and a variable point on the square root function is \ \ #set align(center) $display((Delta y)/(Delta x) &= (f(x_0+Delta x)-f(x_0))/(Delta x) \ &= (sqrt(x_0 + Delta x) - sqrt(x_0))/(Delta x) )$ #set align(left) In order to calculate the instaneous slope, we need a way to cancel out $Delta x$ from the denominator. This can be readily accomplished by multiplying the quotient by the conjugate of the numerator in the form of 1 to induce a difference of squares: #set align(center) $display( (sqrt(x_0 + Delta x) - sqrt(x_0))/(Delta x) dot ((sqrt(x_0+Delta x) + sqrt(x_0))/(sqrt(x_0 + Delta x) + sqrt(x_0))) = ((sqrt(x_0 + Delta x))^2 - (sqrt(x_0))^2)/(Delta x(sqrt(x_0 + Delta x) + sqrt(x_0))) \ )$ $display( &= ((x_0 + Delta x) - x_0)/(Delta x(sqrt(x_0 + Delta x) + sqrt(x_0))) \ &= (Delta x)/(Delta x(sqrt(x_0 + Delta x) + sqrt(x_0))) \ &= 1/(sqrt(x_0 + Delta x) + sqrt(x_0)) )$ #set align(left) Since the $Delta x$ in the denominator is infinitesimal, this means that the quantity $sqrt(x_0 + Delta x)$ is infinitely close to $sqrt(x_0)$, so #set align(center) $display( 1/(sqrt(x_0 + Delta x) + sqrt(x_0))&=1/(sqrt(x_0) + sqrt(x_0))\ &= 1/(2sqrt(x_0)). )$ #set align(left) Those who have experience with calculating the derivatives of functions using the limit definition of the derivative will be quick to notice that these calculations play out mostly the same way with the exception of the absence of the limit. At this stage, the skeptical reader may question how exactly this system has solved the concern regarding rigor. In particular, how do the ideas presented so far formalize the concept of deeming a quantity in a given calculation as neglible? What has happened so far is that we have #emph[defined] what it means for a number to be considered negligibly small, so if a given quantity does not meet the criteria specified, then we know that it cannot be ignored. Beyond that, however, we have done nothing more than explore some basic ideas of nonstandard analysis, and rigorous justifications require a working knowledge of abstract algebra. The details are obviously left out, as they lie far beyond my expertise. While the curious reader may feel left unfulfilled by this, keep in mind that the formalization of many concepts require complicated machinery, so it is commonplace for students of mathematics to take a result at face value initially and uncover its logical justification far later. As a direct analogue to the current situation, consider the analysis behind limits covered in the first half of this paper. It is likely that most undergraduates who have studied limits will never encounter this rigorous treatment of them in their lifetime -- let alone give it any consideration. Ambitious students, however, will inevitably run across it in a real analysis course, and the formalities are unveiled then. We now lie in the very same boat with infinitesimals! #pagebreak() #text(14pt)[ Basic Applications of Infinitesimals ] This section follows #set align(center) <NAME>. (2012). _A Brief Introduction to Infinitesimal Calculus_, can be found at \ https://homepage.math.uiowa.edu/~stroyan/InfsmlCalculus/Lecture1/Lect1.pdf. #set align(left) It is due time for us to see how infinitesimal logic can be used to provide basic intuitive argumentation for a couple of ideas seen in calculus. #set text(font: "Source Serif") #set align(center) #grid( columns: 80%, rows: auto, [ #set align(left) *Theorem 4 - The Extreme Value Theorem* \ Consider a function $f(x)$ that is continuous on a closed interval $[a, b]$. There then exist two numbers $x_(min)$ and $x_(max)$ at which $f(x)$ achieves its minimum and maximum values respectively where #set align(center) $f(x_(min)) <= f(x) <= f(x_(max))$ #set align(left) for all other $x$'s. ] ) #set text(font: "New Computer Modern") #set align(left) #set text(9pt) #figure( image("images/extreme value theorem.png", width: 50%), caption: [Extreme value theorem visualized] ) #set text(10pt) The extreme value theorem asserts that if a function smoothly travels over an interval of inputs, then it must take on a minimum and a maximum value at some inputs $x_(min)$ and $x_(max)$. *Continuity* entails that the outputs of a function are close to one another if the inputs are close. In other words, a small change in the input should only ever produce a proportionately small change in the output. Mathematically speaking, a function $f(x)$ is continuous on a closed interval $[a,b]$ only when #set align(center) $a <= x_1 approx x_2 <= b arrow.r.double.long f(x_1) approx f(x_2)$ #set align(left) where the $approx$ symbol means that two quantities are _approximately_ equal (very close to one another). With this property fleshed out, we can now go about providing an intuitive argument for the extreme value theorem. We start by dividing up the interval $[a,b]$ into small increments like so: #set align(center) $display(a < a + (b-a)/H < a + (2(b-a))/H < dots.h.c < a + (k(b-a))/H < dots.h.c < b) $, #set align(left) where $b-a$ is the length of the interval, $H$ is the number of parts the interval is partitioned into, and $k$ is a positive integer between 1 and $H$. Amongst the partition points, $f(x)$ achieves some maximum #v(-2pt) value at one (or possibly more than one) of the partition points $x_M=display(a + (k(b-a))/H)$, so #set align(center) #v(5pt) $f(x_M) >= f(x_1)$ for any $x_1=display(a + (j(b-a))/H), j != k$. #set align(left) #v(2pt)We know that any input $x$ in the interval $[a, b]$ lies within a distance of $display((b-a)/(2H))$ from one of the #v(-2pt) partition points. To see why, consider the closed interval [2,12] divided into 5 equal subintervals ($H = 5$) so that the partition points are #set align(center) $display(2\, #h(10pt) 2 + (12-2)/5\, #h(10pt) 2 + (2(12-2))/5\, #h(10pt) 2 + (3(12-2))/5\, #h(10pt) 2 + (4(12-2))/5\, #h(10pt) 2 + (5(12-2))/5) \ = #h(5pt) 2, #h(5pt) 4, #h(5pt) 6, #h(5pt) 8, #h(5pt) 10, #h(5pt) 12.$ #set align(left) Since the size of the interval is 10, and it is being partitioned into 5 subintervals, the distance between each partition point is #set align(center) $display((b-a)/H = (12 - 2)/5 = 2).$ #set align(left) and #set align(center) $display((b-a)/(2H) = 1).$ #set text(9pt) #figure( image("images/number line.png", width: 70%), caption: [Partition points visualized] ) #set align(left) #set text(10pt) If we think of the quantity $display((b-a)/(2H))$ as half of the distance between consecutive partition points and #v(-2pt) imagine a one-dimensional radius of $display((b-a)/(2H))$ around each partition, then we can see that these radii #v(0pt)cover all of the values between the partition points. Therefore, any value of $x$ within the interval must #v(0pt) lie within a distance of $display((b-a)/(2H))$ from one of the partition points. \ If we now let $H$ grow exceedingly large to the point where $display((b-a)/(2H))$ becomes infinitesimal, then the set of #v(-2pt) partition points will eventually "fill up" the rest of the interval $[a,b]$ so that any value of $x$ within the interval lies infinitely close to one of the partition points. In others words, #set align(center) $x approx x_1$ for any $x$ in $[a,b]$, #set align(left) which means #set align(center) $f(x_M) >= f(x_1) approx f(x)$, #set align(left) and this gives us the approximate maximum of $f(x)$. A similar argument can then be made for the approximation of the function's minimum, and this concludes the intuitive argument for the extreme value theorem, although this is by no means a formal proof.\ \
https://github.com/Geson-anko/vconf24_template_typst
https://raw.githubusercontent.com/Geson-anko/vconf24_template_typst/main/sample.typ
typst
// sample.typ #import "vconf2024.typ": conf #show: doc => conf( title: "バヌチャル孊䌚2024芁旚テンプレヌトタむトルを蚘入", authors: ( (name: [hinoride#super[1]], contact: "Twitter: @hiddenotna"), (name: [はこ぀き#super[2]], contact: "E-mail: <EMAIL>"), (name: [Lcamu#super[2]], contact: "Twitter: @ogtonvr180426"), ), affiliations: ([#super[1]トラむボロゞヌ勉匷䌚], [#super[2]ラヌメン同奜䌚]), abstract: [ ここに本研究の内容をたずめた抂芁を蚘入するこず芁旚執筆にあたり䞍明な点がある堎合にはバヌチャル孊䌚実行委員䌚にご連絡ください ], bibliography-file: "bibliography.yaml", doc, ) = 緒蚀 本テンプレヌトはTypstを甚いおバヌチャル孊䌚の芁旚原皿を䜜成するためのファむルである = 原皿の曞匏 == 党䜓のフォヌマット A4刀甚玙のPDFで提出するWordLaTeXもしくはTypstファむルでの䜜成を原則ずしレむアりトは2カラムフォントサむズはタむトル18pt・本文10ptずする最倧ペヌゞ数は4ペヌゞずし和文フォントは明朝䜓英文フォントはTimes New RomanCenturyなどの暙準的なものを䜿甚するこず - 衚題今回の研究内容が端的に分かるようにする - 著者名・連絡先・所属著者名にはハンドルネヌムを䜿甚するこずが可胜である最䜎1名に぀いお必ず、孊䌚埌にも確実に連絡がずれる連絡先を蚘茉するこずたた所属は任意に蚘茉し耇数の堎合は1, 2・・・ず蚘す - 抂芁今回の研究内容を1/2頁以内で蚘述する == 内容に぀いお 発衚芁旚は次の事項を基本ずしお簡朔に蚘茉するこずが望たしい - 緒蚀今回の研究のいきさ぀ず研究目的を瀺す - 研究方法他の人が同じような研究ができるような曞き方を心がける - 結果事実のみをたずめる自分の意芋は含めない - 考察結果で瀺した事実をもずに、その解釈やそこでの因果関係などに぀いお議論する - 結蚀研究のたずめを蚘茉する - 参考文献本文䞭に匕甚順に蚘茉する == 衚蚘方法 本文倧芋出し小芋出しなどを明瞭にするこず本文䞭では「぀ぎの衚」のような衚珟を避け@fig:sample_figure や衚1のように曞くたた図衚のキャプションはそれ単䜓で読んだ際に図衚の意味が理解できるように簡朔に蚘述する == 参考文献 本文䞭に別の著者の文献を匕甚する堎合は匕甚箇所の最埌郚に@rafferty1994  @vconf2023 @okatani2015  @kataoka2016  @hinoride2023 のような笊号を぀けるこず本芁旚最埌郚に「参考文献」の項目を甚意し各文献の情報を蚘茉するこず蚘茉の際には他の人が各文献にアクセスできるような衚珟方法ずするこずWebサむトを匕甚する堎合ペヌゞタむトルURL参照日を蚘茉するこず == 字䜓・蚘号略号 䞋蚘の点に泚意し刀読・理解しやすい原皿ずなるよう努める - 䞊぀き文字䞋぀き文字小さく間違いやすいから特に泚意しその䜍眮を明確に瀺す - 孊名生物皮の孊名はむタリック䜓ずする - 略語略語を甚いる堎合には初出時に正匏名称を衚蚘スペルアりトする2回目からは略語で衚蚘する - 量単䜍囜際単䜍系SIを甚いる - 数匏独立した匏の文字倉数は指定のない限りむタリック䜓に組む匏の䞀連番号を で囲み頁の右端に曞く文䞭の匏は䞀行に収める - 脚泚本文䞭に\*, a, bなどを右肩に぀けそのペヌゞの䞋に暪線を匕き暪線の䞋に蚘述する == 図衚の䜜成 図および衚の説明は本文を芋なくおも倧芁が把握できる皋床の最小限のものであるこずが望たしいこれらは@fig:sample_figure のようにすべお本文䞭から参照する 図の䞋に題名・説明文を蚘述する題名はその終わりにピリオドを入れる写真も図ずしお扱う顕埮鏡写真などの瞮小拡倧を正確に瀺すべき図では必ず図䞭に暙準尺床を瀺す線を蚘入する×1000等では瀺さない 衚は芁旚で蚀及する情報のみを蚘茉し題名は䞊に説明文は䞋に蚘述する題名はその終わりにピリオドを入れる衚䞭の列の頭には適切な題を぀け適切な略字を甚いお短くする単䜍を明瀺する各行・各列に番号を぀けるこずは本文匕甚に必芁な堎合を陀き避ける #figure( image("vconf2024.png", width: 95%), caption: [䞻匵を裏付けるデヌタや説明のための図を配眮しおもよい], ) <fig:sample_figure> #heading(level: 1, numbering: none)[謝蟞] バヌチャル孊䌚 Typst版テンプレヌトの䜜成にあたりはこ぀き\@re_hako_moon様のLaTeXテンプレヌトを参考にさせおいただきたした心より深く感謝申し䞊げたす
https://github.com/amanuensisfrances/LaTeX-math-expressions-in-Typst
https://raw.githubusercontent.com/amanuensisfrances/LaTeX-math-expressions-in-Typst/main/LaTeX-math-expressions-in-Typst.typ
typst
MIT License
// LaTeX MATH EXPRESSIONS IN TYPST // (based on https://mirrors.ctan.org/info/symbols/math/maths-symbols.pdf and https://mirrors.ctan.org/fonts/newcomputermodern/doc/newcm-unimath-symbols.pdf) // Math Alphabets #let mathrm(input) = {$serif(#input)$} #let mathsf(input) = {$sans(#input)$} #let mathtt(input) = {$mono(#input)$} #let mathup(input) = {$upright(#input)$} #let mathit(input) = {$italic(#input)$} #let mathbf(input) = {$bold(#input)$} #let mathbb(input) = {$bb(#input)$} #let mathcal(input) = {$cal(#input)$} #let mathscr(input) = {$cal(#input)$} // see https://tex.stackexchange.com/q/361688 and https://zhuanlan.zhihu.com/p/569922028 #let mathfrak(input) = {$frak(#input)$} #let mathnormal(input) = {$serif(italic(#input))$} // Greek Letters #let varepsilon = {$epsilon.alt$} // the default \epsilon in LaTeX #let vartheta = {$theta.alt$} #let varkappa = {$kappa.alt$} #let varpi = {$pi.alt$} #let varrho = {$rho.alt$} #let varphi = {$phi.alt$} // the default \phi in LaTeX // Binary Operation Symbols #let pm = {$plus.minus$} #let mp = {$minus.plus$} #let Ast = {$ast.op$} #let star = {$star.op$} #let circ = {$compose$} #let bullet = {$•$} #let cdot = {$dot.op$} #let cap = {$sect$} #let cup = {$union$} #let uplus = {$union.plus$} #let sqcap = {$sect.sq$} #let sqcup = {$union.sq$} #let vee = {$and$} #let land = {$and$} #let wedge = {$or$} #let lor = {$or$} #let setminus = {$without$} #let wr = {$wreath$} #let smalldiamond = {$diamond.stroked.small$} #let bigtriangleup = {$triangle.stroked.t$} #let bigtriangledown = {$triangle.stroked.b$} #let triangleleft = {$triangle.stroked.l$} #let triangleright = {$triangle.stroked.r$} #let smalltriangleleft = {$triangle.stroked.small.l$} #let smalltriangleright = {$triangle.stroked.small.r$} #let oplus = {$plus.circle$} #let ominus = {$minus.circle$} #let otimes = {$times.circle$} #let oslash = {$⊘$} #let odot = {$dot.circle$} #let bigcirc = {$circle.big$} #let ddagger = {$dagger.double$} #let amalg = {$âš¿$} // Relation Symbols #let leq = {$lt.eq$} #let preceq = {$⪯$} #let ll = {$lt.double$} #let subseteq = {$subset.eq$} #let sqsubseteq = {$subset.eq.sq$} #let vdash = {$⊢$} #let geq = {$gt.eq$} #let succeq = {$⪰$} #let gg = {$gt.double$} #let supseteq = {$supset.eq$} #let sqsupseteq = {$supset.eq.sq$} #let ni = {$in.rev$} #let dashv = {$⊣$} #let equiv = {$ident$} #let sim = {$tilde.op$} #let simeq = {$tilde.eq$} #let asymp = {$≍$} #let cong = {$tilde.eqq$} #let neq = {$eq.not$} #let doteq = {$≐$} #let propto = {$prop$} #let mid = {$\u{2223}$} #let bowtie = {$⋈$} #let smile = {$⌣$} #let frown = {$⌢$} // Punctuation Symbols #let cdotp = {$dot.c$} // Arrow symbols #let leftarrow = {$arrow.l$} #let Leftarrow = {$arrow.l.double$} #let rightarrow = {$arrow.r$} #let to = {$arrow.r$} #let Rightarrow = {$arrow.r.double$} #let leftrightarrow = {$arrow.l.r$} #let Leftrightarrow = {$arrow.l.r.double$} #let mapsto = {$arrow.r.bar$} #let hookleftarrow = {$arrow.l.hook$} #let leftharpoonup = {$harpoon.lt$} #let leftharpoondown = {$harpoon.lb$} #let rightleftharpoons = {$harpoons.rtlb$} #let longleftarrow = {$arrow.l.long$} #let Longleftarrow = {$arrow.l.double.long$} #let longrightarrow = {$arrow.r.long$} #let Longrightarrow = {$arrow.r.double.long$} #let implies = {$thin thin arrow.r.double.long thin thin$} #let longleftrightarrow = {$arrow.l.r.long$} #let Longleftrightarrow = {$arrow.l.r.double.long$} #let iff = {$thin thin arrow.l.r.double.long thin thin$} #let longmapsto = {$arrow.r.long.bar$} #let hookrightarrow = {$arrow.r.hook$} #let rightharpoonup = {$harpoon.rt$} #let rightharpoondown = {$harpoon.rb$} #let rightcurvedarrow = {$″$} #let leadsto = {$″$} #let uparrow = {$arrow.t$} #let Uparrow = {$arrow.t.double$} #let downarrow = {$arrow.b$} #let Downarrow = {$arrow.b.double$} #let updownarrow = {$arrow.t.b$} #let Updownarrow = {$arrow.t.b.double$} #let nearrow = {$arrow.tr$} #let searrow = {$arrow.br$} #let swarrow = {$arrow.bl$} #let nwarrow = {$arrow.tl$} #let longrightsquigarrow = {$arrow.r.long.squiggly$} // Miscellaneous Symbols #let ldots = {$dots.h$} #let aleph = {$א$} #let hbar = {$planck.reduce$} #let imath = {$𝚀$} #let jmath = {$𝚥$} #let wp = {$℘$} #let mho = {$ohm.inv$} #let cdots = {$dots.h.c$} #let emptyset = {$nothing$} #let surd = {$√$} #let top = {$⊀$} #let bot = {$⊥$} #let neg = {$not$} #let flat = {$♭$} #let natural = {$♮$} #let sharp = {$♯$} #let partial = {$∂$} #let ddots = {$dots.down$} #let infty = {$infinity$} #let Box = {$square.stroked$} #let Diamond = {$diamond.stroked$} #let Triangle = {$triangle.stroked.t$} #let clubsuit = {$suit.club$} #let diamondsuit = {$♢$} #let heartsuit = {$♡$} #let spadesuit = {$suit.spade$} #let varclubsuit = {$♧$} #let vardiamondsuit = {$suit.diamond$} #let varheartsuit = {$suit.heart$} #let varspadesuit = {$♀$} // Variable-sized Symbols #let prod = {$product$} #let coprod = {$product.co$} #let int = {$integral$} #let oint = {$integral.cont$} #let Join = {$⚝$} #let bigcap = {$sect.big$} #let bigcup = {$union.big$} #let bigsqcup = {$union.sq.big$} #let bigvee = {$or.big$} #let bigwedge = {$and.big$} #let bigodot = {$dot.circle.big$} #let bigotimes = {$times.circle.big$} #let bigoplus = {$plus.circle.big$} #let biguplus = {$union.plus.big$} // Log-like Symbols #let operatorname(input) = {$op(#input)$} // arccos is predefined #let arccot = {$operatorname("arccot")$} #let arccsc = {$operatorname("arccsc")$} #let arcosh = {$operatorname("arcosh")$} #let arcoth = {$operatorname("arcoth")$} #let arcsch = {$operatorname("arcsch")$} #let arcsec = {$operatorname("arcsec")$} // arcsin is predefined // arctan is predefined // arg is predefined #let arsech = {$operatorname("arsech")$} #let arsinh = {$operatorname("arsinh")$} #let artanh = {$operatorname("artanh")$} // cos is predefined // cosh is predefined // cot is predefined // coth is predefined // ctg is predfined // csc is predefined #let csch = {$operatorname("csch")$} // deg is predefined // det is predefined // dim is predefined // exp is predefined // gcd is predefined // hom is predefined // #let Im = {$operatorname("Im")$} // uncomment this to redefine the imaginary part command from the default "ℑ" to "Im" // inf is predefined // ker is predefined #let lcm = {$operatorname("lcm")$} // lg is predefined // lim is predefined // liminf is predefined // limsup is predefined // ln is predefined // log is predefined // max is predefined // min is predefined // mod is predefined // Pr is predefined // #let Re = {$operatorname("Re")$} // uncomment this to redefine the real part command from the default "ℜ" to "Re" // sec is predefined #let sech = {$operatorname("sech")$} // sin is predefined // sinh is predefined // sup is predefined // tan is predefined // tanh is predefined // tg is predefined // Delimiters #let lfloor = {$⌊$} #let rfloor = {$⌋$} #let langle = {$⟹$} #let rangle = {$⟩$} #let vert = {$|$} #let Vert = {$‖$} #let lceil = {$⌈$} #let rceil = {$⌉$} // Math Mode Accents #let check(input) = {$accent(#input, caron)$} #let Vec(input) = {$accent(#input, arrow)$} #let ddot(input) = {$accent(#input, dot.double)$} // Some other constructions #let widetilde(input) = {$accent(#input, tilde)$} #let overleftarrow(input) = {$accent(#input, arrow.l)$} #let widehat(input) = {$accent(#input, hat)$} #let overrightarrow(input) = {$accent(#input, arrow.r)$} // Typst's root(n, x) = LaTeX's \sqrt[n]{x} // Typst's \frac(a, b) = LaTeX's \frac{a}{b} // AMS Delimiters #let ulcorner = {$⌜$} #let urcorner = {$⌝$} #let llcorner = {$⌞$} #let lrcorner = {$⌟$} // AMS Arrows #let dashrightarrow = {$arrow.r.dashed$} #let rightdasharrow = {$arrow.r.dashed$} #let Lleftarrow = {$arrow.l.quad$} #let leftrightharpoons = {$harpoons.ltrb$} #let upuparrows = {$arrows.tt$} #let leftrightsquigarrow = {$↭$} #let rightleftarrows = {$arrows.rl$} #let downdownarrows = {$arrows.bb$} #let dashleftarrow = {$arrow.l.dashed$} #let leftdasharrow = {$arrow.l.dashed$} #let twoheadleftarrow = {$arrow.l.twohead$} #let curvearrowleft = {$arrow.ccw.half$} #let upharpoonleft = {$harpoon.tl$} #let rightrightarrows = {$arrows.rr$} #let twoheadrightarrow = {$arrow.r.twohead$} #let curvearrowright = {$arrow.cw.half$} #let upharpoonright = {$harpoon.tr$} #let leftleftarrows = {$arrows.ll$} #let leftarrowtail = {$arrow.l.tail$} #let circlearrowleft = {$arrow.ccw$} #let downharpoonleft = {$harpoon.bl$} #let rightarrowtail = {$arrow.r.tail$} #let circlearrowright = {$arrow.cw$} #let downharpoonright = {$harpoon.br$} #let leftrightarrows = {$arrows.lr$} #let looparrowleft = {$arrow.l.loop$} #let Lsh = {$↰$} #let rightrightarrows = {$arrows.rr$} #let looparrowright = {$arrow.r.loop$} #let Rsh = {$↱$} #let rightsquigarrow = {$arrow.r.squiggly$} // AMS Negated Arrows #let nleftarrow = {$arrow.l.not$} #let nleftrightarrow = {$arrow.l.r.not$} #let nrightarrow = {$arrow.r.not$} #let nLeftrightarrow = {$arrow.l.r.double.not$} #let nLeftarrow = {$arrow.l.double.not$} #let nRightarrow = {$arrow.r.double.not$} // AMS Greek #let digamma = {$ϝ$} #let updigamma = {$ϝ$} #let Digamma = {$Ϝ$} #let upDigamma = {$Ϝ$} #let varkappa = {$ϰ$} #let upvarkappa = {$kappa.alt$} // AMS Hebrew #let beth = {$ב$} #let daleth = {$ד$} #let gimel = {$ג$} // AMS Miscellaneous #let Square = {$square.stroked$} #let measureadangle = {$angle.arc$} #let Game = {$⅁$} #let blacktriangle = {$triangle.filled.small.t$} #let bigstar = {$★$} #let diagup = {$∕$} #let hslash = {$planck.reduce$} #let lozenge = {$lozenge.stroked$} #let nexists = {$exists.not$} #let Bbbk = {$𝕜$} #let blacktriangledown = {$triangle.filled.small.b$} #let sphericalangle = {$angle.spheric$} #let diagdown = {$â§µ$} #let vartriangle = {$triangle.stroked.small.t$} #let circledS = {$Ⓢ$} #let backprime = {$‵$} #let blacksquare = {$square.filled$} #let triangledown = {$triangle.stroked.small.b$} #let Finv = {$Ⅎ$} #let varnothing = {$⌀$} #let diameter = {$⌀$} #let blacklozenge = {$â§«$} #let eth = {$ð$} #let matheth = {$ð$} // AMS Binary Operators #let dotplus = {$plus.dot$} #let barwedge = {$⊌$} #let boxtimes = {$times.square$} #let ltimes = {$⋉$} #let curlywedge = {$and.curly$} #let circledcirc = {$circle.nested$} #let smallsetminus = {$∖$} #let veebar = {$⊻$} #let boxdot = {$dot.square$} #let rtimes = {$⋊$} #let curlyvee = {$or.curly$} #let centerdot = {$dot.c$} #let Cap = {$sect.double$} #let doublebarwedge = {$⩞$} #let boxplus = {$plus.square$} #let leftthreetimes = {$times.l$} #let circleddash = {$dash.circle$} #let intercal = {$⊺$} #let Cup = {$union.double$} #let boxminus = {$minus.square$} #let divideontimes = {$times.div$} #let rightthreetimes = {$times.r$} #let circledast = {$ast.circle$} // AMS Binary Relations #let leqq = {$lt.eqq$} #let lessapprox = {$⪅$} #let lessgtr = {$lt.gt$} #let risingdotseq = {$≓$} #let subseteqq = {$⫅$} #let curlyeqprec = {$eq.prec$} #let trianglelefteq = {$⊮$} #let unlhd = {$⊮$} #let smallfrown = {$⏜$} #let geqslant = {$⩟$} #let gtrdot = {$gt.dot$} #let gtreqqless = {$⪌$} #let thicksim = {$sim$} #let sqsupset = {$supset.sq$} #let succaprox = {$succ.approx$} #let shortmid = {$thin thin thin thin ⃓ thin$} #let varpropto = {$propto$} #let blacktriangleright = {$triangle.filled.r$} #let leqslant = {$⩜$} #let approxeq = {$approx.eq$} #let lesseqgtr = {$lt.eq.gt$} #let fallingdotseq = {$≒$} #let Subset = {$subset.double$} #let precsim = {$prec.tilde$} #let vDash = {$⊹$} #let bumpeq = {$≏$} #let eqslantgtr = {$⪖$} #let ggg = {$gt.triple$} #let eqcirc = {$≖$} #let thickapprox = {$approx$} #let succcurlyeq = {$succ.eq$} #let vartriangleright = {$⊳$} #let rhd = {$⊳$} #let shortparallel = {$thin thin thin ⃓ thin ⃓$} #let blacktriangleleft = {$triangle.filled.l$} #let eqslantless = {$⪕$} #let lessdot = {$lt.dot$} #let lesseqqgtr = {$⪋$} #let backsim = {$tilde.rev$} #let sqsubset = {$subset.sq$} #let precapprox = {$prec.approx$} #let Vvdash = {$⊪$} #let Bumpeq = {$≎$} #let gtrsim = {$gt.tilde$} #let gtrless = {$gt.lt$} #let circeq = {$≗$} #let supseteqq = {$⫆$} #let curlysucceq = {$eq.succ$} #let trianglerighteq = {$⊵$} #let unrhd = {$⊵$} #let between = {$≬$} #let lesssim = {$lt.tilde$} #let lll = {$lt.triple$} #let doteqdot = {$≑$} #let Doteq = {$≑$} #let backsimeq = {$tilde.eq.rev$} #let preccurlyeq = {$prec.eq$} #let vartriangleleft = {$⊲$} #let lhd = {$⊲$} #let smallsmile = {$⏝$} #let geqq = {$gt.eqq$} #let gtrapprox = {$⪆$} #let gtreqless = {$gt.eq.lt$} #let triangleq = {$eq.delta$} #let Supset = {$supset.double$} #let succsim = {$succ.tilde$} #let Vdash = {$⊩$} #let pitchfork = {$⋔$} #let backepsilon = {$϶$} #let upbackepsilon = {$϶$} // AMS Negated Binary Relations #let nless = {$lt.not$} #let nleq = {$lt.eq.not$} #let lnapprox = {$⪉$} #let precnapprox = {$prec.napprox$} #let nvdash = {$⊬$} #let nsubseteq = {$subset.eq.not$} #let nsubseteqq = {$#h(5pt) slash #h(-7pt)⫅$} #let varsubsetneqq = {$⫋$} #let ngeqq = {$#h(5pt) slash #h(-7pt) gt.eqq$} #let gnsim = {$gt.ntilde$} #let nsucceq = {$succ.eq.not$} #let nshortparallel = {$thin thin thin #h(0.75pt) Ì·#h(-0.75pt) ⃓ thin ⃓$} #let ntriangleright = {$⋫$} #let nvartriangleright = {$⋫$} #let supsetneq = {$supset.neq$} #let nleq = {$lt.eq.not$} #let lneqq = {$lt.neqq$} #let nprec = {$prec.not$} #let nsim = {$tilde.not$} #let nvDash = {$⊭$} #let subsetneq = {$subset.neq$} #let ngtr = {$gt.not$} #let gneq = {$⪈$} #let gnapprox = {$⪊$} #let succnsim = {$succ.ntilde$} #let nparallel = {$parallel.not$} #let ntrianglerighteq = {$⋭$} #let varsupsetneq = {$supset.eq_(#h(-4pt) Ì·)$} #let nleqslant = {$#h(5pt) slash #h(-7pt) ⩜$} #let lvertneqq = {$lt.eqq_(#h(-8.2pt))$} #let npreceq = {$#h(4.75pt) slash #h(-7.25pt) ⪯$} #let notshortmid = {$thin thin thin thin #h(-0.25pt) Ì· #h(0.25pt) ⃓ thin$} #let ntriangleleft = {$⋪$} #let nvartriangleleft = {$⋪$} #let varsubsetneq = {$subset.eq_(#h(-4pt) Ì·)$} #let ngeq = {$gt.eq.not$} #let gneqq = {$gt.neqq$} #let nsucc = {$succ.not$} #let succnapprox = {$succ.napprox$} #let nvDash = {$⊭$} #let nsupseteq = {$supset.eq.not$} #let supsetneqq = {$⫌$} #let nleqq = {$#h(5pt) slash #h(-7pt) lt.eqq$} #let lnsim = {$lt.ntilde$} #let precnsim = {$prec.ntilde$} #let nmid = {$divides.not$} #let ntrianglelefteq = {$⋬$} #let subsetneqq = {$⫋$} #let ngeqslant = {$#h(5pt) slash #h(-7pt)⩟$} #let gvertneqq = {$gt.eqq_(#h(-8.2pt))$} #let ncong = {$tilde.eqq.not$} #let nVDash = {$⊯$} #let nsupseteqq = {$#h(5pt) slash #h(-7pt)⫆$} #let varsupsetneqq = {$⫌$} // Selected stmaryrd Delimiters (that are available in the NewComputerModern Math font) #let Lbag = {$⟅$} #let Rbag = {$⟆$} #let lbag = {$⟅$} #let rbag = {$⟆$} #let llceil = {$⌈ #h(-3.5pt) ⌈ #h(-1.125pt)$} #let lCeil = {$⌈ #h(-3.5pt) ⌈ #h(-1.125pt)$} #let rrceil = {$#h(-1.125pt) ⌉ #h(-3.5pt) ⌉$} #let rCeil = {$#h(-1.125pt) ⌉ #h(-3.5pt) ⌉$} #let llfloor = {$⌊ #h(-3.5pt) ⌊ #h(-1.125pt)$} #let lFloor = {$⌊ #h(-3.5pt) ⌊ #h(-1.125pt)$} #let rrfloor = {$#h(-1.125pt) ⌋ #h(-3.5pt) ⌋$} #let rFloor = {$#h(-1.125pt) ⌋ #h(-3.5pt) ⌋$} #let llbracket = {$⟩$} #let lBrack = {$⟩$} #let rrbracket = {$⟧$} #let rBrack = {$⟧$} // Selected stmaryrd Arrows (that are available in the NewComputerModern Math font) #let Longmapsfrom = {$arrow.l.double.long.bar$} #let nnearrow = {$arrow.tr$} #let nearrow = {$arrow.tr$} #let longmapsfrom = {$arrow.l.long.bar$} #let lightning = {$↯$} #let downzigarrow = {$↯$} #let Longmapsto = {$arrow.r.double.long.bar$} #let nnwarrow = {$arrow.tl$} #let nwarrow = {$arrow.tl$} #let mapsfrom = {$arrow.l.bar$} #let llparenthesis = {$⩇$} #let rrparenthesis = {$⊈$} #let Mapsfrom = {$arrow.l.double.bar$} #let ssearrow = {$arrow.br$} #let searrow = {$arrow.br$} #let leftarrowtriangle = {$⇜$} #let Mapsto = {$arrow.r.double.bar$} #let swarrow = {$arrow.bl$} #let swarrow = {$arrow.bl$} #let rightarrowtriangle = {$⇟$} #let leftrightarrowtriangle = {$⇿$} // Selected stmaryrd Binary Operators (that are available in the NewComputerModern Math font) #let boxast = {$ast.sq$} #let boxcircle = {$⧇$} #let varogreaterthan = {$gt.circle$} #let ogreaterthan = {$gt.circle$} #let ogtr = {$gt.circle$} #let varcurlyvee = {$or.curly$} #let varobslash = {$backslash.circle$} #let obslash = {$backslash.circle$} #let varolessthan = {$lt.circle$} #let olessthan = {$lt.circle$} #let oless = {$lt.circle$} #let varotimes = {$times.circle$} #let boxbar = {$◫$} #let obar = {$⊶$} #let varobar = {$⌜$} #let varcurlyvee = {$and.curly$} #let varocircle = {$circle.nested$} #let ocircle = {$circle.nested$} #let varominus = {$minus.circle$} #let boxbox = {$⧈$} #let emptybox = {$square.stroked$} #let talloblong = {$⫟$} #let varoast = {$ast.circle$} #let oast = {$ast.circle$} #let varodot = {$dot.circle$} #let varoplus = {$dot.circle$} #let Yup = {$⅄$} #let boxbslash = {$⧅$} #let boxslash = {$⧄$} #let boxdiag = {$⧄$} #let interleave = {$⫎$} #let varbigcirc = {$circle.big$} #let varoslash = {$⊘$} // Selected stmaryrd Large Binary Operators (that are available in the NewComputerModern Math font) #let biginterleave = {$⫌$} #let bigsqcap = {$sect.sq.big$}
https://github.com/yonatanmgr/university-notes
https://raw.githubusercontent.com/yonatanmgr/university-notes/main/0366-%5BMath%5D/03661101-%5BCalculus%201A%5D/src/lectures/03661101_lecture_15.typ
typst
#import "/template.typ": * #import "/utils/graph.typ": * #show: project.with( title: "חדו׮א 1א׳ - שיעוך 15", authors: ("<NAME>",), date: "20 ב׀בךואך, 2024", ) #set enum(numbering: "(1.א)") === (מש׀ט) מש׀ט הסנדוויץ׳ נתונות שלוש ׀ונק׊יות $f,g,h: I bs {x_0} -> RR$. נניח כי מתקיים $f(x)<=g(x)<=h(x), forall x in I bs {x_0}$, וגם $limto(x_0) f(x) = limto(x_0) h(x) = L$. אזי, $limto(x_0) g(x) = L$. ==== הוכחה (ל׀י הגדךת קושי) ניקח $epsilon >0$ שךיךותי. אז $exists delta_1 > 0: 0< abs(x-x_0)<delta_1 => abs(f(x)-L)<epsilon => L-epsilon<f(x)$, \ וגם $exists delta_2 >0:0<abs(x-x_0) < delta_2 => abs(h(x) -L) < epsilon => h(x) < L+epsilon$. נבח׹ $delta = min{delta_1, delta_2}$. \ אז $0<abs(x-x_0)<delta$ גו׹׹ $L-epsilon < f(x) <= g(x) <= h(x) < L+epsilon$. כלומ׹ $abs(g(x)-L) < epsilon$. #QED ==== דוגמה ש׮ל: $liminff((2^x+3^x)^(1/x))= 3$. נ׹אה כי $f(x) = 3 = (3^x)^(1/x) <= (2^x+3^x)^(1/x) <= (3^x+3^x)^(1/x) = (2 dot 3^x)^(1/x) = 2^(1/x)dot 3 = h(x)$. ל׀י כלל הסנדוויץ׳, אם נוכיח כי $h(x)->3$, סיימנו. אם כך, נוכיח כי $liminff(2^(1/x))=1$: $ forall epsilon > 0 exists N >0 : forall x > N => abs(2^(1/x)-1) < epsilon ==> forall epsilon > 0 exists N in NN : abs(2^(1/N) - 1) <epsilon ==> 2^(1/N) < 1 + epsilon $ ואז $forall x > N$ יתקיים $1-epsilon < 1 < 2^(1/x) < 2^(1/N) < 1+epsilon$. #QED === (למה) $limto(0) (sin x)/x = 1$. ==== הוכחה מס׀יק להוכיח $limto(0^+) (sin x)/x = 1$ כי אז $limto(0^-) (sin x)/x eq^(x=-t) limits(lim)_(t->0^+) (sin (-t))/(-t) = limits(lim)_(t->0^+) (sin t)/t =1$. כב׹ הוכחנו כי $forall 0 <= x < pi/2$, $sin x <= x$. נוכיח כעת גם $x<=tan x, forall 0 <= x < pi/2$. // #grid(columns: 2)[ #align(center)[ #image("/attachments/Screenshot 2024-02-20 at 12.41.47.png", width: 25%) ] // ] ואז שטח המשולש $triangle.t O A C$ $<=$ שטח הגז׹ה $O A B$. $cancel(1/2) r x <= cancel(1/2) r abs(C A) = tan x, 0<x<pi/2$. כלומ׹, קיבלנו$x <= tan x, forall 0 <= x < pi/2$. ואז $sin x <= x <= tan x, 0<=x<pi/2$ $arrl$ $1<= x/(sin x) <= 1/(cos x), 0< x< pi/2$. נקבל לבסוף $cos x <= (sin x)/x <= 1, 0<x<pi/2$. נ׹אה כי $cos x -->^(x->0^+) 1$, ולכן מכלל הסנדוויץ׳ $(sin x)/x->1$. #QED #pagebreak() = ך׊י׀ות של ׀ונק׊יה == ך׊י׀ות בנקודה ובקטע - תהי $f: I->RR$ כאשך $I=(a,b)$ קטע ׀תוח. נאמך כי $f$ *ך׊י׀ה בנקודה $x_0 in I$* אם מתקיים $limto(x_0) f(x)= f(x_0)$. - נאמך כי ה׀ונק׊יה *ך׊י׀ה בכל הקטע ה׀תוח $I$* אם $f$ ך׊י׀ה בכל נקודה $x_0 in I$. === (דוגמה) האם ׀ונק׊ית די׹יכלה ך׊י׀ה? עבוך ׀ונק׊ית די׹יכלה, אשך הוגד׹ה $D(x) = cases(1 "if" x in QQ, 0 "if" x in.not QQ)$ הוכחנו כי $exists.not limto(x_0) D(x)$ בשום נקודה $x_0 in RR$. לכן, $D(x)$ לא ך׊י׀ה בשום נקודה $x_0 in RR$. משד שני, למדנו גם את ה׀ונק׊יה $f(x) = x D(x)$ שגם לה אין גבול בכל $0!=x in RR$. אז $limto(0) f(x) = 0 =f(0)$ לכן $f(x)$ ך׊י׀ה בנקודה ממשית יחידה $x_0 = 0$. == ך׊י׀ות מימין ומשמאל ונקודות אי-ך׊י׀ות === (הגד׹ה) ך׊י׀ות מימין ומשמאל - תהי $f: [a,b) -> RR$. נאמך ש-$f$ *ך׊י׀ה מימין בנקודה $a$* אם מתקיים $limto(a^+) f(x) = f(a)$. - תהי $f: (c,a] -> RR$. נאמך ש-$f$ *ך׊י׀ה משמאל בנקודה $a$* אם מתקיים $limto(a^-) f(x) = f(a)$. === (הגד׹ה) שמשום ׀ונק׊יה נתונה ׀ונק׊יה $f: A->RR$ ו-$B subset A$. נסמן $bv(f, B)$ את ה׀ונק׊יה $f$ המוגדךת ךק על $B$. === (טענה) תהי $f: (c,b) -> RR$ ותהי $a in (c,b)$. אזי $f$ ך׊י׀ה ב-$a$ אם׎ם $bv(f, (c,a])$ ך׊י׀ה משמאל ב-$a$ ו-$bv(f, [a,b))$ ך׊י׀ה מימין ב-$a$. === (הגד׹ה) נקודת אי-ך׊י׀ות - נתונה ׀ונק׊יה $f$ המוגדךת בקטע ה׀תוח $I$ סביב נקודה $x_0$, ׀ךט אולי בנקודה $x_0$ ע׊מה. אזי, הנקודה $x_0$ נקךאת *נקודת אי-ך׊י׀ות סליקה* אם $exists limto(x_0) f(x) != f(x_0)$. - *נקודת אי-ך׊י׀ות מסוג ךאשון*: אם קיימים ושונים הגבולות החד-שדדיים $limto(x_0^+) f(x)$ ו-$limto(x_0^+) f(x)$. - *נקודת אי-ך׊י׀ות מסוג שני*: אם ל׀חות אחד מהגבולות החד-שדדיים $limto(x_0^+) f(x)$ ו-$limto(x_0^+) f(x)$ לא קיים. ==== דוגמה: $y= f(x) = sin 1/x, x_0 = 0$ #graph(w: 15, h: 2, start:0.2, end:-0.2, functions: (x=>calc.sin(1/x),), h-asymptotes: (1, -1)) $ sin (1/x) = 0 ==> 1/x = pi k ==> x_k^((1)) = 1/(pi k), k=pm 1, pm 2, p, 3, dots ==> sin 1/x = 1 ==> \ 1/x = pi/2 + 2pi k, k=0, pm 1, pm 2, dots ==> x_k^((2)) = 1/(pi/2 + 2pi k) $ האם קיים $limto(0) sin 1/x$? לא, כי $x_k^((1)) -->^(k->oo) 0 $ ו-$x_k^((2)) -->^(k->oo) 0$. $f(x_k^((1))) = 0 --> 0$ אך $f(x_k^((2))) = 1 --> 1$ ו-$0!=1$. ואז, ל׀י הגדךת היינה, $exists.not limto(0) sin 1/x$ ואז $x_0 = 0$ נקודת אי-ך׊י׀ות מהסוג השני. ==== דוגמה נוס׀ת: האם קיים $limto(0) f(x)$ עבוך $f(x)=x sin 1/x$? כן, כי $x->0$ ו-$sin 1/x$ חסומה (כאשך $x->0$) ואז $x sin 1/x -> 0$. #align(center)[ #graph(w: 8, h: 8, start:0.1125, end:-0.1125, functions: (x=>x*calc.sin(1/x),), additionals: ( x=>x, x=>-x)) ]
https://github.com/herbhuang/utdallas-thesis-template-typst
https://raw.githubusercontent.com/herbhuang/utdallas-thesis-template-typst/main/content/background.typ
typst
MIT License
#import "/utils/todo.typ": TODO = Background #TODO[ Describe each proven technology / concept shortly that is important to understand your thesis. Point out why it is interesting for your thesis. Make sure to incorporate references to important literature here. ] == e.g. User Feedback #TODO[ This section would summarize the concept User Feedback using definitions, historical overviews and pointing out the most important aspects of User Feedback. ] == e.g. Representational State Transfer #TODO[ This section would summarize the architectural style Representational State Transfer (REST) using definitions, historical overviews and pointing out the most important aspects of the architecture. ] == e.g. Scrum #TODO[ This section would summarize the agile method Scrum using definitions, historical overviews and pointing out the most important aspects of Scrum. ]
https://github.com/Enter-tainer/zint-wasi
https://raw.githubusercontent.com/Enter-tainer/zint-wasi/master/typst-package/README.md
markdown
MIT License
# tiaoma [tiaoma(条码)](https://github.com/enter-tainer/zint-wasi) is a barcode generator for typst. It compiles [zint](https://github.com/zint/zint) to wasm and use it to generate barcode. It support nearly all common barcode types. For a complete list of supported barcode types, see [zint's documentation](https://zint.org.uk/): - Australia Post - Standard Customer - Reply Paid - Routing - Redirection - Aztec Code - Aztec Runes - Channel Code - Codabar - Codablock F - Code 11 - Code 128 with automatic subset switching - Code 16k - Code 2 of 5 variants: - Matrix 2 of 5 - Industrial 2 of 5 - IATA 2 of 5 - Datalogic 2 of 5 - Interleaved 2 of 5 - ITF-14 - Deutsche Post Leitcode - Deutsche Post Identcode - Code 32 (Italian pharmacode) - Code 3 of 9 (Code 39) - Code 3 of 9 Extended (Code 39 Extended) - Code 49 - Code 93 - Code One - Data Matrix ECC200 - DotCode - Dutch Post KIX Code - EAN variants: - EAN-13 - EAN-8 - Grid Matrix - GS1 DataBar variants: - GS1 DataBar - GS1 DataBar Stacked - GS1 DataBar Stacked Omnidirectional - GS1 DataBar Expanded - GS1 DataBar Expanded Stacked - GS1 DataBar Limited - Han Xin - Japan Post - Korea Post - LOGMARS - MaxiCode - MSI (Modified Plessey) - PDF417 variants: - PDF417 Truncated - PDF417 - Micro PDF417 - Pharmacode - Pharmacode Two-Track - Pharmazentralnummer - POSTNET / PLANET - QR Code - rMQR - Royal Mail 4-State (RM4SCC) - Royal Mail 4-State Mailmark - Telepen - UPC variants: - UPC-A - UPC-E - UPNQR - USPS OneCode (Intelligent Mail) ## Example ```typ #import "@preview/tiaoma:0.2.1" #set page(width: auto, height: auto) = tiáo mǎ #tiaoma.ean("1234567890128") ``` ![example](./example.svg) ## Manual Please refer to [manual](./manual.pdf) for more details. ## Alternatives There are other barcode/qrcode packages for typst such as: - https://github.com/jneug/typst-codetastic - https://github.com/Midbin/cades Packages differ in provided customization options for generated barcodes. This package is limited by zint functionality, which focuses more on coverage than customization (e.g. inserting graphics into QR codes). Patching upstream zint code is (currently) outside of the scope of this package - if it doesn't provide functionality you need, check the rest of the typst ecosystem to see if it's available elsewhere or request it [upstream](https://github.com/zint/zint) and [notify us](https://github.com/Enter-tainer/zint-wasi/issues) when it's been merged. ### Pros 1. Support for far greater number of barcode types (all provided by zint library) 2. Should be faster as is uses a WASM plugin which bundles zint code which is written in C; others are written in pure typst or javascript. ### Cons 1. While most if not all of zint functionality is covered, it's hard to guarantee there's no overlooked functionality. 2. This package uses typst plugin system and has a WASM backend written in Rust which makes is less welcoming for new contributors.
https://github.com/crd2333/crd2333.github.io
https://raw.githubusercontent.com/crd2333/crd2333.github.io/main/src/docs/AI/Reinforce%20Learning/策略孊习.typ
typst
--- order: 3 --- #import "/src/components/TypstTemplate/lib.typ": * #show: project.with( title: "AI 笔记之区化孊习", lang: "zh", ) #let ba = $bold(a)$ #let bw = $bold(w)$ = 策略孊习 == 策略梯床 - 前面讲的是基于价倌$V$或$Q$的策略而策略梯床是完党䞍同的䞀种方法 - 回顟 - #fig("/public/assets/AI/AI_RL/img-2024-07-05-09-36-52.png") - #fig("/public/assets/AI/AI_RL/img-2024-07-05-09-38-37.png") - #fig("/public/assets/AI/AI_RL/img-2024-07-05-09-41-23.png") - 䌘点具有曎奜的收敛性莚圚高绎床或连续的劚䜜空闎䞭曎有效胜借孊习出随机策略 - 猺点通垞䌚收敛到局郚最䌘而非党局最䌘评䌰䞀䞪策略通垞䞍借高效并具有蟃倧的方差 - 回到现圚䞺什么芁匕入基于策略的区化孊习方法 - 基于价倌的区化孊习方法 + 孊习价倌凜数 + 利甚价倌凜数富出策略 + 曎高的样本训练效率 + 通垞仅适甚于具有犻散劚䜜的环境 - 基于策略的区化孊习方法 + 䞍需芁价倌凜数 + 盎接孊习策略 + 圚高绎或连续劚䜜空闎场景䞭曎加高效 + 适甚任䜕劚䜜类型的场景 + 容易收敛到次䌘解 - 基于挔员-评论家的方法将二者䌘势结合 - 基于策略的区化孊习方法方法盎接搜玢最䌘策略$pi^*$ - 通垞做法是参数化策略 $pi_theta$并利甚无梯床或基于梯床的䌘化方法对参数进行曎新 - 无梯床䌘化启发匏䌘化方法劂有限差分方法、亀叉熵方法、遗䌠算法等可以有效芆盖䜎绎参数空闎䜆基于梯床的训练仍然是銖选因䞺其具有曎高的采样效率这里没有诊细展匀 - 对比之前的衚栌型策略 + 采取某䞪劚䜜的抂率的计算方匏䞍同状态 $s$ 䞊采取劚䜜 $a$ 的抂率䞀䞪是盎接查衚䞀䞪是计算 $pi_theta (a|s)$ + 策略的曎新方匏䞍同䞀䞪是盎接修改衚栌对应条目䞀䞪是曎新参数 $theta$ + 最䌘策略的定义䞍同 - 基本思想 - 利甚目标凜数定义策略䌘劣性$J(theta) = J(pi_theta)$目标凜数劂䜕讟计? - 对目标凜数进行䌘化䌘化方向劂䜕计算以寻扟最䌘策略 - 䌘化方向 - 目标凜数䞍可埮分时䜿甚无梯床算法进行最䌘参数搜玢 - 目标凜数可埮分时利甚基于梯床的䌘化方法寻扟最䌘策略 $theta_(t+1) <- theta_t + alpha nabla_theta J(theta_t)$ - 目标凜数 #fig("/public/assets/AI/AI_RL/img-2024-07-05-09-59-33.png") - 状态分垃$d(s)$ - 策略无关的状态分垃 - 圚这类情况䞋目标凜数关于参数的梯床通垞曎奜算 - 䞀䞪简单的做法是取 $d(s)$ 䞺均匀分垃即每䞪状态郜有盞同的权重 $1\/|S|$ - 及䞀种做法是把权重集䞭分配给䞀郚分状态集合。䟋劂圚䞀些任务䞭䞀䞪回合只从状态 $s_0$ 匀始那么可以讟眮䞺$d(s_0)=1,d(s!=s_0)=0$ - 策略盞关的状态分垃 - 圚这种情况䞋通垞选甚皳态状态分垃 - $d(s)$ 是皳态状态分垃若对䞀䞪状态蜬移 $s->a->s'$满足#mitex(`d(s^{\prime})=\sum_{s\in\mathcal{S}}\sum_{a\in\mathcal{A}}p(s^{\prime}|s,a)\cdot\pi_{\theta}(a|s)\cdot d(s)`) - 劂果采甚最倧化平均蜚迹回报目标凜数$ max_theta J(theta)=max_theta EE_(tau wave p_theta (tau)) [sum_t r(s_t,a_t)] $ - $tau$ 䞺策略 $pi_theta$ 采样而来的蜚迹 ${s_1,a_1,r_1,dots,s_T}$ - è®° $G(tau)=sum_t r(s_t,a_t)$平均蜚迹回报目标的策略梯床䞺 $ nabla_theta J(theta)=nabla_theta int p_theta (tau)G(tau) dif tau &= EE_(tau wave p_theta (tau)) [nabla_theta log p_theta (tau)G(tau)]\ &=EE_(tau wave p_theta (tau)) [sum_(t=1)^T nabla_theta log pi_theta (a_t|s_t)G(tau)] $ - 其䞭出现 $log$ 是因䞺乘䞀䞪陀䞀䞪 $p_theta (tau)$于是 $(nabla_theta p_theta (tau)) / (p_theta (tau))$ 变成 $nabla_theta log p_theta (tau)$ - #fig("/public/assets/AI/AI_RL/img-2024-07-05-10-18-35.png") - 及倖䞀种目标凜数和策略梯床 #fig("/public/assets/AI/AI_RL/img-2024-07-05-10-19-19.png") - 䜿甚䞍同的策略梯床以及䞍同的近䌌方法我们可以埗到各种各样的基于策略梯床的区化孊习算法劂 REINFORCE、DDPG、PPO等 === REINFORCE 算法 - 对于随机策略$pi_theta (a,s) = P(a|s, theta)$ - 盎觉䞊我们应该降䜎垊来䜎价倌/奖励的劚䜜出现的抂率提高垊来高价倌/奖励的劚䜜出现的抂率 - 䞊䞀章䞭我们掚富出了策略梯床最倧化平均蜚迹回报目标凜数圚实践䞭我们可以甚蒙特卡掛方法进行䌰计 #mitex(`\nabla_{\theta}J(\theta)=\ \frac{1}{N}\sum_{n=1}^{N}\sum_{t=1}^{T^{n}}R(\tau^{n})\nabla_{\theta}l o g\,\pi_{\theta}(a_{t}^{n}|s_{t}^{n})`)据歀我们可以埗到 REINFORCE 算法 #algo(caption: "REINFORCE 算法")[ ```typ 利甚策略$pi_theta (a|s)$采样$N$条蜚迹${tau_i}$ 计算梯床 $nabla_theta J(theta)=1/N sum_(n=1)^N (sum_(t=1)^(T^n) R(tau^n) nabla_theta log pi_theta (a_t^n|s_t^n))$ 曎新参数 $theta <- theta + alpha nabla_theta J(theta)$ ``` ] #fig("/public/assets/AI/AI_RL/img-2024-07-05-15-16-33.png", width: 80%) - 思考区化孊习䞎分类问题对比 + 郜是蟓入状态蟓出芁采取的行䞺 + 分类问题监督孊习假讟有垊标筟的训练数据随后利甚极倧䌌然法进行䌘化 + 区化孊习没有标筟只胜通过试错的方匏䞎环境亀互获取奖励以替代监督信息进行训练 - 䞀䞪问题——*训练可胜存圚偏差* #fig("/public/assets/AI/AI_RL/img-2024-07-05-10-41-17.png") - 解决办法添加 *baseline*将奖励凜数减去䞀䞪基线 $b$䜿埗 $R(tau)-b$ 有正有莟 - 劂果 $R(tau)>b$ 就让采取对应劚䜜的抂率提升劂果 $R(tau)<b$ 就让采取对应劚䜜的抂率降䜎 - 䞊述蒙特卡掛采样方法变䞺 #mitex(`\nabla_{\theta}J(\theta)=\ \frac{1}{N}\sum_{n=1}^{N}\sum_{t=1}^{T^{n}}(R(\tau^{n})-b)\nabla_{\theta}l o g\,\pi_{\theta}(a_{t}^{n}|s_{t}^{n})`) - 数孊证明减去䞀䞪基线并䞍䌚圱响原梯床的期望倌 - 劂䜕实现策略梯床 - 隟以计算圚实际应甚时郜䌚采甚 Pytorch、Tensorflow 䞭的自劚求富工具蟅助求解 - 将策略梯床的目标凜数视䞺极倧䌌然法的目标凜数䞀䞪利甚环积奖励进行加权的版本 - 策略梯床算法圚样本利甚率以及皳定性䞊存圚猺陷 - 由于策略梯床算法䞺同策略算法因歀样本利甚率蟃䜎 - 蟃倧的策略曎新或䞍适宜的曎新步长䌚富臎训练的䞍皳定圚监督孊习䞭训练数据具有独立同分垃的性莚而圚区化孊习䞭䞍适宜的曎新步长 $->$ 坏策略 $->$ 䜎莚量的数据于是可胜隟以从糟糕的策略䞭恢倍进而富臎性胜厩溃 - 犻策略梯床根据重芁性采样利甚匂策略样本 - 听䞍懂 - 自然策略梯床 - 听䞍懂 === Actor-Critic 算法 - 䞺什么芁匕入 Actor-Critic䞻芁是因䞺 REINFORCE 效率䞍高 - REINFORCE 算法䞭的的蜚迹回报期望采甚盎接盞加 $R(tau^n)=sum_(t'=t)^T r(s_t'^i,a_t'^i)$ - 这样做方差蟃倧䞍易收敛。我们可以甚劚䜜价倌䌰计 $hat(Q)^pi$ 来近䌌蜚迹回报期望$EE_(pi_theta) sum_(t'=t)^T r(s_t'^i,a_t'^i)$这就是评论家(critic) - 对应地策略 $pi_theta$ 称䞺执行者(actor) #algo(caption: "Actor-Critic 算法")[ ```typ 䜿甚圓前策略 $pi_theta$ 圚环境䞭进行采样 策略提升$theta <- theta + alpha nabla_theta J(theta) approx 1/N sum_(i=1)^N (sum_(t=1)^T nabla_theta log pi_theta (a_t^i|s_t^i) hat(Q)^pi (s_t^i,a_t^i))$ 拟合圓前策略的劚䜜倌凜数$hat(Q)^pi (s_t'^i,a_t'^i) approx sum_(t'=t)^T r(s_t'^i,a_t'^i)$ ``` ] #fig("/public/assets/AI/AI_RL/img-2024-07-05-15-17-48.png") - Advantage Actor-Critc(A2C)算法 - 思想通过减去䞀䞪基线倌来标准化评论家的打分 - 降䜎蟃差劚䜜抂率提高蟃䌘劚䜜抂率 - 进䞀步降䜎方差 - 䌘势凜数$A^pi (s,a)=Q^pi (s,a)-V^pi (s_t)$改变critic于是原本 AC 算法的策略梯床 #mitex(`\nabla_{\theta}J(\theta)\approx\frac{1}{N}\sum_{i=1}^{N}\left(\sum_{t=1}^{T}V_{\theta}\,l o g\,\pi_{\theta}(a_{t}^{i}|s_{t}^{i})\bar{Q}^{\pi}(s_{i}^{i},\alpha_{t}^{i})\right)`) 变䞺 #mitex(`\nabla_{\theta}J(\theta)\approx\frac{1}{N}\sum_{i=1}^{N}\left(\sum_{t=1}^{T}\nabla_{\theta}\,l o g\,\pi_{\theta}(a_{t}^{i}|s_{t}^{i})\bar{A}^{\pi}(s_{i}^{i},\alpha_{t}^{i})\right)`) - $Q$ 和 $V$需芁甚䞀䞪神经眑络拟合吗 - 䞍需芁 $hat(Q)^pi (s_t^i,a_t^i)= R(s_t^i,a_t^i) + gamma hat(V)^pi (s_(t+1)^i)$只需甚䞀䞪神经眑络拟合$hat(V)^pi$ - 状态倌䌰计$hat(V)^pi$胜吊䞎策略 $pi_theta$ 共甚眑络 #fig("/public/assets/AI/AI_RL/img-2024-07-05-11-15-17.png") - 劂果采甚盞同的眑络去训练这蟹的 loss function 没有讲actor 的 losscritic 的 lossactor 的正则化项 entropy可以参考代码或者看 #link("https://www.cnblogs.com/wangxiaocvpr/p/8110120.html")[这篇文章] - 批量曎新没听懂 - 问题利甚单䞪样本进行曎新曎新方差蟃倧训练皳定性差 - 解决方案获埗䞀䞪批次的数据后再进行曎新分䞺同步和匂步䞀种方法 #fig("/public/assets/AI/AI_RL/img-2024-07-05-11-22-12.png") - 批量曎新再改进 #fig("/public/assets/AI/AI_RL/img-2024-07-05-11-22-32.png") - Asynchronous Advantage Actor-Critc(A3C)算法 - 侎A2C䞀样䜿甚䌘势凜数 - 匂步的Actor-Critic方法胜借充分利甚倚栞CPU资源采样环境的经验数据利甚GPU资源匂步地曎新眑络这有效提升了区化孊习算法的训练效率 == TRPO & PPO - TRPOTrust Region Policy Optimization是䞀种基于策略梯床的区化孊习算法其目标是最倧化策略的期望回报 - 眮信域(Trust Region)的抂念就是圚 $N(theta_"now")$ 的邻域内$L(theta|theta_"now")$ 足借逌近䌘化目标 $J(theta)$ - 前面介绍的策略梯床方法包括 REINFORCE 和 Actor-Critic甚蒙特卡掛近䌌梯床 $nabla_theta J(theta)$埗到随机梯床然后做随机梯床䞊升曎新 $theta$䜿埗目标凜数 $J(theta)$ 增倧而这里是甚䞍同的方法 - 目标凜数等价圢匏写成#mitex(`J(\theta)~=~\mathbb{E}_{S}\left[\mathbb{E}_{A\cdots\pi(\cdot|S;\theta_{\mathrm{now}})}\left[\frac{\pi(A\mid S;\,\theta)}{\pi(A\mid S;\,\theta_{\mathrm{now}})}~\cdot\,{\cal Q}_{\pi}(S,A)\right]\right]`) - å…¶äž­ $Q_pi (S, A)$ 䟝旧无法求解因歀䜿甚迭代䞭的䞊䞀步的 $pi=pi(a_t | s_t\; theta_"old")$ - TRPO 第二郚眮信域的选择 - 讀䞺讟定的 $Delta$ - 甹 KL 散床衡量䞀䞪抂率莚量凜数的距犻 - TRPO 算法真正实现起来并䞍容易䞻芁隟点圚于第二步——最倧化。 #hline() - PPO 基于 TRPO 的思想䜆是其算法实现曎加简单 - PPO-惩眚 - 盎接将眮信域纊束 KL 散床䜜䞺损倱凜数的䞀郚分这样就䞍需芁求解最倧化问题 - PPO-截断 - PPO 的及䞀种圢匏 PPO-截断PPO-Clip曎加盎接它圚目标凜数䞭进行限制以保证新的参数和旧的参数的差距䞍䌚倪倧 == 连续控制 - 考虑这样䞀䞪问题我们需芁控制䞀只机械手臂完成某些任务获取奖励。机械手臂有䞀䞪关节分别可以圚 $[0, 360] 侎 [0, 180]$ 的范囎内蜬劚。这䞪问题的自由床是 $d = 2$劚䜜是二绎向量劚䜜空闎是连续集合 $cal(A) = [0, 360] times [0, 180]$。 - 歀前我们孊过的区化孊习方法党郚郜是针对犻散劚䜜空闎䞍胜盎接解决䞊述续控制问题。劂果甚眑栌化方法将连续劚䜜空闎犻散化䌚富臎劚䜜空闎过倧训练效率䜎䞋。特别是自由床蟃高的问题这种方法几乎䞍可行。 == DPG - 确定策略梯床(deterministic policy gradient)是䞀种 actor-critic 方法 - 确定策略眑络 - 圚之前章节里策略眑络 $pi(a|s\; theta)$ 是䞀䞪抂率莚量凜数它蟓出的是抂率倌。本节的确定策略眑络 $mu(s\; theta)$ 的蟓出是 $d$ 绎的向量 $ba$䜜䞺劚䜜。䞀种策略眑络䞀䞪是随机的䞀䞪是确定性的 - 䞪人讀䞺䞍是埈本莚感觉就是把圚倖的 argmax 攟到神经眑络里面去了 - 确定价倌眑络 - 价倌眑络 $Q(s, ba\; bw)$ 也是䞀䞪神经眑络它的蟓入是状态 $s$ 和劚䜜 $ba$蟓出 $hat(q) = q(s, ba; bw)$ 是䞪实数 - 总而蚀之䞪人讀䞺这里盞圓于 actor-critic 的变种并䞔真正把䞀䞪眑络分了匀来䞀䞪眑络分别训练而䞍是共享前几层 - 训练过皋 - 做训练的时候可以同时对价倌眑络和策略眑络做训练。每次从经验回攟数组䞭抜取䞀䞪四元组记䜜 $(s_j, a_j, r_j, s_(j+1))$。把价倌眑络和策略眑络圓前参数分别记䜜 $w_"now"$ 和 $theta_"now"$ -
https://github.com/YouXam/bupt-network-resources-guide
https://raw.githubusercontent.com/YouXam/bupt-network-resources-guide/main/README.md
markdown
MIT License
# bupt-network-resources-guide 北邮眑络资源手册包含了北邮孊生可胜需芁的各种眑络资源的介绍和䜿甚方法。 目圕预览 ![目圕预览](https://github.com/YouXam/bupt-network-resources-guide/releases/latest/download/preview.jpg) ## 䞋蜜 䜠可以从 [这里](https://github.com/YouXam/bupt-network-resources-guide/releases/latest/download/bupt-network-resources-guide.pdf) 䞋蜜最新版本的 PDF 文件。 ## 猖译 ```bash typst compile --font-path fonts main.typ bupt-network-resources-guide.pdf ```
https://github.com/Quaternijkon/notebook
https://raw.githubusercontent.com/Quaternijkon/notebook/main/content/数据结构䞎算法/.chapter-数据结构/树/二叉树最倧深床.typ
typst
#import "../../../../lib.typ":* === #Title( title: [二叉树最倧深床], reflink: "https://leetcode.cn/problems/maximum-depth-of-binary-tree/description/", level: 1, )<二叉树最倧深床> #note( title: [ 二叉树最倧深床 ], description: [ 给定䞀䞪二叉树 root 返回其最倧深床。 二叉树的 最倧深床 是指从根节点到最远叶子节点的最长路埄䞊的节点数。 ], examples: ([ 蟓入root = [3,9,20,null,null,15,7] 蟓出3 ],[ 蟓入root = [1,null,2] 蟓出2 ] ), tips: [ - 树䞭节点的数量圚 $[0, 10^4]$ 区闎内。 - $-100 <= "Node.val" <= 100$ ], solutions: ( ( name:[后序遍历DFS: 递園], text:[ 树的后序遍历 / 深床䌘先搜玢埀埀利甚 递園 或 栈 实现。 星然树的深床 等于 巊子树的深床 侎 右子树的深床䞭的 最倧倌 +1。 1. 终止条件 圓 `root​` 䞺空诎明已越过叶节点因歀返回 深床 0 。 2. 递掚工䜜 本莚䞊是对树做后序遍历。 - 计算节点 `root​` 的 巊子树的深床 即调甚 `maxDepth(root.left)`。 - 计算节点 `root​` 的 右子树的深床 即调甚 `maxDepth(root.right)`。 3. 返回倌 返回 歀树的深床 即 `max(maxDepth(root.left), maxDepth(root.right)) + 1`。 ], code:[ ```cpp class Solution { public: int maxDepth(TreeNode* root) { if (root == nullptr) return 0; return max(maxDepth(root->left), maxDepth(root->right)) + 1; } }; ``` ] ),( name:[层序遍历BFS], text:[ 树的层序遍历 / 广床䌘先搜玢埀埀利甚 队列 实现。 每遍历䞀层则计数噚 +1 盎到遍历完成则可埗到树的深床。 + 特䟋倄理 圓 `root​` 䞺空盎接返回 深床 0 。 + 初始化 队列 `queue` 加入根节点 `root` 计数噚 `res` = 0。 + 埪环遍历 圓 `queue` 䞺空时跳出。 - 初始化䞀䞪空列衚 `tmp` 甚于䞎时存傚䞋䞀层节点。 - 遍历队列 遍历 `queue` 䞭的各节点 `node` 并将其巊子节点和右子节点加入 `tmp。` - 曎新队列 执行 `queue` = `tmp` 将䞋䞀层节点赋倌给 `queue。` - 统计层数 执行 `res += 1` 代衚层数加 1。 + 返回倌 返回 `res` 即可。 ], code:[ ```cpp class Solution { public: int maxDepth(TreeNode* root) { if (root == nullptr) return 0; vector<TreeNode*> que; que.push_back(root); int res = 0; while (!que.empty()) { vector<TreeNode*> tmp; for(TreeNode* node : que) { if (node->left != nullptr) tmp.push_back(node->left); if (node->right != nullptr) tmp.push_back(node->right); } que = tmp; res++; } return res; } }; ``` ] ) ), gain:none, )
https://github.com/malramsay64/resume
https://raw.githubusercontent.com/malramsay64/resume/main/template.typ
typst
#import "utils.typ" #import "@preview/fontawesome:0.4.0" as fa /* Styles */ #let accentColor = luma(80) #let headerInfoStyle(str) = {text( size: 10pt, fill: accentColor, str )} #let headerQuoteStyle(str) = {text( size: 10pt, weight: "medium", // style: "italic", fill: accentColor, str )} #let sectionTitleStyle(str, color:black) = {text( size: 16pt, weight: "bold", fill: color, str )} #let entryA1Style(str) = {text( size: 10pt, weight: "bold", str )} #let entryA2Style(str) = {text( weight: "medium", // fill: accentColor, style: "oblique", str )} #let entryB1Style(str) = {text( // size: 10pt, fill: accentColor, weight: "medium", str )} #let entryB2Style(str) = {text( size: 9pt, weight: "medium", fill: luma(80), style: "oblique", str )} // set rules #let setrules(uservars, doc) = { set text( font: uservars.bodyfont, weight: "regular", size: uservars.fontsize, ) set align(left) set page( paper: "a4", margin: ( left: 1.8cm, right: 1.8cm, top: 1.5cm, bottom: 1.8cm, ), ) set list( spacing: uservars.linespacing ) set par( leading: uservars.linespacing, justify: true, ) doc } // show rules #let showrules(uservars, doc) = { show heading.where(level: 1): set text(font: uservars.headingfont, size: 32pt) show heading.where(level: 2): title => pad(bottom: 0.2em, grid( columns: 2, gutter: 1%, sectionTitleStyle()[#title], line( start: (0pt, 0.95em), length: 100%, stroke: (paint: accentColor, thickness: 0.05em), ), )) doc } // set page layout #let cvinit(doc) = { doc = setrules(doc) doc = showrules(doc) doc } // address // TODO #let addresstext(info, uservars) = { if uservars.showAddress { block(width: 100%)[ #info.personal.location.at("city", default: ""), #info.personal.location.at("region", default: ""), #info.personal.location.country #info.personal.location.at("postalCode", default: "") #v(-4pt) ] } else {none} } #let contacttext(info, uservars) = block(width: 100%)[ #let contact_display(icon, url, display: none) = { let l = if display == none { link(url) } else { link(url)[#display] } box([#icon #sym.zws #l]) } #let profiles = ( contact_display(fa.fa-envelope(solid: true), "mailto:" + info.personal.email), ) #if uservars.showNumber { profiles.push(contact_display(fa.fa-phone(), "tel:" + info.personal.phone)) } #if "url" in info.personal { profiles.push(contact_display(fa.fa-home(), info.personal.url, display: info.personal.url.trim("https://", at: start))) } #if info.personal.profiles.len() > 0 { for profile in info.personal.profiles { let icon = if lower(profile.network) == "linkedin" { fa.fa-linkedin() } else if lower(profile.network) == "github" { fa.fa-github() // TODO: Extend the number of networks with icons } else { // fa.fa-circle() } profiles.push(contact_display(icon, profile.url, display: profile.username)) } } #headerInfoStyle(profiles.join([ #sym.bar.v ])) #headerQuoteStyle(eval(info.personal.summary, mode: "markup")) ] #let styleLabel(str) = { text( size: 20pt, str ) } #let cvheading(info, uservars) = { align(center)[ = #info.personal.name #if "label" in info.personal { styleLabel(info.personal.label) } #addresstext(info, uservars) #contacttext(info, uservars) ] } #let entryHeading(posA1: none, url: none, posA2: none, posB1: none, dateStart: none, dateEnd: none) = { let date = if dateStart == none { utils.strpdate(dateEnd) } else if dateEnd == none { utils.strpdate(dateStart) } else { let start = utils.strpdate(dateStart) let end = utils.strpdate(dateEnd) [#start #sym.dash.en #end] } // parse ISO date strings into datetime objects [ // line 1: company and location #if url != none [ #entryA1Style(link(url, posA1)) #h(1fr) #entryA2Style(posA2)\ ] else [ #entryA1Style(posA1) #h(1fr) #entryA2Style(posA2)\ ] #entryB1Style(posB1) #h(1fr) #entryB2Style(date) \ ] } #let cvwork(info, isbreakable: true) = { let work = utils .filter_visible(info, "work") .map(utils.validate_work_instance) .sorted(key: i => i.positions.at(0).endDate) .rev() if work.len() > 0 [ == Work Experience #for w in work { // create a block layout for each work entry for (index, p) in w.positions.enumerate() { block(width: 100%, breakable: isbreakable)[ #if index == 0 { entryHeading(posA1: w.organization, url: w.url, posA2: w.location, posB1: p.position, dateStart: p.startDate, dateEnd: p.endDate) } else { entryHeading(posB1: p.position, dateStart: p.startDate, dateEnd: p.endDate) } // highlights or description #if p.summary != none [ #eval(p.summary, mode: "markup") ] #for hi in p.highlights [ - #eval(hi, mode: "markup") ] ] } } ] } #let cveducation(info, isbreakable: true) = { let education = utils .filter_visible(info, "education") .sorted(key: i => i.endDate) .rev() if education.len() > 0 [ == Education #for edu in education { let edu-items = "" if edu.at("honors", default: none) != none {edu-items = edu-items + "- *Honors*: " + edu.honors.join(", ") + "\n"} if edu.at("courses", default: none) != none {edu-items = edu-items + "- *Courses*: " + edu.courses.join(", ") + "\n"} if edu.at("highlights", default: none) != none { for hi in edu.highlights { edu-items = edu-items + "- " + hi + "\n" } edu-items = edu-items.trim("\n") } // create a block layout for each education entry block(width: 100%, breakable: isbreakable)[ #entryHeading( posA1: edu.institution, url: edu.url, posA2: edu.location, posB1: [#edu.studyType in #edu.area], dateStart: edu.startDate, dateEnd: edu.endDate ) #eval(edu.summary, mode: "markup") #eval(edu-items, mode: "markup") ] } ] } #let cvaffiliations(info, isbreakable: true) = { if "affiliations" in info and info.affiliations != none [ == Leadership & Activities #for org in info.affiliations { // create a block layout for each affiliation entry block(width: 100%, breakable: isbreakable)[ #entryHeading( posA1: org.organization, url: org.url, posA2: org.location, posB1: org.position, dateStart: org.startDate, dateEnd: org.endDate ) // highlights or description #if org.highlights != none { for hi in org.highlights [ - #eval(hi, mode: "markup") ] } ] } ] } #let cvprojects(info, isbreakable: true) = { let projects = utils .filter_visible(info, "projects") .sorted(key: i => i.endDate) .rev() if projects.len() > 0 [ == Projects #for project in projects { // create a block layout for each project entry block(width: 100%, breakable: isbreakable)[ #entryHeading( posA1: project.name, url: project.at("url", default: none), posB1: project.affiliation, dateStart: project.startDate, dateEnd: project.endDate ) // summary or description #eval(project.summary, mode: "markup") #for hi in project.highlights [ - #eval(hi, mode: "markup") ] // Project tools and technologies #if "skills" in project and project.skills.len() > 0 [ // Ensure the skills look attached to the project #v(-0.5em) *Skills*: #project.skills.join(", ") ] ] } ] } #let cvawards(info, isbreakable: true) = { let awards = utils .filter_visible(info, "awards") .sorted(key: i => i.date) .rev() if awards.len() > 0 [ == Honors & Awards #for award in awards { // create a block layout for each award entry block(width: 100%, breakable: isbreakable)[ #entryHeading( posA1: award.title, url: award.at("url", default: none), posA2: award.location, posB1: [Issued by #text(style: "italic")[#award.issuer]], dateStart: award.date, ) // summary or description #eval(award.summary, mode: "markup") #if award.at("highlights", default: none) != none { for hi in award.highlights [ - #eval(hi, mode: "markup") ] } ] } ] } #let cvcertificates(info, isbreakable: true) = { if "certificates" in info and info.certificates != none [ == Licenses & Certifications #for cert in info.certificates { // parse ISO date strings into datetime objects let date = utils.strpdate(cert.date) // create a block layout for each certificate entry block(width: 100%, breakable: isbreakable)[ // line 1: certificate name #if cert.at("url", default: none) != none [ *#link(cert.url)[#cert.name]* \ ] else [ *#cert.name* \ ] // line 2: issuer and date Issued by #text(style: "italic")[#cert.issuer] #h(1fr) #date \ ] } ] } #let cvpresentations(info, isbreakable: true) = { let presentations = utils .filter_visible(info, "presentations") .sorted(key: i => i.date) .rev() if presentations.len() > 0 [ == Presentations #for pres in presentations { // create a block layout for each publication entry block(width: 100%, breakable: isbreakable)[ #entryHeading( posA1: pres.conference, url: pres.at("url", default: none), posA2: pres.location, posB1: pres.title, dateEnd: pres.date ) #eval(pres.summary, mode: "markup") ] } ] } #let cvpublications(info, isbreakable: true) = { let publications = utils .filter_visible(info, "publications") .sorted(key: i => i.releaseDate) .rev() if publications.len() > 0 [ == Publications #for pub in info.publications { // parse ISO date strings into datetime objects let date = utils.strpdate(pub.releaseDate) // create a block layout for each publication entry block(width: 100%, breakable: isbreakable)[ // line 1: publication title #if pub.at("url", default: none) != none [ *#link(pub.url)[#pub.name]* \ ] else [ *#pub.name* \ ] // line 2: publisher and date Published in #text(style: "italic")[#pub.publisher] #h(1fr) #date \ ] } ] } #let cvskills(info, isbreakable: true) = { let title = () if "languages" in info { title.push("Languages") } if "skills" in info { title.push("Skills") } if "interests" in info { title.push("Interests") } if title.len() > 0 {block(breakable: isbreakable)[ == #title.join(", ") #if ("languages" in info and info.languages != none) [ #let langs = () #for lang in info.languages { langs.push([#lang.language (#lang.fluency)]) } - *Languages*: #langs.join(", ") ] #if ("skills" in info and info.skills != none) { grid( columns: 2, gutter: 10pt, ..info.skills.map(s => { (align(right)[*#s.category*], align(left)[#s.skills.join(", ")]) }).flatten() ) } #if ("interests" in info and info.interests != none) [ - *Interests*: #info.interests.join(", ") ] ]} } #let cvreferences(info, isbreakable: true) = { if "references" in info and info.references != none {block[ == References #for ref in info.references { block(width: 100%, breakable: isbreakable)[ #if ref.at("url", default: none) != none [ - *#link(ref.url)[#ref.name]*: "#ref.reference" ] else [ - *#ref.name*: "#ref.reference" ] ] } ]} else {} } #let endnote() = { }
https://github.com/TJ-CSCCG/tongji-slides-typst
https://raw.githubusercontent.com/TJ-CSCCG/tongji-slides-typst/main/README.md
markdown
MIT License
# tongji-slides-typst :page_facing_up: 同济倧孊幻灯片暡板 | Typst äž­æ–‡ | [English](README-EN.md) > [!CAUTION] > 由于 Typst 项目仍倄于密集发展阶段䞔对某些功胜的支持䞍完善并䞔歀暡板䞺过枡暡板之后䌚䜿甚新的package重写因歀本暡板可胜存圚䞀些问题。劂果悚圚䜿甚过皋䞭遇到了问题欢迎提亀 issue 或 PR我们䌚尜力解决。 > ## 样䟋展瀺 以䞋䟝次展瀺 “title-slide”、“䜿甚实䟋”、“matrix-slide”、“自定义materix-slide”、“空癜slide” 侎 “focus-slide”。 <p align="center"> <img src="https://raw.githubusercontent.com/xbunax/blogImg/main/202405181220130.png" width="30%"> <img src="https://raw.githubusercontent.com/xbunax/blogImg/main/202405181220107.png" width="30%"> <img src="https://raw.githubusercontent.com/xbunax/blogImg/main/202405181220153.png" width="30%"> <img src="https://raw.githubusercontent.com/xbunax/blogImg/main/202405181220139.png" width="30%"> <img src="https://raw.githubusercontent.com/xbunax/blogImg/main/202405181220119.png" width="30%"> <img src="https://raw.githubusercontent.com/xbunax/blogImg/main/202405181220080.png" width="30%"> </p> ## 䜿甚方法 ### 本地猖译 #### 1. 安装 Typst 参照 [Typst](https://github.com/typst/typst?tab=readme-ov-file#installation) 官方文档安装 Typst。 #### 2. clone 本项目 ```bash git clone https://github.com/TJ-CSCCG/tongji-slides-typst.git cd tongji-slides-typst ``` 按照需求修改盞关文件然后执行以䞋呜什以猖译。 ```bash typst compile main.typ typst2pngpdf main.typ ##猖译成囟片pdf的脚本需芁安装imagemask以防pdf viewer倪老无法查看slides ``` ### 圚线猖译 圚 [Typst App](https://typst.app) 䞊䜿甚本暡板进行圚线猖译。 ## 劂䜕䞺该项目莡献代码 还请查看 [How to pull request](CONTRIBUTING.md/#how-to-pull-request)。 ## 匀源协议 该项目䜿甚 [MIT License](LICENSE) 匀源协议。 ### QQ 矀 * TJ-CSCCG 亀流矀`1013806782`
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/hover/user.typ
typst
Apache License 2.0
/// Test #let f() = 1; #(/* ident after */ f());
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/fletcher/0.2.0/test/test.typ
typst
Apache License 2.0
#import "@preview/cetz:0.1.2" #import "/src/exports.typ": * #set page(width: 10cm, height: auto) #show heading.where(level: 1): it => pagebreak(weak: true) + it = Arrow heads Compare to symbols $#sym.arrow$, $#sym.arrow.twohead$, $#sym.arrow.hook$, $#sym.arrow.bar$ #fletcher.diagram( // debug: 1, spacing: (10mm, 5mm), { for i in (0, 1, 2) { let x = 2*i let bend = 40deg*i ( (marks: ("harpoon", "harpoon'")), (marks: ("head", "head")), (marks: ("tail", "tail")), (marks: ("twotail", "twohead")), (marks: ("twohead", "twotail")), (marks: ("hook", "head")), (marks: ("hook", "hook'")), (marks: ("bar", "bar")), (marks: (none, none), extrude: (2.5,0,-2.5)), (marks: ("head", "head"), extrude: (1.5,-1.5)), (marks: ("tail", "tail"), extrude: (1.5,-1.5)), (marks: ("bar", "head"), extrude: (2,0,-2)), (marks: ("twotail", "twohead"), extrude: (1.5,-1.5)), (marks: ("circle", "bigcircle")), (marks: ("circle", "bigcircle"), extrude: (1.5, -1.5)), ).enumerate().map(((i, args)) => { edge((x, -i), (x + 1, -i), ..args, bend: bend) }).join() } }) = Double and triple lines #for (i, a) in ("->", "=>", "==>").enumerate() [ Formula #fletcher.diagram( // node-inset: 5pt, label-sep: 1pt + i*1pt, node((0, -i), $A$), edge((0, -i), (1, -i), text(0.6em, $f$), a), node((1, -i), $B$), ). \ ] = Arrow head shorthands #import "/src/main.typ": parse-arrow-shorthand $ #for i in ( "->", "<-", "<->", "<=>", "<==>", "|->", "|=>", ">->", "->>", "hook->", "hook'--hook", "|=|", ">>-<<", "harpoon-harpoon'", "harpoon'-<<", "<--hook'", "|..|", "hooks--hooks", "o-O", "o==O", ) { $ #block(inset: 2pt, fill: white.darken(5%), raw(i)) &= #fletcher.diagram(edge((0,0), (1,0), ..parse-arrow-shorthand(i))) \ $ } $ = Connectors #fletcher.diagram( debug: 0, cell-size: (10mm, 10mm), node((0,1), $X$), node((1,1), $Y$), node((0,0), $Z$), edge((0,1), (1,1), marks: (none, "head")), edge((0,0), (1,1), $f$, marks: ("hook", "head"), dash: "dashed"), edge((0,1), (0,0), marks: (none, "twohead")), edge((0,1), (0,1), marks: (none, "head"), bend: -120deg), ) = Arc connectors #fletcher.diagram( cell-size: 3cm, { node((0,0), "from") node((1,0), "to") for Ξ in (0deg, 20deg, -50deg) { edge((0,0), (1,0), $#Ξ$, bend: Ξ, marks: (none, "head")) } }) #fletcher.diagram( debug: 3, node((0,0), $X$), node((1,0), $Y$), edge((0,0), (1,0), bend: 45deg, marks: ("head", "head")), ) #for (i, to) in ((0,1), (1,0), (calc.sqrt(1/2),-calc.sqrt(1/2))).enumerate() { fletcher.diagram(debug: 0, { node((0,0), $A$) node(to, $B$) let N = 6 range(N + 1).map(x => (x/N - 0.5)*2*120deg).map(Ξ => edge((0,0), to, bend: Ξ, marks: ("tail", "head"))).join() }) } = Defocus #let around = ( (-1,+1), ( 0,+1), (+1,+1), (-1, 0), (+1, 0), (-1,-1), ( 0,-1), (+1,-1), ) #grid( columns: 2, ..(-10, -1, -.25, 0, +.25, +1, +10).map(defocus => { ((7em, 3em), (3em, 7em)).map(((w, h)) => { align(center + horizon, fletcher.diagram( node-defocus: defocus, node-inset: 0pt, { node((0,0), rect(width: w, height: h, inset: 0pt, align(center + horizon)[#defocus])) for p in around { edge(p, (0,0)) } })) }) }).join() ) = Label placement Default placement above the line. #fletcher.diagram( // cell-size: (2.2cm, 2cm), spacing: 2cm, debug: 3, { for p in around { edge(p, (0,0), $f$) } }) #fletcher.diagram(spacing: 1.5cm, { for (i, a) in (left, center, right).enumerate() { for (j, Ξ) in (-30deg, 0deg, 50deg).enumerate() { edge((2*i, j), (2*i + 1, j), label: a, "->", label-side: a, bend: Ξ) } } }) = Crossing connectors #fletcher.diagram({ edge((0,1), (1,0)) edge((0,0), (1,1), crossing: true) edge((2,1), (3,0), "|-|", bend: -20deg) edge((2,0), (3,1), "<=>", crossing: true, bend: 20deg) }) = `edge()` argument shorthands #fletcher.diagram( edge((0,0), (1,1), "->", "double", bend: 45deg), edge((1,0), (0,1), "->>", "crossing"), edge((1,1), (2,1), $f$, "|->"), edge((0,0), (1,0), "-", "dashed"), ) = Diagram-level options #fletcher.diagram( node-stroke: black, node-fill: green.lighten(80%), label-sep: 0pt, node((0,0), $A$), node((1,1), $sin compose cos compose tan$, fill: none), node((2,0), $C$), node((3,0), $D$, shape: "rect"), edge((0,0), (1,1), $sigma$, "->", bend: -45deg), edge((2,0), (1,1), $f$, "<-"), ) = CeTZ integration #import "/src/utils.typ": vector-polar #fletcher.diagram( node((0,0), $A$, stroke: 1pt), node((2,1), [Bézier], stroke: 1pt), render: (grid, nodes, edges, options) => { cetz.canvas({ fletcher.draw-diagram(grid, nodes, edges, options) let n1 = fletcher.find-node-at(nodes, (0,0)) let p1 = fletcher.get-node-anchor(n1, 0deg) let n2 = fletcher.find-node-at(nodes, (2,1)) let p2 = fletcher.get-node-anchor(n2, -90deg) let c1 = cetz.vector.add(p1, vector-polar(20pt, 0deg)) let c2 = cetz.vector.add(p2, vector-polar(70pt, -90deg)) fletcher.draw-arrow-cap(p1, 180deg, (thickness: 1pt, paint: black), "head") cetz.draw.bezier(p1, p2, c1, c2) }) } ) = Node bounds #fletcher.diagram( debug: 2, node-outset: 5pt, node-inset: 5pt, node((0,0), `hello`, stroke: 1pt), node((1,0), `there`, stroke: 1pt), edge((0,0), (1,0), "<=>"), ) = Corner edges #let around = ( (-1,+1), (+1,+1), (-1,-1), (+1,-1), ) #for dir in (left, right) { pad(1mm, fletcher.diagram( // debug: 2, spacing: 1cm, node((0,0), [#dir]), { for c in around { node(c, $#c$) edge((0,0), c, $f$, "O=>", corner: dir, label-pos: 0.4) } } )) }
https://github.com/wjakethompson/wjt-quarto-ext
https://raw.githubusercontent.com/wjakethompson/wjt-quarto-ext/main/ku-letter/_extensions/ku-letter/typst-show.typ
typst
Creative Commons Zero v1.0 Universal
#show: doc => letter( $if(subject)$ subject: [$subject$], $endif$ $if(recipient)$ recipient: [$recipient$], $endif$ $if(sender)$ sender: [$sender$], $endif$ $if(header-logo)$ header-logo: "$header-logo$", $endif$ $if(footer-logo)$ footer-logo: "$footer-logo$", $endif$ $if(date)$ date: [$date$], $endif$ doc, )
https://github.com/goshakowska/Typstdiff
https://raw.githubusercontent.com/goshakowska/Typstdiff/main/tests/test_complex/para/para_mix_result.typ
typst
In this #strike[report,];#underline[changed,] we will #strike[explore];#underline[changed] the various factors that influence #emph[fluid dynamics] in#strike[ ];#strike[glaciers];#strike[ ];#strike[ha];#strike[ ];#strike[they];#strike[ ];#strike[contribute] to the formation and behaviour of these natural structures. #strike[All];#strike[ ];#strike[manuscripts];#strike[ ];#strike[are];#strike[ ];#strike[to];#strike[ ];#strike[be];#strike[ ];#strike[submitted];#strike[ ];#strike[electronically];#strike[ ];#strike[to];#strike[ ];#strike[the];#strike[ ];#strike[ScholarOne];#strike[ ];#strike[Abstracts];#strike[ ];#strike[site];#strike[ ];#strike[created];#strike[ ];#strike[for];#strike[ ];#strike[each];#strike[ ];#strike[conference.];#strike[ ];#strike[The];#strike[ ];#strike[manuscript];#strike[ ];#strike[upload];#strike[ ];#strike[will];#strike[ ];#strike[be];#strike[ ];#strike[enabled];#strike[ ];#strike[several];#strike[ ];#strike[weeks];#strike[ ];#strike[after];#strike[ ];#strike[acceptance];#strike[ ];#strike[notices];#strike[ ];#strike[have];#strike[ ];#strike[been];#strike[ ];#strike[sent.];#strike[ ];#strike[Presenting];#strike[ ];#strike[authors];#strike[ ];#strike[of];#strike[ ];#strike[accepted];#strike[ ];#strike[papers];#strike[ ];#strike[will];#strike[ ];#strike[receive];#strike[ ];#strike[an];#strike[ ];#strike[email];#strike[ ];#strike[with];#strike[ ];#strike[instructions];#strike[ ];#strike[when];#strike[ ];#strike[manuscript];#strike[ ];#strike[submission];#strike[ ];#strike[opens.];#strike[ ];#strike[It];#strike[ ];#strike[is];#strike[ ];#strike[important];#strike[ ];#strike[that];#strike[ ];#strike[presenting];#strike[ ];#strike[authors];#strike[ ];#strike[keep];#strike[ ];#strike[their];#strike[ ];#strike[email];#strike[ ];#strike[addresses];#strike[ ];#strike[up-to-date];#strike[ ];#strike[so];#strike[ ];#strike[they];#strike[ ];#strike[do];#strike[ ];#strike[not];#strike[ ];#strike[miss];#underline[Something] #strike[this];#underline[new.] #strike[notice.];#underline[Monkey.] #underline[All];#underline[ ];#underline[changed];#underline[ ];#underline[are];#underline[ ];#underline[to];#underline[ ];#underline[be];#underline[ ];#underline[changed];#underline[ ];#strike[It];#underline[electronically] #strike[is];#underline[to] the#underline[ ];#underline[site];#underline[ ];#underline[created];#underline[ ];#underline[for];#underline[ ];#underline[each];#underline[ ];#underline[conference.];#underline[ ];#underline[The];#underline[ ];#underline[manuscript];#underline[ ];#underline[upload];#underline[ ];#underline[will] #strike[responsibility];#underline[be] #strike[of];#underline[enabled] #strike[the];#underline[several] #strike[author];#underline[weeks] #strike[to];#underline[after] #strike[obtain];#underline[acceptance] #strike[any];#underline[notices] #strike[required];#underline[have] #strike[government];#underline[been] #strike[or];#underline[sent.] #strike[company];#underline[Presenting] #strike[reviews];#underline[authors] #strike[for];#underline[of] #strike[their];#underline[accepted] papers#underline[ ];#underline[will];#underline[ ];#underline[receive];#underline[ ];#underline[an];#underline[ ];#underline[email];#underline[ ];#underline[with];#underline[ ];#underline[instructions];#underline[ ];#underline[when];#underline[ ];#underline[manuscript];#underline[ ];#underline[submission] #strike[in];#underline[opens.] #strike[advance];#underline[It] #strike[of];#underline[is] #strike[publication.];#underline[important] #strike[Start];#underline[that] #strike[early];#underline[presenting] #strike[to];#underline[authors] #strike[determine];#underline[keep] #strike[if];#underline[their] #strike[the];#underline[email] #strike[reviews];#underline[addresses] #strike[are];#underline[up-to-date] #strike[required;];#underline[so] #strike[this];#underline[they] #strike[process];#underline[do] #strike[can];#underline[not] #strike[take];#underline[miss] #strike[several];#underline[this] #strike[weeks.];#underline[notice.]
https://github.com/The-Notebookinator/notebookinator
https://raw.githubusercontent.com/The-Notebookinator/notebookinator/main/utils/components.typ
typst
The Unlicense
#import "/globals.typ" /// A constructor for a table of contents component. /// /// *Example Usage:* /// ```typ /// #let toc = utils.make-toc((frontmatter, body, appendix) => { /// for entry in body [ /// #entry.title /// #box(width: 1fr, line(length: 100%, stroke: (dash: "dotted"))) /// #entry.page-number /// ] /// }) /// ``` /// - callback (function): A function which returns the content of the toc. The function must take `frontmatter`, `body`, and `appendix` arguments. /// -> function #let make-toc(callback) = { let helper(type) = { let (state, markers) = if type == "frontmatter" { ( globals.frontmatter-entries, query( selector(<notebook-frontmatter>), ), ) } else if type == "body" { ( globals.entries, query( selector(<notebook-body>), ), ) } else if type == "appendix" { ( globals.appendix-entries, query( selector(<notebook-appendix>), ), ) } else { panic("No valid entry type selected.") } let result = () for (index, entry) in state.final().enumerate() { let page-number = counter(page).at( markers.at(index).location(), ).at(0) let ctx = entry.ctx ctx.page-number = page-number result.push(ctx) } return result } return () => context { let frontmatter-entries = helper("frontmatter") let body-entries = helper("body") let appendix-entries = helper("appendix") callback( frontmatter-entries, body-entries, appendix-entries, ) } } /// Constructor for a glossary component /// /// *Example Usage:* /// ```typ /// #let glossary = utils.make-glossary(glossary => { /// stack( /// spacing: 0.5em, /// ..for entry in glossary { /// ( /// [ /// = #entry.word /// /// #entry.definition /// ], /// ) /// }, /// ) /// }) /// ``` /// - callback (function): A function that returns the content of the glossary. The function must take a `glossary` argument. /// -> function #let make-glossary(callback) = { return () => context { let sorted-glossary = globals.glossary-entries.final().sorted(key: ( (word: word, definition: definition), ) => word) callback(sorted-glossary) } } /// Constructor for a pro / con component /// /// *Example Usage:* /// ```typ /// #let pro-con = utils.make-pro-con((pros, cons) => { /// table( /// columns: ( /// 1fr, /// 1fr, /// ), /// table.cell(fill: green)[*Pros*], /// table.cell(fill: red)[*Cons*], /// pros, /// cons, /// ) /// }) /// ``` /// /// - callback (function): A function that returns the content of the pro / con table. The function must take `pros` and `cons` arguments. /// -> function #let make-pro-con(callback) = { return (pros: [], cons: []) => { callback(pros, cons) } } /// Constructor for a decision matrix /// /// *Example Usage:* /// ```typ /// #let decision-matrix = utils.make-decision-matrix((properties, data) => { /// // ... /// }) /// ``` /// - callback (function): A function that returns the content of the matrix. The function must `properties` and `data` arguments. /// -> function #let make-decision-matrix(callback) = { return (properties: (), ..choices) => { // ensure the properties are passed in correctly // // this variable tracks whether the user // is using the alternate mode of passing in arguments, // where each property is a str instead of a dictionary let alternate-format = false for property in properties { if type(property) == str { alternate-format = true } else { assert( not alternate-format, message: "Property should be of type 'str'", ) if property.at("weight", default: none) == none { property.insert("weight", 1) } assert.eq(type(property.name), str) assert(type(property.weight) == float or type(property.weight) == int) } } // ensure the choices are passed in correctly for choice in choices.pos() { for (index, rating) in choice.enumerate() { if index == 0 { assert.eq(type(rating), str) continue } assert( type(rating) == int or type(rating) == float, message: "Values for decision matrices must be of type 'float' or 'int'", ) } assert.eq( choice.len() - 1, properties.len(), message: "The number of supplied values did not match the number of properties.", ) } // the calculation should only need to parse data in one format, // so if the user passed in the alternate, format we'll just convert it to the standard one properties = if alternate-format { properties.map(property => (name: property, weight: 1)) } else { properties } // now we can actually calculate the data let data = (:) for (index, choice) in choices.pos().enumerate() { let name = choice.at(0) let values = choice.slice(1) let unweighted-total = values.sum() let weighted-values = values.enumerate().map(( (index, value), ) => value * properties.at(index).at( "weight", default: 1, )) let weighted-total = weighted-values.sum() let property-data = (:) for (index, property) in properties.enumerate() { property-data.insert( property.name, ( unweighted: values.at(index), weighted: weighted-values.at(index), highest: false, ), ) } property-data.insert( "total", ( unweighted: unweighted-total, weighted: weighted-total, highest: false, ), ) data.insert( name, property-data, ) } // now that we've filled in all of the data, we can calculate which choice won // we're going to treat total like another property for the sake of calculating if it won properties.push((name: "total")) for property in properties { let highest = ( // Records the index of the choice which had the highest total index: 0, value: 0, ) for (index, choice) in data { let property-value = choice.at(property.name).weighted if property-value > highest.value { highest.index = index highest.value = property-value } } data.at(highest.index).at(property.name).highest = true } properties.pop() return callback(properties, data) } } /// A constructor for an admonition component. /// /// *Example Usage:* /// ```typ /// #let admonition = utils.make-admonition((type, body) => { /// //.. /// } /// ``` /// - callback (function): A function that returns the content for the admonition. The function must take `type` and `body` arguments. /// Valid types include: /// - `"note"`, /// - `"example"`, /// - `"warning"`, /// - `"quote"`, /// - `"equation"`, /// /// - `"identify"`, /// - `"brainstorm"`, /// - `"decide"`, /// - `"decision"`, // DEPRECATED /// - `"build"`, /// - `"program"`, /// - `"test"`, /// - `"management"`, /// - `"notebook"`, /// /// -> function #let make-admonition(callback) = { let valid-types = ( "note", "example", "warning", "quote", "equation", "identify", "brainstorm", "decide", "decision", "build", "program", "test", "management", "notebook", ) let valid-types-printable = valid-types.fold( "", ( base, value, ) => { base + " '" + value + "'" }, ) return (type: none, body) => { if not valid-types.contains(type) { panic("Entry type '" + str(type) + "' is not valid. Valid types include:" + valid-types-printable) } callback( type, body, ) } } /// A constructor for a pie chart component /// /// *Example Usage:* /// /// ```typ /// #let pie-chart = utils.make-pie-chart(data => { /// // ... /// }) /// ``` /// - callback (function): A function that returns the content for the pie chart. The function must take a `data` argument. /// -> function #let make-pie-chart(callback) = { return (..data) => { callback(data) } } /// A constructor for a plot component /// /// *Example Usage:* /// ```typ /// #let plot = utils.make-plot((title, x-label, y-label, length, data) => { /// // ... /// }) /// ``` /// /// - callback (function): A function that returns the content for the plot. /// The function must take `title`, `x-label`, `y-label`, `length`, and `data` arguments. /// -> function #let make-plot(callback) = { return (title: "", x-label: "", y-label: "", length: auto, ..data) => { callback(title, x-label, y-label, length, data) } } // TODO: add method for these extra components: // - gantt chart // - tournament // - team
https://github.com/alexanderkoller/typst-blinky
https://raw.githubusercontent.com/alexanderkoller/typst-blinky/main/blinky.typ
typst
MIT License
#let p = plugin("blinky.wasm") #let bib_re = regex("!!BIBENTRY!([^!]+)!!") #let link-bib-urls(bibsrc, content) = { let serialized = p.get_bib_map(bytes(bibsrc)) let bib_map = cbor.decode(serialized) show bib_re: it => { let (key,) = it.text.match(bib_re).captures let entry = bib_map.at(key, default: "") if entry == "" { it } else { let title = entry.fields.title let url = entry.fields.at("url", default: "") let doi = entry.fields.at("doi", default: "") if doi != "" { let url = "https://doi.org/" + doi link(url)[#title] } else if url != "" { link(url)[#title] } else { [#title] } } } content }
https://github.com/augustebaum/petri
https://raw.githubusercontent.com/augustebaum/petri/main/tests/fletcher/connect-places-with-transitions/test.typ
typst
MIT License
#import "/src/lib.typ": * #set page(width: auto, height: auto, margin: 1cm) #import "@preview/fletcher:0.4.2" as fletcher: edge /// % Place 1 /// \node[place, /// fill=teal!25, /// draw=teal!75, /// tokens=2, /// label=$P_1$] (place1) at (0,0) {}; /// /// % Place 2 /// \node[place, /// fill=teal!25, /// draw=teal!75, /// tokens=1, /// label=$P_2$] (place2) at (4,0) {}; /// /// % Transition /// \node[transition, /// minimum height=12mm, /// minimum width=1.5mm, /// fill=black, /// label=$T$] (trans) at (2,0) {}; /// /// % Connect P-T /// \draw[-latex,thick] (place1) -- (trans); /// /// % Connect T-P /// \draw[-latex,thick] (trans) -- (place2); #fletcher.diagram( node-stroke: 0.5pt, p((0,0), $P_1$, fill: teal.lighten(25%), stroke: teal.darken(15%), tokens: 2), edge("-|>"), t((2,0), $T$, fill: black), edge("-|>"), p((4,0), $P_2$, fill: teal.lighten(25%), stroke: teal.darken(15%), tokens: 1), )
https://github.com/hugoledoux/msc_geomatics_thesis_typst
https://raw.githubusercontent.com/hugoledoux/msc_geomatics_thesis_typst/main/README.md
markdown
MIT License
1. put your details in `settings.toml` 2. `typst compile main.typ`
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/SK/casoslov/casy/cas3.typ
typst
#import "/style.typ": * #import "/SK/texts.typ": * #import "../styleCasoslov.typ": * = Tretí čas #show: rest => columns(2, rest) #nacaloBezKnaza #zalm(16) #zalm(24) #zalm(50) #si #lettrine("Aleluja, aleluja, aleluja, sláva tebe, BoÅŸe.") #note[(3x)] #lettrine("Pane, zmiluj sa.") #note[(3x)] == Tropáre #note[Berieme tropár, prípadne tropáre podÄŸa predpisu] #primText[I teraz: (Bohorodičník)] #lettrine("Bohorodička, ty si pravÜ vinič, * z ktorého nám vyrástol plod ÅŸivota. * K tebe sa modlíme: * Modli sa k nemu, Vládkyňa, so svÀtÜmi apoÅ¡tolmi, * aby sa zmiloval nad naÅ¡imi duÅ¡ami.") #zoznam(( "Nech je velebenÜ Pán deň čo deň; * nesie nás Boh, naÅ¡a spása. * Náš Boh je Boh spásy.", )) #trojsvatePoOtcenas == Kondák #note[Berieme kondák podÄŸa predpisu] #lettrine("Pane, zmiluj sa.") #primText([40x]) #vKazdomCase #ektenia(3) #lettrine("ČestnejÅ¡ia si ako cherubíni * a neporovnateÄŸne slávnejÅ¡ia ako serafíni, * bez poruÅ¡enia si porodila Boha Slovo, * opravdivá Bohorodička, velebíme Å¥a.") Pane JeÅŸiÅ¡u Kriste, BoÅŸe náš, pre modlitby naÅ¡ich svÀtÜch otcov zmiluj sa nad nami. #prepustenieMaleBezKnaza
https://github.com/02hyc/Group-Meeting-Typst
https://raw.githubusercontent.com/02hyc/Group-Meeting-Typst/master/sections/weekly-report.typ
typst
#import "../globals.typ": * = Weekly Meeting == July 19, 2024 === Towards Self-Assembling Artificial Neural Networks through Neural Developmental Programs #footnote[Najarro E, Sudhakaran S, Risi S. Towards self-assembling artificial neural networks through neural developmental programs[C]] #figure( image("../images/2024.7.19_1.png", width: 80%), caption: [Neural Development Program approach for growing neural network] ) - Use the Neural Development Program(NDP) to control *the growth of new networks* - Two training methods: *Evolutionary-based* and *Gradient-based* - Execute experiments on *MNIST, XOR, CartPole, LunarLander* == July 19, 2024 === Towards Self-Assembling Artificial Neural Networks through Neural Developmental Programs #figure( image("../images/2024.7.19_2.png"), caption: [Developmental growth of solving the CartPole balancing task], ) - No indication of *robustness* or other performance advantages - No additional information about the *topological properties* of the network == July 19, 2024 === HYPERNETWORKS #footnote[<NAME>, <NAME>, <NAME> V. Hypernetworks[J]. arXiv preprint arXiv:1609.09106, 2016.] - An approach of using a *hypernetwork* to generate the weights for another network, which is similar to the nature: the relationship between a *genotype* and a *phenotype* - Generate weights for practical architectures by taking layer embedding vectors as inputs - Hypernetworks are trained *end-to-end* with gradient descent together with the main network === Reflection - The focus is not on generating networks, but on *the ability to self-explore* in a multi-task environment - Generative networks are a means of implementation. Are there any existing methods that can achieve self-exploration capabilities to a certain extent, such as *LLM-based agents* == July 26, 2024 - Agents environments setup - New reasoning framework (modify the prompts) - Digital tasks (fine tune on the digital tasks) - Embodied tasks (usually with a vision module) - Learn of reinforcement learning == July 26, 2024 === AgentGym #footnote[<NAME>, <NAME>, <NAME>, et al. AgentGym: Evolving Large Language Model-based Agents across Diverse Environments[J]. arXiv preprint arXiv:2406.04151, 2024.] #figure( image("../images/2024.7.26_3.png"), caption: [Overview of the AgentGym framework], ) == July 26, 2024 === OSWORLD #footnote[<NAME>, <NAME>, <NAME>, et al. Osworld: Benchmarking multimodal agents for open-ended tasks in real computer environments[J]. arXiv preprint arXiv:2404.07972, 2024.] #figure( image("../images/2024.7.26_2.png", width: 90%), caption:[OSWORLD: a real computer environment for multimodal agents], ) == July 26, 2024 === FunSearch #footnote[<NAME>, <NAME>, <NAME>, et al. Mathematical discoveries from program search with large language models[J]. Nature, 2024, 625(7995): 468-475.] #figure( image("../images/2024.7.26_1.png"), caption: [Overview of FunSearch], ) == Aug, 2, 2024 === Target - Diffusion Models as Tools for Gene Expression —— Genotype - Use partial modules in a large model to adapt to different tasks —— Phenotype #figure( image("../images/2024.8.02_1.png", width: 70%), caption: [Overview of PGDiff Framework for Versatile Face Restoration #footnote[<NAME>, <NAME>, <NAME>, et al. PGDiff: Guiding diffusion models for versatile face restoration via partial guidance[J]. Advances in Neural Information Processing Systems, 2024, 36.]], ) == Aug, 2, 2024 === Keywords - Conditional Diffusion Models - Pruning - Model Selector - Multi-task learning - Neural Architecture Search - The representations of the architectures in the search space - Introduce diffusion models as a search algorithm == Aug, 23, 2024 === DiffusionNAG#footnote[<NAME>, <NAME>, <NAME>, et al. DiffusionNAG: Predictor-guided Neural Architecture Generation with Diffusion Models[J]. arXiv preprint arXiv:2305.16943, 2023.] #figure( image("../images/2024.8.23_1.png", width: 80%), caption: [Overview of DiffusionNAG] ) - Treat the neural architecture as DAG and generate the neural architecture graph through a graph diffusion model - Controlling the generation process using property predictors, whose gradient is used to guide the architectures towards a space with desired properties == Aug 23, 2024 === Transformer Layers as Painters#footnote[<NAME>, <NAME>, <NAME>, et al. Transformer Layers as Painters[J]. arXiv preprint arXiv:2407.09298, 2024.] - Explore the role of the layers of the Transformer architecture models - Experiments on BERT and Llama2 - Do the layers share the representation space - Are all layers necessary - Are all middle layers doing the same thing - Does layer order matter - Can layers run in parallel #figure( image("../images/2024.8.23_2.png", width: 80%), caption: [Different execution strategies] ) == Aug 23, 2024 === LLM to extract structured data - Encapsulate the part of LLM - Implemente text conversion from PDF to Markdown#footnote[https://github.com/VikParuchuri/marker] #focus-slide[ Question? ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/circuiteria/0.1.0/gallery/test5.typ
typst
Apache License 2.0
#import "@preview/cetz:0.2.2": draw #import "../src/lib.typ": * #set page(width: auto, height: auto, margin: .5cm) #circuit({ element.multiplexer( x: 0, y: 0, w: .5, h: 1.5, id: "PCMux", entries: 2, fill: util.colors.blue, h-ratio: 80% ) element.block( x: (rel: 2, to: "PCMux.east"), y: (from: "PCMux-port-out", to: "in"), w: 1, h: 1.5, id: "PCBuf", ports: ( north: ((id: "clk", clock: true),), west: ((id: "in"),), east: ((id: "out"),) ), fill: util.colors.green ) element.block( x: (rel: 2, to: "PCBuf.east"), y: (from: "PCBuf-port-out", to: "A"), w: 3, h: 4, id: "IMem", ports: ( west: ( (id: "A", name: "A"), ), east: ( (id: "RD", name: "RD"), ) ), ports-margins: ( west: (0%, 50%), east: (0%, 50%) ), fill: util.colors.green, name: "Instruction\nMemory" ) element.block( x: (rel: 3, to: "IMem.east"), y: (from: "IMem-port-RD", to: "A1"), w: 4.5, h: 4, id: "RegFile", ports: ( north: ( (id: "clk", clock: true, small: true), (id: "WE3", name: "WE3"), (id: "dummy1") ), west: ( (id: "dummy2"), (id: "A1", name: "A1"), (id: "dummy3"), (id: "A2", name: "A2"), (id: "A3", name: "A3"), (id: "dummy4"), (id: "WD3", name: "WD3"), ), east: ( (id: "RD1", name: "RD1"), (id: "RD2", name: "RD2"), ) ), ports-margins: ( north: (-20%, -20%), east: (0%, 10%) ), fill: util.colors.green, name: "Register\nFile" ) element.alu( x: (rel: -.7, to: "IMem.center"), y: -7, w: 1.4, h: 2.8, id: "PCAdd", name: text("+", size: 1.5em), name-anchor: "name", fill: util.colors.pink ) element.extender( x: (rel: 0, to: "RegFile.west"), y: (from: "PCAdd-port-out", to: "in"), w: 4, h: 1.5, id: "Ext", h-ratio: 50%, name: "Extend", name-anchor: "south", align-out: false, fill: util.colors.green ) element.multiplexer( x: (rel: 3, to: "RegFile.east"), y: (from: "RegFile-port-RD2", to: "in0"), w: .5, h: 1.5, id: "SrcBMux", fill: util.colors.blue, h-ratio: 80% ) element.alu( x: (rel: 2, to: "SrcBMux.east"), y: (from: "SrcBMux-port-out", to: "in2"), w: 1.4, h: 2.8, id: "ALU", name: rotate("ALU", -90deg), name-anchor: "name", fill: util.colors.pink ) element.alu( x: (rel: 2, to: "SrcBMux.east"), y: (from: "Ext-port-out", to: "in2"), w: 1.4, h: 2.8, id: "JumpAdd", name: text("+", size: 1.5em), name-anchor: "name", fill: util.colors.pink ) element.block( x: (rel: 4, to: "ALU.east"), y: (from: "ALU-port-out", to: "A"), w: 3, h: 4, id: "DMem", name: "Data\nMemory", ports: ( north: ( (id: "clk", clock: true, small: true), (id: "dummy1"), (id: "WE", name: "WE") ), west: ( (id: "A", name: "A"), (id: "WD", name: "WD") ), east: ( (id: "RD", name: "RD"), (id: "dummy2") ) ), ports-margins: ( north: (-10%, -10%), west: (-20%, -30%), east: (-10%, -20%) ), fill: util.colors.green ) element.multiplexer( x: (rel: 3, to: "DMem.east"), y: (from: "DMem-port-RD", to: "in1"), w: .5, h: 1.5, id: "ResMux", entries: 2, fill: util.colors.blue, h-ratio: 80% ) element.block( x: (rel: 0, to: "RegFile.west"), y: 3.5, w: 2.5, h: 5, id: "Ctrl", name: "Control\nUnit", name-anchor: "north", ports: ( west: ( (id: "op", name: "op"), (id: "funct3", name: "funct3"), (id: "funct7", name: [funct7#sub("[5]")]), (id: "zero", name: "Zero"), ), east: ( (id: "PCSrc"), (id: "ResSrc"), (id: "MemWrite"), (id: "ALUCtrl"), (id: "ALUSrc"), (id: "ImmSrc"), (id: "RegWrite"), ) ), ports-margins: ( west: (40%, 0%) ), fill: util.colors.orange ) // Wires wire.wire( "wPCNext", ("PCMux-port-out", "PCBuf-port-in"), name: "PCNext" ) wire.stub("PCBuf-port-clk", "north", name: "clk", length: 0.25) wire.wire( "wPC1", ("PCBuf-port-out", "IMem-port-A"), name: "PC" ) wire.wire( "wPC2", ("PCBuf-port-out", "JumpAdd-port-in1"), style: "zigzag", zigzag-ratio: 1 ) wire.wire( "wPC3", ("PCBuf-port-out", "PCAdd-port-in1"), style: "zigzag", zigzag-ratio: 1 ) wire.intersection("wPC2.zig") wire.intersection("wPC2.zag") wire.stub("PCAdd-port-in2", "west", name: "4", length: 1.5) wire.wire( "wPC+4", ("PCAdd-port-out", "PCMux-port-in0"), style: "dodge", dodge-sides: ("east", "west"), dodge-y: -7.5, dodge-margins: (1.2, .5), name: "PC+4", name-pos: "start" ) let mid = ("IMem-port-RD", 50%, "RegFile-port-A1") wire.wire( "wInstr", ("IMem-port-RD", mid), bus: true, name: "Instr", name-pos: "start" ) draw.hide({ draw.line(name: "bus-top", mid, (horizontal: (), vertical: "Ctrl-port-op") ) draw.line(name: "bus-bot", mid, (horizontal: (), vertical: "Ext-port-in") ) }) wire.wire( "wInstrBus", ("bus-top.end", "bus-bot.end"), bus: true ) wire.wire( "wOp", ("Ctrl-port-op", (horizontal: mid, vertical: ())), bus: true, reverse: true, slice: (6, 0) ) wire.wire( "wF3", ("Ctrl-port-funct3", (horizontal: mid, vertical: ())), bus: true, reverse: true, slice: (14, 12) ) wire.wire( "wF7", ("Ctrl-port-funct7", (horizontal: mid, vertical: ())), bus: true, reverse: true, slice: (30,) ) wire.wire( "wA1", ("RegFile-port-A1", (horizontal: mid, vertical: ())), bus: true, reverse: true, slice: (19, 15) ) wire.wire( "wA2", ("RegFile-port-A2", (horizontal: mid, vertical: ())), bus: true, reverse: true, slice: (24, 20) ) wire.wire( "wA3", ("RegFile-port-A3", (horizontal: mid, vertical: ())), bus: true, reverse: true, slice: (11, 7) ) wire.wire( "wExt", ("Ext-port-in", (horizontal: mid, vertical: ())), bus: true, reverse: true, slice: (31, 7) ) wire.intersection("wF3.end") wire.intersection("wF7.end") wire.intersection("wA1.end") wire.intersection("wA2.end") wire.intersection("wA3.end") wire.stub("RegFile-port-clk", "north", name: "clk", length: 0.25) wire.wire("wRD2", ("RegFile-port-RD2", "SrcBMux-port-in0")) wire.wire( "wWD", ("RegFile-port-RD2", "DMem-port-WD"), style: "zigzag", zigzag-ratio: 1.5, name: "WriteData", name-pos: "end" ) wire.intersection("wWD.zig") wire.wire( "wImmALU", ("Ext-port-out", "SrcBMux-port-in1"), style: "zigzag", zigzag-ratio: 2.5, name: "ImmExt", name-pos: "start" ) wire.wire( "wImmJump", ("Ext-port-out", "JumpAdd-port-in2") ) wire.intersection("wImmALU.zig") wire.wire( "wJumpPC", ("JumpAdd-port-out", "PCMux-port-in1"), style: "dodge", dodge-sides: ("east", "west"), dodge-y: -8, dodge-margins: (1, 1), name: "PCTarget", name-pos: "start" ) wire.wire( "wSrcA", ("RegFile-port-RD1", "ALU-port-in1"), name: "SrcA", name-pos: "end" ) wire.wire( "wSrcB", ("SrcBMux-port-out", "ALU-port-in2"), name: "SrcB", name-pos: "end" ) wire.wire( "wZero", ( ("ALU.north-east", 50%, "ALU-port-out"), "Ctrl-port-zero" ), style: "dodge", dodge-sides: ("east", "west"), dodge-y: 3, dodge-margins: (1.5, 1), name: "Zero", name-pos: "start" ) wire.wire( "wALURes1", ("ALU-port-out", "DMem-port-A"), name: "ALUResult", name-pos: "start" ) wire.wire( "wALURes2", ("ALU-port-out", "ResMux-port-in0"), style: "dodge", dodge-sides: ("east", "west"), dodge-y: 2, dodge-margins: (3, 2) ) wire.intersection("wALURes2.start2") wire.stub("DMem-port-clk", "north", name: "clk", length: 0.25) wire.wire( "wRD", ("DMem-port-RD", "ResMux-port-in1"), name: "ReadData", name-pos: "start" ) wire.wire( "wRes", ("ResMux-port-out", "RegFile-port-WD3"), style: "dodge", dodge-sides: ("east", "west"), dodge-y: -7.5, dodge-margins: (1, 2) ) draw.content( "wRes.dodge-start", "Result", anchor: "south-east", padding: 5pt ) // Other wires draw.group({ draw.stroke(util.colors.blue) draw.line(name: "wPCSrc", "Ctrl-port-PCSrc", (horizontal: "RegFile.east", vertical: ()), (horizontal: (), vertical: (rel: (0, 0.5), to: "Ctrl.north")), (horizontal: "PCMux.north", vertical: ()), "PCMux.north" ) draw.line(name: "wResSrc", "Ctrl-port-ResSrc", (horizontal: "ResMux.north", vertical: ()), "ResMux.north" ) draw.line(name: "wMemWrite", "Ctrl-port-MemWrite", (horizontal: "DMem-port-WE", vertical: ()), "DMem-port-WE" ) draw.line(name: "wALUCtrl", "Ctrl-port-ALUCtrl", (horizontal: "ALU.north", vertical: ()), "ALU.north" ) draw.line(name: "wALUSrc", "Ctrl-port-ALUSrc", (horizontal: "SrcBMux.north", vertical: ()), "SrcBMux.north" ) draw.line(name: "wImmSrc", "Ctrl-port-ImmSrc", (rel: (1, 0), to: (horizontal: "RegFile.east", vertical: ())), (horizontal: (), vertical: (rel: (0, -.5), to: "RegFile.south")), (horizontal: "Ext.north", vertical: ()), "Ext.north" ) draw.line(name: "wRegWrite", "Ctrl-port-RegWrite", (rel: (.5, 0), to: (horizontal: "RegFile.east", vertical: ())), (horizontal: (), vertical: ("Ctrl.south", 50%, "RegFile.north")), (horizontal: "RegFile-port-WE3", vertical: ()), "RegFile-port-WE3" ) let names = ( "PCSrc": "PCSrc", "ResSrc": "ResultSrc", "MemWrite": "MemWrite", "ALUCtrl": [ALUControl#sub("[2:0]")], "ALUSrc": "ALUSrc", "ImmSrc": [ImmSrc#sub("[1:0]")], "RegWrite": "RegWrite" ) for (port, name) in names { draw.content("Ctrl-port-"+port, name, anchor: "south-west", padding: 3pt) } }) })
https://github.com/maxluoXIII/resume
https://raw.githubusercontent.com/maxluoXIII/resume/master/resume.typ
typst
#show heading: set text(font: "Linux Biolinum") #show link: underline // Uncomment the following lines to adjust the size of text // The recommend resume text size is from `10pt` to `12pt` // #set text( // size: 12pt, // ) // Feel free to change the margin below to best fit your own CV #set page( margin: (x: 1.0cm, y: 1.3cm), ) // For more customizable options, please refer to official reference: https://typst.app/docs/reference/ #set par(justify: true) #let chiline() = {v(-3pt); line(length: 100%); v(-5pt)} = <NAME> #link("mailto:<EMAIL>") | #link("https://github.com/maxluoXIII")[github.com/maxluoXIII] | #link("https://maxluoxiii.github.io")[maxluoxiii.github.io] == Work Experience #chiline() *#link("https://ibm.com")[IBM]* #h(1fr) Aug. 2021 -- Present \ Backend Developer #h(1fr) Rochester, MN \ - Developed robust device drivers for the #link("https://www.ibm.com/products/ibm-i")[IBM i] operating system using C++, for both physical (NVIDIA, Intel, etc.) and virtual (link aggregation, vNIC, etc.) NICs - Migrated device driver testing scripts to an open-source Python framework, expanded test coverage, and improved logging/debugging capabilities to develop a cohesive testing tool for device driver developers - Collaborated with internal and external teams to provide support for clients by providing analyses and fixes *#link("https://8i.com/")[8i]* #h(1fr) May 2020 -- Aug. 2020 \ Software Engineering Intern #h(1fr) Chicago, IL \ - Developed features for an internal MPEG-DASH player to support the company's proprietary 3D mesh, video, and audio codec including seek, caching, and adaptive bitrate selection using the C++ Qt Framework *#link("https://www.eagleseven.com/")[Eagle Seven]* #h(1fr) May 2019 -- Aug. 2019 \ Software Development Intern #h(1fr) Chicago, IL \ - Wrote software to calculate network performance metrics of high-frequency trade engines - Built a real-time dashboard using InfluxDB and Grafana to improve the automation, comparison, and real-time tracking capabilities of the performance testing framework == Education #chiline() #link("https://illinois.edu/")[*University of Illinois at Urbana-Champaign*] #h(1fr) Aug. 2017 -- May 2021 \ Bachelor of Science, Computer Science + Master of Computer Science #h(1fr) Urbana-Champaign, IL \ - Operating System Design; Distributed Systems; Communication Networks; Applied Parallel Programming - Computer Security I/II; Advanced Computer Security; Applied Cryptography; Operating System Security - Machine Learning; ML for Sys, Networks, & Security; Algorithms - Interactive Computer Graphics; UI Design; Top Down Video Game Design; Game Dev Process - Teaching Assistant for CS 225 (Data Structures) and CS 126 (Software Design Studio) - Lead discussions and code reviews to foster educational dialogue on data structures and best coding practices - Provided continuous updates to the course website to provide students with up-to-date information - Answered questions and debugged student solutions in office hours == Projects #chiline() *#link("https://github.com/maxluoXIII/server-manager")[server-manager]* #h(1fr) Mar. 2023 -- Aug. 2023 \ Creator #h(1fr) #link("https://github.com/maxluoXIII/server-manager")[GitHub] \ - Developed a Discord bot in Rust utilizing their HTTPS/REST API to allow members of a Discord server to manage multiple Minecraft servers on a host computer *#link("https://github.com/Mottokrosh/Sheet")[Sheet]* #h(1fr) Sep. 2021 -- Jan. 2022 \ Contributor #h(1fr) #link("https://github.com/Mottokrosh/Sheet")[GitHub] \ - Identified the cause for authentication and database issues that caused an outage of an open-source Node application. - Communicated with the maintainer and developed a fix that was merged into the project. - Reviewed pull requests made by other developers and helped them merge their own fixes to the project. == Skills #chiline() - *Proficient* in C/C++, Python - *Intermediate* knowledge of Rust, Java, HTML/CSS, Javascript (Angular), InfluxDB, Grafana, Unity, Unreal Engine, WebGL, Android app development, Discord app development, Qt Framework, Flutter, Chinese, Japanese - *Basic* skills with OCaml, x86 Assembly, Verilog
https://github.com/HEIGVD-Experience/docs
https://raw.githubusercontent.com/HEIGVD-Experience/docs/main/S4/WEB/docs/TE/TE1.typ
typst
#import "/_settings/typst/template-te.typ": * #show: resume.with( "Résumé WEB - TE1", "<NAME>", cols: 3 ) = HTML == HTML structure - `<!DOCTYPE html>`: The document type declaration for HTML5 - `<html>`: The root element of an HTML page - `<head>`: Contains meta-information about the document - `<title>`: The title of the document ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <!-- CSS link --> <title>Welcome page</title> </head> <body> <h1>Hello students of the Web Technologies course !</h1> </body> </html> ``` - width=device-width : the width of the page matches the screen width - initial-scale=1.0 : the initial zoom level === Open Graph Protocol The Open Graph protocol enables any web pages to show some additional information when shared on social media or messaging apps. ```html <meta property="og:title" content="The Rock" /> <meta property="og:type" content="video.movie" /> <meta property="og:url" content="https://www.imdb.com/title/tt0117500/" /> <meta property="og:image" content="https://ia.media-imdb.com/images/rock.jpg" /> ``` == Lists === Unordered lists Unordered lists are used to list items in no particular order. They are defined with the `<ul>` element. ```html <ul> <li>Item 1</li> <li>Item 2</li> </ul> ``` === Ordered lists Ordered lists are used to list items in a specific order. They are defined with the `<ol>` element. ```html <ol> <li>Item 1</li> <li>Item 2</li> </ol> ``` == Hyperlink Hyperlinks are used to link from one page to another. They are defined with the `<a>` element. ```html <a href="https://www.google.com" title="Google" target="_blank">Google</a> <a href="mailto:<EMAIL>?subject=hello&body=world!">Hello World!</a> ``` == Media elements === Images ```html <img src="image.jpg" alt="Image description"> ``` === Audio & Video ```html <audio src="audio.mp3"></audio> <video src="video.mp4"></video> ``` === Canvas The canvas element allows for dynamic, scriptable rendering of 2D and 3D shapes. ```html <canvas id="myCanvas" width="200" height="100"></canvas> ``` == Tables Tables are used to display data in a tabular format. They are defined with the `<table>` element. ```html <table> <!-- row --> <tr> <!-- header column --> <th>Student ID</th> <th>Grade</th> </tr> <tr> <!-- regular column --> <td>4</td> <td>5</td> </tr> <tr> <!-- merged columns --> <td colspan="2">6</td> </tr> </table> ``` == Forms Forms are used to collect user input. They are defined with the `<form>` element. ```html <form action="/submit" method="post"> <label for="name">Name:</label> <input type="text" id="name" name="name"> <input type="submit" value="Submit"> </form> ``` == Semantic elements ```html <header>Header</header> <nav>Navigation</nav> <main>Main content</main> <section>Section</section> <article>Article</article> <aside>Aside</aside> <footer>Footer</footer> ``` = CSS == CSS Selectors CSS selectors are used to select the elements to which the ruleset will apply. There are several types of selectors: === Type Type selectors select elements based on their tag name. ```css p { color: red; } ``` *This rule will apply to all `<p>` elements. in the html page.* === Id Id selectors select elements based on their `id` attribute. ```css #myId { color: red; } ``` *This rule will apply to the element with the `id="myId"` attribute.* === Class Class selectors select elements based on their `class` attribute. ```css .myClass { color: red; } ``` *This rule will apply to all elements with the `class="myClass"` attribute.* === Universal The universal selector `*` selects all elements. ```css * { color: red; } ``` *This rule will apply to all elements in the html page.* === Grouping Grouping selectors select multiple elements. ```css h1, h2, h3 { color: red; } ``` === Descendant Descendant selectors select elements that are descendants of another element. ```css div p { color: red; } ``` *This rule will apply to all `<p>` elements that are descendants of a `<div>` element.* === Child Child selectors select elements that are direct children of another element. ```css div > p { color: red; } ``` *This rule will apply to all `<p>` elements that are direct children of a `<div>` element.* === Flexbox Flexbox is a layout model that allows elements to align and distribute space within a container. ```html <div class="container"> <div class="item">Item A</div> <div class="item">Item B</div> <div class="item">Item C</div> </div> ``` ```css .container { display: flex; flex-direction: row; } .item { order: 1; flex-grow: 1 } ``` - Container (parent) properties : flex-direction, flex-wrap, flex-flow, justify-content, align-items, align-content - Item (child) properties : order, flex-grow, flex-shrink, flex-basis, flex, align-self === Grid Grid is a layout model that allows elements to align and distribute space in two dimensions. ```html <div class="container"> <div class="item">Item A</div> <div class="item">Item B</div> <div class="item">Item C</div> </div> ``` ```css .container { display: grid; grid-template-columns: 1fr 1fr 1fr; } .item { grid-column: 1 / 3; } ``` - Container (parent) properties : grid-template-column, grid-template-rows, grid-template-areas, grid-template, ... - Item (child) properties : grid-column-start, grid-column-end, grid-column, grid-row, grid-area, ... #image("/_src/img/docs/image copy 38.png") == Media Queries Media queries are used to apply different styles based on the device’s characteristics. ```css h1 { font-size: 50px; } /* General rule */ @media (min-width: 576px) { /* Tablet dimensions */ h1 { font-size: 60px; } } @media (min-width: 768px) { /* Desktop dimensions */ h1 { font-size: 70px; } } ``` == CSS variables ```css :root { /* Global variables */ --main-color: #06c; --main-bg-color: #fff; } .my-element { color: var(--main-color, #06c); background-color: var(--main-bg-color, #fff); } ``` The var() function can take fallback values in case one of the variables is not defined. = JavaScript *Interpreted* The interpreter reads the source code and executes it directly. *Just-in-time (JIT) compiled* The interpreter compiles the hot parts of the source code into machine-code and executes it directly. *First-class functions* Functions are treated like any other value. They can be stored in variables, passed as arguments to other functions, created within functions, and returned from functions. ==== Adding JavaScript directly to HTML ```html <script type='text/javascript'> console.log('Hello, World!'); document.writeln('Hello, World!') </script> ``` ==== Adding JavaScript to an external file ```html <script src='script.js'></script> ``` - The defer attribute is used to defer the execution of the script until the page has been loaded. - The async attribute is used to load the script asynchronously. == Primitive types - *Undefined*: Unique primitive value undefined - *Number*: Real or integer number (e.g. 3.14, 42) - *Boolean*: true or false - *String*: Character sequence, whose literals begin and end with single or double - quotes (e.g. "HEIG-VD", 'hello') - *BigInt*: Arbitrary-precision integers, whose literals end with an n (e.g. - 9007199254740992n) - *Symbol*: Globally unique values usable as identifiers or keys in objects (e.g. Symbol(), Symbol("description")) - *Null*: Unique value null == Arrays - Array: Ordered collection of values The syntax for creating an array is: ```javascript let fruits = ['Apple', 'Banana', 'Cherry']; ``` Elements can be accessed using bracket notation: ```javascript console.log(fruits[0]); // Apple console.log(fruits.length); // Banana ``` === Methods on arrays ```javascript fruits.push("mango", "papaya"); // Appends new items fruits.pop(); // Removes and returns the last item fruits.reverse(); // Reverses the items' order fruits.splice(2, 1, 'Orange'); // Replaces 1 elemnt at position 2 with 'Orange' fruits.splice(1, 0, 'Peach'); // Inserts 'Peach' at index 1 ``` == Typeof operator The typeof operator returns the type of a variable or expression. ```javascript console.log(typeof 42); // number console.log(typeof 'hello'); // string console.log(typeof null); // object console.log(typeof [1, 2, 3]); // object ``` == Arithmetic operators ```javascript 1 + 1; // addition 1 - 1; // subtraction 1 / 1; // division 1 * 1; // multiplication 1 % 1; // modulo 1 ** 1; // exponentiation ``` == String operators ```javascript "con" + "cat" + "e" + "nate"; `PI = ${Math.PI}`; // template literals (instead of: "PI = " + Math.PI) ``` In practice we should opt for template literals over string concatenation. === Automatic type conversion Automatic type conversion is performed when comparing values of different types. It is at the root of many issues when using comparison operators. ```javascript "1" == 1 // true (!!!) false == 0 // true 8 * null // 0 ``` === Strict equality Strict equality compares two values for equality without type conversion. ```javascript "1" === 1 // false "1" !== 1 // true ``` == Variables === var The var statement declares a *non-block-scoped* variable, optionally initializing it to a value. Its scope is its current execution context, i.e. either the enclosing function or, if outside any function, global. It can be re-declared. ```javascript var x = 1; if (true) { var x = 2; } // same variable console.log(x); // 2 ``` === let The let statement declares a *block-scoped* local variable, optionally initializing it to a value. It can be re-assigned but not re-declared. ```javascript let x = 1; { let x = 2; } // different variable (in a new scope) console.log(x); // 1 let x = 1000; // Error: redeclaration of let x ``` === const The const statement declares a *block-scoped* read-only named constant. It can be re-assigned but not re-declared. ```javascript const x = 1; x = 2; // TypeError: Assignment to constant variable. ``` == While and do-while loops ```javascript let num = 0; while (num < 10) { console.log(num); num += 1; } let echo = ""; do { echo = prompt("Echo"); console.log(echo); } while (echo != "stop"); ``` == For loop ```javascript for (let num = 0; num < 10; num++) { console.log(num); } ``` The for...in statement iterates over the enumerable properties of an object. ```javascript let obj = {a: 1, b: 2, c: 3}; for (let prop in obj) { console.log(prop, obj[prop]); } ``` The for...of statement creates a loop iterating over iterable objects. ```javascript let nums = [0, 1, 2, 3, 4, 5, 6, 7, 8 , 9]; for (let num of nums) { console.log(num); } ``` == Declaration notation ```javascript function square(x) { return x * x; } // or var square = function(x) { return x * x; } ``` == Arrow functions ```javascript var square = x => x * x // or var square = (x) => { return x * x; } ``` == Recursion ```javascript function factorial(n) { return n == 1 ? n : n * factorial(n-1); } console.log(factorial(5)) // 5 * 4 * 3 * 2 * 1 = 120 ``` .. as long as it does not overflow the call stack. #colbreak() == Higher-order functions ```javascript function greaterThan(n) { return m => m > n; } let greaterThan10 = greaterThan(10); console.log(greaterThan10(11)); // true ``` = Regular expressions Regular expressions are patterns used to match character combinations in strings. They are created using the RegExp constructor or a literal notation. ```javascript const re1 = /ab+c/; const re2 = new RegExp(/ab+c/); ``` - `Character Classes (., \s, \d, 
)` that distinguish types of chararters (resp. any, whitespace or digit) - `Character sets ([A-Z], [a-z], [0-9], [abc], 
)` that match any of the enclosed - characters (resp. uppercase letters, lowercase letters, digits, and any of a, b or c) - `Either operator (x|y)` that match either the left or right handside values - `Quantifiers (\*, +, ?, {n}, {n,m})` that indicate the number of times an expression matches - `Boundaries (^, \$)` that indicate the beginnings and endings of lines and words - `Groups ((), (?<name>), (?:))` that extracts and remember (or not) information from the input - `Assertions (x(?=y))` that helps at defining conditional expressions ```javascript const emailRegex = /^[a-zA-Z]([a-zA-Z0-9._-]+)@(?:[a-zA-Z0-9]+\.)+(?:com|org|net)$/; ``` == Flags ```javascript const re1 = /ab+c/; // no flag const re2 = /ab+c/g; // global search const re3 = /ab+c/i; // case-insensitive search const re4 = /ab+c/m; // multi-line search const re5 = /ab+c/gi // global case-insensitive search ``` == Context ```javascript function doTwice(f) { f.call(this); // bind this to the current context f.call(this); // bind this to the current context } let human = { age: 32, getOlder() { this.age++; } } doTwice.call(human, human.getOlder); // bind this to human console.log(human.age); // Output will be 34 ``` == Array methods - `concat()` concatenates two or more arrays and returns a new array. - `join()` joins all elements of an array into a string. - `pop()` removes the last element from an array and returns that element. - `push()` adds one or more elements to the end of an array and returns the new length of the array. - `reverse()` reverses the order of the elements of an array. - `shift()` removes the first element from an array and returns that element. - `slice()` selects a part of an array, and returns it as a new array. - `sort()` sorts the elements of an array. - `includes()` determines whether an array contains a specified element. - `flat()` flattens an array up to the specified depth.
https://github.com/Servostar/dhbw-abb-typst-template
https://raw.githubusercontent.com/Servostar/dhbw-abb-typst-template/main/src/pages/declaration-of-authorship.typ
typst
MIT License
// .--------------------------------------------------------------------------. // | Declaration of Authorship | // '--------------------------------------------------------------------------' // Author: <NAME> // Edited: 28.06.2024 // License: MIT #let new_declaration_of_authorship(config) = ( context { pagebreak(weak: true) let thesis = config.thesis let author = config.author if text.lang == "de" [ #heading("SelbstÀndigkeitserklÀrung") ] else if text.lang == "en" [ #heading("Declaration of Authorship") ] v(1em) if text.lang == "de" [ Ich versichere hiermit, dass ich meine PrÌfung mit dem Thema ] else if text.lang == "en" [ I hereby confirm that I have written this thesis with the subject ] v(1em) set align(center) text(weight: "bold", thesis.title) if thesis.subtitle != none { linebreak() thesis.subtitle } set align(left) v(1em) set par(justify: true) if text.lang == "de" [ selbstÀndig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe. Ich versichere zudem, dass die eingereichte elektronische Fassung mit der gedruckten Fassung Ìbereinstimmt. ] else if text.lang == "en" [ independently and have not used any sources or aids other than those specified. I also confirm that the electronic version submitted is identical to the printed version. ] set align(horizon) grid( // set width of columns // we need two, so make both half the page width columns: (50%, 50%), row-gutter: 0.75em, align(left, {line(length: 6cm)}), align(left, {line(length: 6cm)}), align(left, if text.lang == "de" [ Ort, Datum ] else if text.lang == "en" [ Place, Date ] else { panic("no translation for language: ", text.lang) }), align(left, if text.lang == "de" [ Unterschrift ] else if text.lang == "en" [ Signature ] else { panic("no translation for language: ", text.lang) })) } )
https://github.com/noriHanda/undergrad_paper
https://raw.githubusercontent.com/noriHanda/undergrad_paper/main/main.typ
typst
#import "template.typ": * #show: project.with( title: "筋電矩手人工感芚のための駆動郚゚ネルギヌ枬定に基づく力芚センシング", englishTitle: "Kinesthetic sense based on evaluation of actuator energy for artificial sense in myoelectric prosthetic hands", author: "半田 寛明", supervisor: "葛西 誠也 教授", affiliation: "工孊郚情報゚レクトロニクス孊科電気電子工孊コヌス", lab: "量子知胜デバむス研究宀", grade: "孊郚4幎", year: "什和5", ) #outline(indent: 2em, fill: box(width: 1fr, repeat[⋯])) // start page number #set page(numbering: "1", number-align: center, margin: (top: 35.01mm, left: 30mm, right: 30mm, bottom: 30mm)) #counter(page).update(1) = 序論 == 背景 䜕らかの事故や病気により埌倩的に䞊肢を無くしおしたった人、そしお先倩的に䞊肢がない人は本人の意思ずは無関係に、取れる瀟䌚参加の遞択肢が限られおしたう。瀟䌚構造自䜓をそのような人々も参画しやすい圢に倉革する方法も考えられるが、そのためには䞊肢を必芁ずしないコミュニケヌションや業務執行の方法を考える必芁が出おくるため、いずれにせよ技術的課題に盎面する。\ このため、䞊肢を補う圢での瀟䌚参加が克服すべきハヌドルが最小に思える。そこで䜿甚者自身の身䜓の䞀郚のように感じるこずのできる操䜜感の矩手が必芁になっおくるのは明らかである。そもそも矩手には審矎性のみを目的ずした物も存圚するが、操䜜可胜な䞊、䟵襲性がないため着脱が容易な筋電矩手が本分野のこれからの朮流を為すず考えられる。\ 人間が自分の手を動䜜させる際、随意動䜜意識的動䜜ず䞍随意動䜜無意識的動䜜に分類できる。随意動䜜ずは、人間が意図した通りの動きをする動䜜である䞀方、䞍随意操䜜は人間が動䜜に察しお意識的にならずずも確かに行っおいる動䜜や制埡のこずである。熱いものや痛みを感じるず同時かむしろ感じるより前に手を匕っ蟌めたり、重いものを持぀ずきに無意識に力を加えおものが萜ちないように制埡したりずいったこずがこれに圓たる。 筋電矩手の目指す先は䜿甚者があたかも自分の手であったかのように操䜜を行える状態である。このため、その完成床は問題になるが、筋電矩手における随意操䜜性胜自䜓は研究分野ずしおすでに倧きなものずしお存圚する @Prosthetic-Hands-Trends 。䞀方で䞍随意の動䜜に関しおはその課題感の共有の難しさから課題ずしお捉えられにくい分野になっおくる。しかし、この䞍随意動䜜無くしお人の手のような操䜜感は埗られない。 #figure(image("assets/overview_table.png"), numbering: "1", caption: text("筋電矩手研究の方針ず珟圚地"), kind: table) == 目的 䞍随意動䜜を暗黙的に矩手に実装するのでは自分の手のようにはならない。生䜓の手のように、觊る枩床の圢状、觊り心地などはもちろんのこず、手にかかっおいる重量的な負担をも利甚者にフィヌドバックする必芁がある。觊芚に圓たる郚分を皮膚感芚、重量的負担を感じる力芚の郚分を深郚感芚ず呌ばれおいるが、皮膚感芚の分野に぀いおは矩手のみならずxRなどの分野でもハプティクスず呌ばれるように、他分野に枡り研究が進められおいる。䞀方で深郚感芚に぀いおは皮膚感芚ず同様に重芁であるにも関わらず比范的研究が進められおいない。これはGoogle Scholarにお "haptics" は225,000件、 "cutaneous sensation" は516,000件ヒットするのに察し、深郚感芚にあたる "bathyesthesia" は86件しかヒットしないこずからも明らかである。なお "deep sense" や "deep sensing" などはディヌプラヌニングのアルゎリズムなど倚岐にわたる分野での䜿甚がされおいる甚語であるため陀倖した。これらの研究動向を螏たえ、我々は重芁にも関わらずあたり手を぀けられおいない分野である力芚のフィヌドバックに今回取り組むこずずした。 == 本論文の構成 本論文は党6章から構成されおいる。\ 第1章では本論文の目的及び先行研究を螏たえた立ち䜍眮を論じた。\ 第2章では力芚センシング技術を玹介する。\ 第3章では筋電矩手の駆動郚゚ネルギヌ枬定をするこずで劂䜕に力芚センシングを行うかを説明する。\ 第4章では本研究結果を甚いお掚論モデルを䜜成するのにに甚いるリザバヌコンピュヌティングの説明を行う。\ 第5章では駆動郚゚ネルギヌずいう信号をリザバヌコンピュヌティングを甚いお解析する手法に぀いお玹介する。\ 最埌に第6章を本論文のたずめずする。 #pagebreak(weak: true) = 力芚センシング 力芚を枬定するための機構は叀くから研究されおおり、産業甚ロボットやタッチディスプレむなど幅広い甚途で利甚されおきた。以䞋に䞻な力芚センシングをする技術を玹介する。 @Sensors == 既存の力芚センシング技術 === 歪みゲヌゞセンサ 歪みゲヌゞセンサはセンサヌ郚にかかる匕匵力・圧瞮力により、電気抵抗が倉化する金属抵抗材料の性質を利甚しお、力やトルクに換算する。小型で粟床が高く、応答性も高いこずから倚くの堎面で䜿われる。 === 圧電センサ æ°Žæ™¶ã‚„PZT (ゞルコン酞チタン酞鉛) などの圧電効果を有する材料をセンサヌ郚に䜿甚しお、力を枬定する。小型で応答性が高く、コストも比范的優れいるが粟床は、ひずみゲヌゞ匏や静電容量匏には及ばない。 === 静電容量センサ センサヌ郚を金属材料の電極が向かい合わせに配眮されたコンデンサ型ずし、力により導䜓間にひずみが生じお距離が倉わるこずによる静電容量の倉化を怜知する。構成が比范的簡単で䜎コストで生産できる䞊、電極をフィルム状にするず、小型化・薄型化が可胜である。粟床や応答性も優れおいる。 === 光孊センサ 蚈枬察象物に䞀定間隔で暡様をマヌキングしおおき、力が加わった時に生じる暡様の倉化を、カメラやレヌザヌなどの光孊センサで怜出しお、力の倧きさを蚈算しお求める。非接觊で枬定できるこずが最倧のメリットではあるが粟床、応答性、小型化、コストは、他の方匏に軍配が䞊がるため䜿われる堎面は限られる。 === サヌボの逆起電力ずサヌボ内蔵センサを甚いた手法 先述のようなセンサを甚いない手法も叀くから研究されおいる。 特に今回のようにサヌボモヌタを内蔵する堎合が非垞に倚い筋電矩手のようなものの堎合、もずもずもず内蔵されおいるサヌボから埗られる信号を甚いる方法ずしお逆起電力を芳枬する方法がある。これはモヌタに倖力を䞎えお回転させた際にモヌタが発電機ずしお振る舞う珟象を甚いる手法である。しかしこれだけでは回転方向がわからないため、サヌボモヌタの回転角制埡甚に搭茉されおいる゚ンコヌダやタコゞェネレヌタを甚いるこずで倖力の方向を割り出すずいうものである。\ 以䞋にその数理的説明を行う。 ==== センサレスセンシングの数理的説明 党倖乱から倖力以倖の芁玠をモデル化し取り陀くこずで倖力のみを抜出可胜ずしお考えるず以䞋の匏で衚珟される。\ #math.equation(block:true,numbering: "(1)" ,$ F_"ext"=F_"dis"-(F_"int"+F_"g"+F_"c"+D s X^"res"+Delta M s ^2X^"res"-Delta"K"_t"I"^"ref"_a) $) ただしここで$F_"dis"$は党倖乱、$F_"int"$はコリオリ力・遠心力などの内郚干枉力、$F_g$は姿勢の圱響で重力加速床により発生する力、$F_c$はクヌロン摩擊力、$D s X^"res"$は粘性摩擊力、$M$はモヌタ皌働郚の慣性であり$M s^2 X^"res"$は呚波数領域におけるモヌタの動力孊を衚すすなわち$s, X^"res"$はそれぞれラプラス挔算子ず呚波数領域での角床を衚す倉数。$K_t$はモヌタに䜿甚されおいる磁石の匷さやコむルの巻線量によっお倉化するモヌタ固有の掚力定数、$I_a^"ref"$は呚波数領域における電流を衚す倉数である。\ 匏(1)におけるC摩擊力$F_c$、粘性摩擊力$D s X^"res"$は二皮の等速床詊隓、慣性倉動$Delta M$は加速床詊隓によっお同定するこずができる。@Sensorless-Sensing == 既存技術の課題 力芚を取埗する方法には各皮センサを甚いる方法ず、内蔵されおいるサヌボモヌタから埗られる信号を甚いる方法ずが䞀般的であるこずがわかった。しかし、どちらの方法も筋電矩手に力芚を䞎えるためのアプロヌチずしおは盞応しくない。 === 力芚センサの問題点 前節で玹介した力芚センサを筋電矩手に甚いるずなるず二぀の懞念点が浮かんでくる。搭茉センサの取り付け䜍眮ずコストの増加だ。前節で玹介した力芚センサはどれも圧力が盎接かかる郚分に蚭眮する必芁がある。物に觊れた際に感じる感觊が認識察象であればこれでも構わないが、今回察象ずするのは皌働郚にかかる力芚であるため力芚センサも皌働郚に取り付ける必芁が出おくる。駆動郚にある皋床サむズのある力芚センサを取り付けるずなるず取り付け䜍眮や取り付け方にかなりの工倫が必芁ずなっおくるこずは想像に難くない。\ たた、コストの面でも各サヌボ関節郚分に力芚センサが必芁ずなっおくるこずから効果になっおくる。筋電矩手は䞊肢がない方が生掻に支障のないようするずいう、人暩の面からも最䜎限必芁なものずなっおくるものであるため、䜎コストに抑えるこずが重芁である。そのためには各関節ごずに高䟡なセンサを搭茉するこずは望たしくない。 === サヌボの逆起電力を甚いた堎合の問題点 既存技術の䞭で安䟡なアプロヌチずしおサヌボの逆起電力ず゚ンコヌダ等の回転方向を怜出するセンサずを組み合わせたセンサレスの手法がある。前節でも玹介した通り、この手法を甚いるこずで、逆起電力を怜出する回路以倖の远加郚品を必芁ずせず実装できる。たた、远加郚品が必芁ないため取り付け䜍眮に創意工倫の必芁性がない。\ しかし決定的な匱点が存圚する。モヌタの特性䞊、逆起電力を埗るにはシャフトの回転が必芁な点である。実際の力芚を枬定する際、モヌタを回転させるには匱すぎる力が付䞎される堎合も倚く存圚する。しかし、そのような堎合でもこのセンサレスの手法ではかかっおいる力芚は0ずしお刀断されおしたう。これでは実際の生䜓のように、倖力に耐えおいる状態でも筋肉の負荷を感じ取るこずで倖力の倧きさを倧凡認知するこずは叶わない。 == サヌボの消費電力を甚いる方法 前節では力芚センサの搭茉や、サヌボの逆起電力を甚いた、堎合の欠点を玹介した。筋電矩手の力芚を枬定するためにはこれらの方法では実甚性に欠ける郚分があるこずがわかった。これらの方法より簡䟿か぀静止時の蚈枬も可胜な手法が望たしいわけであるが、ここで我々は他の研究テヌマでのトラブルに着目した。 #heading("過負荷によるサヌボの故障", numbering: none, level: 3, outlined: false) 同じ研究宀内の別の研究グルヌプでサヌボの故障が䜕床か発生した。そのグルヌプではロボットを䜿甚しおいたのだが、ロボットの足を為すサヌボに過負荷がかかり電流制埡甚のトランゞスタが焌き切れおしたうこずが原因だった。サヌボは䞎えられたPWM信号に察応する回転角床目暙角床ず珟圚の回転角床ずにずれがある堎合に目暙角床ずなるように回転する性質がある。目暙角床たで回転する際に倖力により回転にブレヌキがかかる際はそれに負けじず䟛絊電流を増やすこずで動こうずする。しかしその際に内郚の電子回路の蚱容電流を超えおしたい砎損するこずがあった。我々はこの珟象に着目をしお、サヌボにかかる倖力を消費電力を甚いお怜出する手法を考案した。 #pagebreak(weak: true) = 筋電矩手の駆動郚゚ネルギヌ枬定に぀いお 筋電矩手の皌働郚を為すサヌボの消費電力を枬定するこずで、矩手にかかる力芚を枬定できるずいうコンセプトの実蚌を行った。今回は簡単のために筋電矩手を甚いるのではなく、実隓甚のロボットアヌムを甚いた。 === 実隓噚具 以䞋に今回の実隓で䜿甚した実隓噚具を衚蚘する - ロボットアヌム近藀科孊株匏䌚瀟 KXR-A5 - マむコンArduino Uno - シャント抵抗1Ω - 差動増幅回路 - オペアンプTexas Instrument TLC-2274 - 抵抗1: 1kΩ - 抵抗2: 2kΩ - 分銅 50g, 100g == 実隓方法 #figure(image("assets/実隓噚具構成図.png"), kind: image, caption: text("実隓噚具構成図")) #pagebreak() 䞊図のように筋電矩手を暡したロボットアヌムのサヌボの3぀を䜿い、それぞれの消費電力を電流を蚈枬するこずで枬定した。各サヌボの消費電力は、サヌボの電源ラむンに盎列にシャント抵抗を接続し、その抵抗の始端ず終端の電圧を差動増幅回路を甚いるこずでマむコンにアナログ情報ずしお取り入れられるようにした。\ 蚈枬に甚いたマむコンは、各サヌボの動䜜を指什するマむコンず同䞀のものを甚いるこずでサヌボの動䜜開始ずほずんど同時に蚈枬が開始されるように蚭蚈した。ここでサヌボの動䜜開始ず蚈枬開始ずが完党に同時でないのは、今回䜿甚したマむコンでは同時に䞀぀のスレッドしか実行できないため厳密には数クロック分だけ動䜜開始ず蚈枬開始ずがずれおしたうためである。\ === 手順 本研究の実隓では二぀の動䜜パタヌンのデヌタをロボットアヌムに付加する負荷を倉えながら取埗するこずで動䜜パタヌンず重さの関係性を調べやすくした。以䞋にその手順を瀺す。 + 負荷をかけない状態で動䜜を実行し、その際のシャント抵抗にかかる電圧を358Hzで1秒間蚈枬した。これを8回繰り返した。 + 1ず同様のこずを、ロボットアヌムの先端郚分に50gの分銅を吊るした状態で実行した。 + 1ず同様のこずを、ロボットアヌムの先端郚分に100gの分銅を吊るした状態で実行した。 + 動䜜2で1〜3ず同様のこずを実行した。 == 実隓結果 この実隓を行った結果、次の図に瀺すような消費電力の時系列倉化が芋られた。 #pagebreak(weak: true) #figure(image("assets/servo_data/motion1_1_servo2_0g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ1の消費電力負荷0g")) #figure(image("assets/servo_data/motion1_1_servo2_50g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ1の消費電力負荷50g")) #figure(image("assets/servo_data/motion1_1_servo2_100g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ1の消費電力負荷100g")) #figure(image("assets/servo_data/motion1_1_servo3_0g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ2の消費電力負荷0g")) #figure(image("assets/servo_data/motion1_1_servo3_50g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ2の消費電力負荷50g")) #figure(image("assets/servo_data/motion1_1_servo3_100g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ2の消費電力負荷100g")) #figure(image("assets/servo_data/motion1_1_servo5_0g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ3の消費電力負荷0g")) #figure(image("assets/servo_data/motion1_1_servo5_50g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ3の消費電力負荷50g")) #figure(image("assets/servo_data/motion1_1_servo5_100g.png", height: 12em), caption: text("動䜜1䞊昇の際のサヌボ3の消費電力負荷100g")) #figure(image("assets/servo_data/motion1_2_servo2_0g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ1の消費電力負荷0g")) #figure(image("assets/servo_data/motion1_2_servo2_50g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ1の消費電力負荷50g")) #figure(image("assets/servo_data/motion1_2_servo2_100g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ1の消費電力負荷100g")) #figure(image("assets/servo_data/motion1_2_servo3_0g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ2の消費電力負荷0g")) #figure(image("assets/servo_data/motion1_2_servo3_50g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ2の消費電力負荷50g")) #figure(image("assets/servo_data/motion1_2_servo3_100g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ2の消費電力負荷100g")) #figure(image("assets/servo_data/motion1_2_servo5_0g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ3の消費電力負荷0g")) #figure(image("assets/servo_data/motion1_2_servo5_50g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ3の消費電力負荷50g")) #figure(image("assets/servo_data/motion1_2_servo5_100g.png", height: 12em), caption: text("動䜜1䞋降の際のサヌボ3の消費電力負荷100g")) #figure(image("assets/servo_data/motion2_1_servo2_0g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ1の消費電力負荷0g")) #figure(image("assets/servo_data/motion2_1_servo2_50g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ1の消費電力負荷50g")) #figure(image("assets/servo_data/motion2_1_servo2_100g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ1の消費電力負荷100g")) #figure(image("assets/servo_data/motion2_1_servo3_0g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ2の消費電力負荷0g")) #figure(image("assets/servo_data/motion2_1_servo3_50g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ2の消費電力負荷50g")) #figure(image("assets/servo_data/motion2_1_servo3_100g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ2の消費電力負荷100g")) #figure(image("assets/servo_data/motion2_1_servo5_0g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ3の消費電力負荷0g")) #figure(image("assets/servo_data/motion2_1_servo5_50g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ3の消費電力負荷50g")) #figure(image("assets/servo_data/motion2_1_servo5_100g.png", height: 12em), caption: text("動䜜2䞊昇の際のサヌボ3の消費電力負荷100g")) #figure(image("assets/servo_data/motion2_2_servo2_0g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ1の消費電力負荷0g")) #figure(image("assets/servo_data/motion2_2_servo2_50g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ1の消費電力負荷50g")) #figure(image("assets/servo_data/motion2_2_servo2_100g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ1の消費電力負荷100g")) #figure(image("assets/servo_data/motion2_2_servo3_0g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ2の消費電力負荷0g")) #figure(image("assets/servo_data/motion2_2_servo3_50g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ2の消費電力負荷50g")) #figure(image("assets/servo_data/motion2_2_servo3_100g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ2の消費電力負荷100g")) #figure(image("assets/servo_data/motion2_2_servo5_0g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ3の消費電力負荷0g")) #figure(image("assets/servo_data/motion2_2_servo5_50g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ3の消費電力負荷50g")) #figure(image("assets/servo_data/motion2_2_servo5_100g.png", height: 12em), caption: text("動䜜2䞋降の際のサヌボ3の消費電力負荷100g")) = リザバヌコンピュヌティング 実隓で埗られた䞀定の芏則性の認められる結果をモデル化するこずで、入力信号から出力の予枬ができるようになる。そのための手法は叀くから倚く考えられおきたが、蚈算機の高性胜化に䌎い近幎では機械孊習を甚いた手法が広く研究されるようになった。機械孊習ず倧きく括っおもそのフレヌムワヌクにはいく぀もの皮類があり、それぞれに埗意ずする分野が存圚する。䟋えばConvolutional Neural Networkを甚いた機械孊習は画像解析に適しおいるが時系列デヌタを扱う堎面で採甚されるこずは少ない。同様にTransformerは自然蚀語凊理の分野で今や䞻流ずなっおいるが、画像凊理には適さない。\ == 抂芁 前章での結果でも瀺したずおり、本研究の孊習察象は時系列倉化する信号ずなっおいる。するず時系列倉化する信号の孊習に適した手法が必芁ずなっおくるわけであるが、これにあたるのがRecursive Neural Network (RNN)を甚いた機械孊習である。しかし埓来型のRNNは掚論フェヌズず実行フェヌズずもに倚くの蚈算量を必芁ずし、さらに孊習のために倚くのデヌタ数を必芁ずするこずが知られおいる。孊習はずもかく、筋電矩手を操䜜するための蚈算機の凊理胜力で掚論がリアルタむムで行われるこずが理想的であるため、埓来型のRNNのような倚くの蚈算リ゜ヌスを必芁ずするようなモデルを採甚するこずは困難ずなっおしたう。@Reservoir-Computing \ そこで登堎するのがリザバヌコンピュヌティングRCである。RCはRNNの䞀皮ではあるが、ニュヌラルネット局の重みづけは行わずに出力局リヌドアりトの重みづけのみを孊習させるこずでモデルの最適化を行う。この手法を甚いるこずで、倚くのデヌタ数がなくずも十分な粟床が埗られる孊習ができるこずが先行の研究で明らかになっおいる。我々は今回RCを甚いおサヌボの消費電力の波圢を孊習させ、系にかかっおいる負荷を予枬するモデルを䜜成した。\ RCを甚いお埗られる結果は == 評䟡方法 モデルの評䟡にはRoot Mean Squared Error (RMSE)ずいう指暙を甚いた。 === RMSE平方平均二乗誀差 モデル出力ず目暙出力が共に連続倀で䞎えられる時系列予枬タスクや、時系列生成タスクの誀差を評䟡する指暙ずしおRMSEが広く甚いられる。\ $ "RMSE" = sqrt(frac(1,T) sum_(n=1)^T norm(upright(bold(d))(n)-accent(upright(bold(y)), hat)(n) )^2_2) $ ず定矩される。これはモデル出力ず目暙出力の間の二乗誀差の時間平均の平方根を衚しおいる。目暙出力デヌタの特城を考慮しおいないので、異なるデヌタに察するRMSEの倀を比范に意味がない点は泚意されるべきである。たた、RMSEはデヌタや予枬倀に平均から倧きく倖れた異垞倀や倖れ倀が含たれおいるず、その圱響を倧きく受けやすい。 @Reservoir-Computing #pagebreak(weak: true) = 消費電力から負荷を孊習 3章で取埗したデヌタを䜿っおRCを甚いお孊習させるこずで、3぀のサヌボの消費電力から系にかかる負荷を割り出すモデルを䜜成した。 たた、消費電力のみを䞎えたずころで負荷を予枬するモデルを䜜成したずころで汎甚性に欠けるずいう予枬のもず、3぀のサヌボの消費電力の時系列デヌタのほかに特城量ずしおそれぞれのサヌボの動䜜開始ず動䜜終了角床、そしお蚭定した回転速床を䞎えるこずずした。これらの情報は取埗に個別のセンサなどの機構を必芁ずせずサヌボ制埡甚、すなわちRC掚論にも甚いるマむコン䞊で取埗可胜なデヌタの䞭から遞んでいる点を匷調する。 == デヌタの前凊理 RCを甚いた孊習をするためにはたずデヌタを孊習に䜿甚しやすい圢にする必芁がある。今回はサヌボ3぀の消費電力の時系列倉化ずいう特城量に加えお、サヌボそれぞれの初期角床、終了角床、そしお蚭定速床を暪䞊びにするこずデヌタをわかりやすくした。たた、最埌にラベルずしお機胜する負荷重量を蚘茉するこずで、プログラム䞊で教垫ラベルずしお扱いやすい圢にした。プログラム䞊ではこれを48個のファむルに分け、党デヌタ数を48個ずし、そのうち38個を蚓緎デヌタずしお、10個を評䟡甚デヌタずしおしお䜿甚しおいる。 #pagebreak(weak: true) #figure(image("assets/前凊理デヌタ.png"), caption: text("リザバヌ孊習にをさせる際に甚いたデヌタ構造"), kind: table) #pagebreak(weak: true) == リザバヌコンピュヌティングの各皮蚭定 実はRCにもさたざたな方法が提案されおいる。Echo State Network (ESN), Liquid State Machine (LSM), FORCEなどが䞀般的であるが、今回は最もシンプルで実装の簡単なESNを採甚するこずずした。ESNはEcho State Propertyを満たすリザバヌ局に入力を䞎え、リヌドアりトの重みづけを線圢回垰を甚いお孊習させる点から非垞にシンプルであるためRCを䜿甚する䞊で広く䜿われおいる。@FORCE === リザバヌ局 リザバヌ局には Leaky Integrator によっお構成されたニュヌラルネットを甚いた。リヌク率は1、リカレント結合重み行列のスペクトル半埄は0.95、掻性化関数にはハむパボリックタンゞェントを甚いた。ノヌド数は特城量の数よりも十分に倧きい100に蚭定した。 @Intrinsic-Plasticity // ==== 適切なノヌド数の調査 // リザバヌ局のノヌド数は孊習の粟床ずその速床、そしお掚論フェヌズでの速床を決定するため非垞に重芁なパラメヌタである。本研究はサヌボの消費電力から系にかかっおいる負荷が掚論できるかずいうコンセプトの実蚌が本題ではあるが、筋電矩手で䜿甚するにあたっお十分に少ないノヌド数で掚論できなければ実行スピヌドがボトルネックずなっおしたう。そこで次のような実隓を行うこずで今回のデヌタに適切なノヌド数を調査した。 // ===== 実隓方法 // リザバヌ局のノヌド数を5から100に倉化させた時のRMSEの倀を比范した。ただし、48個のデヌタを8察2の割合で孊習甚ず評䟡甚のデヌタにランダムに分けおから孊習ず評䟡を行うようにしおいるため、実行ごずに結果が倉わっおくる。この倉化を鑑みお比范するためにそれぞれのノヌド数で1000回の孊習ず評䟡を行い、そのRMSEの平均をずった。このRMSEの平均ずリザバヌ局のノヌド数ずの関係が次の図の通りである。 // ===== 実隓結果 // #figure(image("assets/node_vs_rmse.png"), caption: text("RMSEの平均のノヌド数ずの䟝存関係")) // #pagebreak(weak: true) // 48個のデヌタを8察2の割合で分けおいるため孊習甚のデヌタは38個である。この図から芋お取れる通り、ノヌド数が38個に近づくに぀れおRMSEが急激に増加しおおり、そこから離れるに぀れお枛っおいるこずがわかった。この珟象はdouble descentず呌ばれおいる。 @double-descent // ===== 考察 // この実隓から、蚭定すべきノヌド数は孊習甚デヌタのデヌタ長よりも倧きくするこずがRC孊習には適しおいるこずがわかった。 === リヌドアりト局 次にリヌドアりト局の重みづけの孊習方法に぀いお説明する。今回はESNを甚いるため線圢回垰での重みづけ孊習を行ったのだが、倖れ倀の圱響を必芁以䞊に倧きくするこずを避けるためにRidge回垰を甚いた。正則化パラメヌタは $1.0 times 10^(-3)$に蚭定した。 @Ridge == 孊習結果 以䞋がこの孊習を行った結果である。 #figure(align(left, (image("assets/training_set_predictions_rmse_36.05610294846806.png", width: 180%))), caption: text("掚論モデルで孊習デヌタセットの予枬をさせた結果")) #pagebreak(weak: true) #figure(align(left, (image("assets/test_set_predictions_rmse_30.560928118691546.png", width: 180%))), caption: text("掚論モデルで評䟡デヌタセットの予枬をさせた結果")) #pagebreak(weak: true) == 考察 孊習甚デヌタを甚いおの評䟡䞊びに評䟡甚デヌタを甚いおの掚論のRMSEはどちらも30を超えるものずなった。たた、䞡者においお予枬倀ず実際の倀の差が倧きいこずが芋お取れる。これは孊習手法自䜓が䞍十分なものであるこずが原因ず考えられる。䞀番の特筆すべき点ずしおは重量なしの孊習デヌタず重量50g、そしお100gのデヌタずではデヌタの数は同じであるにもかかわらず、掚論の結果0g付近をほずんど予枬できおいない点である。これは孊習手法に誀りがあったこずを瀺しおいるず考えられる。 #pagebreak(weak: true) = たずめ 筋電矩手の操䜜性向䞊に必芁ずなっおくる力芚の怜知を行う方法ずしお、矩手内に搭茉されるこずの倚いサヌボの消費電力を甚いる手法の劥圓性に぀いお怜蚎した。筋電矩手におけるサヌボずいうのは生䜓における筋肉のように、䜍眮を移動させる胜力を持ちながら倖力が加えられた際にその倧きさに察応する反応を瀺す。その類䌌性は日頃の感芚ずしおは誰しもが気づく䜙地あるものではある。本研究を通しおこの類䌌性を瀺すこずができるか確認のための実隓を重ねたが、有意な類䌌性を瀺すには至らなかった。\ しかし珟時点で手法自䜓が間違っおいるず結論づけるこずはできない。デヌタの䞎え方やリザバヌコンピュヌティングの実装や蚭定の掚敲を重ねるこずで、本来行いたかった実隓の結果を埗られる可胜性は倧いに残っおいるず考えられる。 #set heading(numbering: none) = 謝蟞 本研究を進めるにあたり、倚倧なご指導、ご助蚀を頂いた葛西誠也教授をはじめずする工孊郚情報゚レクトロニクス孊科量子知胜デバむス研究宀の構成員の皆様に深謝の意を衚したす。垞に楜をしようず堕萜の方向ぞ向かう私に劥協を蚱さず研鑜の日々を促しお䞋さった葛西教授はもちろん、ご自身が修士論文研究や孊䌚発衚、就職掻動等でお忙しいにも関わらず進んで研究内容や発衚資料の校閲、的確な助蚀をくださった修士2幎吉田聖氏、修士1幎束田䞀垌氏に深謝の意を衚したす。たた、日頃からご指導、ご意芋を頂いた、量子集積゚レクトロニクス研究センタヌ長であられる本久順䞀教授、先進ナノ電子材料研究宀の石川史倪郎教授、原真二郎准教授、量子知胜デバむス研究宀の䜐藀嚁友准教授、機胜通信センシング研究宀の池蟺将之教授、赀柀正道准教授、集積電子デバむス研究宀の冚岡克広准教授に深く感謝臎したす。 #heading(numbering: none, text("Appendix")) 以䞋にRCで孊習を行った際に甚いたコヌドを瀺す。 ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt import japanize_matplotlib from sklearn.model_selection import train_test_split import model BASE_PATH: str = "data/" file_011_name: str = "0g_1_1.csv" file_012_name: str = "0g_1_2.csv" file_013_name: str = "0g_1_3.csv" file_014_name: str = "0g_1_4.csv" file_015_name: str = "0g_1_5.csv" file_016_name: str = "0g_1_6.csv" file_017_name: str = "0g_1_7.csv" file_018_name: str = "0g_1_8.csv" file_021_name: str = "0g_2_1.csv" file_022_name: str = "0g_2_2.csv" file_023_name: str = "0g_2_3.csv" file_024_name: str = "0g_2_4.csv" file_025_name: str = "0g_2_5.csv" file_026_name: str = "0g_2_6.csv" file_027_name: str = "0g_2_7.csv" file_028_name: str = "0g_2_8.csv" file_5011_name: str = "50g_1_1.csv" file_5012_name: str = "50g_1_2.csv" file_5013_name: str = "50g_1_3.csv" file_5014_name: str = "50g_1_4.csv" file_5015_name: str = "50g_1_5.csv" file_5016_name: str = "50g_1_6.csv" file_5017_name: str = "50g_1_7.csv" file_5018_name: str = "50g_1_8.csv" file_5021_name: str = "50g_2_1.csv" file_5022_name: str = "50g_2_2.csv" file_5023_name: str = "50g_2_3.csv" file_5024_name: str = "50g_2_4.csv" file_5025_name: str = "50g_2_5.csv" file_5026_name: str = "50g_2_6.csv" file_5027_name: str = "50g_2_7.csv" file_5028_name: str = "50g_2_8.csv" file_10011_name: str = "100g_1_1.csv" file_10012_name: str = "100g_1_2.csv" file_10013_name: str = "100g_1_3.csv" file_10014_name: str = "100g_1_4.csv" file_10015_name: str = "100g_1_5.csv" file_10016_name: str = "100g_1_6.csv" file_10017_name: str = "100g_1_7.csv" file_10018_name: str = "100g_1_8.csv" file_10021_name: str = "100g_2_1.csv" file_10022_name: str = "100g_2_2.csv" file_10023_name: str = "100g_2_3.csv" file_10024_name: str = "100g_2_4.csv" file_10025_name: str = "100g_2_5.csv" file_10026_name: str = "100g_2_6.csv" file_10027_name: str = "100g_2_7.csv" file_10028_name: str = "100g_2_8.csv" def convert_data_frames_to_numpys( data_frames: list[pd.DataFrame], ) -> np.ndarray[np.float64]: # あらかじめ空のリストを䜜成しおおく new_data = np.empty( (len(data_frames), data_frames[0].columns.size, data_frames[0].shape[0]), dtype=np.float64, ) for i in range(len(data_frames)): for j in range(data_frames[i].columns.size): new_data[i][j] = data_frames[i][j].values return new_data def get_merged_matrix( list_of_files: list[str], ) -> tuple[np.ndarray[np.float64], np.ndarray[np.float64]]: data_frames = [ pd.read_csv(BASE_PATH + file, header=None, skiprows=1) for file in list_of_files ] training_frames, testing_frames = train_test_split(data_frames, test_size=0.2) train_data_set = convert_data_frames_to_numpys(training_frames) test_data_set = convert_data_frames_to_numpys(testing_frames) return train_data_set, test_data_set train_data, test_data = get_merged_matrix( [ file_011_name, file_012_name, file_013_name, file_014_name, file_015_name, file_016_name, file_017_name, file_018_name, file_021_name, file_022_name, file_023_name, file_024_name, file_025_name, file_026_name, file_027_name, file_028_name, file_5011_name, file_5012_name, file_5013_name, file_5014_name, file_5015_name, file_5016_name, file_5017_name, file_5018_name, file_5021_name, file_5022_name, file_5023_name, file_5024_name, file_5025_name, file_5026_name, file_5027_name, file_5028_name, file_10011_name, file_10012_name, file_10013_name, file_10014_name, file_10015_name, file_10016_name, file_10017_name, file_10018_name, file_10021_name, file_10022_name, file_10023_name, file_10024_name, file_10025_name, file_10026_name, file_10027_name, file_10028_name, ] ) # Extract the load data from the training set. the last arrays of every set are the repeated load data. pick the first one of the last arrays and make it the load data train_load: np.ndarray[np.float64] = np.array( [train_data[i][-1][0] for i in range(len(train_data))], dtype=np.float64 ) test_load: np.ndarray[np.float64] = np.array( [test_data[i][-1][0] for i in range(len(test_data))], dtype=np.float64 ) # erase the last arrays of every set to make the training data does not include load data at the end # and transpose the data to make it compatible with the ESN model train_data = train_data[:, :-1, :].transpose(0, 2, 1) test_data = test_data[:, :-1, :].transpose(0, 2, 1) # Reshape the load data to make it compatible with the RMSE calculation that is for example, (38,) to (38,358) train_load_reshaped = np.tile(train_load, (train_data.shape[1], 1)).T.reshape(-1, 1) test_load_reshaped = np.tile(test_load, (test_data.shape[1], 1)).T.reshape(-1, 1) # Initialize the ESN model input_size = train_data.shape[1] # Number of data points in each sample reservoir_size = 100 # Size of the reservoir output_size = 1 # Predicting a single value (Load) esn = model.ESN(N_u=input_size, N_y=output_size, N_x=reservoir_size) # Train the ESN model esn.train( train_data, train_load, model.Tikhonov(N_x=reservoir_size, N_y=output_size, beta=1e-3), ) # Predict using the trained model (for demonstration, use the training data itself) train_predictions: np.ndarray[float] = esn.predict(train_data) # Evaluate the model by computing the mean squared error on the training data train_rmse: float = np.sqrt(((train_predictions - train_load_reshaped) ** 2).mean()) # Predict using the trained model test_predictions: np.ndarray[float] = esn.predict(test_data) # Evaluate the model by computing the mean squared error on the training data test_rmse: float = np.sqrt(((test_predictions - test_load_reshaped) ** 2).mean()) print("Training RMSE: ", train_rmse) flattened_predictions = test_predictions.flatten() plt.figure(figsize=(12, 6)) plt.subplot(1, 2, 1) plt.scatter( x=range(len(train_load_reshaped)), y=train_load_reshaped, label="実際の質量", alpha=0.6 ) plt.scatter( x=range(len(train_predictions)), y=train_predictions, label="掚論倀", alpha=0.6 ) plt.title("孊習デヌタセットでの掚論") plt.xlabel("詊行") plt.ylabel("負荷質量・掚論倀 (g)") plt.legend() plt.tight_layout() plt.savefig(f'saved_graphs/training_set_predictions_rmse_{train_rmse}.png') plt.show() print("Test RMSE: ", test_rmse) plt.figure(figsize=(12, 6)) plt.subplot(1, 2, 1) plt.scatter( x=range(len(test_load_reshaped)), y=test_load_reshaped, label="実際の質量", alpha=0.6 ) plt.scatter( x=range(len(test_predictions)), y=test_predictions, label="掚論倀", alpha=0.6 ) plt.title("テストデヌタセットでの掚論") plt.xlabel("詊行") plt.ylabel("負荷質量・掚論倀 (g)") plt.legend() plt.tight_layout() plt.savefig(f'saved_graphs/test_set_predictions_rmse_{test_rmse}.png') plt.show() ``` #pagebreak() 以䞋にリザバヌコンピュヌティングのモデルを瀺す。ただし、これは田䞭䞭根廣瀬著「リザバヌコンピュヌティング」森北出版内に蚘茉されおいるコヌドを䞀郚改倉したものであり、本゜ヌスコヌドの著䜜暩は田䞭剛平先生に垰属するこずを明蚘しおおく。 ```python import numpy as np import networkx as nx # 恒等写像 def identity(x): return x # リザバヌ class Reservoir: # リカレント結合重み行列Wの初期化 def __init__(self, N_x, density, rho, activation_func, leaking_rate, seed=0): """ param N_x: リザバヌのノヌド数 param density: ネットワヌクの結合密床 param rho: リカレント結合重み行列のスペクトル半埄 param activation_func: ノヌドの掻性化関数 param leaking_rate: leaky integratorモデルのリヌク率 param seed: 乱数の皮 """ self.seed = seed self.W = self.make_connection(N_x, density, rho) self.x = np.zeros(N_x) # リザバヌ状態ベクトルの初期化 self.activation_func = activation_func self.alpha = leaking_rate # リカレント結合重み行列の生成 def make_connection(self, N_x, density, rho): # Erdos-Renyiランダムグラフ m = int(N_x * (N_x - 1) * density / 2) # 総結合数 G = nx.gnm_random_graph(N_x, m, self.seed) # 行列ぞの倉換(結合構造のみ connection = nx.DiGraph(G) W = np.array(connection) # 非れロ芁玠を䞀様分垃に埓う乱数ずしお生成 rec_scale = 1.0 np.random.seed(seed=self.seed) W = W * np.random.uniform(-rec_scale, rec_scale, (N_x, N_x)) # スペクトル半埄の蚈算 eigv_list = np.linalg.eig(W)[0] sp_radius = np.max(np.abs(eigv_list)) # 指定のスペクトル半埄rhoに合わせおスケヌリング W *= rho / sp_radius return W # リザバヌ状態ベクトルの曎新 def __call__(self, x_in: np.ndarray): """ param x_in: 曎新前の状態ベクトル return: 曎新埌の状態ベクトル """ # self.x = self.x.reshape(-1, 1) self.x = (1.0 - self.alpha) * self.x + self.alpha * self.activation_func( np.dot(self.W, self.x) + x_in # self.x は reservoir のノヌド数 (N_x) の次元を持぀ベクトルなので、np.dot(self.W, self.x) は必ず (N_x,) のベクトルになる。 ) return self.x # リザバヌ状態ベクトルの初期化 def reset_reservoir_state(self): self.x *= 0.0 # 出力局 class Output: # 出力結合重み行列の初期化 def __init__(self, N_x, N_y, seed=0): """ param N_x: リザバヌのノヌド数 param N_y: 出力次元 param seed: 乱数の皮 """ # 正芏分垃に埓う乱数 np.random.seed(seed=seed) self.Wout = np.random.normal(size=(N_y, N_x)) # 出力結合重み行列による重みづけ def __call__(self, x): """ param x: N_x次元のベクトル return: N_y次元のベクトル """ return np.dot(self.Wout, x) # 孊習枈みの出力結合重み行列を蚭定 def setweight(self, Wout_opt): self.Wout = Wout_opt # 出力フィヌドバック class Feedback: # フィヌドバック結合重み行列の初期化 def __init__(self, N_y, N_x, fb_scale, seed=0): """ param N_y: 出力次元 param N_x: リザバヌのノヌド数 param fb_scale: フィヌドバックスケヌリング param seed: 乱数の皮 """ # 䞀様分垃に埓う乱数 np.random.seed(seed=seed) self.Wfb = np.random.uniform(-fb_scale, fb_scale, (N_x, N_y)) # フィヌドバック結合重み行列による重みづけ def __call__(self, y): """ param y: N_y次元のベクトル return: N_x次元のベクトル """ return np.dot(self.Wfb, y) # リッゞ回垰beta=0のずきは線圢回垰 class Tikhonov: def __init__(self, N_x, N_y, beta): """ param N_x: リザバヌのノヌド数 param N_y: 出力次元 param beta: 正則化パラメヌタ """ self.beta = beta self.X_XT = np.zeros((N_x, N_x)) self.D_XT = np.zeros((N_y, N_x)) self.N_x = N_x # 孊習甚の行列の曎新 def __call__(self, d, x): d = np.reshape(d, (-1, 1)) x = np.reshape(x, (-1, 1)) self.X_XT = self.X_XT + np.dot(x, x.T) self.D_XT = self.D_XT + np.dot(d, x.T) # Woutの最適解近䌌解の導出 def get_Wout_opt(self): X_pseudo_inv = np.linalg.inv(self.X_XT + self.beta * np.identity(self.N_x)) Wout_opt = np.dot(self.D_XT, X_pseudo_inv) return Wout_opt # 逐次最小二乗RLS法 class RLS: def __init__(self, N_x, N_y, delta, lam, update): """ param N_x: リザバヌのノヌド数 param N_y: 出力次元 param delta: 行列Pの初期条件の係数P=delta*I, 0<delta<<1 param lam: 忘华係数 (0<lam<1, 1に近い倀) param update: 各時刻での曎新繰り返し回数 """ self.delta = delta self.lam = lam self.update = update self.P = (1.0 / self.delta) * np.eye(N_x, N_x) self.Wout = np.zeros([N_y, N_x]) # Woutの曎新 def __call__(self, d, x): x = np.reshape(x, (-1, 1)) for i in np.arange(self.update): v = d - np.dot(self.Wout, x) gain = 1 / self.lam * np.dot(self.P, x) gain = gain / (1 + 1 / self.lam * np.dot(np.dot(x.T, self.P), x)) self.P = 1 / self.lam * (self.P - np.dot(np.dot(gain, x.T), self.P)) self.Wout += np.dot(v, gain.T) return self.Wout # ゚コヌステヌトネットワヌク class ESN: # 各局の初期化 def __init__( self, N_u, N_y, N_x, density=0.05, input_scale=1.0, rho=0.95, activation_func=np.tanh, fb_scale=None, fb_seed=0, noise_level=None, leaking_rate=1.0, output_func=identity, inv_output_func=identity, classification=False, average_window=None, ): """ param N_u: 入力次元 param N_y: 出力次元 param N_x: リザバヌのノヌド数 param density: リザバヌのネットワヌク結合密床 param input_scale: 入力スケヌリング param rho: リカレント結合重み行列のスペクトル半埄 param activation_func: リザバヌノヌドの掻性化関数 param fb_scale: フィヌドバックスケヌリングdefault: None param fb_seed: フィヌドバック結合重み行列生成に䜿う乱数の皮 param leaking_rate: leaky integratorモデルのリヌク率 param output_func: 出力局の非線圢関数default: 恒等写像 param inv_output_func: output_funcの逆関数 param classification: 分類問題の堎合はTruedefault: False param average_window: 分類問題で出力平均する窓幅default: None """ # self.Input = Input(N_u, N_x, input_scale) self.Reservoir = Reservoir(N_x, density, rho, activation_func, leaking_rate) self.Output = Output(N_x, N_y) self.N_u = N_u self.N_y = N_y self.N_x = N_x self.y_prev = np.zeros(N_y) self.output_func = output_func self.inv_output_func = inv_output_func self.classification = classification # 出力局からのリザバヌぞのフィヌドバックの有無 if fb_scale is None: self.Feedback = None else: self.Feedback = Feedback(N_y, N_x, fb_scale, fb_seed) # リザバヌの状態曎新おけるノむズの有無 if noise_level is None: self.noise = None else: np.random.seed(seed=0) self.noise = np.random.uniform(-noise_level, noise_level, (self.N_x, 1)) # 分類問題か吊か if classification: if average_window is None: raise ValueError("Window for time average is not given!") else: self.window = np.zeros((average_window, N_x)) # バッチ孊習 def train(self, U, D, optimizer, trans_len=None): """ U: 教垫デヌタの入力, デヌタ長×N_u D: 教垫デヌタの出力, デヌタ長×N_y optimizer: 孊習噚 trans_len: 過枡期の長さ return: 孊習前のモデル出力, デヌタ長×N_y """ train_len = len(U) if trans_len is None: trans_len = 0 Y = [] # 時間発展 for n in range(train_len): for m in range(len(U[1])): # デヌタ数だけルヌプさせる # x_in = self.Input(U[n]) # TODO: x_in の倧きさ > リザバヌのノヌド数(N_x) の堎合の凊理を远加する x_in = np.zeros(self.N_x) x_temp = U[n][m] x_in[: len(U[n][m])] = x_temp # フィヌドバック結合 if self.Feedback is not None: x_back = self.Feedback(self.y_prev) x_in = x_in + x_back # ノむズ if self.noise is not None: x_in += self.noise # リザバヌ状態ベクトル x = self.Reservoir(x_in) # 分類問題の堎合は窓幅分の平均を取埗 if self.classification: self.window = np.append(self.window, x.reshape(1, -1), axis=0) self.window = np.delete(self.window, 0, 0) x = np.average(self.window, axis=0) # 目暙倀 d = D[n] d = self.inv_output_func(d) # 孊習噚 if n > trans_len: # 過枡期を過ぎたら optimizer(d, x) # 孊習前のモデル出力 y = self.Output(x) Y.append(self.output_func(y)) self.y_prev = d # 孊習枈みの出力結合重み行列を蚭定 self.Output.setweight(optimizer.get_Wout_opt()) # モデル出力孊習前 return np.array(Y) # バッチ孊習埌の予枬 def predict(self, U): test_len = len(U) Y_pred = [] # 時間発展 for n in range(test_len): for m in range(len(U[1])): # デヌタ数だけルヌプさせる # x_in = self.Input(U[n]) # TODO: x_in の倧きさ > リザバヌのノヌド数(N_x) の堎合の凊理を远加する x_in = np.zeros(self.N_x) x_temp = U[n][m] x_in[: len(U[n][m])] = x_temp # フィヌドバック結合 if self.Feedback is not None: x_back = self.Feedback(self.y_prev) x_in += x_back # リザバヌ状態ベクトル x = self.Reservoir(x_in) # 分類問題の堎合は窓幅分の平均を取埗 if self.classification: self.window = np.append(self.window, x.reshape(1, -1), axis=0) self.window = np.delete(self.window, 0, 0) x = np.average(self.window, axis=0) # 孊習埌のモデル出力 y_pred = self.Output(x) Y_pred.append(self.output_func(y_pred)) self.y_prev = y_pred # モデル出力孊習埌 return np.array(Y_pred) ``` #[ #set text(lang: "en") #bibliography("bibliography/bib.yaml", title: text(bibliographyTitleJa), style: "institute-of-electrical-and-electronics-engineers") ]
https://github.com/HPDell/typst-slides-uob
https://raw.githubusercontent.com/HPDell/typst-slides-uob/main/README.md
markdown
# Slides with Theme University of Bristol in Typst This is a template for creating slides with the theme of the University of Bristol in Typst. ## Functions ```typ #let slides( title: "", authors: (), date: datetime.today(), short-title: "", body ) ``` This function changes page, text and layout settings to prepare for slides. ```typ #let slide(body, subtitle: []) ``` This function creates a slide and can append a subtitle after its title. Its title is specified in the nearest former level-3 headings, i.e., headings of marker `===`. ```typ #let empty(content) ``` This function creates an empty slide. ```typ #let leaflet(content, title: []) ``` This function creates a block area with a header and body, which looks like the `\block{}` command in Beamer. As the name `block` has been taken by Typst itself, it is named to `leaflet` instead. ## Syntax Maps Headings are translated into specific parts: - The level-1 and level-2 headings are mapped to the section page and the subsection page. - The level-3 headings are stored as slide titles and hidden. They only show up once the `#slide` is called to create a new slide. ## Example [![](example.jpg)](./example.pdf)
https://github.com/LDemetrios/Typst4k
https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/model/heading.typ
typst
// Test headings. --- heading-basic --- // Different number of equals signs. = Level 1 == Level 2 === Level 3 // After three, it stops shrinking. =========== Level 11 --- heading-syntax-at-start --- // Heading vs. no heading. // Parsed as headings if at start of the context. /**/ = Level 1 #[== Level 2] #box[=== Level 3] // Not at the start of the context. No = heading // Escaped. \= No heading --- heading-block --- // Blocks can continue the heading. = #[This is multiline. ] = This is not. --- heading-show-where --- // Test styling. #show heading.where(level: 5): it => block( text(font: "Roboto", fill: eastern, it.body + [!]) ) = Heading ===== Heading 🌍 #heading(level: 5)[Heading] --- heading-offset --- // Test setting the starting offset. #set heading(numbering: "1.1") #show heading.where(level: 2): set text(blue) = Level 1 #heading(depth: 1)[We're twins] #heading(level: 1)[We're twins] == Real level 2 #set heading(offset: 1) = Fake level 2 == Fake level 3 --- heading-offset-and-level --- // Passing level directly still overrides all other set values #set heading(numbering: "1.1", offset: 1) #heading(level: 1)[Still level 1] --- heading-syntax-edge-cases --- // Edge cases. #set heading(numbering: "1.") = Not in heading =Nope --- heading-numbering-hint --- = Heading <intro> // Error: 1:19-1:25 cannot reference heading without numbering // Hint: 1:19-1:25 you can enable heading numbering with `#set heading(numbering: "1.")` Cannot be used as @intro
https://github.com/sses7757/sustech-graduated-thesis
https://raw.githubusercontent.com/sses7757/sustech-graduated-thesis/main/test-eq.typ
typst
Apache License 2.0
#import "sustech-graduated-thesis/utils/multi-line-equate.typ": equate, equate-ref #set text(lang: "en") #set heading(numbering: "1.1") #show heading: it => { counter(math.equation).update(0) it } #show math.equation: equate.with(debug: true) #show ref: equate-ref #set math.equation(numbering: "(1.1.a)") = Heading #context counter(math.equation).get() Simple $ O(n/t) = 1 $ <-> #context counter(math.equation).get() Simple 2 $ O(n/t) = 1 $ <simple2> #context counter(math.equation).get() @eqt:simple2 Test $ F_n &= P(n) \ &= floor(1 / sqrt(5) phi.alt^n). #<test2> $ <test> #context counter(math.equation).get() @eqt:test, @eqt:test-test2 Test no label $ F_n &= P(n) \ &= floor(1 / sqrt(5) phi.alt^n). $ <-> #context counter(math.equation).get() $ F_n &= P(n) \ &= floor(1 / sqrt(5) phi.alt^n). #<specific> $ <-> #context counter(math.equation).get() @eqt:specific $ F_n &= P(n) #<new1> \ &= floor(1 / sqrt(5) phi.alt^n). #<new2> $ <-> #context counter(math.equation).get() @eqt:new1, @eqt:new2 #pagebreak() = Heading #context counter(math.equation).get() Simple $ O(n/t) = 1 $ <-> #context counter(math.equation).get() Simple 2 $ O(n/t) = 1 $ <2-simple2> #context counter(math.equation).get() @eqt:2-simple2 Test $ F_n &= P(n) \ &= floor(1 / sqrt(5) phi.alt^n). #<test2> $ <2-test> #context counter(math.equation).get() @eqt:2-test, @eqt:2-test-test2 Test no label $ F_n &= P(n) \ &= floor(1 / sqrt(5) phi.alt^n). $ <-> #context counter(math.equation).get() $ F_n &= P(n) #<2-specific> \ &= floor(1 / sqrt(5) phi.alt^n). $ <-> #context counter(math.equation).get() @eqt:2-specific $ F_n &= P(n) #<2-new1> \ &= floor(1 / sqrt(5) phi.alt^n). #<2-new2> $ <-> #context counter(math.equation).get() @eqt:2-new1, @eqt:2-new2
https://github.com/gongke6642/tuling
https://raw.githubusercontent.com/gongke6642/tuling/main/基础/array/array.typ
typst
#set par( justify: true, leading: 0.52em, ) = array = #image("1.png", width: 100%) #image("2.png") #image("3.png") #image("4.png") #image("5.png") #image("6.png") #image("7.png") #image("8.png") #image("9.png") #image("10.png") #image("11.png") #image("12.png") #image("13.png")