Integrand size = 32, antiderivative size = 91 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-a (A-i B) x+\frac {a (i A+B) \log (\cos (c+d x))}{d}+\frac {a (A-i B) \tan (c+d x)}{d}+\frac {a (i A+B) \tan ^2(c+d x)}{2 d}+\frac {i a B \tan ^3(c+d x)}{3 d} \] Output:
-a*(A-I*B)*x+a*(I*A+B)*ln(cos(d*x+c))/d+a*(A-I*B)*tan(d*x+c)/d+1/2*a*(I*A+ B)*tan(d*x+c)^2/d+1/3*I*a*B*tan(d*x+c)^3/d
Time = 0.50 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.07 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {a \left (-6 (A-i B) \arctan (\tan (c+d x))+6 i A \log (\cos (c+d x))+6 B \log (\cos (c+d x))+3 (i A+B) \sec ^2(c+d x)+6 A \tan (c+d x)-6 i B \tan (c+d x)+2 i B \tan ^3(c+d x)\right )}{6 d} \] Input:
Integrate[Tan[c + d*x]^2*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]
Output:
(a*(-6*(A - I*B)*ArcTan[Tan[c + d*x]] + (6*I)*A*Log[Cos[c + d*x]] + 6*B*Lo g[Cos[c + d*x]] + 3*(I*A + B)*Sec[c + d*x]^2 + 6*A*Tan[c + d*x] - (6*I)*B* Tan[c + d*x] + (2*I)*B*Tan[c + d*x]^3))/(6*d)
Time = 0.51 (sec) , antiderivative size = 91, 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, 4075, 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 \tan ^2(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \tan (c+d x)^2 (a+i a \tan (c+d x)) (A+B \tan (c+d x))dx\) |
\(\Big \downarrow \) 4075 |
\(\displaystyle \int \tan ^2(c+d x) (a (A-i B)+a (i A+B) \tan (c+d x))dx+\frac {i a B \tan ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \tan (c+d x)^2 (a (A-i B)+a (i A+B) \tan (c+d x))dx+\frac {i a B \tan ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 4011 |
\(\displaystyle \int \tan (c+d x) (a (A-i B) \tan (c+d x)-a (i A+B))dx+\frac {a (B+i A) \tan ^2(c+d x)}{2 d}+\frac {i a B \tan ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \tan (c+d x) (a (A-i B) \tan (c+d x)-a (i A+B))dx+\frac {a (B+i A) \tan ^2(c+d x)}{2 d}+\frac {i a B \tan ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 4008 |
\(\displaystyle -a (B+i A) \int \tan (c+d x)dx+\frac {a (B+i A) \tan ^2(c+d x)}{2 d}+\frac {a (A-i B) \tan (c+d x)}{d}-a x (A-i B)+\frac {i a B \tan ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle -a (B+i A) \int \tan (c+d x)dx+\frac {a (B+i A) \tan ^2(c+d x)}{2 d}+\frac {a (A-i B) \tan (c+d x)}{d}-a x (A-i B)+\frac {i a B \tan ^3(c+d x)}{3 d}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle \frac {a (B+i A) \tan ^2(c+d x)}{2 d}+\frac {a (A-i B) \tan (c+d x)}{d}+\frac {a (B+i A) \log (\cos (c+d x))}{d}-a x (A-i B)+\frac {i a B \tan ^3(c+d x)}{3 d}\) |
Input:
Int[Tan[c + d*x]^2*(a + I*a*Tan[c + d*x])*(A + B*Tan[c + d*x]),x]
Output:
-(a*(A - I*B)*x) + (a*(I*A + B)*Log[Cos[c + d*x]])/d + (a*(A - I*B)*Tan[c + d*x])/d + (a*(I*A + B)*Tan[c + d*x]^2)/(2*d) + ((I/3)*a*B*Tan[c + d*x]^3 )/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_.) + (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.19 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.04
method | result | size |
parts | \(\frac {\left (i a A +B a \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 A \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {i a B \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}\) | \(95\) |
norman | \(\left (i a B -a A \right ) x +\frac {\left (-i a B +a A \right ) \tan \left (d x +c \right )}{d}+\frac {\left (i a A +B a \right ) \tan \left (d x +c \right )^{2}}{2 d}+\frac {i a B \tan \left (d x +c \right )^{3}}{3 d}-\frac {\left (i a A +B a \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}\) | \(96\) |
derivativedivides | \(\frac {a \left (\frac {i B \tan \left (d x +c \right )^{3}}{3}+\frac {i A \tan \left (d x +c \right )^{2}}{2}-i B \tan \left (d x +c \right )+\frac {B \tan \left (d x +c \right )^{2}}{2}+A \tan \left (d x +c \right )+\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 )\right )}{d}\) | \(97\) |
default | \(\frac {a \left (\frac {i B \tan \left (d x +c \right )^{3}}{3}+\frac {i A \tan \left (d x +c \right )^{2}}{2}-i B \tan \left (d x +c \right )+\frac {B \tan \left (d x +c \right )^{2}}{2}+A \tan \left (d x +c \right )+\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 )\right )}{d}\) | \(97\) |
parallelrisch | \(-\frac {-2 i a B \tan \left (d x +c \right )^{3}-3 i A \tan \left (d x +c \right )^{2} a -6 i B x a d +3 i A \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a +6 A x a d +6 i B \tan \left (d x +c \right ) a -3 B \tan \left (d x +c \right )^{2} a -6 A \tan \left (d x +c \right ) a +3 B \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a}{6 d}\) | \(110\) |
risch | \(-\frac {2 i a B c}{d}+\frac {2 a A c}{d}+\frac {2 a \left (6 i A \,{\mathrm e}^{4 i \left (d x +c \right )}+9 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 )}+3 i A +4 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}\) | \(134\) |
Input:
int(tan(d*x+c)^2*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x,method=_RETURNVERBO SE)
Output:
(I*a*A+B*a)/d*(1/2*tan(d*x+c)^2-1/2*ln(1+tan(d*x+c)^2))+a*A/d*(tan(d*x+c)- arctan(tan(d*x+c)))+I*a*B/d*(1/3*tan(d*x+c)^3-tan(d*x+c)+arctan(tan(d*x+c) ))
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 170 vs. \(2 (77) = 154\).
Time = 0.08 (sec) , antiderivative size = 170, normalized size of antiderivative = 1.87 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {6 \, {\left (-2 i \, A - 3 \, 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 (-3 i \, A - 4 \, 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(tan(d*x+c)^2*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="f ricas")
Output:
-1/3*(6*(-2*I*A - 3*B)*a*e^(4*I*d*x + 4*I*c) + 18*(-I*A - B)*a*e^(2*I*d*x + 2*I*c) + 2*(-3*I*A - 4*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. 167 vs. \(2 (75) = 150\).
Time = 0.37 (sec) , antiderivative size = 167, normalized size of antiderivative = 1.84 \[ \int \tan ^2(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 {6 i A a + 8 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 (12 i A a e^{4 i c} + 18 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(tan(d*x+c)**2*(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 + (6*I*A*a + 8*B*a + (18*I *A*a*exp(2*I*c) + 18*B*a*exp(2*I*c))*exp(2*I*d*x) + (12*I*A*a*exp(4*I*c) + 18*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 = 82, normalized size of antiderivative = 0.90 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=-\frac {-2 i \, B a \tan \left (d x + c\right )^{3} + 3 \, {\left (-i \, A - B\right )} a \tan \left (d x + c\right )^{2} + 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 (A - i \, B\right )} a \tan \left (d x + c\right )}{6 \, d} \] Input:
integrate(tan(d*x+c)^2*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x, algorithm="m axima")
Output:
-1/6*(-2*I*B*a*tan(d*x + c)^3 + 3*(-I*A - B)*a*tan(d*x + c)^2 + 6*(d*x + c )*(A - I*B)*a + 3*(I*A + B)*a*log(tan(d*x + c)^2 + 1) - 6*(A - I*B)*a*tan( d*x + c))/d
Time = 0.43 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.10 \[ \int \tan ^2(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 {-2 i \, B a d^{2} \tan \left (d x + c\right )^{3} - 3 i \, A a d^{2} \tan \left (d x + c\right )^{2} - 3 \, B a d^{2} \tan \left (d x + c\right )^{2} - 6 \, A a d^{2} \tan \left (d x + c\right ) + 6 i \, B a d^{2} \tan \left (d x + c\right )}{6 \, d^{3}} \] Input:
integrate(tan(d*x+c)^2*(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 - 1/6*(-2*I*B*a*d^2*tan(d*x + c)^3 - 3*I*A*a*d^2*tan(d*x + c)^2 - 3*B*a*d^2*tan(d*x + c)^2 - 6*A*a*d^2*tan(d* x + c) + 6*I*B*a*d^2*tan(d*x + c))/d^3
Time = 3.54 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.90 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,a}{2}+\frac {A\,a\,1{}\mathrm {i}}{2}\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B\,a+A\,a\,1{}\mathrm {i}\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,a-B\,a\,1{}\mathrm {i}\right )}{d}+\frac {B\,a\,{\mathrm {tan}\left (c+d\,x\right )}^3\,1{}\mathrm {i}}{3\,d} \] Input:
int(tan(c + d*x)^2*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i),x)
Output:
(tan(c + d*x)^2*((A*a*1i)/2 + (B*a)/2))/d - (log(tan(c + d*x) + 1i)*(A*a*1 i + B*a))/d + (tan(c + d*x)*(A*a - B*a*1i))/d + (B*a*tan(c + d*x)^3*1i)/(3 *d)
Time = 0.16 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.11 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x)) (A+B \tan (c+d x)) \, dx=\frac {a \left (-3 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a i -3 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) b +2 \tan \left (d x +c \right )^{3} b i +3 \tan \left (d x +c \right )^{2} a i +3 \tan \left (d x +c \right )^{2} b +6 \tan \left (d x +c \right ) a -6 \tan \left (d x +c \right ) b i -6 a d x +6 b d i x \right )}{6 d} \] Input:
int(tan(d*x+c)^2*(a+I*a*tan(d*x+c))*(A+B*tan(d*x+c)),x)
Output:
(a*( - 3*log(tan(c + d*x)**2 + 1)*a*i - 3*log(tan(c + d*x)**2 + 1)*b + 2*t an(c + d*x)**3*b*i + 3*tan(c + d*x)**2*a*i + 3*tan(c + d*x)**2*b + 6*tan(c + d*x)*a - 6*tan(c + d*x)*b*i - 6*a*d*x + 6*b*d*i*x))/(6*d)