Re: sum of recursive fn: solving for n
- To: mathgroup at smc.vnet.net
- Subject: [mg22111] Re: [mg22108] sum of recursive fn: solving for n
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Wed, 16 Feb 2000 02:34:27 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
on 00.2.14 4:03 PM, fiona at reply at newsgroup.please 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
>
You have to solve the recurrence equation first. You can either do it by
hand, (since the answer is obvious), or use Mathematica:
In[6]:=
<< DiscreteMath`RSolve`
In[7]:=
RSolve[{a[n] == 2*a[n - 1], a[1] == 2}, a[n], n]
Out[7]=
n
{{a[n] -> 2 }}
Once you know this you can use Solve:
In[8]:=
Solve[Sum[2^i, {i, 1, n}] == 62, n]
Solve::"ifun": "Inverse functions are being used by \!\(Solve\), so some \
solutions may not be found."
Out[8]=
{{n -> 5}}
--
Andrzej Kozlowski
Toyama International University
Toyama, Japan
http://sigma.tuins.ac.jp/