| vc_fundamental | R Documentation |
Explore the fundamental theorem of calculus numerically
vc_fundamental(
f,
x,
lower = 0,
method = c("adaptive", "trapezoid", "simpson"),
n = 32L,
abs_tol = 1e-08,
rel_tol = 1e-08,
subdivisions = 100L,
h = NULL,
derivative_method = c("central", "forward", "backward"),
atol = 1e-08,
rtol = 1e-04
)
f |
Deterministic function accepting a real scalar and returning one finite real scalar. Vectorization is not required. |
x |
Nonempty finite real vector of upper limits. Input order and duplicates are retained; limits below lower reverse orientation. |
lower |
Finite real scalar fixed lower integration limit. |
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. |
h |
Positive finite initial difference step, or NULL for the vc_derivative() scale heuristic. Smaller is not always more accurate. |
derivative_method |
Central, forward or backward differences applied to the numerical accumulation function. One-sided comparisons are one-sided evidence only and can be used near domain boundaries. |
atol, rtol |
Nonnegative finite sensitivity/agreement tolerances. Agreement threshold is atol + rtol*abs(f(x)). |
Reuses vc_integrate() and vc_derivative(), not an analytical substitution of f(x) for A'(x). At each of the three difference scales, quadrature error estimates are multiplied by the absolute finite-difference coefficients and summed. This indicator accounts for amplification by small steps, but remains heuristic because its input errors are estimates. A consistent/mismatch status requires reliable derivative diagnostics, all sampled integrals meeting their diagnostic tolerances, and propagated indicators no larger than the agreement threshold at all three scales. Otherwise status is inconclusive, even if the computed values agree. Integration/derivative evaluation errors around a finite f(x) are retained as inconclusive messages. Nonfinite f(x) and invalid controls are errors. Integrability on the intervening interval and continuity at x are standard hypotheses for A'(x)=f(x) at an interior point. They are not established by this procedure. A point discontinuity can produce a numerical mismatch; a symmetric quotient alone does not prove a derivative at a jump.
Plain list with type, lower, method, derivative_method, table (x, value, estimate, difference, agreement, derivative_reliable, integration_ok, quadrature_indicator, quadrature_resolved, status, message), results (derivative diagnostics, full sampled integrals and propagated quadrature diagnostics per point), and note. Unavailable estimates and differences are NA. Status is consistent, mismatch or inconclusive.
(function(x)x^2) |> vc_fundamental(x=c(0,1,2),lower=0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.