\(\int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx\) [195]

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

Optimal result

Integrand size = 20, antiderivative size = 57 \[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=\frac {\arctan (\cos (c+d x)-\sin (c+d x))}{a d}-\frac {\text {arctanh}\left (\frac {\cos (c+d x)+\sin (c+d x)}{\sqrt {3}}\right )}{\sqrt {3} a d} \] Output:

arctan(cos(d*x+c)-sin(d*x+c))/a/d-1/3*arctanh(1/3*(cos(d*x+c)+sin(d*x+c))* 
3^(1/2))*3^(1/2)/a/d
 

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3 in optimal.

Time = 2.60 (sec) , antiderivative size = 546, normalized size of antiderivative = 9.58 \[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=-\frac {\left (\text {RootSum}\left [-1-4 i e^{2 i c} \text {$\#$1}^2+e^{4 i c} \text {$\#$1}^4\&,\frac {d x+i \log \left (e^{i d x}-\text {$\#$1}\right )+d e^{2 i c} \sqrt {-e^{-2 i c}} x \text {$\#$1}+i e^{2 i c} \sqrt {-e^{-2 i c}} \log \left (e^{i d x}-\text {$\#$1}\right ) \text {$\#$1}-(1-2 i) d e^{2 i c} x \text {$\#$1}^2-(2+i) e^{2 i c} \log \left (e^{i d x}-\text {$\#$1}\right ) \text {$\#$1}^2+d e^{4 i c} \sqrt {-e^{-2 i c}} x \text {$\#$1}^3+i e^{4 i c} \sqrt {-e^{-2 i c}} \log \left (e^{i d x}-\text {$\#$1}\right ) \text {$\#$1}^3}{-i+2 e^{2 i c} \text {$\#$1}^2}\&\right ]+\text {RootSum}\left [-1-4 i e^{2 i c} \text {$\#$1}^2+e^{4 i c} \text {$\#$1}^4\&,\frac {-d x-i \log \left (e^{i d x}-\text {$\#$1}\right )+d e^{2 i c} \sqrt {-e^{-2 i c}} x \text {$\#$1}+i e^{2 i c} \sqrt {-e^{-2 i c}} \log \left (e^{i d x}-\text {$\#$1}\right ) \text {$\#$1}+(1-2 i) d e^{2 i c} x \text {$\#$1}^2+(2+i) e^{2 i c} \log \left (e^{i d x}-\text {$\#$1}\right ) \text {$\#$1}^2+d e^{4 i c} \sqrt {-e^{-2 i c}} x \text {$\#$1}^3+i e^{4 i c} \sqrt {-e^{-2 i c}} \log \left (e^{i d x}-\text {$\#$1}\right ) \text {$\#$1}^3}{-i+2 e^{2 i c} \text {$\#$1}^2}\&\right ]\right ) (\cos (c)-i \sin (c))}{4 a d \sqrt {-(\cos (c)-i \sin (c))^2}} \] Input:

Integrate[(-(a*Sec[c + d*x]) + a*Sin[c + d*x])^(-1),x]
 

Output:

-1/4*((RootSum[-1 - (4*I)*E^((2*I)*c)*#1^2 + E^((4*I)*c)*#1^4 & , (d*x + I 
*Log[E^(I*d*x) - #1] + d*E^((2*I)*c)*Sqrt[-E^((-2*I)*c)]*x*#1 + I*E^((2*I) 
*c)*Sqrt[-E^((-2*I)*c)]*Log[E^(I*d*x) - #1]*#1 - (1 - 2*I)*d*E^((2*I)*c)*x 
*#1^2 - (2 + I)*E^((2*I)*c)*Log[E^(I*d*x) - #1]*#1^2 + d*E^((4*I)*c)*Sqrt[ 
-E^((-2*I)*c)]*x*#1^3 + I*E^((4*I)*c)*Sqrt[-E^((-2*I)*c)]*Log[E^(I*d*x) - 
#1]*#1^3)/(-I + 2*E^((2*I)*c)*#1^2) & ] + RootSum[-1 - (4*I)*E^((2*I)*c)*# 
1^2 + E^((4*I)*c)*#1^4 & , (-(d*x) - I*Log[E^(I*d*x) - #1] + d*E^((2*I)*c) 
*Sqrt[-E^((-2*I)*c)]*x*#1 + I*E^((2*I)*c)*Sqrt[-E^((-2*I)*c)]*Log[E^(I*d*x 
) - #1]*#1 + (1 - 2*I)*d*E^((2*I)*c)*x*#1^2 + (2 + I)*E^((2*I)*c)*Log[E^(I 
*d*x) - #1]*#1^2 + d*E^((4*I)*c)*Sqrt[-E^((-2*I)*c)]*x*#1^3 + I*E^((4*I)*c 
)*Sqrt[-E^((-2*I)*c)]*Log[E^(I*d*x) - #1]*#1^3)/(-I + 2*E^((2*I)*c)*#1^2) 
& ])*(Cos[c] - I*Sin[c]))/(a*d*Sqrt[-(Cos[c] - I*Sin[c])^2])
 

Rubi [C] (verified)

Result contains complex when optimal does not.

Time = 0.42 (sec) , antiderivative size = 125, normalized size of antiderivative = 2.19, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3042, 4902, 25, 27, 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}{a \sin (c+d x)-a \sec (c+d x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{a \sin (c+d x)-a \sec (c+d x)}dx\)

\(\Big \downarrow \) 4902

\(\displaystyle \frac {2 \int -\frac {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )}{a \left (\tan ^4\left (\frac {1}{2} (c+d x)\right )+2 \tan ^3\left (\frac {1}{2} (c+d x)\right )+2 \tan ^2\left (\frac {1}{2} (c+d x)\right )-2 \tan \left (\frac {1}{2} (c+d x)\right )+1\right )}d\tan \left (\frac {1}{2} (c+d x)\right )}{d}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {2 \int \frac {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )}{a \left (\tan ^4\left (\frac {1}{2} (c+d x)\right )+2 \tan ^3\left (\frac {1}{2} (c+d x)\right )+2 \tan ^2\left (\frac {1}{2} (c+d x)\right )-2 \tan \left (\frac {1}{2} (c+d x)\right )+1\right )}d\tan \left (\frac {1}{2} (c+d x)\right )}{d}\)

\(\Big \downarrow \) 27

\(\displaystyle -\frac {2 \int \frac {1-\tan ^2\left (\frac {1}{2} (c+d x)\right )}{\tan ^4\left (\frac {1}{2} (c+d x)\right )+2 \tan ^3\left (\frac {1}{2} (c+d x)\right )+2 \tan ^2\left (\frac {1}{2} (c+d x)\right )-2 \tan \left (\frac {1}{2} (c+d x)\right )+1}d\tan \left (\frac {1}{2} (c+d x)\right )}{a d}\)

\(\Big \downarrow \) 2492

\(\displaystyle -\frac {2 \int \left (\frac {3 i-\sqrt {3}}{6 \left (-i \tan ^2\left (\frac {1}{2} (c+d x)\right )-\left (i+\sqrt {3}\right ) \tan \left (\frac {1}{2} (c+d x)\right )+i\right )}+\frac {3 i+\sqrt {3}}{6 \left (-i \tan ^2\left (\frac {1}{2} (c+d x)\right )-\left (i-\sqrt {3}\right ) \tan \left (\frac {1}{2} (c+d x)\right )+i\right )}\right )d\tan \left (\frac {1}{2} (c+d x)\right )}{a d}\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {2 \left (\frac {1}{6} \left (3-i \sqrt {3}\right ) \arctan \left (\frac {2 i \tan \left (\frac {1}{2} (c+d x)\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 {1}{2} (c+d x)\right )-\sqrt {3}+i}{\sqrt {2 \left (1+i \sqrt {3}\right )}}\right )\right )}{a d}\)

Input:

Int[(-(a*Sec[c + d*x]) + a*Sin[c + d*x])^(-1),x]
 

Output:

(-2*(-1/6*((3 + I*Sqrt[3])*ArcTan[(I - Sqrt[3] + (2*I)*Tan[(c + d*x)/2])/S 
qrt[2*(1 + I*Sqrt[3])]]) + ((3 - I*Sqrt[3])*ArcTan[(I + Sqrt[3] + (2*I)*Ta 
n[(c + d*x)/2])/Sqrt[2*(1 - I*Sqrt[3])]])/6))/(a*d)
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2492
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]
 

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

