See attachment.
Mathematica also has a MatrixExp command, and on 2 by 2 matrices the
answers are really nice. For example, if the matrix has complex
eigenvalues, the answers are written in terns of Sin and Cos rather than
exponentials of complex numbers.
On 01/24/13 11:20, Christophe BAL wrote:
I'm curious to see this output. Can you send it ?
2013/1/24 Stephen Montgomery-Smith <[email protected]
<mailto:[email protected]>>
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 [email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
sage-support+unsubscribe@__googlegroups.com
<mailto:sage-support%[email protected]>.
Visit this group at
http://groups.google.com/__group/sage-support?hl=en
<http://groups.google.com/group/sage-support?hl=en>.
--
You received this message because you are subscribed to the Google
Groups "sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
Mathematica 7.0 for Linux x86 (32-bit)
Copyright 1988-2008 Wolfram Research, Inc.
In[1]:=
1 3 1 1 3 1
Out[1]= {{0, 1, 0, 0, 0}, {-, 0, -, 0, 0}, {0, -, 0, -, 0}, {0, 0, -, 0, -},
4 4 2 2 4 4
> {0, 1, 0, 1, 0}}
In[2]:= In[2]:=
n n
Out[2]= {{0.0563508 (-1.05315) + 0.443649 (-0.375336) +
-17 -87 n n
> 5.44392 10 (-3.38078 10 ) + 0.443649 0.375336 +
n n n
> 0.0563508 1.05315 , -0.237383 (-1.05315) - 0.66607 (-0.375336) +
-17 -87 n n n
> 7.82873 10 (-3.38078 10 ) + 0.66607 0.375336 + 0.237383 1.05315
n n -87 n
> , 0.3 (-1.05315) + 0.3 (-0.375336) - 1.2 (-3.38078 10 ) +
n n
> 0.3 0.375336 + 0.3 1.05315 ,
n n
> -0.183876 (-1.05315) + 0.515936 (-0.375336) +
-17 -87 n n n
> 3.9725 10 (-3.38078 10 ) - 0.515936 0.375336 + 0.183876 1.05315
n n
> , 0.0436492 (-1.05315) - 0.343649 (-0.375336) +
-87 n n n
> 0.6 (-3.38078 10 ) - 0.343649 0.375336 + 0.0436492 1.05315 },
n n
> {-0.0593458 (-1.05315) - 0.166517 (-0.375336) +
-33 -87 n n
> 1.78072 10 (-3.38078 10 ) + 0.166517 0.375336 +
n n n
> 0.0593458 1.05315 , 0.25 (-1.05315) + 0.25 (-0.375336) +
-33 -87 n n n
> 2.5608 10 (-3.38078 10 ) + 0.25 0.375336 + 0.25 1.05315 ,
n n
> -0.315945 (-1.05315) - 0.112601 (-0.375336) -
-17 -87 n n
> 3.92523 10 (-3.38078 10 ) + 0.112601 0.375336 +
n n n
> 0.315945 1.05315 , 0.193649 (-1.05315) - 0.193649 (-0.375336) +
-33 -87 n n
> 1.29941 10 (-3.38078 10 ) - 0.193649 0.375336 +
n n n
> 0.193649 1.05315 , -0.0459691 (-1.05315) + 0.128984 (-0.375336) +
-17 -87 n n
> 1.96262 10 (-3.38078 10 ) - 0.128984 0.375336 +
n n n
> 0.0459691 1.05315 }, {0.0645497 (-1.05315) - 0.0645497 (-0.375336) -
-17 -87 n n
> 1.81464 10 (-3.38078 10 ) - 0.0645497 0.375336 +
n n n
> 0.0645497 1.05315 , -0.271922 (-1.05315) + 0.0969113 (-0.375336) -
-17 -87 n n
> 2.60958 10 (-3.38078 10 ) - 0.0969113 0.375336 +
n n n
> 0.271922 1.05315 , 0.343649 (-1.05315) - 0.0436492 (-0.375336) +
-87 n n n
> 0.4 (-3.38078 10 ) - 0.0436492 0.375336 + 0.343649 1.05315 ,
n n
> -0.21063 (-1.05315) - 0.0750672 (-0.375336) -
-17 -87 n n
> 1.32417 10 (-3.38078 10 ) + 0.0750672 0.375336 +
n n n
> 0.21063 1.05315 , 0.05 (-1.05315) + 0.05 (-0.375336) -
-87 n n n
> 0.2 (-3.38078 10 ) + 0.05 0.375336 + 0.05 1.05315 },
n n
> {-0.0766151 (-1.05315) + 0.214973 (-0.375336) +
-33 -87 n n
> 2.67108 10 (-3.38078 10 ) - 0.214973 0.375336 +
n n n
> 0.0766151 1.05315 , 0.322749 (-1.05315) - 0.322749 (-0.375336) +
-33 -87 n n n
> 3.8412 10 (-3.38078 10 ) - 0.322749 0.375336 + 0.322749 1.05315
n n
> , -0.407883 (-1.05315) + 0.145367 (-0.375336) -
-17 -87 n n
> 5.88785 10 (-3.38078 10 ) - 0.145367 0.375336 +
n n n
> 0.407883 1.05315 , 0.25 (-1.05315) + 0.25 (-0.375336) +
-33 -87 n n n
> 1.94912 10 (-3.38078 10 ) + 0.25 0.375336 + 0.25 1.05315 ,
n n
> -0.0593458 (-1.05315) - 0.166517 (-0.375336) +
-17 -87 n n
> 2.94392 10 (-3.38078 10 ) + 0.166517 0.375336 +
n n n
> 0.0593458 1.05315 }, {0.129099 (-1.05315) - 0.129099 (-0.375336) +
-17 -87 n n
> 5.44392 10 (-3.38078 10 ) - 0.129099 0.375336 +
n n n
> 0.129099 1.05315 , -0.543844 (-1.05315) + 0.193823 (-0.375336) +
-17 -87 n n
> 7.82873 10 (-3.38078 10 ) - 0.193823 0.375336 +
n n n
> 0.543844 1.05315 , 0.687298 (-1.05315) - 0.0872983 (-0.375336) -
-87 n n n
> 1.2 (-3.38078 10 ) - 0.0872983 0.375336 + 0.687298 1.05315 ,
n n
> -0.42126 (-1.05315) - 0.150134 (-0.375336) +
-17 -87 n n n
> 3.9725 10 (-3.38078 10 ) + 0.150134 0.375336 + 0.42126 1.05315 \
n n -87 n
> , 0.1 (-1.05315) + 0.1 (-0.375336) + 0.6 (-3.38078 10 ) +
n n
> 0.1 0.375336 + 0.1 1.05315 }}
In[3]:=