# Question:How to sum all the numbers in a list L of numbers

## Question:How to sum all the numbers in a list L of numbers

Maple

I did two attempts with different ideas

 >

 > restart;

Task (a) A list of numbers in Maple :

 > L:=[1,2,3,4,5];
 (1)
 >

In general summing up numbers

underscript? ..i like to write a with underscore n : how to that

 > #S:={seq(L[i],i=1..5)};
 > #L:= [seq(L[i],i=1..5)];

For summing up numbers in a list of L i can use a ...

Sumlist := proc (L,N):

 > Sumlist:=proc(L,N)
 > a:=1;
 > for i from 1 to N do
 > a:=seq(L[i],i=1..5);
 > end do;
 > end proc:
 >
 > L:=[1,2,3,4,5];
 (2)
 > N:=3;
 (3)
 > Sumlist(L,N);
 (4)
 >

And now to sum the number sequenze  from the procedure?

 > restart;
 > Sumlist:=proc(L,N)
 > a:=1;
 > for i from 1 to N do
 > a:=seq(L[i],i=1..5);       #sum(a, i=1..5); # for this probably a second do loop nested ?
 > end do;
 > end proc:
 >
 > L:=[1,2,3,4,5];
 (5)
 > N:=3;
 (6)
 > Sumlist(L,N);
 (7)
 >
 >
 >
 >

========================================================================

Also possible by? : a1 = 1, a2=a1+1, a3=a2+1, etc

 > restart;

 > Sumlist:=proc(L,N)
 > a:=1;
 > for i from 1 to N do
 > a:=L[i]+1;
 > end do;
 > end proc:
 >
 > L:=[1,2,3,4,5];
 (8)
 > N:=2;
 (9)
 > Sumlist(L,N);
 (10)
 > L[1];
 (11)
 >

Try some things out, but summing up list ?