ecterrab

14038 Reputation

24 Badges

19 years, 68 days

MaplePrimes Activity


These are answers submitted by ecterrab

Hi

You ask on how to implement this function in Maple. But the MeijerG function is already implemented in Maple, you do not need to implement it. Please give a look at ?MeijerG.

Regarding your question about Matlab, or comment about the output of the Mathematica command Integrate, note please that in this forum we work with Maple, not Matlab nor Mathematica, so perhaps it is better if you ask those question in Matlab or Mathematica forums?

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

Hi
If all what you want is to indicate that {a, b} are real then Physics:-Setup(realobjects = {a, b}) will suffice for the `is` command, and through it everything else in the library (including conjugate), recognize these are real objects. You can also use the standard assume facility, as in assume(a, real) assume(b, real) but that changes who a and b are and that may or not be convenient in general (it frequentiy is not).

So for example Setup(quantumoperator = {a, b}, real = {a, b}) will do what you want to do, then expand(conjugate(k1*a+k2*conjugate(b))) returns as you expect/mentioned in your question.

Note also that you can indicate Setup(hermitianoperator = {a,b}) for the case of a = Dagger(a); generally speaking you can set a quantumoperator, hermitianoperator and unitaryoperator.

The types of operators that you can set as well as the realobjects are all explained in ?Physics:-Setup. 

Finally, note that entering Physics:-Setup(); so without any arguments, you open an applet that shows all the Physics setup at once, and directly in the applet you can specify quantum, hermitian and unitary operators as well as realobjects.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Generally speaking, the command for changing variables in sums is PDEtools:-dchange, for example:

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

Hi

If I understand you correctly, a step forward with regards to your previous question  you want to also

express tensorial expressions involving the metric g_[mu, nu] in terms of the 4-vector l[mu] and the Minkowski

form of the metric - call it eta[mu, nu]. Here is one way to do that, you tell  whether I am missing something and

we move from there.

 

Load the package, set the notation to be textbooklike

restart; with(Physics); Setup(notation = true)

`* Partial match of  'notation' against keyword 'mathematicalnotation'`

(1)

NOTE: I am using the latest version of Physics for Maple 18, that you can download from

Maplesoft's R&D Physics webpage; you verify that checking the Physics datestamp:

Physics:-Version()[2]

`2014, April 15, 18:46 hours`

(2)

So, define your 4-Vector l[mu]

Define(l[mu])

`Defined objects with tensor properties`

 

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

(3)

If you want to define it giving the components, try Define(l[mu] = [a, b, c, d]) where the list on the

right-hand side contains each of the four covariant components of l[mu]

 

I assume also that, in the metric you may want to define, the components of l[mu] depend on the

coordinates, so set a system of coordinates, which you will need anyway to have the Christoffel

symbols working. For simplicity I use here cartesian coordinates  (NOTE: cartesian or arbitrary at this

point mean the same, but if you prefer 'arbitrary' try Setup(coordinates = X))

Setup(Coordinates = cartesian)

`* Partial match of  'Physics:-Coordinates' against keyword 'coordinatesystems'`

 

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

(4)

Again for simplicity, let's have the functionality of l[mu] not displayed all the time, so that everything is

more readable

PDEtools:-declare(l(X))

l(x, y, z, t)*`will now be displayed as`*l

(5)

Getting into the problem: you want to define a metric - that at this point, as a draft, I am calling it

G - equal to:

G[mu, nu] = g_[mu, nu]+l[mu](X)*l[nu](X)

G[mu, nu] = Physics:-g_[mu, nu]+l[mu](X)*l[nu](X)

(6)

So define this G as a tensor

Define(G[mu, nu] = Physics[g_][mu, nu]+l[mu](X)*l[nu](X))

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], G[mu, nu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], l[mu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(7)

Moreover, you want to have a tensor that is exactly equal to the Minkowski metric, and that is available

for computations even after you set the metric g[mu, nu] to something else. You can always do that defining

such a tensor; it is simpler at this point, before changing the metric as follows:

eta[mu, nu] = rhs(g_[])

eta[mu, nu] = Matrix(%id = 18446744078329981398)

(8)

"Define(?)"

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], G[mu, nu], Physics:-Psigma[mu], Physics:-d_[mu], eta[mu, nu], Physics:-g_[mu, nu], l[mu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(9)

Verify ...

eta[]

eta[mu, nu] = Matrix(%id = 18446744078519433926)

(10)

Let's continue defining the actual metric g[mu, nu] using the matrix of the covariant components of G 

NULL

Setup(metric = rhs(G[]))

[metric = {(1, 1) = -1+l[1](X)^2, (1, 2) = l[1](X)*l[2](X), (1, 3) = l[1](X)*l[3](X), (1, 4) = l[1](X)*l[4](X), (2, 2) = -1+l[2](X)^2, (2, 3) = l[2](X)*l[3](X), (2, 4) = l[2](X)*l[4](X), (3, 3) = -1+l[3](X)^2, (3, 4) = l[3](X)*l[4](X), (4, 4) = 1+l[4](X)^2}]

(11)

Check g[mu, nu]

g_[]

Physics:-g_[mu, nu] = Matrix(%id = 18446744078525716710)

(12)

Rewrite now the Christoffel symbols in terms of the metric

Christoffel[alpha, mu, nu] = convert(Christoffel[alpha, mu, nu], g_)

Physics:-Christoffel[alpha, mu, nu] = (1/2)*Physics:-d_[nu](Physics:-g_[alpha, mu], [X])+(1/2)*Physics:-d_[mu](Physics:-g_[alpha, nu], [X])-(1/2)*Physics:-d_[alpha](Physics:-g_[mu, nu], [X])

(13)

and you want to express this result (13) in terms of l[mu] using

g_[mu, nu] = eta[mu, nu]+l[mu](X)*l[nu](X)

Physics:-g_[mu, nu] = eta[mu, nu]+l[mu](X)*l[nu](X)

(14)

Before moving ahead, verify that this equation is true

TensorArray(Physics[g_][mu, nu] = eta[mu, nu]+l[mu](X)*l[nu](X))

Matrix(%id = 18446744078525784902)

(15)

You see by eye that this is an Array of equations all of which are true:

"map(evalb,?)"

Matrix(%id = 18446744078462675414)

(16)

To substitute now (14) in (13) you can use the library command Library:-SubstituteTensor, for which

you have a help page section in the help page for Physics,Library . Note that it will take care of the

indices automatically

Library:-SubstituteTensor(Physics[g_][mu, nu] = eta[mu, nu]+l[mu](X)*l[nu](X), Physics[Christoffel][alpha, mu, nu] = (1/2)*Physics[d_][nu](Physics[g_][alpha, mu], [X])+(1/2)*Physics[d_][mu](Physics[g_][alpha, nu], [X])-(1/2)*Physics[d_][alpha](Physics[g_][mu, nu], [X]))

Physics:-Christoffel[alpha, mu, nu] = (1/2)*Physics:-d_[nu](eta[alpha, mu]+l[alpha](X)*l[mu](X), [X])+(1/2)*Physics:-d_[mu](eta[alpha, nu]+l[alpha](X)*l[nu](X), [X])-(1/2)*Physics:-d_[alpha](eta[mu, nu]+l[mu](X)*l[nu](X), [X])

(17)

You may prefer to see the d_[mu] derivatives evaluated. For that you can just invoke the label or use the

optional argument evaluateexpression

Physics[Christoffel][alpha, mu, nu] = (1/2)*Physics[d_][nu](eta[alpha, mu]+l[alpha](X)*l[mu](X), [X])+(1/2)*Physics[d_][mu](eta[alpha, nu]+l[alpha](X)*l[nu](X), [X])-(1/2)*Physics[d_][alpha](eta[mu, nu]+l[mu](X)*l[nu](X), [X])

Physics:-Christoffel[alpha, mu, nu] = (1/2)*Physics:-d_[nu](l[alpha](X), [X])*l[mu](X)+(1/2)*l[alpha](X)*Physics:-d_[nu](l[mu](X), [X])+(1/2)*Physics:-d_[mu](l[alpha](X), [X])*l[nu](X)+(1/2)*l[alpha](X)*Physics:-d_[mu](l[nu](X), [X])-(1/2)*Physics:-d_[alpha](l[mu](X), [X])*l[nu](X)-(1/2)*l[mu](X)*Physics:-d_[alpha](l[nu](X), [X])

(18)

Library:-SubstituteTensor(Physics[g_][mu, nu] = eta[mu, nu]+l[mu](X)*l[nu](X), Physics[Christoffel][alpha, mu, nu] = (1/2)*Physics[d_][nu](Physics[g_][alpha, mu], [X])+(1/2)*Physics[d_][mu](Physics[g_][alpha, nu], [X])-(1/2)*Physics[d_][alpha](Physics[g_][mu, nu], [X]), evaluateexpression)

Physics:-Christoffel[alpha, mu, nu] = (1/2)*Physics:-d_[nu](l[alpha](X), [X])*l[mu](X)+(1/2)*l[alpha](X)*Physics:-d_[nu](l[mu](X), [X])+(1/2)*Physics:-d_[mu](l[alpha](X), [X])*l[nu](X)+(1/2)*l[alpha](X)*Physics:-d_[mu](l[nu](X), [X])-(1/2)*Physics:-d_[alpha](l[mu](X), [X])*l[nu](X)-(1/2)*l[mu](X)*Physics:-d_[alpha](l[nu](X), [X])

(19)

Likewise, for the Ricci tensor,

Ricci[mu, nu]; % = convert(%, Christoffel)

Physics:-Ricci[mu, nu] = Physics:-d_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X])-Physics:-d_[nu](Physics:-Christoffel[`~alpha`, alpha, mu], [X])+Physics:-Christoffel[`~beta`, mu, nu]*Physics:-Christoffel[`~alpha`, alpha, beta]-Physics:-Christoffel[`~beta`, alpha, mu]*Physics:-Christoffel[`~alpha`, beta, nu]

