\(\int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx\) [945]

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

Optimal result

Integrand size = 39, antiderivative size = 16 \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\cos (a+b x) \sin (a+b x)}{b} \]

[Out]

cos(b*x+a)*sin(b*x+a)/b

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {4465, 2715, 8} \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\sin (a+b x) \cos (a+b x)}{b} \]

[In]

Int[(Cos[a + b*x]^2 - Sin[a + b*x]^2)/(Cos[a + b*x]^2 + Sin[a + b*x]^2),x]

[Out]

(Cos[a + b*x]*Sin[a + b*x])/b

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 4465

Int[(u_.)*((a_.) + cos[(d_.) + (e_.)*(x_)]^2*(b_.) + (c_.)*sin[(d_.) + (e_.)*(x_)]^2)^(p_.), x_Symbol] :> Dist
[(a + c)^p, Int[ActivateTrig[u], x], x] /; FreeQ[{a, b, c, d, e, p}, x] && EqQ[b - c, 0]

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(33\) vs. \(2(16)=32\).

Time = 0.01 (sec) , antiderivative size = 33, normalized size of antiderivative = 2.06 \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\cos (2 b x) \sin (2 a)}{2 b}+\frac {\cos (2 a) \sin (2 b x)}{2 b} \]

[In]

Integrate[(Cos[a + b*x]^2 - Sin[a + b*x]^2)/(Cos[a + b*x]^2 + Sin[a + b*x]^2),x]

[Out]

(Cos[2*b*x]*Sin[2*a])/(2*b) + (Cos[2*a]*Sin[2*b*x])/(2*b)

Maple [A] (verified)

Time = 0.62 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.94

method result size
risch \(\frac {\sin \left (2 x b +2 a \right )}{2 b}\) \(15\)
parallelrisch \(\frac {\sin \left (2 x b +2 a \right )}{2 b}\) \(15\)
derivativedivides \(\frac {\cos \left (x b +a \right ) \sin \left (x b +a \right )}{b}\) \(17\)
default \(\frac {\cos \left (x b +a \right ) \sin \left (x b +a \right )}{b}\) \(17\)
norman \(\frac {\frac {2 \tan \left (\frac {a}{2}+\frac {x b}{2}\right )}{b}+\frac {2 \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{3}}{b}-\frac {2 \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{5}}{b}-\frac {2 \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{7}}{b}}{\left (1+\tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{2}\right )^{4}}\) \(80\)

[In]

int((cos(b*x+a)^2-sin(b*x+a)^2)/(cos(b*x+a)^2+sin(b*x+a)^2),x,method=_RETURNVERBOSE)

[Out]

1/2*sin(2*b*x+2*a)/b

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 16, normalized size of antiderivative = 1.00 \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\cos \left (b x + a\right ) \sin \left (b x + a\right )}{b} \]

[In]

integrate((cos(b*x+a)^2-sin(b*x+a)^2)/(cos(b*x+a)^2+sin(b*x+a)^2),x, algorithm="fricas")

[Out]

cos(b*x + a)*sin(b*x + a)/b

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 32 vs. \(2 (14) = 28\).

Time = 0.12 (sec) , antiderivative size = 32, normalized size of antiderivative = 2.00 \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{b \sin ^{2}{\left (a + b x \right )} + b \cos ^{2}{\left (a + b x \right )}} \]

[In]

integrate((cos(b*x+a)**2-sin(b*x+a)**2)/(cos(b*x+a)**2+sin(b*x+a)**2),x)

[Out]

sin(a + b*x)*cos(a + b*x)/(b*sin(a + b*x)**2 + b*cos(a + b*x)**2)

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.38 \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\tan \left (b x + a\right )}{{\left (\tan \left (b x + a\right )^{2} + 1\right )} b} \]

[In]

integrate((cos(b*x+a)^2-sin(b*x+a)^2)/(cos(b*x+a)^2+sin(b*x+a)^2),x, algorithm="maxima")

[Out]

tan(b*x + a)/((tan(b*x + a)^2 + 1)*b)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.88 \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\sin \left (2 \, b x + 2 \, a\right )}{2 \, b} \]

[In]

integrate((cos(b*x+a)^2-sin(b*x+a)^2)/(cos(b*x+a)^2+sin(b*x+a)^2),x, algorithm="giac")

[Out]

1/2*sin(2*b*x + 2*a)/b

Mupad [B] (verification not implemented)

Time = 26.99 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.88 \[ \int \frac {\cos ^2(a+b x)-\sin ^2(a+b x)}{\cos ^2(a+b x)+\sin ^2(a+b x)} \, dx=\frac {\sin \left (2\,a+2\,b\,x\right )}{2\,b} \]

[In]

int((cos(a + b*x)^2 - sin(a + b*x)^2)/(cos(a + b*x)^2 + sin(a + b*x)^2),x)

[Out]

sin(2*a + 2*b*x)/(2*b)