MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: bugs in Mathematica 5.1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54068] Re: bugs in Mathematica 5.1
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 9 Feb 2005 09:27:51 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <cua579$hgs$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <cua579$hgs$1 at smc.vnet.net>,
 "Gennady Stupakov" <stupakov at yahoo.com> wrote:

> Second is a more complicated integral that I recently encounted in my
> research.
> 
> In[2]:=Integrate[E^(a*Cos[x] - b*Cos[2*x]), {x, 0, 2*Pi},
> GenerateConditions -> True]
> Out[2]=If[Re[a] < Re[b], 2*Pi*BesselI[0, -a + b], Integrate[E^(a*Cos[x] -
> b*Cos[2*x]), {x, 0,
> 2*Pi},Assumptions -> Re[a] >= Re[b]]]
> 
> Let us check this result comparing it with numerical integration for, say,
> b=2 and a=1:
> 
> In[3]:=
> b = 2.;
> a = 1.;
> {Integrate[E^(a*Cos[x] - b*Cos[2*x]), {x, 0, 2*Pi}], NIntegrate[E^(a*Cos[x]
> + b*Cos[2*x]),
> {x, 0, 2*Pi}]}
> Out[5]={7.95493, 20.8711}
> 
> Again, the analytical result is wrong.

Actually, you have changed the sign of part of the integrand:

  Integrate[E^(a*Cos[x] - b*Cos[2*x]), {x, 0, 2*Pi}],   
  NIntegrate[E^(a*Cos[x] + b*Cos[2*x]), {x, 0, 2*Pi}]

Nevertheless, the analytic solution is indeed incorrect. To evaluate 
such integrals in general you can use

  http://functions.wolfram.com/03.02.23.0007.01 

followed by straighforward trig (Fourier) integrals.

For example, 

  Integrate[E^(a Cos[x] + b Cos[2 x]), {x, 0, 2 Pi}] ==
  2 Pi Sum[BesselI[2 m, a] BesselI[m, b], {m, -Infinity, Infinity}]

Although from http://functions.wolfram.com/03.02.16.0007.01,

 BesselI[0,a+b]==Sum[BesselI[m,a] BesselI[m,b], {m,-Infinity,Infinity}]

as far as I am aware, there is no simpler closed-form for the sum 
involving BesselI[2 m, a]. 

This (doubly) infinite sum is rapidly convergent. For example

  2 Pi Sum[BesselI[2 m, a] BesselI[m, b], {m, -4, 4}] /. 
    {b -> 2., a -> 1.}

agrees with the result from NIntegrate to better than 1 part in 10^10.

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 6488 2734
School of Physics, M013                         Fax: +61 8 6488 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: Summary: Which[] as Textbook Input, Plot[] Questions
  • Next by Date: Re: Summary: Which[] as Textbook Input, Plot[] Questions
  • Previous by thread: Re: bugs in Mathematica 5.1
  • Next by thread: Re: bugs in Mathematica 5.1