\(\int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx\) [707]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (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 = 41, antiderivative size = 121 \[ \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=-\frac {4 (A+2 i B) c^3 x}{a}-\frac {4 (i A-2 B) c^3 \log (\cos (e+f x))}{a f}-\frac {4 (A+i B) c^3}{a f (i-\tan (e+f x))}+\frac {(A+4 i B) c^3 \tan (e+f x)}{a f}+\frac {B c^3 \tan ^2(e+f x)}{2 a f} \] Output:

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

Mathematica [A] (verified)

Time = 3.24 (sec) , antiderivative size = 124, normalized size of antiderivative = 1.02 \[ \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=\frac {c^3 \left (14 A+27 i B+8 (A+2 i B) \log (i-\tan (e+f x))+(4 i A-11 B+8 i (A+2 i B) \log (i-\tan (e+f x))) \tan (e+f x)+(2 A+7 i B) \tan ^2(e+f x)+B \tan ^3(e+f x)\right )}{2 a f (-i+\tan (e+f x))} \] Input:

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

Output:

(c^3*(14*A + (27*I)*B + 8*(A + (2*I)*B)*Log[I - Tan[e + f*x]] + ((4*I)*A - 
 11*B + (8*I)*(A + (2*I)*B)*Log[I - Tan[e + f*x]])*Tan[e + f*x] + (2*A + ( 
7*I)*B)*Tan[e + f*x]^2 + B*Tan[e + f*x]^3))/(2*a*f*(-I + Tan[e + f*x]))
 

Rubi [A] (verified)

Time = 0.56 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.70, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.122, Rules used = {3042, 4071, 27, 86, 2009}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4071

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 86

\(\displaystyle \frac {c^3 \int \left (-\frac {4 (A+i B)}{(\tan (e+f x)-i)^2}+A \left (\frac {4 i B}{A}+1\right )+B \tan (e+f x)+\frac {4 i (A+2 i B)}{\tan (e+f x)-i}\right )d\tan (e+f x)}{a f}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {c^3 \left ((A+4 i B) \tan (e+f x)-\frac {4 (A+i B)}{-\tan (e+f x)+i}+4 (-2 B+i A) \log (-\tan (e+f x)+i)+\frac {1}{2} B \tan ^2(e+f x)\right )}{a f}\)

Input:

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

Output:

(c^3*(4*(I*A - 2*B)*Log[I - Tan[e + f*x]] - (4*(A + I*B))/(I - Tan[e + f*x 
]) + (A + (4*I)*B)*Tan[e + f*x] + (B*Tan[e + f*x]^2)/2))/(a*f)
 

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 86
Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_ 
.), x_] :> Int[ExpandIntegrand[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; 
 FreeQ[{a, b, c, d, e, f, n}, x] && ((ILtQ[n, 0] && ILtQ[p, 0]) || EqQ[p, 1 
] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p 
+ 1, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))
 

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 4071
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + 
 (f_.)*(x_)])*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Si 
mp[a*(c/f)   Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x], x 
, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c 
+ a*d, 0] && EqQ[a^2 + b^2, 0]
 
Maple [A] (verified)

Time = 0.44 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.58

