Integrand size = 28, antiderivative size = 86 \[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {1}{8} \left (a^2+4 b^2\right ) x-\frac {\left (a^2+4 b^2\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {5 a b \sin ^3(c+d x)}{12 d}+\frac {a (b+a \cos (c+d x)) \sin ^3(c+d x)}{4 d} \] Output:
1/8*(a^2+4*b^2)*x-1/8*(a^2+4*b^2)*cos(d*x+c)*sin(d*x+c)/d+5/12*a*b*sin(d*x +c)^3/d+1/4*a*(b+a*cos(d*x+c))*sin(d*x+c)^3/d
Time = 0.46 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.95 \[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {12 a^2 c+48 b^2 c+12 a^2 d x+48 b^2 d x+48 a b \sin (c+d x)-24 b^2 \sin (2 (c+d x))-16 a b \sin (3 (c+d x))-3 a^2 \sin (4 (c+d x))}{96 d} \] Input:
Integrate[Cos[c + d*x]^2*(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]
Output:
(12*a^2*c + 48*b^2*c + 12*a^2*d*x + 48*b^2*d*x + 48*a*b*Sin[c + d*x] - 24* b^2*Sin[2*(c + d*x)] - 16*a*b*Sin[3*(c + d*x)] - 3*a^2*Sin[4*(c + d*x)])/( 96*d)
Time = 0.52 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.98, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.321, Rules used = {3042, 4897, 3042, 3171, 3042, 3148, 3042, 3115, 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 \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \cos (c+d x)^2 (a \sin (c+d x)+b \tan (c+d x))^2dx\) |
\(\Big \downarrow \) 4897 |
\(\displaystyle \int \sin ^2(c+d x) (a \cos (c+d x)+b)^2dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \cos \left (c+d x-\frac {\pi }{2}\right )^2 \left (b-a \sin \left (c+d x-\frac {\pi }{2}\right )\right )^2dx\) |
\(\Big \downarrow \) 3171 |
\(\displaystyle \frac {1}{4} \int \left (a^2+5 b \cos (c+d x) a+4 b^2\right ) \sin ^2(c+d x)dx+\frac {a \sin ^3(c+d x) (a \cos (c+d x)+b)}{4 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{4} \int \cos \left (c+d x-\frac {\pi }{2}\right )^2 \left (a^2-5 b \sin \left (c+d x-\frac {\pi }{2}\right ) a+4 b^2\right )dx+\frac {a \sin ^3(c+d x) (a \cos (c+d x)+b)}{4 d}\) |
\(\Big \downarrow \) 3148 |
\(\displaystyle \frac {1}{4} \left (\left (a^2+4 b^2\right ) \int \sin ^2(c+d x)dx+\frac {5 a b \sin ^3(c+d x)}{3 d}\right )+\frac {a \sin ^3(c+d x) (a \cos (c+d x)+b)}{4 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{4} \left (\left (a^2+4 b^2\right ) \int \sin (c+d x)^2dx+\frac {5 a b \sin ^3(c+d x)}{3 d}\right )+\frac {a \sin ^3(c+d x) (a \cos (c+d x)+b)}{4 d}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle \frac {1}{4} \left (\left (a^2+4 b^2\right ) \left (\frac {\int 1dx}{2}-\frac {\sin (c+d x) \cos (c+d x)}{2 d}\right )+\frac {5 a b \sin ^3(c+d x)}{3 d}\right )+\frac {a \sin ^3(c+d x) (a \cos (c+d x)+b)}{4 d}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {1}{4} \left (\left (a^2+4 b^2\right ) \left (\frac {x}{2}-\frac {\sin (c+d x) \cos (c+d x)}{2 d}\right )+\frac {5 a b \sin ^3(c+d x)}{3 d}\right )+\frac {a \sin ^3(c+d x) (a \cos (c+d x)+b)}{4 d}\) |
Input:
Int[Cos[c + d*x]^2*(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]
Output:
(a*(b + a*Cos[c + d*x])*Sin[c + d*x]^3)/(4*d) + ((5*a*b*Sin[c + d*x]^3)/(3 *d) + (a^2 + 4*b^2)*(x/2 - (Cos[c + d*x]*Sin[c + d*x])/(2*d)))/4
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x _)]), x_Symbol] :> Simp[(-b)*((g*Cos[e + f*x])^(p + 1)/(f*g*(p + 1))), x] + Simp[a Int[(g*Cos[e + f*x])^p, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && (IntegerQ[2*p] || NeQ[a^2 - b^2, 0])
Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x _)])^(m_), x_Symbol] :> Simp[(-b)*(g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^(m - 1)/(f*g*(m + p))), x] + Simp[1/(m + p) Int[(g*Cos[e + f*x])^p* (a + b*Sin[e + f*x])^(m - 2)*(b^2*(m - 1) + a^2*(m + p) + a*b*(2*m + p - 1) *Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] && NeQ[m + p, 0] && (IntegersQ[2*m, 2*p] || IntegerQ[m])
Time = 3.82 (sec) , antiderivative size = 77, normalized size of antiderivative = 0.90
method | result | size |
risch | \(\frac {a^{2} x}{8}+\frac {b^{2} x}{2}+\frac {a b \sin \left (d x +c \right )}{2 d}-\frac {\sin \left (4 d x +4 c \right ) a^{2}}{32 d}-\frac {a b \sin \left (3 d x +3 c \right )}{6 d}-\frac {\sin \left (2 d x +2 c \right ) b^{2}}{4 d}\) | \(77\) |
derivativedivides | \(\frac {a^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )^{3}}{4}+\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )+\frac {2 a b \sin \left (d x +c \right )^{3}}{3}+b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(86\) |
default | \(\frac {a^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )^{3}}{4}+\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{8}+\frac {d x}{8}+\frac {c}{8}\right )+\frac {2 a b \sin \left (d x +c \right )^{3}}{3}+b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(86\) |
Input:
int(cos(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)
Output:
1/8*a^2*x+1/2*b^2*x+1/2*a*b*sin(d*x+c)/d-1/32/d*sin(4*d*x+4*c)*a^2-1/6*a*b /d*sin(3*d*x+3*c)-1/4/d*sin(2*d*x+2*c)*b^2
Time = 0.08 (sec) , antiderivative size = 74, normalized size of antiderivative = 0.86 \[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {3 \, {\left (a^{2} + 4 \, b^{2}\right )} d x - {\left (6 \, a^{2} \cos \left (d x + c\right )^{3} + 16 \, a b \cos \left (d x + c\right )^{2} - 16 \, a b - 3 \, {\left (a^{2} - 4 \, b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d} \] Input:
integrate(cos(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="fricas" )
Output:
1/24*(3*(a^2 + 4*b^2)*d*x - (6*a^2*cos(d*x + c)^3 + 16*a*b*cos(d*x + c)^2 - 16*a*b - 3*(a^2 - 4*b^2)*cos(d*x + c))*sin(d*x + c))/d
\[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\int \left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right )^{2} \cos ^{2}{\left (c + d x \right )}\, dx \] Input:
integrate(cos(d*x+c)**2*(a*sin(d*x+c)+b*tan(d*x+c))**2,x)
Output:
Integral((a*sin(c + d*x) + b*tan(c + d*x))**2*cos(c + d*x)**2, x)
Time = 0.03 (sec) , antiderivative size = 66, normalized size of antiderivative = 0.77 \[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {64 \, a b \sin \left (d x + c\right )^{3} + 3 \, {\left (4 \, d x + 4 \, c - \sin \left (4 \, d x + 4 \, c\right )\right )} a^{2} + 24 \, {\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2}}{96 \, d} \] Input:
integrate(cos(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="maxima" )
Output:
1/96*(64*a*b*sin(d*x + c)^3 + 3*(4*d*x + 4*c - sin(4*d*x + 4*c))*a^2 + 24* (2*d*x + 2*c - sin(2*d*x + 2*c))*b^2)/d
Leaf count of result is larger than twice the leaf count of optimal. 5161 vs. \(2 (78) = 156\).
Time = 2.44 (sec) , antiderivative size = 5161, normalized size of antiderivative = 60.01 \[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\text {Too large to display} \] Input:
integrate(cos(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="giac")
Output:
1/8*a^2*x - 1/32*a^2*sin(4*d*x +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x)^2*tan(1/2*d*x)^5*tan(1/2*c)^4*tan(c)^2 + 9*b^2*tan(d*x)*tan (1/2*d*x)^6*tan(1/2*c)^4*tan(c)^2 - 96*a*b*tan(d*x)^2*tan(1/2*d*x)^4*tan(1 /2*c)^5*tan(c)^2 - 32*a*b*tan(d*x)^2*tan(1/2*d*x)^3*tan(1/2*c)^6*tan(c)^2 + 9*b^2*tan(d*x)*tan(1/2*d*x)^4*tan(1/2*c)^6*tan(c)^2 + 9*b^2*d*x*tan(d*x) ^2*tan(1/2*d*x)^6*tan(1/2*c)^2 + 27*b^2*d*x*tan(d*x)^2*tan(1/2*d*x)^4*t...
Time = 15.92 (sec) , antiderivative size = 76, normalized size of antiderivative = 0.88 \[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {a^2\,x}{8}+\frac {b^2\,x}{2}-\frac {a^2\,\sin \left (4\,c+4\,d\,x\right )}{32\,d}-\frac {b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {a\,b\,\sin \left (c+d\,x\right )}{2\,d}-\frac {a\,b\,\sin \left (3\,c+3\,d\,x\right )}{6\,d} \] Input:
int(cos(c + d*x)^2*(a*sin(c + d*x) + b*tan(c + d*x))^2,x)
Output:
(a^2*x)/8 + (b^2*x)/2 - (a^2*sin(4*c + 4*d*x))/(32*d) - (b^2*sin(2*c + 2*d *x))/(4*d) + (a*b*sin(c + d*x))/(2*d) - (a*b*sin(3*c + 3*d*x))/(6*d)
Time = 0.17 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.99 \[ \int \cos ^2(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx=\frac {6 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{3} a^{2}-3 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a^{2}-12 \cos \left (d x +c \right ) \sin \left (d x +c \right ) b^{2}+16 \sin \left (d x +c \right )^{3} a b +3 a^{2} d x +12 b^{2} d x}{24 d} \] Input:
int(cos(d*x+c)^2*(a*sin(d*x+c)+b*tan(d*x+c))^2,x)
Output:
(6*cos(c + d*x)*sin(c + d*x)**3*a**2 - 3*cos(c + d*x)*sin(c + d*x)*a**2 - 12*cos(c + d*x)*sin(c + d*x)*b**2 + 16*sin(c + d*x)**3*a*b + 3*a**2*d*x + 12*b**2*d*x)/(24*d)