Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

As you saw, this gives a NotImplementedError in Sage, so you can't do it directly.

This is possible in Maxima, though it just gives you a symbolic answer.

sage: maxima_console()
<snip>
(%i7) A: matrix([1,2],[3,4]);
                                   [ 1  2 ]
(%o7)                              [      ]
                                   [ 3  4 ]
(%i11) A.A;
                                  [ 7   10 ]
(%o11)                            [        ]
                                  [ 15  22 ]
(%i13) A^^2;
                                  [ 7   10 ]
(%o13)                            [        ]
                                  [ 15  22 ]
(%i14) A^^n;
                                          <n>
                                  [ 1  2 ]
(%o14)                            [      ]
                                  [ 3  4 ]

Unfortunately, I can't find this exponential command for matrices with letters, so we could use it by tab-completion in Sage and then use

sage: A = matrix([[1]])
sage: M = A._maxima_()
sage: M.command_name('n')

or something.