MathGroup Archive 2006

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70943] Re: Two small problems compute OK, but not their sum.
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Thu, 2 Nov 2006 06:47:54 -0500 (EST)
  • References: <ei9okv$20i$1@smc.vnet.net>

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


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