title: Solving double integral numerically in matlab
body: <p>In the paper <a href="http://arxiv.org/abs/1303.6934v1" rel="nofollow noreferrer">"The fractional Laplacian operator on bounded domains as a special case of the nonlocal diffusion operator"</a>. Where the author has solved a fractional laplacian equation on bounded domain as a non-local diffusion equation.</p>
  
  <p>I am trying to implement the finite element approximation of the one dimensional problem(please refer to page 14 of the above mentioned paper) in matlab.</p>
  
  <p>I am using the following definition of $\phi_k$ as it is mentioned in the paper that $\phi$ is a <code>$hat\;function$
  \begin{equation}
  \phi_{k}(x)=\begin{cases} {x-x_{k-1} \over x_k\,-x_{k-1}} &amp; \mbox{ if } x \in [x_{k-1},x_k], \\
  {x_{k+1}\,-x \over x_{k+1}\,-x_k} &amp; \mbox{ if } x \in [x_k,x_{k+1}], \\
  0 &amp; \mbox{ otherwise},\end{cases}
  \end{equation}</code></p>
  
  <p>$\Omega=(-1,1)$ and $\Omega_I=(-1-\lambda,-1) \cup (1,1+\lambda)$ so that $\Omega\cup\Omega_I=(-1-\lambda,1+\lambda)$</p>
  
  <p>For the integers K,N we define the partition of $\overline{\Omega\cup\Omega_I}=[-1-\lambda,1+\lambda]$ as,</p>
  
  <p>\begin{equation}
  -1-\lambda=x_{-K}&lt;...
  
  <p>Finally the equations that we have to solve to get the solution $\tilde{u_N}=\sum_{i=-K}^{K+N}U_j\phi_j(x)$ for some coefficients $U_j$ is:</p>
  
  <p><img src="https://i.stack.imgur.com/0Ztr8.png" alt="enter image description here"></p>
  
  <p>Where $i=1,...,N-1$. </p>
  
  <p>I need pointers in order to simplify and solve the LHS double integral in matlab.It is written in the paper(page 15) that I should use four point gauss quadrature for inner integral and quadgk.m function for outer integral, but since the limits of the inner integral are in terms of x how can I apply four point gauss quadrature on it??.Any help will be appreciated. 
  Thanks.</p>
  
  <p>You can find the original question <a href="https://mathoverflow.net/questions/145366/solving-double-integral-numerically-in-matlab">here</a>.(Since SO does not support Latex)</p>