47 lines
1.0 KiB
Plaintext
47 lines
1.0 KiB
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)],
|
|
))
|
|
|
|
#let r = poly.poly(6, -11, 6, -1)
|
|
#let horner = poly.horner(r, 2)
|
|
$
|
|
r = #poly.display(r, var: "lambda") =
|
|
(#poly.display(horner.root-factor, var: "lambda"))
|
|
(#poly.display(horner.factor, var: "lambda"))
|
|
$
|
|
|
|
#(horner.display)()
|
|
|
|
#let a = poly.mul(horner.root-factor, horner.factor)
|
|
$#poly.display(a, var: "lambda")$ |