#`OK to post homework #`Jiecheng Guo, 2020.09.14, Assignment 1` #first question diff(x^3,x); 3*x^2 sqrt(x+3); (x+3)^(1/2) p := (x+2)*(x+3); p := (x+2)*(x+3) expand(p); x^2+5*x+6 #Question2 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]} [[1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 2], [1, 1, 2, 2], [2, 2, 2]] = {[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]} #question3 #1).L->[op(L),a]is a command that copy the original sequence L and add the new element a #2).Since it is impossible to use positive steps to get negative coordinate #3).Because it is the original and there is only one way to get there, which is staying there, so it should be null #question4 F:= proc(n) local W1,W2,w1,w2: #input the number option remember: if n < 0 then #if the imput is negative RETURN ({}): fi: #if the imput is 0 if n = 0 then RETURN ({[]}): fi: if n = 1 then #if the imput is only one step RETURN ({[1]}): fi: #normal W1 := F(n-1): W2 := F(n-2): {seq([op(w1),1],w1 in W1), seq([op(w2),2],w2 in W2)}: end: F(6) {[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]} #question5 NuF:= proc(n) option remember: if n < 0 then RETURN (0): fi: if n <= 1 then RETURN (1): fi: NuF(n-1) + NuF(n-2): end: NuF(1000);