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

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

[Out]

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

________________________________________________________________________________________

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

Antiderivative was successfully verified.

[In]

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

[Out]

(b^2*n^2*x^2)/(4*(1 + b^2*n^2)) - (b*n*x^2*Cos[a + b*Log[c*x^n]]*Sin[a + b*Log[c*x^n]])/(2*(1 + b^2*n^2)) + (x
^2*Sin[a + b*Log[c*x^n]]^2)/(2*(1 + 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 \sin ^2\left (a+b \log \left (c x^n\right )\right ) \, dx &=-\frac {b n x^2 \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{2 \left (1+b^2 n^2\right )}+\frac {x^2 \sin ^2\left (a+b \log \left (c x^n\right )\right )}{2 \left (1+b^2 n^2\right )}+\frac {\left (b^2 n^2\right ) \int x \, dx}{2 \left (1+b^2 n^2\right )}\\ &=\frac {b^2 n^2 x^2}{4 \left (1+b^2 n^2\right )}-\frac {b n x^2 \cos \left (a+b \log \left (c x^n\right )\right ) \sin \left (a+b \log \left (c x^n\right )\right )}{2 \left (1+b^2 n^2\right )}+\frac {x^2 \sin ^2\left (a+b \log \left (c x^n\right )\right )}{2 \left (1+b^2 n^2\right )}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.13, size = 57, normalized size = 0.58 \begin {gather*} \frac {x^2 \left (1+b^2 n^2-\cos \left (2 \left (a+b \log \left (c x^n\right )\right )\right )-b n \sin \left (2 \left (a+b \log \left (c x^n\right )\right )\right )\right )}{4+4 b^2 n^2} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

Maple [F]
time = 0.05, size = 0, normalized size = 0.00 \[\int x \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*sin(a+b*ln(c*x^n))^2,x)

[Out]

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

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 282 vs. \(2 (92) = 184\).
time = 0.29, size = 282, normalized size = 2.88 \begin {gather*} -\frac {{\left ({\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 + \cos \left (4 \, b \log \left (c\right )\right ) \cos \left (2 \, b \log \left (c\right )\right ) + \sin \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) + \cos \left (2 \, b \log \left (c\right )\right )\right )} x^{2} \cos \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right ) + {\left ({\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 - \cos \left (2 \, b \log \left (c\right )\right ) \sin \left (4 \, b \log \left (c\right )\right ) + \cos \left (4 \, b \log \left (c\right )\right ) \sin \left (2 \, b \log \left (c\right )\right ) - \sin \left (2 \, b \log \left (c\right )\right )\right )} x^{2} \sin \left (2 \, b \log \left (x^{n}\right ) + 2 \, a\right ) - 2 \, {\left ({\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} + \cos \left (2 \, b \log \left (c\right )\right )^{2} + \sin \left (2 \, b \log \left (c\right )\right )^{2}\right )} x^{2}}{8 \, {\left ({\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} + \cos \left (2 \, b \log \left (c\right )\right )^{2} + \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*sin(a+b*log(c*x^n))^2,x, algorithm="maxima")

[Out]

-1/8*(((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 + cos(4*b
*log(c))*cos(2*b*log(c)) + sin(4*b*log(c))*sin(2*b*log(c)) + cos(2*b*log(c)))*x^2*cos(2*b*log(x^n) + 2*a) + ((
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 - cos(2*b*log(c))
*sin(4*b*log(c)) + cos(4*b*log(c))*sin(2*b*log(c)) - sin(2*b*log(c)))*x^2*sin(2*b*log(x^n) + 2*a) - 2*((b^2*co
s(2*b*log(c))^2 + b^2*sin(2*b*log(c))^2)*n^2 + cos(2*b*log(c))^2 + sin(2*b*log(c))^2)*x^2)/((b^2*cos(2*b*log(c
))^2 + b^2*sin(2*b*log(c))^2)*n^2 + cos(2*b*log(c))^2 + sin(2*b*log(c))^2)

________________________________________________________________________________________

Fricas [A]
time = 2.34, size = 78, normalized size = 0.80 \begin {gather*} -\frac {2 \, b n x^{2} \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 ) + 2 \, x^{2} \cos \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2} - {\left (b^{2} n^{2} + 2\right )} x^{2}}{4 \, {\left (b^{2} n^{2} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \begin {cases} \int x \sin ^{2}{\left (a - \frac {i \log {\left (c x^{n} \right )}}{n} \right )}\, dx & \text {for}\: b = - \frac {i}{n} \\\int x \sin ^{2}{\left (a + \frac {i \log {\left (c x^{n} \right )}}{n} \right )}\, dx & \text {for}\: b = \frac {i}{n} \\\frac {b^{2} n^{2} x^{2} \sin ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{4 b^{2} n^{2} + 4} + \frac {b^{2} n^{2} x^{2} \cos ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{4 b^{2} n^{2} + 4} - \frac {2 b n x^{2} \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} + 4} + \frac {2 x^{2} \sin ^{2}{\left (a + b \log {\left (c x^{n} \right )} \right )}}{4 b^{2} n^{2} + 4} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Piecewise((Integral(x*sin(a - I*log(c*x**n)/n)**2, x), Eq(b, -I/n)), (Integral(x*sin(a + I*log(c*x**n)/n)**2,
x), Eq(b, I/n)), (b**2*n**2*x**2*sin(a + b*log(c*x**n))**2/(4*b**2*n**2 + 4) + b**2*n**2*x**2*cos(a + b*log(c*
x**n))**2/(4*b**2*n**2 + 4) - 2*b*n*x**2*sin(a + b*log(c*x**n))*cos(a + b*log(c*x**n))/(4*b**2*n**2 + 4) + 2*x
**2*sin(a + b*log(c*x**n))**2/(4*b**2*n**2 + 4), True))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 820 vs. \(2 (92) = 184\).
time = 0.55, size = 820, normalized size = 8.37 \begin {gather*} \frac {1}{4} \, x^{2} + \frac {2 \, b n x^{2} 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 \, b n x^{2} 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 \, b n x^{2} 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} + 2 \, b n x^{2} 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} - x^{2} 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} - x^{2} 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} - 2 \, b n x^{2} 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 \, b n x^{2} 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 \, b n x^{2} 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 \, b n x^{2} 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 ) + x^{2} 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} + x^{2} 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} + 4 \, x^{2} 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 ) + 4 \, x^{2} 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 ) + x^{2} 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} + x^{2} 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} - x^{2} e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} - x^{2} e^{\left (-\pi b n \mathrm {sgn}\left (x\right ) + \pi b n - \pi b \mathrm {sgn}\left (c\right ) + \pi b\right )}}{8 \, {\left (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} + b^{2} n^{2} \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + b^{2} n^{2} \tan \left (a\right )^{2} + 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} + \tan \left (b n \log \left ({\left | x \right |}\right ) + b \log \left ({\left | c \right |}\right )\right )^{2} + \tan \left (a\right )^{2} + 1\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/4*x^2 + 1/8*(2*b*n*x^2*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*b*n*x^2*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) + 2*b*n*x^2*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 + 2*b*n*x^2*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 -
 x^2*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 - x^2*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 - 2*b*n*x^2*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*b*n*x^2*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*b*n*x^2*e^(pi*b*n*sgn(x) - pi*b*n + p
i*b*sgn(c) - pi*b)*tan(a) - 2*b*n*x^2*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(a) + x^2*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 + x^2*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 + 4*x^2*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) + 4*x^2*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*ta
n(b*n*log(abs(x)) + b*log(abs(c)))*tan(a) + x^2*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*tan(a)^2 + x^2
*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(a)^2 - x^2*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*
b) - x^2*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b))/(b^2*n^2*tan(b*n*log(abs(x)) + b*log(abs(c)))^2*tan
(a)^2 + b^2*n^2*tan(b*n*log(abs(x)) + b*log(abs(c)))^2 + b^2*n^2*tan(a)^2 + b^2*n^2 + tan(b*n*log(abs(x)) + b*
log(abs(c)))^2*tan(a)^2 + tan(b*n*log(abs(x)) + b*log(abs(c)))^2 + tan(a)^2 + 1)

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________