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


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

Re: How to combine 2 list

Started byDana DeLouis <dana01@me.com>
First post2011-11-01 05:02 +0000
Last post2011-11-01 05:02 +0000
Articles 1 — 1 participant

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


Contents

  Re: How to combine 2 list Dana DeLouis <dana01@me.com> - 2011-11-01 05:02 +0000

#6081 — Re: How to combine 2 list

FromDana DeLouis <dana01@me.com>
Date2011-11-01 05:02 +0000
SubjectRe: How to combine 2 list
Message-ID<j8nui3$ede$1@smc.vnet.net>
> cumlativeNetProfitLoss = Drop[FoldList[Plus, 0, listNetProfitLoss], 1]

Hi.  As a side note:

NetProfitLoss= {1.11, 0.96, 0.68, 0.74, 0.3, 6.41, 0.83, 8.81, 2.23, 1.22}

Your Code:

Drop[FoldList[Plus, 0, NetProfitLoss], 1]
{1.11, 2.07, 2.75, 3.49, 3.79, 10.2, 11.03, 19.84, 22.07, 23.29}

Suggestion:

Accumulate[NetProfitLoss]
{1.11, 2.07, 2.75, 3.49, 3.79, 10.2, 11.03, 19.84, 22.07, 23.29}

%% == %
True

= = = = = = = = = = = = =
HTH  :>)
Dana DeLouis
$Version
8.0 for Mac OS X x86 (64-bit) (February 23, 2011)



On Oct 29, 7:24 am, John <j...@datasharks.biz> wrote:
> I have tried to find the answer on this, I am sure it has been asked before. Can anyone help?
> 
> I have 2 list:
> 
> cumlativeNetProfitLoss = Drop[FoldList[Plus, 0, listNetProfitLoss], 1]
> 
> {1.11, 2.07, 2.75, 3.49, 3.79, 10.2, 11.03, 19.84, 22.07, 23.29}
> 
> and
> 
> dateList = Reverse[dateNetProfitLoss[[All, 1]]]
> {{2011, 8, 31}, {2011, 9, 2}, {2011, 9, 6}, {2011, 9, 20}, {2011, 9, 21}, {2011, 9, 22}, {2011, 9, 28}, {2011, 9, 30}, {2011, 10, 4}, {2011, 10, 10}}
> 
> How to I get:
> 
> {{{2011, 8, 31}, 1.11}, {{2011, 9, 2}, 2.07}, {{2011, 9, 6}, 2.75}, {{2011, 9, 20}, 3.49}, {{2011, 9, 21}, 3.79}, {{2011, 9, 22}, 10.2}, {{2011, 9, 28}, 11.03}, {{2011, 9, 30}, 19.84}, {{2011, 10, 4}, 22.07}, {{2011, 10, 10}, 23.29}}
> 
> Thanks in advance.


[toc] | [standalone]


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


csiph-web