gradient {dfdr} | R Documentation |
Compute the gradient-function of a function.
Description
Creates a function that computes the derivative of a function with respect to each parameter and return a vector of these.
Usage
gradient(f, use_names, ...)
Arguments
f |
A function |
use_names |
Should the gradient add variable names to the output of the function? |
... |
The variable names for which gradients should be calculated |
Value
A function that computes the gradient of f at any point.
Examples
f <- function(x, y) x^2 + y^2
df <- gradient(f, FALSE, x, y)
df(1, 1)
[Package dfdr version 0.2.0 Index]