Maple 2017 Questions and Posts

These are Posts and Questions associated with the product, Maple 2017

I'm still quite new to maple and I'm working calculating some dynamic equations.

I want to be able to selectively group certain variables or numbers depending on how I need the equations to be showed, I don't know if that's possible, I´ll explain further.

In typewritting extended format one equation is shown like this:


And maple standard:

The fisrt thing I want is to show the time derivatives in the dot representation, but I also want the 1/2 multiplyting each term of the whole equation like in the maoke standard format. 

I also need to group certain variables in some other equations I have and I was wondering if there is a way to do this.

I have made a small package in a workbook and want to upload it as a package to MapleCloud. According to the help pages, I should select Save To Cloud from the File menu and select the package option for Application Type in the dialog that appears. However, no matter what I do the only option availlable is Maple. What is going on?

To my amazement, the following code hangs

Setup(anticommutativeprefix = psi):

at the last line, or produces the output "Error, (in sprintf) too many levels of recursion" if I wait long enough.

What is going on? Am I just being stupid? The version line verifies to me that I am using the Physics package as shipped with Maple 2017, version date 17th of May 2017. If I outcomment the Setup line, then Dagger does not hang. Do others experience the same behaviour?


I am using codegen to generate code from Maple expressions. More specifically I want to export non quadratic matix. The export works for matrices that have more columns than rows, but not for matrices with more rows than columns. There I receive the error:

Error, (in codegen/array/entry) 2nd index, 3, larger than upper array bound 2

A workaround would be to transpose the matrix before the export, and to transpose on the import (in Matlab) but I don't want to overcomplicate my code. Thanks for your help!

I have attached a demonstration worksheet below.


## test codegen non quadratic returnarray

## works
#Myfun := Matrix(3,3)

## works
#Myfun := Matrix(2,3):Myfun(2,3):= 3*b;

## does not work
Myfun := Matrix(3,2):Myfun(3,2):= 3*b;

Myfun := Matrix(3, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0, (3, 1) = 0, (3, 2) = 3*b})


Myfun(1):= 7*a;

Myfun := Matrix(3, 2, {(1, 1) = 7*a, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0, (3, 1) = 0, (3, 2) = 3*b})


## codegen works best with arraybased matrices, and call by reference becomes possible

returnArray:= convert(Myfun,matrix)

returnArray := Matrix(3, 2, {(1, 1) = 7*a, (1, 2) = 0, (2, 1) = 0, (2, 2) = 0, (3, 1) = 0, (3, 2) = 3*b})



Error, (in codegen/array/entry) 2nd index, 3, larger than upper array bound 2



Error, (in codegen/array/entry) 2nd index, 3, larger than upper array bound 2



Error, (in codegen/array/entry) 2nd index, 3, larger than upper array bound 2










Maple provides a state-of-the-art environment for algebraic and tensorial 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 an embedded 3D curved space - a new ThreePlusOne  package. This package is relevant in numerical relativity and a Hamiltonian formulation of gravity. The developments also include first steps in connection with computational representations for all the objects entering the Standard Model in particle physics.

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 .

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.



Petrov and Segre types, tetrads in canonical form


Equivalence for Schwarzschild metric (spherical and Kruskal coordinates)


Formulation of the problem (remove mixed coordinates)


Solving the Equivalence


The ThreePlusOne (3 + 1) new Maple 2017 Physics package


ThreePlusOne , is a package to cast Einstein's equations in a 3+1 form, that is, representing spacetime as a stack of nonintersecting 3-hypersurfaces Σ. This 3+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 gamma[i, j] that is induced by g[mu, nu] on the 3-dimensional hypersurfaces, and the related covariant derivative, Christoffel symbols and Ricci and Riemann tensors, the Lapse, Shift, Unit normal and Time vectors and Extrinsic curvature related to the ADM equations.


The following is a list of the available commands:















The other four related new Physics  commands:



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  `#mrow(msup(mi("dl"),mrow(mo("⁢"),mn("2"))),mo("="),msub(mi("γ",fontstyle = "normal"),mrow(mi("i"),mo(","),mi("j"))),mo("⁢"),msup(mi("dx"),mi("i")),mo("⁢"),msup(mi("dx"),mi("j")))`.


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.


EnergyMomentum , is a computational representation for the energy-momentum tensor entering Einstein's equations as well as their 3+1 form, the ADMEquations .




restart; with(Physics); Setup(coordinatesystems = cartesian)

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (x, y, z, t)}


`Systems of spacetime Coordinates are: `*{X = (x, y, z, t)}


[coordinatesystems = {X}]



`Setting lowercaselatin_is letters to represent space indices `


0, "%1 is not a command in the %2 package", ThreePlusOne, Physics


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


[ADMEquations, Christoffel3, D3_, ExtrinsicCurvature, Lapse, Ricci3, Riemann3, Shift, TimeVector, UnitNormalVector, gamma3_]


Note the different color for gamma[mu, nu], now a 4D tensor representing the metric of a generic 3-dimensional hypersurface induced by the 4D spacetime metric g[mu, nu]. All the ThreePlusOne tensors are displayed in black to distinguish them of the corresponding 4D or 3D tensors. The particular hypersurface gamma[mu, nu] operates is parameterized by the Lapse  alpha and the Shift  beta[mu].

The induced metric gamma[mu, nu]is defined in terms of the UnitNormalVector  n[mu] and the 4D metric g[mu, nu] as


Physics:-ThreePlusOne:-gamma3_[mu, nu] = Physics:-ThreePlusOne:-UnitNormalVector[mu]*Physics:-ThreePlusOne:-UnitNormalVector[nu]+Physics:-g_[mu, nu]


where n[mu] is defined in terms of the Lapse  alpha and the derivative of a scalar function t that can be interpreted as a global time function


Physics:-ThreePlusOne:-UnitNormalVector[mu] = -Physics:-ThreePlusOne:-Lapse*Physics:-D_[mu](t)


The TimeVector  is defined in terms of the Lapse  alpha and the Shift  beta[mu] and this vector  n[mu] as


Physics:-ThreePlusOne:-TimeVector[mu] = Physics:-ThreePlusOne:-Lapse*Physics:-ThreePlusOne:-UnitNormalVector[mu]+Physics:-ThreePlusOne:-Shift[mu]


The ExtrinsicCurvature  is defined in terms of the LieDerivative  of  gamma[mu, nu]


Physics:-ThreePlusOne:-ExtrinsicCurvature[mu, nu] = -(1/2)*Physics:-LieDerivative[Physics:-ThreePlusOne:-UnitNormalVector](Physics:-ThreePlusOne:-gamma3_[mu, nu])


The metric gamma[mu, nu]is also a projection tensor in that it projects 4D tensors into the 3D hypersurface Σ. The definition for any 4D tensor that is also a 3D tensor in Σ, can thus be written directly by contracting their indices with gamma[mu, nu]. In the case of Christoffel3 , Ricci3  and Riemann3,  these tensors can be defined by replacing the 4D metric g[mu, nu] by gamma[mu, nu] and the 4D Christoffel symbols GAMMA[mu, nu, alpha] by the ThreePlusOne GAMMA[mu, nu, alpha] in the definitions of the corresponding 4D tensors. So, for instance


Physics:-ThreePlusOne:-Christoffel3[mu, nu, alpha] = (1/2)*Physics:-ThreePlusOne:-gamma3_[mu, `~beta`]*(Physics:-d_[alpha](Physics:-ThreePlusOne:-gamma3_[beta, nu], [X])+Physics:-d_[nu](Physics:-ThreePlusOne:-gamma3_[beta, alpha], [X])-Physics:-d_[beta](Physics:-ThreePlusOne:-gamma3_[nu, alpha], [X]))



Physics:-ThreePlusOne:-Ricci3[mu, nu] = Physics:-d_[alpha](Physics:-ThreePlusOne:-Christoffel3[`~alpha`, mu, nu], [X])-Physics:-d_[nu](Physics:-ThreePlusOne:-Christoffel3[`~alpha`, mu, alpha], [X])+Physics:-ThreePlusOne:-Christoffel3[`~beta`, mu, nu]*Physics:-ThreePlusOne:-Christoffel3[`~alpha`, beta, alpha]-Physics:-ThreePlusOne:-Christoffel3[`~beta`, mu, alpha]*Physics:-ThreePlusOne:-Christoffel3[`~alpha`, nu, beta]



