Hi everybody ! I'm trying to sort a matricial expression : J=u'*Q*v (the ' is for the transposition, and * the matrix product) where u=A*x+a and v=B*x+b (Q,A and B are (3,3) matrices ; u,v,x,a and b are (3,1) vectors ; so J is a scalar) I want to stay in the formal field ,i.e I give no numerical values to my matrices an vectors. What i would like to do is to write J like : J=x'*K*x + Lx + M where (that's the result I found by hands) : K=A'*Q*B L=b'*Q'*A+a'*Q*B M=a'*Q*b And of course I would prefer Maple doing it for me ! :) As I really don't know how to take the problem, I tried very easy things : How to tell Maple to write : A*x+B*x=(A+B)*x ? (where x is a vector and A and B matrices) It seems to me that the collect command only works for scalar polynoms. I would appreciate any tips, links or books reference. Thanks in advance, Rollando.