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

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 = 23, antiderivative size = 294 \[ \int \frac {(c+d x)^2}{(a+i a \cot (e+f x))^3} \, dx=-\frac {3 i d^2 e^{2 i e+2 i f x}}{32 a^3 f^3}+\frac {3 i d^2 e^{4 i e+4 i f x}}{256 a^3 f^3}-\frac {i d^2 e^{6 i e+6 i f x}}{864 a^3 f^3}-\frac {3 d e^{2 i e+2 i f x} (c+d x)}{16 a^3 f^2}+\frac {3 d e^{4 i e+4 i f x} (c+d x)}{64 a^3 f^2}-\frac {d e^{6 i e+6 i f x} (c+d x)}{144 a^3 f^2}+\frac {3 i e^{2 i e+2 i f x} (c+d x)^2}{16 a^3 f}-\frac {3 i e^{4 i e+4 i f x} (c+d x)^2}{32 a^3 f}+\frac {i e^{6 i e+6 i f x} (c+d x)^2}{48 a^3 f}+\frac {(c+d x)^3}{24 a^3 d} \] Output:

-3/32*I*d^2*exp(2*I*e+2*I*f*x)/a^3/f^3+3/256*I*d^2*exp(4*I*e+4*I*f*x)/a^3/ 
f^3-1/864*I*d^2*exp(6*I*e+6*I*f*x)/a^3/f^3-3/16*d*exp(2*I*e+2*I*f*x)*(d*x+ 
c)/a^3/f^2+3/64*d*exp(4*I*e+4*I*f*x)*(d*x+c)/a^3/f^2-1/144*d*exp(6*I*e+6*I 
*f*x)*(d*x+c)/a^3/f^2+3/16*I*exp(2*I*e+2*I*f*x)*(d*x+c)^2/a^3/f-3/32*I*exp 
(4*I*e+4*I*f*x)*(d*x+c)^2/a^3/f+1/48*I*exp(6*I*e+6*I*f*x)*(d*x+c)^2/a^3/f+ 
1/24*(d*x+c)^3/a^3/d
 

Mathematica [A] (verified)

Time = 0.60 (sec) , antiderivative size = 369, normalized size of antiderivative = 1.26 \[ \int \frac {(c+d x)^2}{(a+i a \cot (e+f x))^3} \, dx=\frac {288 f^3 x \left (3 c^2+3 c d x+d^2 x^2\right )+648 ((1+i) c f+d (-1+(1+i) f x)) ((1+i) c f+d (i+(1+i) f x)) \cos (2 f x) (\cos (2 e)+i \sin (2 e))-81 ((2+2 i) c f+d (-1+(2+2 i) f x)) ((2+2 i) c f+d (i+(2+2 i) f x)) \cos (4 f x) (\cos (4 e)+i \sin (4 e))+8 ((3+3 i) c f+d (-1+(3+3 i) f x)) ((3+3 i) c f+d (i+(3+3 i) f x)) \cos (6 f x) (\cos (6 e)+i \sin (6 e))+648 i ((1+i) c f+d (-1+(1+i) f x)) ((1+i) c f+d (i+(1+i) f x)) (\cos (2 e)+i \sin (2 e)) \sin (2 f x)-81 (d-(2+2 i) c f-(2+2 i) d f x) (d+(2-2 i) c f+(2-2 i) d f x) (\cos (4 e)+i \sin (4 e)) \sin (4 f x)+8 i ((3+3 i) c f+d (-1+(3+3 i) f x)) ((3+3 i) c f+d (i+(3+3 i) f x)) (\cos (6 e)+i \sin (6 e)) \sin (6 f x)}{6912 a^3 f^3} \] Input:

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

Output:

