Integrand size = 21, antiderivative size = 55 \[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\text {arctanh}(\cos (c+d x))}{a d}+\frac {\sqrt {b} \text {arctanh}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b} d} \] Output:
-arctanh(cos(d*x+c))/a/d+b^(1/2)*arctanh(b^(1/2)*cos(d*x+c)/(a+b)^(1/2))/a /(a+b)^(1/2)/d
Result contains complex when optimal does not.
Time = 6.76 (sec) , antiderivative size = 143, normalized size of antiderivative = 2.60 \[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b}-i \sqrt {a} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a-b}}\right )}{\sqrt {-a-b}}+\frac {\sqrt {b} \arctan \left (\frac {\sqrt {b}+i \sqrt {a} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a-b}}\right )}{\sqrt {-a-b}}+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{a d} \] Input:
Integrate[Csc[c + d*x]/(a + b*Sin[c + d*x]^2),x]
Output:
-(((Sqrt[b]*ArcTan[(Sqrt[b] - I*Sqrt[a]*Tan[(c + d*x)/2])/Sqrt[-a - b]])/S qrt[-a - b] + (Sqrt[b]*ArcTan[(Sqrt[b] + I*Sqrt[a]*Tan[(c + d*x)/2])/Sqrt[ -a - b]])/Sqrt[-a - b] + Log[Cos[(c + d*x)/2]] - Log[Sin[(c + d*x)/2]])/(a *d))
Time = 0.24 (sec) , antiderivative size = 54, normalized size of antiderivative = 0.98, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {3042, 3665, 303, 219, 221}
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 \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1}{\sin (c+d x) \left (a+b \sin (c+d x)^2\right )}dx\) |
\(\Big \downarrow \) 3665 |
\(\displaystyle -\frac {\int \frac {1}{\left (1-\cos ^2(c+d x)\right ) \left (-b \cos ^2(c+d x)+a+b\right )}d\cos (c+d x)}{d}\) |
\(\Big \downarrow \) 303 |
\(\displaystyle -\frac {\frac {\int \frac {1}{1-\cos ^2(c+d x)}d\cos (c+d x)}{a}-\frac {b \int \frac {1}{-b \cos ^2(c+d x)+a+b}d\cos (c+d x)}{a}}{d}\) |
\(\Big \downarrow \) 219 |
\(\displaystyle -\frac {\frac {\text {arctanh}(\cos (c+d x))}{a}-\frac {b \int \frac {1}{-b \cos ^2(c+d x)+a+b}d\cos (c+d x)}{a}}{d}\) |
\(\Big \downarrow \) 221 |
\(\displaystyle -\frac {\frac {\text {arctanh}(\cos (c+d x))}{a}-\frac {\sqrt {b} \text {arctanh}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b}}}{d}\) |
Input:
Int[Csc[c + d*x]/(a + b*Sin[c + d*x]^2),x]
Output:
-((ArcTanh[Cos[c + d*x]]/a - (Sqrt[b]*ArcTanh[(Sqrt[b]*Cos[c + d*x])/Sqrt[ a + b]])/(a*Sqrt[a + b]))/d)
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])
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x /Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
Int[1/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_Symbol] :> Simp[b/(b *c - a*d) Int[1/(a + b*x^2), x], x] - Simp[d/(b*c - a*d) Int[1/(c + d*x ^2), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0]
Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^ (p_.), x_Symbol] :> With[{ff = FreeFactors[Cos[e + f*x], x]}, Simp[-ff/f Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p, x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]
Time = 0.51 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.13
method | result | size |
derivativedivides | \(\frac {\frac {\ln \left (\cos \left (d x +c \right )-1\right )}{2 a}-\frac {\ln \left (\cos \left (d x +c \right )+1\right )}{2 a}+\frac {b \,\operatorname {arctanh}\left (\frac {b \cos \left (d x +c \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a \sqrt {\left (a +b \right ) b}}}{d}\) | \(62\) |
default | \(\frac {\frac {\ln \left (\cos \left (d x +c \right )-1\right )}{2 a}-\frac {\ln \left (\cos \left (d x +c \right )+1\right )}{2 a}+\frac {b \,\operatorname {arctanh}\left (\frac {b \cos \left (d x +c \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a \sqrt {\left (a +b \right ) b}}}{d}\) | \(62\) |
risch | \(-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a d}+\frac {i \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{i \left (d x +c \right )}}{b}+1\right )}{2 \left (a +b \right ) d a}-\frac {i \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{i \left (d x +c \right )}}{b}+1\right )}{2 \left (a +b \right ) d a}\) | \(155\) |
Input:
int(csc(d*x+c)/(a+b*sin(d*x+c)^2),x,method=_RETURNVERBOSE)
Output:
1/d*(1/2/a*ln(cos(d*x+c)-1)-1/2/a*ln(cos(d*x+c)+1)+b/a/((a+b)*b)^(1/2)*arc tanh(b*cos(d*x+c)/((a+b)*b)^(1/2)))
Time = 0.10 (sec) , antiderivative size = 161, normalized size of antiderivative = 2.93 \[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=\left [\frac {\sqrt {\frac {b}{a + b}} \log \left (\frac {b \cos \left (d x + c\right )^{2} + 2 \, {\left (a + b\right )} \sqrt {\frac {b}{a + b}} \cos \left (d x + c\right ) + a + b}{b \cos \left (d x + c\right )^{2} - a - b}\right ) - \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, a d}, -\frac {2 \, \sqrt {-\frac {b}{a + b}} \arctan \left (\sqrt {-\frac {b}{a + b}} \cos \left (d x + c\right )\right ) + \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, a d}\right ] \] Input:
integrate(csc(d*x+c)/(a+b*sin(d*x+c)^2),x, algorithm="fricas")
Output:
[1/2*(sqrt(b/(a + b))*log((b*cos(d*x + c)^2 + 2*(a + b)*sqrt(b/(a + b))*co s(d*x + c) + a + b)/(b*cos(d*x + c)^2 - a - b)) - log(1/2*cos(d*x + c) + 1 /2) + log(-1/2*cos(d*x + c) + 1/2))/(a*d), -1/2*(2*sqrt(-b/(a + b))*arctan (sqrt(-b/(a + b))*cos(d*x + c)) + log(1/2*cos(d*x + c) + 1/2) - log(-1/2*c os(d*x + c) + 1/2))/(a*d)]
\[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=\int \frac {\csc {\left (c + d x \right )}}{a + b \sin ^{2}{\left (c + d x \right )}}\, dx \] Input:
integrate(csc(d*x+c)/(a+b*sin(d*x+c)**2),x)
Output:
Integral(csc(c + d*x)/(a + b*sin(c + d*x)**2), x)
Time = 0.11 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.51 \[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\frac {b \log \left (\frac {b \cos \left (d x + c\right ) - \sqrt {{\left (a + b\right )} b}}{b \cos \left (d x + c\right ) + \sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a} + \frac {\log \left (\cos \left (d x + c\right ) + 1\right )}{a} - \frac {\log \left (\cos \left (d x + c\right ) - 1\right )}{a}}{2 \, d} \] Input:
integrate(csc(d*x+c)/(a+b*sin(d*x+c)^2),x, algorithm="maxima")
Output:
-1/2*(b*log((b*cos(d*x + c) - sqrt((a + b)*b))/(b*cos(d*x + c) + sqrt((a + b)*b)))/(sqrt((a + b)*b)*a) + log(cos(d*x + c) + 1)/a - log(cos(d*x + c) - 1)/a)/d
Leaf count of result is larger than twice the leaf count of optimal. 100 vs. \(2 (47) = 94\).
Time = 0.45 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.82 \[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\frac {2 \, b \arctan \left (\frac {b \cos \left (d x + c\right ) + a + b}{\sqrt {-a b - b^{2}} \cos \left (d x + c\right ) + \sqrt {-a b - b^{2}}}\right )}{\sqrt {-a b - b^{2}} a} - \frac {\log \left (\frac {{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right )}{a}}{2 \, d} \] Input:
integrate(csc(d*x+c)/(a+b*sin(d*x+c)^2),x, algorithm="giac")
Output:
-1/2*(2*b*arctan((b*cos(d*x + c) + a + b)/(sqrt(-a*b - b^2)*cos(d*x + c) + sqrt(-a*b - b^2)))/(sqrt(-a*b - b^2)*a) - log(abs(-cos(d*x + c) + 1)/abs( cos(d*x + c) + 1))/a)/d
Time = 36.57 (sec) , antiderivative size = 457, normalized size of antiderivative = 8.31 \[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\mathrm {atanh}\left (\cos \left (c+d\,x\right )\right )}{a\,d}-\frac {\mathrm {atan}\left (\frac {\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )+\frac {\left (2\,a^2\,b^2-\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}+\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )-\frac {\left (2\,a^2\,b^2+\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}}{\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )+\frac {\left (2\,a^2\,b^2-\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}-\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )-\frac {\left (2\,a^2\,b^2+\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{d\,\left (a^2+b\,a\right )} \] Input:
int(1/(sin(c + d*x)*(a + b*sin(c + d*x)^2)),x)
Output:
- atanh(cos(c + d*x))/(a*d) - (atan((((2*b^3*cos(c + d*x) + ((2*a^2*b^2 - (cos(c + d*x)*(16*a^2*b^3 + 8*a^3*b^2)*(b*(a + b))^(1/2))/(4*(a*b + a^2))) *(b*(a + b))^(1/2))/(2*(a*b + a^2)))*(b*(a + b))^(1/2)*1i)/(a*b + a^2) + ( (2*b^3*cos(c + d*x) - ((2*a^2*b^2 + (cos(c + d*x)*(16*a^2*b^3 + 8*a^3*b^2) *(b*(a + b))^(1/2))/(4*(a*b + a^2)))*(b*(a + b))^(1/2))/(2*(a*b + a^2)))*( b*(a + b))^(1/2)*1i)/(a*b + a^2))/(((2*b^3*cos(c + d*x) + ((2*a^2*b^2 - (c os(c + d*x)*(16*a^2*b^3 + 8*a^3*b^2)*(b*(a + b))^(1/2))/(4*(a*b + a^2)))*( b*(a + b))^(1/2))/(2*(a*b + a^2)))*(b*(a + b))^(1/2))/(a*b + a^2) - ((2*b^ 3*cos(c + d*x) - ((2*a^2*b^2 + (cos(c + d*x)*(16*a^2*b^3 + 8*a^3*b^2)*(b*( a + b))^(1/2))/(4*(a*b + a^2)))*(b*(a + b))^(1/2))/(2*(a*b + a^2)))*(b*(a + b))^(1/2))/(a*b + a^2)))*(b*(a + b))^(1/2)*1i)/(d*(a*b + a^2))
Time = 0.20 (sec) , antiderivative size = 152, normalized size of antiderivative = 2.76 \[ \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx=\frac {-\sqrt {b}\, \sqrt {a +b}\, \mathrm {log}\left (-\sqrt {2 \sqrt {b}\, \sqrt {a +b}-a -2 b}+\sqrt {a}\, \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\sqrt {b}\, \sqrt {a +b}\, \mathrm {log}\left (\sqrt {2 \sqrt {b}\, \sqrt {a +b}-a -2 b}+\sqrt {a}\, \tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sqrt {b}\, \sqrt {a +b}\, \mathrm {log}\left (2 \sqrt {b}\, \sqrt {a +b}+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a +a +2 b \right )+2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a +2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b}{2 a d \left (a +b \right )} \] Input:
int(csc(d*x+c)/(a+b*sin(d*x+c)^2),x)
Output:
( - sqrt(b)*sqrt(a + b)*log( - sqrt(2*sqrt(b)*sqrt(a + b) - a - 2*b) + sqr t(a)*tan((c + d*x)/2)) - sqrt(b)*sqrt(a + b)*log(sqrt(2*sqrt(b)*sqrt(a + b ) - a - 2*b) + sqrt(a)*tan((c + d*x)/2)) + sqrt(b)*sqrt(a + b)*log(2*sqrt( b)*sqrt(a + b) + tan((c + d*x)/2)**2*a + a + 2*b) + 2*log(tan((c + d*x)/2) )*a + 2*log(tan((c + d*x)/2))*b)/(2*a*d*(a + b))