2
$\begingroup$

I need to perform a numerical integration as part a computing matrix elements for a given block diagonal matrix. I've been trying different several approaches with NIntegrate but none have been successful and are really slow. I know for a fact the eigenvalues of the matrix are all order one numbers but with the following code I get extremely small eigenvalues. The matrix is defined as follows: $$\left(\begin{array}{cc} \int f_k^*Wf_{k'} & 0\\ 0 & \int g_k^*Wg_{k'} \end{array}\right) $$

Here is the code:

f[u_, v_, k_] := E^(-I k u) - E^(-I k v);
g[u_, v_, k_] := E^(-I k u) + E^(-I k v);
W[u_, v_, p_, q_, ϵ_] := -1/(4 π)Log[-(0.0116681)^2 (u - p - I ϵ) (v - q - I ϵ)];

Int[k_, m_] =
  f[-x, -y, (k π)/l] W[u, v, x, y, 10^-2] f[u, v, (m π)/l] // FullSimplify
Int2[k_, m_] = 
  g[-x, -y, (k π)/l] W[u, v, x, y, 10^-2] g[u, v, (m π)/l] // FullSimplify

Mat[k_, m_] :=  
  NIntegrate[Int[k, m], {u, -1, 0, 1}, {v, -1, 0, 1}, {x, -1, 0, 1}, 
                        {y, -1, 0,1}, AccuracyGoal -> 3]
Mat2[k_, m_] :=  
  NIntegrate[Int2[k, m], {u, -1, 0, 1}, {v, -1, 0, 1}, {x, -1, 0, 1}, 
                         {y, -1, 0, 1}, AccuracyGoal -> 3]

The $k$ values range from 0 to 2500, but even a single integration for example

Mat[30,30]

takes really long. And with small $k$ values ($k<50$) I get

Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

I have used the same code to construct a matrix with ($k>300$) but when computing the eigenvalues I get really small numbers which means something is very wrong. I hope someone can point me in the right direction!

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$ – bbgodfrey Aug 22 '16 at 4:06
  • $\begingroup$ 3D integrals often are quite slow, but you can speed the computation some by combining the various functions into a single expression for each integrand. $\endgroup$ – bbgodfrey Aug 22 '16 at 4:14
  • $\begingroup$ Did you try Monte-Carlo, it usually works better for the multidimensional problems. $\endgroup$ – Svyatoslav Korneev Aug 22 '16 at 20:11
  • $\begingroup$ I have tried Montecarlo without success. Maybe I have used it naively and that is why It failed (?). Perhaps you can give me tips on what MC routine to use and with what configurations so I can try it and see if it works @SvyatoslavKorneev . $\endgroup$ – Matt Rest Aug 23 '16 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.