#Homework by Mike Murr #OK to post #hw15 #read(`C15.txt`); ud(3); ud(4); #PiJG(N): Computes Pi using the (series) formula on the home page of Jesus Guillera, and # using the number of terms N in the series. # # For 10000 decimal places, need 3334 terms, since we obtain 3 decimal places per term. # # Prints one term of the series, every 500 terms, to display the convergence. # #with(combinat); Digits:=10000; PiJG:=proc(N) local n, term, accum, smallTerm, result; accum:=13; for n from 1 to N do term := ((-1)^n) * ((binomial(2*n,n))^5) * (820*n^2 + 180*n + 13)/2^(20*n); accum:=accum + term; if n mod 500 = 0 then smallTerm:= evalf(term); print(smallTerm); fi; od; #print(accum); result:=evalf(sqrt(128/accum)); print(result); end proc; #PiJG(10); #PiJG(20); #PiJG(200); #PiJG(3500);