ListTools - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Tables, lists, and sets : ListTools Package : ListTools/PartialSums

ListTools

 PartialSums
 return the partial sums of a list

 Calling Sequence PartialSums(L)

Parameters

 L - list

Description

 • The PartialSums(L) function returns a list of partial sums of the elements in list L.
 • This procedure has option inline; therefore, it can be used within a procedure without the overhead of a procedure call.

Examples

 > $\mathrm{with}\left(\mathrm{ListTools}\right):$
 > $\mathrm{PartialSums}\left(\left[a,b,c\right]\right)$
 $\left[{a}{,}{a}{+}{b}{,}{a}{+}{b}{+}{c}\right]$ (1)
 > $L≔\left[1,2,3,4,5,6,7,8,9,10\right]$
 ${L}{≔}\left[{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}{,}{7}{,}{8}{,}{9}{,}{10}\right]$ (2)
 > $\mathrm{PartialSums}\left(L\right)$
 $\left[{1}{,}{3}{,}{6}{,}{10}{,}{15}{,}{21}{,}{28}{,}{36}{,}{45}{,}{55}\right]$ (3)
 > $\mathrm{Digits}≔2$
 ${\mathrm{Digits}}{≔}{2}$ (4)
 > $\mathrm{PartialSums}\left(\left[\mathrm{seq}\left(\mathrm{sin}\left(1.0i\right),i=0..13\right)\right]\right)$
 $\left[{0.}{,}{0.84}{,}{1.8}{,}{1.9}{,}{1.1}{,}{0.14}{,}{-}{0.14}{,}{0.52}{,}{1.5}{,}{1.9}{,}{1.4}{,}{0.4}{,}{-}{0.14}{,}{0.28}\right]$ (5)