Integrand size = 13, antiderivative size = 84 \[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=-\frac {x}{a}+\frac {2 b^3 \text {arctanh}\left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2-b^2}}\right )}{a \left (a^2-b^2\right )^{3/2}}-\frac {b \sec (x)}{a^2-b^2}+\frac {a \tan (x)}{a^2-b^2} \] Output:
-x/a+2*b^3*arctanh((a+b*tan(1/2*x))/(a^2-b^2)^(1/2))/a/(a^2-b^2)^(3/2)-b*s ec(x)/(a^2-b^2)+a*tan(x)/(a^2-b^2)
Time = 0.27 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.04 \[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=-\frac {-2 b^3 \arctan \left (\frac {a+b \tan \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2}}\right )+\sqrt {-a^2+b^2} \left (-a^2 x+b^2 x-a b \sec (x)+a^2 \tan (x)\right )}{a \left (-a^2+b^2\right )^{3/2}} \] Input:
Integrate[Tan[x]^2/(a + b*Csc[x]),x]
Output:
-((-2*b^3*ArcTan[(a + b*Tan[x/2])/Sqrt[-a^2 + b^2]] + Sqrt[-a^2 + b^2]*(-( a^2*x) + b^2*x - a*b*Sec[x] + a^2*Tan[x]))/(a*(-a^2 + b^2)^(3/2)))
Time = 0.62 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.27, number of steps used = 15, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.077, Rules used = {3042, 4386, 3042, 3381, 3042, 3086, 24, 3214, 3042, 3139, 1083, 219, 3954, 24}
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 {\tan ^2(x)}{a+b \csc (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1}{\cot (x)^2 (a+b \csc (x))}dx\) |
\(\Big \downarrow \) 4386 |
\(\displaystyle \int \frac {\sin (x) \tan ^2(x)}{a \sin (x)+b}dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sin (x)^3}{\cos (x)^2 (a \sin (x)+b)}dx\) |
\(\Big \downarrow \) 3381 |
\(\displaystyle \frac {b^2 \int \frac {\sin (x)}{b+a \sin (x)}dx}{a^2-b^2}+\frac {a \int \tan ^2(x)dx}{a^2-b^2}-\frac {b \int \sec (x) \tan (x)dx}{a^2-b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {b^2 \int \frac {\sin (x)}{b+a \sin (x)}dx}{a^2-b^2}+\frac {a \int \tan (x)^2dx}{a^2-b^2}-\frac {b \int \sec (x) \tan (x)dx}{a^2-b^2}\) |
\(\Big \downarrow \) 3086 |
\(\displaystyle \frac {b^2 \int \frac {\sin (x)}{b+a \sin (x)}dx}{a^2-b^2}+\frac {a \int \tan (x)^2dx}{a^2-b^2}-\frac {b \int 1d\sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {b^2 \int \frac {\sin (x)}{b+a \sin (x)}dx}{a^2-b^2}+\frac {a \int \tan (x)^2dx}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 3214 |
\(\displaystyle \frac {b^2 \left (\frac {x}{a}-\frac {b \int \frac {1}{b+a \sin (x)}dx}{a}\right )}{a^2-b^2}+\frac {a \int \tan (x)^2dx}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {b^2 \left (\frac {x}{a}-\frac {b \int \frac {1}{b+a \sin (x)}dx}{a}\right )}{a^2-b^2}+\frac {a \int \tan (x)^2dx}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 3139 |
\(\displaystyle \frac {b^2 \left (\frac {x}{a}-\frac {2 b \int \frac {1}{b \tan ^2\left (\frac {x}{2}\right )+2 a \tan \left (\frac {x}{2}\right )+b}d\tan \left (\frac {x}{2}\right )}{a}\right )}{a^2-b^2}+\frac {a \int \tan (x)^2dx}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 1083 |
\(\displaystyle \frac {b^2 \left (\frac {4 b \int \frac {1}{4 \left (a^2-b^2\right )-\left (2 a+2 b \tan \left (\frac {x}{2}\right )\right )^2}d\left (2 a+2 b \tan \left (\frac {x}{2}\right )\right )}{a}+\frac {x}{a}\right )}{a^2-b^2}+\frac {a \int \tan (x)^2dx}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 219 |
\(\displaystyle \frac {a \int \tan (x)^2dx}{a^2-b^2}+\frac {b^2 \left (\frac {2 b \text {arctanh}\left (\frac {2 a+2 b \tan \left (\frac {x}{2}\right )}{2 \sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2}}+\frac {x}{a}\right )}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 3954 |
\(\displaystyle \frac {a (\tan (x)-\int 1dx)}{a^2-b^2}+\frac {b^2 \left (\frac {2 b \text {arctanh}\left (\frac {2 a+2 b \tan \left (\frac {x}{2}\right )}{2 \sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2}}+\frac {x}{a}\right )}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {b^2 \left (\frac {2 b \text {arctanh}\left (\frac {2 a+2 b \tan \left (\frac {x}{2}\right )}{2 \sqrt {a^2-b^2}}\right )}{a \sqrt {a^2-b^2}}+\frac {x}{a}\right )}{a^2-b^2}+\frac {a (\tan (x)-x)}{a^2-b^2}-\frac {b \sec (x)}{a^2-b^2}\) |
Input:
Int[Tan[x]^2/(a + b*Csc[x]),x]
Output:
(b^2*(x/a + (2*b*ArcTanh[(2*a + 2*b*Tan[x/2])/(2*Sqrt[a^2 - b^2])])/(a*Sqr t[a^2 - b^2])))/(a^2 - b^2) - (b*Sec[x])/(a^2 - b^2) + (a*(-x + Tan[x]))/( a^2 - b^2)
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_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Simp[-2 Subst[I nt[1/Simp[b^2 - 4*a*c - x^2, x], x], x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x]
Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^( n_.), x_Symbol] :> Simp[a/f Subst[Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2 ), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2 ] && !(IntegerQ[m/2] && LtQ[0, m, n + 1])
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = Fre eFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d) Subst[Int[1/(a + 2*b*e*x + a *e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] && NeQ [a^2 - b^2, 0]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d Int[1/(c + d *Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
Int[((cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^( n_))/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[a*(d^2/(a^2 - b^2)) Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n - 2), x], x] + (-Simp[ b*(d/(a^2 - b^2)) Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n - 1), x], x] - Simp[a^2*(d^2/(g^2*(a^2 - b^2))) Int[(g*Cos[e + f*x])^(p + 2)*((d*Sin[ e + f*x])^(n - 2)/(a + b*Sin[e + f*x])), x], x]) /; FreeQ[{a, b, d, e, f, g }, x] && NeQ[a^2 - b^2, 0] && IntegersQ[2*n, 2*p] && LtQ[p, -1] && GtQ[n, 1 ]
Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d *x])^(n - 1)/(d*(n - 1))), x] - Simp[b^2 Int[(b*Tan[c + d*x])^(n - 2), x] , x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]
Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n _), x_Symbol] :> Int[Cos[c + d*x]^m*((b + a*Sin[c + d*x])^n/Sin[c + d*x]^(m + n)), x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 - b^2, 0] && IntegerQ[n] && IntegerQ[m] && (IntegerQ[m/2] || LeQ[m, 1])
Time = 0.14 (sec) , antiderivative size = 106, normalized size of antiderivative = 1.26
method | result | size |
default | \(-\frac {2 \arctan \left (\tan \left (\frac {x}{2}\right )\right )}{a}-\frac {16}{\left (16 a +16 b \right ) \left (\tan \left (\frac {x}{2}\right )-1\right )}-\frac {2 b^{3} \arctan \left (\frac {2 b \tan \left (\frac {x}{2}\right )+2 a}{2 \sqrt {-a^{2}+b^{2}}}\right )}{\left (a -b \right ) \left (a +b \right ) a \sqrt {-a^{2}+b^{2}}}-\frac {16}{\left (16 a -16 b \right ) \left (\tan \left (\frac {x}{2}\right )+1\right )}\) | \(106\) |
risch | \(-\frac {x}{a}+\frac {-2 i a +2 b \,{\mathrm e}^{i x}}{\left ({\mathrm e}^{2 i x}+1\right ) \left (-a^{2}+b^{2}\right )}-\frac {b^{3} \ln \left ({\mathrm e}^{i x}+\frac {i b \sqrt {a^{2}-b^{2}}-a^{2}+b^{2}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) a}+\frac {b^{3} \ln \left ({\mathrm e}^{i x}+\frac {i b \sqrt {a^{2}-b^{2}}+a^{2}-b^{2}}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right ) \left (a -b \right ) a}\) | \(195\) |
Input:
int(tan(x)^2/(a+b*csc(x)),x,method=_RETURNVERBOSE)
Output:
-2/a*arctan(tan(1/2*x))-16/(16*a+16*b)/(tan(1/2*x)-1)-2/(a-b)/(a+b)*b^3/a/ (-a^2+b^2)^(1/2)*arctan(1/2*(2*b*tan(1/2*x)+2*a)/(-a^2+b^2)^(1/2))-16/(16* a-16*b)/(tan(1/2*x)+1)
Time = 0.11 (sec) , antiderivative size = 296, normalized size of antiderivative = 3.52 \[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=\left [-\frac {\sqrt {a^{2} - b^{2}} b^{3} \cos \left (x\right ) \log \left (-\frac {{\left (a^{2} - 2 \, b^{2}\right )} \cos \left (x\right )^{2} + 2 \, a b \sin \left (x\right ) + a^{2} + b^{2} - 2 \, {\left (b \cos \left (x\right ) \sin \left (x\right ) + a \cos \left (x\right )\right )} \sqrt {a^{2} - b^{2}}}{a^{2} \cos \left (x\right )^{2} - 2 \, a b \sin \left (x\right ) - a^{2} - b^{2}}\right ) + 2 \, a^{3} b - 2 \, a b^{3} + 2 \, {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \cos \left (x\right ) - 2 \, {\left (a^{4} - a^{2} b^{2}\right )} \sin \left (x\right )}{2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (x\right )}, \frac {\sqrt {-a^{2} + b^{2}} b^{3} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \sin \left (x\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \cos \left (x\right )}\right ) \cos \left (x\right ) - a^{3} b + a b^{3} - {\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} x \cos \left (x\right ) + {\left (a^{4} - a^{2} b^{2}\right )} \sin \left (x\right )}{{\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (x\right )}\right ] \] Input:
integrate(tan(x)^2/(a+b*csc(x)),x, algorithm="fricas")
Output:
[-1/2*(sqrt(a^2 - b^2)*b^3*cos(x)*log(-((a^2 - 2*b^2)*cos(x)^2 + 2*a*b*sin (x) + a^2 + b^2 - 2*(b*cos(x)*sin(x) + a*cos(x))*sqrt(a^2 - b^2))/(a^2*cos (x)^2 - 2*a*b*sin(x) - a^2 - b^2)) + 2*a^3*b - 2*a*b^3 + 2*(a^4 - 2*a^2*b^ 2 + b^4)*x*cos(x) - 2*(a^4 - a^2*b^2)*sin(x))/((a^5 - 2*a^3*b^2 + a*b^4)*c os(x)), (sqrt(-a^2 + b^2)*b^3*arctan(-sqrt(-a^2 + b^2)*(b*sin(x) + a)/((a^ 2 - b^2)*cos(x)))*cos(x) - a^3*b + a*b^3 - (a^4 - 2*a^2*b^2 + b^4)*x*cos(x ) + (a^4 - a^2*b^2)*sin(x))/((a^5 - 2*a^3*b^2 + a*b^4)*cos(x))]
\[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=\int \frac {\tan ^{2}{\left (x \right )}}{a + b \csc {\left (x \right )}}\, dx \] Input:
integrate(tan(x)**2/(a+b*csc(x)),x)
Output:
Integral(tan(x)**2/(a + b*csc(x)), x)
Exception generated. \[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=\text {Exception raised: ValueError} \] Input:
integrate(tan(x)^2/(a+b*csc(x)),x, algorithm="maxima")
Output:
Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?` f or more de
Time = 0.17 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.23 \[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=-\frac {2 \, {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (\frac {1}{2} \, x\right ) + a}{\sqrt {-a^{2} + b^{2}}}\right )\right )} b^{3}}{{\left (a^{3} - a b^{2}\right )} \sqrt {-a^{2} + b^{2}}} - \frac {x}{a} - \frac {2 \, {\left (a \tan \left (\frac {1}{2} \, x\right ) - b\right )}}{{\left (a^{2} - b^{2}\right )} {\left (\tan \left (\frac {1}{2} \, x\right )^{2} - 1\right )}} \] Input:
integrate(tan(x)^2/(a+b*csc(x)),x, algorithm="giac")
Output:
-2*(pi*floor(1/2*x/pi + 1/2)*sgn(b) + arctan((b*tan(1/2*x) + a)/sqrt(-a^2 + b^2)))*b^3/((a^3 - a*b^2)*sqrt(-a^2 + b^2)) - x/a - 2*(a*tan(1/2*x) - b) /((a^2 - b^2)*(tan(1/2*x)^2 - 1))
Time = 16.93 (sec) , antiderivative size = 2341, normalized size of antiderivative = 27.87 \[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=\text {Too large to display} \] Input:
int(tan(x)^2/(a + b/sin(x)),x)
Output:
((2*b)/(a^2 - b^2) - (2*a*tan(x/2))/(a^2 - b^2))/(tan(x/2)^2 - 1) + (2*ata n((64*a^11*b*tan(x/2))/(192*a*b^11 - 64*a^11*b - 768*a^3*b^9 + 1216*a^5*b^ 7 - 960*a^7*b^5 + 384*a^9*b^3) - (192*a*b^11*tan(x/2))/(192*a*b^11 - 64*a^ 11*b - 768*a^3*b^9 + 1216*a^5*b^7 - 960*a^7*b^5 + 384*a^9*b^3) + (768*a^3* b^9*tan(x/2))/(192*a*b^11 - 64*a^11*b - 768*a^3*b^9 + 1216*a^5*b^7 - 960*a ^7*b^5 + 384*a^9*b^3) - (1216*a^5*b^7*tan(x/2))/(192*a*b^11 - 64*a^11*b - 768*a^3*b^9 + 1216*a^5*b^7 - 960*a^7*b^5 + 384*a^9*b^3) + (960*a^7*b^5*tan (x/2))/(192*a*b^11 - 64*a^11*b - 768*a^3*b^9 + 1216*a^5*b^7 - 960*a^7*b^5 + 384*a^9*b^3) - (384*a^9*b^3*tan(x/2))/(192*a*b^11 - 64*a^11*b - 768*a^3* b^9 + 1216*a^5*b^7 - 960*a^7*b^5 + 384*a^9*b^3)))/a + (b^3*atan(((b^3*((a + b)^3*(a - b)^3)^(1/2)*(tan(x/2)*(64*a^12*b + 64*b^13 - 320*a^2*b^11 + 73 6*a^4*b^9 - 992*a^6*b^7 + 800*a^8*b^5 - 352*a^10*b^3) - 32*a*b^12 + 160*a^ 3*b^10 - 320*a^5*b^8 + 320*a^7*b^6 - 160*a^9*b^4 + 32*a^11*b^2 + (b^3*((a + b)^3*(a - b)^3)^(1/2)*(tan(x/2)*(64*a^2*b^12 - 256*a^4*b^10 + 384*a^6*b^ 8 - 256*a^8*b^6 + 64*a^10*b^4) - 32*a^13*b + 64*a^3*b^11 - 288*a^5*b^9 + 5 12*a^7*b^7 - 448*a^9*b^5 + 192*a^11*b^3 + (b^3*((a + b)^3*(a - b)^3)^(1/2) *(tan(x/2)*(96*a^14*b + 64*a^2*b^13 - 416*a^4*b^11 + 1120*a^6*b^9 - 1600*a ^8*b^7 + 1280*a^10*b^5 - 544*a^12*b^3) - 32*a^3*b^12 + 160*a^5*b^10 - 320* a^7*b^8 + 320*a^9*b^6 - 160*a^11*b^4 + 32*a^13*b^2))/(a*b^6 - a^7 - 3*a^3* b^4 + 3*a^5*b^2)))/(a*b^6 - a^7 - 3*a^3*b^4 + 3*a^5*b^2))*1i)/(a*b^6 - ...
Time = 0.18 (sec) , antiderivative size = 162, normalized size of antiderivative = 1.93 \[ \int \frac {\tan ^2(x)}{a+b \csc (x)} \, dx=\frac {2 \sqrt {-a^{2}+b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {x}{2}\right ) b +a}{\sqrt {-a^{2}+b^{2}}}\right ) \cos \left (x \right ) b^{3}+\cos \left (x \right ) \tan \left (x \right ) a^{4}-2 \cos \left (x \right ) \tan \left (x \right ) a^{2} b^{2}+\cos \left (x \right ) \tan \left (x \right ) b^{4}-\cos \left (x \right ) a^{4} x +\cos \left (x \right ) a^{3} b +2 \cos \left (x \right ) a^{2} b^{2} x -\cos \left (x \right ) a \,b^{3}-\cos \left (x \right ) b^{4} x +\sin \left (x \right ) a^{2} b^{2}-\sin \left (x \right ) b^{4}-a^{3} b +a \,b^{3}}{\cos \left (x \right ) a \left (a^{4}-2 a^{2} b^{2}+b^{4}\right )} \] Input:
int(tan(x)^2/(a+b*csc(x)),x)
Output:
(2*sqrt( - a**2 + b**2)*atan((tan(x/2)*b + a)/sqrt( - a**2 + b**2))*cos(x) *b**3 + cos(x)*tan(x)*a**4 - 2*cos(x)*tan(x)*a**2*b**2 + cos(x)*tan(x)*b** 4 - cos(x)*a**4*x + cos(x)*a**3*b + 2*cos(x)*a**2*b**2*x - cos(x)*a*b**3 - cos(x)*b**4*x + sin(x)*a**2*b**2 - sin(x)*b**4 - a**3*b + a*b**3)/(cos(x) *a*(a**4 - 2*a**2*b**2 + b**4))