Accumulate[list]
给出 list 中元素的逐次累积总值列表.
Accumulate
Accumulate[list]
给出 list 中元素的逐次累积总值列表.
更多信息和选项
- Accumulate[list] 与 list 的长度相同.
- Accumulate[list] 实际等价于 FoldList[Plus,list].
- Accumulate[list,Method"CompensatedSummation"] 用补偿总和减少结果中的数字错误.
范例
打开所有单元 关闭所有单元基本范例 (2)
范围 (3)
累积一个规则采样的 TimeSeries:
v = {3, 8, 4, 11, 9, 2};
ts = TimeSeries[v, Automatic]RegularlySampledQ[ts]res = Accumulate[ts]res["Path"]Accumulate[v]v = {3, 8, 4, 11, 9, 2};
t = {1, 3, 5, 6, 7, 10};
ts = TimeSeries[v, {t}];RegularlySampledQ[ts]res1 = Accumulate[ts["Values"]]或者定义一个新的时间序列,并设置 TemporalRegularity 为 True:
ts2 = TimeSeries[ts, TemporalRegularity -> True];ts["Path"] == ts2["Path"]现在,Accumulate 的结果作为 TimeSeries 给出:
res2 = Accumulate[ts2]res2["Values"] == res1data = Quantity[RandomReal[1, 6], "Meters"]Accumulate[data]推广和延伸 (1)
头部不一定是 List:
Accumulate[f[a, b, c, d]]应用 (4)
Accumulate[Range[10]]ListLinePlot[Accumulate[RandomReal[{-1, 1}, 100]]]ListPlot3D[Accumulate[RandomReal[{-.1, 1}, {30, 30}]]]List@@Normal[Series[Sin[x], {x, 0, 10}]]Plot[Evaluate[Accumulate[%]], {x, 0, 2Pi}]属性和关系 (3)
Differences 几乎与 Accumulate 逆反:
Accumulate[Range[10]]Differences[%]Accumulate 等价于特定的 FoldList:
FoldList[Plus, {a, b, c, d}]Accumulate[{a, b, c, d}]Sum 用于符号累积序列:
s = Sum[i ^ 2, {i, 1, n}]Table[s, {n, 1, 10}]Accumulate[Table[i ^ 2, {i, 1, 10}]]可能存在的问题 (1)
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"]av = Accumulate[v]时间序列首先根据 MinimumTimeIncrement 上采样,然后下采样:
ts1 = TimeSeriesResample[ts];
aux = Accumulate[ts1];
res1 = TimeSeriesResample[aux, {t}]res1["Path"] == res["Path"]ts2 = TimeSeries[ts, TemporalRegularity -> True]ts["Path"] == ts2["Path"]res2 = Accumulate[ts2]res2["Path"]res2["Values"] == av文本
Wolfram Research (2007),Accumulate,Wolfram 语言函数,https://reference.wolfram.com/language/ref/Accumulate.html (更新于 2008 年).
CMS
Wolfram 语言. 2007. "Accumulate." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2008. https://reference.wolfram.com/language/ref/Accumulate.html.
APA
Wolfram 语言. (2007). Accumulate. Wolfram 语言与系统参考资料中心. 追溯自 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: 15-September-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: 15-September-2026]}