vc_limit: Probe a finite numerical limit from one or both sides

View source: R/limit.R

vc_limitR Documentation

Probe a finite numerical limit from one or both sides

Description

Probe a finite numerical limit from one or both sides

Usage

vc_limit(
  f,
  x0,
  side = c("both", "left", "right"),
  h = NULL,
  steps = 20L,
  atol = 1e-06,
  rtol = 1e-04
)

Arguments

f

Deterministic function accepting a real scalar and returning one finite real scalar. Vectorization is not required.

x0

Finite real approach point. f(x0) is never evaluated.

side

One of both, left or right.

h

Positive initial distance. NULL uses 0.1*max(1,abs(x0)).

steps

Integer number of halving distances, between 4 and 1000.

atol, rtol

Nonnegative absolute/relative comparison tolerances.

Details

Each side's last three values must agree within atol+rtol*max(abs(a),abs(b)); both-side estimates must also agree. This finite Cauchy-like check is evidence only. Divergence, oscillations, floating-point cancellation and aliased sampling can evade finite tests. Unbounded or unresolved sequences are not replaced by a finite limit or an asserted infinity. Invalid values remain NA. Collapsed/underflowed or overflowing approach points are errors. Existence is never proved.

Value

Plain list with type, x0, side, samples (x, distance, value, side), left, right (side summaries with estimate and stable), estimate (NA unless applicable checks pass), status, and note. status is compatible_finite, side_disagreement, unresolved or unavailable.

Examples

f <- function(x) sin(x)/x
f |> vc_limit(x0=0)
vc_limit(function(x) abs(x)/x,0)$status

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