\(\int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx\) [92]

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

Optimal result

Integrand size = 34, antiderivative size = 109 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx=-\frac {(A-i B) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{\sqrt {2} \sqrt {a} d}-\frac {A+i B}{d \sqrt {a+i a \tan (c+d x)}}-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d} \] Output:

-1/2*(A-I*B)*arctanh(1/2*(a+I*a*tan(d*x+c))^(1/2)*2^(1/2)/a^(1/2))*2^(1/2) 
/a^(1/2)/d-(A+I*B)/d/(a+I*a*tan(d*x+c))^(1/2)-2*I*B*(a+I*a*tan(d*x+c))^(1/ 
2)/a/d
 

Mathematica [A] (verified)

Time = 0.77 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.00 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx=-\frac {(A-i B) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{\sqrt {2} \sqrt {a} d}-\frac {A+i B}{d \sqrt {a+i a \tan (c+d x)}}-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d} \] Input:

Integrate[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/Sqrt[a + I*a*Tan[c + d*x]],x 
]
 

Output:

-(((A - I*B)*ArcTanh[Sqrt[a + I*a*Tan[c + d*x]]/(Sqrt[2]*Sqrt[a])])/(Sqrt[ 
2]*Sqrt[a]*d)) - (A + I*B)/(d*Sqrt[a + I*a*Tan[c + d*x]]) - ((2*I)*B*Sqrt[ 
a + I*a*Tan[c + d*x]])/(a*d)
 

Rubi [A] (verified)

Time = 0.47 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.02, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.206, Rules used = {3042, 4075, 3042, 4009, 3042, 3961, 219}

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 {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}}dx\)

\(\Big \downarrow \) 4075

\(\displaystyle \int \frac {A \tan (c+d x)-B}{\sqrt {i \tan (c+d x) a+a}}dx-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {A \tan (c+d x)-B}{\sqrt {i \tan (c+d x) a+a}}dx-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d}\)

\(\Big \downarrow \) 4009

\(\displaystyle -\frac {(B+i A) \int \sqrt {i \tan (c+d x) a+a}dx}{2 a}-\frac {A+i B}{d \sqrt {a+i a \tan (c+d x)}}-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d}\)

\(\Big \downarrow \) 3042

\(\displaystyle -\frac {(B+i A) \int \sqrt {i \tan (c+d x) a+a}dx}{2 a}-\frac {A+i B}{d \sqrt {a+i a \tan (c+d x)}}-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d}\)

\(\Big \downarrow \) 3961

\(\displaystyle \frac {i (B+i A) \int \frac {1}{a-i a \tan (c+d x)}d\sqrt {i \tan (c+d x) a+a}}{d}-\frac {A+i B}{d \sqrt {a+i a \tan (c+d x)}}-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d}\)

\(\Big \downarrow \) 219

\(\displaystyle \frac {i (B+i A) \text {arctanh}\left (\frac {\sqrt {a+i a \tan (c+d x)}}{\sqrt {2} \sqrt {a}}\right )}{\sqrt {2} \sqrt {a} d}-\frac {A+i B}{d \sqrt {a+i a \tan (c+d x)}}-\frac {2 i B \sqrt {a+i a \tan (c+d x)}}{a d}\)

Input:

Int[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/Sqrt[a + I*a*Tan[c + d*x]],x]
 

Output:

(I*(I*A + B)*ArcTanh[Sqrt[a + I*a*Tan[c + d*x]]/(Sqrt[2]*Sqrt[a])])/(Sqrt[ 
2]*Sqrt[a]*d) - (A + I*B)/(d*Sqrt[a + I*a*Tan[c + d*x]]) - ((2*I)*B*Sqrt[a 
 + I*a*Tan[c + d*x]])/(a*d)
 

Defintions of rubi rules used

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

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