rule 4902
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]]
 
Maple [C] (verified)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 0.56 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.18

method result size
derivativedivides \(\frac {\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 {d x}{2}+\frac {c}{2}\right )-\textit {\_R} \right )}{2 \textit {\_R}^{3}+3 \textit {\_R}^{2}+2 \textit {\_R} -1}}{d a}\) \(67\)
default \(\frac {\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 {d x}{2}+\frac {c}{2}\right )-\textit {\_R} \right )}{2 \textit {\_R}^{3}+3 \textit {\_R}^{2}+2 \textit {\_R} -1}}{d a}\) \(67\)
risch \(-\frac {i \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {1}{2}-\frac {i}{2}-\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right )}{2 d a}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {1}{2}-\frac {i}{2}-\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6 d a}-\frac {i \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {1}{2}-\frac {i}{2}+\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right )}{2 d a}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {1}{2}-\frac {i}{2}+\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6 d a}+\frac {i \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {1}{2}+\frac {i}{2}-\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right )}{2 d a}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {1}{2}+\frac {i}{2}-\frac {i \sqrt {3}}{2}-\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6 d a}+\frac {i \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {1}{2}+\frac {i}{2}+\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right )}{2 d a}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {1}{2}+\frac {i}{2}+\frac {i \sqrt {3}}{2}+\frac {\sqrt {3}}{2}\right ) \sqrt {3}}{6 d a}\) \(282\)

