numerical methods for gate