Re: Integrating a complicated expression involving Sign[...] etc.

*To*: mathgroup at smc.vnet.net*Subject*: [mg56348] Re: Integrating a complicated expression involving Sign[...] etc.*From*: Paul Abbott <paul at physics.uwa.edu.au>*Date*: Fri, 22 Apr 2005 06:23:40 -0400 (EDT)*Organization*: The University of Western Australia*References*: <d3t38d$8jd$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <d3t38d$8jd$1 at smc.vnet.net>, Christian Mikkelsen <s010132 at student.dtu.dk> wrote: > I want to ask some general questions. I get some very complicated > intermediate results (see expressions below) that Mathematica does not > proces (Integrate) within a day or two. > > 1) Does it normally pay off just leaving it to it? If Mathematica is still > running does it mean that it is doing meaningful transformations and > calculations? Usually very unlikely. > 2) I would like to understand the structure of some of the intermediate > results ("Thetaintegrant" in particular) to see if Mathematica might need > a little help (see my earlier post and the kludge below). Is there any > good way to do that? Using TreeForm, for example if I could just look at > the upper most levels of the expression tree? Mathematica certainly needs some help here ... > > 3) My problem seems to have a lot of structure so I am hopeful that > something can be done to help Mathematica a little. > > Oh, and a easy one... :-) > 4) How do I use $Assumptions to tell Mathematica that A is real etc. > globally? This is possible, but usually not useful. > (* This is actually a spherical Bessel-function *) > j[k_, n_] = ((-I)^n*Sqrt[2*Pi]*BesselJ[1/2 + n, k])/Sqrt[k] > > (* A, B, C are to substituted by sines and cosines to make up polar > coordinates *) > StorMatrix = {{B^2+C^2, A B, A C}, > {B A, A^2+C^2, B C}, > {C A, C B, A^2+B^2}}; Do you have areference for this matrix and the following computations? What is the application and derivation of the integral and matrix? Often it is better to go back to the mathematics to decide the best approach for a Mathematica implementation. Importantly, if the symbolic result ends up being too complicated, it is unlikely to be that useful -- especially if the final goal is numerical computation of a range of integrals. > (* My integrant in the case (0, 0) *) > Integrant = Simplify[StorMatrix j[k A, n] j[k B, m] j[k a, 0] Exp[I k (A > x + B y + C z)]/.{n->0, m->0}, > Assumptions -> {A \[Element] Reals, B \[Element] Reals, > C \[Element] Reals, a > 0, > x \[Element] Reals, y \[Element] Reals, > z \[Element] Reals}]; > > > (* Mathematica refuses to do the definite integral but happily does the > indefinite one *) > KIntegral = Integrate[Integrant, k, > Assumptions -> {A \[Element] Reals, B \[Element] Reals, > C \[Element] Reals, a > 0, > x \[Element] Reals, y \[Element] Reals, > z \[Element] Reals}]; A better approach is to identify exactly what you are trying to compute. For example, consider the following integral: Integrate[j[n, t] Exp[I w t], {t, -Infinity, Infinity}] where j[n, t] is a spherical Bessel function (reversing the order of the arguments compared to your definition -- acutally, j[n][t] is a better notation). This is, essentially, a much simpler version of your integral. However, even in this much simpler problem, Mathematica is not capable of computing this directly. However, it is just the Fourier transform of the spherical Bessel function, which is proportional to LegendreP[n, w] for -1 < w < 1. (Mathematica cannot compute this general Fourier transform directly either). The conclusion to draw from this though is that I expect that your general integral can be computed by suitable use of integral transforms. I note that at http://www.tcm.phy.cam.ac.uk/~pdh1001/thesis/node31.html the integral of a particular triple product of spherical Bessel functions is computed. > (* I calculate the lower limit, no problems here *) > Klowlimit = Limit[KIntegral, k -> 0, > Assumptions -> {A \[Element] Reals, B \[Element] Reals, > C \[Element] Reals, a > 0, > x \[Element] Reals, y \[Element] Reals, > z \[Element] Reals}]//Simplify; > > (* Upper limit, with ComplexExpand and cheating. True? *) > KinfIntegral = ComplexExpand[KIntegral] /. > {ExpIntegralEi[ I A_ k] -> Sign[ I A] Pi, > ExpIntegralEi[-I A_ k] -> Sign[-I A] Pi}; It should be possible to justify this type of approach (one that I often use). However, using Sign is probably not optimal. UnitStep is better (for example, Mathematica knows how to differentiate and inegrate UnitStep). Another approach would be to use Piecewise. > Kinflimit = Limit[KinfIntegral, k -> \[Infinity], > Assumptions -> {A \[Element] Reals, B \[Element] Reals, > C \[Element] Reals, a > 0, > x \[Element] Reals, y \[Element] Reals, > z \[Element] Reals}]; > > Thetaintegrant = (Kinflimit-Klowlimit)/.{A->Sqrt[1-w^2] P, B->Sqrt[1-w^2] > Q, C-> w}; > > (* Warning: Mathematica 5.1 gets stuck on this integral : *) > Thetaintegral = > Integrate[Thetaintegrant, {w, -1, 1}, > Assumptions -> {P >= -1, P <= 1, Q >= -1, Q <= 1, a > 0}] You could try interchanging the order of integration, k <-> w. It does not look promising to me though. 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