Re: Recursion loop help needed tia sal
- To: mathgroup at smc.vnet.net
- Subject: [mg52392] Re: [mg52363] Recursion loop help needed tia sal
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 25 Nov 2004 05:50:40 -0500 (EST)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
Clear[c,f]; k=1/50; f[x_?VectorQ] := Rest[FoldList[(#1+#2)*k&,First[x],Rest[x]]]; entries={15,17,8,12}; b=f[entries] {16/25, 108/625, 3804/15625} ci=f[b] {254/15625, 2029/390625} n=Length[entries]; Clear[c]; c[m_Integer /; 0<m<n-1] := ci[[m]]; c[m_Integer/; m>n-2] := c[m] = (c[m-1]+c[m-2])*k ; Table[c[m],{m,6}] {254/15625, 2029/390625, 8379/19531250, 109829/976562500, 528779/48828125000, 6020229/2441406250000} Bob Hanlon > > From: sal <sal at spp.net> To: mathgroup at smc.vnet.net > Date: 2004/11/24 Wed AM 02:32:38 EST > To: mathgroup at smc.vnet.net > Subject: [mg52392] [mg52363] Recursion loop help needed tia sal > > Greets All, > > I'm having a little trouble in creating this example in mathematica, I'm > not sure how to make the array dynamic enough in mathematica to include > Cn.....Xn in example 1. Does anybody have any idea > > Example 1: > User Input for four numbers 15,17,8,12... (Note: user can input any amount > of numbers) > > (15+17) /25/2 ->b1 > (b1+8) /25/2 ->b2 > (b2+12) /25/2 ->b3 > (b1+b2) /25/2 ->c1 > (c1 +b3)/25/2 ->c2 > (c1 +c2) /25/2 ->c3 > > Tia > >