On 01/24/13 08:57, Christophe BAL wrote:
Hello,
I would like, if it is possible, to calculate the formal power of one
matrix ?

My attempt is after but it doesn't work... :-(

Christophe

======================

var('n')

assume(n, 'integer')

E = matrix([
     [0   , 1   , 0   , 0   , 0  ],
     [1/4 , 0   , 3/4 , 0   , 0  ],
     [0   , 1/2 , 0   , 1/2 , 0  ],
     [0   , 0   , 3/4 , 0   , 1/4],
     [0   , 1   , 0   , 1   , 0  ]
])

You guys probably won't like this answer. But Mathematica has a built in command "MatrixPower:"


a = {{0, 1, 0, 0, 0}, {1/4, 0, 3/4, 0, 0}, {0, 1/2, 0, 1/2, 0}, {0, 0,
    3/4, 0, 1/4}, {0, 1, 0, 1, 0}}

MatrixPower[N[a], n]

Note I convert a into its floating point representation, because otherwise the solution is written in terms of the roots of the characteristic polynomial, and while mathematica is perfectly happy to write this down, it is a horribly length piece of output.

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to