title: Integrating error: maximum number of subdivisions reached
body: <p>I am trying to plot a Fourier integral, but I get error while integrating</p>
  
  <pre><code>X &lt;- seq(-10, 10, by = 0.05)
  f_fourier &lt;- function(X) {
      Y &lt;- sapply(X, function(x) {
          integrand &lt;- function(l) {
              y &lt;- (2 / pi) * cos(l * x) / (l^2 + 1)
          }
          integrate(integrand, lower = 0, upper = Inf)$value
      })
  }
  plot(X,f_fourier(X))
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>maximum number of subdivisions reached
  </code></pre>
  
  <p>I found out that "cos(l * x)" causes this error but Wolfram gives me normal result.
  Can you suggest something?</p>