\(\int x^3 (a+b \tan (c+d x^2))^2 \, dx\) [7]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [F]
Fricas [A] (verification not implemented)
Sympy [F]
Maxima [B] (verification not implemented)
Giac [F]
Mupad [F(-1)]
Reduce [F]

Optimal result

Integrand size = 18, antiderivative size = 126 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {a^2 x^4}{4}+\frac {1}{2} i a b x^4-\frac {b^2 x^4}{4}-\frac {a b x^2 \log \left (1+e^{2 i \left (c+d x^2\right )}\right )}{d}+\frac {b^2 \log \left (\cos \left (c+d x^2\right )\right )}{2 d^2}+\frac {i a b \operatorname {PolyLog}\left (2,-e^{2 i \left (c+d x^2\right )}\right )}{2 d^2}+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{2 d} \] Output:

1/4*a^2*x^4+1/2*I*a*b*x^4-1/4*b^2*x^4-a*b*x^2*ln(1+exp(2*I*(d*x^2+c)))/d+1 
/2*b^2*ln(cos(d*x^2+c))/d^2+1/2*I*a*b*polylog(2,-exp(2*I*(d*x^2+c)))/d^2+1 
/2*b^2*x^2*tan(d*x^2+c)/d
 

Mathematica [A] (verified)

Time = 4.73 (sec) , antiderivative size = 236, normalized size of antiderivative = 1.87 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {\sec (c) \left (-2 a b \cos (c) \left (i d x^2 (\pi +2 \arctan (\cot (c)))+\pi \log \left (1+e^{-2 i d x^2}\right )+2 \left (d x^2-\arctan (\cot (c))\right ) \log \left (1-e^{2 i \left (d x^2-\arctan (\cot (c))\right )}\right )-\pi \log \left (\cos \left (d x^2\right )\right )+2 \arctan (\cot (c)) \log \left (\sin \left (d x^2-\arctan (\cot (c))\right )\right )-i \operatorname {PolyLog}\left (2,e^{2 i \left (d x^2-\arctan (\cot (c))\right )}\right )\right )-2 a b d^2 e^{-i \arctan (\cot (c))} x^4 \sqrt {\csc ^2(c)} \sin (c)+d^2 x^4 \left (\left (a^2-b^2\right ) \cos (c)+2 a b \sin (c)\right )+2 b^2 \left (\cos (c) \log \left (\cos \left (c+d x^2\right )\right )+d x^2 \sin (c)\right )+2 b^2 d x^2 \sec \left (c+d x^2\right ) \sin \left (d x^2\right )\right )}{4 d^2} \] Input:

Integrate[x^3*(a + b*Tan[c + d*x^2])^2,x]
 

Output:

(Sec[c]*(-2*a*b*Cos[c]*(I*d*x^2*(Pi + 2*ArcTan[Cot[c]]) + Pi*Log[1 + E^((- 
2*I)*d*x^2)] + 2*(d*x^2 - ArcTan[Cot[c]])*Log[1 - E^((2*I)*(d*x^2 - ArcTan 
[Cot[c]]))] - Pi*Log[Cos[d*x^2]] + 2*ArcTan[Cot[c]]*Log[Sin[d*x^2 - ArcTan 
[Cot[c]]]] - I*PolyLog[2, E^((2*I)*(d*x^2 - ArcTan[Cot[c]]))]) - (2*a*b*d^ 
2*x^4*Sqrt[Csc[c]^2]*Sin[c])/E^(I*ArcTan[Cot[c]]) + d^2*x^4*((a^2 - b^2)*C 
os[c] + 2*a*b*Sin[c]) + 2*b^2*(Cos[c]*Log[Cos[c + d*x^2]] + d*x^2*Sin[c]) 
+ 2*b^2*d*x^2*Sec[c + d*x^2]*Sin[d*x^2]))/(4*d^2)
 

Rubi [A] (verified)

Time = 0.44 (sec) , antiderivative size = 120, normalized size of antiderivative = 0.95, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.222, Rules used = {4234, 3042, 4205, 2009}

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^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx\)

\(\Big \downarrow \) 4234

\(\displaystyle \frac {1}{2} \int x^2 \left (a+b \tan \left (d x^2+c\right )\right )^2dx^2\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {1}{2} \int x^2 \left (a+b \tan \left (d x^2+c\right )\right )^2dx^2\)

\(\Big \downarrow \) 4205

