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

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

Optimal result

Integrand size = 16, antiderivative size = 81 \[ \int \sqrt {a+b \csc ^2(c+d x)} \, dx=-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {a} \cot (c+d x)}{\sqrt {a+b+b \cot ^2(c+d x)}}\right )}{d}-\frac {\sqrt {b} \text {arctanh}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a+b+b \cot ^2(c+d x)}}\right )}{d} \] Output:

-a^(1/2)*arctan(a^(1/2)*cot(d*x+c)/(a+b+b*cot(d*x+c)^2)^(1/2))/d-b^(1/2)*a 
rctanh(b^(1/2)*cot(d*x+c)/(a+b+b*cot(d*x+c)^2)^(1/2))/d
 

Mathematica [A] (verified)

Time = 0.20 (sec) , antiderivative size = 149, normalized size of antiderivative = 1.84 \[ \int \sqrt {a+b \csc ^2(c+d x)} \, dx=\frac {\sqrt {2} \sqrt {a+b \csc ^2(c+d x)} \left (-\sqrt {-b} \text {arctanh}\left (\frac {\sqrt {2} \sqrt {-b} \cos (c+d x)}{\sqrt {-a-2 b+a \cos (2 (c+d x))}}\right )+\sqrt {a} \log \left (\sqrt {2} \sqrt {a} \cos (c+d x)+\sqrt {-a-2 b+a \cos (2 (c+d x))}\right )\right ) \sin (c+d x)}{d \sqrt {-a-2 b+a \cos (2 (c+d x))}} \] Input:

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

Output:

(Sqrt[2]*Sqrt[a + b*Csc[c + d*x]^2]*(-(Sqrt[-b]*ArcTanh[(Sqrt[2]*Sqrt[-b]* 
Cos[c + d*x])/Sqrt[-a - 2*b + a*Cos[2*(c + d*x)]]]) + Sqrt[a]*Log[Sqrt[2]* 
Sqrt[a]*Cos[c + d*x] + Sqrt[-a - 2*b + a*Cos[2*(c + d*x)]]])*Sin[c + d*x]) 
/(d*Sqrt[-a - 2*b + a*Cos[2*(c + d*x)]])
 

Rubi [A] (verified)

Time = 0.24 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.96, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.438, Rules used = {3042, 4616, 301, 224, 219, 291, 216}

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 {a+b \csc ^2(c+d x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \sqrt {a+b \sec \left (c+d x+\frac {\pi }{2}\right )^2}dx\)

\(\Big \downarrow \) 4616

\(\displaystyle -\frac {\int \frac {\sqrt {b \cot ^2(c+d x)+a+b}}{\cot ^2(c+d x)+1}d\cot (c+d x)}{d}\)

\(\Big \downarrow \) 301

\(\displaystyle -\frac {b \int \frac {1}{\sqrt {b \cot ^2(c+d x)+a+b}}d\cot (c+d x)+a \int \frac {1}{\left (\cot ^2(c+d x)+1\right ) \sqrt {b \cot ^2(c+d x)+a+b}}d\cot (c+d x)}{d}\)

\(\Big \downarrow \) 224

\(\displaystyle -\frac {a \int \frac {1}{\left (\cot ^2(c+d x)+1\right ) \sqrt {b \cot ^2(c+d x)+a+b}}d\cot (c+d x)+b \int \frac {1}{1-\frac {b \cot ^2(c+d x)}{b \cot ^2(c+d x)+a+b}}d\frac {\cot (c+d x)}{\sqrt {b \cot ^2(c+d x)+a+b}}}{d}\)

\(\Big \downarrow \) 219

\(\displaystyle -\frac {a \int \frac {1}{\left (\cot ^2(c+d x)+1\right ) \sqrt {b \cot ^2(c+d x)+a+b}}d\cot (c+d x)+\sqrt {b} \text {arctanh}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a+b \cot ^2(c+d x)+b}}\right )}{d}\)

\(\Big \downarrow \) 291

\(\displaystyle -\frac {a \int \frac {1}{\frac {a \cot ^2(c+d x)}{b \cot ^2(c+d x)+a+b}+1}d\frac {\cot (c+d x)}{\sqrt {b \cot ^2(c+d x)+a+b}}+\sqrt {b} \text {arctanh}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a+b \cot ^2(c+d x)+b}}\right )}{d}\)

\(\Big \downarrow \) 216

