Peter Pein on Sun, 22 Jul 2018 10:15:34 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: generating function solution to poly


Hi Kevin,


I'm just curious:  are you sure the coefficients in g are correct?

starting Bill Allombert's suggestion to iterate via Newton but starting
with just X^2+O(X^3)  gives another sequence for g and a difference for
coeffs of x^7 and higher powers


? P=substvec((1+x)*g^3-2*g^2+(1+x+2*x^2)*g-x^2,[x,g],[X,y])
%1 = (X + 1)*y^3 - 2*y^2 + (2*X^2 + X + 1)*y - X^2
? g=subst(x^2+O(x^3),x,X)
%2 = X^2 + O(X^3)
? g=truncate(g)-subst(P,y,truncate(g))/subst(P',y,g)
%3 = X^2 - X^3 + X^4 - 3*X^5 + O(X^6)
? g=truncate(g)-subst(P,y,truncate(g))/subst(P',y,g)
%4 = X^2 - X^3 + X^4 - 3*X^5 + 6*X^6 - 14*X^7 + 37*X^8 - 91*X^9 +
237*X^10 - 629*X^11 + O(X^12)
? g=truncate(g)-subst(P,y,truncate(g))/subst(P',y,g)
%5 = X^2 - X^3 + X^4 - 3*X^5 + 6*X^6 - 14*X^7 + 37*X^8 - 91*X^9 +
237*X^10 - 629*X^11 + 1668*X^12 - 4512*X^13 + 12298*X^14 - 33740*X^15 +
93365*X^16 - 259775*X^17 + 726672*X^18 - 2043004*X^19 + 5767735*X^20 -
16347053*X^21 + 46495340*X^22 - 132664614*X^23 + O(X^24)
?

This is the same result as in an well known CAS:

 In[1]:= Series[Root[-x^2+(1+x+2 x^2) #1-2 #1^2+(1+x) #1^3&,1],{x,0,23}]

Out[1]= x^2-x^3+x^4-3 x^5+6 x^6-14 x^7+37 x^8-91 x^9+237 x^10-629
x^11+1668 x^12-4512 x^13+12298 x^14-33740 x^15+93365 x^16-259775
x^17+726672 x^18-2043004 x^19+5767735 x^20-16347053 x^21+46495340
x^22-132664614 x^23+O[x]^24

please ignore, if I'm writing crap ...

Peter

Am 21.07.2018 um 10:38 schrieb Kevin Ryde:
> I have a generating function (and more terms too)
>
>     g = x^2 + x^3 + x^4 + 3*x^5 + 6*x^6 + 12*x^7 + 29*x^8 + 67*x^9 + O(x^10);
>
> which satisfies a cubic
>
>     (1+x)*g^3 - 2*g^2 + (1-x+2*x^2)*g - x^2 == 0
>
> Is there an easy or good way to have gp solve that for series g?
>
> I know how to work upwards to get g term by term (after deciding lowest
> should be 0), but maybe gp already has it.  I wondered only for interest
> or generality though, since this one comes from recurrences which are
> easy to calculate.  I attempted serreverse() without joy (change
> variables to solve in x, but I may have confused myself).
>
>