Integrals of Bessel functions
- To: "mathgroup" <mathgroup at yoda.ncsa.uiuc.edu>
- Subject: Integrals of Bessel functions
- From: "WILLIAM M. GOLDING" <golding at ccf4.nrl.navy.mil>
- Date: 21 Jan 91 16:39:00 EST
> Date: Wed, 9 Jan 91 9:26:57 PST > From: Bad Religion <tcrevier at jarthur.Claremont.edu> > To: mathgroup at yoda.ncsa.uiuc.EDU > Subject: Mathematica mailing list > Anyone know of a way to get mathematica to symbollically integrate > Bessel J functions? > -Tom Tom, It's certainly possible to get Mathematica to integrate symbolically any of the special functions, but you have to be able to add rules to the Integrate function. This is done with the sequence, Unprotect[Integrate] ... Add your definitions here ... Protect[Integrate] The next problem is what rules to add. That involves some work. I'd suggest writing down one particular integral involving Bessel functions that you're interested in and trying to get Mathematica to evaluate it correctly. Once you've done that, generalizations to other particular cases should be straight forward. You should also refer to pages 231-234 and 425-426 of the Mathematica book for examples of defining your own integrate function and of modifying the built-in Integrate function. Here is an example allowing you to do simple indefinite integrals of BesselJ functions. The definitions for StruveH are given in the package struve.m which is available in the archives of this site in the files /Symbolic/Mathematica/Packages/Programming_in_Mathematic1 and ...2 These files are the listings of the routines of the book by Roman Maeder. For testing, I just have all these commands placed in a file called bessint.m which can be input directly into Mathematica. <<"rmpack\\struve.m" (* This should refer to struve.m on your system *) Unprotect[Integrate] Integrate[BesselJ[0,z_],z_]:=z BesselJ[0,z] + Pi z/2 ( StruveH[0,z] BesselJ[1,z] - StruveH[1,z] BesselJ[0,z] ) Integrate[BesselJ[1,z_],z_]:= - BesselJ[0,z] Integrate[BesselJ[n_Integer,z_],z_]:= Integrate[BesselJ[n-2,z],z] - 2 BesselJ[n-1,z] /; n > 1 Protect[Integrate] Mathematica (MS-DOS 386/7) 1.2 (September 27, 1989) [With pre-loaded data] by S. Wolfram, D. Grayson, R. Maeder, H. Cejtin, S. Omohundro, D. Ballman and J. Keiper with I. Rivin, D. Withoff and T. Sherlock Copyright 1988,1989 Wolfram Research Inc. In[1]:= <<bessint.m (* the file of definitions described above *) Out[1]= {Integrate} (* Here is a sample of some of the lower order integer order bessel functions *) In[2]:= Integrate[BesselJ[0,x],x] Out[2]= x BesselJ[0, x] + Pi x (BesselJ[1, x] StruveH[0, x] - BesselJ[0, x] StruveH[1, x]) > ---------------------------------------------------------------- 2 In[3]:= Integrate[BesselJ[1,x],x] Out[3]= -BesselJ[0, x] In[4]:= Integrate[BesselJ[2,x],x] Out[4]= x BesselJ[0, x] - 2 BesselJ[1, x] + Pi x (BesselJ[1, x] StruveH[0, x] - BesselJ[0, x] StruveH[1, x]) > ---------------------------------------------------------------- 2 In[5]:= Integrate[BesselJ[3,x],x] Out[5]= -BesselJ[0, x] - 2 BesselJ[2, x] In[6]:= Integrate[BesselJ[4,x],x] Out[6]= x BesselJ[0, x] - 2 BesselJ[1, x] - 2 BesselJ[3, x] + Pi x (BesselJ[1, x] StruveH[0, x] - BesselJ[0, x] StruveH[1, x]) > ---------------------------------------------------------------- 2 In[7]:= Integrate[BesselJ[5,x],x] Out[7]= -BesselJ[0, x] - 2 BesselJ[2, x] - 2 BesselJ[4, x] (* As I was playing with these Bessel functions I found that mathematica already knew how to do integrals of the half integral order Bessel functions *) In[8]:= Integrate[BesselJ[5/2,x],x] -I -- Sqrt[2] Erf[Sqrt[-I] Sqrt[x]] 2 Sqrt[2] Cos[x] 2 Out[8]= ---------------- + -------------------------------- + Sqrt[Pi] Sqrt[x] Sqrt[-I] I - Sqrt[2] Erf[Sqrt[I] Sqrt[x]] 2 2 Sqrt[2] Sin[x] > ------------------------------ - ---------------- Sqrt[I] 3/2 Sqrt[Pi] x (* But you need to use for instance BesselJ[5/2,x] rather than BesselJ[2.5,x], otherwise you simply get the bessel function replaced this series under the integrate function *) In[9]:= Integrate[BesselJ[2.5,x],x] Out[9]= Integrate[(0.797884560802865 3. Cos[-4.71239 + x] 3. Sin[-4.71239 + x] > (0. + Cos[-4.71239 + x] - -------------------- - --------------------) 2 x x > ) / Sqrt[x], x] Anyways, No guarantees that the above works for all or almost all cases. But I think you see that it is possible to extend the integrate function to include the special functions to some degree. Mike Golding