# How to get analytical solution for integral from product of Bessel functions with integer orders

The following integral appears to be problematic for me:

$\int_a^b r J_s(k r) Y_d(k r) \, dr$

The result returned by Mathematica in response to the next input

$Assumptions = a ∈ Reals && b ∈ Reals && k ∈ Reals && r ∈ Reals && b > a && a > 0 && b > 0 && k > 0 && r > 0 && s ∈ Integers && d ∈ Integers; Integrate[r*BesselJ[s, k*r]*BesselY[d, k*r], r]  contains$\csc (\pi d)$and$\cot (\pi d)$, both of which correspond to ComplexInfinity in case of integer order d. It appeared to be possible to integrate the expression for specific values of Bessel function orders. This can be used for determining dependence of coefficient values in integration results upon orders s and d. Also, there are certain values of s and d for which analytic result doesn't coincide with the result of numeric integration (for example s=3,d=7). Because of that the range of orders for which I obtained a solution is limited to$\left| s\right| \geq \left| d\right|$. I need help with a solution for remaining part of the domain. I was not able to find this integral in table of integrals by Gradshtein & Ryzhik. Maple left this integral unevaluated. Tried IntegrateInverseIntegrate and Rubi with no success. • Is there a reason why you think this integral has an analytical solution? Also it seems you can "eliminate"$k$by a change of variable. Mar 22, 2017 at 16:12 • @anderstood, it does have one, but OP's problem is that the solution returned by Mathematica is no good for integer$d$, but fine otherwise (yet another instance of "generically correct"). Mar 22, 2017 at 16:45 • @J.M. Oh I see. Interestingly, with f[r_, d_, s_, k_] = Integrate[r*BesselJ[s, k*r]*BesselY[d, k*r], r], the plot Plot[f[3.2, d, 3.6, 1], {d, 0, 10}] seems "fine" for integer values of d. Maybe the solution is always correct, but its evaluation is only generically correct. Mar 22, 2017 at 17:02 • @anderstood, Concerning the question: "Is there a reason why you think this integral has an analytical solution?". How can I answer it? Do you mean there is kind of theorem that can prove existence of analytic solution? The solution is not even close to "fine" because in my case s is integer too. Try plotting Plot[f[3.2, d, 2, 1], {d, 0, 10}]. Mar 23, 2017 at 5:43 ## 1 Answer The solution for$\left| s\right| \geq \left| d\right|$have already been derived as stated in question. It has the following form Tas901=(1/(2 Sqrt[\[Pi]]))(-a^2 MeijerG[{{0,1/2 Mod[d+s,2]},{1/2 Boole[Mod[d+s,2]==0]}},{{1/2 (Abs[d]+Abs[s]),1/2 Abs[Abs[d]-Abs[s]]},{-1,1/2 (-Abs[d]-Abs[s]),-(1/2) Abs[Abs[d]-Abs[s]]}},a k,1/2]+b^2 MeijerG[{{0,1/2 Mod[d+s,2]},{1/2 Boole[Mod[d+s,2]==0]}},{{1/2 (Abs[d]+Abs[s]),1/2 Abs[Abs[d]-Abs[s]]},{-1,1/2 (-Abs[d]-Abs[s]),-(1/2) Abs[Abs[d]-Abs[s]]}},b k,1/2]) (\[Piecewise] -1 Mod[d+3 s,4]<=1 1 True )  Using the relation from http://functions.wolfram.com/03.03.26.0026.01$Y_{\mu }\left(\sqrt{z}\right) J_{\nu }\left(\sqrt{z}\right)+J_{\mu }\left(\sqrt{z}\right) Y_{\nu }\left(\sqrt{z}\right)=-\frac{2 G_{2,4}^{3,0}\left(z\left| \begin{array}{c} 0,\frac{1}{2} \\ \frac{\mu -\nu }{2},\frac{\nu -\mu }{2},\frac{\mu +\nu }{2},\frac{1}{2} (-\mu -\nu ) \\ \end{array} \right.\right)}{\sqrt{\pi }}$we can swap the orders of Bessel functions. Let us apply this rule to the integrand: Expand[r*BesselJ[s, k*r]*BesselY[d, k*r] /. HoldPattern[ BesselJ[\[Nu]_, z_]*BesselY[\[Mu]_, z_]] :> -(( 2 MeijerG[{{}, {0, 1/2}}, {{(\[Mu] + \[Nu])/2, (\[Mu] - \[Nu])/ 2, (\[Nu] - \[Mu])/2}, {-(1/2) (\[Mu] + \[Nu])}}, z^2])/ Sqrt[\[Pi]]) - BesselJ[\[Mu], z]*BesselY[\[Nu], z]]  As a result we obtain two summands, which need to be integrated -r BesselJ[d, k r] BesselY[s, k r] - ( 2 r MeijerG[{{}, {0, 1/2}}, {{(d - s)/2, 1/2 (-d + s), (d + s)/ 2}, {1/2 (-d - s)}}, k^2 r^2])/Sqrt[\[Pi]]  The first one is already solved. Fortunately, the second summand can be integrated by Mathematica without any problems.  tmp = Integrate[-(( 2 r MeijerG[{{}, {0, 1/2}}, {{(d - s)/2, 1/2 (-d + s), (d + s)/ 2}, {1/2 (-d - s)}}, k^2 r^2])/Sqrt[\[Pi]]), r] (* -(MeijerG[{{1}, {1, 3/2}}, {{1/2 (2 + d - s), 1/2 (2 - d + s), 1/2 (2 + d + s)}, {0, 1/2 (2 - d - s)}}, k^2 r^2]/( k^2 Sqrt[\[Pi]])) *)  Then we use the solution for$\left| s\right| \geq \left| d\right|$for derivation of solution for$\left| s\right| <\left| d\right|$(expression correspond to above expanded integrand): Tas902 = (((-Tas901 /. s -> sTemp) /. d -> s) /. sTemp -> d) + ((tmp /. r -> b) - (tmp /. r -> a))  Gathering integration results for two pieces of domain Tas9= Piecewise[{{Tas901, Abs[s] >= Abs[d]}, {Tas902, Abs[s] < Abs[d]}}]  we can express the solution to the integral in question as follows: \[Piecewise] (1/(2 Sqrt[\[Pi]]))(-a^2 MeijerG[{{0,1/2 Mod[d+s,2]},{1/2 Boole[Mod[d+s,2]==0]}},{{1/2 (Abs[d]+Abs[s]),1/2 Abs[Abs[d]-Abs[s]]},{-1,1/2 (-Abs[d]-Abs[s]),-(1/2) Abs[Abs[d]-Abs[s]]}},a k,1/2]+b^2 MeijerG[{{0,1/2 Mod[d+s,2]},{1/2 Boole[Mod[d+s,2]==0]}},{{1/2 (Abs[d]+Abs[s]),1/2 Abs[Abs[d]-Abs[s]]},{-1,1/2 (-Abs[d]-Abs[s]),-(1/2) Abs[Abs[d]-Abs[s]]}},b k,1/2]) (\[Piecewise] -1 Mod[d+3 s,4]<=1 1 True ) Abs[s]>=Abs[d] (1/(2 k^2 Sqrt[\[Pi]]))(2 MeijerG[{{1},{1,3/2}},{{1/2 (2+d-s),1/2 (2-d+s),1/2 (2+d+s)},{0,1/2 (2-d-s)}},a^2 k^2]-2 MeijerG[{{1},{1,3/2}},{{1/2 (2+d-s),1/2 (2-d+s),1/2 (2+d+s)},{0,1/2 (2-d-s)}},b^2 k^2]+k^2 (a^2 MeijerG[{{0,1/2 Mod[d+s,2]},{1/2 Boole[Mod[d+s,2]==0]}},{{1/2 (Abs[d]+Abs[s]),1/2 Abs[Abs[d]-Abs[s]]},{-1,1/2 (-Abs[d]-Abs[s]),-(1/2) Abs[Abs[d]-Abs[s]]}},a k,1/2]-b^2 MeijerG[{{0,1/2 Mod[d+s,2]},{1/2 Boole[Mod[d+s,2]==0]}},{{1/2 (Abs[d]+Abs[s]),1/2 Abs[Abs[d]-Abs[s]]},{-1,1/2 (-Abs[d]-Abs[s]),-(1/2) Abs[Abs[d]-Abs[s]]}},b k,1/2]) (\[Piecewise] -1 Mod[3 d+s,4]<=1 1 True )) Abs[s]<Abs[d] 0 True  Comparison with numeric integration can be done for the equal precisions of computation results Grid[Prepend[ Table[Flatten@{"d=" <> ToString@id, Table[ruleSet = {s -> is, d -> id, k -> 1/7, a -> 1/8, b -> 1/4}; N[Tas9[s, d] /. ruleSet, 8] == NIntegrate[r*BesselJ[s, k*r]*BesselY[d, k*r] /. ruleSet, Evaluate[{r, a, b} /. ruleSet], PrecisionGoal -> 8], {is, -4, 4}]}, {id, -5, 5}], Flatten@{"s=", Range[-4, 4]}], Frame -> All, Background -> {{{White, Pink}}, {{Cyan, Yellow}}}]  The result of comparison$\begin{array}{cccccccccc} \text{s=} & -4 & -3 & -2 & -1 & 0 & 1 & 2 & 3 & 4 \\ \text{d=-5} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=-4} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=-3} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=-2} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=-1} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=0} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=1} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=2} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=3} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=4} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \text{d=5} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} & \text{True} \\ \end{array}\$

shows that solution is valid for any integer orders s and d`.

Concluding the above stated, I have to avow, that the solution procedure is irrational and was found by the merest chance. A more systematic approach to solution of integrals with integer orders of Bessel functions is still required.