Re: $RecursionLimit Bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg63942] Re: [mg63932] $RecursionLimit Bug?
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Tue, 24 Jan 2006 01:30:27 -0500 (EST)
- References: <200601230911.EAA04880@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
W. Craig Carter wrote: > Hello, > I am using Mathematica 5.2 on MacOS 10.4.4 > > I was trying to construct a cannonical timing example by writing > a memoryless factorial function. > > If I do this (fresh kernel): > > $RecursionLimit = $IterationLimit = 10^6 > fact[0] = 1; > fact[n_] := n fact[n - 1] > Timing[fact[10^6]] > ?fact > This generates no output, and the ?fact input line becomes In[1], as > if the kernel died after Timing[fact[10^5]], but no messages are > generated. > > If I bury the recursion limit inside a Block, then I get > fact[0] = 1; > fact[n_] := n fact[n - 1] > Timing[Block[{$RecursionLimit = Infinity}, Return[fact[10^5]]]] > -----> $RecursionLimit::reclim : Recursion depth of 256 exceeded > ?fact (* now is In[1] *) > -----? Symbol fact not found. > > > Is this a bug? I couldn't find a list of known bugs on the > mathematica site.... > > > Thanks, WCC > > > > W. Craig Carter > Lord Foundation Professor of Materials Science and Engineering > MIT, Dept. of Materials Science and Engineering 13-5018 77 Massachusetts Ave, Cambridge, MA 02139-4307 USA > 617-253-6048 ccarter at mit.edu http://pruffle.mit.edu/~ccarter http://pruffle.mit.edu/~ccarter/FAQS/ http://pruffle.mit.edu/~ccarter/I_do_not_use_microsoft.html Setting $RecursionLimit particularly high means the software in the Mathematica kernel will not limit your recursion depth. No claim is made as to when/where your operating system recursion stack will decide you've run out of room. For your particular example I find that somewhere between 3*10^4 and 4*10^4 I get a segmentation fault running the Mathematica kernel under Linux. Daniel Lichtblau Wolfram Research
- Follow-Ups:
- Re: Re: $RecursionLimit Bug?
- From: "W. Craig Carter" <ccarter@mit.edu>
- Re: Re: $RecursionLimit Bug?
- References:
- $RecursionLimit Bug?
- From: "W. Craig Carter" <ccarter@mit.edu>
- $RecursionLimit Bug?