Integrand size = 14, antiderivative size = 34 \[ \int \tan (c-b x) \tan (a+b x) \, dx=x-\frac {\cot (a+c) \log (\cos (c-b x))}{b}+\frac {\cot (a+c) \log (\cos (a+b x))}{b} \]
Time = 0.41 (sec) , antiderivative size = 28, normalized size of antiderivative = 0.82 \[ \int \tan (c-b x) \tan (a+b x) \, dx=x+\frac {\cot (a+c) (-\log (\cos (c-b x))+\log (\cos (a+b x)))}{b} \]
Time = 0.28 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.21, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {5123, 5121, 3042, 3956}
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 \tan (a+b x) \tan (c-b x) \, dx\) |
\(\Big \downarrow \) 5123 |
\(\displaystyle x-\cos (a+c) \int \sec (c-b x) \sec (a+b x)dx\) |
\(\Big \downarrow \) 5121 |
\(\displaystyle x-\cos (a+c) (\csc (a+c) \int \tan (c-b x)dx+\csc (a+c) \int \tan (a+b x)dx)\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle x-\cos (a+c) (\csc (a+c) \int \tan (c-b x)dx+\csc (a+c) \int \tan (a+b x)dx)\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle x-\cos (a+c) \left (\frac {\csc (a+c) \log (\cos (c-b x))}{b}-\frac {\csc (a+c) \log (\cos (a+b x))}{b}\right )\) |
3.2.40.3.1 Defintions of rubi rules used
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d *x], x]]/d, x] /; FreeQ[{c, d}, x]
Int[Sec[(a_.) + (b_.)*(x_)]*Sec[(c_) + (d_.)*(x_)], x_Symbol] :> Simp[-Csc[ (b*c - a*d)/d] Int[Tan[a + b*x], x], x] + Simp[Csc[(b*c - a*d)/b] Int[T an[c + d*x], x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[b^2 - d^2, 0] && NeQ[b *c - a*d, 0]
Int[Tan[(a_.) + (b_.)*(x_)]*Tan[(c_) + (d_.)*(x_)], x_Symbol] :> Simp[(-b)* (x/d), x] + Simp[(b/d)*Cos[(b*c - a*d)/d] Int[Sec[a + b*x]*Sec[c + d*x], x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[b^2 - d^2, 0] && NeQ[b*c - a*d, 0]
Result contains complex when optimal does not.
Time = 0.39 (sec) , antiderivative size = 145, normalized size of antiderivative = 4.26
method | result | size |
risch | \(x +\frac {i \ln \left ({\mathrm e}^{2 i \left (x b +a \right )}+1\right ) {\mathrm e}^{2 i \left (a +c \right )}}{b \left ({\mathrm e}^{2 i \left (a +c \right )}-1\right )}+\frac {i \ln \left ({\mathrm e}^{2 i \left (x b +a \right )}+1\right )}{b \left ({\mathrm e}^{2 i \left (a +c \right )}-1\right )}-\frac {i \ln \left ({\mathrm e}^{2 i \left (a +c \right )}+{\mathrm e}^{2 i \left (x b +a \right )}\right ) {\mathrm e}^{2 i \left (a +c \right )}}{b \left ({\mathrm e}^{2 i \left (a +c \right )}-1\right )}-\frac {i \ln \left ({\mathrm e}^{2 i \left (a +c \right )}+{\mathrm e}^{2 i \left (x b +a \right )}\right )}{b \left ({\mathrm e}^{2 i \left (a +c \right )}-1\right )}\) | \(145\) |
x+I/b/(exp(2*I*(a+c))-1)*ln(exp(2*I*(b*x+a))+1)*exp(2*I*(a+c))+I/b/(exp(2* I*(a+c))-1)*ln(exp(2*I*(b*x+a))+1)-I/b/(exp(2*I*(a+c))-1)*ln(exp(2*I*(a+c) )+exp(2*I*(b*x+a)))*exp(2*I*(a+c))-I/b/(exp(2*I*(a+c))-1)*ln(exp(2*I*(a+c) )+exp(2*I*(b*x+a)))
Leaf count of result is larger than twice the leaf count of optimal. 145 vs. \(2 (35) = 70\).
Time = 0.27 (sec) , antiderivative size = 145, normalized size of antiderivative = 4.26 \[ \int \tan (c-b x) \tan (a+b x) \, dx=\frac {2 \, b x \sin \left (2 \, a + 2 \, c\right ) - {\left (\cos \left (2 \, a + 2 \, c\right ) + 1\right )} \log \left (-\frac {{\left (\cos \left (2 \, a + 2 \, c\right ) - 1\right )} \tan \left (b x + a\right )^{2} - 2 \, \sin \left (2 \, a + 2 \, c\right ) \tan \left (b x + a\right ) - \cos \left (2 \, a + 2 \, c\right ) - 1}{{\left (\cos \left (2 \, a + 2 \, c\right ) + 1\right )} \tan \left (b x + a\right )^{2} + \cos \left (2 \, a + 2 \, c\right ) + 1}\right ) + {\left (\cos \left (2 \, a + 2 \, c\right ) + 1\right )} \log \left (\frac {1}{\tan \left (b x + a\right )^{2} + 1}\right )}{2 \, b \sin \left (2 \, a + 2 \, c\right )} \]
1/2*(2*b*x*sin(2*a + 2*c) - (cos(2*a + 2*c) + 1)*log(-((cos(2*a + 2*c) - 1 )*tan(b*x + a)^2 - 2*sin(2*a + 2*c)*tan(b*x + a) - cos(2*a + 2*c) - 1)/((c os(2*a + 2*c) + 1)*tan(b*x + a)^2 + cos(2*a + 2*c) + 1)) + (cos(2*a + 2*c) + 1)*log(1/(tan(b*x + a)^2 + 1)))/(b*sin(2*a + 2*c))
Leaf count of result is larger than twice the leaf count of optimal. 2021 vs. \(2 (31) = 62\).
Time = 4.07 (sec) , antiderivative size = 7679, normalized size of antiderivative = 225.85 \[ \int \tan (c-b x) \tan (a+b x) \, dx=\text {Too large to display} \]
Piecewise((0, Eq(a, 0) & Eq(b, 0) & Eq(c, 0)), (-2*b*x*tan(c)/(2*b*tan(c)* *2 + 2*b) + 2*log(tan(b*x) + 1/tan(c))/(2*b*tan(c)**2 + 2*b) - log(tan(b*x )**2 + 1)/(2*b*tan(c)**2 + 2*b), Eq(a, 0)), (2*b*x*tan(a)/(2*b*tan(a)**2 + 2*b) + 2*log(tan(b*x) - 1/tan(a))/(2*b*tan(a)**2 + 2*b) - log(tan(b*x)**2 + 1)/(2*b*tan(a)**2 + 2*b), Eq(c, 0)), (-4*b*x*tan(c)**2*tan(b*x)/(2*b*ta n(c)**5*tan(b*x) + 2*b*tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b*tan(c)*tan(b*x) + 2*b) - 4*b*x*tan(c)/(2*b*tan(c)**5*tan(b*x) + 2*b* tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b*tan(c)*tan(b*x) + 2*b) - 2*log(tan(b*x) + 1/tan(c))*tan(c)**3*tan(b*x)/(2*b*tan(c)**5*tan(b *x) + 2*b*tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b*tan(c)* tan(b*x) + 2*b) - 2*log(tan(b*x) + 1/tan(c))*tan(c)**2/(2*b*tan(c)**5*tan( b*x) + 2*b*tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b*tan(c) *tan(b*x) + 2*b) + 2*log(tan(b*x) + 1/tan(c))*tan(c)*tan(b*x)/(2*b*tan(c)* *5*tan(b*x) + 2*b*tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b *tan(c)*tan(b*x) + 2*b) + 2*log(tan(b*x) + 1/tan(c))/(2*b*tan(c)**5*tan(b* x) + 2*b*tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b*tan(c)*t an(b*x) + 2*b) + log(tan(b*x)**2 + 1)*tan(c)**3*tan(b*x)/(2*b*tan(c)**5*ta n(b*x) + 2*b*tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b*tan( c)*tan(b*x) + 2*b) + log(tan(b*x)**2 + 1)*tan(c)**2/(2*b*tan(c)**5*tan(b*x ) + 2*b*tan(c)**4 + 4*b*tan(c)**3*tan(b*x) + 4*b*tan(c)**2 + 2*b*tan(c)...
Leaf count of result is larger than twice the leaf count of optimal. 290 vs. \(2 (35) = 70\).
Time = 0.22 (sec) , antiderivative size = 290, normalized size of antiderivative = 8.53 \[ \int \tan (c-b x) \tan (a+b x) \, dx=\frac {{\left (b \cos \left (2 \, a + 2 \, c\right )^{2} + b \sin \left (2 \, a + 2 \, c\right )^{2} - 2 \, b \cos \left (2 \, a + 2 \, c\right ) + b\right )} x - {\left (\cos \left (2 \, a + 2 \, c\right )^{2} + \sin \left (2 \, a + 2 \, c\right )^{2} - 1\right )} \arctan \left (\sin \left (2 \, b x\right ) - \sin \left (2 \, a\right ), \cos \left (2 \, b x\right ) + \cos \left (2 \, a\right )\right ) + {\left (\cos \left (2 \, a + 2 \, c\right )^{2} + \sin \left (2 \, a + 2 \, c\right )^{2} - 1\right )} \arctan \left (\sin \left (2 \, b x\right ) + \sin \left (2 \, c\right ), \cos \left (2 \, b x\right ) + \cos \left (2 \, c\right )\right ) + \log \left (\cos \left (2 \, b x\right )^{2} + 2 \, \cos \left (2 \, b x\right ) \cos \left (2 \, a\right ) + \cos \left (2 \, a\right )^{2} + \sin \left (2 \, b x\right )^{2} - 2 \, \sin \left (2 \, b x\right ) \sin \left (2 \, a\right ) + \sin \left (2 \, a\right )^{2}\right ) \sin \left (2 \, a + 2 \, c\right ) - \log \left (\cos \left (2 \, b x\right )^{2} + 2 \, \cos \left (2 \, b x\right ) \cos \left (2 \, c\right ) + \cos \left (2 \, c\right )^{2} + \sin \left (2 \, b x\right )^{2} + 2 \, \sin \left (2 \, b x\right ) \sin \left (2 \, c\right ) + \sin \left (2 \, c\right )^{2}\right ) \sin \left (2 \, a + 2 \, c\right )}{b \cos \left (2 \, a + 2 \, c\right )^{2} + b \sin \left (2 \, a + 2 \, c\right )^{2} - 2 \, b \cos \left (2 \, a + 2 \, c\right ) + b} \]
((b*cos(2*a + 2*c)^2 + b*sin(2*a + 2*c)^2 - 2*b*cos(2*a + 2*c) + b)*x - (c os(2*a + 2*c)^2 + sin(2*a + 2*c)^2 - 1)*arctan2(sin(2*b*x) - sin(2*a), cos (2*b*x) + cos(2*a)) + (cos(2*a + 2*c)^2 + sin(2*a + 2*c)^2 - 1)*arctan2(si n(2*b*x) + sin(2*c), cos(2*b*x) + cos(2*c)) + log(cos(2*b*x)^2 + 2*cos(2*b *x)*cos(2*a) + cos(2*a)^2 + sin(2*b*x)^2 - 2*sin(2*b*x)*sin(2*a) + sin(2*a )^2)*sin(2*a + 2*c) - log(cos(2*b*x)^2 + 2*cos(2*b*x)*cos(2*c) + cos(2*c)^ 2 + sin(2*b*x)^2 + 2*sin(2*b*x)*sin(2*c) + sin(2*c)^2)*sin(2*a + 2*c))/(b* cos(2*a + 2*c)^2 + b*sin(2*a + 2*c)^2 - 2*b*cos(2*a + 2*c) + b)
Leaf count of result is larger than twice the leaf count of optimal. 245 vs. \(2 (35) = 70\).
Time = 0.29 (sec) , antiderivative size = 245, normalized size of antiderivative = 7.21 \[ \int \tan (c-b x) \tan (a+b x) \, dx=\frac {2 \, b x - \frac {{\left (\tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right )^{2} - \tan \left (\frac {1}{2} \, a\right )^{3} - 4 \, \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right )\right )} \log \left ({\left | 2 \, \tan \left (b x\right ) \tan \left (\frac {1}{2} \, a\right ) + \tan \left (\frac {1}{2} \, a\right )^{2} - 1 \right |}\right )}{\tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right ) + \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - \tan \left (\frac {1}{2} \, a\right )^{2} - \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )} + \frac {{\left (\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - 4 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{2} - \tan \left (\frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, c\right )\right )} \log \left ({\left | 2 \, \tan \left (b x\right ) \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, c\right )^{2} + 1 \right |}\right )}{\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, c\right )^{2}}}{2 \, b} \]
1/2*(2*b*x - (tan(1/2*a)^3*tan(1/2*c)^2 - tan(1/2*a)^3 - 4*tan(1/2*a)^2*ta n(1/2*c) - tan(1/2*a)*tan(1/2*c)^2 + tan(1/2*a))*log(abs(2*tan(b*x)*tan(1/ 2*a) + tan(1/2*a)^2 - 1))/(tan(1/2*a)^3*tan(1/2*c) + tan(1/2*a)^2*tan(1/2* c)^2 - tan(1/2*a)^2 - tan(1/2*a)*tan(1/2*c)) + (tan(1/2*a)^2*tan(1/2*c)^3 - tan(1/2*a)^2*tan(1/2*c) - 4*tan(1/2*a)*tan(1/2*c)^2 - tan(1/2*c)^3 + tan (1/2*c))*log(abs(2*tan(b*x)*tan(1/2*c) - tan(1/2*c)^2 + 1))/(tan(1/2*a)^2* tan(1/2*c)^2 + tan(1/2*a)*tan(1/2*c)^3 - tan(1/2*a)*tan(1/2*c) - tan(1/2*c )^2))/b
Time = 31.88 (sec) , antiderivative size = 196, normalized size of antiderivative = 5.76 \[ \int \tan (c-b x) \tan (a+b x) \, dx=\frac {\frac {x}{2}+x\,\left ({\sin \left (a+c\right )}^2-\frac {1}{2}\right )}{{\sin \left (a+c\right )}^2}+\frac {\frac {\sin \left (2\,a+2\,c\right )\,\ln \left ({\sin \left (2\,a+2\,c\right )}^2\,2{}\mathrm {i}-{\sin \left (a+b\,x\right )}^2\,2{}\mathrm {i}+{\sin \left (3\,a+2\,c+b\,x\right )}^2\,2{}\mathrm {i}+\sin \left (4\,a+4\,c\right )+\sin \left (6\,a+4\,c+2\,b\,x\right )-\sin \left (2\,a+2\,b\,x\right )\right )}{2}-\frac {\sin \left (2\,a+2\,c\right )\,\ln \left ({\sin \left (2\,a+c+b\,x\right )}^2\,2{}\mathrm {i}+{\sin \left (2\,a+2\,c\right )}^2\,2{}\mathrm {i}-{\sin \left (c-b\,x\right )}^2\,2{}\mathrm {i}+\sin \left (4\,a+4\,c\right )+\sin \left (4\,a+2\,c+2\,b\,x\right )+\sin \left (2\,c-2\,b\,x\right )\right )}{2}}{b\,{\sin \left (a+c\right )}^2} \]
(x/2 + x*(sin(a + c)^2 - 1/2))/sin(a + c)^2 + ((sin(2*a + 2*c)*log(sin(4*a + 4*c) + sin(6*a + 4*c + 2*b*x) - sin(2*a + 2*b*x) + sin(2*a + 2*c)^2*2i - sin(a + b*x)^2*2i + sin(3*a + 2*c + b*x)^2*2i))/2 - (sin(2*a + 2*c)*log( sin(4*a + 4*c) + sin(4*a + 2*c + 2*b*x) + sin(2*c - 2*b*x) + sin(2*a + c + b*x)^2*2i + sin(2*a + 2*c)^2*2i - sin(c - b*x)^2*2i))/2)/(b*sin(a + c)^2)