(288*f^3*x*(3*c^2 + 3*c*d*x + d^2*x^2) + 648*((1 + I)*c*f + d*(-1 + (1 + I 
)*f*x))*((1 + I)*c*f + d*(I + (1 + I)*f*x))*Cos[2*f*x]*(Cos[2*e] + I*Sin[2 
*e]) - 81*((2 + 2*I)*c*f + d*(-1 + (2 + 2*I)*f*x))*((2 + 2*I)*c*f + d*(I + 
 (2 + 2*I)*f*x))*Cos[4*f*x]*(Cos[4*e] + I*Sin[4*e]) + 8*((3 + 3*I)*c*f + d 
*(-1 + (3 + 3*I)*f*x))*((3 + 3*I)*c*f + d*(I + (3 + 3*I)*f*x))*Cos[6*f*x]* 
(Cos[6*e] + I*Sin[6*e]) + (648*I)*((1 + I)*c*f + d*(-1 + (1 + I)*f*x))*((1 
 + I)*c*f + d*(I + (1 + I)*f*x))*(Cos[2*e] + I*Sin[2*e])*Sin[2*f*x] - 81*( 
d - (2 + 2*I)*c*f - (2 + 2*I)*d*f*x)*(d + (2 - 2*I)*c*f + (2 - 2*I)*d*f*x) 
*(Cos[4*e] + I*Sin[4*e])*Sin[4*f*x] + (8*I)*((3 + 3*I)*c*f + d*(-1 + (3 + 
3*I)*f*x))*((3 + 3*I)*c*f + d*(I + (3 + 3*I)*f*x))*(Cos[6*e] + I*Sin[6*e]) 
*Sin[6*f*x])/(6912*a^3*f^3)
 

Rubi [A] (verified)

Time = 0.53 (sec) , antiderivative size = 294, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3042, 4212, 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+d x)^2}{(a+i a \cot (e+f x))^3} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4212

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

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {3 d (c+d x) e^{2 i e+2 i f x}}{16 a^3 f^2}+\frac {3 d (c+d x) e^{4 i e+4 i f x}}{64 a^3 f^2}-\frac {d (c+d x) e^{6 i e+6 i f x}}{144 a^3 f^2}+\frac {3 i (c+d x)^2 e^{2 i e+2 i f x}}{16 a^3 f}-\frac {3 i (c+d x)^2 e^{4 i e+4 i f x}}{32 a^3 f}+\frac {i (c+d x)^2 e^{6 i e+6 i f x}}{48 a^3 f}+\frac {(c+d x)^3}{24 a^3 d}-\frac {3 i d^2 e^{2 i e+2 i f x}}{32 a^3 f^3}+\frac {3 i d^2 e^{4 i e+4 i f x}}{256 a^3 f^3}-\frac {i d^2 e^{6 i e+6 i f x}}{864 a^3 f^3}\)

Input:

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

Output:

(((-3*I)/32)*d^2*E^((2*I)*e + (2*I)*f*x))/(a^3*f^3) + (((3*I)/256)*d^2*E^( 
(4*I)*e + (4*I)*f*x))/(a^3*f^3) - ((I/864)*d^2*E^((6*I)*e + (6*I)*f*x))/(a 
^3*f^3) - (3*d*E^((2*I)*e + (2*I)*f*x)*(c + d*x))/(16*a^3*f^2) + (3*d*E^(( 
4*I)*e + (4*I)*f*x)*(c + d*x))/(64*a^3*f^2) - (d*E^((6*I)*e + (6*I)*f*x)*( 
c + d*x))/(144*a^3*f^2) + (((3*I)/16)*E^((2*I)*e + (2*I)*f*x)*(c + d*x)^2) 
/(a^3*f) - (((3*I)/32)*E^((4*I)*e + (4*I)*f*x)*(c + d*x)^2)/(a^3*f) + ((I/ 
48)*E^((6*I)*e + (6*I)*f*x)*(c + d*x)^2)/(a^3*f) + (c + d*x)^3/(24*a^3*d)
 

Defintions of rubi rules used

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

Time = 1.13 (sec) , antiderivative size = 238, normalized size of antiderivative = 0.81

