CDF and cumsum of a prbabolity density function

569 Views Asked by At

This is a really really stupid question, but why when I plot a CDF and cumsum of a PDF (e.g. exponential):

$$ f(t) ~ = \lambda e^{-\lambda t}, ~~~ t \ge 0 $$

I get the following plot:

enter image description here

This is the code for the CDF and cumsum values:

x = np.linspace(0, 5, 100)
y = l*np.exp(-l*x)

cumsum = np.cumsum(y)
cdf = 1 - np.exp(-l*x)

The cumsum goes way above 1 (as expected), however the CDF line reaches 1 as if a probability distribution was summed. Since the CDF is just an integral, which is sum, how can it differ from a cumulative sum over the y values?