method result size
derivativedivides \(-\frac {4 c^{3} A \arctan \left (\tan \left (f x +e \right )\right )}{f a}+\frac {2 i c^{3} A \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f a}-\frac {8 i c^{3} B \arctan \left (\tan \left (f x +e \right )\right )}{f a}-\frac {4 c^{3} B \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f a}+\frac {4 i c^{3} B}{f a \left (-i+\tan \left (f x +e \right )\right )}+\frac {4 c^{3} A}{f a \left (-i+\tan \left (f x +e \right )\right )}+\frac {c^{3} A \tan \left (f x +e \right )}{f a}+\frac {4 i c^{3} \tan \left (f x +e \right ) B}{f a}+\frac {B \,c^{3} \tan \left (f x +e \right )^{2}}{2 a f}\) \(191\)
default \(-\frac {4 c^{3} A \arctan \left (\tan \left (f x +e \right )\right )}{f a}+\frac {2 i c^{3} A \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f a}-\frac {8 i c^{3} B \arctan \left (\tan \left (f x +e \right )\right )}{f a}-\frac {4 c^{3} B \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{f a}+\frac {4 i c^{3} B}{f a \left (-i+\tan \left (f x +e \right )\right )}+\frac {4 c^{3} A}{f a \left (-i+\tan \left (f x +e \right )\right )}+\frac {c^{3} A \tan \left (f x +e \right )}{f a}+\frac {4 i c^{3} \tan \left (f x +e \right ) B}{f a}+\frac {B \,c^{3} \tan \left (f x +e \right )^{2}}{2 a f}\) \(191\)
norman \(\frac {\frac {\left (4 i c^{3} B +A \,c^{3}\right ) \tan \left (f x +e \right )^{3}}{a f}+\frac {\left (8 i c^{3} B +5 A \,c^{3}\right ) \tan \left (f x +e \right )}{a f}-\frac {4 \left (2 i c^{3} B +A \,c^{3}\right ) x}{a}-\frac {-8 i c^{3} A +9 B \,c^{3}}{2 a f}-\frac {4 \left (2 i c^{3} B +A \,c^{3}\right ) x \tan \left (f x +e \right )^{2}}{a}+\frac {B \,c^{3} \tan \left (f x +e \right )^{4}}{2 a f}}{1+\tan \left (f x +e \right )^{2}}-\frac {2 \left (-i c^{3} A +2 B \,c^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{a f}\) \(192\)
risch \(-\frac {2 c^{3} {\mathrm e}^{-2 i \left (f x +e \right )} B}{a f}+\frac {2 i c^{3} {\mathrm e}^{-2 i \left (f x +e \right )} A}{a f}-\frac {16 i c^{3} B x}{a}-\frac {8 c^{3} A x}{a}-\frac {16 i c^{3} B e}{f a}-\frac {8 c^{3} A e}{f a}-\frac {2 c^{3} \left (-i A \,{\mathrm e}^{2 i \left (f x +e \right )}+3 B \,{\mathrm e}^{2 i \left (f x +e \right )}-i A +4 B \right )}{a f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}+\frac {8 c^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B}{f a}-\frac {4 i c^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A}{f a}\) \(199\)

Input:

int((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x,method=_RET 
URNVERBOSE)
 

Output:

-4/f*c^3/a*A*arctan(tan(f*x+e))+2*I/f*c^3/a*A*ln(1+tan(f*x+e)^2)-8*I/f*c^3 
/a*B*arctan(tan(f*x+e))-4/f*c^3/a*B*ln(1+tan(f*x+e)^2)+4*I/f*c^3/a/(-I+tan 
(f*x+e))*B+4/f*c^3/a/(-I+tan(f*x+e))*A+1/f*c^3/a*A*tan(f*x+e)+4*I/f*c^3/a* 
tan(f*x+e)*B+1/2*B*c^3*tan(f*x+e)^2/a/f
 

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. 219 vs. \(2 (107) = 214\).

Time = 0.09 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.81 \[ \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=-\frac {2 \, {\left (4 \, {\left (A + 2 i \, B\right )} c^{3} f x e^{\left (6 i \, f x + 6 i \, e\right )} + {\left (-i \, A + B\right )} c^{3} + 2 \, {\left (4 \, {\left (A + 2 i \, B\right )} c^{3} f x + {\left (-i \, A + 2 \, B\right )} c^{3}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (4 \, {\left (A + 2 i \, B\right )} c^{3} f x + 3 \, {\left (-i \, A + 2 \, B\right )} c^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + 2 \, {\left ({\left (i \, A - 2 \, B\right )} c^{3} e^{\left (6 i \, f x + 6 i \, e\right )} + 2 \, {\left (i \, A - 2 \, B\right )} c^{3} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (i \, A - 2 \, B\right )} c^{3} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )\right )}}{a f e^{\left (6 i \, f x + 6 i \, e\right )} + 2 \, a f e^{\left (4 i \, f x + 4 i \, e\right )} + a f e^{\left (2 i \, f x + 2 i \, e\right )}} \] Input:

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algo 
rithm="fricas")
 

Output:

-2*(4*(A + 2*I*B)*c^3*f*x*e^(6*I*f*x + 6*I*e) + (-I*A + B)*c^3 + 2*(4*(A + 
 2*I*B)*c^3*f*x + (-I*A + 2*B)*c^3)*e^(4*I*f*x + 4*I*e) + (4*(A + 2*I*B)*c 
^3*f*x + 3*(-I*A + 2*B)*c^3)*e^(2*I*f*x + 2*I*e) + 2*((I*A - 2*B)*c^3*e^(6 
*I*f*x + 6*I*e) + 2*(I*A - 2*B)*c^3*e^(4*I*f*x + 4*I*e) + (I*A - 2*B)*c^3* 
e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2*I*e) + 1))/(a*f*e^(6*I*f*x + 6*I*e 
) + 2*a*f*e^(4*I*f*x + 4*I*e) + a*f*e^(2*I*f*x + 2*I*e))
 

Sympy [A] (verification not implemented)

Time = 0.47 (sec) , antiderivative size = 265, normalized size of antiderivative = 2.19 \[ \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=\frac {2 i A c^{3} - 8 B c^{3} + \left (2 i A c^{3} e^{2 i e} - 6 B c^{3} e^{2 i e}\right ) e^{2 i f x}}{a f e^{4 i e} e^{4 i f x} + 2 a f e^{2 i e} e^{2 i f x} + a f} + \begin {cases} \frac {\left (2 i A c^{3} - 2 B c^{3}\right ) e^{- 2 i e} e^{- 2 i f x}}{a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (- \frac {- 8 A c^{3} - 16 i B c^{3}}{a} + \frac {\left (- 8 A c^{3} e^{2 i e} + 4 A c^{3} - 16 i B c^{3} e^{2 i e} + 4 i B c^{3}\right ) e^{- 2 i e}}{a}\right ) & \text {otherwise} \end {cases} - \frac {4 i c^{3} \left (A + 2 i B\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} + \frac {x \left (- 8 A c^{3} - 16 i B c^{3}\right )}{a} \] Input:

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**3/(a+I*a*tan(f*x+e)),x)
 

Output:

(2*I*A*c**3 - 8*B*c**3 + (2*I*A*c**3*exp(2*I*e) - 6*B*c**3*exp(2*I*e))*exp 
(2*I*f*x))/(a*f*exp(4*I*e)*exp(4*I*f*x) + 2*a*f*exp(2*I*e)*exp(2*I*f*x) + 
a*f) + Piecewise(((2*I*A*c**3 - 2*B*c**3)*exp(-2*I*e)*exp(-2*I*f*x)/(a*f), 
 Ne(a*f*exp(2*I*e), 0)), (x*(-(-8*A*c**3 - 16*I*B*c**3)/a + (-8*A*c**3*exp 
(2*I*e) + 4*A*c**3 - 16*I*B*c**3*exp(2*I*e) + 4*I*B*c**3)*exp(-2*I*e)/a), 
True)) - 4*I*c**3*(A + 2*I*B)*log(exp(2*I*f*x) + exp(-2*I*e))/(a*f) + x*(- 
8*A*c**3 - 16*I*B*c**3)/a
 

Maxima [F(-2)]

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

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algo 
rithm="maxima")
 

Output:

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

Giac [A] (verification not implemented)

Time = 0.57 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.93 \[ \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=-\frac {4 \, {\left (-i \, A c^{3} + 2 \, B c^{3}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a f} + \frac {4 \, {\left (A c^{3} + i \, B c^{3}\right )}}{a f {\left (\tan \left (f x + e\right ) - i\right )}} + \frac {B a c^{3} f \tan \left (f x + e\right )^{2} + 2 \, A a c^{3} f \tan \left (f x + e\right ) + 8 i \, B a c^{3} f \tan \left (f x + e\right )}{2 \, a^{2} f^{2}} \] Input:

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algo 
rithm="giac")
 

Output:

-4*(-I*A*c^3 + 2*B*c^3)*log(tan(f*x + e) - I)/(a*f) + 4*(A*c^3 + I*B*c^3)/ 
(a*f*(tan(f*x + e) - I)) + 1/2*(B*a*c^3*f*tan(f*x + e)^2 + 2*A*a*c^3*f*tan 
(f*x + e) + 8*I*B*a*c^3*f*tan(f*x + e))/(a^2*f^2)
 

Mupad [B] (verification not implemented)

Time = 5.14 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.12 \[ \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-\frac {8\,B\,c^3}{a}+\frac {A\,c^3\,4{}\mathrm {i}}{a}\right )}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {c^3\,\left (A+B\,2{}\mathrm {i}\right )}{a}+\frac {B\,c^3\,2{}\mathrm {i}}{a}\right )}{f}+\frac {\frac {4\,B\,c^3}{a}+\frac {\left (4\,A\,c^3+B\,c^3\,8{}\mathrm {i}\right )\,1{}\mathrm {i}}{a}}{f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}+\frac {B\,c^3\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2\,a\,f} \] Input:

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

Output:

(log(tan(e + f*x) - 1i)*((A*c^3*4i)/a - (8*B*c^3)/a))/f + (tan(e + f*x)*(( 
c^3*(A + B*2i))/a + (B*c^3*2i)/a))/f + (((4*A*c^3 + B*c^3*8i)*1i)/a + (4*B 
*c^3)/a)/(f*(tan(e + f*x)*1i + 1)) + (B*c^3*tan(e + f*x)^2)/(2*a*f)
 

Reduce [F]

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

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

Output:

(c**3*( - 16*int(1/(tan(e + f*x) - i),x)*a*f*i + 16*int(1/(tan(e + f*x) - 
i),x)*b*f + 4*log(tan(e + f*x)**2 + 1)*a*i - 8*log(tan(e + f*x)**2 + 1)*b 
+ tan(e + f*x)**2*b + 2*tan(e + f*x)*a + 8*tan(e + f*x)*b*i - 16*a*f*x - 2 
4*b*f*i*x))/(2*a*f)