\(\int (a+b \tan (c+d \sqrt {x}))^2 \, dx\) [33]

Optimal result
Mathematica [B] (warning: unable to verify)
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 = 16, antiderivative size = 119 \[ \int \left (a+b \tan \left (c+d \sqrt {x}\right )\right )^2 \, dx=a^2 x+2 i a b x-b^2 x-\frac {4 a b \sqrt {x} \log \left (1+e^{2 i \left (c+d \sqrt {x}\right )}\right )}{d}+\frac {2 b^2 \log \left (\cos \left (c+d \sqrt {x}\right )\right )}{d^2}+\frac {2 i a b \operatorname {PolyLog}\left (2,-e^{2 i \left (c+d \sqrt {x}\right )}\right )}{d^2}+\frac {2 b^2 \sqrt {x} \tan \left (c+d \sqrt {x}\right )}{d} \] Output:

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

Mathematica [B] (warning: unable to verify)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(253\) vs. \(2(119)=238\).

Time = 4.44 (sec) , antiderivative size = 253, normalized size of antiderivative = 2.13 \[ \int \left (a+b \tan \left (c+d \sqrt {x}\right )\right )^2 \, dx=\frac {\sec (c) \left (-2 a b \cos (c) \left (i d \sqrt {x} (\pi +2 \arctan (\cot (c)))+\pi \log \left (1+e^{-2 i d \sqrt {x}}\right )+2 \left (d \sqrt {x}-\arctan (\cot (c))\right ) \log \left (1-e^{2 i \left (d \sqrt {x}-\arctan (\cot (c))\right )}\right )-\pi \log \left (\cos \left (d \sqrt {x}\right )\right )+2 \arctan (\cot (c)) \log \left (\sin \left (d \sqrt {x}-\arctan (\cot (c))\right )\right )-i \operatorname {PolyLog}\left (2,e^{2 i \left (d \sqrt {x}-\arctan (\cot (c))\right )}\right )\right )-2 a b d^2 e^{-i \arctan (\cot (c))} x \sqrt {\csc ^2(c)} \sin (c)+d^2 x \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 \sqrt {x}\right )\right )+d \sqrt {x} \sin (c)\right )+2 b^2 d \sqrt {x} \sec \left (c+d \sqrt {x}\right ) \sin \left (d \sqrt {x}\right )\right )}{d^2} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.41 (sec) , antiderivative size = 124, normalized size of antiderivative = 1.04, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {4226, 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 \left (a+b \tan \left (c+d \sqrt {x}\right )\right )^2 \, dx\)

\(\Big \downarrow \) 4226

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4205

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

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

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 4226
Int[((a_.) + (b_.)*Tan[(c_.) + (d_.)*(x_)^(n_)])^(p_.), x_Symbol] :> Simp[1 
/n   Subst[Int[x^(1/n - 1)*(a + b*Tan[c + d*x])^p, x], x, x^n], x] /; FreeQ 
[{a, b, c, d, p}, x] && IGtQ[1/n, 0] && IntegerQ[p]
 
Maple [F]

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

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

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

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

Output:

Integral((a + b*tan(c + d*sqrt(x)))**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. 497 vs. \(2 (98) = 196\).

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

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

Output:

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

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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