Integrand size = 12, antiderivative size = 73 \[ \int x^2 \tan ^2(a+b x) \, dx=-\frac {i x^2}{b}-\frac {x^3}{3}+\frac {2 x \log \left (1+e^{2 i (a+b x)}\right )}{b^2}-\frac {i \operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{b^3}+\frac {x^2 \tan (a+b x)}{b} \] Output:
-I*x^2/b-1/3*x^3+2*x*ln(1+exp(2*I*(b*x+a)))/b^2-I*polylog(2,-exp(2*I*(b*x+ a)))/b^3+x^2*tan(b*x+a)/b
Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(160\) vs. \(2(73)=146\).
Time = 4.55 (sec) , antiderivative size = 160, normalized size of antiderivative = 2.19 \[ \int x^2 \tan ^2(a+b x) \, dx=-\frac {x^3}{3}+\frac {x^2 \sec (a) \sec (a+b x) \sin (b x)}{b}+\frac {i b x (\pi +2 \arctan (\cot (a)))+\pi \log \left (1+e^{-2 i b x}\right )+2 (b x-\arctan (\cot (a))) \log \left (1-e^{2 i (b x-\arctan (\cot (a)))}\right )-\pi \log (\cos (b x))+2 \arctan (\cot (a)) \log (\sin (b x-\arctan (\cot (a))))-i \operatorname {PolyLog}\left (2,e^{2 i (b x-\arctan (\cot (a)))}\right )+b^2 e^{-i \arctan (\cot (a))} x^2 \sqrt {\csc ^2(a)} \tan (a)}{b^3} \] Input:
Integrate[x^2*Tan[a + b*x]^2,x]
Output:
-1/3*x^3 + (x^2*Sec[a]*Sec[a + b*x]*Sin[b*x])/b + (I*b*x*(Pi + 2*ArcTan[Co t[a]]) + Pi*Log[1 + E^((-2*I)*b*x)] + 2*(b*x - ArcTan[Cot[a]])*Log[1 - E^( (2*I)*(b*x - ArcTan[Cot[a]]))] - Pi*Log[Cos[b*x]] + 2*ArcTan[Cot[a]]*Log[S in[b*x - ArcTan[Cot[a]]]] - I*PolyLog[2, E^((2*I)*(b*x - ArcTan[Cot[a]]))] + (b^2*x^2*Sqrt[Csc[a]^2]*Tan[a])/E^(I*ArcTan[Cot[a]]))/b^3
Time = 0.43 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.19, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.667, Rules used = {3042, 4203, 15, 3042, 4202, 2620, 2715, 2838}
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 x^2 \tan ^2(a+b x) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int x^2 \tan (a+b x)^2dx\) |
\(\Big \downarrow \) 4203 |
\(\displaystyle -\frac {2 \int x \tan (a+b x)dx}{b}-\int x^2dx+\frac {x^2 \tan (a+b x)}{b}\) |
\(\Big \downarrow \) 15 |
\(\displaystyle -\frac {2 \int x \tan (a+b x)dx}{b}+\frac {x^2 \tan (a+b x)}{b}-\frac {x^3}{3}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {2 \int x \tan (a+b x)dx}{b}+\frac {x^2 \tan (a+b x)}{b}-\frac {x^3}{3}\) |
\(\Big \downarrow \) 4202 |
\(\displaystyle -\frac {2 \left (\frac {i x^2}{2}-2 i \int \frac {e^{2 i (a+b x)} x}{1+e^{2 i (a+b x)}}dx\right )}{b}+\frac {x^2 \tan (a+b x)}{b}-\frac {x^3}{3}\) |
\(\Big \downarrow \) 2620 |
\(\displaystyle -\frac {2 \left (\frac {i x^2}{2}-2 i \left (\frac {i \int \log \left (1+e^{2 i (a+b x)}\right )dx}{2 b}-\frac {i x \log \left (1+e^{2 i (a+b x)}\right )}{2 b}\right )\right )}{b}+\frac {x^2 \tan (a+b x)}{b}-\frac {x^3}{3}\) |
\(\Big \downarrow \) 2715 |
\(\displaystyle -\frac {2 \left (\frac {i x^2}{2}-2 i \left (\frac {\int e^{-2 i (a+b x)} \log \left (1+e^{2 i (a+b x)}\right )de^{2 i (a+b x)}}{4 b^2}-\frac {i x \log \left (1+e^{2 i (a+b x)}\right )}{2 b}\right )\right )}{b}+\frac {x^2 \tan (a+b x)}{b}-\frac {x^3}{3}\) |
\(\Big \downarrow \) 2838 |
\(\displaystyle -\frac {2 \left (\frac {i x^2}{2}-2 i \left (-\frac {\operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{4 b^2}-\frac {i x \log \left (1+e^{2 i (a+b x)}\right )}{2 b}\right )\right )}{b}+\frac {x^2 \tan (a+b x)}{b}-\frac {x^3}{3}\) |
Input:
Int[x^2*Tan[a + b*x]^2,x]
Output:
-1/3*x^3 - (2*((I/2)*x^2 - (2*I)*(((-1/2*I)*x*Log[1 + E^((2*I)*(a + b*x))] )/b - PolyLog[2, -E^((2*I)*(a + b*x))]/(4*b^2))))/b + (x^2*Tan[a + b*x])/b
Int[(a_.)*(x_)^(m_.), x_Symbol] :> Simp[a*(x^(m + 1)/(m + 1)), x] /; FreeQ[ {a, m}, x] && NeQ[m, -1]
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ ((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp [((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si mp[d*(m/(b*f*g*n*Log[F])) Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x )))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Simp[1/(d*e*n*Log[F]) Subst[Int[Log[a + b*x]/x, x], x, (F^(e*(c + d*x) ))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 , (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[I *((c + d*x)^(m + 1)/(d*(m + 1))), x] - Simp[2*I Int[(c + d*x)^m*(E^(2*I*( e + f*x))/(1 + E^(2*I*(e + f*x)))), x], x] /; FreeQ[{c, d, e, f}, x] && IGt Q[m, 0]
Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symb ol] :> Simp[b*(c + d*x)^m*((b*Tan[e + f*x])^(n - 1)/(f*(n - 1))), x] + (-Si mp[b*d*(m/(f*(n - 1))) Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1), x] , x] - Simp[b^2 Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; Free Q[{b, c, d, e, f}, x] && GtQ[n, 1] && GtQ[m, 0]
Time = 0.31 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.48
method | result | size |
risch | \(-\frac {x^{3}}{3}+\frac {2 i x^{2}}{b \left (1+{\mathrm e}^{2 i \left (b x +a \right )}\right )}-\frac {2 i x^{2}}{b}-\frac {4 i a x}{b^{2}}-\frac {2 i a^{2}}{b^{3}}+\frac {2 x \ln \left (1+{\mathrm e}^{2 i \left (b x +a \right )}\right )}{b^{2}}-\frac {i \operatorname {polylog}\left (2, -{\mathrm e}^{2 i \left (b x +a \right )}\right )}{b^{3}}+\frac {4 a \ln \left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}\) | \(108\) |
Input:
int(x^2*tan(b*x+a)^2,x,method=_RETURNVERBOSE)
Output:
-1/3*x^3+2*I*x^2/b/(1+exp(2*I*(b*x+a)))-2*I/b*x^2-4*I/b^2*a*x-2*I/b^3*a^2+ 2*x*ln(1+exp(2*I*(b*x+a)))/b^2-I*polylog(2,-exp(2*I*(b*x+a)))/b^3+4/b^3*a* ln(exp(I*(b*x+a)))
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 144 vs. \(2 (62) = 124\).
Time = 0.08 (sec) , antiderivative size = 144, normalized size of antiderivative = 1.97 \[ \int x^2 \tan ^2(a+b x) \, dx=-\frac {2 \, b^{3} x^{3} - 6 \, b^{2} x^{2} \tan \left (b x + a\right ) - 6 \, b x \log \left (-\frac {2 \, {\left (i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1}\right ) - 6 \, b x \log \left (-\frac {2 \, {\left (-i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1}\right ) - 3 i \, {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1} + 1\right ) + 3 i \, {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1} + 1\right )}{6 \, b^{3}} \] Input:
integrate(x^2*tan(b*x+a)^2,x, algorithm="fricas")
Output:
-1/6*(2*b^3*x^3 - 6*b^2*x^2*tan(b*x + a) - 6*b*x*log(-2*(I*tan(b*x + a) - 1)/(tan(b*x + a)^2 + 1)) - 6*b*x*log(-2*(-I*tan(b*x + a) - 1)/(tan(b*x + a )^2 + 1)) - 3*I*dilog(2*(I*tan(b*x + a) - 1)/(tan(b*x + a)^2 + 1) + 1) + 3 *I*dilog(2*(-I*tan(b*x + a) - 1)/(tan(b*x + a)^2 + 1) + 1))/b^3
\[ \int x^2 \tan ^2(a+b x) \, dx=\int x^{2} \tan ^{2}{\left (a + b x \right )}\, dx \] Input:
integrate(x**2*tan(b*x+a)**2,x)
Output:
Integral(x**2*tan(a + b*x)**2, x)
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 257 vs. \(2 (62) = 124\).
Time = 0.24 (sec) , antiderivative size = 257, normalized size of antiderivative = 3.52 \[ \int x^2 \tan ^2(a+b x) \, dx=\frac {i \, b^{3} x^{3} + 6 \, {\left (b x \cos \left (2 \, b x + 2 \, a\right ) + i \, b x \sin \left (2 \, b x + 2 \, a\right ) + b x\right )} \arctan \left (\sin \left (2 \, b x + 2 \, a\right ), \cos \left (2 \, b x + 2 \, a\right ) + 1\right ) + {\left (i \, b^{3} x^{3} - 6 \, b^{2} x^{2}\right )} \cos \left (2 \, b x + 2 \, a\right ) - 3 \, {\left (\cos \left (2 \, b x + 2 \, a\right ) + i \, \sin \left (2 \, b x + 2 \, a\right ) + 1\right )} {\rm Li}_2\left (-e^{\left (2 i \, b x + 2 i \, a\right )}\right ) - 3 \, {\left (i \, b x \cos \left (2 \, b x + 2 \, a\right ) - b x \sin \left (2 \, b x + 2 \, a\right ) + i \, b x\right )} \log \left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} + 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right ) - {\left (b^{3} x^{3} + 6 i \, b^{2} x^{2}\right )} \sin \left (2 \, b x + 2 \, a\right )}{-3 i \, b^{3} \cos \left (2 \, b x + 2 \, a\right ) + 3 \, b^{3} \sin \left (2 \, b x + 2 \, a\right ) - 3 i \, b^{3}} \] Input:
integrate(x^2*tan(b*x+a)^2,x, algorithm="maxima")
Output:
(I*b^3*x^3 + 6*(b*x*cos(2*b*x + 2*a) + I*b*x*sin(2*b*x + 2*a) + b*x)*arcta n2(sin(2*b*x + 2*a), cos(2*b*x + 2*a) + 1) + (I*b^3*x^3 - 6*b^2*x^2)*cos(2 *b*x + 2*a) - 3*(cos(2*b*x + 2*a) + I*sin(2*b*x + 2*a) + 1)*dilog(-e^(2*I* b*x + 2*I*a)) - 3*(I*b*x*cos(2*b*x + 2*a) - b*x*sin(2*b*x + 2*a) + I*b*x)* log(cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 + 2*cos(2*b*x + 2*a) + 1) - (b ^3*x^3 + 6*I*b^2*x^2)*sin(2*b*x + 2*a))/(-3*I*b^3*cos(2*b*x + 2*a) + 3*b^3 *sin(2*b*x + 2*a) - 3*I*b^3)
\[ \int x^2 \tan ^2(a+b x) \, dx=\int { x^{2} \tan \left (b x + a\right )^{2} \,d x } \] Input:
integrate(x^2*tan(b*x+a)^2,x, algorithm="giac")
Output:
integrate(x^2*tan(b*x + a)^2, x)
Timed out. \[ \int x^2 \tan ^2(a+b x) \, dx=\int x^2\,{\mathrm {tan}\left (a+b\,x\right )}^2 \,d x \] Input:
int(x^2*tan(a + b*x)^2,x)
Output:
int(x^2*tan(a + b*x)^2, x)
\[ \int x^2 \tan ^2(a+b x) \, dx=\frac {-6 \left (\int \tan \left (b x +a \right ) x d x \right )+3 \tan \left (b x +a \right ) x^{2}-b \,x^{3}}{3 b} \] Input:
int(x^2*tan(b*x+a)^2,x)
Output:
( - 6*int(tan(a + b*x)*x,x) + 3*tan(a + b*x)*x**2 - b*x**3)/(3*b)