Integrand size = 19, antiderivative size = 47 \[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {b^2 \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a b \cos (c+d x)}{d}+\frac {\left (a^2-b^2\right ) \sin (c+d x)}{d} \] Output:
b^2*arctanh(sin(d*x+c))/d-2*a*b*cos(d*x+c)/d+(a^2-b^2)*sin(d*x+c)/d
Time = 0.35 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.79 \[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {-2 a b \cos (c+d x)+b^2 \left (-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+\left (a^2-b^2\right ) \sin (c+d x)}{d} \] Input:
Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]
Output:
(-2*a*b*Cos[c + d*x] + b^2*(-Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + Lo g[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]) + (a^2 - b^2)*Sin[c + d*x])/d
Time = 0.34 (sec) , antiderivative size = 46, normalized size of antiderivative = 0.98, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.421, Rules used = {3042, 3991, 27, 3042, 3118, 4159, 299, 219}
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 \cos (c+d x) (a+b \tan (c+d x))^2 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(a+b \tan (c+d x))^2}{\sec (c+d x)}dx\) |
\(\Big \downarrow \) 3991 |
\(\displaystyle \int \cos (c+d x) \left (a^2+b^2 \tan ^2(c+d x)\right )dx+\int 2 a b \sin (c+d x)dx\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \int \cos (c+d x) \left (a^2+b^2 \tan ^2(c+d x)\right )dx+2 a b \int \sin (c+d x)dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {a^2+b^2 \tan (c+d x)^2}{\sec (c+d x)}dx+2 a b \int \sin (c+d x)dx\) |
\(\Big \downarrow \) 3118 |
\(\displaystyle \int \frac {a^2+b^2 \tan (c+d x)^2}{\sec (c+d x)}dx-\frac {2 a b \cos (c+d x)}{d}\) |
\(\Big \downarrow \) 4159 |
\(\displaystyle \frac {\int \frac {a^2-\left (a^2-b^2\right ) \sin ^2(c+d x)}{1-\sin ^2(c+d x)}d\sin (c+d x)}{d}-\frac {2 a b \cos (c+d x)}{d}\) |
\(\Big \downarrow \) 299 |
\(\displaystyle \frac {b^2 \int \frac {1}{1-\sin ^2(c+d x)}d\sin (c+d x)+\left (a^2-b^2\right ) \sin (c+d x)}{d}-\frac {2 a b \cos (c+d x)}{d}\) |
\(\Big \downarrow \) 219 |
\(\displaystyle \frac {\left (a^2-b^2\right ) \sin (c+d x)+b^2 \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a b \cos (c+d x)}{d}\) |
Input:
Int[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]
Output:
(-2*a*b*Cos[c + d*x])/d + (b^2*ArcTanh[Sin[c + d*x]] + (a^2 - b^2)*Sin[c + d*x])/d
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))* ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (Gt Q[a, 0] || LtQ[b, 0])
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[d*x *((a + b*x^2)^(p + 1)/(b*(2*p + 3))), x] - Simp[(a*d - b*c*(2*p + 3))/(b*(2 *p + 3)) Int[(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && NeQ[2*p + 3, 0]
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n _), x_Symbol] :> Module[{k}, Int[Sec[e + f*x]^m*Sum[Binomial[n, 2*k]*a^(n - 2*k)*b^(2*k)*Tan[e + f*x]^(2*k), {k, 0, n/2}], x] + Int[Sec[e + f*x]^m*Tan [e + f*x]*Sum[Binomial[n, 2*k + 1]*a^(n - 2*k - 1)*b^(2*k + 1)*Tan[e + f*x] ^(2*k), {k, 0, (n - 1)/2}], x]] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 + b^2, 0] && IntegerQ[(m - 1)/2] && IGtQ[n, 0]
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_ ))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Simp[ff/f Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 - ff^2 *x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f} , x] && IntegerQ[(m - 1)/2] && IntegerQ[n/2] && IntegerQ[p]
Time = 1.18 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.13
method | result | size |
derivativedivides | \(\frac {b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )-2 a b \cos \left (d x +c \right )+a^{2} \sin \left (d x +c \right )}{d}\) | \(53\) |
default | \(\frac {b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )-2 a b \cos \left (d x +c \right )+a^{2} \sin \left (d x +c \right )}{d}\) | \(53\) |
risch | \(-\frac {{\mathrm e}^{i \left (d x +c \right )} a b}{d}-\frac {i a^{2} {\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} b^{2}}{2 d}-\frac {{\mathrm e}^{-i \left (d x +c \right )} a b}{d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a^{2}}{2 d}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} b^{2}}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2}}{d}\) | \(147\) |
Input:
int(cos(d*x+c)*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)
Output:
1/d*(b^2*(-sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c)))-2*a*b*cos(d*x+c)+a^2*sin( d*x+c))
Time = 0.09 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.32 \[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {4 \, a b \cos \left (d x + c\right ) - b^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) + b^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \] Input:
integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="fricas")
Output:
-1/2*(4*a*b*cos(d*x + c) - b^2*log(sin(d*x + c) + 1) + b^2*log(-sin(d*x + c) + 1) - 2*(a^2 - b^2)*sin(d*x + c))/d
\[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \cos {\left (c + d x \right )}\, dx \] Input:
integrate(cos(d*x+c)*(a+b*tan(d*x+c))**2,x)
Output:
Integral((a + b*tan(c + d*x))**2*cos(c + d*x), x)
Time = 0.04 (sec) , antiderivative size = 60, normalized size of antiderivative = 1.28 \[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} - 4 \, a b \cos \left (d x + c\right ) + 2 \, a^{2} \sin \left (d x + c\right )}{2 \, d} \] Input:
integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="maxima")
Output:
1/2*(b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) - 4*a*b*cos(d*x + c) + 2*a^2*sin(d*x + c))/d
Leaf count of result is larger than twice the leaf count of optimal. 1100 vs. \(2 (47) = 94\).
Time = 0.42 (sec) , antiderivative size = 1100, normalized size of antiderivative = 23.40 \[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=\text {Too large to display} \] Input:
integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="giac")
Output:
-1/2*(b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2 *d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 - b^2*log(2*(tan(1/2*d*x)^2 *tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)/(tan( 1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x) ^2*tan(1/2*c)^2 + 4*a*b*tan(1/2*d*x)^2*tan(1/2*c)^2 + b^2*log(2*(tan(1/2*d *x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2* c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/ (tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2 *d*x)^2 - b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/ 2*c) - 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan (1/2*d*x) + 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan(1/2*c)^2 + tan(1/2*d*x)^ 2 + tan(1/2*c)^2 + 1))*tan(1/2*d*x)^2 + 4*a^2*tan(1/2*d*x)^2*tan(1/2*c) - 4*b^2*tan(1/2*d*x)^2*tan(1/2*c) + b^2*log(2*(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + 2*tan(1/2*d*x)*tan(1/2*c)^2 + tan(1/2*d*x)^ 2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)/(tan(1/2*d*x)^2*tan( 1/2*c)^2 + tan(1/2*d*x)^2 + tan(1/2*c)^2 + 1))*tan(1/2*c)^2 - b^2*log(2*(t an(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) - 2*tan(1/2*d*...
Time = 0.77 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.40 \[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {2\,b^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {4\,a\,b-\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a^2-2\,b^2\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \] Input:
int(cos(c + d*x)*(a + b*tan(c + d*x))^2,x)
Output:
(2*b^2*atanh(tan(c/2 + (d*x)/2)))/d - (4*a*b - tan(c/2 + (d*x)/2)*(2*a^2 - 2*b^2))/(d*(tan(c/2 + (d*x)/2)^2 + 1))
Time = 0.16 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.55 \[ \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {-2 \cos \left (d x +c \right ) a b -\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) b^{2}+\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) b^{2}+\sin \left (d x +c \right ) a^{2}-\sin \left (d x +c \right ) b^{2}+2 a b}{d} \] Input:
int(cos(d*x+c)*(a+b*tan(d*x+c))^2,x)
Output:
( - 2*cos(c + d*x)*a*b - log(tan((c + d*x)/2) - 1)*b**2 + log(tan((c + d*x )/2) + 1)*b**2 + sin(c + d*x)*a**2 - sin(c + d*x)*b**2 + 2*a*b)/d