#C10.txt, Oct. 10, 2016, Lagrange Inversion Help:=proc(): print(` LId(P,z,N),LI(P,z,N) , SPnk(n,k), SP(n) , Bell1(N) `): end: #LId(P,z,N): the first N coefficients of the f.p.s. u(t) safisfying u(t)=t*P(u(t)) #u(t)->t*P(u(t)) LId:=proc(P,z,N) local u,u1,t: if eval(subs(z=0,P))<>1 then RETURN(FAIL): fi: u:=t: u1:= convert(taylor(t*subs(z=u,P),t=0,N+1),polynom): while u<>u1 do u:=u1: u1:= convert(taylor(t*subs(z=u1,P),t=0,N+1),polynom): od: [seq(coeff(u1,t,i),i=1..N)]: end: #LI(P,z,N): the first N coefficients of the f.p.s. u(t) safisfying u(t)=t*P(u(t)) #using the famous Lagrange Inversion Formula LI:=proc(P,z,N) local n: [seq(1/n* coeff(taylor(P^n,z=0,n),z,n-1), n=1..N)]: end: #SP(n,k): the set of set-partitions of {1,.., n} into exactly k sets SPnk:=proc(n,k) local Old, New,sp,se,se1,new: option remember: if n=1 then if k=1 then RETURN({{{1}}}): else RETURN({}): fi: fi: #The new kid is shy so makes his or her or its own set Old:=SPnk(n-1,k-1): New:={ seq(sp union {{n}}, sp in Old)}: Old:=SPnk(n-1,k): for sp in Old do for se in sp do se1:=se union {n}: new:= sp minus {se} union {se1}: New:=New union {new}: od: od: New: end: #The set of set partitions of {1,...,n} SPn:=proc(n) local k: {seq(op(SPnk(n,k)),k=1..n)}: end: #Bell1(N): the list consisting of the N first Bell numbers Bell1:=proc(N) local i,z: [seq(coeff(taylor(exp(exp(z)-1),z=0,N+1),z,i)*i!,i=1..N)]: end: with(combinat): #SP1(n): the set of set-partitions of {1,..,n}, by considering the set of roomates of n #under construction SP1:=proc(n) local New,Old, FriendsOfn,S: S:=powerset({seq(i,i=1..n-1)}): end: