\(\int \csc ^3(e+f x) (a+b \sec ^2(e+f x)) \, dx\) [6]

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

Optimal result

Integrand size = 21, antiderivative size = 53 \[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {(a+3 b) \text {arctanh}(\cos (e+f x))}{2 f}-\frac {(a+b) \cot (e+f x) \csc (e+f x)}{2 f}+\frac {b \sec (e+f x)}{f} \] Output:

-1/2*(a+3*b)*arctanh(cos(f*x+e))/f-1/2*(a+b)*cot(f*x+e)*csc(f*x+e)/f+b*sec 
(f*x+e)/f
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(236\) vs. \(2(53)=106\).

Time = 0.45 (sec) , antiderivative size = 236, normalized size of antiderivative = 4.45 \[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {a \csc ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}-\frac {b \csc ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}-\frac {a \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}-\frac {3 b \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {a \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {3 b \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {a \sec ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}+\frac {b \sec ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}+\frac {b \sin \left (\frac {1}{2} (e+f x)\right )}{f \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )}-\frac {b \sin \left (\frac {1}{2} (e+f x)\right )}{f \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )} \] Input:

Integrate[Csc[e + f*x]^3*(a + b*Sec[e + f*x]^2),x]
 

Output:

-1/8*(a*Csc[(e + f*x)/2]^2)/f - (b*Csc[(e + f*x)/2]^2)/(8*f) - (a*Log[Cos[ 
(e + f*x)/2]])/(2*f) - (3*b*Log[Cos[(e + f*x)/2]])/(2*f) + (a*Log[Sin[(e + 
 f*x)/2]])/(2*f) + (3*b*Log[Sin[(e + f*x)/2]])/(2*f) + (a*Sec[(e + f*x)/2] 
^2)/(8*f) + (b*Sec[(e + f*x)/2]^2)/(8*f) + (b*Sin[(e + f*x)/2])/(f*(Cos[(e 
 + f*x)/2] - Sin[(e + f*x)/2])) - (b*Sin[(e + f*x)/2])/(f*(Cos[(e + f*x)/2 
] + Sin[(e + f*x)/2]))
 

Rubi [A] (verified)

Time = 0.24 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.13, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 4621, 361, 25, 359, 219}

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 \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a+b \sec (e+f x)^2}{\sin (e+f x)^3}dx\)

\(\Big \downarrow \) 4621

\(\displaystyle -\frac {\int \frac {\left (a \cos ^2(e+f x)+b\right ) \sec ^2(e+f x)}{\left (1-\cos ^2(e+f x)\right )^2}d\cos (e+f x)}{f}\)

\(\Big \downarrow \) 361

\(\displaystyle -\frac {\frac {(a+b) \cos (e+f x)}{2 \left (1-\cos ^2(e+f x)\right )}-\frac {1}{2} \int -\frac {\left ((a+b) \cos ^2(e+f x)+2 b\right ) \sec ^2(e+f x)}{1-\cos ^2(e+f x)}d\cos (e+f x)}{f}\)

\(\Big \downarrow \) 25

\(\displaystyle -\frac {\frac {1}{2} \int \frac {\left ((a+b) \cos ^2(e+f x)+2 b\right ) \sec ^2(e+f x)}{1-\cos ^2(e+f x)}d\cos (e+f x)+\frac {(a+b) \cos (e+f x)}{2 \left (1-\cos ^2(e+f x)\right )}}{f}\)

\(\Big \downarrow \) 359

\(\displaystyle -\frac {\frac {1}{2} \left ((a+3 b) \int \frac {1}{1-\cos ^2(e+f x)}d\cos (e+f x)-2 b \sec (e+f x)\right )+\frac {(a+b) \cos (e+f x)}{2 \left (1-\cos ^2(e+f x)\right )}}{f}\)

\(\Big \downarrow \) 219

\(\displaystyle -\frac {\frac {1}{2} ((a+3 b) \text {arctanh}(\cos (e+f x))-2 b \sec (e+f x))+\frac {(a+b) \cos (e+f x)}{2 \left (1-\cos ^2(e+f x)\right )}}{f}\)

Input:

Int[Csc[e + f*x]^3*(a + b*Sec[e + f*x]^2),x]
 

Output:

-((((a + b)*Cos[e + f*x])/(2*(1 - Cos[e + f*x]^2)) + ((a + 3*b)*ArcTanh[Co 
s[e + f*x]] - 2*b*Sec[e + f*x])/2)/f)
 

Defintions of rubi rules used

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

rule 219
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])
 

