I am developing an algorithm and am stuck with the following definite integral:

$$\int_s^t\frac{\sin\theta \cos\theta}{((a^2-1)\cos^2\theta+1)^2}\sin\left(\frac{\pi(\theta-b+c)}{2c}\right)\,d\theta$$

Without the second sine term it would be very simple, however in this form I am getting nowhere. The parameters satisfy $s,t,b,c\in[0,\frac{\pi}{2}]$, $a\ge0$.

I'd be most happy with a solution or even better, a simple analytic approximation that is easy to compute in time critical applications.

Any help is greatly appreciated.
Thank you

  • 1
    $\begingroup$ do you mean a Pade aprroximation? $\endgroup$ Sep 23 '16 at 16:42
  • 1
    $\begingroup$ Is the $(a^2-1)$ part of the argument of $\cos^2$ or is it the coefficient? $\endgroup$
    – Ian Miller
    Sep 24 '16 at 6:36
  • $\begingroup$ Pade would give something relatively expensive to compute, a lot of terms. $a^2-1$ isn't part of the cosine. I will update the question. $\endgroup$ Sep 24 '16 at 6:42
  • $\begingroup$ The first fraction has an easy antiderivative, so at least you can integrate by parts to get a somewhat simpler integral, but it's not much helpful. $\endgroup$ Sep 24 '16 at 6:50

if $c$ is small then the right $\sin$ will oscillate quickly causing problems for quadrature methods.

The left trig functions have slow oscillation so over a short range $s,t \in [0,\frac{\pi}{2}]$ it will have half a cycle. Note: $\cos(\theta)\sin(\theta) = \frac1{2}\sin(2\theta)$, $\displaystyle 2\frac{\pi}{2} = \pi$, i.e. half a cycle and it saves one trig calculation.

The left trig functions can be approximated accurately by polynomials over the short range of integration. This is required for many quadrature methods.

There are many papers on the integration of oscillating functions.

$\sin(x) = Imaginary(e^{ix})$

The problem can be expressed in the form: $$I = \int_a^b f(x)e^{iwx}dx$$

where $f(x)$ is the slow left trig terms and $e^{iwx}$ is the fast right $\sin$.

This form can be transformed into a Gauss–Laguerre quadrature form. $\int_{0}^{\infty} f(u)e^{-u}du$

An integral path is taken into the complex plane.

$$h_x(t) = x + it$$

$x$ is fixed and $t$ varies from $0\dots\infty$.

$$I = \int_0^\infty f(h_x(t))e^{iwh_x(t)}h'_x(t) dt \, \Biggr|_{x=b}^{x=a} $$

$$I = ie^{iwx}\int_0^\infty f(x+it)e^{-wt} dt \, \Biggr|_{x=b}^{x=a} $$

Let $u = wt$ then $t = \frac{u}{w}$ and $dt = \frac{du}{w}$

$$I = \frac{ie^{iwx}}{w}\int_0^\infty f\left(x+i\frac{u}{w}\right)e^{-u} du \, \Biggr|_{x=b}^{x=a} $$

The integral is now in Gauss Laguerre form.

Determine the number of quadrature points for the required accuracy.

Calculate the quadrature using the points and weights then take the imaginary component.

  • $\begingroup$ Note: $\displaystyle e^{\frac{i\pi(\theta - b + c )}{2c}} = e^{\frac{i\pi(- b + c )}{2c}} e^{\frac{i\pi\theta}{2c}}$ factor out the left as a constant. $\endgroup$
    – arthur
    Sep 27 '16 at 12:32
  • $\begingroup$ Very interesting. Numerical integration is still not good enough for a real-time application. In my case it was possible to extract the parameters s, t, a, b, c from only 2 parameters. So for each pair I numerically integrated, as described, many points for $\theta$, created a Gaussian fit and stored the resulting coefficients in a 2D lookup table. Surprisingly good results and obviously very fast. $\endgroup$ Sep 28 '16 at 5:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.