How do I extract the coefficients of a Julia Polynomial
?
In Julia we can create a Polynomial
:
using Polynomials
p = Polynomial([23,34,23,135])
Which gives:
Polynomial(23 + 34*x + 23*x^2 + 135*x^3)
How do I extract the coefficients and store them in a Vector
?
In Julia
, this is done using the coeffs()
function.
For the above Polynomial
called p
, this is done as such:
coeffs(p)
Which gives:
4-element Vector{Int64}:
23
34
23
135