
On Aug 22, 2011, at 9:53 PM, Claudio Zanettini wrote:

> Thanks guys,
> I did not know the fun cumsum
> I will work on that.

A very compact method would be:

cumsum( round(1.4^(0:20)*rep(5, 21)) )

(And I was wrong about it increasing more rapidly if it had been in  
hte mamer I imagined.)

-- 
David.
>
> HVZ
>
> 2011/8/22 David Winsemius <dwinsemius@comcast.net>
>
> On Aug 22, 2011, at 8:36 PM, Claudio Zanettini wrote:
>
> Hello everyone,
> I would like to generate a sequence
> such as, starting from 5, every value  is
> 40% of the value before+ all the preceeding values.
> es:
> this is the seq of all the value+40% of the preceding value:
> 5         7        10        14        19        27        38
> 53        74       103       145       202       283       397
> 556       778      1089      1525      2134      2988      4183
>
> then the vector tha I need is
> 5 , 5+7, 5+7+10, 5+7+10+14 and so on
>
> If you have the first vector, then the second vector is just:
>
> cumsum(vec)
>
> (I am not sure this actually implements the problem statement. I  
> would have imagined the third item to be 12+0.4*7 from the written  
> description and for it to increase more rapidly.)
>
>
>
> I can generate the first sequence but I don t know how to generate  
> the last.
>
> You should offer code when you have a partial solution.
>
> -- 
>
> David Winsemius, MD
> West Hartford, CT
>
>

David Winsemius, MD
West Hartford, CT


	[[alternative HTML version deleted]]

