MathGroup Archive 2000

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

Search the Archive

Re: sum of recursive fn: solving for n


f[1] = 2;
f[x_] := 2*f[x - 1];

For an undefined n, the recursion for f[n] does not stop since it doesn't 
know when it gets to f[1]. Consequently, attempting to evaluate your Sum 
causes a recursion limit error. A brute force method is

Select[Table[{n, Sum[f[x], {x, 1, n}]}, {n, 1, 10}], #[[2]] == 62 &][[1, 1]]

5

Alternatively,

Needs["DiscreteMath`RSolve`"];

Clear[f, n];

RSolve[{f[x] == 2*f[x - 1], f[1] == 2}, f[x], x]

{{f[x] -> 2^x}}

Solve[Sum[(f[x] /. %[[1]]), {x, 1, n}] == 62, n]

Solve::"ifun": "Inverse functions are being used by \!\(Solve\), so some \
solutions may not be found."

{{n -> 5}}

Bob Hanlon

In a message dated 2/14/2000 3:25:09 AM, reply at newsgroup.please writes:

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


  • Prev by Date: Re: sum of recursive fn: solving for n
  • Next by Date: Re: sum of recursive fn: solving for n
  • Previous by thread: Re: sum of recursive fn: solving for n
  • Next by thread: Re: sum of recursive fn: solving for n