ex8: init

This commit is contained in:
2025-10-12 18:44:10 +02:00
parent 516e4d703f
commit 5016c6ae91
2 changed files with 69 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#let title(cont, size: 18pt) = align(center)[
#text(size: size * 2, weight: "bold")[#underline[#cont]]
]
#let butcher(s, nums) = {
let nums = nums.map(x => if type(x) == float or type(x) == int {
$#x$
} else { x })
table(
stroke: (x, y) => if x == 0 and y == s {
(right: 0.7pt + black, top: 0.7pt + black)
} else if x == 0 {
(right: 0.7pt + black)
} else if y == s {
(top: 0.7pt + black)
},
align: (x, y) => (
if x > 0 { center } else { left }
),
columns: s + 1,
$0$, ..range(s).map(x => none), // first row
..range(2, s + 1)
.map(i => {
let p(i) = calc.floor(i * i / 2 + i / 2 - 1)
(
nums.slice(p(i - 1), p(i - 1) + i),
range(i, s + 1).map(x => none),
).flatten()
})
.flatten(),
none, ..nums.rev().slice(0, s).rev() // last row
)
}
+36
View File
@@ -0,0 +1,36 @@
#import "lib.typ"
#let FONT_SIZE = 18pt;
#set page(paper: "a4", margin: (x: 2.6cm, y: 2.8cm), numbering: "1 : 1")
#set par(justify: true, leading: 0.52em)
#set text(font: "FreeSerif", size: FONT_SIZE, lang: "us")
#show math.equation: set text(
font: "Euler Math",
size: (FONT_SIZE * 1.0),
lang: "en",
)
#set heading(numbering: none)
#show heading.where(level: 1): it => {
rect(inset: FONT_SIZE / 2)[#it]
}
these are my solutions to the eighth exercise set of TMA4135.
this document was created using
#link("https://typst.app/")[#text(blue.darken(5%))[typst]].
#lib.title(size: FONT_SIZE)[exercise 7]
\
#outline(title: none)
#pagebreak()
= problem 1
#include "problem1.typ"