\(\int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx\) [1536]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (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 = 29, antiderivative size = 94 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {(a+b)^2 (A+B) \log (1-\sin (c+d x))}{2 d}+\frac {(a-b)^2 (A-B) \log (1+\sin (c+d x))}{2 d}-\frac {b (A b+2 a B) \sin (c+d x)}{d}-\frac {b^2 B \sin ^2(c+d x)}{2 d} \] Output:

-1/2*(a+b)^2*(A+B)*ln(1-sin(d*x+c))/d+1/2*(a-b)^2*(A-B)*ln(1+sin(d*x+c))/d 
-b*(A*b+2*B*a)*sin(d*x+c)/d-1/2*b^2*B*sin(d*x+c)^2/d
 

Mathematica [A] (verified)

Time = 0.21 (sec) , antiderivative size = 81, normalized size of antiderivative = 0.86 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {(a+b)^2 (A+B) \log (1-\sin (c+d x))-(a-b)^2 (A-B) \log (1+\sin (c+d x))+2 b (A b+2 a B) \sin (c+d x)+b^2 B \sin ^2(c+d x)}{2 d} \] Input:

Integrate[Sec[c + d*x]*(a + b*Sin[c + d*x])^2*(A + B*Sin[c + d*x]),x]
 

Output:

-1/2*((a + b)^2*(A + B)*Log[1 - Sin[c + d*x]] - (a - b)^2*(A - B)*Log[1 + 
Sin[c + d*x]] + 2*b*(A*b + 2*a*B)*Sin[c + d*x] + b^2*B*Sin[c + d*x]^2)/d
 

Rubi [A] (verified)

Time = 0.34 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.06, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {3042, 3316, 27, 657, 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 \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \sin (c+d x))^2 (A+B \sin (c+d x))}{\cos (c+d x)}dx\)

\(\Big \downarrow \) 3316

