Physics for Maple 2017 - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Physics : Updates : Physics for Maple 2017


Maple provides a state-of-the-art environment for algebraic computations in Physics, with emphasis on ensuring that the computational experience is as natural as possible. The theme of the Physics project for Maple 2017 has been the consolidation of the functionality introduced in previous releases, together with significant enhancements and new functionality in General Relativity, in connection with classification of solutions to Einstein's equations and tensor representations to work in the embedded 3D curved space, relevant in numerical relativity, and Field Theory, in connection with computational representations for the objects entering the Standard Model in particle physics.

Taking all together, there are more than 300 enhancements throughout the entire package increasing robustness, versatility and functionality, extending once more the range of Physics-related algebraic computations that can be done using computer algebra software and in a natural way.

As part of its commitment to providing the best possible environment for algebraic computations in Physics, Maplesoft launched a Maple Physics: Research and Development web site with Maple 18, which enabled users to download research versions, ask questions, and provide feedback. The results from this accelerated exchange with people around the world have been incorporated into the Physics package in Maple 2017.



General Relativity: classification of solutions to Einstein's equations and the Tetrads package

The 3D metric and the ThreePlusOne (3 + 1) new Physics subpackage

Tensors in Special and General Relativity

The StandardModel new Physics subpackage

General Relativity: classification of solutions to Einstein's equations and the Tetrads package

In Maple 2016, the digitizing of the database of solutions to Einstein's equations was finished, added to the standard Maple library, with all the metrics from "Stephani, H.; Kramer, D.; MacCallum, M.; Hoenselaers, C.; and Herlt, E., Exact Solutions to Einstein's Field Equations". These metrics can be loaded to work with them, or change them, or searched using g_ (the Physics command representing the spacetime metric that also sets the metric to your choice in one go) or using the command DifferentialGeometry:-Library:-MetricSearch.


Related to these developments, in Maple 2017, the Physics:-Tetrads package has been vastly improved and extended, now including new commands like PetrovType and SegreType to classify these metrics, and the TransformTetrad now has an option canonicalform to automatically derive a transformation and put the tetrad in canonical form (reorientation of the axis of the local system of references), a relevant step in resolving the equivalence between two metrics.


In the PDEtools package, you have the mathematical tools - including a complete symmetry approach - to work with the underlying partial differential equations. By combining the functionality of the Physics:-Tetrads package, the Physics:-TransformCoordinates command, and the ability to compute Riemann invariants and Weyl scalars, you can also formulate and, depending on the metrics also resolve, the equivalence problem; that is: to answer whether or not, given two metrics, they can be obtained from each other by a transformation of coordinates, as well as compute the transformation.


Depending on the context, or textbook, two different signatures are used in the description of spacetime: (− + + +), used for instance in the database of solutions of Einstein's equations and related textbook, and (+ − − −) typically used in particle Physics and in Landau's Course for Theoretical Physics, the main reference for the Maple Physics project. Two other computational representations of those same signatures are (+ + + −) and (− − − +), with time in position 4; for the computer, this difference in representation is relevant since it indicates the computational position where the component 0 is to be found (either 1 or 4). This difference also changes the position of the time coordinate in the ordered list of the coordinates. Changing the signature to follow a textbook or just for convenience thus entails redefining the metric rearranging lines and columns in its matrix representation and/or changing the sign, and reordering the coordinates, operations prone to mistakes. To handle these redefinitions of the metric and coordinates according to a change in the signature, a new command Redefine (options fromsignature, tosignature), got added to the Physics package.


Petrov and Segre types, tetrads in canonical form


Setting lowercaselatin letters to represent tetrad indices

Defined as tetrad tensors see ?Physics,tetrads,𝔢a,μ,ηa,b,γa,b,c,λa,b,c

Defined as spacetime tensors representing the NP null vectors of the tetrad formalism see ?Physics,tetrads,lμ,nμ,mμ,m&conjugate0;μ



