MathGroup Archive 2005

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

Search the Archive

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

  • To: mathgroup at
  • Subject: [mg56353] Re: Integrating a complicated expression involving Sign[...] etc.
  • From: Christian Mikkelsen <s010132 at>
  • Date: Fri, 22 Apr 2005 06:23:50 -0400 (EDT)
  • Organization: UNI-C
  • References: <d3t38d$8jd$> <>
  • Sender: owner-wri-mathgroup at

(This comment is rather long and there is no question to answer, however,
Paul Abbott deserves a reply.)

> > (* 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.

Actually, this comes from subtracting a unit matrix from a "dyadic" formed
from a unit vector K (as opposed to k; K = k/|k|):

   (K K - 1)

The A, B, and C are then really x, y, and z; or as I will substitute
later: Sin[Phi] Sin[Theta], Cos[Phi] Sin[Theta], and Cos[Theta].

> 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.

Well, the ultimate goal would be to get a result in closed form. :-)

> > (* 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).

Why is that? Does it matter to Mathematica or is it just for us humans?

> 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.

This is exactly how I get the spherical Bessel-function in the first
place. Basically, I am expanding in terms of Legendre-polynomials in real
space and Fourier-transforming to get to reciprocal space where my problem
is a lot simpler.

As a side note, what I am doing is solving the Stokes equation for a
viscous fluid and the mysterious (1 - K K) is actually the condition of
incompressibility. Anyway, let's leave that.

> (Mathematica cannot compute this general Fourier transform directly
> either).

No, by I can by hand :-)

> The conclusion to draw from this though is that I expect that your
> general integral can be computed by suitable use of integral transforms.

My hope was that I could get Mathematica to help me :-)

Just to be clear, I did try to "think" before plugging things into
Mathematica and I tried my best with Gradshtyen & Ryzhik and Prudnikov et
al. but I took the Mathematica route just to see if it could do it and to
my amazement it actually gave me an answer. If it had just plainly
refused, I would have tried thinking some more...

> I note that at
> the integral of a particular triple product of spherical Bessel
> functions is computed.

I greatly appreciate this reference and will study it closer.

> > (* 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.

Okay, because Mathematica is very keen on giving me results in terms of
Sign[...]. Maybe your advice can help me there.

> You could try interchanging the order of integration, k <-> w. It does
> not look promising to me though.

Anyway, I must tell you that I managed to do quite a lot about the
horrible intermediate result. (I already - almost - know that the
resulting matrix is diagonal and I have focused on just the [[1,1]]
entry.) I end up with a sum of eight terms each being Piecewise-defined
functions of the form:

(a + A (1+x) + B (1+y) + C z)^2 (Pi + I Log[(a + A (1+x) + B (1+y) + C z)^2]
                                     for (a + A (1+x) + B (1+y) + C z) > 0
(a + A (1+x) + B (1+y) + C z)^2 (-Pi + I Log[(a + A (1+x) + B (1+y) + C z)^2]
                                     for (a + A (1+x) + B (1+y) + C z) < 0

with alternating signs of the A, B, and C terms. Now, I realize that I
could avoid the piecewise-defined function by using Sign, or as you
suggest UnitStep, but I am not very optimistic about the evaluation of the
integrals resulting from the substitution A -> Sin[Phi] Sin[Theta] etc.
However, all this work has not been in vain as Mathematica seems happier
evaluating this function numerically.

Anyway, I have to say that "dh" got me on the right track when he
recommended "Shallow" as a means to start looking at the structure of my
result. Now, it was not the way to go but it helped me finding the right
places in the documentation to start and this was a great help.

> Paul Abbott                                   Phone: +61 8 6488 2734
> The University of Western Australia      (CRICOS Provider No 00126G)

Funnily, I am actually going to Western Australia in a month :-)

Best regards,


  • Prev by Date: Re: Re: (x-y) DiracDelta[x-y] does not simplify to 0
  • Next by Date: Re: Integrating a complicated expression involving Sign[...] etc.
  • Previous by thread: Re: Integrating a complicated expression involving Sign[...] etc.
  • Next by thread: Re: Integrating a complicated expression involving Sign[...] etc.