Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8714 > unrolled thread

Re: How to Multiply a Sequence of #s that depends on the previous #

Started byDana DeLouis <dana01@me.com>
First post2012-02-23 10:52 +0000
Last post2012-02-23 10:52 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: How to Multiply a Sequence of #s that depends on the previous # Dana DeLouis <dana01@me.com> - 2012-02-23 10:52 +0000

#8714 — Re: How to Multiply a Sequence of #s that depends on the previous #

FromDana DeLouis <dana01@me.com>
Date2012-02-23 10:52 +0000
SubjectRe: How to Multiply a Sequence of #s that depends on the previous #
Message-ID<ji55p7$7ae$1@smc.vnet.net>
On Feb 21, 6:18 am, Bill Rowe <readn...@sbcglobal.net> wrote:
> On 2/20/12 at 2:46 AM, clutchderivat...@gmail.com (Clutch) wrote:

> Out[3]= {50,55.,63.25,75.9,102.465}

> and to show each subsequent value in lst has the correct ratio

> In[4]:= 1/Divide @@@ Partition[lst, 2, 1]
> Out[4]= {1.1,1.15,1.2,1.35}

Hi.  Just to mention another way to check...

lst = {50,55.,63.25,75.9,102.465} ;

Ratios[lst]
{1.1, 1.15, 1.2, 1.35}

= = = = = = = = = = = =
HTH   :> )
Dana DeLouis
Mac & Math 8
= = = = = = = = = = = =


On Feb 21, 6:18 am, Bill Rowe <readn...@sbcglobal.net> wrote:
> On 2/20/12 at 2:46 AM, clutchderivat...@gmail.com (Clutch) 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?
> 
> If I understand correctly, you can do this by:
> 
> In[3]:= lst = FoldList[Times, 50, {1.1, 1.15, 1.2, 1.35}]
> 
> Out[3]= {50,55.,63.25,75.9,102.465}
> 
> and to show each subsequent value in lst has the correct ratio
> 
> In[4]:= 1/Divide @@@ Partition[lst, 2, 1]
> 
> Out[4]= {1.1,1.15,1.2,1.35}

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web