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

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

Optimal result

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

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

Mathematica [A] (verified)

Time = 2.92 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.31 \[ \int \frac {(c+d \sec (e+f x))^2}{a+b \cos (e+f x)} \, dx=\frac {-\frac {2 (a c-b d)^2 \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+d \left (-\left ((2 a c-b 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 )\right )+a d \tan (e+f x)\right )}{a^2 f} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.53 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3042, 3307, 3042, 3431, 2009}

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3307

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3431

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

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

Defintions of rubi rules used

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 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 3431
Int[((g_.)*sin[(e_.) + (f_.)*(x_)])^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x 
_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Int[Exp 
andTrig[(g*sin[e + f*x])^p*(a + b*sin[e + f*x])^m*(c + d*sin[e + f*x])^n, x 
], x] /; FreeQ[{a, b, c, d, e, f, g, n, p}, x] && NeQ[b*c - a*d, 0] && (Int 
egersQ[m, n] || IntegersQ[m, p] || IntegersQ[n, p]) && NeQ[p, 2]
 
Maple [A] (verified)

Time = 0.50 (sec) , antiderivative size = 165, normalized size of antiderivative = 1.60

method result size
derivativedivides \(\frac {\frac {2 \left (a^{2} c^{2}-2 a b c d +b^{2} d^{2}\right ) \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 )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {d^{2}}{a \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}+\frac {d \left (2 a c -b d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{a^{2}}-\frac {d^{2}}{a \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}-\frac {d \left (2 a c -b d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{a^{2}}}{f}\) \(165\)
default \(\frac {\frac {2 \left (a^{2} c^{2}-2 a b c d +b^{2} d^{2}\right ) \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 )}{a^{2} \sqrt {\left (a -b \right ) \left (a +b \right )}}-\frac {d^{2}}{a \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}+\frac {d \left (2 a c -b d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{a^{2}}-\frac {d^{2}}{a \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}-\frac {d \left (2 a c -b d \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{a^{2}}}{f}\) \(165\)
risch \(\frac {2 i d^{2}}{f a \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}-\frac {2 d \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) c}{a f}+\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right ) b}{a^{2} f}-\frac {\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 ) c^{2}}{\sqrt {-a^{2}+b^{2}}\, f}+\frac {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 ) b c d}{\sqrt {-a^{2}+b^{2}}\, f a}-\frac {\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 ) b^{2} d^{2}}{\sqrt {-a^{2}+b^{2}}\, f \,a^{2}}+\frac {\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 ) c^{2}}{\sqrt {-a^{2}+b^{2}}\, f}-\frac {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 ) b c d}{\sqrt {-a^{2}+b^{2}}\, f a}+\frac {\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 ) b^{2} d^{2}}{\sqrt {-a^{2}+b^{2}}\, f \,a^{2}}+\frac {2 d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) c}{a f}-\frac {d^{2} \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right ) b}{a^{2} f}\) \(564\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

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

Time = 2.91 (sec) , antiderivative size = 505, normalized size of antiderivative = 4.90 \[ \int \frac {(c+d \sec (e+f x))^2}{a+b \cos (e+f x)} \, dx=\left [\frac {2 \, {\left (a^{3} - a b^{2}\right )} d^{2} \sin \left (f x + e\right ) - {\left (a^{2} c^{2} - 2 \, a b c d + b^{2} d^{2}\right )} \sqrt {-a^{2} + b^{2}} \cos \left (f x + e\right ) \log \left (\frac {2 \, a b \cos \left (f x + e\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (f x + e\right ) + b\right )} \sin \left (f x + e\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (f x + e\right )^{2} + 2 \, a b \cos \left (f x + e\right ) + a^{2}}\right ) + {\left (2 \, {\left (a^{3} - a b^{2}\right )} c d - {\left (a^{2} b - b^{3}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (2 \, {\left (a^{3} - a b^{2}\right )} c d - {\left (a^{2} b - b^{3}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (a^{4} - a^{2} b^{2}\right )} f \cos \left (f x + e\right )}, \frac {2 \, {\left (a^{3} - a b^{2}\right )} d^{2} \sin \left (f x + e\right ) + 2 \, {\left (a^{2} c^{2} - 2 \, a b c d + b^{2} d^{2}\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (f x + e\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (f x + e\right )}\right ) \cos \left (f x + e\right ) + {\left (2 \, {\left (a^{3} - a b^{2}\right )} c d - {\left (a^{2} b - b^{3}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (2 \, {\left (a^{3} - a b^{2}\right )} c d - {\left (a^{2} b - b^{3}\right )} d^{2}\right )} \cos \left (f x + e\right ) \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (a^{4} - a^{2} b^{2}\right )} f \cos \left (f x + e\right )}\right ] \] Input:

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

Output:

[1/2*(2*(a^3 - a*b^2)*d^2*sin(f*x + e) - (a^2*c^2 - 2*a*b*c*d + b^2*d^2)*s 
qrt(-a^2 + b^2)*cos(f*x + e)*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*d - (a^2*b - b^3)*d^2)*cos(f*x + e)*log(sin(f*x + e) + 1) - (2*(a^3 - a* 
b^2)*c*d - (a^2*b - b^3)*d^2)*cos(f*x + e)*log(-sin(f*x + e) + 1))/((a^4 - 
 a^2*b^2)*f*cos(f*x + e)), 1/2*(2*(a^3 - a*b^2)*d^2*sin(f*x + e) + 2*(a^2* 
c^2 - 2*a*b*c*d + b^2*d^2)*sqrt(a^2 - b^2)*arctan(-(a*cos(f*x + e) + b)/(s 
qrt(a^2 - b^2)*sin(f*x + e)))*cos(f*x + e) + (2*(a^3 - a*b^2)*c*d - (a^2*b 
 - b^3)*d^2)*cos(f*x + e)*log(sin(f*x + e) + 1) - (2*(a^3 - a*b^2)*c*d - ( 
a^2*b - b^3)*d^2)*cos(f*x + e)*log(-sin(f*x + e) + 1))/((a^4 - a^2*b^2)*f* 
cos(f*x + e))]
 

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

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

integrate((c+d*sec(f*x+e))^2/(a+b*cos(f*x+e)),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 [B] (verification not implemented)

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

Time = 0.17 (sec) , antiderivative size = 196, normalized size of antiderivative = 1.90 \[ \int \frac {(c+d \sec (e+f x))^2}{a+b \cos (e+f x)} \, dx=-\frac {\frac {2 \, d^{2} \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} - \frac {{\left (2 \, a c d - b d^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{a^{2}} + \frac {{\left (2 \, a c d - b d^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{a^{2}} + \frac {2 \, {\left (a^{2} c^{2} - 2 \, a b c d + b^{2} d^{2}\right )} {\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 )}}{\sqrt {a^{2} - b^{2}} a^{2}}}{f} \] Input:

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

Output:

-(2*d^2*tan(1/2*f*x + 1/2*e)/((tan(1/2*f*x + 1/2*e)^2 - 1)*a) - (2*a*c*d - 
 b*d^2)*log(abs(tan(1/2*f*x + 1/2*e) + 1))/a^2 + (2*a*c*d - b*d^2)*log(abs 
(tan(1/2*f*x + 1/2*e) - 1))/a^2 + 2*(a^2*c^2 - 2*a*b*c*d + b^2*d^2)*(pi*fl 
oor(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)))/(sqrt(a^2 - b^2)*a^2))/f
 

Mupad [B] (verification not implemented)

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

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

Output:

(atan((((-(a + b)*(a - b))^(1/2)*((32*tan(e/2 + (f*x)/2)*(a^5*c^4 - 2*b^5* 
d^4 - a^4*b*c^4 + 4*a*b^4*d^4 - 3*a^2*b^3*d^4 + a^3*b^2*d^4 + 4*a^5*c^2*d^ 
2 - 16*a^2*b^3*c*d^3 + 12*a^3*b^2*c*d^3 + 4*a^3*b^2*c^3*d - 12*a^4*b*c^2*d 
^2 - 10*a^2*b^3*c^2*d^2 + 18*a^3*b^2*c^2*d^2 + 8*a*b^4*c*d^3 - 4*a^4*b*c*d 
^3 - 4*a^4*b*c^3*d))/a^2 + ((-(a + b)*(a - b))^(1/2)*((32*(a^7*c^2 - 2*a^6 
*b*c^2 - a^6*b*d^2 + a^5*b^2*c^2 - a^4*b^3*d^2 + 2*a^5*b^2*d^2 + 2*a^7*c*d 
 - 4*a^6*b*c*d + 2*a^5*b^2*c*d))/a^3 + (32*tan(e/2 + (f*x)/2)*(-(a + b)*(a 
 - b))^(1/2)*(a*c - b*d)^2*(2*a^6*b + 2*a^4*b^3 - 4*a^5*b^2))/(a^2*(a^4 - 
a^2*b^2)))*(a*c - b*d)^2)/(a^4 - a^2*b^2))*(a*c - b*d)^2*1i)/(a^4 - a^2*b^ 
2) + ((-(a + b)*(a - b))^(1/2)*((32*tan(e/2 + (f*x)/2)*(a^5*c^4 - 2*b^5*d^ 
4 - a^4*b*c^4 + 4*a*b^4*d^4 - 3*a^2*b^3*d^4 + a^3*b^2*d^4 + 4*a^5*c^2*d^2 
- 16*a^2*b^3*c*d^3 + 12*a^3*b^2*c*d^3 + 4*a^3*b^2*c^3*d - 12*a^4*b*c^2*d^2 
 - 10*a^2*b^3*c^2*d^2 + 18*a^3*b^2*c^2*d^2 + 8*a*b^4*c*d^3 - 4*a^4*b*c*d^3 
 - 4*a^4*b*c^3*d))/a^2 - ((-(a + b)*(a - b))^(1/2)*((32*(a^7*c^2 - 2*a^6*b 
*c^2 - a^6*b*d^2 + a^5*b^2*c^2 - a^4*b^3*d^2 + 2*a^5*b^2*d^2 + 2*a^7*c*d - 
 4*a^6*b*c*d + 2*a^5*b^2*c*d))/a^3 - (32*tan(e/2 + (f*x)/2)*(-(a + b)*(a - 
 b))^(1/2)*(a*c - b*d)^2*(2*a^6*b + 2*a^4*b^3 - 4*a^5*b^2))/(a^2*(a^4 - a^ 
2*b^2)))*(a*c - b*d)^2)/(a^4 - a^2*b^2))*(a*c - b*d)^2*1i)/(a^4 - a^2*b^2) 
)/((64*(a*b^4*d^6 - b^5*d^6 - 2*a^5*c^5*d + 4*a^5*c^4*d^2 - a*b^4*c^2*d^4 
- 6*a^2*b^3*c*d^5 - 12*a^4*b*c^3*d^3 + a^4*b*c^4*d^2 - 12*a^2*b^3*c^2*d...
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 445, normalized size of antiderivative = 4.32 \[ \int \frac {(c+d \sec (e+f x))^2}{a+b \cos (e+f x)} \, dx=\frac {2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a -\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) b}{\sqrt {a^{2}-b^{2}}}\right ) \cos \left (f x +e \right ) a^{2} c^{2}-4 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a -\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) b}{\sqrt {a^{2}-b^{2}}}\right ) \cos \left (f x +e \right ) a b c d +2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a -\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) b}{\sqrt {a^{2}-b^{2}}}\right ) \cos \left (f x +e \right ) b^{2} d^{2}-2 \cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) a^{3} c d +\cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) a^{2} b \,d^{2}+2 \cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) a \,b^{2} c d -\cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) b^{3} d^{2}+2 \cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) a^{3} c d -\cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) a^{2} b \,d^{2}-2 \cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) a \,b^{2} c d +\cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) b^{3} d^{2}+\sin \left (f x +e \right ) a^{3} d^{2}-\sin \left (f x +e \right ) a \,b^{2} d^{2}}{\cos \left (f x +e \right ) a^{2} f \left (a^{2}-b^{2}\right )} \] Input:

int((c+d*sec(f*x+e))^2/(a+b*cos(f*x+e)),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**2 - 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*b*c*d + 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)*b**2*d**2 - 2*cos(e + f*x)*log(tan((e + f*x)/2) - 
1)*a**3*c*d + cos(e + f*x)*log(tan((e + f*x)/2) - 1)*a**2*b*d**2 + 2*cos(e 
 + f*x)*log(tan((e + f*x)/2) - 1)*a*b**2*c*d - cos(e + f*x)*log(tan((e + f 
*x)/2) - 1)*b**3*d**2 + 2*cos(e + f*x)*log(tan((e + f*x)/2) + 1)*a**3*c*d 
- cos(e + f*x)*log(tan((e + f*x)/2) + 1)*a**2*b*d**2 - 2*cos(e + f*x)*log( 
tan((e + f*x)/2) + 1)*a*b**2*c*d + cos(e + f*x)*log(tan((e + f*x)/2) + 1)* 
b**3*d**2 + sin(e + f*x)*a**3*d**2 - sin(e + f*x)*a*b**2*d**2)/(cos(e + f* 
x)*a**2*f*(a**2 - b**2))