Joerg Arndt on Sat, 16 Aug 2014 08:46:18 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Vec() and leading zeros of generating function |
* Kevin Ryde <user42_kevin@yahoo.com.au> [Aug 16. 2014 07:58]: > 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] I'd use concat([0,0], Vec(x^2/(1-2*x) + O(x^5))) The drawback is that you have to manually put in the right number of zeros. With any method to obtain the smallest exponent of a power series with nonzero coefficient this could be done as follows: gf = x^2/(1-2*x) + O(x^5)) e = magic(gf) \\ anyone? concat( vector(e), Vec(gf) ) That magic() would be useful in many places in the OEIS. Would e = valuation(gf,x) do the trick _reliably_? > [...]