(20)

so this expresses the Ricci tensor in terms of derivatives of l[mu]

Library:-SubstituteTensor(Physics[Christoffel][alpha, mu, nu] = (1/2)*Physics[d_][nu](l[alpha](X), [X])*l[mu](X)+(1/2)*l[alpha](X)*Physics[d_][nu](l[mu](X), [X])+(1/2)*Physics[d_][mu](l[alpha](X), [X])*l[nu](X)+(1/2)*l[alpha](X)*Physics[d_][mu](l[nu](X), [X])-(1/2)*Physics[d_][alpha](l[mu](X), [X])*l[nu](X)-(1/2)*l[mu](X)*Physics[d_][alpha](l[nu](X), [X]), Physics[Ricci][mu, nu] = Physics[d_][alpha](Physics[Christoffel][`~alpha`, mu, nu], [X])-Physics[d_][nu](Physics[Christoffel][`~alpha`, alpha, mu], [X])+Physics[Christoffel][`~beta`, mu, nu]*Physics[Christoffel][`~alpha`, alpha, beta]-Physics[Christoffel][`~beta`, alpha, mu]*Physics[Christoffel][`~alpha`, beta, nu], evaluateexpression)

Physics:-Ricci[mu, nu] = ((1/2)*Physics:-d_[nu](l[`~beta`](X), [X])*l[mu](X)+(1/2)*l[`~beta`](X)*Physics:-d_[nu](l[mu](X), [X])+(1/2)*Physics:-d_[mu](l[`~beta`](X), [X])*l[nu](X)+(1/2)*l[`~beta`](X)*Physics:-d_[mu](l[nu](X), [X])-(1/2)*Physics:-d_[`~beta`](l[mu](X), [X])*l[nu](X)-(1/2)*l[mu](X)*Physics:-d_[`~beta`](l[nu](X), [X]))*((1/2)*Physics:-d_[beta](l[`~alpha`](X), [X])*l[alpha](X)+(1/2)*l[`~alpha`](X)*Physics:-d_[beta](l[alpha](X), [X])+(1/2)*Physics:-d_[alpha](l[`~alpha`](X), [X])*l[beta](X)+(1/2)*l[`~alpha`](X)*Physics:-d_[alpha](l[beta](X), [X])-(1/2)*Physics:-d_[`~alpha`](l[alpha](X), [X])*l[beta](X)-(1/2)*l[alpha](X)*Physics:-d_[`~alpha`](l[beta](X), [X]))-((1/2)*Physics:-d_[mu](l[`~beta`](X), [X])*l[alpha](X)+(1/2)*l[`~beta`](X)*Physics:-d_[mu](l[alpha](X), [X])+(1/2)*Physics:-d_[alpha](l[`~beta`](X), [X])*l[mu](X)+(1/2)*l[`~beta`](X)*Physics:-d_[alpha](l[mu](X), [X])-(1/2)*Physics:-d_[`~beta`](l[alpha](X), [X])*l[mu](X)-(1/2)*l[alpha](X)*Physics:-d_[`~beta`](l[mu](X), [X]))*((1/2)*Physics:-d_[nu](l[`~alpha`](X), [X])*l[beta](X)+(1/2)*l[`~alpha`](X)*Physics:-d_[nu](l[beta](X), [X])+(1/2)*Physics:-d_[beta](l[`~alpha`](X), [X])*l[nu](X)+(1/2)*l[`~alpha`](X)*Physics:-d_[beta](l[nu](X), [X])-(1/2)*Physics:-d_[`~alpha`](l[beta](X), [X])*l[nu](X)-(1/2)*l[beta](X)*Physics:-d_[`~alpha`](l[nu](X), [X]))+(1/2)*Physics:-d_[nu](l[alpha](X), [X])*Physics:-d_[`~alpha`](l[mu](X), [X])+(1/2)*l[alpha](X)*Physics:-d_[nu](Physics:-d_[`~alpha`](l[mu](X), [X]), [X])+(1/2)*Physics:-d_[nu](Physics:-d_[`~alpha`](l[alpha](X), [X]), [X])*l[mu](X)+(1/2)*Physics:-d_[`~alpha`](l[alpha](X), [X])*Physics:-d_[nu](l[mu](X), [X])-(1/2)*l[`~alpha`](X)*Physics:-d_[nu](Physics:-d_[alpha](l[mu](X), [X]), [X])-(1/2)*Physics:-d_[nu](Physics:-d_[alpha](l[`~alpha`](X), [X]), [X])*l[mu](X)-(1/2)*Physics:-d_[nu](l[`~alpha`](X), [X])*Physics:-d_[mu](l[alpha](X), [X])-(1/2)*l[`~alpha`](X)*Physics:-d_[nu](Physics:-d_[mu](l[alpha](X), [X]), [X])-(1/2)*Physics:-d_[nu](Physics:-d_[mu](l[`~alpha`](X), [X]), [X])*l[alpha](X)-(1/2)*Physics:-d_[mu](l[`~alpha`](X), [X])*Physics:-d_[nu](l[alpha](X), [X])-(1/2)*Physics:-d_[alpha](l[mu](X), [X])*Physics:-d_[`~alpha`](l[nu](X), [X])-(1/2)*l[mu](X)*(Physics:-d_[alpha](Physics:-g_[`~alpha`, `~kappa`], [X])*Physics:-d_[kappa](l[nu](X), [X])+Physics:-dAlembertian(l[nu](X), [X]))-(1/2)*(Physics:-d_[alpha](Physics:-g_[`~alpha`, `~kappa`], [X])*Physics:-d_[kappa](l[mu](X), [X])+Physics:-dAlembertian(l[mu](X), [X]))*l[nu](X)-(1/2)*Physics:-d_[`~alpha`](l[mu](X), [X])*Physics:-d_[alpha](l[nu](X), [X])+(1/2)*Physics:-d_[alpha](l[`~alpha`](X), [X])*Physics:-d_[mu](l[nu](X), [X])+(1/2)*l[`~alpha`](X)*Physics:-d_[alpha](Physics:-d_[mu](l[nu](X), [X]), [X])+(1/2)*Physics:-d_[mu](l[`~alpha`](X), [X])*Physics:-d_[alpha](l[nu](X), [X])+(1/2)*Physics:-d_[alpha](Physics:-d_[mu](l[`~alpha`](X), [X]), [X])*l[nu](X)+(1/2)*l[`~alpha`](X)*Physics:-d_[alpha](Physics:-d_[nu](l[mu](X), [X]), [X])+(1/2)*Physics:-d_[alpha](Physics:-d_[nu](l[`~alpha`](X), [X]), [X])*l[mu](X)