\(\displaystyle \frac {1}{2} \int \left (a^2 x^2+b^2 \tan ^2\left (d x^2+c\right ) x^2+2 a b \tan \left (d x^2+c\right ) x^2\right )dx^2\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {1}{2} \left (\frac {a^2 x^4}{2}+\frac {i a b \operatorname {PolyLog}\left (2,-e^{2 i \left (d x^2+c\right )}\right )}{d^2}-\frac {2 a b x^2 \log \left (1+e^{2 i \left (c+d x^2\right )}\right )}{d}+i a b x^4+\frac {b^2 \log \left (\cos \left (c+d x^2\right )\right )}{d^2}+\frac {b^2 x^2 \tan \left (c+d x^2\right )}{d}-\frac {b^2 x^4}{2}\right )\)

Input:

Int[x^3*(a + b*Tan[c + d*x^2])^2,x]
 

Output:

((a^2*x^4)/2 + I*a*b*x^4 - (b^2*x^4)/2 - (2*a*b*x^2*Log[1 + E^((2*I)*(c + 
d*x^2))])/d + (b^2*Log[Cos[c + d*x^2]])/d^2 + (I*a*b*PolyLog[2, -E^((2*I)* 
(c + d*x^2))])/d^2 + (b^2*x^2*Tan[c + d*x^2])/d)/2
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4205
Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, (a + b*Tan[e + f*x])^n, x], 
 x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]
 

