Using trapezoidal rule to calculate an improper integral. I have numerically calculated the integral $$\int_{-1}^{1}\frac{e^{-x^2}}{\sqrt{1-x^2}}dx$$ using Gauss-Legendre and Gauss-Chebyshev quadrature. Now, I am asked to calculate the integral using the trapezoidal rule and compare the different methods. I had previously used the trapezoidal method for other integrals, however, with this one, I can't evaluate the function at the limits of the integral, since the denominator is $0$.

How can I calculate this integral using the trapezoidal rule? Is it even possible?
$\require{cancel}$

Calculate

\begin{eqnarray}
\int_{-1}^{1} \frac{e^{-x^2}}{\sqrt{1-x^2}} \,{\rm d}x&amp;=&amp; 2\int_{0}^{1} \frac{e^{-x^2} - \color{blue}{e^{-1} + e^{-1}}}{\sqrt{1-x^2}} \,{\rm d}x\\ 
&amp;=&amp; 2\int_{0}^{1}\frac{e^{-x^2} - \color{blue}{e^{-1}}}{\sqrt{1-x^2}} \,{\rm d}x+ 2\color{blue}{e^{-1}}\int_{0}^{1} \frac{1}{\sqrt{1-x^2}}\,{\rm d}x \\
&amp;=&amp; 2\int_{0}^{1} \frac{e^{-x^2} - \color{blue}{e^{-1}}}{\sqrt{1-x^2}} \,{\rm d}x+ \frac{\pi}{e}
\end{eqnarray}

The advantage of doing this is that

$$
\lim_{x\to 1}\frac{e^{-x^2} - \color{blue}{e^{-1}}}{\sqrt{1-x^2}} = 0
$$

So when you evaluate this node in your code you just set it to zero. That is, if 

$$
f(x) = \frac{e^{-x^2}- e^{-1}}{\sqrt{1 - x^2}}
$$

then

$$
\int_0^1 f(x)\,{\rm d}x \approx \frac{h}{2}[f(0) + 2f(x_1) + 2 f(x_2) + \cdots + 2 f(x_{n-1}) + \cancelto{0}{f(1)}] 
$$
Hint: Calculate 

$$\int_{-\varepsilon}^{\varepsilon}\dfrac{e^{-x^2}}{\sqrt{1-x^2}}dx$$

using the trapezoidal rule. The expression should be a function of $\varepsilon$. Then calculate $\varepsilon \to 1$ for that expression.