There are six Petrov types: I, II, III, D, N and O. Start with a spacetime metric of Petrov type "I"  (the numbers always refer to the equation number in the "Exact solutions to Einstein's field equations" textbook)


Systems of spacetime Coordinates are: X=t,x,y,φ

Default differentiation variables for d_, D_ and dAlembertian are: X=t,x,y,φ

The McLenaghan, Tariq (1975), Tupper (1976) metric in coordinates t,x,y,φ

Parameters: a,k,κ0

Comments: k paramⅇtrⅈzⅇs thⅇ most gⅇnⅇral ⅇlⅇctromagnⅇtⅈc ⅈnvarⅈant wⅈth rⅇspⅇct to thⅇ last 3 Kⅈllⅈng vⅇctors

Resetting the signature of spacetime from "- - - +" to `- + + +` in order to match the signature in the database of metrics:

The Weyl scalars are derived from the Weyl tensor and the null vectors of the Newman-Penrose formalism (l_, n_, m_ and mb_)







For presentation simplicity, without absolute values, assume that x is positive or 0 and recompute the Weyl scalars

Assumex  0






Relevant in connection with the equivalence problem between two metrics, the Petrov type of this metric is




and the Plebanski-Segre type is




Two spacetime metrics with different classification cannot be different coordinate representations of the same metric (if the classification is the same the question is still undecided). The same computation but tracking the principal roots behind this classification







The principal polynomial only, having four different roots corresponding to Petrov type "I"




An example of Petrov type III and a canonical form for the corresponding tetrad.

g_12, 35, 1

Systems of spacetime Coordinates are: X=u,x,y,z

Default differentiation variables for d_, D_ and dAlembertian are: X=u,x,y,z

The Kaigorodov (1962), Cahen (1964), Siklos (1981), Ozsvath (1987) metric in coordinates u,x,y,z

Parameters: Λ

For presentation simplicity, assume that z and the parameter Λ are positive




The Petrov and Plebanski-Segre types, the default tetrad and the corresponding Weyl scalars:













These scalars are not in canonical form. Compute then a canonical form for this tetrad (i.e. rotate the tetrad such that the Weyl scalars match the canonical form shown in the Petrov classification table) and set this rotated tetrad (using Setup), then recompute the Weyl scalars





The scalars now match the requirement for canonical form shown in the Petrov classification table for type III. In this example, the canonical form computed for the tetrad




is not much more complicated than the default tetrad (14) that is not in canonical form, but depending on the example the canonical form can be significantly more complicated.

Examples of transforming the tetrad into canonical form for spacetimes of Petrov types II, N and D can be seen by performing the same steps above departing from the metrics of the database with numbers  g_[[24, 37, 7]], g_[[12, 6, 1]] and g_[[12, 8, 4]].


Together with the developments above, the TransformTetrad got thoroughly reviewed and its transformation functionality extended in order to perform the six traditional rotations that leave different null vectors of the Newman-Penrose formalism unchanged in direction or length,

Load the Schwarzschild metric in spherical coordinates; you can input g_[Schwarzschild] or the simpler


Systems of spacetime Coordinates are: X=t&comma;r&comma;θ&comma;φ

Default differentiation variables for d_, D_ and dAlembertian are: X=t&comma;r&comma;θ&comma;φ

The Schwarzschild metric in coordinates t&comma;r&comma;θ&comma;φ

Parameters: m

An orthonormal tetrad (this is the one used by default) is

Setuptetrad &equals; orthonormal&colon; e_




Type of tetrad: orthonormal



The key observation here is that the orientation of the axis of the local system of references (the tetrad system) is arbitrary and with them the values of the Weyl scalars too. So, you can perform a Lorentz transformation on the tetrad, without changing the spacetime metric g_ or its Petrov classification while fixing the values of the Weyl scalars in one of the possible forms (classes) shown in the Petrov classification table.

