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 thecoeffs()function.For the above
Polynomialcalledp, this is done as such:Which gives: