\(\int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx\) [14]

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

Optimal result

Integrand size = 25, antiderivative size = 187 \[ \int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx=\frac {2 a^2 \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} \sqrt {a+b} (a c-b d)^2 f}-\frac {2 d \left (2 a c^2-b c d-a d^2\right ) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{(c-d)^{3/2} (c+d)^{3/2} (a c-b d)^2 f}+\frac {d^2 \sin (e+f x)}{(a c-b d) \left (c^2-d^2\right ) f (d+c \cos (e+f x))} \] Output:

2*a^2*arctan((a-b)^(1/2)*tan(1/2*f*x+1/2*e)/(a+b)^(1/2))/(a-b)^(1/2)/(a+b) 
^(1/2)/(a*c-b*d)^2/f-2*d*(2*a*c^2-a*d^2-b*c*d)*arctanh((c-d)^(1/2)*tan(1/2 
*f*x+1/2*e)/(c+d)^(1/2))/(c-d)^(3/2)/(c+d)^(3/2)/(a*c-b*d)^2/f+d^2*sin(f*x 
+e)/(a*c-b*d)/(c^2-d^2)/f/(d+c*cos(f*x+e))
 

Mathematica [A] (verified)

Time = 2.05 (sec) , antiderivative size = 205, normalized size of antiderivative = 1.10 \[ \int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx=\frac {(d+c \cos (e+f x)) \sec ^2(e+f x) \left (-\frac {2 a^2 \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {-a^2+b^2}}\right ) (d+c \cos (e+f x))}{\sqrt {-a^2+b^2}}-\frac {2 d \left (b c d+a \left (-2 c^2+d^2\right )\right ) \text {arctanh}\left (\frac {(-c+d) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right ) (d+c \cos (e+f x))}{\left (c^2-d^2\right )^{3/2}}+\frac {d^2 (a c-b d) \sin (e+f x)}{(c-d) (c+d)}\right )}{(a c-b d)^2 f (c+d \sec (e+f x))^2} \] Input:

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

Output:

((d + c*Cos[e + f*x])*Sec[e + f*x]^2*((-2*a^2*ArcTanh[((a - b)*Tan[(e + f* 
x)/2])/Sqrt[-a^2 + b^2]]*(d + c*Cos[e + f*x]))/Sqrt[-a^2 + b^2] - (2*d*(b* 
c*d + a*(-2*c^2 + d^2))*ArcTanh[((-c + d)*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2 
]]*(d + c*Cos[e + f*x]))/(c^2 - d^2)^(3/2) + (d^2*(a*c - b*d)*Sin[e + f*x] 
)/((c - d)*(c + d))))/((a*c - b*d)^2*f*(c + d*Sec[e + f*x])^2)
 

Rubi [A] (verified)

Time = 0.99 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.18, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.440, Rules used = {3042, 3307, 3042, 3535, 25, 3042, 3480, 3042, 3138, 218, 221}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3307

