7374 Reputation

19 Badges

14 years, 77 days

MaplePrimes Activity

These are Posts that have been published by ecterrab


The Physics Updates for Maple 2019 (current v.331 or higher) is already available for installation via MapleCloud. This version contains further improvements to the Maple 2019 capabilities for solving PDE & BC as well as to the tensor simplifier. To install these Updates,

  • Open Maple,
  • Click the MapleCloud icon in the upper-right corner to open the MapleCloud toolbar 
  • In the MapleCloud toolbar, open Packages
  • Find the Physics Updates package and click the install button, it is the last one under Actions
  • To check for new versions of Physics Updates, click the MapleCloud icon. If the Updates icon has a red dot, click it to install the new version

Note that the first time you install the Updates in Maple 2019 you need to install them from Packages, even if in your copy of Maple 2018 you had already installed these Updates.

Also, at this moment you cannot use the MapleCloud to install the Physics Updates for Maple 2018. So, to install the last version of the Updates for Maple 2018, open Maple 2018 and enter PackageTools:-Install("5137472255164416", version = 329, overwrite)

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

A Complete Guide for performing Tensors computations using Physics


This is an old request, a complete guide for using Physics  to perform tensor computations. This guide, shown below with Sections closed, is linked at the end of this post as a pdf file with all the sections open, and also as a Maple worksheet that allows for reproducing its contents. Most of the computations shown are reproducible in Maple 2018.2.1, and a significant part also in previous releases, but to reproduce everything you need to have the Maplesoft Physics Updates version 283 or higher installed. Feedback one how to improve this presentation is welcome.


Physics  is a package developed by Maplesoft, an integral part of the Maple system. In addition to its commands for Quantum Mechanics, Classical Field Theory and General Relativity, Physics  includes 5 other subpackages, three of them also related to General Relativity: Tetrads , ThreePlusOne  and NumericalRelativity (work in progress), plus one to compute with Vectors  and another related to the Standard Model (this one too work in progress).


The presentation is organized as follows. Section I is complete regarding the functionality provided with the Physics package for computing with tensors  in Classical and Quantum Mechanics (so including Euclidean spaces), Electrodynamics and Special Relativity. The material of section I is also relevant in General Relativity, for which section II is all devoted to curved spacetimes. (The sub-section on the Newman-Penrose formalism needs to be filled with more material and a new section devoted to the EnergyMomentum tensor is appropriate. I will complete these two things as time permits.) Section III is about transformations of coordinates, relevant in general.


For an alphabetical list of the Physics commands with a brief one-line description and a link to the corresponding help page see Physics: Brief description of each command .


I. Spacetime and tensors in Physics



This section contains all what is necessary for working with tensors in Classical and Quantum Mechanics, Electrodynamics and Special Relativity. This material is also relevant for computing with tensors in General Relativity, for which there is a dedicated Section II. Curved spacetimes .


Default metric and signature, coordinate systems


Tensors, their definition, symmetries and operations



Physics comes with a set of predefined tensors, mainly the spacetime metric  g[mu, nu], the space metric  gamma[j, k], and all the standard tensors of  General Relativity. In addition, one of the strengths of Physics is that you can define tensors, in natural ways, by indicating a matrix or array with its components, or indicating any generic tensorial expression involving other tensors.


In Maple, tensor indices are letters, as when computing with paper and pencil, lowercase or upper case, latin or greek, entered using indexation, as in A[mu], and are displayed as subscripts as in A[mu]. Contravariant indices are entered preceding the letter with ~, as in A[`~μ`], and are displayed as superscripts as in A[`~mu`]. You can work with two or more kinds of indices at the same time, e.g., spacetime and space indices.


To input greek letters, you can spell them, as in mu for mu, or simpler: use the shortcuts for entering Greek characters . Right-click your input and choose Convert To → 2-D Math input to give to your input spelled tensorial expression a textbook high quality typesetting.


Not every indexed object or function is, however, automatically a tensor. You first need to define it as such using the Define  command. You can do that in two ways:



Passing the tensor being defined, say F[mu, nu], possibly indicating symmetries and/or antisymmetries for its indices.


Passing a tensorial equation where the left-hand side is the tensor being defined as in 1. and the right-hand side is a tensorial expression - or an Array or Matrix - such that the components of the tensor being defined are equal to the components of the tensorial expression.


