completed differential equation implmentation