Integrand size = 32, antiderivative size = 89 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=a (A-i B) x+\frac {a (A-i B) \cot (c+d x)}{d}-\frac {a (i A+B) \cot ^2(c+d x)}{2 d}-\frac {a A \cot ^3(c+d x)}{3 d}-\frac {a (i A+B) \log (\sin (c+d x))}{d} \] Output:
a*(A-I*B)*x+a*(A-I*B)*cot(d*x+c)/d-1/2*a*(I*A+B)*cot(d*x+c)^2/d-1/3*a*A*co t(d*x+c)^3/d-a*(I*A+B)*ln(sin(d*x+c))/d
Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.
Time = 0.05 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.52 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {i a A \csc ^2(c+d x)}{2 d}-\frac {a B \csc ^2(c+d x)}{2 d}-\frac {a A \cot ^3(c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {3}{2},1,-\frac {1}{2},-\tan ^2(c+d x)\right )}{3 d}-\frac {i a B \cot (c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},-\tan ^2(c+d x)\right )}{d}-\frac {i a A \log (\sin (c+d x))}{d}-\frac {a B \log (\sin (c+d x))}{d} \] Input:
Integrate[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]
Output:
((-1/2*I)*a*A*Csc[c + d*x]^2)/d - (a*B*Csc[c + d*x]^2)/(2*d) - (a*A*Cot[c + d*x]^3*Hypergeometric2F1[-3/2, 1, -1/2, -Tan[c + d*x]^2])/(3*d) - (I*a*B *Cot[c + d*x]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[c + d*x]^2])/d - (I*a*A *Log[Sin[c + d*x]])/d - (a*B*Log[Sin[c + d*x]])/d
Time = 0.62 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.02, number of steps used = 12, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.375, Rules used = {3042, 4074, 3042, 4012, 25, 3042, 4012, 3042, 4014, 3042, 25, 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 ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(a+i a \tan (c+d x)) (A+B \tan (c+d x))}{\tan (c+d x)^4}dx\) |
\(\Big \downarrow \) 4074 |
\(\displaystyle -\frac {a A \cot ^3(c+d x)}{3 d}+\int \cot ^3(c+d x) (a (i A+B)-a (A-i B) \tan (c+d x))dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\frac {a A \cot ^3(c+d x)}{3 d}+\int \frac {a (i A+B)-a (A-i B) \tan (c+d x)}{\tan (c+d x)^3}dx\) |
\(\Big \downarrow \) 4012 |
\(\displaystyle \int -\cot ^2(c+d x) (a (A-i B)+a (i A+B) \tan (c+d x))dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle -\int \cot ^2(c+d x) (a (A-i B)+a (i A+B) \tan (c+d x))dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\int \frac {a (A-i B)+a (i A+B) \tan (c+d x)}{\tan (c+d x)^2}dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 4012 |
\(\displaystyle -\int \cot (c+d x) (a (i A+B)-a (A-i B) \tan (c+d x))dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}+\frac {a (A-i B) \cot (c+d x)}{d}-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -\int \frac {a (i A+B)-a (A-i B) \tan (c+d x)}{\tan (c+d x)}dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}+\frac {a (A-i B) \cot (c+d x)}{d}-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 4014 |
\(\displaystyle -a (B+i A) \int \cot (c+d x)dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}+\frac {a (A-i B) \cot (c+d x)}{d}+a x (A-i B)-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -a (B+i A) \int -\tan \left (c+d x+\frac {\pi }{2}\right )dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}+\frac {a (A-i B) \cot (c+d x)}{d}+a x (A-i B)-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle a (B+i A) \int \tan \left (\frac {1}{2} (2 c+\pi )+d x\right )dx-\frac {a (B+i A) \cot ^2(c+d x)}{2 d}+\frac {a (A-i B) \cot (c+d x)}{d}+a x (A-i B)-\frac {a A \cot ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle -\frac {a (B+i A) \cot ^2(c+d x)}{2 d}+\frac {a (A-i B) \cot (c+d x)}{d}-\frac {a (B+i A) \log (-\sin (c+d x))}{d}+a x (A-i B)-\frac {a A \cot ^3(c+d x)}{3 d}\) |
Input:
Int[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]
Output:
a*(A - I*B)*x + (a*(A - I*B)*Cot[c + d*x])/d - (a*(I*A + B)*Cot[c + d*x]^2 )/(2*d) - (a*A*Cot[c + d*x]^3)/(3*d) - (a*(I*A + B)*Log[-Sin[c + d*x]])/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_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/ (f*(m + 1)*(a^2 + b^2))), x] + Simp[1/(a^2 + b^2) Int[(a + b*Tan[e + f*x] )^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a , b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1 ]
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a *d)/(a^2 + b^2) Int[(b - a*Tan[e + f*x])/(a + b*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] && N eQ[a*c + b*d, 0]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b *c - a*d)*(A*b - a*B)*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1)*(a^2 + b^2 ))), x] + Simp[1/(a^2 + b^2) Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*A*c + b*B*c + A*b*d - a*B*d - (A*b*c - a*B*c - a*A*d - b*B*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && LtQ[m , -1] && NeQ[a^2 + b^2, 0]
Time = 0.35 (sec) , antiderivative size = 88, normalized size of antiderivative = 0.99
method | result | size |
parallelrisch | \(\frac {\left (\frac {\left (i A +B \right ) \ln \left (\sec \left (d x +c \right )^{2}\right )}{2}-\left (i A +B \right ) \ln \left (\tan \left (d x +c \right )\right )-\frac {A \cot \left (d x +c \right )^{3}}{3}-\frac {\cot \left (d x +c \right )^{2} \left (i A +B \right )}{2}+\left (-i B +A \right ) \cot \left (d x +c \right )+\left (-i B +A \right ) x d \right ) a}{d}\) | \(88\) |
derivativedivides | \(\frac {a \left (\frac {\left (i A +B \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-i B +A \right ) \arctan \left (\tan \left (d x +c \right )\right )-\frac {A}{3 \tan \left (d x +c \right )^{3}}-\frac {i B -A}{\tan \left (d x +c \right )}+\left (-i A -B \right ) \ln \left (\tan \left (d x +c \right )\right )-\frac {i A +B}{2 \tan \left (d x +c \right )^{2}}\right )}{d}\) | \(101\) |
default | \(\frac {a \left (\frac {\left (i A +B \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-i B +A \right ) \arctan \left (\tan \left (d x +c \right )\right )-\frac {A}{3 \tan \left (d x +c \right )^{3}}-\frac {i B -A}{\tan \left (d x +c \right )}+\left (-i A -B \right ) \ln \left (\tan \left (d x +c \right )\right )-\frac {i A +B}{2 \tan \left (d x +c \right )^{2}}\right )}{d}\) | \(101\) |
norman | \(\frac {\frac {\left (-i a B +a A \right ) \tan \left (d x +c \right )^{2}}{d}+\left (-i a B +a A \right ) x \tan \left (d x +c \right )^{3}-\frac {a A}{3 d}-\frac {\left (i a A +B a \right ) \tan \left (d x +c \right )}{2 d}}{\tan \left (d x +c \right )^{3}}-\frac {\left (i a A +B a \right ) \ln \left (\tan \left (d x +c \right )\right )}{d}+\frac {\left (i a A +B a \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}\) | \(125\) |
risch | \(\frac {2 i a B c}{d}-\frac {2 a A c}{d}+\frac {2 a \left (9 i A \,{\mathrm e}^{4 i \left (d x +c \right )}+6 B \,{\mathrm e}^{4 i \left (d x +c \right )}-9 i A \,{\mathrm e}^{2 i \left (d x +c \right )}-9 B \,{\mathrm e}^{2 i \left (d x +c \right )}+4 i A +3 B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}-\frac {a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{d}-\frac {i a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) A}{d}\) | \(135\) |
Input:
int(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x,method=_RETURNVERBO SE)
Output:
(1/2*(I*A+B)*ln(sec(d*x+c)^2)-(I*A+B)*ln(tan(d*x+c))-1/3*A*cot(d*x+c)^3-1/ 2*cot(d*x+c)^2*(I*A+B)+(A-I*B)*cot(d*x+c)+(A-I*B)*x*d)*a/d
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 166 vs. \(2 (77) = 154\).
Time = 0.10 (sec) , antiderivative size = 166, normalized size of antiderivative = 1.87 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {6 \, {\left (-3 i \, A - 2 \, B\right )} a e^{\left (4 i \, d x + 4 i \, c\right )} + 18 \, {\left (i \, A + B\right )} a e^{\left (2 i \, d x + 2 i \, c\right )} + 2 \, {\left (-4 i \, A - 3 \, B\right )} a + 3 \, {\left ({\left (i \, A + B\right )} a e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (-i \, A - B\right )} a e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (i \, A + B\right )} a e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-i \, A - B\right )} a\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )}} \] Input:
integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="f ricas")
Output:
-1/3*(6*(-3*I*A - 2*B)*a*e^(4*I*d*x + 4*I*c) + 18*(I*A + B)*a*e^(2*I*d*x + 2*I*c) + 2*(-4*I*A - 3*B)*a + 3*((I*A + B)*a*e^(6*I*d*x + 6*I*c) + 3*(-I* A - B)*a*e^(4*I*d*x + 4*I*c) + 3*(I*A + B)*a*e^(2*I*d*x + 2*I*c) + (-I*A - B)*a)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(6*I*d*x + 6*I*c) - 3*d*e^(4*I*d *x + 4*I*c) + 3*d*e^(2*I*d*x + 2*I*c) - d)
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 168 vs. \(2 (73) = 146\).
Time = 0.36 (sec) , antiderivative size = 168, normalized size of antiderivative = 1.89 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=- \frac {i a \left (A - i B\right ) \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{d} + \frac {8 i A a + 6 B a + \left (- 18 i A a e^{2 i c} - 18 B a e^{2 i c}\right ) e^{2 i d x} + \left (18 i A a e^{4 i c} + 12 B a e^{4 i c}\right ) e^{4 i d x}}{3 d e^{6 i c} e^{6 i d x} - 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} - 3 d} \] Input:
integrate(cot(d*x+c)**4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)
Output:
-I*a*(A - I*B)*log(exp(2*I*d*x) - exp(-2*I*c))/d + (8*I*A*a + 6*B*a + (-18 *I*A*a*exp(2*I*c) - 18*B*a*exp(2*I*c))*exp(2*I*d*x) + (18*I*A*a*exp(4*I*c) + 12*B*a*exp(4*I*c))*exp(4*I*d*x))/(3*d*exp(6*I*c)*exp(6*I*d*x) - 9*d*exp (4*I*c)*exp(4*I*d*x) + 9*d*exp(2*I*c)*exp(2*I*d*x) - 3*d)
Time = 0.11 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.16 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {6 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a - 3 \, {\left (-i \, A - B\right )} a \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (-i \, A - B\right )} a \log \left (\tan \left (d x + c\right )\right ) + \frac {6 \, {\left (A - i \, B\right )} a \tan \left (d x + c\right )^{2} + 3 \, {\left (-i \, A - B\right )} a \tan \left (d x + c\right ) - 2 \, A a}{\tan \left (d x + c\right )^{3}}}{6 \, d} \] Input:
integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="m axima")
Output:
1/6*(6*(d*x + c)*(A - I*B)*a - 3*(-I*A - B)*a*log(tan(d*x + c)^2 + 1) + 6* (-I*A - B)*a*log(tan(d*x + c)) + (6*(A - I*B)*a*tan(d*x + c)^2 + 3*(-I*A - B)*a*tan(d*x + c) - 2*A*a)/tan(d*x + c)^3)/d
Time = 0.41 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.07 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {{\left (i \, A a + B a\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{d} + \frac {{\left (-i \, A a - B a\right )} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{d} + \frac {6 \, {\left (A a - i \, B a\right )} \tan \left (d x + c\right )^{2} - 2 \, A a - 3 \, {\left (i \, A a + B a\right )} \tan \left (d x + c\right )}{6 \, d \tan \left (d x + c\right )^{3}} \] Input:
integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="g iac")
Output:
(I*A*a + B*a)*log(tan(d*x + c) + I)/d + (-I*A*a - B*a)*log(abs(tan(d*x + c )))/d + 1/6*(6*(A*a - I*B*a)*tan(d*x + c)^2 - 2*A*a - 3*(I*A*a + B*a)*tan( d*x + c))/(d*tan(d*x + c)^3)
Time = 3.63 (sec) , antiderivative size = 80, normalized size of antiderivative = 0.90 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {\left (-A\,a+B\,a\,1{}\mathrm {i}\right )\,{\mathrm {tan}\left (c+d\,x\right )}^2+\left (\frac {B\,a}{2}+\frac {A\,a\,1{}\mathrm {i}}{2}\right )\,\mathrm {tan}\left (c+d\,x\right )+\frac {A\,a}{3}}{d\,{\mathrm {tan}\left (c+d\,x\right )}^3}-\frac {a\,\mathrm {atan}\left (2\,\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,2{}\mathrm {i}}{d} \] Input:
int(cot(c + d*x)^4*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i),x)
Output:
- ((A*a)/3 + tan(c + d*x)*((A*a*1i)/2 + (B*a)/2) - tan(c + d*x)^2*(A*a - B *a*1i))/(d*tan(c + d*x)^3) - (a*atan(2*tan(c + d*x) + 1i)*(A*1i + B)*2i)/d
Time = 0.17 (sec) , antiderivative size = 222, normalized size of antiderivative = 2.49 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {a \left (16 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} a -12 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} b i -4 \cos \left (d x +c \right ) a +12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (d x +c \right )^{3} a i +12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+1\right ) \sin \left (d x +c \right )^{3} b -12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{3} a i -12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \sin \left (d x +c \right )^{3} b +12 \sin \left (d x +c \right )^{3} a d x +3 \sin \left (d x +c \right )^{3} a i -12 \sin \left (d x +c \right )^{3} b d i x +3 \sin \left (d x +c \right )^{3} b -6 \sin \left (d x +c \right ) a i -6 \sin \left (d x +c \right ) b \right )}{12 \sin \left (d x +c \right )^{3} d} \] Input:
int(cot(d*x+c)^4*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)
Output:
(a*(16*cos(c + d*x)*sin(c + d*x)**2*a - 12*cos(c + d*x)*sin(c + d*x)**2*b* i - 4*cos(c + d*x)*a + 12*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**3*a*i + 12*log(tan((c + d*x)/2)**2 + 1)*sin(c + d*x)**3*b - 12*log(tan((c + d*x )/2))*sin(c + d*x)**3*a*i - 12*log(tan((c + d*x)/2))*sin(c + d*x)**3*b + 1 2*sin(c + d*x)**3*a*d*x + 3*sin(c + d*x)**3*a*i - 12*sin(c + d*x)**3*b*d*i *x + 3*sin(c + d*x)**3*b - 6*sin(c + d*x)*a*i - 6*sin(c + d*x)*b))/(12*sin (c + d*x)**3*d)