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

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

Optimal result

Integrand size = 34, antiderivative size = 129 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {3 (i A-B) x}{2 a}-\frac {(A+2 i B) \log (\cos (c+d x))}{a d}-\frac {3 (i A-B) \tan (c+d x)}{2 a d}-\frac {(A+2 i B) \tan ^2(c+d x)}{2 a d}+\frac {(i A-B) \tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))} \] Output:

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

Mathematica [A] (verified)

Time = 1.29 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.06 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {\frac {2 (2 A+i B) \tan ^2(c+d x)}{a+i a \tan (c+d x)}+\frac {2 B \tan ^3(c+d x)}{a+i a \tan (c+d x)}+\frac {(5 A+7 i B) \log (i-\tan (c+d x))-(A-i B) \log (i+\tan (c+d x))+\frac {6 (-i A+B)}{-i+\tan (c+d x)}}{a}}{4 d} \] Input:

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

Output:

((2*(2*A + I*B)*Tan[c + d*x]^2)/(a + I*a*Tan[c + d*x]) + (2*B*Tan[c + d*x] 
^3)/(a + I*a*Tan[c + d*x]) + ((5*A + (7*I)*B)*Log[I - Tan[c + d*x]] - (A - 
 I*B)*Log[I + Tan[c + d*x]] + (6*((-I)*A + B))/(-I + Tan[c + d*x]))/a)/(4* 
d)
 

Rubi [A] (verified)

Time = 0.61 (sec) , antiderivative size = 122, normalized size of antiderivative = 0.95, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.235, Rules used = {3042, 4078, 3042, 4011, 3042, 4008, 3042, 3956}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4078

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

\(\displaystyle \frac {(-B+i A) \tan ^3(c+d x)}{2 d (a+i a \tan (c+d x))}-\frac {\frac {a (A+2 i B) \tan ^2(c+d x)}{d}+\frac {3 a (-B+i A) \tan (c+d x)}{d}+\frac {2 a (A+2 i B) \log (\cos (c+d x))}{d}-3 a x (-B+i A)}{2 a^2}\)

Input:

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

Output:

((I*A - B)*Tan[c + d*x]^3)/(2*d*(a + I*a*Tan[c + d*x])) - (-3*a*(I*A - B)* 
x + (2*a*(A + (2*I)*B)*Log[Cos[c + d*x]])/d + (3*a*(I*A - B)*Tan[c + d*x]) 
/d + (a*(A + (2*I)*B)*Tan[c + d*x]^2)/d)/(2*a^2)
 

Defintions of rubi rules used

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

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

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

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

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

Time = 0.31 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.13

