Quantcast
Channel: MaplePrimes - Questions and Posts tagged with calculus
Viewing all articles
Browse latest Browse all 126

How to find the formal expressions of the transpose and/or inverse of a matrix expression?

$
0
0

Hi, 

A few times ago a trainee asked me this question
         "given a matrix formula, can Maple find the transpose of this formula?"

More precisely, let's say E, A, B and C are four (abstract) matrices (let's say symbols) with consistent dimensions such that E = A+B*C, can Maple "find" that ET = AT + CT * BT (where  ET represents the transpose of E)?

I come back to this problem regularly because the trainee was quite frustrated by my negative answer (note she had the same request form the inverse of a matrix formula).

The best I'm capable to do is given in the attached file (transposition only).
This seems to work correctly even if did not do intensive testing.

Do you have any ideas on how to implement the transposition and inversion computation rules in Maple?
For example, given 

E := A &* B^(-1))

Maple would return 

Transpose(E);      (B^(-1))^T &* A^T 
# or better   E^(T) = (B^T)^(-1) &* A^T
# and 
Inverse(E);   B &* A^(-1)


Thanks in advance for you involvement
 

restart:

Transpose := proc(e)
  local tr, t:

  tr := `#mo("т")`:

  define(
    t,
    t(`&*`(a::anything, b::anything)) = &*(b^tr, a^tr),
    t(a::anything+b::anything)=a^tr+b^tr,
    t(a^tr)=a,
    'linear', 'flat'
  ):
 
  t(expand(e));

  return eval(%, map(u -> (u^tr)^tr = u, indets(e, name)));
end proc

proc (e) local tr, t; tr := `#mo("т")`; define(t, t(`&*`(a::anything, b::anything)) = `&*`(b^tr, a^tr), t(a::anything+b::anything) = a^tr+b^tr, t(a^tr) = a, 'linear', 'flat'); t(expand(e)); return eval(%, map(proc (u) options operator, arrow; (u^tr)^tr = u end proc, indets(e, name))) end proc

(1)

Transpose(A+B)

B^`#mo("т")`+A^`#mo("т")`

(2)

Transpose(2*A + B &* C)

2*A^`#mo("т")`+`&*`(C^`#mo("т")`, B^`#mo("т")`)

(3)

Transpose((A + B) &* (A + B))

`&*`(A^`#mo("т")`, A^`#mo("т")`)+`&*`(B^`#mo("т")`, A^`#mo("т")`)+`&*`(A^`#mo("т")`, B^`#mo("т")`)+`&*`(B^`#mo("т")`, B^`#mo("т")`)

(4)

Transpose((A + B) &* Transpose(A + B) + Transpose(Transpose(A)) )

`&*`(B, A^`#mo("т")`)+`&*`(A, A^`#mo("т")`)+`&*`(B, B^`#mo("т")`)+`&*`(A, B^`#mo("т")`)+A^`#mo("т")`

(5)

 


 

Download transposition.mw


Viewing all articles
Browse latest Browse all 126

Trending Articles