3.265 \(\int (a \sec (x)+b \tan (x))^3 \, dx\)

Optimal. Leaf size=75 \[ \frac {1}{2} a b^2 \sin (x)+\frac {1}{4} (a+2 b) (a-b)^2 \log (\sin (x)+1)-\frac {1}{4} (a-2 b) (a+b)^2 \log (1-\sin (x))+\frac {1}{2} \sec ^2(x) (a \sin (x)+b) (a+b \sin (x))^2 \]

[Out]

-1/4*(a-2*b)*(a+b)^2*ln(1-sin(x))+1/4*(a-b)^2*(a+2*b)*ln(1+sin(x))+1/2*a*b^2*sin(x)+1/2*sec(x)^2*(b+a*sin(x))*
(a+b*sin(x))^2

________________________________________________________________________________________

Rubi [A]  time = 0.14, antiderivative size = 75, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.546, Rules used = {4391, 2668, 739, 774, 633, 31} \[ \frac {1}{2} a b^2 \sin (x)+\frac {1}{4} (a+2 b) (a-b)^2 \log (\sin (x)+1)-\frac {1}{4} (a-2 b) (a+b)^2 \log (1-\sin (x))+\frac {1}{2} \sec ^2(x) (a \sin (x)+b) (a+b \sin (x))^2 \]

Antiderivative was successfully verified.

[In]

Int[(a*Sec[x] + b*Tan[x])^3,x]

[Out]

-((a - 2*b)*(a + b)^2*Log[1 - Sin[x]])/4 + ((a - b)^2*(a + 2*b)*Log[1 + Sin[x]])/4 + (a*b^2*Sin[x])/2 + (Sec[x
]^2*(b + a*Sin[x])*(a + b*Sin[x])^2)/2

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 633

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[-(a*c), 2]}, Dist[e/2 + (c*d)/(2*q),
Int[1/(-q + c*x), x], x] + Dist[e/2 - (c*d)/(2*q), Int[1/(q + c*x), x], x]] /; FreeQ[{a, c, d, e}, x] && NiceS
qrtQ[-(a*c)]

Rule 739

