Integrand size = 14, antiderivative size = 50 \[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx=\frac {a x}{b \left (a^2+b^2\right )}+\frac {\log (a \cos (x)+b \sin (x))}{a^2+b^2}-\frac {x}{b (a+b \tan (x))} \] Output:
a*x/b/(a^2+b^2)+ln(a*cos(x)+b*sin(x))/(a^2+b^2)-x/b/(a+b*tan(x))
Time = 0.15 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.96 \[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx=\frac {-b x+a \log (a \cos (x)+b \sin (x))}{a^3+a b^2}+\frac {x \sin (x)}{a^2 \cos (x)+a b \sin (x)} \] Input:
Integrate[(x*Sec[x]^2)/(a + b*Tan[x])^2,x]
Output:
(-(b*x) + a*Log[a*Cos[x] + b*Sin[x]])/(a^3 + a*b^2) + (x*Sin[x])/(a^2*Cos[ x] + a*b*Sin[x])
Time = 0.36 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.06, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {4924, 3042, 3965, 3042, 4013}
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 {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx\) |
\(\Big \downarrow \) 4924 |
\(\displaystyle \frac {\int \frac {1}{a+b \tan (x)}dx}{b}-\frac {x}{b (a+b \tan (x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {1}{a+b \tan (x)}dx}{b}-\frac {x}{b (a+b \tan (x))}\) |
\(\Big \downarrow \) 3965 |
\(\displaystyle \frac {\frac {b \int \frac {b-a \tan (x)}{a+b \tan (x)}dx}{a^2+b^2}+\frac {a x}{a^2+b^2}}{b}-\frac {x}{b (a+b \tan (x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {b \int \frac {b-a \tan (x)}{a+b \tan (x)}dx}{a^2+b^2}+\frac {a x}{a^2+b^2}}{b}-\frac {x}{b (a+b \tan (x))}\) |
\(\Big \downarrow \) 4013 |
\(\displaystyle \frac {\frac {a x}{a^2+b^2}+\frac {b \log (a \cos (x)+b \sin (x))}{a^2+b^2}}{b}-\frac {x}{b (a+b \tan (x))}\) |
Input:
Int[(x*Sec[x]^2)/(a + b*Tan[x])^2,x]
Output:
((a*x)/(a^2 + b^2) + (b*Log[a*Cos[x] + b*Sin[x]])/(a^2 + b^2))/b - x/(b*(a + b*Tan[x]))
Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[a*(x/(a^ 2 + b^2)), x] + Simp[b/(a^2 + b^2) Int[(b - a*Tan[c + d*x])/(a + b*Tan[c + d*x]), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0]
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* (x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
Int[((e_.) + (f_.)*(x_))^(m_.)*Sec[(c_.) + (d_.)*(x_)]^2*((a_) + (b_.)*Tan[ (c_.) + (d_.)*(x_)])^(n_.), x_Symbol] :> Simp[(e + f*x)^m*((a + b*Tan[c + d *x])^(n + 1)/(b*d*(n + 1))), x] - Simp[f*(m/(b*d*(n + 1))) Int[(e + f*x)^ (m - 1)*(a + b*Tan[c + d*x])^(n + 1), x], x] /; FreeQ[{a, b, c, d, e, f, n} , x] && IGtQ[m, 0] && NeQ[n, -1]
Result contains complex when optimal does not.
Time = 1.10 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.72
method | result | size |
risch | \(-\frac {2 i x}{a^{2}+b^{2}}+\frac {2 i x}{\left (-i b \,{\mathrm e}^{2 i x}+a \,{\mathrm e}^{2 i x}+i b +a \right ) \left (-i b +a \right )}+\frac {\ln \left ({\mathrm e}^{2 i x}-\frac {i b +a}{i b -a}\right )}{a^{2}+b^{2}}\) | \(86\) |
Input:
int(x*sec(x)^2/(a+b*tan(x))^2,x,method=_RETURNVERBOSE)
Output:
-2*I/(a^2+b^2)*x+2*I*x/(-I*b*exp(2*I*x)+a*exp(2*I*x)+I*b+a)/(-I*b+a)+1/(a^ 2+b^2)*ln(exp(2*I*x)-(I*b+a)/(I*b-a))
Time = 0.09 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.60 \[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx=-\frac {2 \, b x \cos \left (x\right ) - 2 \, a x \sin \left (x\right ) - {\left (a \cos \left (x\right ) + b \sin \left (x\right )\right )} \log \left (2 \, a b \cos \left (x\right ) \sin \left (x\right ) + {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + b^{2}\right )}{2 \, {\left ({\left (a^{3} + a b^{2}\right )} \cos \left (x\right ) + {\left (a^{2} b + b^{3}\right )} \sin \left (x\right )\right )}} \] Input:
integrate(x*sec(x)^2/(a+b*tan(x))^2,x, algorithm="fricas")
Output:
-1/2*(2*b*x*cos(x) - 2*a*x*sin(x) - (a*cos(x) + b*sin(x))*log(2*a*b*cos(x) *sin(x) + (a^2 - b^2)*cos(x)^2 + b^2))/((a^3 + a*b^2)*cos(x) + (a^2*b + b^ 3)*sin(x))
\[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx=\int \frac {x \sec ^{2}{\left (x \right )}}{\left (a + b \tan {\left (x \right )}\right )^{2}}\, dx \] Input:
integrate(x*sec(x)**2/(a+b*tan(x))**2,x)
Output:
Integral(x*sec(x)**2/(a + b*tan(x))**2, x)
Leaf count of result is larger than twice the leaf count of optimal. 250 vs. \(2 (50) = 100\).
Time = 0.05 (sec) , antiderivative size = 250, normalized size of antiderivative = 5.00 \[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx=-\frac {8 \, a b x \cos \left (2 \, x\right ) - 4 \, {\left (a^{2} - b^{2}\right )} x \sin \left (2 \, x\right ) - {\left ({\left (a^{2} + b^{2}\right )} \cos \left (2 \, x\right )^{2} + 4 \, a b \sin \left (2 \, x\right ) + {\left (a^{2} + b^{2}\right )} \sin \left (2 \, x\right )^{2} + a^{2} + b^{2} + 2 \, {\left (a^{2} - b^{2}\right )} \cos \left (2 \, x\right )\right )} \log \left (\frac {{\left (a^{2} + b^{2}\right )} \cos \left (2 \, x\right )^{2} + 4 \, a b \sin \left (2 \, x\right ) + {\left (a^{2} + b^{2}\right )} \sin \left (2 \, x\right )^{2} + a^{2} + b^{2} + 2 \, {\left (a^{2} - b^{2}\right )} \cos \left (2 \, x\right )}{a^{2} + b^{2}}\right )}{2 \, {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4} + {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \cos \left (2 \, x\right )^{2} + {\left (a^{4} + 2 \, a^{2} b^{2} + b^{4}\right )} \sin \left (2 \, x\right )^{2} + 2 \, {\left (a^{4} - b^{4}\right )} \cos \left (2 \, x\right ) + 4 \, {\left (a^{3} b + a b^{3}\right )} \sin \left (2 \, x\right )\right )}} \] Input:
integrate(x*sec(x)^2/(a+b*tan(x))^2,x, algorithm="maxima")
Output:
-1/2*(8*a*b*x*cos(2*x) - 4*(a^2 - b^2)*x*sin(2*x) - ((a^2 + b^2)*cos(2*x)^ 2 + 4*a*b*sin(2*x) + (a^2 + b^2)*sin(2*x)^2 + a^2 + b^2 + 2*(a^2 - b^2)*co s(2*x))*log(((a^2 + b^2)*cos(2*x)^2 + 4*a*b*sin(2*x) + (a^2 + b^2)*sin(2*x )^2 + a^2 + b^2 + 2*(a^2 - b^2)*cos(2*x))/(a^2 + b^2)))/(a^4 + 2*a^2*b^2 + b^4 + (a^4 + 2*a^2*b^2 + b^4)*cos(2*x)^2 + (a^4 + 2*a^2*b^2 + b^4)*sin(2* x)^2 + 2*(a^4 - b^4)*cos(2*x) + 4*(a^3*b + a*b^3)*sin(2*x))
Leaf count of result is larger than twice the leaf count of optimal. 322 vs. \(2 (50) = 100\).
Time = 0.27 (sec) , antiderivative size = 322, normalized size of antiderivative = 6.44 \[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx=-\frac {2 \, b x \tan \left (\frac {1}{2} \, x\right )^{2} - a \log \left (\frac {4 \, {\left (a^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 4 \, a b \tan \left (\frac {1}{2} \, x\right )^{3} - 2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + 4 \, b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + 4 \, a b \tan \left (\frac {1}{2} \, x\right ) + a^{2}\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{2} + 4 \, a x \tan \left (\frac {1}{2} \, x\right ) + 2 \, b \log \left (\frac {4 \, {\left (a^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 4 \, a b \tan \left (\frac {1}{2} \, x\right )^{3} - 2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + 4 \, b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + 4 \, a b \tan \left (\frac {1}{2} \, x\right ) + a^{2}\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right ) - 2 \, b x + a \log \left (\frac {4 \, {\left (a^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 4 \, a b \tan \left (\frac {1}{2} \, x\right )^{3} - 2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + 4 \, b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + 4 \, a b \tan \left (\frac {1}{2} \, x\right ) + a^{2}\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right )}{2 \, {\left (a^{3} \tan \left (\frac {1}{2} \, x\right )^{2} + a b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, a^{2} b \tan \left (\frac {1}{2} \, x\right ) - 2 \, b^{3} \tan \left (\frac {1}{2} \, x\right ) - a^{3} - a b^{2}\right )}} \] Input:
integrate(x*sec(x)^2/(a+b*tan(x))^2,x, algorithm="giac")
Output:
-1/2*(2*b*x*tan(1/2*x)^2 - a*log(4*(a^2*tan(1/2*x)^4 - 4*a*b*tan(1/2*x)^3 - 2*a^2*tan(1/2*x)^2 + 4*b^2*tan(1/2*x)^2 + 4*a*b*tan(1/2*x) + a^2)/(tan(1 /2*x)^4 + 2*tan(1/2*x)^2 + 1))*tan(1/2*x)^2 + 4*a*x*tan(1/2*x) + 2*b*log(4 *(a^2*tan(1/2*x)^4 - 4*a*b*tan(1/2*x)^3 - 2*a^2*tan(1/2*x)^2 + 4*b^2*tan(1 /2*x)^2 + 4*a*b*tan(1/2*x) + a^2)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1))*tan (1/2*x) - 2*b*x + a*log(4*(a^2*tan(1/2*x)^4 - 4*a*b*tan(1/2*x)^3 - 2*a^2*t an(1/2*x)^2 + 4*b^2*tan(1/2*x)^2 + 4*a*b*tan(1/2*x) + a^2)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1)))/(a^3*tan(1/2*x)^2 + a*b^2*tan(1/2*x)^2 - 2*a^2*b*ta n(1/2*x) - 2*b^3*tan(1/2*x) - a^3 - a*b^2)
Timed out. \[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx=\int \frac {x}{{\cos \left (x\right )}^2\,{\left (a+b\,\mathrm {tan}\left (x\right )\right )}^2} \,d x \] Input:
int(x/(cos(x)^2*(a + b*tan(x))^2),x)
Output:
int(x/(cos(x)^2*(a + b*tan(x))^2), x)
Time = 0.18 (sec) , antiderivative size = 1206, normalized size of antiderivative = 24.12 \[ \int \frac {x \sec ^2(x)}{(a+b \tan (x))^2} \, dx =\text {Too large to display} \] Input:
int(x*sec(x)^2/(a+b*tan(x))^2,x)
Output:
( - 6*cos(x)*log(tan(x/2)**2 + 1)*sin(x)**2*tan(x)*a**3*b**2 - 6*cos(x)*lo g(tan(x/2)**2 + 1)*sin(x)**2*a**4*b + 6*cos(x)*log(tan(x/2)**2 + 1)*tan(x) *a**3*b**2 + 6*cos(x)*log(tan(x/2)**2 + 1)*a**4*b + 6*cos(x)*log(tan(x/2)* *2*a - 2*tan(x/2)*b - a)*sin(x)**2*tan(x)*a**3*b**2 + 6*cos(x)*log(tan(x/2 )**2*a - 2*tan(x/2)*b - a)*sin(x)**2*a**4*b - 6*cos(x)*log(tan(x/2)**2*a - 2*tan(x/2)*b - a)*tan(x)*a**3*b**2 - 6*cos(x)*log(tan(x/2)**2*a - 2*tan(x /2)*b - a)*a**4*b - cos(x)*sec(x)**2*sin(x)**2*tan(x)*a**3*b**2 - cos(x)*s ec(x)**2*sin(x)**2*tan(x)*a*b**4 - 6*cos(x)*sec(x)**2*sin(x)**2*a**5*x + 3 *cos(x)*sec(x)**2*sin(x)**2*a**4*b - 6*cos(x)*sec(x)**2*sin(x)**2*a**3*b** 2*x + 3*cos(x)*sec(x)**2*sin(x)**2*a**2*b**3 + cos(x)*sec(x)**2*tan(x)*a** 3*b**2 + cos(x)*sec(x)**2*tan(x)*a*b**4 + 6*cos(x)*sec(x)**2*a**5*x - 3*co s(x)*sec(x)**2*a**4*b + 6*cos(x)*sec(x)**2*a**3*b**2*x - 3*cos(x)*sec(x)** 2*a**2*b**3 - cos(x)*sin(x)**2*tan(x)*a**3*b**2 - 6*cos(x)*sin(x)**2*tan(x )*a**2*b**3*x - cos(x)*sin(x)**2*tan(x)*a*b**4 - cos(x)*sin(x)**2*a**4*b - 6*cos(x)*sin(x)**2*a**3*b**2*x - cos(x)*sin(x)**2*a**2*b**3 - 6*cos(x)*ta n(x)*a**4*b*x + 4*cos(x)*tan(x)*a**3*b**2 + 4*cos(x)*tan(x)*a*b**4 - 6*cos (x)*a**5*x + 4*cos(x)*a**4*b + 4*cos(x)*a**2*b**3 - 6*log(tan(x/2)**2 + 1) *sin(x)**3*tan(x)*a**2*b**3 - 6*log(tan(x/2)**2 + 1)*sin(x)**3*a**3*b**2 + 6*log(tan(x/2)**2 + 1)*sin(x)*tan(x)*a**2*b**3 + 6*log(tan(x/2)**2 + 1)*s in(x)*a**3*b**2 + 6*log(tan(x/2)**2*a - 2*tan(x/2)*b - a)*sin(x)**3*tan...