# Question:Why "Error, too many levels of recursion"?

## Question:Why "Error, too many levels of recursion"?

Maple

I’ve developed a procedure in the Maple as follows:

> restart;

> PS:=proc()

> local a,v1,v2,SE1,con1,Y1,Y1S,y1,b,Y1p,y1p,bp,SE2,con2,Y2,Y2S,y2,lim,p1,p2,p3,p4;

> v1:=0;

> v2:=10;

> a:=0.347646250;

> SE1:=-diff(y1(x),x,x)+v1*y1(x)=5*y1(x);

> con1:=y1(-2)=1,D(y1)(-2)=a;

> Y1:=dsolve({SE1,con1},y1(x));

> Y1S:=subs(Y1,y1(x));

> y1:=unapply(Y1S,x);

> b:=evalf(y1(0));

> Y1p:=diff(y1(x),x);

> y1p:=unapply(Y1p,x);

> bp:=evalf(y1p(0));

> SE2:=-diff(y2(x),x,x)+v2*y2(x)=5*y2(x);

> con2:= y2(0)=b,D(y2)(0)=bp;

> Y2:=dsolve({SE2,con2},y2(x));

> Y2S:=subs(Y2,y2(x));

> y2:=unapply(Y2S,x);

> lim:=evalf(y2(50));

> while abs(lim)>10^47 do

>       a:=a+1:

>        y1:=x->y1(x):

>        SE1:=-diff(y1(x),x,x)+v1*y1(x)=5*y1(x):

>        con1:=y1(-2)=1,D(y1)(-2)=a:

>        Y1:=dsolve({SE1,con1},y1(x)):

>        Y1S:=subs(Y1,y1(x)):

>        y1:=unapply(Y1S,x):

>        b:=evalf(y1(0)):

>        Y1p:=diff(y1(x),x):

>         y1p:=unapply(Y1p,x):

>         bp:=evalf(y1p(0)):

>        y2:=x->y2(x):

>        SE2:=-diff(y2(x),x,x)+v2*y2(x)=5*y2(x):

>         con2:= y2(0)=b,D(y2)(0)=bp:

>          Y2:=dsolve({SE2,con2},y2(x)):

>          Y2S:=subs(Y2,y2(x)):

>         y2:=unapply(Y2S,x):

>           lim:=evalf(y2(50)):

> end do:

> with(plots):

> p1:=plot(y1(x),x=-3..0):

> p2:=plot(y2(x),x=0..3):

> p3:=plot(v1,x=-3..0):

> p4:=plot(v2,x=0..3):

> display(p1,p2,p3,p4);

> end proc:

> PS();

Error, (in y1) too many levels of recursion

I don’t understand what is my procedure’s error that abovementioned Error appears.

Can you help me?