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

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

Optimal result

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

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

Mathematica [A] (verified)

Time = 0.51 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.78 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=\frac {-((2 A-3 B) \text {arctanh}(\sin (c+d x)) (1+\sec (c+d x)))+\left (4 (A-B)+(2 A-B) \sec (c+d x)+B \sec ^2(c+d x)\right ) \tan (c+d x)}{2 a d (1+\sec (c+d x))} \] Input:

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

Output:

(-((2*A - 3*B)*ArcTanh[Sin[c + d*x]]*(1 + Sec[c + d*x])) + (4*(A - B) + (2 
*A - B)*Sec[c + d*x] + B*Sec[c + d*x]^2)*Tan[c + d*x])/(2*a*d*(1 + Sec[c + 
 d*x]))
 

Rubi [A] (verified)

Time = 0.66 (sec) , antiderivative size = 102, normalized size of antiderivative = 0.94, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.323, Rules used = {3042, 4507, 3042, 4274, 3042, 4254, 24, 4255, 3042, 4257}

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 \sec (c+d x)+a} \, 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 )}{a \csc \left (c+d x+\frac {\pi }{2}\right )+a}dx\)

\(\Big \downarrow \) 4507

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4274

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4254

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

\(\Big \downarrow \) 24

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

\(\Big \downarrow \) 4255

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4257

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

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

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

rule 4255
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* 
x]*((b*Csc[c + d*x])^(n - 1)/(d*(n - 1))), x] + Simp[b^2*((n - 2)/(n - 1)) 
  Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] 
&& IntegerQ[2*n]
 

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

rule 4274
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_)), x_Symbol] :> Simp[a   Int[(d*Csc[e + f*x])^n, x], x] + Simp[b/d   In 
t[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]
 

rule 4507
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[d*(A*b 
- a*B)*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^(n - 1)/(a*f*( 
2*m + 1))), x] - Simp[1/(a*b*(2*m + 1))   Int[(a + b*Csc[e + f*x])^(m + 1)* 
(d*Csc[e + f*x])^(n - 1)*Simp[A*(a*d*(n - 1)) - B*(b*d*(n - 1)) - d*(a*B*(m 
 - n + 1) + A*b*(m + n))*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, 
A, B}, x] && NeQ[A*b - a*B, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)] && G 
tQ[n, 0]
 
Maple [A] (verified)

Time = 0.40 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.13

