Integrand size = 21, antiderivative size = 66 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=-\frac {a x}{a^2+b^2}-\frac {\log (\cos (c+d x))}{b d}+\frac {a^2 \log (a \cos (c+d x)+b \sin (c+d x))}{b \left (a^2+b^2\right ) d} \] Output:
-a*x/(a^2+b^2)-ln(cos(d*x+c))/b/d+a^2*ln(a*cos(d*x+c)+b*sin(d*x+c))/b/(a^2 +b^2)/d
Result contains complex when optimal does not.
Time = 0.06 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.18 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {b (i a+b) \log (i-\tan (c+d x))+b (-i a+b) \log (i+\tan (c+d x))+2 a^2 \log (a+b \tan (c+d x))}{2 b \left (a^2+b^2\right ) d} \] Input:
Integrate[Tan[c + d*x]^2/(a + b*Tan[c + d*x]),x]
Output:
(b*(I*a + b)*Log[I - Tan[c + d*x]] + b*((-I)*a + b)*Log[I + Tan[c + d*x]] + 2*a^2*Log[a + b*Tan[c + d*x]])/(2*b*(a^2 + b^2)*d)
Time = 0.48 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.14, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3042, 4024, 3042, 3956, 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 {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\tan (c+d x)^2}{a+b \tan (c+d x)}dx\) |
\(\Big \downarrow \) 4024 |
\(\displaystyle \frac {a^2 \int \frac {1}{a+b \tan (c+d x)}dx}{b^2}+\frac {\int \tan (c+d x)dx}{b}-\frac {a x}{b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a^2 \int \frac {1}{a+b \tan (c+d x)}dx}{b^2}+\frac {\int \tan (c+d x)dx}{b}-\frac {a x}{b^2}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle \frac {a^2 \int \frac {1}{a+b \tan (c+d x)}dx}{b^2}-\frac {a x}{b^2}-\frac {\log (\cos (c+d x))}{b d}\) |
\(\Big \downarrow \) 3965 |
\(\displaystyle \frac {a^2 \left (\frac {b \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}+\frac {a x}{a^2+b^2}\right )}{b^2}-\frac {a x}{b^2}-\frac {\log (\cos (c+d x))}{b d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a^2 \left (\frac {b \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}+\frac {a x}{a^2+b^2}\right )}{b^2}-\frac {a x}{b^2}-\frac {\log (\cos (c+d x))}{b d}\) |
\(\Big \downarrow \) 4013 |
\(\displaystyle \frac {a^2 \left (\frac {b \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )}+\frac {a x}{a^2+b^2}\right )}{b^2}-\frac {a x}{b^2}-\frac {\log (\cos (c+d x))}{b d}\) |
Input:
Int[Tan[c + d*x]^2/(a + b*Tan[c + d*x]),x]
Output:
-((a*x)/b^2) - Log[Cos[c + d*x]]/(b*d) + (a^2*((a*x)/(a^2 + b^2) + (b*Log[ a*Cos[c + d*x] + b*Sin[c + d*x]])/((a^2 + b^2)*d)))/b^2
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d *x], x]]/d, x] /; FreeQ[{c, d}, 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[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2/((a_.) + (b_.)*tan[(e_.) + (f _.)*(x_)]), x_Symbol] :> Simp[d*(2*b*c - a*d)*(x/b^2), x] + (Simp[d^2/b I nt[Tan[e + f*x], x], x] + Simp[(b*c - a*d)^2/b^2 Int[1/(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]
Time = 0.41 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.85
method | result | size |
parallelrisch | \(\frac {-2 a b d x +\ln \left (1+\tan \left (d x +c \right )^{2}\right ) b^{2}+2 a^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{2 b d \left (a^{2}+b^{2}\right )}\) | \(56\) |
derivativedivides | \(\frac {\frac {\frac {b \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}-a \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}+\frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) b}}{d}\) | \(68\) |
default | \(\frac {\frac {\frac {b \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}-a \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}+\frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right ) b}}{d}\) | \(68\) |
norman | \(-\frac {a x}{a^{2}+b^{2}}+\frac {a^{2} \ln \left (a +b \tan \left (d x +c \right )\right )}{b d \left (a^{2}+b^{2}\right )}+\frac {b \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d \left (a^{2}+b^{2}\right )}\) | \(71\) |
risch | \(\frac {x}{i b -a}+\frac {2 i x}{b}+\frac {2 i c}{b d}-\frac {2 i a^{2} x}{b \left (a^{2}+b^{2}\right )}-\frac {2 i a^{2} c}{b d \left (a^{2}+b^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{b d}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{b d \left (a^{2}+b^{2}\right )}\) | \(140\) |
Input:
int(tan(d*x+c)^2/(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)
Output:
1/2*(-2*a*b*d*x+ln(1+tan(d*x+c)^2)*b^2+2*a^2*ln(a+b*tan(d*x+c)))/b/d/(a^2+ b^2)
Time = 0.11 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.35 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=-\frac {2 \, a b d x - a^{2} \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^{2} + b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{2} b + b^{3}\right )} d} \] Input:
integrate(tan(d*x+c)^2/(a+b*tan(d*x+c)),x, algorithm="fricas")
Output:
-1/2*(2*a*b*d*x - a^2*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/ (tan(d*x + c)^2 + 1)) + (a^2 + b^2)*log(1/(tan(d*x + c)^2 + 1)))/((a^2*b + b^3)*d)
Result contains complex when optimal does not.
Time = 0.50 (sec) , antiderivative size = 405, normalized size of antiderivative = 6.14 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\begin {cases} \tilde {\infty } x \tan {\left (c \right )} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {- x + \frac {\tan {\left (c + d x \right )}}{d}}{a} & \text {for}\: b = 0 \\\frac {i d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {\log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\- \frac {i d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {\log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \tan ^{2}{\left (c \right )}}{a + b \tan {\left (c \right )}} & \text {for}\: d = 0 \\\frac {2 a^{2} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} b d + 2 b^{3} d} - \frac {2 a b d x}{2 a^{2} b d + 2 b^{3} d} + \frac {b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} b d + 2 b^{3} d} & \text {otherwise} \end {cases} \] Input:
integrate(tan(d*x+c)**2/(a+b*tan(d*x+c)),x)
Output:
Piecewise((zoo*x*tan(c), Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), ((-x + tan(c + d *x)/d)/a, Eq(b, 0)), (I*d*x*tan(c + d*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) + d*x/(2*b*d*tan(c + d*x) - 2*I*b*d) + log(tan(c + d*x)**2 + 1)*tan(c + d*x) /(2*b*d*tan(c + d*x) - 2*I*b*d) - I*log(tan(c + d*x)**2 + 1)/(2*b*d*tan(c + d*x) - 2*I*b*d) - I/(2*b*d*tan(c + d*x) - 2*I*b*d), Eq(a, -I*b)), (-I*d* x*tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + d*x/(2*b*d*tan(c + d*x) + 2*I*b*d) + log(tan(c + d*x)**2 + 1)*tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I *b*d) + I*log(tan(c + d*x)**2 + 1)/(2*b*d*tan(c + d*x) + 2*I*b*d) + I/(2*b *d*tan(c + d*x) + 2*I*b*d), Eq(a, I*b)), (x*tan(c)**2/(a + b*tan(c)), Eq(d , 0)), (2*a**2*log(a/b + tan(c + d*x))/(2*a**2*b*d + 2*b**3*d) - 2*a*b*d*x /(2*a**2*b*d + 2*b**3*d) + b**2*log(tan(c + d*x)**2 + 1)/(2*a**2*b*d + 2*b **3*d), True))
Time = 0.12 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.09 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\frac {2 \, a^{2} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b + b^{3}} - \frac {2 \, {\left (d x + c\right )} a}{a^{2} + b^{2}} + \frac {b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \] Input:
integrate(tan(d*x+c)^2/(a+b*tan(d*x+c)),x, algorithm="maxima")
Output:
1/2*(2*a^2*log(b*tan(d*x + c) + a)/(a^2*b + b^3) - 2*(d*x + c)*a/(a^2 + b^ 2) + b*log(tan(d*x + c)^2 + 1)/(a^2 + b^2))/d
Time = 0.18 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.20 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {a^{2} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b d + b^{3} d} - \frac {{\left (d x + c\right )} a}{a^{2} d + b^{2} d} + \frac {b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, {\left (a^{2} d + b^{2} d\right )}} \] Input:
integrate(tan(d*x+c)^2/(a+b*tan(d*x+c)),x, algorithm="giac")
Output:
a^2*log(abs(b*tan(d*x + c) + a))/(a^2*b*d + b^3*d) - (d*x + c)*a/(a^2*d + b^2*d) + 1/2*b*log(tan(d*x + c)^2 + 1)/(a^2*d + b^2*d)
Time = 1.27 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.18 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (b+a\,1{}\mathrm {i}\right )}+\frac {a^2\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{b\,d\,\left (a^2+b^2\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (a+b\,1{}\mathrm {i}\right )} \] Input:
int(tan(c + d*x)^2/(a + b*tan(c + d*x)),x)
Output:
(log(tan(c + d*x) - 1i)*1i)/(2*d*(a + b*1i)) + log(tan(c + d*x) + 1i)/(2*d *(a*1i + b)) + (a^2*log(a + b*tan(c + d*x)))/(b*d*(a^2 + b^2))
Time = 0.18 (sec) , antiderivative size = 55, normalized size of antiderivative = 0.83 \[ \int \frac {\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx=\frac {\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) b^{2}+2 \,\mathrm {log}\left (a +\tan \left (d x +c \right ) b \right ) a^{2}-2 a b d x}{2 b d \left (a^{2}+b^{2}\right )} \] Input:
int(tan(d*x+c)^2/(a+b*tan(d*x+c)),x)
Output:
(log(tan(c + d*x)**2 + 1)*b**2 + 2*log(tan(c + d*x)*b + a)*a**2 - 2*a*b*d* x)/(2*b*d*(a**2 + b**2))