Maple 2017 Questions and Posts

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

Hey,

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})

(1)

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})

(2)

## 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})

(3)

codegen[makeproc](Myfun,[a,b])

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

 

codegen[makeproc](returnArray,[returnArray,a,b])

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

 

codegen[makeproc](returnArray,[a,b])

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

 

 


 

Download codegen_rectangular_matrix.mw

 

 

Physics

 

 

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.

Examples

 

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:

 

ADMEquations

Christoffel3

D3_

ExtrinsicCurvature

gamma3_

Lapse

Ricci3

Riemann3

Shift

TimeVector

UnitNormalVector

 

 

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 .

 

Examples

 

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}]

(2.1.1)

with(ThreePlusOne)

`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_]

(2.1.2)

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

gamma3_[definition]

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

(2.1.3)

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

UnitNormalVector[definition]

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

(2.1.4)

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

TimeVector[definition]

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

(2.1.5)

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

ExtrinsicCurvature[definition]

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

(2.1.6)

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

Christoffel3[definition]

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

(2.1.7)

Ricci3[definition]

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]

(2.1.8)

Riemann3[definition]

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

(2.1.9)

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"))`

Define(dx[mu])

`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)}

(2.1.10)

"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`]

(2.1.11)

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`]

(2.1.12)

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`]

(2.1.13)

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`]

(2.1.14)

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`]

(2.1.15)

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

(2.1.16)

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

(2.1.17)

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]

(2.1.18)

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

(2.1.19)

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]

(2.1.20)

isolate(eq[2], Lapse^2)

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

(2.1.21)

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

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

(2.1.22)

References

 
  

[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, https://arxiv.org/pdf/gr-qc/0703035v1.pdf.

  

[5] Arnowitt, R., Dese, S., Misner, C.W., The Dynamics of General Relativity, Chapter 7 in Gravitation: an introduction to current research (Wiley, 1962), https://arxiv.org/pdf/gr-qc/0405109v1.pdf

  

 

Examples: Decompose, gamma_

 

restartwith(Physics)NULL

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(2.2.1)

Define  now an arbitrary tensor A

Define(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]}

(2.2.2)

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

Setup(signature)

[signature = `- - - +`]

(2.2.3)

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]

(2.2.4)

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

Decompose(A[`~mu`])

Array(%id = 18446744078724512334)

(2.2.5)

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)

(2.2.6)

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

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}))

(2.2.7)

Decompose(g_[mu, nu])

Matrix(%id = 18446744078724494270)

(2.2.8)

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

gamma_[definition]

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

(2.2.9)

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

"gamma_[~,definition];"

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

(2.2.10)

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`]

(2.2.11)

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)

(2.2.12)

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`]

(2.2.13)

Compare with a full decomposition

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

Matrix(%id = 18446744078724489454)

(2.2.14)

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]

(2.2.15)

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`]

(2.2.16)

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`]

(2.2.17)

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 `- - - +`

gamma_[definition]

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

(2.2.18)

NULL

References

 
  

[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


 

Download PhysicsMaple2017.mw

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

I am somewhat surprised to find that

PDEtools:-difforder(sin(diff(f(x),x)));

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 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 http://eve-tech.com/ 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.        

time(rand()$1000000)

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?  

 

I have an update below

I am student, and bought Maple student version 2017 and went through verification and activation with no probems and been using Maple for number of days.

But few days ago, I disconnected my internet service provider, and so now I have no access to the internet from my home PC where I installed Maple (I am writing this from  library)

Now at home, when I start Maple, I get a message saying that my licence will expire in 10 or 9  days or so. I do not understand this messge. Why it comes up now and did not come up before when I had internet access? 

Does one need to be connected to the internet all the time to use Maple? What if one does not have internet access?

I did remove one monitor from my PC also. Do you think Maple detected change in PC (one less monitor) and now it thinks this is new PC? But this makes no sense.

How do I tell Maple I have activated my Maple if I do not have internet access?

Update

After installing Maple 2017.1, now each time I disconnect from the internet, I am not able to start Maple !  I get this error

 

When I connect to the internet and try again, Maple comes up OK and it works. (it does NOT ask me to activate). I have allready activated OK before. This message only comes up when I am not connected to the internet.

This tells me Maple is trying to connect to the internet each time for some reason to verify my installation? But when if I do not want to be connected to the internet and still use Maple?

I never installed beta Maple or anything like this before. What to do to make Maple start without being connected to the internet? I did not change my PC.

 

 

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))

