Integrand size = 28, antiderivative size = 91 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=\frac {(c-i d)^2 x}{4 a^2}+\frac {(c+i d) (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2} \] Output:
1/4*(c-I*d)^2*x/a^2+1/4*(c+I*d)*(I*c+3*d)/a^2/f/(1+I*tan(f*x+e))+1/4*I*(c+ I*d)^2/f/(a+I*a*tan(f*x+e))^2
Time = 0.89 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.31 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=-\frac {\sec ^2(e+f x) \left (2 i \left (c^2+d^2\right )+2 i c^2 \cos (2 (e+f x))+2 (c-i d)^2 \arctan (\tan (e+f x)) (\cos (2 (e+f x))+i \sin (2 (e+f x)))-\left (c^2-2 i c d+d^2\right ) \sin (2 (e+f x))\right )}{8 a^2 f (-i+\tan (e+f x))^2} \] Input:
Integrate[(c + d*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x])^2,x]
Output:
-1/8*(Sec[e + f*x]^2*((2*I)*(c^2 + d^2) + (2*I)*c^2*Cos[2*(e + f*x)] + 2*( c - I*d)^2*ArcTan[Tan[e + f*x]]*(Cos[2*(e + f*x)] + I*Sin[2*(e + f*x)]) - (c^2 - (2*I)*c*d + d^2)*Sin[2*(e + f*x)]))/(a^2*f*(-I + Tan[e + f*x])^2)
Time = 0.41 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.02, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3042, 4023, 3042, 4009, 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 \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2}dx\) |
\(\Big \downarrow \) 4023 |
\(\displaystyle \frac {\int \frac {a \left (c^2-2 i d c+d^2\right )-2 i a d^2 \tan (e+f x)}{i \tan (e+f x) a+a}dx}{2 a^2}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a \left (c^2-2 i d c+d^2\right )-2 i a d^2 \tan (e+f x)}{i \tan (e+f x) a+a}dx}{2 a^2}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}\) |
\(\Big \downarrow \) 4009 |
\(\displaystyle \frac {\frac {1}{2} (c-i d)^2 \int 1dx+\frac {(c+i d) (3 d+i c)}{2 f (1+i \tan (e+f x))}}{2 a^2}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {\frac {(c+i d) (3 d+i c)}{2 f (1+i \tan (e+f x))}+\frac {1}{2} x (c-i d)^2}{2 a^2}+\frac {i (c+i d)^2}{4 f (a+i a \tan (e+f x))^2}\) |
Input:
Int[(c + d*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x])^2,x]
Output:
(((c - I*d)^2*x)/2 + ((c + I*d)*(I*c + 3*d))/(2*f*(1 + I*Tan[e + f*x])))/( 2*a^2) + ((I/4)*(c + I*d)^2)/(f*(a + I*a*Tan[e + f*x])^2)
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/(2*a *f*m)), x] + Simp[(b*c + a*d)/(2*a*b) Int[(a + b*Tan[e + f*x])^(m + 1), x ], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2 , 0] && LtQ[m, 0]
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[(-b)*(a*c + b*d)^2*((a + b*Tan[e + f*x])^ m/(2*a^3*f*m)), x] + Simp[1/(2*a^2) Int[(a + b*Tan[e + f*x])^(m + 1)*Simp [a*c^2 - 2*b*c*d + a*d^2 - 2*b*d^2*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && LeQ[m, -1] && EqQ[a^2 + b^2, 0]
Time = 0.20 (sec) , antiderivative size = 132, normalized size of antiderivative = 1.45
method | result | size |
risch | \(-\frac {i x c d}{2 a^{2}}+\frac {x \,c^{2}}{4 a^{2}}-\frac {x \,d^{2}}{4 a^{2}}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c^{2}}{4 a^{2} f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} d^{2}}{4 a^{2} f}-\frac {{\mathrm e}^{-4 i \left (f x +e \right )} c d}{8 a^{2} f}+\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} c^{2}}{16 a^{2} f}-\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} d^{2}}{16 a^{2} f}\) | \(132\) |
derivativedivides | \(\frac {c d}{2 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}-\frac {i c d}{2 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}-\frac {i c d \arctan \left (\tan \left (f x +e \right )\right )}{2 f \,a^{2}}+\frac {i d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}+\frac {c^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {3 d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}-\frac {i c^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}+\frac {c^{2} \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}-\frac {d^{2} \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}\) | \(189\) |
default | \(\frac {c d}{2 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}-\frac {i c d}{2 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}-\frac {i c d \arctan \left (\tan \left (f x +e \right )\right )}{2 f \,a^{2}}+\frac {i d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}+\frac {c^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}+\frac {3 d^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )}-\frac {i c^{2}}{4 f \,a^{2} \left (-i+\tan \left (f x +e \right )\right )^{2}}+\frac {c^{2} \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}-\frac {d^{2} \arctan \left (\tan \left (f x +e \right )\right )}{4 f \,a^{2}}\) | \(189\) |
Input:
int((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x,method=_RETURNVERBOSE)
Output:
-1/2*I*x/a^2*c*d+1/4*x/a^2*c^2-1/4*x/a^2*d^2+1/4*I/a^2/f*exp(-2*I*(f*x+e)) *c^2+1/4*I/a^2/f*exp(-2*I*(f*x+e))*d^2-1/8/a^2/f*exp(-4*I*(f*x+e))*c*d+1/1 6*I/a^2/f*exp(-4*I*(f*x+e))*c^2-1/16*I/a^2/f*exp(-4*I*(f*x+e))*d^2
Time = 0.10 (sec) , antiderivative size = 80, normalized size of antiderivative = 0.88 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=\frac {{\left (4 \, {\left (c^{2} - 2 i \, c d - d^{2}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{2} - 2 \, c d - i \, d^{2} - 4 \, {\left (-i \, c^{2} - i \, d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \] Input:
integrate((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")
Output:
1/16*(4*(c^2 - 2*I*c*d - d^2)*f*x*e^(4*I*f*x + 4*I*e) + I*c^2 - 2*c*d - I* d^2 - 4*(-I*c^2 - I*d^2)*e^(2*I*f*x + 2*I*e))*e^(-4*I*f*x - 4*I*e)/(a^2*f)
Time = 0.26 (sec) , antiderivative size = 258, normalized size of antiderivative = 2.84 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=\begin {cases} \frac {\left (\left (16 i a^{2} c^{2} f e^{4 i e} + 16 i a^{2} d^{2} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{2} f e^{2 i e} - 8 a^{2} c d f e^{2 i e} - 4 i a^{2} d^{2} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{2} - 2 i c d - d^{2}}{4 a^{2}} + \frac {\left (c^{2} e^{4 i e} + 2 c^{2} e^{2 i e} + c^{2} - 2 i c d e^{4 i e} + 2 i c d - d^{2} e^{4 i e} + 2 d^{2} e^{2 i e} - d^{2}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {x \left (c^{2} - 2 i c d - d^{2}\right )}{4 a^{2}} \] Input:
integrate((c+d*tan(f*x+e))**2/(a+I*a*tan(f*x+e))**2,x)
Output:
Piecewise((((16*I*a**2*c**2*f*exp(4*I*e) + 16*I*a**2*d**2*f*exp(4*I*e))*ex p(-2*I*f*x) + (4*I*a**2*c**2*f*exp(2*I*e) - 8*a**2*c*d*f*exp(2*I*e) - 4*I* a**2*d**2*f*exp(2*I*e))*exp(-4*I*f*x))*exp(-6*I*e)/(64*a**4*f**2), Ne(a**4 *f**2*exp(6*I*e), 0)), (x*(-(c**2 - 2*I*c*d - d**2)/(4*a**2) + (c**2*exp(4 *I*e) + 2*c**2*exp(2*I*e) + c**2 - 2*I*c*d*exp(4*I*e) + 2*I*c*d - d**2*exp (4*I*e) + 2*d**2*exp(2*I*e) - d**2)*exp(-4*I*e)/(4*a**2)), True)) + x*(c** 2 - 2*I*c*d - d**2)/(4*a**2)
Exception generated. \[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=\text {Exception raised: RuntimeError} \] Input:
integrate((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")
Output:
Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negati ve exponent.
Time = 0.54 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.29 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=-\frac {{\left (-i \, c^{2} - 2 \, c d + i \, d^{2}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{8 \, a^{2} f} - \frac {{\left (i \, c^{2} + 2 \, c d - i \, d^{2}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{8 \, a^{2} f} - \frac {2 i \, c^{2} + 2 i \, d^{2} + i \, {\left (i \, c^{2} + 2 \, c d + 3 i \, d^{2}\right )} \tan \left (f x + e\right )}{4 \, a^{2} f {\left (\tan \left (f x + e\right ) - i\right )}^{2}} \] Input:
integrate((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x, algorithm="giac")
Output:
-1/8*(-I*c^2 - 2*c*d + I*d^2)*log(tan(f*x + e) + I)/(a^2*f) - 1/8*(I*c^2 + 2*c*d - I*d^2)*log(tan(f*x + e) - I)/(a^2*f) - 1/4*(2*I*c^2 + 2*I*d^2 + I *(I*c^2 + 2*c*d + 3*I*d^2)*tan(f*x + e))/(a^2*f*(tan(f*x + e) - I)^2)
Time = 2.17 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.02 \[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=-\frac {x\,{\left (d+c\,1{}\mathrm {i}\right )}^2}{4\,a^2}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {c\,d}{2\,a^2}+\frac {c^2\,1{}\mathrm {i}}{4\,a^2}+\frac {d^2\,3{}\mathrm {i}}{4\,a^2}\right )+\frac {c^2}{2\,a^2}+\frac {d^2}{2\,a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )} \] Input:
int((c + d*tan(e + f*x))^2/(a + a*tan(e + f*x)*1i)^2,x)
Output:
(tan(e + f*x)*((c^2*1i)/(4*a^2) + (d^2*3i)/(4*a^2) + (c*d)/(2*a^2)) + c^2/ (2*a^2) + d^2/(2*a^2))/(f*(2*tan(e + f*x) + tan(e + f*x)^2*1i - 1i)) - (x* (c*1i + d)^2)/(4*a^2)
\[ \int \frac {(c+d \tan (e+f x))^2}{(a+i a \tan (e+f x))^2} \, dx=\frac {-\left (\int \frac {\tan \left (f x +e \right )^{2}}{\tan \left (f x +e \right )^{2}-2 \tan \left (f x +e \right ) i -1}d x \right ) d^{2}-2 \left (\int \frac {\tan \left (f x +e \right )}{\tan \left (f x +e \right )^{2}-2 \tan \left (f x +e \right ) i -1}d x \right ) c d -\left (\int \frac {1}{\tan \left (f x +e \right )^{2}-2 \tan \left (f x +e \right ) i -1}d x \right ) c^{2}}{a^{2}} \] Input:
int((c+d*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^2,x)
Output:
( - int(tan(e + f*x)**2/(tan(e + f*x)**2 - 2*tan(e + f*x)*i - 1),x)*d**2 - 2*int(tan(e + f*x)/(tan(e + f*x)**2 - 2*tan(e + f*x)*i - 1),x)*c*d - int( 1/(tan(e + f*x)**2 - 2*tan(e + f*x)*i - 1),x)*c**2)/a**2