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

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 = 17, antiderivative size = 74 \[ \int \frac {a+b \sec ^2(x)}{c+d \cos (x)} \, dx=\frac {2 \left (a c^2+b d^2\right ) \arctan \left (\frac {\sqrt {c-d} \tan \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{c^2 \sqrt {c-d} \sqrt {c+d}}-\frac {b d \text {arctanh}(\sin (x))}{c^2}+\frac {b \tan (x)}{c} \] Output:

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

Mathematica [A] (verified)

Time = 0.55 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.32 \[ \int \frac {a+b \sec ^2(x)}{c+d \cos (x)} \, dx=\frac {-\frac {2 \left (a c^2+b d^2\right ) \text {arctanh}\left (\frac {(c-d) \tan \left (\frac {x}{2}\right )}{\sqrt {-c^2+d^2}}\right )}{\sqrt {-c^2+d^2}}+b d \left (\log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )-\log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )\right )+b c \tan (x)}{c^2} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.60 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.07, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.647, Rules used = {3042, 4722, 3042, 3535, 25, 3042, 3480, 3042, 3138, 218, 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 {a+b \sec ^2(x)}{c+d \cos (x)} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4722

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3535

\(\displaystyle \frac {\int -\frac {(b d-a c \cos (x)) \sec (x)}{c+d \cos (x)}dx}{c}+\frac {b \tan (x)}{c}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {b \tan (x)}{c}-\frac {\int \frac {(b d-a c \cos (x)) \sec (x)}{c+d \cos (x)}dx}{c}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3480

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3138

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

\(\Big \downarrow \) 218

\(\displaystyle \frac {b \tan (x)}{c}-\frac {\frac {b d \int \csc \left (x+\frac {\pi }{2}\right )dx}{c}-\frac {2 \left (a c^2+b d^2\right ) \arctan \left (\frac {\sqrt {c-d} \tan \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{c \sqrt {c-d} \sqrt {c+d}}}{c}\)

\(\Big \downarrow \) 4257

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

Input:

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

Output:

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

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 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 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])))
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4722
Int[(u_)*((A_) + (C_.)*sec[(a_.) + (b_.)*(x_)]^2), x_Symbol] :> Int[Activat 
eTrig[u]*((C + A*Cos[a + b*x]^2)/Cos[a + b*x]^2), x] /; FreeQ[{a, b, A, C}, 
 x] && KnownSineIntegrandQ[u, x]
 
Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 106, normalized size of antiderivative = 1.43

method result size
default \(-\frac {b}{c \left (\tan \left (\frac {x}{2}\right )+1\right )}-\frac {d b \ln \left (\tan \left (\frac {x}{2}\right )+1\right )}{c^{2}}+\frac {2 \left (a \,c^{2}+b \,d^{2}\right ) \arctan \left (\frac {\left (c -d \right ) \tan \left (\frac {x}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{c^{2} \sqrt {\left (c +d \right ) \left (c -d \right )}}-\frac {b}{c \left (\tan \left (\frac {x}{2}\right )-1\right )}+\frac {d b \ln \left (\tan \left (\frac {x}{2}\right )-1\right )}{c^{2}}\) \(106\)
risch \(\frac {2 i b}{c \left ({\mathrm e}^{2 i x}+1\right )}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i c^{2}-i d^{2}+\sqrt {-c^{2}+d^{2}}\, c}{d \sqrt {-c^{2}+d^{2}}}\right ) a}{\sqrt {-c^{2}+d^{2}}}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i c^{2}-i d^{2}+\sqrt {-c^{2}+d^{2}}\, c}{d \sqrt {-c^{2}+d^{2}}}\right ) b \,d^{2}}{\sqrt {-c^{2}+d^{2}}\, c^{2}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {-i c^{2}+i d^{2}+\sqrt {-c^{2}+d^{2}}\, c}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a}{\sqrt {-c^{2}+d^{2}}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {-i c^{2}+i d^{2}+\sqrt {-c^{2}+d^{2}}\, c}{\sqrt {-c^{2}+d^{2}}\, d}\right ) b \,d^{2}}{\sqrt {-c^{2}+d^{2}}\, c^{2}}+\frac {d b \ln \left ({\mathrm e}^{i x}-i\right )}{c^{2}}-\frac {d b \ln \left ({\mathrm e}^{i x}+i\right )}{c^{2}}\) \(307\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 133 vs. \(2 (64) = 128\).

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

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

Output:

[-1/2*((a*c^2 + b*d^2)*sqrt(-c^2 + d^2)*cos(x)*log((2*c*d*cos(x) + (2*c^2 
- d^2)*cos(x)^2 + 2*sqrt(-c^2 + d^2)*(c*cos(x) + d)*sin(x) - c^2 + 2*d^2)/ 
(d^2*cos(x)^2 + 2*c*d*cos(x) + c^2)) + (b*c^2*d - b*d^3)*cos(x)*log(sin(x) 
 + 1) - (b*c^2*d - b*d^3)*cos(x)*log(-sin(x) + 1) - 2*(b*c^3 - b*c*d^2)*si 
n(x))/((c^4 - c^2*d^2)*cos(x)), 1/2*(2*(a*c^2 + b*d^2)*sqrt(c^2 - d^2)*arc 
tan(-(c*cos(x) + d)/(sqrt(c^2 - d^2)*sin(x)))*cos(x) - (b*c^2*d - b*d^3)*c 
os(x)*log(sin(x) + 1) + (b*c^2*d - b*d^3)*cos(x)*log(-sin(x) + 1) + 2*(b*c 
^3 - b*c*d^2)*sin(x))/((c^4 - c^2*d^2)*cos(x))]
 

Sympy [F]

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

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

Output:

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

Maxima [F(-2)]

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

integrate((a+b*sec(x)^2)/(c+d*cos(x)),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*d^2-4*c^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.69 \[ \int \frac {a+b \sec ^2(x)}{c+d \cos (x)} \, dx=-\frac {b d \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) + 1 \right |}\right )}{c^{2}} + \frac {b d \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) - 1 \right |}\right )}{c^{2}} - \frac {2 \, b \tan \left (\frac {1}{2} \, x\right )}{{\left (\tan \left (\frac {1}{2} \, x\right )^{2} - 1\right )} c} - \frac {2 \, {\left (a c^{2} + b d^{2}\right )} {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, c + 2 \, d\right ) + \arctan \left (-\frac {c \tan \left (\frac {1}{2} \, x\right ) - d \tan \left (\frac {1}{2} \, x\right )}{\sqrt {c^{2} - d^{2}}}\right )\right )}}{\sqrt {c^{2} - d^{2}} c^{2}} \] Input:

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

