Integrand size = 17, antiderivative size = 100 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\frac {b c x}{d^2}+\frac {2 a \arctan \left (\frac {d+c \tan \left (\frac {x}{2}\right )}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}-\frac {2 b \sqrt {c^2-d^2} \arctan \left (\frac {d+c \tan \left (\frac {x}{2}\right )}{\sqrt {c^2-d^2}}\right )}{d^2}+\frac {b \cos (x)}{d} \]
b*c*x/d^2+b*cos(x)/d+2*a*arctan((d+c*tan(1/2*x))/(c^2-d^2)^(1/2))/(c^2-d^2 )^(1/2)-2*b*arctan((d+c*tan(1/2*x))/(c^2-d^2)^(1/2))*(c^2-d^2)^(1/2)/d^2
Time = 0.14 (sec) , antiderivative size = 72, normalized size of antiderivative = 0.72 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\frac {\frac {2 \left (a d^2+b \left (-c^2+d^2\right )\right ) \arctan \left (\frac {d+c \tan \left (\frac {x}{2}\right )}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}+b (c x+d \cos (x))}{d^2} \]
((2*(a*d^2 + b*(-c^2 + d^2))*ArcTan[(d + c*Tan[x/2])/Sqrt[c^2 - d^2]])/Sqr t[c^2 - d^2] + b*(c*x + d*Cos[x]))/d^2
Time = 0.42 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3042, 4901, 2009}
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 \cos ^2(x)}{c+d \sin (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {a+b \cos (x)^2}{c+d \sin (x)}dx\) |
\(\Big \downarrow \) 4901 |
\(\displaystyle \int \left (\frac {a}{c+d \sin (x)}+\frac {b \cos ^2(x)}{c+d \sin (x)}\right )dx\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {2 a \arctan \left (\frac {c \tan \left (\frac {x}{2}\right )+d}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}-\frac {2 b \sqrt {c^2-d^2} \arctan \left (\frac {c \tan \left (\frac {x}{2}\right )+d}{\sqrt {c^2-d^2}}\right )}{d^2}+\frac {b c x}{d^2}+\frac {b \cos (x)}{d}\) |
(b*c*x)/d^2 + (2*a*ArcTan[(d + c*Tan[x/2])/Sqrt[c^2 - d^2]])/Sqrt[c^2 - d^ 2] - (2*b*Sqrt[c^2 - d^2]*ArcTan[(d + c*Tan[x/2])/Sqrt[c^2 - d^2]])/d^2 + (b*Cos[x])/d
3.3.11.3.1 Defintions of rubi rules used
Int[u_, x_Symbol] :> With[{v = ExpandTrig[u, x]}, Int[v, x] /; SumQ[v]] /; !InertTrigFreeQ[u]
Time = 0.58 (sec) , antiderivative size = 86, normalized size of antiderivative = 0.86
method | result | size |
default | \(\frac {2 \left (a \,d^{2}-c^{2} b +b \,d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {x}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}+\frac {2 b \left (\frac {d}{1+\tan \left (\frac {x}{2}\right )^{2}}+c \arctan \left (\tan \left (\frac {x}{2}\right )\right )\right )}{d^{2}}\) | \(86\) |
parts | \(\frac {2 a \arctan \left (\frac {2 c \tan \left (\frac {x}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{\sqrt {c^{2}-d^{2}}}+b \left (\frac {\frac {2 d}{1+\tan \left (\frac {x}{2}\right )^{2}}+2 c \arctan \left (\tan \left (\frac {x}{2}\right )\right )}{d^{2}}+\frac {2 \left (-c^{2}+d^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {x}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}\right )\) | \(119\) |
risch | \(\frac {b c x}{d^{2}}+\frac {b \,{\mathrm e}^{i x}}{2 d}+\frac {b \,{\mathrm e}^{-i x}}{2 d}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{d \sqrt {-c^{2}+d^{2}}}\right ) a}{\sqrt {-c^{2}+d^{2}}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{d \sqrt {-c^{2}+d^{2}}}\right ) c^{2} b}{\sqrt {-c^{2}+d^{2}}\, d^{2}}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i \sqrt {-c^{2}+d^{2}}\, c -c^{2}+d^{2}}{d \sqrt {-c^{2}+d^{2}}}\right ) b}{\sqrt {-c^{2}+d^{2}}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{d \sqrt {-c^{2}+d^{2}}}\right ) a}{\sqrt {-c^{2}+d^{2}}}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{d \sqrt {-c^{2}+d^{2}}}\right ) c^{2} b}{\sqrt {-c^{2}+d^{2}}\, d^{2}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {i \sqrt {-c^{2}+d^{2}}\, c +c^{2}-d^{2}}{d \sqrt {-c^{2}+d^{2}}}\right ) b}{\sqrt {-c^{2}+d^{2}}}\) | \(400\) |
2*(a*d^2-b*c^2+b*d^2)/d^2/(c^2-d^2)^(1/2)*arctan(1/2*(2*c*tan(1/2*x)+2*d)/ (c^2-d^2)^(1/2))+2*b/d^2*(d/(1+tan(1/2*x)^2)+c*arctan(tan(1/2*x)))
Time = 0.26 (sec) , antiderivative size = 262, normalized size of antiderivative = 2.62 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\left [\frac {{\left (b c^{2} - {\left (a + b\right )} d^{2}\right )} \sqrt {-c^{2} + d^{2}} \log \left (\frac {{\left (2 \, c^{2} - d^{2}\right )} \cos \left (x\right )^{2} - 2 \, c d \sin \left (x\right ) - c^{2} - d^{2} + 2 \, {\left (c \cos \left (x\right ) \sin \left (x\right ) + d \cos \left (x\right )\right )} \sqrt {-c^{2} + d^{2}}}{d^{2} \cos \left (x\right )^{2} - 2 \, c d \sin \left (x\right ) - c^{2} - d^{2}}\right ) + 2 \, {\left (b c^{3} - b c d^{2}\right )} x + 2 \, {\left (b c^{2} d - b d^{3}\right )} \cos \left (x\right )}{2 \, {\left (c^{2} d^{2} - d^{4}\right )}}, \frac {{\left (b c^{2} - {\left (a + b\right )} d^{2}\right )} \sqrt {c^{2} - d^{2}} \arctan \left (-\frac {c \sin \left (x\right ) + d}{\sqrt {c^{2} - d^{2}} \cos \left (x\right )}\right ) + {\left (b c^{3} - b c d^{2}\right )} x + {\left (b c^{2} d - b d^{3}\right )} \cos \left (x\right )}{c^{2} d^{2} - d^{4}}\right ] \]
[1/2*((b*c^2 - (a + b)*d^2)*sqrt(-c^2 + d^2)*log(((2*c^2 - d^2)*cos(x)^2 - 2*c*d*sin(x) - c^2 - d^2 + 2*(c*cos(x)*sin(x) + d*cos(x))*sqrt(-c^2 + d^2 ))/(d^2*cos(x)^2 - 2*c*d*sin(x) - c^2 - d^2)) + 2*(b*c^3 - b*c*d^2)*x + 2* (b*c^2*d - b*d^3)*cos(x))/(c^2*d^2 - d^4), ((b*c^2 - (a + b)*d^2)*sqrt(c^2 - d^2)*arctan(-(c*sin(x) + d)/(sqrt(c^2 - d^2)*cos(x))) + (b*c^3 - b*c*d^ 2)*x + (b*c^2*d - b*d^3)*cos(x))/(c^2*d^2 - d^4)]
Leaf count of result is larger than twice the leaf count of optimal. 2035 vs. \(2 (85) = 170\).
Time = 110.01 (sec) , antiderivative size = 2035, normalized size of antiderivative = 20.35 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\text {Too large to display} \]
Piecewise((zoo*(a*log(tan(x/2))*tan(x/2)**2/(tan(x/2)**2 + 1) + a*log(tan( x/2))/(tan(x/2)**2 + 1) + b*log(tan(x/2))*tan(x/2)**2/(tan(x/2)**2 + 1) + b*log(tan(x/2))/(tan(x/2)**2 + 1) + 2*b/(tan(x/2)**2 + 1)), Eq(c, 0) & Eq( d, 0)), ((a*log(tan(x/2))*tan(x/2)**2/(tan(x/2)**2 + 1) + a*log(tan(x/2))/ (tan(x/2)**2 + 1) + b*log(tan(x/2))*tan(x/2)**2/(tan(x/2)**2 + 1) + b*log( tan(x/2))/(tan(x/2)**2 + 1) + 2*b/(tan(x/2)**2 + 1))/d, Eq(c, 0)), (2*a*sq rt(d**2)*tan(x/2)**2/(d**2*tan(x/2)**3 + d**2*tan(x/2) - d*sqrt(d**2)*tan( x/2)**2 - d*sqrt(d**2)) + 2*a*sqrt(d**2)/(d**2*tan(x/2)**3 + d**2*tan(x/2) - d*sqrt(d**2)*tan(x/2)**2 - d*sqrt(d**2)) + b*d*x*tan(x/2)**2/(d**2*tan( x/2)**3 + d**2*tan(x/2) - d*sqrt(d**2)*tan(x/2)**2 - d*sqrt(d**2)) + b*d*x /(d**2*tan(x/2)**3 + d**2*tan(x/2) - d*sqrt(d**2)*tan(x/2)**2 - d*sqrt(d** 2)) + 2*b*d*tan(x/2)/(d**2*tan(x/2)**3 + d**2*tan(x/2) - d*sqrt(d**2)*tan( x/2)**2 - d*sqrt(d**2)) - b*x*sqrt(d**2)*tan(x/2)**3/(d**2*tan(x/2)**3 + d **2*tan(x/2) - d*sqrt(d**2)*tan(x/2)**2 - d*sqrt(d**2)) - b*x*sqrt(d**2)*t an(x/2)/(d**2*tan(x/2)**3 + d**2*tan(x/2) - d*sqrt(d**2)*tan(x/2)**2 - d*s qrt(d**2)) - 2*b*sqrt(d**2)/(d**2*tan(x/2)**3 + d**2*tan(x/2) - d*sqrt(d** 2)*tan(x/2)**2 - d*sqrt(d**2)), Eq(c, -sqrt(d**2))), (-2*a*sqrt(d**2)*tan( x/2)**2/(d**2*tan(x/2)**3 + d**2*tan(x/2) + d*sqrt(d**2)*tan(x/2)**2 + d*s qrt(d**2)) - 2*a*sqrt(d**2)/(d**2*tan(x/2)**3 + d**2*tan(x/2) + d*sqrt(d** 2)*tan(x/2)**2 + d*sqrt(d**2)) + b*d*x*tan(x/2)**2/(d**2*tan(x/2)**3 + ...
Exception generated. \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\text {Exception raised: ValueError} \]
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
Time = 0.27 (sec) , antiderivative size = 93, normalized size of antiderivative = 0.93 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\frac {b c x}{d^{2}} - \frac {2 \, {\left (b c^{2} - a d^{2} - b d^{2}\right )} {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (c\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, x\right ) + d}{\sqrt {c^{2} - d^{2}}}\right )\right )}}{\sqrt {c^{2} - d^{2}} d^{2}} + \frac {2 \, b}{{\left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )} d} \]
b*c*x/d^2 - 2*(b*c^2 - a*d^2 - b*d^2)*(pi*floor(1/2*x/pi + 1/2)*sgn(c) + a rctan((c*tan(1/2*x) + d)/sqrt(c^2 - d^2)))/(sqrt(c^2 - d^2)*d^2) + 2*b/((t an(1/2*x)^2 + 1)*d)
Time = 30.62 (sec) , antiderivative size = 1646, normalized size of antiderivative = 16.46 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\text {Too large to display} \]
(2*b)/(d*(tan(x/2)^2 + 1)) - (atan((((-(c + d)*(c - d))^(1/2)*((32*b^2*c^4 )/d - (32*tan(x/2)*(a^2*c*d^5 + b^2*c*d^5 + 2*b^2*c^5*d - 4*b^2*c^3*d^3 + 2*a*b*c*d^5 - 2*a*b*c^3*d^3))/d^3 + ((-(c + d)*(c - d))^(1/2)*(32*a*c^2*d^ 2 + (32*tan(x/2)*(2*a*c*d^6 - 2*b*c^3*d^4 + 2*b*c*d^6))/d^3 + ((-(c + d)*( c - d))^(1/2)*(32*c^2*d^3 + (32*tan(x/2)*(3*c*d^7 - 2*c^3*d^5))/d^3)*(a*d^ 2 - b*c^2 + b*d^2))/(d^4 - c^2*d^2))*(a*d^2 - b*c^2 + b*d^2))/(d^4 - c^2*d ^2))*(a*d^2 - b*c^2 + b*d^2)*1i)/(d^4 - c^2*d^2) - ((-(c + d)*(c - d))^(1/ 2)*((32*tan(x/2)*(a^2*c*d^5 + b^2*c*d^5 + 2*b^2*c^5*d - 4*b^2*c^3*d^3 + 2* a*b*c*d^5 - 2*a*b*c^3*d^3))/d^3 - (32*b^2*c^4)/d + ((-(c + d)*(c - d))^(1/ 2)*(32*a*c^2*d^2 + (32*tan(x/2)*(2*a*c*d^6 - 2*b*c^3*d^4 + 2*b*c*d^6))/d^3 - ((-(c + d)*(c - d))^(1/2)*(32*c^2*d^3 + (32*tan(x/2)*(3*c*d^7 - 2*c^3*d ^5))/d^3)*(a*d^2 - b*c^2 + b*d^2))/(d^4 - c^2*d^2))*(a*d^2 - b*c^2 + b*d^2 ))/(d^4 - c^2*d^2))*(a*d^2 - b*c^2 + b*d^2)*1i)/(d^4 - c^2*d^2))/((64*(b^3 *c^2*d^2 - a*b^2*c^4 - b^3*c^4 + 2*a*b^2*c^2*d^2 + a^2*b*c^2*d^2))/d^2 + ( 64*tan(x/2)*(2*b^3*c^3*d^2 - 2*b^3*c^5 + 2*a*b^2*c^3*d^2))/d^3 + ((-(c + d )*(c - d))^(1/2)*((32*b^2*c^4)/d - (32*tan(x/2)*(a^2*c*d^5 + b^2*c*d^5 + 2 *b^2*c^5*d - 4*b^2*c^3*d^3 + 2*a*b*c*d^5 - 2*a*b*c^3*d^3))/d^3 + ((-(c + d )*(c - d))^(1/2)*(32*a*c^2*d^2 + (32*tan(x/2)*(2*a*c*d^6 - 2*b*c^3*d^4 + 2 *b*c*d^6))/d^3 + ((-(c + d)*(c - d))^(1/2)*(32*c^2*d^3 + (32*tan(x/2)*(3*c *d^7 - 2*c^3*d^5))/d^3)*(a*d^2 - b*c^2 + b*d^2))/(d^4 - c^2*d^2))*(a*d^...