我有一个情节
Plot[40500*x^(-0.1), {x, 1, 100}, PlotRange -> {0, 50000}]
我正在尝试绘制这些y值的累积值。我将尝试用一个例子来解释:
我想要
for x=1: 40500*1^(-0.1)
for x=2: 40500*(2^(-0.1)+1^(-0.1))
for x=3: 40500*(3^(-0.1)+2^(-0.1)+1^(-0.1))
and so on up to x=100.
有办法吗?
答案 0 :(得分:0)
为as((split(first2$Product,f = first2$Transaction_Id)),"transactions")
x = 3
for x=3: 40500*(3^(-0.1)+2^(-0.1)+1^(-0.1))
可以使用114574.
:
Sum
或使用Sum[40500*i^(-0.1), {i, 3}]
Fold
Fold[#1 + 40500*#2^(-0.1) &, 0, {1, 2, 3}]
114574.
输出中间步骤。
FoldList
FoldList[#1 + 40500*#2^(-0.1) &, 0, {1, 2, 3}]
累计到100并丢弃初始零值:
{0, 40500., 78287.8, 114574.}