0
votes

I am working MuPad in order to have a symbolic tool to find solution for an equation. But I am working with matrices.

Consider this:

blck := A -> matrix([
[A[1..linalg::matdim(A)[1]/2,1..linalg::matdim(a)[2]/2],
A[1..linalg::matdim(A)[1]/2,linalg::matdim(A)[2]/2+1..linalg::matdim(A)[2]]],
[A[linalg::matdim(A)[1]/2+1..linalg::matdim(A)[1],1..linalg::matdim(A)[2]/2],
A[linalg::matdim(A)[1]/2+1..linalg::matdim(A)[1],linalg::matdim(A)[2]/2+1..linalg::matdim(A)[2]]]
])

This function enables me to have a block representation of a matrix and it works. Now consider this function

myfun := A -> matrix([[blck(A)[1,1]*blck(A)[2,2]*blck(A)[2,1],blck(A)[1,1]],
[blck(A)[1,1],blck(A)[1,1]]])

This will manipulate a little a matrix and returns matrix whose components are combined somehow. The problem is that, considering that I cannot tell MuPad that matrix A and its components are matrices and not reals, it happens that MuPad will show me matrix products in different order

For example. Consider

myfun(matrix([[A11,A12],[A21,A22]]))

The first component of the returned matrix, element (1,1), is A11*A21*A22 which is incorrect being A11,A12,A21,A22 matrices!

How can i tell MuPad that A11,A12,A21 and A22 are matrices so that MuPad will expand products correctly?

1

1 Answers

1
votes

You can have matrices in matrices in MuPAD, as long as you explicitly put them in there. Just telling the system to treat A1*A2 as non-commutative is more difficult and not well supported. You could go full-blown, create your own datatype and implement arithmetic accordingly, but that's not necessarily easy if you still want simplifications to happen.