implemented euler method