The problem I have is really basic but I just can't get my head around it.
Suppose I have a list of ordered pairs
A = {{a, b}, {c, d}, {e, f}, {g, h}, ...}.
I am looking for a function that will give me the average of partial sums of the second element of each pair, like so:
f[1] = b/1 = A[[1, 2]]/1
f[2] = (b+d)/2 = (A[[1, 2]] + A[[2, 2]])/2
f[3] = (b+d+f)/3 = (A[[1, 2]] + A[[2, 2]] + A[[3, 2]])/3
....
f[n] = ?
Thank you for your help.
Mean /@ FoldList[Flatten[{##}] &, A[[All, 2]]]
$\endgroup$ReplaceList[A[[All, 2]], {x__, y___} :> Mean@{x}]
$\endgroup$n
vs if you want to tabulatef
for alln
.. $\endgroup$