An object-oriented general relativity package for Mathematica.
TCalcGeodesicWithTimeParameter[]
calculates the geodesic equations with respect to the time parameter (which is assumed to be the first coordinate) instead of an affine curve parameter.TCalcNormSquared[]
calculates the norm-squared of a tensor with respect to its metric, that is, the tensor contracted with itself in all indices. For example, for a vector vμ the norm-squared will be vμvμ and for a rank-2 tensor Tμν the result will be Tμν Tμν.TCite[]
displays information on how to cite this package in published research. Thank you for citing my work! :)TCalc*
modules no longer display a progress bar for the calculation. The progress bar wasn't too useful, since almost all tensor calculations are very fast even on an average laptop. Simplifications are the only operations which take any considerable amount of time, and thus progress bars are now displayed only for simplifications.TCovariantD
and TPartialD
:
TCovariantD
is used on a scalar, it is now replaced automatically with TPartialD
to improve performance, since the covariant derivative of a scalar is just a partial derivative anyway.TGetComponents
now applies a function given in the last argument to the components, and then simplifies them (in parallel, if parallelization is enabled), before returning the components. Note that TShow
and TList
have already had this option for some time, but now TGetComponents
has it too.TLineElement
now simplifies the line element before returning it.TSimplify
now allows the user to simplify any expression, not just tensor objects. TSimplify[expression]
simplifies expression
based on the user-defined simplification assumptions set using TSetAssumptions
. If expression
is a List
, the components will be simplified in parallel. The user can thus make use of OGRe's optimized simplification process to simplify any Mathematica expression.README.md
and CHANGELOG.md
.CITATION.cff
file (in YAML format) to the GitHub repository. This should add an option to get a citation in different formats directly from GitHub repository by clicking on "cite this repository" on the sidebar to the right.CITATION.bib
file (in BibTeX format) to the GitHub repository. You can use it to easily cite this package in your papers.TCalcGeodesicFromChristoffel
:
TCalcChristoffel
if they have not already been calculated.TCalcGeodesicFromLagrangian
:
TCalcLagrangian
(see below) if it has not already been calculated.Inactive
), which can sometimes help solve the geodesic equations by inspection. Use Activate
to evaluate the derivatives. (Recall that TList
and TShow
can apply a function to the tensor's components before displaying them, so you can write e.g. TList["ID", Activate]
.)TCalcGeodesicFromChristoffel
, but they will always have the same solutions. Usually, one of TCalcGeodesicFromChristoffel
or TCalcGeodesicFromLagrangian
will generate simpler equations for a given metric and/or coordinate system.TCalcLagrangian
: Calculates the curve Lagrangian of a metric, defined as the norm-squared of the tangent to the curve: gμνẋμẋν. Taking the square root of (the absolute value of) the Lagrangian yields the integrand of the curve length functional. Varying the Lagrangian using the Euler-Lagrange equations yields the geodesic equations (see TCalcGeodesicFromLagrangian
above).TMessage
:
Message
, the message will now be displayed as TMessage::<message_name>
instead of the awkward OGRe`Private`<module_name>::<message_name>
.TMessage
yet; the transition will be performed gradually in the upcoming releases.TSetAllowOverwrite
:
False
, which means you cannot create a new tensor with the same ID as an existing tensor. Calling TSetAllowOverwrite[True]
will allow overwriting tensors, which is more convenient, but can result in loss of data.Message
) using Off[TMessage::WarningOverwrite]
.TSetCurveParameter
:
TCalcGeodesicFromChristoffel
, TCalcGeodesicFromLagrangian
, and TCalcLagrangian
. These modules will produce results in terms of the coordinate symbols as functions of the curve parameter and their derivatives with respect to this parameter. The default value is λ.TList
or TShow
, the arguments of the coordinate functions are omitted (e.g. x instead of x[λ]) and derivatives with respect to the curve parameter are displayed in Newton (dot) notation (e.g. ẋ instead of x'[λ]) for improved readability. However, extracting the components using TGetComponents
will produce the full expressions (e.g. to be used with DSolve
).TSetReservedSymbols
:
TInitializeSymbols
, which has now been removed. However, TSetReservedSymbols
also saves the reserved symbols so they can be exported and then imported in a later session.TList
and TShow
will not show the arguments of the function when displaying the components of a tensor, for improved readability.TVolumeElementSquared
: Calculates the determinant of a given metric. The square root of the determinant (or its negative, for a pseudo-Riemannian metric) is the volume element.TCalc*
modules now check if the metric exists first.TGetComponents
: This module now gets the components of the tensor in the default index configuration and/or coordinate system if either or both are not specified. However, if the default value is used, a message will let you know which representation the components are given in, to avoid confusion.TInitializeSymbols
has been removed and replaced with TSetReservedSymbols
(see above).TList
and TShow
:
TList
will no longer list the same element twice if it is non-zero but equal to minus itself (e.g. ComplexInfinity
).TSetCurveParameter
and TSetReservedSymbols
above for other changes.TNewMetric
: If the new metric overrides a previous metric with the same ID, all of the curvature tensors calculated from the metric being overwritten will be automatically deleted, for consistency.TSetParallelization
:
$MaxLicenseSubprocesses
instead of the deprecated (as of Mathematica 12.3) $ConfiguredKernels
to determine how many kernels to launch when enabling parallelization.README.md
.TLineElement
: Displays the line element of a given metric in a coordinate system of your choice.TSetAutoUpdates
: Enables or disables automatic checks for updates at startup. Note that this setting is persistent between sessions.TInfo
:
TInfo
for that tensor.TList
or TShow
.TInfo[]
with no parameters lists all the tensors created so far in this session: coordinate systems, metrics, and the tensors associated with each metric.TSetParallelization
: Calling TSetParallelization[]
with no parameters now returns the current setting, True
or False
.Splice
function, which only works in v12.1 and later. This has now been fixed, and compatibility with v12.0 has been restored. Although I always develop the package using the latest version of Mathematica, I have now installed Mathematica 12.0 on my computer alongside the latest version, and will use it to ensure compatibility with v12.0 in all future releases of the package.OGRe_Documentation.nb
to prevent the message "This file contains potentially unsafe dynamic content" from appearing when opening it.README.md
, so I moved it to a separate file, CHANGELOG.md
.TAddCoordTransformation
now has the clearer syntax TAddCoordTransformation[sourceID -> targetID, rules]
. The old syntax (with ,
instead of ->
) can still be used.TChangeID
now has the clearer syntax TChangeID[oldID -> newID]
. The old syntax (with ,
instead of ->
) can still be used.TChristoffel
, TEinsteinTensor
, TRicciScalar
, TRicciTensor
, and TRiemannTensor
have been renamed to TCalcChristoffel
, TCalcEinsteinTensor
, TCalcRicciScalar
, TCalcRicciTensor
, and TCalcRiemannTensor
respectively, to group them all together and clarify that they all calculate specific tensors using TCalc
.TIndexLetters
, TParallelize
, and TSimplifyAssumptions
have been renamed to TSetIndexLetters
, TSetParallelization
, and TSetAssumptions
respectively, to group them all together and clarify that they all change various settings.TCalc
, TCalcChristoffel
, TCalcEinsteinTensor
, TCalcRicciScalar
, TCalcRicciTensor
, TCalcRiemannTensor
, TChangeID
, TImport
, TNewCoordinates
, TNewMetric
, and TNewTensor
no longer overwrite existing tensors, to prevent data loss. The user will be instructed to rename the existing tensor using TChangeID
or delete it using TDelete
first.SessionSubmit[StartupCheckForUpdates[]];
in OGRe.m
to UpdateMessage = "Checking for updates is disabled.";
.README.md
.README.md
.TExport
, TExportAll
, TImport
, and TImportAll
:
TExportAll
and TImportAll
that the directory where the file will be saved or read from can be changed using SetDirectory
.Options
will now be populated correctly with the specific keys relevant to this version, even if you import from other versions which may use different Options
keys.x |-> body
. However, since this is a new feature introduced in Mathematica 12.2, this accidentally made the package incompatible with earlier Mathematica versions. I changed it to the old syntax Function[x, body]
in order to maintain compatibility.TDocs
: Opens the Mathematica notebook OGRe_Documentation.nb
directly from the GitHub repository. This allows users to instantly access the latest documentation from any Mathematica session, whether the package itself was loaded locally or from GitHub.TParallelize
:
TExportAll
, so it will be imported automatically with TImportAll
in future sessions.TCalc
now displays a progress bar (see below).TCheckForUpdates
:
OGRe.m
to the current notebook directory if the notebook is an Untitled notebook, meaning it is not an actual file in the file system and thus does not have a notebook directory.TList
and TShow
:
MatrixForm
may be added in a future version.)ReplaceAll[rules]
to apply the rules
to the elements, but any function can be used. Note that applying ReplaceAll
to the output of TShow
or TList
directly won't work, since the output is formatted.TNewMetric
now verifies that the metric components are an invertible, symmetric, and square matrix.TParallelize
(see above). The parallelization is implemented using a thread pool model (with ParallelSubmit
and WaitAll
), which in my benchmarks was found to provide better performance than the simpler Parallelize
or ParallelMap
.TCalc
and simplifications now both display progress bars, so you can keep track of long calculations. This was a popular feature request, especially for simplifications, since they are usually the most time-consuming operations.README.md
file.TCheckForUpdates
: Automatically checks the GitHub repository for updates. If a new version of the package is available, the module will offer an option to download or install the new version and reload the package.TGetComponents
: Extracts the components of a tensor object in a specific representation as a List
.TInfo
: Displays information about a tensor object, and any other objects associated with it, in human-readable form.TAddCoordTransformation
now also calculates the Jacobian of the transformation when it is executed, and stores the result for future use within the tensor object of the source coordinates. This improves performance by using the pre-calculated Jacobian whenever a coordinate transformation is performed, instead of calculating it from scratch every time, as was the case in v1.0.TChristoffel
now explicitly marks the resulting tensor object as having special transformation properties. The Levi-Civita connection, whose components are the Christoffel symbols, does not transform like a tensor under a coordinate transformation, and OGRe now automatically knows to use the correct transformation rule. Please note that tensors created with TChristoffel
in v1.0 will not transform correctly, so they should be recalculated after updating.
TExport
now adds a key named "OGReVersion"
which records the version of the package used to create the tensor being exported. This will be used in future versions to ensure backwards compatibility.TExportAll
now exports, in addition to all the tensors defined so far, a special key, Options
, containing information about the current session. Currently, this key stores the version of the package, the index letters to use, and the simplification assumptions set by the user. When importing the data in another session using TImportAll
, the version number will be used to ensure backwards compatibility, and the other options will be used to restore any user-defined index letters and simplification assumptions made during the session.TNewTensor
now allows defining the components of the new tensor in any coordinate system. In v1.0, the components had to be defined in the default coordinate system of the associated metric. This is still the default behavior if a coordinate system is not specified, for compatibility with v1.0, but it is recommended to always specify the coordinate system explicitly, to avoid accidentally defining the tensor with the wrong components.TSimplifyAssumptions
now appends new simplification assumptions to the list of previously added assumptions, instead of replacing it. Also, OGRe now automatically assumes that all variables are real, which helps simplify certain expressions. If you are using more exotic variables, use TSimplifyAssumptions[!Reals]
to disable this assumption."Role"
key of each tensor object now indicates how that object was created. In v1.0, tensors created with TNewCoordinates
had the role "Coordinates"
and tensors created with TNewMetric
had the role "Metric"
, but all other tensors had the role "General"
. Now tensors will have the roles "Tensor"
, "Calculated"
, "Christoffel"
, "Riemann"
, "Ricci Tensor"
, "Ricci Scalar"
, or "Einstein"
if they were created using TNewTensor
, TCalc
, TChristoffel
, TRiemannTensor
, TRicciTensor
, TRicciScalar
, or TEinstein
respectively. This is currently just for bookkeeping, but may have other uses in future versions. Note that tensors imported from v1.0 will still have the role "General"
.This is the initial release.