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

Optimal result
Mathematica [A] (warning: unable to verify)
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 = 29, antiderivative size = 98 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx=-\frac {(2 A-B) x}{a^2}+\frac {2 (5 A-2 B) \sin (c+d x)}{3 a^2 d}-\frac {(2 A-B) \sin (c+d x)}{a^2 d (1+\sec (c+d x))}-\frac {(A-B) \sin (c+d x)}{3 d (a+a \sec (c+d x))^2} \] Output:

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

Mathematica [A] (warning: unable to verify)

Time = 1.06 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.05 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx=\frac {\sin (c+d x) \left (4 A-B+\frac {-A+B}{(1+\sec (c+d x))^2}+\frac {3 (2 A-B) \left (\arcsin (\cos (c+d x)) (1+\cos (c+d x))+\sqrt {\sin ^2(c+d x)}\right )}{\sqrt {1-\cos (c+d x)} (1+\cos (c+d x))^{3/2}}\right )}{3 a^2 d} \] Input:

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

Output:

(Sin[c + d*x]*(4*A - B + (-A + B)/(1 + Sec[c + d*x])^2 + (3*(2*A - B)*(Arc 
Sin[Cos[c + d*x]]*(1 + Cos[c + d*x]) + Sqrt[Sin[c + d*x]^2]))/(Sqrt[1 - Co 
s[c + d*x]]*(1 + Cos[c + d*x])^(3/2))))/(3*a^2*d)
 

Rubi [A] (verified)

Time = 0.68 (sec) , antiderivative size = 106, normalized size of antiderivative = 1.08, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.310, Rules used = {3042, 4508, 3042, 4508, 3042, 4274, 24, 3042, 3117}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4508

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4508

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4274

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

\(\Big \downarrow \) 24

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3117

\(\displaystyle \frac {\frac {\frac {2 a^2 (5 A-2 B) \sin (c+d x)}{d}-3 a^2 x (2 A-B)}{a^2}-\frac {3 (2 A-B) \sin (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B) \sin (c+d x)}{3 d (a \sec (c+d x)+a)^2}\)

Input:

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

Output:

-1/3*((A - B)*Sin[c + d*x])/(d*(a + a*Sec[c + d*x])^2) + ((-3*(2*A - B)*Si 
n[c + d*x])/(d*(1 + Sec[c + d*x])) + (-3*a^2*(2*A - B)*x + (2*a^2*(5*A - 2 
*B)*Sin[c + d*x])/d)/a^2)/(3*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 3117
Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[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 4508
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-(A*b 
- a*B))*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(b*f*(2*m + 
 1))), x] - Simp[1/(a^2*(2*m + 1))   Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Cs 
c[e + f*x])^n*Simp[b*B*n - a*A*(2*m + n + 1) + (A*b - a*B)*(m + n + 1)*Csc[ 
e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[A*b - a*B 
, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)] &&  !GtQ[n, 0]
 
Maple [A] (verified)

Time = 0.32 (sec) , antiderivative size = 73, normalized size of antiderivative = 0.74

method result size
parallelrisch \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (-20 B +\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (3 A \cos \left (2 d x +2 c \right )+28 A \cos \left (d x +c \right )+23 A +2 B \right )\right )-24 d \left (A -\frac {B}{2}\right ) x}{12 a^{2} d}\) \(73\)
derivativedivides \(\frac {-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} A}{3}+\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} B}{3}+5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A -3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\frac {4 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}-4 \left (2 A -B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) \(108\)
default \(\frac {-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} A}{3}+\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} B}{3}+5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A -3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\frac {4 A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}-4 \left (2 A -B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) \(108\)
risch \(-\frac {2 A x}{a^{2}}+\frac {x B}{a^{2}}-\frac {i A \,{\mathrm e}^{i \left (d x +c \right )}}{2 a^{2} d}+\frac {i A \,{\mathrm e}^{-i \left (d x +c \right )}}{2 a^{2} d}+\frac {2 i \left (9 A \,{\mathrm e}^{2 i \left (d x +c \right )}-6 B \,{\mathrm e}^{2 i \left (d x +c \right )}+15 \,{\mathrm e}^{i \left (d x +c \right )} A -9 B \,{\mathrm e}^{i \left (d x +c \right )}+8 A -5 B \right )}{3 d \,a^{2} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3}}\) \(130\)
norman \(\frac {-\frac {\left (2 A -B \right ) x}{a}-\frac {\left (A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{6 a d}-\frac {\left (2 A -B \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{a}+\frac {3 \left (3 A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}+\frac {\left (7 A -4 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 a d}}{a \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}\) \(132\)

Input:

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

Output:

1/12*(tan(1/2*d*x+1/2*c)*(-20*B+sec(1/2*d*x+1/2*c)^2*(3*A*cos(2*d*x+2*c)+2 
8*A*cos(d*x+c)+23*A+2*B))-24*d*(A-1/2*B)*x)/a^2/d
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.26 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx=-\frac {3 \, {\left (2 \, A - B\right )} d x \cos \left (d x + c\right )^{2} + 6 \, {\left (2 \, A - B\right )} d x \cos \left (d x + c\right ) + 3 \, {\left (2 \, A - B\right )} d x - {\left (3 \, A \cos \left (d x + c\right )^{2} + {\left (14 \, A - 5 \, B\right )} \cos \left (d x + c\right ) + 10 \, A - 4 \, B\right )} \sin \left (d x + c\right )}{3 \, {\left (a^{2} d \cos \left (d x + c\right )^{2} + 2 \, a^{2} d \cos \left (d x + c\right ) + a^{2} d\right )}} \] Input:

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

Output:

-1/3*(3*(2*A - B)*d*x*cos(d*x + c)^2 + 6*(2*A - B)*d*x*cos(d*x + c) + 3*(2 
*A - B)*d*x - (3*A*cos(d*x + c)^2 + (14*A - 5*B)*cos(d*x + c) + 10*A - 4*B 
)*sin(d*x + c))/(a^2*d*cos(d*x + c)^2 + 2*a^2*d*cos(d*x + c) + a^2*d)
 

Sympy [F]

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

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

Output:

(Integral(A*cos(c + d*x)/(sec(c + d*x)**2 + 2*sec(c + d*x) + 1), x) + Inte 
gral(B*cos(c + d*x)*sec(c + d*x)/(sec(c + d*x)**2 + 2*sec(c + d*x) + 1), x 
))/a**2
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 191 vs. \(2 (94) = 188\).

Time = 0.11 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.95 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx=\frac {A {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {24 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} + \frac {a^{2} \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 )}}\right )} - B {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}}\right )}}{6 \, d} \] Input:

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

Output:

1/6*(A*((15*sin(d*x + c)/(cos(d*x + c) + 1) - sin(d*x + c)^3/(cos(d*x + c) 
 + 1)^3)/a^2 - 24*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a^2 + 12*sin(d*x 
 + c)/((a^2 + a^2*sin(d*x + c)^2/(cos(d*x + c) + 1)^2)*(cos(d*x + c) + 1)) 
) - B*((9*sin(d*x + c)/(cos(d*x + c) + 1) - sin(d*x + c)^3/(cos(d*x + c) + 
 1)^3)/a^2 - 12*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a^2))/d
 

Giac [A] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.23 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx=-\frac {\frac {6 \, {\left (d x + c\right )} {\left (2 \, A - B\right )}}{a^{2}} - \frac {12 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a^{2}} + \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 15 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \] Input:

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

Output:

-1/6*(6*(d*x + c)*(2*A - B)/a^2 - 12*A*tan(1/2*d*x + 1/2*c)/((tan(1/2*d*x 
+ 1/2*c)^2 + 1)*a^2) + (A*a^4*tan(1/2*d*x + 1/2*c)^3 - B*a^4*tan(1/2*d*x + 
 1/2*c)^3 - 15*A*a^4*tan(1/2*d*x + 1/2*c) + 9*B*a^4*tan(1/2*d*x + 1/2*c))/ 
a^6)/d
 

Mupad [B] (verification not implemented)

Time = 11.30 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.11 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A-B}{a^2}+\frac {3\,A-B}{2\,a^2}\right )}{d}-\frac {x\,\left (2\,A-B\right )}{a^2}+\frac {2\,A\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a^2\right )}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 145, normalized size of antiderivative = 1.48 \[ \int \frac {\cos (c+d x) (A+B \sec (c+d x))}{(a+a \sec (c+d x))^2} \, dx=\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5} a +\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5} b +14 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} a -8 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} b -12 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a d x +6 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b d x +27 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a -9 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b -12 a d x +6 b d x}{6 a^{2} d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right )} \] Input:

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

Output:

( - tan((c + d*x)/2)**5*a + tan((c + d*x)/2)**5*b + 14*tan((c + d*x)/2)**3 
*a - 8*tan((c + d*x)/2)**3*b - 12*tan((c + d*x)/2)**2*a*d*x + 6*tan((c + d 
*x)/2)**2*b*d*x + 27*tan((c + d*x)/2)*a - 9*tan((c + d*x)/2)*b - 12*a*d*x 
+ 6*b*d*x)/(6*a**2*d*(tan((c + d*x)/2)**2 + 1))