Re: sum of recursive fn: solving for n
- To: mathgroup at smc.vnet.net
- Subject: [mg22117] Re: [mg22108] sum of recursive fn: solving for n
- From: BobHanlon at aol.com
- Date: Wed, 16 Feb 2000 02:34:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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]
>