Integrand size = 16, antiderivative size = 96 \[ \int (c+d x)^2 \tan ^2(a+b x) \, dx=-\frac {i (c+d x)^2}{b}-\frac {(c+d x)^3}{3 d}+\frac {2 d (c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{b^2}-\frac {i d^2 \operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{b^3}+\frac {(c+d x)^2 \tan (a+b x)}{b} \] Output:
-I*(d*x+c)^2/b-1/3*(d*x+c)^3/d+2*d*(d*x+c)*ln(1+exp(2*I*(b*x+a)))/b^2-I*d^ 2*polylog(2,-exp(2*I*(b*x+a)))/b^3+(d*x+c)^2*tan(b*x+a)/b
Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(203\) vs. \(2(96)=192\).
Time = 5.38 (sec) , antiderivative size = 203, normalized size of antiderivative = 2.11 \[ \int (c+d x)^2 \tan ^2(a+b x) \, dx=-\frac {1}{3} x \left (3 c^2+3 c d x+d^2 x^2\right )+\frac {(c+d x)^2 \sec (a) \sec (a+b x) \sin (b x)}{b}+\frac {2 c d (\log (\cos (a+b x))+b x \tan (a))}{b^2}+\frac {d^2 \left (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)\right )}{b^3} \] Input:
Integrate[(c + d*x)^2*Tan[a + b*x]^2,x]
Output:
-1/3*(x*(3*c^2 + 3*c*d*x + d^2*x^2)) + ((c + d*x)^2*Sec[a]*Sec[a + b*x]*Si n[b*x])/b + (2*c*d*(Log[Cos[a + b*x]] + b*x*Tan[a]))/b^2 + (d^2*(I*b*x*(Pi + 2*ArcTan[Cot[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[Sin[b*x - ArcTan[Cot[a]]]] - I*PolyLog[2, E^((2*I)*(b*x - Arc Tan[Cot[a]]))] + (b^2*x^2*Sqrt[Csc[a]^2]*Tan[a])/E^(I*ArcTan[Cot[a]])))/b^ 3
Time = 0.48 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.16, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3042, 4203, 17, 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 (c+d x)^2 \tan ^2(a+b x) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (c+d x)^2 \tan (a+b x)^2dx\) |
\(\Big \downarrow \) 4203 |
\(\displaystyle -\frac {2 d \int (c+d x) \tan (a+b x)dx}{b}-\int (c+d x)^2dx+\frac {(c+d x)^2 \tan (a+b x)}{b}\) |
\(\Big \downarrow \) 17 |
\(\displaystyle -\frac {2 d \int (c+d x) \tan (a+b x)dx}{b}+\frac {(c+d x)^2 \tan (a+b x)}{b}-\frac {(c+d x)^3}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {2 d \int (c+d x) \tan (a+b x)dx}{b}+\frac {(c+d x)^2 \tan (a+b x)}{b}-\frac {(c+d x)^3}{3 d}\) |
\(\Big \downarrow \) 4202 |
\(\displaystyle -\frac {2 d \left (\frac {i (c+d x)^2}{2 d}-2 i \int \frac {e^{2 i (a+b x)} (c+d x)}{1+e^{2 i (a+b x)}}dx\right )}{b}+\frac {(c+d x)^2 \tan (a+b x)}{b}-\frac {(c+d x)^3}{3 d}\) |
\(\Big \downarrow \) 2620 |
\(\displaystyle -\frac {2 d \left (\frac {i (c+d x)^2}{2 d}-2 i \left (\frac {i d \int \log \left (1+e^{2 i (a+b x)}\right )dx}{2 b}-\frac {i (c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{2 b}\right )\right )}{b}+\frac {(c+d x)^2 \tan (a+b x)}{b}-\frac {(c+d x)^3}{3 d}\) |
\(\Big \downarrow \) 2715 |
\(\displaystyle -\frac {2 d \left (\frac {i (c+d x)^2}{2 d}-2 i \left (\frac {d \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 (c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{2 b}\right )\right )}{b}+\frac {(c+d x)^2 \tan (a+b x)}{b}-\frac {(c+d x)^3}{3 d}\) |
\(\Big \downarrow \) 2838 |
\(\displaystyle -\frac {2 d \left (\frac {i (c+d x)^2}{2 d}-2 i \left (-\frac {d \operatorname {PolyLog}\left (2,-e^{2 i (a+b x)}\right )}{4 b^2}-\frac {i (c+d x) \log \left (1+e^{2 i (a+b x)}\right )}{2 b}\right )\right )}{b}+\frac {(c+d x)^2 \tan (a+b x)}{b}-\frac {(c+d x)^3}{3 d}\) |
Input:
Int[(c + d*x)^2*Tan[a + b*x]^2,x]
Output:
-1/3*(c + d*x)^3/d - (2*d*(((I/2)*(c + d*x)^2)/d - (2*I)*(((-1/2*I)*(c + d *x)*Log[1 + E^((2*I)*(a + b*x))])/b - (d*PolyLog[2, -E^((2*I)*(a + b*x))]) /(4*b^2))))/b + ((c + d*x)^2*Tan[a + b*x])/b
Int[(c_.)*((a_.) + (b_.)*(x_))^(m_.), x_Symbol] :> Simp[c*((a + b*x)^(m + 1 )/(b*(m + 1))), x] /; FreeQ[{a, b, c, 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]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 198 vs. \(2 (88 ) = 176\).
Time = 0.49 (sec) , antiderivative size = 199, normalized size of antiderivative = 2.07
method | result | size |
risch | \(-\frac {d^{2} x^{3}}{3}-c d \,x^{2}-c^{2} x -\frac {c^{3}}{3 d}+\frac {2 i \left (x^{2} d^{2}+2 c d x +c^{2}\right )}{b \left ({\mathrm e}^{2 i \left (b x +a \right )}+1\right )}+\frac {2 d c \ln \left ({\mathrm e}^{2 i \left (b x +a \right )}+1\right )}{b^{2}}-\frac {4 d c \ln \left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{2}}-\frac {2 i d^{2} x^{2}}{b}-\frac {4 i d^{2} a x}{b^{2}}-\frac {2 i d^{2} a^{2}}{b^{3}}+\frac {2 d^{2} \ln \left ({\mathrm e}^{2 i \left (b x +a \right )}+1\right ) x}{b^{2}}-\frac {i d^{2} \operatorname {polylog}\left (2, -{\mathrm e}^{2 i \left (b x +a \right )}\right )}{b^{3}}+\frac {4 d^{2} a \ln \left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{3}}\) | \(199\) |
Input:
int((d*x+c)^2*tan(b*x+a)^2,x,method=_RETURNVERBOSE)
Output:
-1/3*d^2*x^3-c*d*x^2-c^2*x-1/3/d*c^3+2*I*(d^2*x^2+2*c*d*x+c^2)/b/(exp(2*I* (b*x+a))+1)+2*d/b^2*c*ln(exp(2*I*(b*x+a))+1)-4*d/b^2*c*ln(exp(I*(b*x+a)))- 2*I*d^2/b*x^2-4*I*d^2/b^2*a*x-2*I*d^2/b^3*a^2+2*d^2/b^2*ln(exp(2*I*(b*x+a) )+1)*x-I*d^2*polylog(2,-exp(2*I*(b*x+a)))/b^3+4*d^2/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. 210 vs. \(2 (85) = 170\).
Time = 0.07 (sec) , antiderivative size = 210, normalized size of antiderivative = 2.19 \[ \int (c+d x)^2 \tan ^2(a+b x) \, dx=-\frac {2 \, b^{3} d^{2} x^{3} + 6 \, b^{3} c d x^{2} + 6 \, b^{3} c^{2} x - 3 i \, d^{2} {\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 \, d^{2} {\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 \, {\left (b d^{2} x + b c d\right )} \log \left (-\frac {2 \, {\left (i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1}\right ) - 6 \, {\left (b d^{2} x + b c d\right )} \log \left (-\frac {2 \, {\left (-i \, \tan \left (b x + a\right ) - 1\right )}}{\tan \left (b x + a\right )^{2} + 1}\right ) - 6 \, {\left (b^{2} d^{2} x^{2} + 2 \, b^{2} c d x + b^{2} c^{2}\right )} \tan \left (b x + a\right )}{6 \, b^{3}} \] Input:
integrate((d*x+c)^2*tan(b*x+a)^2,x, algorithm="fricas")
Output:
-1/6*(2*b^3*d^2*x^3 + 6*b^3*c*d*x^2 + 6*b^3*c^2*x - 3*I*d^2*dilog(2*(I*tan (b*x + a) - 1)/(tan(b*x + a)^2 + 1) + 1) + 3*I*d^2*dilog(2*(-I*tan(b*x + a ) - 1)/(tan(b*x + a)^2 + 1) + 1) - 6*(b*d^2*x + b*c*d)*log(-2*(I*tan(b*x + a) - 1)/(tan(b*x + a)^2 + 1)) - 6*(b*d^2*x + b*c*d)*log(-2*(-I*tan(b*x + a) - 1)/(tan(b*x + a)^2 + 1)) - 6*(b^2*d^2*x^2 + 2*b^2*c*d*x + b^2*c^2)*ta n(b*x + a))/b^3
\[ \int (c+d x)^2 \tan ^2(a+b x) \, dx=\int \left (c + d x\right )^{2} \tan ^{2}{\left (a + b x \right )}\, dx \] Input:
integrate((d*x+c)**2*tan(b*x+a)**2,x)
Output:
Integral((c + d*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. 418 vs. \(2 (85) = 170\).
Time = 0.30 (sec) , antiderivative size = 418, normalized size of antiderivative = 4.35 \[ \int (c+d x)^2 \tan ^2(a+b x) \, dx=\frac {i \, b^{3} d^{2} x^{3} + 3 i \, b^{3} c d x^{2} + 3 i \, b^{3} c^{2} x + 6 \, b^{2} c^{2} + 6 \, {\left (b d^{2} x + b c d + {\left (b d^{2} x + b c d\right )} \cos \left (2 \, b x + 2 \, a\right ) - {\left (-i \, b d^{2} x - i \, b c d\right )} \sin \left (2 \, b x + 2 \, a\right )\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} d^{2} x^{3} - 3 \, {\left (-i \, b^{3} c d + 2 \, b^{2} d^{2}\right )} x^{2} - 3 \, {\left (-i \, b^{3} c^{2} + 4 \, b^{2} c d\right )} x\right )} \cos \left (2 \, b x + 2 \, a\right ) - 3 \, {\left (d^{2} \cos \left (2 \, b x + 2 \, a\right ) + i \, d^{2} \sin \left (2 \, b x + 2 \, a\right ) + d^{2}\right )} {\rm Li}_2\left (-e^{\left (2 i \, b x + 2 i \, a\right )}\right ) - 3 \, {\left (i \, b d^{2} x + i \, b c d + {\left (i \, b d^{2} x + i \, b c d\right )} \cos \left (2 \, b x + 2 \, a\right ) - {\left (b d^{2} x + b c d\right )} \sin \left (2 \, b x + 2 \, a\right )\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} d^{2} x^{3} + 3 \, {\left (b^{3} c d + 2 i \, b^{2} d^{2}\right )} x^{2} + 3 \, {\left (b^{3} c^{2} + 4 i \, b^{2} c d\right )} x\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((d*x+c)^2*tan(b*x+a)^2,x, algorithm="maxima")
Output:
(I*b^3*d^2*x^3 + 3*I*b^3*c*d*x^2 + 3*I*b^3*c^2*x + 6*b^2*c^2 + 6*(b*d^2*x + b*c*d + (b*d^2*x + b*c*d)*cos(2*b*x + 2*a) - (-I*b*d^2*x - I*b*c*d)*sin( 2*b*x + 2*a))*arctan2(sin(2*b*x + 2*a), cos(2*b*x + 2*a) + 1) + (I*b^3*d^2 *x^3 - 3*(-I*b^3*c*d + 2*b^2*d^2)*x^2 - 3*(-I*b^3*c^2 + 4*b^2*c*d)*x)*cos( 2*b*x + 2*a) - 3*(d^2*cos(2*b*x + 2*a) + I*d^2*sin(2*b*x + 2*a) + d^2)*dil og(-e^(2*I*b*x + 2*I*a)) - 3*(I*b*d^2*x + I*b*c*d + (I*b*d^2*x + I*b*c*d)* cos(2*b*x + 2*a) - (b*d^2*x + b*c*d)*sin(2*b*x + 2*a))*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*d^2*x^3 + 3*(b^3 *c*d + 2*I*b^2*d^2)*x^2 + 3*(b^3*c^2 + 4*I*b^2*c*d)*x)*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 (c+d x)^2 \tan ^2(a+b x) \, dx=\int { {\left (d x + c\right )}^{2} \tan \left (b x + a\right )^{2} \,d x } \] Input:
integrate((d*x+c)^2*tan(b*x+a)^2,x, algorithm="giac")
Output:
integrate((d*x + c)^2*tan(b*x + a)^2, x)
Timed out. \[ \int (c+d x)^2 \tan ^2(a+b x) \, dx=\int {\mathrm {tan}\left (a+b\,x\right )}^2\,{\left (c+d\,x\right )}^2 \,d x \] Input:
int(tan(a + b*x)^2*(c + d*x)^2,x)
Output:
int(tan(a + b*x)^2*(c + d*x)^2, x)
\[ \int (c+d x)^2 \tan ^2(a+b x) \, dx=\frac {-6 \left (\int \tan \left (b x +a \right ) x d x \right ) b \,d^{2}-3 \,\mathrm {log}\left (\tan \left (b x +a \right )^{2}+1\right ) c d +3 \tan \left (b x +a \right ) b \,c^{2}+6 \tan \left (b x +a \right ) b c d x +3 \tan \left (b x +a \right ) b \,d^{2} x^{2}-3 b^{2} c^{2} x -3 b^{2} c d \,x^{2}-b^{2} d^{2} x^{3}}{3 b^{2}} \] Input:
int((d*x+c)^2*tan(b*x+a)^2,x)
Output:
( - 6*int(tan(a + b*x)*x,x)*b*d**2 - 3*log(tan(a + b*x)**2 + 1)*c*d + 3*ta n(a + b*x)*b*c**2 + 6*tan(a + b*x)*b*c*d*x + 3*tan(a + b*x)*b*d**2*x**2 - 3*b**2*c**2*x - 3*b**2*c*d*x**2 - b**2*d**2*x**3)/(3*b**2)