Re: Integrating a complicated expression involving Sign[...] etc.
- To: mathgroup at smc.vnet.net
- Subject: [mg56219] Re: Integrating a complicated expression involving Sign[...] etc.
- From: dh <dh at metrohm.ch>
- Date: Wed, 20 Apr 2005 05:29:50 -0400 (EDT)
- References: <d3t38d$8jd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Christian, I can not answer all your questions, try to be a bit more specific. Daniel Christian Mikkelsen 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? > > 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? try the following: Shallow[TreeForm[ expr ], depth ] with depth you can control how deep your tree is displayed. > > 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? Wrap your calculations into Assuming[assumptions, expr ] > > > ----- > (* 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}}; > > (* 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}]; > > (* 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}; > > 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}] >