 |
|
List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Too many levels of recursion
| [MUG] Too many levels of recursion |
|
Author:
Posted: Thu, 14 Nov 2002 12:33:52 EET
|
>> From: "guyer"
Has anybody an idea about the error message "(In Signature) Too many
levels of recursion" ? Is it my procedure's fault or not?
Is this problem concerned with the hardware of the computer which I
can solve by adding more memory?
Thanks in Advance
Tolga GUYER
|
| [MUG] Re: Too many levels of recursion |
|
Author: Maple User Group
Posted: Tue, 19 Nov 2002 16:52:50 -0500
|
>> From: Maple User Group "maple_gr"
| >> From: "guyer"
| Has anybody an idea about the error message "(In Signature) Too many
| levels of recursion" ? Is it my procedure's fault or not?
| Is this problem concerned with the hardware of the computer which I
| can solve by adding more memory?
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 15 Nov 2002 12:49:14 -0500
To: "maple-list"
From: "Gerald A. Edgar" "edgar"
Subject: Too many levels of recursion
In my experience, it is a sign of INFINITE recursion, where something (perhaps indirectly) depends on itself. So whenever I have received this message,
it has been my fault. Try turning on "trace" for the function where this
happens, and see if you can tell what is going on.
--
G. A. Edgar http://www.math.ohio-state.edu/~edgar/
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 15 Nov 2002 13:55:24 -0500 (EST)
From: Carl Devore "devore"
To: MAPLE User Group "maple-list"
Subject: Too many levels of recursion
Most likely you have a statement of the form x:= x+1 somewhere where x has
not been initialized.
> Is this problem concerned with the hardware of the computer which I
> can solve by adding more memory?
No.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 15 Nov 2002 13:44:42 -0800 (PST)
From: Robert Israel "israel"
To: MAPLE User Group "maple-list"
Subject: Too many levels of recursion
|> Has anybody an idea about the error message "(In Signature) Too many
|> levels of recursion" ? Is it my procedure's fault or not?
Yes, probably. It might help if we could see the actual
procedure, but usually this message indicates that somehow you
are setting up an infinite recursion. The other possibility is
that this is a procedure that legitimately uses a very large number
of levels of recursion.
Each time a procedure calls another, some information must be stored in an
area of memory called the stack. This is removed when the called
procedure returns. The stack has only a finite capacity, and when it is
full this error message occurs. The size of the stack may vary depending
on the platform and the version of Maple as well as the amount of
available memory in the computer.
For example, the following recursive procedure, if called with a positive
integer n, will at some point have n "levels of recursion" active at
the same time, as f(n) calls f(n-1) which calls f(n-2) and so on down to
f(1).
> f:= proc(n) if n = 1 then 2 else f(n-1)^2 + 1 mod (n+2) fi end;
When I tried it just now (in Maple 8 under Windows NT 4.0), f(3309)
worked but f(3310) gave me "too many levels of recursion".
It is often possible to rewrite a recursive procedure as an iterative
one, and there are various other tricks that can reduce the amount of
recursion needed.
> Is this problem concerned with the hardware of the computer which I
> can solve by adding more memory?
Probably not.
Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Sat, 16 Nov 2002 10:18:46 +0100
From: Maerivoet Roland "roland.maerivoet"
To: "maple-list"
Subject: Too many levels of recursion
Hello,
I guess it has to do with your procedure.
Since you did not include it, it's rather difficult to give exact
comments.
You get this kind of error-message when using variables recusively.
--
Met vriendelijke groeten - Best Regards
Roland Maerivoet
Hogeschool Gent
Departement Bedrijfskunde Aalst
Keizersplein, 19
B9300 Aalst
Belgium
tel: +32053212321
fax: +32053710934
http://docent.hogent.be/~roma754
http://users.pandora.be/roland.maerivoet
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Dr Francis J. Wright" "F.J.Wright"
To: "guyer"
Subject: Too many levels of recursion
Date: Mon, 18 Nov 2002 11:21:42 -0000
> Has anybody an idea about the error message "(In Signature) Too many
> levels of recursion" ? Is it my procedure's fault or not?
Probably.
> Is this problem concerned with the hardware of the computer which I
> can solve by adding more memory?
Probably not.
This error usually arises from a recursive procedure that has an error in
the base case (i.e. the test that should stop the recursion). I suggest
that you try running your procedure in the debugger, or just increase
printlevel and let the procedure run for a bit. From the output, you may be
able to spot the problem. But beware that you will probably get a LOT of
output!
IIRC, there was a time when the Windows version of Maple had a rather small
stack allocated and some highly recursive library procedures could run out
of stack and so cause the above error, but I don't think that has been an
issue for some time now. It probably related to early releases of Maple V
for Windows 3.1.
If you did not intend to write a recursive procedure then maybe you have
done so unintentionally. A recursive procedure is one that calls itself,
which is fine (and a very powerful programming technique) provided you
remember to include an appropriate base case (or cases) to stop the
recursion.
Francis
|
Previous by date: [MUG] Re: Lebesgue-Integral, Maple User Group
Next by date: [MUG] Re: Limit Superior & Limit Inferior, Maple User Group
Previous thread: [MUG] Maple crashing with odeplot, John Robert Kitchin
Next thread: [MUG] Limit Superior & Limit Inferior, Classen, Manfred
|
|
|