(21)

The same for Riemann

Riemann[alpha, mu, beta, nu]; % = convert(%, Christoffel)

Physics:-Riemann[alpha, mu, beta, nu] = Physics:-g_[alpha, lambda]*(Physics:-d_[beta](Physics:-Christoffel[`~lambda`, mu, nu], [X])-Physics:-d_[nu](Physics:-Christoffel[`~lambda`, beta, mu], [X])+Physics:-Christoffel[`~lambda`, beta, kappa]*Physics:-Christoffel[`~kappa`, mu, nu]-Physics:-Christoffel[`~lambda`, kappa, nu]*Physics:-Christoffel[`~kappa`, beta, mu])

(22)

Library:-SubstituteTensor(Physics[Christoffel][alpha, mu, nu] = (1/2)*Physics[d_][nu](l[alpha](X), [X])*l[mu](X)+(1/2)*l[alpha](X)*Physics[d_][nu](l[mu](X), [X])+(1/2)*Physics[d_][mu](l[alpha](X), [X])*l[nu](X)+(1/2)*l[alpha](X)*Physics[d_][mu](l[nu](X), [X])-(1/2)*Physics[d_][alpha](l[mu](X), [X])*l[nu](X)-(1/2)*l[mu](X)*Physics[d_][alpha](l[nu](X), [X]), Physics[Riemann][alpha, mu, beta, nu] = Physics[g_][alpha, lambda]*(Physics[d_][beta](Physics[Christoffel][`~lambda`, mu, nu], [X])-Physics[d_][nu](Physics[Christoffel][`~lambda`, beta, mu], [X])+Physics[Christoffel][`~lambda`, beta, kappa]*Physics[Christoffel][`~kappa`, mu, nu]-Physics[Christoffel][`~lambda`, kappa, nu]*Physics[Christoffel][`~kappa`, beta, mu]), evaluateexpression)

Physics:-Riemann[alpha, mu, beta, nu] = Physics:-g_[alpha, lambda]*((1/2)*Physics:-d_[beta](Physics:-d_[nu](l[`~lambda`](X), [X]), [X])*l[mu](X)+(1/2)*l[`~lambda`](X)*Physics:-d_[beta](Physics:-d_[nu](l[mu](X), [X]), [X])+(1/2)*Physics:-d_[beta](Physics:-d_[mu](l[`~lambda`](X), [X]), [X])*l[nu](X)+(1/2)*Physics:-d_[mu](l[`~lambda`](X), [X])*Physics:-d_[beta](l[nu](X), [X])+(1/2)*Physics:-d_[beta](l[`~lambda`](X), [X])*Physics:-d_[mu](l[nu](X), [X])+(1/2)*l[`~lambda`](X)*Physics:-d_[beta](Physics:-d_[mu](l[nu](X), [X]), [X])-(1/2)*Physics:-d_[beta](Physics:-d_[`~lambda`](l[mu](X), [X]), [X])*l[nu](X)-(1/2)*Physics:-d_[`~lambda`](l[mu](X), [X])*Physics:-d_[beta](l[nu](X), [X])-(1/2)*Physics:-d_[beta](l[mu](X), [X])*Physics:-d_[`~lambda`](l[nu](X), [X])-(1/2)*l[mu](X)*Physics:-d_[beta](Physics:-d_[`~lambda`](l[nu](X), [X]), [X])-(1/2)*Physics:-d_[nu](Physics:-d_[mu](l[`~lambda`](X), [X]), [X])*l[beta](X)-(1/2)*Physics:-d_[mu](l[`~lambda`](X), [X])*Physics:-d_[nu](l[beta](X), [X])-(1/2)*Physics:-d_[nu](l[`~lambda`](X), [X])*Physics:-d_[mu](l[beta](X), [X])-(1/2)*l[`~lambda`](X)*Physics:-d_[nu](Physics:-d_[mu](l[beta](X), [X]), [X])-(1/2)*Physics:-d_[nu](Physics:-d_[beta](l[`~lambda`](X), [X]), [X])*l[mu](X)-(1/2)*l[`~lambda`](X)*Physics:-d_[nu](Physics:-d_[beta](l[mu](X), [X]), [X])+(1/2)*Physics:-d_[nu](Physics:-d_[`~lambda`](l[beta](X), [X]), [X])*l[mu](X)+(1/2)*Physics:-d_[`~lambda`](l[beta](X), [X])*Physics:-d_[nu](l[mu](X), [X])+(1/2)*Physics:-d_[nu](l[beta](X), [X])*Physics:-d_[`~lambda`](l[mu](X), [X])+(1/2)*l[beta](X)*Physics:-d_[nu](Physics:-d_[`~lambda`](l[mu](X), [X]), [X])+((1/2)*Physics:-d_[kappa](l[`~lambda`](X), [X])*l[beta](X)+(1/2)*l[`~lambda`](X)*Physics:-d_[kappa](l[beta](X), [X])+(1/2)*Physics:-d_[beta](l[`~lambda`](X), [X])*l[kappa](X)+(1/2)*l[`~lambda`](X)*Physics:-d_[beta](l[kappa](X), [X])-(1/2)*Physics:-d_[`~lambda`](l[beta](X), [X])*l[kappa](X)-(1/2)*l[beta](X)*Physics:-d_[`~lambda`](l[kappa](X), [X]))*((1/2)*Physics:-d_[nu](l[`~kappa`](X), [X])*l[mu](X)+(1/2)*l[`~kappa`](X)*Physics:-d_[nu](l[mu](X), [X])+(1/2)*Physics:-d_[mu](l[`~kappa`](X), [X])*l[nu](X)+(1/2)*l[`~kappa`](X)*Physics:-d_[mu](l[nu](X), [X])-(1/2)*Physics:-d_[`~kappa`](l[mu](X), [X])*l[nu](X)-(1/2)*l[mu](X)*Physics:-d_[`~kappa`](l[nu](X), [X]))-((1/2)*Physics:-d_[nu](l[`~lambda`](X), [X])*l[kappa](X)+(1/2)*l[`~lambda`](X)*Physics:-d_[nu](l[kappa](X), [X])+(1/2)*Physics:-d_[kappa](l[`~lambda`](X), [X])*l[nu](X)+(1/2)*l[`~lambda`](X)*Physics:-d_[kappa](l[nu](X), [X])-(1/2)*Physics:-d_[`~lambda`](l[kappa](X), [X])*l[nu](X)-(1/2)*l[kappa](X)*Physics:-d_[`~lambda`](l[nu](X), [X]))*((1/2)*Physics:-d_[mu](l[`~kappa`](X), [X])*l[beta](X)+(1/2)*l[`~kappa`](X)*Physics:-d_[mu](l[beta](X), [X])+(1/2)*Physics:-d_[beta](l[`~kappa`](X), [X])*l[mu](X)+(1/2)*l[`~kappa`](X)*Physics:-d_[beta](l[mu](X), [X])-(1/2)*Physics:-d_[`~kappa`](l[beta](X), [X])*l[mu](X)-(1/2)*l[beta](X)*Physics:-d_[`~kappa`](l[mu](X), [X])))

(23)

Also, recalling from my previous reply you have not defined l[mu], so in practice you do not have l[mu]*l[`~mu`] = 0.

Hence, I understand that, generally speaking, l[mu]*l[nu]*R[`~mu`, `~nu`] <> 0.

 

Regarding the simplifications you mention: could you please attach a worksheet to your post showing

the actual input you are using in Maple to represent your computation? Looking at this actual Maple

input I could probably give you some concrete feedback.

 

As an example illustrating what I say above, the following shows that, without specifying l[mu], you have

l[mu]*l[nu]*R[`~mu`, `~nu`] <> 0:

Ricci[mu, nu]*l[mu](X)*l[nu](X)

l[mu](X)*l[nu](X)*Physics:-Ricci[`~mu`, `~nu`]

(24)

If you uncomment the following input line you see a rather long expression different from zero involving

the components of l[mu] and their derivatives

NULL

NULL

 

Download RewriteTensors.mw


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

Hi
In a previous post in Mapleprimes, the question possed was a bit different but the answer is precisely what you are asking now, about setting the algebra for Pauli matrices. So in addition to Mehdi's answer you may want to check the reply entitled "Algebra for Pauli matrices" (you will need to scroll down the page to see this answer, by myself).

Independent of these two answers: a) it is possible as well to set this algebra as a tensor algebra, by setting spaceindices and using them to set the algebra; b) this algebra, as well as the algebra for Dirac matrices, they will soon both be loaded by default when you load Physics; that is, implemented directly in the package, not requiring someone to code them.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 

Hi

This is how I would do it: 

Load the package, set the notation to be textbooklike

restart; with(Physics); Setup(notation = true)

`* Partial match of  'notation' against keyword 'mathematicalnotation'`

(1)

Define your 4-Vector l[mu]

Define(l[mu])

`Defined objects with tensor properties`

 

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

(2)

If you want to define it giving the components, try Define(l[mu] = [a, b, c, d]) where the list on the right-hand side contains

each of the four covariant components of l[mu]

 

I assume also that, in the metric you may want to define, the components of l[mu] depend on the coordinates, so set a system

of coordinates, which you will need anyway to have the Christoffel symbols working. For simplicity I use here cartesian

coordinates

Setup(Coordinates = cartesian)

`* Partial match of  'Physics:-Coordinates' against keyword 'coordinatesystems'`

 

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

(3)

Again for simplicity, let's have the functionality of l[mu] not displayed all the time, so that everything is more readable

PDEtools:-declare(l(X))

l(x, y, z, t)*`will now be displayed as`*l

(4)

Now your problem: you want to define a metric - that at this point, as a draft, I am calling it G - equal to:

G[mu, nu] = g_[mu, nu]+l[mu](X)*l[nu](X)

G[mu, nu] = Physics:-g_[mu, nu]+l[mu](X)*l[nu](X)

(5)

Am I correct? Suppose yes. So define this G as a tensor

