What is the math/code/formula for the function ‘EndPointAverage’, not the description as in the documentation. Thanks!