# Please do not post homework # Ravali Bommanaboina, 9/13/2020, HW1 # Question 1:------------------------------------------------------------- #read "C:/Users/rb1002/Documents/hw1.txt"; #nops(F(6)); # 13 #NuF(6); # 13 #nops(F(10)); # 89 #NuF(10); # 89 #diff(x^2, x); # 2 x # # Question 2:------------------------------------------------------------- # F(6)={[1,1,1,1,1,1],[2,1,1,1,1],[1,2,1,1,1],[1,1,2,1,1],[1,1,1,2,1],[1,1,1,1,2],[2,2,1,1],[2,1,2,1],[2,1,1,2],[1,1,2,2],[1,2,1,2],[1,2,2,1],[2,2,2]} # Question 3:------------------------------------------------------------- #The function L->[op(L),a] appends a new element a to the list L. #if L1:=[Mercury, Venus, Earth] and we want L2:=[Mercury, Venus, Earth, Mars] #Then we can run this operation L2:=[op(L1),Mars]; #We initialize WALKS(m,n) to get all the paths from the coordinate (0,0) to the destination (m,n). # m and n are the number of steps in a particular direction. # If m represented steps north and n represented steps east then WALKS(5,4) would give us all the paths that eventually go 5 steps north and 4 steps east. # WALKS(0,0) gives us the empty set because there are 0 steps north and east so there are no paths to the destinations because your starting location is already the destination. # Question 4:------------------------------------------------------------- with(combinat): F:=proc(S) local a,S1,P1,s,numTwos,k,i: option remember: P1:={}; numTwos:=floor(S/2); if S=0 then RETURN({{}}): fi: a:=0; while a<=numTwos do S1:={}; i:=0; k:=0; while k < a do S1:=[op(S1),2]; i:=i+2; k:=k+1; end do; while i