Physics:-ThreePlusOne:-Riemann3[mu, nu, alpha, beta] = Physics:-g_[mu, lambda]*(Physics:-d_[alpha](Physics:-ThreePlusOne:-Christoffel3[`~lambda`, nu, beta], [X])-Physics:-d_[beta](Physics:-ThreePlusOne:-Christoffel3[`~lambda`, nu, alpha], [X])+Physics:-ThreePlusOne:-Christoffel3[`~lambda`, upsilon, alpha]*Physics:-ThreePlusOne:-Christoffel3[`~upsilon`, nu, beta]-Physics:-ThreePlusOne:-Christoffel3[`~lambda`, upsilon, beta]*Physics:-ThreePlusOne:-Christoffel3[`~upsilon`, nu, alpha])


When working with the ADM formalism, the line element of an arbitrary spacetime metric can be expressed in terms of the differentials of the coordinates dx^mu, the Lapse , the Shift  and the spatial components of the 3D metric gamma3_ . From this line element one can derive the relation between the Lapse , the spatial part of the Shift , the spatial part of the gamma3_  metric and the g[0, j] components of the 4D spacetime metric.

For this purpose, define a tensor representing the differentials of the coordinates and an alias  dt = `#msup(mi("dx"),mn("0"))`


`Defined objects with tensor properties`


{Physics:-ThreePlusOne:-D3_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-ThreePlusOne:-Ricci3[mu, nu], Physics:-ThreePlusOne:-Shift[mu], Physics:-d_[mu], dx[mu], Physics:-g_[mu, nu], Physics:-ThreePlusOne:-gamma3_[mu, nu], Physics:-gamma_[i, j], Physics:-ThreePlusOne:-Christoffel3[mu, nu, alpha], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-ThreePlusOne:-Riemann3[mu, nu, alpha, beta], Physics:-ThreePlusOne:-TimeVector[mu], Physics:-ThreePlusOne:-ExtrinsicCurvature[mu, nu], Physics:-ThreePlusOne:-UnitNormalVector[mu], Physics:-SpaceTimeVector[mu](X)}


"alias(dt = dx[~0]):"

The expression for the line element in terms of the Lapse  and Shift   is (see [2], eq.(2.123))

ds^2 = (-Lapse^2+Shift[i]^2)*dt^2+2*Shift[i]*dt*dx[`~i`]+gamma_[i, j]*dx[`~i`]*dx[`~j`]

ds^2 = (-Physics:-ThreePlusOne:-Lapse^2+Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`])*dt^2+2*Physics:-ThreePlusOne:-Shift[i]*dt*dx[`~i`]+Physics:-gamma_[i, j]*dx[`~i`]*dx[`~j`]


Compare this expression with the 3+1 decomposition of the line element in an arbitrary system. To avoid the automatic evaluation of the metric components, work with the inert form of the metric %g_

ds^2 = %g_[mu, nu]*dx[`~mu`]*dx[`~nu`]

ds^2 = %g_[mu, nu]*dx[`~mu`]*dx[`~nu`]


Decompose(ds^2 = %g_[mu, nu]*dx[`~mu`]*dx[`~nu`])

ds^2 = %g_[0, 0]*dt^2+%g_[0, j]*dt*dx[`~j`]+%g_[i, 0]*dt*dx[`~i`]+%g_[i, j]*dx[`~i`]*dx[`~j`]


The second and third terms on the right-hand side are equal

op(2, rhs(ds^2 = dt^2*%g_[0, 0]+dt*%g_[0, j]*dx[`~j`]+dt*%g_[i, 0]*dx[`~i`]+%g_[i, j]*dx[`~i`]*dx[`~j`])) = op(3, rhs(ds^2 = dt^2*%g_[0, 0]+dt*%g_[0, j]*dx[`~j`]+dt*%g_[i, 0]*dx[`~i`]+%g_[i, j]*dx[`~i`]*dx[`~j`]))

%g_[0, j]*dt*dx[`~j`] = %g_[i, 0]*dt*dx[`~i`]


subs(%g_[0, j]*dt*dx[`~j`] = %g_[i, 0]*dt*dx[`~i`], ds^2 = dt^2*%g_[0, 0]+dt*%g_[0, j]*dx[`~j`]+dt*%g_[i, 0]*dx[`~i`]+%g_[i, j]*dx[`~i`]*dx[`~j`])

ds^2 = %g_[0, 0]*dt^2+2*%g_[i, 0]*dt*dx[`~i`]+%g_[i, j]*dx[`~i`]*dx[`~j`]


Taking the difference between this expression and the one in terms of the Lapse  and Shift  we get

simplify((ds^2 = dt^2*%g_[0, 0]+2*dt*%g_[i, 0]*dx[`~i`]+%g_[i, j]*dx[`~i`]*dx[`~j`])-(ds^2 = (-Physics:-ThreePlusOne:-Lapse^2+Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`])*dt^2+2*Physics:-ThreePlusOne:-Shift[i]*dt*dx[`~i`]+Physics:-gamma_[i, j]*dx[`~i`]*dx[`~j`]))

