3.1.56 \(\int x \cos (\pi x) \, dx\) [56]

Optimal. Leaf size=18 \[ \frac {\cos (\pi x)}{\pi ^2}+\frac {x \sin (\pi x)}{\pi } \]

[Out]

cos(Pi*x)/Pi^2+x*sin(Pi*x)/Pi

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3377, 2718} \begin {gather*} \frac {x \sin (\pi x)}{\pi }+\frac {\cos (\pi x)}{\pi ^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x*Cos[Pi*x],x]

[Out]

Cos[Pi*x]/Pi^2 + (x*Sin[Pi*x])/Pi

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3377

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(-(c + d*x)^m)*(Cos[e + f*x]/f), x]
+ Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rubi steps

\begin {align*} \int x \cos (\pi x) \, dx &=\frac {x \sin (\pi x)}{\pi }-\frac {\int \sin (\pi x) \, dx}{\pi }\\ &=\frac {\cos (\pi x)}{\pi ^2}+\frac {x \sin (\pi x)}{\pi }\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.01, size = 18, normalized size = 1.00 \begin {gather*} \frac {\cos (\pi x)}{\pi ^2}+\frac {x \sin (\pi x)}{\pi } \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x*Cos[Pi*x],x]

[Out]

Cos[Pi*x]/Pi^2 + (x*Sin[Pi*x])/Pi

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 17, normalized size = 0.94

method result size
derivativedivides \(\frac {\cos \left (\pi x \right )+x \pi \sin \left (\pi x \right )}{\pi ^{2}}\) \(17\)
default \(\frac {\cos \left (\pi x \right )+x \pi \sin \left (\pi x \right )}{\pi ^{2}}\) \(17\)
risch \(\frac {\cos \left (\pi x \right )}{\pi ^{2}}+\frac {x \sin \left (\pi x \right )}{\pi }\) \(19\)
norman \(\frac {\frac {2 x \tan \left (\frac {\pi x}{2}\right )}{\pi }+\frac {2}{\pi ^{2}}}{1+\tan ^{2}\left (\frac {\pi x}{2}\right )}\) \(30\)
meijerg \(\frac {-\frac {1}{\sqrt {\pi }}+\frac {\cos \left (\pi x \right )}{\sqrt {\pi }}+\sqrt {\pi }\, x \sin \left (\pi x \right )}{\pi ^{\frac {3}{2}}}\) \(31\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cos(Pi*x),x,method=_RETURNVERBOSE)

[Out]

1/Pi^2*(cos(Pi*x)+x*Pi*sin(Pi*x))

________________________________________________________________________________________

Maxima [A]
time = 1.15, size = 16, normalized size = 0.89 \begin {gather*} \frac {\pi x \sin \left (\pi x\right ) + \cos \left (\pi x\right )}{\pi ^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(pi*x),x, algorithm="maxima")

[Out]

(pi*x*sin(pi*x) + cos(pi*x))/pi^2

________________________________________________________________________________________

Fricas [A]
time = 0.64, size = 16, normalized size = 0.89 \begin {gather*} \frac {\pi x \sin \left (\pi x\right ) + \cos \left (\pi x\right )}{\pi ^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(pi*x),x, algorithm="fricas")

[Out]

(pi*x*sin(pi*x) + cos(pi*x))/pi^2

________________________________________________________________________________________

Sympy [A]
time = 0.06, size = 15, normalized size = 0.83 \begin {gather*} \frac {x \sin {\left (\pi x \right )}}{\pi } + \frac {\cos {\left (\pi x \right )}}{\pi ^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(pi*x),x)

[Out]

x*sin(pi*x)/pi + cos(pi*x)/pi**2

________________________________________________________________________________________

Giac [A]
time = 0.67, size = 18, normalized size = 1.00 \begin {gather*} \frac {x \sin \left (\pi x\right )}{\pi } + \frac {\cos \left (\pi x\right )}{\pi ^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cos(pi*x),x, algorithm="giac")

[Out]

x*sin(pi*x)/pi + cos(pi*x)/pi^2

________________________________________________________________________________________

Mupad [B]
time = 0.02, size = 16, normalized size = 0.89 \begin {gather*} \frac {\cos \left (\Pi \,x\right )+\Pi \,x\,\sin \left (\Pi \,x\right )}{\Pi ^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cos(Pi*x),x)

[Out]

(cos(Pi*x) + Pi*x*sin(Pi*x))/Pi^2

________________________________________________________________________________________