Zulip Chat Archive

Stream: Is there code for X?

Topic: Polynomial from coefficients


Eric Wieser (Sep 11 2021 at 14:31):

#9011 adds

/-- The associated polynomial `(v 0) + (v 1) * X + ... + (v (n-1)) * X ^ (n-1)` to `matrix.circulant v`.-/
noncomputable
def matrix.circulant.poly [semiring α] (v : fin n  α) : polynomial α :=
 i : fin n, polynomial.monomial i (v i)

Obviously it doesn't belong in the matrix namespace as #9011 has it, but do we have this "make a polynomial from its coefficients" function somewhere already?

Eric Wieser (Sep 11 2021 at 14:31):

cc @Alex Zhang

Johan Commelin (Sep 11 2021 at 14:34):

Oops, I missed this.

Johan Commelin (Sep 11 2021 at 14:35):

Anyway, I think that this sum is the best we've got, when it comes to constructing a polynomial from its coefficients

Eric Wieser (Sep 11 2021 at 14:38):

Presumably there's a docs#finsupp_of_finite somewhere, which can be composed with docs#finsupp.map_domain

Eric Wieser (Sep 11 2021 at 14:39):

Which would make the coefficients defeq

Eric Wieser (Sep 11 2021 at 14:40):

Ah, it's docs#finsupp.equiv_fun_on_fintype

Johan Commelin (Sep 11 2021 at 14:57):

Aah, I agree that this is a better idea.

Johan Commelin (Sep 11 2021 at 14:58):

Presumably we should have polynomial.mk_of_fin or something like that?

Eric Wieser (Sep 11 2021 at 15:11):

Yeah, or mk_of_fin_coeffs


Last updated: Dec 20 2023 at 11:08 UTC