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

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (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 = 62 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=\frac {(A-B) \text {arctanh}(\sin (c+d x))}{a d}+\frac {B \tan (c+d x)}{a d}-\frac {(A-B) \tan (c+d x)}{d (a+a \sec (c+d x))} \] Output:

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

Mathematica [A] (verified)

Time = 0.46 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.76 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=\frac {(A-B) \coth ^{-1}(\sin (c+d x))+(-A+2 B+B \sec (c+d x)) \tan \left (\frac {1}{2} (c+d x)\right )}{a d} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.51 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.02, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.290, Rules used = {3042, 4496, 25, 3042, 4274, 3042, 4254, 24, 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 ^2(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 )^2 \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 \) 4496

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

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \sec (c+d x) (a (A-B)+a B \sec (c+d x))dx}{a^2}-\frac {(A-B) \tan (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 ) \left (a (A-B)+a B \csc \left (c+d x+\frac {\pi }{2}\right )\right )dx}{a^2}-\frac {(A-B) \tan (c+d x)}{d (a \sec (c+d x)+a)}\)

\(\Big \downarrow \) 4274

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4254

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

\(\Big \downarrow \) 24

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

\(\Big \downarrow \) 4257

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

Input:

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

Output:

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

Defintions of rubi rules used

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

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], 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 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 4496
Int[csc[(e_.) + (f_.)*(x_)]^2*(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/(b*f*(2*m + 1))), x] + Simp[1/(b^2*(2*m + 
 1))   Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^(m + 1)*Simp[A*b*m - a*B*m + b 
*B*(2*m + 1)*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B}, x] && Ne 
Q[A*b - a*B, 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)]
 
Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.50

method result size
parallelrisch \(\frac {-\cos \left (d x +c \right ) \left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\cos \left (d x +c \right ) \left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\left (\left (A -2 B \right ) \cos \left (d x +c \right )-B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d \cos \left (d x +c \right )}\) \(93\)
derivativedivides \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -\frac {B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d a}\) \(100\)
default \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -\frac {B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d a}\) \(100\)
norman \(\frac {-\frac {\left (A -3 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}+\frac {2 \left (A -2 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a d}-\frac {\left (A -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 )^{2}}+\frac {\left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a d}-\frac {\left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a d}\) \(138\)
risch \(-\frac {2 i \left (A \,{\mathrm e}^{2 i \left (d x +c \right )}-B \,{\mathrm e}^{2 i \left (d x +c \right )}-B \,{\mathrm e}^{i \left (d x +c \right )}+A -2 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 )}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{a d}\) \(163\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 127 vs. \(2 (62) = 124\).

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

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

Output:

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

Sympy [F]

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

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

Output:

(Integral(A*sec(c + d*x)**2/(sec(c + d*x) + 1), x) + Integral(B*sec(c + d* 
x)**3/(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. 196 vs. \(2 (62) = 124\).

Time = 0.03 (sec) , antiderivative size = 196, normalized size of antiderivative = 3.16 \[ \int \frac {\sec ^2(c+d x) (A+B \sec (c+d x))}{a+a \sec (c+d x)} \, dx=-\frac {B {\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 )} - 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 {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{d} \] Input:

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

Output:

-(B*(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/(cos(d*x + c) + 
 1)^2)*(cos(d*x + c) + 1)) - sin(d*x + c)/(a*(cos(d*x + c) + 1))) - 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 - sin(d*x + c)/(a*(cos(d*x + c) + 1))))/d
 

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

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