\(\displaystyle \int \frac {\cos ^2(e+f x)}{(a+b \cos (e+f x)) (c \cos (e+f x)+d)^2}dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3535

\(\displaystyle \frac {\int -\frac {a c d+\left (b c d-a \left (c^2-d^2\right )\right ) \cos (e+f x)}{(a+b \cos (e+f x)) (d+c \cos (e+f x))}dx}{\left (c^2-d^2\right ) (a c-b d)}+\frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac {\int \frac {a c d+\left (b c d-a \left (c^2-d^2\right )\right ) \cos (e+f x)}{(a+b \cos (e+f x)) (d+c \cos (e+f x))}dx}{\left (c^2-d^2\right ) (a c-b d)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac {\int \frac {a c d+\left (b c d-a \left (c^2-d^2\right )\right ) \sin \left (e+f x+\frac {\pi }{2}\right )}{\left (a+b \sin \left (e+f x+\frac {\pi }{2}\right )\right ) \left (d+c \sin \left (e+f x+\frac {\pi }{2}\right )\right )}dx}{\left (c^2-d^2\right ) (a c-b d)}\)

\(\Big \downarrow \) 3480

\(\displaystyle \frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac {-\frac {a^2 \left (c^2-d^2\right ) \int \frac {1}{a+b \cos (e+f x)}dx}{a c-b d}-\frac {d \left (b c d-a \left (2 c^2-d^2\right )\right ) \int \frac {1}{d+c \cos (e+f x)}dx}{a c-b d}}{\left (c^2-d^2\right ) (a c-b d)}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac {-\frac {a^2 \left (c^2-d^2\right ) \int \frac {1}{a+b \sin \left (e+f x+\frac {\pi }{2}\right )}dx}{a c-b d}-\frac {d \left (b c d-a \left (2 c^2-d^2\right )\right ) \int \frac {1}{d+c \sin \left (e+f x+\frac {\pi }{2}\right )}dx}{a c-b d}}{\left (c^2-d^2\right ) (a c-b d)}\)

\(\Big \downarrow \) 3138

\(\displaystyle \frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac {-\frac {2 a^2 \left (c^2-d^2\right ) \int \frac {1}{(a-b) \tan ^2\left (\frac {1}{2} (e+f x)\right )+a+b}d\tan \left (\frac {1}{2} (e+f x)\right )}{f (a c-b d)}-\frac {2 d \left (b c d-a \left (2 c^2-d^2\right )\right ) \int \frac {1}{-\left ((c-d) \tan ^2\left (\frac {1}{2} (e+f x)\right )\right )+c+d}d\tan \left (\frac {1}{2} (e+f x)\right )}{f (a c-b d)}}{\left (c^2-d^2\right ) (a c-b d)}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac {-\frac {2 d \left (b c d-a \left (2 c^2-d^2\right )\right ) \int \frac {1}{-\left ((c-d) \tan ^2\left (\frac {1}{2} (e+f x)\right )\right )+c+d}d\tan \left (\frac {1}{2} (e+f x)\right )}{f (a c-b d)}-\frac {2 a^2 \left (c^2-d^2\right ) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{f \sqrt {a-b} \sqrt {a+b} (a c-b d)}}{\left (c^2-d^2\right ) (a c-b d)}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {d^2 \sin (e+f x)}{f \left (c^2-d^2\right ) (a c-b d) (c \cos (e+f x)+d)}-\frac {-\frac {2 a^2 \left (c^2-d^2\right ) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{f \sqrt {a-b} \sqrt {a+b} (a c-b d)}-\frac {2 d \left (b c d-a \left (2 c^2-d^2\right )\right ) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{f \sqrt {c-d} \sqrt {c+d} (a c-b d)}}{\left (c^2-d^2\right ) (a c-b d)}\)

Input:

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

Output:

-(((-2*a^2*(c^2 - d^2)*ArcTan[(Sqrt[a - b]*Tan[(e + f*x)/2])/Sqrt[a + b]]) 
/(Sqrt[a - b]*Sqrt[a + b]*(a*c - b*d)*f) - (2*d*(b*c*d - a*(2*c^2 - d^2))* 
ArcTanh[(Sqrt[c - d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/(Sqrt[c - d]*Sqrt[c + 
 d]*(a*c - b*d)*f))/((a*c - b*d)*(c^2 - d^2))) + (d^2*Sin[e + f*x])/((a*c 
- b*d)*(c^2 - d^2)*f*(d + c*Cos[e + f*x]))
 

Defintions of rubi rules used

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

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 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

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

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + b + 
(a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] 
 && NeQ[a^2 - b^2, 0]
 

rule 3307
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.)*((a_) + (b_.)*sin[(e_.) + 
(f_.)*(x_)])^(m_.), x_Symbol] :> Int[(a + b*Sin[e + f*x])^m*((d + c*Sin[e + 
 f*x])^n/Sin[e + f*x]^n), x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IntegerQ 
[n]
 

rule 3480
Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(((a_.) + (b_.)*sin[(e_.) + (f_ 
.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])), x_Symbol] :> Simp[(A*b 
- a*B)/(b*c - a*d)   Int[1/(a + b*Sin[e + f*x]), x], x] + Simp[(B*c - A*d)/ 
(b*c - a*d)   Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f 
, A, B}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]
 

rule 3535
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + 
 (f_.)*(x_)])^(n_)*((A_.) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> 
Simp[(-(A*b^2 + a^2*C))*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1)*((c + d*S 
in[e + f*x])^(n + 1)/(f*(m + 1)*(b*c - a*d)*(a^2 - b^2))), x] + Simp[1/((m 
+ 1)*(b*c - a*d)*(a^2 - b^2))   Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin 
[e + f*x])^n*Simp[a*(m + 1)*(b*c - a*d)*(A + C) + d*(A*b^2 + a^2*C)*(m + n 
+ 2) - (c*(A*b^2 + a^2*C) + b*(m + 1)*(b*c - a*d)*(A + C))*Sin[e + f*x] - d 
*(A*b^2 + a^2*C)*(m + n + 3)*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, 
d, e, f, A, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 
- d^2, 0] && LtQ[m, -1] && ((EqQ[a, 0] && IntegerQ[m] &&  !IntegerQ[n]) || 
 !(IntegerQ[2*n] && LtQ[n, -1] && ((IntegerQ[n] &&  !IntegerQ[m]) || EqQ[a, 
 0])))
 
Maple [A] (verified)

Time = 1.65 (sec) , antiderivative size = 210, normalized size of antiderivative = 1.12

method result size
derivativedivides \(\frac {\frac {2 a^{2} \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a c -b d \right )^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 d \left (-\frac {d \left (a c -b d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c^{2}-d^{2}\right ) \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )}-\frac {\left (2 a \,c^{2}-a \,d^{2}-b c d \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c +d \right ) \left (c -d \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (a c -b d \right )^{2}}}{f}\) \(210\)
default \(\frac {\frac {2 a^{2} \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a c -b d \right )^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {2 d \left (-\frac {d \left (a c -b d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c^{2}-d^{2}\right ) \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )}-\frac {\left (2 a \,c^{2}-a \,d^{2}-b c d \right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c +d \right ) \left (c -d \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (a c -b d \right )^{2}}}{f}\) \(210\)
risch \(\frac {2 i d^{2} \left (d \,{\mathrm e}^{i \left (f x +e \right )}+c \right )}{c \left (c^{2}-d^{2}\right ) \left (a c -b d \right ) f \left (c \,{\mathrm e}^{2 i \left (f x +e \right )}+2 d \,{\mathrm e}^{i \left (f x +e \right )}+c \right )}+\frac {2 d \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) a \,c^{2}}{\sqrt {c^{2}-d^{2}}\, \left (a c -b d \right )^{2} \left (c +d \right ) \left (c -d \right ) f}-\frac {d^{3} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) a}{\sqrt {c^{2}-d^{2}}\, \left (a c -b d \right )^{2} \left (c +d \right ) \left (c -d \right ) f}-\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i c^{2}-i d^{2}-d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) b c}{\sqrt {c^{2}-d^{2}}\, \left (a c -b d \right )^{2} \left (c +d \right ) \left (c -d \right ) f}-\frac {2 d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) a \,c^{2}}{\sqrt {c^{2}-d^{2}}\, \left (a c -b d \right )^{2} \left (c +d \right ) \left (c -d \right ) f}+\frac {d^{3} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) a}{\sqrt {c^{2}-d^{2}}\, \left (a c -b d \right )^{2} \left (c +d \right ) \left (c -d \right ) f}+\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+d \sqrt {c^{2}-d^{2}}}{\sqrt {c^{2}-d^{2}}\, c}\right ) b c}{\sqrt {c^{2}-d^{2}}\, \left (a c -b d \right )^{2} \left (c +d \right ) \left (c -d \right ) f}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a c -b d \right )^{2} f}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i a^{2}+i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a c -b d \right )^{2} f}\) \(808\)

Input:

int(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x,method=_RETURNVERBOSE)
 

Output:

1/f*(2*a^2/(a*c-b*d)^2/((a-b)*(a+b))^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e) 
/((a-b)*(a+b))^(1/2))+2*d/(a*c-b*d)^2*(-d*(a*c-b*d)/(c^2-d^2)*tan(1/2*f*x+ 
1/2*e)/(tan(1/2*f*x+1/2*e)^2*c-tan(1/2*f*x+1/2*e)^2*d-c-d)-(2*a*c^2-a*d^2- 
b*c*d)/(c+d)/(c-d)/((c+d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/(( 
c+d)*(c-d))^(1/2))))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 645 vs. \(2 (169) = 338\).

Time = 87.08 (sec) , antiderivative size = 2835, normalized size of antiderivative = 15.16 \[ \int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx=\text {Too large to display} \] Input:

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="fricas")
 

Output:

[-1/2*((a^2*c^4*d - 2*a^2*c^2*d^3 + a^2*d^5 + (a^2*c^5 - 2*a^2*c^3*d^2 + a 
^2*c*d^4)*cos(f*x + e))*sqrt(-a^2 + b^2)*log((2*a*b*cos(f*x + e) + (2*a^2 
- b^2)*cos(f*x + e)^2 + 2*sqrt(-a^2 + b^2)*(a*cos(f*x + e) + b)*sin(f*x + 
e) - a^2 + 2*b^2)/(b^2*cos(f*x + e)^2 + 2*a*b*cos(f*x + e) + a^2)) - (2*(a 
^3 - a*b^2)*c^2*d^2 - (a^2*b - b^3)*c*d^3 - (a^3 - a*b^2)*d^4 + (2*(a^3 - 
a*b^2)*c^3*d - (a^2*b - b^3)*c^2*d^2 - (a^3 - a*b^2)*c*d^3)*cos(f*x + e))* 
sqrt(c^2 - d^2)*log((2*c*d*cos(f*x + e) - (c^2 - 2*d^2)*cos(f*x + e)^2 - 2 
*sqrt(c^2 - d^2)*(d*cos(f*x + e) + c)*sin(f*x + e) + 2*c^2 - d^2)/(c^2*cos 
(f*x + e)^2 + 2*c*d*cos(f*x + e) + d^2)) - 2*((a^3 - a*b^2)*c^3*d^2 - (a^2 
*b - b^3)*c^2*d^3 - (a^3 - a*b^2)*c*d^4 + (a^2*b - b^3)*d^5)*sin(f*x + e)) 
/(((a^4 - a^2*b^2)*c^7 - 2*(a^3*b - a*b^3)*c^6*d - (2*a^4 - 3*a^2*b^2 + b^ 
4)*c^5*d^2 + 4*(a^3*b - a*b^3)*c^4*d^3 + (a^4 - 3*a^2*b^2 + 2*b^4)*c^3*d^4 
 - 2*(a^3*b - a*b^3)*c^2*d^5 + (a^2*b^2 - b^4)*c*d^6)*f*cos(f*x + e) + ((a 
^4 - a^2*b^2)*c^6*d - 2*(a^3*b - a*b^3)*c^5*d^2 - (2*a^4 - 3*a^2*b^2 + b^4 
)*c^4*d^3 + 4*(a^3*b - a*b^3)*c^3*d^4 + (a^4 - 3*a^2*b^2 + 2*b^4)*c^2*d^5 
- 2*(a^3*b - a*b^3)*c*d^6 + (a^2*b^2 - b^4)*d^7)*f), -1/2*(2*(2*(a^3 - a*b 
^2)*c^2*d^2 - (a^2*b - b^3)*c*d^3 - (a^3 - a*b^2)*d^4 + (2*(a^3 - a*b^2)*c 
^3*d - (a^2*b - b^3)*c^2*d^2 - (a^3 - a*b^2)*c*d^3)*cos(f*x + e))*sqrt(-c^ 
2 + d^2)*arctan(-sqrt(-c^2 + d^2)*(d*cos(f*x + e) + c)/((c^2 - d^2)*sin(f* 
x + e))) + (a^2*c^4*d - 2*a^2*c^2*d^3 + a^2*d^5 + (a^2*c^5 - 2*a^2*c^3*...
 

Sympy [F]

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

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))**2,x)
 

Output:

Integral(1/((a + b*cos(e + f*x))*(c + d*sec(e + f*x))**2), x)
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx=\text {Exception raised: ValueError} \] Input:

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="maxima")
 

