MathGroup Archive 2000

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

Search the Archive

Re: sum of recursive fn: solving for n


fiona wrote:
> 
> what am i doing wrong here?
> 
> f[x_] := (f[x-1])*2
> f[1] =2
> Solve[Sum[f[x], {x, 1,n}] ==62, n]
> 
> tia,
> fiona

For one thing, Sum cannot handle this symbolic summation.

In[32]:= Sum[f[x], {x,1,n}]

$RecursionLimit::reclim: Recursion depth of 256 exceeded.

$RecursionLimit::reclim: Recursion depth of 256 exceeded.

$RecursionLimit::reclim: Recursion depth of 256 exceeded.

General::stop: Further output of $RecursionLimit::reclim
     will be suppressed during this calculation.

Out[32]=
Sum[2894802230932904885589274625217197696331749616641014100986439600\
 
>      1978282409984 Hold[f[(-253 + x) - 1]], {x, 1, n}]

One way to attack the problem is to first solve the recurrence in closed
form.

In[33]:= <<DiscreteMath`RSolve`

In[35]:=  soln = RSolve[{g[x]==2*g[x-1], g[1]==2}, g[x], x]
                    x
Out[35]= {{g[x] -> 2 }}

Now obtain a symbolic form of the sum.

In[39]:= h[n] = Sum[g[x]/.soln[[1,1]], {x,1,n}]
                  n
Out[39]= 2 (-1 + 2 )

In[40]:= Solve[h[n]==62, n]

Solve::ifun: Inverse functions are being used by Solve, so some
solutions may
     not be found.
Out[40]= {{n -> 5}}


Daniel Lichtblau
Wolfram Research


  • Prev by Date: getting radial data into a cartesian grid
  • Next by Date: Re: Simple Problem (I suppose...)
  • Previous by thread: Re: sum of recursive fn: solving for n
  • Next by thread: Re: sum of recursive fn: solving for n