Integrand size = 23, antiderivative size = 87 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\left (a^2 A-A b^2-2 a b B\right ) x-\frac {\left (2 a A b+a^2 B-b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {b (A b+a B) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d} \] Output:
(A*a^2-A*b^2-2*B*a*b)*x-(2*A*a*b+B*a^2-B*b^2)*ln(cos(d*x+c))/d+b*(A*b+B*a) *tan(d*x+c)/d+1/2*B*(a+b*tan(d*x+c))^2/d
Result contains complex when optimal does not.
Time = 0.31 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.10 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {(a+i b)^2 (-i A+B) \log (i-\tan (c+d x))+(a-i b)^2 (i A+B) \log (i+\tan (c+d x))+2 b (A b+2 a B) \tan (c+d x)+b^2 B \tan ^2(c+d x)}{2 d} \] Input:
Integrate[(a + b*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
Output:
((a + I*b)^2*((-I)*A + B)*Log[I - Tan[c + d*x]] + (a - I*b)^2*(I*A + B)*Lo g[I + Tan[c + d*x]] + 2*b*(A*b + 2*a*B)*Tan[c + d*x] + b^2*B*Tan[c + d*x]^ 2)/(2*d)
Time = 0.41 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {3042, 4011, 3042, 4008, 3042, 3956}
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 \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x))dx\) |
\(\Big \downarrow \) 4011 |
\(\displaystyle \int (a+b \tan (c+d x)) (a A-b B+(A b+a B) \tan (c+d x))dx+\frac {B (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (c+d x)) (a A-b B+(A b+a B) \tan (c+d x))dx+\frac {B (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 4008 |
\(\displaystyle \left (a^2 B+2 a A b-b^2 B\right ) \int \tan (c+d x)dx+x \left (a^2 A-2 a b B-A b^2\right )+\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \left (a^2 B+2 a A b-b^2 B\right ) \int \tan (c+d x)dx+x \left (a^2 A-2 a b B-A b^2\right )+\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle -\frac {\left (a^2 B+2 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}+x \left (a^2 A-2 a b B-A b^2\right )+\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}\) |
Input:
Int[(a + b*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
Output:
(a^2*A - A*b^2 - 2*a*b*B)*x - ((2*a*A*b + a^2*B - b^2*B)*Log[Cos[c + d*x]] )/d + (b*(A*b + a*B)*Tan[c + d*x])/d + (B*(a + b*Tan[c + d*x])^2)/(2*d)
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d *x], x]]/d, x] /; FreeQ[{c, d}, x]
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) *(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), x] + Simp[(b*c + a*d) Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int [(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] , x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]
Time = 0.06 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.03
method | result | size |
norman | \(\left (A \,a^{2}-A \,b^{2}-2 B a b \right ) x +\frac {b \left (A b +2 B a \right ) \tan \left (d x +c \right )}{d}+\frac {B \,b^{2} \tan \left (d x +c \right )^{2}}{2 d}+\frac {\left (2 A a b +B \,a^{2}-B \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}\) | \(90\) |
derivativedivides | \(\frac {\frac {B \,b^{2} \tan \left (d x +c \right )^{2}}{2}+A \,b^{2} \tan \left (d x +c \right )+2 B a b \tan \left (d x +c \right )+\frac {\left (2 A a b +B \,a^{2}-B \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (A \,a^{2}-A \,b^{2}-2 B a b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(97\) |
default | \(\frac {\frac {B \,b^{2} \tan \left (d x +c \right )^{2}}{2}+A \,b^{2} \tan \left (d x +c \right )+2 B a b \tan \left (d x +c \right )+\frac {\left (2 A a b +B \,a^{2}-B \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (A \,a^{2}-A \,b^{2}-2 B a b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(97\) |
parts | \(A \,a^{2} x +\frac {\left (A \,b^{2}+2 B a b \right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {\left (2 A a b +B \,a^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}+\frac {B \,b^{2} \left (\frac {\tan \left (d x +c \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}\right )}{d}\) | \(98\) |
parallelrisch | \(\frac {2 A x \,a^{2} d -2 A \,b^{2} d x -4 B a b d x +B \,b^{2} \tan \left (d x +c \right )^{2}+2 A \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a b +2 A \,b^{2} \tan \left (d x +c \right )+B \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a^{2}-B \ln \left (1+\tan \left (d x +c \right )^{2}\right ) b^{2}+4 B a b \tan \left (d x +c \right )}{2 d}\) | \(115\) |
risch | \(-\frac {2 i B \,b^{2} c}{d}+2 i A a b x +i B \,a^{2} x +A \,a^{2} x -A \,b^{2} x -2 B a b x -i B \,b^{2} x +\frac {2 i b \left (A b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 B a \,{\mathrm e}^{2 i \left (d x +c \right )}-i B b \,{\mathrm e}^{2 i \left (d x +c \right )}+A b +2 B a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+\frac {4 i A a b c}{d}+\frac {2 i B \,a^{2} c}{d}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A a b}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,b^{2}}{d}\) | \(204\) |
Input:
int((a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)
Output:
(A*a^2-A*b^2-2*B*a*b)*x+b*(A*b+2*B*a)/d*tan(d*x+c)+1/2*B*b^2/d*tan(d*x+c)^ 2+1/2*(2*A*a*b+B*a^2-B*b^2)/d*ln(1+tan(d*x+c)^2)
Time = 0.08 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {B b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} d x - {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \] Input:
integrate((a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="fricas")
Output:
1/2*(B*b^2*tan(d*x + c)^2 + 2*(A*a^2 - 2*B*a*b - A*b^2)*d*x - (B*a^2 + 2*A *a*b - B*b^2)*log(1/(tan(d*x + c)^2 + 1)) + 2*(2*B*a*b + A*b^2)*tan(d*x + c))/d
Time = 0.12 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.64 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\begin {cases} A a^{2} x + \frac {A a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - A b^{2} x + \frac {A b^{2} \tan {\left (c + d x \right )}}{d} + \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 B a b x + \frac {2 B a b \tan {\left (c + d x \right )}}{d} - \frac {B b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\left (c \right )}\right ) \left (a + b \tan {\left (c \right )}\right )^{2} & \text {otherwise} \end {cases} \] Input:
integrate((a+b*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)
Output:
Piecewise((A*a**2*x + A*a*b*log(tan(c + d*x)**2 + 1)/d - A*b**2*x + A*b**2 *tan(c + d*x)/d + B*a**2*log(tan(c + d*x)**2 + 1)/(2*d) - 2*B*a*b*x + 2*B* a*b*tan(c + d*x)/d - B*b**2*log(tan(c + d*x)**2 + 1)/(2*d) + B*b**2*tan(c + d*x)**2/(2*d), Ne(d, 0)), (x*(A + B*tan(c))*(a + b*tan(c))**2, True))
Time = 0.10 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {B b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} {\left (d x + c\right )} + {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \] Input:
integrate((a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="maxima")
Output:
1/2*(B*b^2*tan(d*x + c)^2 + 2*(A*a^2 - 2*B*a*b - A*b^2)*(d*x + c) + (B*a^2 + 2*A*a*b - B*b^2)*log(tan(d*x + c)^2 + 1) + 2*(2*B*a*b + A*b^2)*tan(d*x + c))/d
Time = 0.27 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.21 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {{\left (A a^{2} - 2 \, B a b - A b^{2}\right )} {\left (d x + c\right )}}{d} + \frac {{\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} + \frac {B b^{2} d \tan \left (d x + c\right )^{2} + 4 \, B a b d \tan \left (d x + c\right ) + 2 \, A b^{2} d \tan \left (d x + c\right )}{2 \, d^{2}} \] Input:
integrate((a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="giac")
Output:
(A*a^2 - 2*B*a*b - A*b^2)*(d*x + c)/d + 1/2*(B*a^2 + 2*A*a*b - B*b^2)*log( tan(d*x + c)^2 + 1)/d + 1/2*(B*b^2*d*tan(d*x + c)^2 + 4*B*a*b*d*tan(d*x + c) + 2*A*b^2*d*tan(d*x + c))/d^2
Time = 3.32 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {B\,a^2}{2}+A\,a\,b-\frac {B\,b^2}{2}\right )}{d}-x\,\left (-A\,a^2+2\,B\,a\,b+A\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,b^2+2\,B\,a\,b\right )}{d}+\frac {B\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \] Input:
int((A + B*tan(c + d*x))*(a + b*tan(c + d*x))^2,x)
Output:
(log(tan(c + d*x)^2 + 1)*((B*a^2)/2 - (B*b^2)/2 + A*a*b))/d - x*(A*b^2 - A *a^2 + 2*B*a*b) + (tan(c + d*x)*(A*b^2 + 2*B*a*b))/d + (B*b^2*tan(c + d*x) ^2)/(2*d)
Time = 0.30 (sec) , antiderivative size = 78, normalized size of antiderivative = 0.90 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {3 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a^{2} b -\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) b^{3}+\tan \left (d x +c \right )^{2} b^{3}+6 \tan \left (d x +c \right ) a \,b^{2}+2 a^{3} d x -6 a \,b^{2} d x}{2 d} \] Input:
int((a+b*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)
Output:
(3*log(tan(c + d*x)**2 + 1)*a**2*b - log(tan(c + d*x)**2 + 1)*b**3 + tan(c + d*x)**2*b**3 + 6*tan(c + d*x)*a*b**2 + 2*a**3*d*x - 6*a*b**2*d*x)/(2*d)