1
$\begingroup$

I wish to perform the integral $$ \int \prod_{i,j}dM_{ij}\exp\left(-Tr(M^2)\right) $$ where we integrate over the matrix elements of $M$. I tried

Integrate[Exp[-Tr[matrix^2]],Product[Part[matrix,i,j],{matrix}]];

I know this is wrong and I get "The expression i cannot be used as a part specification.", but how should I write this instead?

$\endgroup$
2
  • 1
    $\begingroup$ Do you mean the component-wise square of the matrix or the matrix product of M with itself? $\endgroup$ Nov 1, 2018 at 18:09
  • $\begingroup$ @HenrikSchumacher The matrix product. But what I try to understand is not the integrand, but how to express the $dM_{ij}$ with Mathematica $\endgroup$ Nov 1, 2018 at 18:21

2 Answers 2

3
$\begingroup$

I'm assuming $\prod_{i,j} dM_{i,j} = dM_{1,1} dM_{1,2}\ldots$ so as to successively integrate over each element in your matrix.

Then

mat = {{a, b}, {c, d}}
Integrate[Exp[-Tr[MatrixPower[mat, 2]]], ##] & @@ Flatten@mat

-(1/8) π Erf[a] Erf[d] ExpIntegralEi[-2 b c]

$\endgroup$
2
  • $\begingroup$ My matrix is a GUE (mat=RandomVariate[GaussianUnitaryMatrixDistribution[some rank]];) and it returns me the error 'Invalid integration variable or limit(s)' $\endgroup$ Nov 2, 2018 at 0:01
  • $\begingroup$ You could try starting with a symbolic matrix, then integrate, then replace the symbols with the appropriate numbers in the final output or implement integration bounds as in @Henrik's answer. Otherwise, since your matrix is made of numeric quantities, integrating with respect to a number doesn't really work. $\endgroup$ Nov 2, 2018 at 1:27
2
$\begingroup$

Just some shot into the dark because I am not sure whether I understood exactly want you want to compute:

n = 3;
M = Array[m, {n, n}];
With[{vars = Sequence @@ Transpose[{Flatten[M], ConstantArray[-∞, n^2], ConstantArray[∞, n^2]}]},
 Integrate[Exp[-Tr[M\[Transpose].M]], vars]
 ]

π^(9/2)

Also notice that

With[{vars = Sequence @@ Transpose[{Flatten[M], ConstantArray[-∞, n^2], ConstantArray[∞, n^2]}]},
 Integrate[Exp[-Tr[M.M]], vars]
 ]

will lead to an error message stating that integral won't converge.

$\endgroup$
1
  • $\begingroup$ For arbitrary n, a wild guess would be (Pi)^(n^2/2) :-) $\endgroup$
    – chris
    Nov 2, 2018 at 0:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.