vc_partial: Approximate a coordinate partial derivative

View source: R/multivariable.R

vc_partialR Documentation

Approximate a coordinate partial derivative

Description

Approximate a coordinate partial derivative

Usage

vc_partial(
  f,
  point,
  coordinate,
  method = c("central", "forward", "backward"),
  h = NULL,
  atol = 1e-08,
  rtol = 1e-04,
  warn = TRUE
)

Arguments

f

Deterministic scalar field accepting ONE numeric vector and returning one finite real scalar. For f(x,y), supply an explicit wrapper function(v)f(v[1],v[2]); no automatic signature guessing is performed.

point

Nonempty finite real coordinate vector. Optional names must be unique and nonempty and are passed to f.

coordinate

Integer coordinate index from one to length(point).

method

One of "central", "forward", or "backward".

h

Positive finite real initial step. NULL uses max(1, abs(x)) times machine epsilon to the power 1/3 for central differences or 1/2 for one-sided differences. This heuristic is not optimal for every function or physical scale.

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

Holds every other coordinate fixed and reuses vc_derivative(). Its actual-displacement and three-scale checks remain unchanged. Existence of partial derivatives is not proof of differentiability. Finite samples cannot establish the existence of the mathematical partial derivative.

Value

Plain list with type, point, coordinate, value, estimate, derivative (complete vc_derivative diagnostics), reliable and note.

Examples

(function(v)v[1]^2+2*v[2]^2) |> vc_partial(c(1,2),coordinate=2)

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