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

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

Optimal result

Integrand size = 22, antiderivative size = 241 \[ \int \sqrt {x} \left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2 \, dx=-\frac {2 i b^2 x}{d}+\frac {2}{3} a^2 x^{3/2}-\frac {8 a b x \text {arctanh}\left (e^{i \left (c+d \sqrt {x}\right )}\right )}{d}-\frac {2 b^2 x \cot \left (c+d \sqrt {x}\right )}{d}+\frac {4 b^2 \sqrt {x} \log \left (1-e^{2 i \left (c+d \sqrt {x}\right )}\right )}{d^2}+\frac {8 i a b \sqrt {x} \operatorname {PolyLog}\left (2,-e^{i \left (c+d \sqrt {x}\right )}\right )}{d^2}-\frac {8 i a b \sqrt {x} \operatorname {PolyLog}\left (2,e^{i \left (c+d \sqrt {x}\right )}\right )}{d^2}-\frac {2 i b^2 \operatorname {PolyLog}\left (2,e^{2 i \left (c+d \sqrt {x}\right )}\right )}{d^3}-\frac {8 a b \operatorname {PolyLog}\left (3,-e^{i \left (c+d \sqrt {x}\right )}\right )}{d^3}+\frac {8 a b \operatorname {PolyLog}\left (3,e^{i \left (c+d \sqrt {x}\right )}\right )}{d^3} \] Output:

-2*I*b^2*x/d+2/3*a^2*x^(3/2)-8*a*b*x*arctanh(exp(I*(c+d*x^(1/2))))/d-2*b^2 
*x*cot(c+d*x^(1/2))/d+4*b^2*x^(1/2)*ln(1-exp(2*I*(c+d*x^(1/2))))/d^2+8*I*a 
*b*x^(1/2)*polylog(2,-exp(I*(c+d*x^(1/2))))/d^2-8*I*a*b*x^(1/2)*polylog(2, 
exp(I*(c+d*x^(1/2))))/d^2-2*I*b^2*polylog(2,exp(2*I*(c+d*x^(1/2))))/d^3-8* 
a*b*polylog(3,-exp(I*(c+d*x^(1/2))))/d^3+8*a*b*polylog(3,exp(I*(c+d*x^(1/2 
))))/d^3
 

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(681\) vs. \(2(241)=482\).

Time = 3.29 (sec) , antiderivative size = 681, normalized size of antiderivative = 2.83 \[ \int \sqrt {x} \left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2 \, dx=\frac {-12 i b^2 d^2 x-2 a^2 d^3 x^{3/2}+2 a^2 d^3 e^{2 i c} x^{3/2}-12 b^2 d \sqrt {x} \log \left (1-e^{-i \left (c+d \sqrt {x}\right )}\right )+12 b^2 d e^{2 i c} \sqrt {x} \log \left (1-e^{-i \left (c+d \sqrt {x}\right )}\right )-12 a b d^2 x \log \left (1-e^{-i \left (c+d \sqrt {x}\right )}\right )+12 a b d^2 e^{2 i c} x \log \left (1-e^{-i \left (c+d \sqrt {x}\right )}\right )-12 b^2 d \sqrt {x} \log \left (1+e^{-i \left (c+d \sqrt {x}\right )}\right )+12 b^2 d e^{2 i c} \sqrt {x} \log \left (1+e^{-i \left (c+d \sqrt {x}\right )}\right )+12 a b d^2 x \log \left (1+e^{-i \left (c+d \sqrt {x}\right )}\right )-12 a b d^2 e^{2 i c} x \log \left (1+e^{-i \left (c+d \sqrt {x}\right )}\right )+12 i b \left (-1+e^{2 i c}\right ) \left (b-2 a d \sqrt {x}\right ) \operatorname {PolyLog}\left (2,-e^{-i \left (c+d \sqrt {x}\right )}\right )+12 i b \left (-1+e^{2 i c}\right ) \left (b+2 a d \sqrt {x}\right ) \operatorname {PolyLog}\left (2,e^{-i \left (c+d \sqrt {x}\right )}\right )+24 a b \operatorname {PolyLog}\left (3,-e^{-i \left (c+d \sqrt {x}\right )}\right )-24 a b e^{2 i c} \operatorname {PolyLog}\left (3,-e^{-i \left (c+d \sqrt {x}\right )}\right )-24 a b \operatorname {PolyLog}\left (3,e^{-i \left (c+d \sqrt {x}\right )}\right )+24 a b e^{2 i c} \operatorname {PolyLog}\left (3,e^{-i \left (c+d \sqrt {x}\right )}\right )-3 b^2 d^2 x \csc \left (\frac {c}{2}\right ) \csc \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right ) \sin \left (\frac {d \sqrt {x}}{2}\right )+3 b^2 d^2 e^{2 i c} x \csc \left (\frac {c}{2}\right ) \csc \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right ) \sin \left (\frac {d \sqrt {x}}{2}\right )-3 b^2 d^2 x \sec \left (\frac {c}{2}\right ) \sec \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right ) \sin \left (\frac {d \sqrt {x}}{2}\right )+3 b^2 d^2 e^{2 i c} x \sec \left (\frac {c}{2}\right ) \sec \left (\frac {1}{2} \left (c+d \sqrt {x}\right )\right ) \sin \left (\frac {d \sqrt {x}}{2}\right )}{3 d^3 \left (-1+e^{2 i c}\right )} \] Input:

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