326923550694.745*(-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+0.509991585138852e-7*cos(0.9521358320417e-2*f)^4-0.509991585138852e-7*cos(0.9521358320417e-2*f)^2+1311634114532.54*sin(0.19042716640833e-1*f)*sin(0.9521358320417e-2*f)*cos(0.9521358320417e-2*f)*cos(0.19042716640833e-1*f)+0.440579291676234e27*cos(0.19042716640833e-1*f)^2-0.440686170684233e27))^(1/2)

(1)

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

 

 

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

 

 

 

``


 

Download test.mw

 

 

 

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.

Download cobb-douglas.mw

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

P.

 

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?!

I am thinking about buying maple 2017 however there are only 4 different categories to choose from when you want to buy: student, commercial, academic and government. I dont belong to any of them! Also the price difference is huge! I am on disability benefits and the academic license cost more or less the same amount that I get in disability benifts each month to cover my food, rent and medicines which is approximatly 1 100 usd. The price for a student licens is completely realistic and is a price that I am willing to pay but I am not a student and I dont feel comfortable claiming that I am even though everyone is a student as long as they live. When you stop learning you life is more or less over anyway. If I am forced to pay around 1 000 usd then I am not going to buy maple 2017. Then I am just going to continue using MathPapa free algbra calculator https://www.mathpapa.com/ because to be honest I dont really need maple that much in my research today but there are a couple of reaons why I want to buy. 1) I would like to support maplesoft because I think you have the best and most userfriendly mathematical software on the market. 2) I want to hedge my bets. My needs might change in the future. 3) I want to be able to run my large number of old worksheets and see if I can improve them. 4) I want to see what changes and improvments have been made to maple 2017 compared to let say 5 years ago and to assess if these changes provide any value to me. 

A question was raised recently on Stewart Gough platforms.  I decided to tidy up some old code to show platform position and leg lengths for any given displacement.
 

restart

``

Hexapod Setup Data

 

