matt's math function

matt's math function