After defining a tensor - say A[mu] or F[mu, nu]- you can perform the following operations on algebraic expressions involving them



Automatic formatting of repeated indices, one covariant the other contravariant


Automatic handling of collisions of repeated indices in products of tensors


Simplify  products using Einstein's sum rule for repeated indices.


SumOverRepeatedIndices  of the tensorial expression.


Use TensorArray  to compute the expression's components


TransformCoordinates .


If you define a tensor using a tensorial equation, in addition to the items above you can:



Get each tensor component by indexing, say as in A[1] or A[`~1`]


Get all the covariant and contravariant components by respectively using the shortcut notation A[] and "A[~]".


Use any of the special indexing keywords valid for the pre-defined tensors of Physics; they are: definition, nonzero, and in the case of tensors of 2 indices also trace, and determinant.


No need to specify the tensor dependency for differentiation purposes - it is inferred automatically from its definition.


Redefine any particular tensor component using Library:-RedefineTensorComponent


Minimizing the number of independent tensor components using Library:-MinimizeTensorComponent


Compute the number of independent tensor components - relevant for tensors with several indices and different symmetries - using Library:-NumberOfTensorComponents .


The first two sections illustrate these two ways of defining a tensor and the features described. The next sections present the existing functionality of the Physics package to compute with tensors.


Defining a tensor passing the tensor itself


Defining a tensor passing a tensorial equation


Automatic formatting of repeated tensor indices and handling of their collisions in products


Tensor symmetries


Substituting tensors and tensor indices


Simplifying tensorial expressions




Visualizing tensor components - Library:-TensorComponents and TensorArray


Modifying tensor components - Library:-RedefineTensorComponent


Enhancing the display of tensorial expressions involving tensor functions and derivatives using CompactDisplay


The LeviCivita tensor and KroneckerDelta


The 3D space metric and decomposing 4D tensors into their 3D space part and the rest


Total differentials, the d_[mu] and dAlembertian operators


Tensorial differential operators in algebraic expressions


Inert tensors


Functional differentiation of tensorial expressions with respect to tensor functions


The Pauli matrices and the spacetime Psigma[mu] 4-vector


The Dirac matrices and the spacetime Dgamma[mu] 4-vector


Quantum not-commutative operators using tensor notation


II. Curved spacetimes



Physics comes with a set of predefined tensors, mainly the spacetime metric  g[mu, nu], the space metric  gamma[j, k], and all the standard tensors of general relativity, respectively entered and displayed as: Einstein[mu,nu] = G[mu, nu],    Ricci[mu,nu]  = R[mu, nu], Riemann[alpha, beta, mu, nu]  = R[alpha, beta, mu, nu], Weyl[alpha, beta, mu, nu],  = C[alpha, beta, mu, nu], and the Christoffel symbols   Christoffel[alpha, mu, nu]  = GAMMA[alpha, mu, nu] and Christoffel[~alpha, mu, nu]  = "GAMMA[mu,nu]^(alpha)" respectively of first and second kinds. The Tetrads  and ThreePlusOne  subpackages have other predefined related tensors. This section is thus all about computing with tensors in General Relativity.


Loading metrics from the database of solutions to Einstein's equations


Setting the spacetime metric indicating the line element or a Matrix


Covariant differentiation: the D_[mu] operator and the Christoffel symbols


The Einstein, Ricci, Riemann and Weyl tensors of General Relativity


A conversion network for the tensors of General Relativity


Tetrads and the local system of references - the Newman-Penrose formalism


The ThreePlusOne package and the 3+1 splitting of Einstein's equations


III. Transformations of coordinates


See Also


Physics , Conventions used in the Physics package , Physics examples , Physics Updates



Download, or the pdf version with sections open: Tensors_-_A_Complete_Guide.pdf

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Overview of the Physics Updates


One of the problems pointed out several times about the Physics package documentation is that the information is scattered. There are the help pages for each Physics command, then there is that page on Physics conventions, one other with Examples in different areas of physics, one "What's new in Physics" page at each release with illustrations only shown there. Then there are a number of Mapleprimes post describing the Physics project and showing how to use the package to tackle different problems. We seldomly find the information we are looking for fast enough.


This post thus organizes and presents all those elusive links in one place. All the hyperlinks below are alive from within a Maple worksheet. A link to this page is also appearing in all the Physics help pages in the future Maple release. Comments on practical ways to improve this presentation of information are welcome.



