I want to invert a power series with PARI/GP:
if $y=a[1]*x+a[2]*x^2+...+O(x^N)$
is encoded by a given array, say a=vector(N-1)
, I want PARI to produce the vector b such that $x=b[1]*y+b[2]*y^2+...+O(y^N)$
.
This can be done using the Bell polynomials. The Pari handbook has
Bell(k,n=-1)=
{
my(var(i)=eval(Str("X",i)));
my(x,v,dv);
v=vector(k,i,if(i==1,’E,var(i-1)));
dv=vector(k,i,if(i==1,’X*var(1)*’E,var(i)));
x=diffop(’E,v,dv,k)/’E;
if(n<0,subst(x,’X,1),polcoeff(x,n,’X))
}
producing e.g.
gp > Bell(3)
%3 = X1^3 + 3*X2*X1 + X3
But I have no idea how to use those, i.e. to attribute values to X1, X2, ...
in a subsequent formula in Pari (in fact, I hardly understand how eval()
and subst()
work in the above formula!). That should be trivial for someone who knows... Help please!