The hornerform command converts the polynomial A to Horner's form with respect to a variable X.
f = x^2*y + x*z + x + 1; hornerform(f,x); 1+x*(1+z+x*y)