rule 359
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2), x 
_Symbol] :> Simp[c*(e*x)^(m + 1)*((a + b*x^2)^(p + 1)/(a*e*(m + 1))), x] + 
Simp[(a*d*(m + 1) - b*c*(m + 2*p + 3))/(a*e^2*(m + 1))   Int[(e*x)^(m + 2)* 
(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] 
&& LtQ[m, -1] &&  !ILtQ[p, -1]
 

rule 361
Int[(x_)^(m_)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] : 
> Simp[(-a)^(m/2 - 1)*(b*c - a*d)*x*((a + b*x^2)^(p + 1)/(2*b^(m/2 + 1)*(p 
+ 1))), x] + Simp[1/(2*b^(m/2 + 1)*(p + 1))   Int[x^m*(a + b*x^2)^(p + 1)*E 
xpandToSum[2*b*(p + 1)*Together[(b^(m/2)*(c + d*x^2) - (-a)^(m/2 - 1)*(b*c 
- a*d)*x^(-m + 2))/(a + b*x^2)] - ((-a)^(m/2 - 1)*(b*c - a*d))/x^m, x], x], 
 x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] && ILtQ[m/ 
2, 0] && (IntegerQ[p] || EqQ[m + 2*p + 1, 0])
 

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

rule 4621
Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*sin[(e_.) + (f_.)*(x_ 
)]^(m_.), x_Symbol] :> With[{ff = FreeFactors[Cos[e + f*x], x]}, Simp[-ff/f 
   Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*(ff*x)^n)^p/(ff*x)^(n*p)), 
x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/ 
2] && IntegerQ[n] && IntegerQ[p]
 
Maple [A] (verified)

Time = 0.81 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.70

