vc_curve_length: Integrate speed along a spatial parametric curve

View source: R/parametric_curve.R

vc_curve_lengthR Documentation

Integrate speed along a spatial parametric curve

Description

Integrate speed along a spatial parametric curve

Usage

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

Arguments

curve

Function of one scalar parameter returning a finite real three-vector in Cartesian x,y,z order.

interval

Two finite parameter endpoints. Length uses their increasing order, regardless of traversal direction.

velocity

Optional function returning the Cartesian derivative as a finite real three-vector. The caller supplies its mathematical validity.

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

Number of initial subintervals for fixed quadrature, as in vc_integrate(). Adaptive quadrature ignores this count.

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

Length uses increasing parameter bounds and is nonnegative. A zero interval gives zero without evaluations. With no supplied velocity, central Jacobian stencils can leave the interval or cross a break. Supply velocity when the curve is undefined at needed stencil points. Split known nonsmooth pieces using breaks and prefer adaptive quadrature at corners. The speed formula requires a suitable piecewise smooth parameterization. Quadrature diagnostics cover the sampled speed and omit derivative error.

Value

List with type curve_length, sorted interval, estimate, integral diagnostics, speed samples, derivative source, numerical Jacobian results (in sample order) and a separate derivative sensitivity flag.

Examples

vc_curve_length(function(t)c(cos(t),sin(t),t),c(0,2*pi),
  velocity=function(t)c(-sin(t),cos(t),1))

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