vc_line_integral: Integrate a scalar or vector field along a parametric curve

View source: R/line_integral.R

vc_line_integralR Documentation

Integrate a scalar or vector field along a parametric curve

Description

Integrate a scalar or vector field along a parametric curve

Usage

vc_line_integral(
  f,
  curve,
  interval,
  type = c("scalar", "work"),
  velocity = NULL,
  h = NULL,
  breaks = NULL,
  method = c("adaptive", "trapezoid", "simpson"),
  n = 32L,
  abs_tol = 1e-08,
  rel_tol = 1e-08,
  subdivisions = 100L,
  time_dependent = FALSE
)

Arguments

f

Function of one Cartesian vector, or of position and parameter when time_dependent is TRUE. Returns one finite scalar or a vector matching the curve dimension, according to type.

curve

Function of one scalar parameter returning a finite real Cartesian vector of length two or three.

interval

Two finite parameter endpoints in traversal order.

type

Scalar line integral with respect to arc length, or vector work using the dot product with the curve derivative.

velocity

Optional derivative of curve with the same dimension.

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.

time_dependent

Pass the curve parameter explicitly as f(position,t).

Details

Scalar integrals are invariant under interval reversal, including for signed scalar fields. Work changes sign. Reversal traverses the same parameterized field values, including when time_dependent is TRUE. Equal endpoints give zero without evaluating either function. Central stencils can leave the domain or cross breaks. Supply velocity at known boundaries and split nonsmooth pieces with breaks when appropriate. Quadrature diagnostics cover the sampled integrand and omit derivative error.

Value

List with estimate, interval, dimension, orientation, quadrature diagnostics on increasing bounds, samples in traversal order, derivative source, and separate numerical Jacobian diagnostics in sample order.

Examples

vc_line_integral(function(p)c(-p[2],p[1]),
  function(t)c(cos(t),sin(t)),c(0,2*pi),type="work",
  velocity=function(t)c(-sin(t),cos(t)))$estimate

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