\(\int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx\) [12]

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

Optimal result

Integrand size = 23, antiderivative size = 76 \[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\frac {2 (a c-b d) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a \sqrt {a-b} \sqrt {a+b} f}+\frac {d \text {arctanh}(\sin (e+f x))}{a f} \] Output:

2*(a*c-b*d)*arctan((a-b)^(1/2)*tan(1/2*f*x+1/2*e)/(a+b)^(1/2))/a/(a-b)^(1/ 
2)/(a+b)^(1/2)/f+d*arctanh(sin(f*x+e))/a/f
 

Mathematica [A] (verified)

Time = 0.62 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.47 \[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\frac {\frac {(-2 a c+2 b d) \text {arctanh}\left (\frac {(a-b) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+d \left (-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )}{a f} \] Input:

Integrate[(c + d*Sec[e + f*x])/(a + b*Cos[e + f*x]),x]
 

Output:

(((-2*a*c + 2*b*d)*ArcTanh[((a - b)*Tan[(e + f*x)/2])/Sqrt[-a^2 + b^2]])/S 
qrt[-a^2 + b^2] + d*(-Log[Cos[(e + f*x)/2] - Sin[(e + f*x)/2]] + Log[Cos[( 
e + f*x)/2] + Sin[(e + f*x)/2]]))/(a*f)
 

Rubi [A] (verified)

Time = 0.46 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.348, Rules used = {3042, 3307, 3042, 3480, 3042, 3138, 218, 4257}

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 {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {c+d \csc \left (e+f x+\frac {\pi }{2}\right )}{a+b \sin \left (e+f x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 3307

\(\displaystyle \int \frac {\sec (e+f x) (c \cos (e+f x)+d)}{a+b \cos (e+f x)}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {c \sin \left (e+f x+\frac {\pi }{2}\right )+d}{\sin \left (e+f x+\frac {\pi }{2}\right ) \left (a+b \sin \left (e+f x+\frac {\pi }{2}\right )\right )}dx\)

\(\Big \downarrow \) 3480

\(\displaystyle \frac {(a c-b d) \int \frac {1}{a+b \cos (e+f x)}dx}{a}+\frac {d \int \sec (e+f x)dx}{a}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {(a c-b d) \int \frac {1}{a+b \sin \left (e+f x+\frac {\pi }{2}\right )}dx}{a}+\frac {d \int \csc \left (e+f x+\frac {\pi }{2}\right )dx}{a}\)

\(\Big \downarrow \) 3138

\(\displaystyle \frac {2 (a c-b d) \int \frac {1}{(a-b) \tan ^2\left (\frac {1}{2} (e+f x)\right )+a+b}d\tan \left (\frac {1}{2} (e+f x)\right )}{a f}+\frac {d \int \csc \left (e+f x+\frac {\pi }{2}\right )dx}{a}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {d \int \csc \left (e+f x+\frac {\pi }{2}\right )dx}{a}+\frac {2 (a c-b d) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a f \sqrt {a-b} \sqrt {a+b}}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {2 (a c-b d) \arctan \left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a+b}}\right )}{a f \sqrt {a-b} \sqrt {a+b}}+\frac {d \text {arctanh}(\sin (e+f x))}{a f}\)

Input:

Int[(c + d*Sec[e + f*x])/(a + b*Cos[e + f*x]),x]
 

Output:

(2*(a*c - b*d)*ArcTan[(Sqrt[a - b]*Tan[(e + f*x)/2])/Sqrt[a + b]])/(a*Sqrt 
[a - b]*Sqrt[a + b]*f) + (d*ArcTanh[Sin[e + f*x]])/(a*f)
 

Defintions of rubi rules used

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

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

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

rule 3307
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.)*((a_) + (b_.)*sin[(e_.) + 
(f_.)*(x_)])^(m_.), x_Symbol] :> Int[(a + b*Sin[e + f*x])^m*((d + c*Sin[e + 
 f*x])^n/Sin[e + f*x]^n), x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IntegerQ 
[n]
 

rule 3480
Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)])/(((a_.) + (b_.)*sin[(e_.) + (f_ 
.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])), x_Symbol] :> Simp[(A*b 
- a*B)/(b*c - a*d)   Int[1/(a + b*Sin[e + f*x]), x], x] + Simp[(B*c - A*d)/ 
(b*c - a*d)   Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f 
, A, B}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 
Maple [A] (verified)

