Integrand size = 23, antiderivative size = 181 \[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=-\frac {d \left (b^2 n+a^2 (1+n)\right ) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1-n}{2},\frac {3-n}{2},\cos ^2(e+f x)\right ) (d \sec (e+f x))^{-1+n} \sin (e+f x)}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a b \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n}{2},\frac {2-n}{2},\cos ^2(e+f x)\right ) (d \sec (e+f x))^n \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 (d \sec (e+f x))^n \tan (e+f x)}{f (1+n)} \] Output:
-d*(b^2*n+a^2*(1+n))*hypergeom([1/2, 1/2-1/2*n],[3/2-1/2*n],cos(f*x+e)^2)* (d*sec(f*x+e))^(-1+n)*sin(f*x+e)/f/(-n^2+1)/(sin(f*x+e)^2)^(1/2)+2*a*b*hyp ergeom([1/2, -1/2*n],[1-1/2*n],cos(f*x+e)^2)*(d*sec(f*x+e))^n*sin(f*x+e)/f /n/(sin(f*x+e)^2)^(1/2)+b^2*(d*sec(f*x+e))^n*tan(f*x+e)/f/(1+n)
Time = 0.22 (sec) , antiderivative size = 171, normalized size of antiderivative = 0.94 \[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=\frac {\csc (e+f x) \left (a^2 \left (2+3 n+n^2\right ) \cos ^2(e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {n}{2},\frac {2+n}{2},\sec ^2(e+f x)\right )+b n \left (2 a (2+n) \cos (e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1+n}{2},\frac {3+n}{2},\sec ^2(e+f x)\right )+b (1+n) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+n}{2},\frac {4+n}{2},\sec ^2(e+f x)\right )\right )\right ) \sec (e+f x) (d \sec (e+f x))^n \sqrt {-\tan ^2(e+f x)}}{f n (1+n) (2+n)} \] Input:
Integrate[(d*Sec[e + f*x])^n*(a + b*Sec[e + f*x])^2,x]
Output:
(Csc[e + f*x]*(a^2*(2 + 3*n + n^2)*Cos[e + f*x]^2*Hypergeometric2F1[1/2, n /2, (2 + n)/2, Sec[e + f*x]^2] + b*n*(2*a*(2 + n)*Cos[e + f*x]*Hypergeomet ric2F1[1/2, (1 + n)/2, (3 + n)/2, Sec[e + f*x]^2] + b*(1 + n)*Hypergeometr ic2F1[1/2, (2 + n)/2, (4 + n)/2, Sec[e + f*x]^2]))*Sec[e + f*x]*(d*Sec[e + f*x])^n*Sqrt[-Tan[e + f*x]^2])/(f*n*(1 + n)*(2 + n))
Time = 0.79 (sec) , antiderivative size = 180, normalized size of antiderivative = 0.99, number of steps used = 11, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.478, Rules used = {3042, 4275, 3042, 4259, 3042, 3122, 4534, 3042, 4259, 3042, 3122}
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 (a+b \sec (e+f x))^2 (d \sec (e+f x))^n \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \left (a+b \csc \left (e+f x+\frac {\pi }{2}\right )\right )^2 \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^ndx\) |
\(\Big \downarrow \) 4275 |
\(\displaystyle \int (d \sec (e+f x))^n \left (a^2+b^2 \sec ^2(e+f x)\right )dx+\frac {2 a b \int (d \sec (e+f x))^{n+1}dx}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^n \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^{n+1}dx}{d}\) |
\(\Big \downarrow \) 4259 |
\(\displaystyle \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^n \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \left (\frac {\cos (e+f x)}{d}\right )^n (d \sec (e+f x))^n \int \left (\frac {\cos (e+f x)}{d}\right )^{-n-1}dx}{d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^n \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \left (\frac {\cos (e+f x)}{d}\right )^n (d \sec (e+f x))^n \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{d}\right )^{-n-1}dx}{d}\) |
\(\Big \downarrow \) 3122 |
\(\displaystyle \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^n \left (a^2+b^2 \csc \left (e+f x+\frac {\pi }{2}\right )^2\right )dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n}{2},\frac {2-n}{2},\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}\) |
\(\Big \downarrow \) 4534 |
\(\displaystyle \left (a^2+\frac {b^2 n}{n+1}\right ) \int (d \sec (e+f x))^ndx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n}{2},\frac {2-n}{2},\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^n}{f (n+1)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \left (a^2+\frac {b^2 n}{n+1}\right ) \int \left (d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^ndx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n}{2},\frac {2-n}{2},\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^n}{f (n+1)}\) |
\(\Big \downarrow \) 4259 |
\(\displaystyle \left (a^2+\frac {b^2 n}{n+1}\right ) \left (\frac {\cos (e+f x)}{d}\right )^n (d \sec (e+f x))^n \int \left (\frac {\cos (e+f x)}{d}\right )^{-n}dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n}{2},\frac {2-n}{2},\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^n}{f (n+1)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \left (a^2+\frac {b^2 n}{n+1}\right ) \left (\frac {\cos (e+f x)}{d}\right )^n (d \sec (e+f x))^n \int \left (\frac {\sin \left (e+f x+\frac {\pi }{2}\right )}{d}\right )^{-n}dx+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n}{2},\frac {2-n}{2},\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^n}{f (n+1)}\) |
\(\Big \downarrow \) 3122 |
\(\displaystyle -\frac {d \left (a^2+\frac {b^2 n}{n+1}\right ) \sin (e+f x) (d \sec (e+f x))^{n-1} \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {1-n}{2},\frac {3-n}{2},\cos ^2(e+f x)\right )}{f (1-n) \sqrt {\sin ^2(e+f x)}}+\frac {2 a b \sin (e+f x) (d \sec (e+f x))^n \operatorname {Hypergeometric2F1}\left (\frac {1}{2},-\frac {n}{2},\frac {2-n}{2},\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {b^2 \tan (e+f x) (d \sec (e+f x))^n}{f (n+1)}\) |
Input:
Int[(d*Sec[e + f*x])^n*(a + b*Sec[e + f*x])^2,x]
Output:
-((d*(a^2 + (b^2*n)/(1 + n))*Hypergeometric2F1[1/2, (1 - n)/2, (3 - n)/2, Cos[e + f*x]^2]*(d*Sec[e + f*x])^(-1 + n)*Sin[e + f*x])/(f*(1 - n)*Sqrt[Si n[e + f*x]^2])) + (2*a*b*Hypergeometric2F1[1/2, -1/2*n, (2 - n)/2, Cos[e + f*x]^2]*(d*Sec[e + f*x])^n*Sin[e + f*x])/(f*n*Sqrt[Sin[e + f*x]^2]) + (b^ 2*(d*Sec[e + f*x])^n*Tan[e + f*x])/(f*(1 + n))
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[Cos[c + d*x]*(( b*Sin[c + d*x])^(n + 1)/(b*d*(n + 1)*Sqrt[Cos[c + d*x]^2]))*Hypergeometric2 F1[1/2, (n + 1)/2, (n + 3)/2, Sin[c + d*x]^2], x] /; FreeQ[{b, c, d, n}, x] && !IntegerQ[2*n]
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(b*Csc[c + d*x] )^(n - 1)*((Sin[c + d*x]/b)^(n - 1) Int[1/(Sin[c + d*x]/b)^n, x]), x] /; FreeQ[{b, c, d, n}, x] && !IntegerQ[n]
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Simp[2*a*(b/d) Int[(d*Csc[e + f*x])^(n + 1), x], x] + Int[(d*Csc[e + f*x])^n*(a^2 + b^2*Csc[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f, n}, x]
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) + (A_)), x_Symbol] :> Simp[(-C)*Cot[e + f*x]*((b*Csc[e + f*x])^m/(f*(m + 1) )), x] + Simp[(C*m + A*(m + 1))/(m + 1) Int[(b*Csc[e + f*x])^m, x], x] /; FreeQ[{b, e, f, A, C, m}, x] && NeQ[C*m + A*(m + 1), 0] && !LeQ[m, -1]
\[\int \left (d \sec \left (f x +e \right )\right )^{n} \left (a +b \sec \left (f x +e \right )\right )^{2}d x\]
Input:
int((d*sec(f*x+e))^n*(a+b*sec(f*x+e))^2,x)
Output:
int((d*sec(f*x+e))^n*(a+b*sec(f*x+e))^2,x)
\[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=\int { {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (d \sec \left (f x + e\right )\right )^{n} \,d x } \] Input:
integrate((d*sec(f*x+e))^n*(a+b*sec(f*x+e))^2,x, algorithm="fricas")
Output:
integral((b^2*sec(f*x + e)^2 + 2*a*b*sec(f*x + e) + a^2)*(d*sec(f*x + e))^ n, x)
\[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=\int \left (d \sec {\left (e + f x \right )}\right )^{n} \left (a + b \sec {\left (e + f x \right )}\right )^{2}\, dx \] Input:
integrate((d*sec(f*x+e))**n*(a+b*sec(f*x+e))**2,x)
Output:
Integral((d*sec(e + f*x))**n*(a + b*sec(e + f*x))**2, x)
\[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=\int { {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (d \sec \left (f x + e\right )\right )^{n} \,d x } \] Input:
integrate((d*sec(f*x+e))^n*(a+b*sec(f*x+e))^2,x, algorithm="maxima")
Output:
integrate((b*sec(f*x + e) + a)^2*(d*sec(f*x + e))^n, x)
\[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=\int { {\left (b \sec \left (f x + e\right ) + a\right )}^{2} \left (d \sec \left (f x + e\right )\right )^{n} \,d x } \] Input:
integrate((d*sec(f*x+e))^n*(a+b*sec(f*x+e))^2,x, algorithm="giac")
Output:
integrate((b*sec(f*x + e) + a)^2*(d*sec(f*x + e))^n, x)
Timed out. \[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=\int {\left (a+\frac {b}{\cos \left (e+f\,x\right )}\right )}^2\,{\left (\frac {d}{\cos \left (e+f\,x\right )}\right )}^n \,d x \] Input:
int((a + b/cos(e + f*x))^2*(d/cos(e + f*x))^n,x)
Output:
int((a + b/cos(e + f*x))^2*(d/cos(e + f*x))^n, x)
\[ \int (d \sec (e+f x))^n (a+b \sec (e+f x))^2 \, dx=d^{n} \left (\left (\int \sec \left (f x +e \right )^{n}d x \right ) a^{2}+\left (\int \sec \left (f x +e \right )^{n} \sec \left (f x +e \right )^{2}d x \right ) b^{2}+2 \left (\int \sec \left (f x +e \right )^{n} \sec \left (f x +e \right )d x \right ) a b \right ) \] Input:
int((d*sec(f*x+e))^n*(a+b*sec(f*x+e))^2,x)
Output:
d**n*(int(sec(e + f*x)**n,x)*a**2 + int(sec(e + f*x)**n*sec(e + f*x)**2,x) *b**2 + 2*int(sec(e + f*x)**n*sec(e + f*x),x)*a*b)