0 = (Physics:-ThreePlusOne:-Lapse^2-Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`]+%g_[0, 0])*dt^2+2*dx[`~i`]*(%g_[i, 0]-Physics:-ThreePlusOne:-Shift[i])*dt-dx[`~i`]*dx[`~j`]*(Physics:-gamma_[i, j]-%g_[i, j])


Taking coefficients, we get equations for the Shift , the Lapse  and the spatial components of the metric gamma3_

eq[1] := coeff(coeff(rhs(0 = (Physics:-ThreePlusOne:-Lapse^2-Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`]+%g_[0, 0])*dt^2+2*dx[`~i`]*(%g_[i, 0]-Physics:-ThreePlusOne:-Shift[i])*dt-dx[`~i`]*dx[`~j`]*(Physics:-gamma_[i, j]-%g_[i, j])), dt), dx[`~i`]) = 0

2*%g_[i, 0]-2*Physics:-ThreePlusOne:-Shift[i] = 0


eq[2] := coeff(rhs(0 = (Physics:-ThreePlusOne:-Lapse^2-Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`]+%g_[0, 0])*dt^2+2*dx[`~i`]*(%g_[i, 0]-Physics:-ThreePlusOne:-Shift[i])*dt-dx[`~i`]*dx[`~j`]*(Physics:-gamma_[i, j]-%g_[i, j])), dt^2)

Physics:-ThreePlusOne:-Lapse^2-Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`]+%g_[0, 0]


eq[3] := coeff(coeff(rhs(0 = (Physics:-ThreePlusOne:-Lapse^2-Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`]+%g_[0, 0])*dt^2+2*dx[`~i`]*(%g_[i, 0]-Physics:-ThreePlusOne:-Shift[i])*dt-dx[`~i`]*dx[`~j`]*(Physics:-gamma_[i, j]-%g_[i, j])), dx[`~i`]), dx[`~j`]) = 0

-Physics:-gamma_[i, j]+%g_[i, j] = 0


Using these equations, these quantities can all be expressed in terms of the time and space components of the 4D metric g[0, 0] and g[i, j]

isolate(eq[1], Shift[i])

Physics:-ThreePlusOne:-Shift[i] = %g_[i, 0]


isolate(eq[2], Lapse^2)

Physics:-ThreePlusOne:-Lapse^2 = Physics:-ThreePlusOne:-Shift[i]*Physics:-ThreePlusOne:-Shift[`~i`]-%g_[0, 0]


isolate(eq[3], gamma_[i, j])

Physics:-gamma_[i, j] = %g_[i, j]




[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.


[2] Alcubierre, M., Introduction to 3+1 Numerical Relativity, International Series of Monographs on Physics 140, Oxford University Press, 2008.


[3] Baumgarte, T.W., Shapiro, S.L., Numerical Relativity, Solving Einstein's Equations on a Computer, Cambridge University Press, 2010.


[4] Gourgoulhon, E., 3+1 Formalism and Bases of Numerical Relativity, Lecture notes, 2007,


[5] Arnowitt, R., Dese, S., Misner, C.W., The Dynamics of General Relativity, Chapter 7 in Gravitation: an introduction to current research (Wiley, 1962),



Examples: Decompose, gamma_



Setup(mathematicalnotation = true)

[mathematicalnotation = true]


Define  now an arbitrary tensor A


`Defined objects with tensor properties`


{A, Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu]}


So A^mu 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

Setup(spaceindices = lowercase_is)

[spaceindices = lowercaselatin_is]


Accordingly, the 3+1 decomposition of A^mu is


Array(%id = 18446744078724512334)


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, nu])

Matrix(%id = 18446744078724507998)


Note the position of the component %g_[0, 0], related to the trailing position of the time-like component in the signature "(- - - +)".

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


g[mu, nu] = (Matrix(4, 4, {(1, 1) = -1, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = -1, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -1, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 1}))


Decompose(g_[mu, nu])

Matrix(%id = 18446744078724494270)


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


Physics:-gamma_[i, j] = -Physics:-g_[i, j]+Physics:-g_[0, i]*Physics:-g_[0, j]/Physics:-g_[0, 0]


The 3D space part of -g[`~mu`, `~nu`] is actually equal to the 3D metric "gamma[]^(i,j)"


Physics:-gamma_[`~i`, `~j`] = -Physics:-g_[`~i`, `~j`]


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

%g_[`~alpha`, `~mu`]*%g_[mu, beta] = KroneckerDelta[`~alpha`, beta]

%g_[`~alpha`, `~mu`]*%g_[mu, beta] = Physics:-KroneckerDelta[beta, `~alpha`]


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

Eq := Decompose(%g_[`~alpha`, `~mu`]*%g_[mu, beta] = Physics[KroneckerDelta][beta, `~alpha`], repeatedindices = false)

Matrix(%id = 18446744078132963318)


Eq := Decompose(%g_[`~alpha`, `~mu`]*%g_[mu, beta] = Physics[KroneckerDelta][beta, `~alpha`], freeindices = false)

%g_[0, beta]*%g_[`~alpha`, `~0`]+%g_[i, beta]*%g_[`~alpha`, `~i`] = Physics:-KroneckerDelta[beta, `~alpha`]


Compare with a full decomposition

Eq := Decompose(%g_[`~alpha`, `~mu`]*%g_[mu, beta] = Physics[KroneckerDelta][beta, `~alpha`])

Matrix(%id = 18446744078724489454)


Eq is a symmetric matrix of equations involving non-contracted occurrences of `#msup(mi("g"),mrow(mn("0"),mo(","),mn("0")))`, `#msup(mi("g"),mrow(mi("j"),mo(","),mo("0")))` and `#msup(mi("g"),mrow(mi("j"),mo(","),mi("i")))`. Isolate, in Eq[1, 2], `#msup(mi("g"),mrow(mi("j"),mo(","),mo("0")))`, that you input as %g_[~j, ~0], and substitute into Eq[1, 1]

"isolate(Eq[1, 2], `%g_`[~j, ~0]);"

%g_[`~j`, `~0`] = -%g_[i, 0]*%g_[`~j`, `~i`]/%g_[0, 0]


subs(%g_[`~j`, `~0`] = -%g_[i, 0]*%g_[`~j`, `~i`]/%g_[0, 0], Eq[1, 1])

-%g_[0, k]*%g_[i, 0]*%g_[`~j`, `~i`]/%g_[0, 0]+%g_[i, k]*%g_[`~j`, `~i`] = Physics:-KroneckerDelta[k, `~j`]


Collect `#msup(mi("g"),mrow(mi("j"),mo(","),mi("i")))`, that you input as %g_[~j, ~i]

collect(-%g_[0, k]*%g_[i, 0]*%g_[`~j`, `~i`]/%g_[0, 0]+%g_[i, k]*%g_[`~j`, `~i`] = Physics[KroneckerDelta][k, `~j`], %g_[`~j`, `~i`])

(-%g_[0, k]*%g_[i, 0]/%g_[0, 0]+%g_[i, k])*%g_[`~j`, `~i`] = Physics:-KroneckerDelta[k, `~j`]


Since the right-hand side is the identity matrix and, from , `#msup(mi("g"),mrow(mi("i"),mo(","),mi("j")))` = -`#msup(mi("γ",fontstyle = "normal"),mrow(mi("i"),mo(","),mi("j")))`, the expression between parenthesis, multiplied by -1, is the reciprocal of the contravariant 3D metric `#msup(mi("γ",fontstyle = "normal"),mrow(mi("i"),mo(","),mi("j")))`, that is the covariant 3D metric gamma[i, j], in accordance to its definition for the signature `- - - +`


Physics:-gamma_[i, j] = -Physics:-g_[i, j]+Physics:-g_[0, i]*Physics:-g_[0, j]/Physics:-g_[0, 0]





[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.

Example: Redefine


Tensors in Special and General Relativity


A number of relevant changes happened in the tensor routines of the Physics package, towards making the routines pack more functionality both for special and general relativity, as well as working more efficiently and naturally, based on Maple's Physics users' feedback collected during 2016.

New functionality


Implement conversions to most of the tensors of general relativity (relevant in connection with functional differentiation)


New setting in the Physics Setup  allows for specifying the cosmologicalconstant and a default tensorsimplifier



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

I am somewhat surprised to find that


say, returns 1. Does that really make mathematical sense with diff(f(x),x) here being the argument of a function?

PS: I bumped into this issue because I was trying to write down some structured type, or some other matching criterium, that will return true for some scalarly quantity consisting of any number of functions and their derivatives if and only if all arguments to all functions have differential order zero. This criterium would exclude the above function, for instance.

Update: Just for the sake of completeness, or as a service to any visitor to this thread, the above was readily resolved as being due to a blunder of mine, see a comment of mine below. The thread, though, developed into a quite interesting one concerning issues with conserved currents, and related, in the case of Grassmann-odd quantities, issues that are at the time of writing still unresolved.

The MapleCloud now provides the GRTensorIII package for component tensor calculations in general relativity. This package is an update of the established GRTensorII package, last updated in 1999.  In early June, I had the opportunity to present this update at the recent Atlantic General Relativity meeting. The GR community was delighted to have an updated version that works well with more recent versions of Maple. Several talks specifically called out the key role GRTensorIII had in establishing the results presented.

GRTensorIII supports the calculation of the standard curvature objects in relativity. It also provides the command which allows the definition of new tensor objects via a simple definition string (without programming). This command is the key reason for GRTensor’s continued use in the GR community. GRTensorIII also provides a new, more direct API to define a spacetime via the command. This command allows for the metric or line element definition within a worksheet – removing the need for storing the metric in a file and allowing example worksheets to be self-contained. GRTensorIII has significant new functionality to support the definition of hyper-surfaces and the calculation of junction conditions and thin-shell stress energy. An extensive series of example worksheets based on Eric Poisson’s “A Relativist’s Toolkit” are included.

GRTensorIII is available from the MapleCloud window within Maple in the list of available packages or via a download from Maple. It can be loaded directly via the command line as: 

It is also available on github. The source code is available on github in a separate repository: grtensor3src .  

GRTensorIII was developed in collaboration with Kayll Lake and Denis Pollney. I would like to thank Maple for access to the beta program and Eric Poisson for testing and feedback.

The following is the PDE I need to solve.

(x*y+1)*(diff(h(x, y), y, y, y))+(x+h(x, y))*(diff(h(x, y), y, y))-(diff(h(x, y), y))^2+k(x, y) = 0, (10.*(x*y+1))*(diff(k(x, y), y,y))+(10.*x+h(x,y))*(diff(k(x, y), y))-(diff(h(x, y), y))*k(x, y) = 0


This is the original boundary condition:

h(0, y) = f(y), h(x, 0) = 0, k(0, y) = g(y), k(x, 0) = 1, k(x, 25) = 0, (D[2](h))(x, 0) = 0, (D[2](h))(x, 25) = 0


After using pdsolve it come out the error:

pdsolve(eval(pde2, P = .1), pdebc4, numeric, [h(x, y), k(x, y)], spacestep = .1)

Error, (in pdsolve/numeric/par_hyp) Incorrect number of initial conditions, expected 0, got 2


If I remove one of the boundary condition when x=0, maybe h(0,y)=f(y), then the error will be this:

Error, (in pdsolve/numeric/par_hyp) Incorrect number of initial conditions, expected 0, got 1


However if I remove both when x=0, it come out this error:

Error, (in pdsolve/numeric) initial/boundary conditions must be defined at one or two points for each independent variable


May I know what is the problem of this equations?

P/S: I know its only differentiate with respect to y and is consider to be an ODE( I need more explantion on this please) and I'm still new to maple. Thanks!!


The OrthogonalExpansions package is a collection of commands to compute one-dimensional and multi-dimensional orthogonal series expansions of a function. The expansions are evaluated symbolically, numerically or in an inert form.

In particular, the package includes six modifications of the one-dimensional Fourier series, as well the multi-dimensional Fourier, cosine and sine series, one- and multi-dimensional series expansions of classical orthogonal polynomials.

The package includes MixedSeries command to compute multi-dimensional mixed orthogonal series expansions. Mixed series are created from the one-dimensional and multi-dimensional series that are available in the package.

The package also includes GramSchmidtL2 command for computing symbolically or numerically an orthonormal set of one- and multi-variable functions.


The Maple 2017 updates look great. I do have a question, though. Why was the user interface (palettes, toolbar icons, etc) changed from 3D to flat? Maple 2015 on Windows 7 Pro looked like a Windows  program. Maple 2017 with it's flat interface looks like it was written 30 years ago for Solaris (when the graphics in Java weren't cross platform).

I really wish there was a way I could get 2017 to look like 2015. I know it's very minor but being a very visual person, I really like the interface graphics.
was way beyond the competition.


The purpose of this post is to review how well-designed Maple 2017 GUI is for a Microsoft surface pro 4 tablet touch screen with windows 10 pro (64-bit) and to determine the performance of Maple 2017 on my tablet which has a m3 CPU with a 0.9 GHZ base frequency and 4 GB RAM.

First, my experience is that 4 GB of RAM is far from enough. Under heavy load I have had problems before on other software with 4 GB of RAM. 68 % of my RAM and 41% of the CPU is already gone by simply running Maple and my web browser at the same time before I have even instructed Maple to do any calculations.


I think a tablet with at least 8 GB of RAM would be preferred. If you only want to use Maple as an expensive calculator then you would most likely not even need 4 GB of RAM. I find that the surface pro 4 to be overpriced for the hardware it provides. I think eve windows 10 tablet with up to 16 GB of RAM and with a much cheaper price looks much more promising than the Microsoft surface pro 4. When I use the surface pro 4 with word 2016 and the reference manager zotero word plugin I sometime notice a trailing line when I sweep up or down in a document with a lot of references which I suspect is because of the low amount of RAM. When I played with Maple 2017 on my surface pro I noticed the same trailing line which again indicates to me that there is not enough RAM. However, I am not certain that low RAM is the cause of such problem.  

Secondly, I managed to increase the size of the Maple icons under the File, Edit etc. menu so now they have a perfect size for a touch screen tablet. Very cool!


However, as you can see words in the text menu File, Edit etc. are way too small for a touch screen tablet. There is a lot of room to the right so the words could easily be increased in size. I am also a missing a menu item called maplet where you can attach your own maplets for easy access. It appears that Maple 2017 GUI has not been designed with a touch screen tablet in mind. I wish the words in the text menu File, Edit etc. would have increased when I increased the size of the icons. The text and icons in the sidebar are also way too small for a touch screen tablet. The name of the open tabs is also to small and x that you tap on to close the worksheet is also to small. It is almost impossible to close a worksheet because the x is so small. 

I thinks there are ways in windows 10 to increase the text size in the menus but I have only been able to increase the text size and icon size for all software at the same time. Since, Maple is more or less the only software that I have where the menu text is too small this is not an optimal solution.   

The table of content for Maple help files also has too small text as seen in the below picture. However, the biggest problem is not the small words it is the row spacing of the table of content. Some of the words appear almost to be on top of each other. I think the row spacing need to be increased. The text within the help files itself displays beautifully and is in the perfect size.   


Another problem is that when you swipe up or down on the touch screen you dont go up or down in the maple document. You just highlight text as seen in the picture below. This needs to be fixed. Highlighting should be done by a long tap on the screen as in word 2017 on a touch screen devices.



The norm today might be to use Maple on a desktop computer or on a laptop but I am convinced that in the future touch screen tablet will become more and more powerful making them an excellent computers to run Maple on because they are so light and portable. I think Maplesoft must have this in mind when they design the GUI.

Now to test the performance of Maple 2017 on my tablet I decided to generate 1 000 000 random number and see how long it takes. Since I dont have a benchmark it becomes very hard to comment on how fast maple 2017 is on my tablet but I am hoping that someone can run the same code on their machine and comment on this post so we can get a benchmark.        


Maple 2017 claims that running such code took about 50 seconds on my tablet however when I timed it with a stop watch it only took around 30 seconds hence I am a bit confused as to where the 20 seconds difference comes from?  


While preparing for a recent webinar, I ran across something that didn't behave the same way in Maple 2017 as it did in previous releases. In particular, it was the failure of the over-dot notation for t-derivatives to display with the over-dot. Turns out that this is due to a change in behavior of typesetting that was detailed in the What's New page for Maple 2017, a page I had looked at many times in the last few months, but apparently didn't comprehend fully. The details are below.

Prior to Maple 2017, under the aegis of extended typesetting, the following two lines of code would alert Maple that the over-dot notation for t-derivatives should be used in the output display.

However, this changed in Maple 2017. Extended typesetting is now the default, but these two lines of code are no longer sufficient to induce Maple to display the over-dot in output. Indeed, we would now have

as output. The change is documented in the following paragraph

lifted from the help page 

Thus, it now takes the additional command

to induce Maple to display the over-dot notation in output.

I must confess that, even though I pored over the "What's New" pages for Maple 2017, I completely missed the import of this change to typesetting. I stumbled over the issue while preparing for an upcoming webinar, and frantically sent out help calls to the developers back in the building. Fortunately, I was quickly set straight on the matter, but was disappointed in my own reading of all the implications of the typesetting changes in Maple 2017. So perhaps this note will alert other users to the changes, and to the help page wherein one finds those essential bits of information needed to complete the tasks we set for ourselves.

And one more thing - I was cautioned that the "= true" was essential. Without it, the command would act as a query, echoing the present state of the setting, and not making the desired change to the setting.

hi, learners of maple like me, i was handling a project,but i came across this problem,and i began to doubt the accuracy of maple-plot,,,

very simply expression,result3,changing with the parameter f,

i first plot the f from 100 to 5000,

than i need to watch closer,

so i change the define domain of parameter f, plot f from 100 to 1000,  

and the result of plot definitely  differs from the previous one. 

low vally in the first figure (f in the scale of 100-1000),disappears! that's insane...


you can see below,

anyone see it, can you give me some clue? i really do not understand this. why ,why why,,

result3 := 3.269235506947450*10^11*sqrt(-1/(0.975698207102e-3*cos(0.19042716640833e-1*f)^2*cos(0.9521358320417e-2*f)^4-0.975698207102e-3*cos(0.19042716640833e-1*f)^2*cos(0.9521358320417e-2*f)^2+5.099915851388520*10^(-8)*cos(0.9521358320417e-2*f)^4-5.099915851388520*10^(-8)*cos(0.9521358320417e-2*f)^2+1.311634114532540*10^12*sin(0.19042716640833e-1*f)*sin(0.9521358320417e-2*f)*cos(0.9521358320417e-2*f)*cos(0.19042716640833e-1*f)+4.405792916762340*10^26*cos(0.19042716640833e-1*f)^2-4.406861706842330*10^26))



plot(result3, f = 100 .. 5000);



plot(result3, f = 100 .. 1000);










I have a workbook that derives the Cobb-Douglas factor demand functions:

The final formulas (10) and (11) are not in the same format as the formulas in my textbook (by Hal Varian). In fact my last formulas betray no obvious symmetry while Varian's forms do.


Here is a picture of them scraped from the text.


Is it possible to instruct Maple to obtain these forms?

Maple 17 is very exciting so I am hopeful ....



The following construction of a simple vector of matrices (just a test example)

Vector(2,(a) -> Matrix(2,2,(b,c) -> m||a||b||c));

works in Maple 17, but not in Maple 2017 where the error message "Error, (in Vector[column]) number of elements on right side must match subselection on left side" is produced. Why that?

Update: If no output is prompted, i.e., if the above line is terminated with colon instead of semicolon, then no error is raised. What?!

1 2 3 4 Page 1 of 4