# HW 4, Pablo Blanco # OK to post # old code Help := proc(): print(`binomCoeff(n)`): end: # outputs the binomial coefficients of N-th degree as a list binomCoeff := proc(N) local s,j, i,y: s:= 1: if N<0 then RETURN(FAIL): fi: if N=0 then #not sure how to return multiple lines yet RETURN(s): fi: for i from 1 to N do s := 0,s,0; y := seq(s[j]+s[j+1], j=1..i+1): s:= y: od: [y]: end: # a sequence (a1,..,an) is log-concave iff s[i]^2 >= s[i-1]*s[i+1] for all 1 < i < n # input a list and the output is whether or not it is log-concave # if the list is log-concave: output "true" # otherwise, output a list which shows which elements fail the condition logConcaveCheck := proc(s) local r,i,j: r:=seq(evalb(s[i]*s[i] >= s[i-1]*s[i+1]),i=2..nops(s)-1): if not member(false, {r}) then return(true): fi: return([true, r, true]): end: # given two non-negative integers, generates a matrix with prime dimensions such that there is a submatrix 7x11 which says "PB" PBMatrix := proc(m,n) local p,q, A: p:=ithprime(4+m); q:=ithprime(5+n); A:= matrix(p,q, [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0$(q-11), 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0$(q-11), 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0$(q-11), 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0$(q-11), 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0$(q-11), 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0$(q-11), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0$(q-11), 0$((p-7)*(qx)) ]); end: # turns a matrix into a one-dimensional vector with(linalg): vectorize := proc(A) local i,j: return([seq(seq(A[j,i], i=1..coldim(A)),j=1..rowdim(A))]); end: vectorize(PBMatrix(0,0)); # RC(2,n,d,10 000) best: book: # # RC(2,5,3,10 000); 4 4 # RC(2,6,3,10 000); 6 8 # RC(2,7,3,10 000); 10 16 # RC(2,8,3,10 000); 18 20 # RC(2,9,3,10 000); 29 40 # RC(2,10,3,10 000); 53 72-79 # RC(2,11,3,10 000); 87 144-158 # RC(2,12,3,10 000); 161 256 # RC(2,13,3,10 000); 268 512 # RC(2,14,3,10 000); 448 1024 # RC(2,15,3,10 000); 757 2048 # RC(2,16,3,10 000); 1224 2560-3276 # RC(2,5,5,10 000); 2 2 # RC(2,6,5,10 000); 2 2 # RC(2,7,5,10 000); 2 2 # RC(2,8,5,10 000); 4 4 # RC(2,9,5,10 000); 6 6 # RC(2,10,5,10 000); 7 12 # RC(2,11,5,10 000); 14 24 # RC(2,12,5,10 000); 18 32 # RC(2,13,5,10 000); 31 64 # RC(2,14,5,10 000); 45 128 # RC(2,15,5,10 000); 71 256 # RC(2,16,5,10 000); 104 256-340 # RC(2,5,7,10 000); -- # RC(2,6,7,10 000); -- # RC(2,7,7,10 000); 2 # RC(2,8,7,10 000); 2 # RC(2,9,7,10 000); 2 # RC(2,10,7,10 000); 2 # RC(2,11,7,10 000); 4 # RC(2,12,7,10 000); 4 4 # RC(2,13,7,10 000); 6 8 # RC(2,14,7,10 000); 9 16 # RC(2,15,7,10 000); 12 32 # RC(2,16,7,10 000); 18 36-37 # using sphere packing bound and perfect, we have that # M = (2^n)/(1 + n) # by applying d = 2*1 + 1 implies t=1 and use 2.18 in Hill