Integrand size = 23, antiderivative size = 89 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=-\left (\left (2 b c d-a \left (c^2-d^2\right )\right ) x\right )-\frac {\left (2 a c d+b \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {d (b c+a d) \tan (e+f x)}{f}+\frac {b (c+d \tan (e+f x))^2}{2 f} \] Output:
-(2*b*c*d-a*(c^2-d^2))*x-(2*a*c*d+b*(c^2-d^2))*ln(cos(f*x+e))/f+d*(a*d+b*c )*tan(f*x+e)/f+1/2*b*(c+d*tan(f*x+e))^2/f
Result contains complex when optimal does not.
Time = 0.32 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.08 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {(-i a+b) (c+i d)^2 \log (i-\tan (e+f x))+(i a+b) (c-i d)^2 \log (i+\tan (e+f x))+2 d (2 b c+a d) \tan (e+f x)+b d^2 \tan ^2(e+f x)}{2 f} \] Input:
Integrate[(a + b*Tan[e + f*x])*(c + d*Tan[e + f*x])^2,x]
Output:
(((-I)*a + b)*(c + I*d)^2*Log[I - Tan[e + f*x]] + (I*a + b)*(c - I*d)^2*Lo g[I + Tan[e + f*x]] + 2*d*(2*b*c + a*d)*Tan[e + f*x] + b*d^2*Tan[e + f*x]^ 2)/(2*f)
Time = 0.42 (sec) , antiderivative size = 89, 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.261, 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+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2dx\) |
\(\Big \downarrow \) 4011 |
\(\displaystyle \int (c+d \tan (e+f x)) (a c-b d+(b c+a d) \tan (e+f x))dx+\frac {b (c+d \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int (c+d \tan (e+f x)) (a c-b d+(b c+a d) \tan (e+f x))dx+\frac {b (c+d \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 4008 |
\(\displaystyle \left (2 a c d+b \left (c^2-d^2\right )\right ) \int \tan (e+f x)dx-x \left (2 b c d-a \left (c^2-d^2\right )\right )+\frac {d (a d+b c) \tan (e+f x)}{f}+\frac {b (c+d \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \left (2 a c d+b \left (c^2-d^2\right )\right ) \int \tan (e+f x)dx-x \left (2 b c d-a \left (c^2-d^2\right )\right )+\frac {d (a d+b c) \tan (e+f x)}{f}+\frac {b (c+d \tan (e+f x))^2}{2 f}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle -\frac {\left (2 a c d+b \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}-x \left (2 b c d-a \left (c^2-d^2\right )\right )+\frac {d (a d+b c) \tan (e+f x)}{f}+\frac {b (c+d \tan (e+f x))^2}{2 f}\) |
Input:
Int[(a + b*Tan[e + f*x])*(c + d*Tan[e + f*x])^2,x]
Output:
-((2*b*c*d - a*(c^2 - d^2))*x) - ((2*a*c*d + b*(c^2 - d^2))*Log[Cos[e + f* x]])/f + (d*(b*c + a*d)*Tan[e + f*x])/f + (b*(c + d*Tan[e + f*x])^2)/(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.12 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.01
method | result | size |
norman | \(\left (a \,c^{2}-a \,d^{2}-2 b c d \right ) x +\frac {d \left (a d +2 b c \right ) \tan \left (f x +e \right )}{f}+\frac {b \,d^{2} \tan \left (f x +e \right )^{2}}{2 f}+\frac {\left (2 a c d +b \,c^{2}-b \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) | \(90\) |
derivativedivides | \(\frac {\frac {b \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\tan \left (f x +e \right ) a \,d^{2}+2 \tan \left (f x +e \right ) b c d +\frac {\left (2 a c d +b \,c^{2}-b \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a \,c^{2}-a \,d^{2}-2 b c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(97\) |
default | \(\frac {\frac {b \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\tan \left (f x +e \right ) a \,d^{2}+2 \tan \left (f x +e \right ) b c d +\frac {\left (2 a c d +b \,c^{2}-b \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a \,c^{2}-a \,d^{2}-2 b c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(97\) |
parts | \(a \,c^{2} x +\frac {\left (a \,d^{2}+2 b c d \right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (2 a c d +b \,c^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {b \,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}\) | \(98\) |
parallelrisch | \(\frac {2 a \,c^{2} f x -2 a \,d^{2} f x -4 b c d f x +b \,d^{2} \tan \left (f x +e \right )^{2}+2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a c d +\ln \left (1+\tan \left (f x +e \right )^{2}\right ) b \,c^{2}-\ln \left (1+\tan \left (f x +e \right )^{2}\right ) b \,d^{2}+2 \tan \left (f x +e \right ) a \,d^{2}+4 \tan \left (f x +e \right ) b c d}{2 f}\) | \(115\) |
risch | \(i b \,c^{2} x +\frac {4 i a c d e}{f}+\frac {2 i b \,c^{2} e}{f}+a \,c^{2} x -a \,d^{2} x -2 b c d x -i b \,d^{2} x +2 i a c d x +\frac {2 i d \left (a d \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b c \,{\mathrm e}^{2 i \left (f x +e \right )}-i b d \,{\mathrm e}^{2 i \left (f x +e \right )}+a d +2 b c \right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}-\frac {2 i b \,d^{2} e}{f}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a c d}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b \,c^{2}}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b \,d^{2}}{f}\) | \(204\) |
Input:
int((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)
Output:
(a*c^2-a*d^2-2*b*c*d)*x+d*(a*d+2*b*c)/f*tan(f*x+e)+1/2*b*d^2/f*tan(f*x+e)^ 2+1/2*(2*a*c*d+b*c^2-b*d^2)/f*ln(1+tan(f*x+e)^2)
Time = 0.11 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.02 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {b d^{2} \tan \left (f x + e\right )^{2} + 2 \, {\left (a c^{2} - 2 \, b c d - a d^{2}\right )} f x - {\left (b c^{2} + 2 \, a c d - b d^{2}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (2 \, b c d + a d^{2}\right )} \tan \left (f x + e\right )}{2 \, f} \] Input:
integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="fricas")
Output:
1/2*(b*d^2*tan(f*x + e)^2 + 2*(a*c^2 - 2*b*c*d - a*d^2)*f*x - (b*c^2 + 2*a *c*d - b*d^2)*log(1/(tan(f*x + e)^2 + 1)) + 2*(2*b*c*d + a*d^2)*tan(f*x + e))/f
Time = 0.11 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.61 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\begin {cases} a c^{2} x + \frac {a c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - a d^{2} x + \frac {a d^{2} \tan {\left (e + f x \right )}}{f} + \frac {b c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 2 b c d x + \frac {2 b c d \tan {\left (e + f x \right )}}{f} - \frac {b d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {b d^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right ) \left (c + d \tan {\left (e \right )}\right )^{2} & \text {otherwise} \end {cases} \] Input:
integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))**2,x)
Output:
Piecewise((a*c**2*x + a*c*d*log(tan(e + f*x)**2 + 1)/f - a*d**2*x + a*d**2 *tan(e + f*x)/f + b*c**2*log(tan(e + f*x)**2 + 1)/(2*f) - 2*b*c*d*x + 2*b* c*d*tan(e + f*x)/f - b*d**2*log(tan(e + f*x)**2 + 1)/(2*f) + b*d**2*tan(e + f*x)**2/(2*f), Ne(f, 0)), (x*(a + b*tan(e))*(c + d*tan(e))**2, True))
Time = 0.11 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.02 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {b d^{2} \tan \left (f x + e\right )^{2} + 2 \, {\left (a c^{2} - 2 \, b c d - a d^{2}\right )} {\left (f x + e\right )} + {\left (b c^{2} + 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 2 \, {\left (2 \, b c d + a d^{2}\right )} \tan \left (f x + e\right )}{2 \, f} \] Input:
integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="maxima")
Output:
1/2*(b*d^2*tan(f*x + e)^2 + 2*(a*c^2 - 2*b*c*d - a*d^2)*(f*x + e) + (b*c^2 + 2*a*c*d - b*d^2)*log(tan(f*x + e)^2 + 1) + 2*(2*b*c*d + a*d^2)*tan(f*x + e))/f
Time = 0.29 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.18 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {{\left (a c^{2} - 2 \, b c d - a d^{2}\right )} {\left (f x + e\right )}}{f} + \frac {{\left (b c^{2} + 2 \, a c d - b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, f} + \frac {b d^{2} f \tan \left (f x + e\right )^{2} + 4 \, b 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+b*tan(f*x+e))*(c+d*tan(f*x+e))^2,x, algorithm="giac")
Output:
(a*c^2 - 2*b*c*d - a*d^2)*(f*x + e)/f + 1/2*(b*c^2 + 2*a*c*d - b*d^2)*log( tan(f*x + e)^2 + 1)/f + 1/2*(b*d^2*f*tan(f*x + e)^2 + 4*b*c*d*f*tan(f*x + e) + 2*a*d^2*f*tan(f*x + e))/f^2
Time = 2.21 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.02 \[ \int (a+b \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\,b\,c\,d\right )}{f}-x\,\left (-a\,c^2+2\,b\,c\,d+a\,d^2\right )+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {b\,c^2}{2}+a\,c\,d-\frac {b\,d^2}{2}\right )}{f}+\frac {b\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2\,f} \] Input:
int((a + b*tan(e + f*x))*(c + d*tan(e + f*x))^2,x)
Output:
(tan(e + f*x)*(a*d^2 + 2*b*c*d))/f - x*(a*d^2 - a*c^2 + 2*b*c*d) + (log(ta n(e + f*x)^2 + 1)*((b*c^2)/2 - (b*d^2)/2 + a*c*d))/f + (b*d^2*tan(e + f*x) ^2)/(2*f)
Time = 0.22 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.28 \[ \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx=\frac {2 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a c d +\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) b \,c^{2}-\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) b \,d^{2}+\tan \left (f x +e \right )^{2} b \,d^{2}+2 \tan \left (f x +e \right ) a \,d^{2}+4 \tan \left (f x +e \right ) b c d +2 a \,c^{2} f x -2 a \,d^{2} f x -4 b c d f x}{2 f} \] Input:
int((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^2,x)
Output:
(2*log(tan(e + f*x)**2 + 1)*a*c*d + log(tan(e + f*x)**2 + 1)*b*c**2 - log( tan(e + f*x)**2 + 1)*b*d**2 + tan(e + f*x)**2*b*d**2 + 2*tan(e + f*x)*a*d* *2 + 4*tan(e + f*x)*b*c*d + 2*a*c**2*f*x - 2*a*d**2*f*x - 4*b*c*d*f*x)/(2* f)