Define(G[mu, nu] = Physics[g_][mu, nu]+l[mu](X)*l[nu](X))

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], G[mu, nu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], l[mu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(6)

Let's check the components of G

G[]

G[mu, nu] = Matrix(%id = 18446744078377195630)

(7)

You can now define the actual metric g[mu, nu] using the matrix of the covariant components of G 

"Setup(metric = rhs(?))"

[metric = {(1, 1) = -1+l[1](X)^2, (1, 2) = l[1](X)*l[2](X), (1, 3) = l[1](X)*l[3](X), (1, 4) = l[1](X)*l[4](X), (2, 2) = -1+l[2](X)^2, (2, 3) = l[2](X)*l[3](X), (2, 4) = l[2](X)*l[4](X), (3, 3) = -1+l[3](X)^2, (3, 4) = l[3](X)*l[4](X), (4, 4) = 1+l[4](X)^2}]

(8)

Check g[mu, nu]

g_[]

Physics:-g_[mu, nu] = Matrix(%id = 18446744078346400822)

(9)

Note also that there are other manners of defining the metric: you can also pass the corresonding line element, or use one

of the predefined ones, etc. but most of the time you just construct a matrix and use it to define a metric as shown above.

 

So if I understood what you want to do correctly, the above is the answer, plus that you may want to define l[mu] more concretely,

indicating its covariant (or contravariant) components (so that "l[]^(nu) l[nu]=0 "?"").

 

Finally, regarding the Christoffel symbols, you do not need to define them - in the context of the Physics package everything

(the Christoffel, Ricci, Riemann, Einsten tensors, the covariant derivative D_[mu] etc. - see the corresponding help page) gets

automatically defined after you set the metric. For example:

"'Christoffel[~1,2,3]' = Christoffel[~1,2,3]"

Physics:-Christoffel[`~1`, 2, 3] = -(1/2)*((diff(l[1](X), z))*l[2](X)+l[1](X)*(diff(l[2](X), z))+(diff(l[1](X), y))*l[3](X)+l[1](X)*(diff(l[3](X), y))-(diff(l[2](X), x))*l[3](X)-l[2](X)*(diff(l[3](X), x))-l[3](X)^3*(diff(l[1](X), y))+l[3](X)^3*(diff(l[2](X), x))-l[2](X)^3*(diff(l[1](X), z))+l[2](X)^3*(diff(l[3](X), x))+l[1](X)*l[2](X)^2*(diff(l[2](X), z))-l[2](X)^2*l[1](X)*(diff(l[3](X), y))+l[4](X)^2*l[3](X)*(diff(l[1](X), y))-l[4](X)^2*l[3](X)*(diff(l[2](X), x))+l[4](X)^2*l[2](X)*(diff(l[1](X), z))-l[4](X)^2*l[2](X)*(diff(l[3](X), x))-l[3](X)^2*l[2](X)*(diff(l[1](X), z))+l[3](X)^2*l[2](X)*(diff(l[3](X), x))-l[3](X)^2*l[1](X)*(diff(l[2](X), z))+l[1](X)*l[3](X)^2*(diff(l[3](X), y))-l[3](X)*l[2](X)^2*(diff(l[1](X), y))+l[3](X)*l[2](X)^2*(diff(l[2](X), x))+l[4](X)*l[3](X)*l[1](X)*(diff(l[2](X), t))-l[4](X)*l[3](X)*l[1](X)*(diff(l[4](X), y))+l[4](X)*l[2](X)*l[1](X)*(diff(l[3](X), t))-l[4](X)*l[2](X)*l[1](X)*(diff(l[4](X), z)))/(l[4](X)^2-l[3](X)^2-l[2](X)^2-l[1](X)^2+1)

(10)

The Einstein covariant components: uncommenting the following line you get Einstein[1, 1] - a rather large expression

 

Download SetMetric.mw

 

Edgardo S. Cheb-Terrab 

Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi Mac Dude

This example you show looks to me sufficiently similar to the one you see as the last example in the help page for dchange. So the same solution can be used: just call G the inverse of F entering Theta = F(s), so s = G(Theta), and proceed ahead, as shown in the page.

Similarly, in the context of the example shown in the page, if itr is Theta = F(s), you can use PDEtools:-Solve to get a RootOf exact representation of the inverse using PDEtools:-Solve(itr, s) (note the use of PDEtools:-Solve instead of solve, which, for historical reasons only, will refuse to construct this representation). Then change variables using this exact representation of the inverse of F returned by PDEtools:-Solve. To see how this works you can use it instead of the 'tr := {s = am(w)}' shown in the help page, and you see it produces the same desired result shown in the page as equation (19).

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

Hi
I didn't investigate the solutions to your system, but can see a syntax problem in the input you show. First, you write D(u(t)) -- it should be D(u)(t); then you write inits and sys1 as lists, but then you ask {sys1} union {inits} -- that does not produce a single set of equations and initial conditions as you expect. 

Correcting these syntax issues, the input to your problem would be:

inits := {u(0) = 1, v(0) = 1, D(u)(0) = 1, D(v)(0) = 1};

sys1 := {D[1, 1](u)(t)+C[1, 1, 1]*D(u)(t)^2+2*C[1, 1, 2]*D(u)(t)*D(v)(t)+C[1, 2, 2]*D(v)(t)^2 = 0, D[1, 1](v)(t)+C[2, 1, 1]*D(u)(t)^2+2*C[2, 1, 2]*(D(u)(t)*D(v)(t))^2+C[2, 2, 2]*D(v)(t)^2 = 0};

L := dsolve(sys1 union inits);

Then dsolve(L) does not return unexpected error messages - but although you have defined a procedure Christoff (I understand that for the Christoffel symbols) you have not executed it, so the C[i,j,k] have no values assigned, and so the system, for generic C[i,j,k], is not solvable automatically by dsolve (perhaps it is solvable interactively using symmetries or integrating factors ...). I believe that in order to tackle your problem you first need to assign values to these C[i,j,k].

Independent of all this, the error message you show indicates that the program is not capturing the wrong syntax properly, as it should - I will give a look at that.

Also: note that the Physics package has dedicated commands to compute Geodesics - see ?Physics,Geodesics, and for the Christoffel symbols.

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

Hi

There were some similar questions/answers here in Mapleprimes. One that comes to my mind is 4-Vectors of arbitrary form - see ?Physics:-Define... There you will also find links to more Mapleprimes post about similar or the same. Let me know please if these do not contain the answer to your question.

Regarding a Student:-Physics, we are not here yet. I feel that first we need to fill some gaps, and that will probably take not less than 2 releases after Maple 18.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi Fred

This issue is now fixed; the fix available within today's update in the usual Maplesoft's Physics R&D (updates) webpage. I am in Brazil giving a mini-course on "computer algebra for physicits" - on return I will add to the zip a new Maple 18 PhysicsUpdates.mw worksheet to tell the things that have been updated already.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi
This is explained in the help page for ?Physics,Define, see the 4th paragraph. In brief, use = instead of an assignment :=, then pass that equation as an argument to Define. Also, to avoid the possible ambiguous meaning for KroneckerDelta[i,j] when the spacetime metric is of Minkowsky type, use the metric itself, g_[i,j] instead. So your input/output would look like

restart; with(Physics); Setup(mathematicalnotation = true, spacetimeindices = lowercaselatin)

L[i, j, k, l] = Physics:-`*`(Physics:-`*`(lambda, g_[i, j]), g_[k, l])+Physics:-`*`(mu, Physics:-`*`(g_[i, k], g_[j, l])+Physics:-`*`(g_[i, l], g_[j, k]));

L[i, j, k, l] = lambda*Physics:-g_[i, j]*Physics:-g_[k, l]+mu*(Physics:-g_[i, k]*Physics:-g_[j, l]+Physics:-g_[i, l]*Physics:-g_[j, k])

(1)

Define(L[i, j, k, l] = lambda*Physics:-g_[i, j]*Physics:-g_[k, l]+mu*(Physics:-g_[i, k]*Physics:-g_[j, l]+Physics:-g_[i, l]*Physics:-g_[j, k]))

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], L[i, j, k, l], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu]}

