|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Fundamental Theorem of Calculus bridge hooks. More...
#include <cmath>#include <concepts>#include <cstddef>#include <type_traits>#include <utility>import dedekind.algebra;
Concepts | |
| concept | dedekind::analysis::detail::IsNumericalBridgeScalar |
Typedefs | |
| template<typename R> | |
| using | dedekind::analysis::detail::resolved_value_t |
Functions | |
| template<typename R> | |
| constexpr auto | dedekind::analysis::detail::resolved_value (const R &x) |
| template<IsNumericalBridgeScalar R> | |
| constexpr R | dedekind::analysis::detail::lift (resolved_value_t< R > value) |
| template<IsNumericalBridgeScalar R> | |
| constexpr R | dedekind::analysis::detail::from_count (std::size_t value) |
| template<IsNumericalBridgeScalar R> | |
| constexpr R | dedekind::analysis::detail::zero () |
| template<IsNumericalBridgeScalar R> | |
| constexpr R | dedekind::analysis::detail::two () |
| template<IsNumericalBridgeScalar R> | |
| constexpr bool | dedekind::analysis::detail::less_than (const R &a, const R &b) |
| template<IsNumericalBridgeScalar R> | |
| constexpr bool | dedekind::analysis::detail::finite_value (const R &x) |
| template<IsNumericalBridgeScalar R> | |
| constexpr auto | dedekind::analysis::detail::magnitude (const R &x) |
| template<IsNumericalBridgeScalar R> | |
| constexpr bool | dedekind::analysis::detail::close_enough (const R &lhs, const R &rhs, const R &tolerance) |
| template<detail::IsNumericalBridgeScalar R, typename F> requires std::invocable<F, R> | |
| constexpr R | dedekind::analysis::derivative_at (F &&f, R x, R h=static_cast< R >(1e-5)) |
| Numerical derivative witness via central difference. | |
| template<detail::IsNumericalBridgeScalar R, typename F> requires std::invocable<F, R> | |
| constexpr R | dedekind::analysis::integral_over (F &&f, R a, R b, std::size_t slices=4096) |
| Numerical integral witness via trapezoidal rule (Riemann sum). | |
|
template<detail::IsNumericalBridgeScalar R, typename F> requires std::invocable<F, R> | |
| constexpr bool | dedekind::analysis::ftc_part_i_hypotheses (F &&f, R a, R b, std::size_t samples=32) |
| FTC Part I bridge: d/dx integral_a^x f(t) dt ~= f(x). | |
|
template<detail::IsNumericalBridgeScalar R, typename F, typename Antiderivative> requires std::invocable<F, R> && std::invocable<Antiderivative, R> | |
| constexpr bool | dedekind::analysis::ftc_part_ii_hypotheses (F &&f, Antiderivative &&antiderivative, R a, R b, std::size_t samples=32, R tolerance=static_cast< R >(1e-4)) |
| Numerical bridge for the sampled Part II hypothesis F' ~= f. | |
|
template<detail::IsNumericalBridgeScalar R, typename F> requires std::invocable<F, R> | |
| constexpr bool | dedekind::analysis::ftc_part_i_bridge (F &&f, R a, R x, R tolerance=static_cast< R >(1e-4)) |
| FTC Part I bridge: d/dx integral_a^x f(t) dt ~= f(x). | |
|
template<detail::IsNumericalBridgeScalar R, typename F, typename Antiderivative> requires std::invocable<F, R> && std::invocable<Antiderivative, R> | |
| constexpr bool | dedekind::analysis::ftc_part_ii_bridge (F &&f, Antiderivative &&antiderivative, R a, R b, R tolerance=static_cast< R >(1e-4)) |
| FTC Part II bridge: integral_a^b f(x) dx ~= F(b)-F(a). | |
| template<detail::IsNumericalBridgeScalar R, typename F, typename Antiderivative> requires std::invocable<F, R> && std::invocable<Antiderivative, R> | |
| constexpr bool | dedekind::analysis::ftc_worked_theorem_chain (F &&f, Antiderivative &&antiderivative, R a, R x, R b, R tolerance=static_cast< R >(1e-4)) |
| Worked theorem chain combining both FTC directions. | |
| template<detail::IsNumericalBridgeScalar R, typename F> requires std::invocable<F, R> | |
| constexpr std::pair< R, R > | dedekind::analysis::suggest_derivative_step_size (F &&f, R x, R tolerance=static_cast< R >(1e-6)) |
| Diagnostic: suggests optimal derivative step size via convergence testing. | |
| template<detail::IsNumericalBridgeScalar R, typename F> requires std::invocable<F, R> | |
| constexpr std::pair< std::size_t, R > | dedekind::analysis::diagnose_integral_convergence (F &&f, R a, R b, R convergence_threshold=static_cast< R >(1e-5)) |
| Diagnostic: validates integral convergence via Richardson extrapolation-style sampling. | |
Fundamental Theorem of Calculus bridge hooks.
@partition :ftc
Provides small numerical bridge lemmas between derivative and integral interfaces so downstream formalization can target a stable API.
CURRENT LIMITATIONS (see backlog for actionable follow-ups):
| using dedekind::analysis::detail::resolved_value_t |
|
constexprexport |
Numerical derivative witness via central difference.
Implements a basic finite-difference approximation without formal connection to geometry::frechet_derivative_at(). For scalar functions, this is a Fréchet approximation in the classical sense, but should eventually bridge to the formal derivative abstraction. Consider mapping through OneForm/Covector for differential geometry.
|
constexprexport |
Diagnostic: validates integral convergence via Richardson extrapolation-style sampling.
Computes integral_over() at increasing slice counts (100, 500, 2500, 4096) and monitors convergence drift. Returns the smallest slice count where drift ≤ convergence_threshold, plus the maximum drift observed across all refinement steps.
| f | The function to integrate. |
| a | Left endpoint. |
| b | Right endpoint. |
| convergence_threshold | Maximum acceptable drift between successive refinements. |
|
constexprexport |
Worked theorem chain combining both FTC directions.
Checks that a numerical accumulation differentiates back to the integrand at x, and that the same integrand integrates to the provided antiderivative delta over [a,b].
|
constexprexport |
Numerical integral witness via trapezoidal rule (Riemann sum).
Implements a Riemann sum using the trapezoidal rule, NOT a formal Lebesgue integral. Does not compose with differential forms (OneForm/TwoForm) or support Stokes' theorem. Limitations:
|
constexprexport |
Diagnostic: suggests optimal derivative step size via convergence testing.
Tests h values from 1e-8 to 1e-3 to find where derivative_at() stabilizes. Computes derivatives at decreasing step sizes and tracks the drift between successive estimates. Returns the smallest h where drift ≤ tolerance, plus the magnitude of last observed convergence drift.
| f | The function to differentiate. |
| x | The point at which to test the derivative. |
| tolerance | Convergence threshold for step size selection. |