### 3.19 $$\int \frac{(c+d x)^2}{a+i a \tan (e+f x)} \, dx$$

Optimal. Leaf size=137 $\frac{d (c+d x)}{2 f^2 (a+i a \tan (e+f x))}+\frac{i (c+d x)^2}{2 f (a+i a \tan (e+f x))}-\frac{i (c+d x)^2}{4 a f}+\frac{(c+d x)^3}{6 a d}-\frac{i d^2}{4 f^3 (a+i a \tan (e+f x))}-\frac{d^2 x}{4 a f^2}$

[Out]

-(d^2*x)/(4*a*f^2) - ((I/4)*(c + d*x)^2)/(a*f) + (c + d*x)^3/(6*a*d) - ((I/4)*d^2)/(f^3*(a + I*a*Tan[e + f*x])
) + (d*(c + d*x))/(2*f^2*(a + I*a*Tan[e + f*x])) + ((I/2)*(c + d*x)^2)/(f*(a + I*a*Tan[e + f*x]))

________________________________________________________________________________________

Rubi [A]  time = 0.123412, antiderivative size = 137, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 23, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.13, Rules used = {3723, 3479, 8} $\frac{d (c+d x)}{2 f^2 (a+i a \tan (e+f x))}+\frac{i (c+d x)^2}{2 f (a+i a \tan (e+f x))}-\frac{i (c+d x)^2}{4 a f}+\frac{(c+d x)^3}{6 a d}-\frac{i d^2}{4 f^3 (a+i a \tan (e+f x))}-\frac{d^2 x}{4 a f^2}$

Antiderivative was successfully veriﬁed.

[In]

Int[(c + d*x)^2/(a + I*a*Tan[e + f*x]),x]

[Out]

-(d^2*x)/(4*a*f^2) - ((I/4)*(c + d*x)^2)/(a*f) + (c + d*x)^3/(6*a*d) - ((I/4)*d^2)/(f^3*(a + I*a*Tan[e + f*x])
) + (d*(c + d*x))/(2*f^2*(a + I*a*Tan[e + f*x])) + ((I/2)*(c + d*x)^2)/(f*(a + I*a*Tan[e + f*x]))

Rule 3723

