Feeds:
Posts
Comments

SAGE tip: Simplifying a matrix

Hi there!

Today’s tip is very useful, and we should thank Simon King for it.

Suppose we are trying to prove that, the matrix, $M$,

`sage: M = matrix([[sin(x), cos(x)],[-cos(x),sin(x)]])`

belongs to the orthogonal group, i.e., $M M^t=1$.

```sage: E = M*M.transpose() sage: E [sin(x)^2+cos(x)^2 0] [0 sin(x)^2+cos(x)^2]```

For simplifying the matrix, unfortunately, one should simplify each element, it’s done with the following line,

```sage: E.apply_map(lambda x: x.simplify_full()) [1 0] [0 1]```

Thanks Simon.

Advertisements

2 Responses

1. […] When I ran the worksheet, the result of the Ricci tensor was right, but didn’t simplify to zero… So, I decide to bypass this applying the trick of matrix simplification. […]

2. […] way of simplifying the matrix elements of the exponentiation, not even with the procedure post in here. I didn’t try with the rewrite […]