method result size
risch \(\frac {d^{2} x^{3}}{24 a^{3}}+\frac {d c \,x^{2}}{8 a^{3}}+\frac {c^{2} x}{8 a^{3}}+\frac {c^{3}}{24 a^{3} d}+\frac {i \left (18 d^{2} x^{2} f^{2}+36 c d \,f^{2} x +6 i d^{2} f x +18 c^{2} f^{2}+6 i c d f -d^{2}\right ) {\mathrm e}^{6 i \left (f x +e \right )}}{864 a^{3} f^{3}}-\frac {3 i \left (8 d^{2} x^{2} f^{2}+16 c d \,f^{2} x +4 i d^{2} f x +8 c^{2} f^{2}+4 i c d f -d^{2}\right ) {\mathrm e}^{4 i \left (f x +e \right )}}{256 a^{3} f^{3}}+\frac {3 i \left (2 d^{2} x^{2} f^{2}+4 c d \,f^{2} x +2 i d^{2} f x +2 c^{2} f^{2}+2 i c d f -d^{2}\right ) {\mathrm e}^{2 i \left (f x +e \right )}}{32 a^{3} f^{3}}\) \(238\)
parallelrisch \(\frac {3 \tan \left (f x +e \right )^{3} \left (24 \left (d^{2} x^{3}+3 c d \,x^{2}+3 x \,c^{2}\right ) f^{3}+6 i \left (-29 d^{2} x^{2}-58 c d x -36 c^{2}\right ) f^{2}+\left (139 d^{2} x +180 c d \right ) f +81 i d^{2}\right )+6 \left (108 i x \left (\frac {1}{3} d^{2} x^{2}+c d x +c^{2}\right ) f^{3}+9 \left (d^{2} x^{2}+2 c d x +8 c^{2}\right ) f^{2}+96 i d \left (\frac {23 d x}{64}+c \right ) f -52 d^{2}\right ) \tan \left (f x +e \right )^{2}+756 \left (-\frac {2 \left (d^{2} x^{2}+3 c d x +3 c^{2}\right ) f^{2}}{7}-i \left (\frac {d x}{2}+c \right ) d f +\frac {41 d^{2}}{84}\right ) f x \tan \left (f x +e \right )-216 i x \left (\frac {1}{3} d^{2} x^{2}+c d x +c^{2}\right ) f^{3}+18 \left (11 d^{2} x^{2}+22 c d x +4 c^{2}\right ) f^{2}+132 i d \left (\frac {85 d x}{44}+c \right ) f -85 d^{2}}{1728 f^{3} a^{3} \left (-i-3 \tan \left (f x +e \right )+3 i \tan \left (f x +e \right )^{2}+\tan \left (f x +e \right )^{3}\right )}\) \(309\)
derivativedivides \(\text {Expression too large to display}\) \(1879\)
default \(\text {Expression too large to display}\) \(1879\)

Input:

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

Output:

1/24/a^3*d^2*x^3+1/8/a^3*d*c*x^2+1/8/a^3*c^2*x+1/24/a^3/d*c^3+1/864*I*(18* 
d^2*x^2*f^2+6*I*d^2*f*x+36*c*d*f^2*x+6*I*c*d*f+18*c^2*f^2-d^2)/a^3/f^3*exp 
(6*I*(f*x+e))-3/256*I*(8*d^2*x^2*f^2+4*I*d^2*f*x+16*c*d*f^2*x+4*I*c*d*f+8* 
c^2*f^2-d^2)/a^3/f^3*exp(4*I*(f*x+e))+3/32*I*(2*d^2*x^2*f^2+2*I*d^2*f*x+4* 
c*d*f^2*x+2*I*c*d*f+2*c^2*f^2-d^2)/a^3/f^3*exp(2*I*(f*x+e))
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 211, normalized size of antiderivative = 0.72 \[ \int \frac {(c+d x)^2}{(a+i a \cot (e+f x))^3} \, dx=\frac {288 \, d^{2} f^{3} x^{3} + 864 \, c d f^{3} x^{2} + 864 \, c^{2} f^{3} x - 8 \, {\left (-18 i \, d^{2} f^{2} x^{2} - 18 i \, c^{2} f^{2} + 6 \, c d f + i \, d^{2} + 6 \, {\left (-6 i \, c d f^{2} + d^{2} f\right )} x\right )} e^{\left (6 i \, f x + 6 i \, e\right )} - 81 \, {\left (8 i \, d^{2} f^{2} x^{2} + 8 i \, c^{2} f^{2} - 4 \, c d f - i \, d^{2} + 4 \, {\left (4 i \, c d f^{2} - d^{2} f\right )} x\right )} e^{\left (4 i \, f x + 4 i \, e\right )} - 648 \, {\left (-2 i \, d^{2} f^{2} x^{2} - 2 i \, c^{2} f^{2} + 2 \, c d f + i \, d^{2} + 2 \, {\left (-2 i \, c d f^{2} + d^{2} f\right )} x\right )} e^{\left (2 i \, f x + 2 i \, e\right )}}{6912 \, a^{3} f^{3}} \] Input:

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

Output:

