Um, no. Sum is not the same as trapz. Are they close, under some circumstances? Well, yes.
Do you see they are not the same result?
Is sum close? Yes. And that is because when you use sum and trapz, trapz first assumes a unit stride between the points. If the stride was not 1, then trapz would not produce something even close. This gets into the question of what an integral is, and what rectangle rule means, etc. I won't teach a beginning calc course here. Sorry. But if we assume a stride of 1, then you still see they are not identical.
Anyway, as you can see, sum is NOT the same. If you look closely at the formula for rectangle rule to approximate an integral, and then look at the formula for trapz, you will see they essentially only differ at the ends. And since your vector B is almost zero at each end, then sum and trapz will be quite close in their prediction.