#
“Memory” Summation (`\memsum`

)

When evaluating an summation, often the summation symbol \(\sum\) appears with the same limits repeatedly. A "memory" command `\memsum`

allows for the limits to be typed once when the summation first appears and omitted thereafter. In particular, there are two versions of `\memsum`

: a starred version `\memsum*[<lower limit>][<upper limit>]`

records the lower limit `<lower limit>`

and the upper limit `<lower limit>`

into memory. From then on, the unstarred version `\memsum`

will insert a summation with the recorded limits. In addition to saving time typing, `\memsum`

simplifies the LaTeX code, so it is easier to edit and find mistakes.

WARNING: Be careful while using this command because each time the starred version is called, it changes the definition for all of the unstarred versions until the next starred version. Thus, if you add `\memsum*`

into the middle of text where you are already using `\memsum`

with a different definition, you can unintentionally change the rendered equations. For this reason, I restrict the usage of each remembered command to a single equation.

**Definition**

### Examples

Code | Output |
---|---|

\memsum*[n=1][\infty] \frac{1}{n} = \memsum \frac{1}{n} |
$$\begin{aligned} \sum_{n=1}^{\infty} \frac{1}{n} &= \sum_{n=1}^{\infty} \frac{1}{n} \end{aligned} $$ |