Rowlinginthedeep

5 Reputation

2 Badges

11 years, 237 days

MaplePrimes Activity


These are questions asked by Rowlinginthedeep

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. 
Can someone help me with this? I'm not very good at using procedures.
 G := proc (N)
 local s, n;
 s := 0.;
 n := 0;
 while n < N do 
n := n+1;
 s := s+1/n
 end do;
 [s, n] 
end proc;
             G := proc (N) local s, n; s := 0.; n := 0; while n < N do n := n+1; s := s+1/n end do; [s, n] end proc
Compute G(1.0),G(2.0), .....G(7.0) try to figure out what the procedure G is doing
> G(1.0);
1 2 Page 2 of 2