| Loïc Grenié on Sat, 16 Aug 2014 08:31:16 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Vec() and leading zeros of generating function |
2014-08-16 7:43 GMT+02:00 Kevin Ryde <user42_kevin@yahoo.com.au>:
> Vec() can give terms from a polynomial generating function but it
> doesn't include leading zeros. Eg.
>
> Vec(x^2/(1-2*x) + O(x^5))
> =>
> [1, 2, 4]
>
> Is there a good way to start from the zero'th term so I would get
>
> [0, 0, 1, 2, 4]
There is a genuine problem if your series have negative valuation.
If your series always have non-negative valuation, you can do:
sertovec(s)=concat(vector(valuation(s,variable(s))),Vec(s))
and use sertovec instead of Vec. The function is not robust and
will fail if s has negative valuation.
Hope this helps,
Loïc