View source: R/multivariable.R
| vc_gradient | R Documentation |
Approximate the gradient of a scalar field
vc_gradient(
f,
point,
method = "central",
h = NULL,
atol = 1e-08,
rtol = 1e-04,
warn = TRUE
)
f |
Deterministic scalar field accepting ONE numeric vector and returning
one finite real scalar. For f(x,y), supply an explicit wrapper
|
point |
Nonempty finite real coordinate vector. Optional names must be unique and nonempty and are passed to f. |
method |
One difference method, or one per coordinate. Explicit one-sided methods can be used at known coordinate-domain boundaries. |
h |
NULL for per-coordinate vc_derivative heuristics, one positive finite step for all coordinates, or a positive finite vector of that dimension. No recycling of shorter vectors is allowed. |
atol |
Nonnegative finite absolute tolerance for sensitivity comparisons. |
rtol |
Nonnegative finite relative tolerance for sensitivity comparisons. |
warn |
Logical scalar; warn when sensitivity diagnostics fail. |
Reuses vc_partial(), which reuses the accepted one-variable engine. A reliable flag means only that its finite coordinate checks passed. Even all existing coordinate partials do not imply total differentiability or justify computing every directional derivative by a dot product. The engine's conservative side checks may fail at smooth stationary points.
Plain list with type, point, value, estimate (named vector), results (full partial results), table (coordinate, label, method, h, estimate, reliable), reliable (all coordinate checks), and note.
(function(v)v[1]^2+2*v[2]^2) |> vc_gradient(c(x=1,y=2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.