General power of a matrix?
Is there a way to compute a general power of a matrix? For example:
((2,-1),(1,0))^k = ((k+1,-k),(k,1-k))
WolframAlpha: https://is.gd/8cseex
Is Sage able to compute that?
Is there a way to compute a general power of a matrix? For example:
((2,-1),(1,0))^k = ((k+1,-k),(k,1-k))
WolframAlpha: https://is.gd/8cseex
Is Sage able to compute that?
My answer elaborates on using the Jordan normal form to implement a broad class of matrix functions, the matrix power included. It relies on the jordan_form()
method, available for exact rings.
The mathematical preliminaries can be found in extending scalar function for matrix functions and in the excellent book Functions of Matrices by N. Higham.
(using πππππΌπππππππππππ½.πΊ,ππππππππ³πππ:πΈπΆπ·πΌβ―π·πΆβ―π·πΎ)
Let
sage: A = matrix(QQ, [[2, -1], [1, 0]])
sage: var('k')
sage: A^k
we get
sage: NotImplementedError: non-integral exponents not supported
The code below implements $f(A)$ using the Jordan normal form of $A$, see [N. Higham, Functions of Matrices, Sec. 1.2] for details.
def matrix_function_Jordan(A, f):
# returns jordan matrix J and invertible matrix P such that A = P*J*~P
[J, P] = A.jordan_form(transformation=True)
fJ = zero_matrix(SR, J.ncols())
num_Jordan_blocks = 1+len(J.subdivisions()[0])
fJ.subdivide(J.subdivisions())
for k in range(num_Jordan_blocks):
# get Jordan block Jk
Jk = J.subdivision(k, k)
# dimension of Jordan block Jk
mk = Jk.ncols();
fJk = zero_matrix(SR, mk, mk)
# compute the first row of f(Jk)
vk = [f.derivative(x, i)(Jk[i][i])/factorial(i) for i in range(mk)]
# insert vk into each row (above the main diagonal)
for i in range(mk):
row_Jk_i = vector(SR, zero_vector(SR, i).list() + vk[0:mk-i])
fJk.set_row(i, row_Jk_i)
fJ.set_block(k, k, fJk)
fA = P*fJ*~P
return fA
First, we define our matrix function:
sage: var('k'); pow_sym(x) = x^k
Let's consider the OP's example, a $2\times 2$ matrix with one Jordan block of size $2$:
sage: A = matrix(QQ, [[2, -1], [1, 0]])
This matrix is not diagonalizable.
sage: A.is_diagonalizable()
sage: False
Calling our function,
sage: matrix_function_Jordan(A, pow_sym)
gives $\newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} k + 1 & -k \\ k & -k + 1 \end{array}\right)$.
A limitation of this approach is that we need the Jordan form. Notice that it is only implemented for exact rings (the Jordan form is unstable for inexact rings). Moreover, the spectrum should belong to the same ring. Consider for instance:
sage: A = matrix(QQ, [[0,4,1],[-1,1,5],[2,0,-89]]);
sage: [J, P] = A.jordan_form(transformation=True)
gives:
RuntimeError: Some eigenvalue does not exist in Rational Field.
This is not a piece of cake for WolframAlpha either: we get Standard computation time exceeded...
In many cases the following works:
A=matrix(SR,[[1,2],[2,1]])
D,P=A.eigenmatrix_right()
n=var('n')
An=P*matrix(SR,[[D[0,0]^n,0],[0,D[1,1]^n]])*P.inverse()
An
Here one obtains An as follows:
[1/2*3^n + 1/2*(-1)^n 1/2*3^n - 1/2*(-1)^n]
[1/2*3^n - 1/2*(-1)^n 1/2*3^n + 1/2*(-1)^n].
It does not work if the given matrix is not similar to a diagonal matrix.
EDIT : this feature should be soon part of Sage, see trac ticket 22523 !
Let me complement @mforets answer.
First, we can bypass the pitfall by working in the field of algebraic numbers, QQbar
, which is both exact and algebraically closed:
sage: A = matrix(QQ, [[2,1],[1,1]])
sage: matrix_function_Jordan(A, pow_sym)
RuntimeError: Some eigenvalue does not exist in Rational Field.
But:
sage: A = A.change_ring(QQbar)
sage: matrix_function_Jordan(A, pow_sym)
[0.7236067977499790?*2.618033988749895?^k + 0.2763932022500211?*0.3819660112501051?^k 0.4472135954999580?*2.618033988749895?^k - 0.4472135954999580?*0.3819660112501051?^k]
[0.4472135954999580?*2.618033988749895?^k - 0.4472135954999580?*0.3819660112501051?^k 0.2763932022500211?*2.618033988749895?^k + 0.7236067977499790?*0.3819660112501051?^k]
Second, you may not be happy with such a representation of the result, whose entries belong to the symbolic ring bundled with algerbraic numbers (written in a non-symbolic form).
However, some algebraic numbers have a symbolic representation by radicals. So we can use that representation of algebraic entries of the jordan form before mixing them with symbolic expressions. Let me propose the following change in @mforets code (my comments begin with ##
):
def matrix_function_Jordan(A, f):
# returns jordan matrix J and invertible matrix P such that A = P*J*~P
## We change the matrix into a matrix on the field of algebraic numbers
[J, P] = A.change_ring(QQbar).jordan_form(transformation=True);
fJ = zero_matrix(SR, J.ncols())
num_Jordan_blocks = 1+len(J.subdivisions()[0])
fJ.subdivide(J.subdivisions());
for k in range(num_Jordan_blocks):
# get Jordan block Jk
Jk = J.subdivision(k, k)
# dimension of Jordan block Jk
mk = Jk.ncols();
fJk = zero_matrix(SR, mk, mk);
# compute the first row of f(Jk)
## Before applying a symbolic function to the coefficients of J, we change them into symbolic expressions
vk = [f.derivative(x, i)(Jk[i][i].radical_expression())/factorial(i) for i in range(mk)]
# insert vk into each row (above the main diagonal)
for i in range(mk):
row_Jk_i = vector(SR, zero_vector(SR, i).list() + vk[0:mk-i])
fJk.set_row(i, row_Jk_i)
fJ.set_block(k, k, fJk)
## We change the entries of P and P^-1 into symbolic expressions
Psym = P.apply_map(AlgebraicNumber.radical_expression)
Psyminv = (~P).apply_map(AlgebraicNumber.radical_expression)
fA = Psym*fJ*Psyminv
return fA
Now, we have:
sage: A = matrix(QQ, [[2,1],[1,1]])
sage: matrix_function_Jordan(A, pow_sym)
[ 1/10*(1/2*sqrt(5) + 3/2)^k*(sqrt(5) + 5) - 1/10*(-1/2*sqrt(5) + 3/2)^k*(sqrt(5) - 5) 1/5*sqrt(5)*(1/2*sqrt(5) + 3/2)^k - 1/5*sqrt(5)*(-1/2*sqrt(5) + 3/2)^k]
[1/20*(1/2*sqrt(5) + 3/2)^k*(sqrt(5) + 5)*(sqrt(5) - 1) + 1/20*(-1/2*sqrt(5) + 3/2)^k*(sqrt(5) + 1)*(sqrt(5) - 5) 1/10*sqrt(5)*(-1/2*sqrt(5) + 3/2)^k*(sqrt(5) + 1) + 1/10*sqrt(5)*(1/2*sqrt(5) + 3/2)^k*(sqrt(5) - 1)]
Typeset:
$\left(\begin{array}{rr} \frac{1}{10} {\left(\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} {\left(\sqrt{5} + 5\right)} - \frac{1}{10} {\left(-\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} {\left(\sqrt{5} - 5\right)} & \frac{1}{5} \sqrt{5} {\left(\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} - \frac{1}{5} \sqrt{5} {\left(-\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} \\ \frac{1}{20} {\left(\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} {\left(\sqrt{5} + 5\right)} {\left(\sqrt{5} - 1\right)} + \frac{1}{20} {\left(-\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} {\left(\sqrt{5} + 1\right)} {\left(\sqrt{5} - 5\right)} & \frac{1}{10} \sqrt{5} {\left(-\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} {\left(\sqrt{5} + 1\right)} + \frac{1}{10} \sqrt{5} {\left(\frac{1}{2} \sqrt{5} + \frac{3}{2}\right)}^{k} {\left(\sqrt{5} - 1\right)} \end{array}\right)$
The function also works with matrix(QQ, [[0,4,1],[-1,1,5],[2,0,-89]])
but the result is so huge that your browser will not like it:
$\left(\begin{array}{rrr} -\frac{1}{106517166} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-1154521 i \sqrt{3} + 1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} - 35505722\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} - \frac{1}{106517166} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{1154521 i \sqrt{3} + 1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} - 35505722\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} + \frac{1}{53258583} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} + \frac{1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} + 17752861\right)} & -\frac{1}{319551498} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{2 {\left(32133662 i \sqrt{3} - 32133662\right)}}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} - \frac{1}{319551498} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{2 {\left(-32133662 i \sqrt{3} - 32133662\right)}}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} + \frac{1}{159775749} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} - \frac{64267324}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} & -\frac{1}{319551498} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-188329 i \sqrt{3} + 188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} - \frac{1}{319551498} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{188329 i \sqrt{3} + 188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} + \frac{1}{159775749} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} - \frac{188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} \\ \frac{1}{9394814041200} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-1154521 i \sqrt{3} + 1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} - 35505722\right)} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{188329 i \sqrt{3} + 188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} - 194460\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} - \frac{1}{4697407020600} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{1154521 i \sqrt{3} + 1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} - 35505722\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} + \frac{188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} + 97230\right)} - \frac{1}{4697407020600} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-188329 i \sqrt{3} + 188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} - 194460\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} + \frac{1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} + 17752861\right)} & \frac{1}{28184442123600} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{2 {\left(32133662 i \sqrt{3} - 32133662\right)}}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{188329 i \sqrt{3} + 188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} - 194460\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} + \frac{1}{28184442123600} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-188329 i \sqrt{3} + 188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} - 194460\right)} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{2 {\left(-32133662 i \sqrt{3} - 32133662\right)}}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} + \frac{1}{7046110530900} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} + \frac{188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} + 97230\right)} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} - \frac{64267324}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} & \frac{1}{28184442123600} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-188329 i \sqrt{3} + 188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{188329 i \sqrt{3} + 188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} - 194460\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} + \frac{1}{28184442123600} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-188329 i \sqrt{3} + 188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} - 194460\right)} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{188329 i \sqrt{3} + 188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} + \frac{1}{7046110530900} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(44100 {\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}} + \frac{188329}{{\left(\frac{1}{1225} \sqrt{2536123} \sqrt{7} + \frac{87716917}{9261000}\right)}^{\frac{1}{3}}} + 97230\right)} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} - \frac{188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} \\ \frac{1}{2348703510300} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{16066831 i \sqrt{3} + 16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} + 841260\right)} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{1154521 i \sqrt{3} + 1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} - 35505722\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} - \frac{1}{1174351755150} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-1154521 i \sqrt{3} + 1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} - 35505722\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} + \frac{16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} - 420630\right)} - \frac{1}{1174351755150} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-16066831 i \sqrt{3} + 16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} + 841260\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(53258583 {\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}} + \frac{1154521}{{\left(\frac{14048645297}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{3668486}{479327247}\right)}^{\frac{1}{3}}} + 17752861\right)} & \frac{1}{7046110530900} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-16066831 i \sqrt{3} + 16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} + 841260\right)} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{2 {\left(-32133662 i \sqrt{3} - 32133662\right)}}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} - \frac{1}{3523055265450} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{2 {\left(32133662 i \sqrt{3} - 32133662\right)}}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} + \frac{16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} - 420630\right)} - \frac{1}{3523055265450} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{16066831 i \sqrt{3} + 16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} + 841260\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(159775749 {\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}} - \frac{64267324}{{\left(\frac{515211235568}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{7608369}\right)}^{\frac{1}{3}}}\right)} & \frac{1}{7046110530900} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} + \frac{-16066831 i \sqrt{3} + 16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} + 841260\right)} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{188329 i \sqrt{3} + 188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} {\left({\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} + \frac{8005}{9 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} - \frac{1}{3523055265450} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-188329 i \sqrt{3} + 188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(i \sqrt{3} + 1\right)} - \frac{-8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} + \frac{16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} - 420630\right)} - \frac{1}{3523055265450} {\left(11025 {\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} + \frac{16066831 i \sqrt{3} + 16066831}{{\left(\frac{1}{3675} \sqrt{2536123} \sqrt{7} - \frac{64401404446}{1157625}\right)}^{\frac{1}{3}}} + 841260\right)} {\left(-\frac{1}{2} {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}} {\left(-i \sqrt{3} + 1\right)} - \frac{8005 i \sqrt{3} + 8005}{18 {\left(\frac{2}{3} \sqrt{17752861} - \frac{720217}{27}\right)}^{\frac{1}{3}}} - \frac{88}{3}\right)}^{k} {\left(159775749 {\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}} - \frac{188329}{{\left(\frac{87716917}{21580961113270008463041} \sqrt{114184979435291050069} - \frac{40}{2536123}\right)}^{\frac{1}{3}}}\right)} \end{array}\right)$
@Tommy Angelo: Notice that such matrix can be dealt with the original matrix_function_Jordan(A, f)
but with A = matrix(SR, [[pi, -1],[1, 0]])
(just use SR instead of QQ). My observation is that although this trick works quite generally (even so when the matrix has complex eigenvalues), the quality of the answer by @tmonteil's approach will be far better than using "plain" SR (and with wolframalpha, as you can check with some toy examples). Here by quality I mean simplified formulas (as well as a smaller computational time), so this is crucial in practice.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2016-11-19 17:21:33 +0100
Seen: 3,148 times
Last updated: Mar 06 '17
How do I understand the result of symbolic integrals
Plot picewise function + infinity, error message
Problem with sign / sgn and .n()
Plotting an integral with a variable as a limit
def f(x): evaluvates individually but not inside plot
Bug with absolute value of a complex variable?
Related: