\(\int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx\) [205]

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

Optimal result

Integrand size = 22, antiderivative size = 14 \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\frac {c x}{d^2}-\frac {\sin (x)}{d} \]

[Out]

c*x/d^2-sin(x)/d

Rubi [A] (verified)

Time = 0.15 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.136, Rules used = {4482, 3095, 2717} \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\frac {c x}{d^2}-\frac {\sin (x)}{d} \]

[In]

Int[(-1 + c^2/d^2 + Sin[x]^2)/(c + d*Cos[x]),x]

[Out]

(c*x)/d^2 - Sin[x]/d

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3095

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[
C/b^2, Int[(a + b*Sin[e + f*x])^(m + 1)*Simp[-a + b*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, C, m}, x
] && EqQ[A*b^2 + a^2*C, 0]

Rule 4482

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\frac {c^2}{d^2}-\cos ^2(x)}{c+d \cos (x)} \, dx \\ & = -\frac {\int (-c+d \cos (x)) \, dx}{d^2} \\ & = \frac {c x}{d^2}-\frac {\int \cos (x) \, dx}{d} \\ & = \frac {c x}{d^2}-\frac {\sin (x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00 \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\frac {c x}{d^2}-\frac {\sin (x)}{d} \]

[In]

Integrate[(-1 + c^2/d^2 + Sin[x]^2)/(c + d*Cos[x]),x]

[Out]

(c*x)/d^2 - Sin[x]/d

Maple [A] (verified)

Time = 0.39 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.00

method result size
parallelrisch \(\frac {-d \sin \left (x \right )+c x}{d^{2}}\) \(14\)
risch \(\frac {c x}{d^{2}}-\frac {\sin \left (x \right )}{d}\) \(15\)
default \(\frac {-\frac {2 d \tan \left (\frac {x}{2}\right )}{1+\tan \left (\frac {x}{2}\right )^{2}}+2 c \arctan \left (\tan \left (\frac {x}{2}\right )\right )}{d^{2}}\) \(31\)
norman \(\frac {\frac {c x}{d}+\frac {c x \tan \left (\frac {x}{2}\right )^{4}}{d}-2 \tan \left (\frac {x}{2}\right )^{3}+\frac {2 c x \tan \left (\frac {x}{2}\right )^{2}}{d}-2 \tan \left (\frac {x}{2}\right )}{d \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )^{2}}\) \(61\)

[In]

int((-1+c^2/d^2+sin(x)^2)/(c+d*cos(x)),x,method=_RETURNVERBOSE)

[Out]

(-d*sin(x)+c*x)/d^2

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.93 \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\frac {c x - d \sin \left (x\right )}{d^{2}} \]

[In]

integrate((-1+c^2/d^2+sin(x)^2)/(c+d*cos(x)),x, algorithm="fricas")

[Out]

(c*x - d*sin(x))/d^2

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 61 vs. \(2 (10) = 20\).

Time = 28.27 (sec) , antiderivative size = 61, normalized size of antiderivative = 4.36 \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\frac {c x \tan ^{2}{\left (\frac {x}{2} \right )}}{d^{2} \tan ^{2}{\left (\frac {x}{2} \right )} + d^{2}} + \frac {c x}{d^{2} \tan ^{2}{\left (\frac {x}{2} \right )} + d^{2}} - \frac {2 d \tan {\left (\frac {x}{2} \right )}}{d^{2} \tan ^{2}{\left (\frac {x}{2} \right )} + d^{2}} \]

[In]

integrate((-1+c**2/d**2+sin(x)**2)/(c+d*cos(x)),x)

[Out]

c*x*tan(x/2)**2/(d**2*tan(x/2)**2 + d**2) + c*x/(d**2*tan(x/2)**2 + d**2) - 2*d*tan(x/2)/(d**2*tan(x/2)**2 + d
**2)

Maxima [F(-2)]

Exception generated. \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((-1+c^2/d^2+sin(x)^2)/(c+d*cos(x)),x, algorithm="maxima")

[Out]

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

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.86 \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\frac {c x}{d^{2}} - \frac {2 \, \tan \left (\frac {1}{2} \, x\right )}{{\left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )} d} \]

[In]

integrate((-1+c^2/d^2+sin(x)^2)/(c+d*cos(x)),x, algorithm="giac")

[Out]

c*x/d^2 - 2*tan(1/2*x)/((tan(1/2*x)^2 + 1)*d)

Mupad [B] (verification not implemented)

Time = 27.95 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.93 \[ \int \frac {-1+\frac {c^2}{d^2}+\sin ^2(x)}{c+d \cos (x)} \, dx=\frac {c\,x-d\,\sin \left (x\right )}{d^2} \]

[In]

int((sin(x)^2 + c^2/d^2 - 1)/(c + d*cos(x)),x)

[Out]

(c*x - d*sin(x))/d^2