3.1.7 \(\int x^2 \sin ^2(a+b \log (c x^n)) \, dx\) [7]

Optimal. Leaf size=97 \[ \frac {2 b^2 n^2 x^3}{3 \left (9+4 b^2 n^2\right )}-\frac {2 b n x^3 \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{9+4 b^2 n^2}+\frac {3 x^3 \sin ^2\left (a+b \log \left (c x^n\right )\right )}{9+4 b^2 n^2} \]

[Out]

2/3*b^2*n^2*x^3/(4*b^2*n^2+9)-2*b*n*x^3*cos(a+b*ln(c*x^n))*sin(a+b*ln(c*x^n))/(4*b^2*n^2+9)+3*x^3*sin(a+b*ln(c
*x^n))^2/(4*b^2*n^2+9)

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 97, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {4575, 30} \begin {gather*} \frac {3 x^3 \sin ^2\left (a+b \log \left (c x^n\right )\right )}{4 b^2 n^2+9}-\frac {2 b n x^3 \sin \left (a+b \log \left (c x^n\right )\right ) \cos \left (a+b \log \left (c x^n\right )\right )}{4 b^2 n^2+9}+\frac {2 b^2 n^2 x^3}{3 \left (4 b^2 n^2+9\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x^2*Sin[a + b*Log[c*x^n]]^2,x]

[Out]

(2*b^2*n^2*x^3)/(3*(9 + 4*b^2*n^2)) - (2*b*n*x^3*Cos[a + b*Log[c*x^n]]*Sin[a + b*Log[c*x^n]])/(9 + 4*b^2*n^2)
+ (3*x^3*Sin[a + b*Log[c*x^n]]^2)/(9 + 4*b^2*n^2)

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 4575

Int[((e_.)*(x_))^(m_.)*Sin[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*(d_.)]^(p_), x_Symbol] :> Simp[(m + 1)*(e*x)^
(m + 1)*(Sin[d*(a + b*Log[c*x^n])]^p/(b^2*d^2*e*n^2*p^2 + e*(m + 1)^2)), x] + (Dist[b^2*d^2*n^2*p*((p - 1)/(b^
2*d^2*n^2*p^2 + (m + 1)^2)), Int[(e*x)^m*Sin[d*(a + b*Log[c*x^n])]^(p - 2), x], x] - Simp[b*d*n*p*(e*x)^(m + 1
)*Cos[d*(a + b*Log[c*x^n])]*(Sin[d*(a + b*Log[c*x^n])]^(p - 1)/(b^2*d^2*e*n^2*p^2 + e*(m + 1)^2)), x]) /; Free
Q[{a, b, c, d, e, m, n}, x] && IGtQ[p, 1] && NeQ[b^2*d^2*n^2*p^2 + (m + 1)^2, 0]

Rubi steps

\begin {align*} \int x^2 \sin ^2\left (a+b \log \left (c x^n\right )\right ) \, dx &=-\frac {2 b n x^3 \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{9+4 b^2 n^2}+\frac {3 x^3 \sin ^2\left (a+b \log \left (c x^n\right )\right )}{9+4 b^2 n^2}+\frac {\left (2 b^2 n^2\right ) \int x^2 \, dx}{9+4 b^2 n^2}\\ &=\frac {2 b^2 n^2 x^3}{3 \left (9+4 b^2 n^2\right )}-\frac {2 b n x^3 \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{9+4 b^2 n^2}+\frac {3 x^3 \sin ^2\left (a+b \log \left (c x^n\right )\right )}{9+4 b^2 n^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.17, size = 61, normalized size = 0.63 \begin {gather*} \frac {x^3 \left (9+4 b^2 n^2-9 \cos \left (2 \left (a+b \log \left (c x^n\right )\right )\right )-6 b n \sin \left (2 \left (a+b \log \left (c x^n\right )\right )\right )\right )}{6 \left (9+4 b^2 n^2\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x^2*Sin[a + b*Log[c*x^n]]^2,x]

[Out]

(x^3*(9 + 4*b^2*n^2 - 9*Cos[2*(a + b*Log[c*x^n])] - 6*b*n*Sin[2*(a + b*Log[c*x^n])]))/(6*(9 + 4*b^2*n^2))

________________________________________________________________________________________

Maple [F]
time = 0.07, size = 0, normalized size = 0.00 \[\int x^{2} \left (\sin ^{2}\left (a +b \ln \left (c \,x^{n}\right )\right )\right )\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2*sin(a+b*ln(c*x^n))^2,x)

[Out]

int(x^2*sin(a+b*ln(c*x^n))^2,x)

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 301 vs. \(2 (95) = 190\).
time = 0.30, size = 301, normalized size = 3.10 \begin {gather*} -\frac {3 \, {\left (2 \, {\left (b \cos \left (2 \, b \log \left (c\right )\right ) \sin \left (4 \, b \log \left (c\right )\right ) - b \cos \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) + b \sin \left (2 \, b \log \left (c\right )\right )\right )} n + 3 \, \cos \left (4 \, b \log \left (c\right )\right ) \cos \left (2 \, b \log \left (c\right )\right ) + 3 \, \sin \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) + 3 \, \cos \left (2 \, b \log \left (c\right )\right )\right )} x^{3} \cos \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right ) + 3 \, {\left (2 \, {\left (b \cos \left (4 \, b \log \left (c\right )\right ) \cos \left (2 \, b \log \left (c\right )\right ) + b \sin \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) + b \cos \left (2 \, b \log \left (c\right )\right )\right )} n - 3 \, \cos \left (2 \, b \log \left (c\right )\right ) \sin \left (4 \, b \log \left (c\right )\right ) + 3 \, \cos \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) - 3 \, \sin \left (2 \, b \log \left (c\right )\right )\right )} x^{3} \sin \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right ) - 2 \, {\left (4 \, {\left (b^{2} \cos \left (2 \, b \log \left (c\right )\right )^{2} + b^{2} \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )} n^{2} + 9 \, \cos \left (2 \, b \log \left (c\right )\right )^{2} + 9 \, \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )} x^{3}}{12 \, {\left (4 \, {\left (b^{2} \cos \left (2 \, b \log \left (c\right )\right )^{2} + b^{2} \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )} n^{2} + 9 \, \cos \left (2 \, b \log \left (c\right )\right )^{2} + 9 \, \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*sin(a+b*log(c*x^n))^2,x, algorithm="maxima")

[Out]

-1/12*(3*(2*(b*cos(2*b*log(c))*sin(4*b*log(c)) - b*cos(4*b*log(c))*sin(2*b*log(c)) + b*sin(2*b*log(c)))*n + 3*
cos(4*b*log(c))*cos(2*b*log(c)) + 3*sin(4*b*log(c))*sin(2*b*log(c)) + 3*cos(2*b*log(c)))*x^3*cos(2*b*log(x^n)
+ 2*a) + 3*(2*(b*cos(4*b*log(c))*cos(2*b*log(c)) + b*sin(4*b*log(c))*sin(2*b*log(c)) + b*cos(2*b*log(c)))*n -
3*cos(2*b*log(c))*sin(4*b*log(c)) + 3*cos(4*b*log(c))*sin(2*b*log(c)) - 3*sin(2*b*log(c)))*x^3*sin(2*b*log(x^n
) + 2*a) - 2*(4*(b^2*cos(2*b*log(c))^2 + b^2*sin(2*b*log(c))^2)*n^2 + 9*cos(2*b*log(c))^2 + 9*sin(2*b*log(c))^
2)*x^3)/(4*(b^2*cos(2*b*log(c))^2 + b^2*sin(2*b*log(c))^2)*n^2 + 9*cos(2*b*log(c))^2 + 9*sin(2*b*log(c))^2)

________________________________________________________________________________________

Fricas [A]
time = 4.61, size = 80, normalized size = 0.82 \begin {gather*} -\frac {6 \, b n x^{3} \cos \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) \sin \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right ) + 9 \, x^{3} \cos \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2} - {\left (2 \, b^{2} n^{2} + 9\right )} x^{3}}{3 \, {\left (4 \, b^{2} n^{2} + 9\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*sin(a+b*log(c*x^n))^2,x, algorithm="fricas")

[Out]

-1/3*(6*b*n*x^3*cos(b*n*log(x) + b*log(c) + a)*sin(b*n*log(x) + b*log(c) + a) + 9*x^3*cos(b*n*log(x) + b*log(c
) + a)^2 - (2*b^2*n^2 + 9)*x^3)/(4*b^2*n^2 + 9)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \begin {cases} \int x^{2} \sin ^{2}{\left (a - \frac {3 i \log {\left (c x^{n} \right )}}{2 n} \right )}\, dx & \text {for}\: b = - \frac {3 i}{2 n} \\\int x^{2} \sin ^{2}{\left (a + \frac {3 i \log {\left (c x^{n} \right )}}{2 n} \right )}\, dx & \text {for}\: b = \frac {3 i}{2 n} \\\frac {2 b^{2} n^{2} x^{3} \sin ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{12 b^{2} n^{2} + 27} + \frac {2 b^{2} n^{2} x^{3} \cos ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{12 b^{2} n^{2} + 27} - \frac {6 b n x^{3} \sin {\left (a + b \log {\left (c x^{n} \right )} \right )} \cos {\left (a + b \log {\left (c x^{n} \right )} \right )}}{12 b^{2} n^{2} + 27} + \frac {9 x^{3} \sin ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{12 b^{2} n^{2} + 27} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**2*sin(a+b*ln(c*x**n))**2,x)

[Out]

Piecewise((Integral(x**2*sin(a - 3*I*log(c*x**n)/(2*n))**2, x), Eq(b, -3*I/(2*n))), (Integral(x**2*sin(a + 3*I
*log(c*x**n)/(2*n))**2, x), Eq(b, 3*I/(2*n))), (2*b**2*n**2*x**3*sin(a + b*log(c*x**n))**2/(12*b**2*n**2 + 27)
 + 2*b**2*n**2*x**3*cos(a + b*log(c*x**n))**2/(12*b**2*n**2 + 27) - 6*b*n*x**3*sin(a + b*log(c*x**n))*cos(a +
b*log(c*x**n))/(12*b**2*n**2 + 27) + 9*x**3*sin(a + b*log(c*x**n))**2/(12*b**2*n**2 + 27), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 833 vs. \(2 (95) = 190\).
time = 0.53, size = 833, normalized size = 8.59 \begin {gather*} \frac {1}{6} \, x^{3} + \frac {4 \, b n x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right ) + 4 \, b n x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right ) + 4 \, b n x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right )^{2} + 4 \, b n x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right )^{2} - 3 \, x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} - 3 \, x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} - 4 \, b n x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) - 4 \, b n x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) - 4 \, b n x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (a\right ) - 4 \, b n x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (a\right ) + 3 \, x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + 3 \, x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + 12 \, x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right ) + 12 \, x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right ) \tan \left (a\right ) + 3 \, x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} \tan \left (a\right )^{2} + 3 \, x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )} \tan \left (a\right )^{2} - 3 \, x^{3} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} - 3 \, x^{3} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )}}{4 \, {\left (4 \, b^{2} n^{2} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} + 4 \, b^{2} n^{2} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + 4 \, b^{2} n^{2} \tan \left (a\right )^{2} + 4 \, b^{2} n^{2} + 9 \, \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} \tan \left (a\right )^{2} + 9 \, \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + 9 \, \tan \left (a\right )^{2} + 9\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*sin(a+b*log(c*x^n))^2,x, algorithm="giac")

