next up previous contents index
suivant: Product : product mul monter: Lists and vectors précédent: Sum of elements of   Table des matières   Index


Cumulated sum of the elements of a list : cumSum

cumSum takes as argument a list l (resp sequence) of numbers or of strings.
cumSum returns the list (resp sequence) with same length as l and with k-th element the sum (or concatenation) of the elements $ \tt l[0],..,l[k]$.
Input :
cumSum(sqrt(2),3,4,5,6)
Output :
sqrt(2),3+sqrt(2),3+sqrt(2)+4,3+sqrt(2)+4+5,
3+sqrt(2)+4+5+6
Input :
normal(cumSum(sqrt(2),3,4,5,6))
Output :
sqrt(2),sqrt(2)+3,sqrt(2)+7,sqrt(2)+12,sqrt(2)+18
Input :
cumSum(1.2,3,4.5,6)
Output :
1.2,4.2,8.7,14.7
Input :
cumSum([0,1,2,3,4])
Output :
[0,1,3,6,10]
Input :
cumSum("a","b","c","d")
Output :
"a","ab","abc","abcd"
Input :
cumSum("a","ab","abc","abcd")
Output :
"a","aab","aababc","aababcabcd"



giac documentation written by Renée De Graeve and Bernard Parisse