# Applying a real or complex-valued function to a matrix, using matrix operations

I'm having difficulty applying real or complex-valued functions to matrices. For example let's define

Q = {{1,2,3},{2,3,1},{6,7,8}}


Then

PolyLog[-1,Q]


obviously returns

{{ComplexInfinity,2,3/4},{2,3/4,ComplexInfinity},{6/25,7/36,8/49}}


because it is doing the PolyLog on each entry of Q separately. However, what I really want is for the PolyLog[-1,z] expression, which evaluates to z/(1-z)^2, to be applied to Q as a matrix. That is, I want output that matches

Q.MatrixPower[Inverse[IdentityMatrix-Q],2]


which returns

{{-17/20, -39/20, 7/10},{9/5,26/5,-8/5},{-11/10,-37/10,6/5}}


In my research, I need to iteratively evaluate polylogs of matrices, for n= -1, -2, -3, .... The problem is the huge difference in syntax for matrices vs. real or complex numbers. Is there any way to do this without manually rewriting the function in terms of the matrix syntax?

If not, is there a way to symbolically differentiate a function defined on a matrix (since you can get polylogs iteratively using differentiation)?

• Does MatrixFunction help? – bill s Feb 13 '17 at 18:24
• @bills - Just add RootReduce, i.e., MatrixFunction[PolyLog[-1, #] &, Q] // RootReduce – Bob Hanlon Feb 14 '17 at 0:15
• @bill Perhaps you would case to post that as an Answer to take this off the unanswered list, or cast a close vote if you feel this is easily found in the documentation? – Mr.Wizard Mar 7 '17 at 11:11

q = {{1, 2, 3}, {2, 3, 1}, {6, 7, 8}};