The transformations that you can perform with TransformTetrad are either the standard ones, of classes I, II or III specified in the description of TransformTetrad, or arbitrary. For example, transform the orthonormal tetrad above using a null rotation with fixed l_, where l_ and the related NULL vectors of the Newman-Penrose formalism (commands of the Tetrads package) satisfy







Note the transformation parameter E introduced by TransformTetrad. You can replace it by a value (see subs and eval) or assign it, or you may want to Assume that this parameter is, for instance, real







Now is this a tetrad? Of what type?


Type of tetrad: null



TransformTetrad applies a transformation on a tetrad but does not set the value of e_ to this result. For that purpose, i.e. to effectively rotate the tetrad system of references to match the orientation/tetrad you want, use Setup. Following this reorientation of the tetrad, all the components of tensors in the local (tetrad) system of references, as for instance gamma_, lambda_ and the tetrad components of spacetime tensors, automatically change. For example, the Ricci rotation coefficients gamma_ follow this change of value of the components of &efr;__a,&mu; according to their definition




So before setting (23) as the new tetrad, for comparison purposes below, track first the value of the Ricci rotation coefficient with covariant indices 1, 2, 1




Set now (23) as the new tetrad




The new value of γ1,2,1




Equivalence for Schwarzschild metric (spherical and Kruskal coordinates)

Formulation of the problem (remove mixed coordinates)


withPhysics&colon; withTetrads&colon; Setupauto&equals;true&comma; mathematicalnotation &equals; true&semi;

Setting lowercaselatin letters to represent tetrad indices

Defined as tetrad tensors see ?Physics,tetrads,𝔢a,μ,ηa,b,γa,b,c,λa,b,c

Defined as spacetime tensors representing the NP null vectors of the tetrad formalism see ?Physics,tetrads,lμ,nμ,mμ,m&conjugate0;μ

* Partial match of 'auto' against keyword 'automaticsimplification'



The departure point, Schwarzschild metric in spherical coordinates


Systems of spacetime Coordinates are: X=r&comma;θ&comma;φ&comma;t

Default differentiation variables for d_, D_ and dAlembertian are: X=r&comma;θ&comma;φ&comma;t

The Schwarzschild metric in coordinates r&comma;θ&comma;φ&comma;t

Parameters: m



Introduce now Kruskal coordinates following the literature (see Wikipedia) and the corresponding line element involving "mixed" coordinates


Systems of spacetime Coordinates are: K=u&comma;ϑ&comma;ϕ&comma;v&comma;X=r&comma;θ&comma;φ&comma;t






The mixing of variables is visible: in the line element above is in Kruskal coordinates but you also see r , which belongs to the X (not K) coordinates.


For the purpose of formulating problem free of this mixing of coordinates, set the metric now to be (32)

Setupdiff &equals; K&comma;metric&equals;&comma; quiet&colon;




To remove the mix of coordinates, introduce a transformation with unknown transformation functions f&comma;h, change variables, and resolve for the transformation functions f&comma;g (this in itself is resolving a form of equivalence problem).

tr__0  u&equals;fr&comma;t&comma; v&equals;hr&comma;t




fr&comma;twill now be displayed asf

hr&comma;twill now be displayed ash





Equate to (30) and solve








Without loss of generality, set _C1&equals;0&comma;_C2&equals;1&comma;_C3&equals;0 

tr  combinesubs_C1&equals;0&comma;_C2&equals;1&comma;_C3&equals;0&comma; eval&comma;1



Check it out:







Compute the inverse of the transformation (39)


itr  simplifynormalsolve&comma;r&comma;t&comma;expanded



This inverse transformation involves the LambertW function. Set now the metric to be the standard Schwarzschild's metric in spherical coordinates (30) and use itr to get he form of the metric entirely in Kruskal coordinates


Default differentiation variables for d_, D_ and dAlembertian are: X=r&comma;θ&comma;φ&comma;t

The Schwarzschild metric in coordinates r&comma;θ&comma;φ&comma;t

Parameters: m



So this is Schwarzschild's solution all in Kruskal coordinates