Output:

Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 333, normalized size of antiderivative = 1.78 \[ \int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx=\frac {2 \, {\left (\frac {{\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} a^{2}}{{\left (a^{2} c^{2} - 2 \, a b c d + b^{2} d^{2}\right )} \sqrt {a^{2} - b^{2}}} - \frac {d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{{\left (a c^{3} - b c^{2} d - a c d^{2} + b d^{3}\right )} {\left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - c - d\right )}} - \frac {{\left (2 \, a c^{2} d - b c d^{2} - a d^{3}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, c + 2 \, d\right ) + \arctan \left (-\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-c^{2} + d^{2}}}\right )\right )}}{{\left (a^{2} c^{4} - 2 \, a b c^{3} d - a^{2} c^{2} d^{2} + b^{2} c^{2} d^{2} + 2 \, a b c d^{3} - b^{2} d^{4}\right )} \sqrt {-c^{2} + d^{2}}}\right )}}{f} \] Input:

integrate(1/(a+b*cos(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="giac")
 

Output:

2*((pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(2*a - 2*b) + arctan((a*tan(1/2*f* 
x + 1/2*e) - b*tan(1/2*f*x + 1/2*e))/sqrt(a^2 - b^2)))*a^2/((a^2*c^2 - 2*a 
*b*c*d + b^2*d^2)*sqrt(a^2 - b^2)) - d^2*tan(1/2*f*x + 1/2*e)/((a*c^3 - b* 
c^2*d - a*c*d^2 + b*d^3)*(c*tan(1/2*f*x + 1/2*e)^2 - d*tan(1/2*f*x + 1/2*e 
)^2 - c - d)) - (2*a*c^2*d - b*c*d^2 - a*d^3)*(pi*floor(1/2*(f*x + e)/pi + 
 1/2)*sgn(-2*c + 2*d) + arctan(-(c*tan(1/2*f*x + 1/2*e) - d*tan(1/2*f*x + 
1/2*e))/sqrt(-c^2 + d^2)))/((a^2*c^4 - 2*a*b*c^3*d - a^2*c^2*d^2 + b^2*c^2 
*d^2 + 2*a*b*c*d^3 - b^2*d^4)*sqrt(-c^2 + d^2)))/f
 

Mupad [B] (verification not implemented)

Time = 9.11 (sec) , antiderivative size = 20827, normalized size of antiderivative = 111.37 \[ \int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx=\text {Too large to display} \] Input:

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

Output:

(a^2*atan(((a^2*(b^2 - a^2)^(1/2)*((32*tan(e/2 + (f*x)/2)*(a^5*c^6 + 2*a^5 
*d^6 - a^4*b*c^6 - 4*a^4*b*d^6 - 2*a^5*c*d^5 - 2*a^5*c^5*d - a^2*b^3*d^6 + 
 3*a^3*b^2*d^6 - 5*a^5*c^2*d^4 + 4*a^5*c^3*d^3 + 3*a^5*c^4*d^2 - b^5*c^2*d 
^4 + 3*a*b^4*c^2*d^4 + 4*a*b^4*c^3*d^3 + 6*a^2*b^3*c*d^5 - 6*a^3*b^2*c*d^5 
 + 13*a^4*b*c^2*d^4 - 8*a^4*b*c^3*d^3 - 11*a^4*b*c^4*d^2 + a^2*b^3*c^2*d^4 
 - 12*a^2*b^3*c^3*d^3 - 4*a^2*b^3*c^4*d^2 - 11*a^3*b^2*c^2*d^4 + 12*a^3*b^ 
2*c^3*d^3 + 12*a^3*b^2*c^4*d^2 - 2*a*b^4*c*d^5 + 4*a^4*b*c*d^5 + 2*a^4*b*c 
^5*d))/(a^2*c^5 - b^2*d^5 + a^2*c^4*d - b^2*c*d^4 - a^2*c^2*d^3 - a^2*c^3* 
d^2 + b^2*c^2*d^3 + b^2*c^3*d^2 + 2*a*b*c*d^4 - 2*a*b*c^4*d + 2*a*b*c^2*d^ 
3 - 2*a*b*c^3*d^2) + (a^2*(b^2 - a^2)^(1/2)*((32*(2*a^6*b*c^9 - a^7*c^9 + 
a*b^6*d^9 + 2*a^7*c^8*d + b^7*c*d^8 - a^5*b^2*c^9 - 2*a^2*b^5*d^9 + a^3*b^ 
4*d^9 + a^7*c^4*d^5 - 3*a^7*c^6*d^3 + a^7*c^7*d^2 - b^7*c^2*d^7 - b^7*c^3* 
d^6 + b^7*c^4*d^5 - 5*a*b^6*c^2*d^7 + 7*a*b^6*c^3*d^6 + 4*a*b^6*c^4*d^5 - 
5*a*b^6*c^5*d^4 - 3*a^2*b^5*c*d^8 + 8*a^3*b^4*c*d^8 - 4*a^4*b^3*c*d^8 + 5* 
a^4*b^3*c^8*d - 8*a^5*b^2*c^8*d - 4*a^6*b*c^3*d^6 - 2*a^6*b*c^4*d^5 + 13*a 
^6*b*c^5*d^4 + a^6*b*c^6*d^3 - 11*a^6*b*c^7*d^2 + 13*a^2*b^5*c^2*d^7 + 7*a 
^2*b^5*c^3*d^6 - 21*a^2*b^5*c^4*d^5 - 4*a^2*b^5*c^5*d^4 + 10*a^2*b^5*c^6*d 
^3 - a^3*b^4*c^2*d^7 - 31*a^3*b^4*c^3*d^6 + 4*a^3*b^4*c^4*d^5 + 33*a^3*b^4 
*c^5*d^4 - 4*a^3*b^4*c^6*d^3 - 10*a^3*b^4*c^7*d^2 - 12*a^4*b^3*c^2*d^7 + 1 
4*a^4*b^3*c^3*d^6 + 34*a^4*b^3*c^4*d^5 - 21*a^4*b^3*c^5*d^4 - 27*a^4*b^...
 

Reduce [B] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 1678, normalized size of antiderivative = 8.97 \[ \int \frac {1}{(a+b \cos (e+f x)) (c+d \sec (e+f x))^2} \, dx =\text {Too large to display} \] Input:

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

Output:

(2*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt(a 
**2 - b**2))*cos(e + f*x)*a**2*c**5 - 4*sqrt(a**2 - b**2)*atan((tan((e + f 
*x)/2)*a - tan((e + f*x)/2)*b)/sqrt(a**2 - b**2))*cos(e + f*x)*a**2*c**3*d 
**2 + 2*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/s 
qrt(a**2 - b**2))*cos(e + f*x)*a**2*c*d**4 + 2*sqrt(a**2 - b**2)*atan((tan 
((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt(a**2 - b**2))*a**2*c**4*d - 4*s 
qrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt(a**2 
- b**2))*a**2*c**2*d**3 + 2*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a - t 
an((e + f*x)/2)*b)/sqrt(a**2 - b**2))*a**2*d**5 - 4*sqrt( - c**2 + d**2)*a 
tan((tan((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*cos(e 
+ f*x)*a**3*c**3*d + 2*sqrt( - c**2 + d**2)*atan((tan((e + f*x)/2)*c - tan 
((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*cos(e + f*x)*a**3*c*d**3 + 2*sqrt( 
- c**2 + d**2)*atan((tan((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 
 + d**2))*cos(e + f*x)*a**2*b*c**2*d**2 + 4*sqrt( - c**2 + d**2)*atan((tan 
((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*cos(e + f*x)*a 
*b**2*c**3*d - 2*sqrt( - c**2 + d**2)*atan((tan((e + f*x)/2)*c - tan((e + 
f*x)/2)*d)/sqrt( - c**2 + d**2))*cos(e + f*x)*a*b**2*c*d**3 - 2*sqrt( - c* 
*2 + d**2)*atan((tan((e + f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 + d 
**2))*cos(e + f*x)*b**3*c**2*d**2 - 4*sqrt( - c**2 + d**2)*atan((tan((e + 
f*x)/2)*c - tan((e + f*x)/2)*d)/sqrt( - c**2 + d**2))*a**3*c**2*d**2 + ...