Integrand size = 19, antiderivative size = 49 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx=-\frac {b x}{d}+\frac {(a d+b (c+d)) \arctan \left (\frac {\sqrt {c+d} \tan (x)}{\sqrt {c}}\right )}{\sqrt {c} d \sqrt {c+d}} \] Output:
-b*x/d+(a*d+b*(c+d))*arctan((c+d)^(1/2)*tan(x)/c^(1/2))/c^(1/2)/d/(c+d)^(1 /2)
Time = 0.54 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.96 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx=\frac {-b x+\frac {(a d+b (c+d)) \arctan \left (\frac {\sqrt {c+d} \tan (x)}{\sqrt {c}}\right )}{\sqrt {c} \sqrt {c+d}}}{d} \] Input:
Integrate[(a + b*Cos[x]^2)/(c + d*Sin[x]^2),x]
Output:
(-(b*x) + ((a*d + b*(c + d))*ArcTan[(Sqrt[c + d]*Tan[x])/Sqrt[c]])/(Sqrt[c ]*Sqrt[c + d]))/d
Time = 0.31 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.04, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {3042, 4889, 397, 216, 218}
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 ^2(x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {a+b \cos (x)^2}{c+d \sin (x)^2}dx\) |
\(\Big \downarrow \) 4889 |
\(\displaystyle \int \frac {a \tan ^2(x)+a+b}{\left (\tan ^2(x)+1\right ) \left ((c+d) \tan ^2(x)+c\right )}d\tan (x)\) |
\(\Big \downarrow \) 397 |
\(\displaystyle \frac {(a d+b (c+d)) \int \frac {1}{(c+d) \tan ^2(x)+c}d\tan (x)}{d}-\frac {b \int \frac {1}{\tan ^2(x)+1}d\tan (x)}{d}\) |
\(\Big \downarrow \) 216 |
\(\displaystyle \frac {(a d+b (c+d)) \int \frac {1}{(c+d) \tan ^2(x)+c}d\tan (x)}{d}-\frac {b \arctan (\tan (x))}{d}\) |
\(\Big \downarrow \) 218 |
\(\displaystyle \frac {(a d+b (c+d)) \arctan \left (\frac {\sqrt {c+d} \tan (x)}{\sqrt {c}}\right )}{\sqrt {c} d \sqrt {c+d}}-\frac {b \arctan (\tan (x))}{d}\) |
Input:
Int[(a + b*Cos[x]^2)/(c + d*Sin[x]^2),x]
Output:
-((b*ArcTan[Tan[x]])/d) + ((a*d + b*(c + d))*ArcTan[(Sqrt[c + d]*Tan[x])/S qrt[c]])/(Sqrt[c]*d*Sqrt[c + d])
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a , 0] || GtQ[b, 0])
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_ Symbol] :> Simp[(b*e - a*f)/(b*c - a*d) Int[1/(a + b*x^2), x], x] - Simp[ (d*e - c*f)/(b*c - a*d) Int[1/(c + d*x^2), x], x] /; FreeQ[{a, b, c, d, e , f}, x]
Int[u_, x_Symbol] :> With[{v = FunctionOfTrig[u, x]}, With[{d = FreeFactors [Tan[v], x]}, Simp[d/Coefficient[v, x, 1] Subst[Int[SubstFor[1/(1 + d^2*x ^2), Tan[v]/d, u, x], x], x, Tan[v]/d], x]] /; !FalseQ[v] && FunctionOfQ[N onfreeFactors[Tan[v], x], u, x]] /; InverseFunctionFreeQ[u, x] && !MatchQ[ u, (v_.)*((c_.)*tan[w_]^(n_.)*tan[z_]^(n_.))^(p_.) /; FreeQ[{c, p}, x] && I ntegerQ[n] && LinearQ[w, x] && EqQ[z, 2*w]]
Time = 0.30 (sec) , antiderivative size = 46, normalized size of antiderivative = 0.94
method | result | size |
default | \(-\frac {b \arctan \left (\tan \left (x \right )\right )}{d}+\frac {\left (a d +c b +d b \right ) \arctan \left (\frac {\left (c +d \right ) \tan \left (x \right )}{\sqrt {\left (c +d \right ) c}}\right )}{d \sqrt {\left (c +d \right ) c}}\) | \(46\) |
parts | \(\frac {a \arctan \left (\frac {\left (c +d \right ) \tan \left (x \right )}{\sqrt {\left (c +d \right ) c}}\right )}{\sqrt {\left (c +d \right ) c}}+b \left (\frac {\left (c +d \right ) \arctan \left (\frac {\left (c +d \right ) \tan \left (x \right )}{\sqrt {\left (c +d \right ) c}}\right )}{d \sqrt {\left (c +d \right ) c}}-\frac {\arctan \left (\tan \left (x \right )\right )}{d}\right )\) | \(64\) |
risch | \(-\frac {b x}{d}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {2 i c^{2}+2 i d c +2 \sqrt {-c^{2}-c d}\, c +\sqrt {-c^{2}-c d}\, d}{\sqrt {-c^{2}-c d}\, d}\right ) a}{2 \sqrt {-c^{2}-c d}}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {2 i c^{2}+2 i d c +2 \sqrt {-c^{2}-c d}\, c +\sqrt {-c^{2}-c d}\, d}{\sqrt {-c^{2}-c d}\, d}\right ) c b}{2 \sqrt {-c^{2}-c d}\, d}-\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {2 i c^{2}+2 i d c +2 \sqrt {-c^{2}-c d}\, c +\sqrt {-c^{2}-c d}\, d}{\sqrt {-c^{2}-c d}\, d}\right ) b}{2 \sqrt {-c^{2}-c d}}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i c^{2}+2 i d c -2 \sqrt {-c^{2}-c d}\, c -\sqrt {-c^{2}-c d}\, d}{\sqrt {-c^{2}-c d}\, d}\right ) a}{2 \sqrt {-c^{2}-c d}}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i c^{2}+2 i d c -2 \sqrt {-c^{2}-c d}\, c -\sqrt {-c^{2}-c d}\, d}{\sqrt {-c^{2}-c d}\, d}\right ) c b}{2 \sqrt {-c^{2}-c d}\, d}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {2 i c^{2}+2 i d c -2 \sqrt {-c^{2}-c d}\, c -\sqrt {-c^{2}-c d}\, d}{\sqrt {-c^{2}-c d}\, d}\right ) b}{2 \sqrt {-c^{2}-c d}}\) | \(497\) |
Input:
int((a+cos(x)^2*b)/(c+d*sin(x)^2),x,method=_RETURNVERBOSE)
Output:
-b/d*arctan(tan(x))+(a*d+b*c+b*d)/d/((c+d)*c)^(1/2)*arctan((c+d)*tan(x)/(( c+d)*c)^(1/2))
Leaf count of result is larger than twice the leaf count of optimal. 85 vs. \(2 (41) = 82\).
Time = 0.10 (sec) , antiderivative size = 255, normalized size of antiderivative = 5.20 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx=\left [-\frac {{\left (b c + {\left (a + b\right )} d\right )} \sqrt {-c^{2} - c d} \log \left (\frac {{\left (8 \, c^{2} + 8 \, c d + d^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, c^{2} + 5 \, c d + d^{2}\right )} \cos \left (x\right )^{2} + 4 \, {\left ({\left (2 \, c + d\right )} \cos \left (x\right )^{3} - {\left (c + d\right )} \cos \left (x\right )\right )} \sqrt {-c^{2} - c d} \sin \left (x\right ) + c^{2} + 2 \, c d + d^{2}}{d^{2} \cos \left (x\right )^{4} - 2 \, {\left (c d + d^{2}\right )} \cos \left (x\right )^{2} + c^{2} + 2 \, c d + d^{2}}\right ) + 4 \, {\left (b c^{2} + b c d\right )} x}{4 \, {\left (c^{2} d + c d^{2}\right )}}, -\frac {{\left (b c + {\left (a + b\right )} d\right )} \sqrt {c^{2} + c d} \arctan \left (\frac {{\left (2 \, c + d\right )} \cos \left (x\right )^{2} - c - d}{2 \, \sqrt {c^{2} + c d} \cos \left (x\right ) \sin \left (x\right )}\right ) + 2 \, {\left (b c^{2} + b c d\right )} x}{2 \, {\left (c^{2} d + c d^{2}\right )}}\right ] \] Input:
integrate((a+b*cos(x)^2)/(c+d*sin(x)^2),x, algorithm="fricas")
Output:
[-1/4*((b*c + (a + b)*d)*sqrt(-c^2 - c*d)*log(((8*c^2 + 8*c*d + d^2)*cos(x )^4 - 2*(4*c^2 + 5*c*d + d^2)*cos(x)^2 + 4*((2*c + d)*cos(x)^3 - (c + d)*c os(x))*sqrt(-c^2 - c*d)*sin(x) + c^2 + 2*c*d + d^2)/(d^2*cos(x)^4 - 2*(c*d + d^2)*cos(x)^2 + c^2 + 2*c*d + d^2)) + 4*(b*c^2 + b*c*d)*x)/(c^2*d + c*d ^2), -1/2*((b*c + (a + b)*d)*sqrt(c^2 + c*d)*arctan(1/2*((2*c + d)*cos(x)^ 2 - c - d)/(sqrt(c^2 + c*d)*cos(x)*sin(x))) + 2*(b*c^2 + b*c*d)*x)/(c^2*d + c*d^2)]
Timed out. \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx=\text {Timed out} \] Input:
integrate((a+b*cos(x)**2)/(c+d*sin(x)**2),x)
Output:
Timed out
Time = 0.11 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.86 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx=-\frac {b x}{d} + \frac {{\left (b c + {\left (a + b\right )} d\right )} \arctan \left (\frac {{\left (c + d\right )} \tan \left (x\right )}{\sqrt {{\left (c + d\right )} c}}\right )}{\sqrt {{\left (c + d\right )} c} d} \] Input:
integrate((a+b*cos(x)^2)/(c+d*sin(x)^2),x, algorithm="maxima")
Output:
-b*x/d + (b*c + (a + b)*d)*arctan((c + d)*tan(x)/sqrt((c + d)*c))/(sqrt((c + d)*c)*d)
Time = 0.12 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.43 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx=-\frac {b x}{d} + \frac {{\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, c + 2 \, d\right ) + \arctan \left (\frac {c \tan \left (x\right ) + d \tan \left (x\right )}{\sqrt {c^{2} + c d}}\right )\right )} {\left (b c + a d + b d\right )}}{\sqrt {c^{2} + c d} d} \] Input:
integrate((a+b*cos(x)^2)/(c+d*sin(x)^2),x, algorithm="giac")
Output:
-b*x/d + (pi*floor(x/pi + 1/2)*sgn(2*c + 2*d) + arctan((c*tan(x) + d*tan(x ))/sqrt(c^2 + c*d)))*(b*c + a*d + b*d)/(sqrt(c^2 + c*d)*d)
Time = 16.91 (sec) , antiderivative size = 1774, normalized size of antiderivative = 36.20 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx=\text {Too large to display} \] Input:
int((a + b*cos(x)^2)/(c + d*sin(x)^2),x)
Output:
- (b*c^2*x)/(c*d^2 + c^2*d) - (a*d*atan((a^2*d^3*tan(x)*(- c*d - c^2)^(3/2 )*1i + b^2*c^3*tan(x)*(- c*d - c^2)^(3/2)*2i + b^2*c^5*tan(x)*(- c*d - c^2 )^(1/2)*2i + b^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + a^2*c*d^2*tan(x)*(- c *d - c^2)^(3/2)*2i + b^2*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*4i + b^2*c^2*d*t an(x)*(- c*d - c^2)^(3/2)*5i + b^2*c^4*d*tan(x)*(- c*d - c^2)^(1/2)*6i + a ^2*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*1i + a^2*c^3*d^2*tan(x)*(- c*d - c^2 )^(1/2)*1i + b^2*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*2i + b^2*c^3*d^2*tan(x )*(- c*d - c^2)^(1/2)*6i + a*b*d^3*tan(x)*(- c*d - c^2)^(3/2)*2i + a*b*c*d ^2*tan(x)*(- c*d - c^2)^(3/2)*6i + a*b*c^2*d*tan(x)*(- c*d - c^2)^(3/2)*4i + a*b*c^4*d*tan(x)*(- c*d - c^2)^(1/2)*2i + a*b*c^2*d^3*tan(x)*(- c*d - c ^2)^(1/2)*2i + a*b*c^3*d^2*tan(x)*(- c*d - c^2)^(1/2)*4i)/(b^2*c^5*d + a^2 *c^2*d^4 + 2*a^2*c^3*d^3 + a^2*c^4*d^2 + b^2*c^2*d^4 + 3*b^2*c^3*d^3 + 3*b ^2*c^4*d^2 + 2*a*b*c^5*d + 2*a*b*c^2*d^4 + 6*a*b*c^3*d^3 + 6*a*b*c^4*d^2)) *(- c*d - c^2)^(1/2)*1i)/(c*d^2 + c^2*d) - (b*c*atan((a^2*d^3*tan(x)*(- c* d - c^2)^(3/2)*1i + b^2*c^3*tan(x)*(- c*d - c^2)^(3/2)*2i + b^2*c^5*tan(x) *(- c*d - c^2)^(1/2)*2i + b^2*d^3*tan(x)*(- c*d - c^2)^(3/2)*1i + a^2*c*d^ 2*tan(x)*(- c*d - c^2)^(3/2)*2i + b^2*c*d^2*tan(x)*(- c*d - c^2)^(3/2)*4i + b^2*c^2*d*tan(x)*(- c*d - c^2)^(3/2)*5i + b^2*c^4*d*tan(x)*(- c*d - c^2) ^(1/2)*6i + a^2*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*1i + a^2*c^3*d^2*tan(x) *(- c*d - c^2)^(1/2)*1i + b^2*c^2*d^3*tan(x)*(- c*d - c^2)^(1/2)*2i + b...
Time = 0.18 (sec) , antiderivative size = 1244, normalized size of antiderivative = 25.39 \[ \int \frac {a+b \cos ^2(x)}{c+d \sin ^2(x)} \, dx =\text {Too large to display} \] Input:
int((a+b*cos(x)^2)/(c+d*sin(x)^2),x)
Output:
( - 2*sqrt(d)*sqrt(c)*sqrt(c + d)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)*at an((tan(x/2)*c)/(sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)))*a*d - 2*s qrt(d)*sqrt(c)*sqrt(c + d)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)*atan((tan (x/2)*c)/(sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)))*b*c - 2*sqrt(d)* sqrt(c)*sqrt(c + d)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)*atan((tan(x/2)*c )/(sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)))*b*d + 2*sqrt(c)*sqrt(2* sqrt(d)*sqrt(c + d) + c + 2*d)*atan((tan(x/2)*c)/(sqrt(c)*sqrt(2*sqrt(d)*s qrt(c + d) + c + 2*d)))*a*c*d + 2*sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)*atan((tan(x/2)*c)/(sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)))*a *d**2 + 2*sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)*atan((tan(x/2)*c)/ (sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)))*b*c**2 + 4*sqrt(c)*sqrt(2 *sqrt(d)*sqrt(c + d) + c + 2*d)*atan((tan(x/2)*c)/(sqrt(c)*sqrt(2*sqrt(d)* sqrt(c + d) + c + 2*d)))*b*c*d + 2*sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)*atan((tan(x/2)*c)/(sqrt(c)*sqrt(2*sqrt(d)*sqrt(c + d) + c + 2*d)))* b*d**2 - sqrt(d)*sqrt(c)*sqrt(c + d)*sqrt(2*sqrt(d)*sqrt(c + d) - c - 2*d) *log( - sqrt(2*sqrt(d)*sqrt(c + d) - c - 2*d) + sqrt(c)*tan(x/2))*a*d - sq rt(d)*sqrt(c)*sqrt(c + d)*sqrt(2*sqrt(d)*sqrt(c + d) - c - 2*d)*log( - sqr t(2*sqrt(d)*sqrt(c + d) - c - 2*d) + sqrt(c)*tan(x/2))*b*c - sqrt(d)*sqrt( c)*sqrt(c + d)*sqrt(2*sqrt(d)*sqrt(c + d) - c - 2*d)*log( - sqrt(2*sqrt(d) *sqrt(c + d) - c - 2*d) + sqrt(c)*tan(x/2))*b*d + sqrt(d)*sqrt(c)*sqrt(...