\(\displaystyle \frac {b \int \frac {(a+b \sin (c+d x))^2 (A b+B \sin (c+d x) b)}{b \left (b^2-b^2 \sin ^2(c+d x)\right )}d(b \sin (c+d x))}{d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {\int \frac {(a+b \sin (c+d x))^2 (A b+B \sin (c+d x) b)}{b^2-b^2 \sin ^2(c+d x)}d(b \sin (c+d x))}{d}\)

\(\Big \downarrow \) 657

\(\displaystyle \frac {\int \left (-A b-B \sin (c+d x) b-2 a B+\frac {b \left (A a^2+2 b B a+A b^2\right )+b \left (B a^2+2 A b a+b^2 B\right ) \sin (c+d x)}{b^2-b^2 \sin ^2(c+d x)}\right )d(b \sin (c+d x))}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {\left (a^2 A+2 a b B+A b^2\right ) \text {arctanh}(\sin (c+d x))-\frac {1}{2} \left (a^2 B+2 a A b+b^2 B\right ) \log \left (b^2-b^2 \sin ^2(c+d x)\right )-b (2 a B+A b) \sin (c+d x)-\frac {1}{2} b^2 B \sin ^2(c+d x)}{d}\)

Input:

Int[Sec[c + d*x]*(a + b*Sin[c + d*x])^2*(A + B*Sin[c + d*x]),x]
 

Output:

((a^2*A + A*b^2 + 2*a*b*B)*ArcTanh[Sin[c + d*x]] - ((2*a*A*b + a^2*B + b^2 
*B)*Log[b^2 - b^2*Sin[c + d*x]^2])/2 - b*(A*b + 2*a*B)*Sin[c + d*x] - (b^2 
*B*Sin[c + d*x]^2)/2)/d
 

Defintions of rubi rules used

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 657
Int[(((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.))/((a_) + (c_.)*( 
x_)^2), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*((f + g*x)^n/(a + c*x^ 
2)), x], x] /; FreeQ[{a, c, d, e, f, g, m}, x] && IntegersQ[n]
 

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

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

rule 3316
Int[cos[(e_.) + (f_.)*(x_)]^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_ 
.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Simp[1/(b^p* 
f)   Subst[Int[(a + x)^m*(c + (d/b)*x)^n*(b^2 - x^2)^((p - 1)/2), x], x, b* 
Sin[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] && IntegerQ[(p - 1) 
/2] && NeQ[a^2 - b^2, 0]
 
Maple [A] (verified)

Time = 0.81 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.33

method result size
parallelrisch \(\frac {\left (8 A a b +4 a^{2} B +4 B \,b^{2}\right ) \ln \left (\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )-4 \left (a +b \right )^{2} \left (A +B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+4 \left (a -b \right )^{2} \left (A -B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+B \cos \left (2 d x +2 c \right ) b^{2}+\left (-4 b^{2} A -8 a b B \right ) \sin \left (d x +c \right )-B \,b^{2}}{4 d}\) \(125\)
derivativedivides \(\frac {A \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )-a^{2} B \ln \left (\cos \left (d x +c \right )\right )-2 A a b \ln \left (\cos \left (d x +c \right )\right )+2 a b B \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} A \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+B \,b^{2} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(131\)
default \(\frac {A \,a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )-a^{2} B \ln \left (\cos \left (d x +c \right )\right )-2 A a b \ln \left (\cos \left (d x +c \right )\right )+2 a b B \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} A \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+B \,b^{2} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(131\)
norman \(\frac {-\frac {2 B \,b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}-\frac {2 B \,b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}-\frac {2 b \left (A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {4 b \left (A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}-\frac {2 b \left (A b +2 B a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{3}}+\frac {\left (2 A a b +a^{2} B +B \,b^{2}\right ) \ln \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}{d}+\frac {\left (A \,a^{2}-2 A a b +b^{2} A -a^{2} B +2 a b B -B \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {\left (A \,a^{2}+2 A a b +b^{2} A +a^{2} B +2 a b B +B \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(263\)
risch \(-\frac {i {\mathrm e}^{-i \left (d x +c \right )} a b B}{d}+2 i A a b x +\frac {4 i A a b c}{d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} b^{2} A}{2 d}+\frac {2 i B \,b^{2} c}{d}+\frac {2 i a^{2} B c}{d}+i x B \,a^{2}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} b^{2} A}{2 d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,a^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2} A}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,b^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,a^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2} A}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2} B}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,b^{2}}{d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A a b}{d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a b B}{d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A a b}{d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a b B}{d}+i B \,b^{2} x +\frac {i {\mathrm e}^{i \left (d x +c \right )} a b B}{d}+\frac {\cos \left (2 d x +2 c \right ) B \,b^{2}}{4 d}\) \(407\)

Input:

int(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x,method=_RETURNVERBOSE 
)
 

Output:

1/4*((8*A*a*b+4*B*a^2+4*B*b^2)*ln(sec(1/2*d*x+1/2*c)^2)-4*(a+b)^2*(A+B)*ln 
(tan(1/2*d*x+1/2*c)-1)+4*(a-b)^2*(A-B)*ln(tan(1/2*d*x+1/2*c)+1)+B*cos(2*d* 
x+2*c)*b^2+(-4*A*b^2-8*B*a*b)*sin(d*x+c)-B*b^2)/d
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.18 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {B b^{2} \cos \left (d x + c\right )^{2} + {\left ({\left (A - B\right )} a^{2} - 2 \, {\left (A - B\right )} a b + {\left (A - B\right )} b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left ({\left (A + B\right )} a^{2} + 2 \, {\left (A + B\right )} a b + {\left (A + B\right )} b^{2}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, B a b + A b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \] Input:

integrate(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="fri 
cas")
 

Output:

1/2*(B*b^2*cos(d*x + c)^2 + ((A - B)*a^2 - 2*(A - B)*a*b + (A - B)*b^2)*lo 
g(sin(d*x + c) + 1) - ((A + B)*a^2 + 2*(A + B)*a*b + (A + B)*b^2)*log(-sin 
(d*x + c) + 1) - 2*(2*B*a*b + A*b^2)*sin(d*x + c))/d
 

Sympy [F]

\[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\int \left (A + B \sin {\left (c + d x \right )}\right ) \left (a + b \sin {\left (c + d x \right )}\right )^{2} \sec {\left (c + d x \right )}\, dx \] Input:

integrate(sec(d*x+c)*(a+b*sin(d*x+c))**2*(A+B*sin(d*x+c)),x)
 

Output:

Integral((A + B*sin(c + d*x))*(a + b*sin(c + d*x))**2*sec(c + d*x), x)
 

Maxima [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 109, normalized size of antiderivative = 1.16 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {B b^{2} \sin \left (d x + c\right )^{2} - {\left ({\left (A - B\right )} a^{2} - 2 \, {\left (A - B\right )} a b + {\left (A - B\right )} b^{2}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) + {\left ({\left (A + B\right )} a^{2} + 2 \, {\left (A + B\right )} a b + {\left (A + B\right )} b^{2}\right )} \log \left (\sin \left (d x + c\right ) - 1\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \] Input:

integrate(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="max 
ima")
 

Output:

-1/2*(B*b^2*sin(d*x + c)^2 - ((A - B)*a^2 - 2*(A - B)*a*b + (A - B)*b^2)*l 
og(sin(d*x + c) + 1) + ((A + B)*a^2 + 2*(A + B)*a*b + (A + B)*b^2)*log(sin 
(d*x + c) - 1) + 2*(2*B*a*b + A*b^2)*sin(d*x + c))/d
 

Giac [A] (verification not implemented)

Time = 0.36 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.49 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {{\left (A a^{2} - B a^{2} - 2 \, A a b + 2 \, B a b + A b^{2} - B b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) + 1 \right |}\right )}{2 \, d} - \frac {{\left (A a^{2} + B a^{2} + 2 \, A a b + 2 \, B a b + A b^{2} + B b^{2}\right )} \log \left ({\left | \sin \left (d x + c\right ) - 1 \right |}\right )}{2 \, d} - \frac {B b^{2} d \sin \left (d x + c\right )^{2} + 4 \, B a b d \sin \left (d x + c\right ) + 2 \, A b^{2} d \sin \left (d x + c\right )}{2 \, d^{2}} \] Input:

integrate(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x, algorithm="gia 
c")
 

Output:

1/2*(A*a^2 - B*a^2 - 2*A*a*b + 2*B*a*b + A*b^2 - B*b^2)*log(abs(sin(d*x + 
c) + 1))/d - 1/2*(A*a^2 + B*a^2 + 2*A*a*b + 2*B*a*b + A*b^2 + B*b^2)*log(a 
bs(sin(d*x + c) - 1))/d - 1/2*(B*b^2*d*sin(d*x + c)^2 + 4*B*a*b*d*sin(d*x 
+ c) + 2*A*b^2*d*sin(d*x + c))/d^2
 

Mupad [B] (verification not implemented)

Time = 33.73 (sec) , antiderivative size = 80, normalized size of antiderivative = 0.85 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=-\frac {\sin \left (c+d\,x\right )\,\left (A\,b^2+2\,B\,a\,b\right )+\frac {\ln \left (\sin \left (c+d\,x\right )-1\right )\,{\left (a+b\right )}^2\,\left (A+B\right )}{2}+\frac {B\,b^2\,{\sin \left (c+d\,x\right )}^2}{2}-\frac {\ln \left (\sin \left (c+d\,x\right )+1\right )\,\left (A-B\right )\,{\left (a-b\right )}^2}{2}}{d} \] Input:

int(((A + B*sin(c + d*x))*(a + b*sin(c + d*x))^2)/cos(c + d*x),x)
 

Output:

-(sin(c + d*x)*(A*b^2 + 2*B*a*b) + (log(sin(c + d*x) - 1)*(a + b)^2*(A + B 
))/2 + (B*b^2*sin(c + d*x)^2)/2 - (log(sin(c + d*x) + 1)*(A - B)*(a - b)^2 
)/2)/d
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 210, normalized size of antiderivative = 2.23 \[ \int \sec (c+d x) (a+b \sin (c+d x))^2 (A+B \sin (c+d x)) \, dx=\frac {6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) a^{2} b +2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) b^{3}-2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a^{3}-6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a^{2} b -6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a \,b^{2}-2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) b^{3}+2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a^{3}-6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a^{2} b +6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a \,b^{2}-2 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) b^{3}-\sin \left (d x +c \right )^{2} b^{3}-6 \sin \left (d x +c \right ) a \,b^{2}}{2 d} \] Input:

int(sec(d*x+c)*(a+b*sin(d*x+c))^2*(A+B*sin(d*x+c)),x)
 

Output:

(6*log(tan((c + d*x)/2)**2 + 1)*a**2*b + 2*log(tan((c + d*x)/2)**2 + 1)*b* 
*3 - 2*log(tan((c + d*x)/2) - 1)*a**3 - 6*log(tan((c + d*x)/2) - 1)*a**2*b 
 - 6*log(tan((c + d*x)/2) - 1)*a*b**2 - 2*log(tan((c + d*x)/2) - 1)*b**3 + 
 2*log(tan((c + d*x)/2) + 1)*a**3 - 6*log(tan((c + d*x)/2) + 1)*a**2*b + 6 
*log(tan((c + d*x)/2) + 1)*a*b**2 - 2*log(tan((c + d*x)/2) + 1)*b**3 - sin 
(c + d*x)**2*b**3 - 6*sin(c + d*x)*a*b**2)/(2*d)