MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

why do recursive function calculations take so long in Mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43566] why do recursive function calculations take so long in Mathematica?
  • From: g.feigin at verizon.net (G Feigin)
  • Date: Sat, 20 Sep 2003 06:39:35 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I defined the following simple recursive function:

dr[0,0] := 0; dr[n_,n_]:= 0;
dr[n_,0]:=1;dr[n_,k_]:=dr[n,k-1]+dr[n-1,k];

To evaluate dr[16,15] takes about 5 minutes on a Pentium class
machine, an absurdly long time.  Why? And what can I do to speed
things up?  By the way,
if I perform the recursion in an Excel spreadsheet on the same
machine, the calculation time is practically instantaneous.

Please reply by email.


  • Prev by Date: Nonlinear regression
  • Next by Date: question of Simplify
  • Previous by thread: Re: Nonlinear regression
  • Next by thread: Re: why do recursive function calculations take so long in Mathematica?