Int[((d_) + (e_.)*(x_))^(m_)*((a_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Simp[((d + e*x)^(m - 1)*(a*e - c*d*x)*(a
 + c*x^2)^(p + 1))/(2*a*c*(p + 1)), x] + Dist[1/((p + 1)*(-2*a*c)), Int[(d + e*x)^(m - 2)*Simp[a*e^2*(m - 1) -
 c*d^2*(2*p + 3) - d*c*e*(m + 2*p + 2)*x, x]*(a + c*x^2)^(p + 1), x], x] /; FreeQ[{a, c, d, e}, x] && NeQ[c*d^
2 + a*e^2, 0] && LtQ[p, -1] && GtQ[m, 1] && IntQuadraticQ[a, 0, c, d, e, m, p, x]

Rule 774

Int[(((d_.) + (e_.)*(x_))*((f_) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(e*g*x)/c, x] + Dist[1
/c, Int[(c*d*f - a*e*g + c*(e*f + d*g)*x)/(a + c*x^2), x], x] /; FreeQ[{a, c, d, e, f, g}, x]

Rule 2668

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^m*(b^2 - x^2)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && Integer
Q[(p - 1)/2] && NeQ[a^2 - b^2, 0]

Rule 4391

Int[(u_.)*((b_.)*sec[(c_.) + (d_.)*(x_)]^(n_.) + (a_.)*tan[(c_.) + (d_.)*(x_)]^(n_.))^(p_), x_Symbol] :> Int[A
ctivateTrig[u]*Sec[c + d*x]^(n*p)*(b + a*Sin[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.57, size = 123, normalized size = 1.64 \[ \frac {2 a^4 b \sec ^2(x)+\left (a^2-b^2\right ) \left ((a-2 b) (a+b)^2 \log (1-\sin (x))-(a-b)^2 (a+2 b) \log (\sin (x)+1)\right )+\left (-8 a^4 b+4 a^2 b^3+2 b^5\right ) \tan ^2(x)-2 a \left (a^4+2 a^2 b^2-3 b^4\right ) \tan (x) \sec (x)}{4 \left (b^2-a^2\right )} \]

Antiderivative was successfully verified.

[In]

Integrate[(a*Sec[x] + b*Tan[x])^3,x]

[Out]

((a^2 - b^2)*((a - 2*b)*(a + b)^2*Log[1 - Sin[x]] - (a - b)^2*(a + 2*b)*Log[1 + Sin[x]]) + 2*a^4*b*Sec[x]^2 -
2*a*(a^4 + 2*a^2*b^2 - 3*b^4)*Sec[x]*Tan[x] + (-8*a^4*b + 4*a^2*b^3 + 2*b^5)*Tan[x]^2)/(4*(-a^2 + b^2))

________________________________________________________________________________________

fricas [A]  time = 2.07, size = 85, normalized size = 1.13 \[ \frac {{\left (a^{3} - 3 \, a b^{2} + 2 \, b^{3}\right )} \cos \relax (x)^{2} \log \left (\sin \relax (x) + 1\right ) - {\left (a^{3} - 3 \, a b^{2} - 2 \, b^{3}\right )} \cos \relax (x)^{2} \log \left (-\sin \relax (x) + 1\right ) + 6 \, a^{2} b + 2 \, b^{3} + 2 \, {\left (a^{3} + 3 \, a b^{2}\right )} \sin \relax (x)}{4 \, \cos \relax (x)^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))^3,x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.14, size = 86, normalized size = 1.15 \[ \frac {1}{4} \, {\left (a^{3} - 3 \, a b^{2} + 2 \, b^{3}\right )} \log \left (\sin \relax (x) + 1\right ) - \frac {1}{4} \, {\left (a^{3} - 3 \, a b^{2} - 2 \, b^{3}\right )} \log \left (-\sin \relax (x) + 1\right ) - \frac {b^{3} \sin \relax (x)^{2} + a^{3} \sin \relax (x) + 3 \, a b^{2} \sin \relax (x) + 3 \, a^{2} b}{2 \, {\left (\sin \relax (x)^{2} - 1\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))^3,x, algorithm="giac")

[Out]

1/4*(a^3 - 3*a*b^2 + 2*b^3)*log(sin(x) + 1) - 1/4*(a^3 - 3*a*b^2 - 2*b^3)*log(-sin(x) + 1) - 1/2*(b^3*sin(x)^2
 + a^3*sin(x) + 3*a*b^2*sin(x) + 3*a^2*b)/(sin(x)^2 - 1)

________________________________________________________________________________________

maple [A]  time = 0.08, size = 82, normalized size = 1.09 \[ \frac {a^{3} \sec \relax (x ) \tan \relax (x )}{2}+\frac {a^{3} \ln \left (\sec \relax (x )+\tan \relax (x )\right )}{2}+\frac {3 a^{2} b}{2 \cos \relax (x )^{2}}+\frac {3 a \,b^{2} \left (\sin ^{3}\relax (x )\right )}{2 \cos \relax (x )^{2}}+\frac {3 a \,b^{2} \sin \relax (x )}{2}-\frac {3 a \,b^{2} \ln \left (\sec \relax (x )+\tan \relax (x )\right )}{2}+\frac {b^{3} \left (\tan ^{2}\relax (x )\right )}{2}+b^{3} \ln \left (\cos \relax (x )\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a*sec(x)+b*tan(x))^3,x)

[Out]

1/2*a^3*sec(x)*tan(x)+1/2*a^3*ln(sec(x)+tan(x))+3/2*a^2*b/cos(x)^2+3/2*a*b^2*sin(x)^3/cos(x)^2+3/2*a*b^2*sin(x
)-3/2*a*b^2*ln(sec(x)+tan(x))+1/2*b^3*tan(x)^2+b^3*ln(cos(x))

________________________________________________________________________________________

maxima [A]  time = 0.35, size = 95, normalized size = 1.27 \[ \frac {3}{2} \, a^{2} b \tan \relax (x)^{2} - \frac {3}{4} \, a b^{2} {\left (\frac {2 \, \sin \relax (x)}{\sin \relax (x)^{2} - 1} + \log \left (\sin \relax (x) + 1\right ) - \log \left (\sin \relax (x) - 1\right )\right )} - \frac {1}{4} \, a^{3} {\left (\frac {2 \, \sin \relax (x)}{\sin \relax (x)^{2} - 1} - \log \left (\sin \relax (x) + 1\right ) + \log \left (\sin \relax (x) - 1\right )\right )} - \frac {1}{2} \, b^{3} {\left (\frac {1}{\sin \relax (x)^{2} - 1} - \log \left (\sin \relax (x)^{2} - 1\right )\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))^3,x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 2.50, size = 126, normalized size = 1.68 \[ \frac {\left (a^3+3\,a\,b^2\right )\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3+\left (6\,a^2\,b+2\,b^3\right )\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+\left (a^3+3\,a\,b^2\right )\,\mathrm {tan}\left (\frac {x}{2}\right )}{{\mathrm {tan}\left (\frac {x}{2}\right )}^4-2\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+1}-b^3\,\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )-\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )-1\right )\,{\left (a+b\right )}^2\,\left (a-2\,b\right )}{2}+\frac {\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )+1\right )\,{\left (a-b\right )}^2\,\left (a+2\,b\right )}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((b*tan(x) + a/cos(x))^3,x)

[Out]

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

________________________________________________________________________________________

sympy [A]  time = 4.94, size = 122, normalized size = 1.63 \[ - \frac {a^{3} \log {\left (\sin {\relax (x )} - 1 \right )}}{4} + \frac {a^{3} \log {\left (\sin {\relax (x )} + 1 \right )}}{4} - \frac {a^{3} \sin {\relax (x )}}{2 \sin ^{2}{\relax (x )} - 2} + \frac {3 a^{2} b \sec ^{2}{\relax (x )}}{2} + \frac {3 a b^{2} \log {\left (\sin {\relax (x )} - 1 \right )}}{4} - \frac {3 a b^{2} \log {\left (\sin {\relax (x )} + 1 \right )}}{4} - \frac {3 a b^{2} \sin {\relax (x )}}{2 \sin ^{2}{\relax (x )} - 2} - \frac {b^{3} \log {\left (\sec ^{2}{\relax (x )} \right )}}{2} + \frac {b^{3} \sec ^{2}{\relax (x )}}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a*sec(x)+b*tan(x))**3,x)

[Out]

-a**3*log(sin(x) - 1)/4 + a**3*log(sin(x) + 1)/4 - a**3*sin(x)/(2*sin(x)**2 - 2) + 3*a**2*b*sec(x)**2/2 + 3*a*
b**2*log(sin(x) - 1)/4 - 3*a*b**2*log(sin(x) + 1)/4 - 3*a*b**2*sin(x)/(2*sin(x)**2 - 2) - b**3*log(sec(x)**2)/
2 + b**3*sec(x)**2/2

________________________________________________________________________________________