\(\int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx\) [195]

Optimal result
Mathematica [C] (verified)
Rubi [A] (verified)
Maple [B] (verified)
Fricas [A] (verification not implemented)
Sympy [F]
Maxima [F]
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 28, antiderivative size = 107 \[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=\frac {6 a^2 E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d \sqrt {\cos (c+d x)} \sqrt {e \sec (c+d x)}}-\frac {6 a^2 \sqrt {e \sec (c+d x)} \sin (c+d x)}{d e}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}} \] Output:

6*a^2*EllipticE(sin(1/2*d*x+1/2*c),2^(1/2))/d/cos(d*x+c)^(1/2)/(e*sec(d*x+ 
c))^(1/2)-6*a^2*(e*sec(d*x+c))^(1/2)*sin(d*x+c)/d/e-4*I*(a^2+I*a^2*tan(d*x 
+c))/d/(e*sec(d*x+c))^(1/2)
 

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 4 in optimal.

Time = 2.07 (sec) , antiderivative size = 132, normalized size of antiderivative = 1.23 \[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=-\frac {2 i \sqrt {2} a^2 e^{2 i (c+d x)} \left (-\sqrt {1+e^{2 i (c+d x)}}+\left (1+e^{2 i (c+d x)}\right ) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {3}{4},\frac {7}{4},-e^{2 i (c+d x)}\right )\right )}{d \sqrt {\frac {e e^{i (c+d x)}}{1+e^{2 i (c+d x)}}} \left (1+e^{2 i (c+d x)}\right )^{3/2}} \] Input:

Integrate[(a + I*a*Tan[c + d*x])^2/Sqrt[e*Sec[c + d*x]],x]
 

Output:

((-2*I)*Sqrt[2]*a^2*E^((2*I)*(c + d*x))*(-Sqrt[1 + E^((2*I)*(c + d*x))] + 
(1 + E^((2*I)*(c + d*x)))*Hypergeometric2F1[1/2, 3/4, 7/4, -E^((2*I)*(c + 
d*x))]))/(d*Sqrt[(e*E^(I*(c + d*x)))/(1 + E^((2*I)*(c + d*x)))]*(1 + E^((2 
*I)*(c + d*x)))^(3/2))
 

Rubi [A] (verified)

Time = 0.50 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.04, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 3977, 3042, 4255, 3042, 4258, 3042, 3119}

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 \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}}dx\)

\(\Big \downarrow \) 3977

\(\displaystyle -\frac {3 a^2 \int (e \sec (c+d x))^{3/2}dx}{e^2}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}}\)

\(\Big \downarrow \) 3042

\(\displaystyle -\frac {3 a^2 \int \left (e \csc \left (c+d x+\frac {\pi }{2}\right )\right )^{3/2}dx}{e^2}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}}\)

\(\Big \downarrow \) 4255

\(\displaystyle -\frac {3 a^2 \left (\frac {2 e \sin (c+d x) \sqrt {e \sec (c+d x)}}{d}-e^2 \int \frac {1}{\sqrt {e \sec (c+d x)}}dx\right )}{e^2}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}}\)

\(\Big \downarrow \) 3042

\(\displaystyle -\frac {3 a^2 \left (\frac {2 e \sin (c+d x) \sqrt {e \sec (c+d x)}}{d}-e^2 \int \frac {1}{\sqrt {e \csc \left (c+d x+\frac {\pi }{2}\right )}}dx\right )}{e^2}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}}\)

\(\Big \downarrow \) 4258

\(\displaystyle -\frac {3 a^2 \left (\frac {2 e \sin (c+d x) \sqrt {e \sec (c+d x)}}{d}-\frac {e^2 \int \sqrt {\cos (c+d x)}dx}{\sqrt {\cos (c+d x)} \sqrt {e \sec (c+d x)}}\right )}{e^2}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}}\)

\(\Big \downarrow \) 3042

\(\displaystyle -\frac {3 a^2 \left (\frac {2 e \sin (c+d x) \sqrt {e \sec (c+d x)}}{d}-\frac {e^2 \int \sqrt {\sin \left (c+d x+\frac {\pi }{2}\right )}dx}{\sqrt {\cos (c+d x)} \sqrt {e \sec (c+d x)}}\right )}{e^2}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}}\)

\(\Big \downarrow \) 3119

\(\displaystyle -\frac {3 a^2 \left (\frac {2 e \sin (c+d x) \sqrt {e \sec (c+d x)}}{d}-\frac {2 e^2 E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d \sqrt {\cos (c+d x)} \sqrt {e \sec (c+d x)}}\right )}{e^2}-\frac {4 i \left (a^2+i a^2 \tan (c+d x)\right )}{d \sqrt {e \sec (c+d x)}}\)

Input:

Int[(a + I*a*Tan[c + d*x])^2/Sqrt[e*Sec[c + d*x]],x]
 

Output:

