ez:=proc(): print(`RP(K,d,x), RC(K,d,x,n), EvalC(C,x,x0), DiffEvalC(C,x,x0) `): end: RP:=proc(K,d,x) local ra,i: ra:=rand(-K..K): add(ra()*x^i,i=0..d): end: #RC(K,d,x,n) RC:=proc(K,d,x,n) local i: [seq(RP(K,d,x),i=1..n)]: end: EvalC:=proc(C,x,x0) local i,C0: C0:=[subs(x=x0,C[1])]: for i from 2 to nops(C) do C0:=[op(C0),expand(subs(x=C0[i-1],C[i]))]: od: C0: end: #DiffEvalC(C,x,x0): the derivatives of the chain C evaluated at x0. Try #DiffEvalC([1+x,x^2+1,x^3],x,2); DiffEvalC:=proc(C,x,x0) local Cd,C0,i,Cd0: Cd:=diff(C,x): C0:=EvalC(C,x,x0): Cd0:=[subs(x=x0,Cd[1])]: for i from 2 to nops(C) do Cd0:=[op(Cd0),subs(x=C0[i-1],Cd[i])*Cd0[i-1]]: od: Cd0: end: #DiffEvalCstu(C,x,x0): the derivatives of the chain C evaluated at x0. Try #DiffEvalCstu([1+x,x^2+1,x^3],x,2); DiffEvalCstu:=proc(C,x,x0) local y: subs(y=x0,diff(EvalC(C,x,y),y)): end: