Artificial intelligent assistant

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&=& 2\int_{0}^{1} \frac{e^{-x^2} - \color{blue}{e^{-1} + e^{-1}}}{\sqrt{1-x^2}} \,{\rm d}x\\\ &=& 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 \\\ &=& 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)}] $$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 9dc34d1b9c9589598112abfadab982c9