\(\int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx\) [45]

Optimal result
Mathematica [A] (warning: unable to verify)
Rubi [F]
Maple [F]
Fricas [B] (verification not implemented)
Sympy [F]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 23, antiderivative size = 337 \[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\sqrt {2} \left (\sqrt {-1+\sqrt {2}} \arctan \left (\frac {\sqrt {-2+2 \sqrt {2}} \left (-\sqrt {2}-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}\right )}{2 \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}\right )-\sqrt {1+\sqrt {2}} \arctan \left (\frac {\sqrt {2+2 \sqrt {2}} \left (-\sqrt {2}-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}\right )}{2 \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}\right )-\sqrt {1+\sqrt {2}} \text {arctanh}\left (\frac {\sqrt {-2+2 \sqrt {2}} \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}{\sqrt {2}-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}\right )+\sqrt {-1+\sqrt {2}} \text {arctanh}\left (\frac {\sqrt {2+2 \sqrt {2}} \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}{\sqrt {2}-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}\right )\right ) \cot (x) \sqrt {-1+\sec (x)} \sqrt {1+\sec (x)} \] Output:

cot(x)*2^(1/2)*(-1+sec(x))^(1/2)*(1+sec(x))^(1/2)*(arctan(1/2*(-2^(1/2)-(- 
1+sec(x))^(1/2)+(1+sec(x))^(1/2))*(-2+2*2^(1/2))^(1/2)/(-(-1+sec(x))^(1/2) 
+(1+sec(x))^(1/2))^(1/2))*(2^(1/2)-1)^(1/2)+arctanh((2+2*2^(1/2))^(1/2)*(- 
(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^(1/2)/(2^(1/2)-(-1+sec(x))^(1/2)+(1+se 
c(x))^(1/2)))*(2^(1/2)-1)^(1/2)-arctan(1/2*(-2^(1/2)-(-1+sec(x))^(1/2)+(1+ 
sec(x))^(1/2))*(2+2*2^(1/2))^(1/2)/(-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^( 
1/2))*(1+2^(1/2))^(1/2)-arctanh((-2+2*2^(1/2))^(1/2)*(-(-1+sec(x))^(1/2)+( 
1+sec(x))^(1/2))^(1/2)/(2^(1/2)-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2)))*(1+2^ 
(1/2))^(1/2))
 

Mathematica [A] (warning: unable to verify)

Time = 2.82 (sec) , antiderivative size = 552, normalized size of antiderivative = 1.64 \[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\frac {\sqrt [4]{2} \cos (x) \left (\sqrt {-1+\sec (x)}-\sqrt {1+\sec (x)}\right )^2 \left (2 \arctan \left (\cot \left (\frac {\pi }{8}\right )-\frac {\csc \left (\frac {\pi }{8}\right ) \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}{\sqrt [4]{2}}\right ) \cos \left (\frac {\pi }{8}\right )-2 \arctan \left (\cot \left (\frac {\pi }{8}\right )+\frac {\csc \left (\frac {\pi }{8}\right ) \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}{\sqrt [4]{2}}\right ) \cos \left (\frac {\pi }{8}\right )+\cos \left (\frac {\pi }{8}\right ) \log \left (2+\sqrt {2} \left (-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}\right )-2\ 2^{3/4} \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \sin \left (\frac {\pi }{8}\right )\right )-\cos \left (\frac {\pi }{8}\right ) \log \left (2+\sqrt {2} \left (-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}\right )+2\ 2^{3/4} \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \sin \left (\frac {\pi }{8}\right )\right )+2 \arctan \left (\frac {\sec \left (\frac {\pi }{8}\right ) \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}{\sqrt [4]{2}}-\tan \left (\frac {\pi }{8}\right )\right ) \sin \left (\frac {\pi }{8}\right )+2 \arctan \left (\frac {\sec \left (\frac {\pi }{8}\right ) \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}}{\sqrt [4]{2}}+\tan \left (\frac {\pi }{8}\right )\right ) \sin \left (\frac {\pi }{8}\right )-\log \left (2-2\ 2^{3/4} \cos \left (\frac {\pi }{8}\right ) \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}+\sqrt {2} \left (-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}\right )\right ) \sin \left (\frac {\pi }{8}\right )+\log \left (2+\sqrt [4]{2} \csc \left (\frac {\pi }{8}\right ) \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}}+\sqrt {2} \left (-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}\right )\right ) \sin \left (\frac {\pi }{8}\right )\right ) \sin (x)}{-1+\cos (2 x)+2 \cos (x) \sqrt {-1+\sec (x)} \sqrt {1+\sec (x)}} \] Input:

