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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]  time = 0.09, antiderivative size = 28, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {4342, 43} \[ \frac {b \tan (x)}{d}-\frac {(b c-a d) \log (c+d \tan (x))}{d^2} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

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])

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])

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.38, size = 54, normalized size = 1.93 \[ \frac {\cos (x) (a+b \tan (x)) ((b c-a d) (\log (\cos (x))-\log (c \cos (x)+d \sin (x)))+b d \tan (x))}{d^2 (a \cos (x)+b \sin (x))} \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

fricas [B]  time = 0.91, size = 71, normalized size = 2.54 \[ -\frac {{\left (b c - a d\right )} \cos \relax (x) \log \left (2 \, c d \cos \relax (x) \sin \relax (x) + {\left (c^{2} - d^{2}\right )} \cos \relax (x)^{2} + d^{2}\right ) - {\left (b c - a d\right )} \cos \relax (x) \log \left (\cos \relax (x)^{2}\right ) - 2 \, b d \sin \relax (x)}{2 \, d^{2} \cos \relax (x)} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.14, size = 29, normalized size = 1.04 \[ \frac {b \tan \relax (x)}{d} - \frac {{\left (b c - a d\right )} \log \left ({\left | d \tan \relax (x) + c \right |}\right )}{d^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.12, size = 35, normalized size = 1.25 \[ \frac {b \tan \relax (x )}{d}+\frac {\ln \left (c +d \tan \relax (x )\right ) a}{d}-\frac {\ln \left (c +d \tan \relax (x )\right ) c b}{d^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 28, normalized size = 1.00 \[ \frac {b \tan \relax (x)}{d} - \frac {{\left (b c - a d\right )} \log \left (d \tan \relax (x) + c\right )}{d^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 3.09, size = 27, normalized size = 0.96 \[ \frac {b\,\mathrm {tan}\relax (x)}{d}+\frac {\ln \left (c+d\,\mathrm {tan}\relax (x)\right )\,\left (a\,d-b\,c\right )}{d^2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 4.91, size = 29, normalized size = 1.04 \[ \frac {b \tan {\relax (x )}}{d} + \frac {\left (a d - b c\right ) \left (\begin {cases} \frac {\tan {\relax (x )}}{c} & \text {for}\: d = 0 \\\frac {\log {\left (c + d \tan {\relax (x )} \right )}}{d} & \text {otherwise} \end {cases}\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________