As part of its commitment to providing the best possible environment for algebraic computations in Physics, Maplesoft launched, during 2014, a Maple Physics: Research and Development website. That enabled users to ask questions, provide feedback and download updated versions of the Physics package, around the clock.

The "Physics Updates" include improvements, fixes, and the latest new developments, in the areas of Physics, Differential Equations and Mathematical Functions. Since Maple 2018, you can install/uninstall the "Physics Updates" directly from the MapleCloud .

Maplesoft incorporated the results of this accelerated exchange with people around the world into the successive versions of Maple. Below there are two sections


The Updates of Physics, as  an organized collection of links per Maple release, where you can find a description with examples of the subjects developed in the Physics package, from 2012 till 2019.


The Mapleprimes Physics posts, containing the most important posts describing the Physics project and showing the use of the package to tackle problems in General Relativity and Quantum Mechanics.

The update of Physics in Maple 2018 and back to Maple 16 (2012)




Physics Updates during 2018


Tensor product of Quantum States using Dirac's Bra-Ket Notation


Coherent States in Quantum Mechanics


The Zassenhaus formula and the algebra of the Pauli matrices


Multivariable Taylor series of expressions involving anticommutative (Grassmannian) variables


New SortProducts command


A Complete Guide for Tensor computations using Physics



Physics Maple 2018 updates


Automatic handling of collision of tensor indices in products


User defined algebraic differential operators


The Physics:-Cactus package for Numerical Relativity


Automatic setting of the EnergyMomentumTensor for metrics of the database of solutions to Einstein's equations


Minimize the number of tensor components according to its symmetries, relabel, redefine or count the number of independent tensor components


New functionality and display for inert names and inert tensors


Automatic setting of Dirac, Paul and Gell-Mann algebras


Simplification of products of Dirac matrices


New Physics:-Library commands to perform matrix operations in expressions involving spinors with omitted indices


Miscellaneous improvements



Physics Maple 2017 updates


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



Physics Maple 2016 updates


Completion of the Database of Solutions to Einstein's Equations


Operatorial Algebraic Expressions Involving the Differential Operators d_[mu], D_[mu] and Nabla


Factorization of Expressions Involving Noncommutative Operators


Tensors in Special and General Relativity


Vectors Package


New Physics:-Library commands


Redesigned Functionality and Miscellaneous



Physics Maple 2015 updates






Tetrads in General Relativity


More Metrics in the Database of Solutions to Einstein's Equations


Commutators, AntiCommutators, and Dirac notation in quantum mechanics


New Assume command and new enhanced Mode: automaticsimplification


Vectors Package


New Physics:-Library commands





Physics Maple 18 updates




4-Vectors, Substituting Tensors


Functional Differentiation


More Metrics in the Database of Solutions to Einstein's Equations


Commutators, AntiCommutators


Expand and Combine


New Enhanced Modes in Physics Setup




Vectors Package


New Physics:-Library commands





Physics Maple 17 updates


Tensors and Relativity: ExteriorDerivative, Geodesics, KillingVectors, LieDerivative, LieBracket, Antisymmetrize and Symmetrize


Dirac matrices, commutators, anticommutators, and algebras


Vector Analysis


A new Library of programming commands for Physics



Physics Maple 16 updates


Tensors in Special and General Relativity: contravariant indices and new commands for all the General Relativity tensors


New commands for working with expressions involving anticommutative variables and functions: Gtaylor, ToFieldComponents, ToSuperfields


Vector Analysis: geometrical coordinates with funcional dependency

Mapleprimes Physics posts




The Physics project at Maplesoft


Mini-Course: Computer Algebra for Physicists


A Complete Guide for Tensor computations using Physics


Perimeter Institute-2015, Computer Algebra in Theoretical Physics (I)


IOP-2016, Computer Algebra in Theoretical Physics (II)


ACA-2017, Computer Algebra in Theoretical Physics (III) 



General Relativity



General Relativity using Computer Algebra


Exact solutions to Einstein's equations 


Classification of solutions to Einstein's equations and the ThreePlusOne (3 + 1) package 


Tetrads and Weyl scalars in canonical form 


Equivalence problem in General Relativity 


Automatic handling of collision of tensor indices in products 


Minimize the number of tensor components according to its symmetries


Quantum Mechanics



Quantum Commutation Rules Basics