Numerical integration of $\int_a^bf(x) \: \text{d}x$ for $f(x) \to \infty$ when $x \to b$

131 Views Asked by At

This is the function I am trying to approximate using Simpson's rule:

$$\int_0^1 f(x) \: \text{d}x =\int_0^1 \frac{e^x}{\sqrt{1-x^2}} \: \text{d}x.$$

Of course, Simpson's rule is of the form $$\int_a^b g(x) \: \text{d}x \approx \frac{b-a}{6}\left( g(a) +4g\!\left( \frac{a+b}{2} \right) +g(b) \right),$$ but in this case $f(x) \to \infty$ as $x \to 1$. I'm not sure if there is any kind of work around here, any help would be great!

3

There are 3 best solutions below

4
On BEST ANSWER

By integrating by parts, using $$ (e^x)'=e^x, \qquad \left(\arcsin x \right)'=\frac{1}{\sqrt{1-x^2}},\qquad -1<x<1, $$ one gets $$ \int_0^1 \frac{e^x}{\sqrt{1-x^2}} \: dx=\left.e^x \frac{}{}\arcsin x\right|_0^1-\int_0^1e^x \frac{}{}\arcsin x \:dx $$ and the latter integral is more suitable for the Simpson rule, the function $\arcsin(\cdot)$ being bounded over $[0,1]$.

0
On

Since by Euler's Beta function $$ \int_{0}^{1}\frac{x^k\,dx}{\sqrt{1-x^2}} = \frac{1}{2}\int_{0}^{1}x^{(k-1)/2}(1-x)^{-1/2}\,dx = \frac{\sqrt{\pi}}{2}\cdot\frac{\Gamma\!\left(\tfrac{k+1}{2}\right)}{\Gamma\!\left(\tfrac{k+2}{2}\right)}\tag{1}$$ we simply have: $$ \int_{0}^{1}\frac{e^x}{\sqrt{1-x^2}}\,dx = \sum_{k\geq 0}\frac{\sqrt{\pi}}{2k!}\cdot\frac{\Gamma\!\left(\tfrac{k+1}{2}\right)}{\Gamma\!\left(\tfrac{k+2}{2}\right)}\tag{2}$$ and the last hypergeometric series (that equals $\frac{\pi}{2}\left(I_0(1)+L_0(1)\right)$ in terms of Bessel and Struve functions) is fast-convergent. It is not difficult, either, to find a generalized continued fraction converging to the RHS of $(2)$.

0
On

$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

As $\ds{x \to 1^{-}}$, $\ds{\root{1 - x^{2}} \sim 2^{1/2}\root{1 - x}}$ which suggests the variable change $$ \root{1 - x} \equiv t\quad \implies\quad x = 1 - t^{2} $$ This serves to the purpose of 'avoid' the integrable singularity as $\ds{x \to 1^{-}}$:

\begin{align} \int_{0}^{1}{\expo{x} \over \root{1 - x^{2}}}\,\dd x & \,\,\,\stackrel{x\ =\ 1 - t^{2}}{=}\,\,\, \int_{1}^{0}\pars{-2\,{\expo{1 - t^{2}} \over \root{2-t^{2}}}}\dd t = 2\expo{}\int_{0}^{1}{\expo{-t^{2}} \over \root{2 - t^{2}}} \end{align} In using your announced Simpson's Rule: \begin{align} \int_{0}^{1}{\expo{x} \over \root{1 - x^{2}}}\,\dd x & = 2\expo{}\bracks{{1 - 0 \over 6}\pars{{\expo{-0^{2}} \over \root{2 - 0^{2}}} + 4\,{\expo{-1/4} \over \root{2 - 1/4}} + {\expo{-1^{2}} \over \root{2 - 1^{2}}}}} \\[5mm] & = {\root{2}\expo{} \over 6} + {8\root{7}\expo{3/4} \over 21} + {1 \over 3} \approx 3.10\color{#f00}{77\ldots} \end{align}

The exact result $\ds{\pars{~\approx 3.10437901\ldots~}}$involves Bessel functions. The above Simpson's Rule yields a relative error $\ds{\approx 0.1094}$ %.