Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

A symbolic matrix with two parameters, say $x,y$, shows up in my calculation. The entries of the matrix are homogeneous polynomials. I want the entries to be written in some standard format, e.g. in ascending power of say $x$ and descending powers of $y$, or vice versa. But Mathematica insists on factoring some of them. How do you force Mathematica to expand expressions such as $ab^2(a^2-b^2)$ or $a(a^2-b^2)^2$ that occur inside a matrix?

share|improve this question
Closely related: How to keep Collect result in order?. –  Artes Jan 13 at 21:59
Just to elaborate on Artes' answer, you can do something like this: Collect[2*a^3*(a + 2 b)^2, a] –  Vincent Tjeng Jan 14 at 16:59
@Artes thanks. It looks like my problem was that I was using Collect[MatrixForm ... instead of MatrixForm[Collect ... Somehow the first one does not work but the second one does! –  Maesumi Jan 14 at 18:00
add comment

put on hold as off-topic by Kuba, Oleksandr R., Sjoerd C. de Vries, bobthechemist, Yves Klett 4 hours ago

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Oleksandr R., Sjoerd C. de Vries, Yves Klett
  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Kuba, bobthechemist
If this question can be reworded to fit the rules in the help center, please edit the question.