Page 148

Warning :  Not fully debugged!

Integrate[x Sin[r x], {x, 0, π}]

Integrate[(x^3) Sin[r x], {x, 0, π}]

c[r_] := 12 ((((-1))^(r + 1))/(r^3));

g[x_] := NSum[c[r] Sin[r x], {r, 1, 10}];

\(ni = Table[i, {i, \(-4\), 12}]; 
xi = ni*π\/4; 
gi = Map[g, xi]; 
    
fi = N[Map[Function[x, \(π\^2\) x - x\^3], xi]]; \)

\(lpApprox = ListPlot[Thread[xi, gi], 
		DisplayFunction -> Identity]; 
    
lpTrue = ListPlot[Thread[xi, fi], 
		DisplayFunction -> Identity]; 

    Show[{lpApprox, lpTrue}, 
	DisplayFunction -> $DisplayFunction]; \)