(-3*a^2*((-2*e^2*EllipticE[(c + d*x)/2, 2])/(d*Sqrt[Cos[c + d*x]]*Sqrt[e*S 
ec[c + d*x]]) + (2*e*Sqrt[e*Sec[c + d*x]]*Sin[c + d*x])/d))/e^2 - ((4*I)*( 
a^2 + I*a^2*Tan[c + d*x]))/(d*Sqrt[e*Sec[c + d*x]])
 

Defintions of rubi rules used

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

rule 3119
Int[Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticE[(1/2)* 
(c - Pi/2 + d*x), 2], x] /; FreeQ[{c, d}, x]
 

rule 3977
Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x 
_)])^(n_), x_Symbol] :> Simp[2*b*(d*Sec[e + f*x])^m*((a + b*Tan[e + f*x])^( 
n - 1)/(f*m)), x] - Simp[b^2*((m + 2*n - 2)/(d^2*m))   Int[(d*Sec[e + f*x]) 
^(m + 2)*(a + b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, d, e, f}, x] 
&& EqQ[a^2 + b^2, 0] && GtQ[n, 1] && ((IGtQ[n/2, 0] && ILtQ[m - 1/2, 0]) || 
 (EqQ[n, 2] && LtQ[m, 0]) || (LeQ[m, -1] && GtQ[m + n, 0]) || (ILtQ[m, 0] & 
& LtQ[m/2 + n - 1, 0] && IntegerQ[n]) || (EqQ[n, 3/2] && EqQ[m, -2^(-1)])) 
&& IntegerQ[2*m]
 

rule 4255
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* 
x]*((b*Csc[c + d*x])^(n - 1)/(d*(n - 1))), x] + Simp[b^2*((n - 2)/(n - 1)) 
  Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] 
&& IntegerQ[2*n]
 

rule 4258
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x] 
)^n*Sin[c + d*x]^n   Int[1/Sin[c + d*x]^n, x], x] /; FreeQ[{b, c, d}, x] && 
 EqQ[n^2, 1/4]
 
Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 378 vs. \(2 (99 ) = 198\).

Time = 9.87 (sec) , antiderivative size = 379, normalized size of antiderivative = 3.54

method result size
parts \(\frac {2 a^{2} \left (i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right ), i\right ) \left (-\cos \left (d x +c \right )-2-\sec \left (d x +c \right )\right )+i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticE}\left (i \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right ), i\right ) \left (\cos \left (d x +c \right )+2+\sec \left (d x +c \right )\right )+\sin \left (d x +c \right )\right )}{d \left (\cos \left (d x +c \right )+1\right ) \sqrt {e \sec \left (d x +c \right )}}-\frac {4 i a^{2}}{\sqrt {e \sec \left (d x +c \right )}\, d}+\frac {2 a^{2} \left (\sin \left (d x +c \right )-\tan \left (d x +c \right )-2 i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \left (\cos \left (d x +c \right )+2+\sec \left (d x +c \right )\right ) \operatorname {EllipticF}\left (i \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right ), i\right )+2 i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticE}\left (i \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right ), i\right ) \left (\cos \left (d x +c \right )+2+\sec \left (d x +c \right )\right )\right )}{d \left (\cos \left (d x +c \right )+1\right ) \sqrt {e \sec \left (d x +c \right )}}\) \(379\)
default \(\frac {a^{2} \left (i \ln \left (\frac {4 \cos \left (d x +c \right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}+4 \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}-2 \cos \left (d x +c \right )+2}{\cos \left (d x +c \right )+1}\right )-i \ln \left (\frac {2 \cos \left (d x +c \right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}+2 \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}-\cos \left (d x +c \right )+1}{\cos \left (d x +c \right )+1}\right )+6 i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}\, \operatorname {EllipticE}\left (i \left (\cot \left (d x +c \right )-\csc \left (d x +c \right )\right ), i\right ) \left (-\cos \left (d x +c \right )-2-\sec \left (d x +c \right )\right )+6 i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}\, \operatorname {EllipticF}\left (i \left (\cot \left (d x +c \right )-\csc \left (d x +c \right )\right ), i\right ) \left (\cos \left (d x +c \right )+2+\sec \left (d x +c \right )\right )+2 \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}\, \left (2 \sin \left (d x +c \right )-\tan \left (d x +c \right )\right )+4 i \left (-\cos \left (d x +c \right )-1\right ) \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}\right )}{d \left (\cos \left (d x +c \right )+1\right ) \sqrt {e \sec \left (d x +c \right )}\, \sqrt {-\frac {\cos \left (d x +c \right )}{\left (\cos \left (d x +c \right )+1\right )^{2}}}}\) \(454\)

Input:

int((a+I*a*tan(d*x+c))^2/(e*sec(d*x+c))^(1/2),x,method=_RETURNVERBOSE)
 

Output:

2*a^2/d/(cos(d*x+c)+1)/(e*sec(d*x+c))^(1/2)*(I*(1/(cos(d*x+c)+1))^(1/2)*(c 
os(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(I*(csc(d*x+c)-cot(d*x+c)),I)*(-c 
os(d*x+c)-2-sec(d*x+c))+I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c) 
+1))^(1/2)*EllipticE(I*(csc(d*x+c)-cot(d*x+c)),I)*(cos(d*x+c)+2+sec(d*x+c) 
)+sin(d*x+c))-4*I*a^2/(e*sec(d*x+c))^(1/2)/d+2*a^2/d/(cos(d*x+c)+1)/(e*sec 
(d*x+c))^(1/2)*(sin(d*x+c)-tan(d*x+c)-2*I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d* 
x+c)/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)+2+sec(d*x+c))*EllipticF(I*(csc(d*x+ 
c)-cot(d*x+c)),I)+2*I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1)) 
^(1/2)*EllipticE(I*(csc(d*x+c)-cot(d*x+c)),I)*(cos(d*x+c)+2+sec(d*x+c)))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 69, normalized size of antiderivative = 0.64 \[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=-\frac {2 \, {\left (-i \, \sqrt {2} a^{2} \sqrt {\frac {e}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} e^{\left (\frac {3}{2} i \, d x + \frac {3}{2} i \, c\right )} - 3 i \, \sqrt {2} a^{2} \sqrt {e} {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, e^{\left (i \, d x + i \, c\right )}\right )\right )\right )}}{d e} \] Input:

integrate((a+I*a*tan(d*x+c))^2/(e*sec(d*x+c))^(1/2),x, algorithm="fricas")
 

Output:

-2*(-I*sqrt(2)*a^2*sqrt(e/(e^(2*I*d*x + 2*I*c) + 1))*e^(3/2*I*d*x + 3/2*I* 
c) - 3*I*sqrt(2)*a^2*sqrt(e)*weierstrassZeta(-4, 0, weierstrassPInverse(-4 
, 0, e^(I*d*x + I*c))))/(d*e)
 

Sympy [F]

\[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=- a^{2} \left (\int \left (- \frac {1}{\sqrt {e \sec {\left (c + d x \right )}}}\right )\, dx + \int \frac {\tan ^{2}{\left (c + d x \right )}}{\sqrt {e \sec {\left (c + d x \right )}}}\, dx + \int \left (- \frac {2 i \tan {\left (c + d x \right )}}{\sqrt {e \sec {\left (c + d x \right )}}}\right )\, dx\right ) \] Input:

integrate((a+I*a*tan(d*x+c))**2/(e*sec(d*x+c))**(1/2),x)
 

Output:

-a**2*(Integral(-1/sqrt(e*sec(c + d*x)), x) + Integral(tan(c + d*x)**2/sqr 
t(e*sec(c + d*x)), x) + Integral(-2*I*tan(c + d*x)/sqrt(e*sec(c + d*x)), x 
))
 

Maxima [F]

\[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=\int { \frac {{\left (i \, a \tan \left (d x + c\right ) + a\right )}^{2}}{\sqrt {e \sec \left (d x + c\right )}} \,d x } \] Input:

integrate((a+I*a*tan(d*x+c))^2/(e*sec(d*x+c))^(1/2),x, algorithm="maxima")
 

Output:

integrate((I*a*tan(d*x + c) + a)^2/sqrt(e*sec(d*x + c)), x)
 

Giac [F]

\[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=\int { \frac {{\left (i \, a \tan \left (d x + c\right ) + a\right )}^{2}}{\sqrt {e \sec \left (d x + c\right )}} \,d x } \] Input:

integrate((a+I*a*tan(d*x+c))^2/(e*sec(d*x+c))^(1/2),x, algorithm="giac")
 

Output:

integrate((I*a*tan(d*x + c) + a)^2/sqrt(e*sec(d*x + c)), x)
 

Mupad [F(-1)]

Timed out. \[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=\int \frac {{\left (a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}^2}{\sqrt {\frac {e}{\cos \left (c+d\,x\right )}}} \,d x \] Input:

int((a + a*tan(c + d*x)*1i)^2/(e/cos(c + d*x))^(1/2),x)
 

Output:

int((a + a*tan(c + d*x)*1i)^2/(e/cos(c + d*x))^(1/2), x)
 

Reduce [F]

\[ \int \frac {(a+i a \tan (c+d x))^2}{\sqrt {e \sec (c+d x)}} \, dx=\frac {\sqrt {e}\, a^{2} \left (\int \frac {\sqrt {\sec \left (d x +c \right )}}{\sec \left (d x +c \right )}d x -\left (\int \frac {\sqrt {\sec \left (d x +c \right )}\, \tan \left (d x +c \right )^{2}}{\sec \left (d x +c \right )}d x \right )+2 \left (\int \frac {\sqrt {\sec \left (d x +c \right )}\, \tan \left (d x +c \right )}{\sec \left (d x +c \right )}d x \right ) i \right )}{e} \] Input:

int((a+I*a*tan(d*x+c))^2/(e*sec(d*x+c))^(1/2),x)
 

Output:

(sqrt(e)*a**2*(int(sqrt(sec(c + d*x))/sec(c + d*x),x) - int((sqrt(sec(c + 
d*x))*tan(c + d*x)**2)/sec(c + d*x),x) + 2*int((sqrt(sec(c + d*x))*tan(c + 
 d*x))/sec(c + d*x),x)*i))/e