[Out]

1/6*x^3 + 1/4*(4*b*n*x^3*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))^
2*tan(a) + 4*b*n*x^3*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))^2*t
an(a) + 4*b*n*x^3*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))*tan(a)^
2 + 4*b*n*x^3*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))*tan(a)^2 -
 3*x^3*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))^2*tan(a)^2 - 3*x^3
*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))^2*tan(a)^2 - 4*b*n*x^3*
e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c))) - 4*b*n*x^3*e^(-pi*b*n*sg
n(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c))) - 4*b*n*x^3*e^(pi*b*n*sgn(x) - pi*b*n
 + pi*b*sgn(c) - pi*b)*tan(a) - 4*b*n*x^3*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(a) + 3*x^3*e^(p
i*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))^2 + 3*x^3*e^(-pi*b*n*sgn(x) +
 pi*b*n - pi*b*sgn(c) + pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))^2 + 12*x^3*e^(pi*b*n*sgn(x) - pi*b*n + pi*b
*sgn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))*tan(a) + 12*x^3*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c)
+ pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))*tan(a) + 3*x^3*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*ta
n(a)^2 + 3*x^3*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(a)^2 - 3*x^3*e^(pi*b*n*sgn(x) - pi*b*n + p
i*b*sgn(c) - pi*b) - 3*x^3*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b))/(4*b^2*n^2*tan(b*n*log(abs(x)) +
b*log(abs(c)))^2*tan(a)^2 + 4*b^2*n^2*tan(b*n*log(abs(x)) + b*log(abs(c)))^2 + 4*b^2*n^2*tan(a)^2 + 4*b^2*n^2
+ 9*tan(b*n*log(abs(x)) + b*log(abs(c)))^2*tan(a)^2 + 9*tan(b*n*log(abs(x)) + b*log(abs(c)))^2 + 9*tan(a)^2 +
9)

________________________________________________________________________________________

Mupad [B]
time = 3.28, size = 67, normalized size = 0.69 \begin {gather*} \frac {x^3}{6}-\frac {x^3\,{\mathrm {e}}^{-a\,2{}\mathrm {i}}\,\frac {1}{{\left (c\,x^n\right )}^{b\,2{}\mathrm {i}}}\,1{}\mathrm {i}}{8\,b\,n+12{}\mathrm {i}}-\frac {x^3\,{\mathrm {e}}^{a\,2{}\mathrm {i}}\,{\left (c\,x^n\right )}^{b\,2{}\mathrm {i}}}{12+b\,n\,8{}\mathrm {i}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2*sin(a + b*log(c*x^n))^2,x)

[Out]

x^3/6 - (x^3*exp(-a*2i)/(c*x^n)^(b*2i)*1i)/(8*b*n + 12i) - (x^3*exp(a*2i)*(c*x^n)^(b*2i))/(b*n*8i + 12)

________________________________________________________________________________________