\(\displaystyle -\frac {\sqrt {a} \arctan \left (\frac {\sqrt {a} \cot (c+d x)}{\sqrt {a+b \cot ^2(c+d x)+b}}\right )+\sqrt {b} \text {arctanh}\left (\frac {\sqrt {b} \cot (c+d x)}{\sqrt {a+b \cot ^2(c+d x)+b}}\right )}{d}\)

Input:

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

Output:

-((Sqrt[a]*ArcTan[(Sqrt[a]*Cot[c + d*x])/Sqrt[a + b + b*Cot[c + d*x]^2]] + 
 Sqrt[b]*ArcTanh[(Sqrt[b]*Cot[c + d*x])/Sqrt[a + b + b*Cot[c + d*x]^2]])/d 
)
 

Defintions of rubi rules used

rule 216
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A 
rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a 
, 0] || GtQ[b, 0])
 

rule 219
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* 
ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt 
Q[a, 0] || LtQ[b, 0])
 

rule 224
Int[1/Sqrt[(a_) + (b_.)*(x_)^2], x_Symbol] :> Subst[Int[1/(1 - b*x^2), x], 
x, x/Sqrt[a + b*x^2]] /; FreeQ[{a, b}, x] &&  !GtQ[a, 0]
 

rule 291
Int[1/(Sqrt[(a_) + (b_.)*(x_)^2]*((c_) + (d_.)*(x_)^2)), x_Symbol] :> Subst 
[Int[1/(c - (b*c - a*d)*x^2), x], x, x/Sqrt[a + b*x^2]] /; FreeQ[{a, b, c, 
d}, x] && NeQ[b*c - a*d, 0]
 

