\(\int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx\) [321]

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

Optimal result

Integrand size = 31, antiderivative size = 164 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\frac {(A b-2 a B) \text {arctanh}(\sin (c+d x))}{b^3 d}-\frac {2 a \left (a^2 A b-2 A b^3-2 a^3 B+3 a b^2 B\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} b^3 (a+b)^{3/2} d}+\frac {B \tan (c+d x)}{b^2 d}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 \left (a^2-b^2\right ) d (a+b \sec (c+d x))} \] Output:

(A*b-2*B*a)*arctanh(sin(d*x+c))/b^3/d-2*a*(A*a^2*b-2*A*b^3-2*B*a^3+3*B*a*b 
^2)*arctanh((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b)^(1/2))/(a-b)^(3/2)/b^3/(a 
+b)^(3/2)/d+B*tan(d*x+c)/b^2/d-a^2*(A*b-B*a)*tan(d*x+c)/b^2/(a^2-b^2)/d/(a 
+b*sec(d*x+c))
 

Mathematica [A] (verified)

Time = 1.92 (sec) , antiderivative size = 240, normalized size of antiderivative = 1.46 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\frac {-\frac {2 a \left (-a^2 A b+2 A b^3+2 a^3 B-3 a b^2 B\right ) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}-A b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 a B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+A b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )-2 a B \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {a^2 b (-A b+a B) \sin (c+d x)}{(a-b) (a+b) (b+a \cos (c+d x))}+b B \tan (c+d x)}{b^3 d} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 1.24 (sec) , antiderivative size = 194, normalized size of antiderivative = 1.18, number of steps used = 14, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.419, Rules used = {3042, 4516, 25, 3042, 4570, 3042, 4486, 3042, 4257, 4318, 3042, 3138, 221}

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 {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4516

\(\displaystyle -\frac {\int -\frac {\sec (c+d x) \left (b \left (a^2-b^2\right ) B \sec ^2(c+d x)+\left (a^2-b^2\right ) (A b-a B) \sec (c+d x)+a b (A b-a B)\right )}{a+b \sec (c+d x)}dx}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \frac {\sec (c+d x) \left (b \left (a^2-b^2\right ) B \sec ^2(c+d x)+\left (a^2-b^2\right ) (A b-a B) \sec (c+d x)+a b (A b-a B)\right )}{a+b \sec (c+d x)}dx}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (b \left (a^2-b^2\right ) B \csc \left (c+d x+\frac {\pi }{2}\right )^2+\left (a^2-b^2\right ) (A b-a B) \csc \left (c+d x+\frac {\pi }{2}\right )+a b (A b-a B)\right )}{a+b \csc \left (c+d x+\frac {\pi }{2}\right )}dx}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 4570

