I calculated an integral g when printed grives:
Piecewise((sin(w/2)/w - 2*cos(w/2)/w**2 + 4*sin(w/2)/w**3, Ne(w, 0)), (2/3, True)) + 2*Piecewise((-sin(w/2)/(2*w) + cos(w/2)/w**2 + sin(w/2)/w**3 - sin(3*w/2)/w**3, Ne(w, 0)), (1/6, True))
First, how can I extract from g (without cutting and pasting the output) what I really want which is:
(sin(w/2)/w - 2*cos(w/2)/w**2 + 4*sin(w/2)/w**3)+2*(-sin(w/2)/(2*w) + cos(w/2)/w**2 + sin(w/2)/w**3 - sin(3*w/2)/w**3)
Secondly, I can substitute y = w/2. In the resulting expression force expansion of sin(3*y). trigsimp doesn't do that. I know the answer is supposed to be of the form (sin(y)/y)**3.