implementation of gradient algorithm
add a new algorithm