Hi Kjetil, On Wed, Dec 23, 2009 at 3:51 AM, Kjetil Halvorsen <[email protected]> wrote: > subject says it all!!
If m is a matrix, you could do "m.exp?" to get help on matrix exponential. You could do m.exp() or exp(m): ---------------------------------------------------------------------- | Sage Version 4.2.1, Release Date: 2009-11-14 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: m = matrix(SR,2, [0,x,x,0]); m [0 x] [x 0] sage: # m.exp? sage: m.exp() [1/2*(e^(2*x) + 1)*e^(-x) 1/2*(e^(2*x) - 1)*e^(-x)] [1/2*(e^(2*x) - 1)*e^(-x) 1/2*(e^(2*x) + 1)*e^(-x)] sage: exp(m) [1/2*(e^(2*x) + 1)*e^(-x) 1/2*(e^(2*x) - 1)*e^(-x)] [1/2*(e^(2*x) - 1)*e^(-x) 1/2*(e^(2*x) + 1)*e^(-x)] Here's an example with matrices with integer entries: sage: MS = MatrixSpace(ZZ, nrows=2, ncols=2) sage: m = MS.random_element(); m [ 1 -8] [-1 -2] sage: m.exp() [ 1/82*((3*sqrt(41) + 41)*e^sqrt(41) - 3*sqrt(41) + 41)*e^(-1/2*sqrt(41) - 1/2) -8/41*(sqrt(41)*e^sqrt(41) - sqrt(41))*e^(-1/2*sqrt(41) - 1/2)] [ -1/41*(sqrt(41)*e^sqrt(41) - sqrt(41))*e^(-1/2*sqrt(41) - 1/2) -1/82*((3*sqrt(41) - 41)*e^sqrt(41) - 3*sqrt(41) - 41)*e^(-1/2*sqrt(41) - 1/2)] sage: exp(m) [ 1/82*((3*sqrt(41) + 41)*e^sqrt(41) - 3*sqrt(41) + 41)*e^(-1/2*sqrt(41) - 1/2) -8/41*(sqrt(41)*e^sqrt(41) - sqrt(41))*e^(-1/2*sqrt(41) - 1/2)] [ -1/41*(sqrt(41)*e^sqrt(41) - sqrt(41))*e^(-1/2*sqrt(41) - 1/2) -1/82*((3*sqrt(41) - 41)*e^sqrt(41) - 3*sqrt(41) - 41)*e^(-1/2*sqrt(41) - 1/2)] -- Regards Minh Van Nguyen -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