(2)

Now you can use indices with L;  this is the covariant component of L where all the indices are equal to 1

L[1, 1, 1, 1]

lambda+2*mu

(3)

This other one has three indices contravariant

'L[1, `~1`, `~1`, `~1`]' = L[1, `~1`, `~1`, `~1`]

L[1, `~1`, `~1`, `~1`] = -lambda-2*mu

(4)

The mixed covariant, contravariant

"'L[1,~1,1,~1]' = L[1,~1,1,~1]"

L[1, `~1`, 1, `~1`] = lambda+2*mu

(5)

You can also compute without attributing values to the indices while taking into account the symmetries under permutation of the indices that are implicit in the definition (1)

L[i, j, k, l]

L[i, j, k, l]

(6)

Swap for instance the first two indices: you receive the same expression

L[j, i, k, l]

L[i, j, k, l]

(7)

And the same if in addition you swap the positions in the second pair of indices

L[j, i, l, k]

L[i, j, k, l]

(8)

All the covariant nonzero components

L[nonzero]

L[a, b, c, d] = {(1, 1, 1, 1) = lambda+2*mu, (1, 1, 2, 2) = lambda, (1, 1, 3, 3) = lambda, (1, 1, 4, 4) = -lambda, (1, 2, 1, 2) = mu, (1, 2, 2, 1) = mu, (1, 3, 1, 3) = mu, (1, 3, 3, 1) = mu, (1, 4, 1, 4) = -mu, (1, 4, 4, 1) = -mu, (2, 1, 1, 2) = mu, (2, 1, 2, 1) = mu, (2, 2, 1, 1) = lambda, (2, 2, 2, 2) = lambda+2*mu, (2, 2, 3, 3) = lambda, (2, 2, 4, 4) = -lambda, (2, 3, 2, 3) = mu, (2, 3, 3, 2) = mu, (2, 4, 2, 4) = -mu, (2, 4, 4, 2) = -mu, (3, 1, 1, 3) = mu, (3, 1, 3, 1) = mu, (3, 2, 2, 3) = mu, (3, 2, 3, 2) = mu, (3, 3, 1, 1) = lambda, (3, 3, 2, 2) = lambda, (3, 3, 3, 3) = lambda+2*mu, (3, 3, 4, 4) = -lambda, (3, 4, 3, 4) = -mu, (3, 4, 4, 3) = -mu, (4, 1, 1, 4) = -mu, (4, 1, 4, 1) = -mu, (4, 2, 2, 4) = -mu, (4, 2, 4, 2) = -mu, (4, 3, 3, 4) = -mu, (4, 3, 4, 3) = -mu, (4, 4, 1, 1) = -lambda, (4, 4, 2, 2) = -lambda, (4, 4, 3, 3) = -lambda, (4, 4, 4, 4) = lambda+2*mu}

(9)

These are the five different values found in this set

map(rhs, rhs(L[a, b, c, d] = {(1, 1, 1, 1) = lambda+2*mu, (1, 1, 2, 2) = lambda, (1, 1, 3, 3) = lambda, (1, 1, 4, 4) = -lambda, (1, 2, 1, 2) = mu, (1, 2, 2, 1) = mu, (1, 3, 1, 3) = mu, (1, 3, 3, 1) = mu, (1, 4, 1, 4) = -mu, (1, 4, 4, 1) = -mu, (2, 1, 1, 2) = mu, (2, 1, 2, 1) = mu, (2, 2, 1, 1) = lambda, (2, 2, 2, 2) = lambda+2*mu, (2, 2, 3, 3) = lambda, (2, 2, 4, 4) = -lambda, (2, 3, 2, 3) = mu, (2, 3, 3, 2) = mu, (2, 4, 2, 4) = -mu, (2, 4, 4, 2) = -mu, (3, 1, 1, 3) = mu, (3, 1, 3, 1) = mu, (3, 2, 2, 3) = mu, (3, 2, 3, 2) = mu, (3, 3, 1, 1) = lambda, (3, 3, 2, 2) = lambda, (3, 3, 3, 3) = lambda+2*mu, (3, 3, 4, 4) = -lambda, (3, 4, 3, 4) = -mu, (3, 4, 4, 3) = -mu, (4, 1, 1, 4) = -mu, (4, 1, 4, 1) = -mu, (4, 2, 2, 4) = -mu, (4, 2, 4, 2) = -mu, (4, 3, 3, 4) = -mu, (4, 3, 4, 3) = -mu, (4, 4, 1, 1) = -lambda, (4, 4, 2, 2) = -lambda, (4, 4, 3, 3) = -lambda, (4, 4, 4, 4) = lambda+2*mu}))

{lambda, mu, -lambda, -mu, lambda+2*mu}

(10)

nops({lambda, mu, -lambda, -mu, lambda+2*mu})

5

(11)

 

Download TensorDefinition.mw

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

Hi
You indicate bosonic and fermionic operators, respectively noncommutative and anticommutative, using the Physics:-Setup command (see ?Physics,Setup). Any operator set, say as in Setup(operator = A), is assumed to be noncommutative. If in addition this operator is constructed with an anticommutative prefix, that you set, say as in Setup(anticommutativeprefix = Q), so for example if you enter Setup(operator = Q), then Q is a fermionic (anticommutative) operator. You can construct annihilation and creation operators to increase the occupation numbers of bosonic and fermionic quantum states by using the Annihilation and Creation operators. Details about all this are found in the help pages ?Physics,Example (section on Quantum Mechanics), ?Physics,Conventions (section on Space of quantum states and Dirac notation) and ?Physics,Annihilation. For projectos onto bosonic and fermionic states see ?Physics,Projector.

Regarding your other question, tensors can have their indices covariant, these are displayed as subscripts, or contravariant, displayed as superscripts.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@josephap83 and @tsunamiBTP


Hi

Although you could do these computations using DifferentialGeometry, I believe in cases like this one it is simpler using the tensor capabilities of the Physics package.

 

Independent of that, there is an issue with your post about the Divergence of a Tensor. You show a tensor 'tau' defined as an equation with a matrix on the right-hand side, but you do not show the indices of tau: is this the all contravariant tau, as in tau[`~i`, `~j`] or the all covariant tau[i, j] or just the "physical" components frequently denotated tau[i, j] that are not covariant nor contravariant? For the relationship between convariant, contravariant and "physical" components, see for instance A Primer on Tensor Calculus, page 12, formulas (32) and (33).

 

Here I will assume that you are describing tau[i, j]

 

restart; with(Physics)

 

Set the dimension to 3 and work with the coordiantes you indicated

Physics:-Setup(spacetimeindices = lowercaselatin, dimension = 3, coordinates = (X = [r, theta, z]), quiet)

