Integrand size = 7, antiderivative size = 28 \[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=\arctan (\cos (x)+\sin (x))-\frac {\text {arctanh}\left (\frac {\cos (x)-\sin (x)}{\sqrt {3}}\right )}{\sqrt {3}} \] Output:
arctan(cos(x)+sin(x))-1/3*arctanh(1/3*(cos(x)-sin(x))*3^(1/2))*3^(1/2)
Leaf count is larger than twice the leaf count of optimal. \(93\) vs. \(2(28)=56\).
Time = 0.82 (sec) , antiderivative size = 93, normalized size of antiderivative = 3.32 \[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=\arctan \left (1-\left (-1+\sqrt {3}\right ) \tan \left (\frac {x}{2}\right )\right )+\arctan \left (1+\left (1+\sqrt {3}\right ) \tan \left (\frac {x}{2}\right )\right )+\frac {-\log \left (\sec ^2\left (\frac {x}{2}\right ) \left (\sqrt {3}+\cos (x)-\sin (x)\right )\right )+\log \left (-\sec ^2\left (\frac {x}{2}\right ) \left (\sqrt {3}-\cos (x)+\sin (x)\right )\right )}{2 \sqrt {3}} \] Input:
Integrate[(Sec[x] + Sin[x])^(-1),x]
Output:
ArcTan[1 - (-1 + Sqrt[3])*Tan[x/2]] + ArcTan[1 + (1 + Sqrt[3])*Tan[x/2]] + (-Log[Sec[x/2]^2*(Sqrt[3] + Cos[x] - Sin[x])] + Log[-(Sec[x/2]^2*(Sqrt[3] - Cos[x] + Sin[x]))])/(2*Sqrt[3])
Result contains complex when optimal does not.
Time = 0.46 (sec) , antiderivative size = 111, normalized size of antiderivative = 3.96, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.571, Rules used = {3042, 4902, 2492, 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 \frac {1}{\sin (x)+\sec (x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1}{\sin (x)+\sec (x)}dx\) |
\(\Big \downarrow \) 4902 |
\(\displaystyle 2 \int \frac {1-\tan ^2\left (\frac {x}{2}\right )}{\tan ^4\left (\frac {x}{2}\right )-2 \tan ^3\left (\frac {x}{2}\right )+2 \tan ^2\left (\frac {x}{2}\right )+2 \tan \left (\frac {x}{2}\right )+1}d\tan \left (\frac {x}{2}\right )\) |
\(\Big \downarrow \) 2492 |
\(\displaystyle 2 \int \left (\frac {3 i-\sqrt {3}}{6 \left (-i \tan ^2\left (\frac {x}{2}\right )+\left (i+\sqrt {3}\right ) \tan \left (\frac {x}{2}\right )+i\right )}+\frac {3 i+\sqrt {3}}{6 \left (-i \tan ^2\left (\frac {x}{2}\right )+\left (i-\sqrt {3}\right ) \tan \left (\frac {x}{2}\right )+i\right )}\right )d\tan \left (\frac {x}{2}\right )\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle 2 \left (\frac {1}{6} \left (3+i \sqrt {3}\right ) \arctan \left (\frac {-2 i \tan \left (\frac {x}{2}\right )-\sqrt {3}+i}{\sqrt {2 \left (1+i \sqrt {3}\right )}}\right )-\frac {1}{6} \left (3-i \sqrt {3}\right ) \arctan \left (\frac {-2 i \tan \left (\frac {x}{2}\right )+\sqrt {3}+i}{\sqrt {2 \left (1-i \sqrt {3}\right )}}\right )\right )\) |
Input:
Int[(Sec[x] + Sin[x])^(-1),x]
Output:
2*(((3 + I*Sqrt[3])*ArcTan[(I - Sqrt[3] - (2*I)*Tan[x/2])/Sqrt[2*(1 + I*Sq rt[3])]])/6 - ((3 - I*Sqrt[3])*ArcTan[(I + Sqrt[3] - (2*I)*Tan[x/2])/Sqrt[ 2*(1 - I*Sqrt[3])]])/6)
Int[(Px_.)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2 + (d_.)*(x_)^3 + (e_.)*(x_)^4) ^(p_), x_Symbol] :> Simp[e^p Int[ExpandIntegrand[Px*(b/d + ((d + Sqrt[e*( (b^2 - 4*a*c)/a) + 8*a*d*(e/b)])/(2*e))*x + x^2)^p*(b/d + ((d - Sqrt[e*((b^ 2 - 4*a*c)/a) + 8*a*d*(e/b)])/(2*e))*x + x^2)^p, x], x], x] /; FreeQ[{a, b, c, d, e}, x] && PolyQ[Px, x] && ILtQ[p, 0] && EqQ[a*d^2 - b^2*e, 0]
Int[u_, x_Symbol] :> With[{w = Block[{$ShowSteps = False, $StepCounter = Nu ll}, Int[SubstFor[1/(1 + FreeFactors[Tan[FunctionOfTrig[u, x]/2], x]^2*x^2) , Tan[FunctionOfTrig[u, x]/2]/FreeFactors[Tan[FunctionOfTrig[u, x]/2], x], u, x], x]]}, Module[{v = FunctionOfTrig[u, x], d}, Simp[d = FreeFactors[Tan [v/2], x]; 2*(d/Coefficient[v, x, 1]) Subst[Int[SubstFor[1/(1 + d^2*x^2), Tan[v/2]/d, u, x], x], x, Tan[v/2]/d], x]] /; CalculusFreeQ[w, x]] /; Inve rseFunctionFreeQ[u, x] && !FalseQ[FunctionOfTrig[u, x]]
Result contains higher order function than in optimal. Order 9 vs. order 3.
Time = 1.68 (sec) , antiderivative size = 57, normalized size of antiderivative = 2.04
method | result | size |
default | \(\munderset {\textit {\_R} =\operatorname {RootOf}\left (\textit {\_Z}^{4}-2 \textit {\_Z}^{3}+2 \textit {\_Z}^{2}+2 \textit {\_Z} +1\right )}{\sum }\frac {\left (-\textit {\_R}^{2}+1\right ) \ln \left (\tan \left (\frac {x}{2}\right )-\textit {\_R} \right )}{2 \textit {\_R}^{3}-3 \textit {\_R}^{2}+2 \textit {\_R} +1}\) | \(57\) |
risch | \(\frac {i \ln \left ({\mathrm e}^{i x}-\frac {1}{2}+\frac {i}{2}+\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right )}{2}+\frac {\ln \left ({\mathrm e}^{i x}-\frac {1}{2}+\frac {i}{2}+\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6}+\frac {i \ln \left ({\mathrm e}^{i x}-\frac {1}{2}+\frac {i}{2}-\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right )}{2}-\frac {\ln \left ({\mathrm e}^{i x}-\frac {1}{2}+\frac {i}{2}-\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6}-\frac {i \ln \left ({\mathrm e}^{i x}+\frac {1}{2}-\frac {i}{2}+\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right )}{2}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {1}{2}-\frac {i}{2}+\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6}-\frac {i \ln \left ({\mathrm e}^{i x}+\frac {1}{2}-\frac {i}{2}-\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right )}{2}-\frac {\ln \left ({\mathrm e}^{i x}+\frac {1}{2}-\frac {i}{2}-\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6}\) | \(202\) |
Input:
int(1/(sec(x)+sin(x)),x,method=_RETURNVERBOSE)
Output:
sum((-_R^2+1)/(2*_R^3-3*_R^2+2*_R+1)*ln(tan(1/2*x)-_R),_R=RootOf(_Z^4-2*_Z ^3+2*_Z^2+2*_Z+1))
Leaf count of result is larger than twice the leaf count of optimal. 105 vs. \(2 (25) = 50\).
Time = 0.11 (sec) , antiderivative size = 105, normalized size of antiderivative = 3.75 \[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=-\frac {1}{12} \, \sqrt {3} \log \left ({\left (\sqrt {3} + \cos \left (x\right )\right )} \sin \left (x\right ) - \sqrt {3} \cos \left (x\right ) - 2\right ) + \frac {1}{12} \, \sqrt {3} \log \left ({\left (\sqrt {3} - \cos \left (x\right )\right )} \sin \left (x\right ) - \sqrt {3} \cos \left (x\right ) + 2\right ) - \frac {1}{2} \, \arctan \left (-\frac {\sqrt {3} \cos \left (x\right ) - \sqrt {3} \sin \left (x\right ) + 2}{\cos \left (x\right ) + \sin \left (x\right )}\right ) + \frac {1}{2} \, \arctan \left (-\frac {\sqrt {3} \cos \left (x\right ) - \sqrt {3} \sin \left (x\right ) - 2}{\cos \left (x\right ) + \sin \left (x\right )}\right ) \] Input:
integrate(1/(sec(x)+sin(x)),x, algorithm="fricas")
Output:
-1/12*sqrt(3)*log((sqrt(3) + cos(x))*sin(x) - sqrt(3)*cos(x) - 2) + 1/12*s qrt(3)*log((sqrt(3) - cos(x))*sin(x) - sqrt(3)*cos(x) + 2) - 1/2*arctan(-( sqrt(3)*cos(x) - sqrt(3)*sin(x) + 2)/(cos(x) + sin(x))) + 1/2*arctan(-(sqr t(3)*cos(x) - sqrt(3)*sin(x) - 2)/(cos(x) + sin(x)))
\[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=\int \frac {1}{\sin {\left (x \right )} + \sec {\left (x \right )}}\, dx \] Input:
integrate(1/(sec(x)+sin(x)),x)
Output:
Integral(1/(sin(x) + sec(x)), x)
\[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=\int { \frac {1}{\sec \left (x\right ) + \sin \left (x\right )} \,d x } \] Input:
integrate(1/(sec(x)+sin(x)),x, algorithm="maxima")
Output:
integrate(1/(sec(x) + sin(x)), x)
Leaf count of result is larger than twice the leaf count of optimal. 81 vs. \(2 (25) = 50\).
Time = 0.11 (sec) , antiderivative size = 81, normalized size of antiderivative = 2.89 \[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=\frac {1}{2} \, \pi + \frac {1}{6} \, \sqrt {3} \log \left ({\left (\sqrt {3} + \tan \left (\frac {1}{2} \, x\right ) - 1\right )}^{2} + \tan \left (\frac {1}{2} \, x\right )^{2}\right ) - \frac {1}{6} \, \sqrt {3} \log \left ({\left (\sqrt {3} - \tan \left (\frac {1}{2} \, x\right ) + 1\right )}^{2} + \tan \left (\frac {1}{2} \, x\right )^{2}\right ) + \arctan \left ({\left (\sqrt {3} + 1\right )} \tan \left (\frac {1}{2} \, x\right ) + 1\right ) + \arctan \left (-{\left (\sqrt {3} - 1\right )} \tan \left (\frac {1}{2} \, x\right ) + 1\right ) \] Input:
integrate(1/(sec(x)+sin(x)),x, algorithm="giac")
Output:
1/2*pi + 1/6*sqrt(3)*log((sqrt(3) + tan(1/2*x) - 1)^2 + tan(1/2*x)^2) - 1/ 6*sqrt(3)*log((sqrt(3) - tan(1/2*x) + 1)^2 + tan(1/2*x)^2) + arctan((sqrt( 3) + 1)*tan(1/2*x) + 1) + arctan(-(sqrt(3) - 1)*tan(1/2*x) + 1)
Time = 0.31 (sec) , antiderivative size = 233, normalized size of antiderivative = 8.32 \[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=-\mathrm {atan}\left (\frac {96\,\mathrm {tan}\left (\frac {x}{2}\right )}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64-\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}+\frac {\sqrt {3}\,32{}\mathrm {i}}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64-\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}+\frac {32}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64-\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,32{}\mathrm {i}}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64-\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}\right )\,\left (-1+\frac {\sqrt {3}\,1{}\mathrm {i}}{3}\right )-\mathrm {atan}\left (-\frac {96\,\mathrm {tan}\left (\frac {x}{2}\right )}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64+\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}+\frac {\sqrt {3}\,32{}\mathrm {i}}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64+\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}-\frac {32}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64+\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,32{}\mathrm {i}}{64\,\mathrm {tan}\left (\frac {x}{2}\right )+64+\sqrt {3}\,\mathrm {tan}\left (\frac {x}{2}\right )\,64{}\mathrm {i}}\right )\,\left (1+\frac {\sqrt {3}\,1{}\mathrm {i}}{3}\right ) \] Input:
int(1/(sin(x) + 1/cos(x)),x)
Output:
- atan((96*tan(x/2))/(64*tan(x/2) - 3^(1/2)*tan(x/2)*64i + 64) + (3^(1/2)* 32i)/(64*tan(x/2) - 3^(1/2)*tan(x/2)*64i + 64) + 32/(64*tan(x/2) - 3^(1/2) *tan(x/2)*64i + 64) + (3^(1/2)*tan(x/2)*32i)/(64*tan(x/2) - 3^(1/2)*tan(x/ 2)*64i + 64))*((3^(1/2)*1i)/3 - 1) - atan((3^(1/2)*32i)/(64*tan(x/2) + 3^( 1/2)*tan(x/2)*64i + 64) - (96*tan(x/2))/(64*tan(x/2) + 3^(1/2)*tan(x/2)*64 i + 64) - 32/(64*tan(x/2) + 3^(1/2)*tan(x/2)*64i + 64) + (3^(1/2)*tan(x/2) *32i)/(64*tan(x/2) + 3^(1/2)*tan(x/2)*64i + 64))*((3^(1/2)*1i)/3 + 1)
\[ \int \frac {1}{\sec (x)+\sin (x)} \, dx=\int \frac {1}{\sec \left (x \right )+\sin \left (x \right )}d x \] Input:
int(1/(sec(x)+sin(x)),x)
Output:
int(1/(sec(x) + sin(x)),x)