Question: loops and output lists?

Hi all,

I am pretty new to maple so forgive me if i am asking a basic question.

I have created a simple loop to evaluate the sum of  1/(k^2)+3, for k from 1 to n, where in this case n = N*20. here is my code and it works ok (for N=1), i have checked with the built in add/evalf functions.

sm := 0: N := 1:  n := N*20

for k from 1 to n do

sm := sm+(1/(k^2)+3):

end do:

evalf(sm);

so far so good. Now my question is say i wanted to vary the value of N for example N = 1,2..30, and evaluate sm at these values. Is there a way to do it with out just repeating the above and changing the value of N? I was thinking along the line of a list that displays { evalf(sm)N1= xx,  evalf(sm)N2=yy, evalf(sm)N3=zz...}. is this possible?

hope i have made myself clear, and thanks for any replies

(p.s just saw the maple tag above)

restart:sm := 0: N := 1: n := N*20: > for k from 1 to n do > sm := sm+(1/(k^2)+3): > end do: > evalf(sm);

regards

slip

 

 

Please Wait...