[coordinatesystems = {X}, dimension = 3, spacetimeindices = lowercaselatin]

(1)

To set the metric, the simplest way is to indicate the line element

`#msup(mi("ds"),mn("2"))` := Physics:-`^`(Physics:-d_(r), 2)+Physics:-`*`(Physics:-`^`(r, 2), Physics:-`^`(Physics:-d_(theta), 2))+Physics:-`^`(Physics:-d_(z), 2)

Physics:-d_(r)^2+r^2*Physics:-d_(theta)^2+Physics:-d_(z)^2

(2)

Physics:-Setup(metric = Physics:-d_(r)^2+r^2*Physics:-d_(theta)^2+Physics:-d_(z)^2)

[metric = {(1, 1) = 1, (2, 2) = r^2, (3, 3) = 1}]

(3)

Visual check on the metric

g_[]

g[a, b] = (Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 2) = r^2, (2, 3) = 0, (3, 3) = 1}, storage = triangular[upper], shape = [symmetric]))

(4)

Define now the stress tensor tau[i, j]

Physics:-Define(tau[mu, nu], symmetric)

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], tau[mu, nu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(5)

And that is all. You do not need to define anything else, basis, Christoffel symbols, nothing.

Just compute the (covariant) divergence using standard tensorial notation.

Moreover: to avoid repetitive display of (r,theta,z) everywhere, use PDEtools:-declare

PDEtools:-declare(tau(X))

tau(r, theta, z)*`will now be displayed as`*tau

(6)

Physics:-D_[`~i`](tau[i, j](X))

Physics:-D_[`~i`](tau[i, j](X), [X])

(7)

The components of this Divergence are

Library:-TensorComponents(Physics:-D_[`~i`](tau[i, j](X), [X]))

[diff(tau[1, 1](X), r)+(diff(tau[2, 1](X), theta)+r*tau[1, 1](X)-tau[2, 2](X)/r)/r^2+diff(tau[3, 1](X), z), diff(tau[1, 2](X), r)-tau[1, 2](X)/r+(diff(tau[2, 2](X), theta)+r*tau[1, 2](X)+r*tau[2, 1](X))/r^2+diff(tau[3, 2](X), z), diff(tau[1, 3](X), r)+(diff(tau[2, 3](X), theta)+r*tau[1, 3](X))/r^2+diff(tau[3, 3](X), z)]

(8)

If what you need is this expression in terms of the "physical components" tau[i, j], from the formulas (32) and (33) of the reference mentioned in the first paragraph, you have:

h := proc (i) options operator, arrow; if i::(Or(1, 2, 3)) then [1, r, 1][i] else 'h(i)' end if end proc;

proc (i) options operator, arrow; if i::(Or(1, 2, 3)) then [1, r, 1][i] else 'h(i)' end if end proc

(9)

tau[i, j](X) = Physics:-`*`(Physics:-`*`(h(i), h(j)), tau[``(i, j)](X))

tau[i, j](X) = h(i)*h(j)*tau[``(i, j)](X)

(10)

[seq(seq(tau[i, j](X) = h(i)*h(j)*tau[``(i, j)](X), i = 1 .. 3), j = 1 .. 3)]

[tau[1, 1](X) = tau[``(1, 1)](X), tau[2, 1](X) = r*tau[``(2, 1)](X), tau[3, 1](X) = tau[``(3, 1)](X), tau[1, 2](X) = r*tau[``(1, 2)](X), tau[2, 2](X) = r^2*tau[``(2, 2)](X), tau[3, 2](X) = r*tau[``(3, 2)](X), tau[1, 3](X) = tau[``(1, 3)](X), tau[2, 3](X) = r*tau[``(2, 3)](X), tau[3, 3](X) = tau[``(3, 3)](X)]

(11)

eval([diff(tau[1, 1](X), r)+(diff(tau[2, 1](X), theta)+r*tau[1, 1](X)-tau[2, 2](X)/r)/r^2+diff(tau[3, 1](X), z), diff(tau[1, 2](X), r)-tau[1, 2](X)/r+(diff(tau[2, 2](X), theta)+r*tau[1, 2](X)+r*tau[2, 1](X))/r^2+diff(tau[3, 2](X), z), diff(tau[1, 3](X), r)+(diff(tau[2, 3](X), theta)+r*tau[1, 3](X))/r^2+diff(tau[3, 3](X), z)], [tau[1, 1](X) = tau[``(1, 1)](X), tau[2, 1](X) = r*tau[``(2, 1)](X), tau[3, 1](X) = tau[``(3, 1)](X), tau[1, 2](X) = r*tau[``(1, 2)](X), tau[2, 2](X) = r^2*tau[``(2, 2)](X), tau[3, 2](X) = r*tau[``(3, 2)](X), tau[1, 3](X) = tau[``(1, 3)](X), tau[2, 3](X) = r*tau[``(2, 3)](X), tau[3, 3](X) = tau[``(3, 3)](X)])

[diff(tau[``(1, 1)](X), r)+(r*(diff(tau[``(2, 1)](X), theta))+r*tau[``(1, 1)](X)-r*tau[``(2, 2)](X))/r^2+diff(tau[``(3, 1)](X), z), r*(diff(tau[``(1, 2)](X), r))+(r^2*(diff(tau[``(2, 2)](X), theta))+r^2*tau[``(1, 2)](X)+r^2*tau[``(2, 1)](X))/r^2+r*(diff(tau[``(3, 2)](X), z)), diff(tau[``(1, 3)](X), r)+(r*(diff(tau[``(2, 3)](X), theta))+r*tau[``(1, 3)](X))/r^2+diff(tau[``(3, 3)](X), z)]

(12)

And this is the result you show, that you were expecting.

 

_________________________________________________________________________

Details

Note the compact display of derivatives indexed, and the functionality of the components of tau omited (this is what PDEtools:-declare does). But is only a display trick.

The actual Maple objects are behind this display. If you want to see them in standard Maple notation, use show

show

[diff(tau[``(1, 1)](X), r)+(r*(diff(tau[``(2, 1)](X), theta))+r*tau[``(1, 1)](X)-r*tau[``(2, 2)](X))/r^2+diff(tau[``(3, 1)](X), z), r*(diff(tau[``(1, 2)](X), r))+(r^2*(diff(tau[``(2, 2)](X), theta))+r^2*tau[``(1, 2)](X)+r^2*tau[``(2, 1)](X))/r^2+r*(diff(tau[``(3, 2)](X), z)), diff(tau[``(1, 3)](X), r)+(r*(diff(tau[``(2, 3)](X), theta))+r*tau[``(1, 3)](X))/r^2+diff(tau[``(3, 3)](X), z)]

(13)

Also, in (12) you see tau[1, 2] and also tau[2, 1]. If you want the symmetry of the stress tensor - that you indicated when you defined the tensor - to be taken into account, use Physics:-Simplify  (not simplify)

Physics:-Simplify([diff(tau[``(1, 1)](X), r)+(r*(diff(tau[``(2, 1)](X), theta))+r*tau[``(1, 1)](X)-r*tau[``(2, 2)](X))/r^2+diff(tau[``(3, 1)](X), z), r*(diff(tau[``(1, 2)](X), r))+(r^2*(diff(tau[``(2, 2)](X), theta))+r^2*tau[``(1, 2)](X)+r^2*tau[``(2, 1)](X))/r^2+r*(diff(tau[``(3, 2)](X), z)), diff(tau[``(1, 3)](X), r)+(r*(diff(tau[``(2, 3)](X), theta))+r*tau[``(1, 3)](X))/r^2+diff(tau[``(3, 3)](X), z)])

[((diff(tau[``(1, 1)](X), r))*r+(diff(tau[``(3, 1)](X), z))*r+diff(tau[``(2, 1)](X), theta)+tau[``(1, 1)](X)-tau[``(2, 2)](X))/r, r*(diff(tau[``(1, 2)](X), r))+r*(diff(tau[``(3, 2)](X), z))+diff(tau[``(2, 2)](X), theta)+tau[``(1, 2)](X)+tau[``(2, 1)](X), ((diff(tau[``(1, 3)](X), r))*r+(diff(tau[``(3, 3)](X), z))*r+diff(tau[``(2, 3)](X), theta)+tau[``(1, 3)](X))/r]

(14)

If you prefer for the symmetry properties to be taken into account automatically, among other ways you can directly define the tensor as a matrix with the appropriate symmetry, for example:

proc (i, j) options operator, arrow; tau[i, j](X) end proc

proc (i, j) options operator, arrow; tau[i, j](X) end proc

(15)

Tau[i, j] = Matrix(3, proc (i, j) options operator, arrow; tau[i, j](X) end proc, shape = symmetric)

Tau[i, j] = Matrix(%id = 18446744078150270358)

(16)

Define now a tensor Tau with this equation (see Physics:-Define , the paragraph about defining using tensorial equations)

Physics:-Define(Tau[i, j] = Matrix(%id = 18446744078150270358))

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Tau[i, j], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], tau[mu, nu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(17)

You can now compute taking the symmetry into account automatically

Physics:-D_[`~i`](Tau[i, j])

Physics:-D_[`~i`](Tau[i, j], [X])

(18)

Library:-TensorComponents(Physics:-D_[`~i`](Tau[i, j], [X]))

[diff(tau[1, 1](X), r)+(diff(tau[1, 2](X), theta)+r*tau[1, 1](X)-tau[2, 2](X)/r)/r^2+diff(tau[1, 3](X), z), diff(tau[1, 2](X), r)-tau[1, 2](X)/r+(diff(tau[2, 2](X), theta)+2*r*tau[1, 2](X))/r^2+diff(tau[2, 3](X), z), diff(tau[1, 3](X), r)+(diff(tau[2, 3](X), theta)+r*tau[1, 3](X))/r^2+diff(tau[3, 3](X), z)]

(19)

By the way you may want to compute with this object `&Dscr;`[`~mu`](Tau[mu, nu]) itself, as a tensor of 1 index. You can do that the same way, defining a tensor whose components are the components of this divergence, as in

Z[j] = Physics:-D_[`~i`](Tau[i, j], [X])

Z[j] = Physics:-D_[`~i`](Tau[i, j], [X])

(20)

Physics:-Define(Z[j] = Physics:-D_[`~i`](Tau[i, j], [X]))

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Tau[i, j], Physics:-Weyl[mu, nu, alpha, beta], Z[j], Physics:-d_[mu], Physics:-g_[mu, nu], tau[mu, nu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(21)

Now you have direct access to the covariant OR contravariant components using indices. For example, the 2nd covariant and contravariant components are different

'Z[2]' = Z[2]

Z[2] = ((diff(tau[1, 2](X), r))*r^2+r*tau[1, 2](X)+diff(tau[2, 2](X), theta)+(diff(tau[2, 3](X), z))*r^2)/r^2

(22)

'Z[`~2`]' = Z[`~2`]

Z[`~2`] = ((diff(tau[1, 2](X), r))*r^2+r*tau[1, 2](X)+diff(tau[2, 2](X), theta)+(diff(tau[2, 3](X), z))*r^2)/r^4

(23)

simplify(normal((Z[2] = ((diff(tau[1, 2](X), r))*r^2+r*tau[1, 2](X)+diff(tau[2, 2](X), theta)+(diff(tau[2, 3](X), z))*r^2)/r^2)-(Z[`~2`] = ((diff(tau[1, 2](X), r))*r^2+r*tau[1, 2](X)+diff(tau[2, 2](X), theta)+(diff(tau[2, 3](X), z))*r^2)/r^4)), size)

((diff(tau[1, 2](X), r))*r^2+r*tau[1, 2](X)+diff(tau[2, 2](X), theta)+(diff(tau[2, 3](X), z))*r^2)*(r+1)*(r-1)/r^4 = ((diff(tau[1, 2](X), r))*r^2+r*tau[1, 2](X)+diff(tau[2, 2](X), theta)+(diff(tau[2, 3](X), z))*r^2)*(r+1)*(r-1)/r^4

(24)

NOTE: the computations above are performed using the newest Physics library, available for download at Maplesoft's Physics Research & Development webpage

``

NULL


Download DivergenceOfATensor.mw

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

Hi

There is a technique in Maple, not very well know, which however permits eliminations as the one you say indicating your preferred variables. Suppose for that purpose that you do not assign c := a+b. Instead you only want a + b + 2 be rewritten as c + 2, and let's state the task as "I want to simplfy a + b + 2 taking into account c = a + b and removing a and b". Here it is:

The details are explained in ?simplify,siderels. In my opinion, and despite some nuances of its syntax, this is one of the most versatile simplifications available in the Maple system.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi Alejandro, others

Regarding Diff -> diff, PDEtools:-dchange works as designed. When I wrote this command (exactly 22 years ago ...) and also by the end of 1999 there was evidence of problems when you did not do Diff -> diff, mainly related to incorrect uses of Diff, that would not be detected if you do not activate these inert derivatives, making the whole 'change of variables' process go astray.

Along the years, mainly while designing `assuming` and the handling of inert functions, another approach proved to be more useful: just spend additional computational cycles, as much as you need, verifying - with reasonable probability - that ill-defined situations are not present, then proceed without activating anything. This always implies on a slow down but it is negligible. PDEtools:-dchange never got updated regarding this; when I saw this post a couple of days ago it passed through my mind to just do it.

By now I am busy with the  Virtual User Summit (Feb/27) and next month with a mini-course on Computer algebra for physicists in Brazil. After that I will give a look at this. If possible, I will implement it and put it available on the Maplesoft R&D page for DEs and Mathematical functions. I will then post here again.

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

First 47 48 49 50 51 52 53 Last Page 49 of 58