Function Repository Resource:

# ReverseAccumulate

Replace each element of a list with the sum of the elements in the original list that are not to the left of that element

Contributed by: Seth J. Chandler
 ResourceFunction["ReverseAccumulate"][list] computes the successive accumulated totals of list, proceding from right to left.

## Details and Options

ResourceFunction["ReverseAccumulate"] is efficiently computed by reversing the original list, running Accumulate on it and then reversing the result.
ResourceFunction["ReverseAccumulate"] is useful in computing actuarial commutation functions.

## Examples

### Basic Examples (2)

Get the sum of elements not to the left of each element in a list:

 In[1]:=
 Out[1]=

Apply ReverseAccumulate to a symbolic array:

 In[2]:=
 Out[2]=

### Scope (3)

Actuarial computations sometimes depend on nested ReverseAccumulate operations:

 In[3]:=
 Out[3]=

The Head of an expression does not need to be List for ReverseAccumulate to work:

 In[4]:=
 Out[4]=

Where the argument is a nested list, X, ReverseAccumulate creates a nested list Y of similar dimension in which Y[[i,j]]=ReverseAccumulate[X[[All,j]]][[i]]:

 In[5]:=
 Out[5]=
 In[6]:=
 Out[6]=

### Applications (1)

Compute the values of the actuarial commutation function S for a survival list and an annual discount value of 0.8:

 In[7]:=
 Out[7]=

### Properties and Relations (2)

The ReverseAccumulate of a list is equivalent to the Reverse of the Accumulate of the Reverse of the list:

 In[8]:=
 Out[8]=

One can generalize the idea of ReverseAccumulate to include operations that do not involve addition:

 In[9]:=
 In[10]:=
 Out[10]=

Indeed, ReverseAccumulate is a special case of the following RightFoldList:

 In[11]:=
 Out[11]=

Seth J. Chandler

## Version History

• 1.0.0 – 10 September 2019