Integrand size = 27, antiderivative size = 19 \[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=-\arctan \left (\frac {2 \cos (x)-\sin (x)}{2+\sin (x)}\right ) \]
[Out]
Time = 2.51 (sec) , antiderivative size = 38, normalized size of antiderivative = 2.00, number of steps used = 43, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.444, Rules used = {4486, 2727, 12, 6874, 1694, 1687, 1108, 648, 632, 210, 642, 1121} \[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=-\arctan \left (\frac {2 \cos (x)-\sin (x)}{\sin (x)+2}\right )+\cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)} \]
[In]
[Out]
Rule 12
Rule 210
Rule 632
Rule 642
Rule 648
Rule 1108
Rule 1121
Rule 1687
Rule 1694
Rule 2727
Rule 4486
Rule 6874
Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {1}{1-\cos (x)}+\frac {2 \left (1+\cos ^2(x)\right )}{(-1+\cos (x)) \left (3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)\right )}\right ) \, dx \\ & = 2 \int \frac {1+\cos ^2(x)}{(-1+\cos (x)) \left (3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)\right )} \, dx+\int \frac {1}{1-\cos (x)} \, dx \\ & = -\frac {\sin (x)}{1-\cos (x)}+2 \int \left (\frac {1}{(-1+\cos (x)) \left (3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)\right )}+\frac {\cos ^2(x)}{(-1+\cos (x)) \left (3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)\right )}\right ) \, dx \\ & = -\frac {\sin (x)}{1-\cos (x)}+2 \int \frac {1}{(-1+\cos (x)) \left (3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)\right )} \, dx+2 \int \frac {\cos ^2(x)}{(-1+\cos (x)) \left (3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)\right )} \, dx \\ & = -\frac {\sin (x)}{1-\cos (x)}+4 \text {Subst}\left (\int \frac {\left (1-x^2\right )^2}{8 x^2 \left (-1-x^2-2 x^3-x^4\right )} \, dx,x,\tan \left (\frac {x}{2}\right )\right )+4 \text {Subst}\left (\int \frac {\left (1+x^2\right )^2}{8 x^2 \left (-1-x^2-2 x^3-x^4\right )} \, dx,x,\tan \left (\frac {x}{2}\right )\right ) \\ & = -\frac {\sin (x)}{1-\cos (x)}+\frac {1}{2} \text {Subst}\left (\int \frac {\left (1-x^2\right )^2}{x^2 \left (-1-x^2-2 x^3-x^4\right )} \, dx,x,\tan \left (\frac {x}{2}\right )\right )+\frac {1}{2} \text {Subst}\left (\int \frac {\left (1+x^2\right )^2}{x^2 \left (-1-x^2-2 x^3-x^4\right )} \, dx,x,\tan \left (\frac {x}{2}\right )\right ) \\ & = -\frac {\sin (x)}{1-\cos (x)}+\frac {1}{2} \text {Subst}\left (\int \left (-\frac {1}{x^2}+\frac {-1+2 x}{1+x^2+2 x^3+x^4}\right ) \, dx,x,\tan \left (\frac {x}{2}\right )\right )+\frac {1}{2} \text {Subst}\left (\int \left (-\frac {1}{x^2}+\frac {3+2 x}{1+x^2+2 x^3+x^4}\right ) \, dx,x,\tan \left (\frac {x}{2}\right )\right ) \\ & = \cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)}+\frac {1}{2} \text {Subst}\left (\int \frac {-1+2 x}{1+x^2+2 x^3+x^4} \, dx,x,\tan \left (\frac {x}{2}\right )\right )+\frac {1}{2} \text {Subst}\left (\int \frac {3+2 x}{1+x^2+2 x^3+x^4} \, dx,x,\tan \left (\frac {x}{2}\right )\right ) \\ & = \cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)}+\frac {1}{2} \text {Subst}\left (\int \frac {32 (-1+x)}{17-8 x^2+16 x^4} \, dx,x,\frac {1}{2}+\tan \left (\frac {x}{2}\right )\right )+\frac {1}{2} \text {Subst}\left (\int \frac {32 (1+x)}{17-8 x^2+16 x^4} \, dx,x,\frac {1}{2}+\tan \left (\frac {x}{2}\right )\right ) \\ & = \cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)}+16 \text {Subst}\left (\int \frac {-1+x}{17-8 x^2+16 x^4} \, dx,x,\frac {1}{2}+\tan \left (\frac {x}{2}\right )\right )+16 \text {Subst}\left (\int \frac {1+x}{17-8 x^2+16 x^4} \, dx,x,\frac {1}{2}+\tan \left (\frac {x}{2}\right )\right ) \\ & = \cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)}+2 \left (16 \text {Subst}\left (\int \frac {x}{17-8 x^2+16 x^4} \, dx,x,\frac {1}{2}+\tan \left (\frac {x}{2}\right )\right )\right ) \\ & = \cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)}+2 \left (8 \text {Subst}\left (\int \frac {1}{17-8 x+16 x^2} \, dx,x,\left (\frac {1}{2}+\tan \left (\frac {x}{2}\right )\right )^2\right )\right ) \\ & = \cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)}-2 \left (16 \text {Subst}\left (\int \frac {1}{-1024-x^2} \, dx,x,-8+32 \left (\frac {1}{2}+\tan \left (\frac {x}{2}\right )\right )^2\right )\right ) \\ & = \arctan \left (\frac {1}{4} \left (-1+\left (1+2 \tan \left (\frac {x}{2}\right )\right )^2\right )\right )+\cot \left (\frac {x}{2}\right )-\frac {\sin (x)}{1-\cos (x)} \\ \end{align*}
Leaf count is larger than twice the leaf count of optimal. \(46\) vs. \(2(19)=38\).
Time = 1.41 (sec) , antiderivative size = 46, normalized size of antiderivative = 2.42 \[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=\frac {1}{2} \arctan \left (\frac {1+\cos (x)}{-1+\cos (x)-\sin (x)}\right )-\frac {1}{2} \arctan \left (\frac {1}{2} \sec ^2\left (\frac {x}{2}\right ) (-1+\cos (x)-\sin (x))\right ) \]
[In]
[Out]
Time = 0.80 (sec) , antiderivative size = 13, normalized size of antiderivative = 0.68
method | result | size |
default | \(\arctan \left (\tan ^{2}\left (\frac {x}{2}\right )+\tan \left (\frac {x}{2}\right )\right )\) | \(13\) |
parallelrisch | \(-\frac {i \left (\ln \left (\tan ^{2}\left (\frac {x}{2}\right )-i+\tan \left (\frac {x}{2}\right )\right )-\ln \left (\tan ^{2}\left (\frac {x}{2}\right )+i+\tan \left (\frac {x}{2}\right )\right )\right )}{2}\) | \(35\) |
risch | \(-\frac {i \ln \left ({\mathrm e}^{2 i x}+\left (\frac {2}{5}+\frac {6 i}{5}\right ) {\mathrm e}^{i x}+\frac {1}{5}-\frac {2 i}{5}\right )}{2}+\frac {i \ln \left ({\mathrm e}^{2 i x}+\left (-2-2 i\right ) {\mathrm e}^{i x}+1-2 i\right )}{2}\) | \(46\) |
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 48 vs. \(2 (19) = 38\).
Time = 0.26 (sec) , antiderivative size = 48, normalized size of antiderivative = 2.53 \[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=\frac {1}{2} \, \arctan \left (-\frac {3 \, \cos \left (x\right )^{2} - 2 \, {\left (3 \, \cos \left (x\right ) + 1\right )} \sin \left (x\right ) - 4 \, \cos \left (x\right ) - 3}{2 \, {\left (2 \, \cos \left (x\right )^{2} + {\left (\cos \left (x\right ) - 3\right )} \sin \left (x\right ) + 4 \, \cos \left (x\right ) - 2\right )}}\right ) \]
[In]
[Out]
\[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=\int \frac {2 \sin {\left (x \right )} + \cos {\left (x \right )} + 1}{- 2 \sin {\left (x \right )} \cos {\left (x \right )} + 2 \sin {\left (x \right )} + \cos ^{2}{\left (x \right )} + 3}\, dx \]
[In]
[Out]
\[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=\int { \frac {\cos \left (x\right ) + 2 \, \sin \left (x\right ) + 1}{\cos \left (x\right )^{2} - 2 \, \cos \left (x\right ) \sin \left (x\right ) + 2 \, \sin \left (x\right ) + 3} \,d x } \]
[In]
[Out]
none
Time = 0.31 (sec) , antiderivative size = 18, normalized size of antiderivative = 0.95 \[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=-\arctan \left (-\tan \left (\frac {1}{2} \, x\right )^{2} - \tan \left (\frac {1}{2} \, x\right )\right ) \]
[In]
[Out]
Time = 0.31 (sec) , antiderivative size = 12, normalized size of antiderivative = 0.63 \[ \int \frac {1+\cos (x)+2 \sin (x)}{3+\cos ^2(x)+2 \sin (x)-2 \cos (x) \sin (x)} \, dx=\mathrm {atan}\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+\mathrm {tan}\left (\frac {x}{2}\right )\right ) \]
[In]
[Out]