vc_divergence: Estimate the divergence of a square vector field

View source: R/vector_fields.R

vc_divergenceR Documentation

Estimate the divergence of a square vector field

Description

Estimate the divergence of a square vector field

Usage

vc_divergence(
  f,
  point,
  method = "central",
  h = NULL,
  atol = 1e-08,
  rtol = 1e-04,
  warn = TRUE
)

Arguments

f

Function of a Cartesian vector returning the same number of finite real components as the input.

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.

Details

The estimate is the trace of the Jacobian. Reliability summarizes only the diagonal entries. Numerical sensitivity does not certify differentiability or bound the divergence error.

Value

List with estimate, refinements, reliable and the full Jacobian.

Examples

vc_divergence(function(p)c(p[1],2*p[2]),c(1,2))$estimate

vectorialcalculus documentation built on Nov. 17, 2026, 1:09 a.m.