Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13826 > unrolled thread
| Started by | Garcia5529@yahoo.fr |
|---|---|
| First post | 2013-03-13 08:18 +0000 |
| Last post | 2013-03-16 07:13 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Noob requests help with recursive formula Garcia5529@yahoo.fr - 2013-03-13 08:18 +0000
Re: Noob requests help with recursive formula Ray Koopman <koopman@sfu.ca> - 2013-03-14 11:13 +0000
Re: Noob requests help with recursive formula garcia5529@yahoo.fr - 2013-03-16 07:13 +0000
| From | Garcia5529@yahoo.fr |
|---|---|
| Date | 2013-03-13 08:18 +0000 |
| Subject | Noob requests help with recursive formula |
| Message-ID | <khpco1$mdi$1@smc.vnet.net> |
I appreciate any tips on how to code this in Mathematica.
I have two lists, each with 99 elements; A and B. Real numbers.
I want to form a list, C, whose elements are functions (F[]) of A and B, and also previous elements of C itself.
C ={F[A1/B1], F[A2/(B2-A1/C1)], F[A3/(B3-A1/C1-A2/C2)],..F[A99/(B99-A1/C1...-A98/C98.)}
...where the integers after A,B, and C, are element indices.
Thanks for any suggestions.
HG
[toc] | [next] | [standalone]
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2013-03-14 11:13 +0000 |
| Message-ID | <khsbca$36q$1@smc.vnet.net> |
| In reply to | #13826 |
On Mar 13, 1:18 am, Garcia5...@yahoo.fr wrote:
> I have two lists, each with 99 elements; A and B. Real numbers.
> I want to form a list, C, whose elements are functions (F[])
> of A and B, and also previous elements of C itself.
>
> C = {F[A1/B1], F[A2/(B2-A1/C1)], F[A3/(B3-A1/C1-A2/C2)], ...,
> F[A99/(B99-A1/C1 ... -A98/C98.)}
...where the integers after A,B,C are element indices.
First define a helper function:
cr[{c_,r_},{a_,b_}] := {#, r+a/#}& @ f[a/(b-r)]
Then use FoldList. Here is an example with 3 elements:
Rest@FoldList[cr,{0,0},Transpose@
{{a1,a2,a3},{b1,b2,b3}}][[All,1]] //InputForm
{f[a1/b1],
f[a2/(b2 - a1/f[a1/b1])],
f[a3/(b3 - a1/f[a1/b1] - a2/f[a2/(b2 - a1/f[a1/b1])])]}
[toc] | [prev] | [next] | [standalone]
| From | garcia5529@yahoo.fr |
|---|---|
| Date | 2013-03-16 07:13 +0000 |
| Message-ID | <ki1637$5ug$1@smc.vnet.net> |
| In reply to | #13826 |
Thanks very much to you three. HG
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web