TransWikia.com

Integrating twice gives a different result than a double integral

Mathematica Asked on October 22, 2021

I would like to compute the following double integral:
$$
int_{-1/2}^{0}int_{-v}^{1+v} frac{2}{1-(u^2-v^2)} dudv = frac{pi^2}{12}
$$

When I do this using using

Integrate[2/(1 - (u^2 - v^2)), {v, -1/2, 0}, {u, -v, 1 + v}]
π^2/12

the result is $pi^2/12$ as expected (It took me a while to figure out the strange convention that the first argument to Integrate is the outer variable).

However when I try to do the calculation in two steps like

Integrate[2/(1 - (u^2 - v^2)), {u, -v, 1 + v}, GenerateConditions -> False]
-((2 (ArcTan[v/Sqrt[-1 - v^2]] + ArcTan[(1 + v)/Sqrt[-1 - v^2]]))/Sqrt[-1 - v^2])
Integrate[ %, {v, -1/2, 0}]
1/12 (π^2 + 3 ArcCosh[7/2] ArcCsch[2] - 12 ArcTanh[1/Sqrt[5]]^2)

the result is different (I added GenerateConditions -> False just for speed, it doesn’t seem to change the result).

Why is that? What do I have to do to get the same result for the integration also in two steps?

3 Answers

PossibleZeroQ will numerically check for zero if standard transformations do not work. It, being numerical, is not foolproof, and so it is not a complete rigorous method. For that reason, @Artes' method is superior in this case.

Simplify[
 1/12 (π^2 + 3 ArcCosh[7/2] ArcCsch[2] - 
    12 ArcTanh[1/Sqrt[5]]^2),
 TransformationFunctions -> {Automatic, # /. _?PossibleZeroQ :> 0 &}]
`Simplify::ztest1`: Unable to decide whether numeric quantity `-3 (-Log[1+Times[<<2>>]]+Log[1+1/Sqrt[5]])^2+3 Log[1/2+Sqrt[5]/2] Log[7/2+(3 Sqrt[5])/2]` is equal to zero. Assuming it is.
(*  π^2/12  *)

Simplify caches results, so the message only appears on first execution.

Answered by Michael E2 on October 22, 2021

The results are the same, as

3 ArcCosh[7/2] ArcCsch[2]-12 ArcTanh[1/Sqrt[5]]^2

is actually zero. Mathematica does not seem to realize that, even with FullSimplify, but you can check it numerically up to a high number of digits

N[1+3 ArcCosh[7/2] ArcCsch[2]-12 ArcTanh[1/Sqrt[5]]^2,200]
1.00000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000

Answered by Hausdorff on October 22, 2021

You should add assumptions on v or simplify the result of the first integral with appropriate assumptions.

Integrate[ Integrate[2/(1 - (u^2 - v^2)), {u, -v, 1 + v}, 
           Assumptions -> -1/2 <= v <= 0], {v, -1/2, 0}]
 Pi^2/12

Originally the first integral yields the result in terms of ArcTan, however with assumptions we get slightly different expression which after another integration avoids possible issues with terms hard to simplify.

Refine[ Integrate[2/(1 - (u^2 - v^2)), {u, -v, 1 + v}, Assumptions -> -1/2 <= v <= 0], 
        -1/2 < v < 0]
  (2 (ArcSinh[v] + ArcTanh[(1 + v)/Sqrt[1 + v^2]]))/Sqrt[1 + v^2]

alternatively we can get it with

FullSimplify[ -((2(ArcTan[v/Sqrt[-1 - v^2]] 
              + ArcTan[(1 + v)/Sqrt[-1 - v^2]]))/Sqrt[-1 - v^2]), -1/2 <= v < 0]

Edit

In the comments there have appeared some doubts whether the integral converges since the integrand diverges as $v to 0$. To demonstrate the convergence we can follow along standard mathematical techniques or exploit appropriate Mathematica functionality. We are going to make use of the newest functions. The first integral yields $$ int_{-1/2}^{0}int_{-v}^{1+v} frac{2}{1-(u^2-v^2)} dudv = int_{-frac{1}{2}}^0frac{2left(operatorname{arcsh}(v)+operatorname{arcth}(frac{1+v}{sqrt{1+v^2}}) right)}{sqrt{1+v^2}} dv $$ The first term in the integral is not harmful and so we take a closer look at the second one. Now we can show

Asymptotic[2 ArcTanh[(1 + v)/Sqrt[1 + v^2]]/Sqrt[1 + v^2], v -> 0]
-Log[v]

and integrating it with respect to $v$ we can see that the integral converges as the upper integration limit approaches to $0$ from below. Moreover

AsymptoticLessEqual[(2 (ArcTanh[(1 + v)/Sqrt[1 + v^2]]))/Sqrt[1 + v^2],-Log[-v],
                     v -> 0, Direction -> +1]
True

This means that we can find a constant $c$ such that $frac{2operatorname{arcth}(frac{1+v}{sqrt{1+v^2}}) }{sqrt{1+v^2}} leq c log(-v)$ for any $v<0$, taking e.g. $c=2$ we can see

Plot[{(2 (ArcTanh[(1 + v)/Sqrt[1 + v^2]]))/Sqrt[1 + v^2], -2 Log[-v]},
      {v, -1/2, 0}, PlotStyle -> Thick]

enter image description here

These arguments clarify that the integral actually exists. One can also calculate this integral

res = Integrate[(2 (ArcTanh[(1 + v)/Sqrt[1 + v^2]]))/Sqrt[1 + v^2], {v, -1/2, z}, 
           Assumptions -> -1/2 < z < 0]

and then calculate the limit

Limit[ res, z -> 0, Direction -> "FromBelow"]

We have proved, that Mathematica correctly deals with this type of the integrand.

Answered by Artes on October 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP