Special Relativity in Financial Modeling 1.0.0
Lorentz transforms, spacetime classification, and geodesic price paths for quantitative finance
Loading...
Searching...
No Matches
Public Member Functions | List of all members
srfm::tensor::ChristoffelSymbolsDual Class Reference

#include <tensor.hpp>

Public Member Functions

 ChristoffelSymbolsDual (const MetricTensor &metric, DualMetricFunction dual_fn)
 
ChristoffelArray compute (const SpacetimePoint &x) const
 
FourVelocity contract (const ChristoffelArray &gamma, const FourVelocity &u) const
 

Detailed Description

Christoffel symbols computed via dual-number forward-mode autodiff.

Replaces the O(h²) central finite-difference approximation in ChristoffelSymbols with an exact computation. The metric function is re-evaluated at a dual-number point xd = x + ε·ê_σ; the ε-component of the result is the exact partial derivative ∂g_μν/∂x^σ, with zero truncation error and no step-size sensitivity.

Requirements

The caller must supply a DualMetricFunction in addition to the standard MetricFunction. This is the same mathematical object as the metric, but templated over DualNumber arithmetic instead of double arithmetic.

Performance vs. ChristoffelSymbols

Each of the 4 derivative directions requires one call to the dual metric function (vs. 2 calls each for central differences). Total cost: 4 calls vs. 8 calls per Christoffel evaluation, and no step-size h to tune.

Example

// Build a flat Minkowski dual metric function for a flat (constant) metric.
auto dual_fn = [](const DualSpacetimePoint& /*xd*&zwj;/) -> DualMetricMatrix {
DualMetricMatrix gd = DualMetricMatrix::Zero();
gd(0,0) = DualNumber{-1.0, 0.0};
gd(1,1) = DualNumber{ 1.0, 0.0};
gd(2,2) = DualNumber{ 1.0, 0.0};
gd(3,3) = DualNumber{ 1.0, 0.0};
return gd;
};
MetricTensor base_metric = MetricTensor::make_minkowski(1.0, 1.0);
ChristoffelSymbolsDual cs(base_metric, dual_fn);
auto gamma = cs.compute(SpacetimePoint::Zero());
// All gamma[l](mu,nu) == 0 for flat Minkowski — exact with no FD error.
Eigen::Matrix< DualNumber, SPACETIME_DIM, 1 > DualSpacetimePoint
Definition tensor.hpp:131

Definition at line 475 of file tensor.hpp.

Constructor & Destructor Documentation

◆ ChristoffelSymbolsDual()

srfm::tensor::ChristoffelSymbolsDual::ChristoffelSymbolsDual ( const MetricTensor &  metric,
DualMetricFunction  dual_fn 
)

Construct from a base MetricTensor and a dual-number metric function.

Parameters
metricBase metric tensor (used for inverse metric g^λσ).
dual_fnDual-number analogue of the metric function, used for exact derivative extraction via autodiff.

Definition at line 28 of file christoffel_dual.cpp.

Member Function Documentation

◆ compute()

ChristoffelArray srfm::tensor::ChristoffelSymbolsDual::compute ( const SpacetimePoint &  x) const

Compute all Γ^λ_μν at point x using dual-number autodiff.

For each coordinate σ ∈ {0,1,2,3}:

  1. Build dual point xd: xd[k] = {x(k), k==σ ? 1.0 : 0.0}
  2. Evaluate dual_fn(xd) → DualMetricMatrix gd
  3. dg[σ](μ,ν) = gd(μ,ν).deriv (exact ∂g_μν/∂x^σ)

Then assemble Γ^λ_μν using the standard formula with g^λσ from the base metric inverse.

Parameters
xSpacetime point at which to evaluate Γ^λ_μν.
Returns
ChristoffelArray, or all-zero if the metric is singular at x.

Definition at line 61 of file christoffel_dual.cpp.

◆ contract()

FourVelocity srfm::tensor::ChristoffelSymbolsDual::contract ( const ChristoffelArray &  gamma,
const FourVelocity &  u 
) const

Contract Christoffel symbols with a four-velocity (identical to ChristoffelSymbols::contract).

Definition at line 106 of file christoffel_dual.cpp.


The documentation for this class was generated from the following files: