Question: Regarding powerseries package

Hello,

I am teaching students "operator analysis" and trying to work with maple. But here I encounter some problems, maybe someone could help me.

I have an operator which returns  powerseries. An operator is implemented in procedure geom (in parameters: s is powerseries and this procedur returns A(s), where A is an operator and s powwerseries):

with(powseries);
geom:=proc(s) local l, ll, p;
l:=powint(powdiff(powdiff(s)));
powcreate(p(n)=0,p(1)=1);
ll:=multiply(p,multiply(p,s));
powadd(l,ll);
end proc;
 
Then I need the powerseries (1+A(s)+A(A(s))+A(A(A(s)))+...) this sequence stops, when reaches n (by this I mean A^0=1, A^1=A(s), A^2=A(A(s)), A^3=A(A(A(s))) and so on till A^n.
 
So I write two procedure: one implement to get A^n and another counts the sum (1+A(s)+A(A(s))+A(A(A(s)))+...).
 
The first works good but the second returns and error: Error, (in sum) too many levels of recursion.
 
I cannot understand where is the problem:
 
 

with(powseries);  
An:=proc(s,N) 
if N>1 then An(geom(s),N-1) 
elif N=1 then geom(s) end if
end proc;
 
 
with(powseries);  geometre:=proc(s,N) local i, suma;
suma:=powcreate(p(n)=0);
for i from 1 to N
    do
       suma:=powadd(suma, An(s,i));
    end do;
end proc;

 
 
I am sorry for my English (I am from Lithuania, Europe) and would be very gratefull for Your help. Thank You.

Please Wait...