\(\int \frac {(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx\) [1080]

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 = 28, antiderivative size = 129 \[ \int \frac {(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=\frac {\left (c^3-3 i c^2 d+3 c d^2+3 i d^3\right ) x}{2 a}+\frac {(3 i c-d) d^2 \log (\cos (e+f x))}{a f}-\frac {(c+3 i d) d^2 \tan (e+f x)}{2 a f}+\frac {(i c-d) (c+d \tan (e+f x))^2}{2 f (a+i a \tan (e+f x))} \] Output:

1/2*(c^3-3*I*c^2*d+3*c*d^2+3*I*d^3)*x/a+(3*I*c-d)*d^2*ln(cos(f*x+e))/a/f-1 
/2*(c+3*I*d)*d^2*tan(f*x+e)/a/f+1/2*(I*c-d)*(c+d*tan(f*x+e))^2/f/(a+I*a*ta 
n(f*x+e))
 

Mathematica [A] (verified)

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

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

Output:

((-1/4*I)*(-3*(c + I*d)^4*Log[I - Tan[e + f*x]] + 3*(c - I*d)^4*Log[I + Ta 
n[e + f*x]] + (6*I)*d^2*(-6*c^2 + d^2)*Tan[e + f*x] - (12*I)*c*d^3*Tan[e + 
 f*x]^2 - (2*I)*d^4*Tan[e + f*x]^3 + ((2*I)*(c + d*Tan[e + f*x])^4)/(-I + 
Tan[e + f*x]) + (2*I)*(2*c - I*d)*((I*c - d)^3*Log[I - Tan[e + f*x]] - (I* 
c + d)^3*Log[I + Tan[e + f*x]] + 6*c*d^2*Tan[e + f*x] + d^3*Tan[e + f*x]^2 
)))/(a*(c + I*d)*f)
 

Rubi [A] (verified)

Time = 0.53 (sec) , antiderivative size = 127, normalized size of antiderivative = 0.98, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3042, 4033, 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 {(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4033

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

\(\displaystyle \frac {a x \left (c^3-3 i c^2 d+3 c d^2+3 i d^3\right )-\frac {a d^2 (c+3 i d) \tan (e+f x)}{f}+\frac {2 a d^2 (-d+3 i c) \log (\cos (e+f x))}{f}}{2 a^2}+\frac {(-d+i c) (c+d \tan (e+f x))^2}{2 f (a+i a \tan (e+f x))}\)

Input:

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

Output:

((I*c - d)*(c + d*Tan[e + f*x])^2)/(2*f*(a + I*a*Tan[e + f*x])) + (a*(c^3 
- (3*I)*c^2*d + 3*c*d^2 + (3*I)*d^3)*x + (2*a*((3*I)*c - d)*d^2*Log[Cos[e 
+ f*x]])/f - (a*(c + (3*I)*d)*d^2*Tan[e + f*x])/f)/(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 4033
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)/((a_) + (b_.)*tan[(e_.) + 
(f_.)*(x_)]), x_Symbol] :> Simp[(b*c - a*d)*((c + d*Tan[e + f*x])^(n - 1)/( 
2*a*f*(a + b*Tan[e + f*x]))), x] + Simp[1/(2*a^2)   Int[(c + d*Tan[e + f*x] 
)^(n - 2)*Simp[a*c^2 + a*d^2*(n - 1) - b*c*d*n - d*(a*c*(n - 2) + b*d*n)*Ta 
n[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] 
 && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[n, 1]
 
Maple [A] (verified)

Time = 0.26 (sec) , antiderivative size = 224, normalized size of antiderivative = 1.74

method result size
risch \(-\frac {3 i x \,c^{2} d}{2 a}+\frac {5 i x \,d^{3}}{2 a}+\frac {c^{3} x}{2 a}+\frac {9 x c \,d^{2}}{2 a}-\frac {3 \,{\mathrm e}^{-2 i \left (f x +e \right )} c^{2} d}{4 a f}+\frac {{\mathrm e}^{-2 i \left (f x +e \right )} d^{3}}{4 a f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c^{3}}{4 a f}-\frac {3 i {\mathrm e}^{-2 i \left (f x +e \right )} c \,d^{2}}{4 a f}+\frac {6 d^{2} c e}{a f}+\frac {2 i d^{3} e}{a f}+\frac {2 d^{3}}{f a \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {3 i d^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c}{a f}-\frac {d^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{a f}\) \(224\)
derivativedivides \(-\frac {3 i c^{2} d \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {3 i d^{3} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {d^{3} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f a}+\frac {3 i c^{2} d}{2 f a \left (-i+\tan \left (f x +e \right )\right )}-\frac {3 i c \,d^{2} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f a}+\frac {c^{3} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}-\frac {i d^{3} \tan \left (f x +e \right )}{f a}+\frac {3 c \,d^{2} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}-\frac {i d^{3}}{2 f a \left (-i+\tan \left (f x +e \right )\right )}+\frac {c^{3}}{2 f a \left (-i+\tan \left (f x +e \right )\right )}-\frac {3 c \,d^{2}}{2 f a \left (-i+\tan \left (f x +e \right )\right )}\) \(234\)
default \(-\frac {3 i c^{2} d \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {3 i d^{3} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}+\frac {d^{3} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f a}+\frac {3 i c^{2} d}{2 f a \left (-i+\tan \left (f x +e \right )\right )}-\frac {3 i c \,d^{2} \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f a}+\frac {c^{3} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}-\frac {i d^{3} \tan \left (f x +e \right )}{f a}+\frac {3 c \,d^{2} \arctan \left (\tan \left (f x +e \right )\right )}{2 f a}-\frac {i d^{3}}{2 f a \left (-i+\tan \left (f x +e \right )\right )}+\frac {c^{3}}{2 f a \left (-i+\tan \left (f x +e \right )\right )}-\frac {3 c \,d^{2}}{2 f a \left (-i+\tan \left (f x +e \right )\right )}\) \(234\)

Input:

int((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x,method=_RETURNVERBOSE)
 

Output:

-3/2*I*x/a*c^2*d+5/2*I*x/a*d^3+1/2*c^3*x/a+9/2*x/a*c*d^2-3/4/a/f*exp(-2*I* 
(f*x+e))*c^2*d+1/4/a/f*exp(-2*I*(f*x+e))*d^3+1/4*I/a/f*exp(-2*I*(f*x+e))*c 
^3-3/4*I/a/f*exp(-2*I*(f*x+e))*c*d^2+6*d^2/a/f*c*e+2*I*d^3/a/f*e+2/f/a*d^3 
/(exp(2*I*(f*x+e))+1)+3*I*d^2/a/f*ln(exp(2*I*(f*x+e))+1)*c-d^3/a/f*ln(exp( 
2*I*(f*x+e))+1)
 

Fricas [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 197, normalized size of antiderivative = 1.53 \[ \int \frac {(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=\frac {2 \, {\left (c^{3} - 3 i \, c^{2} d + 9 \, c d^{2} + 5 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + d^{3} + {\left (i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + 9 \, d^{3} + 2 \, {\left (c^{3} - 3 i \, c^{2} d + 9 \, c d^{2} + 5 i \, d^{3}\right )} f x\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - 4 \, {\left ({\left (-3 i \, c d^{2} + d^{3}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (-3 i \, c d^{2} + d^{3}\right )} 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 )}{4 \, {\left (a f e^{\left (4 i \, f x + 4 i \, e\right )} + a f e^{\left (2 i \, f x + 2 i \, e\right )}\right )}} \] Input:

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algorithm="fricas")
 

Output:

1/4*(2*(c^3 - 3*I*c^2*d + 9*c*d^2 + 5*I*d^3)*f*x*e^(4*I*f*x + 4*I*e) + I*c 
^3 - 3*c^2*d - 3*I*c*d^2 + d^3 + (I*c^3 - 3*c^2*d - 3*I*c*d^2 + 9*d^3 + 2* 
(c^3 - 3*I*c^2*d + 9*c*d^2 + 5*I*d^3)*f*x)*e^(2*I*f*x + 2*I*e) - 4*((-3*I* 
c*d^2 + d^3)*e^(4*I*f*x + 4*I*e) + (-3*I*c*d^2 + d^3)*e^(2*I*f*x + 2*I*e)) 
*log(e^(2*I*f*x + 2*I*e) + 1))/(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.40 (sec) , antiderivative size = 260, normalized size of antiderivative = 2.02 \[ \int \frac {(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=\frac {2 d^{3}}{a f e^{2 i e} e^{2 i f x} + a f} + \begin {cases} \frac {\left (i c^{3} - 3 c^{2} d - 3 i c d^{2} + d^{3}\right ) e^{- 2 i e} e^{- 2 i f x}}{4 a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (- \frac {c^{3} - 3 i c^{2} d + 9 c d^{2} + 5 i d^{3}}{2 a} + \frac {\left (c^{3} e^{2 i e} + c^{3} - 3 i c^{2} d e^{2 i e} + 3 i c^{2} d + 9 c d^{2} e^{2 i e} - 3 c d^{2} + 5 i d^{3} e^{2 i e} - i d^{3}\right ) e^{- 2 i e}}{2 a}\right ) & \text {otherwise} \end {cases} + \frac {i d^{2} \cdot \left (3 c + i d\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} + \frac {x \left (c^{3} - 3 i c^{2} d + 9 c d^{2} + 5 i d^{3}\right )}{2 a} \] Input:

integrate((c+d*tan(f*x+e))**3/(a+I*a*tan(f*x+e)),x)
 

Output:

2*d**3/(a*f*exp(2*I*e)*exp(2*I*f*x) + a*f) + Piecewise(((I*c**3 - 3*c**2*d 
 - 3*I*c*d**2 + d**3)*exp(-2*I*e)*exp(-2*I*f*x)/(4*a*f), Ne(a*f*exp(2*I*e) 
, 0)), (x*(-(c**3 - 3*I*c**2*d + 9*c*d**2 + 5*I*d**3)/(2*a) + (c**3*exp(2* 
I*e) + c**3 - 3*I*c**2*d*exp(2*I*e) + 3*I*c**2*d + 9*c*d**2*exp(2*I*e) - 3 
*c*d**2 + 5*I*d**3*exp(2*I*e) - I*d**3)*exp(-2*I*e)/(2*a)), True)) + I*d** 
2*(3*c + I*d)*log(exp(2*I*f*x) + exp(-2*I*e))/(a*f) + x*(c**3 - 3*I*c**2*d 
 + 9*c*d**2 + 5*I*d**3)/(2*a)
 

Maxima [F(-2)]

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

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algorithm="maxima")
 

Output:

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

Giac [A] (verification not implemented)

Time = 0.56 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.06 \[ \int \frac {(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=-\frac {i \, d^{3} \tan \left (f x + e\right )}{a f} + \frac {{\left (i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} - d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{4 \, a f} + \frac {{\left (-i \, c^{3} - 3 \, c^{2} d - 9 i \, c d^{2} + 5 \, d^{3}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{4 \, a f} + \frac {c^{3} + 3 i \, c^{2} d - 3 \, c d^{2} - i \, d^{3}}{2 \, a f {\left (\tan \left (f x + e\right ) - i\right )}} \] Input:

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e)),x, algorithm="giac")
 

Output:

-I*d^3*tan(f*x + e)/(a*f) + 1/4*(I*c^3 + 3*c^2*d - 3*I*c*d^2 - d^3)*log(ta 
n(f*x + e) + I)/(a*f) + 1/4*(-I*c^3 - 3*c^2*d - 9*I*c*d^2 + 5*d^3)*log(tan 
(f*x + e) - I)/(a*f) + 1/2*(c^3 + 3*I*c^2*d - 3*c*d^2 - I*d^3)/(a*f*(tan(f 
*x + e) - I))
 

Mupad [B] (verification not implemented)

Time = 2.50 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.36 \[ \int \frac {(c+d \tan (e+f x))^3}{a+i a \tan (e+f x)} \, dx=-\frac {\frac {3\,c^2\,d-d^3}{2\,a}+\frac {\left (d^3\,1{}\mathrm {i}+3\,c\,d^2\right )\,1{}\mathrm {i}}{2\,a}-\frac {-d^3+c^3\,1{}\mathrm {i}}{2\,a}}{f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}-\frac {d^3\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}{a\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}{4\,a\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (c^3\,1{}\mathrm {i}+3\,c^2\,d+c\,d^2\,9{}\mathrm {i}-5\,d^3\right )}{4\,a\,f} \] Input:

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

Output:

- ((3*c^2*d - d^3)/(2*a) + ((3*c*d^2 + d^3*1i)*1i)/(2*a) - (c^3*1i - d^3)/ 
(2*a))/(f*(tan(e + f*x)*1i + 1)) - (d^3*tan(e + f*x)*1i)/(a*f) - (log(tan( 
e + f*x) + 1i)*(c*d^2*3i - 3*c^2*d - c^3*1i + d^3))/(4*a*f) - (log(tan(e + 
 f*x) - 1i)*(c*d^2*9i + 3*c^2*d + c^3*1i - 5*d^3))/(4*a*f)
 

Reduce [F]

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

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

Output:

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