Integrand size = 20, antiderivative size = 114 \[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {d x}{4 b}-\frac {i (c+d x)^2}{2 d}+\frac {(c+d x) \log \left (1-e^{2 i (a+b x)}\right )}{b}-\frac {i d \operatorname {PolyLog}\left (2,e^{2 i (a+b x)}\right )}{2 b^2}-\frac {d \cos (a+b x) \sin (a+b x)}{4 b^2}-\frac {(c+d x) \sin ^2(a+b x)}{2 b} \] Output:
1/4*d*x/b-1/2*I*(d*x+c)^2/d+(d*x+c)*ln(1-exp(2*I*(b*x+a)))/b-1/2*I*d*polyl og(2,exp(2*I*(b*x+a)))/b^2-1/4*d*cos(b*x+a)*sin(b*x+a)/b^2-1/2*(d*x+c)*sin (b*x+a)^2/b
Time = 0.45 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.15 \[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {d x \cos (2 (a+b x))}{4 b}+\frac {c \log (\sin (a+b x))}{b}-\frac {a d \log (\sin (a+b x))}{b^2}+\frac {d \left ((a+b x) \log \left (1-e^{2 i (a+b x)}\right )-\frac {1}{2} i \left ((a+b x)^2+\operatorname {PolyLog}\left (2,e^{2 i (a+b x)}\right )\right )\right )}{b^2}-\frac {c \sin ^2(a+b x)}{2 b}-\frac {d \sin (2 (a+b x))}{8 b^2} \] Input:
Integrate[(c + d*x)*Cos[a + b*x]^2*Cot[a + b*x],x]
Output:
(d*x*Cos[2*(a + b*x)])/(4*b) + (c*Log[Sin[a + b*x]])/b - (a*d*Log[Sin[a + b*x]])/b^2 + (d*((a + b*x)*Log[1 - E^((2*I)*(a + b*x))] - (I/2)*((a + b*x) ^2 + PolyLog[2, E^((2*I)*(a + b*x))])))/b^2 - (c*Sin[a + b*x]^2)/(2*b) - ( d*Sin[2*(a + b*x)])/(8*b^2)
Time = 0.63 (sec) , antiderivative size = 134, normalized size of antiderivative = 1.18, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.550, Rules used = {4908, 3042, 25, 4202, 2620, 2715, 2838, 4904, 3042, 3115, 24}
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 (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx\) |
\(\Big \downarrow \) 4908 |
\(\displaystyle \int (c+d x) \cot (a+b x)dx-\int (c+d x) \cos (a+b x) \sin (a+b x)dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int -\left ((c+d x) \tan \left (a+b x+\frac {\pi }{2}\right )\right )dx-\int (c+d x) \cos (a+b x) \sin (a+b x)dx\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\int (c+d x) \tan \left (\frac {1}{2} (2 a+\pi )+b x\right )dx-\int (c+d x) \cos (a+b x) \sin (a+b x)dx\) |
\(\Big \downarrow \) 4202 |
\(\displaystyle 2 i \int \frac {e^{i (2 a+2 b x+\pi )} (c+d x)}{1+e^{i (2 a+2 b x+\pi )}}dx-\int (c+d x) \cos (a+b x) \sin (a+b x)dx-\frac {i (c+d x)^2}{2 d}\) |
\(\Big \downarrow \) 2620 |
\(\displaystyle 2 i \left (\frac {i d \int \log \left (1+e^{i (2 a+2 b x+\pi )}\right )dx}{2 b}-\frac {i (c+d x) \log \left (1+e^{i (2 a+2 b x+\pi )}\right )}{2 b}\right )-\int (c+d x) \cos (a+b x) \sin (a+b x)dx-\frac {i (c+d x)^2}{2 d}\) |
\(\Big \downarrow \) 2715 |
\(\displaystyle 2 i \left (\frac {d \int e^{-i (2 a+2 b x+\pi )} \log \left (1+e^{i (2 a+2 b x+\pi )}\right )de^{i (2 a+2 b x+\pi )}}{4 b^2}-\frac {i (c+d x) \log \left (1+e^{i (2 a+2 b x+\pi )}\right )}{2 b}\right )-\int (c+d x) \cos (a+b x) \sin (a+b x)dx-\frac {i (c+d x)^2}{2 d}\) |
\(\Big \downarrow \) 2838 |
\(\displaystyle -\int (c+d x) \cos (a+b x) \sin (a+b x)dx+2 i \left (-\frac {d \operatorname {PolyLog}\left (2,-e^{i (2 a+2 b x+\pi )}\right )}{4 b^2}-\frac {i (c+d x) \log \left (1+e^{i (2 a+2 b x+\pi )}\right )}{2 b}\right )-\frac {i (c+d x)^2}{2 d}\) |
\(\Big \downarrow \) 4904 |
\(\displaystyle \frac {d \int \sin ^2(a+b x)dx}{2 b}+2 i \left (-\frac {d \operatorname {PolyLog}\left (2,-e^{i (2 a+2 b x+\pi )}\right )}{4 b^2}-\frac {i (c+d x) \log \left (1+e^{i (2 a+2 b x+\pi )}\right )}{2 b}\right )-\frac {(c+d x) \sin ^2(a+b x)}{2 b}-\frac {i (c+d x)^2}{2 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {d \int \sin (a+b x)^2dx}{2 b}+2 i \left (-\frac {d \operatorname {PolyLog}\left (2,-e^{i (2 a+2 b x+\pi )}\right )}{4 b^2}-\frac {i (c+d x) \log \left (1+e^{i (2 a+2 b x+\pi )}\right )}{2 b}\right )-\frac {(c+d x) \sin ^2(a+b x)}{2 b}-\frac {i (c+d x)^2}{2 d}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle \frac {d \left (\frac {\int 1dx}{2}-\frac {\sin (a+b x) \cos (a+b x)}{2 b}\right )}{2 b}+2 i \left (-\frac {d \operatorname {PolyLog}\left (2,-e^{i (2 a+2 b x+\pi )}\right )}{4 b^2}-\frac {i (c+d x) \log \left (1+e^{i (2 a+2 b x+\pi )}\right )}{2 b}\right )-\frac {(c+d x) \sin ^2(a+b x)}{2 b}-\frac {i (c+d x)^2}{2 d}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle 2 i \left (-\frac {d \operatorname {PolyLog}\left (2,-e^{i (2 a+2 b x+\pi )}\right )}{4 b^2}-\frac {i (c+d x) \log \left (1+e^{i (2 a+2 b x+\pi )}\right )}{2 b}\right )-\frac {(c+d x) \sin ^2(a+b x)}{2 b}+\frac {d \left (\frac {x}{2}-\frac {\sin (a+b x) \cos (a+b x)}{2 b}\right )}{2 b}-\frac {i (c+d x)^2}{2 d}\) |
Input:
Int[(c + d*x)*Cos[a + b*x]^2*Cot[a + b*x],x]
Output:
((-1/2*I)*(c + d*x)^2)/d + (2*I)*(((-1/2*I)*(c + d*x)*Log[1 + E^(I*(2*a + Pi + 2*b*x))])/b - (d*PolyLog[2, -E^(I*(2*a + Pi + 2*b*x))])/(4*b^2)) - (( c + d*x)*Sin[a + b*x]^2)/(2*b) + (d*(x/2 - (Cos[a + b*x]*Sin[a + b*x])/(2* b)))/(2*b)
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ ((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp [((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si mp[d*(m/(b*f*g*n*Log[F])) Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x )))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
Int[Log[(a_) + (b_.)*((F_)^((e_.)*((c_.) + (d_.)*(x_))))^(n_.)], x_Symbol] :> Simp[1/(d*e*n*Log[F]) Subst[Int[Log[a + b*x]/x, x], x, (F^(e*(c + d*x) ))^n], x] /; FreeQ[{F, a, b, c, d, e, n}, x] && GtQ[a, 0]
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 , (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[I *((c + d*x)^(m + 1)/(d*(m + 1))), x] - Simp[2*I Int[(c + d*x)^m*(E^(2*I*( e + f*x))/(1 + E^(2*I*(e + f*x)))), x], x] /; FreeQ[{c, d, e, f}, x] && IGt Q[m, 0]
Int[Cos[(a_.) + (b_.)*(x_)]*((c_.) + (d_.)*(x_))^(m_.)*Sin[(a_.) + (b_.)*(x _)]^(n_.), x_Symbol] :> Simp[(c + d*x)^m*(Sin[a + b*x]^(n + 1)/(b*(n + 1))) , x] - Simp[d*(m/(b*(n + 1))) Int[(c + d*x)^(m - 1)*Sin[a + b*x]^(n + 1), x], x] /; FreeQ[{a, b, c, d, n}, x] && IGtQ[m, 0] && NeQ[n, -1]
Int[Cos[(a_.) + (b_.)*(x_)]^(n_.)*Cot[(a_.) + (b_.)*(x_)]^(p_.)*((c_.) + (d _.)*(x_))^(m_.), x_Symbol] :> -Int[(c + d*x)^m*Cos[a + b*x]^n*Cot[a + b*x]^ (p - 2), x] + Int[(c + d*x)^m*Cos[a + b*x]^(n - 2)*Cot[a + b*x]^p, x] /; Fr eeQ[{a, b, c, d, m}, x] && IGtQ[n, 0] && IGtQ[p, 0]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 248 vs. \(2 (98 ) = 196\).
Time = 0.99 (sec) , antiderivative size = 249, normalized size of antiderivative = 2.18
method | result | size |
risch | \(-\frac {i d \,x^{2}}{2}+i x c -\frac {2 c \ln \left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b}+\frac {c \ln \left ({\mathrm e}^{i \left (b x +a \right )}-1\right )}{b}+\frac {c \ln \left ({\mathrm e}^{i \left (b x +a \right )}+1\right )}{b}-\frac {i d \operatorname {polylog}\left (2, -{\mathrm e}^{i \left (b x +a \right )}\right )}{b^{2}}-\frac {2 i d a x}{b}-\frac {i d \operatorname {polylog}\left (2, {\mathrm e}^{i \left (b x +a \right )}\right )}{b^{2}}+\frac {d \ln \left ({\mathrm e}^{i \left (b x +a \right )}+1\right ) x}{b}-\frac {i d \,a^{2}}{b^{2}}+\frac {d \ln \left (1-{\mathrm e}^{i \left (b x +a \right )}\right ) x}{b}+\frac {d \ln \left (1-{\mathrm e}^{i \left (b x +a \right )}\right ) a}{b^{2}}+\frac {2 d a \ln \left ({\mathrm e}^{i \left (b x +a \right )}\right )}{b^{2}}-\frac {d a \ln \left ({\mathrm e}^{i \left (b x +a \right )}-1\right )}{b^{2}}+\frac {\left (d x +c \right ) \cos \left (2 b x +2 a \right )}{4 b}-\frac {d \sin \left (2 b x +2 a \right )}{8 b^{2}}\) | \(249\) |
Input:
int((d*x+c)*cos(b*x+a)^2*cot(b*x+a),x,method=_RETURNVERBOSE)
Output:
-1/2*I*d*x^2+I*x*c-2/b*c*ln(exp(I*(b*x+a)))+1/b*c*ln(exp(I*(b*x+a))-1)+1/b *c*ln(exp(I*(b*x+a))+1)-I*d*polylog(2,-exp(I*(b*x+a)))/b^2-2*I/b*d*a*x-I*d *polylog(2,exp(I*(b*x+a)))/b^2+1/b*d*ln(exp(I*(b*x+a))+1)*x-I/b^2*d*a^2+1/ b*d*ln(1-exp(I*(b*x+a)))*x+1/b^2*d*ln(1-exp(I*(b*x+a)))*a+2/b^2*d*a*ln(exp (I*(b*x+a)))-1/b^2*d*a*ln(exp(I*(b*x+a))-1)+1/4*(d*x+c)*cos(2*b*x+2*a)/b-1 /8*d*sin(2*b*x+2*a)/b^2
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 292 vs. \(2 (95) = 190\).
Time = 0.10 (sec) , antiderivative size = 292, normalized size of antiderivative = 2.56 \[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=-\frac {b d x - 2 \, {\left (b d x + b c\right )} \cos \left (b x + a\right )^{2} + d \cos \left (b x + a\right ) \sin \left (b x + a\right ) + 2 i \, d {\rm Li}_2\left (\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) - 2 i \, d {\rm Li}_2\left (\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) - 2 i \, d {\rm Li}_2\left (-\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right )\right ) + 2 i \, d {\rm Li}_2\left (-\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right )\right ) - 2 \, {\left (b d x + b c\right )} \log \left (\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + 1\right ) - 2 \, {\left (b d x + b c\right )} \log \left (\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + 1\right ) - 2 \, {\left (b c - a d\right )} \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) + \frac {1}{2} i \, \sin \left (b x + a\right ) + \frac {1}{2}\right ) - 2 \, {\left (b c - a d\right )} \log \left (-\frac {1}{2} \, \cos \left (b x + a\right ) - \frac {1}{2} i \, \sin \left (b x + a\right ) + \frac {1}{2}\right ) - 2 \, {\left (b d x + a d\right )} \log \left (-\cos \left (b x + a\right ) + i \, \sin \left (b x + a\right ) + 1\right ) - 2 \, {\left (b d x + a d\right )} \log \left (-\cos \left (b x + a\right ) - i \, \sin \left (b x + a\right ) + 1\right )}{4 \, b^{2}} \] Input:
integrate((d*x+c)*cos(b*x+a)^2*cot(b*x+a),x, algorithm="fricas")
Output:
-1/4*(b*d*x - 2*(b*d*x + b*c)*cos(b*x + a)^2 + d*cos(b*x + a)*sin(b*x + a) + 2*I*d*dilog(cos(b*x + a) + I*sin(b*x + a)) - 2*I*d*dilog(cos(b*x + a) - I*sin(b*x + a)) - 2*I*d*dilog(-cos(b*x + a) + I*sin(b*x + a)) + 2*I*d*dil og(-cos(b*x + a) - I*sin(b*x + a)) - 2*(b*d*x + b*c)*log(cos(b*x + a) + I* sin(b*x + a) + 1) - 2*(b*d*x + b*c)*log(cos(b*x + a) - I*sin(b*x + a) + 1) - 2*(b*c - a*d)*log(-1/2*cos(b*x + a) + 1/2*I*sin(b*x + a) + 1/2) - 2*(b* c - a*d)*log(-1/2*cos(b*x + a) - 1/2*I*sin(b*x + a) + 1/2) - 2*(b*d*x + a* d)*log(-cos(b*x + a) + I*sin(b*x + a) + 1) - 2*(b*d*x + a*d)*log(-cos(b*x + a) - I*sin(b*x + a) + 1))/b^2
\[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=\int \left (c + d x\right ) \cos ^{2}{\left (a + b x \right )} \cot {\left (a + b x \right )}\, dx \] Input:
integrate((d*x+c)*cos(b*x+a)**2*cot(b*x+a),x)
Output:
Integral((c + d*x)*cos(a + b*x)**2*cot(a + b*x), x)
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 223 vs. \(2 (95) = 190\).
Time = 0.14 (sec) , antiderivative size = 223, normalized size of antiderivative = 1.96 \[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {-4 i \, b^{2} d x^{2} - 8 i \, b^{2} c x - 8 i \, b d x \arctan \left (\sin \left (b x + a\right ), -\cos \left (b x + a\right ) + 1\right ) + 8 i \, b c \arctan \left (\sin \left (b x + a\right ), \cos \left (b x + a\right ) - 1\right ) - 8 \, {\left (-i \, b d x - i \, b c\right )} \arctan \left (\sin \left (b x + a\right ), \cos \left (b x + a\right ) + 1\right ) + 2 \, {\left (b d x + b c\right )} \cos \left (2 \, b x + 2 \, a\right ) - 8 i \, d {\rm Li}_2\left (-e^{\left (i \, b x + i \, a\right )}\right ) - 8 i \, d {\rm Li}_2\left (e^{\left (i \, b x + i \, a\right )}\right ) + 4 \, {\left (b d x + b c\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} + 2 \, \cos \left (b x + a\right ) + 1\right ) + 4 \, {\left (b d x + b c\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} - 2 \, \cos \left (b x + a\right ) + 1\right ) - d \sin \left (2 \, b x + 2 \, a\right )}{8 \, b^{2}} \] Input:
integrate((d*x+c)*cos(b*x+a)^2*cot(b*x+a),x, algorithm="maxima")
Output:
1/8*(-4*I*b^2*d*x^2 - 8*I*b^2*c*x - 8*I*b*d*x*arctan2(sin(b*x + a), -cos(b *x + a) + 1) + 8*I*b*c*arctan2(sin(b*x + a), cos(b*x + a) - 1) - 8*(-I*b*d *x - I*b*c)*arctan2(sin(b*x + a), cos(b*x + a) + 1) + 2*(b*d*x + b*c)*cos( 2*b*x + 2*a) - 8*I*d*dilog(-e^(I*b*x + I*a)) - 8*I*d*dilog(e^(I*b*x + I*a) ) + 4*(b*d*x + b*c)*log(cos(b*x + a)^2 + sin(b*x + a)^2 + 2*cos(b*x + a) + 1) + 4*(b*d*x + b*c)*log(cos(b*x + a)^2 + sin(b*x + a)^2 - 2*cos(b*x + a) + 1) - d*sin(2*b*x + 2*a))/b^2
\[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=\int { {\left (d x + c\right )} \cos \left (b x + a\right )^{2} \cot \left (b x + a\right ) \,d x } \] Input:
integrate((d*x+c)*cos(b*x+a)^2*cot(b*x+a),x, algorithm="giac")
Output:
integrate((d*x + c)*cos(b*x + a)^2*cot(b*x + a), x)
Timed out. \[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=\int {\cos \left (a+b\,x\right )}^2\,\mathrm {cot}\left (a+b\,x\right )\,\left (c+d\,x\right ) \,d x \] Input:
int(cos(a + b*x)^2*cot(a + b*x)*(c + d*x),x)
Output:
int(cos(a + b*x)^2*cot(a + b*x)*(c + d*x), x)
\[ \int (c+d x) \cos ^2(a+b x) \cot (a+b x) \, dx=\frac {2 \left (\int \cos \left (b x +a \right )^{2} \cot \left (b x +a \right ) x d x \right ) b d -2 \,\mathrm {log}\left (\tan \left (\frac {b x}{2}+\frac {a}{2}\right )^{2}+1\right ) c +2 \,\mathrm {log}\left (\tan \left (\frac {b x}{2}+\frac {a}{2}\right )\right ) c -\sin \left (b x +a \right )^{2} c}{2 b} \] Input:
int((d*x+c)*cos(b*x+a)^2*cot(b*x+a),x)
Output:
(2*int(cos(a + b*x)**2*cot(a + b*x)*x,x)*b*d - 2*log(tan((a + b*x)/2)**2 + 1)*c + 2*log(tan((a + b*x)/2))*c - sin(a + b*x)**2*c)/(2*b)