rule 4234
Int[(x_)^(m_.)*((a_.) + (b_.)*Tan[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x_Symbol 
] :> Simp[1/n   Subst[Int[x^(Simplify[(m + 1)/n] - 1)*(a + b*Tan[c + d*x])^ 
p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IGtQ[Simplify[(m + 
 1)/n], 0] && IntegerQ[p]
 
Maple [F]

\[\int x^{3} {\left (a +b \tan \left (d \,x^{2}+c \right )\right )}^{2}d x\]

Input:

int(x^3*(a+b*tan(d*x^2+c))^2,x)
 

Output:

int(x^3*(a+b*tan(d*x^2+c))^2,x)
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.58 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {{\left (a^{2} - b^{2}\right )} d^{2} x^{4} + 2 \, b^{2} d x^{2} \tan \left (d x^{2} + c\right ) - i \, a b {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1} + 1\right ) + i \, a b {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1} + 1\right ) - {\left (2 \, a b d x^{2} - b^{2}\right )} \log \left (-\frac {2 \, {\left (i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1}\right ) - {\left (2 \, a b d x^{2} - b^{2}\right )} \log \left (-\frac {2 \, {\left (-i \, \tan \left (d x^{2} + c\right ) - 1\right )}}{\tan \left (d x^{2} + c\right )^{2} + 1}\right )}{4 \, d^{2}} \] Input:

integrate(x^3*(a+b*tan(d*x^2+c))^2,x, algorithm="fricas")
 

Output:

1/4*((a^2 - b^2)*d^2*x^4 + 2*b^2*d*x^2*tan(d*x^2 + c) - I*a*b*dilog(2*(I*t 
an(d*x^2 + c) - 1)/(tan(d*x^2 + c)^2 + 1) + 1) + I*a*b*dilog(2*(-I*tan(d*x 
^2 + c) - 1)/(tan(d*x^2 + c)^2 + 1) + 1) - (2*a*b*d*x^2 - b^2)*log(-2*(I*t 
an(d*x^2 + c) - 1)/(tan(d*x^2 + c)^2 + 1)) - (2*a*b*d*x^2 - b^2)*log(-2*(- 
I*tan(d*x^2 + c) - 1)/(tan(d*x^2 + c)^2 + 1)))/d^2
 

Sympy [F]

\[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\int x^{3} \left (a + b \tan {\left (c + d x^{2} \right )}\right )^{2}\, dx \] Input:

integrate(x**3*(a+b*tan(d*x**2+c))**2,x)
 

Output:

Integral(x**3*(a + b*tan(c + d*x**2))**2, x)
 

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 398 vs. \(2 (105) = 210\).

Time = 0.12 (sec) , antiderivative size = 398, normalized size of antiderivative = 3.16 \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {1}{4} \, a^{2} x^{4} + \frac {{\left (2 \, a b + i \, b^{2}\right )} d^{2} x^{4} - 2 \, {\left (2 \, a b d x^{2} - b^{2} + {\left (2 \, a b d x^{2} - b^{2}\right )} \cos \left (2 \, d x^{2} + 2 \, c\right ) - {\left (-2 i \, a b d x^{2} + i \, b^{2}\right )} \sin \left (2 \, d x^{2} + 2 \, c\right )\right )} \arctan \left (\sin \left (2 \, d x^{2} + 2 \, c\right ), \cos \left (2 \, d x^{2} + 2 \, c\right ) + 1\right ) + {\left ({\left (2 \, a b + i \, b^{2}\right )} d^{2} x^{4} - 4 \, b^{2} d x^{2}\right )} \cos \left (2 \, d x^{2} + 2 \, c\right ) + 2 \, {\left (a b \cos \left (2 \, d x^{2} + 2 \, c\right ) + i \, a b \sin \left (2 \, d x^{2} + 2 \, c\right ) + a b\right )} {\rm Li}_2\left (-e^{\left (2 i \, d x^{2} + 2 i \, c\right )}\right ) - {\left (-2 i \, a b d x^{2} + i \, b^{2} + {\left (-2 i \, a b d x^{2} + i \, b^{2}\right )} \cos \left (2 \, d x^{2} + 2 \, c\right ) + {\left (2 \, a b d x^{2} - b^{2}\right )} \sin \left (2 \, d x^{2} + 2 \, c\right )\right )} \log \left (\cos \left (2 \, d x^{2} + 2 \, c\right )^{2} + \sin \left (2 \, d x^{2} + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x^{2} + 2 \, c\right ) + 1\right ) - {\left ({\left (-2 i \, a b + b^{2}\right )} d^{2} x^{4} + 4 i \, b^{2} d x^{2}\right )} \sin \left (2 \, d x^{2} + 2 \, c\right )}{-4 i \, d^{2} \cos \left (2 \, d x^{2} + 2 \, c\right ) + 4 \, d^{2} \sin \left (2 \, d x^{2} + 2 \, c\right ) - 4 i \, d^{2}} \] Input:

integrate(x^3*(a+b*tan(d*x^2+c))^2,x, algorithm="maxima")
 

Output:

1/4*a^2*x^4 + ((2*a*b + I*b^2)*d^2*x^4 - 2*(2*a*b*d*x^2 - b^2 + (2*a*b*d*x 
^2 - b^2)*cos(2*d*x^2 + 2*c) - (-2*I*a*b*d*x^2 + I*b^2)*sin(2*d*x^2 + 2*c) 
)*arctan2(sin(2*d*x^2 + 2*c), cos(2*d*x^2 + 2*c) + 1) + ((2*a*b + I*b^2)*d 
^2*x^4 - 4*b^2*d*x^2)*cos(2*d*x^2 + 2*c) + 2*(a*b*cos(2*d*x^2 + 2*c) + I*a 
*b*sin(2*d*x^2 + 2*c) + a*b)*dilog(-e^(2*I*d*x^2 + 2*I*c)) - (-2*I*a*b*d*x 
^2 + I*b^2 + (-2*I*a*b*d*x^2 + I*b^2)*cos(2*d*x^2 + 2*c) + (2*a*b*d*x^2 - 
b^2)*sin(2*d*x^2 + 2*c))*log(cos(2*d*x^2 + 2*c)^2 + sin(2*d*x^2 + 2*c)^2 + 
 2*cos(2*d*x^2 + 2*c) + 1) - ((-2*I*a*b + b^2)*d^2*x^4 + 4*I*b^2*d*x^2)*si 
n(2*d*x^2 + 2*c))/(-4*I*d^2*cos(2*d*x^2 + 2*c) + 4*d^2*sin(2*d*x^2 + 2*c) 
- 4*I*d^2)
 

Giac [F]

\[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\int { {\left (b \tan \left (d x^{2} + c\right ) + a\right )}^{2} x^{3} \,d x } \] Input:

integrate(x^3*(a+b*tan(d*x^2+c))^2,x, algorithm="giac")
 

Output:

integrate((b*tan(d*x^2 + c) + a)^2*x^3, x)
 

Mupad [F(-1)]

Timed out. \[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\int x^3\,{\left (a+b\,\mathrm {tan}\left (d\,x^2+c\right )\right )}^2 \,d x \] Input:

int(x^3*(a + b*tan(c + d*x^2))^2,x)
 

Output:

int(x^3*(a + b*tan(c + d*x^2))^2, x)
 

Reduce [F]

\[ \int x^3 \left (a+b \tan \left (c+d x^2\right )\right )^2 \, dx=\frac {8 \left (\int \tan \left (d \,x^{2}+c \right ) x^{3}d x \right ) a b \,d^{2}-\mathrm {log}\left (\tan \left (d \,x^{2}+c \right )^{2}+1\right ) b^{2}+2 \tan \left (d \,x^{2}+c \right ) b^{2} d \,x^{2}+a^{2} d^{2} x^{4}-b^{2} d^{2} x^{4}}{4 d^{2}} \] Input:

int(x^3*(a+b*tan(d*x^2+c))^2,x)
 

Output:

(8*int(tan(c + d*x**2)*x**3,x)*a*b*d**2 - log(tan(c + d*x**2)**2 + 1)*b**2 
 + 2*tan(c + d*x**2)*b**2*d*x**2 + a**2*d**2*x**4 - b**2*d**2*x**4)/(4*d** 
2)