
To define a piecewise function, I usually use a chained sequence of numpy.where.
First, the domain for the independent variable, then the conditions and the analytical expression, with a difference for the last where, as explained in the docs.
NB: are you sure that the circular frequency of the sines is 2π? when I see a domain expressed in multiples of π I think immediately to frequencies expressed as integer numbers or simple fractions…
from numpy import exp,linspace, pi, sin, where
from matplotlib.pyplot import grid, plot, show
x = linspace(-10*pi, +10*pi, 4001)
y = where(x < -pi, 4*pi*exp(+x/10)*sin(1*x),
where(x <-pi/2, 0,
where(x <+pi/2, 4*x*x/pi-pi,
where(x < +pi, 0,
4*pi*exp(-x/10)*sin(1*x)))))
plot(x, y) ; grid() ; show()
PS
In a comment Davide_sd correctly remarks that the technique I have shown is OK only if the piecewise function is continuous.
If there are discontinuities across sub-domains, you can always use numpy.where but you should assign np.nan values to the y array in the points of discontinuity, so that Matplotlib knows that she has to break the line across the NaN.
— EDIT — I've changed the circular frequency of the sines because I cannot make sense of the OP specification.