# Evaluation of an integral using Mathematica

I am trying to evaluate the following integral, but the result I got is imaginary part. Do you know if there is a way to get a better evaluation of difficult integrals?

In S = Integrate[1/(Pi*Sqrt[(1/a) - (1/x)]*Sqrt[(1/x) - (1/b)]*(1 - B*x^2)), {x, a,b}]


where, a, b >0, b>a.

If you have any suggestions on how to evaluate this, let me know. Thank you in advance.

• Should B be b? – N.J.Evans Sep 7 '18 at 13:14
• No, they are different. – Mounia Hamidouche Sep 7 '18 at 13:16

If you restrict B to be real

S = Assuming[b > a > 0 && Element[B, Reals], Integrate[
1/(Pi*Sqrt[(1/a) - (1/x)]*Sqrt[(1/x) - (1/b)]*(1 - B*x^2)),
{x, a, b}] // Simplify]

(* ConditionalExpression[(Sqrt[
a b] (Sqrt[-(-1 + a Sqrt[B]) (-1 + b Sqrt[B])] Log[-1 - a Sqrt[B]] +
Sqrt[-(1 + a Sqrt[B]) (1 + b Sqrt[B])] Log[1 - a Sqrt[B]] -
Sqrt[-(1 + a Sqrt[B]) (1 + b Sqrt[B])] Log[-1 + b Sqrt[B]] -
Sqrt[-(-1 + a Sqrt[B]) (-1 + b Sqrt[B])] Log[1 + b Sqrt[B]] -
Sqrt[-(1 + a Sqrt[B]) (1 + b Sqrt[B])] Log[Sqrt[B] - a B] -
Sqrt[-(-1 + a Sqrt[B]) (-1 + b Sqrt[B])] Log[Sqrt[B] + a B] +
Sqrt[-(1 + a Sqrt[B]) (1 + b Sqrt[B])] Log[Sqrt[B] - b B] +
Sqrt[-(-1 + a Sqrt[B]) (-1 + b Sqrt[B])]
Log[Sqrt[B] + b B]))/(2 Sqrt[-(-1 + a Sqrt[B]) (-1 + b Sqrt[B])]
Sqrt[-(1 + a Sqrt[B]) (1 + b Sqrt[B])] Sqrt[
B] π), ((B > 0 && 1/b^2 >= B) || B < 0 ||
1/a^2 <= B) && (a >= Re[1/Sqrt[B]] || b <= Re[1/Sqrt[B]] ||
Sqrt[B] ∉ Reals)] *)


Or for the more restrictive case of B > 0

S = Assuming[b > a > 0 && B > 0, Integrate[
1/(Pi*Sqrt[(1/a) - (1/x)]*Sqrt[(1/x) - (1/b)]*(1 - B*x^2)),
{x, a, b}] // Simplify]

(* ConditionalExpression[(
Sqrt[a b] (-Sqrt[1 - (a + b) Sqrt[B] + a b B] + Sqrt[
1 + (a + b) Sqrt[B] + a b B]))/(2 Sqrt[B (-1 + a^2 B) (-1 + b^2 B)]),
1/b^2 > B] *)


EDIT: Example

S /. {a -> 1, b -> 2, B -> 1/8} // FullSimplify

(* 4 Sqrt[2/7 (5 - Sqrt[7])] *)

% // N

(* 3.28059 *)