Skip to content

Commit 941dcea

Browse files
committed
✨ feat: tangents
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
1 parent bbc2d8b commit 941dcea

7 files changed

Lines changed: 758 additions & 31 deletions

File tree

docs/spec.md

Lines changed: 238 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ A **distance quantity** has dimensions of length and, in the strict metric sense
3838
Let $M$ be a **smooth manifold** of dimension $n$.
3939

4040
- A **point** is an element $p \in M$.
41-
- A **tangent vector** at $p$ is an element $v \in T_pM$, where $T_pM$ is the **tangent space** at $p$: a vector space attached to the point that represents the infinitesimal directions in which one may move away from $p$ on the manifold.
41+
- A **tangent vector** at $p$ is an element $v \in T_pM$, where $T_pM$ is the [**tangent space**](#math-spec-tangents) at $p$: a vector space attached to the point that represents the infinitesimal directions in which one may move away from $p$ on the manifold.
4242

4343
<!-- Charts -->
4444

@@ -88,9 +88,110 @@ $$
8888
\varphi_S(r, \theta, \phi) \circ \varphi_C^{-1}(x, y, z) = (\sqrt(x^2+y^2+z^2), \arccos(z/r), \arctan(y/x))
8989
$$
9090

91+
<!-- Frame Transformations -->
92+
93+
**_Frame Transformations_**:
94+
95+
A **frame transformation** is a smooth map
96+
97+
$$
98+
F : M \to M
99+
$$
100+
101+
that relates two descriptions of points on the same manifold. The map $F : M \to M$ is smooth if it is infinitely differentiable in any chart, a major boon for auto-differentiation codes.
102+
103+
Such maps may represent either:
104+
105+
- an **active transformation**, moving points of the manifold, or
106+
- a **passive transformation**, re-expressing the same geometric point in a different reference frame.
107+
108+
_In `coordinax`, frame transformations are passive_: a point described in one reference frame can be mapped to its representation in another frame.
109+
110+
Here we enumerate some transformations:
111+
112+
<u>**identity**</u>:
113+
114+
The trivial transformation that leaves all points unchanged.
115+
116+
<!-- Frame Transformations: translations -->
117+
118+
<u>**translation**</u>:
119+
120+
shifts all points by a constant displacement vector:
121+
122+
$$
123+
F(p) = p + a .
124+
$$
125+
126+
In Cartesian coordinates this is $ x’ = x + a .$
127+
128+
<!-- Frame Transformations: rotations -->
129+
130+
<u>**rotations**</u>:
131+
132+
A rotation is a linear transformation preserving orientation and distances in Euclidean space. In $\mathbb{R}^n$, rotations are represented by orthogonal matrices with unit determinant:
133+
134+
$$
135+
R^T R = I, \quad \det R = 1 .
136+
$$
137+
138+
Rotations form the special orthogonal group $ SO(n).$
139+
140+
<!-- Frame Transformations: rotations -->
141+
142+
<u>**reflections**</u>:
143+
144+
A reflection is a linear transformation that reverses orientation across a hyperplane. Reflections preserve distances but have determinant -1.
145+
146+
Together with rotations, reflections generate the orthogonal group $ O(n). $
147+
148+
<a id="math-spec-tangents"></a>
149+
150+
## Tangents
151+
152+
<!-- tangents -->
153+
154+
**_Tangent Spaces_**:
155+
156+
For a smooth manifold $M$ and a point $p \in M$, the **tangent space** $T_pM$ is the vector space of infinitesimal directions through $p$.
157+
158+
Elements $v \in T_pM$ may be equivalently defined as
159+
160+
- equivalence classes of curves through $p$,
161+
- derivations acting on smooth functions,
162+
- coordinate vectors induced by charts.
163+
164+
In a chart $C=(U,\varphi)$ with coordinates $q^i$, the tangent space has a natural coordinate basis
165+
166+
$$
167+
\left\{\frac{\partial}{\partial q^1},
168+
\dots,
169+
\frac{\partial}{\partial q^n}\right\}_p .
170+
$$
171+
172+
A tangent vector can therefore be written
173+
174+
$$
175+
v = v^i \frac{\partial}{\partial q^i}\Big|_p .
176+
$$
177+
178+
Under a change of coordinates \(q^i \rightarrow \tilde q^j\), the components transform by the **Jacobian pushforward law**
179+
180+
$$
181+
\tilde v^j = \frac{\partial \tilde q^j}{\partial q^i} v^i .
182+
$$
183+
184+
The collection of all tangent spaces forms the **tangent bundle**
185+
186+
$$
187+
TM = \bigsqcup_{p \in M} T_pM .
188+
$$
189+
190+
Unlike points, tangent vectors form a vector space and support addition and scalar multiplication.
191+
91192
<!-- metric -->
92193

93-
**_Metrics \& Reimannian Manifolds_**:
194+
**_Metrics \& Manifolds_**:
94195

95196
A manifold _without_ a metric is just a smooth manifold $M$. We can add geometric structure to the manifold, specifically the **metric**, to obtain a **Riemannian manifold** $(M, g)$.
96197

@@ -111,70 +212,128 @@ varying smoothly with p. This additional structure equips the manifold with noti
111212

112213
Importantly, the metric acts only on tangent spaces; it does not act directly on points. Thus, it equips the manifold with intrinsic geometric meaning beyond smooth structure alone.
113214

114-
In chart coordinates, the metric is represented by the matrix
215+
**Metric Matrix**
216+
217+
In a coordinate chart with coordinates $q^i$, the metric tensor is represented by a symmetric matrix of components
115218

116219
$$
117-
g_{ij}(q) = g\!\left(\frac{\partial}{\partial q^i},\frac{\partial}{\partial q^j}\right),
220+
g_{ij}(q) = g\!\left(\frac{\partial}{\partial q^i},\frac{\partial}{\partial q^j}\right).
118221
$$
119222

120-
evaluated at the base point $p$ with coordinates $q=\varphi(p)$.
223+
This matrix varies smoothly with the base point $p$ whose coordinates are $q=\varphi(p)$. In matrix form the metric determines the squared line element
121224

122-
<!-- Frame Transformations -->
225+
$$
226+
ds^2 = g_{ij}(q)\, dq^i dq^j.
227+
$$
123228

124-
**_Frame Transformations_**:
229+
The matrix $g_{ij}$ is symmetric and non-degenerate:
125230

126-
A **frame transformation** is a smooth map
231+
$$
232+
g_{ij} = g_{ji}, \qquad \det(g_{ij}) \neq 0.
233+
$$
234+
235+
The inverse matrix $g^{ij}$ satisfies
127236

128237
$$
129-
F : M \to M
238+
g^{ik} g_{kj} = \delta^i_j,
130239
$$
131240

132-
that relates two descriptions of points on the same manifold. The map $F : M \to M$ is smooth if it is infinitely differentiable in any chart, a major boon for auto-differentiation codes.
241+
and is used to raise indices and identify tangent and cotangent spaces.
133242

134-
Such maps may represent either:
243+
**Signature of a Metric**
135244

136-
- an **active transformation**, moving points of the manifold, or
137-
- a **passive transformation**, re-expressing the same geometric point in a different reference frame.
245+
The **signature** of a metric describes the signs of the eigenvalues of the metric matrix. If the metric matrix at a point can be diagonalized to
138246

139-
_In `coordinax`, frame transformations are passive_: a point described in one reference frame can be mapped to its representation in another frame.
247+
$$
248+
\mathrm{diag}(\underbrace{+1,\dots,+1}_p,\underbrace{-1,\dots,-1}_q),
249+
$$
140250

141-
Here we enumerate some transformations:
251+
then the metric is said to have signature $(p,q)$.
142252

143-
<u>**identity**</u>:
253+
The signature is invariant under coordinate transformations and characterizes the geometric type of the manifold. Typical examples include:
144254

145-
The trivial transformation that leaves all points unchanged.
255+
- **Riemannian metrics:** signature $(n,0)$, all positive eigenvalues. These describe ordinary curved spatial geometries.
256+
- **Lorentzian metrics:** signature $(1,3)$ describe spacetime geometry in relativity.
146257

147-
<!-- Frame Transformations: translations -->
258+
Thus the signature distinguishes purely spatial geometries from spacetime geometries with one timelike direction.
148259

149-
<u>**translation**</u>:
260+
<!-- transformations -->
150261

151-
shifts all points by a constant displacement vector:
262+
**_Frame Transformations_**:
263+
264+
<!-- Induced Action on Tangent Spaces -->
265+
266+
A smooth map $F : M \to M$ induces a linear map on tangent spaces called the pushforward
152267

153268
$$
154-
F(p) = p + a .
269+
F_* : T_pM \to T_{F(p)}M .
155270
$$
156271

157-
In Cartesian coordinates this is $ x’ = x + a .$
272+
If $v \in T_pM$ is a tangent vector, then under the transformation
158273

159-
<!-- Frame Transformations: rotations -->
274+
$$
275+
v \mapsto F_* v .
276+
$$
160277

161-
<u>**rotations**</u>:
278+
In coordinates $x^i$, if the transformation is written
162279

163-
A rotation is a linear transformation preserving orientation and distances in Euclidean space. In $\mathbb{R}^n$, rotations are represented by orthogonal matrices with unit determinant:
280+
$$
281+
x’^i = F^i(x),
282+
$$
283+
284+
then the tangent components transform according to the Jacobian
164285

165286
$$
166-
R^T R = I, \quad \det R = 1 .
287+
v’^i = \frac{\partial F^i}{\partial x^j} v^j .
167288
$$
168289

169-
Rotations form the special orthogonal group $ SO(n).$
290+
Thus frame transformations act naturally on both points and tangent vectors.
170291

171-
<!-- Frame Transformations: rotations -->
292+
<!-- Isometry -->
172293

173-
<u>**reflections**</u>:
294+
Transformations that preserve distances between points are called isometries. When a metric structure g exists on the manifold, a map $F : M \to M$ is an isometry if
174295

175-
A reflection is a linear transformation that reverses orientation across a hyperplane. Reflections preserve distances but have determinant -1.
296+
$$
297+
g(F_* u, F_* v) = g(u,v)
298+
$$
176299

177-
Together with rotations, reflections generate the orthogonal group $ O(n). $
300+
<!-- Frame Transformations: Lorentz boosts -->
301+
302+
<u>**Lorentz boosts**</u>:
303+
304+
A Lorentz boost is a Lorentz transformation corresponding to a change between inertial frames moving at constant relative velocity (see [Tangents](#math-spec-tangents) for the definition and properties of velocity).
305+
306+
For motion in an arbitrary spatial direction with velocity vector $\mathbf{v}$,
307+
308+
$$
309+
\begin{aligned}
310+
t' &= \gamma \left(t - \frac{\mathbf{v} \cdot \mathbf{x}}{c^2}\right), \\
311+
\mathbf{x}' &= \mathbf{x} + \frac{\gamma - 1}{\|\mathbf{v}\|^2} (\mathbf{v} \cdot \mathbf{x}) \, \mathbf{v} - \gamma \, \mathbf{v} \, t,
312+
\end{aligned}
313+
$$
314+
315+
where
316+
317+
$$
318+
\gamma = \frac{1}{\sqrt{1 - \|\mathbf{v}\|^2/c^2}} .
319+
$$
320+
321+
<!-- Frame Transformations: Lorentz acceleration boosts -->
322+
323+
<u>**Acceleration boosts**</u>:
324+
325+
Uniformly accelerated observers in Minkowski spacetime use Rindler coordinates. The transformation from Minkowski coordinates (t,x) to Rindler coordinates (\tau,\rho) is
326+
327+
$$
328+
\begin{aligned}
329+
t &= \rho \sinh(a\tau / c), \
330+
x &= \rho \cosh(a\tau / c),
331+
\end{aligned}
332+
$$
333+
334+
where a is the proper acceleration.
335+
336+
These transformations describe reference frames undergoing constant proper acceleration. Unlike Lorentz transformations, they do not correspond to global spacetime symmetries but are still smooth diffeomorphisms on appropriate regions of spacetime.
178337

179338
## Transformation Groups
180339

@@ -524,6 +683,8 @@ Typical examples include
524683
- **Points**: a point is an element $$p \in M .$$ The transformation law is $$
525684
q_f = \Phi(q_i) $$
526685

686+
- **Tangent vectors**: a tangent vector at $p$ is an element $$ v \in T_pM , $$ where $T_pM$ is the tangent space of $M$ at $p$. The transformation law is $$ v_f^a = \frac{\partial q_f^a}{\partial q_i^b} v_i^b $$
687+
527688
Thus the geometry kind determines the class of transformation rule applied to the components.
528689

529690
Importantly, the geometry kind is **independent of the coordinate chart** used to represent the components. The same geometric object may be written in any compatible chart.
@@ -550,11 +711,46 @@ The coefficients $v^a$ are the **components of the vector in the basis** $B$.
550711

551712
**Coordinate bases** determine how components are expressed, when such a choice is meaningful.
552713

714+
Given a chart with coordinates $q^a$, the natural coordinate basis of the tangent space is
715+
716+
$$
717+
\left\{ \frac{\partial}{\partial q^a} \right\}.
718+
$$
719+
720+
In this basis,
721+
722+
$$
723+
v = v^a \frac{\partial}{\partial q^a}.
724+
$$
725+
726+
The corresponding cotangent basis is
727+
728+
$$
729+
\{ dq^a \}.
730+
$$
731+
732+
#### Basis transformations
733+
734+
If two bases ${e_a}$ and ${e’_a}$ are related by
735+
736+
$$
737+
e’_a = A_a^{\ b} e_b ,
738+
$$
739+
740+
then vector components transform as
741+
742+
$$
743+
v’^a = (A^{-1})_b^{\ a} v^b .
744+
$$
745+
746+
Thus basis transformations act **linearly**, in contrast to chart transitions, which are generally nonlinear.
747+
553748
#### Basis relevance
554749

555750
Not all geometric objects require a basis specification.
556751

557752
- Points are affine objects and do not belong to a vector space. Their coordinates are chart values, not vector components.
753+
- Vectors and tensors require a basis because their components depend on the basis choice.
558754

559755
Therefore the basis component of a representation may be trivial for some geometry kinds.
560756

@@ -567,9 +763,20 @@ While the geometry kind determines the mathematical space of the object, the sem
567763
Examples include:
568764

569765
- **Location**: a point interpreted as the position of a particle or object.
766+
- **Displacement**: a tangent vector interpreted as the difference between nearby points.
767+
- **Velocity**: a tangent vector interpreted as the derivative of a trajectory: $$ v = \frac{d\gamma}{dt}. $$
768+
- **Acceleration**: a tangent vector interpreted as the second derivative of a trajectory.
570769

571770
Semantic kinds do **not** change coordinate transformation laws.
572771

772+
For example, velocity and acceleration both transform as tangent vectors under coordinate changes:
773+
774+
$$
775+
v_f^a = \frac{\partial q_f^a}{\partial q_i^b} v_i^b .
776+
$$
777+
778+
Their difference lies only in interpretation and in the operations that produce them.
779+
573780
Separating semantics from geometry provides two advantages:
574781

575782
1. Correct transformation laws -- transformation behavior depends only on geometry kind and basis, not on semantics.

packages/coordinax.hypothesis/src/coordinax/hypothesis/representations/_src/reps.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ def valid_basis_classes_for_geometry(
4040
return (cxr.NoBasis,)
4141

4242

43+
@plum.dispatch
44+
def valid_basis_classes_for_geometry(
45+
geom_kind: cxr.TangentGeometry, /
46+
) -> tuple[type[cxr.AbstractBasis], ...]:
47+
"""Return valid basis classes for tangent geometry."""
48+
del geom_kind
49+
return (cxr.CoordinateBasis, cxr.PhysicalBasis)
50+
51+
4352
@plum.dispatch
4453
def valid_semantic_classes_for_geometry(
4554
geom_kind: cxr.AbstractGeometry, /
@@ -61,6 +70,16 @@ def valid_semantic_classes_for_geometry(
6170
return (cxr.Location,)
6271

6372

73+
@plum.dispatch
74+
def valid_semantic_classes_for_geometry(
75+
geom_kind: cxr.TangentGeometry,
76+
/,
77+
) -> tuple[type[cxr.AbstractSemanticKind], ...]:
78+
"""Return valid semantic classes for tangent geometry."""
79+
del geom_kind
80+
return (cxr.Displacement, cxr.Velocity, cxr.Acceleration)
81+
82+
6483
@st.composite
6584
def representations(
6685
draw: st.DrawFn,

0 commit comments

Comments
 (0)