trying to write a gradient descent with a single cost function and data seperated