Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
hamilton.cppm File Reference

The Principle of Least Action (Hamiltonian Dynamics). More...

#include <cmath>
#include <concepts>
#include <cstddef>
#include <functional>
import dedekind.sequences;
import dedekind.geometry;
import dedekind.analysis:ftc;
import dedekind.algebra;
import dedekind.category;
Include dependency graph for hamilton.cppm:

Classes

struct  dedekind::analysis::HarmonicOscillator< R >
 Concrete Hamiltonian carrier for the 1-D harmonic oscillator. More...

Concepts

concept  dedekind::analysis::IsHamiltonian
 Formal verification of the energy mapping.
concept  dedekind::analysis::IsPoissonAlgebra
 A Ring equipped with a bracket satisfying the Jacobi Identity.

Typedefs

template<std::floating_point R>
using dedekind::analysis::PhasePoint = Vector<R, 2>
 Canonical 1D phase-space state (q, p).

Functions

template<std::floating_point R, std::size_t N>
constexpr R dedekind::analysis::poisson_bracket (auto &&f, auto &&g, const Vector< R, N > &state)
 The Poisson Bracket: The fundamental operation of Classical Mechanics.
template<std::floating_point R>
constexpr PhasePoint< R > dedekind::analysis::harmonic_oscillator_closed_form (R q0, R p0, R t, R ω=R{1})
 Closed-form harmonic-oscillator flow at time t.
template<std::floating_point R>
constexpr auto dedekind::analysis::harmonic_oscillator_curve (R q0, R p0, R ω=R{1})
 Continuum-indexed Hamiltonian trajectory as a Curve.
template<std::floating_point R>
constexpr auto dedekind::analysis::harmonic_oscillator_leapfrog_path (R q0, R p0, R dt, R ω=R{1})
 Discrete Hamiltonian trajectory via leapfrog/Verlet (infinite path).
template<std::floating_point R>
constexpr auto dedekind::analysis::harmonic_oscillator_leapfrog_finite_path (R q0, R p0, R dt, std::size_t steps, R ω=R{1})

Detailed Description

The Principle of Least Action (Hamiltonian Dynamics).

@partition :hamilton

hamilton__Hamiltonian

This partition defines the generator of motion ( \mathcal{H} ). In the Dedekind Category, the Hamiltonian is the Morphism that maps the Phase Space (Position and Momentum) to the Energy Scalar Field.

Following the Poisson formulation:

  • IsHamiltonian: A mapping (\mathcal{H}: \mathcal{S} \to \mathbb{F}).
  • Poisson Bracket: The Lie Algebra structure defining the flow.
  • Conservation: The proof that (f, \mathcal{H}

Function Documentation

◆ harmonic_oscillator_closed_form()

template<std::floating_point R>
PhasePoint< R > dedekind::analysis::harmonic_oscillator_closed_form ( R q0,
R p0,
R t,
R ω = R{1} )
constexprexport

Closed-form harmonic-oscillator flow at time t.

For H(q,p) = 1/2 (p^2 + ω^2 q^2) with unit mass: q(t) = q0 cos(ωt) + (p0/ω) sin(ωt) p(t) = p0 cos(ωt) - ω q0 sin(ωt)

Note
The direct use of std::cos() and std::sin() here is intentional—it marks the boundary between extensional (runtime) and intensional (symbolic) computation. Once transcendental function abstraction (GitHub #344) is formalized, this function will serve as a template for integrating the IsTranscendental<> concept. Do not refactor before that design is complete.

◆ harmonic_oscillator_leapfrog_path()

template<std::floating_point R>
auto dedekind::analysis::harmonic_oscillator_leapfrog_path ( R q0,
R p0,
R dt,
R ω = R{1} )
constexprexport

Discrete Hamiltonian trajectory via leapfrog/Verlet (infinite path).

The update is the symplectic kick-drift-kick form used in N-body style benchmark loops: preserve qualitative energy behavior over long horizons.

◆ poisson_bracket()

template<std::floating_point R, std::size_t N>
R dedekind::analysis::poisson_bracket ( auto && f,
auto && g,
const Vector< R, N > & state )
constexprexport

The Poisson Bracket: The fundamental operation of Classical Mechanics.

{f, g} = Σ (∂f/∂q ∂g/∂p - ∂f/∂p ∂g/∂q)