Added Midpoint Function

Added Midpoint Function