You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This new version of OGRePy is released shortly after the OGRe v2.0.0 release, and includes many of the new features, performance optimizations, and bug fixes from that release, as well as additional improvements specific to the Python version.
New features:
Metric.weyl() can now be used to calculate the Weyl tensor.
Metric.volume_element_squared() has been renamed to Metric.det(), as this is a more accurate name for what the method actually calculates: the determinant of the metric, which may be negative for pseudo-Riemannian metrics.
Metric.volume_element() is a new method that calculates the actual volume element of a given metric in the form $\mathrm{d}V = \sqrt{|\det(g)|} , {\mathrm{d}x}^{0} \wedge \cdots \wedge {\mathrm{d}x}^{n-1}$, where $n$ is the number of dimensions.
OGRePy Live now includes a more helpful starting notebook with some coordinate systems and metrics pre-defined, as well as suggestions for things to try.
Derivative shorthand notation:
Partial derivatives are now displayed correctly. Previously, a function with two partial derivatives, e.g. f.diff(x, y), was incorrectly displayed by list() and show() as $\partial_{x}f$, ignoring any derivatives after the first one. Now, the same function is correctly displayed as $\partial_{x}\partial_{y}f$.
list() and show() now use a clearer shorthand notation for higher-order derivatives. Previously the shorthand for something like f.diff(x, 2) was $\partial_{x^2}f$, which was confusing, especially because it seems like the derivative is with respect to $x^2$, rather than a second derivative with respect to $x$. Now the shorthand for the same is $\partial_{x}^{2} f$, which more closely resembles familiar tensor notation.
The shorthand notation has been made clearer in cases where the derivative is raised to a power. Previously the shorthand for something like f.diff(x)**2 was $\partial_{x} f^2$, which makes it look like the function itself is squared, instead of the derivative. Now the shorthand for the same is $(\partial_{x} f)^2$, which is much more clear.
The shorthand notation has also been improved in cases where the function is multiplied by its derivative. Previously, f * f.diff(x) was displayed as $\partial_{x} f f$, which is very confusing. Now the same is displayed as $f \partial_{x} f$.
Geodesics:
Index transformations for the GeodesicFromLagrangian and GeodesicFromChristoffel classes now use the metric components evaluated along the curve, instead of the unmodified metric components.
The GeodesicFromLagrangian class now follows the Euler-Lagrange equations more rigorously: the defining representation now has a lower index, and the sign has been corrected.
The GeodesicTimeParam class now rejects index transformations, since these equations do not transform as a tensor.
The docstring for geodesic_time_param() now shows the correct formula and return value.
Performance optimizations:
Christoffel symbols and Riemann tensors are now recalculated directly when requested in a new coordinate system, instead of transforming the existing components. This improves performance, both because coordinate transformations on rank 3 or 4 tensors are slow, and because the directly calculated components are easier to simplify.
All built-in tensors derived from a metric are now calculated directly from the component formulas instead of using overloaded tensor operators, avoiding the overhead.
Index transformations now raise or lower one index at a time, simplifying and caching intermediate representations for later reuse, as in OGRe; this is more efficient than performing the full transformation in one step. The transformations start from the closest cached index configuration to minimize the number of raising/lowering steps.
Coordinate and index transformations now use direct component contractions instead of full SymPy tensor products.
Coordinate and index transformations now use sparse matrices to skip zero transformation terms.
The constructor of the Metric class has been optimized; it now avoids calculating the determinant.
Bug fixes:
Fixed a bug where the welcome message did not render correctly.
Fixed a bug where permute() failed for derived tensor classes, such as metrics and curvature tensors. permute() now always returns a generic Tensor instead of the original class.
Fixed a bug where permute() did not propagate the permuted index specification to the new tensor, which caused errors if it was used subsequently in calculations.
Fixed a bug where attempting to register a non-invertible coordinate transformation with set_coord_transformation() could leave the transformation state inconsistent.
Fixed a bug where adding tensors of rank 11 or higher produced incorrect results.
Fixed the type validation for the syms() function.
Fixed the default index letters (previously, $\epsilon$ appeared twice and $\eta$ was unused).
T.compare(..., exact=True) now uses exact comparison when comparing the associated metrics of the tensors. (Previously, the metrics were always compared using exact=False.)
Fixed various typos in the documentation.
The package now has a comprehensive internal test suite which thoroughly tests all OGRePy functions, classes, and methods and verifies that it accurately reproduces a wide variety of known results from differential geometry and general relativity, ensuring users can fully trust OGRePy as a reliable tool for research and pedagogy. This is currently used only internally, but will eventually be made available on the GitHub repository, once it matures a bit more and is cleaned up and properly documented.