Integrand size = 15, antiderivative size = 55 \[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\frac {\arctan \left (\frac {b+a \tan (x)}{\sqrt {a^2-b^2}}\right )}{2 \sqrt {a^2-b^2}}+\frac {\log (a+b \sin (2 x))}{4 b} \] Output:
1/2*arctan((b+a*tan(x))/(a^2-b^2)^(1/2))/(a^2-b^2)^(1/2)+1/4*ln(a+b*sin(2* x))/b
Time = 0.06 (sec) , antiderivative size = 54, normalized size of antiderivative = 0.98 \[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\frac {1}{4} \left (\frac {2 \arctan \left (\frac {b+a \tan (x)}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+\frac {\log (a+b \sin (2 x))}{b}\right ) \] Input:
Integrate[Cos[x]^2/(a + b*Sin[2*x]),x]
Output:
((2*ArcTan[(b + a*Tan[x])/Sqrt[a^2 - b^2]])/Sqrt[a^2 - b^2] + Log[a + b*Si n[2*x]]/b)/4
Time = 0.35 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.51, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.667, Rules used = {3042, 4889, 1312, 27, 240, 1142, 27, 1083, 217, 1103}
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 {\cos ^2(x)}{a+b \sin (2 x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\cos (x)^2}{a+b \sin (2 x)}dx\) |
\(\Big \downarrow \) 4889 |
\(\displaystyle \int \frac {1}{\left (\tan ^2(x)+1\right ) \left (a \tan ^2(x)+a+2 b \tan (x)\right )}d\tan (x)\) |
\(\Big \downarrow \) 1312 |
\(\displaystyle \frac {\int \frac {2 b (2 b+a \tan (x))}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)}{4 b^2}-\frac {\int \frac {2 b \tan (x)}{\tan ^2(x)+1}d\tan (x)}{4 b^2}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {\int \frac {2 b+a \tan (x)}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)}{2 b}-\frac {\int \frac {\tan (x)}{\tan ^2(x)+1}d\tan (x)}{2 b}\) |
\(\Big \downarrow \) 240 |
\(\displaystyle \frac {\int \frac {2 b+a \tan (x)}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)}{2 b}-\frac {\log \left (\tan ^2(x)+1\right )}{4 b}\) |
\(\Big \downarrow \) 1142 |
\(\displaystyle \frac {b \int \frac {1}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)+\frac {1}{2} \int \frac {2 (b+a \tan (x))}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)}{2 b}-\frac {\log \left (\tan ^2(x)+1\right )}{4 b}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {b \int \frac {1}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)+\int \frac {b+a \tan (x)}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)}{2 b}-\frac {\log \left (\tan ^2(x)+1\right )}{4 b}\) |
\(\Big \downarrow \) 1083 |
\(\displaystyle \frac {\int \frac {b+a \tan (x)}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)-2 b \int \frac {1}{-(2 b+2 a \tan (x))^2-4 \left (a^2-b^2\right )}d(2 b+2 a \tan (x))}{2 b}-\frac {\log \left (\tan ^2(x)+1\right )}{4 b}\) |
\(\Big \downarrow \) 217 |
\(\displaystyle \frac {\int \frac {b+a \tan (x)}{a \tan ^2(x)+2 b \tan (x)+a}d\tan (x)+\frac {b \arctan \left (\frac {2 a \tan (x)+2 b}{2 \sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}}{2 b}-\frac {\log \left (\tan ^2(x)+1\right )}{4 b}\) |
\(\Big \downarrow \) 1103 |
\(\displaystyle \frac {\frac {b \arctan \left (\frac {2 a \tan (x)+2 b}{2 \sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+\frac {1}{2} \log \left (a \tan ^2(x)+a+2 b \tan (x)\right )}{2 b}-\frac {\log \left (\tan ^2(x)+1\right )}{4 b}\) |
Input:
Int[Cos[x]^2/(a + b*Sin[2*x]),x]
Output:
-1/4*Log[1 + Tan[x]^2]/b + ((b*ArcTan[(2*b + 2*a*Tan[x])/(2*Sqrt[a^2 - b^2 ])])/Sqrt[a^2 - b^2] + Log[a + 2*b*Tan[x] + a*Tan[x]^2]/2)/(2*b)
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^( -1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] & & (LtQ[a, 0] || LtQ[b, 0])
Int[(x_)/((a_) + (b_.)*(x_)^2), x_Symbol] :> Simp[Log[RemoveContent[a + b*x ^2, x]]/(2*b), x] /; FreeQ[{a, b}, x]
Int[((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2 Subst[I nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x]
Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> S imp[d*(Log[RemoveContent[a + b*x + c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]
Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> S imp[(2*c*d - b*e)/(2*c) Int[1/(a + b*x + c*x^2), x], x] + Simp[e/(2*c) Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x]
Int[1/(((a_) + (b_.)*(x_) + (c_.)*(x_)^2)*((d_) + (f_.)*(x_)^2)), x_Symbol] :> With[{q = c^2*d^2 + b^2*d*f - 2*a*c*d*f + a^2*f^2}, Simp[1/q Int[(c^2 *d + b^2*f - a*c*f + b*c*f*x)/(a + b*x + c*x^2), x], x] - Simp[1/q Int[(c *d*f - a*f^2 + b*f^2*x)/(d + f*x^2), x], x] /; NeQ[q, 0]] /; FreeQ[{a, b, c , d, f}, x] && NeQ[b^2 - 4*a*c, 0]
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 = 1.66 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.31
method | result | size |
default | \(-\frac {\ln \left (1+\tan \left (x \right )^{2}\right )}{4 b}+\frac {\frac {\ln \left (a \tan \left (x \right )^{2}+2 b \tan \left (x \right )+a \right )}{2}+\frac {b \arctan \left (\frac {2 a \tan \left (x \right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}}}{2 b}\) | \(72\) |
risch | \(\frac {i x}{2 b}-\frac {i x \,a^{2} b}{a^{2} b^{2}-b^{4}}+\frac {i x \,b^{3}}{a^{2} b^{2}-b^{4}}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i a b +\sqrt {-a^{2} b^{2}+b^{4}}}{b^{2}}\right ) a^{2}}{4 \left (a^{2}-b^{2}\right ) b}-\frac {b \ln \left ({\mathrm e}^{2 i x}+\frac {i a b +\sqrt {-a^{2} b^{2}+b^{4}}}{b^{2}}\right )}{4 \left (a^{2}-b^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i a b +\sqrt {-a^{2} b^{2}+b^{4}}}{b^{2}}\right ) \sqrt {-a^{2} b^{2}+b^{4}}}{4 \left (a^{2}-b^{2}\right ) b}+\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i a b -\sqrt {-a^{2} b^{2}+b^{4}}}{b^{2}}\right ) a^{2}}{4 \left (a^{2}-b^{2}\right ) b}-\frac {b \ln \left ({\mathrm e}^{2 i x}+\frac {i a b -\sqrt {-a^{2} b^{2}+b^{4}}}{b^{2}}\right )}{4 \left (a^{2}-b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i x}+\frac {i a b -\sqrt {-a^{2} b^{2}+b^{4}}}{b^{2}}\right ) \sqrt {-a^{2} b^{2}+b^{4}}}{4 \left (a^{2}-b^{2}\right ) b}\) | \(372\) |
Input:
int(cos(x)^2/(a+b*sin(2*x)),x,method=_RETURNVERBOSE)
Output:
-1/4/b*ln(1+tan(x)^2)+1/2/b*(1/2*ln(a*tan(x)^2+2*b*tan(x)+a)+b/(a^2-b^2)^( 1/2)*arctan(1/2*(2*a*tan(x)+2*b)/(a^2-b^2)^(1/2)))
Leaf count of result is larger than twice the leaf count of optimal. 121 vs. \(2 (47) = 94\).
Time = 0.11 (sec) , antiderivative size = 322, normalized size of antiderivative = 5.85 \[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\left [-\frac {\sqrt {-a^{2} + b^{2}} b \log \left (-\frac {4 \, {\left (2 \, a^{2} - b^{2}\right )} \cos \left (x\right )^{4} - 4 \, a b \cos \left (x\right ) \sin \left (x\right ) - 4 \, {\left (2 \, a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + a^{2} - 2 \, b^{2} + 2 \, {\left (2 \, b \cos \left (x\right )^{2} + 2 \, {\left (2 \, a \cos \left (x\right )^{3} - a \cos \left (x\right )\right )} \sin \left (x\right ) - b\right )} \sqrt {-a^{2} + b^{2}}}{4 \, b^{2} \cos \left (x\right )^{4} - 4 \, b^{2} \cos \left (x\right )^{2} - 4 \, a b \cos \left (x\right ) \sin \left (x\right ) - a^{2}}\right ) - {\left (a^{2} - b^{2}\right )} \log \left (-4 \, b^{2} \cos \left (x\right )^{4} + 4 \, b^{2} \cos \left (x\right )^{2} + 4 \, a b \cos \left (x\right ) \sin \left (x\right ) + a^{2}\right )}{8 \, {\left (a^{2} b - b^{3}\right )}}, -\frac {2 \, \sqrt {a^{2} - b^{2}} b \arctan \left (-\frac {{\left (2 \, a \cos \left (x\right ) \sin \left (x\right ) + b\right )} \sqrt {a^{2} - b^{2}}}{2 \, {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - a^{2} + b^{2}}\right ) - {\left (a^{2} - b^{2}\right )} \log \left (-4 \, b^{2} \cos \left (x\right )^{4} + 4 \, b^{2} \cos \left (x\right )^{2} + 4 \, a b \cos \left (x\right ) \sin \left (x\right ) + a^{2}\right )}{8 \, {\left (a^{2} b - b^{3}\right )}}\right ] \] Input:
integrate(cos(x)^2/(a+b*sin(2*x)),x, algorithm="fricas")
Output:
[-1/8*(sqrt(-a^2 + b^2)*b*log(-(4*(2*a^2 - b^2)*cos(x)^4 - 4*a*b*cos(x)*si n(x) - 4*(2*a^2 - b^2)*cos(x)^2 + a^2 - 2*b^2 + 2*(2*b*cos(x)^2 + 2*(2*a*c os(x)^3 - a*cos(x))*sin(x) - b)*sqrt(-a^2 + b^2))/(4*b^2*cos(x)^4 - 4*b^2* cos(x)^2 - 4*a*b*cos(x)*sin(x) - a^2)) - (a^2 - b^2)*log(-4*b^2*cos(x)^4 + 4*b^2*cos(x)^2 + 4*a*b*cos(x)*sin(x) + a^2))/(a^2*b - b^3), -1/8*(2*sqrt( a^2 - b^2)*b*arctan(-(2*a*cos(x)*sin(x) + b)*sqrt(a^2 - b^2)/(2*(a^2 - b^2 )*cos(x)^2 - a^2 + b^2)) - (a^2 - b^2)*log(-4*b^2*cos(x)^4 + 4*b^2*cos(x)^ 2 + 4*a*b*cos(x)*sin(x) + a^2))/(a^2*b - b^3)]
Time = 2.46 (sec) , antiderivative size = 124, normalized size of antiderivative = 2.25 \[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\begin {cases} \frac {\log {\left (\frac {a}{b} + \sin {\left (2 x \right )} \right )}}{4 b} & \text {for}\: b \neq 0 \\\frac {\sin {\left (2 x \right )}}{4 a} & \text {otherwise} \end {cases} + \begin {cases} \tilde {\infty } \log {\left (\tan {\left (x \right )} \right )} & \text {for}\: a = 0 \wedge b = 0 \\\frac {\log {\left (\tan {\left (x \right )} \right )}}{4 b} & \text {for}\: a = 0 \\\frac {1}{2 b \tan {\left (x \right )} - 2 b} & \text {for}\: a = - b \\- \frac {1}{2 b \tan {\left (x \right )} + 2 b} & \text {for}\: a = b \\\frac {\log {\left (\tan {\left (x \right )} + \frac {b}{a} - \frac {\sqrt {- a^{2} + b^{2}}}{a} \right )}}{4 \sqrt {- a^{2} + b^{2}}} - \frac {\log {\left (\tan {\left (x \right )} + \frac {b}{a} + \frac {\sqrt {- a^{2} + b^{2}}}{a} \right )}}{4 \sqrt {- a^{2} + b^{2}}} & \text {otherwise} \end {cases} \] Input:
integrate(cos(x)**2/(a+b*sin(2*x)),x)
Output:
Piecewise((log(a/b + sin(2*x))/(4*b), Ne(b, 0)), (sin(2*x)/(4*a), True)) + Piecewise((zoo*log(tan(x)), Eq(a, 0) & Eq(b, 0)), (log(tan(x))/(4*b), Eq( a, 0)), (1/(2*b*tan(x) - 2*b), Eq(a, -b)), (-1/(2*b*tan(x) + 2*b), Eq(a, b )), (log(tan(x) + b/a - sqrt(-a**2 + b**2)/a)/(4*sqrt(-a**2 + b**2)) - log (tan(x) + b/a + sqrt(-a**2 + b**2)/a)/(4*sqrt(-a**2 + b**2)), True))
Exception generated. \[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate(cos(x)^2/(a+b*sin(2*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*b^2-4*a^2>0)', see `assume?` f or more de
Time = 0.14 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.40 \[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\frac {\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (x\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )}{2 \, \sqrt {a^{2} - b^{2}}} + \frac {\log \left (a \tan \left (x\right )^{2} + 2 \, b \tan \left (x\right ) + a\right )}{4 \, b} - \frac {\log \left (\tan \left (x\right )^{2} + 1\right )}{4 \, b} \] Input:
integrate(cos(x)^2/(a+b*sin(2*x)),x, algorithm="giac")
Output:
1/2*(pi*floor(x/pi + 1/2)*sgn(a) + arctan((a*tan(x) + b)/sqrt(a^2 - b^2))) /sqrt(a^2 - b^2) + 1/4*log(a*tan(x)^2 + 2*b*tan(x) + a)/b - 1/4*log(tan(x) ^2 + 1)/b
Time = 17.08 (sec) , antiderivative size = 1374, normalized size of antiderivative = 24.98 \[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\text {Too large to display} \] Input:
int(cos(x)^2/(a + b*sin(2*x)),x)
Output:
- log(tan(x)^2 + 1)/(4*b) - atan((2*tan(x)*((6*b*(2*a^2 - 3*b^2)*(((24*a*b ^3 - ((8*a^2*b - 8*b^3)*(96*a*b^4 - 64*a^3*b^2))/(2*(16*b^4 - 16*a^2*b^2)) )/(4*(a^2 - b^2)^(1/2)) - ((8*a^2*b - 8*b^3)*(96*a*b^4 - 64*a^3*b^2))/(8*( a^2 - b^2)^(1/2)*(16*b^4 - 16*a^2*b^2)))/(4*(a^2 - b^2)^(1/2)) + ((8*a^2*b - 8*b^3)*(4*a^3 - ((8*a^2*b - 8*b^3)*(24*a*b^3 - ((8*a^2*b - 8*b^3)*(96*a *b^4 - 64*a^3*b^2))/(2*(16*b^4 - 16*a^2*b^2))))/(2*(16*b^4 - 16*a^2*b^2))) )/(2*(16*b^4 - 16*a^2*b^2)) - ((8*a^2*b - 8*b^3)*(96*a*b^4 - 64*a^3*b^2))/ (32*(a^2 - b^2)*(16*b^4 - 16*a^2*b^2))))/(a^3*(4*a^2 - 3*b^2)^2) - (((96*a *b^4 - 64*a^3*b^2)/(64*(a^2 - b^2)^(3/2)) - (4*a^3 - ((8*a^2*b - 8*b^3)*(2 4*a*b^3 - ((8*a^2*b - 8*b^3)*(96*a*b^4 - 64*a^3*b^2))/(2*(16*b^4 - 16*a^2* b^2))))/(2*(16*b^4 - 16*a^2*b^2)))/(4*(a^2 - b^2)^(1/2)) + ((8*a^2*b - 8*b ^3)*((24*a*b^3 - ((8*a^2*b - 8*b^3)*(96*a*b^4 - 64*a^3*b^2))/(2*(16*b^4 - 16*a^2*b^2)))/(4*(a^2 - b^2)^(1/2)) - ((8*a^2*b - 8*b^3)*(96*a*b^4 - 64*a^ 3*b^2))/(8*(a^2 - b^2)^(1/2)*(16*b^4 - 16*a^2*b^2))))/(2*(16*b^4 - 16*a^2* b^2)))*(4*a^4 + 18*b^4 - 21*a^2*b^2))/(a^3*(a^2 - b^2)^(1/2)*(4*a^2 - 3*b^ 2)^2))*(a^2 - b^2)^(3/2))/a - (2*(a^2 - b^2)*((a^2*b^3)/(2*(a^2 - b^2)^(3/ 2)) - (2*a^2*b - ((8*a^2*b - 8*b^3)*(16*a^2*b^2 - (16*a^2*b^3*(8*a^2*b - 8 *b^3))/(16*b^4 - 16*a^2*b^2)))/(2*(16*b^4 - 16*a^2*b^2)))/(4*(a^2 - b^2)^( 1/2)) + ((8*a^2*b - 8*b^3)*((16*a^2*b^2 - (16*a^2*b^3*(8*a^2*b - 8*b^3))/( 16*b^4 - 16*a^2*b^2))/(4*(a^2 - b^2)^(1/2)) - (4*a^2*b^3*(8*a^2*b - 8*b...
\[ \int \frac {\cos ^2(x)}{a+b \sin (2 x)} \, dx=\int \frac {\cos \left (x \right )^{2}}{\sin \left (2 x \right ) b +a}d x \] Input:
int(cos(x)^2/(a+b*sin(2*x)),x)
Output:
int(cos(x)**2/(sin(2*x)*b + a),x)