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

Optimal result
Mathematica [B] (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 = 41, antiderivative size = 183 \[ \int \frac {\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {3 (4 A-4 B+5 C) \text {arctanh}(\sin (c+d x))}{8 a d}-\frac {(3 A-4 B+4 C) \tan (c+d x)}{a d}+\frac {3 (4 A-4 B+5 C) \sec (c+d x) \tan (c+d x)}{8 a d}+\frac {(4 A-4 B+5 C) \sec ^3(c+d x) \tan (c+d x)}{4 a d}-\frac {(A-B+C) \sec ^4(c+d x) \tan (c+d x)}{d (a+a \sec (c+d x))}-\frac {(3 A-4 B+4 C) \tan ^3(c+d x)}{3 a d} \] Output:

3/8*(4*A-4*B+5*C)*arctanh(sin(d*x+c))/a/d-(3*A-4*B+4*C)*tan(d*x+c)/a/d+3/8 
*(4*A-4*B+5*C)*sec(d*x+c)*tan(d*x+c)/a/d+1/4*(4*A-4*B+5*C)*sec(d*x+c)^3*ta 
n(d*x+c)/a/d-(A-B+C)*sec(d*x+c)^4*tan(d*x+c)/d/(a+a*sec(d*x+c))-1/3*(3*A-4 
*B+4*C)*tan(d*x+c)^3/a/d
 

Mathematica [B] (warning: unable to verify)

Leaf count is larger than twice the leaf count of optimal. \(1099\) vs. \(2(183)=366\).

Time = 7.57 (sec) , antiderivative size = 1099, normalized size of antiderivative = 6.01 \[ \int \frac {\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx =\text {Too large to display} \] Input:

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

Output:

(-3*(4*A - 4*B + 5*C)*Cos[c/2 + (d*x)/2]^2*Cos[c + d*x]*Log[Cos[c/2 + (d*x 
)/2] - Sin[c/2 + (d*x)/2]]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(2*d*( 
A + 2*C + 2*B*Cos[c + d*x] + A*Cos[2*c + 2*d*x])*(a + a*Sec[c + d*x])) + ( 
3*(4*A - 4*B + 5*C)*Cos[c/2 + (d*x)/2]^2*Cos[c + d*x]*Log[Cos[c/2 + (d*x)/ 
2] + Sin[c/2 + (d*x)/2]]*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(2*d*(A 
+ 2*C + 2*B*Cos[c + d*x] + A*Cos[2*c + 2*d*x])*(a + a*Sec[c + d*x])) + (Co 
s[c/2 + (d*x)/2]*Sec[c/2]*Sec[c]*Sec[c + d*x]^3*(A + B*Sec[c + d*x] + C*Se 
c[c + d*x]^2)*(-60*A*Sin[(d*x)/2] + 108*B*Sin[(d*x)/2] - 75*C*Sin[(d*x)/2] 
 - 60*A*Sin[(3*d*x)/2] + 124*B*Sin[(3*d*x)/2] - 91*C*Sin[(3*d*x)/2] + 204* 
A*Sin[c - (d*x)/2] - 252*B*Sin[c - (d*x)/2] + 219*C*Sin[c - (d*x)/2] - 60* 
A*Sin[c + (d*x)/2] + 12*B*Sin[c + (d*x)/2] + 21*C*Sin[c + (d*x)/2] + 84*A* 
Sin[2*c + (d*x)/2] - 132*B*Sin[2*c + (d*x)/2] + 165*C*Sin[2*c + (d*x)/2] + 
 36*A*Sin[c + (3*d*x)/2] + 28*B*Sin[c + (3*d*x)/2] + 5*C*Sin[c + (3*d*x)/2 
] + 36*A*Sin[2*c + (3*d*x)/2] - 36*B*Sin[2*c + (3*d*x)/2] + 69*C*Sin[2*c + 
 (3*d*x)/2] + 132*A*Sin[3*c + (3*d*x)/2] - 132*B*Sin[3*c + (3*d*x)/2] + 16 
5*C*Sin[3*c + (3*d*x)/2] - 156*A*Sin[c + (5*d*x)/2] + 220*B*Sin[c + (5*d*x 
)/2] - 211*C*Sin[c + (5*d*x)/2] - 60*A*Sin[2*c + (5*d*x)/2] + 124*B*Sin[2* 
c + (5*d*x)/2] - 115*C*Sin[2*c + (5*d*x)/2] - 60*A*Sin[3*c + (5*d*x)/2] + 
60*B*Sin[3*c + (5*d*x)/2] - 51*C*Sin[3*c + (5*d*x)/2] + 36*A*Sin[4*c + (5* 
d*x)/2] - 36*B*Sin[4*c + (5*d*x)/2] + 45*C*Sin[4*c + (5*d*x)/2] - 12*A*...
 

Rubi [A] (verified)

Time = 0.90 (sec) , antiderivative size = 154, normalized size of antiderivative = 0.84, number of steps used = 14, number of rules used = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.317, Rules used = {3042, 4572, 25, 3042, 4274, 3042, 4254, 2009, 4255, 3042, 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 ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a \sec (c+d x)+a} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4572

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 4274

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4254

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

\(\Big \downarrow \) 2009

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

\(\Big \downarrow \) 4255

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4255

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

\(\Big \downarrow \) 3042

\(\displaystyle -\frac {-a (4 A-4 B+5 C) \left (\frac {3}{4} \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 )+\frac {\tan (c+d x) \sec ^3(c+d x)}{4 d}\right )-\frac {a (3 A-4 B+4 C) \left (-\frac {1}{3} \tan ^3(c+d x)-\tan (c+d x)\right )}{d}}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^4(c+d x)}{d (a \sec (c+d x)+a)}\)

\(\Big \downarrow \) 4257

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

Input:

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

Output:

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

Defintions of rubi rules used

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

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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 4572
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. 
))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a 
_))^(m_), x_Symbol] :> Simp[(-(a*A - b*B + a*C))*Cot[e + f*x]*(a + b*Csc[e 
+ f*x])^m*((d*Csc[e + f*x])^n/(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*Simp[a*B*n - b*C*n - 
 A*b*(2*m + n + 1) - (b*B*(m + n + 1) - a*(A*(m + n + 1) - C*(m - n)))*Csc[ 
e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C, n}, x] && EqQ[a^2 - 
b^2, 0] && LtQ[m, -2^(-1)]
 
Maple [A] (verified)

Time = 0.69 (sec) , antiderivative size = 217, normalized size of antiderivative = 1.19

method result size
parallelrisch \(\frac {-3 \left (A -B +\frac {5 C}{4}\right ) \left (\cos \left (4 d x +4 c \right )+4 \cos \left (2 d x +2 c \right )+3\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+3 \left (A -B +\frac {5 C}{4}\right ) \left (\cos \left (4 d x +4 c \right )+4 \cos \left (2 d x +2 c \right )+3\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 (6 A -10 B +\frac {17 C}{2}\right ) \cos \left (2 d x +2 c \right )+2 \left (A -\frac {4 B}{3}+\frac {4 C}{3}\right ) \cos \left (4 d x +4 c \right )+\left (A -\frac {7 B}{3}+\frac {19 C}{12}\right ) \cos \left (3 d x +3 c \right )+\left (3 A -\frac {29 B}{3}+\frac {65 C}{12}\right ) \cos \left (d x +c \right )+4 A -\frac {22 B}{3}+\frac {23 C}{6}\right )}{2 a d \left (\cos \left (4 d x +4 c \right )+4 \cos \left (2 d x +2 c \right )+3\right )}\) \(217\)
norman \(\frac {-\frac {\left (A -B +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{11}}{a d}+\frac {\left (8 A -16 B +11 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 a d}+\frac {\left (32 A -40 B +45 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{4 a d}+\frac {2 \left (33 A -43 B +43 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{3 a d}-\frac {\left (66 A -98 B +95 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{6 a d}-\frac {\left (120 A -152 B +155 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{6 a d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{5}}-\frac {3 \left (4 A -4 B +5 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{8 a d}+\frac {3 \left (4 A -4 B +5 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{8 a d}\) \(247\)
derivativedivides \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {C}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {-\frac {5 C}{2}+B}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\left (\frac {15 C}{8}-\frac {3 B}{2}+\frac {3 A}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {-\frac {25 C}{8}+\frac {5 B}{2}-\frac {3 A}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}-\frac {\frac {15 C}{4}-2 B +A}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {C}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{4}}-\frac {-\frac {5 C}{2}+B}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}+\left (-\frac {15 C}{8}+\frac {3 B}{2}-\frac {3 A}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {-\frac {25 C}{8}+\frac {5 B}{2}-\frac {3 A}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {-\frac {15 C}{4}+2 B -A}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}}{d a}\) \(260\)
default \(\frac {-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C -\frac {C}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{4}}-\frac {-\frac {5 C}{2}+B}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}+\left (\frac {15 C}{8}-\frac {3 B}{2}+\frac {3 A}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {-\frac {25 C}{8}+\frac {5 B}{2}-\frac {3 A}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}-\frac {\frac {15 C}{4}-2 B +A}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {C}{4 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{4}}-\frac {-\frac {5 C}{2}+B}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}+\left (-\frac {15 C}{8}+\frac {3 B}{2}-\frac {3 A}{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {-\frac {25 C}{8}+\frac {5 B}{2}-\frac {3 A}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {-\frac {15 C}{4}+2 B -A}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}}{d a}\) \(260\)
risch \(-\frac {i \left (36 A \,{\mathrm e}^{8 i \left (d x +c \right )}+165 C \,{\mathrm e}^{6 i \left (d x +c \right )}+64 C +48 A -64 B -36 B \,{\mathrm e}^{8 i \left (d x +c \right )}-132 B \,{\mathrm e}^{6 i \left (d x +c \right )}+132 A \,{\mathrm e}^{6 i \left (d x +c \right )}+204 A \,{\mathrm e}^{4 i \left (d x +c \right )}+219 C \,{\mathrm e}^{4 i \left (d x +c \right )}+156 A \,{\mathrm e}^{2 i \left (d x +c \right )}+211 C \,{\mathrm e}^{2 i \left (d x +c \right )}+36 A \,{\mathrm e}^{7 i \left (d x +c \right )}+84 A \,{\mathrm e}^{5 i \left (d x +c \right )}+60 A \,{\mathrm e}^{3 i \left (d x +c \right )}+12 A \,{\mathrm e}^{i \left (d x +c \right )}+45 C \,{\mathrm e}^{7 i \left (d x +c \right )}+165 C \,{\mathrm e}^{5 i \left (d x +c \right )}+91 C \,{\mathrm e}^{3 i \left (d x +c \right )}+19 C \,{\mathrm e}^{i \left (d x +c \right )}-28 B \,{\mathrm e}^{i \left (d x +c \right )}+45 C \,{\mathrm e}^{8 i \left (d x +c \right )}-220 B \,{\mathrm e}^{2 i \left (d x +c \right )}-132 B \,{\mathrm e}^{5 i \left (d x +c \right )}-252 B \,{\mathrm e}^{4 i \left (d x +c \right )}-124 B \,{\mathrm e}^{3 i \left (d x +c \right )}-36 B \,{\mathrm e}^{7 i \left (d x +c \right )}\right )}{12 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 )^{4}}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A}{2 a d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{2 a d}-\frac {15 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{8 a d}+\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A}{2 a d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{2 a d}+\frac {15 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{8 a d}\) \(467\)

Input:

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

Output:

1/2*(-3*(A-B+5/4*C)*(cos(4*d*x+4*c)+4*cos(2*d*x+2*c)+3)*ln(tan(1/2*d*x+1/2 
*c)-1)+3*(A-B+5/4*C)*(cos(4*d*x+4*c)+4*cos(2*d*x+2*c)+3)*ln(tan(1/2*d*x+1/ 
2*c)+1)-2*tan(1/2*d*x+1/2*c)*((6*A-10*B+17/2*C)*cos(2*d*x+2*c)+2*(A-4/3*B+ 
4/3*C)*cos(4*d*x+4*c)+(A-7/3*B+19/12*C)*cos(3*d*x+3*c)+(3*A-29/3*B+65/12*C 
)*cos(d*x+c)+4*A-22/3*B+23/6*C))/a/d/(cos(4*d*x+4*c)+4*cos(2*d*x+2*c)+3)
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 216, normalized size of antiderivative = 1.18 \[ \int \frac {\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {9 \, {\left ({\left (4 \, A - 4 \, B + 5 \, C\right )} \cos \left (d x + c\right )^{5} + {\left (4 \, A - 4 \, B + 5 \, C\right )} \cos \left (d x + c\right )^{4}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 9 \, {\left ({\left (4 \, A - 4 \, B + 5 \, C\right )} \cos \left (d x + c\right )^{5} + {\left (4 \, A - 4 \, B + 5 \, C\right )} \cos \left (d x + c\right )^{4}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (16 \, {\left (3 \, A - 4 \, B + 4 \, C\right )} \cos \left (d x + c\right )^{4} + {\left (12 \, A - 28 \, B + 19 \, C\right )} \cos \left (d x + c\right )^{3} - {\left (12 \, A - 4 \, B + 13 \, C\right )} \cos \left (d x + c\right )^{2} - 2 \, {\left (4 \, B - C\right )} \cos \left (d x + c\right ) - 6 \, C\right )} \sin \left (d x + c\right )}{48 \, {\left (a d \cos \left (d x + c\right )^{5} + a d \cos \left (d x + c\right )^{4}\right )}} \] Input:

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

Output:

1/48*(9*((4*A - 4*B + 5*C)*cos(d*x + c)^5 + (4*A - 4*B + 5*C)*cos(d*x + c) 
^4)*log(sin(d*x + c) + 1) - 9*((4*A - 4*B + 5*C)*cos(d*x + c)^5 + (4*A - 4 
*B + 5*C)*cos(d*x + c)^4)*log(-sin(d*x + c) + 1) - 2*(16*(3*A - 4*B + 4*C) 
*cos(d*x + c)^4 + (12*A - 28*B + 19*C)*cos(d*x + c)^3 - (12*A - 4*B + 13*C 
)*cos(d*x + c)^2 - 2*(4*B - C)*cos(d*x + c) - 6*C)*sin(d*x + c))/(a*d*cos( 
d*x + c)^5 + a*d*cos(d*x + c)^4)
 

Sympy [F]

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

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

Output:

(Integral(A*sec(c + d*x)**4/(sec(c + d*x) + 1), x) + Integral(B*sec(c + d* 
x)**5/(sec(c + d*x) + 1), x) + Integral(C*sec(c + d*x)**6/(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. 611 vs. \(2 (175) = 350\).

Time = 0.05 (sec) , antiderivative size = 611, normalized size of antiderivative = 3.34 \[ \int \frac {\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx =\text {Too large to display} \] Input:

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

Output:

-1/24*(C*(2*(21*sin(d*x + c)/(cos(d*x + c) + 1) - 109*sin(d*x + c)^3/(cos( 
d*x + c) + 1)^3 + 115*sin(d*x + c)^5/(cos(d*x + c) + 1)^5 - 75*sin(d*x + c 
)^7/(cos(d*x + c) + 1)^7)/(a - 4*a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + 6 
*a*sin(d*x + c)^4/(cos(d*x + c) + 1)^4 - 4*a*sin(d*x + c)^6/(cos(d*x + c) 
+ 1)^6 + a*sin(d*x + c)^8/(cos(d*x + c) + 1)^8) - 45*log(sin(d*x + c)/(cos 
(d*x + c) + 1) + 1)/a + 45*log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a + 24 
*sin(d*x + c)/(a*(cos(d*x + c) + 1))) - 4*B*(2*(9*sin(d*x + c)/(cos(d*x + 
c) + 1) - 16*sin(d*x + c)^3/(cos(d*x + c) + 1)^3 + 15*sin(d*x + c)^5/(cos( 
d*x + c) + 1)^5)/(a - 3*a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + 3*a*sin(d* 
x + c)^4/(cos(d*x + c) + 1)^4 - a*sin(d*x + c)^6/(cos(d*x + c) + 1)^6) - 9 
*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a + 9*log(sin(d*x + c)/(cos(d*x 
+ c) + 1) - 1)/a + 6*sin(d*x + c)/(a*(cos(d*x + c) + 1))) + 12*A*(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))))/d
 

Giac [A] (verification not implemented)

Time = 0.26 (sec) , antiderivative size = 285, normalized size of antiderivative = 1.56 \[ \int \frac {\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {\frac {9 \, {\left (4 \, A - 4 \, B + 5 \, C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {9 \, {\left (4 \, A - 4 \, B + 5 \, C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} - \frac {24 \, {\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 ) + C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{a} + \frac {2 \, {\left (36 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 60 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 75 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 84 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 124 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 115 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 60 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 100 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 109 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 12 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 36 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 21 \, C \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 )}^{4} a}}{24 \, d} \] Input:

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

Output:

1/24*(9*(4*A - 4*B + 5*C)*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - 9*(4*A - 
4*B + 5*C)*log(abs(tan(1/2*d*x + 1/2*c) - 1))/a - 24*(A*tan(1/2*d*x + 1/2* 
c) - B*tan(1/2*d*x + 1/2*c) + C*tan(1/2*d*x + 1/2*c))/a + 2*(36*A*tan(1/2* 
d*x + 1/2*c)^7 - 60*B*tan(1/2*d*x + 1/2*c)^7 + 75*C*tan(1/2*d*x + 1/2*c)^7 
 - 84*A*tan(1/2*d*x + 1/2*c)^5 + 124*B*tan(1/2*d*x + 1/2*c)^5 - 115*C*tan( 
1/2*d*x + 1/2*c)^5 + 60*A*tan(1/2*d*x + 1/2*c)^3 - 100*B*tan(1/2*d*x + 1/2 
*c)^3 + 109*C*tan(1/2*d*x + 1/2*c)^3 - 12*A*tan(1/2*d*x + 1/2*c) + 36*B*ta 
n(1/2*d*x + 1/2*c) - 21*C*tan(1/2*d*x + 1/2*c))/((tan(1/2*d*x + 1/2*c)^2 - 
 1)^4*a))/d
 

Mupad [B] (verification not implemented)

Time = 13.23 (sec) , antiderivative size = 203, normalized size of antiderivative = 1.11 \[ \int \frac {\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx=\frac {3\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (4\,A-4\,B+5\,C\right )}{4\,a\,d}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B+C\right )}{a\,d}-\frac {\left (5\,B-3\,A-\frac {25\,C}{4}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (7\,A-\frac {31\,B}{3}+\frac {115\,C}{12}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (\frac {25\,B}{3}-5\,A-\frac {109\,C}{12}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (A-3\,B+\frac {7\,C}{4}\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8-4\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+6\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-4\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )} \] Input:

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

Output:

(3*atanh(tan(c/2 + (d*x)/2))*(4*A - 4*B + 5*C))/(4*a*d) - (tan(c/2 + (d*x) 
/2)*(A - B + C))/(a*d) - (tan(c/2 + (d*x)/2)*(A - 3*B + (7*C)/4) - tan(c/2 
 + (d*x)/2)^7*(3*A - 5*B + (25*C)/4) - tan(c/2 + (d*x)/2)^3*(5*A - (25*B)/ 
3 + (109*C)/12) + tan(c/2 + (d*x)/2)^5*(7*A - (31*B)/3 + (115*C)/12))/(d*( 
a - 4*a*tan(c/2 + (d*x)/2)^2 + 6*a*tan(c/2 + (d*x)/2)^4 - 4*a*tan(c/2 + (d 
*x)/2)^6 + a*tan(c/2 + (d*x)/2)^8))
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 645, normalized size of antiderivative = 3.52 \[ \int \frac {\sec ^4(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{a+a \sec (c+d x)} \, dx =\text {Too large to display} \] Input:

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

Output:

(48*cos(c + d*x)*sin(c + d*x)**4*a - 64*cos(c + d*x)*sin(c + d*x)**4*b + 6 
4*cos(c + d*x)*sin(c + d*x)**4*c - 72*cos(c + d*x)*sin(c + d*x)**2*a + 96* 
cos(c + d*x)*sin(c + d*x)**2*b - 96*cos(c + d*x)*sin(c + d*x)**2*c + 24*co 
s(c + d*x)*a - 24*cos(c + d*x)*b + 24*cos(c + d*x)*c - 36*log(tan((c + d*x 
)/2) - 1)*sin(c + d*x)**5*a + 36*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**5 
*b - 45*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**5*c + 72*log(tan((c + d*x) 
/2) - 1)*sin(c + d*x)**3*a - 72*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**3* 
b + 90*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**3*c - 36*log(tan((c + d*x)/ 
2) - 1)*sin(c + d*x)*a + 36*log(tan((c + d*x)/2) - 1)*sin(c + d*x)*b - 45* 
log(tan((c + d*x)/2) - 1)*sin(c + d*x)*c + 36*log(tan((c + d*x)/2) + 1)*si 
n(c + d*x)**5*a - 36*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**5*b + 45*log( 
tan((c + d*x)/2) + 1)*sin(c + d*x)**5*c - 72*log(tan((c + d*x)/2) + 1)*sin 
(c + d*x)**3*a + 72*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**3*b - 90*log(t 
an((c + d*x)/2) + 1)*sin(c + d*x)**3*c + 36*log(tan((c + d*x)/2) + 1)*sin( 
c + d*x)*a - 36*log(tan((c + d*x)/2) + 1)*sin(c + d*x)*b + 45*log(tan((c + 
 d*x)/2) + 1)*sin(c + d*x)*c - 36*sin(c + d*x)**4*a + 36*sin(c + d*x)**4*b 
 - 45*sin(c + d*x)**4*c + 60*sin(c + d*x)**2*a - 60*sin(c + d*x)**2*b + 75 
*sin(c + d*x)**2*c - 24*a + 24*b - 24*c)/(24*sin(c + d*x)*a*d*(sin(c + d*x 
)**4 - 2*sin(c + d*x)**2 + 1))