I wanted to take a quick look at the following distribution function and noticed that something is very wrong with the way I'm trying to do that. When applying the function to x_range, all values end up being 0. I am very confused about this and struggle to understand why that would be the case. Am I using numpy wrong in this situation? At least that is the only explanation I have, but I have not been able to find any sort of explanation for why I am seeing these results.
Below is my code.
from matplotlib import pyplot as plt
import numpy as np
def F(x):
return 0 if x <= 0 \
else .0025 * x if x <= 100 \
else .25 if x <= 200 \
else .0025 * x - .25 if x <= 300 \
else .0025 * x if x <= 400 \
else 1
x_range = np.linspace(0, 410, 1000)
plt.plot(np.vectorize(F)(x_range))
plt.show()
Also, is anyone aware of a more elegant way to simply plot a function over an interval? I am not really a fan of vectorizing the function and applying it to a specially generated array for the mere purpose of plotting. I assume there should be built-in matplotlib functionality to plot a function over some subspace of R.

