For your default program, the exact value is 2500 and the trapezium value is about 2313. That does not seem wrong to me, for 50 bins. If I use 5000 bins, it gets about 2498. Again, seems fine to me.
Regarding plotting ... you seem to only be plotting the exact value curve. So, it is impossible to provide any advice on why your code may be wrong.
If you want to plot the individual rectangles, I would suggest using the bar() function.
Best Answer