Output:

((-12*I)*b^2*d^2*x - 2*a^2*d^3*x^(3/2) + 2*a^2*d^3*E^((2*I)*c)*x^(3/2) - 1 
2*b^2*d*Sqrt[x]*Log[1 - E^((-I)*(c + d*Sqrt[x]))] + 12*b^2*d*E^((2*I)*c)*S 
qrt[x]*Log[1 - E^((-I)*(c + d*Sqrt[x]))] - 12*a*b*d^2*x*Log[1 - E^((-I)*(c 
 + d*Sqrt[x]))] + 12*a*b*d^2*E^((2*I)*c)*x*Log[1 - E^((-I)*(c + d*Sqrt[x]) 
)] - 12*b^2*d*Sqrt[x]*Log[1 + E^((-I)*(c + d*Sqrt[x]))] + 12*b^2*d*E^((2*I 
)*c)*Sqrt[x]*Log[1 + E^((-I)*(c + d*Sqrt[x]))] + 12*a*b*d^2*x*Log[1 + E^(( 
-I)*(c + d*Sqrt[x]))] - 12*a*b*d^2*E^((2*I)*c)*x*Log[1 + E^((-I)*(c + d*Sq 
rt[x]))] + (12*I)*b*(-1 + E^((2*I)*c))*(b - 2*a*d*Sqrt[x])*PolyLog[2, -E^( 
(-I)*(c + d*Sqrt[x]))] + (12*I)*b*(-1 + E^((2*I)*c))*(b + 2*a*d*Sqrt[x])*P 
olyLog[2, E^((-I)*(c + d*Sqrt[x]))] + 24*a*b*PolyLog[3, -E^((-I)*(c + d*Sq 
rt[x]))] - 24*a*b*E^((2*I)*c)*PolyLog[3, -E^((-I)*(c + d*Sqrt[x]))] - 24*a 
*b*PolyLog[3, E^((-I)*(c + d*Sqrt[x]))] + 24*a*b*E^((2*I)*c)*PolyLog[3, E^ 
((-I)*(c + d*Sqrt[x]))] - 3*b^2*d^2*x*Csc[c/2]*Csc[(c + d*Sqrt[x])/2]*Sin[ 
(d*Sqrt[x])/2] + 3*b^2*d^2*E^((2*I)*c)*x*Csc[c/2]*Csc[(c + d*Sqrt[x])/2]*S 
in[(d*Sqrt[x])/2] - 3*b^2*d^2*x*Sec[c/2]*Sec[(c + d*Sqrt[x])/2]*Sin[(d*Sqr 
t[x])/2] + 3*b^2*d^2*E^((2*I)*c)*x*Sec[c/2]*Sec[(c + d*Sqrt[x])/2]*Sin[(d* 
Sqrt[x])/2])/(3*d^3*(-1 + E^((2*I)*c)))
 

