# Numerical integration of a function with a highly varying region.

I would appreciate some advice on numerically integrating the following function

\begin{align} I &= \int_a^b f(x) ~dx = \int^b_a \cos\left[\alpha\left(\sqrt{x^2 + \beta_1x + \gamma_1} - \sqrt{x^2 + \beta_2x + \gamma_2}\right)\right] dx. \\ & a,b, \alpha, \gamma_{1,2} \in \mathbb{R}_{>0},~~ \beta_{1,2} \in \mathbb{R} \end{align}

The integrand $f(x)$ is initially highly varying and then stops oscillating as can be seen in the plot of f(x). The boundary between the regions is given by \begin{align} c = \frac{\alpha[4(\gamma_1-\gamma_2) + (\beta_2 - \beta_1)]}{16\pi}. \end{align}

What numerical integration methods would be suitable for the two regions?

• The graph show a function which is not even continuous at 0. Is this a part on the integration domain? – user14717 Jun 26 '17 at 15:35
• @user14717: It is continuous at 0, however it is oscillating very rapidly. – jw217 Jun 26 '17 at 16:27
• Use tanh-sinh quadrature with extended precision. The extended precision will help cope with the horrific condition number of the summation problem. – user14717 Jun 26 '17 at 16:57