rule 3961
Int[Sqrt[(a_) + (b_.)*tan[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[-2*(b/d) 
  Subst[Int[1/(2*a - x^2), x], x, Sqrt[a + b*Tan[c + d*x]]], x] /; FreeQ[{a 
, b, c, d}, x] && EqQ[a^2 + b^2, 0]
 

rule 4009
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[(-(b*c - a*d))*((a + b*Tan[e + f*x])^m/(2*a 
*f*m)), x] + Simp[(b*c + a*d)/(2*a*b)   Int[(a + b*Tan[e + f*x])^(m + 1), x 
], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2 
, 0] && LtQ[m, 0]
 

rule 4075
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B 
*d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f* 
x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, 
d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1]
 
Maple [A] (verified)

Time = 0.19 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.81

method result size
derivativedivides \(\frac {-2 i B \sqrt {a +i a \tan \left (d x +c \right )}-\frac {\sqrt {a}\, \left (-i B +A \right ) \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{2}-\frac {a \left (i B +A \right )}{\sqrt {a +i a \tan \left (d x +c \right )}}}{a d}\) \(88\)
default \(\frac {-2 i B \sqrt {a +i a \tan \left (d x +c \right )}-\frac {\sqrt {a}\, \left (-i B +A \right ) \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{2}-\frac {a \left (i B +A \right )}{\sqrt {a +i a \tan \left (d x +c \right )}}}{a d}\) \(88\)
parts \(\frac {A \left (-\frac {\sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{2 \sqrt {a}}-\frac {1}{\sqrt {a +i a \tan \left (d x +c \right )}}\right )}{d}+\frac {2 i B \left (-\sqrt {a +i a \tan \left (d x +c \right )}+\frac {\sqrt {a}\, \sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {a +i a \tan \left (d x +c \right )}\, \sqrt {2}}{2 \sqrt {a}}\right )}{4}-\frac {a}{2 \sqrt {a +i a \tan \left (d x +c \right )}}\right )}{d a}\) \(130\)

Input:

int(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^(1/2),x,method=_RETURNV 
ERBOSE)
 

Output:

2/d/a*(-I*B*(a+I*a*tan(d*x+c))^(1/2)-1/4*a^(1/2)*(A-I*B)*2^(1/2)*arctanh(1 
/2*(a+I*a*tan(d*x+c))^(1/2)*2^(1/2)/a^(1/2))-1/2*a*(A+I*B)/(a+I*a*tan(d*x+ 
c))^(1/2))
 

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 327 vs. \(2 (84) = 168\).

Time = 0.09 (sec) , antiderivative size = 327, normalized size of antiderivative = 3.00 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx=\frac {{\left (\sqrt {2} a d \sqrt {\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}} e^{\left (i \, d x + i \, c\right )} \log \left (-\frac {4 \, {\left ({\left (-i \, A - B\right )} a e^{\left (i \, d x + i \, c\right )} + {\left (i \, a d e^{\left (2 i \, d x + 2 i \, c\right )} + i \, a d\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}}\right )} e^{\left (-i \, d x - i \, c\right )}}{i \, A + B}\right ) - \sqrt {2} a d \sqrt {\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}} e^{\left (i \, d x + i \, c\right )} \log \left (-\frac {4 \, {\left ({\left (-i \, A - B\right )} a e^{\left (i \, d x + i \, c\right )} + {\left (-i \, a d e^{\left (2 i \, d x + 2 i \, c\right )} - i \, a d\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {A^{2} - 2 i \, A B - B^{2}}{a d^{2}}}\right )} e^{\left (-i \, d x - i \, c\right )}}{i \, A + B}\right ) - 2 \, \sqrt {2} {\left ({\left (A + 5 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + A + i \, B\right )} \sqrt {\frac {a}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-i \, d x - i \, c\right )}}{4 \, a d} \] Input:

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^(1/2),x, algorith 
m="fricas")
 

Output:

1/4*(sqrt(2)*a*d*sqrt((A^2 - 2*I*A*B - B^2)/(a*d^2))*e^(I*d*x + I*c)*log(- 
4*((-I*A - B)*a*e^(I*d*x + I*c) + (I*a*d*e^(2*I*d*x + 2*I*c) + I*a*d)*sqrt 
(a/(e^(2*I*d*x + 2*I*c) + 1))*sqrt((A^2 - 2*I*A*B - B^2)/(a*d^2)))*e^(-I*d 
*x - I*c)/(I*A + B)) - sqrt(2)*a*d*sqrt((A^2 - 2*I*A*B - B^2)/(a*d^2))*e^( 
I*d*x + I*c)*log(-4*((-I*A - B)*a*e^(I*d*x + I*c) + (-I*a*d*e^(2*I*d*x + 2 
*I*c) - I*a*d)*sqrt(a/(e^(2*I*d*x + 2*I*c) + 1))*sqrt((A^2 - 2*I*A*B - B^2 
)/(a*d^2)))*e^(-I*d*x - I*c)/(I*A + B)) - 2*sqrt(2)*((A + 5*I*B)*e^(2*I*d* 
x + 2*I*c) + A + I*B)*sqrt(a/(e^(2*I*d*x + 2*I*c) + 1)))*e^(-I*d*x - I*c)/ 
(a*d)
 

Sympy [F]

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

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))**(1/2),x)
 