method result size
parallelrisch \(\frac {\left (1+\cos \left (2 d x +2 c \right )\right ) \left (-\frac {3 B}{2}+A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\left (1+\cos \left (2 d x +2 c \right )\right ) \left (-\frac {3 B}{2}+A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\left (A -B \right ) \cos \left (2 d x +2 c \right )+\left (1+\cos \left (d x +c \right )\right ) \left (A -\frac {B}{2}\right )\right )}{d a \left (1+\cos \left (2 d x +2 c \right )\right )}\) \(122\)
derivativedivides \(\frac {\frac {B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {-\frac {3 B}{2}+A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-\frac {3 B}{2}+A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -\frac {B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\left (\frac {3 B}{2}-A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {-\frac {3 B}{2}+A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{d a}\) \(142\)
default \(\frac {\frac {B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {-\frac {3 B}{2}+A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-\frac {3 B}{2}+A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -\frac {B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\left (\frac {3 B}{2}-A \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {-\frac {3 B}{2}+A}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{d a}\) \(142\)
norman \(\frac {\frac {\left (A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{a d}+\frac {7 \left (A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a d}-\frac {\left (3 A -2 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {\left (5 A -6 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{3}}+\frac {\left (2 A -3 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 a d}-\frac {\left (2 A -3 B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 a d}\) \(170\)
risch \(\frac {i \left (2 A \,{\mathrm e}^{4 i \left (d x +c \right )}-3 B \,{\mathrm e}^{4 i \left (d x +c \right )}+2 A \,{\mathrm e}^{3 i \left (d x +c \right )}-3 B \,{\mathrm e}^{3 i \left (d x +c \right )}+6 A \,{\mathrm e}^{2 i \left (d x +c \right )}-5 B \,{\mathrm e}^{2 i \left (d x +c \right )}+2 \,{\mathrm e}^{i \left (d x +c \right )} A -B \,{\mathrm e}^{i \left (d x +c \right )}+4 A -4 B \right )}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{a d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{2 a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{a d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{2 a d}\) \(227\)

Input:

int(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+a*sec(d*x+c)),x,method=_RETURNVERBOSE 
)
 

Output:

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

Fricas [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 156, normalized size of antiderivative = 1.44 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=-\frac {{\left ({\left (2 \, A - 3 \, B\right )} \cos \left (d x + c\right )^{3} + {\left (2 \, A - 3 \, B\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left ({\left (2 \, A - 3 \, B\right )} \cos \left (d x + c\right )^{3} + {\left (2 \, A - 3 \, B\right )} \cos \left (d x + c\right )^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (4 \, {\left (A - B\right )} \cos \left (d x + c\right )^{2} + {\left (2 \, A - B\right )} \cos \left (d x + c\right ) + B\right )} \sin \left (d x + c\right )}{4 \, {\left (a d \cos \left (d x + c\right )^{3} + a d \cos \left (d x + c\right )^{2}\right )}} \] Input:

integrate(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+a*sec(d*x+c)),x, algorithm="fri 
cas")
 

Output:

-1/4*(((2*A - 3*B)*cos(d*x + c)^3 + (2*A - 3*B)*cos(d*x + c)^2)*log(sin(d* 
x + c) + 1) - ((2*A - 3*B)*cos(d*x + c)^3 + (2*A - 3*B)*cos(d*x + c)^2)*lo 
g(-sin(d*x + c) + 1) - 2*(4*(A - B)*cos(d*x + c)^2 + (2*A - B)*cos(d*x + c 
) + B)*sin(d*x + c))/(a*d*cos(d*x + c)^3 + a*d*cos(d*x + c)^2)
 

Sympy [F]

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

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

Output:

(Integral(A*sec(c + d*x)**3/(sec(c + d*x) + 1), x) + Integral(B*sec(c + d* 
x)**4/(sec(c + d*x) + 1), x))/a
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 282 vs. \(2 (104) = 208\).

Time = 0.04 (sec) , antiderivative size = 282, normalized size of antiderivative = 2.61 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=-\frac {B {\left (\frac {2 \, {\left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {3 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}\right )}}{a - \frac {2 \, a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} - \frac {3 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} + \frac {3 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} + \frac {2 \, \sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} + 2 \, A {\left (\frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a} - \frac {2 \, \sin \left (d x + c\right )}{{\left (a - \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{2 \, d} \] Input:

integrate(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+a*sec(d*x+c)),x, algorithm="max 
ima")
 

Output:

-1/2*(B*(2*(sin(d*x + c)/(cos(d*x + c) + 1) - 3*sin(d*x + c)^3/(cos(d*x + 
c) + 1)^3)/(a - 2*a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + a*sin(d*x + c)^4 
/(cos(d*x + c) + 1)^4) - 3*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a + 3* 
log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a + 2*sin(d*x + c)/(a*(cos(d*x + 
c) + 1))) + 2*A*(log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x 
+ c)/(cos(d*x + c) + 1) - 1)/a - 2*sin(d*x + c)/((a - a*sin(d*x + c)^2/(co 
s(d*x + c) + 1)^2)*(cos(d*x + c) + 1)) - sin(d*x + c)/(a*(cos(d*x + c) + 1 
))))/d
 

Giac [A] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 156, normalized size of antiderivative = 1.44 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=-\frac {\frac {{\left (2 \, A - 3 \, B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {{\left (2 \, A - 3 \, B\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} - \frac {2 \, {\left (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 )\right )}}{a} + \frac {2 \, {\left (2 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, 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 )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2} a}}{2 \, d} \] Input:

integrate(sec(d*x+c)^3*(A+B*sec(d*x+c))/(a+a*sec(d*x+c)),x, algorithm="gia 
c")
 

Output:

-1/2*((2*A - 3*B)*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - (2*A - 3*B)*log(a 
bs(tan(1/2*d*x + 1/2*c) - 1))/a - 2*(A*tan(1/2*d*x + 1/2*c) - B*tan(1/2*d* 
x + 1/2*c))/a + 2*(2*A*tan(1/2*d*x + 1/2*c)^3 - 3*B*tan(1/2*d*x + 1/2*c)^3 
 - 2*A*tan(1/2*d*x + 1/2*c) + B*tan(1/2*d*x + 1/2*c))/((tan(1/2*d*x + 1/2* 
c)^2 - 1)^2*a))/d
 

Mupad [B] (verification not implemented)

Time = 10.85 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.10 \[ \int \frac {\sec ^3(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B\right )}{a\,d}-\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (A-\frac {3\,B}{2}\right )}{a\,d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (2\,A-3\,B\right )-\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,A-B\right )}{d\,\left (a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-2\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )} \] Input:

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

Output:

(tan(c/2 + (d*x)/2)*(A - B))/(a*d) - (2*atanh(tan(c/2 + (d*x)/2))*(A - (3* 
B)/2))/(a*d) - (tan(c/2 + (d*x)/2)^3*(2*A - 3*B) - tan(c/2 + (d*x)/2)*(2*A 
 - B))/(d*(a - 2*a*tan(c/2 + (d*x)/2)^2 + a*tan(c/2 + (d*x)/2)^4))
 

Reduce [B] (verification not implemented)

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

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

Output:

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