math-tools/gallery/example4.typ
2024-06-25 18:50:29 +02:00

35 lines
735 B
Plaintext

#import "/src/lib.typ": *
#let p = poly.poly(0,1,2,3,4)
#let q = poly.poly(5,6,7)
#let a = poly.add(p, q)
#let b = poly.sub(p, q)
$
p = #poly.display(p) quad q = #poly.display(q)\
p + q = #poly.display(a)\
p - q = #poly.display(b)\
$
#let P = poly.poly(7, -3, -3, 1, 1)
#let Q = poly.poly(-2, 1, 1)
$
P = #poly.display(P) quad Q = #poly.display(Q)\
P / Q = #poly.display(P) / #poly.display(Q)
$
#let div = poly.div(P, Q)
#align(center, grid(
columns: 2,
align: left,
column-gutter: 2em,
row-gutter: 1em,
[dividend: #poly.display(div.dividend)],
grid.cell(rowspan: 4, (div.display)()),
[divisor: #poly.display(div.divisor)],
[quotient: #poly.display(div.quotient)],
[rest: #poly.display(div.rest)],
))