Integrand size = 28, antiderivative size = 131 \[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=-\frac {6 a^2 b \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} (a+b)^{5/2} d}+\frac {a \csc (c+d x)}{\left (a^2-b^2\right ) d (b+a \cos (c+d x))}+\frac {\left (3 a b-\left (2 a^2+b^2\right ) \cos (c+d x)\right ) \csc (c+d x)}{\left (a^2-b^2\right )^2 d} \] Output:
-6*a^2*b*arctanh((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b)^(1/2))/(a-b)^(5/2)/( a+b)^(5/2)/d+a*csc(d*x+c)/(a^2-b^2)/d/(b+a*cos(d*x+c))+(3*a*b-(2*a^2+b^2)* cos(d*x+c))*csc(d*x+c)/(a^2-b^2)^2/d
Time = 0.67 (sec) , antiderivative size = 121, normalized size of antiderivative = 0.92 \[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {\frac {12 a^2 b \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2}}-\frac {\cot \left (\frac {1}{2} (c+d x)\right )}{(a+b)^2}+\frac {\frac {2 a^3 \sin (c+d x)}{(a+b)^2 (b+a \cos (c+d x))}+\tan \left (\frac {1}{2} (c+d x)\right )}{(a-b)^2}}{2 d} \] Input:
Integrate[Sec[c + d*x]^2/(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]
Output:
((12*a^2*b*ArcTanh[((-a + b)*Tan[(c + d*x)/2])/Sqrt[a^2 - b^2]])/(a^2 - b^ 2)^(5/2) - Cot[(c + d*x)/2]/(a + b)^2 + ((2*a^3*Sin[c + d*x])/((a + b)^2*( b + a*Cos[c + d*x])) + Tan[(c + d*x)/2])/(a - b)^2)/(2*d)
Time = 0.70 (sec) , antiderivative size = 157, normalized size of antiderivative = 1.20, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.393, Rules used = {3042, 4897, 3042, 3173, 25, 3042, 3345, 27, 3042, 3138, 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 {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {\sec (c+d x)^2}{(a \sin (c+d x)+b \tan (c+d x))^2}dx\) |
\(\Big \downarrow \) 4897 |
\(\displaystyle \int \frac {\csc ^2(c+d x)}{(a \cos (c+d x)+b)^2}dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1}{\cos \left (c+d x-\frac {\pi }{2}\right )^2 \left (b-a \sin \left (c+d x-\frac {\pi }{2}\right )\right )^2}dx\) |
\(\Big \downarrow \) 3173 |
\(\displaystyle \frac {\int -\frac {(b-2 a \cos (c+d x)) \csc ^2(c+d x)}{b+a \cos (c+d x)}dx}{a^2-b^2}+\frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}-\frac {\int \frac {(b-2 a \cos (c+d x)) \csc ^2(c+d x)}{b+a \cos (c+d x)}dx}{a^2-b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}-\frac {\int \frac {b+2 a \sin \left (c+d x-\frac {\pi }{2}\right )}{\cos \left (c+d x-\frac {\pi }{2}\right )^2 \left (b-a \sin \left (c+d x-\frac {\pi }{2}\right )\right )}dx}{a^2-b^2}\) |
\(\Big \downarrow \) 3345 |
\(\displaystyle \frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}-\frac {\frac {\int \frac {3 a^2 b}{b+a \cos (c+d x)}dx}{a^2-b^2}-\frac {\csc (c+d x) \left (3 a b-\left (2 a^2+b^2\right ) \cos (c+d x)\right )}{d \left (a^2-b^2\right )}}{a^2-b^2}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}-\frac {\frac {3 a^2 b \int \frac {1}{b+a \cos (c+d x)}dx}{a^2-b^2}-\frac {\csc (c+d x) \left (3 a b-\left (2 a^2+b^2\right ) \cos (c+d x)\right )}{d \left (a^2-b^2\right )}}{a^2-b^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}-\frac {\frac {3 a^2 b \int \frac {1}{b+a \sin \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2-b^2}-\frac {\csc (c+d x) \left (3 a b-\left (2 a^2+b^2\right ) \cos (c+d x)\right )}{d \left (a^2-b^2\right )}}{a^2-b^2}\) |
\(\Big \downarrow \) 3138 |
\(\displaystyle \frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}-\frac {\frac {6 a^2 b \int \frac {1}{-\left ((a-b) \tan ^2\left (\frac {1}{2} (c+d x)\right )\right )+a+b}d\tan \left (\frac {1}{2} (c+d x)\right )}{d \left (a^2-b^2\right )}-\frac {\csc (c+d x) \left (3 a b-\left (2 a^2+b^2\right ) \cos (c+d x)\right )}{d \left (a^2-b^2\right )}}{a^2-b^2}\) |
\(\Big \downarrow \) 221 |
\(\displaystyle \frac {a \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)}-\frac {\frac {6 a^2 b \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{d \sqrt {a-b} \sqrt {a+b} \left (a^2-b^2\right )}-\frac {\csc (c+d x) \left (3 a b-\left (2 a^2+b^2\right ) \cos (c+d x)\right )}{d \left (a^2-b^2\right )}}{a^2-b^2}\) |
Input:
Int[Sec[c + d*x]^2/(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]
Output:
(a*Csc[c + d*x])/((a^2 - b^2)*d*(b + a*Cos[c + d*x])) - ((6*a^2*b*ArcTanh[ (Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(Sqrt[a - b]*Sqrt[a + b]*(a^2 - b^2)*d) - ((3*a*b - (2*a^2 + b^2)*Cos[c + d*x])*Csc[c + d*x])/((a^2 - b ^2)*d))/(a^2 - b^2)
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
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[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d) Subst[Int[1/(a + b + (a - b)*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[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x _)])^(m_), x_Symbol] :> Simp[(-b)*(g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^(m + 1)/(f*g*(a^2 - b^2)*(m + 1))), x] + Simp[1/((a^2 - b^2)*(m + 1)) Int[(g*Cos[e + f*x])^p*(a + b*Sin[e + f*x])^(m + 1)*(a*(m + 1) - b*(m + p + 2)*Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b ^2, 0] && LtQ[m, -1] && IntegersQ[2*m, 2*p]
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x _)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(g*Co s[e + f*x])^(p + 1)*(a + b*Sin[e + f*x])^(m + 1)*((b*c - a*d - (a*c - b*d)* Sin[e + f*x])/(f*g*(a^2 - b^2)*(p + 1))), x] + Simp[1/(g^2*(a^2 - b^2)*(p + 1)) Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*x])^m*Simp[c*(a^2*(p + 2) - b^2*(m + p + 2)) + a*b*d*m + b*(a*c - b*d)*(m + p + 3)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, g, m}, x] && NeQ[a^2 - b^2, 0] && Lt Q[p, -1] && IntegerQ[2*m]
Time = 6.94 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.18
method | result | size |
derivativedivides | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}-4 a b +2 b^{2}}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}+\frac {2 a^{2} \left (-\frac {a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-a -b}-\frac {3 b \,\operatorname {arctanh}\left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}}{d}\) | \(155\) |
default | \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a^{2}-4 a b +2 b^{2}}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}+\frac {2 a^{2} \left (-\frac {a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-a -b}-\frac {3 b \,\operatorname {arctanh}\left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}}{d}\) | \(155\) |
risch | \(-\frac {2 i \left (-3 \,{\mathrm e}^{3 i \left (d x +c \right )} a^{2} b -3 a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+{\mathrm e}^{i \left (d x +c \right )} a^{2} b +2 \,{\mathrm e}^{i \left (d x +c \right )} b^{3}+2 a^{3}+a \,b^{2}\right )}{\left (a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right ) \left (a^{2}-b^{2}\right )^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) d}+\frac {3 b \,a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {-i a^{2}+i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}-\frac {3 b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right ) a^{2}}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}\) | \(296\) |
Input:
int(sec(d*x+c)^2/(a*sin(d*x+c)+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)
Output:
1/d*(1/2*tan(1/2*d*x+1/2*c)/(a^2-2*a*b+b^2)-1/2/(a+b)^2/tan(1/2*d*x+1/2*c) +2*a^2/(a-b)^2/(a+b)^2*(-a*tan(1/2*d*x+1/2*c)/(tan(1/2*d*x+1/2*c)^2*a-b*ta n(1/2*d*x+1/2*c)^2-a-b)-3*b/((a+b)*(a-b))^(1/2)*arctanh(tan(1/2*d*x+1/2*c) *(a-b)/((a+b)*(a-b))^(1/2))))
Time = 0.10 (sec) , antiderivative size = 516, normalized size of antiderivative = 3.94 \[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\left [\frac {2 \, a^{5} + 2 \, a^{3} b^{2} - 4 \, a b^{4} + 3 \, {\left (a^{3} b \cos \left (d x + c\right ) + a^{2} b^{2}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) \sin \left (d x + c\right ) - 2 \, {\left (2 \, a^{5} - a^{3} b^{2} - a b^{4}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (d x + c\right )}{2 \, {\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d\right )} \sin \left (d x + c\right )}, \frac {a^{5} + a^{3} b^{2} - 2 \, a b^{4} - 3 \, {\left (a^{3} b \cos \left (d x + c\right ) + a^{2} b^{2}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - {\left (2 \, a^{5} - a^{3} b^{2} - a b^{4}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} \cos \left (d x + c\right )}{{\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d\right )} \sin \left (d x + c\right )}\right ] \] Input:
integrate(sec(d*x+c)^2/(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="fricas" )
Output:
[1/2*(2*a^5 + 2*a^3*b^2 - 4*a*b^4 + 3*(a^3*b*cos(d*x + c) + a^2*b^2)*sqrt( a^2 - b^2)*log((2*a*b*cos(d*x + c) - (a^2 - 2*b^2)*cos(d*x + c)^2 - 2*sqrt (a^2 - b^2)*(b*cos(d*x + c) + a)*sin(d*x + c) + 2*a^2 - b^2)/(a^2*cos(d*x + c)^2 + 2*a*b*cos(d*x + c) + b^2))*sin(d*x + c) - 2*(2*a^5 - a^3*b^2 - a* b^4)*cos(d*x + c)^2 + 2*(a^4*b - 2*a^2*b^3 + b^5)*cos(d*x + c))/(((a^7 - 3 *a^5*b^2 + 3*a^3*b^4 - a*b^6)*d*cos(d*x + c) + (a^6*b - 3*a^4*b^3 + 3*a^2* b^5 - b^7)*d)*sin(d*x + c)), (a^5 + a^3*b^2 - 2*a*b^4 - 3*(a^3*b*cos(d*x + c) + a^2*b^2)*sqrt(-a^2 + b^2)*arctan(-sqrt(-a^2 + b^2)*(b*cos(d*x + c) + a)/((a^2 - b^2)*sin(d*x + c)))*sin(d*x + c) - (2*a^5 - a^3*b^2 - a*b^4)*c os(d*x + c)^2 + (a^4*b - 2*a^2*b^3 + b^5)*cos(d*x + c))/(((a^7 - 3*a^5*b^2 + 3*a^3*b^4 - a*b^6)*d*cos(d*x + c) + (a^6*b - 3*a^4*b^3 + 3*a^2*b^5 - b^ 7)*d)*sin(d*x + c))]
\[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\int \frac {\sec ^{2}{\left (c + d x \right )}}{\left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right )^{2}}\, dx \] Input:
integrate(sec(d*x+c)**2/(a*sin(d*x+c)+b*tan(d*x+c))**2,x)
Output:
Integral(sec(c + d*x)**2/(a*sin(c + d*x) + b*tan(c + d*x))**2, x)
Exception generated. \[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\text {Exception raised: ValueError} \] Input:
integrate(sec(d*x+c)^2/(a*sin(d*x+c)+b*tan(d*x+c))^2,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
Leaf count of result is larger than twice the leaf count of optimal. 284 vs. \(2 (122) = 244\).
Time = 0.34 (sec) , antiderivative size = 284, normalized size of antiderivative = 2.17 \[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {\frac {12 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )} a^{2} b}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {-a^{2} + b^{2}}} + \frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2} - 2 \, a b + b^{2}} - \frac {5 \, a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 3 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{3} + a^{2} b + a b^{2} - b^{3}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}}{2 \, d} \] Input:
integrate(sec(d*x+c)^2/(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="giac")
Output:
1/2*(12*(pi*floor(1/2*(d*x + c)/pi + 1/2)*sgn(2*a - 2*b) + arctan((a*tan(1 /2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sqrt(-a^2 + b^2)))*a^2*b/((a^4 - 2*a^2*b^2 + b^4)*sqrt(-a^2 + b^2)) + tan(1/2*d*x + 1/2*c)/(a^2 - 2*a*b + b^2) - (5*a^3*tan(1/2*d*x + 1/2*c)^2 - 3*a^2*b*tan(1/2*d*x + 1/2*c)^2 + 3* a*b^2*tan(1/2*d*x + 1/2*c)^2 - b^3*tan(1/2*d*x + 1/2*c)^2 - a^3 + a^2*b + a*b^2 - b^3)/((a^4 - 2*a^2*b^2 + b^4)*(a*tan(1/2*d*x + 1/2*c)^3 - b*tan(1/ 2*d*x + 1/2*c)^3 - a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))))/d
Time = 16.94 (sec) , antiderivative size = 215, normalized size of antiderivative = 1.64 \[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d\,{\left (a-b\right )}^2}+\frac {\frac {a^2-2\,a\,b+b^2}{a+b}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (5\,a^3-3\,a^2\,b+3\,a\,b^2-b^3\right )}{{\left (a+b\right )}^2}}{d\,\left (\left (2\,a^3-6\,a^2\,b+6\,a\,b^2-2\,b^3\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (-2\,a^3+2\,a^2\,b+2\,a\,b^2-2\,b^3\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}-\frac {6\,a^2\,b\,\mathrm {atanh}\left (\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^4-2\,a^2\,b^2+b^4\right )}{{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{3/2}}\right )}{d\,{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{5/2}} \] Input:
int(1/(cos(c + d*x)^2*(a*sin(c + d*x) + b*tan(c + d*x))^2),x)
Output:
tan(c/2 + (d*x)/2)/(2*d*(a - b)^2) + ((a^2 - 2*a*b + b^2)/(a + b) - (tan(c /2 + (d*x)/2)^2*(3*a*b^2 - 3*a^2*b + 5*a^3 - b^3))/(a + b)^2)/(d*(tan(c/2 + (d*x)/2)^3*(6*a*b^2 - 6*a^2*b + 2*a^3 - 2*b^3) + tan(c/2 + (d*x)/2)*(2*a *b^2 + 2*a^2*b - 2*a^3 - 2*b^3))) - (6*a^2*b*atanh((tan(c/2 + (d*x)/2)*(a^ 4 + b^4 - 2*a^2*b^2))/((a + b)^(5/2)*(a - b)^(3/2))))/(d*(a + b)^(5/2)*(a - b)^(5/2))
Time = 0.22 (sec) , antiderivative size = 317, normalized size of antiderivative = 2.42 \[ \int \frac {\sec ^2(c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {-6 \sqrt {-a^{2}+b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b}{\sqrt {-a^{2}+b^{2}}}\right ) \cos \left (d x +c \right ) \sin \left (d x +c \right ) a^{3} b -6 \sqrt {-a^{2}+b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b}{\sqrt {-a^{2}+b^{2}}}\right ) \sin \left (d x +c \right ) a^{2} b^{2}+\cos \left (d x +c \right ) a^{4} b -2 \cos \left (d x +c \right ) a^{2} b^{3}+\cos \left (d x +c \right ) b^{5}+2 \sin \left (d x +c \right )^{2} a^{5}-\sin \left (d x +c \right )^{2} a^{3} b^{2}-\sin \left (d x +c \right )^{2} a \,b^{4}-a^{5}+2 a^{3} b^{2}-a \,b^{4}}{\sin \left (d x +c \right ) d \left (\cos \left (d x +c \right ) a^{7}-3 \cos \left (d x +c \right ) a^{5} b^{2}+3 \cos \left (d x +c \right ) a^{3} b^{4}-\cos \left (d x +c \right ) a \,b^{6}+a^{6} b -3 a^{4} b^{3}+3 a^{2} b^{5}-b^{7}\right )} \] Input:
int(sec(d*x+c)^2/(a*sin(d*x+c)+b*tan(d*x+c))^2,x)
Output:
( - 6*sqrt( - a**2 + b**2)*atan((tan((c + d*x)/2)*a - tan((c + d*x)/2)*b)/ sqrt( - a**2 + b**2))*cos(c + d*x)*sin(c + d*x)*a**3*b - 6*sqrt( - a**2 + b**2)*atan((tan((c + d*x)/2)*a - tan((c + d*x)/2)*b)/sqrt( - a**2 + b**2)) *sin(c + d*x)*a**2*b**2 + cos(c + d*x)*a**4*b - 2*cos(c + d*x)*a**2*b**3 + cos(c + d*x)*b**5 + 2*sin(c + d*x)**2*a**5 - sin(c + d*x)**2*a**3*b**2 - sin(c + d*x)**2*a*b**4 - a**5 + 2*a**3*b**2 - a*b**4)/(sin(c + d*x)*d*(cos (c + d*x)*a**7 - 3*cos(c + d*x)*a**5*b**2 + 3*cos(c + d*x)*a**3*b**4 - cos (c + d*x)*a*b**6 + a**6*b - 3*a**4*b**3 + 3*a**2*b**5 - b**7))