Accumulate[list]
gives a list of the successive accumulated totals of elements in list.
Accumulate
Accumulate[list]
gives a list of the successive accumulated totals of elements in list.
Details and Options
- Accumulate[list] has the same length as list.
- Accumulate[list] is effectively equivalent to FoldList[Plus,list].
- Accumulate[list,Method"CompensatedSummation"] uses compensated summation to reduce numerical error in the result.
Examples
open all close allBasic Examples (2)
Scope (3)
Accumulate a regularly sampled TimeSeries:
v = {3, 8, 4, 11, 9, 2};
ts = TimeSeries[v, Automatic]The created time stamps are regularly spaced:
RegularlySampledQ[ts]res = Accumulate[ts]res["Path"]Compare to the accumulated values:
Accumulate[v]Accumulate an irregularly sampled time series:
v = {3, 8, 4, 11, 9, 2};
t = {1, 3, 5, 6, 7, 10};
ts = TimeSeries[v, {t}];RegularlySampledQ[ts]res1 = Accumulate[ts["Values"]]Or define a new time series and set TemporalRegularity to True:
ts2 = TimeSeries[ts, TemporalRegularity -> True];ts["Path"] == ts2["Path"]Now the result of Accumulate is given as a TimeSeries:
res2 = Accumulate[ts2]res2["Values"] == res1Accumulate data involving quantities:
data = Quantity[RandomReal[1, 6], "Meters"]Accumulate[data]Generalizations & Extensions (1)
The head does not need to be List:
Accumulate[f[a, b, c, d]]Applications (4)
Accumulate[Range[10]]ListLinePlot[Accumulate[RandomReal[{-1, 1}, 100]]]Idealized random mountainside:
ListPlot3D[Accumulate[RandomReal[{-.1, 1}, {30, 30}]]]Cumulative sums of terms in a series:
List@@Normal[Series[Sin[x], {x, 0, 10}]]Plot[Evaluate[Accumulate[%]], {x, 0, 2Pi}]Properties & Relations (3)
Differences is almost the inverse of Accumulate:
Accumulate[Range[10]]Differences[%]Accumulate is equivalent to a particular case of FoldList:
FoldList[Plus, {a, b, c, d}]Accumulate[{a, b, c, d}]Use Sum to symbolically accumulate sequences:
s = Sum[i ^ 2, {i, 1, n}]Table[s, {n, 1, 10}]Accumulate[Table[i ^ 2, {i, 1, 10}]]Possible Issues (1)
Accumulating directly an irregularly sampled time series may differ from accumulating the values:
v = {3, 8, 4, 11, 9, 2};
t = {1, 3, 5, 6, 7, 10};
ts = TimeSeries[v, {t}]ts["Path"]RegularlySampledQ[ts]res = Accumulate[ts]res["Path"]This is not the same as the accumulated values:
av = Accumulate[v]The time series was first upsampled according to MinimumTimeIncrement and then downsampled:
ts1 = TimeSeriesResample[ts];
aux = Accumulate[ts1];
res1 = TimeSeriesResample[aux, {t}]res1["Path"] == res["Path"]Assume temporal regularity to simply accumulate the values:
ts2 = TimeSeries[ts, TemporalRegularity -> True]ts["Path"] == ts2["Path"]res2 = Accumulate[ts2]res2["Path"]res2["Values"] == avSee Also
FoldList Differences Total Sum Plus MovingAverage LinearRecurrence
Function Repository: ReverseAccumulate CumulativeAverages AccumulateApply
Text
Wolfram Research (2007), Accumulate, Wolfram Language function, https://reference.wolfram.com/language/ref/Accumulate.html (updated 2008).
CMS
Wolfram Language. 2007. "Accumulate." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/Accumulate.html.
APA
Wolfram Language. (2007). Accumulate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Accumulate.html
BibTeX
@misc{reference.wolfram_2026_accumulate, author="Wolfram Research", title="{Accumulate}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/Accumulate.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_accumulate, organization={Wolfram Research}, title={Accumulate}, year={2008}, url={https://reference.wolfram.com/language/ref/Accumulate.html}, note=[Accessed: 13-June-2026]}