解法一:∫(-π,π) xcosxdx=∫(-π,π)xd(sinx)
=(xsinx)│(-π,π)-∫(-π,π)sinxdx (应用分部积分法)
=(cosx)│(-π,π)
=cos(π)-cos(-π)
=0;
解法二:∫(-π,π) xcosxdx=∫(-π,0) xcosxdx+∫(0,π) xcosxdx
=∫(π,0) (-x)cos(-x)d(-x)+∫(0,π) xcosxdx (第一个积分用-x代换x)
=-∫(0,π) xcosxdx+∫(0,π) xcosxdx
=0.