Integrate[Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + Sec[x]]],x]
 

Output:

(2^(1/4)*Cos[x]*(Sqrt[-1 + Sec[x]] - Sqrt[1 + Sec[x]])^2*(2*ArcTan[Cot[Pi/ 
8] - (Csc[Pi/8]*Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + Sec[x]]])/2^(1/4)]*Cos[ 
Pi/8] - 2*ArcTan[Cot[Pi/8] + (Csc[Pi/8]*Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + 
 Sec[x]]])/2^(1/4)]*Cos[Pi/8] + Cos[Pi/8]*Log[2 + Sqrt[2]*(-Sqrt[-1 + Sec[ 
x]] + Sqrt[1 + Sec[x]]) - 2*2^(3/4)*Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + Sec 
[x]]]*Sin[Pi/8]] - Cos[Pi/8]*Log[2 + Sqrt[2]*(-Sqrt[-1 + Sec[x]] + Sqrt[1 
+ Sec[x]]) + 2*2^(3/4)*Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + Sec[x]]]*Sin[Pi/ 
8]] + 2*ArcTan[(Sec[Pi/8]*Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + Sec[x]]])/2^( 
1/4) - Tan[Pi/8]]*Sin[Pi/8] + 2*ArcTan[(Sec[Pi/8]*Sqrt[-Sqrt[-1 + Sec[x]] 
+ Sqrt[1 + Sec[x]]])/2^(1/4) + Tan[Pi/8]]*Sin[Pi/8] - Log[2 - 2*2^(3/4)*Co 
s[Pi/8]*Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + Sec[x]]] + Sqrt[2]*(-Sqrt[-1 + 
Sec[x]] + Sqrt[1 + Sec[x]])]*Sin[Pi/8] + Log[2 + 2^(1/4)*Csc[Pi/8]*Sqrt[-S 
qrt[-1 + Sec[x]] + Sqrt[1 + Sec[x]]] + Sqrt[2]*(-Sqrt[-1 + Sec[x]] + Sqrt[ 
1 + Sec[x]])]*Sin[Pi/8])*Sin[x])/(-1 + Cos[2*x] + 2*Cos[x]*Sqrt[-1 + Sec[x 
]]*Sqrt[1 + Sec[x]])
 

Rubi [F]

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \sqrt {\sqrt {\sec (x)+1}-\sqrt {\sec (x)-1}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \sqrt {\sqrt {\sec (x)+1}-\sqrt {\sec (x)-1}}dx\)

\(\Big \downarrow \) 4902

\(\displaystyle 2 \int \frac {\sqrt [4]{2} \sqrt {\sqrt {\frac {1}{1-\tan ^2\left (\frac {x}{2}\right )}}-\sqrt {\frac {\tan ^2\left (\frac {x}{2}\right )}{1-\tan ^2\left (\frac {x}{2}\right )}}}}{\tan ^2\left (\frac {x}{2}\right )+1}d\tan \left (\frac {x}{2}\right )\)

\(\Big \downarrow \) 27

\(\displaystyle 2 \sqrt [4]{2} \int \frac {\sqrt {\sqrt {\frac {1}{1-\tan ^2\left (\frac {x}{2}\right )}}-\sqrt {\frac {\tan ^2\left (\frac {x}{2}\right )}{1-\tan ^2\left (\frac {x}{2}\right )}}}}{\tan ^2\left (\frac {x}{2}\right )+1}d\tan \left (\frac {x}{2}\right )\)

\(\Big \downarrow \) 7276

\(\displaystyle 2 \sqrt [4]{2} \int \left (\frac {i \sqrt {\sqrt {\frac {1}{1-\tan ^2\left (\frac {x}{2}\right )}}-\sqrt {\frac {\tan ^2\left (\frac {x}{2}\right )}{1-\tan ^2\left (\frac {x}{2}\right )}}}}{2 \left (i-\tan \left (\frac {x}{2}\right )\right )}+\frac {i \sqrt {\sqrt {\frac {1}{1-\tan ^2\left (\frac {x}{2}\right )}}-\sqrt {\frac {\tan ^2\left (\frac {x}{2}\right )}{1-\tan ^2\left (\frac {x}{2}\right )}}}}{2 \left (\tan \left (\frac {x}{2}\right )+i\right )}\right )d\tan \left (\frac {x}{2}\right )\)

