# Question:why my procedure appear too many recursion?

## Question:why my procedure appear too many recursion?

Maple 14

restart:
> Digits:=30:
> with(linalg):
>
> h[0]:=0.156;:
> d:=0.32*h[0]:
> l:=4:
> h[1]:=h[0]-d:
> h[2]:=h[0]+d:
> g:=9.8:
> Term:=12:
> Num:=3:
> n:=4:
>
> for N from 1 to Num do
> lambda:=2*n*Pi/l:## N1 wei sha ba tiao shu
> epsilon:=evalf(0.5+2*(N-1)/(Num-1)):
> k[0]:=evalf(0.5*Pi+2*(N-1)*Pi/(Num-1)):
> tau[0]:=evalf(k[0]*h[0]):
> omega:=evalf((g*k[0]*tanh(k[0]*h[0]))^(1/2)):
> E:=g/(omega)^2:
> k[1]:=abs(fsolve(omega^2=g*k*tanh(k*h[1]),k)):
> tau[1]:=evalf(k[1]*h[1]):
> k[2]:=abs(fsolve(omega^2=g*k*tanh(k*h[2]),k)):
> tau[2]:=evalf(k[2]*h[2]):
>
> F:=tau->tanh(tau[1])+tau*sum((eval(diff(tanh(tau),tau\$s),tau=tau[1]))/s!*(tau-tau[1])^(s-1),s=1..4);
> T:=tau->tanh(tau[2])+tau*sum((eval(diff(tanh(tau),tau\$s),tau=tau[1]))/s!*(tau-tau[2])^(s-1),s=1..4);
>
> P:=tau->(sinh(2*tau)-2*tau*cosh(2*tau))/(2*tau+sinh(2*tau))^2;
> Q:=tau->(16*tau^4+32*tau^3*sinh(2*tau)-9*sinh(2*tau)*sinh(4*tau)+12*tau*(tau+sinh(2*tau))*((cosh(2*tau))^2-2*cosh(2*tau)+3))/3/(2*tau+sinh(2*tau))^4; # ding yi han shu
>
> A:=unapply(taylor(2*(tau-tau[1])/sinh(2*tau)-tanh(tau)*(h[0]-E*tau*tanh(tau))*(2*tau+sinh(2*tau))/((E*tau*tanh(tau)-h[2])*F(tau)*sinh(2*tau)),tau=tau[1],Term+1),tau);
> B:=unapply(taylor((1+2*tau/sinh(2*tau))^2*(-(tau-tau[1])/lambda^2/E/(E*tau*tanh(tau)-h[2])/F(tau)-(h[0]-E*tau*tanh(tau))*(tau-tau[1])*tanh(tau)/(E*tau*tanh(tau)-h[2])/F(tau)*P(tau)+(tau-tau[1])^2*Q(tau)),tau=tau[1],Term+1),tau);
>
>
> for j from 0 to Term do
> a[j]:=coeff(A(tau),tau-tau[1],j):
> b[j]:=coeff(B(tau),tau-tau[1],j):
> end do;
>
> for m from 1 to Term do
> f1[0]:=1;
> f2[0]:=1;
> f1[m]:=-(sum(f1[m-i]*((m-i)*a[i]+b[i]),i=1..m))/(m*(m-1+1/2));
> f2[m]:=-(sum(f2[m-i]*((m-i+1/2)*a[i]+b[i]),i=1..m))/((m+1/2)*(m+1/2-1+1/2));
> end do;
>
>
>
>
> CC:=unapply(taylor(2*(tau-tau[2])/sinh(2*tau)-tanh(tau)*(h[0]-E*tau*tanh(tau))*(2*tau+sinh(2*tau))/(E*tau*tanh(tau)-h[1])/T(tau)/sinh(2*tau),tau=tau[2],Term+1),tau);
> DD:=unapply(taylor((1+2*tau/sinh(2*tau))^2*(-(tau-tau[2])/lambda^2/E/(E*tau*tanh(tau)-h[1])/T(tau)-(h[0]-E*tau*tanh(tau))*(tau-tau[2])*tanh(tau)/(E*tau*tanh(tau)-h[1])/T(tau)*P(tau)+(tau-tau[2])^2*Q(tau)),tau=tau[2],Term+1),tau);
>
> j:='j':
> for j from 0 to Term do
> cc[j]:=coeff(CC(tau),tau-tau[2],j):
> dd[j]:=coeff(DD(tau),tau-tau[2],j):
> end do;
>
> i:='i':
> f3[0]:=1;
> f4[0]:=1;
> m:='m':
> for m from 1 to Term do
> f3[m]:=-(sum('f3[m-i]*((m-i)*cc[i]+dd[i])','i'=1..m))/(m*(m-1+1/2));
> f4[m]:=-(sum('f4[m-i]*((m-i+1/2)*cc[i]+dd[i])','i'=1..m))/((m+1/2)*(m+1/2-1+1/2));
> end do:
>
>
> xi11:=unapply(sum(f1[j1]*(tau-tau[1])^(j1),j1=0..m-1),tau);
> xi12:=unapply(sum(f2[j2]*(tau-tau[1])^(j2+1/2),j2=0..m-1),tau);
> xi21:=unapply(sum(f3[j3]*(tau-tau[2])^(j3),j3=0..m-1),tau);
> xi22:=unapply(sum(f4[j4]*(tau-tau[2])^(j4+1/2),j4=0..m-1),tau);
> end do:

﻿