Integrand size = 21, antiderivative size = 88 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {\left (a^2-b^2\right ) x}{\left (a^2+b^2\right )^2}-\frac {2 a b \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^2 d}-\frac {a^2}{b \left (a^2+b^2\right ) d (a+b \tan (c+d x))} \] Output:
-(a^2-b^2)*x/(a^2+b^2)^2-2*a*b*ln(a*cos(d*x+c)+b*sin(d*x+c))/(a^2+b^2)^2/d -a^2/b/(a^2+b^2)/d/(a+b*tan(d*x+c))
Result contains complex when optimal does not.
Time = 0.34 (sec) , antiderivative size = 183, normalized size of antiderivative = 2.08 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=\frac {a \left (i (a-i b)^2 \log (i-\tan (c+d x))-i (a+i b)^2 \log (i+\tan (c+d x))-4 a b \log (a+b \tan (c+d x))\right )+\left (i (a-i b)^2 b \log (i-\tan (c+d x))-i (a+i b)^2 b \log (i+\tan (c+d x))+2 a \left (a^2+b^2-2 b^2 \log (a+b \tan (c+d x))\right )\right ) \tan (c+d x)}{2 \left (a^2+b^2\right )^2 d (a+b \tan (c+d x))} \] Input:
Integrate[Tan[c + d*x]^2/(a + b*Tan[c + d*x])^2,x]
Output:
(a*(I*(a - I*b)^2*Log[I - Tan[c + d*x]] - I*(a + I*b)^2*Log[I + Tan[c + d* x]] - 4*a*b*Log[a + b*Tan[c + d*x]]) + (I*(a - I*b)^2*b*Log[I - Tan[c + d* x]] - I*(a + I*b)^2*b*Log[I + Tan[c + d*x]] + 2*a*(a^2 + b^2 - 2*b^2*Log[a + b*Tan[c + d*x]]))*Tan[c + d*x])/(2*(a^2 + b^2)^2*d*(a + b*Tan[c + d*x]) )
Time = 0.52 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.12, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 4025, 25, 3042, 4014, 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 {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\tan (c+d x)^2}{(a+b \tan (c+d x))^2}dx\) |
\(\Big \downarrow \) 4025 |
\(\displaystyle \frac {\int -\frac {a-b \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}-\frac {a^2}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\frac {\int \frac {a-b \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}-\frac {a^2}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {\int \frac {a-b \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}-\frac {a^2}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}\) |
\(\Big \downarrow \) 4014 |
\(\displaystyle -\frac {\frac {2 a b \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}+\frac {x \left (a^2-b^2\right )}{a^2+b^2}}{a^2+b^2}-\frac {a^2}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {\frac {2 a b \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}+\frac {x \left (a^2-b^2\right )}{a^2+b^2}}{a^2+b^2}-\frac {a^2}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}\) |
\(\Big \downarrow \) 4013 |
\(\displaystyle -\frac {a^2}{b d \left (a^2+b^2\right ) (a+b \tan (c+d x))}-\frac {\frac {2 a b \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )}+\frac {x \left (a^2-b^2\right )}{a^2+b^2}}{a^2+b^2}\) |
Input:
Int[Tan[c + d*x]^2/(a + b*Tan[c + d*x])^2,x]
Output:
-((((a^2 - b^2)*x)/(a^2 + b^2) + (2*a*b*Log[a*Cos[c + d*x] + b*Sin[c + d*x ]])/((a^2 + b^2)*d))/(a^2 + b^2)) - a^2/(b*(a^2 + b^2)*d*(a + b*Tan[c + d* x]))
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[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a *d)/(a^2 + b^2) Int[(b - a*Tan[e + f*x])/(a + b*Tan[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] && N eQ[a*c + b*d, 0]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[(b*c - a*d)^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1)*(a^2 + b^2))), x] + Simp[1/(a^2 + b^2) Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*c^2 + 2*b*c*d - a*d^2 - (b*c^2 - 2*a*c*d - b*d^2)*Ta n[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && NeQ[a^2 + b^2, 0]
Time = 0.49 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.15
method | result | size |
derivativedivides | \(\frac {-\frac {a^{2}}{\left (a^{2}+b^{2}\right ) b \left (a +b \tan \left (d x +c \right )\right )}-\frac {2 a b \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {a b \ln \left (1+\tan \left (d x +c \right )^{2}\right )+\left (-a^{2}+b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(101\) |
default | \(\frac {-\frac {a^{2}}{\left (a^{2}+b^{2}\right ) b \left (a +b \tan \left (d x +c \right )\right )}-\frac {2 a b \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {a b \ln \left (1+\tan \left (d x +c \right )^{2}\right )+\left (-a^{2}+b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(101\) |
norman | \(\frac {-\frac {a^{2}}{b d \left (a^{2}+b^{2}\right )}-\frac {\left (a^{2}-b^{2}\right ) a x}{a^{4}+2 b^{2} a^{2}+b^{4}}-\frac {b \left (a^{2}-b^{2}\right ) x \tan \left (d x +c \right )}{a^{4}+2 b^{2} a^{2}+b^{4}}}{a +b \tan \left (d x +c \right )}+\frac {a b \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{d \left (a^{4}+2 b^{2} a^{2}+b^{4}\right )}-\frac {2 a b \ln \left (a +b \tan \left (d x +c \right )\right )}{d \left (a^{4}+2 b^{2} a^{2}+b^{4}\right )}\) | \(171\) |
parallelrisch | \(\frac {-x \tan \left (d x +c \right ) a^{2} b^{2} d +x \tan \left (d x +c \right ) b^{4} d +\ln \left (1+\tan \left (d x +c \right )^{2}\right ) \tan \left (d x +c \right ) a \,b^{3}-2 \ln \left (a +b \tan \left (d x +c \right )\right ) \tan \left (d x +c \right ) a \,b^{3}-a^{3} b d x +a \,b^{3} d x +\ln \left (1+\tan \left (d x +c \right )^{2}\right ) a^{2} b^{2}-2 \ln \left (a +b \tan \left (d x +c \right )\right ) a^{2} b^{2}-a^{4}-b^{2} a^{2}}{\left (a +b \tan \left (d x +c \right )\right ) \left (a^{4}+2 b^{2} a^{2}+b^{4}\right ) b d}\) | \(176\) |
risch | \(\frac {x}{2 i a b -a^{2}+b^{2}}+\frac {4 i a b x}{a^{4}+2 b^{2} a^{2}+b^{4}}+\frac {4 i a b c}{d \left (a^{4}+2 b^{2} a^{2}+b^{4}\right )}+\frac {2 i a^{2}}{\left (i b +a \right ) d \left (-i b +a \right )^{2} \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+a \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +a \right )}-\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{d \left (a^{4}+2 b^{2} a^{2}+b^{4}\right )}\) | \(179\) |
Input:
int(tan(d*x+c)^2/(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)
Output:
1/d*(-a^2/(a^2+b^2)/b/(a+b*tan(d*x+c))-2*a*b/(a^2+b^2)^2*ln(a+b*tan(d*x+c) )+1/(a^2+b^2)^2*(a*b*ln(1+tan(d*x+c)^2)+(-a^2+b^2)*arctan(tan(d*x+c))))
Time = 0.12 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.74 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {a^{2} b + {\left (a^{3} - a b^{2}\right )} d x + {\left (a b^{2} \tan \left (d x + c\right ) + a^{2} b\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (a^{3} - {\left (a^{2} b - b^{3}\right )} d x\right )} \tan \left (d x + c\right )}{{\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} d \tan \left (d x + c\right ) + {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} d} \] Input:
integrate(tan(d*x+c)^2/(a+b*tan(d*x+c))^2,x, algorithm="fricas")
Output:
-(a^2*b + (a^3 - a*b^2)*d*x + (a*b^2*tan(d*x + c) + a^2*b)*log((b^2*tan(d* x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/(tan(d*x + c)^2 + 1)) - (a^3 - (a^2*b - b^3)*d*x)*tan(d*x + c))/((a^4*b + 2*a^2*b^3 + b^5)*d*tan(d*x + c) + (a^ 5 + 2*a^3*b^2 + a*b^4)*d)
Result contains complex when optimal does not.
Time = 0.76 (sec) , antiderivative size = 1314, normalized size of antiderivative = 14.93 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=\text {Too large to display} \] Input:
integrate(tan(d*x+c)**2/(a+b*tan(d*x+c))**2,x)
Output:
Piecewise((zoo*x, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), ((-x + tan(c + d*x)/d)/ a**2, Eq(b, 0)), (d*x*tan(c + d*x)**2/(4*b**2*d*tan(c + d*x)**2 - 8*I*b**2 *d*tan(c + d*x) - 4*b**2*d) - 2*I*d*x*tan(c + d*x)/(4*b**2*d*tan(c + d*x)* *2 - 8*I*b**2*d*tan(c + d*x) - 4*b**2*d) - d*x/(4*b**2*d*tan(c + d*x)**2 - 8*I*b**2*d*tan(c + d*x) - 4*b**2*d) - 3*tan(c + d*x)/(4*b**2*d*tan(c + d* x)**2 - 8*I*b**2*d*tan(c + d*x) - 4*b**2*d) + 2*I/(4*b**2*d*tan(c + d*x)** 2 - 8*I*b**2*d*tan(c + d*x) - 4*b**2*d), Eq(a, -I*b)), (d*x*tan(c + d*x)** 2/(4*b**2*d*tan(c + d*x)**2 + 8*I*b**2*d*tan(c + d*x) - 4*b**2*d) + 2*I*d* x*tan(c + d*x)/(4*b**2*d*tan(c + d*x)**2 + 8*I*b**2*d*tan(c + d*x) - 4*b** 2*d) - d*x/(4*b**2*d*tan(c + d*x)**2 + 8*I*b**2*d*tan(c + d*x) - 4*b**2*d) - 3*tan(c + d*x)/(4*b**2*d*tan(c + d*x)**2 + 8*I*b**2*d*tan(c + d*x) - 4* b**2*d) - 2*I/(4*b**2*d*tan(c + d*x)**2 + 8*I*b**2*d*tan(c + d*x) - 4*b**2 *d), Eq(a, I*b)), (x*tan(c)**2/(a + b*tan(c))**2, Eq(d, 0)), (-a**4/(a**5* b*d + a**4*b**2*d*tan(c + d*x) + 2*a**3*b**3*d + 2*a**2*b**4*d*tan(c + d*x ) + a*b**5*d + b**6*d*tan(c + d*x)) - a**3*b*d*x/(a**5*b*d + a**4*b**2*d*t an(c + d*x) + 2*a**3*b**3*d + 2*a**2*b**4*d*tan(c + d*x) + a*b**5*d + b**6 *d*tan(c + d*x)) - a**2*b**2*d*x*tan(c + d*x)/(a**5*b*d + a**4*b**2*d*tan( c + d*x) + 2*a**3*b**3*d + 2*a**2*b**4*d*tan(c + d*x) + a*b**5*d + b**6*d* tan(c + d*x)) - 2*a**2*b**2*log(a/b + tan(c + d*x))/(a**5*b*d + a**4*b**2* d*tan(c + d*x) + 2*a**3*b**3*d + 2*a**2*b**4*d*tan(c + d*x) + a*b**5*d ...
Time = 0.11 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.56 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {\frac {2 \, a b \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {a b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {{\left (a^{2} - b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {a^{2}}{a^{3} b + a b^{3} + {\left (a^{2} b^{2} + b^{4}\right )} \tan \left (d x + c\right )}}{d} \] Input:
integrate(tan(d*x+c)^2/(a+b*tan(d*x+c))^2,x, algorithm="maxima")
Output:
-(2*a*b*log(b*tan(d*x + c) + a)/(a^4 + 2*a^2*b^2 + b^4) - a*b*log(tan(d*x + c)^2 + 1)/(a^4 + 2*a^2*b^2 + b^4) + (a^2 - b^2)*(d*x + c)/(a^4 + 2*a^2*b ^2 + b^4) + a^2/(a^3*b + a*b^3 + (a^2*b^2 + b^4)*tan(d*x + c)))/d
Time = 0.21 (sec) , antiderivative size = 156, normalized size of antiderivative = 1.77 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=-\frac {2 \, a b^{2} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{4} b d + 2 \, a^{2} b^{3} d + b^{5} d} + \frac {a b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} d + 2 \, a^{2} b^{2} d + b^{4} d} - \frac {{\left (a^{2} - b^{2}\right )} {\left (d x + c\right )}}{a^{4} d + 2 \, a^{2} b^{2} d + b^{4} d} - \frac {a^{4} + a^{2} b^{2}}{{\left (a^{2} + b^{2}\right )}^{2} {\left (b \tan \left (d x + c\right ) + a\right )} b d} \] Input:
integrate(tan(d*x+c)^2/(a+b*tan(d*x+c))^2,x, algorithm="giac")
Output:
-2*a*b^2*log(abs(b*tan(d*x + c) + a))/(a^4*b*d + 2*a^2*b^3*d + b^5*d) + a* b*log(tan(d*x + c)^2 + 1)/(a^4*d + 2*a^2*b^2*d + b^4*d) - (a^2 - b^2)*(d*x + c)/(a^4*d + 2*a^2*b^2*d + b^4*d) - (a^4 + a^2*b^2)/((a^2 + b^2)^2*(b*ta n(d*x + c) + a)*b*d)
Time = 1.18 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.43 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )}{2\,d\,\left (-a^2\,1{}\mathrm {i}+2\,a\,b+b^2\,1{}\mathrm {i}\right )}-\frac {a^2}{b\,d\,\left (a^2+b^2\right )\,\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}-\frac {2\,a\,b\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{d\,{\left (a^2+b^2\right )}^2}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (-a^2+a\,b\,2{}\mathrm {i}+b^2\right )} \] Input:
int(tan(c + d*x)^2/(a + b*tan(c + d*x))^2,x)
Output:
(log(tan(c + d*x) + 1i)*1i)/(2*d*(a*b*2i - a^2 + b^2)) + log(tan(c + d*x) - 1i)/(2*d*(2*a*b - a^2*1i + b^2*1i)) - a^2/(b*d*(a^2 + b^2)*(a + b*tan(c + d*x))) - (2*a*b*log(a + b*tan(c + d*x)))/(d*(a^2 + b^2)^2)
Time = 0.17 (sec) , antiderivative size = 198, normalized size of antiderivative = 2.25 \[ \int \frac {\tan ^2(c+d x)}{(a+b \tan (c+d x))^2} \, dx=\frac {\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) \tan \left (d x +c \right ) a \,b^{2}+\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a^{2} b -2 \,\mathrm {log}\left (a +\tan \left (d x +c \right ) b \right ) \tan \left (d x +c \right ) a \,b^{2}-2 \,\mathrm {log}\left (a +\tan \left (d x +c \right ) b \right ) a^{2} b +\tan \left (d x +c \right ) a^{3}-\tan \left (d x +c \right ) a^{2} b d x +\tan \left (d x +c \right ) a \,b^{2}+\tan \left (d x +c \right ) b^{3} d x -a^{3} d x +a \,b^{2} d x}{d \left (\tan \left (d x +c \right ) a^{4} b +2 \tan \left (d x +c \right ) a^{2} b^{3}+\tan \left (d x +c \right ) b^{5}+a^{5}+2 a^{3} b^{2}+a \,b^{4}\right )} \] Input:
int(tan(d*x+c)^2/(a+b*tan(d*x+c))^2,x)
Output:
(log(tan(c + d*x)**2 + 1)*tan(c + d*x)*a*b**2 + log(tan(c + d*x)**2 + 1)*a **2*b - 2*log(tan(c + d*x)*b + a)*tan(c + d*x)*a*b**2 - 2*log(tan(c + d*x) *b + a)*a**2*b + tan(c + d*x)*a**3 - tan(c + d*x)*a**2*b*d*x + tan(c + d*x )*a*b**2 + tan(c + d*x)*b**3*d*x - a**3*d*x + a*b**2*d*x)/(d*(tan(c + d*x) *a**4*b + 2*tan(c + d*x)*a**2*b**3 + tan(c + d*x)*b**5 + a**5 + 2*a**3*b** 2 + a*b**4))