#!/usr/local/bin/maple # -*- maplev -*- # Nathaniel Shar # HW 15 # Experimental Mathematics # It is okay to link to this assignment on the course webpage. # From C314159.txt: JG:=proc(N) local n: add((-1)^n*(6*n)!/n!^6/2880^(3*n)*(5418*n^2+693*n+29),n=0..N), 128*sqrt(5)/Pi^2: end: ############# # Problem 1 # ############# rf := proc(r, n): return mul(r+i, i=0..n-1): end: JG1 := proc(N) local n,j: add((-1)^n/(2^(10*n))*rf(1/2, n)^5/rf(1,n)^5*(820*n^2 + 180*n +13), n=0..N), 128/Pi^2: end: JG2 := proc(N) local n,j: add(add(binomial(n,j)^4*(-1)^n/(18^(2*n))*(4*sqrt(5)/27 + 68*sqrt(5)/81*n), j=0..n), n=0..N), 1/Pi: end: JG3 := proc(N) local n: add(rf(1/2,n)^3/rf(1,n)^3*(97-56*sqrt(3))^n*(sqrt(78*sqrt(3)-135) + 6*sqrt(14*sqrt(3) - 24)*n), n=0..N), 1/Pi: end: JG4 := proc(N) local n: add((-1)^n*rf(1/2, n)*rf(1/4,n)*rf(3/4,n)*rf(1/3, n)*rf(2/3, n)/((n!)^5*48^n)*(252*n^2+63*n+5), n=0..N), 48/Pi^2: end: JG5 := proc(N) local n: add((-1)^n/4^n*rf(1/2,n)^5/(n!)^5*(20*n^2+8*n+1), n=0..N), 8/Pi^2: end: JG6 := proc(N) local n: add(1/16^n*rf(1/2,n)^3*rf(1/4,n)*rf(3/4,n)/rf(1,n)^5*(120*n^2+34*n+3),n=0..N), 32/Pi^2: end: ############# # Problem 2 # ############# JGfast := proc(N) local n, T, i, f: T := 29: f := 1: for i from 1 to N do: f := f * (-1)*(6*i-5)*(3*i-2)*(2*i-1)*(3*i-1)*(6*i-1)/(331776000*i^5): T := T + f*(5418*i^2+693*i+29): od: return T, 128*sqrt(5)/Pi^2: end: # Not that much faster, but when N = 3000 it is much faster (about 7 # times faster -- 40-second difference). ############# # Problem 3 # ############# BBP := proc(N) local i: return add(1/16^i*(4/(8*i+1) - 2/(8*i+4) - 1/(8*i+5) - 1/(8*i+6)), i=0..N), Pi: end: ############# # Problem 5 # ############# # I wasn't able to do this problem. I attempted to check the identity # using Maple and couldn't get it to come out right. ############# # Problem 6 # ############# AndreFF := proc(n) local k: option remember: if n <= 1 then: return 1: else: return add(binomial(n-1,2*k-1)*AndreFF(2*k-1)*AndreFF(n-2*k),k=1..floor(n/2)): fi: end: # 10: Within 7*10^(-5) # 100: Within 8*10^(-47) # 1000: Within 3*10^(-476)