\(\int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx\) [7]

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

Optimal result

Integrand size = 20, antiderivative size = 262 \[ \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx=-\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {4 i a^2 (c+d x)^2 \arctan \left (e^{i (e+f x)}\right )}{f}+\frac {2 a^2 d (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f^2}+\frac {4 i a^2 d (c+d x) \operatorname {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \operatorname {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2}-\frac {i a^2 d^2 \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{f^3}-\frac {4 a^2 d^2 \operatorname {PolyLog}\left (3,-i e^{i (e+f x)}\right )}{f^3}+\frac {4 a^2 d^2 \operatorname {PolyLog}\left (3,i e^{i (e+f x)}\right )}{f^3}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f} \] Output:

-I*a^2*(d*x+c)^2/f+1/3*a^2*(d*x+c)^3/d-4*I*a^2*(d*x+c)^2*arctan(exp(I*(f*x 
+e)))/f+2*a^2*d*(d*x+c)*ln(1+exp(2*I*(f*x+e)))/f^2+4*I*a^2*d*(d*x+c)*polyl 
og(2,-I*exp(I*(f*x+e)))/f^2-4*I*a^2*d*(d*x+c)*polylog(2,I*exp(I*(f*x+e)))/ 
f^2-I*a^2*d^2*polylog(2,-exp(2*I*(f*x+e)))/f^3-4*a^2*d^2*polylog(3,-I*exp( 
I*(f*x+e)))/f^3+4*a^2*d^2*polylog(3,I*exp(I*(f*x+e)))/f^3+a^2*(d*x+c)^2*ta 
n(f*x+e)/f
 

Mathematica [A] (verified)

Time = 1.75 (sec) , antiderivative size = 232, normalized size of antiderivative = 0.89 \[ \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx=\frac {1}{3} a^2 \left (\frac {(c+d x)^3}{d}-\frac {12 i (c+d x)^2 \arctan \left (e^{i (e+f x)}\right )}{f}-\frac {3 i \left (f (c+d x) \left (f (c+d x)+2 i d \log \left (1+e^{2 i (e+f x)}\right )\right )+d^2 \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )\right )}{f^3}+\frac {12 i d \left (f (c+d x) \operatorname {PolyLog}\left (2,-i e^{i (e+f x)}\right )+i d \operatorname {PolyLog}\left (3,-i e^{i (e+f x)}\right )\right )}{f^3}+\frac {12 d \left (-i f (c+d x) \operatorname {PolyLog}\left (2,i e^{i (e+f x)}\right )+d \operatorname {PolyLog}\left (3,i e^{i (e+f x)}\right )\right )}{f^3}+\frac {3 (c+d x)^2 \tan (e+f x)}{f}\right ) \] Input:

Integrate[(c + d*x)^2*(a + a*Sec[e + f*x])^2,x]
 

Output:

(a^2*((c + d*x)^3/d - ((12*I)*(c + d*x)^2*ArcTan[E^(I*(e + f*x))])/f - ((3 
*I)*(f*(c + d*x)*(f*(c + d*x) + (2*I)*d*Log[1 + E^((2*I)*(e + f*x))]) + d^ 
2*PolyLog[2, -E^((2*I)*(e + f*x))]))/f^3 + ((12*I)*d*(f*(c + d*x)*PolyLog[ 
2, (-I)*E^(I*(e + f*x))] + I*d*PolyLog[3, (-I)*E^(I*(e + f*x))]))/f^3 + (1 
2*d*((-I)*f*(c + d*x)*PolyLog[2, I*E^(I*(e + f*x))] + d*PolyLog[3, I*E^(I* 
(e + f*x))]))/f^3 + (3*(c + d*x)^2*Tan[e + f*x])/f))/3
 

Rubi [A] (verified)

Time = 0.57 (sec) , antiderivative size = 262, 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.150, Rules used = {3042, 4678, 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 (c+d x)^2 (a \sec (e+f x)+a)^2 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4678

\(\displaystyle \int \left (a^2 (c+d x)^2 \sec ^2(e+f x)+2 a^2 (c+d x)^2 \sec (e+f x)+a^2 (c+d x)^2\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {4 i a^2 (c+d x)^2 \arctan \left (e^{i (e+f x)}\right )}{f}+\frac {4 i a^2 d (c+d x) \operatorname {PolyLog}\left (2,-i e^{i (e+f x)}\right )}{f^2}-\frac {4 i a^2 d (c+d x) \operatorname {PolyLog}\left (2,i e^{i (e+f x)}\right )}{f^2}+\frac {2 a^2 d (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f^2}+\frac {a^2 (c+d x)^2 \tan (e+f x)}{f}-\frac {i a^2 (c+d x)^2}{f}+\frac {a^2 (c+d x)^3}{3 d}-\frac {i a^2 d^2 \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{f^3}-\frac {4 a^2 d^2 \operatorname {PolyLog}\left (3,-i e^{i (e+f x)}\right )}{f^3}+\frac {4 a^2 d^2 \operatorname {PolyLog}\left (3,i e^{i (e+f x)}\right )}{f^3}\)

Input:

Int[(c + d*x)^2*(a + a*Sec[e + f*x])^2,x]
 

Output:

((-I)*a^2*(c + d*x)^2)/f + (a^2*(c + d*x)^3)/(3*d) - ((4*I)*a^2*(c + d*x)^ 
2*ArcTan[E^(I*(e + f*x))])/f + (2*a^2*d*(c + d*x)*Log[1 + E^((2*I)*(e + f* 
x))])/f^2 + ((4*I)*a^2*d*(c + d*x)*PolyLog[2, (-I)*E^(I*(e + f*x))])/f^2 - 
 ((4*I)*a^2*d*(c + d*x)*PolyLog[2, I*E^(I*(e + f*x))])/f^2 - (I*a^2*d^2*Po 
lyLog[2, -E^((2*I)*(e + f*x))])/f^3 - (4*a^2*d^2*PolyLog[3, (-I)*E^(I*(e + 
 f*x))])/f^3 + (4*a^2*d^2*PolyLog[3, I*E^(I*(e + f*x))])/f^3 + (a^2*(c + d 
*x)^2*Tan[e + f*x])/f
 

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 4678
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(n_.)*((c_.) + (d_.)*(x_))^(m_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, (a + b*Csc[e + f*x])^n, x], 
 x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]
 
Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 678 vs. \(2 (237 ) = 474\).

Time = 0.28 (sec) , antiderivative size = 679, normalized size of antiderivative = 2.59

method result size
risch \(\frac {a^{2} d^{2} x^{3}}{3}+\frac {a^{2} c^{3}}{3 d}-\frac {4 a^{2} d^{2} \operatorname {polylog}\left (3, -i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}+\frac {4 a^{2} d^{2} \operatorname {polylog}\left (3, i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}+\frac {8 i a^{2} c d e \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+a^{2} d c \,x^{2}+a^{2} c^{2} x -\frac {i a^{2} d^{2} \operatorname {polylog}\left (2, -{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f^{3}}-\frac {2 a^{2} d^{2} \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) x^{2}}{f}+\frac {2 a^{2} d^{2} \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) x^{2}}{f}+\frac {2 a^{2} c d \ln \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f^{2}}-\frac {4 a^{2} c d \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+\frac {2 a^{2} d^{2} \ln \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right ) x}{f^{2}}+\frac {4 a^{2} d^{2} e \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}-\frac {2 a^{2} e^{2} d^{2} \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}+\frac {2 a^{2} e^{2} d^{2} \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}-\frac {4 i a^{2} c^{2} \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f}-\frac {2 i a^{2} e^{2} d^{2}}{f^{3}}-\frac {2 i a^{2} d^{2} x^{2}}{f}+\frac {2 i a^{2} \left (d^{2} x^{2}+2 c d x +c^{2}\right )}{f \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right )}-\frac {4 i a^{2} c d \operatorname {polylog}\left (2, i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+\frac {4 a^{2} c d \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) e}{f^{2}}+\frac {4 a^{2} c d \ln \left (1-i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f}-\frac {4 a^{2} c d \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f}-\frac {4 a^{2} c d \ln \left (1+i {\mathrm e}^{i \left (f x +e \right )}\right ) e}{f^{2}}+\frac {4 i a^{2} c d \operatorname {polylog}\left (2, -i {\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {4 i a^{2} d^{2} e x}{f^{2}}-\frac {4 i a^{2} d^{2} e^{2} \arctan \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{3}}-\frac {4 i a^{2} d^{2} \operatorname {polylog}\left (2, i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f^{2}}+\frac {4 i a^{2} d^{2} \operatorname {polylog}\left (2, -i {\mathrm e}^{i \left (f x +e \right )}\right ) x}{f^{2}}\) \(679\)

Input:

int((d*x+c)^2*(a+a*sec(f*x+e))^2,x,method=_RETURNVERBOSE)
 

Output:

1/3*a^2*d^2*x^3+1/3*a^2/d*c^3-4*a^2*d^2*polylog(3,-I*exp(I*(f*x+e)))/f^3+4 
*a^2*d^2*polylog(3,I*exp(I*(f*x+e)))/f^3-I*a^2*d^2*polylog(2,-exp(2*I*(f*x 
+e)))/f^3+8*I/f^2*a^2*c*d*e*arctan(exp(I*(f*x+e)))-2/f*a^2*d^2*ln(1+I*exp( 
I*(f*x+e)))*x^2+2/f*a^2*d^2*ln(1-I*exp(I*(f*x+e)))*x^2+2/f^2*a^2*c*d*ln(1+ 
exp(2*I*(f*x+e)))-4/f^2*a^2*c*d*ln(exp(I*(f*x+e)))+2/f^2*a^2*d^2*ln(1+exp( 
2*I*(f*x+e)))*x+4/f^3*a^2*d^2*e*ln(exp(I*(f*x+e)))-2/f^3*a^2*e^2*d^2*ln(1- 
I*exp(I*(f*x+e)))+2/f^3*a^2*e^2*d^2*ln(1+I*exp(I*(f*x+e)))-4*I/f*a^2*c^2*a 
rctan(exp(I*(f*x+e)))-2*I/f^3*a^2*e^2*d^2-2*I/f*a^2*d^2*x^2+2*I*a^2*(d^2*x 
^2+2*c*d*x+c^2)/f/(1+exp(2*I*(f*x+e)))-4*I/f^2*a^2*c*d*polylog(2,I*exp(I*( 
f*x+e)))+4/f^2*a^2*c*d*ln(1-I*exp(I*(f*x+e)))*e+4/f*a^2*c*d*ln(1-I*exp(I*( 
f*x+e)))*x-4/f*a^2*c*d*ln(1+I*exp(I*(f*x+e)))*x-4/f^2*a^2*c*d*ln(1+I*exp(I 
*(f*x+e)))*e+4*I/f^2*a^2*c*d*polylog(2,-I*exp(I*(f*x+e)))-4*I/f^2*a^2*d^2* 
e*x-4*I/f^3*a^2*d^2*e^2*arctan(exp(I*(f*x+e)))-4*I/f^2*a^2*d^2*polylog(2,I 
*exp(I*(f*x+e)))*x+4*I/f^2*a^2*d^2*polylog(2,-I*exp(I*(f*x+e)))*x+a^2*d*c* 
x^2+a^2*c^2*x
 

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. 1096 vs. \(2 (225) = 450\).

Time = 0.14 (sec) , antiderivative size = 1096, normalized size of antiderivative = 4.18 \[ \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx=\text {Too large to display} \] Input:

integrate((d*x+c)^2*(a+a*sec(f*x+e))^2,x, algorithm="fricas")
 

Output:

-1/3*(6*a^2*d^2*cos(f*x + e)*polylog(3, I*cos(f*x + e) + sin(f*x + e)) - 6 
*a^2*d^2*cos(f*x + e)*polylog(3, I*cos(f*x + e) - sin(f*x + e)) + 6*a^2*d^ 
2*cos(f*x + e)*polylog(3, -I*cos(f*x + e) + sin(f*x + e)) - 6*a^2*d^2*cos( 
f*x + e)*polylog(3, -I*cos(f*x + e) - sin(f*x + e)) + 3*(2*I*a^2*d^2*f*x + 
 2*I*a^2*c*d*f - I*a^2*d^2)*cos(f*x + e)*dilog(I*cos(f*x + e) + sin(f*x + 
e)) + 3*(2*I*a^2*d^2*f*x + 2*I*a^2*c*d*f + I*a^2*d^2)*cos(f*x + e)*dilog(I 
*cos(f*x + e) - sin(f*x + e)) + 3*(-2*I*a^2*d^2*f*x - 2*I*a^2*c*d*f + I*a^ 
2*d^2)*cos(f*x + e)*dilog(-I*cos(f*x + e) + sin(f*x + e)) + 3*(-2*I*a^2*d^ 
2*f*x - 2*I*a^2*c*d*f - I*a^2*d^2)*cos(f*x + e)*dilog(-I*cos(f*x + e) - si 
n(f*x + e)) - 3*(a^2*d^2*e^2 + a^2*c^2*f^2 - a^2*d^2*e - (2*a^2*c*d*e - a^ 
2*c*d)*f)*cos(f*x + e)*log(cos(f*x + e) + I*sin(f*x + e) + I) + 3*(a^2*d^2 
*e^2 + a^2*c^2*f^2 + a^2*d^2*e - (2*a^2*c*d*e + a^2*c*d)*f)*cos(f*x + e)*l 
og(cos(f*x + e) - I*sin(f*x + e) + I) - 3*(a^2*d^2*f^2*x^2 - a^2*d^2*e^2 + 
 2*a^2*c*d*e*f + a^2*d^2*e + (2*a^2*c*d*f^2 + a^2*d^2*f)*x)*cos(f*x + e)*l 
og(I*cos(f*x + e) + sin(f*x + e) + 1) + 3*(a^2*d^2*f^2*x^2 - a^2*d^2*e^2 + 
 2*a^2*c*d*e*f - a^2*d^2*e + (2*a^2*c*d*f^2 - a^2*d^2*f)*x)*cos(f*x + e)*l 
og(I*cos(f*x + e) - sin(f*x + e) + 1) - 3*(a^2*d^2*f^2*x^2 - a^2*d^2*e^2 + 
 2*a^2*c*d*e*f + a^2*d^2*e + (2*a^2*c*d*f^2 + a^2*d^2*f)*x)*cos(f*x + e)*l 
og(-I*cos(f*x + e) + sin(f*x + e) + 1) + 3*(a^2*d^2*f^2*x^2 - a^2*d^2*e^2 
+ 2*a^2*c*d*e*f - a^2*d^2*e + (2*a^2*c*d*f^2 - a^2*d^2*f)*x)*cos(f*x + ...
 

Sympy [F]

\[ \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx=a^{2} \left (\int c^{2}\, dx + \int 2 c^{2} \sec {\left (e + f x \right )}\, dx + \int c^{2} \sec ^{2}{\left (e + f x \right )}\, dx + \int d^{2} x^{2}\, dx + \int 2 c d x\, dx + \int 2 d^{2} x^{2} \sec {\left (e + f x \right )}\, dx + \int d^{2} x^{2} \sec ^{2}{\left (e + f x \right )}\, dx + \int 4 c d x \sec {\left (e + f x \right )}\, dx + \int 2 c d x \sec ^{2}{\left (e + f x \right )}\, dx\right ) \] Input:

integrate((d*x+c)**2*(a+a*sec(f*x+e))**2,x)
 

Output:

a**2*(Integral(c**2, x) + Integral(2*c**2*sec(e + f*x), x) + Integral(c**2 
*sec(e + f*x)**2, x) + Integral(d**2*x**2, x) + Integral(2*c*d*x, x) + Int 
egral(2*d**2*x**2*sec(e + f*x), x) + Integral(d**2*x**2*sec(e + f*x)**2, x 
) + Integral(4*c*d*x*sec(e + f*x), x) + Integral(2*c*d*x*sec(e + f*x)**2, 
x))
 

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1704 vs. \(2 (225) = 450\).

Time = 0.39 (sec) , antiderivative size = 1704, normalized size of antiderivative = 6.50 \[ \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx=\text {Too large to display} \] Input:

integrate((d*x+c)^2*(a+a*sec(f*x+e))^2,x, algorithm="maxima")
 

Output:

1/3*(3*(f*x + e)*a^2*c^2 + (f*x + e)^3*a^2*d^2/f^2 - 3*(f*x + e)^2*a^2*d^2 
*e/f^2 + 3*(f*x + e)*a^2*d^2*e^2/f^2 + 3*(f*x + e)^2*a^2*c*d/f - 6*(f*x + 
e)*a^2*c*d*e/f + 6*a^2*c^2*log(sec(f*x + e) + tan(f*x + e)) + 6*a^2*d^2*e^ 
2*log(sec(f*x + e) + tan(f*x + e))/f^2 - 12*a^2*c*d*e*log(sec(f*x + e) + t 
an(f*x + e))/f + 3*(2*a^2*d^2*e^2 - 4*a^2*c*d*e*f + 2*a^2*c^2*f^2 - 2*((f* 
x + e)^2*a^2*d^2 - 2*(a^2*d^2*e - a^2*c*d*f)*(f*x + e) + ((f*x + e)^2*a^2* 
d^2 - 2*(a^2*d^2*e - a^2*c*d*f)*(f*x + e))*cos(2*f*x + 2*e) + (I*(f*x + e) 
^2*a^2*d^2 + 2*(-I*a^2*d^2*e + I*a^2*c*d*f)*(f*x + e))*sin(2*f*x + 2*e))*a 
rctan2(cos(f*x + e), sin(f*x + e) + 1) - 2*((f*x + e)^2*a^2*d^2 - 2*(a^2*d 
^2*e - a^2*c*d*f)*(f*x + e) + ((f*x + e)^2*a^2*d^2 - 2*(a^2*d^2*e - a^2*c* 
d*f)*(f*x + e))*cos(2*f*x + 2*e) + (I*(f*x + e)^2*a^2*d^2 + 2*(-I*a^2*d^2* 
e + I*a^2*c*d*f)*(f*x + e))*sin(2*f*x + 2*e))*arctan2(cos(f*x + e), -sin(f 
*x + e) + 1) + 2*((f*x + e)*a^2*d^2 - a^2*d^2*e + a^2*c*d*f + ((f*x + e)*a 
^2*d^2 - a^2*d^2*e + a^2*c*d*f)*cos(2*f*x + 2*e) - (-I*(f*x + e)*a^2*d^2 + 
 I*a^2*d^2*e - I*a^2*c*d*f)*sin(2*f*x + 2*e))*arctan2(sin(2*f*x + 2*e), co 
s(2*f*x + 2*e) + 1) - 2*((f*x + e)^2*a^2*d^2 - 2*(a^2*d^2*e - a^2*c*d*f)*( 
f*x + e))*cos(2*f*x + 2*e) - (a^2*d^2*cos(2*f*x + 2*e) + I*a^2*d^2*sin(2*f 
*x + 2*e) + a^2*d^2)*dilog(-e^(2*I*f*x + 2*I*e)) - 4*((f*x + e)*a^2*d^2 - 
a^2*d^2*e + a^2*c*d*f + ((f*x + e)*a^2*d^2 - a^2*d^2*e + a^2*c*d*f)*cos(2* 
f*x + 2*e) + (I*(f*x + e)*a^2*d^2 - I*a^2*d^2*e + I*a^2*c*d*f)*sin(2*f*...
 

Giac [F]

\[ \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx=\int { {\left (d x + c\right )}^{2} {\left (a \sec \left (f x + e\right ) + a\right )}^{2} \,d x } \] Input:

integrate((d*x+c)^2*(a+a*sec(f*x+e))^2,x, algorithm="giac")
 

Output:

integrate((d*x + c)^2*(a*sec(f*x + e) + a)^2, x)
 

Mupad [F(-1)]

Timed out. \[ \int (c+d x)^2 (a+a \sec (e+f x))^2 \, dx=\int {\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^2\,{\left (c+d\,x\right )}^2 \,d x \] Input:

int((a + a/cos(e + f*x))^2*(c + d*x)^2,x)
 

Output:

int((a + a/cos(e + f*x))^2*(c + d*x)^2, x)
 

Reduce [F]

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

int((d*x+c)^2*(a+a*sec(f*x+e))^2,x)
 

Output:

(a**2*(4*cos(e + f*x)*int(x**2/(tan((e + f*x)/2)**4 - 2*tan((e + f*x)/2)** 
2 + 1),x)*d**2*f + 8*cos(e + f*x)*int(x/(tan((e + f*x)/2)**4 - 2*tan((e + 
f*x)/2)**2 + 1),x)*c*d*f - 2*cos(e + f*x)*log(tan((e + f*x)/2) - 1)*c**2 + 
 2*cos(e + f*x)*log(tan((e + f*x)/2) + 1)*c**2 + cos(e + f*x)*c**2*f*x + s 
in(e + f*x)*c**2))/(cos(e + f*x)*f)