0
$\begingroup$

This question already has an answer here:

I want to have calculate a cummulative series from the existing one.

In a simplified example, let's say there's a series:

ts = TimeSeries[{{{2016, 1, 14}, 0}, {{2016, 2, 1}, 10}, {{2016, 4, 6}, 0},
{{2016, 5, 10}, 10}, {{2016, 8, 18}, 10}}]

which has 5 observations.

However, the following:

Accumulate[ts]

has only 4 observations and the Accumulate[ts]["Values"] are not what could be expected, i.e. {0, 10, 10, 20, 30}, but {0, 10, 98029/3978, 8353/221}.

What is the logic behind this? Why do we loose one observation? What are these numbers in the results mean?

$\endgroup$

marked as duplicate by corey979, Community Jan 9 '17 at 11:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Accumulate[ts["Values"]] $\endgroup$ – corey979 Jan 9 '17 at 11:09
  • $\begingroup$ @corey979, yep, I know. But I want to have a TimeSeries object as an output. I can hack around this by writing a function, i.e. TimeSeriesAccumulate, that will do that, but wanted to understand whether there's any logic behind what happens by default. $\endgroup$ – iav Jan 9 '17 at 11:17
  • $\begingroup$ @corey979, thanks! To be fair Mathematica in the recent years has drifted towards becoming if anything an ultimate pokemon analysis tool. This might be one cause. $\endgroup$ – iav Jan 9 '17 at 11:37