vc_arc_length: Approximate the length of a graph

View source: R/applications.R

vc_arc_lengthR Documentation

Approximate the length of a graph

Description

Approximate the length of a graph

Usage

vc_arc_length(
  f,
  interval,
  df = NULL,
  h = NULL,
  breaks = NULL,
  method = c("adaptive", "trapezoid", "simpson"),
  n = 32L,
  abs_tol = 1e-08,
  rel_tol = 1e-08,
  subdivisions = 100L
)

Arguments

f

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

interval

Two finite real bounds, allowing reversed or equal bounds.

df

Optional scalar derivative function, assumed mathematically correct. NULL reuses vc_derivative() with central differences.

h

Optional positive finite numerical derivative step.

breaks

Optional finite strictly increasing interior integration split points, for example known intersections. These are not found automatically.

method

Quadrature rule: trapezoid, Simpson, or adaptive QUADPACK through stats::integrate(). Improper infinite bounds are not supported.

n

Initial number of equal cells for fixed rules; positive integer, even and at least two for Simpson. Ignored by the adaptive rule.

abs_tol, rel_tol

Nonnegative finite absolute and relative diagnostic tolerances; at least one must be positive. Adaptive integration also applies the tolerance restrictions of stats::integrate().

subdivisions

Positive integer maximum adaptive subinterval count; ignored by fixed rules.

Details

Integrates ⁠sqrt(1+f'(t)^2)⁠ for a rectifiable graph. Known corners can be supplied as breaks. Central numerical stencils may leave the domain near endpoints or cross corners; supply df where appropriate. Nonfinite sampled derivatives are errors. Failed sensitivity flags remain visible even if quadrature meets its tolerance. A supplied df is not verified. Quadrature error estimates do not include numerical derivative error; derivative_sensitivity_ok is a separate heuristic, not a bound.

Value

Plain list with type, sorted interval, breaks, method, estimate, integral (full quadrature diagnostics), derivative_source, derivative_sensitivity_ok (NA for supplied derivatives or no samples), locations, derivatives (full diagnostics per sampled point), and note.

Examples

identity |> vc_arc_length(c(0,1),df=function(x)1)

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