Integrand size = 17, antiderivative size = 105 \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\frac {b c x}{d^2}+\frac {2 a \arctan \left (\frac {\sqrt {c-d} \tan \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{\sqrt {c-d} \sqrt {c+d}}-\frac {2 b \sqrt {c-d} \sqrt {c+d} \arctan \left (\frac {\sqrt {c-d} \tan \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{d^2}-\frac {b \sin (x)}{d} \] Output:
b*c*x/d^2+2*a*arctan((c-d)^(1/2)*tan(1/2*x)/(c+d)^(1/2))/(c-d)^(1/2)/(c+d) ^(1/2)-2*b*(c-d)^(1/2)*(c+d)^(1/2)*arctan((c-d)^(1/2)*tan(1/2*x)/(c+d)^(1/ 2))/d^2-b*sin(x)/d
Time = 0.14 (sec) , antiderivative size = 73, normalized size of antiderivative = 0.70 \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\frac {b c x-\frac {2 \left (a d^2+b \left (-c^2+d^2\right )\right ) \text {arctanh}\left (\frac {(c-d) \tan \left (\frac {x}{2}\right )}{\sqrt {-c^2+d^2}}\right )}{\sqrt {-c^2+d^2}}-b d \sin (x)}{d^2} \] Input:
Integrate[(a + b*Sin[x]^2)/(c + d*Cos[x]),x]
Output:
(b*c*x - (2*(a*d^2 + b*(-c^2 + d^2))*ArcTanh[((c - d)*Tan[x/2])/Sqrt[-c^2 + d^2]])/Sqrt[-c^2 + d^2] - b*d*Sin[x])/d^2
Time = 0.45 (sec) , antiderivative size = 105, 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 \sin ^2(x)}{c+d \cos (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {a+b \sin (x)^2}{c+d \cos (x)}dx\) |
\(\Big \downarrow \) 4901 |
\(\displaystyle \int \left (\frac {a}{c+d \cos (x)}+\frac {b \sin ^2(x)}{c+d \cos (x)}\right )dx\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {2 a \arctan \left (\frac {\sqrt {c-d} \tan \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{\sqrt {c-d} \sqrt {c+d}}-\frac {2 b \sqrt {c-d} \sqrt {c+d} \arctan \left (\frac {\sqrt {c-d} \tan \left (\frac {x}{2}\right )}{\sqrt {c+d}}\right )}{d^2}+\frac {b c x}{d^2}-\frac {b \sin (x)}{d}\) |
Input:
Int[(a + b*Sin[x]^2)/(c + d*Cos[x]),x]
Output:
(b*c*x)/d^2 + (2*a*ArcTan[(Sqrt[c - d]*Tan[x/2])/Sqrt[c + d]])/(Sqrt[c - d ]*Sqrt[c + d]) - (2*b*Sqrt[c - d]*Sqrt[c + d]*ArcTan[(Sqrt[c - d]*Tan[x/2] )/Sqrt[c + d]])/d^2 - (b*Sin[x])/d
Int[u_, x_Symbol] :> With[{v = ExpandTrig[u, x]}, Int[v, x] /; SumQ[v]] /; !InertTrigFreeQ[u]
Time = 0.26 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.84
method | result | size |
default | \(\frac {2 b \left (-\frac {d \tan \left (\frac {x}{2}\right )}{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 {\left (c -d \right ) \tan \left (\frac {x}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{d^{2} \sqrt {\left (c +d \right ) \left (c -d \right )}}\) | \(88\) |
risch | \(\frac {b c x}{d^{2}}+\frac {i b \,{\mathrm e}^{i x}}{2 d}-\frac {i b \,{\mathrm e}^{-i x}}{2 d}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {i c^{2}-i d^{2}+\sqrt {-c^{2}+d^{2}}\, c}{d \sqrt {-c^{2}+d^{2}}}\right ) a}{\sqrt {-c^{2}+d^{2}}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {i c^{2}-i d^{2}+\sqrt {-c^{2}+d^{2}}\, c}{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 c^{2}-i d^{2}+\sqrt {-c^{2}+d^{2}}\, c}{d \sqrt {-c^{2}+d^{2}}}\right ) b}{\sqrt {-c^{2}+d^{2}}}+\frac {\ln \left ({\mathrm e}^{i x}-\frac {i c^{2}-i d^{2}-\sqrt {-c^{2}+d^{2}}\, c}{d \sqrt {-c^{2}+d^{2}}}\right ) a}{\sqrt {-c^{2}+d^{2}}}-\frac {\ln \left ({\mathrm e}^{i x}-\frac {i c^{2}-i d^{2}-\sqrt {-c^{2}+d^{2}}\, c}{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 c^{2}-i d^{2}-\sqrt {-c^{2}+d^{2}}\, c}{d \sqrt {-c^{2}+d^{2}}}\right ) b}{\sqrt {-c^{2}+d^{2}}}\) | \(420\) |
Input:
int((a+b*sin(x)^2)/(c+d*cos(x)),x,method=_RETURNVERBOSE)
Output:
2*b/d^2*(-d*tan(1/2*x)/(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+d)*(c-d))^(1/2)*arctan((c-d)*tan(1/2*x)/((c+d)*(c-d))^(1 /2))
Time = 0.10 (sec) , antiderivative size = 254, normalized size of antiderivative = 2.42 \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\left [\frac {{\left (b c^{2} - {\left (a + b\right )} d^{2}\right )} \sqrt {-c^{2} + d^{2}} \log \left (\frac {2 \, c d \cos \left (x\right ) + {\left (2 \, c^{2} - d^{2}\right )} \cos \left (x\right )^{2} + 2 \, \sqrt {-c^{2} + d^{2}} {\left (c \cos \left (x\right ) + d\right )} \sin \left (x\right ) - c^{2} + 2 \, d^{2}}{d^{2} \cos \left (x\right )^{2} + 2 \, c d \cos \left (x\right ) + c^{2}}\right ) + 2 \, {\left (b c^{3} - b c d^{2}\right )} x - 2 \, {\left (b c^{2} d - b d^{3}\right )} \sin \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 \cos \left (x\right ) + d}{\sqrt {c^{2} - d^{2}} \sin \left (x\right )}\right ) - {\left (b c^{3} - b c d^{2}\right )} x + {\left (b c^{2} d - b d^{3}\right )} \sin \left (x\right )}{c^{2} d^{2} - d^{4}}\right ] \] Input:
integrate((a+b*sin(x)^2)/(c+d*cos(x)),x, algorithm="fricas")
Output:
[1/2*((b*c^2 - (a + b)*d^2)*sqrt(-c^2 + d^2)*log((2*c*d*cos(x) + (2*c^2 - d^2)*cos(x)^2 + 2*sqrt(-c^2 + d^2)*(c*cos(x) + d)*sin(x) - c^2 + 2*d^2)/(d ^2*cos(x)^2 + 2*c*d*cos(x) + c^2)) + 2*(b*c^3 - b*c*d^2)*x - 2*(b*c^2*d - b*d^3)*sin(x))/(c^2*d^2 - d^4), -((b*c^2 - (a + b)*d^2)*sqrt(c^2 - d^2)*ar ctan(-(c*cos(x) + d)/(sqrt(c^2 - d^2)*sin(x))) - (b*c^3 - b*c*d^2)*x + (b* c^2*d - b*d^3)*sin(x))/(c^2*d^2 - d^4)]
Leaf count of result is larger than twice the leaf count of optimal. 2608 vs. \(2 (92) = 184\).
Time = 58.28 (sec) , antiderivative size = 2608, normalized size of antiderivative = 24.84 \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\text {Too large to display} \] Input:
integrate((a+b*sin(x)**2)/(c+d*cos(x)),x)
Output:
Piecewise((zoo*(-a*log(tan(x/2) - 1)*tan(x/2)**2/(tan(x/2)**2 + 1) - a*log (tan(x/2) - 1)/(tan(x/2)**2 + 1) + a*log(tan(x/2) + 1)*tan(x/2)**2/(tan(x/ 2)**2 + 1) + a*log(tan(x/2) + 1)/(tan(x/2)**2 + 1) - b*log(tan(x/2) - 1)*t an(x/2)**2/(tan(x/2)**2 + 1) - b*log(tan(x/2) - 1)/(tan(x/2)**2 + 1) + b*l og(tan(x/2) + 1)*tan(x/2)**2/(tan(x/2)**2 + 1) + b*log(tan(x/2) + 1)/(tan( x/2)**2 + 1) - 2*b*tan(x/2)/(tan(x/2)**2 + 1)), Eq(c, 0) & Eq(d, 0)), (a*t an(x/2)**3/(d*tan(x/2)**2 + d) + a*tan(x/2)/(d*tan(x/2)**2 + d) + b*x*tan( x/2)**2/(d*tan(x/2)**2 + d) + b*x/(d*tan(x/2)**2 + d) - 2*b*tan(x/2)/(d*ta n(x/2)**2 + d), Eq(c, d)), (a*tan(x/2)**2/(d*tan(x/2)**3 + d*tan(x/2)) + a /(d*tan(x/2)**3 + d*tan(x/2)) - b*x*tan(x/2)**3/(d*tan(x/2)**3 + d*tan(x/2 )) - b*x*tan(x/2)/(d*tan(x/2)**3 + d*tan(x/2)) - 2*b*tan(x/2)**2/(d*tan(x/ 2)**3 + d*tan(x/2)), Eq(c, -d)), ((a*x + b*x*sin(x)**2/2 + b*x*cos(x)**2/2 - b*sin(x)*cos(x)/2)/c, Eq(d, 0)), (a*d**2*log(-sqrt(-c/(c - d) - d/(c - d)) + tan(x/2))*tan(x/2)**2/(c*d**2*sqrt(-c/(c - d) - d/(c - d))*tan(x/2)* *2 + c*d**2*sqrt(-c/(c - d) - d/(c - d)) - d**3*sqrt(-c/(c - d) - d/(c - d ))*tan(x/2)**2 - d**3*sqrt(-c/(c - d) - d/(c - d))) + a*d**2*log(-sqrt(-c/ (c - d) - d/(c - d)) + tan(x/2))/(c*d**2*sqrt(-c/(c - d) - d/(c - d))*tan( x/2)**2 + c*d**2*sqrt(-c/(c - d) - d/(c - d)) - d**3*sqrt(-c/(c - d) - d/( c - d))*tan(x/2)**2 - d**3*sqrt(-c/(c - d) - d/(c - d))) - a*d**2*log(sqrt (-c/(c - d) - d/(c - d)) + tan(x/2))*tan(x/2)**2/(c*d**2*sqrt(-c/(c - d...
Exception generated. \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate((a+b*sin(x)^2)/(c+d*cos(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.12 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.05 \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\frac {b c x}{d^{2}} - \frac {2 \, b \tan \left (\frac {1}{2} \, x\right )}{{\left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )} d} + \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 (-2 \, c + 2 \, d\right ) + \arctan \left (-\frac {c \tan \left (\frac {1}{2} \, x\right ) - d \tan \left (\frac {1}{2} \, x\right )}{\sqrt {c^{2} - d^{2}}}\right )\right )}}{\sqrt {c^{2} - d^{2}} d^{2}} \] Input:
integrate((a+b*sin(x)^2)/(c+d*cos(x)),x, algorithm="giac")
Output:
b*c*x/d^2 - 2*b*tan(1/2*x)/((tan(1/2*x)^2 + 1)*d) + 2*(b*c^2 - a*d^2 - b*d ^2)*(pi*floor(1/2*x/pi + 1/2)*sgn(-2*c + 2*d) + arctan(-(c*tan(1/2*x) - d* tan(1/2*x))/sqrt(c^2 - d^2)))/(sqrt(c^2 - d^2)*d^2)
Time = 18.31 (sec) , antiderivative size = 2429, normalized size of antiderivative = 23.13 \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\text {Too large to display} \] Input:
int((a + b*sin(x)^2)/(c + d*cos(x)),x)
Output:
(b*c^2*d*sin(x))/(d^4 - c^2*d^2) - (b*d^3*sin(x))/(d^4 - c^2*d^2) - (2*b*c ^3*atan(sin(x/2)/cos(x/2)))/(d^4 - c^2*d^2) - (a*d^2*atan((a^2*d^7*sin(x/2 )*(d^2 - c^2)^(1/2)*1i - b^2*c^5*sin(x/2)*(d^2 - c^2)^(3/2)*2i - b^2*c^7*s in(x/2)*(d^2 - c^2)^(1/2)*2i + b^2*d^7*sin(x/2)*(d^2 - c^2)^(1/2)*1i - a^2 *c*d^4*sin(x/2)*(d^2 - c^2)^(3/2)*2i + a^2*c*d^6*sin(x/2)*(d^2 - c^2)^(1/2 )*1i - b^2*c*d^4*sin(x/2)*(d^2 - c^2)^(3/2)*2i + b^2*c*d^6*sin(x/2)*(d^2 - c^2)^(1/2)*1i - a^2*c^2*d^5*sin(x/2)*(d^2 - c^2)^(1/2)*1i - a^2*c^3*d^4*s in(x/2)*(d^2 - c^2)^(1/2)*1i - b^2*c^2*d^5*sin(x/2)*(d^2 - c^2)^(1/2)*2i + b^2*c^3*d^2*sin(x/2)*(d^2 - c^2)^(3/2)*4i - b^2*c^3*d^4*sin(x/2)*(d^2 - c ^2)^(1/2)*4i + b^2*c^4*d^3*sin(x/2)*(d^2 - c^2)^(1/2)*1i + b^2*c^5*d^2*sin (x/2)*(d^2 - c^2)^(1/2)*5i + a*b*d^7*sin(x/2)*(d^2 - c^2)^(1/2)*2i - a*b*c *d^4*sin(x/2)*(d^2 - c^2)^(3/2)*4i + a*b*c*d^6*sin(x/2)*(d^2 - c^2)^(1/2)* 2i - a*b*c^2*d^5*sin(x/2)*(d^2 - c^2)^(1/2)*4i + a*b*c^3*d^2*sin(x/2)*(d^2 - c^2)^(3/2)*4i - a*b*c^3*d^4*sin(x/2)*(d^2 - c^2)^(1/2)*4i + a*b*c^4*d^3 *sin(x/2)*(d^2 - c^2)^(1/2)*2i + a*b*c^5*d^2*sin(x/2)*(d^2 - c^2)^(1/2)*2i )/(a^2*d^8*cos(x/2) + b^2*d^8*cos(x/2) + 2*a*b*d^8*cos(x/2) - 2*a^2*c^2*d^ 6*cos(x/2) + a^2*c^4*d^4*cos(x/2) - 3*b^2*c^2*d^6*cos(x/2) + 3*b^2*c^4*d^4 *cos(x/2) - b^2*c^6*d^2*cos(x/2) - 6*a*b*c^2*d^6*cos(x/2) + 6*a*b*c^4*d^4* cos(x/2) - 2*a*b*c^6*d^2*cos(x/2)))*(d^2 - c^2)^(1/2)*2i)/(d^4 - c^2*d^2) + (b*c^2*atan((a^2*d^7*sin(x/2)*(d^2 - c^2)^(1/2)*1i - b^2*c^5*sin(x/2)...
Time = 0.17 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.70 \[ \int \frac {a+b \sin ^2(x)}{c+d \cos (x)} \, dx=\frac {2 \sqrt {c^{2}-d^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) c -\tan \left (\frac {x}{2}\right ) 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 -\tan \left (\frac {x}{2}\right ) 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 -\tan \left (\frac {x}{2}\right ) d}{\sqrt {c^{2}-d^{2}}}\right ) b \,d^{2}-\sin \left (x \right ) b \,c^{2} d +\sin \left (x \right ) b \,d^{3}+b \,c^{3} x -b c \,d^{2} x}{d^{2} \left (c^{2}-d^{2}\right )} \] Input:
int((a+b*sin(x)^2)/(c+d*cos(x)),x)
Output:
(2*sqrt(c**2 - d**2)*atan((tan(x/2)*c - tan(x/2)*d)/sqrt(c**2 - d**2))*a*d **2 - 2*sqrt(c**2 - d**2)*atan((tan(x/2)*c - tan(x/2)*d)/sqrt(c**2 - d**2) )*b*c**2 + 2*sqrt(c**2 - d**2)*atan((tan(x/2)*c - tan(x/2)*d)/sqrt(c**2 - d**2))*b*d**2 - sin(x)*b*c**2*d + sin(x)*b*d**3 + b*c**3*x - b*c*d**2*x)/( d**2*(c**2 - d**2))