rule 301
Int[((a_) + (b_.)*(x_)^2)^(p_.)/((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[b/ 
d   Int[(a + b*x^2)^(p - 1), x], x] - Simp[(b*c - a*d)/d   Int[(a + b*x^2)^ 
(p - 1)/(c + d*x^2), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] 
&& GtQ[p, 0] && (EqQ[p, 1/2] || EqQ[Denominator[p], 4] || (EqQ[p, 2/3] && E 
qQ[b*c + 3*a*d, 0]))
 

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

rule 4616
Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> With[{ff = 
FreeFactors[Tan[e + f*x], x]}, Simp[ff/f   Subst[Int[(a + b + b*ff^2*x^2)^p 
/(1 + ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] 
&& NeQ[a + b, 0] && NeQ[p, -1]
 
Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(357\) vs. \(2(69)=138\).

Time = 0.36 (sec) , antiderivative size = 358, normalized size of antiderivative = 4.42

method result size
default \(-\frac {\sqrt {4}\, \sqrt {a +b \csc \left (d x +c \right )^{2}}\, \left (b \ln \left (\frac {4 a \left (1-\cos \left (d x +c \right )\right )^{2}+2 b \left (1-\cos \left (d x +c \right )\right )^{2}+4 \sqrt {b}\, \sqrt {\frac {a \sin \left (d x +c \right )^{2}+b}{\left (1+\cos \left (d x +c \right )\right )^{2}}}\, \sin \left (d x +c \right )^{2}+2 b \sin \left (d x +c \right )^{2}}{\left (1-\cos \left (d x +c \right )\right )^{2}}\right ) \sqrt {-a}+2 a \ln \left (4 \sqrt {-a}\, \sqrt {\frac {a \sin \left (d x +c \right )^{2}+b}{\left (1+\cos \left (d x +c \right )\right )^{2}}}\, \cos \left (d x +c \right )+4 \sqrt {-a}\, \sqrt {\frac {a \sin \left (d x +c \right )^{2}+b}{\left (1+\cos \left (d x +c \right )\right )^{2}}}-4 \cos \left (d x +c \right ) a \right ) \sqrt {b}-\ln \left (\frac {2 \sqrt {\frac {a \sin \left (d x +c \right )^{2}+b}{\left (1+\cos \left (d x +c \right )\right )^{2}}}\, \sqrt {b}\, \cos \left (d x +c \right )+2 \sqrt {b}\, \sqrt {\frac {a \sin \left (d x +c \right )^{2}+b}{\left (1+\cos \left (d x +c \right )\right )^{2}}}+2 \cos \left (d x +c \right ) a +2 a +2 b}{\sqrt {b}\, \left (1+\cos \left (d x +c \right )\right )}\right ) \sqrt {-a}\, b \right ) \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{4 d \sqrt {b}\, \sqrt {-a}\, \sqrt {\frac {a \sin \left (d x +c \right )^{2}+b}{\left (1+\cos \left (d x +c \right )\right )^{2}}}}\) \(358\)

Input:

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

Output:

-1/4/d*4^(1/2)/b^(1/2)/(-a)^(1/2)*(a+b*csc(d*x+c)^2)^(1/2)*(b*ln(2/(1-cos( 
d*x+c))^2*(2*a*(1-cos(d*x+c))^2+b*(1-cos(d*x+c))^2+2*b^(1/2)*((a*sin(d*x+c 
)^2+b)/(1+cos(d*x+c))^2)^(1/2)*sin(d*x+c)^2+b*sin(d*x+c)^2))*(-a)^(1/2)+2* 
a*ln(4*(-a)^(1/2)*((a*sin(d*x+c)^2+b)/(1+cos(d*x+c))^2)^(1/2)*cos(d*x+c)+4 
*(-a)^(1/2)*((a*sin(d*x+c)^2+b)/(1+cos(d*x+c))^2)^(1/2)-4*cos(d*x+c)*a)*b^ 
(1/2)-ln(2/b^(1/2)*(((a*sin(d*x+c)^2+b)/(1+cos(d*x+c))^2)^(1/2)*b^(1/2)*co 
s(d*x+c)+b^(1/2)*((a*sin(d*x+c)^2+b)/(1+cos(d*x+c))^2)^(1/2)+cos(d*x+c)*a+ 
a+b)/(1+cos(d*x+c)))*(-a)^(1/2)*b)/((a*sin(d*x+c)^2+b)/(1+cos(d*x+c))^2)^( 
1/2)*(csc(d*x+c)-cot(d*x+c))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 255 vs. \(2 (69) = 138\).

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

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

Output:

[1/8*(sqrt(-a)*log(128*a^4*cos(d*x + c)^8 - 256*(a^4 + a^3*b)*cos(d*x + c) 
^6 + 160*(a^4 + 2*a^3*b + a^2*b^2)*cos(d*x + c)^4 + a^4 + 4*a^3*b + 6*a^2* 
b^2 + 4*a*b^3 + b^4 - 32*(a^4 + 3*a^3*b + 3*a^2*b^2 + a*b^3)*cos(d*x + c)^ 
2 - 8*(16*a^3*cos(d*x + c)^7 - 24*(a^3 + a^2*b)*cos(d*x + c)^5 + 10*(a^3 + 
 2*a^2*b + a*b^2)*cos(d*x + c)^3 - (a^3 + 3*a^2*b + 3*a*b^2 + b^3)*cos(d*x 
 + c))*sqrt(-a)*sqrt((a*cos(d*x + c)^2 - a - b)/(cos(d*x + c)^2 - 1))*sin( 
d*x + c)) + 2*sqrt(b)*log(2*((a^2 - 6*a*b + b^2)*cos(d*x + c)^4 - 2*(a^2 - 
 2*a*b - 3*b^2)*cos(d*x + c)^2 + 4*((a - b)*cos(d*x + c)^3 - (a + b)*cos(d 
*x + c))*sqrt(b)*sqrt((a*cos(d*x + c)^2 - a - b)/(cos(d*x + c)^2 - 1))*sin 
(d*x + c) + a^2 + 2*a*b + b^2)/(cos(d*x + c)^4 - 2*cos(d*x + c)^2 + 1)))/d 
, -1/8*(4*sqrt(-b)*arctan(-1/2*((a - b)*cos(d*x + c)^2 - a - b)*sqrt(-b)*s 
qrt((a*cos(d*x + c)^2 - a - b)/(cos(d*x + c)^2 - 1))*sin(d*x + c)/(a*b*cos 
(d*x + c)^3 - (a*b + b^2)*cos(d*x + c))) - sqrt(-a)*log(128*a^4*cos(d*x + 
c)^8 - 256*(a^4 + a^3*b)*cos(d*x + c)^6 + 160*(a^4 + 2*a^3*b + a^2*b^2)*co 
s(d*x + c)^4 + a^4 + 4*a^3*b + 6*a^2*b^2 + 4*a*b^3 + b^4 - 32*(a^4 + 3*a^3 
*b + 3*a^2*b^2 + a*b^3)*cos(d*x + c)^2 - 8*(16*a^3*cos(d*x + c)^7 - 24*(a^ 
3 + a^2*b)*cos(d*x + c)^5 + 10*(a^3 + 2*a^2*b + a*b^2)*cos(d*x + c)^3 - (a 
^3 + 3*a^2*b + 3*a*b^2 + b^3)*cos(d*x + c))*sqrt(-a)*sqrt((a*cos(d*x + c)^ 
2 - a - b)/(cos(d*x + c)^2 - 1))*sin(d*x + c)))/d, 1/4*(sqrt(a)*arctan(1/4 
*(8*a^2*cos(d*x + c)^4 - 8*(a^2 + a*b)*cos(d*x + c)^2 + a^2 + 2*a*b + b...
 

Sympy [F]

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

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

Output:

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

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

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

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

Output:

-1/2*(2*sqrt(a)*b^(3/2)*arctan2(a*sin(2*d*x + 2*c) + (a^2*cos(4*d*x + 4*c) 
^2 + a^2*sin(4*d*x + 4*c)^2 + 4*(a^2 + 4*a*b + 4*b^2)*cos(2*d*x + 2*c)^2 - 
 4*(a^2 + 2*a*b)*sin(4*d*x + 4*c)*sin(2*d*x + 2*c) + 4*(a^2 + 4*a*b + 4*b^ 
2)*sin(2*d*x + 2*c)^2 + a^2 + 2*(a^2 - 2*(a^2 + 2*a*b)*cos(2*d*x + 2*c))*c 
os(4*d*x + 4*c) - 4*(a^2 + 2*a*b)*cos(2*d*x + 2*c))^(1/4)*sqrt(a)*sin(1/2* 
arctan2(a*sin(4*d*x + 4*c) - 2*(a + 2*b)*sin(2*d*x + 2*c), a*cos(4*d*x + 4 
*c) - 2*(a + 2*b)*cos(2*d*x + 2*c) + a)), a*cos(2*d*x + 2*c) + (a^2*cos(4* 
d*x + 4*c)^2 + a^2*sin(4*d*x + 4*c)^2 + 4*(a^2 + 4*a*b + 4*b^2)*cos(2*d*x 
+ 2*c)^2 - 4*(a^2 + 2*a*b)*sin(4*d*x + 4*c)*sin(2*d*x + 2*c) + 4*(a^2 + 4* 
a*b + 4*b^2)*sin(2*d*x + 2*c)^2 + a^2 + 2*(a^2 - 2*(a^2 + 2*a*b)*cos(2*d*x 
 + 2*c))*cos(4*d*x + 4*c) - 4*(a^2 + 2*a*b)*cos(2*d*x + 2*c))^(1/4)*sqrt(a 
)*cos(1/2*arctan2(a*sin(4*d*x + 4*c) - 2*(a + 2*b)*sin(2*d*x + 2*c), a*cos 
(4*d*x + 4*c) - 2*(a + 2*b)*cos(2*d*x + 2*c) + a)) - a - 2*b) - a^(3/2)*sq 
rt(b)*arctan2(2*(a^2*cos(4*d*x + 4*c)^2 + a^2*sin(4*d*x + 4*c)^2 + 4*(a^2 
+ 4*a*b + 4*b^2)*cos(2*d*x + 2*c)^2 - 4*(a^2 + 2*a*b)*sin(4*d*x + 4*c)*sin 
(2*d*x + 2*c) + 4*(a^2 + 4*a*b + 4*b^2)*sin(2*d*x + 2*c)^2 + a^2 + 2*(a^2 
- 2*(a^2 + 2*a*b)*cos(2*d*x + 2*c))*cos(4*d*x + 4*c) - 4*(a^2 + 2*a*b)*cos 
(2*d*x + 2*c))^(1/4)*sqrt(a)*sin(1/2*arctan2(a*sin(4*d*x + 4*c) - 2*(a + 2 
*b)*sin(2*d*x + 2*c), a*cos(4*d*x + 4*c) - 2*(a + 2*b)*cos(2*d*x + 2*c) + 
a)), 2*(a^2*cos(4*d*x + 4*c)^2 + a^2*sin(4*d*x + 4*c)^2 + 4*(a^2 + 4*a*...
 

Giac [F(-2)]

Exception generated. \[ \int \sqrt {a+b \csc ^2(c+d x)} \, dx=\text {Exception raised: TypeError} \] Input:

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

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Degree mismatch inside factorisatio 
n over extensionDegree mismatch inside factorisation over extensionDegree 
mismatch
 

Mupad [F(-1)]

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

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

Output:

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

Reduce [F]

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

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

Output:

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