1/6912*(288*d^2*f^3*x^3 + 864*c*d*f^3*x^2 + 864*c^2*f^3*x - 8*(-18*I*d^2*f 
^2*x^2 - 18*I*c^2*f^2 + 6*c*d*f + I*d^2 + 6*(-6*I*c*d*f^2 + d^2*f)*x)*e^(6 
*I*f*x + 6*I*e) - 81*(8*I*d^2*f^2*x^2 + 8*I*c^2*f^2 - 4*c*d*f - I*d^2 + 4* 
(4*I*c*d*f^2 - d^2*f)*x)*e^(4*I*f*x + 4*I*e) - 648*(-2*I*d^2*f^2*x^2 - 2*I 
*c^2*f^2 + 2*c*d*f + I*d^2 + 2*(-2*I*c*d*f^2 + d^2*f)*x)*e^(2*I*f*x + 2*I* 
e))/(a^3*f^3)
 

Sympy [A] (verification not implemented)

Time = 0.35 (sec) , antiderivative size = 575, normalized size of antiderivative = 1.96 \[ \int \frac {(c+d x)^2}{(a+i a \cot (e+f x))^3} \, dx=\begin {cases} \frac {\left (1327104 i a^{6} c^{2} f^{8} e^{2 i e} + 2654208 i a^{6} c d f^{8} x e^{2 i e} - 1327104 a^{6} c d f^{7} e^{2 i e} + 1327104 i a^{6} d^{2} f^{8} x^{2} e^{2 i e} - 1327104 a^{6} d^{2} f^{7} x e^{2 i e} - 663552 i a^{6} d^{2} f^{6} e^{2 i e}\right ) e^{2 i f x} + \left (- 663552 i a^{6} c^{2} f^{8} e^{4 i e} - 1327104 i a^{6} c d f^{8} x e^{4 i e} + 331776 a^{6} c d f^{7} e^{4 i e} - 663552 i a^{6} d^{2} f^{8} x^{2} e^{4 i e} + 331776 a^{6} d^{2} f^{7} x e^{4 i e} + 82944 i a^{6} d^{2} f^{6} e^{4 i e}\right ) e^{4 i f x} + \left (147456 i a^{6} c^{2} f^{8} e^{6 i e} + 294912 i a^{6} c d f^{8} x e^{6 i e} - 49152 a^{6} c d f^{7} e^{6 i e} + 147456 i a^{6} d^{2} f^{8} x^{2} e^{6 i e} - 49152 a^{6} d^{2} f^{7} x e^{6 i e} - 8192 i a^{6} d^{2} f^{6} e^{6 i e}\right ) e^{6 i f x}}{7077888 a^{9} f^{9}} & \text {for}\: a^{9} f^{9} \neq 0 \\\frac {x^{3} \left (- d^{2} e^{6 i e} + 3 d^{2} e^{4 i e} - 3 d^{2} e^{2 i e}\right )}{24 a^{3}} + \frac {x^{2} \left (- c d e^{6 i e} + 3 c d e^{4 i e} - 3 c d e^{2 i e}\right )}{8 a^{3}} + \frac {x \left (- c^{2} e^{6 i e} + 3 c^{2} e^{4 i e} - 3 c^{2} e^{2 i e}\right )}{8 a^{3}} & \text {otherwise} \end {cases} + \frac {c^{2} x}{8 a^{3}} + \frac {c d x^{2}}{8 a^{3}} + \frac {d^{2} x^{3}}{24 a^{3}} \] Input:

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

Output:

Piecewise((((1327104*I*a**6*c**2*f**8*exp(2*I*e) + 2654208*I*a**6*c*d*f**8 
*x*exp(2*I*e) - 1327104*a**6*c*d*f**7*exp(2*I*e) + 1327104*I*a**6*d**2*f** 
8*x**2*exp(2*I*e) - 1327104*a**6*d**2*f**7*x*exp(2*I*e) - 663552*I*a**6*d* 
*2*f**6*exp(2*I*e))*exp(2*I*f*x) + (-663552*I*a**6*c**2*f**8*exp(4*I*e) - 
1327104*I*a**6*c*d*f**8*x*exp(4*I*e) + 331776*a**6*c*d*f**7*exp(4*I*e) - 6 
63552*I*a**6*d**2*f**8*x**2*exp(4*I*e) + 331776*a**6*d**2*f**7*x*exp(4*I*e 
) + 82944*I*a**6*d**2*f**6*exp(4*I*e))*exp(4*I*f*x) + (147456*I*a**6*c**2* 
f**8*exp(6*I*e) + 294912*I*a**6*c*d*f**8*x*exp(6*I*e) - 49152*a**6*c*d*f** 
7*exp(6*I*e) + 147456*I*a**6*d**2*f**8*x**2*exp(6*I*e) - 49152*a**6*d**2*f 
**7*x*exp(6*I*e) - 8192*I*a**6*d**2*f**6*exp(6*I*e))*exp(6*I*f*x))/(707788 
8*a**9*f**9), Ne(a**9*f**9, 0)), (x**3*(-d**2*exp(6*I*e) + 3*d**2*exp(4*I* 
e) - 3*d**2*exp(2*I*e))/(24*a**3) + x**2*(-c*d*exp(6*I*e) + 3*c*d*exp(4*I* 
e) - 3*c*d*exp(2*I*e))/(8*a**3) + x*(-c**2*exp(6*I*e) + 3*c**2*exp(4*I*e) 
- 3*c**2*exp(2*I*e))/(8*a**3), True)) + c**2*x/(8*a**3) + c*d*x**2/(8*a**3 
) + d**2*x**3/(24*a**3)
 

Maxima [F(-2)]

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

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 333, normalized size of antiderivative = 1.13 \[ \int \frac {(c+d x)^2}{(a+i a \cot (e+f x))^3} \, dx=\frac {288 \, d^{2} f^{3} x^{3} + 864 \, c d f^{3} x^{2} + 144 i \, d^{2} f^{2} x^{2} e^{\left (6 i \, f x + 6 i \, e\right )} - 648 i \, d^{2} f^{2} x^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 1296 i \, d^{2} f^{2} x^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 864 \, c^{2} f^{3} x + 288 i \, c d f^{2} x e^{\left (6 i \, f x + 6 i \, e\right )} - 1296 i \, c d f^{2} x e^{\left (4 i \, f x + 4 i \, e\right )} + 2592 i \, c d f^{2} x e^{\left (2 i \, f x + 2 i \, e\right )} + 144 i \, c^{2} f^{2} e^{\left (6 i \, f x + 6 i \, e\right )} - 48 \, d^{2} f x e^{\left (6 i \, f x + 6 i \, e\right )} - 648 i \, c^{2} f^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 324 \, d^{2} f x e^{\left (4 i \, f x + 4 i \, e\right )} + 1296 i \, c^{2} f^{2} e^{\left (2 i \, f x + 2 i \, e\right )} - 1296 \, d^{2} f x e^{\left (2 i \, f x + 2 i \, e\right )} - 48 \, c d f e^{\left (6 i \, f x + 6 i \, e\right )} + 324 \, c d f e^{\left (4 i \, f x + 4 i \, e\right )} - 1296 \, c d f e^{\left (2 i \, f x + 2 i \, e\right )} - 8 i \, d^{2} e^{\left (6 i \, f x + 6 i \, e\right )} + 81 i \, d^{2} e^{\left (4 i \, f x + 4 i \, e\right )} - 648 i \, d^{2} e^{\left (2 i \, f x + 2 i \, e\right )}}{6912 \, a^{3} f^{3}} \] Input:

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

Output:

1/6912*(288*d^2*f^3*x^3 + 864*c*d*f^3*x^2 + 144*I*d^2*f^2*x^2*e^(6*I*f*x + 
 6*I*e) - 648*I*d^2*f^2*x^2*e^(4*I*f*x + 4*I*e) + 1296*I*d^2*f^2*x^2*e^(2* 
I*f*x + 2*I*e) + 864*c^2*f^3*x + 288*I*c*d*f^2*x*e^(6*I*f*x + 6*I*e) - 129 
6*I*c*d*f^2*x*e^(4*I*f*x + 4*I*e) + 2592*I*c*d*f^2*x*e^(2*I*f*x + 2*I*e) + 
 144*I*c^2*f^2*e^(6*I*f*x + 6*I*e) - 48*d^2*f*x*e^(6*I*f*x + 6*I*e) - 648* 
I*c^2*f^2*e^(4*I*f*x + 4*I*e) + 324*d^2*f*x*e^(4*I*f*x + 4*I*e) + 1296*I*c 
^2*f^2*e^(2*I*f*x + 2*I*e) - 1296*d^2*f*x*e^(2*I*f*x + 2*I*e) - 48*c*d*f*e 
^(6*I*f*x + 6*I*e) + 324*c*d*f*e^(4*I*f*x + 4*I*e) - 1296*c*d*f*e^(2*I*f*x 
 + 2*I*e) - 8*I*d^2*e^(6*I*f*x + 6*I*e) + 81*I*d^2*e^(4*I*f*x + 4*I*e) - 6 
48*I*d^2*e^(2*I*f*x + 2*I*e))/(a^3*f^3)
 

