#' @export
# direction finding function 1 dimension
dfp1d <- function(gradient) {
Q <- diag(1, nrow = 2, ncol = 2)
A <- c(1, -1)
LHS <- rbind(cbind(Q, A), cbind(t(A), 0))
RHS <- -c(gradient, 0)
unname(solve(LHS, RHS)[1:2])[1]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.