method result size
norman \(\frac {\frac {\left (-i A +B \right ) \tan \left (d x +c \right )^{3}}{a d}-\frac {3 \left (-i A +B \right ) x}{2 a}+\frac {2 i B +A}{2 a d}+\frac {3 \left (-i A +B \right ) \tan \left (d x +c \right )}{2 a d}-\frac {3 \left (-i A +B \right ) x \tan \left (d x +c \right )^{2}}{2 a}-\frac {i B \tan \left (d x +c \right )^{4}}{2 a d}}{1+\tan \left (d x +c \right )^{2}}+\frac {\left (2 i B +A \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 a d}\) \(146\)
risch \(-\frac {7 x B}{2 a}+\frac {5 i x A}{2 a}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} B}{4 a d}+\frac {{\mathrm e}^{-2 i \left (d x +c \right )} A}{4 a d}-\frac {4 B c}{a d}+\frac {2 i A c}{a d}+\frac {2 i \left (-i A \,{\mathrm e}^{2 i \left (d x +c \right )}-i A +B \right )}{d a \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {2 i \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{a d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{a d}\) \(159\)
derivativedivides \(\frac {B \tan \left (d x +c \right )}{d a}-\frac {i B \tan \left (d x +c \right )^{2}}{2 d a}-\frac {i A \tan \left (d x +c \right )}{d a}+\frac {A \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d a}+\frac {3 i A \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i B \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{d a}-\frac {3 B \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}-\frac {i A}{2 d a \left (-i+\tan \left (d x +c \right )\right )}+\frac {B}{2 d a \left (-i+\tan \left (d x +c \right )\right )}\) \(165\)
default \(\frac {B \tan \left (d x +c \right )}{d a}-\frac {i B \tan \left (d x +c \right )^{2}}{2 d a}-\frac {i A \tan \left (d x +c \right )}{d a}+\frac {A \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d a}+\frac {3 i A \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}+\frac {i B \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{d a}-\frac {3 B \arctan \left (\tan \left (d x +c \right )\right )}{2 d a}-\frac {i A}{2 d a \left (-i+\tan \left (d x +c \right )\right )}+\frac {B}{2 d a \left (-i+\tan \left (d x +c \right )\right )}\) \(165\)

Input:

int(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x,method=_RETURNVERBO 
SE)
 

Output:

(1/a/d*(B-I*A)*tan(d*x+c)^3-3/2/a*(B-I*A)*x+1/2*(A+2*I*B)/a/d+3/2/a/d*(B-I 
*A)*tan(d*x+c)-3/2/a*(B-I*A)*x*tan(d*x+c)^2-1/2*I*B/a/d*tan(d*x+c)^4)/(1+t 
an(d*x+c)^2)+1/2*(A+2*I*B)/a/d*ln(1+tan(d*x+c)^2)
 

Fricas [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 186, normalized size of antiderivative = 1.44 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {2 \, {\left (-5 i \, A + 7 \, B\right )} d x e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (4 \, {\left (-5 i \, A + 7 \, B\right )} d x - 9 \, A - i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, {\left ({\left (-5 i \, A + 7 \, B\right )} d x - 5 \, A - 5 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + 4 \, {\left ({\left (A + 2 i \, B\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + 2 \, {\left (A + 2 i \, B\right )} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (A + 2 i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - A - i \, B}{4 \, {\left (a d e^{\left (6 i \, d x + 6 i \, c\right )} + 2 \, a d e^{\left (4 i \, d x + 4 i \, c\right )} + a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \] Input:

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="f 
ricas")
 

Output:

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

Sympy [A] (verification not implemented)

Time = 0.49 (sec) , antiderivative size = 196, normalized size of antiderivative = 1.52 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {2 A e^{2 i c} e^{2 i d x} + 2 A + 2 i B}{a d e^{4 i c} e^{4 i d x} + 2 a d e^{2 i c} e^{2 i d x} + a d} + \begin {cases} \frac {\left (A + i B\right ) e^{- 2 i c} e^{- 2 i d x}}{4 a d} & \text {for}\: a d e^{2 i c} \neq 0 \\x \left (- \frac {5 i A - 7 B}{2 a} + \frac {\left (5 i A e^{2 i c} - i A - 7 B e^{2 i c} + B\right ) e^{- 2 i c}}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {x \left (5 i A - 7 B\right )}{2 a} - \frac {\left (A + 2 i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{a d} \] Input:

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

Output:

(2*A*exp(2*I*c)*exp(2*I*d*x) + 2*A + 2*I*B)/(a*d*exp(4*I*c)*exp(4*I*d*x) + 
 2*a*d*exp(2*I*c)*exp(2*I*d*x) + a*d) + Piecewise(((A + I*B)*exp(-2*I*c)*e 
xp(-2*I*d*x)/(4*a*d), Ne(a*d*exp(2*I*c), 0)), (x*(-(5*I*A - 7*B)/(2*a) + ( 
5*I*A*exp(2*I*c) - I*A - 7*B*exp(2*I*c) + B)*exp(-2*I*c)/(2*a)), True)) + 
x*(5*I*A - 7*B)/(2*a) - (A + 2*I*B)*log(exp(2*I*d*x) + exp(-2*I*c))/(a*d)
 

Maxima [F(-2)]

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

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="m 
axima")
 

Output:

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negati 
ve exponent.
 

Giac [A] (verification not implemented)

Time = 0.45 (sec) , antiderivative size = 116, normalized size of antiderivative = 0.90 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=-\frac {{\left (A - i \, B\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{4 \, a d} + \frac {{\left (5 \, A + 7 i \, B\right )} \log \left (\tan \left (d x + c\right ) - i\right )}{4 \, a d} - \frac {i \, A - B}{2 \, a d {\left (\tan \left (d x + c\right ) - i\right )}} - \frac {i \, B a d \tan \left (d x + c\right )^{2} + 2 i \, A a d \tan \left (d x + c\right ) - 2 \, B a d \tan \left (d x + c\right )}{2 \, a^{2} d^{2}} \] Input:

integrate(tan(d*x+c)^3*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c)),x, algorithm="g 
iac")
 

Output:

-1/4*(A - I*B)*log(tan(d*x + c) + I)/(a*d) + 1/4*(5*A + 7*I*B)*log(tan(d*x 
 + c) - I)/(a*d) - 1/2*(I*A - B)/(a*d*(tan(d*x + c) - I)) - 1/2*(I*B*a*d*t 
an(d*x + c)^2 + 2*I*A*a*d*tan(d*x + c) - 2*B*a*d*tan(d*x + c))/(a^2*d^2)
 

Mupad [B] (verification not implemented)

Time = 3.69 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.09 \[ \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx=\frac {\frac {A}{2\,a}-\frac {A+B\,1{}\mathrm {i}}{2\,a}+\frac {A+B\,2{}\mathrm {i}}{2\,a}}{d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-\frac {B}{a}+\frac {A\,1{}\mathrm {i}}{a}\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{4\,a\,d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (5\,A+B\,7{}\mathrm {i}\right )}{4\,a\,d}-\frac {B\,{\mathrm {tan}\left (c+d\,x\right )}^2\,1{}\mathrm {i}}{2\,a\,d} \] Input:

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

Output:

(A/(2*a) - (A + B*1i)/(2*a) + (A + B*2i)/(2*a))/(d*(tan(c + d*x)*1i + 1)) 
- (tan(c + d*x)*((A*1i)/a - B/a))/d + (log(tan(c + d*x) + 1i)*(A*1i + B)*1 
i)/(4*a*d) + (log(tan(c + d*x) - 1i)*(5*A + B*7i))/(4*a*d) - (B*tan(c + d* 
x)^2*1i)/(2*a*d)
 

Reduce [F]

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

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

Output:

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