'How to force maxima to display common factors of matrix elements as product of matrix

The result of the following matrix expression

F : invert(ident(2) - 1/J*matrix(['diff(u,x), 'diff(u,y)],['diff(v,x), 'diff(v,y)]));

produces the following output, noting the common denominator of all matrix elements.

enter image description here

I'd like to display the result in a simpler form where the common denominator appears (highlighted) as a product of the matrix. I've tried to achieve this manually, as shown below, but the result is the same:

matrix([num(F[1,1]), num(F[1,2])/J], [num(F[2,1])/J, num(F[2,2])])/denom(F[1,1]);

Is there a workaround, as F is used in other expressions and the complicated form makes those expressions even more complicated.



Solution 1:[1]

You can use a symbol ('s) to replace the common part:

a: denom(F[1,1]);
newF: F*a*'(1/a)

newF

and replace it again with newF, a=a when needed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eelvex