This metric involves the LambertW function in a non-simplifiable form.

Solving the Equivalence


We now have the two forms: (41) in spherical and (44) in Kruskal coordinates, so we can formulate the equivalence problem from one coordinate system to the other one.


The transformation to be resolved does not need to involve &phi; because neither &phi; nor ϕ enter either of the two metrics.

The transformation does not need to involve &theta; or &vartheta; because they enter the metrics in exactly the same position and with the same dependence.

In addition the Weyl scalars of both metrics are in canonical form and the only scalar different from zero, that is &Psi;__2 does not depend on any of &phi;&comma;&theta;&comma; &varphi;&comma;&vartheta;)


So we look for a generic transformation from spherical to Kruskal of the form

r&equals;RK&comma; t&equals;TK




Ru&comma;ϑ&comma;ϕ&comma;vwill now be displayed asR

Tu&comma;ϑ&comma;ϕ&comma;vwill now be displayed asT


The metric set in this moment is in spherical coordinates, (43), so change using (45) and equate to (44) in Kruskal coordinates


convertTransformCoordinates&comma;g_mu&comma;nu&comma;K&comma;X&equals;&comma; setofequations



This is a nonlinear, non-rational PDE system in two unknowns depending on two independent variables (see (45)). You can now either call pdsolve on (47), solving the problem in one step, or first split into cases without solving any differential equation, just doing differential elimination, to see the cases


Typesetting:-_HolddiffTK&comma;u&equals;2mu&comma;Typesetting:-_HolddiffTK&comma;&vartheta;&equals;0&comma;Typesetting:-_HolddiffTK&comma;&varphi;&equals;0&comma;Typesetting:-_HolddiffTK&comma;v&equals;2mv&comma;Typesetting:-_HoldRK&equals;2LambertW12uv&ExponentialE;1m&plus;1m &where &comma;Typesetting:-_HolddiffTK&comma;u&equals;2mu&comma;Typesetting:-_HolddiffTK&comma;&vartheta;&equals;0&comma;Typesetting:-_HolddiffTK&comma;&varphi;&equals;0&comma;Typesetting:-_HolddiffTK&comma;v&equals;2mv&comma;Typesetting:-_HoldRK&equals;2LambertW12uv&ExponentialE;1m&plus;1m &where


By using differential elimination we removed all nonlinearities, the problem is actually easy for the differential equation routines




So the transformation of coordinates resolving the equivalence between (41) and (44) is




Check this result transforming (41) fully written in spherical coordinates into (44) fully written in Kruskal coordinates







Redefining the spacetime metric and coordinates according to the signature

restart&semi; withPhysics&colon; 


Default differentiation variables for d_, D_ and dAlembertian are: X=x&comma;y&comma;z&comma;t

Systems of spacetime Coordinates are: X=x&comma;y&comma;z&comma;t



Consider the generic form of a spacetime metric, for the purpose of illustrating its redefinition (reordering of lines and columns) when changing the signature, it doesn't need to depend on the coordinates

G  Matrix4&comma;symbol&equals;g&comma; shape&equals;symmetric

Set the metric, and in the same call check the value of signature: it is (- - - +)

Setupsignature&comma; metric &equals; G

metric=1&comma;1=g1,1&comma;1&comma;2=g1,2&comma;1&comma;3=g1,3&comma;1&comma;4=g1,4&comma;2&comma;2=g2,2&comma;2&comma;3=g2,3&comma;2&comma;4=g2,4&comma;3&comma;3=g3,3&comma;3&comma;4=g3,4&comma;4&comma;4=g4,4&comma;signature=- - - +


Track the line element




Change now the signature by reversing the position of the time-like component, from 4 to 1


signature=+ - - -


Neither the metric nor the coordinates change: t is still in position 4 and the component (1, 1) of the metric is still g__11


Systems of spacetime Coordinates are: X=x&comma;y&comma;z&comma;t




