# Integration of product of BesselJ and BesselY not giving correct results

I am trying to integrate a product of Bessel functions as shown below. Where z is real valued and positive.

The integration yields MeijerG functions. Taking a ratio of the derivative of the MeijerG function to the original function does not yield correct results in some cases (see the function f[z]).

Any idea what's going on here?

f[z_] := BesselJ[1, z] BesselY[2, z] ;
(*  Edit : Originally I wrote g[z_] := BesselJ[0, z] BesselY[2, z]; which also is buggy and is what is used in the answer to this question   *)
g[z_] := BesselJ[2, z] BesselY[2, z];
(*Integration of functions over z*)
temp1 = Integrate[f[z], z]
temp2 = Integrate[g[z], z]
(*
-(MeijerG[{{1/2}, {-(1/2), 1}}, {{0, 0, 2}, {-1, -(1/2)}}, z, 1/2]/(
2 Sqrt[\[Pi]]))

-(MeijerG[{{1, 1}, {-1, 1/2}}, {{-(1/2), 3/2, 3/2}, {-1, -(1/2), 0}},
z, 1/2]/(2 Sqrt[\[Pi]]))

*)
(************)
(*Now take the ratio of derivative of the MeijerG Function too the original function.
This should evaluate to 1 if the results match*)

(*Numerically this does not match*)
Table[
D[temp1, z]/(f[z]) /. {z -> RandomReal[{0.1, 10}]}, {i, 1, 3}]
(*Numerically this does match*)
Table[
D[temp2, z]/(g[z]) /. {z -> RandomReal[{0.1, 10}]}, {i, 1, 3}]

(*
{0.0759936, 0.257989, 0.387316}

{1, 1, 1}
*)


• I think this is a bug. Or at least a limitation. Commented Oct 16, 2020 at 3:33

Both answers are wrong. Here are the correct answers: The first integral temp1 is off by Log[z]/Pi, the second one by 2/(Pi z). But, you know, integration is hard. Have pity. But it should be reported to WRI.
Plot[D[-Log[z]/Pi + temp1, z] - f[z] // Evaluate, {z, 1/10, 10},

Plot[D[2/(Pi z) + temp2, z] - g[z] // Evaluate, {z, 1/10, 10},

• @user75220 I played with plotting f[z] and the derivative of temp1, which look like they differ by a simple function, and made a blind guess. Neither FullSimplify nor MeijerGReduce would verify the result, so I resorted to numerical verification. Commented Oct 16, 2020 at 22:08