PRC
← All projects

numty

NumPy-style maths for Typst — vectors, matrices and broadcasting.

Typst 2024 Source ↗ Website ↗

A library for element-wise maths on numbers, vectors and matrices in Typst, with broadcasting and NaN handling. The API follows NumPy, so add, mult, dot, linspace and friends behave the way you expect.

#import "@preview/numty:0.2.0" as nt

#let a = (1, 2, 3)
#nt.mult(a, 2)          // (2, 4, 6)
#nt.dot(a, a)           // 14
#nt.sin(nt.linspace(0, 10, 3))