I want to plot the following cumulative distribution function
and to do this I thought I could use np.piecewise
as follows
x = np.linspace(3, 9, 100)
np.piecewise(x, [x < 3, 3 <= x <= 9, x > 9], [0, float((x - 3)) / (9 - 3), 1])
but this gives the following error
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
How can I do this?