The algorithm then, is similar to the previous examples but with the gradient equations incorporated into it.