       Re: Numerical integration

• To: mathgroup at smc.vnet.net
• Subject: [mg79675] Re: [mg79621] Numerical integration
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Wed, 1 Aug 2007 05:12:22 -0400 (EDT)

```Version 6 appears to have a problem with this integral.

\$Version

6.0 for Mac OS X x86 (32-bit) (June 19, 2007)

expr1 = Integrate[Log[1 + z^2]*(BesselJ[1, z]^2/z), {z, 0, Infinity}]

(1/2)*HypergeometricPFQ[{1/2},
{1, 2}, 1]*(1 - 2*EulerGamma +
Log)

expr2 = expr1 // FunctionExpand // Simplify

(-(1/2))*(BesselI[0, 1]^2 -
BesselI[1, 1]^2)*
(-1 + 2*EulerGamma - Log)

expr1 // N

0.790559

expr2 // N

0.790559

NIntegrate[Log[1 + z^2]*(BesselJ[1, z]^2/z), {z, 0, Infinity}]

0.869058

Bob Hanlon

---- dimitris <dimmechan at yahoo.com> wrote:
> In:=
> Integrate[Log[1 + z^2]*(BesselJ[1, z]^2/z), {z, 0, Infinity}]
> N[%, 10]
>
> Out=
> MeijerG[{{1/2}, {}}, {{0, 0}, {-1}}, 1]/(2*Sqrt[Pi])
>
> Out=
> 0.8732180258611361020606751916`10.
>
> On another CAS I took,
>
> convert("Integrate[Log[1 + z^2]*(BesselJ[1, z]^2/z), {z, 0,
> Infinity}]",FromMma,evaluate);
> evalf(%,20);
>
>            1/2
>   1/2 (2 Pi    BesselI(0, 1) BesselK(0, 1)
>
>                1/2                                /   1/2
>          + 2 Pi    BesselK(1, 1) BesselI(1, 1))  /  Pi
>                                                 /
>
>                         0.87321802586113613925
>
> Both CAS return the same symbolic result.
> [An interesting challenge is to simplify the MeijerG
> output of Mathematica to that of the other CAS]
>
> I want to check this symbolic result with NIntegrate.
> I have "played around" with the options but I could get
> "more closely" than
>
> In:=
> NIntegrate[Log[1+z^2]*(BesselJ[1,z]^2/z),{z,
>       0, },MaxRecursion\[Rule]18]//InputForm
>
> >From In:=
> \!\(\*
>   RowBox[{\(NIntegrate::"slwcon
>       "\), \(\(:\)\(\ \)\), "\<\"Numerical integration
>     converging too slowly; suspect
>     one of the following: singularity, value of the integration being
> 0, \
> oscillatory integrand, or insufficient WorkingPrecision. If your
> integrand is \
> oscillatory try using the option Method->Oscillatory in NIntegrate. \
> \", \
> ButtonFrame->None, ButtonData:>\\\"NIntegrate::slwcon\\\"]\\)\"\>"}]\)
>
> >From In:=
> \!\(\*
>   RowBox[{\(NIntegrate::"ncvb"\), \(\(:\)\(\ \)\), "\<\"NIntegrate
> failed
>     to converge to prescribed accuracy
>     after \\!\\(19\\) recursive bisections in \\!\\(z\\) near \\!\\(z\
> \) = \
> \\!\\(35857.55603944016`\\). \\!\\(\\*ButtonBox[\\\"More...\\\", \
> ButtonData:>\\\"NIntegrate::ncvb\\\"]\\)\"\>"}]\)
>
> Out//InputForm=
> 0.8732193803103058
>
> I would be very happy if someone pointed a tactic for perfroming
> satisfactory numerical integration with mathematica for this integral.
> I use mathematica 5.2 but you can use Mathematica 6 as well!
>
> The integral arose in another forum. There it was pointed out that
> the performance of Mathematica 6 is buggy as regards numerical
> integration.
>
> I look forward to seeing any replies.
>
> Greetings from burning Greece!
>
> Dimitris
>
> PS
>
> See here
>