Time = 0.31 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.21

method result size
derivativedivides \(\frac {\frac {2 \left (a c -b d \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{a}-\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{a}}{f}\) \(92\)
default \(\frac {\frac {2 \left (a c -b d \right ) \arctan \left (\frac {\left (a -b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{a \sqrt {\left (a -b \right ) \left (a +b \right )}}+\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{a}-\frac {d \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{a}}{f}\) \(92\)
risch \(-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) c}{\sqrt {-a^{2}+b^{2}}\, f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) b d}{\sqrt {-a^{2}+b^{2}}\, f a}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) c}{\sqrt {-a^{2}+b^{2}}\, f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) b d}{\sqrt {-a^{2}+b^{2}}\, f a}-\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{a f}+\frac {d \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{a f}\) \(331\)

Input:

int((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x,method=_RETURNVERBOSE)
 

Output:

1/f*(2*(a*c-b*d)/a/((a-b)*(a+b))^(1/2)*arctan((a-b)*tan(1/2*f*x+1/2*e)/((a 
-b)*(a+b))^(1/2))+d/a*ln(tan(1/2*f*x+1/2*e)+1)-d/a*ln(tan(1/2*f*x+1/2*e)-1 
))
 

Fricas [A] (verification not implemented)

Time = 0.38 (sec) , antiderivative size = 296, normalized size of antiderivative = 3.89 \[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\left [\frac {{\left (a^{2} - b^{2}\right )} d \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (a^{2} - b^{2}\right )} d \log \left (-\sin \left (f x + e\right ) + 1\right ) + \sqrt {-a^{2} + b^{2}} {\left (a c - b d\right )} \log \left (\frac {2 \, a b \cos \left (f x + e\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (f x + e\right ) + b\right )} \sin \left (f x + e\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (f x + e\right )^{2} + 2 \, a b \cos \left (f x + e\right ) + a^{2}}\right )}{2 \, {\left (a^{3} - a b^{2}\right )} f}, \frac {{\left (a^{2} - b^{2}\right )} d \log \left (\sin \left (f x + e\right ) + 1\right ) - {\left (a^{2} - b^{2}\right )} d \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \, \sqrt {a^{2} - b^{2}} {\left (a c - b d\right )} \arctan \left (-\frac {a \cos \left (f x + e\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (f x + e\right )}\right )}{2 \, {\left (a^{3} - a b^{2}\right )} f}\right ] \] Input:

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x, algorithm="fricas")
 

Output:

[1/2*((a^2 - b^2)*d*log(sin(f*x + e) + 1) - (a^2 - b^2)*d*log(-sin(f*x + e 
) + 1) + sqrt(-a^2 + b^2)*(a*c - b*d)*log((2*a*b*cos(f*x + e) + (2*a^2 - b 
^2)*cos(f*x + e)^2 - 2*sqrt(-a^2 + b^2)*(a*cos(f*x + e) + b)*sin(f*x + e) 
- a^2 + 2*b^2)/(b^2*cos(f*x + e)^2 + 2*a*b*cos(f*x + e) + a^2)))/((a^3 - a 
*b^2)*f), 1/2*((a^2 - b^2)*d*log(sin(f*x + e) + 1) - (a^2 - b^2)*d*log(-si 
n(f*x + e) + 1) + 2*sqrt(a^2 - b^2)*(a*c - b*d)*arctan(-(a*cos(f*x + e) + 
b)/(sqrt(a^2 - b^2)*sin(f*x + e))))/((a^3 - a*b^2)*f)]
 

Sympy [F]

\[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\int \frac {c + d \sec {\left (e + f x \right )}}{a + b \cos {\left (e + f x \right )}}\, dx \] Input:

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x)
 

Output:

Integral((c + d*sec(e + f*x))/(a + b*cos(e + f*x)), x)
 

Maxima [F(-2)]

Exception generated. \[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\text {Exception raised: ValueError} \] Input:

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),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*b^2-4*a^2>0)', see `assume?` f 
or more de
 