Output:

Integral((A + B*tan(c + d*x))*tan(c + d*x)/sqrt(I*a*(tan(c + d*x) - I)), x 
)
 

Maxima [A] (verification not implemented)

Time = 0.14 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.01 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx=\frac {\sqrt {2} {\left (A - i \, B\right )} a^{\frac {3}{2}} \log \left (-\frac {\sqrt {2} \sqrt {a} - \sqrt {i \, a \tan \left (d x + c\right ) + a}}{\sqrt {2} \sqrt {a} + \sqrt {i \, a \tan \left (d x + c\right ) + a}}\right ) - 8 i \, \sqrt {i \, a \tan \left (d x + c\right ) + a} B a - \frac {4 \, {\left (A + i \, B\right )} a^{2}}{\sqrt {i \, a \tan \left (d x + c\right ) + a}}}{4 \, a^{2} d} \] Input:

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^(1/2),x, algorith 
m="maxima")
 

Output:

1/4*(sqrt(2)*(A - I*B)*a^(3/2)*log(-(sqrt(2)*sqrt(a) - sqrt(I*a*tan(d*x + 
c) + a))/(sqrt(2)*sqrt(a) + sqrt(I*a*tan(d*x + c) + a))) - 8*I*sqrt(I*a*ta 
n(d*x + c) + a)*B*a - 4*(A + I*B)*a^2/sqrt(I*a*tan(d*x + c) + a))/(a^2*d)
 

Giac [F(-2)]

Exception generated. \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx=\text {Exception raised: TypeError} \] Input:

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^(1/2),x, algorith 
m="giac")
 

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Error: Bad Argument TypeError: Bad 
Argument TypeDone
 

Mupad [B] (verification not implemented)

Time = 1.00 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.29 \[ \int \frac {\tan (c+d x) (A+B \tan (c+d x))}{\sqrt {a+i a \tan (c+d x)}} \, dx=-\frac {A}{d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}-\frac {B\,1{}\mathrm {i}}{d\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}-\frac {B\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}\,2{}\mathrm {i}}{a\,d}-\frac {\sqrt {2}\,B\,\mathrm {atan}\left (\frac {\sqrt {2}\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{2\,\sqrt {-a}}\right )\,1{}\mathrm {i}}{2\,\sqrt {-a}\,d}-\frac {\sqrt {2}\,A\,\mathrm {atanh}\left (\frac {\sqrt {2}\,\sqrt {a+a\,\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}}}{2\,\sqrt {a}}\right )}{2\,\sqrt {a}\,d} \] Input:

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

Output:

- A/(d*(a + a*tan(c + d*x)*1i)^(1/2)) - (B*1i)/(d*(a + a*tan(c + d*x)*1i)^ 
(1/2)) - (B*(a + a*tan(c + d*x)*1i)^(1/2)*2i)/(a*d) - (2^(1/2)*B*atan((2^( 
1/2)*(a + a*tan(c + d*x)*1i)^(1/2))/(2*(-a)^(1/2)))*1i)/(2*(-a)^(1/2)*d) - 
 (2^(1/2)*A*atanh((2^(1/2)*(a + a*tan(c + d*x)*1i)^(1/2))/(2*a^(1/2))))/(2 
*a^(1/2)*d)
 

Reduce [F]

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

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

Output:

(sqrt(a)*( - int((sqrt(tan(c + d*x)*i + 1)*tan(c + d*x)**3)/(tan(c + d*x)* 
*2 + 1),x)*b*i - int((sqrt(tan(c + d*x)*i + 1)*tan(c + d*x)**2)/(tan(c + d 
*x)**2 + 1),x)*a*i + int((sqrt(tan(c + d*x)*i + 1)*tan(c + d*x)**2)/(tan(c 
 + d*x)**2 + 1),x)*b + int((sqrt(tan(c + d*x)*i + 1)*tan(c + d*x))/(tan(c 
+ d*x)**2 + 1),x)*a))/a