#OK to post homework #Karnaa Mistry, 09/13/20, Assignment HW #1 diff(y*x^4,x); integrate(e^(x/2),x); limit((3*x^2+4*x)/(x^2+5),x=infinity); permute({x,y,z},3); distance((0,0,1),(2,2,2)); discont(3/(x^2+3*x-4),x); # 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,2,2,1], [1,2,1,2], [1,1,2,2], [2,2,2]} # 3. a) The maple line that converts L1:=[Mercury,Venus,Earth] to L2:=[Mercury,Venus,Earth,Mars] can be L2:=[op(L1),Mars]; # 3. b) When either m or n or both are negative, there are no possible walks that we can make by using North and East to get from [0,0]. # It doesn't make sense to have negative m and/or negative n, so we have a null set of answers. # 3. c) WALKS(0,0) is the singleton set {[]} because there is a single way to get to [0,0] from [0,0], and that is to not do anything, i.e. not use any N's or E's. # So, we have no N's or E's, and we have {[]} as the answer. # 4. #F(n): inputs a non-negative integer n and outputs the set of lists in {1,2} that add up to n F:=proc(n) local F1,F2,f1,f2: option remember: if n<0 then RETURN({}): fi: if n=0 then RETURN({[]}): fi: F1:=F(n-1): F2:=F(n-2): {seq([op(f1),1],f1 in F1), seq([op(f2),2],f2 in F2) }: end: #F(6) from Maple = {[2, 2, 2], [1, 1, 2, 2], [1, 2, 1, 2], [1, 2, 2, 1], [2, 1, 1, 2], [2, 1, 2, 1], # [2, 2, 1, 1], [1, 1, 1, 1, 2], [1, 1, 1, 2, 1], [1, 1, 2, 1, 1], [1, 2, 1, 1, 1], [2, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1]} # SAME as F(6) by hand # 5. #NuF(n): inputs a non-negative integer n and outputs the numbers of lists in {1,2} that add up to n NuF:=proc(n) local F1,F2,f1,f2: option remember: if n<0 then RETURN(0): fi: if n=0 then RETURN(1): fi: F1:=NuF(n-1): F2:=NuF(n-2): F1+F2: end: #I have also confirmed nops(F(n)) is equal to NuF(n) for n=1..10 # NuF(1000) = 70330367711422815821835254877183549770181269836358732742604905087154537118196933579742249494562611733487750449241765991088186363265450223647106012053374121273867339111198139373125598767690091902245245323403501 # If I did nops(F(1000)), Maple would have to compute F(1000), then count each of the elements, which means finding this HUGE number, # which is far too many for the computer to handle (it will be evaluating... for a LONG time).