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

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

Optimal result

Integrand size = 32, antiderivative size = 89 \[ \int \frac {B \cos (c+d x)+C \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {(b B-a C) x}{b^2}-\frac {2 a (b B-a C) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{\sqrt {a-b} b^2 \sqrt {a+b} d}+\frac {C \sin (c+d x)}{b d} \] Output:

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

Mathematica [A] (verified)

Time = 0.74 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.96 \[ \int \frac {B \cos (c+d x)+C \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {(b B-a C) (c+d x)-\frac {2 a (-b B+a C) \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+b C \sin (c+d x)}{b^2 d} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.41 (sec) , antiderivative size = 86, normalized size of antiderivative = 0.97, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3042, 3502, 27, 3042, 3214, 3042, 3138, 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 {B \cos (c+d x)+C \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3502

\(\displaystyle \frac {\int \frac {(b B-a C) \cos (c+d x)}{a+b \cos (c+d x)}dx}{b}+\frac {C \sin (c+d x)}{b d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {(b B-a C) \int \frac {\cos (c+d x)}{a+b \cos (c+d x)}dx}{b}+\frac {C \sin (c+d x)}{b d}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3214

\(\displaystyle \frac {(b B-a C) \left (\frac {x}{b}-\frac {a \int \frac {1}{a+b \cos (c+d x)}dx}{b}\right )}{b}+\frac {C \sin (c+d x)}{b d}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3138

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

\(\Big \downarrow \) 218

\(\displaystyle \frac {(b B-a C) \left (\frac {x}{b}-\frac {2 a \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b d \sqrt {a-b} \sqrt {a+b}}\right )}{b}+\frac {C \sin (c+d x)}{b d}\)

Input:

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

Output:

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

Defintions of rubi rules used

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 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 3214
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d   Int[1/(c + d 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3502
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co 
s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m 
+ 2))   Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m 
 + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] 
 &&  !LtQ[m, -1]
 
Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.24

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

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+b*cos(d*x+c)),x, algorithm="fri 
cas")
 

Output:

[-1/2*(2*(C*a^3 - B*a^2*b - C*a*b^2 + B*b^3)*d*x - (C*a^2 - B*a*b)*sqrt(-a 
^2 + b^2)*log((2*a*b*cos(d*x + c) + (2*a^2 - b^2)*cos(d*x + c)^2 - 2*sqrt( 
-a^2 + b^2)*(a*cos(d*x + c) + b)*sin(d*x + c) - a^2 + 2*b^2)/(b^2*cos(d*x 
+ c)^2 + 2*a*b*cos(d*x + c) + a^2)) - 2*(C*a^2*b - C*b^3)*sin(d*x + c))/(( 
a^2*b^2 - b^4)*d), -((C*a^3 - B*a^2*b - C*a*b^2 + B*b^3)*d*x - (C*a^2 - B* 
a*b)*sqrt(a^2 - b^2)*arctan(-(a*cos(d*x + c) + b)/(sqrt(a^2 - b^2)*sin(d*x 
 + c))) - (C*a^2*b - C*b^3)*sin(d*x + c))/((a^2*b^2 - b^4)*d)]
 

Sympy [F(-1)]

Timed out. \[ \int \frac {B \cos (c+d x)+C \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\text {Timed out} \] Input:

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

Output:

Timed out
 

Maxima [F(-2)]

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

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+b*cos(d*x+c)),x, algorithm="max 
ima")
 

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.13 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.60 \[ \int \frac {B \cos (c+d x)+C \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=-\frac {\frac {{\left (C a - B b\right )} {\left (d x + c\right )}}{b^{2}} - \frac {2 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} b} + \frac {2 \, {\left (C a^{2} - B a b\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {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 )}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2}} b^{2}}}{d} \] Input:

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+b*cos(d*x+c)),x, algorithm="gia 
c")
 

Output:

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

Mupad [B] (verification not implemented)

Time = 1.10 (sec) , antiderivative size = 541, normalized size of antiderivative = 6.08 \[ \int \frac {B \cos (c+d x)+C \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {2\,C\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^2-b^2\right )}-\frac {2\,B\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d\,\left (a^2-b^2\right )}-\frac {C\,b\,\sin \left (c+d\,x\right )}{d\,\left (a^2-b^2\right )}+\frac {2\,B\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d\,\left (a^2-b^2\right )}-\frac {2\,C\,a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b^2\,d\,\left (a^2-b^2\right )}+\frac {B\,a\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d\,\sqrt {b^2-a^2}}-\frac {B\,a\,\ln \left (\frac {b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b\,d\,\sqrt {b^2-a^2}}-\frac {C\,a^2\,\ln \left (\frac {a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b^2\,d\,\sqrt {b^2-a^2}}+\frac {C\,a^2\,\ln \left (\frac {b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )-a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )+\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{b^2\,d\,\sqrt {b^2-a^2}}+\frac {C\,a^2\,\sin \left (c+d\,x\right )}{b\,d\,\left (a^2-b^2\right )} \] Input:

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

Output:

(2*C*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^2 - b^2)) - (2*B 
*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(d*(a^2 - b^2)) - (C*b*sin 
(c + d*x))/(d*(a^2 - b^2)) + (2*B*a^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d 
*x)/2)))/(b*d*(a^2 - b^2)) - (2*C*a^3*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d 
*x)/2)))/(b^2*d*(a^2 - b^2)) + (B*a*log((a*sin(c/2 + (d*x)/2) - b*sin(c/2 
+ (d*x)/2) + cos(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/cos(c/2 + (d*x)/2)))/(b 
*d*(b^2 - a^2)^(1/2)) - (B*a*log((b*sin(c/2 + (d*x)/2) - a*sin(c/2 + (d*x) 
/2) + cos(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/cos(c/2 + (d*x)/2)))/(b*d*(b^2 
 - a^2)^(1/2)) - (C*a^2*log((a*sin(c/2 + (d*x)/2) - b*sin(c/2 + (d*x)/2) + 
 cos(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/cos(c/2 + (d*x)/2)))/(b^2*d*(b^2 - 
a^2)^(1/2)) + (C*a^2*log((b*sin(c/2 + (d*x)/2) - a*sin(c/2 + (d*x)/2) + co 
s(c/2 + (d*x)/2)*(b^2 - a^2)^(1/2))/cos(c/2 + (d*x)/2)))/(b^2*d*(b^2 - a^2 
)^(1/2)) + (C*a^2*sin(c + d*x))/(b*d*(a^2 - b^2))
                                                                                    
                                                                                    
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 183, normalized size of antiderivative = 2.06 \[ \int \frac {B \cos (c+d x)+C \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx=\frac {2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b}{\sqrt {a^{2}-b^{2}}}\right ) a^{2} c -2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b}{\sqrt {a^{2}-b^{2}}}\right ) a \,b^{2}+\sin \left (d x +c \right ) a^{2} b c -\sin \left (d x +c \right ) b^{3} c -a^{3} c d x +a^{2} b^{2} d x +a \,b^{2} c d x -b^{4} d x}{b^{2} d \left (a^{2}-b^{2}\right )} \] Input:

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

Output:

(2*sqrt(a**2 - b**2)*atan((tan((c + d*x)/2)*a - tan((c + d*x)/2)*b)/sqrt(a 
**2 - b**2))*a**2*c - 2*sqrt(a**2 - b**2)*atan((tan((c + d*x)/2)*a - tan(( 
c + d*x)/2)*b)/sqrt(a**2 - b**2))*a*b**2 + sin(c + d*x)*a**2*b*c - sin(c + 
 d*x)*b**3*c - a**3*c*d*x + a**2*b**2*d*x + a*b**2*c*d*x - b**4*d*x)/(b**2 
*d*(a**2 - b**2))