# Question:Error, too many levels of recursion

## Question:Error, too many levels of recursion

Maple 11

Hello! I wrote a program in Maple but it doesn't work. It crashes with the following error: "Error, (in r_nach_1[3]) too many levels of recursion". I am a newbie in Maple and don't know how to solve this problem. A part of my program that causes the error is given below. Many thanks!

maple.mws

restart;
t1F := 20: A11 := 2.5*10^(-3): c1 := 4*10^2: ss1 := 0.5*10^(-2):
pI1 := 0.4*10^(-1): r1max := 0.6*10^(-2): procent:=0.2:
A12 := procent*A11: B1:=-1: alpha:=0.000001:

beta1:=0.5: r_nach_1[1]:=0: r_nach_1[2]:=0.2*10^(-2):

iter_psi_c1_1:=proc(t) 0 end proc: iter_psi_c2_1:=proc(t) 0 end proc:
s1[1]:=proc(t) 0 end proc:

for i from 1 to 2 do

_p11 := evalf(dsolve({
diff(p1(t), t) = A11*(p1(t)-'s1'[i](t))+B1*(r_nach_1[i+1](t)-r_nach_1[i](t))+A12*(p1(t)-'s1'[i](t))^2+ss1,
p1(0) = pI1}, numeric,method = dverk78, abserr = 1.*10^(-8), relerr = 1.*10^(-8),optimize,output = listprocedure, known=[s1[i],iter_psi_c1_1,iter_psi_c2_1])):

p1F := rhs(_p11(t1F)[2]):
s1[i+1] := subs(_p11, p1(t)):

q11 := evalf(dsolve({diff(q1(t), t) = c1*r_nach_1[i+1](t), q1(0) = 0},numeric,range=0..t1F,known=[iter_psi_c1_1,iter_psi_c2_1])):

q1F := rhs(q11(t1F)[2]):

F[i]:= beta1*q1F;

_psi_c1_1 :=
evalf(dsolve({
diff(psi_c1_1(t), t) = A11+2*A12*('s1'[i+1](t)-'s1'[i](t))*psi_c1_1(t), psi_c1_1(t1F) =  -1+beta1},numeric,method = dverk78, abserr = 1.*10^(-8), relerr = 1.*10^(-8),optimize,known=[s1[i],s1[i+1]],output=listprocedure)):

_psi_c2_1 :=evalf(dsolve({
diff(psi_c2_1(t), t) = 0, psi_c2_1(t1F) =  -beta1},numeric,output=listprocedure)):
iter_psi_c1_1 := op([2,2],_psi_c1_1):
iter_psi_c2_1 := op([2,2],_psi_c2_1):

r_nach_1[i+2] := t-> r_nach_1[i+1](t) +  alpha*(B1*(iter_psi_c1_1(t)) + (c1*iter_psi_c2_1(t))):

_p11 := evalf(dsolve({
diff(p1(t), t) = A11*(p1(t)-'s1'[i+1](t))+B1*(r_nach_1[i+2](t)-r_nach_1[i+1](t))+A12*(p1(t)-'s1'[i+1](t))^2+ss1,
p1(0) = pI1}, numeric,method = dverk78, abserr = 1.*10^(-8), relerr = 1.*10^(-8),optimize, output = listprocedure, known=[s1[i+1],iter_psi_c1_1,iter_psi_c2_1])):

p1F := rhs(_p11(t1F)[2]):

s1[i+2] := subs(_p11, p1(t)):

q11 := evalf(dsolve({diff(q1(t), t) = c1*r_nach_1[i+2](t), q1(0) = 0},numeric,range=0..t1F,known=[iter_psi_c1_1,iter_psi_c2_1])):

q1F := rhs(q11(t1F)[2]):

F[i+1]:= beta1*q1F;

od:
Error, (in r_nach_1[3]) too many levels of recursion

﻿