Rubi [A] (verified)

Time = 0.55 (sec) , antiderivative size = 243, normalized size of antiderivative = 1.01, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.182, Rules used = {4693, 3042, 4678, 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 \sqrt {x} \left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2 \, dx\)

\(\Big \downarrow \) 4693

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4678

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

\(\Big \downarrow \) 2009

\(\displaystyle 2 \left (\frac {1}{3} a^2 x^{3/2}-\frac {4 a b x \text {arctanh}\left (e^{i \left (c+d \sqrt {x}\right )}\right )}{d}-\frac {4 a b \operatorname {PolyLog}\left (3,-e^{i \left (c+d \sqrt {x}\right )}\right )}{d^3}+\frac {4 a b \operatorname {PolyLog}\left (3,e^{i \left (c+d \sqrt {x}\right )}\right )}{d^3}+\frac {4 i a b \sqrt {x} \operatorname {PolyLog}\left (2,-e^{i \left (c+d \sqrt {x}\right )}\right )}{d^2}-\frac {4 i a b \sqrt {x} \operatorname {PolyLog}\left (2,e^{i \left (c+d \sqrt {x}\right )}\right )}{d^2}-\frac {i b^2 \operatorname {PolyLog}\left (2,e^{2 i \left (c+d \sqrt {x}\right )}\right )}{d^3}+\frac {2 b^2 \sqrt {x} \log \left (1-e^{2 i \left (c+d \sqrt {x}\right )}\right )}{d^2}-\frac {b^2 x \cot \left (c+d \sqrt {x}\right )}{d}-\frac {i b^2 x}{d}\right )\)

Input:

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

Output:

2*(((-I)*b^2*x)/d + (a^2*x^(3/2))/3 - (4*a*b*x*ArcTanh[E^(I*(c + d*Sqrt[x] 
))])/d - (b^2*x*Cot[c + d*Sqrt[x]])/d + (2*b^2*Sqrt[x]*Log[1 - E^((2*I)*(c 
 + d*Sqrt[x]))])/d^2 + ((4*I)*a*b*Sqrt[x]*PolyLog[2, -E^(I*(c + d*Sqrt[x]) 
)])/d^2 - ((4*I)*a*b*Sqrt[x]*PolyLog[2, E^(I*(c + d*Sqrt[x]))])/d^2 - (I*b 
^2*PolyLog[2, E^((2*I)*(c + d*Sqrt[x]))])/d^3 - (4*a*b*PolyLog[3, -E^(I*(c 
 + d*Sqrt[x]))])/d^3 + (4*a*b*PolyLog[3, E^(I*(c + d*Sqrt[x]))])/d^3)
 

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 4678
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(n_.)*((c_.) + (d_.)*(x_))^(m_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, (a + b*Csc[e + f*x])^n, x], 
 x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]
 

