#OK to post # Soham Palande, Assignment 9, 10/11/2020 #PART 1 #(i) RUID: 187006241 DiagSeq2(1/(1-x-(8*y)+(x*y)-(6*(x^3))+(2*(y^3))),x,y,50) 15191094275120822927061648250786876159006181233476515981823461429213801500829067921 #(ii) DiagWalks3D({[1,7,1],[8,0,0],[0,7,7]},30) [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # PART 2 # PART 5 #(i) #This sequence is in the OEIS #A006480 #(ii) #Not in OEIS #(iii) #Not in OEIS #PART 6 #DiagWalks4D(S,N): Inputs a set of "atomic steps" in the 2-dimenional square lattice, with positve steps, of the form [a,b,c,d] #Number of walks from [0,0,0,0] to [n,n,n,n] using the atomic steps. DiagWalks4D:=proc(S,N) local s,x,y,z,w: if not (type(S, set) and type(N,integer) and N>=0) then print(`Bad input`): RETURN(FAIL): fi: DiagSeq4(1/(1-add(x^s[1]*y^s[2]*z^s[3]*w^s[4], s in S)),x,y,z,w,N ) : end: #DiagSeq4(f,x,y,z,w,N): Given a rational function f of the variables x, y, z and w such that the denominator does not vanish at (0,0,0,0) #outputs the list whose i-th entry is the coefficient of x^(i-1)*y^(i-1)*z^(i-1)*w(i-1) in the 4-variable power-series expansion of f #Try: #DiagSeq4(1/(1-x-y-z-w),x,y,z); DiagSeq4:=proc(f,x,y,z,w,N) local i: if subs({x=0,y=0,z=0,w=0},denom(f))=0 then print(`The denominator of`, f, `should have a non-zero constant term `): RETURN(FAIL): fi: [seq(coeff(taylor(coeff(taylor(coeff(taylor(coeff(taylor(f,x=0,N+1),x,i),y=0,N+1),y,i),z=0,N+1),z,i),w=0,N+1),y,i),i=0..N)]: end: