Question: write proc for alternating series and return nth partial sum

 Write a function to compute the n-th partial sum of the alternating series

"1-1/(4)+1/(9)-1/(16)+...+(-1)^(n-1) * 1/(n^(2))"
Specifically, the procedure takes n as input, and returns the sum of the first n terms.
So I am kind of lost- I've tried 5 different procs but keep getting more confused. Here is current one:
prob := proc (N) 
local a, u, n, q; 
a := 0.0; 
u := 0; 
q := 0.0; 
for n from 1 to n do 
a := n->(-1^(n-1))*u(n); 
u := n-> 1/n^2; 
end do; 
q := n->seq([evalf(prob(n)), n], n = 1 .. n) 
end proc; 
return q(n);
end proc;
I probably should be using 'sum' instead.. any insight is much appreciated, thank you!
Please Wait...