# Numerical integration over infinite interval with highly oscillatory integrand

It is known that $$J_{\nu }(x)=\frac{2}{\pi }$$ $$\int_0^{\infty } \cosh (\nu t) \sin \left(x \cosh (t)-\frac{\pi \nu }{2}\right) \, dt$$ for $$x>0$$ and $$-1<\Re(\nu )<1$$.

(see DLMF formula 10.9.8)

The integrand is highly oscillatory for large t and NIntegrate gives an inaccurate result as shown below. How can accuracy be improved ?

intJ[\[Nu]_,x_]:=2/\[Pi] NIntegrate[Cosh[\[Nu] t]Sin[x Cosh[t]-(\[Pi] \[Nu])/2],{t,0,\[Infinity]}]
intJ[0.5, 3.0]
0.227508
BesselJ[0.5, 3.0]
0.0650082

• may be not all integral representations are equal. Eq (149) on this web page gives the exact value as BesselJ for the values you used. Here it is intJ[v_, x_] := 1/Pi NIntegrate[Cos[v*t - x*Sin[t]], {t, 0, Pi}] - Sin[v*Pi]/Pi* NIntegrate[Exp[-v*t - x*Sinh[t]], {t, 0, Infinity}] Sep 24 '21 at 6:29
• @Nasser: You made use of another integral representation of BesselJ. This does not answer the question. Am I not right? Sep 24 '21 at 6:47

An ArcCosh substitution allows NIntegrate to compute the integral accurately.

Cosh[ν t] Sin[x Cosh[t] - (π ν)/2] Dt[t, u] /. t -> ArcCosh[u]

(*
(Cosh[ν ArcCosh[u]] Sin[u x - (π ν)/2])/(Sqrt[-1 + u] Sqrt[1 + u])
*)

intJ[ν_, x_] := 2/π NIntegrate[
(Cosh[ν ArcCosh[u]] Sin[u x - (π ν)/2])/(Sqrt[-1 + u] Sqrt[1 + u])
, {u, 1, ∞}
, PrecisionGoal -> 12
];

intJ[1/2, 3]
BesselJ[0.5, 3.0]
% - %%

(*
0.0650082
0.0650082
4.996*10^-15
*)

• Let us consider a slightly modified integrand Cosh[[Nu] (t +t^(2/9))] Sin[x Cosh[t + t^(2/9)]] - ([Pi] [Nu])/2] and the same range of integration from 0 to Infinity. Does the approach suggested by you work in this case? Sep 24 '21 at 14:12

This can be done by cutting the tail of the improper integral under consideration.

intJ[\[Nu]_?NumericQ, x_?NumericQ] := 2/\[Pi] NIntegrate[Cosh[\[Nu] t] *
Sin[x Cosh[t] - (\[Pi] \[Nu])/2], {t, 0, 20}, Method -> "LocalAdaptive"]
intJ[0.5, 3.0]


0.0650177

Addition. One can split the integral into two ones:

intJ1[\[Nu]_?NumericQ, x_?NumericQ] :=  2/\[Pi] NIntegrate[
Cosh[\[Nu] t]*Sin[x Cosh[t] - (\[Pi] \[Nu])/2], {t, 0, 20},

0.0650122