rule 4693
Int[((a_.) + Csc[(c_.) + (d_.)*(x_)^(n_)]*(b_.))^(p_.)*(x_)^(m_.), x_Symbol 
] :> Simp[1/n   Subst[Int[x^(Simplify[(m + 1)/n] - 1)*(a + b*Csc[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 \sqrt {x}\, \left (a +b \csc \left (c +d \sqrt {x}\right )\right )^{2}d x\]

Input:

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

Output:

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

Fricas [F]

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

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

Output:

integral(b^2*sqrt(x)*csc(d*sqrt(x) + c)^2 + 2*a*b*sqrt(x)*csc(d*sqrt(x) + 
c) + a^2*sqrt(x), x)
 

Sympy [F]

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

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

Output:

Integral(sqrt(x)*(a + b*csc(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. 1217 vs. \(2 (190) = 380\).

Time = 0.13 (sec) , antiderivative size = 1217, normalized size of antiderivative = 5.05 \[ \int \sqrt {x} \left (a+b \csc \left (c+d \sqrt {x}\right )\right )^2 \, dx=\text {Too large to display} \] Input:

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

Output:

2/3*((d*sqrt(x) + c)^3*a^2 - 3*(d*sqrt(x) + c)^2*a^2*c + 3*(d*sqrt(x) + c) 
*a^2*c^2 - 6*a*b*c^2*log(cot(d*sqrt(x) + c) + csc(d*sqrt(x) + c)) - 3*(2*b 
^2*c^2 - 2*((d*sqrt(x) + c)^2*a*b + b^2*c - (2*a*b*c + b^2)*(d*sqrt(x) + c 
) - ((d*sqrt(x) + c)^2*a*b + b^2*c - (2*a*b*c + b^2)*(d*sqrt(x) + c))*cos( 
2*d*sqrt(x) + 2*c) + (-I*(d*sqrt(x) + c)^2*a*b - I*b^2*c + (2*I*a*b*c + I* 
b^2)*(d*sqrt(x) + c))*sin(2*d*sqrt(x) + 2*c))*arctan2(sin(d*sqrt(x) + c), 
cos(d*sqrt(x) + c) + 1) + 2*(b^2*c*cos(2*d*sqrt(x) + 2*c) + I*b^2*c*sin(2* 
d*sqrt(x) + 2*c) - b^2*c)*arctan2(sin(d*sqrt(x) + c), cos(d*sqrt(x) + c) - 
 1) - 2*((d*sqrt(x) + c)^2*a*b - (2*a*b*c - b^2)*(d*sqrt(x) + c) - ((d*sqr 
t(x) + c)^2*a*b - (2*a*b*c - b^2)*(d*sqrt(x) + c))*cos(2*d*sqrt(x) + 2*c) 
+ (-I*(d*sqrt(x) + c)^2*a*b + (2*I*a*b*c - I*b^2)*(d*sqrt(x) + c))*sin(2*d 
*sqrt(x) + 2*c))*arctan2(sin(d*sqrt(x) + c), -cos(d*sqrt(x) + c) + 1) + 2* 
((d*sqrt(x) + c)^2*b^2 - 2*(d*sqrt(x) + c)*b^2*c)*cos(2*d*sqrt(x) + 2*c) + 
 2*(2*(d*sqrt(x) + c)*a*b - 2*a*b*c - b^2 - (2*(d*sqrt(x) + c)*a*b - 2*a*b 
*c - b^2)*cos(2*d*sqrt(x) + 2*c) - (2*I*(d*sqrt(x) + c)*a*b - 2*I*a*b*c - 
I*b^2)*sin(2*d*sqrt(x) + 2*c))*dilog(-e^(I*d*sqrt(x) + I*c)) - 2*(2*(d*sqr 
t(x) + c)*a*b - 2*a*b*c + b^2 - (2*(d*sqrt(x) + c)*a*b - 2*a*b*c + b^2)*co 
s(2*d*sqrt(x) + 2*c) + (-2*I*(d*sqrt(x) + c)*a*b + 2*I*a*b*c - I*b^2)*sin( 
2*d*sqrt(x) + 2*c))*dilog(e^(I*d*sqrt(x) + I*c)) + (I*(d*sqrt(x) + c)^2*a* 
b + I*b^2*c + (-2*I*a*b*c - I*b^2)*(d*sqrt(x) + c) + (-I*(d*sqrt(x) + c...
 

Giac [F]

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

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

Output:

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

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

(2*sqrt(x)*a**2*x + 6*int(sqrt(x)*csc(sqrt(x)*d + c),x)*a*b + 3*int(sqrt(x 
)*csc(sqrt(x)*d + c)**2,x)*b**2)/3