New library : purescript-sparse-polynomials



A library to do various computations with sparse polynomials like

  • usual computations using univariate polynomials,
  • multivariate polynomials, or
  • numeric roots of real univariate polynomials

Documentation on Pursuit


Is the a difference (besides normalization) between <> serves the same purpose as +?

I would find (+) to be more intuitive


That’s an interesting question and I think the answer have to belong in the philosophical realm rather than the technical one.
To defend myself, I propose the following analogy: when you build a vector X from its components x1 and x2, do you think you’re adding them ? I personnally think I’m glueing them because in order to add them, they should already have the shape (x1, 0) and (0, x2), meaning they’re already glued to something!
Furthermore, the hole in the <> operator reminds that nothing particular happens during the glueing process, which is not the case during the + operation (filtering of null coefficients, for instance).
I guess it’s a matter of point of view.


I see your point.

The multivariante modelling is really elegant.

1 Like

Thank you very much. I’m rather proud of it myself, especially since I’ve realized that I’ve solved the matrix modelling (my next goal) in the process.

Indeed, as there is a 1-to-1 correspondance between any matrix (say 2X3) and a polynomial in (x,y) (in this case : a00+a01y+a02y²+a10x+a11xy+a12xy²), I already have my matrix coefficients basis (a00^0^0, a01^0^1, a02^0^2, a10^1^0, a11^1^1 and a12^1^2) and setters!

In fact, this solves the tensor modelling too when considering more than x and y !!


That is quite clever. I wish you the best for your matrix library!

1 Like

Thanks ! I’m working on it! And to elaborate on your initial question, <> will also serve as a replacement/resetter operator in case of common exponents.
Thanks for your PR :pray:, it is now tested and merged.


I did not think of using <> as a replacement operator. Good point