adapted conjugate gradient
added sphere function