RotZ := proc (delta) options operator, arrow; Matrix(1 .. 3, 1 .. 3, {(1, 1) = cos(delta), (1, 2) = -sin(delta), (1, 3) = 0, (2, 1) = sin(delta), (2, 2) = cos(delta), (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1}, datatype = anything, storage = rectangular, order = Fortran_order, subtype = Matrix) end proc

a[1] := Vector(3, [.5, 3.0, 0]); a[2] := evalf(RotZ(20*((1/180)*Pi)).a[1]); a[3] := evalf(RotZ(100*((1/180)*Pi)).a[2]); a[4] := evalf(RotZ(20*((1/180)*Pi)).a[3]); a[5] := evalf(RotZ(100*((1/180)*Pi)).a[4]); a[6] := evalf(RotZ(20*((1/180)*Pi)).a[5])

b[1] := evalf(.7*RotZ(-40*((1/180)*Pi)).a[1]); b[2] := evalf(RotZ(100*Pi*(1/180)).b[1]); b[3] := evalf(RotZ(20*Pi*(1/180)).b[2]); b[4] := evalf(RotZ(100*Pi*(1/180)).b[3]); b[5] := evalf(RotZ(20*Pi*(1/180)).b[4]); b[6] := evalf(RotZ(100*Pi*(1/180)).b[5])

Zeroposn := Vector(3, [0, 0, 3])

Tx := Vector(3, [1, 0, 0]); Ty := Vector(3, [0, 1, 0]); Tz := Vector(3, [0, 0, 1])

``

``

NULL

Procedures

 

PlatPosn := proc (x := 0, y := 0, z := 0, alpha := 0, beta := 0, delta := 0) local i, v, Rot, L1, L2, L3, L4, L5, L6; global txn, tyn, tzn, ctrp; description "Calculates the platform position in the Global Coordinates, Unit normals and Leg Lengths"; v := Vector(3, [x, y, z]); ctrp := Zeroposn+v; Rot := Matrix(1 .. 3, 1 .. 3, {(1, 1) = cos(delta)*cos(beta), (1, 2) = -sin(delta)*cos(alpha)+cos(delta)*sin(beta)*sin(alpha), (1, 3) = sin(delta)*sin(alpha)+cos(delta)*sin(beta)*cos(alpha), (2, 1) = sin(delta)*cos(beta), (2, 2) = cos(delta)*cos(alpha)+sin(delta)*sin(beta)*sin(alpha), (2, 3) = -cos(delta)*sin(alpha)+sin(delta)*sin(beta)*cos(alpha), (3, 1) = -sin(beta), (3, 2) = cos(beta)*sin(alpha), (3, 3) = cos(beta)*cos(alpha)}, datatype = anything, storage = rectangular, order = Fortran_order, subtype = Matrix); for i to 6 do bn || i := Zeroposn+v+Rot.b[i] end do; txn := Rot.Tx; tyn := Rot.Ty; tzn := Rot.Tz; print(" Platform centre Global", ctrp); print(" Platform corner Co-ords Global", bn1, bn2, bn3, bn4, bn5, bn6); print("Platform Triad Vectors  ", "X green ", txn, "Y blue", tyn, "Z red ", tzn); L1 := sqrt((bn1-a[1])^%T.(bn1-a[1])); L2 := sqrt((bn2-a[2])^%T.(bn2-a[2])); L3 := sqrt((bn3-a[3])^%T.(bn3-a[3])); L4 := sqrt((bn4-a[4])^%T.(bn4-a[4])); L5 := sqrt((bn5-a[5])^%T.(bn5-a[5])); L6 := sqrt((bn6-a[6])^%T.(bn6-a[6])); print("Leg Lengths"); print("L1= ", L1); print("L2= ", L2); print("L3= ", L3); print("L4= ", L4); print("L5= ", L5); print("L6= ", L6) end proc

``

PlatPlot := proc () local Base, Platformdisplacement, picL1, picL2, picL3, picL4, picL5, picL6; global tx0, ty0, tz0; description "Displays the Hexapod"; Base := plots:-polygonplot3d(Matrix([a[1], a[2], a[3], a[4], a[5], a[6]], datatype = float), color = black, transparency = .5); Platformdisplacement := plots:-polygonplot3d(Matrix([seq(bn || i, i = 1 .. 6)]), color = cyan, transparency = .5); picL1 := plots:-arrow(a[1], bn || 1-a[1], colour = green); picL2 := plots:-arrow(a[2], bn || 2-a[2], colour = blue); picL3 := plots:-arrow(a[3], bn || 3-a[3], colour = blue); picL4 := plots:-arrow(a[4], bn || 4-a[4], colour = blue); picL5 := plots:-arrow(a[5], bn || 5-a[5], colour = blue); picL6 := plots:-arrow(a[6], bn || 6-a[6], colour = orange); tx0 := plots:-arrow(ctrp, txn, colour = green); ty0 := plots:-arrow(ctrp, tyn, colour = blue); tz0 := plots:-arrow(ctrp, tzn, colour = red); plots:-display(Base, picL1, picL2, picL3, picL4, picL5, picL6, Platformdisplacement, tx0, ty0, tz0, axes = box, labels = [X, Y, Z], scaling = constrained) end proc

``

NULL

``

``

PlatPosn()

"L6= ", 3.586394355

(1)

PlatPlot()

 

NULL

PlatPosn(.52, -.89, .7, .2, .67, .3)

"L6= ", 3.055217994

(2)

PlatPlot()

 

NULL

NULL

 

NULL

print('tzn' = LinearAlgebra:-CrossProduct(txn, tyn), `= `, tzn)

tzn = Vector[column](%id = 18446744074564617750), `= `, Vector[column](%id = 18446744074328082542)

(3)

``

``NULL

NULL

Rotation Matrices

NULL

``

 

RotZ := Matrix(3, 3, {(1, 1) = cos(delta), (1, 2) = -sin(delta), (1, 3) = 0, (2, 1) = sin(delta), (2, 2) = cos(delta), (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 1})

RotY := Matrix(3, 3, {(1, 1) = cos(beta), (1, 2) = 0, (1, 3) = sin(beta), (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = -sin(beta), (3, 2) = 0, (3, 3) = cos(beta)})

RotX := Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = cos(alpha), (2, 3) = -sin(alpha), (3, 1) = 0, (3, 2) = sin(alpha), (3, 3) = cos(alpha)})

NULL

ROT := RotZ.RotY.RotX

Matrix(%id = 18446744074564619310)

(4)

``

``

``


 

Download Reverse_Kinematics_Stewart_Gough_Platform.mw

With this application the components of the acceleration can be calculated. The components of the acceleration in scalar and vector of the tangent and the normal. In addition to the curvilinear kinetics in polar coordinates. It can be used in different engineers, especially mechanics, civilians and more.

In Spanish.

Kinematics_Curvilinear v18.mw

Kinematics_Curvilinear_updated_v2017.mw

Cinemática_en_Coordenadas_Polares_Cilindricas.mw

Kinematics_Curvilinear_updated_v2018.mw

Cinemática_de_una_partícula_nueva_sintaxis.mw

Lenin Araujo Castillo

Ambassador of Maple

 

 

First 35 36 37 38 39 40 Page 37 of 40