Question: Error, (in testeq) too many levels of recursion, how to deal?

Can't find what the matter in recursive occurance of this problem. Anyone knows how to sort it out, thanks

k:=20:
m:=4:
p[0] := 1:
tr := 4:

omega[n]:=sqrt(k/m):

T[n]:=(2 pi/omega[n]):

> maxpoint := proc (x)
local tr, p1;

tr := evalf(x*T[n]):
p1 := piecewise(t1 <= tr, p[0]*t1/tr, p[0]):
maximize(int(p1*sin(omega[n]*(t-t1))/(m*omega[n]), t1 = 0 .. t), t = 0 .. dur) :

end proc;
>
y:=ceil(tr/T[n]):
plot(maxpoint(tr1), tr1 = 0 .. 2, sample = [0, 1, 2], numpoints = 20, adaptive = false);
Error, (in testeq) too many levels of recursion



 Keep giving this error, by right the tr-value in proc is always changing, shouldn't be any issue with recursiveness.

Please Wait...