# Any way to fully expand an expression of two operators?

I am looking for a way to expand a complicate expression like the follow

(A o B + C o (DxE))*(D o (ExF) - ExA + A)


Here o and x are the operator. I want to expand it so to have it simplified as $$\sum_{n,m} G(f_n, g_m)$$

where G stands for operation (either o or x) of any variable $f_n$ and $g_m$, for example, $G(A, B)$ could be $A \,o\, B$ or $A \, \times\, B$.

Also, o is commutable but x not, i.e. A o B = B o A, but A x B = - B x A. I am looking for a way to deal with any operator but up to now, for simplification, we could take o and x as dot product and cross product for real vector.

After expanding the expression in above form, I would like to regulate each term so the number (coefficient) placed ahead of the vector. For example,

(p+aq)x(p+bq) => pxp + px(bq) + (aq)xp + (aq)x(bq) => pxp + b*(pxq) + a*(qxp) + (a*b)*(qxq)


where p and q are vectors, and a, b are numbers.

-
You've seen Distribute[] already? –  Ｊ. Ｍ. Apr 25 '13 at 16:59
Thanks for your reply. I tried that, it helps to expand the expression partially. What I mean is ... for example, consider an expression of dot and cross products. (p+aq)x(p+bq), where p and q are vectors and a, b are number. Distribute expands the expression as pxp + px(bq) + (aq)xp + (aq)x(bq). But it wonder further simply that to eliminate pxp and aqxbq. Is that any way to do that or to regulate the resulting terms such that each terms will be of the form cv1xv2 or cv1.v2 or c*v1, that is, make the coefficient ahead of the vector. Thanks. –  user1285419 Apr 25 '13 at 19:51
You might find some ideas at mathematica.stackexchange.com/questions/23423/…. –  whuber Apr 25 '13 at 20:16
Thanks. That works for Cross[vec[x], a vec[y]], Cross[a vec[x], vec[y]] but not Cross[a vec[x], b vec[y]] –  user1285419 Apr 25 '13 at 20:25