\(\int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx\) [219]

Optimal result
Mathematica [B] (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 = 133 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx=\frac {(3 c-2 d) d^2 \text {arctanh}(\sin (e+f x))}{a^2 f}+\frac {(c-d) (c+d \sec (e+f x))^2 \tan (e+f x)}{3 f (a+a \sec (e+f x))^2}+\frac {\left (c^3+4 c^2 d-12 c d^2+10 d^3-(c-4 d) d^2 \sec (e+f x)\right ) \tan (e+f x)}{3 f \left (a^2+a^2 \sec (e+f x)\right )} \] Output:

(3*c-2*d)*d^2*arctanh(sin(f*x+e))/a^2/f+1/3*(c-d)*(c+d*sec(f*x+e))^2*tan(f 
*x+e)/f/(a+a*sec(f*x+e))^2+1/3*(c^3+4*c^2*d-12*c*d^2+10*d^3-(c-4*d)*d^2*se 
c(f*x+e))*tan(f*x+e)/f/(a^2+a^2*sec(f*x+e))
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(294\) vs. \(2(133)=266\).

Time = 3.26 (sec) , antiderivative size = 294, normalized size of antiderivative = 2.21 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx=\frac {2 \cos ^6\left (\frac {1}{2} (e+f x)\right ) \sec (e+f x) \left (6 d^2 (-3 c+2 d) \left (\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )-8 (c-d)^3 \csc ^3(e+f x) \sin ^4\left (\frac {1}{2} (e+f x)\right )+32 (c-d)^3 \csc ^5(e+f x) \sin ^8\left (\frac {1}{2} (e+f x)\right )+2 \left (2 c^3+3 c^2 d-12 c d^2+13 d^3\right ) \tan \left (\frac {1}{2} (e+f x)\right )+6 (3 c-2 d) d^2 \left (\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right ) \tan ^2\left (\frac {1}{2} (e+f x)\right )-2 (c-d)^2 (2 c+7 d) \tan ^3\left (\frac {1}{2} (e+f x)\right )\right )}{3 a^2 f (1+\cos (e+f x))^2} \] Input:

Integrate[(Sec[e + f*x]*(c + d*Sec[e + f*x])^3)/(a + a*Sec[e + f*x])^2,x]
 

Output:

(2*Cos[(e + f*x)/2]^6*Sec[e + f*x]*(6*d^2*(-3*c + 2*d)*(Log[Cos[(e + f*x)/ 
2] - Sin[(e + f*x)/2]] - Log[Cos[(e + f*x)/2] + Sin[(e + f*x)/2]]) - 8*(c 
- d)^3*Csc[e + f*x]^3*Sin[(e + f*x)/2]^4 + 32*(c - d)^3*Csc[e + f*x]^5*Sin 
[(e + f*x)/2]^8 + 2*(2*c^3 + 3*c^2*d - 12*c*d^2 + 13*d^3)*Tan[(e + f*x)/2] 
 + 6*(3*c - 2*d)*d^2*(Log[Cos[(e + f*x)/2] - Sin[(e + f*x)/2]] - Log[Cos[( 
e + f*x)/2] + Sin[(e + f*x)/2]])*Tan[(e + f*x)/2]^2 - 2*(c - d)^2*(2*c + 7 
*d)*Tan[(e + f*x)/2]^3))/(3*a^2*f*(1 + Cos[e + f*x])^2)
 

Rubi [A] (verified)

Time = 0.44 (sec) , antiderivative size = 222, normalized size of antiderivative = 1.67, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {3042, 4475, 109, 25, 27, 160, 45, 218}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4475

\(\displaystyle -\frac {a^2 \tan (e+f x) \int \frac {(c+d \sec (e+f x))^3}{\sqrt {a-a \sec (e+f x)} (\sec (e+f x) a+a)^{5/2}}d\sec (e+f x)}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}\)

\(\Big \downarrow \) 109

