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

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

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 88, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {4565, 8} \begin {gather*} \frac {x \sin ^2\left (a+b \log \left (c x^n\right )\right )}{4 b^2 n^2+1}-\frac {2 b n x \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+1}+\frac {2 b^2 n^2 x}{4 b^2 n^2+1} \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 4565

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

Rubi steps

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

________________________________________________________________________________________

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

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

[Out]

-1/4*((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 + 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*cos(2*b*log(x^n) + 2*a) + (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 - 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*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 + cos(2*b*log(c))^2 + sin(2*b*log(c))^2)*x)/(4*(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.76, size = 73, normalized size = 0.83 \begin {gather*} -\frac {2 \, b n x \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 ) + x \cos \left (b n \log \left (x\right ) + b \log \left (c\right ) + a\right )^{2} - {\left (2 \, b^{2} n^{2} + 1\right )} x}{4 \, b^{2} n^{2} + 1} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 786 vs. \(2 (88) = 176\).
time = 0.50, size = 786, normalized size = 8.93 \begin {gather*} \frac {1}{2} \, x + \frac {4 \, b n x 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 e^{\left (\pi b n \mathrm {sgn}\left (x\right ) - \pi b n + \pi b \mathrm {sgn}\left (c\right ) - \pi b\right )} - x 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} + \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(sin(a+b*log(c*x^n))^2,x, algorithm="giac")

[Out]

1/2*x + 1/4*(4*b*n*x*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*ta
n(a) + 4*b*n*x*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*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*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*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*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*e^(pi*b*n*sgn(x) - p
i*b*n + pi*b*sgn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c))) - 4*b*n*x*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*s
gn(c) + pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c))) - 4*b*n*x*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*t
an(a) - 4*b*n*x*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b*sgn(c) + pi*b)*tan(a) + x*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*s
gn(c) - pi*b)*tan(b*n*log(abs(x)) + b*log(abs(c)))^2 + x*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*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*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) + x*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b)*tan(a)^2 + x*e^(-pi*b*n*sgn(x) + pi*b*n - pi*b
*sgn(c) + pi*b)*tan(a)^2 - x*e^(pi*b*n*sgn(x) - pi*b*n + pi*b*sgn(c) - pi*b) - x*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 + 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.47, size = 56, normalized size = 0.64 \begin {gather*} \frac {x\,\left (2\,{\sin \left (a+b\,\ln \left (c\,x^n\right )\right )}^2+4\,b^2\,n^2-2\,b\,n\,\sin \left (2\,a+2\,b\,\ln \left (c\,x^n\right )\right )\right )}{8\,b^2\,n^2+2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________