Help:=proc(): print(`RMP(x,d,K) `): end: #RP(x,d,K): a random poly in x of degree k with coefficients from 1 to K do RP:=proc(x,d,K) local ra,i: ra:=rand(1..K): add(ra()*x^i,i=0..d): end: RMP:=proc(x,d,K) local x1,i: if nops(x)=1 then RP(x[1],d,K): else x1:=[op(2..nops(x),x)]: expand(add(x[1]^i*RMP(x1,d,K),i=0..d)): fi: end: #RC(x,d,K,n): a random chain of length n of poly in x of degree k with coefficients from 1 to K do RC:=proc(x,d,K,n) local i: [seq(RP(x,d,K),i=1..n)]: end: #[x0->x1->x2-> ... ->xn] #EvalC(L,x,x0): inputs a listL of expressions in the variable x and a number x0 #outputs L[n](L[n-1](.... L[1](x0))))))))) mod K: #x0->L[1](x0)->L[2](L[1](x0))-.... EvalC:=proc(L,x,x0) local a,i: a:=x0: for i from 1 to nops(L) do a:=subs(x=a,L[i]): od: a: end: #EvalCD(L,x,x0): inputs a listL of expressions in the variable x and a number x0 #outputs L[n](L[n-1](.... L[1](x0))))))))) followed by the derivative of the composition #at x0: #x0->L[1](x0)->L[2](L[1](x0))-.... #f(g(x))'= f'(g(x))*g'(x) . (F[i](Previous(x)))'(x0)= F[i]'(Previoius(x)|x=x0)* (Previous'(x)|x=x0) EvalCD:=proc(L,x,x0) local a,b,i: a:=x0: b:=1: for i from 1 to nops(L) do b:=b*subs(x=a,diff(L[i],x)) : a:=subs(x=a,L[i]): od: a,b: end: