adding function for Euler method