Re: "Accumulate" with operator Times.
- To: mathgroup at smc.vnet.net
- Subject: [mg114906] Re: "Accumulate" with operator Times.
- From: Dana DeLouis <dana01 at me.com>
- Date: Wed, 22 Dec 2010 02:36:02 -0500 (EST)
On Dec 21, 12:17 am, Matthias Bode <lvs... at hotmail.com> wrote: > Hola: > I tried > > "Accumulate[{a, b, c}] /. Plus -> Times" > > before, it does work with {a,b,c}. > > BUT > > Accumulate[{2, 4, 5}] /. Plus -> Times yields > > {2, 6, 11}. Hi. Just two cents on your attempt above. The example with numbers were added together before the conversion had a chance to run. Hence "Plus" no longer existed. This is not the best way... just something different. v=HoldForm/@{2,4,5}; Accumulate[v] {2, 2+4, 2+4+5} Accumulate[v] /. Plus->Times // ReleaseHold {2, 8, 40} Another variation... Accumulate[v] /. Plus->Star {2, 2 * 4, 2 * 4 * 5} % /. Star->Times // ReleaseHold {2, 8, 40} = = = = = HTH :>) Dana DeLouis