Integrand size = 26, antiderivative size = 78 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=a (c-i d)^2 x-\frac {i a (c-i d)^2 \log (\cos (e+f x))}{f}+\frac {a d (i c+d) \tan (e+f x)}{f}+\frac {i a (c+d \tan (e+f x))^2}{2 f} \] Output:
a*(c-I*d)^2*x-I*a*(c-I*d)^2*ln(cos(f*x+e))/f+a*d*(I*c+d)*tan(f*x+e)/f+1/2* I*a*(c+d*tan(f*x+e))^2/f
Time = 0.32 (sec) , antiderivative size = 66, normalized size of antiderivative = 0.85 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {i a \left (c^2+2 (c-i d)^2 \log (i+\tan (e+f x))+2 (2 c-i d) d \tan (e+f x)+d^2 \tan ^2(e+f x)\right )}{2 f} \] Input:
Integrate[(a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x])^2,x]
Output:
((I/2)*a*(c^2 + 2*(c - I*d)^2*Log[I + Tan[e + f*x]] + 2*(2*c - I*d)*d*Tan[ e + f*x] + d^2*Tan[e + f*x]^2))/f
Time = 0.41 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {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 (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2dx\) |
\(\Big \downarrow \) 4011 |
\(\displaystyle \int (c+d \tan (e+f x)) (a (c-i d)+a (i c+d) \tan (e+f x))dx+\frac {i a (c+d \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (c+d \tan (e+f x)) (a (c-i d)+a (i c+d) \tan (e+f x))dx+\frac {i a (c+d \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 4008 |
\(\displaystyle i a (c-i d)^2 \int \tan (e+f x)dx+\frac {i a (c+d \tan (e+f x))^2}{2 f}+\frac {a d (d+i c) \tan (e+f x)}{f}+a x (c-i d)^2\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle i a (c-i d)^2 \int \tan (e+f x)dx+\frac {i a (c+d \tan (e+f x))^2}{2 f}+\frac {a d (d+i c) \tan (e+f x)}{f}+a x (c-i d)^2\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle \frac {i a (c+d \tan (e+f x))^2}{2 f}+\frac {a d (d+i c) \tan (e+f x)}{f}-\frac {i a (c-i d)^2 \log (\cos (e+f x))}{f}+a x (c-i d)^2\) |
Input:
Int[(a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x])^2,x]
Output:
a*(c - I*d)^2*x - (I*a*(c - I*d)^2*Log[Cos[e + f*x]])/f + (a*d*(I*c + d)*T an[e + f*x])/f + ((I/2)*a*(c + d*Tan[e + f*x])^2)/f
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]
Time = 0.16 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.21
method | result | size |
derivativedivides | \(\frac {a \left (\frac {i d^{2} \tan \left (f x +e \right )^{2}}{2}+2 i \tan \left (f x +e \right ) c d +d^{2} \tan \left (f x +e \right )+\frac {\left (i c^{2}-i d^{2}+2 c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (-2 i c d +c^{2}-d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(94\) |
default | \(\frac {a \left (\frac {i d^{2} \tan \left (f x +e \right )^{2}}{2}+2 i \tan \left (f x +e \right ) c d +d^{2} \tan \left (f x +e \right )+\frac {\left (i c^{2}-i d^{2}+2 c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (-2 i c d +c^{2}-d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) | \(94\) |
norman | \(\left (-2 i a c d +a \,c^{2}-a \,d^{2}\right ) x +\frac {\left (2 i a c d +a \,d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {i a \,d^{2} \tan \left (f x +e \right )^{2}}{2 f}+\frac {i a \left (-2 i c d +c^{2}-d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) | \(94\) |
parts | \(a \,c^{2} x +\frac {\left (i a \,c^{2}+2 a c d \right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (2 i a c d +a \,d^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {i a \,d^{2} \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}\) | \(103\) |
parallelrisch | \(\frac {-4 i x a c d f +i a \,d^{2} \tan \left (f x +e \right )^{2}+i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,c^{2}-i \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,d^{2}+4 i \tan \left (f x +e \right ) a c d +2 x a \,c^{2} f -2 x a \,d^{2} f +2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a c d +2 \tan \left (f x +e \right ) a \,d^{2}}{2 f}\) | \(122\) |
risch | \(\frac {4 i a c d e}{f}-\frac {2 a \,c^{2} e}{f}+\frac {2 a \,d^{2} e}{f}-\frac {2 a d \left (-2 i d \,{\mathrm e}^{2 i \left (f x +e \right )}+2 c \,{\mathrm e}^{2 i \left (f x +e \right )}-i d +2 c \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}-\frac {2 a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c d}{f}-\frac {i a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2}}{f}+\frac {i a \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) d^{2}}{f}\) | \(149\) |
Input:
int((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)
Output:
1/f*a*(1/2*I*d^2*tan(f*x+e)^2+2*I*tan(f*x+e)*c*d+d^2*tan(f*x+e)+1/2*(I*c^2 -I*d^2+2*c*d)*ln(1+tan(f*x+e)^2)+(-2*I*c*d+c^2-d^2)*arctan(tan(f*x+e)))
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 152 vs. \(2 (66) = 132\).
Time = 0.09 (sec) , antiderivative size = 152, normalized size of antiderivative = 1.95 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=-\frac {4 \, a c d - 2 i \, a d^{2} + 4 \, {\left (a c d - i \, a d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - {\left (-i \, a c^{2} - 2 \, a c d + i \, a d^{2} + {\left (-i \, a c^{2} - 2 \, a c d + i \, a d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} - 2 \, {\left (i \, a c^{2} + 2 \, a c d - i \, a d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{f e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f} \] Input:
integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="fricas")
Output:
-(4*a*c*d - 2*I*a*d^2 + 4*(a*c*d - I*a*d^2)*e^(2*I*f*x + 2*I*e) - (-I*a*c^ 2 - 2*a*c*d + I*a*d^2 + (-I*a*c^2 - 2*a*c*d + I*a*d^2)*e^(4*I*f*x + 4*I*e) - 2*(I*a*c^2 + 2*a*c*d - I*a*d^2)*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x + 2 *I*e) + 1))/(f*e^(4*I*f*x + 4*I*e) + 2*f*e^(2*I*f*x + 2*I*e) + f)
Time = 0.35 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.53 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=- \frac {i a \left (c - i d\right )^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{f} + \frac {- 4 a c d + 2 i a d^{2} + \left (- 4 a c d e^{2 i e} + 4 i a d^{2} e^{2 i e}\right ) e^{2 i f x}}{f e^{4 i e} e^{4 i f x} + 2 f e^{2 i e} e^{2 i f x} + f} \] Input:
integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))**2,x)
Output:
-I*a*(c - I*d)**2*log(exp(2*I*f*x) + exp(-2*I*e))/f + (-4*a*c*d + 2*I*a*d* *2 + (-4*a*c*d*exp(2*I*e) + 4*I*a*d**2*exp(2*I*e))*exp(2*I*f*x))/(f*exp(4* I*e)*exp(4*I*f*x) + 2*f*exp(2*I*e)*exp(2*I*f*x) + f)
Time = 0.12 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.21 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=-\frac {-i \, a d^{2} \tan \left (f x + e\right )^{2} - 2 \, {\left (a c^{2} - 2 i \, a c d - a d^{2}\right )} {\left (f x + e\right )} + {\left (-i \, a c^{2} - 2 \, a c d + i \, a d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 2 \, {\left (-2 i \, a c d - a d^{2}\right )} \tan \left (f x + e\right )}{2 \, f} \] Input:
integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="maxima")
Output:
-1/2*(-I*a*d^2*tan(f*x + e)^2 - 2*(a*c^2 - 2*I*a*c*d - a*d^2)*(f*x + e) + (-I*a*c^2 - 2*a*c*d + I*a*d^2)*log(tan(f*x + e)^2 + 1) + 2*(-2*I*a*c*d - a *d^2)*tan(f*x + e))/f
Time = 0.47 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.00 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {{\left (i \, a c^{2} + 2 \, a c d - i \, a d^{2}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{f} - \frac {-i \, a d^{2} f \tan \left (f x + e\right )^{2} - 4 i \, a c d f \tan \left (f x + e\right ) - 2 \, a d^{2} f \tan \left (f x + e\right )}{2 \, f^{2}} \] Input:
integrate((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="giac")
Output:
(I*a*c^2 + 2*a*c*d - I*a*d^2)*log(tan(f*x + e) + I)/f - 1/2*(-I*a*d^2*f*ta n(f*x + e)^2 - 4*I*a*c*d*f*tan(f*x + e) - 2*a*d^2*f*tan(f*x + e))/f^2
Time = 1.91 (sec) , antiderivative size = 75, normalized size of antiderivative = 0.96 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a\,d^2+2{}\mathrm {i}\,a\,c\,d\right )}{f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (1{}\mathrm {i}\,a\,c^2+2\,a\,c\,d-1{}\mathrm {i}\,a\,d^2\right )}{f}+\frac {a\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}}{2\,f} \] Input:
int((a + a*tan(e + f*x)*1i)*(c + d*tan(e + f*x))^2,x)
Output:
(tan(e + f*x)*(a*d^2 + a*c*d*2i))/f + (log(tan(e + f*x) + 1i)*(a*c^2*1i - a*d^2*1i + 2*a*c*d))/f + (a*d^2*tan(e + f*x)^2*1i)/(2*f)
Time = 0.19 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.42 \[ \int (a+i a \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {a \left (\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) c^{2} i +2 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) c d -\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) d^{2} i +\tan \left (f x +e \right )^{2} d^{2} i +4 \tan \left (f x +e \right ) c d i +2 \tan \left (f x +e \right ) d^{2}+2 c^{2} f x -4 c d f i x -2 d^{2} f x \right )}{2 f} \] Input:
int((a+I*a*tan(f*x+e))*(c+d*tan(f*x+e))^2,x)
Output:
(a*(log(tan(e + f*x)**2 + 1)*c**2*i + 2*log(tan(e + f*x)**2 + 1)*c*d - log (tan(e + f*x)**2 + 1)*d**2*i + tan(e + f*x)**2*d**2*i + 4*tan(e + f*x)*c*d *i + 2*tan(e + f*x)*d**2 + 2*c**2*f*x - 4*c*d*f*i*x - 2*d**2*f*x))/(2*f)