Int[((c_.) + (d_.)*(x_))^(m_.)/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c + d*x)^(m + 1)/(2*
a*d*(m + 1)), x] + (Dist[(a*d*m)/(2*b*f), Int[(c + d*x)^(m - 1)/(a + b*Tan[e + f*x]), x], x] - Simp[(a*(c + d*
x)^m)/(2*b*f*(a + b*Tan[e + f*x])), x]) /; FreeQ[{a, b, c, d, e, f}, x] && EqQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3479

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(a*(a + b*Tan[c + d*x])^n)/(2*b*d*n), x] +
Dist[1/(2*a), Int[(a + b*Tan[c + d*x])^(n + 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && LtQ[n
, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \frac{(c+d x)^2}{a+i a \tan (e+f x)} \, dx &=\frac{(c+d x)^3}{6 a d}+\frac{i (c+d x)^2}{2 f (a+i a \tan (e+f x))}-\frac{(i d) \int \frac{c+d x}{a+i a \tan (e+f x)} \, dx}{f}\\ &=-\frac{i (c+d x)^2}{4 a f}+\frac{(c+d x)^3}{6 a d}+\frac{d (c+d x)}{2 f^2 (a+i a \tan (e+f x))}+\frac{i (c+d x)^2}{2 f (a+i a \tan (e+f x))}-\frac{d^2 \int \frac{1}{a+i a \tan (e+f x)} \, dx}{2 f^2}\\ &=-\frac{i (c+d x)^2}{4 a f}+\frac{(c+d x)^3}{6 a d}-\frac{i d^2}{4 f^3 (a+i a \tan (e+f x))}+\frac{d (c+d x)}{2 f^2 (a+i a \tan (e+f x))}+\frac{i (c+d x)^2}{2 f (a+i a \tan (e+f x))}-\frac{d^2 \int 1 \, dx}{4 a f^2}\\ &=-\frac{d^2 x}{4 a f^2}-\frac{i (c+d x)^2}{4 a f}+\frac{(c+d x)^3}{6 a d}-\frac{i d^2}{4 f^3 (a+i a \tan (e+f x))}+\frac{d (c+d x)}{2 f^2 (a+i a \tan (e+f x))}+\frac{i (c+d x)^2}{2 f (a+i a \tan (e+f x))}\\ \end{align*}

Mathematica [A]  time = 0.309967, size = 178, normalized size = 1.3 $\frac{\sec (e+f x) (\cos (f x)+i \sin (f x)) \left (\frac{4}{3} f^3 x \left (3 c^2+3 c d x+d^2 x^2\right ) (\cos (e)+i \sin (e))+(\cos (e)-i \sin (e)) \cos (2 f x) ((1+i) c f+(1+i) d f x+d) ((1+i) c f+d ((1+i) f x-i))-i (\cos (e)-i \sin (e)) \sin (2 f x) ((1+i) c f+(1+i) d f x+d) ((1+i) c f+d ((1+i) f x-i))\right )}{8 f^3 (a+i a \tan (e+f x))}$

Antiderivative was successfully veriﬁed.

[In]

Integrate[(c + d*x)^2/(a + I*a*Tan[e + f*x]),x]

[Out]

(Sec[e + f*x]*(Cos[f*x] + I*Sin[f*x])*((d + (1 + I)*c*f + (1 + I)*d*f*x)*((1 + I)*c*f + d*(-I + (1 + I)*f*x))*
Cos[2*f*x]*(Cos[e] - I*Sin[e]) + (4*f^3*x*(3*c^2 + 3*c*d*x + d^2*x^2)*(Cos[e] + I*Sin[e]))/3 - I*(d + (1 + I)*
c*f + (1 + I)*d*f*x)*((1 + I)*c*f + d*(-I + (1 + I)*f*x))*(Cos[e] - I*Sin[e])*Sin[2*f*x]))/(8*f^3*(a + I*a*Tan
[e + f*x]))

________________________________________________________________________________________

Maple [A]  time = 0.162, size = 97, normalized size = 0.7 \begin{align*}{\frac{{d}^{2}{x}^{3}}{6\,a}}+{\frac{cd{x}^{2}}{2\,a}}+{\frac{{c}^{2}x}{2\,a}}+{\frac{{\frac{i}{8}} \left ( 2\,{d}^{2}{x}^{2}{f}^{2}-2\,i{d}^{2}fx+4\,cd{f}^{2}x-2\,icdf+2\,{c}^{2}{f}^{2}-{d}^{2} \right ){{\rm e}^{-2\,i \left ( fx+e \right ) }}}{a{f}^{3}}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)^2/(a+I*a*tan(f*x+e)),x)

[Out]

1/6/a*d^2*x^3+1/2/a*c*d*x^2+1/2/a*c^2*x+1/8*I*(2*d^2*x^2*f^2-2*I*d^2*f*x+4*c*d*f^2*x-2*I*c*d*f+2*c^2*f^2-d^2)/
a/f^3*exp(-2*I*(f*x+e))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.53424, size = 248, normalized size = 1.81 \begin{align*} \frac{{\left (6 i \, d^{2} f^{2} x^{2} + 6 i \, c^{2} f^{2} + 6 \, c d f - 3 i \, d^{2} +{\left (12 i \, c d f^{2} + 6 \, d^{2} f\right )} x + 4 \,{\left (d^{2} f^{3} x^{3} + 3 \, c d f^{3} x^{2} + 3 \, c^{2} f^{3} x\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{24 \, a f^{3}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/24*(6*I*d^2*f^2*x^2 + 6*I*c^2*f^2 + 6*c*d*f - 3*I*d^2 + (12*I*c*d*f^2 + 6*d^2*f)*x + 4*(d^2*f^3*x^3 + 3*c*d*
f^3*x^2 + 3*c^2*f^3*x)*e^(2*I*f*x + 2*I*e))*e^(-2*I*f*x - 2*I*e)/(a*f^3)

________________________________________________________________________________________

Sympy [A]  time = 0.682644, size = 238, normalized size = 1.74 \begin{align*} \begin{cases} \frac{\left (2 i a^{2} c^{2} f^{5} e^{4 i e} + 4 i a^{2} c d f^{5} x e^{4 i e} + 2 a^{2} c d f^{4} e^{4 i e} + 2 i a^{2} d^{2} f^{5} x^{2} e^{4 i e} + 2 a^{2} d^{2} f^{4} x e^{4 i e} - i a^{2} d^{2} f^{3} e^{4 i e}\right ) e^{- 6 i e} e^{- 2 i f x}}{8 a^{3} f^{6}} & \text{for}\: 8 a^{3} f^{6} e^{6 i e} \neq 0 \\\frac{c^{2} x e^{- 2 i e}}{2 a} + \frac{c d x^{2} e^{- 2 i e}}{2 a} + \frac{d^{2} x^{3} e^{- 2 i e}}{6 a} & \text{otherwise} \end{cases} + \frac{c^{2} x}{2 a} + \frac{c d x^{2}}{2 a} + \frac{d^{2} x^{3}}{6 a} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)**2/(a+I*a*tan(f*x+e)),x)

[Out]

Piecewise(((2*I*a**2*c**2*f**5*exp(4*I*e) + 4*I*a**2*c*d*f**5*x*exp(4*I*e) + 2*a**2*c*d*f**4*exp(4*I*e) + 2*I*
a**2*d**2*f**5*x**2*exp(4*I*e) + 2*a**2*d**2*f**4*x*exp(4*I*e) - I*a**2*d**2*f**3*exp(4*I*e))*exp(-6*I*e)*exp(
-2*I*f*x)/(8*a**3*f**6), Ne(8*a**3*f**6*exp(6*I*e), 0)), (c**2*x*exp(-2*I*e)/(2*a) + c*d*x**2*exp(-2*I*e)/(2*a
) + d**2*x**3*exp(-2*I*e)/(6*a), True)) + c**2*x/(2*a) + c*d*x**2/(2*a) + d**2*x**3/(6*a)

________________________________________________________________________________________

Giac [A]  time = 1.197, size = 166, normalized size = 1.21 \begin{align*} \frac{{\left (4 \, d^{2} f^{3} x^{3} e^{\left (2 i \, f x + 2 i \, e\right )} + 12 \, c d f^{3} x^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 12 \, c^{2} f^{3} x e^{\left (2 i \, f x + 2 i \, e\right )} + 6 i \, d^{2} f^{2} x^{2} + 12 i \, c d f^{2} x + 6 i \, c^{2} f^{2} + 6 \, d^{2} f x + 6 \, c d f - 3 i \, d^{2}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{24 \, a f^{3}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)^2/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

1/24*(4*d^2*f^3*x^3*e^(2*I*f*x + 2*I*e) + 12*c*d*f^3*x^2*e^(2*I*f*x + 2*I*e) + 12*c^2*f^3*x*e^(2*I*f*x + 2*I*e
) + 6*I*d^2*f^2*x^2 + 12*I*c*d*f^2*x + 6*I*c^2*f^2 + 6*d^2*f*x + 6*c*d*f - 3*I*d^2)*e^(-2*I*f*x - 2*I*e)/(a*f^
3)