Integrand size = 38, antiderivative size = 87 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\left (a^2 B-b^2 B-2 a b C\right ) x-\frac {\left (2 a b B+a^2 C-b^2 C\right ) \log (\cos (c+d x))}{d}+\frac {b (b B+a C) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d} \] Output:
(B*a^2-B*b^2-2*C*a*b)*x-(2*B*a*b+C*a^2-C*b^2)*ln(cos(d*x+c))/d+b*(B*b+C*a) *tan(d*x+c)/d+1/2*C*(a+b*tan(d*x+c))^2/d
Result contains complex when optimal does not.
Time = 0.32 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.10 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {(a+i b)^2 (-i B+C) \log (i-\tan (c+d x))+(a-i b)^2 (i B+C) \log (i+\tan (c+d x))+2 b (b B+2 a C) \tan (c+d x)+b^2 C \tan ^2(c+d x)}{2 d} \] Input:
Integrate[Cot[c + d*x]*(a + b*Tan[c + d*x])^2*(B*Tan[c + d*x] + C*Tan[c + d*x]^2),x]
Output:
((a + I*b)^2*((-I)*B + C)*Log[I - Tan[c + d*x]] + (a - I*b)^2*(I*B + C)*Lo g[I + Tan[c + d*x]] + 2*b*(b*B + 2*a*C)*Tan[c + d*x] + b^2*C*Tan[c + d*x]^ 2)/(2*d)
Time = 0.86 (sec) , antiderivative size = 87, 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.211, Rules used = {3042, 4115, 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 \cot (c+d x) (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 \frac {(a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan (c+d x)^2\right )}{\tan (c+d x)}dx\) |
\(\Big \downarrow \) 4115 |
\(\displaystyle \int (a+b \tan (c+d x))^2 (B+C \tan (c+d x))dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (c+d x))^2 (B+C \tan (c+d x))dx\) |
\(\Big \downarrow \) 4011 |
\(\displaystyle \int (a+b \tan (c+d x)) (a B-b C+(b B+a C) \tan (c+d x))dx+\frac {C (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (c+d x)) (a B-b C+(b B+a C) \tan (c+d x))dx+\frac {C (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 4008 |
\(\displaystyle \left (a^2 C+2 a b B-b^2 C\right ) \int \tan (c+d x)dx+x \left (a^2 B-2 a b C-b^2 B\right )+\frac {b (a C+b B) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \left (a^2 C+2 a b B-b^2 C\right ) \int \tan (c+d x)dx+x \left (a^2 B-2 a b C-b^2 B\right )+\frac {b (a C+b B) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle -\frac {\left (a^2 C+2 a b B-b^2 C\right ) \log (\cos (c+d x))}{d}+x \left (a^2 B-2 a b C-b^2 B\right )+\frac {b (a C+b B) \tan (c+d x)}{d}+\frac {C (a+b \tan (c+d x))^2}{2 d}\) |
Input:
Int[Cot[c + d*x]*(a + b*Tan[c + d*x])^2*(B*Tan[c + d*x] + C*Tan[c + d*x]^2 ),x]
Output:
(a^2*B - b^2*B - 2*a*b*C)*x - ((2*a*b*B + a^2*C - b^2*C)*Log[Cos[c + d*x]] )/d + (b*(b*B + a*C)*Tan[c + d*x])/d + (C*(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]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_ .) + (f_.)*(x_)]^2), x_Symbol] :> Simp[1/b^2 Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*(b*B - a*C + b*C*Tan[e + f*x]), x], x] /; FreeQ [{a, b, c, d, e, f, A, B, C, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - a*b*B + a^2*C, 0]
Time = 0.15 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.00
method | result | size |
parallelrisch | \(\frac {\ln \left (\sec \left (d x +c \right )^{2}\right ) \left (2 B a b +C \,a^{2}-C \,b^{2}\right )+C \,b^{2} \tan \left (d x +c \right )^{2}+\left (2 B \,b^{2}+4 C a b \right ) \tan \left (d x +c \right )+2 d x \left (B \,a^{2}-B \,b^{2}-2 C a b \right )}{2 d}\) | \(87\) |
norman | \(\left (B \,a^{2}-B \,b^{2}-2 C a b \right ) x +\frac {b \left (B b +2 C a \right ) \tan \left (d x +c \right )}{d}+\frac {C \,b^{2} \tan \left (d x +c \right )^{2}}{2 d}+\frac {\left (2 B a b +C \,a^{2}-C \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}\) | \(90\) |
derivativedivides | \(-\frac {\frac {\left (-2 B a b -C \,a^{2}+C \,b^{2}\right ) \ln \left (\cot \left (d x +c \right )^{2}+1\right )}{2}+\left (B \,a^{2}-B \,b^{2}-2 C a b \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )+\left (2 B a b +C \,a^{2}-C \,b^{2}\right ) \ln \left (\cot \left (d x +c \right )\right )-\frac {C \,b^{2}}{2 \cot \left (d x +c \right )^{2}}-\frac {b \left (B b +2 C a \right )}{\cot \left (d x +c \right )}}{d}\) | \(126\) |
default | \(-\frac {\frac {\left (-2 B a b -C \,a^{2}+C \,b^{2}\right ) \ln \left (\cot \left (d x +c \right )^{2}+1\right )}{2}+\left (B \,a^{2}-B \,b^{2}-2 C a b \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )+\left (2 B a b +C \,a^{2}-C \,b^{2}\right ) \ln \left (\cot \left (d x +c \right )\right )-\frac {C \,b^{2}}{2 \cot \left (d x +c \right )^{2}}-\frac {b \left (B b +2 C a \right )}{\cot \left (d x +c \right )}}{d}\) | \(126\) |
risch | \(B \,a^{2} x -B \,b^{2} x -2 C a b x +\frac {4 i B a b c}{d}+i C \,a^{2} x -i C \,b^{2} x -\frac {2 i C \,b^{2} c}{d}+\frac {2 i C \,a^{2} c}{d}+\frac {2 i b \left (-i C b \,{\mathrm e}^{2 i \left (d x +c \right )}+B b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 C a \,{\mathrm e}^{2 i \left (d x +c \right )}+B b +2 C a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+2 i B a b x -\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B a b}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C \,a^{2}}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C \,b^{2}}{d}\) | \(204\) |
Input:
int(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x,method=_ RETURNVERBOSE)
Output:
1/2*(ln(sec(d*x+c)^2)*(2*B*a*b+C*a^2-C*b^2)+C*b^2*tan(d*x+c)^2+(2*B*b^2+4* C*a*b)*tan(d*x+c)+2*d*x*(B*a^2-B*b^2-2*C*a*b))/d
Time = 0.08 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {C b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} d x - {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \] Input:
integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, a lgorithm="fricas")
Output:
1/2*(C*b^2*tan(d*x + c)^2 + 2*(B*a^2 - 2*C*a*b - B*b^2)*d*x - (C*a^2 + 2*B *a*b - C*b^2)*log(1/(tan(d*x + c)^2 + 1)) + 2*(2*C*a*b + B*b^2)*tan(d*x + c))/d
Time = 0.45 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.74 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\begin {cases} B a^{2} x + \frac {B a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - B b^{2} x + \frac {B b^{2} \tan {\left (c + d x \right )}}{d} + \frac {C a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 C a b x + \frac {2 C a b \tan {\left (c + d x \right )}}{d} - \frac {C b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {C 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 )^{2} \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \cot {\left (c \right )} & \text {otherwise} \end {cases} \] Input:
integrate(cot(d*x+c)*(a+b*tan(d*x+c))**2*(B*tan(d*x+c)+C*tan(d*x+c)**2),x)
Output:
Piecewise((B*a**2*x + B*a*b*log(tan(c + d*x)**2 + 1)/d - B*b**2*x + B*b**2 *tan(c + d*x)/d + C*a**2*log(tan(c + d*x)**2 + 1)/(2*d) - 2*C*a*b*x + 2*C* a*b*tan(c + d*x)/d - C*b**2*log(tan(c + d*x)**2 + 1)/(2*d) + C*b**2*tan(c + d*x)**2/(2*d), Ne(d, 0)), (x*(a + b*tan(c))**2*(B*tan(c) + C*tan(c)**2)* cot(c), True))
Time = 0.11 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {C b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (B a^{2} - 2 \, C a b - B b^{2}\right )} {\left (d x + c\right )} + {\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (2 \, C a b + B b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \] Input:
integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, a lgorithm="maxima")
Output:
1/2*(C*b^2*tan(d*x + c)^2 + 2*(B*a^2 - 2*C*a*b - B*b^2)*(d*x + c) + (C*a^2 + 2*B*a*b - C*b^2)*log(tan(d*x + c)^2 + 1) + 2*(2*C*a*b + B*b^2)*tan(d*x + c))/d
Time = 0.64 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.21 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {{\left (B a^{2} - 2 \, C a b - B b^{2}\right )} {\left (d x + c\right )}}{d} + \frac {{\left (C a^{2} + 2 \, B a b - C b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} + \frac {C b^{2} d \tan \left (d x + c\right )^{2} + 4 \, C a b d \tan \left (d x + c\right ) + 2 \, B b^{2} d \tan \left (d x + c\right )}{2 \, d^{2}} \] Input:
integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, a lgorithm="giac")
Output:
(B*a^2 - 2*C*a*b - B*b^2)*(d*x + c)/d + 1/2*(C*a^2 + 2*B*a*b - C*b^2)*log( tan(d*x + c)^2 + 1)/d + 1/2*(C*b^2*d*tan(d*x + c)^2 + 4*C*a*b*d*tan(d*x + c) + 2*B*b^2*d*tan(d*x + c))/d^2
Time = 5.23 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {C\,a^2}{2}+B\,a\,b-\frac {C\,b^2}{2}\right )}{d}-x\,\left (-B\,a^2+2\,C\,a\,b+B\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,b^2+2\,C\,a\,b\right )}{d}+\frac {C\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \] Input:
int(cot(c + d*x)*(B*tan(c + d*x) + C*tan(c + d*x)^2)*(a + b*tan(c + d*x))^ 2,x)
Output:
(log(tan(c + d*x)^2 + 1)*((C*a^2)/2 - (C*b^2)/2 + B*a*b))/d - x*(B*b^2 - B *a^2 + 2*C*a*b) + (tan(c + d*x)*(B*b^2 + 2*C*a*b))/d + (C*b^2*tan(c + d*x) ^2)/(2*d)
Time = 0.16 (sec) , antiderivative size = 542, normalized size of antiderivative = 6.23 \[ \int \cot (c+d x) (a+b \tan (c+d x))^2 \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx =\text {Too large to display} \] Input:
int(cot(d*x+c)*(a+b*tan(d*x+c))^2*(B*tan(d*x+c)+C*tan(d*x+c)^2),x)
Output:
( - 4*cos(c + d*x)*sin(c + d*x)*a*b*c - 2*cos(c + d*x)*sin(c + d*x)*b**3 + 2*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**2*a**2*c + 4*log(tan((c + d* x)/2)**2 + 1)*sin(c + d*x)**2*a*b**2 - 2*log(tan((c + d*x)/2)**2 + 1)*sin( c + d*x)**2*b**2*c - 2*log(tan((c + d*x)/2)**2 + 1)*a**2*c - 4*log(tan((c + d*x)/2)**2 + 1)*a*b**2 + 2*log(tan((c + d*x)/2)**2 + 1)*b**2*c - 2*log(t an((c + d*x)/2) - 1)*sin(c + d*x)**2*a**2*c - 4*log(tan((c + d*x)/2) - 1)* sin(c + d*x)**2*a*b**2 + 2*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**2*b**2* c + 2*log(tan((c + d*x)/2) - 1)*a**2*c + 4*log(tan((c + d*x)/2) - 1)*a*b** 2 - 2*log(tan((c + d*x)/2) - 1)*b**2*c - 2*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a**2*c - 4*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*a*b**2 + 2 *log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*b**2*c + 2*log(tan((c + d*x)/2) + 1)*a**2*c + 4*log(tan((c + d*x)/2) + 1)*a*b**2 - 2*log(tan((c + d*x)/2) + 1)*b**2*c + 2*sin(c + d*x)**2*a**2*b*d*x - 4*sin(c + d*x)**2*a*b*c*d*x - 2*sin(c + d*x)**2*b**3*d*x - sin(c + d*x)**2*b**2*c - 2*a**2*b*d*x + 4*a *b*c*d*x + 2*b**3*d*x)/(2*d*(sin(c + d*x)**2 - 1))