\(\Big \downarrow \) 2009

\(\displaystyle 2 \sqrt [4]{2} \left (\frac {1}{2} i \int \frac {\sqrt {\sqrt {\frac {1}{1-\tan ^2\left (\frac {x}{2}\right )}}-\sqrt {\frac {\tan ^2\left (\frac {x}{2}\right )}{1-\tan ^2\left (\frac {x}{2}\right )}}}}{i-\tan \left (\frac {x}{2}\right )}d\tan \left (\frac {x}{2}\right )+\frac {1}{2} i \int \frac {\sqrt {\sqrt {\frac {1}{1-\tan ^2\left (\frac {x}{2}\right )}}-\sqrt {\frac {\tan ^2\left (\frac {x}{2}\right )}{1-\tan ^2\left (\frac {x}{2}\right )}}}}{\tan \left (\frac {x}{2}\right )+i}d\tan \left (\frac {x}{2}\right )\right )\)

Input:

Int[Sqrt[-Sqrt[-1 + Sec[x]] + Sqrt[1 + Sec[x]]],x]
 

Output:

$Aborted
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4902
Int[u_, x_Symbol] :> With[{w = Block[{$ShowSteps = False, $StepCounter = Nu 
ll}, Int[SubstFor[1/(1 + FreeFactors[Tan[FunctionOfTrig[u, x]/2], x]^2*x^2) 
, Tan[FunctionOfTrig[u, x]/2]/FreeFactors[Tan[FunctionOfTrig[u, x]/2], x], 
u, x], x]]}, Module[{v = FunctionOfTrig[u, x], d}, Simp[d = FreeFactors[Tan 
[v/2], x]; 2*(d/Coefficient[v, x, 1])   Subst[Int[SubstFor[1/(1 + d^2*x^2), 
 Tan[v/2]/d, u, x], x], x, Tan[v/2]/d], x]] /; CalculusFreeQ[w, x]] /; Inve 
rseFunctionFreeQ[u, x] &&  !FalseQ[FunctionOfTrig[u, x]]
 