\(\displaystyle -\frac {a^2 \tan (e+f x) \left (-\frac {\int -\frac {a^2 (c+d \sec (e+f x)) \left (c^2+4 d c-2 d^2-(c-4 d) d \sec (e+f x)\right )}{\sqrt {a-a \sec (e+f x)} (\sec (e+f x) a+a)^{3/2}}d\sec (e+f x)}{3 a^3}-\frac {(c-d) \sqrt {a-a \sec (e+f x)} (c+d \sec (e+f x))^2}{3 a^2 (a \sec (e+f x)+a)^{3/2}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {a^2 \tan (e+f x) \left (\frac {\int \frac {a^2 (c+d \sec (e+f x)) \left (c^2+4 d c-2 d^2-(c-4 d) d \sec (e+f x)\right )}{\sqrt {a-a \sec (e+f x)} (\sec (e+f x) a+a)^{3/2}}d\sec (e+f x)}{3 a^3}-\frac {(c-d) \sqrt {a-a \sec (e+f x)} (c+d \sec (e+f x))^2}{3 a^2 (a \sec (e+f x)+a)^{3/2}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}\)

\(\Big \downarrow \) 27

\(\displaystyle -\frac {a^2 \tan (e+f x) \left (\frac {\int \frac {(c+d \sec (e+f x)) \left (c^2+4 d c-2 d^2-(c-4 d) d \sec (e+f x)\right )}{\sqrt {a-a \sec (e+f x)} (\sec (e+f x) a+a)^{3/2}}d\sec (e+f x)}{3 a}-\frac {(c-d) \sqrt {a-a \sec (e+f x)} (c+d \sec (e+f x))^2}{3 a^2 (a \sec (e+f x)+a)^{3/2}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}\)

\(\Big \downarrow \) 160

\(\displaystyle -\frac {a^2 \tan (e+f x) \left (\frac {\frac {3 d^2 (3 c-2 d) \int \frac {1}{\sqrt {a-a \sec (e+f x)} \sqrt {\sec (e+f x) a+a}}d\sec (e+f x)}{a}-\frac {\sqrt {a-a \sec (e+f x)} \left (c^3+4 c^2 d-d^2 (c-4 d) \sec (e+f x)-12 c d^2+10 d^3\right )}{a^2 \sqrt {a \sec (e+f x)+a}}}{3 a}-\frac {(c-d) \sqrt {a-a \sec (e+f x)} (c+d \sec (e+f x))^2}{3 a^2 (a \sec (e+f x)+a)^{3/2}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}\)

\(\Big \downarrow \) 45

\(\displaystyle -\frac {a^2 \tan (e+f x) \left (\frac {\frac {6 d^2 (3 c-2 d) \int \frac {1}{-\frac {(a-a \sec (e+f x)) a}{\sec (e+f x) a+a}-a}d\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {\sec (e+f x) a+a}}}{a}-\frac {\sqrt {a-a \sec (e+f x)} \left (c^3+4 c^2 d-d^2 (c-4 d) \sec (e+f x)-12 c d^2+10 d^3\right )}{a^2 \sqrt {a \sec (e+f x)+a}}}{3 a}-\frac {(c-d) \sqrt {a-a \sec (e+f x)} (c+d \sec (e+f x))^2}{3 a^2 (a \sec (e+f x)+a)^{3/2}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}\)

\(\Big \downarrow \) 218

\(\displaystyle -\frac {a^2 \tan (e+f x) \left (\frac {-\frac {6 d^2 (3 c-2 d) \arctan \left (\frac {\sqrt {a-a \sec (e+f x)}}{\sqrt {a \sec (e+f x)+a}}\right )}{a^2}-\frac {\sqrt {a-a \sec (e+f x)} \left (c^3+4 c^2 d-d^2 (c-4 d) \sec (e+f x)-12 c d^2+10 d^3\right )}{a^2 \sqrt {a \sec (e+f x)+a}}}{3 a}-\frac {(c-d) \sqrt {a-a \sec (e+f x)} (c+d \sec (e+f x))^2}{3 a^2 (a \sec (e+f x)+a)^{3/2}}\right )}{f \sqrt {a-a \sec (e+f x)} \sqrt {a \sec (e+f x)+a}}\)

Input:

Int[(Sec[e + f*x]*(c + d*Sec[e + f*x])^3)/(a + a*Sec[e + f*x])^2,x]
 

Output:

-((a^2*(-1/3*((c - d)*Sqrt[a - a*Sec[e + f*x]]*(c + d*Sec[e + f*x])^2)/(a^ 
2*(a + a*Sec[e + f*x])^(3/2)) + ((-6*(3*c - 2*d)*d^2*ArcTan[Sqrt[a - a*Sec 
[e + f*x]]/Sqrt[a + a*Sec[e + f*x]]])/a^2 - (Sqrt[a - a*Sec[e + f*x]]*(c^3 
 + 4*c^2*d - 12*c*d^2 + 10*d^3 - (c - 4*d)*d^2*Sec[e + f*x]))/(a^2*Sqrt[a 
+ a*Sec[e + f*x]]))/(3*a))*Tan[e + f*x])/(f*Sqrt[a - a*Sec[e + f*x]]*Sqrt[ 
a + a*Sec[e + f*x]]))
 

Defintions of rubi rules used

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

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 45
Int[1/(Sqrt[(a_) + (b_.)*(x_)]*Sqrt[(c_) + (d_.)*(x_)]), x_Symbol] :> Simp[ 
2   Subst[Int[1/(b - d*x^2), x], x, Sqrt[a + b*x]/Sqrt[c + d*x]], x] /; Fre 
eQ[{a, b, c, d}, x] && EqQ[b*c + a*d, 0] &&  !GtQ[c, 0]
 

rule 109
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_) 
)^(p_), x_] :> Simp[(b*c - a*d)*(a + b*x)^(m + 1)*(c + d*x)^(n - 1)*((e + f 
*x)^(p + 1)/(b*(b*e - a*f)*(m + 1))), x] + Simp[1/(b*(b*e - a*f)*(m + 1)) 
 Int[(a + b*x)^(m + 1)*(c + d*x)^(n - 2)*(e + f*x)^p*Simp[a*d*(d*e*(n - 1) 
+ c*f*(p + 1)) + b*c*(d*e*(m - n + 2) - c*f*(m + p + 2)) + d*(a*d*f*(n + p) 
 + b*(d*e*(m + 1) - c*f*(m + n + p + 1)))*x, x], x], x] /; FreeQ[{a, b, c, 
d, e, f, p}, x] && LtQ[m, -1] && GtQ[n, 1] && (IntegersQ[2*m, 2*n, 2*p] || 
IntegersQ[m, n + p] || IntegersQ[p, m + n])
 

rule 160
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.)*((e_) + (f_.)*(x_) 
)*((g_.) + (h_.)*(x_)), x_] :> Simp[(b^2*d*e*g - a^2*d*f*h*m - a*b*(d*(f*g 
+ e*h) - c*f*h*(m + 1)) + b*f*h*(b*c - a*d)*(m + 1)*x)*(a + b*x)^(m + 1)*(( 
c + d*x)^(n + 1)/(b^2*d*(b*c - a*d)*(m + 1))), x] + Simp[(a*d*f*h*m + b*(d* 
(f*g + e*h) - c*f*h*(m + 2)))/(b^2*d)   Int[(a + b*x)^(m + 1)*(c + d*x)^n, 
x], x] /; FreeQ[{a, b, c, d, e, f, g, h, m, n}, x] && EqQ[m + n + 2, 0] && 
NeQ[m, -1] && (SumSimplerQ[m, 1] ||  !SumSimplerQ[n, 1])
 

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

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

rule 4475
Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_), x_Symbol] :> Simp[a 
^2*g*(Cot[e + f*x]/(f*Sqrt[a + b*Csc[e + f*x]]*Sqrt[a - b*Csc[e + f*x]])) 
 Subst[Int[(g*x)^(p - 1)*(a + b*x)^(m - 1/2)*((c + d*x)^n/Sqrt[a - b*x]), x 
], x, Csc[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, g, m, n, p}, x] && NeQ[ 
b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && (EqQ[p, 1] || In 
tegerQ[m - 1/2])
 
Maple [A] (verified)

Time = 0.43 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.32

method result size
parallelrisch \(\frac {-18 d^{2} \cos \left (f x +e \right ) \left (c -\frac {2 d}{3}\right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )+18 d^{2} \cos \left (f x +e \right ) \left (c -\frac {2 d}{3}\right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )+\sec \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} \left (\left (\frac {3}{2} c^{2} d -6 c \,d^{2}+c^{3}+5 d^{3}\right ) \cos \left (2 f x +2 e \right )+\left (c^{3}+6 c^{2} d -15 c \,d^{2}+14 d^{3}\right ) \cos \left (f x +e \right )+c^{3}+\frac {3 c^{2} d}{2}-6 c \,d^{2}+8 d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{6 f \,a^{2} \cos \left (f x +e \right )}\) \(175\)
derivativedivides \(\frac {-\frac {c^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}+c^{2} d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}-c \,d^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}+\frac {d^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}+c^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+3 c^{2} d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-9 c \,d^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+5 d^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 d^{3}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1}+2 d^{2} \left (3 c -2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )-\frac {2 d^{3}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1}-2 d^{2} \left (3 c -2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{2 f \,a^{2}}\) \(216\)
default \(\frac {-\frac {c^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}+c^{2} d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}-c \,d^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}+\frac {d^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3}+c^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+3 c^{2} d \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-9 c \,d^{2} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+5 d^{3} \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 d^{3}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1}+2 d^{2} \left (3 c -2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )-\frac {2 d^{3}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1}-2 d^{2} \left (3 c -2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{2 f \,a^{2}}\) \(216\)
norman \(\frac {\frac {\left (c^{3}-3 c \,d^{2}+2 d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{7}}{f a}-\frac {\left (c^{3}-3 c^{2} d +3 c \,d^{2}-d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{9}}{6 f a}-\frac {\left (c^{3}+3 c^{2} d -9 c \,d^{2}+9 d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{2 f a}-\frac {\left (2 c^{3}+3 c^{2} d -12 c \,d^{2}+9 d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5}}{f a}+\frac {\left (5 c^{3}+12 c^{2} d -39 c \,d^{2}+34 d^{3}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3}}{3 f a}}{\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )^{3} a}+\frac {d^{2} \left (3 c -2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{a^{2} f}-\frac {d^{2} \left (3 c -2 d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{a^{2} f}\) \(276\)
risch \(\frac {2 i \left (3 c^{3} {\mathrm e}^{4 i \left (f x +e \right )}-9 c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+6 d^{3} {\mathrm e}^{4 i \left (f x +e \right )}+3 c^{3} {\mathrm e}^{3 i \left (f x +e \right )}+9 c^{2} d \,{\mathrm e}^{3 i \left (f x +e \right )}-27 c \,d^{2} {\mathrm e}^{3 i \left (f x +e \right )}+18 d^{3} {\mathrm e}^{3 i \left (f x +e \right )}+5 c^{3} {\mathrm e}^{2 i \left (f x +e \right )}+3 c^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}-21 c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+22 d^{3} {\mathrm e}^{2 i \left (f x +e \right )}+3 c^{3} {\mathrm e}^{i \left (f x +e \right )}+9 c^{2} d \,{\mathrm e}^{i \left (f x +e \right )}-27 c \,d^{2} {\mathrm e}^{i \left (f x +e \right )}+24 d^{3} {\mathrm e}^{i \left (f x +e \right )}+2 c^{3}+3 c^{2} d -12 c \,d^{2}+10 d^{3}\right )}{3 f \,a^{2} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )^{3}}+\frac {3 d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) c}{a^{2} f}-\frac {2 d^{3} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{a^{2} f}-\frac {3 d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) c}{a^{2} f}+\frac {2 d^{3} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{a^{2} f}\) \(375\)

Input:

int(sec(f*x+e)*(c+d*sec(f*x+e))^3/(a+a*sec(f*x+e))^2,x,method=_RETURNVERBO 
SE)
 

Output:

1/6*(-18*d^2*cos(f*x+e)*(c-2/3*d)*ln(tan(1/2*f*x+1/2*e)-1)+18*d^2*cos(f*x+ 
e)*(c-2/3*d)*ln(tan(1/2*f*x+1/2*e)+1)+sec(1/2*f*x+1/2*e)^2*((3/2*c^2*d-6*c 
*d^2+c^3+5*d^3)*cos(2*f*x+2*e)+(c^3+6*c^2*d-15*c*d^2+14*d^3)*cos(f*x+e)+c^ 
3+3/2*c^2*d-6*c*d^2+8*d^3)*tan(1/2*f*x+1/2*e))/f/a^2/cos(f*x+e)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 268 vs. \(2 (130) = 260\).

Time = 0.13 (sec) , antiderivative size = 268, normalized size of antiderivative = 2.02 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx=\frac {3 \, {\left ({\left (3 \, c d^{2} - 2 \, d^{3}\right )} \cos \left (f x + e\right )^{3} + 2 \, {\left (3 \, c d^{2} - 2 \, d^{3}\right )} \cos \left (f x + e\right )^{2} + {\left (3 \, c d^{2} - 2 \, d^{3}\right )} \cos \left (f x + e\right )\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) - 3 \, {\left ({\left (3 \, c d^{2} - 2 \, d^{3}\right )} \cos \left (f x + e\right )^{3} + 2 \, {\left (3 \, c d^{2} - 2 \, d^{3}\right )} \cos \left (f x + e\right )^{2} + {\left (3 \, c d^{2} - 2 \, d^{3}\right )} \cos \left (f x + e\right )\right )} \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \, {\left (3 \, d^{3} + {\left (2 \, c^{3} + 3 \, c^{2} d - 12 \, c d^{2} + 10 \, d^{3}\right )} \cos \left (f x + e\right )^{2} + {\left (c^{3} + 6 \, c^{2} d - 15 \, c d^{2} + 14 \, d^{3}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{6 \, {\left (a^{2} f \cos \left (f x + e\right )^{3} + 2 \, a^{2} f \cos \left (f x + e\right )^{2} + a^{2} f \cos \left (f x + e\right )\right )}} \] Input:

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

Output:

1/6*(3*((3*c*d^2 - 2*d^3)*cos(f*x + e)^3 + 2*(3*c*d^2 - 2*d^3)*cos(f*x + e 
)^2 + (3*c*d^2 - 2*d^3)*cos(f*x + e))*log(sin(f*x + e) + 1) - 3*((3*c*d^2 
- 2*d^3)*cos(f*x + e)^3 + 2*(3*c*d^2 - 2*d^3)*cos(f*x + e)^2 + (3*c*d^2 - 
2*d^3)*cos(f*x + e))*log(-sin(f*x + e) + 1) + 2*(3*d^3 + (2*c^3 + 3*c^2*d 
- 12*c*d^2 + 10*d^3)*cos(f*x + e)^2 + (c^3 + 6*c^2*d - 15*c*d^2 + 14*d^3)* 
cos(f*x + e))*sin(f*x + e))/(a^2*f*cos(f*x + e)^3 + 2*a^2*f*cos(f*x + e)^2 
 + a^2*f*cos(f*x + e))
 

Sympy [F]

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

integrate(sec(f*x+e)*(c+d*sec(f*x+e))**3/(a+a*sec(f*x+e))**2,x)
 

Output:

(Integral(c**3*sec(e + f*x)/(sec(e + f*x)**2 + 2*sec(e + f*x) + 1), x) + I 
ntegral(d**3*sec(e + f*x)**4/(sec(e + f*x)**2 + 2*sec(e + f*x) + 1), x) + 
Integral(3*c*d**2*sec(e + f*x)**3/(sec(e + f*x)**2 + 2*sec(e + f*x) + 1), 
x) + Integral(3*c**2*d*sec(e + f*x)**2/(sec(e + f*x)**2 + 2*sec(e + f*x) + 
 1), x))/a**2
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 342 vs. \(2 (130) = 260\).

Time = 0.04 (sec) , antiderivative size = 342, normalized size of antiderivative = 2.57 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx=\frac {d^{3} {\left (\frac {\frac {15 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {\sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \log \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + 1\right )}{a^{2}} + \frac {12 \, \log \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} - 1\right )}{a^{2}} + \frac {12 \, \sin \left (f x + e\right )}{{\left (a^{2} - \frac {a^{2} \sin \left (f x + e\right )^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}}\right )} - 3 \, c d^{2} {\left (\frac {\frac {9 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {\sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}}{a^{2}} - \frac {6 \, \log \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + 1\right )}{a^{2}} + \frac {6 \, \log \left (\frac {\sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} - 1\right )}{a^{2}}\right )} + \frac {3 \, c^{2} d {\left (\frac {3 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} + \frac {\sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}\right )}}{a^{2}} + \frac {c^{3} {\left (\frac {3 \, \sin \left (f x + e\right )}{\cos \left (f x + e\right ) + 1} - \frac {\sin \left (f x + e\right )^{3}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{3}}\right )}}{a^{2}}}{6 \, f} \] Input:

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

Output:

1/6*(d^3*((15*sin(f*x + e)/(cos(f*x + e) + 1) + sin(f*x + e)^3/(cos(f*x + 
e) + 1)^3)/a^2 - 12*log(sin(f*x + e)/(cos(f*x + e) + 1) + 1)/a^2 + 12*log( 
sin(f*x + e)/(cos(f*x + e) + 1) - 1)/a^2 + 12*sin(f*x + e)/((a^2 - a^2*sin 
(f*x + e)^2/(cos(f*x + e) + 1)^2)*(cos(f*x + e) + 1))) - 3*c*d^2*((9*sin(f 
*x + e)/(cos(f*x + e) + 1) + sin(f*x + e)^3/(cos(f*x + e) + 1)^3)/a^2 - 6* 
log(sin(f*x + e)/(cos(f*x + e) + 1) + 1)/a^2 + 6*log(sin(f*x + e)/(cos(f*x 
 + e) + 1) - 1)/a^2) + 3*c^2*d*(3*sin(f*x + e)/(cos(f*x + e) + 1) + sin(f* 
x + e)^3/(cos(f*x + e) + 1)^3)/a^2 + c^3*(3*sin(f*x + e)/(cos(f*x + e) + 1 
) - sin(f*x + e)^3/(cos(f*x + e) + 1)^3)/a^2)/f
 

Giac [A] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 250, normalized size of antiderivative = 1.88 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx=-\frac {\frac {12 \, d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )} a^{2}} - \frac {6 \, {\left (3 \, c d^{2} - 2 \, d^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{a^{2}} + \frac {6 \, {\left (3 \, c d^{2} - 2 \, d^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{a^{2}} + \frac {a^{4} c^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 3 \, a^{4} c^{2} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 3 \, a^{4} c d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - a^{4} d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 3 \, a^{4} c^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 9 \, a^{4} c^{2} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 27 \, a^{4} c d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 15 \, a^{4} d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{a^{6}}}{6 \, f} \] Input:

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

Output:

-1/6*(12*d^3*tan(1/2*f*x + 1/2*e)/((tan(1/2*f*x + 1/2*e)^2 - 1)*a^2) - 6*( 
3*c*d^2 - 2*d^3)*log(abs(tan(1/2*f*x + 1/2*e) + 1))/a^2 + 6*(3*c*d^2 - 2*d 
^3)*log(abs(tan(1/2*f*x + 1/2*e) - 1))/a^2 + (a^4*c^3*tan(1/2*f*x + 1/2*e) 
^3 - 3*a^4*c^2*d*tan(1/2*f*x + 1/2*e)^3 + 3*a^4*c*d^2*tan(1/2*f*x + 1/2*e) 
^3 - a^4*d^3*tan(1/2*f*x + 1/2*e)^3 - 3*a^4*c^3*tan(1/2*f*x + 1/2*e) - 9*a 
^4*c^2*d*tan(1/2*f*x + 1/2*e) + 27*a^4*c*d^2*tan(1/2*f*x + 1/2*e) - 15*a^4 
*d^3*tan(1/2*f*x + 1/2*e))/a^6)/f
 

Mupad [B] (verification not implemented)

Time = 10.76 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.02 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx=\frac {2\,d^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )\,\left (3\,c-2\,d\right )}{a^2\,f}-\frac {2\,d^3\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}{f\,\left (a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-a^2\right )}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3\,{\left (c-d\right )}^3}{6\,a^2\,f}-\frac {\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\left (\frac {{\left (c-d\right )}^3}{a^2}-\frac {3\,\left (c+d\right )\,{\left (c-d\right )}^2}{2\,a^2}\right )}{f} \] Input:

int((c + d/cos(e + f*x))^3/(cos(e + f*x)*(a + a/cos(e + f*x))^2),x)
 

Output:

(2*d^2*atanh(tan(e/2 + (f*x)/2))*(3*c - 2*d))/(a^2*f) - (2*d^3*tan(e/2 + ( 
f*x)/2))/(f*(a^2*tan(e/2 + (f*x)/2)^2 - a^2)) - (tan(e/2 + (f*x)/2)^3*(c - 
 d)^3)/(6*a^2*f) - (tan(e/2 + (f*x)/2)*((c - d)^3/a^2 - (3*(c + d)*(c - d) 
^2)/(2*a^2)))/f
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 397, normalized size of antiderivative = 2.98 \[ \int \frac {\sec (e+f x) (c+d \sec (e+f x))^3}{(a+a \sec (e+f x))^2} \, dx=\frac {-18 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c \,d^{2}+12 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d^{3}+18 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) c \,d^{2}-12 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) d^{3}+18 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c \,d^{2}-12 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d^{3}-18 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) c \,d^{2}+12 \,\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) d^{3}-\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5} c^{3}+3 \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5} c^{2} d -3 \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5} c \,d^{2}+\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{5} d^{3}+4 \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3} c^{3}+6 \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3} c^{2} d -24 \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3} c \,d^{2}+14 \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{3} d^{3}-3 \tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c^{3}-9 \tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c^{2} d +27 \tan \left (\frac {f x}{2}+\frac {e}{2}\right ) c \,d^{2}-27 \tan \left (\frac {f x}{2}+\frac {e}{2}\right ) d^{3}}{6 a^{2} f \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )} \] Input:

int(sec(f*x+e)*(c+d*sec(f*x+e))^3/(a+a*sec(f*x+e))^2,x)
 

Output:

( - 18*log(tan((e + f*x)/2) - 1)*tan((e + f*x)/2)**2*c*d**2 + 12*log(tan(( 
e + f*x)/2) - 1)*tan((e + f*x)/2)**2*d**3 + 18*log(tan((e + f*x)/2) - 1)*c 
*d**2 - 12*log(tan((e + f*x)/2) - 1)*d**3 + 18*log(tan((e + f*x)/2) + 1)*t 
an((e + f*x)/2)**2*c*d**2 - 12*log(tan((e + f*x)/2) + 1)*tan((e + f*x)/2)* 
*2*d**3 - 18*log(tan((e + f*x)/2) + 1)*c*d**2 + 12*log(tan((e + f*x)/2) + 
1)*d**3 - tan((e + f*x)/2)**5*c**3 + 3*tan((e + f*x)/2)**5*c**2*d - 3*tan( 
(e + f*x)/2)**5*c*d**2 + tan((e + f*x)/2)**5*d**3 + 4*tan((e + f*x)/2)**3* 
c**3 + 6*tan((e + f*x)/2)**3*c**2*d - 24*tan((e + f*x)/2)**3*c*d**2 + 14*t 
an((e + f*x)/2)**3*d**3 - 3*tan((e + f*x)/2)*c**3 - 9*tan((e + f*x)/2)*c** 
2*d + 27*tan((e + f*x)/2)*c*d**2 - 27*tan((e + f*x)/2)*d**3)/(6*a**2*f*(ta 
n((e + f*x)/2)**2 - 1))