Integrand size = 34, antiderivative size = 140 \[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=-\frac {a^2 c \cos ^2(e+f x)^{\frac {3+p}{2}} \operatorname {Hypergeometric2F1}\left (\frac {3}{2},\frac {3+p}{2},\frac {5}{2},\sin ^2(e+f x)\right ) (g \sec (e+f x))^p \tan ^3(e+f x)}{3 f}-\frac {a^2 c \cos ^2(e+f x)^{\frac {4+p}{2}} \operatorname {Hypergeometric2F1}\left (\frac {3}{2},\frac {4+p}{2},\frac {5}{2},\sin ^2(e+f x)\right ) (g \sec (e+f x))^{1+p} \tan ^3(e+f x)}{3 f g} \] Output:
-1/3*a^2*c*(cos(f*x+e)^2)^(3/2+1/2*p)*hypergeom([3/2, 3/2+1/2*p],[5/2],sin (f*x+e)^2)*(g*sec(f*x+e))^p*tan(f*x+e)^3/f-1/3*a^2*c*(cos(f*x+e)^2)^(2+1/2 *p)*hypergeom([3/2, 2+1/2*p],[5/2],sin(f*x+e)^2)*(g*sec(f*x+e))^(p+1)*tan( f*x+e)^3/f/g
Leaf count is larger than twice the leaf count of optimal. \(325\) vs. \(2(140)=280\).
Time = 2.16 (sec) , antiderivative size = 325, normalized size of antiderivative = 2.32 \[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\frac {a^2 \csc ^2\left (\frac {1}{2} (e+f x)\right ) \sec ^4\left (\frac {1}{2} (e+f x)\right ) (g \sec (e+f x))^p (1+\sec (e+f x))^2 (c-c \sec (e+f x)) \left (-2 \cos ^3(e+f x) \cos ^2(e+f x)^{p/2} \left (2 \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+p}{2},\frac {3}{2},\sin ^2(e+f x)\right )-\operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {4+p}{2},\frac {3}{2},\sin ^2(e+f x)\right )\right ) \sin (e+f x)-\frac {\sec ^2(e+f x)^{-1-\frac {p}{2}} \left ((4+p) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},1-\frac {p}{2},\frac {3}{2},-\tan ^2(e+f x)\right )-3 \sec ^2(e+f x)^{p/2}\right ) \sin (e+f x)}{1+p}-\frac {\operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {2+p}{2},\frac {4+p}{2},\sec ^2(e+f x)\right ) \sin (e+f x)}{(2+p) \sqrt {-\tan ^2(e+f x)}}+\frac {2 \cot (e+f x) \operatorname {Hypergeometric2F1}\left (\frac {1}{2},\frac {3+p}{2},\frac {5+p}{2},\sec ^2(e+f x)\right ) \sqrt {-\tan ^2(e+f x)}}{3+p}\right )}{32 f} \] Input:
Integrate[(g*Sec[e + f*x])^p*(a + a*Sec[e + f*x])^2*(c - c*Sec[e + f*x]),x ]
Output:
(a^2*Csc[(e + f*x)/2]^2*Sec[(e + f*x)/2]^4*(g*Sec[e + f*x])^p*(1 + Sec[e + f*x])^2*(c - c*Sec[e + f*x])*(-2*Cos[e + f*x]^3*(Cos[e + f*x]^2)^(p/2)*(2 *Hypergeometric2F1[1/2, (2 + p)/2, 3/2, Sin[e + f*x]^2] - Hypergeometric2F 1[1/2, (4 + p)/2, 3/2, Sin[e + f*x]^2])*Sin[e + f*x] - ((Sec[e + f*x]^2)^( -1 - p/2)*((4 + p)*Hypergeometric2F1[1/2, 1 - p/2, 3/2, -Tan[e + f*x]^2] - 3*(Sec[e + f*x]^2)^(p/2))*Sin[e + f*x])/(1 + p) - (Hypergeometric2F1[1/2, (2 + p)/2, (4 + p)/2, Sec[e + f*x]^2]*Sin[e + f*x])/((2 + p)*Sqrt[-Tan[e + f*x]^2]) + (2*Cot[e + f*x]*Hypergeometric2F1[1/2, (3 + p)/2, (5 + p)/2, Sec[e + f*x]^2]*Sqrt[-Tan[e + f*x]^2])/(3 + p)))/(32*f)
Time = 0.43 (sec) , antiderivative size = 138, normalized size of antiderivative = 0.99, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {3042, 4450, 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 (a \sec (e+f x)+a)^2 (c-c \sec (e+f x)) (g \sec (e+f x))^p \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \left (a \csc \left (e+f x+\frac {\pi }{2}\right )+a\right )^2 \left (c-c \csc \left (e+f x+\frac {\pi }{2}\right )\right ) \left (g \csc \left (e+f x+\frac {\pi }{2}\right )\right )^pdx\) |
\(\Big \downarrow \) 4450 |
\(\displaystyle -a c \int \left (a \tan ^2(e+f x) (g \sec (e+f x))^p+a \sec (e+f x) \tan ^2(e+f x) (g \sec (e+f x))^p\right )dx\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle -a c \left (\frac {a \tan ^3(e+f x) \cos ^2(e+f x)^{\frac {p+3}{2}} (g \sec (e+f x))^p \operatorname {Hypergeometric2F1}\left (\frac {3}{2},\frac {p+3}{2},\frac {5}{2},\sin ^2(e+f x)\right )}{3 f}+\frac {a \tan ^3(e+f x) \cos ^2(e+f x)^{\frac {p+4}{2}} (g \sec (e+f x))^{p+1} \operatorname {Hypergeometric2F1}\left (\frac {3}{2},\frac {p+4}{2},\frac {5}{2},\sin ^2(e+f x)\right )}{3 f g}\right )\) |
Input:
Int[(g*Sec[e + f*x])^p*(a + a*Sec[e + f*x])^2*(c - c*Sec[e + f*x]),x]
Output:
-(a*c*((a*(Cos[e + f*x]^2)^((3 + p)/2)*Hypergeometric2F1[3/2, (3 + p)/2, 5 /2, Sin[e + f*x]^2]*(g*Sec[e + f*x])^p*Tan[e + f*x]^3)/(3*f) + (a*(Cos[e + f*x]^2)^((4 + p)/2)*Hypergeometric2F1[3/2, (4 + p)/2, 5/2, Sin[e + f*x]^2 ]*(g*Sec[e + f*x])^(1 + p)*Tan[e + f*x]^3)/(3*f*g)))
Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.), x_Symbol] :> Simp [((-a)*c)^m Int[ExpandTrig[(g*csc[e + f*x])^p*cot[e + f*x]^(2*m), (c + d* csc[e + f*x])^(n - m), x], x], x] /; FreeQ[{a, b, c, d, e, f, g, n, p}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 - b^2, 0] && IntegersQ[m, n] && GeQ[n - m, 0] && GtQ[m*n, 0]
\[\int \left (g \sec \left (f x +e \right )\right )^{p} \left (a +a \sec \left (f x +e \right )\right )^{2} \left (c -c \sec \left (f x +e \right )\right )d x\]
Input:
int((g*sec(f*x+e))^p*(a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x)
Output:
int((g*sec(f*x+e))^p*(a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x)
\[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\int { -{\left (a \sec \left (f x + e\right ) + a\right )}^{2} {\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p} \,d x } \] Input:
integrate((g*sec(f*x+e))^p*(a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x, algorith m="fricas")
Output:
integral(-(a^2*c*sec(f*x + e)^3 + a^2*c*sec(f*x + e)^2 - a^2*c*sec(f*x + e ) - a^2*c)*(g*sec(f*x + e))^p, x)
\[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=- a^{2} c \left (\int \left (- \left (g \sec {\left (e + f x \right )}\right )^{p}\right )\, dx + \int \left (- \left (g \sec {\left (e + f x \right )}\right )^{p} \sec {\left (e + f x \right )}\right )\, dx + \int \left (g \sec {\left (e + f x \right )}\right )^{p} \sec ^{2}{\left (e + f x \right )}\, dx + \int \left (g \sec {\left (e + f x \right )}\right )^{p} \sec ^{3}{\left (e + f x \right )}\, dx\right ) \] Input:
integrate((g*sec(f*x+e))**p*(a+a*sec(f*x+e))**2*(c-c*sec(f*x+e)),x)
Output:
-a**2*c*(Integral(-(g*sec(e + f*x))**p, x) + Integral(-(g*sec(e + f*x))**p *sec(e + f*x), x) + Integral((g*sec(e + f*x))**p*sec(e + f*x)**2, x) + Int egral((g*sec(e + f*x))**p*sec(e + f*x)**3, x))
\[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\int { -{\left (a \sec \left (f x + e\right ) + a\right )}^{2} {\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p} \,d x } \] Input:
integrate((g*sec(f*x+e))^p*(a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x, algorith m="maxima")
Output:
-integrate((a*sec(f*x + e) + a)^2*(c*sec(f*x + e) - c)*(g*sec(f*x + e))^p, x)
\[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\int { -{\left (a \sec \left (f x + e\right ) + a\right )}^{2} {\left (c \sec \left (f x + e\right ) - c\right )} \left (g \sec \left (f x + e\right )\right )^{p} \,d x } \] Input:
integrate((g*sec(f*x+e))^p*(a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x, algorith m="giac")
Output:
integrate(-(a*sec(f*x + e) + a)^2*(c*sec(f*x + e) - c)*(g*sec(f*x + e))^p, x)
Timed out. \[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=\int {\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^2\,\left (c-\frac {c}{\cos \left (e+f\,x\right )}\right )\,{\left (\frac {g}{\cos \left (e+f\,x\right )}\right )}^p \,d x \] Input:
int((a + a/cos(e + f*x))^2*(c - c/cos(e + f*x))*(g/cos(e + f*x))^p,x)
Output:
int((a + a/cos(e + f*x))^2*(c - c/cos(e + f*x))*(g/cos(e + f*x))^p, x)
\[ \int (g \sec (e+f x))^p (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx=g^{p} a^{2} c \left (\int \sec \left (f x +e \right )^{p}d x -\left (\int \sec \left (f x +e \right )^{p} \sec \left (f x +e \right )^{3}d x \right )-\left (\int \sec \left (f x +e \right )^{p} \sec \left (f x +e \right )^{2}d x \right )+\int \sec \left (f x +e \right )^{p} \sec \left (f x +e \right )d x \right ) \] Input:
int((g*sec(f*x+e))^p*(a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x)
Output:
g**p*a**2*c*(int(sec(e + f*x)**p,x) - int(sec(e + f*x)**p*sec(e + f*x)**3, x) - int(sec(e + f*x)**p*sec(e + f*x)**2,x) + int(sec(e + f*x)**p*sec(e + f*x),x))