3.2.5 \(\int \frac {\sin ^2(x)}{x} \, dx\) [105]

Optimal. Leaf size=15 \[ -\frac {\text {Ci}(2 x)}{2}+\frac {\log (x)}{2} \]

[Out]

-1/2*Ci(2*x)+1/2*ln(x)

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 15, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3393, 3383} \begin {gather*} \frac {\log (x)}{2}-\frac {\text {Ci}(2 x)}{2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sin[x]^2/x,x]

[Out]

-1/2*CosIntegral[2*x] + Log[x]/2

Rule 3383

Int[sin[(e_.) + (f_.)*(x_)]/((c_.) + (d_.)*(x_)), x_Symbol] :> Simp[CosIntegral[e - Pi/2 + f*x]/d, x] /; FreeQ
[{c, d, e, f}, x] && EqQ[d*(e - Pi/2) - c*f, 0]

Rule 3393

Int[((c_.) + (d_.)*(x_))^(m_)*sin[(e_.) + (f_.)*(x_)]^(n_), x_Symbol] :> Int[ExpandTrigReduce[(c + d*x)^m, Sin
[e + f*x]^n, x], x] /; FreeQ[{c, d, e, f, m}, x] && IGtQ[n, 1] && ( !RationalQ[m] || (GeQ[m, -1] && LtQ[m, 1])
)

Rubi steps

\begin {align*} \int \frac {\sin ^2(x)}{x} \, dx &=\int \left (\frac {1}{2 x}-\frac {\cos (2 x)}{2 x}\right ) \, dx\\ &=\frac {\log (x)}{2}-\frac {1}{2} \int \frac {\cos (2 x)}{x} \, dx\\ &=-\frac {\text {Ci}(2 x)}{2}+\frac {\log (x)}{2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 15, normalized size = 1.00 \begin {gather*} -\frac {\text {Ci}(2 x)}{2}+\frac {\log (x)}{2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]^2/x,x]

[Out]

-1/2*CosIntegral[2*x] + Log[x]/2

________________________________________________________________________________________

Mathics [C] Result contains higher order function than in optimal. Order 9 vs. order 4 in optimal.
time = 2.28, size = 11, normalized size = 0.73 \begin {gather*} -\frac {\text {Ci}\left [2 x\right ]}{2}+\frac {\text {Log}\left [x\right ]}{2} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

mathics('Integrate[Sin[x]^2/x,x]')

[Out]

-Ci[2 x] / 2 + Log[x] / 2

________________________________________________________________________________________

Maple [A]
time = 0.03, size = 12, normalized size = 0.80

method result size
default \(-\frac {\cosineIntegral \left (2 x \right )}{2}+\frac {\ln \left (x \right )}{2}\) \(12\)
risch \(-\frac {\cosineIntegral \left (2 x \right )}{2}+\frac {i \pi \,\mathrm {csgn}\left (i x \right ) \mathrm {csgn}\left (x \right )}{4}-\frac {i \pi \,\mathrm {csgn}\left (i x \right )}{4}+\frac {\ln \left (x \right )}{2}\) \(32\)
meijerg \(\frac {\sqrt {\pi }\, \left (\frac {2 \gamma }{\sqrt {\pi }}+\frac {2 \ln \left (2\right )}{\sqrt {\pi }}+\frac {2 \ln \left (x \right )}{\sqrt {\pi }}-\frac {2 \cosineIntegral \left (2 x \right )}{\sqrt {\pi }}\right )}{4}\) \(36\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/x,x,method=_RETURNVERBOSE)

[Out]

-1/2*Ci(2*x)+1/2*ln(x)

________________________________________________________________________________________

Maxima [C] Result contains complex when optimal does not.
time = 0.29, size = 17, normalized size = 1.13 \begin {gather*} -\frac {1}{4} \, {\rm Ei}\left (2 i \, x\right ) - \frac {1}{4} \, {\rm Ei}\left (-2 i \, x\right ) + \frac {1}{2} \, \log \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/x,x, algorithm="maxima")

[Out]

-1/4*Ei(2*I*x) - 1/4*Ei(-2*I*x) + 1/2*log(x)

________________________________________________________________________________________

Fricas [A]
time = 0.33, size = 17, normalized size = 1.13 \begin {gather*} -\frac {1}{4} \, \operatorname {Ci}\left (2 \, x\right ) - \frac {1}{4} \, \operatorname {Ci}\left (-2 \, x\right ) + \frac {1}{2} \, \log \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/x,x, algorithm="fricas")

[Out]

-1/4*cos_integral(2*x) - 1/4*cos_integral(-2*x) + 1/2*log(x)

________________________________________________________________________________________

Sympy [A]
time = 0.58, size = 10, normalized size = 0.67 \begin {gather*} \frac {\log {\left (x \right )}}{2} - \frac {\operatorname {Ci}{\left (2 x \right )}}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)**2/x,x)

[Out]

log(x)/2 - Ci(2*x)/2

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 16, normalized size = 1.07 \begin {gather*} -\frac {1}{2} \mathrm {Ci}\left (2 x\right )+\frac {1}{2} \ln x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)^2/x,x)

[Out]

-1/2*cos_integral(2*x) + 1/2*log(x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.07 \begin {gather*} \frac {\ln \left (x\right )}{2}-\frac {\mathrm {cosint}\left (2\,x\right )}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)^2/x,x)

[Out]

log(x)/2 - cosint(2*x)/2

________________________________________________________________________________________