A library for working with polynomials.
Provides an abstract module, at poly, for generic coefficients, and specific modules for integers and floats, at poly/int and poly/float, respectively.
Special thanks to yoshi for their beautiful docs at iv that were used as heavy inspiration.
gleam add polynomial@1import poly
pub fn main() {
let ops = poly.Operations(
zero: 0,
add: int.add,
subtract: int.subtract,
multiply: int.multiply,
divide: int.divide
)
let a = poly.from_list([1, 2, 3])
let b = poly.from_list([4, 5, 6])
// Prints out [4, 13, 28, 27, 18]
echo poly.coefficients(poly.multiply(a, b, with: ops))
}Further documentation can be found at https://hexdocs.pm/poly.
gleam run # Run the project
gleam test # Run the tests