Integrand size = 43, antiderivative size = 292 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=-\frac {\left (a \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )-b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^2}-\frac {\left (a \left (B c^2+2 c C d-B d^2\right )-b \left (c^2 C-2 B c d-C d^2\right )-A \left (2 a c d-b \left (c^2-d^2\right )\right )\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right )^2 f}+\frac {\left (b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right )^2 f}+\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right )}{d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))} \] Output:
-(a*(c^2*C-2*B*c*d-C*d^2-A*(c^2-d^2))-b*(2*c*(A-C)*d-B*(c^2-d^2)))*x/(c^2+ d^2)^2-(a*(B*c^2-B*d^2+2*C*c*d)-b*(-2*B*c*d+C*c^2-C*d^2)-A*(2*a*c*d-b*(c^2 -d^2)))*ln(cos(f*x+e))/(c^2+d^2)^2/f+(b*(c^4*C-c^2*(A-3*C)*d^2-2*B*c*d^3+A *d^4)+a*d^2*(2*c*(A-C)*d-B*(c^2-d^2)))*ln(c+d*tan(f*x+e))/d^2/(c^2+d^2)^2/ f+(-a*d+b*c)*(A*d^2-B*c*d+C*c^2)/d^2/(c^2+d^2)/f/(c+d*tan(f*x+e))
Result contains complex when optimal does not.
Time = 1.54 (sec) , antiderivative size = 221, normalized size of antiderivative = 0.76 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {(-i a+b) (A+i B-C) \log (i-\tan (e+f x))}{(c+i d)^2}+\frac {(i a+b) (A-i B-C) \log (i+\tan (e+f x))}{(c-i d)^2}+\frac {2 \left (b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d+B \left (-c^2+d^2\right )\right )\right ) \log (c+d \tan (e+f x))}{d^2 \left (c^2+d^2\right )^2}+\frac {2 (b c-a d) \left (c^2 C-B c d+A d^2\right )}{d^2 \left (c^2+d^2\right ) (c+d \tan (e+f x))}}{2 f} \] Input:
Integrate[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/( c + d*Tan[e + f*x])^2,x]
Output:
((((-I)*a + b)*(A + I*B - C)*Log[I - Tan[e + f*x]])/(c + I*d)^2 + ((I*a + b)*(A - I*B - C)*Log[I + Tan[e + f*x]])/(c - I*d)^2 + (2*(b*(c^4*C - c^2*( A - 3*C)*d^2 - 2*B*c*d^3 + A*d^4) + a*d^2*(2*c*(A - C)*d + B*(-c^2 + d^2)) )*Log[c + d*Tan[e + f*x]])/(d^2*(c^2 + d^2)^2) + (2*(b*c - a*d)*(c^2*C - B *c*d + A*d^2))/(d^2*(c^2 + d^2)*(c + d*Tan[e + f*x])))/(2*f)
Time = 1.99 (sec) , antiderivative size = 304, normalized size of antiderivative = 1.04, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.186, Rules used = {3042, 4118, 3042, 4109, 3042, 3956, 4100, 16}
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 {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan (e+f x)^2\right )}{(c+d \tan (e+f x))^2}dx\) |
\(\Big \downarrow \) 4118 |
\(\displaystyle \frac {\int \frac {b C \left (c^2+d^2\right ) \tan ^2(e+f x)+d (A b c+a B c-b C c-a A d+b B d+a C d) \tan (e+f x)+a d (A c-C c+B d)+b \left (C c^2-B d c+A d^2\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}+\frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {b C \left (c^2+d^2\right ) \tan (e+f x)^2+d (A b c+a B c-b C c-a A d+b B d+a C d) \tan (e+f x)+a d (A c-C c+B d)+b \left (C c^2-B d c+A d^2\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}+\frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 4109 |
\(\displaystyle \frac {-\frac {d \left (2 a A c d-a B \left (c^2-d^2\right )-2 a c C d-A b \left (c^2-d^2\right )+b \left (-2 B c d+c^2 C-C d^2\right )\right ) \int \tan (e+f x)dx}{c^2+d^2}+\frac {\left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \int \frac {\tan ^2(e+f x)+1}{c+d \tan (e+f x)}dx}{c^2+d^2}-\frac {d x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{c^2+d^2}}{d \left (c^2+d^2\right )}+\frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {-\frac {d \left (2 a A c d-a B \left (c^2-d^2\right )-2 a c C d-A b \left (c^2-d^2\right )+b \left (-2 B c d+c^2 C-C d^2\right )\right ) \int \tan (e+f x)dx}{c^2+d^2}+\frac {\left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}-\frac {d x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{c^2+d^2}}{d \left (c^2+d^2\right )}+\frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 3956 |
\(\displaystyle \frac {\frac {\left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {d \log (\cos (e+f x)) \left (2 a A c d-a B \left (c^2-d^2\right )-2 a c C d-A b \left (c^2-d^2\right )+b \left (-2 B c d+c^2 C-C d^2\right )\right )}{f \left (c^2+d^2\right )}-\frac {d x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{c^2+d^2}}{d \left (c^2+d^2\right )}+\frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 4100 |
\(\displaystyle \frac {\frac {\left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \int \frac {1}{c+d \tan (e+f x)}d(d \tan (e+f x))}{d f \left (c^2+d^2\right )}+\frac {d \log (\cos (e+f x)) \left (2 a A c d-a B \left (c^2-d^2\right )-2 a c C d-A b \left (c^2-d^2\right )+b \left (-2 B c d+c^2 C-C d^2\right )\right )}{f \left (c^2+d^2\right )}-\frac {d x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{c^2+d^2}}{d \left (c^2+d^2\right )}+\frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\) |
\(\Big \downarrow \) 16 |
\(\displaystyle \frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))}+\frac {\frac {d \log (\cos (e+f x)) \left (2 a A c d-a B \left (c^2-d^2\right )-2 a c C d-A b \left (c^2-d^2\right )+b \left (-2 B c d+c^2 C-C d^2\right )\right )}{f \left (c^2+d^2\right )}-\frac {d x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )-b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{c^2+d^2}+\frac {\left (a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )\right ) \log (c+d \tan (e+f x))}{d f \left (c^2+d^2\right )}}{d \left (c^2+d^2\right )}\) |
Input:
Int[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d* Tan[e + f*x])^2,x]
Output:
(-((d*(a*(c^2*C - 2*B*c*d - C*d^2 - A*(c^2 - d^2)) - b*(2*c*(A - C)*d - B* (c^2 - d^2)))*x)/(c^2 + d^2)) + (d*(2*a*A*c*d - 2*a*c*C*d - A*b*(c^2 - d^2 ) - a*B*(c^2 - d^2) + b*(c^2*C - 2*B*c*d - C*d^2))*Log[Cos[e + f*x]])/((c^ 2 + d^2)*f) + ((b*(c^4*C - c^2*(A - 3*C)*d^2 - 2*B*c*d^3 + A*d^4) + a*d^2* (2*c*(A - C)*d - B*(c^2 - d^2)))*Log[c + d*Tan[e + f*x]])/(d*(c^2 + d^2)*f ))/(d*(c^2 + d^2)) + ((b*c - a*d)*(c^2*C - B*c*d + A*d^2))/(d^2*(c^2 + d^2 )*f*(c + d*Tan[e + f*x]))
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + b*x, x]]/b), x] /; FreeQ[{a, b, c}, x]
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_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[A/(b*f) Subst[Int[(a + x)^m, x], x, b* Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]
Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2 )/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*A + b*B - a *C)*(x/(a^2 + b^2)), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2) Int[( 1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Simp[(A*b - a*B - b*C)/( a^2 + b^2) Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] & & NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a*B - b*C , 0]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_. )*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f _.)*(x_)]^2), x_Symbol] :> Simp[(-(b*c - a*d))*(c^2*C - B*c*d + A*d^2)*((c + d*Tan[e + f*x])^(n + 1)/(d^2*f*(n + 1)*(c^2 + d^2))), x] + Simp[1/(d*(c^2 + d^2)) Int[(c + d*Tan[e + f*x])^(n + 1)*Simp[a*d*(A*c - c*C + B*d) + b* (c^2*C - B*c*d + A*d^2) + d*(A*b*c + a*B*c - b*c*C - a*A*d + b*B*d + a*C*d) *Tan[e + f*x] + b*C*(c^2 + d^2)*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && LtQ[n , -1]
Time = 0.24 (sec) , antiderivative size = 321, normalized size of antiderivative = 1.10
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-2 A a c d +A b \,c^{2}-A b \,d^{2}+B a \,c^{2}-B a \,d^{2}+2 B b c d +2 C a c d -C b \,c^{2}+C b \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A a \,c^{2}-A a \,d^{2}+2 A b c d +2 B a c d -B b \,c^{2}+B b \,d^{2}-C a \,c^{2}+C a \,d^{2}-2 C b c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}}{d^{2} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (2 A a c \,d^{3}-A b \,c^{2} d^{2}+A b \,d^{4}-B a \,c^{2} d^{2}+B a \,d^{4}-2 B b c \,d^{3}-2 C a c \,d^{3}+C b \,c^{4}+3 C b \,c^{2} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2} d^{2}}}{f}\) | \(321\) |
default | \(\frac {\frac {\frac {\left (-2 A a c d +A b \,c^{2}-A b \,d^{2}+B a \,c^{2}-B a \,d^{2}+2 B b c d +2 C a c d -C b \,c^{2}+C b \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (A a \,c^{2}-A a \,d^{2}+2 A b c d +2 B a c d -B b \,c^{2}+B b \,d^{2}-C a \,c^{2}+C a \,d^{2}-2 C b c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}}{d^{2} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (2 A a c \,d^{3}-A b \,c^{2} d^{2}+A b \,d^{4}-B a \,c^{2} d^{2}+B a \,d^{4}-2 B b c \,d^{3}-2 C a c \,d^{3}+C b \,c^{4}+3 C b \,c^{2} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2} d^{2}}}{f}\) | \(321\) |
norman | \(\frac {\frac {c \left (A a \,c^{2}-A a \,d^{2}+2 A b c d +2 B a c d -B b \,c^{2}+B b \,d^{2}-C a \,c^{2}+C a \,d^{2}-2 C b c d \right ) x}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {d \left (A a \,c^{2}-A a \,d^{2}+2 A b c d +2 B a c d -B b \,c^{2}+B b \,d^{2}-C a \,c^{2}+C a \,d^{2}-2 C b c d \right ) x \tan \left (f x +e \right )}{c^{4}+2 c^{2} d^{2}+d^{4}}-\frac {A a \,d^{3}-A b c \,d^{2}-B a c \,d^{2}+B b \,c^{2} d +C a \,c^{2} d -C b \,c^{3}}{d^{2} f \left (c^{2}+d^{2}\right )}}{c +d \tan \left (f x +e \right )}+\frac {\left (2 A a c \,d^{3}-A b \,c^{2} d^{2}+A b \,d^{4}-B a \,c^{2} d^{2}+B a \,d^{4}-2 B b c \,d^{3}-2 C a c \,d^{3}+C b \,c^{4}+3 C b \,c^{2} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{4}+2 c^{2} d^{2}+d^{4}\right ) f \,d^{2}}-\frac {\left (2 A a c d -A b \,c^{2}+A b \,d^{2}-B a \,c^{2}+B a \,d^{2}-2 B b c d -2 C a c d +C b \,c^{2}-C b \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}\) | \(438\) |
parallelrisch | \(\text {Expression too large to display}\) | \(1210\) |
risch | \(\text {Expression too large to display}\) | \(1523\) |
Input:
int((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^2,x, method=_RETURNVERBOSE)
Output:
1/f*(1/(c^2+d^2)^2*(1/2*(-2*A*a*c*d+A*b*c^2-A*b*d^2+B*a*c^2-B*a*d^2+2*B*b* c*d+2*C*a*c*d-C*b*c^2+C*b*d^2)*ln(1+tan(f*x+e)^2)+(A*a*c^2-A*a*d^2+2*A*b*c *d+2*B*a*c*d-B*b*c^2+B*b*d^2-C*a*c^2+C*a*d^2-2*C*b*c*d)*arctan(tan(f*x+e)) )-(A*a*d^3-A*b*c*d^2-B*a*c*d^2+B*b*c^2*d+C*a*c^2*d-C*b*c^3)/d^2/(c^2+d^2)/ (c+d*tan(f*x+e))+(2*A*a*c*d^3-A*b*c^2*d^2+A*b*d^4-B*a*c^2*d^2+B*a*d^4-2*B* b*c*d^3-2*C*a*c*d^3+C*b*c^4+3*C*b*c^2*d^2)/(c^2+d^2)^2/d^2*ln(c+d*tan(f*x+ e)))
Time = 0.16 (sec) , antiderivative size = 505, normalized size of antiderivative = 1.73 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\frac {2 \, C b c^{3} d^{2} - 2 \, A a d^{5} - 2 \, {\left (C a + B b\right )} c^{2} d^{3} + 2 \, {\left (B a + A b\right )} c d^{4} + 2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{3} d^{2} + 2 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d^{3} - {\left ({\left (A - C\right )} a - B b\right )} c d^{4}\right )} f x + {\left (C b c^{5} - {\left (B a + {\left (A - 3 \, C\right )} b\right )} c^{3} d^{2} + 2 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} + {\left (B a + A b\right )} c d^{4} + {\left (C b c^{4} d - {\left (B a + {\left (A - 3 \, C\right )} b\right )} c^{2} d^{3} + 2 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{4} + {\left (B a + A b\right )} d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (C b c^{5} + 2 \, C b c^{3} d^{2} + C b c d^{4} + {\left (C b c^{4} d + 2 \, C b c^{2} d^{3} + C b d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (C b c^{4} d - A a c d^{4} - {\left (C a + B b\right )} c^{3} d^{2} + {\left (B a + A b\right )} c^{2} d^{3} - {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} + 2 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{4} - {\left ({\left (A - C\right )} a - B b\right )} d^{5}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}\right )} f \tan \left (f x + e\right ) + {\left (c^{5} d^{2} + 2 \, c^{3} d^{4} + c d^{6}\right )} f\right )}} \] Input:
integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e) )^2,x, algorithm="fricas")
Output:
1/2*(2*C*b*c^3*d^2 - 2*A*a*d^5 - 2*(C*a + B*b)*c^2*d^3 + 2*(B*a + A*b)*c*d ^4 + 2*(((A - C)*a - B*b)*c^3*d^2 + 2*(B*a + (A - C)*b)*c^2*d^3 - ((A - C) *a - B*b)*c*d^4)*f*x + (C*b*c^5 - (B*a + (A - 3*C)*b)*c^3*d^2 + 2*((A - C) *a - B*b)*c^2*d^3 + (B*a + A*b)*c*d^4 + (C*b*c^4*d - (B*a + (A - 3*C)*b)*c ^2*d^3 + 2*((A - C)*a - B*b)*c*d^4 + (B*a + A*b)*d^5)*tan(f*x + e))*log((d ^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + e) + c^2)/(tan(f*x + e)^2 + 1)) - (C*b *c^5 + 2*C*b*c^3*d^2 + C*b*c*d^4 + (C*b*c^4*d + 2*C*b*c^2*d^3 + C*b*d^5)*t an(f*x + e))*log(1/(tan(f*x + e)^2 + 1)) - 2*(C*b*c^4*d - A*a*c*d^4 - (C*a + B*b)*c^3*d^2 + (B*a + A*b)*c^2*d^3 - (((A - C)*a - B*b)*c^2*d^3 + 2*(B* a + (A - C)*b)*c*d^4 - ((A - C)*a - B*b)*d^5)*f*x)*tan(f*x + e))/((c^4*d^3 + 2*c^2*d^5 + d^7)*f*tan(f*x + e) + (c^5*d^2 + 2*c^3*d^4 + c*d^6)*f)
Result contains complex when optimal does not.
Time = 1.32 (sec) , antiderivative size = 9721, normalized size of antiderivative = 33.29 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\text {Too large to display} \] Input:
integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)**2)/(c+d*tan(f*x+e ))**2,x)
Output:
Piecewise((zoo*x*(a + b*tan(e))*(A + B*tan(e) + C*tan(e)**2)/tan(e)**2, Eq (c, 0) & Eq(d, 0) & Eq(f, 0)), ((A*a*x + A*b*log(tan(e + f*x)**2 + 1)/(2*f ) + B*a*log(tan(e + f*x)**2 + 1)/(2*f) - B*b*x + B*b*tan(e + f*x)/f - C*a* x + C*a*tan(e + f*x)/f - C*b*log(tan(e + f*x)**2 + 1)/(2*f) + C*b*tan(e + f*x)**2/(2*f))/c**2, Eq(d, 0)), (-A*a*f*x*tan(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*I*A*a*f*x*tan(e + f*x) /(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + A*a*f*x /(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) - A*a*tan (e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*I*A*a/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + I*A*b*f*x*tan(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*A*b*f*x*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I *d**2*f*tan(e + f*x) - 4*d**2*f) - I*A*b*f*x/(4*d**2*f*tan(e + f*x)**2 - 8 *I*d**2*f*tan(e + f*x) - 4*d**2*f) + I*A*b*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + I*B*a*f*x*tan(e + f*x)**2/ (4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*B*a*f* x*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d** 2*f) - I*B*a*f*x/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d **2*f) + I*B*a*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + B*b*f*x*tan(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 -...
Time = 0.12 (sec) , antiderivative size = 319, normalized size of antiderivative = 1.09 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{2} + 2 \, {\left (B a + {\left (A - C\right )} b\right )} c d - {\left ({\left (A - C\right )} a - B b\right )} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {2 \, {\left (C b c^{4} - {\left (B a + {\left (A - 3 \, C\right )} b\right )} c^{2} d^{2} + 2 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{3} + {\left (B a + A b\right )} d^{4}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{4} d^{2} + 2 \, c^{2} d^{4} + d^{6}} + \frac {{\left ({\left (B a + {\left (A - C\right )} b\right )} c^{2} - 2 \, {\left ({\left (A - C\right )} a - B b\right )} c d - {\left (B a + {\left (A - C\right )} b\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {2 \, {\left (C b c^{3} - A a d^{3} - {\left (C a + B b\right )} c^{2} d + {\left (B a + A b\right )} c d^{2}\right )}}{c^{3} d^{2} + c d^{4} + {\left (c^{2} d^{3} + d^{5}\right )} \tan \left (f x + e\right )}}{2 \, f} \] Input:
integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e) )^2,x, algorithm="maxima")
Output:
1/2*(2*(((A - C)*a - B*b)*c^2 + 2*(B*a + (A - C)*b)*c*d - ((A - C)*a - B*b )*d^2)*(f*x + e)/(c^4 + 2*c^2*d^2 + d^4) + 2*(C*b*c^4 - (B*a + (A - 3*C)*b )*c^2*d^2 + 2*((A - C)*a - B*b)*c*d^3 + (B*a + A*b)*d^4)*log(d*tan(f*x + e ) + c)/(c^4*d^2 + 2*c^2*d^4 + d^6) + ((B*a + (A - C)*b)*c^2 - 2*((A - C)*a - B*b)*c*d - (B*a + (A - C)*b)*d^2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2* d^2 + d^4) + 2*(C*b*c^3 - A*a*d^3 - (C*a + B*b)*c^2*d + (B*a + A*b)*c*d^2) /(c^3*d^2 + c*d^4 + (c^2*d^3 + d^5)*tan(f*x + e)))/f
Time = 0.57 (sec) , antiderivative size = 420, normalized size of antiderivative = 1.44 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\frac {{\left (A a c^{2} - C a c^{2} - B b c^{2} + 2 \, B a c d + 2 \, A b c d - 2 \, C b c d - A a d^{2} + C a d^{2} + B b d^{2}\right )} {\left (f x + e\right )}}{c^{4} f + 2 \, c^{2} d^{2} f + d^{4} f} + \frac {{\left (B a c^{2} + A b c^{2} - C b c^{2} - 2 \, A a c d + 2 \, C a c d + 2 \, B b c d - B a d^{2} - A b d^{2} + C b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, {\left (c^{4} f + 2 \, c^{2} d^{2} f + d^{4} f\right )}} + \frac {{\left (C b c^{4} - B a c^{2} d^{2} - A b c^{2} d^{2} + 3 \, C b c^{2} d^{2} + 2 \, A a c d^{3} - 2 \, C a c d^{3} - 2 \, B b c d^{3} + B a d^{4} + A b d^{4}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{4} d^{2} f + 2 \, c^{2} d^{4} f + d^{6} f} + \frac {C b c^{5} - C a c^{4} d - B b c^{4} d + B a c^{3} d^{2} + A b c^{3} d^{2} + C b c^{3} d^{2} - A a c^{2} d^{3} - C a c^{2} d^{3} - B b c^{2} d^{3} + B a c d^{4} + A b c d^{4} - A a d^{5}}{{\left (c^{2} + d^{2}\right )}^{2} {\left (d \tan \left (f x + e\right ) + c\right )} d^{2} f} \] Input:
integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e) )^2,x, algorithm="giac")
Output:
(A*a*c^2 - C*a*c^2 - B*b*c^2 + 2*B*a*c*d + 2*A*b*c*d - 2*C*b*c*d - A*a*d^2 + C*a*d^2 + B*b*d^2)*(f*x + e)/(c^4*f + 2*c^2*d^2*f + d^4*f) + 1/2*(B*a*c ^2 + A*b*c^2 - C*b*c^2 - 2*A*a*c*d + 2*C*a*c*d + 2*B*b*c*d - B*a*d^2 - A*b *d^2 + C*b*d^2)*log(tan(f*x + e)^2 + 1)/(c^4*f + 2*c^2*d^2*f + d^4*f) + (C *b*c^4 - B*a*c^2*d^2 - A*b*c^2*d^2 + 3*C*b*c^2*d^2 + 2*A*a*c*d^3 - 2*C*a*c *d^3 - 2*B*b*c*d^3 + B*a*d^4 + A*b*d^4)*log(abs(d*tan(f*x + e) + c))/(c^4* d^2*f + 2*c^2*d^4*f + d^6*f) + (C*b*c^5 - C*a*c^4*d - B*b*c^4*d + B*a*c^3* d^2 + A*b*c^3*d^2 + C*b*c^3*d^2 - A*a*c^2*d^3 - C*a*c^2*d^3 - B*b*c^2*d^3 + B*a*c*d^4 + A*b*c*d^4 - A*a*d^5)/((c^2 + d^2)^2*(d*tan(f*x + e) + c)*d^2 *f)
Time = 18.12 (sec) , antiderivative size = 1875, normalized size of antiderivative = 6.42 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx=\text {Too large to display} \] Input:
int(((a + b*tan(e + f*x))*(A + B*tan(e + f*x) + C*tan(e + f*x)^2))/(c + d* tan(e + f*x))^2,x)
Output:
(log(c + d*tan(e + f*x))*(d^4*(A*b + B*a) - d^3*(2*B*b*c - 2*A*a*c + 2*C*a *c) - d^2*(A*b*c^2 + B*a*c^2 - 3*C*b*c^2) + C*b*c^4))/(f*(d^6 + 2*c^2*d^4 + c^4*d^2)) - (log((A*B*b^2*d^4 - A*B*a^2*d^4 + B*C*a^2*d^4 + B*C*b^2*c^4 - A^2*a*b*d^4 + B^2*a*b*d^4 + C^2*a*b*c^4 - A^2*a^2*c*d^3 + A^2*b^2*c*d^3 + B^2*a^2*c*d^3 - B^2*b^2*c*d^3 - C^2*a^2*c*d^3 + C^2*b^2*c*d^3 + A*B*a^2* c^2*d^2 - A*B*b^2*c^2*d^2 - B*C*a^2*c^2*d^2 + 3*B*C*b^2*c^2*d^2 + A^2*a*b* c^2*d^2 - B^2*a*b*c^2*d^2 + 3*C^2*a*b*c^2*d^2 - A*C*a*b*c^4 + A*C*a*b*d^4 + 2*A*C*a^2*c*d^3 - 2*A*C*b^2*c*d^3 - 4*A*C*a*b*c^2*d^2 + 4*A*B*a*b*c*d^3 - 4*B*C*a*b*c*d^3)/(d*(c^2 + d^2)^2) + (tan(e + f*x)*(A^2*a^2*d^4 + B^2*b^ 2*d^4 + C^2*a^2*d^4 + C^2*b^2*c^4 + C^2*b^2*d^4 + A^2*b^2*c^2*d^2 + B^2*a^ 2*c^2*d^2 + 3*C^2*b^2*c^2*d^2 - 2*A*C*a^2*d^4 - A*C*b^2*c^4 - A*C*b^2*d^4 - 4*A*C*b^2*c^2*d^2 - 2*A*B*a*b*d^4 - B*C*a*b*c^4 + B*C*a*b*d^4 - 2*A*B*a^ 2*c*d^3 + 2*A*B*b^2*c*d^3 + 2*B*C*a^2*c*d^3 - 2*B*C*b^2*c*d^3 - 2*A^2*a*b* c*d^3 + 2*B^2*a*b*c*d^3 - 2*C^2*a*b*c*d^3 + 2*A*B*a*b*c^2*d^2 - 4*B*C*a*b* c^2*d^2 + 4*A*C*a*b*c*d^3))/(d*(c^2 + d^2)^2) + ((a*1i + b)*(B*1i - A + C) *(A*a*d - B*b*d - C*a*d - 4*C*b*c + (tan(e + f*x)*(3*A*b*d^4 + 3*B*a*d^4 + 2*C*b*c^4 - 5*C*b*d^4 + 4*A*a*c*d^3 - 4*B*b*c*d^3 - 4*C*a*c*d^3 - A*b*c^2 *d^2 - B*a*c^2*d^2 + C*b*c^2*d^2))/(d*(c^2 + d^2)) + (d*(a*1i + b)*(4*c*d - c^2*tan(e + f*x) + 3*d^2*tan(e + f*x))*(B*1i - A + C))/(c*1i + d)^2))/(2 *(c*1i + d)^2))*(A*a*1i + A*b + B*a - B*b*1i - C*a*1i - C*b))/(2*f*(c*d...
Time = 0.16 (sec) , antiderivative size = 1114, normalized size of antiderivative = 3.82 \[ \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^2} \, dx =\text {Too large to display} \] Input:
int((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^2,x)
Output:
( - 2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**2*c**2*d**4 + 2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a*b*c**3*d**3 - 2*log(tan(e + f*x)**2 + 1)*tan( e + f*x)*a*b*c*d**5 + 2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a*c**3*d**4 + 2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*b**2*c**2*d**4 - log(tan(e + f*x )**2 + 1)*tan(e + f*x)*b*c**4*d**3 + log(tan(e + f*x)**2 + 1)*tan(e + f*x) *b*c**2*d**5 - 2*log(tan(e + f*x)**2 + 1)*a**2*c**3*d**3 + 2*log(tan(e + f *x)**2 + 1)*a*b*c**4*d**2 - 2*log(tan(e + f*x)**2 + 1)*a*b*c**2*d**4 + 2*l og(tan(e + f*x)**2 + 1)*a*c**4*d**3 + 2*log(tan(e + f*x)**2 + 1)*b**2*c**3 *d**3 - log(tan(e + f*x)**2 + 1)*b*c**5*d**2 + log(tan(e + f*x)**2 + 1)*b* c**3*d**4 + 4*log(tan(e + f*x)*d + c)*tan(e + f*x)*a**2*c**2*d**4 - 4*log( tan(e + f*x)*d + c)*tan(e + f*x)*a*b*c**3*d**3 + 4*log(tan(e + f*x)*d + c) *tan(e + f*x)*a*b*c*d**5 - 4*log(tan(e + f*x)*d + c)*tan(e + f*x)*a*c**3*d **4 - 4*log(tan(e + f*x)*d + c)*tan(e + f*x)*b**2*c**2*d**4 + 2*log(tan(e + f*x)*d + c)*tan(e + f*x)*b*c**6*d + 6*log(tan(e + f*x)*d + c)*tan(e + f* x)*b*c**4*d**3 + 4*log(tan(e + f*x)*d + c)*a**2*c**3*d**3 - 4*log(tan(e + f*x)*d + c)*a*b*c**4*d**2 + 4*log(tan(e + f*x)*d + c)*a*b*c**2*d**4 - 4*lo g(tan(e + f*x)*d + c)*a*c**4*d**3 - 4*log(tan(e + f*x)*d + c)*b**2*c**3*d* *3 + 2*log(tan(e + f*x)*d + c)*b*c**7 + 6*log(tan(e + f*x)*d + c)*b*c**5*d **2 + 2*tan(e + f*x)*a**2*c**3*d**3*f*x + 2*tan(e + f*x)*a**2*c**2*d**4 - 2*tan(e + f*x)*a**2*c*d**5*f*x + 2*tan(e + f*x)*a**2*d**6 - 4*tan(e + f...