Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
spacetime_interval.cpp
Go to the documentation of this file.
1/// @file src/manifold/spacetime_interval.cpp
2/// @brief SpacetimeInterval — financial Minkowski interval ds² (AGT-06 stub).
3
4#include "srfm/manifold.hpp"
5
6#include <algorithm>
7#include <cmath>
8
9namespace srfm::manifold {
10
11// ─── to_string ────────────────────────────────────────────────────────────────
12
13const char* to_string(IntervalType t) noexcept {
14 switch (t) {
15 case IntervalType::Timelike: return "Timelike";
16 case IntervalType::Lightlike: return "Lightlike";
17 case IntervalType::Spacelike: return "Spacelike";
18 }
19 return "Unknown";
20}
21
22// ─── SpacetimeInterval::compute ───────────────────────────────────────────────
23
24std::optional<double>
26 const SpacetimeEvent& b,
27 double c_market) noexcept {
28 // Guard: all coordinates must be finite.
29 if (!std::isfinite(a.time) || !std::isfinite(b.time) ||
30 !std::isfinite(a.price) || !std::isfinite(b.price) ||
31 !std::isfinite(a.volume) || !std::isfinite(b.volume) ||
32 !std::isfinite(a.momentum) || !std::isfinite(b.momentum) ||
33 !std::isfinite(c_market) || c_market <= 0.0) {
34 return std::nullopt;
35 }
36
37 const double dt = b.time - a.time;
38 const double dp = b.price - a.price;
39 const double dv = b.volume - a.volume;
40 const double dm = b.momentum - a.momentum;
41
42 // ds² = −c²·Δt² + ΔP² + ΔV² + ΔM²
43 // Minkowski signature (−,+,+,+):
44 // − time component: causal separation dominates → timelike
45 // + spatial components: spatial separation dominates → spacelike
46 const double time_term = c_market * c_market * dt * dt;
47 const double spatial_term = dp * dp + dv * dv + dm * dm;
48
49 return spatial_term - time_term;
50}
51
52// ─── SpacetimeInterval::classify ─────────────────────────────────────────────
53
55SpacetimeInterval::classify(double interval_squared) noexcept {
56 if (std::abs(interval_squared) <= constants::FLOAT_EPSILON) {
58 }
59 return (interval_squared < 0.0) ? IntervalType::Timelike
61}
62
63} // namespace srfm::manifold
static IntervalType classify(double interval_squared) noexcept
static std::optional< double > compute(const SpacetimeEvent &a, const SpacetimeEvent &b, double c_market=constants::SPEED_OF_INFORMATION) noexcept
Spacetime Market Manifold — AGT-02 public API (implemented by AGT-06).
static constexpr double FLOAT_EPSILON
General floating-point comparison epsilon.
Definition constants.hpp:25
const char * to_string(IntervalType t) noexcept
Convert IntervalType to a human-readable string.
IntervalType
Causal character of a spacetime interval.
Definition manifold.hpp:61
@ Timelike
ds² < 0 — causal market movement (β < c)
@ Spacelike
ds² > 0 — stochastic regime (no causal link)
@ Lightlike
ds² ≈ 0 — information propagation at c
A point in 4D spacetime (t, x, y, z).