\(\int \frac {(c+d x)^2}{(a+b \sec (e+f x))^2} \, dx\) [40]

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

Optimal result

Integrand size = 20, antiderivative size = 1117 \[ \int \frac {(c+d x)^2}{(a+b \sec (e+f x))^2} \, dx =\text {Too large to display} \] Output:

2*I*b^3*d^2*polylog(3,-a*exp(I*(f*x+e))/(b+(-a^2+b^2)^(1/2)))/a^2/(-a^2+b^ 
2)^(3/2)/f^3+1/3*(d*x+c)^3/a^2/d+2*b^2*d*(d*x+c)*ln(1+a*exp(I*(f*x+e))/(b- 
I*(a^2-b^2)^(1/2)))/a^2/(a^2-b^2)/f^2+2*b^2*d*(d*x+c)*ln(1+a*exp(I*(f*x+e) 
)/(b+I*(a^2-b^2)^(1/2)))/a^2/(a^2-b^2)/f^2-I*b^2*(d*x+c)^2/a^2/(a^2-b^2)/f 
-2*I*b^2*d^2*polylog(2,-a*exp(I*(f*x+e))/(b-I*(a^2-b^2)^(1/2)))/a^2/(a^2-b 
^2)/f^3-4*I*b*d^2*polylog(3,-a*exp(I*(f*x+e))/(b+(-a^2+b^2)^(1/2)))/a^2/(- 
a^2+b^2)^(1/2)/f^3-2*I*b^3*d^2*polylog(3,-a*exp(I*(f*x+e))/(b-(-a^2+b^2)^( 
1/2)))/a^2/(-a^2+b^2)^(3/2)/f^3+4*I*b*d^2*polylog(3,-a*exp(I*(f*x+e))/(b-( 
-a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^(1/2)/f^3+I*b^3*(d*x+c)^2*ln(1+a*exp(I*(f 
*x+e))/(b+(-a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^(3/2)/f-2*b^3*d*(d*x+c)*polylo 
g(2,-a*exp(I*(f*x+e))/(b-(-a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^(3/2)/f^2+4*b*d 
*(d*x+c)*polylog(2,-a*exp(I*(f*x+e))/(b-(-a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^ 
(1/2)/f^2+2*b^3*d*(d*x+c)*polylog(2,-a*exp(I*(f*x+e))/(b+(-a^2+b^2)^(1/2)) 
)/a^2/(-a^2+b^2)^(3/2)/f^2-4*b*d*(d*x+c)*polylog(2,-a*exp(I*(f*x+e))/(b+(- 
a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^(1/2)/f^2-2*I*b*(d*x+c)^2*ln(1+a*exp(I*(f* 
x+e))/(b+(-a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^(1/2)/f-2*I*b^2*d^2*polylog(2,- 
a*exp(I*(f*x+e))/(b+I*(a^2-b^2)^(1/2)))/a^2/(a^2-b^2)/f^3+2*I*b*(d*x+c)^2* 
ln(1+a*exp(I*(f*x+e))/(b-(-a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^(1/2)/f-I*b^3*( 
d*x+c)^2*ln(1+a*exp(I*(f*x+e))/(b-(-a^2+b^2)^(1/2)))/a^2/(-a^2+b^2)^(3/2)/ 
f+b^2*(d*x+c)^2*sin(f*x+e)/a/(a^2-b^2)/f/(b+a*cos(f*x+e))
 

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(3365\) vs. \(2(1117)=2234\).

Time = 16.57 (sec) , antiderivative size = 3365, normalized size of antiderivative = 3.01 \[ \int \frac {(c+d x)^2}{(a+b \sec (e+f x))^2} \, dx=\text {Result too large to show} \] Input:

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

Output:

(x*(3*c^2 + 3*c*d*x + d^2*x^2)*(b + a*Cos[e + f*x])^2*Sec[e + f*x]^2)/(3*a 
^2*(a + b*Sec[e + f*x])^2) + (2*b*E^(I*e)*(b + a*Cos[e + f*x])^2*((-2*I)*b 
*c*d*E^(I*e)*x - I*b*d^2*E^(I*e)*x^2 + ((2*I)*a^2*c^2*ArcTan[(b + a*E^(I*( 
e + f*x)))/Sqrt[a^2 - b^2]])/(Sqrt[a^2 - b^2]*E^(I*e)) - (I*b^2*c^2*ArcTan 
[(b + a*E^(I*(e + f*x)))/Sqrt[a^2 - b^2]])/(Sqrt[a^2 - b^2]*E^(I*e)) + ((2 
*I)*a^2*c^2*E^(I*e)*ArcTan[(b + a*E^(I*(e + f*x)))/Sqrt[a^2 - b^2]])/Sqrt[ 
a^2 - b^2] - (I*b^2*c^2*E^(I*e)*ArcTan[(b + a*E^(I*(e + f*x)))/Sqrt[a^2 - 
b^2]])/Sqrt[a^2 - b^2] + (b*c*d*Log[a + 2*b*E^(I*(e + f*x)) + a*E^((2*I)*( 
e + f*x))])/(E^(I*e)*f) + (b*c*d*E^(I*e)*Log[a + 2*b*E^(I*(e + f*x)) + a*E 
^((2*I)*(e + f*x))])/f + ((2*I)*a^2*c*d*x*Log[1 + (a*E^(I*(2*e + f*x)))/(b 
*E^(I*e) - Sqrt[(-a^2 + b^2)*E^((2*I)*e)])])/Sqrt[(-a^2 + b^2)*E^((2*I)*e) 
] - (I*b^2*c*d*x*Log[1 + (a*E^(I*(2*e + f*x)))/(b*E^(I*e) - Sqrt[(-a^2 + b 
^2)*E^((2*I)*e)])])/Sqrt[(-a^2 + b^2)*E^((2*I)*e)] + ((2*I)*a^2*c*d*E^((2* 
I)*e)*x*Log[1 + (a*E^(I*(2*e + f*x)))/(b*E^(I*e) - Sqrt[(-a^2 + b^2)*E^((2 
*I)*e)])])/Sqrt[(-a^2 + b^2)*E^((2*I)*e)] - (I*b^2*c*d*E^((2*I)*e)*x*Log[1 
 + (a*E^(I*(2*e + f*x)))/(b*E^(I*e) - Sqrt[(-a^2 + b^2)*E^((2*I)*e)])])/Sq 
rt[(-a^2 + b^2)*E^((2*I)*e)] + (b*d^2*x*Log[1 + (a*E^(I*(2*e + f*x)))/(b*E 
^(I*e) - Sqrt[(-a^2 + b^2)*E^((2*I)*e)])])/(E^(I*e)*f) + (b*d^2*E^(I*e)*x* 
Log[1 + (a*E^(I*(2*e + f*x)))/(b*E^(I*e) - Sqrt[(-a^2 + b^2)*E^((2*I)*e)]) 
])/f + (I*a^2*d^2*x^2*Log[1 + (a*E^(I*(2*e + f*x)))/(b*E^(I*e) - Sqrt[(...
 

Rubi [A] (verified)

Time = 2.51 (sec) , antiderivative size = 1117, 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, 4679, 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+b \sec (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4679

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

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {i (c+d x)^2 \log \left (\frac {e^{i (e+f x)} a}{b-\sqrt {b^2-a^2}}+1\right ) b^3}{a^2 \left (b^2-a^2\right )^{3/2} f}+\frac {i (c+d x)^2 \log \left (\frac {e^{i (e+f x)} a}{b+\sqrt {b^2-a^2}}+1\right ) b^3}{a^2 \left (b^2-a^2\right )^{3/2} f}-\frac {2 d (c+d x) \operatorname {PolyLog}\left (2,-\frac {a e^{i (e+f x)}}{b-\sqrt {b^2-a^2}}\right ) b^3}{a^2 \left (b^2-a^2\right )^{3/2} f^2}+\frac {2 d (c+d x) \operatorname {PolyLog}\left (2,-\frac {a e^{i (e+f x)}}{b+\sqrt {b^2-a^2}}\right ) b^3}{a^2 \left (b^2-a^2\right )^{3/2} f^2}-\frac {2 i d^2 \operatorname {PolyLog}\left (3,-\frac {a e^{i (e+f x)}}{b-\sqrt {b^2-a^2}}\right ) b^3}{a^2 \left (b^2-a^2\right )^{3/2} f^3}+\frac {2 i d^2 \operatorname {PolyLog}\left (3,-\frac {a e^{i (e+f x)}}{b+\sqrt {b^2-a^2}}\right ) b^3}{a^2 \left (b^2-a^2\right )^{3/2} f^3}-\frac {i (c+d x)^2 b^2}{a^2 \left (a^2-b^2\right ) f}+\frac {2 d (c+d x) \log \left (\frac {e^{i (e+f x)} a}{b-i \sqrt {a^2-b^2}}+1\right ) b^2}{a^2 \left (a^2-b^2\right ) f^2}+\frac {2 d (c+d x) \log \left (\frac {e^{i (e+f x)} a}{b+i \sqrt {a^2-b^2}}+1\right ) b^2}{a^2 \left (a^2-b^2\right ) f^2}-\frac {2 i d^2 \operatorname {PolyLog}\left (2,-\frac {a e^{i (e+f x)}}{b-i \sqrt {a^2-b^2}}\right ) b^2}{a^2 \left (a^2-b^2\right ) f^3}-\frac {2 i d^2 \operatorname {PolyLog}\left (2,-\frac {a e^{i (e+f x)}}{b+i \sqrt {a^2-b^2}}\right ) b^2}{a^2 \left (a^2-b^2\right ) f^3}+\frac {(c+d x)^2 \sin (e+f x) b^2}{a \left (a^2-b^2\right ) f (b+a \cos (e+f x))}+\frac {2 i (c+d x)^2 \log \left (\frac {e^{i (e+f x)} a}{b-\sqrt {b^2-a^2}}+1\right ) b}{a^2 \sqrt {b^2-a^2} f}-\frac {2 i (c+d x)^2 \log \left (\frac {e^{i (e+f x)} a}{b+\sqrt {b^2-a^2}}+1\right ) b}{a^2 \sqrt {b^2-a^2} f}+\frac {4 d (c+d x) \operatorname {PolyLog}\left (2,-\frac {a e^{i (e+f x)}}{b-\sqrt {b^2-a^2}}\right ) b}{a^2 \sqrt {b^2-a^2} f^2}-\frac {4 d (c+d x) \operatorname {PolyLog}\left (2,-\frac {a e^{i (e+f x)}}{b+\sqrt {b^2-a^2}}\right ) b}{a^2 \sqrt {b^2-a^2} f^2}+\frac {4 i d^2 \operatorname {PolyLog}\left (3,-\frac {a e^{i (e+f x)}}{b-\sqrt {b^2-a^2}}\right ) b}{a^2 \sqrt {b^2-a^2} f^3}-\frac {4 i d^2 \operatorname {PolyLog}\left (3,-\frac {a e^{i (e+f x)}}{b+\sqrt {b^2-a^2}}\right ) b}{a^2 \sqrt {b^2-a^2} f^3}+\frac {(c+d x)^3}{3 a^2 d}\)

Input:

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

Output:

((-I)*b^2*(c + d*x)^2)/(a^2*(a^2 - b^2)*f) + (c + d*x)^3/(3*a^2*d) + (2*b^ 
2*d*(c + d*x)*Log[1 + (a*E^(I*(e + f*x)))/(b - I*Sqrt[a^2 - b^2])])/(a^2*( 
a^2 - b^2)*f^2) + (2*b^2*d*(c + d*x)*Log[1 + (a*E^(I*(e + f*x)))/(b + I*Sq 
rt[a^2 - b^2])])/(a^2*(a^2 - b^2)*f^2) - (I*b^3*(c + d*x)^2*Log[1 + (a*E^( 
I*(e + f*x)))/(b - Sqrt[-a^2 + b^2])])/(a^2*(-a^2 + b^2)^(3/2)*f) + ((2*I) 
*b*(c + d*x)^2*Log[1 + (a*E^(I*(e + f*x)))/(b - Sqrt[-a^2 + b^2])])/(a^2*S 
qrt[-a^2 + b^2]*f) + (I*b^3*(c + d*x)^2*Log[1 + (a*E^(I*(e + f*x)))/(b + S 
qrt[-a^2 + b^2])])/(a^2*(-a^2 + b^2)^(3/2)*f) - ((2*I)*b*(c + d*x)^2*Log[1 
 + (a*E^(I*(e + f*x)))/(b + Sqrt[-a^2 + b^2])])/(a^2*Sqrt[-a^2 + b^2]*f) - 
 ((2*I)*b^2*d^2*PolyLog[2, -((a*E^(I*(e + f*x)))/(b - I*Sqrt[a^2 - b^2]))] 
)/(a^2*(a^2 - b^2)*f^3) - ((2*I)*b^2*d^2*PolyLog[2, -((a*E^(I*(e + f*x)))/ 
(b + I*Sqrt[a^2 - b^2]))])/(a^2*(a^2 - b^2)*f^3) - (2*b^3*d*(c + d*x)*Poly 
Log[2, -((a*E^(I*(e + f*x)))/(b - Sqrt[-a^2 + b^2]))])/(a^2*(-a^2 + b^2)^( 
3/2)*f^2) + (4*b*d*(c + d*x)*PolyLog[2, -((a*E^(I*(e + f*x)))/(b - Sqrt[-a 
^2 + b^2]))])/(a^2*Sqrt[-a^2 + b^2]*f^2) + (2*b^3*d*(c + d*x)*PolyLog[2, - 
((a*E^(I*(e + f*x)))/(b + Sqrt[-a^2 + b^2]))])/(a^2*(-a^2 + b^2)^(3/2)*f^2 
) - (4*b*d*(c + d*x)*PolyLog[2, -((a*E^(I*(e + f*x)))/(b + Sqrt[-a^2 + b^2 
]))])/(a^2*Sqrt[-a^2 + b^2]*f^2) - ((2*I)*b^3*d^2*PolyLog[3, -((a*E^(I*(e 
+ f*x)))/(b - Sqrt[-a^2 + b^2]))])/(a^2*(-a^2 + b^2)^(3/2)*f^3) + ((4*I)*b 
*d^2*PolyLog[3, -((a*E^(I*(e + f*x)))/(b - Sqrt[-a^2 + b^2]))])/(a^2*Sq...
 

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 4679
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(n_.)*((c_.) + (d_.)*(x_))^(m_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, 1/(Sin[e + f*x]^n/(b + a*Si 
n[e + f*x])^n), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && ILtQ[n, 0] && IGt 
Q[m, 0]
 
Maple [F]

\[\int \frac {\left (d x +c \right )^{2}}{\left (a +b \sec \left (f x +e \right )\right )^{2}}d x\]

Input:

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

Output:

int((d*x+c)^2/(a+b*sec(f*x+e))^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. 4274 vs. \(2 (991) = 1982\).

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

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

Output:

Too large to include
 

Sympy [F]

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

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

Output:

Integral((c + d*x)**2/(a + b*sec(e + f*x))**2, x)
 

Maxima [F(-2)]

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

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

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?` f 
or more de
 

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

\text{Hanged}
 

Reduce [F]

\[ \int \frac {(c+d x)^2}{(a+b \sec (e+f x))^2} \, dx=\text {too large to display} \] Input:

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

Output:

( - 24*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b) 
/sqrt( - a**2 + b**2))*cos(e + f*x)*a**4*b*c**2*f**2 - 24*sqrt( - a**2 + b 
**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))* 
cos(e + f*x)*a**4*b*d**2 - 12*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)* 
a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*cos(e + f*x)*a**3*b**2*c**2* 
f**2 + 12*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2) 
*b)/sqrt( - a**2 + b**2))*cos(e + f*x)*a**2*b**3*c**2*f**2 + 24*sqrt( - a* 
*2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b 
**2))*cos(e + f*x)*a**2*b**3*d**2 + 6*sqrt( - a**2 + b**2)*atan((tan((e + 
f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*cos(e + f*x)*a*b**4* 
c**2*f**2 - 24*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + f* 
x)/2)*b)/sqrt( - a**2 + b**2))*a**3*b**2*c**2*f**2 - 24*sqrt( - a**2 + b** 
2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*a* 
*3*b**2*d**2 - 12*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan((e + 
 f*x)/2)*b)/sqrt( - a**2 + b**2))*a**2*b**3*c**2*f**2 + 12*sqrt( - a**2 + 
b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2)) 
*a*b**4*c**2*f**2 + 24*sqrt( - a**2 + b**2)*atan((tan((e + f*x)/2)*a - tan 
((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*a*b**4*d**2 + 6*sqrt( - a**2 + b**2 
)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt( - a**2 + b**2))*b** 
5*c**2*f**2 - 48*cos(e + f*x)*int(x**2/(2*tan((e + f*x)/2)**4*a**5 - 7*...