Integrand size = 32, antiderivative size = 107 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-2 a^2 (i A+B) x-\frac {2 a^2 (A-i B) \log (\cos (c+d x))}{d}+\frac {a^2 (i A+B) \tan (c+d x)}{d}+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d} \] Output:
-2*a^2*(I*A+B)*x-2*a^2*(A-I*B)*ln(cos(d*x+c))/d+a^2*(I*A+B)*tan(d*x+c)/d+1 /2*A*(a+I*a*tan(d*x+c))^2/d-1/3*I*B*(a+I*a*tan(d*x+c))^3/a/d
Time = 0.53 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.77 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {a^2 \left (3 A-2 i B+12 (A-i B) \log (i+\tan (c+d x))+12 (i A+B) \tan (c+d x)-3 (A-2 i B) \tan ^2(c+d x)-2 B \tan ^3(c+d x)\right )}{6 d} \] Input:
Integrate[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
Output:
(a^2*(3*A - (2*I)*B + 12*(A - I*B)*Log[I + Tan[c + d*x]] + 12*(I*A + B)*Ta n[c + d*x] - 3*(A - (2*I)*B)*Tan[c + d*x]^2 - 2*B*Tan[c + d*x]^3))/(6*d)
Time = 0.49 (sec) , antiderivative size = 99, normalized size of antiderivative = 0.93, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3042, 4075, 3042, 4010, 3042, 3958, 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 \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x))dx\) |
\(\Big \downarrow \) 4075 |
\(\displaystyle \int (i \tan (c+d x) a+a)^2 (A \tan (c+d x)-B)dx-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (i \tan (c+d x) a+a)^2 (A \tan (c+d x)-B)dx-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\) |
\(\Big \downarrow \) 4010 |
\(\displaystyle -(B+i A) \int (i \tan (c+d x) a+a)^2dx+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -(B+i A) \int (i \tan (c+d x) a+a)^2dx+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\) |
\(\Big \downarrow \) 3958 |
\(\displaystyle -(B+i A) \left (2 i a^2 \int \tan (c+d x)dx-\frac {a^2 \tan (c+d x)}{d}+2 a^2 x\right )+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -(B+i A) \left (2 i a^2 \int \tan (c+d x)dx-\frac {a^2 \tan (c+d x)}{d}+2 a^2 x\right )+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle -(B+i A) \left (-\frac {a^2 \tan (c+d x)}{d}-\frac {2 i a^2 \log (\cos (c+d x))}{d}+2 a^2 x\right )+\frac {A (a+i a \tan (c+d x))^2}{2 d}-\frac {i B (a+i a \tan (c+d x))^3}{3 a d}\) |
Input:
Int[Tan[c + d*x]*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]
Output:
(A*(a + I*a*Tan[c + d*x])^2)/(2*d) - ((I/3)*B*(a + I*a*Tan[c + d*x])^3)/(a *d) - (I*A + B)*(2*a^2*x - ((2*I)*a^2*Log[Cos[c + d*x]])/d - (a^2*Tan[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[(c_.) + (d_.)*(x_)])^2, x_Symbol] :> Simp[(a^2 - b^2) *x, x] + (Simp[b^2*(Tan[c + d*x]/d), x] + Simp[2*a*b Int[Tan[c + d*x], x] , x]) /; FreeQ[{a, b, c, d}, x]
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] + Simp [(b*c + a*d)/b Int[(a + b*Tan[e + f*x])^m, x], x] /; FreeQ[{a, b, c, d, e , f, m}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && !LtQ[m, 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 *d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f* x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0] && !LeQ[m, -1]
Time = 0.11 (sec) , antiderivative size = 99, normalized size of antiderivative = 0.93
method | result | size |
derivativedivides | \(\frac {a^{2} \left (i B \tan \left (d x +c \right )^{2}-\frac {B \tan \left (d x +c \right )^{3}}{3}+2 i A \tan \left (d x +c \right )-\frac {A \tan \left (d x +c \right )^{2}}{2}+2 B \tan \left (d x +c \right )+\frac {\left (-2 i B +2 A \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-2 i A -2 B \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) | \(99\) |
default | \(\frac {a^{2} \left (i B \tan \left (d x +c \right )^{2}-\frac {B \tan \left (d x +c \right )^{3}}{3}+2 i A \tan \left (d x +c \right )-\frac {A \tan \left (d x +c \right )^{2}}{2}+2 B \tan \left (d x +c \right )+\frac {\left (-2 i B +2 A \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-2 i A -2 B \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) | \(99\) |
norman | \(\left (-2 i A \,a^{2}-2 B \,a^{2}\right ) x -\frac {\left (-2 i B \,a^{2}+A \,a^{2}\right ) \tan \left (d x +c \right )^{2}}{2 d}+\frac {2 \left (i A \,a^{2}+B \,a^{2}\right ) \tan \left (d x +c \right )}{d}-\frac {B \,a^{2} \tan \left (d x +c \right )^{3}}{3 d}+\frac {\left (-i B \,a^{2}+A \,a^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{d}\) | \(113\) |
parallelrisch | \(-\frac {12 i A x \,a^{2} d -6 i B \tan \left (d x +c \right )^{2} a^{2}+2 B \tan \left (d x +c \right )^{3} a^{2}-12 i A \tan \left (d x +c \right ) a^{2}+3 A \tan \left (d x +c \right )^{2} a^{2}+6 i B \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a^{2}+12 B x \,a^{2} d -6 A \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a^{2}-12 B \tan \left (d x +c \right ) a^{2}}{6 d}\) | \(127\) |
parts | \(\frac {\left (2 i A \,a^{2}+B \,a^{2}\right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {\left (2 i B \,a^{2}-A \,a^{2}\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 {A \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a^{2}}{2 d}-\frac {B \,a^{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}\) | \(132\) |
risch | \(\frac {4 a^{2} B c}{d}+\frac {4 i a^{2} A c}{d}+\frac {2 i a^{2} \left (9 i A \,{\mathrm e}^{4 i \left (d x +c \right )}+15 B \,{\mathrm e}^{4 i \left (d x +c \right )}+15 i A \,{\mathrm e}^{2 i \left (d x +c \right )}+18 B \,{\mathrm e}^{2 i \left (d x +c \right )}+6 i A +7 B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}-\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{d}\) | \(146\) |
Input:
int(tan(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x,method=_RETURNVERBO SE)
Output:
1/d*a^2*(I*B*tan(d*x+c)^2-1/3*B*tan(d*x+c)^3+2*I*A*tan(d*x+c)-1/2*A*tan(d* x+c)^2+2*B*tan(d*x+c)+1/2*(-2*I*B+2*A)*ln(1+tan(d*x+c)^2)+(-2*B-2*I*A)*arc tan(tan(d*x+c)))
Time = 0.09 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.64 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (3 \, {\left (3 \, A - 5 i \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (5 \, A - 6 i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (6 \, A - 7 i \, B\right )} a^{2} + 3 \, {\left ({\left (A - i \, B\right )} a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (A - i \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (A - i \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (A - i \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\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(tan(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="f ricas")
Output:
-2/3*(3*(3*A - 5*I*B)*a^2*e^(4*I*d*x + 4*I*c) + 3*(5*A - 6*I*B)*a^2*e^(2*I *d*x + 2*I*c) + (6*A - 7*I*B)*a^2 + 3*((A - I*B)*a^2*e^(6*I*d*x + 6*I*c) + 3*(A - I*B)*a^2*e^(4*I*d*x + 4*I*c) + 3*(A - I*B)*a^2*e^(2*I*d*x + 2*I*c) + (A - I*B)*a^2)*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. 178 vs. \(2 (88) = 176\).
Time = 0.36 (sec) , antiderivative size = 178, normalized size of antiderivative = 1.66 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=- \frac {2 a^{2} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {- 12 A a^{2} + 14 i B a^{2} + \left (- 30 A a^{2} e^{2 i c} + 36 i B a^{2} e^{2 i c}\right ) e^{2 i d x} + \left (- 18 A a^{2} e^{4 i c} + 30 i B a^{2} 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(tan(d*x+c)*(a+I*a*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)
Output:
-2*a**2*(A - I*B)*log(exp(2*I*d*x) + exp(-2*I*c))/d + (-12*A*a**2 + 14*I*B *a**2 + (-30*A*a**2*exp(2*I*c) + 36*I*B*a**2*exp(2*I*c))*exp(2*I*d*x) + (- 18*A*a**2*exp(4*I*c) + 30*I*B*a**2*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.16 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.86 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, B a^{2} \tan \left (d x + c\right )^{3} + 3 \, {\left (A - 2 i \, B\right )} a^{2} \tan \left (d x + c\right )^{2} + 12 \, {\left (d x + c\right )} {\left (i \, A + B\right )} a^{2} - 6 \, {\left (A - i \, B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 12 \, {\left (-i \, A - B\right )} a^{2} \tan \left (d x + c\right )}{6 \, d} \] Input:
integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="m axima")
Output:
-1/6*(2*B*a^2*tan(d*x + c)^3 + 3*(A - 2*I*B)*a^2*tan(d*x + c)^2 + 12*(d*x + c)*(I*A + B)*a^2 - 6*(A - I*B)*a^2*log(tan(d*x + c)^2 + 1) + 12*(-I*A - B)*a^2*tan(d*x + c))/d
Time = 0.42 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.07 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {2 \, {\left (A a^{2} - i \, B a^{2}\right )} \log \left (\tan \left (d x + c\right ) + i\right )}{d} - \frac {2 \, B a^{2} d^{2} \tan \left (d x + c\right )^{3} + 3 \, A a^{2} d^{2} \tan \left (d x + c\right )^{2} - 6 i \, B a^{2} d^{2} \tan \left (d x + c\right )^{2} - 12 i \, A a^{2} d^{2} \tan \left (d x + c\right ) - 12 \, B a^{2} d^{2} \tan \left (d x + c\right )}{6 \, d^{3}} \] Input:
integrate(tan(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="g iac")
Output:
2*(A*a^2 - I*B*a^2)*log(tan(d*x + c) + I)/d - 1/6*(2*B*a^2*d^2*tan(d*x + c )^3 + 3*A*a^2*d^2*tan(d*x + c)^2 - 6*I*B*a^2*d^2*tan(d*x + c)^2 - 12*I*A*a ^2*d^2*tan(d*x + c) - 12*B*a^2*d^2*tan(d*x + c))/d^3
Time = 3.53 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.04 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {a^2\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2}+\frac {B\,a^2\,1{}\mathrm {i}}{2}\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^2\,\left (B+A\,1{}\mathrm {i}\right )+B\,a^2+A\,a^2\,1{}\mathrm {i}\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (2\,A\,a^2-B\,a^2\,2{}\mathrm {i}\right )}{d}-\frac {B\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d} \] Input:
int(tan(c + d*x)*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^2,x)
Output:
(tan(c + d*x)^2*((a^2*(A*1i + B)*1i)/2 + (B*a^2*1i)/2))/d + (tan(c + d*x)* (A*a^2*1i + a^2*(A*1i + B) + B*a^2))/d + (log(tan(c + d*x) + 1i)*(2*A*a^2 - B*a^2*2i))/d - (B*a^2*tan(c + d*x)^3)/(3*d)
Time = 0.17 (sec) , antiderivative size = 102, normalized size of antiderivative = 0.95 \[ \int \tan (c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {a^{2} \left (6 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a -6 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) b i -2 \tan \left (d x +c \right )^{3} b -3 \tan \left (d x +c \right )^{2} a +6 \tan \left (d x +c \right )^{2} b i +12 \tan \left (d x +c \right ) a i +12 \tan \left (d x +c \right ) b -12 a d i x -12 b d x \right )}{6 d} \] Input:
int(tan(d*x+c)*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x)
Output:
(a**2*(6*log(tan(c + d*x)**2 + 1)*a - 6*log(tan(c + d*x)**2 + 1)*b*i - 2*t an(c + d*x)**3*b - 3*tan(c + d*x)**2*a + 6*tan(c + d*x)**2*b*i + 12*tan(c + d*x)*a*i + 12*tan(c + d*x)*b - 12*a*d*i*x - 12*b*d*x))/(6*d)