(%i1) prod: (2*X+1)*(1-5*X)*(X+1);
(%o1) (1 - 5 X) (X + 1) (2 X + 1)
(%i2) args(prod);
(%o2) [1 - 5 X, X + 1, 2 X + 1]
args(...) tells you the "arguments" of a function, in this case the
multiplication function "*"; the expression is being considered as
"*"( (5*x-1), (x+1), (2*x+1) )
(%i3) expand(prod);
3 2
(%o3) - 10 X - 13 X - 2 X + 1
(%i4) f: factor(%);
(%o4) - (X + 1) (2 X + 1) (5 X - 1)
Note that -1 has been factored out.
(%i5) args(f);
(%o5) [(X + 1) (2 X + 1) (5 X - 1)]
Hmm. Args here is telling us that Maxima interprets this as
"-" ( "*"( (x+1), (2*x+1), (5*x-1) ) )
So let's look at the inner expression
(%i6) args(args(f)[1]);
(%o6) [X + 1, 2 X + 1, 5 X - 1]
Internally, Maxima actually represents this as a product with -1, not
a negation:
(%i7) args(f),inflag:true;
(%o7) [- 1, X + 1, 2 X + 1, 5 X - 1]
(inflag says use the internal representation)