This design gives you freedom to set things as necessary. However, after changing the signature we may also want to redefine the coordinates - place t in position 1 - and possibly also the metric reordering its lines and rows accordingly. A new command for that purpose is Redefine, to which you need to indicate the previous signature (or a new signature, to explore the effect of a change before doing it) and an indication of whether you want to redefine the metric, the coordinates or all:

Redefinecoordinates&comma; fromsignature &equals; ---+



Redefinemetric&comma; fromsignature &equals; ---+

These redefinitions however were not set, the keywords coordinates, metric, or all only trigger the change, t is still in position 4 and the component (1,1) of the metric is still g__1,1


Systems of spacetime Coordinates are: X=x&comma;y&comma;z&comma;t




You can now either use the output of this routine to redefine things using the Setup command, or do all in one go using any of the keywords setcoordinates, setmetric, or setall, for example

Redefinesetall&comma; fromsignature &equals; ---+

Now t in position 1 and the component (1,1) of the metric equal to g__4,4


Systems of spacetime Coordinates are: X=t&comma;x&comma;y&comma;z




Note that, despite the reordering of lines and columns in the metric, because we also reordered the variables, the line element has not changed:







This routine is particularly useful when working with metrics from the database of solutions to Einstein's equations, all of which reset the signature to (-+++) when loaded. For example:


Systems of spacetime Coordinates are: X=t&comma;x&comma;y&comma;φ

Default differentiation variables for d_, D_ and dAlembertian are: X=t&comma;x&comma;y&comma;φ

The McLenaghan, Tariq (1975), Tupper (1976) metric in coordinates t&comma;x&comma;y&comma;φ

Parameters: a&comma;k&comma;&kappa;0

Comments: k param&ExponentialE;trⅈz&ExponentialE;s th&ExponentialE; most g&ExponentialE;n&ExponentialE;ral &ExponentialE;l&ExponentialE;ctromagn&ExponentialE;tⅈc ⅈnvarⅈant wⅈth r&ExponentialE;sp&ExponentialE;ct to th&ExponentialE; last 3 Kⅈllⅈng v&ExponentialE;ctors

Resetting the signature of spacetime from "+ - - -" to `- + + +` in order to match the signature in the database of metrics:

Note above the message about resetting the signature; query about:


signature=- + + +


How would this metric and coordinates look with the original signature (---+) ?

Redefineall&comma; tosignature &equals; ---+

By entering the command above replacing all by setall not only the list of coordinates and metric matrix form are returned but they are also set in one go.


The 3D metric and the ThreePlusOne (3 + 1) new Physics subpackage

In the general theory of relativity, x1, x2, x3 can be any quantities defining the position of bodies in space and the time coordinate x0 can be defined by an arbitrarily running clock. In order to define simultaneity (synchronizing clocks located at different points in space) as well as determine actual space distances and time intervals in terms of these quantities x0, x1, x2, x3, it is relevant to split the spacetime mathematical description of gravity into its space and time parts. For this purpose, a new package, ThreePlusOne, and three new commands, were added to the Physics package:


Decompose, to decompose 4D tensorial expressions (free and/or contracted indices) into the space and time parts.


gamma_, representing the three-dimensional metric tensor, with which the element of spatial distance is defined as  dl 2=γi,jdxidxj.