method result size
derivativedivides \(\frac {a \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )+b \left (-\frac {1}{2 \sin \left (f x +e \right )^{2} \cos \left (f x +e \right )}+\frac {3}{2 \cos \left (f x +e \right )}+\frac {3 \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(90\)
default \(\frac {a \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )+b \left (-\frac {1}{2 \sin \left (f x +e \right )^{2} \cos \left (f x +e \right )}+\frac {3}{2 \cos \left (f x +e \right )}+\frac {3 \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(90\)
norman \(\frac {\frac {a +b}{8 f}+\frac {\left (a +b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{6}}{8 f}-\frac {\left (a +9 b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}}{4 f}}{\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-1\right )}+\frac {\left (a +3 b \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{2 f}\) \(98\)
parallelrisch \(\frac {4 \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right ) \left (a +3 b \right ) \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (a +b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{4}+\left (a +b \right ) \cot \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-2 a -18 b}{8 f \tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2}-8 f}\) \(98\)
risch \(\frac {{\mathrm e}^{i \left (f x +e \right )} \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}+3 b \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}-2 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a +3 b \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) a}{2 f}+\frac {3 \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b}{2 f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) a}{2 f}-\frac {3 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b}{2 f}\) \(177\)

Input:

int(csc(f*x+e)^3*(a+b*sec(f*x+e)^2),x,method=_RETURNVERBOSE)
 

Output:

1/f*(a*(-1/2*csc(f*x+e)*cot(f*x+e)+1/2*ln(csc(f*x+e)-cot(f*x+e)))+b*(-1/2/ 
sin(f*x+e)^2/cos(f*x+e)+3/2/cos(f*x+e)+3/2*ln(csc(f*x+e)-cot(f*x+e))))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 124 vs. \(2 (49) = 98\).

Time = 0.08 (sec) , antiderivative size = 124, normalized size of antiderivative = 2.34 \[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {2 \, {\left (a + 3 \, b\right )} \cos \left (f x + e\right )^{2} - {\left ({\left (a + 3 \, b\right )} \cos \left (f x + e\right )^{3} - {\left (a + 3 \, b\right )} \cos \left (f x + e\right )\right )} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + {\left ({\left (a + 3 \, b\right )} \cos \left (f x + e\right )^{3} - {\left (a + 3 \, b\right )} \cos \left (f x + e\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) - 4 \, b}{4 \, {\left (f \cos \left (f x + e\right )^{3} - f \cos \left (f x + e\right )\right )}} \] Input:

integrate(csc(f*x+e)^3*(a+b*sec(f*x+e)^2),x, algorithm="fricas")
 

Output:

1/4*(2*(a + 3*b)*cos(f*x + e)^2 - ((a + 3*b)*cos(f*x + e)^3 - (a + 3*b)*co 
s(f*x + e))*log(1/2*cos(f*x + e) + 1/2) + ((a + 3*b)*cos(f*x + e)^3 - (a + 
 3*b)*cos(f*x + e))*log(-1/2*cos(f*x + e) + 1/2) - 4*b)/(f*cos(f*x + e)^3 
- f*cos(f*x + e))
 

Sympy [F]

\[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\int \left (a + b \sec ^{2}{\left (e + f x \right )}\right ) \csc ^{3}{\left (e + f x \right )}\, dx \] Input:

integrate(csc(f*x+e)**3*(a+b*sec(f*x+e)**2),x)
 

Output:

Integral((a + b*sec(e + f*x)**2)*csc(e + f*x)**3, x)
 

Maxima [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.43 \[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {{\left (a + 3 \, b\right )} \log \left (\cos \left (f x + e\right ) + 1\right ) - {\left (a + 3 \, b\right )} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, {\left ({\left (a + 3 \, b\right )} \cos \left (f x + e\right )^{2} - 2 \, b\right )}}{\cos \left (f x + e\right )^{3} - \cos \left (f x + e\right )}}{4 \, f} \] Input:

integrate(csc(f*x+e)^3*(a+b*sec(f*x+e)^2),x, algorithm="maxima")
 

Output:

-1/4*((a + 3*b)*log(cos(f*x + e) + 1) - (a + 3*b)*log(cos(f*x + e) - 1) - 
2*((a + 3*b)*cos(f*x + e)^2 - 2*b)/(cos(f*x + e)^3 - cos(f*x + e)))/f
 

Giac [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.70 \[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=-\frac {{\left (a + 3 \, b\right )} \log \left ({\left | \cos \left (f x + e\right ) + 1 \right |}\right )}{4 \, f} + \frac {{\left (a + 3 \, b\right )} \log \left ({\left | \cos \left (f x + e\right ) - 1 \right |}\right )}{4 \, f} + \frac {a \cos \left (f x + e\right )^{2} + 3 \, b \cos \left (f x + e\right )^{2} - 2 \, b}{2 \, {\left (\cos \left (f x + e\right )^{3} - \cos \left (f x + e\right )\right )} f} \] Input:

integrate(csc(f*x+e)^3*(a+b*sec(f*x+e)^2),x, algorithm="giac")
 

Output:

-1/4*(a + 3*b)*log(abs(cos(f*x + e) + 1))/f + 1/4*(a + 3*b)*log(abs(cos(f* 
x + e) - 1))/f + 1/2*(a*cos(f*x + e)^2 + 3*b*cos(f*x + e)^2 - 2*b)/((cos(f 
*x + e)^3 - cos(f*x + e))*f)
 

Mupad [B] (verification not implemented)

Time = 12.53 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.17 \[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {b-{\cos \left (e+f\,x\right )}^2\,\left (\frac {a}{2}+\frac {3\,b}{2}\right )}{f\,\left (\cos \left (e+f\,x\right )-{\cos \left (e+f\,x\right )}^3\right )}-\frac {\mathrm {atanh}\left (\cos \left (e+f\,x\right )\right )\,\left (\frac {a}{2}+\frac {3\,b}{2}\right )}{f} \] Input:

int((a + b/cos(e + f*x)^2)/sin(e + f*x)^3,x)
 

Output:

(b - cos(e + f*x)^2*(a/2 + (3*b)/2))/(f*(cos(e + f*x) - cos(e + f*x)^3)) - 
 (atanh(cos(e + f*x))*(a/2 + (3*b)/2))/f
 

Reduce [B] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 138, normalized size of antiderivative = 2.60 \[ \int \csc ^3(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx=\frac {4 \cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right ) \sin \left (f x +e \right )^{2} a +12 \cos \left (f x +e \right ) \mathrm {log}\left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right ) \sin \left (f x +e \right )^{2} b -\cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} a -9 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} b +4 \sin \left (f x +e \right )^{2} a +12 \sin \left (f x +e \right )^{2} b -4 a -4 b}{8 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} f} \] Input:

int(csc(f*x+e)^3*(a+b*sec(f*x+e)^2),x)
 

Output:

(4*cos(e + f*x)*log(tan((e + f*x)/2))*sin(e + f*x)**2*a + 12*cos(e + f*x)* 
log(tan((e + f*x)/2))*sin(e + f*x)**2*b - cos(e + f*x)*sin(e + f*x)**2*a - 
 9*cos(e + f*x)*sin(e + f*x)**2*b + 4*sin(e + f*x)**2*a + 12*sin(e + f*x)* 
*2*b - 4*a - 4*b)/(8*cos(e + f*x)*sin(e + f*x)**2*f)