Mupad [B] (verification not implemented)

Time = 1.05 (sec) , antiderivative size = 263, normalized size of antiderivative = 0.89 \[ \int \frac {(c+d x)^2}{(a+i a \cot (e+f x))^3} \, dx={\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,\left (\frac {\left (6\,c^2\,f^2+c\,d\,f\,6{}\mathrm {i}-3\,d^2\right )\,1{}\mathrm {i}}{32\,a^3\,f^3}+\frac {d^2\,x^2\,3{}\mathrm {i}}{16\,a^3\,f}+\frac {d\,x\,\left (2\,c\,f+d\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{16\,a^3\,f^2}\right )-{\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}\,\left (\frac {\left (24\,c^2\,f^2+c\,d\,f\,12{}\mathrm {i}-3\,d^2\right )\,1{}\mathrm {i}}{256\,a^3\,f^3}+\frac {d^2\,x^2\,3{}\mathrm {i}}{32\,a^3\,f}+\frac {d\,x\,\left (4\,c\,f+d\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{64\,a^3\,f^2}\right )+{\mathrm {e}}^{e\,6{}\mathrm {i}+f\,x\,6{}\mathrm {i}}\,\left (\frac {\left (18\,c^2\,f^2+c\,d\,f\,6{}\mathrm {i}-d^2\right )\,1{}\mathrm {i}}{864\,a^3\,f^3}+\frac {d^2\,x^2\,1{}\mathrm {i}}{48\,a^3\,f}+\frac {d\,x\,\left (6\,c\,f+d\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{144\,a^3\,f^2}\right )+\frac {c^2\,x}{8\,a^3}+\frac {d^2\,x^3}{24\,a^3}+\frac {c\,d\,x^2}{8\,a^3} \] Input:

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

Output:

exp(e*2i + f*x*2i)*(((6*c^2*f^2 - 3*d^2 + c*d*f*6i)*1i)/(32*a^3*f^3) + (d^ 
2*x^2*3i)/(16*a^3*f) + (d*x*(d*1i + 2*c*f)*3i)/(16*a^3*f^2)) - exp(e*4i + 
f*x*4i)*(((24*c^2*f^2 - 3*d^2 + c*d*f*12i)*1i)/(256*a^3*f^3) + (d^2*x^2*3i 
)/(32*a^3*f) + (d*x*(d*1i + 4*c*f)*3i)/(64*a^3*f^2)) + exp(e*6i + f*x*6i)* 
(((18*c^2*f^2 - d^2 + c*d*f*6i)*1i)/(864*a^3*f^3) + (d^2*x^2*1i)/(48*a^3*f 
) + (d*x*(d*1i + 6*c*f)*1i)/(144*a^3*f^2)) + (c^2*x)/(8*a^3) + (d^2*x^3)/( 
24*a^3) + (c*d*x^2)/(8*a^3)
 

Reduce [F]

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

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

Output:

(3*int(sin(e + f*x)**3/(4*cos(e + f*x)*sin(e + f*x)**2*i - cos(e + f*x)*i 
+ 4*sin(e + f*x)**3 - 3*sin(e + f*x)),x)*c**2*f - 3*int(x**2/(cot(e + f*x) 
**3*i + 3*cot(e + f*x)**2 - 3*cot(e + f*x)*i - 1),x)*d**2*f - 6*int(x/(cot 
(e + f*x)**3*i + 3*cot(e + f*x)**2 - 3*cot(e + f*x)*i - 1),x)*c*d*f + 3*lo 
g(tan((e + f*x)/2)**2 + 1)*c**2*i - log(tan((e + f*x)/2)**6*i - 6*tan((e + 
 f*x)/2)**5 - 15*tan((e + f*x)/2)**4*i + 20*tan((e + f*x)/2)**3 + 15*tan(( 
e + f*x)/2)**2*i - 6*tan((e + f*x)/2) - i)*c**2*i + 3*c**2*f*x)/(3*a**3*f)