Re: Two small problems compute OK, but not their sum.

• To: mathgroup at smc.vnet.net
• Subject: [mg71028] [mg70991] Re: Two small problems compute OK, but not their sum.
• From: "David W. Cantrell" <DWCantrell at sigmaxi.net>
• Date: Mon, 6 Nov 2006 02:52:24 -0500 (EST)
• References: <ei9okv\$20i\$1@smc.vnet.net> <eicmvq\$fqe\$1@smc.vnet.net>

```"Ray Koopman" <koopman at sfu.ca> wrote:
> aaronfude at gmail.com wrote:
> > Hi,
> >
> > I needed to intergate a linear function times Log of something, and
> > Mathematica would give me a too-compicated answer. So I broke it up
> > into two smaller programs and it worked much better as you can see
> > below. Although the answer is probably correct in both cases,

No, it's not. See below.

> > I'm just trying to understand why the difference in appearance is quite
> > so significant.
> >
> > Thanks!
> >
> > Aaron Fude
> >
> > In[31]:=
> > Zero=A*Log[c^2+x^2]/2;
> > One=(B-A)/a*x*Log[c^2+x^2]/2;
> > Assuming[a>0&&c>0, Integrate[Zero, {x, 0, a}]]
> > Assuming[a>0&&c>0, Integrate[One, {x, 0, a}]]
> > Assuming[a>0&&c>0, Integrate[Zero+One, {x, 0, a}]]
> >
> > Out[33]=
> > \!\(1\/2\ A\ \((2\ c\ ArcTan[a\/c] + a\ \((\(-2\) + Log[a\^2 +
> > c\^2])\))\)\)
> >
> > Out[34]=
> > \!\(\(-\(\(\((A -
> >       B)\)\ \((\(-a\^2\) - 2\ c\^2\ Log[
> >             c] + \((a\^2 + c\^2)\)\ Log[a\^2 + c\^2])\)\)\/\(4\
> > a\)\)\)\)
> >
> > Out[35]=
> > \!\(\(\(1\/\(4\ a\ c\)\)\((\(-\[ImaginaryI]\)\ a\
> >     A\ \((a\^2 + c\^2)\)\ HypergeometricPFQ[{1\/2, 1, 1}, {2,
> >           2}, 1 + a\^2\/c\^2] + c\ \((\((
> >           a + \[ImaginaryI]\ c)\)\ \((a\ \((A + B)\) + \[ImaginaryI]\
> > \((A - \
> > B)\)\ c)\)\ Log[1 + a\^2\/c\^2] + a\ \((a\ \((A -
> >       B)\) - 2\ \[ImaginaryI]\ A\ c\ \((\(-2\) + Log[4])\) + 2\ a\ \((A
> > +
> >                 B)\)\ Log[c])\))\))\)\)\)
>
> Zero = A*Log[c^2+x^2]/2;
> One = (B-A)/a*x*Log[c^2+x^2]/2;
>
> Assuming[a > 0 && c > 0, i0 = Integrate[Zero, {x, 0, a}]]
>
> (A*(2*c*ArcTan[a/c] + a*(-2 + Log[a^2 + c^2])))/2
>
> Assuming[a > 0 && c > 0, i1 = Integrate[One, {x, 0, a}]]
>
> -((A - B)*(-a^2 - 2*c^2*Log[c] + (a^2 + c^2)*Log[a^2 + c^2]))/(4*a)
>
> The divisions by 2 in Zero and One make Integrate[Zero + One, ...]
> too complicated, so factor them out:
>
> Assuming[a > 0 && c > 0, i01 = Integrate[2 Zero + 2 One, {x, 0, a}]/2]
>
> (-(a^2*(3*A + B)) + 4*a*A*c*ArcTan[a/c] + 2*(A - B)*c^2*Log[c] +
>   (a^2*(A + B) + (-A + B)*c^2)*Log[a^2 + c^2])/(4*a)
>
> Simplify[i0 + i1 == i01]
>
> True

It must be noted that the "too-complicated" result, Aaron's Out[35] above,
produced by integrating Zero + One, is not merely "too-complicated" -- it's
simply incorrect! This is, I suspect, a genuine bug.

David Cantrell

```

• Prev by Date: Re: ExactRootIsolation
• Next by Date: Re: find roots
• Previous by thread: Re: Two small problems compute OK, but not their sum.
• Next by thread: Context headache