Integrand size = 32, antiderivative size = 112 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=-\left (\left (2 a b B+a^2 C-b^2 C\right ) x\right )-\frac {\left (a^2 B-b^2 B-2 a b C\right ) \log (\cos (c+d x))}{d}+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d} \] Output:
-(2*B*a*b+C*a^2-C*b^2)*x-(B*a^2-B*b^2-2*C*a*b)*ln(cos(d*x+c))/d+b*(B*a-C*b )*tan(d*x+c)/d+1/2*B*(a+b*tan(d*x+c))^2/d+1/3*C*(a+b*tan(d*x+c))^3/b/d
Result contains complex when optimal does not.
Time = 1.26 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.54 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {2 C (a+b \tan (c+d x))^3+3 (a B+b C) \left (i \left ((a+i b)^2 \log (i-\tan (c+d x))-(a-i b)^2 \log (i+\tan (c+d x))\right )-2 b^2 \tan (c+d x)\right )+3 B \left ((i a-b)^3 \log (i-\tan (c+d x))-(i a+b)^3 \log (i+\tan (c+d x))+6 a b^2 \tan (c+d x)+b^3 \tan ^2(c+d x)\right )}{6 b d} \] Input:
Integrate[(a + b*Tan[c + d*x])^2*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]
Output:
(2*C*(a + b*Tan[c + d*x])^3 + 3*(a*B + b*C)*(I*((a + I*b)^2*Log[I - Tan[c + d*x]] - (a - I*b)^2*Log[I + Tan[c + d*x]]) - 2*b^2*Tan[c + d*x]) + 3*B*( (I*a - b)^3*Log[I - Tan[c + d*x]] - (I*a + b)^3*Log[I + Tan[c + d*x]] + 6* a*b^2*Tan[c + d*x] + b^3*Tan[c + d*x]^2))/(6*b*d)
Time = 0.89 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3042, 4113, 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 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan (c+d x)^2\right )dx\) |
\(\Big \downarrow \) 4113 |
\(\displaystyle \int (a+b \tan (c+d x))^2 (B \tan (c+d x)-C)dx+\frac {C (a+b \tan (c+d x))^3}{3 b d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (c+d x))^2 (B \tan (c+d x)-C)dx+\frac {C (a+b \tan (c+d x))^3}{3 b d}\) |
\(\Big \downarrow \) 4011 |
\(\displaystyle \int (a+b \tan (c+d x)) (-b B-a C+(a B-b C) \tan (c+d x))dx+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (c+d x)) (-b B-a C+(a B-b C) \tan (c+d x))dx+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}\) |
\(\Big \downarrow \) 4008 |
\(\displaystyle \left (a^2 B-2 a b C-b^2 B\right ) \int \tan (c+d x)dx-x \left (a^2 C+2 a b B-b^2 C\right )+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \left (a^2 B-2 a b C-b^2 B\right ) \int \tan (c+d x)dx-x \left (a^2 C+2 a b B-b^2 C\right )+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle -\frac {\left (a^2 B-2 a b C-b^2 B\right ) \log (\cos (c+d x))}{d}-x \left (a^2 C+2 a b B-b^2 C\right )+\frac {b (a B-b C) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\frac {C (a+b \tan (c+d x))^3}{3 b d}\) |
Input:
Int[(a + b*Tan[c + d*x])^2*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]
Output:
-((2*a*b*B + a^2*C - b^2*C)*x) - ((a^2*B - b^2*B - 2*a*b*C)*Log[Cos[c + d* x]])/d + (b*(a*B - b*C)*Tan[c + d*x])/d + (B*(a + b*Tan[c + d*x])^2)/(2*d) + (C*(a + b*Tan[c + d*x])^3)/(3*b*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]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Si mp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0] && !LeQ[m, -1]
Time = 0.08 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.07
method | result | size |
norman | \(\left (-2 B a b -C \,a^{2}+C \,b^{2}\right ) x +\frac {\left (2 B a b +C \,a^{2}-C \,b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {C \,b^{2} \tan \left (d x +c \right )^{3}}{3 d}+\frac {b \left (B b +2 C a \right ) \tan \left (d x +c \right )^{2}}{2 d}+\frac {\left (B \,a^{2}-B \,b^{2}-2 C a b \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}\) | \(120\) |
parts | \(\frac {\left (2 B a b +C \,a^{2}\right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {\left (B \,b^{2}+2 C a b \right ) \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}+\frac {B \,a^{2} \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}+\frac {C \,b^{2} \left (\frac {\tan \left (d x +c \right )^{3}}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) | \(126\) |
derivativedivides | \(\frac {\frac {C \tan \left (d x +c \right )^{3} b^{2}}{3}+\frac {B \tan \left (d x +c \right )^{2} b^{2}}{2}+C \tan \left (d x +c \right )^{2} a b +2 B \tan \left (d x +c \right ) a b +C \tan \left (d x +c \right ) a^{2}-C \tan \left (d x +c \right ) b^{2}+\frac {\left (B \,a^{2}-B \,b^{2}-2 C a b \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-2 B a b -C \,a^{2}+C \,b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(135\) |
default | \(\frac {\frac {C \tan \left (d x +c \right )^{3} b^{2}}{3}+\frac {B \tan \left (d x +c \right )^{2} b^{2}}{2}+C \tan \left (d x +c \right )^{2} a b +2 B \tan \left (d x +c \right ) a b +C \tan \left (d x +c \right ) a^{2}-C \tan \left (d x +c \right ) b^{2}+\frac {\left (B \,a^{2}-B \,b^{2}-2 C a b \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-2 B a b -C \,a^{2}+C \,b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(135\) |
parallelrisch | \(\frac {2 C \tan \left (d x +c \right )^{3} b^{2}-12 B a b d x +3 B \tan \left (d x +c \right )^{2} b^{2}-6 C \,a^{2} d x +6 C \,b^{2} d x +6 C \tan \left (d x +c \right )^{2} a b +3 B \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a^{2}-3 B \ln \left (1+\tan \left (d x +c \right )^{2}\right ) b^{2}+12 B \tan \left (d x +c \right ) a b -6 C \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a b +6 C \tan \left (d x +c \right ) a^{2}-6 C \tan \left (d x +c \right ) b^{2}}{6 d}\) | \(156\) |
risch | \(-\frac {4 i C a b c}{d}-i B \,b^{2} x +\frac {2 i \left (-3 i B \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 i C a b \,{\mathrm e}^{4 i \left (d x +c \right )}+6 B a b \,{\mathrm e}^{4 i \left (d x +c \right )}+3 C \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-3 i B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 i C a b \,{\mathrm e}^{2 i \left (d x +c \right )}+12 B a b \,{\mathrm e}^{2 i \left (d x +c \right )}+6 C \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 C \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+6 B a b +3 C \,a^{2}-4 C \,b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-2 B a b x -C \,a^{2} x +C \,b^{2} x +i B \,a^{2} x +\frac {2 i B \,a^{2} c}{d}-2 i C a b x -\frac {2 i B \,b^{2} c}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,a^{2}}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,b^{2}}{d}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C a b}{d}\) | \(324\) |
Input:
int((a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x,method=_RETURNVERBO SE)
Output:
(-2*B*a*b-C*a^2+C*b^2)*x+(2*B*a*b+C*a^2-C*b^2)/d*tan(d*x+c)+1/3*C*b^2/d*ta n(d*x+c)^3+1/2*b*(B*b+2*C*a)/d*tan(d*x+c)^2+1/2*(B*a^2-B*b^2-2*C*a*b)/d*ln (1+tan(d*x+c)^2)
Time = 0.08 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.06 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {2 \, C b^{2} \tan \left (d x + c\right )^{3} - 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} d x + 3 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )^{2} - 3 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \tan \left (d x + c\right )}{6 \, d} \] Input:
integrate((a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="f ricas")
Output:
1/6*(2*C*b^2*tan(d*x + c)^3 - 6*(C*a^2 + 2*B*a*b - C*b^2)*d*x + 3*(2*C*a*b + B*b^2)*tan(d*x + c)^2 - 3*(B*a^2 - 2*C*a*b - B*b^2)*log(1/(tan(d*x + c) ^2 + 1)) + 6*(C*a^2 + 2*B*a*b - C*b^2)*tan(d*x + c))/d
Time = 0.14 (sec) , antiderivative size = 194, normalized size of antiderivative = 1.73 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\begin {cases} \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} - C a^{2} x + \frac {C a^{2} \tan {\left (c + d x \right )}}{d} - \frac {C a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {C a b \tan ^{2}{\left (c + d x \right )}}{d} + C b^{2} x + \frac {C b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {C b^{2} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{2} \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) & \text {otherwise} \end {cases} \] Input:
integrate((a+b*tan(d*x+c))**2*(B*tan(d*x+c)+C*tan(d*x+c)**2),x)
Output:
Piecewise((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) - C*a**2*x + C*a**2*tan(c + d*x)/d - C*a*b*log(tan(c + d*x)**2 + 1)/d + C*a*b*tan(c + d*x)**2/d + C*b**2*x + C*b**2*tan(c + d*x)**3/(3*d) - C*b**2*tan(c + d*x)/d, Ne(d, 0)), (x*(a + b*tan(c))**2*(B*tan(c) + C*tan( c)**2), True))
Time = 0.11 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.07 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {2 \, C b^{2} \tan \left (d x + c\right )^{3} + 3 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} {\left (d x + c\right )} + 3 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \tan \left (d x + c\right )}{6 \, d} \] Input:
integrate((a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="m axima")
Output:
1/6*(2*C*b^2*tan(d*x + c)^3 + 3*(2*C*a*b + B*b^2)*tan(d*x + c)^2 - 6*(C*a^ 2 + 2*B*a*b - C*b^2)*(d*x + c) + 3*(B*a^2 - 2*C*a*b - B*b^2)*log(tan(d*x + c)^2 + 1) + 6*(C*a^2 + 2*B*a*b - C*b^2)*tan(d*x + c))/d
Time = 0.50 (sec) , antiderivative size = 161, normalized size of antiderivative = 1.44 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=-\frac {{\left (C a^{2} + 2 \, B a b - C b^{2}\right )} {\left (d x + c\right )}}{d} + \frac {{\left (B a^{2} - 2 \, C a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} + \frac {2 \, C b^{2} d^{2} \tan \left (d x + c\right )^{3} + 6 \, C a b d^{2} \tan \left (d x + c\right )^{2} + 3 \, B b^{2} d^{2} \tan \left (d x + c\right )^{2} + 6 \, C a^{2} d^{2} \tan \left (d x + c\right ) + 12 \, B a b d^{2} \tan \left (d x + c\right ) - 6 \, C b^{2} d^{2} \tan \left (d x + c\right )}{6 \, d^{3}} \] Input:
integrate((a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, algorithm="g iac")
Output:
-(C*a^2 + 2*B*a*b - C*b^2)*(d*x + c)/d + 1/2*(B*a^2 - 2*C*a*b - B*b^2)*log (tan(d*x + c)^2 + 1)/d + 1/6*(2*C*b^2*d^2*tan(d*x + c)^3 + 6*C*a*b*d^2*tan (d*x + c)^2 + 3*B*b^2*d^2*tan(d*x + c)^2 + 6*C*a^2*d^2*tan(d*x + c) + 12*B *a*b*d^2*tan(d*x + c) - 6*C*b^2*d^2*tan(d*x + c))/d^3
Time = 5.27 (sec) , antiderivative size = 121, normalized size of antiderivative = 1.08 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,b^2}{2}+C\,a\,b\right )}{d}-x\,\left (C\,a^2+2\,B\,a\,b-C\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (C\,a^2+2\,B\,a\,b-C\,b^2\right )}{d}-\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (-\frac {B\,a^2}{2}+C\,a\,b+\frac {B\,b^2}{2}\right )}{d}+\frac {C\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \] Input:
int((B*tan(c + d*x) + C*tan(c + d*x)^2)*(a + b*tan(c + d*x))^2,x)
Output:
(tan(c + d*x)^2*((B*b^2)/2 + C*a*b))/d - x*(C*a^2 - C*b^2 + 2*B*a*b) + (ta n(c + d*x)*(C*a^2 - C*b^2 + 2*B*a*b))/d - (log(tan(c + d*x)^2 + 1)*((B*b^2 )/2 - (B*a^2)/2 + C*a*b))/d + (C*b^2*tan(c + d*x)^3)/(3*d)
Time = 0.17 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.38 \[ \int (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {3 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a^{2} b -6 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a b c -3 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) b^{3}+2 \tan \left (d x +c \right )^{3} b^{2} c +6 \tan \left (d x +c \right )^{2} a b c +3 \tan \left (d x +c \right )^{2} b^{3}+6 \tan \left (d x +c \right ) a^{2} c +12 \tan \left (d x +c \right ) a \,b^{2}-6 \tan \left (d x +c \right ) b^{2} c -6 a^{2} c d x -12 a \,b^{2} d x +6 b^{2} c d x}{6 d} \] Input:
int((a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x)
Output:
(3*log(tan(c + d*x)**2 + 1)*a**2*b - 6*log(tan(c + d*x)**2 + 1)*a*b*c - 3* log(tan(c + d*x)**2 + 1)*b**3 + 2*tan(c + d*x)**3*b**2*c + 6*tan(c + d*x)* *2*a*b*c + 3*tan(c + d*x)**2*b**3 + 6*tan(c + d*x)*a**2*c + 12*tan(c + d*x )*a*b**2 - 6*tan(c + d*x)*b**2*c - 6*a**2*c*d*x - 12*a*b**2*d*x + 6*b**2*c *d*x)/(6*d)