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} \] Output:
b*c*x/d^2+2*a*arctan((d+c*tan(1/2*x))/(c^2-d^2)^(1/2))/(c^2-d^2)^(1/2)-2*b *(c^2-d^2)^(1/2)*arctan((d+c*tan(1/2*x))/(c^2-d^2)^(1/2))/d^2+b*cos(x)/d
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} \] Input:
Integrate[(a + b*Cos[x]^2)/(c + d*Sin[x]),x]
Output:
((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.43 (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}\) |
Input:
Int[(a + b*Cos[x]^2)/(c + d*Sin[x]),x]
Output:
(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
Int[u_, x_Symbol] :> With[{v = ExpandTrig[u, x]}, Int[v, x] /; SumQ[v]] /; !InertTrigFreeQ[u]
Time = 0.24 (sec) , antiderivative size = 86, normalized size of antiderivative = 0.86
method | result | size |
default | \(\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}}+\frac {2 \left (a \,d^{2}-b \,c^{2}+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}}}\) | \(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 {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}}}+\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}}\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 ) b \,c^{2}}{\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 ) b \,c^{2}}{\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\) |
Input:
int((a+cos(x)^2*b)/(c+d*sin(x)),x,method=_RETURNVERBOSE)
Output:
2*b/d^2*(d/(1+tan(1/2*x)^2)+c*arctan(tan(1/2*x)))+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))
Time = 0.10 (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 ] \] Input:
integrate((a+b*cos(x)^2)/(c+d*sin(x)),x, algorithm="fricas")
Output:
[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 = 116.15 (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} \] Input:
integrate((a+b*cos(x)**2)/(c+d*sin(x)),x)
Output:
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} \] Input:
integrate((a+b*cos(x)^2)/(c+d*sin(x)),x, algorithm="maxima")
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*d^2-4*c^2>0)', see `assume?` f or more de
Time = 0.11 (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} \] Input:
integrate((a+b*cos(x)^2)/(c+d*sin(x)),x, algorithm="giac")
Output:
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 = 17.70 (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} \] Input:
int((a + b*cos(x)^2)/(c + d*sin(x)),x)
Output:
(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^...
Time = 0.21 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.72 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin (x)} \, dx=\frac {2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) a \,d^{2}-2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) b \,c^{2}+2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) c +d}{\sqrt {c^{2}-d^{2}}}\right ) b \,d^{2}+\cos \left (x \right ) b \,c^{2} d -\cos \left (x \right ) b \,d^{3}+b \,c^{3} x -b \,c^{2} d -b c \,d^{2} x +b \,d^{3}}{d^{2} \left (c^{2}-d^{2}\right )} \] Input:
int((a+b*cos(x)^2)/(c+d*sin(x)),x)
Output:
(2*sqrt(c**2 - d**2)*atan((tan(x/2)*c + d)/sqrt(c**2 - d**2))*a*d**2 - 2*s qrt(c**2 - d**2)*atan((tan(x/2)*c + d)/sqrt(c**2 - d**2))*b*c**2 + 2*sqrt( c**2 - d**2)*atan((tan(x/2)*c + d)/sqrt(c**2 - d**2))*b*d**2 + cos(x)*b*c* *2*d - cos(x)*b*d**3 + b*c**3*x - b*c**2*d - b*c*d**2*x + b*d**3)/(d**2*(c **2 - d**2))