Output:

-b*d*log(abs(tan(1/2*x) + 1))/c^2 + b*d*log(abs(tan(1/2*x) - 1))/c^2 - 2*b 
*tan(1/2*x)/((tan(1/2*x)^2 - 1)*c) - 2*(a*c^2 + b*d^2)*(pi*floor(1/2*x/pi 
+ 1/2)*sgn(-2*c + 2*d) + arctan(-(c*tan(1/2*x) - d*tan(1/2*x))/sqrt(c^2 - 
d^2)))/(sqrt(c^2 - d^2)*c^2)
 

Mupad [B] (verification not implemented)

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

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

Output:

(b*c^3*sin(x))/(c^4*cos(x) - c^2*d^2*cos(x)) - (b*c*d^2*sin(x))/(c^4*cos(x 
) - c^2*d^2*cos(x)) + (2*b*d^3*atanh(sin(x/2)/cos(x/2))*cos(x))/(c^4*cos(x 
) - c^2*d^2*cos(x)) + (a*c^2*atan((a^2*c^7*sin(x/2)*(d^2 - c^2)^(1/2)*1i + 
 b^2*d^5*sin(x/2)*(d^2 - c^2)^(3/2)*2i - b^2*d^7*sin(x/2)*(d^2 - c^2)^(1/2 
)*2i + a^2*c^4*d*sin(x/2)*(d^2 - c^2)^(3/2)*2i + a^2*c^6*d*sin(x/2)*(d^2 - 
 c^2)^(1/2)*1i - a^2*c^4*d^3*sin(x/2)*(d^2 - c^2)^(1/2)*1i - a^2*c^5*d^2*s 
in(x/2)*(d^2 - c^2)^(1/2)*1i + b^2*c^2*d^5*sin(x/2)*(d^2 - c^2)^(1/2)*3i - 
 b^2*c^3*d^4*sin(x/2)*(d^2 - c^2)^(1/2)*1i - b^2*c^4*d^3*sin(x/2)*(d^2 - c 
^2)^(1/2)*1i + b^2*c^5*d^2*sin(x/2)*(d^2 - c^2)^(1/2)*1i + a*b*c^2*d^3*sin 
(x/2)*(d^2 - c^2)^(3/2)*4i - a*b*c^2*d^5*sin(x/2)*(d^2 - c^2)^(1/2)*2i - a 
*b*c^3*d^4*sin(x/2)*(d^2 - c^2)^(1/2)*2i + a*b*c^4*d^3*sin(x/2)*(d^2 - c^2 
)^(1/2)*2i + a*b*c^5*d^2*sin(x/2)*(d^2 - c^2)^(1/2)*2i)/(a^2*c^8*cos(x/2) 
+ a^2*c^4*d^4*cos(x/2) - 2*a^2*c^6*d^2*cos(x/2) + b^2*c^2*d^6*cos(x/2) - 2 
*b^2*c^4*d^4*cos(x/2) + b^2*c^6*d^2*cos(x/2) + 2*a*b*c^2*d^6*cos(x/2) - 4* 
a*b*c^4*d^4*cos(x/2) + 2*a*b*c^6*d^2*cos(x/2)))*cos(x)*(d^2 - c^2)^(1/2)*2 
i)/(c^4*cos(x) - c^2*d^2*cos(x)) + (b*d^2*atan((a^2*c^7*sin(x/2)*(d^2 - c^ 
2)^(1/2)*1i + b^2*d^5*sin(x/2)*(d^2 - c^2)^(3/2)*2i - b^2*d^7*sin(x/2)*(d^ 
2 - c^2)^(1/2)*2i + a^2*c^4*d*sin(x/2)*(d^2 - c^2)^(3/2)*2i + a^2*c^6*d*si 
n(x/2)*(d^2 - c^2)^(1/2)*1i - a^2*c^4*d^3*sin(x/2)*(d^2 - c^2)^(1/2)*1i - 
a^2*c^5*d^2*sin(x/2)*(d^2 - c^2)^(1/2)*1i + b^2*c^2*d^5*sin(x/2)*(d^2 -...
 

Reduce [B] (verification not implemented)

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

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

Output:

(2*sqrt(c**2 - d**2)*atan((tan(x/2)*c - tan(x/2)*d)/sqrt(c**2 - d**2))*cos 
(x)*a*c**2 + 2*sqrt(c**2 - d**2)*atan((tan(x/2)*c - tan(x/2)*d)/sqrt(c**2 
- d**2))*cos(x)*b*d**2 + cos(x)*log(tan(x/2) - 1)*b*c**2*d - cos(x)*log(ta 
n(x/2) - 1)*b*d**3 - cos(x)*log(tan(x/2) + 1)*b*c**2*d + cos(x)*log(tan(x/ 
2) + 1)*b*d**3 + sin(x)*b*c**3 - sin(x)*b*c*d**2)/(cos(x)*c**2*(c**2 - d** 
2))