CumulativeProduct - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Statistics

 CumulativeSum
 compute cumulative sums for a data sample
 CumulativeProduct
 compute cumulative products for a data sample

 Calling Sequence CumulativeSum(X) CumulativeProduct(X)

Parameters

 X -

Description

 • The CumulativeSum is a utility routine for computing cumulative sums of data.
 • The CumulativeProduct is a utility routine for computing cumulative products of data.
 • The first parameter X is a data sample - given as e.g. a Vector.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $N≔10$
 ${N}{≔}{10}$ (1)
 > $h≔\frac{1.}{N-1}$
 ${h}{≔}{0.1111111111}$ (2)
 > $\mathrm{σ}≔0.2;$$r≔0.1$
 ${\mathrm{\sigma }}{≔}{0.2}$
 ${r}{≔}{0.1}$ (3)
 > $U≔\mathrm{RandomVariable}\left(\mathrm{Normal}\left(0,\mathrm{σ}\sqrt{h}\right)\right)$
 ${U}{≔}{\mathrm{_R}}$ (4)
 > $R≔\mathrm{Sample}\left({ⅇ}^{rh-\frac{{\mathrm{σ}}^{2}h}{2}}{ⅇ}^{U},N\right)$
 ${R}{≔}\left[\begin{array}{cccccccccc}{0.939313440198753}& {0.990244516766144}& {1.05043038223201}& {0.981220475406314}& {0.964074854341808}& {1.02045245942057}& {1.03782546004108}& {0.971126773289737}& {0.994968315345709}& {0.994468626738408}\end{array}\right]$ (5)
 > $S≔\mathrm{CumulativeSum}\left(R\right)$
 ${S}{≔}\left[\begin{array}{cccccccccc}{0.939313440198753}& {1.92955795696490}& {2.97998833919691}& {3.96120881460322}& {4.92528366894503}& {5.94573612836560}& {6.98356158840668}& {7.95468836169642}& {8.94965667704213}& {9.94412530378054}\end{array}\right]$ (6)
 > $P≔\mathrm{CumulativeProduct}\left(R\right)$
 ${P}{≔}\left[\begin{array}{cccccccccc}{0.939313440198753}& {0.930149983681559}& {0.977057802891718}& {0.958709121852860}& {0.924267357006458}& {0.943170897619390}& {0.978846770719206}& {0.950584305993622}& {0.945801265528544}& {0.940569685697619}\end{array}\right]$ (7)
 > $\mathrm{LineChart}\left(\left[S,P\right],\mathrm{legend}=\left["Cumulative Sum","Cumulative Product"\right]\right)$