Giac [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.68 \[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\frac {\frac {d \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right )}{a} - \frac {d \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right )}{a} - \frac {2 \, {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} {\left (a c - b d\right )}}{\sqrt {a^{2} - b^{2}} a}}{f} \] Input:

integrate((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x, algorithm="giac")
 

Output:

(d*log(abs(tan(1/2*f*x + 1/2*e) + 1))/a - d*log(abs(tan(1/2*f*x + 1/2*e) - 
 1))/a - 2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(-2*a + 2*b) + arctan(-(a* 
tan(1/2*f*x + 1/2*e) - b*tan(1/2*f*x + 1/2*e))/sqrt(a^2 - b^2)))*(a*c - b* 
d)/(sqrt(a^2 - b^2)*a))/f
 

Mupad [B] (verification not implemented)

Time = 1.78 (sec) , antiderivative size = 345, normalized size of antiderivative = 4.54 \[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\frac {2\,d\,\mathrm {atanh}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{a\,f}-\frac {b\,\left (d\,\ln \left (\frac {a\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+b\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {-\left (a+b\right )\,\left (a-b\right )}-d\,\ln \left (\frac {b\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-a\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {b^2-a^2}\right )+a\,c\,\ln \left (\frac {b\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-a\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {b^2-a^2}-a\,c\,\ln \left (\frac {a\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+b\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {b^2-a^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {-\left (a+b\right )\,\left (a-b\right )}}{a\,f\,\left (a^2-b^2\right )} \] Input:

int((c + d/cos(e + f*x))/(a + b*cos(e + f*x)),x)
 

Output:

(2*d*atanh(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(a*f) - (b*(d*log((a*co 
s(e/2 + (f*x)/2) + b*cos(e/2 + (f*x)/2) - sin(e/2 + (f*x)/2)*(b^2 - a^2)^( 
1/2))/cos(e/2 + (f*x)/2))*(-(a + b)*(a - b))^(1/2) - d*log((b*sin(e/2 + (f 
*x)/2) - a*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(b^2 - a^2)^(1/2))/cos( 
e/2 + (f*x)/2))*(b^2 - a^2)^(1/2)) + a*c*log((b*sin(e/2 + (f*x)/2) - a*sin 
(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(b^2 - a^2)^(1/2))/cos(e/2 + (f*x)/2) 
)*(b^2 - a^2)^(1/2) - a*c*log((a*cos(e/2 + (f*x)/2) + b*cos(e/2 + (f*x)/2) 
 - sin(e/2 + (f*x)/2)*(b^2 - a^2)^(1/2))/cos(e/2 + (f*x)/2))*(-(a + b)*(a 
- b))^(1/2))/(a*f*(a^2 - b^2))
                                                                                    
                                                                                    
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 193, normalized size of antiderivative = 2.54 \[ \int \frac {c+d \sec (e+f x)}{a+b \cos (e+f x)} \, dx=\frac {2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a -\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) b}{\sqrt {a^{2}-b^{2}}}\right ) a c -2 \sqrt {a^{2}-b^{2}}\, \mathit {atan} \left (\frac {\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) a -\tan \left (\frac {f x}{2}+\frac {e}{2}\right ) b}{\sqrt {a^{2}-b^{2}}}\right ) b d -\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) a^{2} d +\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) b^{2} d +\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) a^{2} d -\mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) b^{2} d}{a f \left (a^{2}-b^{2}\right )} \] Input:

int((c+d*sec(f*x+e))/(a+b*cos(f*x+e)),x)
 

Output:

(2*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a - tan((e + f*x)/2)*b)/sqrt(a 
**2 - b**2))*a*c - 2*sqrt(a**2 - b**2)*atan((tan((e + f*x)/2)*a - tan((e + 
 f*x)/2)*b)/sqrt(a**2 - b**2))*b*d - log(tan((e + f*x)/2) - 1)*a**2*d + lo 
g(tan((e + f*x)/2) - 1)*b**2*d + log(tan((e + f*x)/2) + 1)*a**2*d - log(ta 
n((e + f*x)/2) + 1)*b**2*d)/(a*f*(a**2 - b**2))