rule 7276
Int[(u_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> With[{v = RationalFunctionE 
xpand[u/(a + b*x^n), x]}, Int[v, x] /; SumQ[v]] /; FreeQ[{a, b}, x] && IGtQ 
[n, 0]
 
Maple [F]

\[\int \sqrt {-\sqrt {-1+\sec \left (x \right )}+\sqrt {1+\sec \left (x \right )}}d x\]

Input:

int((-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^(1/2),x)
 

Output:

int((-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^(1/2),x)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 721 vs. \(2 (244) = 488\).

Time = 0.10 (sec) , antiderivative size = 721, normalized size of antiderivative = 2.14 \[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\text {Too large to display} \] Input:

integrate((-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^(1/2),x, algorithm="fricas 
")
 

Output:

-2*sqrt(1/2*sqrt(2) + 1/2)*arctan(2*(sqrt(2) + 1)*sqrt(1/2*sqrt(2) + 1/2)* 
sqrt(1/2*sqrt(2) - 1/2) + 2*sqrt(1/2*sqrt(2) + 1/2)*sqrt(sqrt((cos(x) + 1) 
/cos(x))*(cos(x) - sin(x) + 1)/(cos(x) + 1))) - 2*sqrt(1/2*sqrt(2) + 1/2)* 
arctan(-2*(sqrt(2) + 1)*sqrt(1/2*sqrt(2) + 1/2)*sqrt(1/2*sqrt(2) - 1/2) + 
2*sqrt(1/2*sqrt(2) + 1/2)*sqrt(sqrt((cos(x) + 1)/cos(x))*(cos(x) - sin(x) 
+ 1)/(cos(x) + 1))) + 2*sqrt(1/2*sqrt(2) - 1/2)*arctan(2*(sqrt(2) - 1)*sqr 
t(1/2*sqrt(2) + 1/2)*sqrt(1/2*sqrt(2) - 1/2) + 2*sqrt(1/2*sqrt(2) - 1/2)*s 
qrt(sqrt((cos(x) + 1)/cos(x))*(cos(x) - sin(x) + 1)/(cos(x) + 1))) + 2*sqr 
t(1/2*sqrt(2) - 1/2)*arctan(-2*(sqrt(2) - 1)*sqrt(1/2*sqrt(2) + 1/2)*sqrt( 
1/2*sqrt(2) - 1/2) + 2*sqrt(1/2*sqrt(2) - 1/2)*sqrt(sqrt((cos(x) + 1)/cos( 
x))*(cos(x) - sin(x) + 1)/(cos(x) + 1))) - sqrt(1/2*sqrt(2) + 1/2)*log((2* 
((sqrt(2) - 1)*cos(x) + sqrt(2) - 1)*sqrt(1/2*sqrt(2) + 1/2)*sqrt(sqrt((co 
s(x) + 1)/cos(x))*(cos(x) - sin(x) + 1)/(cos(x) + 1)) + sqrt((cos(x) + 1)/ 
cos(x))*(cos(x) - sin(x) + 1) + sqrt(2)*cos(x) + sqrt(2))/(cos(x) + 1)) + 
sqrt(1/2*sqrt(2) + 1/2)*log(-(2*((sqrt(2) - 1)*cos(x) + sqrt(2) - 1)*sqrt( 
1/2*sqrt(2) + 1/2)*sqrt(sqrt((cos(x) + 1)/cos(x))*(cos(x) - sin(x) + 1)/(c 
os(x) + 1)) - sqrt((cos(x) + 1)/cos(x))*(cos(x) - sin(x) + 1) - sqrt(2)*co 
s(x) - sqrt(2))/(cos(x) + 1)) + sqrt(1/2*sqrt(2) - 1/2)*log((2*((sqrt(2) + 
 1)*cos(x) + sqrt(2) + 1)*sqrt(1/2*sqrt(2) - 1/2)*sqrt(sqrt((cos(x) + 1)/c 
os(x))*(cos(x) - sin(x) + 1)/(cos(x) + 1)) + sqrt((cos(x) + 1)/cos(x))*...
 

Sympy [F]

\[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\int \sqrt {- \sqrt {\sec {\left (x \right )} - 1} + \sqrt {\sec {\left (x \right )} + 1}}\, dx \] Input:

integrate((-(-1+sec(x))**(1/2)+(1+sec(x))**(1/2))**(1/2),x)
 

Output:

Integral(sqrt(-sqrt(sec(x) - 1) + sqrt(sec(x) + 1)), x)
 

Maxima [F]

\[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\int { \sqrt {\sqrt {\sec \left (x\right ) + 1} - \sqrt {\sec \left (x\right ) - 1}} \,d x } \] Input:

integrate((-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^(1/2),x, algorithm="maxima 
")
 

Output:

integrate(sqrt(sqrt(sec(x) + 1) - sqrt(sec(x) - 1)), x)
 

Giac [F]

\[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\int { \sqrt {\sqrt {\sec \left (x\right ) + 1} - \sqrt {\sec \left (x\right ) - 1}} \,d x } \] Input:

integrate((-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^(1/2),x, algorithm="giac")
                                                                                    
                                                                                    
 

Output:

integrate(sqrt(sqrt(sec(x) + 1) - sqrt(sec(x) - 1)), x)
 

Mupad [F(-1)]

Timed out. \[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\int \sqrt {\sqrt {\frac {1}{\cos \left (x\right )}+1}-\sqrt {\frac {1}{\cos \left (x\right )}-1}} \,d x \] Input:

int(((1/cos(x) + 1)^(1/2) - (1/cos(x) - 1)^(1/2))^(1/2),x)
 

Output:

int(((1/cos(x) + 1)^(1/2) - (1/cos(x) - 1)^(1/2))^(1/2), x)
 

Reduce [F]

\[ \int \sqrt {-\sqrt {-1+\sec (x)}+\sqrt {1+\sec (x)}} \, dx=\int \sqrt {-\sqrt {\sec \left (x \right )-1}+\sqrt {\sec \left (x \right )+1}}d x \] Input:

int((-(-1+sec(x))^(1/2)+(1+sec(x))^(1/2))^(1/2),x)
 

Output:

int(sqrt( - sqrt(sec(x) - 1) + sqrt(sec(x) + 1)),x)