Maxima Function
mat_function (f,mat)
Returns f(mat), where f is an analytic function and mat
a matrix. This computation is based on Cauchy's integral formula, which states that
if f(x)
is analytic and
mat = diag([JF(m1,n1),...,JF(mk,nk)]),
then
f(mat) = ModeMatrix*diag([f(JF(m1,n1)), ..., f(JF(mk,nk))]) *ModeMatrix^^(-1)
Note that there are about 6 or 8 other methods for this calculation.
Some examples follow.
Example 1:
(%i1) load("diag")$ (%i2) b2:matrix([0,1,0], [0,0,1], [-1,-3,-3])$ (%i3) mat_function(exp,t*b2); 2 - t t %e - t - t (%o3) matrix([-------- + t %e + %e , 2 - t - t - t 2 %e %e - t - t %e t (- ----- - ----- + %e ) + t (2 %e - -----) t 2 t t - t - t - t - t - t %e 2 %e %e + 2 %e , t (%e - -----) + t (----- - -----) t 2 t 2 - t - t - t - t t %e 2 %e %e - t + %e ], [- --------, - t (- ----- - ----- + %e ), 2 t 2 t - t - t 2 - t 2 %e %e t %e - t - t (----- - -----)], [-------- - t %e , 2 t 2 - t - t - t 2 %e %e - t - t %e t (- ----- - ----- + %e ) - t (2 %e - -----), t 2 t t - t - t - t 2 %e %e - t %e t (----- - -----) - t (%e - -----)]) 2 t t (%i4) ratsimp(%); [ 2 - t ] [ (t + 2 t + 2) %e ] [ -------------------- ] [ 2 ] [ ] [ 2 - t ] (%o4) Col 1 = [ t %e ] [ - -------- ] [ 2 ] [ ] [ 2 - t ] [ (t - 2 t) %e ] [ ---------------- ] [ 2 ] [ 2 - t ] [ (t + t) %e ] [ ] Col 2 = [ 2 - t ] [ - (t - t - 1) %e ] [ ] [ 2 - t ] [ (t - 3 t) %e ] [ 2 - t ] [ t %e ] [ -------- ] [ 2 ] [ ] [ 2 - t ] Col 3 = [ (t - 2 t) %e ] [ - ---------------- ] [ 2 ] [ ] [ 2 - t ] [ (t - 4 t + 2) %e ] [ -------------------- ] [ 2 ]
Example 2:
(%i5) b1:matrix([0,0,1,1,1], [0,0,0,1,1], [0,0,0,0,1], [0,0,0,0,0], [0,0,0,0,0])$ (%i6) mat_function(exp,t*b1); [ 2 ] [ t ] [ 1 0 t t -- + t ] [ 2 ] [ ] (%o6) [ 0 1 0 t t ] [ ] [ 0 0 1 0 t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ] (%i7) minimalPoly(jordan(b1)); 3 (%o7) x (%i8) ident(5)+t*b1+1/2*(t^2)*b1^^2; [ 2 ] [ t ] [ 1 0 t t -- + t ] [ 2 ] [ ] (%o8) [ 0 1 0 t t ] [ ] [ 0 0 1 0 t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ] (%i9) mat_function(exp,%i*t*b1); [ 2 ] [ t ] [ 1 0 %i t %i t %i t - -- ] [ 2 ] [ ] (%o9) [ 0 1 0 %i t %i t ] [ ] [ 0 0 1 0 %i t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ] (%i10) mat_function(cos,t*b1)+%i*mat_function(sin,t*b1); [ 2 ] [ t ] [ 1 0 %i t %i t %i t - -- ] [ 2 ] [ ] (%o10) [ 0 1 0 %i t %i t ] [ ] [ 0 0 1 0 %i t ] [ ] [ 0 0 0 1 0 ] [ ] [ 0 0 0 0 1 ]
Example 3:
(%i11) a1:matrix([2,1,0,0,0,0], [-1,4,0,0,0,0], [-1,1,2,1,0,0], [-1,1,-1,4,0,0], [-1,1,-1,1,3,0], [-1,1,-1,1,1,2])$ (%i12) fpow(x):=block([k],declare(k,integer),x^k)$ (%i13) mat_function(fpow,a1); [ k k - 1 ] [ k - 1 ] [ 3 - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k k - 1 ] [ - k 3 ] [ 3 + k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] (%o13) Col 1 = [ ] Col 2 = [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ 0 ] [ 0 ] [ ] [ ] [ 0 ] [ 0 ] [ ] [ ] [ k k - 1 ] [ k - 1 ] [ 3 - k 3 ] [ k 3 ] [ ] [ ] Col 3 = [ k - 1 ] Col 4 = [ k k - 1 ] [ - k 3 ] [ 3 + k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ ] [ ] [ k - 1 ] [ k - 1 ] [ - k 3 ] [ k 3 ] [ 0 ] [ ] [ 0 ] [ 0 ] [ ] [ ] [ 0 ] [ 0 ] [ ] [ ] [ 0 ] Col 5 = [ 0 ] Col 6 = [ ] [ ] [ 0 ] [ k ] [ ] [ 3 ] [ 0 ] [ ] [ ] [ k k ] [ k ] [ 3 - 2 ] [ 2 ]
To use this function write first load("diag")
.