pystein.coords module
Symbolic Coordinates for cosmological calculations
This module extends the analogous module in sympy and adds some new principal features to the CoordSystem interface. Notably, sympy CoordSystem depends on a Metric, whereas we’ve reversed that dependency here. Also, we have made the underlying coordinates more accessible, instead of relying on coordinate-function intermediaries.
There is a bug in sympy curvature calculation that makes the symbols insufficient indices for partial derivatives, which is wrong. As a work around, sympy forces users to use the coordinate functions as coordinates, which is mathematically valid but symbolically unfortunate. We emphasize that the underlying symbols in a coordinate system should be sufficient for differentiation.
- class pystein.coords.CoordSystem(name, patch, names=None)
Bases:
sympy.diffgeom.diffgeom.CoordSystemCoordinate System class extension of the sympy.diffgeom.CoordSystem class
This class has the principle difference of being able to produce the base symbols used in the coordinates, via the new method ‘base_symbols’
- base_symbols()
Return the symbols used in the coordinate system
- default_assumptions = {}
- static from_sympy_coordsystem(coord_system: sympy.diffgeom.diffgeom.CoordSystem)
Create a CoordSystem from a sympy.diffgeom.CoordSystem
- static from_twoform(twoform: sympy.core.expr.Expr)
Create a CoordSystem from a sympy.Expr that represents a metric as a twoform by extracting the coordinates from the given metric (reversing this dependency)
- pystein.coords.cartesian_coords(manifold: Optional[sympy.diffgeom.diffgeom.Manifold] = None, dim: int = 4)
Create a Cartesian Coordinate system (t ~ R and (x,y,z) ~ R^3) with maximal dimension 4 (can create subspaces too)
- Parameters
manifold – Manifold, default None. If specified use this Manifold to take a coordinate patch
dim –
- int, the dimension of the resulting coordinate system. Must be less than or equal to 4,
and must match the dimension of the given Manifold if specified.
- Returns
CoordSystem, the coordinate system
- pystein.coords.toroidal_coords(manifold: Optional[sympy.diffgeom.diffgeom.Manifold] = None, dim: int = 4)
Create a Toroidal Coordinate system (t ~ R and (x,y,z) ~ S^3) with maximal dimension 4 (can create subspaces too)
- Parameters
manifold – Manifold, default None. If specified use this Manifold to take a coordinate patch
dim –
- int, the dimension of the resulting coordinate system. Must be less than or equal to 4,
and must match the dimension of the given Manifold if specified.
- Returns
CoordSystem, the coordinate system