Input:

int(1/(-a*sec(d*x+c)+a*sin(d*x+c)),x,method=_RETURNVERBOSE)
 

Output:

1/d/a*sum((_R^2-1)/(2*_R^3+3*_R^2+2*_R-1)*ln(tan(1/2*d*x+1/2*c)-_R),_R=Roo 
tOf(_Z^4+2*_Z^3+2*_Z^2-2*_Z+1))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 254 vs. \(2 (54) = 108\).

Time = 0.09 (sec) , antiderivative size = 254, normalized size of antiderivative = 4.46 \[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=\frac {\sqrt {\frac {1}{3}} a d \sqrt {\frac {1}{a^{2} d^{2}}} \log \left (-\frac {3}{2} \, \sqrt {\frac {1}{3}} {\left (a d \cos \left (d x + c\right ) + a d \sin \left (d x + c\right )\right )} \sqrt {\frac {1}{a^{2} d^{2}}} + \frac {1}{2} \, \cos \left (d x + c\right ) \sin \left (d x + c\right ) + 1\right ) - \sqrt {\frac {1}{3}} a d \sqrt {\frac {1}{a^{2} d^{2}}} \log \left (-\frac {3}{2} \, \sqrt {\frac {1}{3}} {\left (a d \cos \left (d x + c\right ) + a d \sin \left (d x + c\right )\right )} \sqrt {\frac {1}{a^{2} d^{2}}} - \frac {1}{2} \, \cos \left (d x + c\right ) \sin \left (d x + c\right ) - 1\right ) - 2 \, \arctan \left (-\frac {3 \, \sqrt {\frac {1}{3}} {\left (a d \cos \left (d x + c\right ) + a d \sin \left (d x + c\right )\right )} \sqrt {\frac {1}{a^{2} d^{2}}} + 2}{\cos \left (d x + c\right ) - \sin \left (d x + c\right )}\right ) + 2 \, \arctan \left (-\frac {3 \, \sqrt {\frac {1}{3}} {\left (a d \cos \left (d x + c\right ) + a d \sin \left (d x + c\right )\right )} \sqrt {\frac {1}{a^{2} d^{2}}} - 2}{\cos \left (d x + c\right ) - \sin \left (d x + c\right )}\right )}{4 \, a d} \] Input:

integrate(1/(-a*sec(d*x+c)+a*sin(d*x+c)),x, algorithm="fricas")
 

Output:

1/4*(sqrt(1/3)*a*d*sqrt(1/(a^2*d^2))*log(-3/2*sqrt(1/3)*(a*d*cos(d*x + c) 
+ a*d*sin(d*x + c))*sqrt(1/(a^2*d^2)) + 1/2*cos(d*x + c)*sin(d*x + c) + 1) 
 - sqrt(1/3)*a*d*sqrt(1/(a^2*d^2))*log(-3/2*sqrt(1/3)*(a*d*cos(d*x + c) + 
a*d*sin(d*x + c))*sqrt(1/(a^2*d^2)) - 1/2*cos(d*x + c)*sin(d*x + c) - 1) - 
 2*arctan(-(3*sqrt(1/3)*(a*d*cos(d*x + c) + a*d*sin(d*x + c))*sqrt(1/(a^2* 
d^2)) + 2)/(cos(d*x + c) - sin(d*x + c))) + 2*arctan(-(3*sqrt(1/3)*(a*d*co 
s(d*x + c) + a*d*sin(d*x + c))*sqrt(1/(a^2*d^2)) - 2)/(cos(d*x + c) - sin( 
d*x + c))))/(a*d)
 

Sympy [F]

\[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=- \frac {\int \frac {1}{- \sin {\left (c + d x \right )} + \sec {\left (c + d x \right )}}\, dx}{a} \] Input:

integrate(1/(-a*sec(d*x+c)+a*sin(d*x+c)),x)
 

Output:

-Integral(1/(-sin(c + d*x) + sec(c + d*x)), x)/a
 

Maxima [F]

\[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=\int { -\frac {1}{a \sec \left (d x + c\right ) - a \sin \left (d x + c\right )} \,d x } \] Input:

integrate(1/(-a*sec(d*x+c)+a*sin(d*x+c)),x, algorithm="maxima")
                                                                                    
                                                                                    
 

Output:

-integrate(1/(a*sec(d*x + c) - a*sin(d*x + c)), x)
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 122 vs. \(2 (54) = 108\).

Time = 0.12 (sec) , antiderivative size = 122, normalized size of antiderivative = 2.14 \[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=-\frac {3 \, \pi + \sqrt {3} \log \left ({\left (\sqrt {3} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}^{2} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}\right ) - \sqrt {3} \log \left ({\left (\sqrt {3} - \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}^{2} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}\right ) + 6 \, \arctan \left ({\left (\sqrt {3} + 1\right )} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) + 6 \, \arctan \left (-{\left (\sqrt {3} - 1\right )} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}{6 \, a d} \] Input:

integrate(1/(-a*sec(d*x+c)+a*sin(d*x+c)),x, algorithm="giac")
 

Output:

-1/6*(3*pi + sqrt(3)*log((sqrt(3) + tan(1/2*d*x + 1/2*c) + 1)^2 + tan(1/2* 
d*x + 1/2*c)^2) - sqrt(3)*log((sqrt(3) - tan(1/2*d*x + 1/2*c) - 1)^2 + tan 
(1/2*d*x + 1/2*c)^2) + 6*arctan((sqrt(3) + 1)*tan(1/2*d*x + 1/2*c) - 1) + 
6*arctan(-(sqrt(3) - 1)*tan(1/2*d*x + 1/2*c) - 1))/(a*d)
 

Mupad [B] (verification not implemented)

Time = 15.27 (sec) , antiderivative size = 453, normalized size of antiderivative = 7.95 \[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=\frac {\mathrm {atan}\left (-\frac {64\,\sqrt {3}\,\sqrt {-\frac {1}{6\,a^2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}}{\frac {64\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a}-\frac {64}{a}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,64{}\mathrm {i}}{a}}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-\frac {1}{6\,a^2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}\,96{}\mathrm {i}}{\frac {64\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a}-\frac {64}{a}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,64{}\mathrm {i}}{a}}+\frac {96\,\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-\frac {1}{6\,a^2}-\frac {\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}}{\frac {64\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a}-\frac {64}{a}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,64{}\mathrm {i}}{a}}\right )\,\sqrt {-\frac {1+\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}\,2{}\mathrm {i}}{d}-\frac {\mathrm {atan}\left (\frac {64\,\sqrt {3}\,\sqrt {-\frac {1}{6\,a^2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}}{\frac {64}{a}-\frac {64\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,64{}\mathrm {i}}{a}}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-\frac {1}{6\,a^2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}\,96{}\mathrm {i}}{\frac {64}{a}-\frac {64\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,64{}\mathrm {i}}{a}}-\frac {96\,\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {-\frac {1}{6\,a^2}+\frac {\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}}{\frac {64}{a}-\frac {64\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a}+\frac {\sqrt {3}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,64{}\mathrm {i}}{a}}\right )\,\sqrt {\frac {-1+\sqrt {3}\,1{}\mathrm {i}}{6\,a^2}}\,2{}\mathrm {i}}{d} \] Input:

int(1/(a*sin(c + d*x) - a/cos(c + d*x)),x)
 

Output:

(atan((tan(c/2 + (d*x)/2)*(- (3^(1/2)*1i)/(6*a^2) - 1/(6*a^2))^(1/2)*96i)/ 
((64*tan(c/2 + (d*x)/2))/a - 64/a + (3^(1/2)*tan(c/2 + (d*x)/2)*64i)/a) - 
(64*3^(1/2)*(- (3^(1/2)*1i)/(6*a^2) - 1/(6*a^2))^(1/2))/((64*tan(c/2 + (d* 
x)/2))/a - 64/a + (3^(1/2)*tan(c/2 + (d*x)/2)*64i)/a) + (96*3^(1/2)*tan(c/ 
2 + (d*x)/2)*(- (3^(1/2)*1i)/(6*a^2) - 1/(6*a^2))^(1/2))/((64*tan(c/2 + (d 
*x)/2))/a - 64/a + (3^(1/2)*tan(c/2 + (d*x)/2)*64i)/a))*(-(3^(1/2)*1i + 1) 
/(6*a^2))^(1/2)*2i)/d - (atan((64*3^(1/2)*((3^(1/2)*1i)/(6*a^2) - 1/(6*a^2 
))^(1/2))/(64/a - (64*tan(c/2 + (d*x)/2))/a + (3^(1/2)*tan(c/2 + (d*x)/2)* 
64i)/a) + (tan(c/2 + (d*x)/2)*((3^(1/2)*1i)/(6*a^2) - 1/(6*a^2))^(1/2)*96i 
)/(64/a - (64*tan(c/2 + (d*x)/2))/a + (3^(1/2)*tan(c/2 + (d*x)/2)*64i)/a) 
- (96*3^(1/2)*tan(c/2 + (d*x)/2)*((3^(1/2)*1i)/(6*a^2) - 1/(6*a^2))^(1/2)) 
/(64/a - (64*tan(c/2 + (d*x)/2))/a + (3^(1/2)*tan(c/2 + (d*x)/2)*64i)/a))* 
((3^(1/2)*1i - 1)/(6*a^2))^(1/2)*2i)/d
 

Reduce [F]

\[ \int \frac {1}{-a \sec (c+d x)+a \sin (c+d x)} \, dx=-\frac {\int \frac {1}{\sec \left (d x +c \right )-\sin \left (d x +c \right )}d x}{a} \] Input:

int(1/(-a*sec(d*x+c)+a*sin(d*x+c)),x)
 

Output:

( - int(1/(sec(c + d*x) - sin(c + d*x)),x))/a