Redefine, to redefine the coordinates and the spacetime metric according to changes in the signature from any of the four possible signatures(− + + +), (+ − − −), (+ + + −) and ((− + + +) to any of the other ones.






Define now an arbitrary tensor A


Defined objects with tensor properties



So Aμ is a 4D tensor with only one free index, where the position of the time-like component is the position of the different sign in the signature, that you can query about via


signature=- - - +


To perform a decomposition into space and time, set - for instance - the lowercase latin letters from i to s to represent spaceindices and

Setupspaceindices &equals; lowercase_is



Accordingly, the 3+1 decomposition of Aμ is




The 3+1 decomposition of the inert representation %g_[mu,nu] of the 4D spacetime metric; use the inert representation when you do not want the actual components of the metric appearing in the output

Decompose%g_mu&comma; nu&semi;



Note the position of the component %g_[0, 0], related to the trailing position of the time-like component in the signature    &plus;.

Compare the decomposition of the 4D inert with the decomposition of the 4D active spacetime metric


Decomposeg_mu&comma; nu&semi;



Note that in general the 3D space part of gμ,ν is not equal to the 3D metric γi,j whose definition includes another term (see [1] Landau & Lifshitz, eq.(84.7)).




The 3D space part of gμ,νμ,ν is actually equal to the 3D metric γi,ji,j




To derive the formula (71) for the covariant components of the 3D metric, Decompose into 3+1 the identity

%g_~alpha&comma; ~mu %g_mu&comma; beta &equals; KroneckerDelta~alpha&comma; beta&semi;



To the side, for illustration purposes, these are the 3 + 1 decompositions, first excluding the repeated indices, then excluding the free indices







Compare with a full decomposition




Eq is a symmetric matrix of equations involving non-contracted occurrences of g0,0, gj,0 and gj,i. Isolate, in Eq1,2, gj,0, that you input as %g_[~j, ~0], and substitute into Eq1,1

isolateEq1&comma; 2&comma; %g_~j&comma; ~0&semi;






Collect gj,i, that you input as %g_[~j, ~i]

collect&comma;%g_~j&comma; ~i



Since the right-hand side is the identity matrix and, from (72), gi,j= &gamma;i,j, the expression between parenthesis, multiplied by -1, is the reciprocal of the contravariant 3D metric γi,j, that is the covariant 3D metric γi,j, in accordance to its definition for the signature - - - +






[1] Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.

Maple 2017 introduces a new package, ThreePlusOne, to cast Einstein's equations in a 3+1 form, that is, representing spacetime as a stack of nonintersecting 3-hypersurfaces Σ (not necessarily actual space). This 3&plus;1 description is key in the Hamiltonian formulation of gravity as well as in the study of gravitational waves, black holes, neutron stars, and in general to study the evolution of physical system in general relativity by running numerical simulations as traditional initial value (Cauchy) problems. ThreePlusOne includes:


Computational representations for the spatial metric γi,j that is induced by gμ,ν on the 3-dimensional hypersurfaces, and the related covariant derivative, Christoffel symbols and Ricci and Riemann tensors.


Computational representations for the Lapse, Shift, Unit normal and Time vectors and Extrinsic curvature related to the ADM equations.


restart&semi; withPhysics&colon; Setupcoordinatesystems&equals;cartesian&semi;

Default differentiation variables for d_, D_ and dAlembertian are: X=x&comma;y&comma;z&comma;t

Systems of spacetime Coordinates are: X=x&comma;y&comma;z&comma;t




Setting lowercaselatin_is letters to represent space indices

Defined as 4D, spacetime tensors that are purely spatialsee ?Physics,ThreePlusOne,γμ,ν,𝒟μ,Γμ,ν,α,Rμ,ν,Rμ,ν,α,β,βμ,nμ,tμ,Κμ,ν

Changing the signature of spacetime from - - - + to + + + - in order to match the signature customarily used in the ADM formalism



Note the different color for γμ,ν, now a 4D tensor representing the metric of a generic 3-dimensional hypersurface (not necessarily the 3D space) induced by the 4D spacetime metric gμ,ν. All the ThreePlusOne tensors are displayed in black to distinguish them of the corresponding 4D or 3D tensors. The particular hypersurface γ&mu;,&nu; operates is parameterized by the Lapse α and the Shift βμ.

The induced metric γ&mu;,&nu;is defined in terms of the UnitNormalVector nμ and the 4D metric gμ,ν as




where nμ is defined in terms of the Lapse α and the derivative of a scalar function t that can be interpreted as a global time function




The TimeVector is defined in terms of the Lapse α and the Shift βμ and this vector  nμ as