\(\displaystyle \frac {\frac {\int \frac {\sec (c+d x) \left (a (A b-a B) b^2+\left (a^2-b^2\right ) (A b-2 a B) \sec (c+d x) b\right )}{a+b \sec (c+d x)}dx}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\int \frac {\csc \left (c+d x+\frac {\pi }{2}\right ) \left (a (A b-a B) b^2+\left (a^2-b^2\right ) (A b-2 a B) \csc \left (c+d x+\frac {\pi }{2}\right ) b\right )}{a+b \csc \left (c+d x+\frac {\pi }{2}\right )}dx}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 4486

\(\displaystyle \frac {\frac {\left (a^2-b^2\right ) (A b-2 a B) \int \sec (c+d x)dx-a \left (-2 a^3 B+a^2 A b+3 a b^2 B-2 A b^3\right ) \int \frac {\sec (c+d x)}{a+b \sec (c+d x)}dx}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\left (a^2-b^2\right ) (A b-2 a B) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx-a \left (-2 a^3 B+a^2 A b+3 a b^2 B-2 A b^3\right ) \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right )}{a+b \csc \left (c+d x+\frac {\pi }{2}\right )}dx}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {\frac {\frac {\left (a^2-b^2\right ) (A b-2 a B) \text {arctanh}(\sin (c+d x))}{d}-a \left (-2 a^3 B+a^2 A b+3 a b^2 B-2 A b^3\right ) \int \frac {\csc \left (c+d x+\frac {\pi }{2}\right )}{a+b \csc \left (c+d x+\frac {\pi }{2}\right )}dx}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 4318

\(\displaystyle \frac {\frac {\frac {\left (a^2-b^2\right ) (A b-2 a B) \text {arctanh}(\sin (c+d x))}{d}-\frac {a \left (-2 a^3 B+a^2 A b+3 a b^2 B-2 A b^3\right ) \int \frac {1}{\frac {a \cos (c+d x)}{b}+1}dx}{b}}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\frac {\left (a^2-b^2\right ) (A b-2 a B) \text {arctanh}(\sin (c+d x))}{d}-\frac {a \left (-2 a^3 B+a^2 A b+3 a b^2 B-2 A b^3\right ) \int \frac {1}{\frac {a \sin \left (c+d x+\frac {\pi }{2}\right )}{b}+1}dx}{b}}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 3138

\(\displaystyle \frac {\frac {\frac {\left (a^2-b^2\right ) (A b-2 a B) \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a \left (-2 a^3 B+a^2 A b+3 a b^2 B-2 A b^3\right ) \int \frac {1}{\left (1-\frac {a}{b}\right ) \tan ^2\left (\frac {1}{2} (c+d x)\right )+\frac {a+b}{b}}d\tan \left (\frac {1}{2} (c+d x)\right )}{b d}}{b}+\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {\frac {B \left (a^2-b^2\right ) \tan (c+d x)}{d}+\frac {\frac {\left (a^2-b^2\right ) (A b-2 a B) \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a \left (-2 a^3 B+a^2 A b+3 a b^2 B-2 A b^3\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{d \sqrt {a-b} \sqrt {a+b}}}{b}}{b^2 \left (a^2-b^2\right )}-\frac {a^2 (A b-a B) \tan (c+d x)}{b^2 d \left (a^2-b^2\right ) (a+b \sec (c+d x))}\)

Input:

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

Output:

-((a^2*(A*b - a*B)*Tan[c + d*x])/(b^2*(a^2 - b^2)*d*(a + b*Sec[c + d*x]))) 
 + ((((a^2 - b^2)*(A*b - 2*a*B)*ArcTanh[Sin[c + d*x]])/d - (2*a*(a^2*A*b - 
 2*A*b^3 - 2*a^3*B + 3*a*b^2*B)*ArcTanh[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqr 
t[a + b]])/(Sqrt[a - b]*Sqrt[a + b]*d))/b + ((a^2 - b^2)*B*Tan[c + d*x])/d 
)/(b^2*(a^2 - b^2))
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + b + 
(a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] 
 && NeQ[a^2 - b^2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4318
Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbo 
l] :> Simp[1/b   Int[1/(1 + (a/b)*Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, 
f}, x] && NeQ[a^2 - b^2, 0]
 

rule 4486
Int[(csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)))/(csc[( 
e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[B/b   Int[Csc[e + f*x], 
 x], x] + Simp[(A*b - a*B)/b   Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x 
] /; FreeQ[{a, b, e, f, A, B}, x] && NeQ[A*b - a*B, 0]
 

rule 4516
Int[csc[(e_.) + (f_.)*(x_)]^3*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*( 
csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-a^2)*(A*b - a*B) 
*Cot[e + f*x]*((a + b*Csc[e + f*x])^(m + 1)/(b^2*f*(m + 1)*(a^2 - b^2))), x 
] + Simp[1/(b^2*(m + 1)*(a^2 - b^2))   Int[Csc[e + f*x]*(a + b*Csc[e + f*x] 
)^(m + 1)*Simp[a*b*(A*b - a*B)*(m + 1) - (A*b - a*B)*(a^2 + b^2*(m + 1))*Cs 
c[e + f*x] + b*B*(m + 1)*(a^2 - b^2)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a 
, b, e, f, A, B}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && LtQ[m, -1 
]
 

rule 4570
Int[csc[(e_.) + (f_.)*(x_)]*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e 
_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_S 
ymbol] :> Simp[(-C)*Cot[e + f*x]*((a + b*Csc[e + f*x])^(m + 1)/(b*f*(m + 2) 
)), x] + Simp[1/(b*(m + 2))   Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^m*Simp[ 
b*A*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Csc[e + f*x], x], x], x] /; 
 FreeQ[{a, b, e, f, A, B, C, m}, x] &&  !LtQ[m, -1]
 
Maple [A] (verified)

Time = 0.62 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.49

method result size
derivativedivides \(\frac {-\frac {B}{b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {\left (-A b +2 B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{3}}+\frac {2 a \left (\frac {a b \left (A b -B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b \right )}-\frac {\left (A \,a^{2} b -2 A \,b^{3}-2 B \,a^{3}+3 B a \,b^{2}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{3}}-\frac {B}{b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {\left (A b -2 B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{3}}}{d}\) \(245\)
default \(\frac {-\frac {B}{b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}+\frac {\left (-A b +2 B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{b^{3}}+\frac {2 a \left (\frac {a b \left (A b -B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b \right )}-\frac {\left (A \,a^{2} b -2 A \,b^{3}-2 B \,a^{3}+3 B a \,b^{2}\right ) \operatorname {arctanh}\left (\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a +b \right ) \left (a -b \right ) \sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{b^{3}}-\frac {B}{b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}+\frac {\left (A b -2 B a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{b^{3}}}{d}\) \(245\)
risch \(\frac {2 i \left (A a \,b^{2} {\mathrm e}^{3 i \left (d x +c \right )}-B \,a^{2} b \,{\mathrm e}^{3 i \left (d x +c \right )}+A \,a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}-2 B \,a^{3} {\mathrm e}^{2 i \left (d x +c \right )}+B a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+A a \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-3 B \,a^{2} b \,{\mathrm e}^{i \left (d x +c \right )}+2 b^{3} B \,{\mathrm e}^{i \left (d x +c \right )}+A \,a^{2} b -2 B \,a^{3}+B a \,b^{2}\right )}{d \,b^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) \left (-a^{2}+b^{2}\right ) \left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{b^{2} d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a}{b^{3} d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{2}}-\frac {2 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}-\frac {2 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{3}}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d b}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{2}}+\frac {2 a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) A}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d}+\frac {2 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{3}}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{\sqrt {a^{2}-b^{2}}\, a}\right ) B}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) d b}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{b^{2} d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a}{b^{3} d}\) \(977\)

Input:

int(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^2,x,method=_RETURNVERBO 
SE)
 

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 529 vs. \(2 (157) = 314\).

Time = 6.73 (sec) , antiderivative size = 1114, normalized size of antiderivative = 6.79 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\text {Too large to display} \] Input:

integrate(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^2,x, algorithm="f 
ricas")
 

Output:

[-1/2*(((2*B*a^5 - A*a^4*b - 3*B*a^3*b^2 + 2*A*a^2*b^3)*cos(d*x + c)^2 + ( 
2*B*a^4*b - A*a^3*b^2 - 3*B*a^2*b^3 + 2*A*a*b^4)*cos(d*x + c))*sqrt(a^2 - 
b^2)*log((2*a*b*cos(d*x + c) - (a^2 - 2*b^2)*cos(d*x + c)^2 - 2*sqrt(a^2 - 
 b^2)*(b*cos(d*x + c) + a)*sin(d*x + c) + 2*a^2 - b^2)/(a^2*cos(d*x + c)^2 
 + 2*a*b*cos(d*x + c) + b^2)) + ((2*B*a^6 - A*a^5*b - 4*B*a^4*b^2 + 2*A*a^ 
3*b^3 + 2*B*a^2*b^4 - A*a*b^5)*cos(d*x + c)^2 + (2*B*a^5*b - A*a^4*b^2 - 4 
*B*a^3*b^3 + 2*A*a^2*b^4 + 2*B*a*b^5 - A*b^6)*cos(d*x + c))*log(sin(d*x + 
c) + 1) - ((2*B*a^6 - A*a^5*b - 4*B*a^4*b^2 + 2*A*a^3*b^3 + 2*B*a^2*b^4 - 
A*a*b^5)*cos(d*x + c)^2 + (2*B*a^5*b - A*a^4*b^2 - 4*B*a^3*b^3 + 2*A*a^2*b 
^4 + 2*B*a*b^5 - A*b^6)*cos(d*x + c))*log(-sin(d*x + c) + 1) - 2*(B*a^4*b^ 
2 - 2*B*a^2*b^4 + B*b^6 + (2*B*a^5*b - A*a^4*b^2 - 3*B*a^3*b^3 + A*a^2*b^4 
 + B*a*b^5)*cos(d*x + c))*sin(d*x + c))/((a^5*b^3 - 2*a^3*b^5 + a*b^7)*d*c 
os(d*x + c)^2 + (a^4*b^4 - 2*a^2*b^6 + b^8)*d*cos(d*x + c)), 1/2*(2*((2*B* 
a^5 - A*a^4*b - 3*B*a^3*b^2 + 2*A*a^2*b^3)*cos(d*x + c)^2 + (2*B*a^4*b - A 
*a^3*b^2 - 3*B*a^2*b^3 + 2*A*a*b^4)*cos(d*x + c))*sqrt(-a^2 + b^2)*arctan( 
-sqrt(-a^2 + b^2)*(b*cos(d*x + c) + a)/((a^2 - b^2)*sin(d*x + c))) - ((2*B 
*a^6 - A*a^5*b - 4*B*a^4*b^2 + 2*A*a^3*b^3 + 2*B*a^2*b^4 - A*a*b^5)*cos(d* 
x + c)^2 + (2*B*a^5*b - A*a^4*b^2 - 4*B*a^3*b^3 + 2*A*a^2*b^4 + 2*B*a*b^5 
- A*b^6)*cos(d*x + c))*log(sin(d*x + c) + 1) + ((2*B*a^6 - A*a^5*b - 4*B*a 
^4*b^2 + 2*A*a^3*b^3 + 2*B*a^2*b^4 - A*a*b^5)*cos(d*x + c)^2 + (2*B*a^5...
 

Sympy [F]

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

integrate(sec(d*x+c)**3*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))**2,x)
 

Output:

Integral((A + B*sec(c + d*x))*sec(c + d*x)**3/(a + b*sec(c + d*x))**2, x)
 

Maxima [F(-2)]

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

integrate(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^2,x, algorithm="m 
axima")
 

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 [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 404 vs. \(2 (157) = 314\).

Time = 0.25 (sec) , antiderivative size = 404, normalized size of antiderivative = 2.46 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\frac {\frac {2 \, {\left (2 \, B a^{4} - A a^{3} b - 3 \, B a^{2} b^{2} + 2 \, A a b^{3}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{2} b^{3} - b^{5}\right )} \sqrt {-a^{2} + b^{2}}} - \frac {2 \, {\left (2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 2 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a + b\right )} {\left (a^{2} b^{2} - b^{4}\right )}} - \frac {{\left (2 \, B a - A b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{b^{3}} + \frac {{\left (2 \, B a - A b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{b^{3}}}{d} \] Input:

integrate(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^2,x, algorithm="g 
iac")
 

Output:

(2*(2*B*a^4 - A*a^3*b - 3*B*a^2*b^2 + 2*A*a*b^3)*(pi*floor(1/2*(d*x + c)/p 
i + 1/2)*sgn(-2*a + 2*b) + arctan(-(a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x 
 + 1/2*c))/sqrt(-a^2 + b^2)))/((a^2*b^3 - b^5)*sqrt(-a^2 + b^2)) - 2*(2*B* 
a^3*tan(1/2*d*x + 1/2*c)^3 - A*a^2*b*tan(1/2*d*x + 1/2*c)^3 - B*a^2*b*tan( 
1/2*d*x + 1/2*c)^3 - B*a*b^2*tan(1/2*d*x + 1/2*c)^3 + B*b^3*tan(1/2*d*x + 
1/2*c)^3 - 2*B*a^3*tan(1/2*d*x + 1/2*c) + A*a^2*b*tan(1/2*d*x + 1/2*c) - B 
*a^2*b*tan(1/2*d*x + 1/2*c) + B*a*b^2*tan(1/2*d*x + 1/2*c) + B*b^3*tan(1/2 
*d*x + 1/2*c))/((a*tan(1/2*d*x + 1/2*c)^4 - b*tan(1/2*d*x + 1/2*c)^4 - 2*a 
*tan(1/2*d*x + 1/2*c)^2 + a + b)*(a^2*b^2 - b^4)) - (2*B*a - A*b)*log(abs( 
tan(1/2*d*x + 1/2*c) + 1))/b^3 + (2*B*a - A*b)*log(abs(tan(1/2*d*x + 1/2*c 
) - 1))/b^3)/d
 

Mupad [B] (verification not implemented)

Time = 19.52 (sec) , antiderivative size = 5436, normalized size of antiderivative = 33.15 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\text {Too large to display} \] Input:

int((A + B/cos(c + d*x))/(cos(c + d*x)^3*(a + b/cos(c + d*x))^2),x)
 

Output:

((2*tan(c/2 + (d*x)/2)^3*(A*a^2*b - B*b^3 - 2*B*a^3 + B*a*b^2 + B*a^2*b))/ 
(b^2*(a + b)*(a - b)) - (2*tan(c/2 + (d*x)/2)*(B*b^3 - 2*B*a^3 + A*a^2*b + 
 B*a*b^2 - B*a^2*b))/(b^2*(a + b)*(a - b)))/(d*(a + b + tan(c/2 + (d*x)/2) 
^4*(a - b) - 2*a*tan(c/2 + (d*x)/2)^2)) + (atan(((((32*tan(c/2 + (d*x)/2)* 
(A^2*b^8 + 8*B^2*a^8 - 2*A^2*a*b^7 - 8*B^2*a^7*b + 3*A^2*a^2*b^6 + 4*A^2*a 
^3*b^5 - 5*A^2*a^4*b^4 - 2*A^2*a^5*b^3 + 2*A^2*a^6*b^2 + 4*B^2*a^2*b^6 - 8 
*B^2*a^3*b^5 + 5*B^2*a^4*b^4 + 16*B^2*a^5*b^3 - 16*B^2*a^6*b^2 - 4*A*B*a*b 
^7 - 8*A*B*a^7*b + 8*A*B*a^2*b^6 - 8*A*B*a^3*b^5 - 16*A*B*a^4*b^4 + 18*A*B 
*a^5*b^3 + 8*A*B*a^6*b^2))/(a*b^6 + b^7 - a^2*b^5 - a^3*b^4) + (((32*(A*a^ 
2*b^10 - A*b^12 - 3*A*a^3*b^9 + A*a^5*b^7 - 3*B*a^2*b^10 - 3*B*a^3*b^9 + 5 
*B*a^4*b^8 + B*a^5*b^7 - 2*B*a^6*b^6 + 2*A*a*b^11 + 2*B*a*b^11))/(a*b^8 + 
b^9 - a^2*b^7 - a^3*b^6) + (32*tan(c/2 + (d*x)/2)*(A*b - 2*B*a)*(2*a*b^11 
- 2*a^2*b^10 - 4*a^3*b^9 + 4*a^4*b^8 + 2*a^5*b^7 - 2*a^6*b^6))/(b^3*(a*b^6 
 + b^7 - a^2*b^5 - a^3*b^4)))*(A*b - 2*B*a))/b^3)*(A*b - 2*B*a)*1i)/b^3 + 
(((32*tan(c/2 + (d*x)/2)*(A^2*b^8 + 8*B^2*a^8 - 2*A^2*a*b^7 - 8*B^2*a^7*b 
+ 3*A^2*a^2*b^6 + 4*A^2*a^3*b^5 - 5*A^2*a^4*b^4 - 2*A^2*a^5*b^3 + 2*A^2*a^ 
6*b^2 + 4*B^2*a^2*b^6 - 8*B^2*a^3*b^5 + 5*B^2*a^4*b^4 + 16*B^2*a^5*b^3 - 1 
6*B^2*a^6*b^2 - 4*A*B*a*b^7 - 8*A*B*a^7*b + 8*A*B*a^2*b^6 - 8*A*B*a^3*b^5 
- 16*A*B*a^4*b^4 + 18*A*B*a^5*b^3 + 8*A*B*a^6*b^2))/(a*b^6 + b^7 - a^2*b^5 
 - a^3*b^4) - (((32*(A*a^2*b^10 - A*b^12 - 3*A*a^3*b^9 + A*a^5*b^7 - 3*...
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 200, normalized size of antiderivative = 1.22 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{(a+b \sec (c+d x))^2} \, dx=\frac {2 \sqrt {-a^{2}+b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b}{\sqrt {-a^{2}+b^{2}}}\right ) \cos \left (d x +c \right ) a^{2}+\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a^{3}-\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a \,b^{2}-\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a^{3}+\cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a \,b^{2}+\sin \left (d x +c \right ) a^{2} b -\sin \left (d x +c \right ) b^{3}}{\cos \left (d x +c \right ) b^{2} d \left (a^{2}-b^{2}\right )} \] Input:

int(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+b*sec(d*x+c))^2,x)
 

Output:

(2*sqrt( - a**2 + b**2)*atan((tan((c + d*x)/2)*a - tan((c + d*x)/2)*b)/sqr 
t( - a**2 + b**2))*cos(c + d*x)*a**2 + cos(c + d*x)*log(tan((c + d*x)/2) - 
 1)*a**3 - cos(c + d*x)*log(tan((c + d*x)/2) - 1)*a*b**2 - cos(c + d*x)*lo 
g(tan((c + d*x)/2) + 1)*a**3 + cos(c + d*x)*log(tan((c + d*x)/2) + 1)*a*b* 
*2 + sin(c + d*x)*a**2*b - sin(c + d*x)*b**3)/(cos(c + d*x)*b**2*d*(a**2 - 
 b**2))