2
$\begingroup$

I want to evaluate the following integral: $$\int_{\left(1-\sqrt{a}\right)^{2}}^{\left(1+\sqrt{a}\right)^{2}} \frac{1}{2\pi x}\sqrt{\left(\left(1+\sqrt{a}\right)^{2}-x\right)\left(x-\left(1-\sqrt{a}\right)^{2}\right)}\operatorname{d}\!x$$

$a\in\left(0,\infty\right)$ is a real parameter.

The radicand is equal to $$\left(\left(1+\sqrt{a}\right)^{2}-x\right)\left(x-\left(1-\sqrt{a}\right)^{2}\right) = 4a -\left(x-\left(1+a\right)\right)^{2}\text{,}$$ and Mathematica agrees on that:

FullSimplify[((1 + Sqrt[a])^2 - x) (x - (1 - Sqrt[a])^2) - (4 a - (x - (1 + a))^2)]
(* 0 *)

With Mathematica, I get two different solutions:

FullSimplify[Integrate[1/(2 π*x) Sqrt[((1 + Sqrt[a])^2 - x) (x - (1 - Sqrt[a])^2)], {x, (1 - Sqrt[a])^2, (1 + Sqrt[a])^2}, Assumptions -> {x ∈ Reals, a ∈ Reals && a > 1}]]
(* a *)

FullSimplify[Integrate[1/(2 π*x) Sqrt[4 a - (x - (1 + a))^2], {x, (1 - Sqrt[a])^2, (1 + Sqrt[a])^2}, Assumptions -> {x ∈ Reals, a ∈ Reals && a > 1}]]
(* 1 *)

If I set $a:=2$, I get

Integrate[1/(2 π*x) Sqrt[((1 + Sqrt[2])^2 - x) (x - (1 - Sqrt[2])^2)], {x, (1 - Sqrt[2])^2, (1 + Sqrt[2])^2}, Assumptions -> {x ∈ Reals}]
(* 2 *)

Integrate[1/(2 π*x) Sqrt[4*2 - (x - (1 + 2))^2], {x, (1 - Sqrt[2])^2, (1 + Sqrt[2])^2}, Assumptions -> {x ∈ Reals}]
(* 2 *)

But if I integrate numerically, I get the following:

NIntegrate[1/(2 π*x) Sqrt[((1 + Sqrt[2])^2 - x) (x - (1 - Sqrt[2])^2)], {x, (1 - Sqrt[2])^2, (1 + Sqrt[2])^2}]
( 1. *)

NIntegrate[1/(2 π*x) Sqrt[4*2 - (x - (1 + 2))^2], {x, (1 - Sqrt[2])^2, (1 + Sqrt[2])^2}]
(* 1. *)

What is right and why doe Mathematica evaluate two (seemingly?!) equivalent expressions to different results?

Edit I use Mathematica v. 9.0.1.0 (Win64).

I tried it with blank new noteboooks, different variables, ClearAll and so forth, but I got the above solutions.

$\endgroup$
  • 2
    $\begingroup$ I don't get the same results you get. For instance, the first two integrals you mention both calculate to $1$ on my machine (v.10.1 Win7-64): screenshot. Have you tried again in a fresh session on MMA? I think you might have had some spurious definitions polluting your evaluation. $\endgroup$ – MarcoB Jun 15 '15 at 18:41
  • 1
    $\begingroup$ I have same results as OP on Mathematica 10.0.1.0 $\endgroup$ – BlacKow Jun 15 '15 at 20:07
  • 1
    $\begingroup$ I get the same as @MarcoB, both integrals evaluate to 1 on V10.1, Mac OS. (The function Integrate is updated every version, so including version information is helpful.) $\endgroup$ – Michael E2 Jun 16 '15 at 4:13
  • 1
    $\begingroup$ Version 9.0.1, the same as you. I get 1 for both of the first two integrals, not a, so I would consider this part of the question irreproducible (although apparently it is reproducible with some versions of Mathematica 10?). But I also see the difference between Integrate giving 2 and NIntegrate giving 1. That, I cannot explain. Note that, when Assumptions are not specified, a different answer is produced that evaluates to 1 at machine precision (but not otherwise, in which case it is Indeterminate). I am not sure if this is actually a correct answer, but it seems doubtful. $\endgroup$ – Oleksandr R. Jun 17 '15 at 0:41
  • 2
    $\begingroup$ I'm voting to close this question as off-topic because the problem the user is experiencing can not be reproduced by others. $\endgroup$ – m_goldberg Sep 1 '15 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.