3.702 \(\int \frac{\sec ^2(x) (a+b \tan (x))^2}{c+d \tan (x)} \, dx\)

Optimal. Leaf size=53 \[ -\frac{b \tan (x) (b c-a d)}{d^2}+\frac{(b c-a d)^2 \log (c+d \tan (x))}{d^3}+\frac{(a+b \tan (x))^2}{2 d} \]

[Out]

((b*c - a*d)^2*Log[c + d*Tan[x]])/d^3 - (b*(b*c - a*d)*Tan[x])/d^2 + (a + b*Tan[x])^2/(2*d)

________________________________________________________________________________________

Rubi [A]  time = 0.137769, antiderivative size = 53, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.095, Rules used = {4342, 43} \[ -\frac{b \tan (x) (b c-a d)}{d^2}+\frac{(b c-a d)^2 \log (c+d \tan (x))}{d^3}+\frac{(a+b \tan (x))^2}{2 d} \]

Antiderivative was successfully verified.

[In]

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

[Out]

((b*c - a*d)^2*Log[c + d*Tan[x]])/d^3 - (b*(b*c - a*d)*Tan[x])/d^2 + (a + b*Tan[x])^2/(2*d)

Rule 4342

Int[(u_)*(F_)[(c_.)*((a_.) + (b_.)*(x_))]^2, x_Symbol] :> With[{d = FreeFactors[Tan[c*(a + b*x)], x]}, Dist[d/
(b*c), Subst[Int[SubstFor[1, Tan[c*(a + b*x)]/d, u, x], x], x, Tan[c*(a + b*x)]/d], x] /; FunctionOfQ[Tan[c*(a
 + b*x)]/d, u, x, True]] /; FreeQ[{a, b, c}, x] && NonsumQ[u] && (EqQ[F, Sec] || EqQ[F, sec])

Rule 43

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rubi steps

\begin{align*} \int \frac{\sec ^2(x) (a+b \tan (x))^2}{c+d \tan (x)} \, dx &=\operatorname{Subst}\left (\int \frac{(a+b x)^2}{c+d x} \, dx,x,\tan (x)\right )\\ &=\operatorname{Subst}\left (\int \left (-\frac{b (b c-a d)}{d^2}+\frac{b (a+b x)}{d}+\frac{(-b c+a d)^2}{d^2 (c+d x)}\right ) \, dx,x,\tan (x)\right )\\ &=\frac{(b c-a d)^2 \log (c+d \tan (x))}{d^3}-\frac{b (b c-a d) \tan (x)}{d^2}+\frac{(a+b \tan (x))^2}{2 d}\\ \end{align*}

Mathematica [A]  time = 0.555891, size = 62, normalized size = 1.17 \[ \frac{b^2 d^2 \sec ^2(x)-2 \left (b d \tan (x) (b c-2 a d)+(b c-a d)^2 (\log (\cos (x))-\log (c \cos (x)+d \sin (x)))\right )}{2 d^3} \]

Antiderivative was successfully verified.

[In]

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

[Out]

(b^2*d^2*Sec[x]^2 - 2*((b*c - a*d)^2*(Log[Cos[x]] - Log[c*Cos[x] + d*Sin[x]]) + b*d*(b*c - 2*a*d)*Tan[x]))/(2*
d^3)

________________________________________________________________________________________

Maple [A]  time = 0.059, size = 80, normalized size = 1.5 \begin{align*}{\frac{{b}^{2} \left ( \tan \left ( x \right ) \right ) ^{2}}{2\,d}}+2\,{\frac{ab\tan \left ( x \right ) }{d}}-{\frac{{b}^{2}\tan \left ( x \right ) c}{{d}^{2}}}+{\frac{\ln \left ( c+d\tan \left ( x \right ) \right ){a}^{2}}{d}}-2\,{\frac{\ln \left ( c+d\tan \left ( x \right ) \right ) abc}{{d}^{2}}}+{\frac{\ln \left ( c+d\tan \left ( x \right ) \right ){b}^{2}{c}^{2}}{{d}^{3}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*b^2/d*tan(x)^2+2*b/d*a*tan(x)-b^2/d^2*tan(x)*c+1/d*ln(c+d*tan(x))*a^2-2/d^2*ln(c+d*tan(x))*a*b*c+1/d^3*ln(
c+d*tan(x))*b^2*c^2

________________________________________________________________________________________

Maxima [A]  time = 0.990692, size = 85, normalized size = 1.6 \begin{align*} \frac{b^{2} d \tan \left (x\right )^{2} - 2 \,{\left (b^{2} c - 2 \, a b d\right )} \tan \left (x\right )}{2 \, d^{2}} + \frac{{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left (d \tan \left (x\right ) + c\right )}{d^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*(b^2*d*tan(x)^2 - 2*(b^2*c - 2*a*b*d)*tan(x))/d^2 + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(d*tan(x) + c)/d^3

________________________________________________________________________________________

Fricas [B]  time = 2.40642, size = 302, normalized size = 5.7 \begin{align*} \frac{b^{2} d^{2} +{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cos \left (x\right )^{2} \log \left (2 \, c d \cos \left (x\right ) \sin \left (x\right ) +{\left (c^{2} - d^{2}\right )} \cos \left (x\right )^{2} + d^{2}\right ) -{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \cos \left (x\right )^{2} \log \left (\cos \left (x\right )^{2}\right ) - 2 \,{\left (b^{2} c d - 2 \, a b d^{2}\right )} \cos \left (x\right ) \sin \left (x\right )}{2 \, d^{3} \cos \left (x\right )^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*(b^2*d^2 + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cos(x)^2*log(2*c*d*cos(x)*sin(x) + (c^2 - d^2)*cos(x)^2 + d^2)
- (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*cos(x)^2*log(cos(x)^2) - 2*(b^2*c*d - 2*a*b*d^2)*cos(x)*sin(x))/(d^3*cos(x)^
2)

________________________________________________________________________________________

Sympy [A]  time = 4.70279, size = 56, normalized size = 1.06 \begin{align*} \frac{b^{2} \tan ^{2}{\left (x \right )}}{2 d} + \frac{\left (a d - b c\right )^{2} \left (\begin{cases} \frac{\tan{\left (x \right )}}{c} & \text{for}\: d = 0 \\\frac{\log{\left (c + d \tan{\left (x \right )} \right )}}{d} & \text{otherwise} \end{cases}\right )}{d^{2}} + \frac{\left (2 a b d - b^{2} c\right ) \tan{\left (x \right )}}{d^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

b**2*tan(x)**2/(2*d) + (a*d - b*c)**2*Piecewise((tan(x)/c, Eq(d, 0)), (log(c + d*tan(x))/d, True))/d**2 + (2*a
*b*d - b**2*c)*tan(x)/d**2

________________________________________________________________________________________

Giac [A]  time = 1.09683, size = 86, normalized size = 1.62 \begin{align*} \frac{b^{2} d \tan \left (x\right )^{2} - 2 \, b^{2} c \tan \left (x\right ) + 4 \, a b d \tan \left (x\right )}{2 \, d^{2}} + \frac{{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \log \left ({\left | d \tan \left (x\right ) + c \right |}\right )}{d^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*(b^2*d*tan(x)^2 - 2*b^2*c*tan(x) + 4*a*b*d*tan(x))/d^2 + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*log(abs(d*tan(x)
+ c))/d^3