Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8674
| From | David Reiss <dbreiss@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to Multiply a Sequence of #s that depends on the previous # |
| Date | 2012-02-21 11:15 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jhvud1$852$1@smc.vnet.net> (permalink) |
| References | <jhstr1$nj5$1@smc.vnet.net> |
One approach is to use FoldList:
In[1]:= FoldList[Times, 50, {1.10, 1.15, 1.20, 1.35}]
Out[1]= {50, 55., 63.25, 75.9, 102.465}
In[2]:= FoldList[Times, 50, {a, b, c, d}]
Out[2]= {50, 50 a, 50 a b, 50 a b c, 50 a b c d}
--David
On Feb 20, 2:47 am, Clutch <clutchderivat...@gmail.com> wrote:
> I have a list of #s : 1.10, 1.15, 1.20, 1.35.
>
> I start off with 50 and the first # is 50 * 1.10.
> The second # is the first # * 1.15.
> The third # is the second # * 1.20.
> The fourth # is the third # * 1.35.
>
> I want to maintain a list of these #s.
> How can this be done efficiently in Mathematica without running for loops?
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
How to Multiply a Sequence of #s that depends on the previous # Clutch <clutchderivative@gmail.com> - 2012-02-20 07:47 +0000 Re: How to Multiply a Sequence of #s that depends on the previous # David Reiss <dbreiss@gmail.com> - 2012-02-21 11:15 +0000
csiph-web