ecterrab

13431 Reputation

24 Badges

19 years, 362 days

MaplePrimes Activity


These are answers submitted by ecterrab

 

The problem is in your use of 'assume'. I don't mean you are doing something "wrong", just that the assume command is incompatible with VectorCalculus, DifferentialGeometry, Physics, etc. . From you post it is clear that this should be emphasized more. The problem: assume redefines the variables. So, after you input "assume(theta::whatever)", the variable theta is different from the variable theta "before that call to assume " (i.e. when you defined the metric check the order of your input lines below).

 

For this reason, in Maple 2015, a new command, Physics:-Assume, that is compatible with VectorCalculus, DifferentialGeometry, Physics, etc., got introduced. A discussion about this is present in the page for what is new in Physics in Maple 2015 .(check please the section on the new command Assume, and the related examples).

 

Likewise, if you updated your Physics library with the one available on the Maplesoft R&D Physics webpage, you will see that now you can use the `assuming` command with Physics:-Assume (open the Physics:-Setup() applet and tick the corresponding box), so that now `assuming` is also fully compatible with all these Maple packages.

 

Below you find the results using Physics:-Assume instead of assume, but in this case you get the same without using any form of assumptions. My text is italized and my input is in 2D format, so you can distinguish it from yours (that I kept untouched) because yours is in 1D input format (the maroon ASCII letters).

 

#Error in D_[]
restart:
with(Physics):
Setup(mathematicalnotation = true):
ds2 := 1/(r^2*cos(theta)^2)*(-dt^2 + dr^2 + r^2*dtheta^2);

(dtheta^2*r^2+dr^2-dt^2)/(r^2*cos(theta)^2)

(1)

Setup(dimension = 3, coordinatesystems = (N = [t, r, theta]), metric = ds2):

`The dimension and signature of the tensor space are set to: [3, - - +] `

 

`Detected \`t\`, the time variable, in position 1. Changing the signature of the spacetime metric accordingly, to: + - - `

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{N = (t, r, theta)}

 

`Systems of spacetime Coordinates are: `*{N = (t, r, theta)}

(2)

So in the above you entered the metric with variables N = (t, r, theta). But if you now call assume, the variable theta that is part of the metric (entered before calling assume) will be different than the variable theta after you call assume.

 

So: do not use assume. Use Physics:-Assume instead. Please see also the explanation about the difference in the third paragraph of the Description in the help page of Physics:-Assume. Here I comment your input that uses 'assume' and replace it with a call to Assume. It does all the same, just without redefining the variables, without changing them into something else.

.

Assume(theta<Pi/2, theta>-Pi/2); # assume(theta<Pi/2, theta>-Pi/2)

{theta::(RealRange(Open(-(1/2)*Pi), Open((1/2)*Pi)))}

(3)

Continue now with your computation

Setup(spacetimeindices = lowercaselatin);

[spacetimeindices = lowercaselatin]

(4)

W[a,b] = Matrix(3,3, {(1, 1) = mu, (2,2) = mu*sin(theta)^2, (3,3) =mu*r^2*cos(theta)^2, (2,3) = mu*r*sin(theta)*cos(theta)}, shape = symmetric):
Define(%):

`Defined objects with tensor properties`

(5)

The simplest way to give a look at the components of W is actually this one:

W[]

W[a, b] = Matrix(%id = 18446744078437576702)

(6)

or, for the contravariant components:

"W[~]"

W[`~a`, `~b`] = Matrix(%id = 18446744078437571510)

(7)

TensorArray(W[a,b]);

Matrix(3, 3, {(1, 1) = mu, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = mu*sin(theta)^2, (2, 3) = mu*r*sin(theta)*cos(theta), (3, 1) = 0, (3, 2) = mu*r*sin(theta)*cos(theta), (3, 3) = mu*r^2*cos(theta)^2})

(8)

B[d,e,f] = D_[d](W[e,f]);

B[d, e, f] = Physics:-D_[d](W[e, f], [N])

(9)

Define(%, quiet):

The simplest input to generate the nonzero components of a tensor is, for instance in the case of B,

B[nonzero]

B[a, b, c] = {(1, 1, 2) = mu/r, (1, 1, 3) = -sin(theta)*mu/cos(theta), (1, 2, 1) = mu/r, (1, 3, 1) = -sin(theta)*mu/cos(theta), (2, 1, 1) = 2*mu/r, (2, 2, 2) = 4*mu*sin(theta)^2/r, (2, 2, 3) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta), (2, 3, 2) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta), (2, 3, 3) = 2*mu*r*(2*cos(theta)^2-1), (3, 1, 1) = -2*sin(theta)*mu/cos(theta), (3, 2, 2) = 2*mu*(2*cos(theta)^2-1)*sin(theta)/cos(theta), (3, 2, 3) = mu*r*(4*cos(theta)^2-3), (3, 3, 2) = mu*r*(4*cos(theta)^2-3), (3, 3, 3) = -4*mu*r^2*cos(theta)*sin(theta)}

(10)

You see that

subs(d = 1, e = 2, f = 1, B[d, e, f] = Physics:-D_[d](W[e, f], [N]))

B[1, 2, 1] = Physics:-D_[1](W[2, 1], [N])

(11)

B[1, 2, 1] = Physics:-D_[1](W[2, 1], [N])

mu/r = -W[1, d]*Physics:-Christoffel[`~d`, 1, 2]-W[2, d]*Physics:-Christoffel[`~d`, 1, 1]

(12)

And this lhs is indeed what you were looking for. The right-hand side is also correct, just sum over the repeated index d

Physics:-SumOverRepeatedIndices(mu/r = -W[1, d]*Physics:-Christoffel[`~d`, 1, 2]-W[2, d]*Physics:-Christoffel[`~d`, 1, 1])

mu/r = mu/r

(13)

This is how I'd test all the components at once, in steps

TensorArray(B[d, e, f] = Physics:-D_[d](W[e, f], [N]), simplifier = simplify)

RTABLE(18446744074180911102, anything, Array, rectangular, Fortran_order, [], 3, 1 .. 3, 1 .. 3, 1 .. 3)

(14)

ArrayElems(Array(%id = 18446744078203209718))

{(1, 1, 1) = (0 = 0), (1, 1, 2) = (mu/r = mu/r), (1, 1, 3) = (-sin(theta)*mu/cos(theta) = -sin(theta)*mu/cos(theta)), (1, 2, 1) = (mu/r = mu/r), (1, 2, 2) = (0 = 0), (1, 2, 3) = (0 = 0), (1, 3, 1) = (-sin(theta)*mu/cos(theta) = -sin(theta)*mu/cos(theta)), (1, 3, 2) = (0 = 0), (1, 3, 3) = (0 = 0), (2, 1, 1) = (2*mu/r = 2*mu/r), (2, 1, 2) = (0 = 0), (2, 1, 3) = (0 = 0), (2, 2, 1) = (0 = 0), (2, 2, 2) = (4*mu*sin(theta)^2/r = 4*mu*sin(theta)^2/r), (2, 2, 3) = (mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta)), (2, 3, 1) = (0 = 0), (2, 3, 2) = (mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta)), (2, 3, 3) = (2*mu*r*(2*cos(theta)^2-1) = 2*mu*r*(2*cos(theta)^2-1)), (3, 1, 1) = (-2*sin(theta)*mu/cos(theta) = -2*sin(theta)*mu/cos(theta)), (3, 1, 2) = (0 = 0), (3, 1, 3) = (0 = 0), (3, 2, 1) = (0 = 0), (3, 2, 2) = (2*mu*(2*cos(theta)^2-1)*sin(theta)/cos(theta) = 2*mu*(2*cos(theta)^2-1)*sin(theta)/cos(theta)), (3, 2, 3) = (mu*r*(4*cos(theta)^2-3) = mu*r*(4*cos(theta)^2-3)), (3, 3, 1) = (0 = 0), (3, 3, 2) = (mu*r*(4*cos(theta)^2-3) = mu*r*(4*cos(theta)^2-3)), (3, 3, 3) = (-4*mu*r^2*cos(theta)*sin(theta) = -4*mu*r^2*cos(theta)*sin(theta))}

(15)

Take the rhs of each object in (15), and check for equality (using evalb ), they all return true

map(`@`(evalb, rhs), {(1, 1, 1) = (0 = 0), (1, 1, 2) = (mu/r = mu/r), (1, 1, 3) = (-sin(theta)*mu/cos(theta) = -sin(theta)*mu/cos(theta)), (1, 2, 1) = (mu/r = mu/r), (1, 2, 2) = (0 = 0), (1, 2, 3) = (0 = 0), (1, 3, 1) = (-sin(theta)*mu/cos(theta) = -sin(theta)*mu/cos(theta)), (1, 3, 2) = (0 = 0), (1, 3, 3) = (0 = 0), (2, 1, 1) = (2*mu/r = 2*mu/r), (2, 1, 2) = (0 = 0), (2, 1, 3) = (0 = 0), (2, 2, 1) = (0 = 0), (2, 2, 2) = (4*mu*sin(theta)^2/r = 4*mu*sin(theta)^2/r), (2, 2, 3) = (mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta)), (2, 3, 1) = (0 = 0), (2, 3, 2) = (mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta)), (2, 3, 3) = (2*mu*r*(2*cos(theta)^2-1) = 2*mu*r*(2*cos(theta)^2-1)), (3, 1, 1) = (-2*sin(theta)*mu/cos(theta) = -2*sin(theta)*mu/cos(theta)), (3, 1, 2) = (0 = 0), (3, 1, 3) = (0 = 0), (3, 2, 1) = (0 = 0), (3, 2, 2) = (2*mu*(2*cos(theta)^2-1)*sin(theta)/cos(theta) = 2*mu*(2*cos(theta)^2-1)*sin(theta)/cos(theta)), (3, 2, 3) = (mu*r*(4*cos(theta)^2-3) = mu*r*(4*cos(theta)^2-3)), (3, 3, 1) = (0 = 0), (3, 3, 2) = (mu*r*(4*cos(theta)^2-3) = mu*r*(4*cos(theta)^2-3)), (3, 3, 3) = (-4*mu*r^2*cos(theta)*sin(theta) = -4*mu*r^2*cos(theta)*sin(theta))})

{true}

(16)

When there is D_ around and you are in doubt, it is always convenient to convert to d_  first, to make explicit the Christoffel symbols, then proceed as in above:

convert(B[d, e, f] = Physics:-D_[d](W[e, f], [N]), Physics:-d_)

B[d, e, f] = Physics:-d_[d](W[e, f], [N])-Physics:-Christoffel[`~a`, d, e]*W[a, f]-Physics:-Christoffel[`~a`, d, f]*W[a, e]

(17)

map(`@`(evalb, rhs), ArrayElems(Physics:-TensorArray(B[d, e, f] = Physics:-d_[d](W[e, f], [N])-Physics:-Christoffel[`~a`, d, e]*W[a, f]-Physics:-Christoffel[`~a`, d, f]*W[a, e], simplifier = simplify)))

{true}

(18)

subs([d = 1, e = 2, f = 1], B[d, e, f] = Physics:-d_[d](W[e, f], [N])-Physics:-Christoffel[`~a`, d, e]*W[a, f]-Physics:-Christoffel[`~a`, d, f]*W[a, e])

B[1, 2, 1] = Physics:-d_[1](W[2, 1], [N])-Physics:-Christoffel[`~a`, 1, 2]*W[a, 1]-Physics:-Christoffel[`~a`, 1, 1]*W[a, 2]

(19)

B[1, 2, 1] = Physics:-d_[1](W[2, 1], [N])-Physics:-Christoffel[`~a`, 1, 2]*W[a, 1]-Physics:-Christoffel[`~a`, 1, 1]*W[a, 2]

mu/r = -W[1, a]*Physics:-Christoffel[`~a`, 1, 2]-W[2, a]*Physics:-Christoffel[`~a`, 1, 1]

(20)

Physics:-SumOverRepeatedIndices(mu/r = -W[1, a]*Physics:-Christoffel[`~a`, 1, 2]-W[2, a]*Physics:-Christoffel[`~a`, 1, 1])

mu/r = mu/r

(21)

With the following input/output you can compare all the components of B after replacing that call to "assume" by a call to Physics:-Assume, with the components you were receiving using "assume" (my input: 2D format, your former input: afterwards in 1D format):

simplify(B[d, e, f, nonzero]);

B[d, e, f] = {(1, 1, 2) = mu/r, (1, 1, 3) = -sin(theta)*mu/cos(theta), (1, 2, 1) = mu/r, (1, 3, 1) = -sin(theta)*mu/cos(theta), (2, 1, 1) = 2*mu/r, (2, 2, 2) = 4*mu*sin(theta)^2/r, (2, 2, 3) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta), (2, 3, 2) = mu*(4*cos(theta)^2-1)*sin(theta)/cos(theta), (2, 3, 3) = 2*mu*r*(2*cos(theta)^2-1), (3, 1, 1) = -2*sin(theta)*mu/cos(theta), (3, 2, 2) = 2*mu*(2*cos(theta)^2-1)*sin(theta)/cos(theta), (3, 2, 3) = mu*r*(4*cos(theta)^2-3), (3, 3, 2) = mu*r*(4*cos(theta)^2-3), (3, 3, 3) = -4*mu*r^2*cos(theta)*sin(theta)}

(22)

simplify(B[d,e,f,nonzero]);

`Defined objects with tensor properties`

 

B[d, e, f] = {(1, 1, 2) = -mu*(cos(theta)^2-2)/r, (1, 1, 3) = mu*sin(theta)*cos(theta), (1, 2, 1) = -mu*(cos(theta)^2-2)/r, (1, 3, 1) = mu*sin(theta)*cos(theta), (2, 1, 1) = 2*mu/r, (2, 2, 2) = 2*mu*sin(theta)^2/r, (2, 2, 3) = 2*mu*sin(theta)*cos(theta), (2, 3, 2) = 2*mu*sin(theta)*cos(theta), (2, 3, 3) = 2*mu*r*cos(theta)^2, (3, 2, 2) = 2*mu*sin(theta)*cos(theta), (3, 2, 3) = mu*r*(2*cos(theta)^2-1), (3, 3, 2) = mu*r*(2*cos(theta)^2-1), (3, 3, 3) = -2*mu*r^2*cos(theta)*sin(theta)}

(23)

Finally, in typical situations you may want to experiment using assuming; if so, please remember to set it up so that it uses Physics:-Assume instead of its default use of assume. You achieve that entering, at the prompt,

Physics:-Setup(assumingusesAssume = true)

[assumingusesAssume = true]

(24)

Or likewise, open the Setup applet using

Physics:-Setup()

and check the corresponding box in the lower left side of the applet.

 

Edgardo S. Cheb-Terrab

Physics, Differential Equations and Mathematical Functions, Maplesoft.

 

# Results from GRTensorII version 1.79(R4)

`For the blabr spacetime:`

`W(dn,dn,cdn)`

W[r*t*`;`*t] = mu/r

W[theta*t*`;`*t] = -mu*sin(theta)/cos(theta)

W[t*r*`;`*t] = mu/r

W[t*theta*`;`*t] = -mu*sin(theta)/cos(theta)

W[t*t*`;`*r] = 2*mu/r

W[r*r*`;`*r] = 4*mu*sin(theta)^2/r

W[theta*r*`;`*r] = mu*sin(theta)*(3*cos(theta)^2-sin(theta)^2)/cos(theta)

W[r*theta*`;`*r] = mu*sin(theta)*(3*cos(theta)^2-sin(theta)^2)/cos(theta)

W[theta*theta*`;`*r] = 2*mu*r*cos(theta)^2-2*mu*r*sin(theta)^2

W[t*t*`;`*theta] = -2*mu*sin(theta)/cos(theta)

W[r*r*`;`*theta] = 2*mu*sin(theta)*(cos(theta)^2-sin(theta)^2)/cos(theta)

W[theta*r*`;`*theta] = mu*r*cos(theta)^2-3*mu*r*sin(theta)^2

W[r*theta*`;`*theta] = mu*r*cos(theta)^2-3*mu*r*sin(theta)^2

W[theta*theta*`;`*theta] = -4*mu*r^2*cos(theta)*sin(theta)

 

 

Download NoErrorsInD_(reviewed_using_Assume).mw

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


Regarding your first question: no, there is no way to indicate indices that run for part of the dimension (but for space and spacetime, as you noticed).

 

Regarding your second question, a but report, below is your worksheet reviewed, using Maple 2015 and the latest Physics update: I cannot reproduce any bug. There are a couple of observations though, all written italized, intercalated with a few additional input lines, all entered in 2D math input mode, so you can distinguish your original lines (in 1D input mode) from my comments.

 

#Bug in Physics

#Restart and load packages
restart:
with(Physics):
Setup(mathematicalnotation = true):

Physics:-Version()[2 .. -1]

`2015, July 19, 14:23 hours`

(1)

#Set up 3D metric with coordinates N = [t,r,theta]
ds2 := 1/(r^2*cos(theta)^2)*(-dt^2 + dr^2 + r^2*dtheta^2);
Setup(dimension = 3, coordinatesystems = (N = [t, r, theta]), metric = ds2);

(dtheta^2*r^2+dr^2-dt^2)/(r^2*cos(theta)^2)

 

`The dimension and signature of the tensor space are set to: [3, - - +] `

 

`Detected \`t\`, the time variable, in position 1. Changing the signature of the spacetime metric accordingly, to: + - - `

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{N = (t, r, theta)}

 

`Systems of spacetime Coordinates are: `*{N = (t, r, theta)}

 

[coordinatesystems = {N}, dimension = 3, metric = {(1, 1) = -1/(r^2*cos(theta)^2), (2, 2) = 1/(r^2*cos(theta)^2), (3, 3) = 1/cos(theta)^2}]

(2)

#Define h, and V tensors
Define(h[mu,nu](N), V[mu](N));

`Defined objects with tensor properties`

 

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

(3)

Setup(spaceindices = lowercaselatin);

[spaceindices = lowercaselatin]

(4)

#Complicated expression
expression := D_[c](D_[~c](V[mu](N))) + D_[c](D_[mu](V[~c](N))) - D_[mu](D_[c](V[~c](N))) + D_[c](h[~c, mu](N)) - 1/2*D_[mu](h[~c,c](N));

Physics:-D_[c](Physics:-D_[`~c`](V[mu](N)), [N])+Physics:-D_[c](Physics:-D_[mu](V[`~c`](N)), [N])-Physics:-d_[mu](Physics:-D_[c](V[`~c`](N)), [N])+Physics:-D_[c](h[`~c`, mu](N), [N])-(1/2)*Physics:-d_[mu](h[`~c`, c](N), [N])

(5)

Check(expression);

`The repeated and free indices in the given expression check ok.`

(6)

In your worksheet, you show an Error message, that I keep here to compare, but right after I run the same computation and receive no error message

SumOverRepeatedIndices(expression);  # this is the error message you show

Error, (in Physics:-SumOverRepeatedIndices) unable to handle tensor expressions as Physics:-D_[c](Physics:-d_[mu](V[`~c`](t, r, theta), [t, r, theta]), [t, r, theta])+Physics:-D_[c](Physics:-Christoffel[`~c`, 1, mu]*V[`~1`](t, r, theta), [t, r, theta])+Physics:-D_[c](Physics:-Christoffel[`~c`, 2, mu]*V[`~2`](t, r, theta), [t, r, theta])+Physics:-D_[c](Physics:-Christoffel[`~c`, 3, mu]*V[`~3`](t, r, theta), [t, r, theta])

 

Physics:-SumOverRepeatedIndices(expression)

Physics:-D_[1](Physics:-D_[`~1`](V[mu](N)), [N])+Physics:-D_[2](Physics:-D_[`~2`](V[mu](N)), [N])-Physics:-d_[mu](diff(V[`~1`](N), t)+V[alpha](N)*Physics:-Christoffel[`~1`, 1, `~alpha`]+diff(V[`~2`](N), r)+V[alpha](N)*Physics:-Christoffel[`~2`, 2, `~alpha`], [N])+Physics:-D_[1](h[`~1`, mu](N), [N])+Physics:-D_[2](h[`~2`, mu](N), [N])-(1/2)*Physics:-d_[mu](h[`~1`, 1](N)+h[`~2`, 2](N), [N])

(7)

At this point you perform an operation over one expression, then over another, then you expect to be able to perform the same operation over their sum. BUT: the free indices of both expressions are not the same, so the error message you see is correct, and points to the problem. Let's see:

Physics:-`*`(Christoffel[`~c`, mu, nu], V[`~nu`](N))

Physics:-Christoffel[`~c`, mu, nu]*V[`~nu`](N)

(8)

These are the repeated (not relevant here) and free indices (relevant)

Physics:-Check(Physics:-Christoffel[`~c`, mu, nu]*V[`~nu`](N), all)

`The repeated indices per term are: `[{`...`}, {`...`}, `...`]*`; the free indices are: `*{`...`}

 

[{nu}], {mu, `~c`}

(9)

#Part 1: okay, no error
SumOverRepeatedIndices((8));

Physics:-Christoffel[`~c`, 1, mu]*V[`~1`](N)+Physics:-Christoffel[`~c`, 2, mu]*V[`~2`](N)+Physics:-Christoffel[`~c`, 3, mu]*V[`~3`](N)

(10)

Now the expression you use in Part 2 a couple of lines below:

Physics:-D_[c](Physics:-d_[mu](V[`~c`](N), [N]))

Physics:-D_[c](Physics:-d_[mu](V[`~c`](N), [N]), [N])

(11)

Physics:-Check(Physics:-D_[c](Physics:-d_[mu](V[`~c`](N), [N]), [N]), all)

`The repeated indices per term are: `[{`...`}, {`...`}, `...`]*`; the free indices are: `*{`...`}

 

[{c}], {mu}

(12)

You see that the free indices detected in (9) , that is {mu, `~c`}, are not the same as the single free index detected in (12), that is "{mu}. "So while summing over thre repeated indices of (11) alone or (8) alone is fine, summing over the repeated indices of the sum is not fine because the two subexpressions have not the same free indices. Hence the following two results

 

#Part 2: okay, no error
SumOverRepeatedIndices((11));

Physics:-D_[1](Physics:-d_[mu](V[`~1`](N), [N]), [N])+Physics:-D_[2](Physics:-d_[mu](V[`~2`](N), [N]), [N])

(13)

#Both seem to be okay, but if we add them it breaks
#Part 1 +2:
SumOverRepeatedIndices((8) + (11));

Error, (in Physics:-CheckIndices) found different free indices in different operands of a sum; in operand 1: [mu, ~c], in operand 2: [mu]

 

#Why is SumOverRepeatedIndices adding things with different free indices? 'expression' clearly has the correct number of indices

As said, (8) + (11) is an incorrectly formed tensorial expression, because the free indices of each subexpression are not the same. For that reason, if you check the addition of subexpressions itself, you receive the same message, indicating what the problem is

Check(Physics:-Christoffel[`~c`, mu, nu]*V[`~nu`](N)+Physics:-D_[c](Physics:-d_[mu](V[`~c`](N), [N]), [N]))

Error, (in Physics:-Check) found different free indices in different operands of a sum; in operand 1: [mu, ~c], in operand 2: [mu]

 

 

#This didn't work in Maple 18 (newest Physics package) but works in Maple # 2015.
expression2 := D_[nu](D_[~nu](V[mu](N))) + D_[nu](D_[mu](V[~nu](N))) - D_[mu](D_[nu](V[~nu](N))) + D_[nu](h[~nu, mu](N)) - 1/2*D_[mu](h[~nu,nu](N));

Physics:-D_[nu](Physics:-D_[mu](V[`~nu`](N)), [N])-Physics:-d_[mu](Physics:-d_[nu](V[`~nu`](N), [N]), [N])-Physics:-d_[mu](Physics:-Christoffel[`~nu`, alpha, nu], [N])*V[`~alpha`](N)-Physics:-Christoffel[`~nu`, alpha, nu]*Physics:-d_[mu](V[`~alpha`](N), [N])+Physics:-D_[nu](h[`~nu`, mu](N), [N])-(1/2)*Physics:-d_[mu](h[`~nu`, nu](N), [N])

(14)

Check(expression2);

`The repeated and free indices in the given expression check ok.`

(15)

The Physics package is changing substantially at every release. I cannot explain at this point why it didn't work in Maple 18, nor I have Maple 18 at hands. But I see everything working correctly in current Maple (that is Maple 2015) and, in the material presented in this worksheet, I see no bug.

 

Regarding the length of this summation: you can always apply a simplifier. This is what you obtained:

SumOverRepeatedIndices(expression2);

`[Length of output exceeds limit of 10000]`

(16)

This is what I obtain by just simplifying by size

answer := Physics:-SumOverRepeatedIndices(expression2, simplifier = (proc (u) options operator, arrow; simplify(u, size) end proc)):

length(answer)

2666

(17)

This answer is actually small enough

answer

(1/2)*(-2*(Physics:-d_[mu](diff(V[`~1`](N), t), [N])+Physics:-d_[mu](diff(V[`~2`](N), r), [N])+Physics:-d_[mu](diff(V[`~3`](N), theta), [N]))*cos(theta)^2*r^2-(Physics:-d_[mu](h[`~1`, 1](N), [N])+Physics:-d_[mu](h[`~2`, 2](N), [N])+Physics:-d_[mu](h[`~3`, 3](N), [N]))*cos(theta)^2*r^2+2*Physics:-d_[mu](diff(V[`~3`](N), theta), [N])*cos(theta)^2*r^2+2*Physics:-d_[mu](diff(V[`~1`](N), t), [N])*cos(theta)^2*r^2+2*Physics:-d_[mu](diff(V[`~2`](N), r), [N])*cos(theta)^2*r^2+2*(diff(h[`~3`, mu](N), theta))*cos(theta)^2*r^2+2*(diff(h[`~1`, mu](N), t))*cos(theta)^2*r^2+2*(diff(h[`~2`, mu](N), r))*cos(theta)^2*r^2-2*r*(-cos(theta)^2*r*Physics:-diff(Physics:-Christoffel[`~3`, 3, mu], theta)-cos(theta)^2*r*Physics:-diff(Physics:-Christoffel[`~2`, 3, mu], r)+(3*r*Physics:-g_[mu, `~3`]+2*Physics:-Christoffel[`~2`, 3, mu])*cos(theta)^2+r*sin(theta)*(Physics:-Christoffel[`~1`, 1, mu]+Physics:-Christoffel[`~2`, 2, mu]-2*Physics:-Christoffel[`~3`, 3, mu])*cos(theta)+3*r*Physics:-g_[mu, `~3`]*sin(theta)^2)*V[`~3`](N)-2*cos(theta)*((-r^2*Physics:-diff(Physics:-Christoffel[`~3`, 2, mu], theta)*cos(theta)-r^2*Physics:-diff(Physics:-Christoffel[`~2`, 2, mu], r)*cos(theta)+((-Physics:-Christoffel[`~1`, 1, mu]+Physics:-Christoffel[`~2`, 2, mu])*r+2*Physics:-g_[mu, `~2`])*cos(theta)-2*sin(theta)*(r^2*Physics:-Christoffel[`~3`, 2, mu]+(1/2)*Physics:-Christoffel[`~2`, 3, mu]))*V[`~2`](N)+(-r^2*Physics:-diff(Physics:-Christoffel[`~3`, 1, mu], theta)*cos(theta)-r^2*Physics:-diff(Physics:-Christoffel[`~2`, 1, mu], r)*cos(theta)-r*(Physics:-Christoffel[`~1`, 2, mu]-Physics:-Christoffel[`~2`, 1, mu])*cos(theta)-2*(r^2*Physics:-Christoffel[`~3`, 1, mu]-(1/2)*Physics:-Christoffel[`~1`, 3, mu])*sin(theta))*V[`~1`](N)+r*(2*cos(theta)*h[`~2`, mu](N)+r*(-3*h[`~3`, mu](N)*sin(theta)+cos(theta)*(Physics:-Christoffel[`~1`, 1, mu]*h[`~1`, 1](N)+Physics:-Christoffel[`~1`, 2, mu]*h[`~2`, 1](N)+Physics:-Christoffel[`~1`, 3, mu]*h[`~3`, 1](N)+Physics:-Christoffel[`~2`, 1, mu]*h[`~1`, 2](N)+Physics:-Christoffel[`~2`, 2, mu]*h[`~2`, 2](N)+Physics:-Christoffel[`~2`, 3, mu]*h[`~3`, 2](N)+Physics:-Christoffel[`~3`, 1, mu]*h[`~1`, 3](N)+Physics:-Christoffel[`~3`, 2, mu]*h[`~2`, 3](N)+Physics:-Christoffel[`~3`, 3, mu]*h[`~3`, 3](N))))))/(r^2*cos(theta)^2)

(18)

Tip: you can compact this further, one line less, by using the display implemented in PDEtools:

PDEtools:-declare(answer)

V(t, r, theta)*`will now be displayed as`*V

 

h(t, r, theta)*`will now be displayed as`*h

(19)

``


Download Physics_(no_Bug)_reviewed.mw

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

I don't know what is the type of computation you are trying to perform, but if it where just from your post I'd say it is simpler using the Physics package - check for instance the help page for Physics,Christoffel; you see the answer to your question in the Examples section.

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

In Maple, the packages that implement symmetries are DEtools (restricted to symmetries of 1 ODE) and PDEtools (more general, can handle PDE systems). Both supersede the old and limited liesym, as well as DESOLV (which by the way is not official Maple).

Now, if the ODE, or for the case a PDE system, is not of higher degree in the highest derivatives, the determining equations are of course always linear in the infinitesimals and their derivatives. Otherwise the answer involves more details but, for the case of a single ODE, the determining PDE system can always be written linear in the infinitesimals and their derivatives, and radicals of the right-hand side of the ODE (this is equivalent to isolating the highest derivative in ODE in terms of radicals or RootOf). 

You can try with one example, for instance this equation of degree 2 in y'': ODE := diff(y(x), x, x)^2 = f(x, y(x), diff(y(x), x)). Try now DEtools[gensys](ODE, [xi, eta](x,y)) for the determining PDE for point symmetry infinitesimals, and you see it is linear in [xi, eta](x,y) and their derivatives, but involve fractional powers of f(x, y(x), diff(y(x),x)). If you want to avoid the presence of these fractional powers when ODE is of higher degree in the highest derivative, then you will necessarily get higher degree in the infinitesimals and their derivatives in the determining PDE system. To see this, enter for instance PDEtools:-DeterminingPDE(ODE, integrabilityconditions = false).

Both DEtools and PDEtools have a large number of detailed help pages regarding all of their symmetry commands, which also cover all the steps of the symmetry approach.

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

Hi ClearBlueSky (what a name! :)

In Maple you can attempt converting to elementary functions, to Sum, to Int, using the convert command. The details and myriad of options are explained in the help page convert,to_special_function

Now, there are two relevant things to take into account

  1. By all means, most functions do not have an elementary form representation, unless perhaps their parameters have very special values. For example, enter FunctionAdvisor(specialize, BesselJ, sin) and you will see that the elementary form (i.e. in terms of the elementary function sin) happens when the first parameter is equal to 1/2. You can also try FunctionAdvisor(specialize, GAMMA) for instance, so without specifying the target function, and you will see all the specializations and related conditions that are known to the system.
  2. When you convert using the convert command, the conversion will happen only if the conditions shown by the FunctionAdvisor are met. For example, convert(LambertW(z), Sum) does not perform any conversion, but then if you enter FunctionAdvisor(sum_form, LambertW(z)) you see there is a condition to be met: abs(z) < 1/exp(1). So try now convert(LambertW(z), Sum) assuming abs(z) < 1/exp(1) and you will see the conversion happening.

In summary: you can convert expressions to elementary or sum or int, etc forms in many cases, Maple is excellent at that, but not all functions admit that conversion, and the way to go is to interactively investigate the specializations using the FunctionAdvisor while performing the conversions using convert and perhaps also assuming.

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

Hi CytochromeC

The first one is that in the procedure ppwaveNP you define in your worksheet (at the end, in equation (8)), you wrote pdsolve(Sys, ...) while it should be pdsolve(Syst, ...). The second problem is that you are sending the tensor structures constructed with DifferentialGeometry directly to pdsolve - I believe you intend to send the coefficients of D_u, D_w, etc. instead? Note that although you see the DifferentialGeometry structures as algebraic sums, that display is obtained through display routines only, the actual structures are not sums but functions, say as in "_DG([[tensor, ...], ...])".

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

Hi

If in your worksheet I enter Gamma[~1,1,2] * Gamma[~1,2,1], I do not receive Gamma[~1,2,1]^2. Then if I enter gamma_[~a,b,c], that is, that tensor whose components are the Ricci rotation coefficients, it has all the components equal to 0 because the spacetime metric is of Minkowski (i.e. Galilean) type. So I suppose your post misses some piece of information?

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

 

Hi Age,

I thought, as said in my previous answer, that SumOverRepeatedIndices was not handling noncommutative products. Looking at this now, however, I see that  I implemented noncommutative tensors 3 years ago. So there is no issue about this (details below).

 

Besides that, there was this other issue, where you used the letter a as a parameter in the spacetime metric, but also as a tetrad index, causing a level of ambiguity in the definition of tensors where the same letter is useed with these two different meanings. This problem, however, is detectable whithin Define (when you define the tensors) - I implemented this detection last Friday.

 

In summary:

 

• 

SumOverRepeatedIndices does handle noncommutative products of tensor components, and the result it returns is actually correct (unlike what you suggested, see details below)

• 

The issue of using one letter with two different meanings, although I recommend against doing that, it is now worked around automatically within Define when you define a tensor.

 

So could you please revise the material below? Mainly, I show, step by step, that the results returned are actually correct, unlike what you suggested. Your input/output is as found in the worksheet you posted (you use no "Execution group boundaries", i.e. the document mode) while my feedback does have "Execution group boundaries" (typical of worksheet mode), is italized and in blue color. My first feedback starts after equation  (17).

 

Note the version of Physics is as of today, you need this to have in place that workaround to using one letter with two different meanings.

 


Physics:-Version()

"/Users/ecterrab/Maple/lib/Physics2015.mla", `2015, June 8, 13:28 hours`

(1)

restart; with(LinearAlgebra); with(Physics); Setup(mathematicalnotation = true, signature = `+-`, noncommutativeprefix = {g}, dimension = 2)

[dimension = 2, mathematicalnotation = true, noncommutativeprefix = {g}, signature = `+ -`]

(2)

with(Physics:-Tetrads)

[IsTetrad, NullTetrad, OrthonormalTetrad, SimplifyTetrad, TransformTetrad, e_, eta_, gamma_, l_, lambda_, m_, mb_, n_]

(3)

eta_[matrix]

eta[a, b] = (Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 2) = -1}, storage = triangular[upper], shape = [symmetric]))

(4)

g_[]

g[mu, nu] = (Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 2) = -1}, storage = triangular[upper], shape = [symmetric]))

(5)

Coords := [t, x];

{X}

(6)

 

Physics:-`*`(Physics:-`*`(Physics:-`^`(a, 2), Physics:-`^`(x, 2)), Physics:-`^`(Physics:-d_(t), 2))-Physics:-`^`(Physics:-d_(x), 2)

a^2*x^2*Physics:-d_(t)^2-Physics:-d_(x)^2

(7)

Physics:-Setup(metric = a^2*x^2*Physics:-d_(t)^2-Physics:-d_(x)^2);

Physics:-Christoffel[mu, nu, alpha] = {(1, 1, 2) = a^2*x, (1, 2, 1) = a^2*x, (2, 1, 1) = -a^2*x}

(8)

eta_[]

eta[a, b] = (Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 2) = -1}, storage = triangular[upper], shape = [symmetric]))

(9)

e_[]

`&efr;`[a, mu] = (Matrix(2, 2, {(1, 1) = x*a, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1}))

(10)

with(Physics:-Tetrads)

[IsTetrad, NullTetrad, OrthonormalTetrad, SimplifyTetrad, TransformTetrad, e_, eta_, gamma_, l_, lambda_, m_, mb_, n_]

(11)

eta_[matrix]

eta[a, b] = (Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 2) = -1}, storage = triangular[upper], shape = [symmetric]))

(12)

(13)

NULL

g_[`~mu`, `~nu`, matrix]

g[`~mu`, `~nu`] = (Matrix(2, 2, {(1, 1) = 1/(a^2*x^2), (1, 2) = 0, (2, 2) = -1}, storage = triangular[upper], shape = [symmetric]))

(14)

Physics:-`*`(Physics:-`*`(e_[`~a`, mu], e_[`~b`, nu]), eta_[a, b])

Physics:-Tetrads:-e_[`~a`, mu]*Physics:-Tetrads:-e_[`~b`, nu]*Physics:-Tetrads:-eta_[a, b]

(15)

Physics:-TensorArray(Physics:-SumOverRepeatedIndices(%))

Matrix(2, 2, {(1, 1) = a^2*x^2, (1, 2) = 0, (2, 1) = 0, (2, 2) = -1})

(16)

Set up my own tetrads

 

tet[t] := [Physics:-`*`(a, x), 0]:
``

eNew_[`~a`, mu] = LinearAlgebra:-Transpose(Matrix([tet[t], tet[chi]]));

eNew_[`~a`, mu] = (Matrix(2, 2, {(1, 1) = x*a, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1}))

(17)

NULL

Physics:-Define(%, quiet):NULL

 

The problem: in the definition above you used the letter a as a parameter, but also as a tetrad index, that is prone to problems, although now the situation is detected within Define, and so handled as one would expect when computing with paper and pencil.

 

e_[a, `~mu`, matrix]

"`&efr;`[a]^(mu)=[[[1/(x a),0],[0,-1]]]"

(18)

eNew_[a, `~mu`, matrix]

eNew_[a, `~mu`] = (Matrix(2, 2, {(1, 1) = 1/(x*a), (1, 2) = 0, (2, 1) = 0, (2, 2) = 1}))

(19)

g_[mu, nu, matrix]

g[mu, nu] = (Matrix(2, 2, {(1, 1) = a^2*x^2, (1, 2) = 0, (2, 2) = -1}, storage = triangular[upper], shape = [symmetric]))

(20)

The following computation within TensorArray was getting corrupted because this double meaning of the letter a. As said this situation is now detected when you define your tetrad and so not a problem anymore, and the result by TensorArray is now correct:

 

Physics:-TensorArray(Physics:-`*`(Physics:-`*`(e_[a, `~mu`], e_[b, `~nu`]), g_[mu, nu]) = eta_[a, b])

Matrix(2, 2, {(1, 1) = 1 = 1, (1, 2) = 0 = 0, (2, 1) = 0 = 0, (2, 2) = -1 = -1})

(21)

# Have I done something incorrect here? Should these not match?

 

NULL

Physics:-TensorArray(Physics:-`*`(Physics:-`*`(eNew_[a, `~mu`], eNew_[b, `~nu`]), g_[mu, nu]) = eta_[a, b])

Matrix(2, 2, {(1, 1) = 1 = 1, (1, 2) = 0 = 0, (2, 1) = 0 = 0, (2, 2) = -1 = -1})

(22)

Physics:-TensorArray(Physics:-`*`(Physics:-`*`(eNew_[`~a`, mu], eNew_[`~b`, nu]), eta_[a, b]) = g_[mu, nu])

Matrix(2, 2, {(1, 1) = a^2*x^2 = a^2*x^2, (1, 2) = 0 = 0, (2, 1) = 0 = 0, (2, 2) = -1 = -1})

(23)

Physics:-Define(g[`~a`], quiet):

Calculate the Spin-Connection Gamma_mu:

Physics:-Setup(Physics:-AntiCommutator(g[`~a`], g[`~b`]) = Physics:-`*`(2, eta_[`~a`, `~b`]));

[algebrarules = {%AntiCommutator(g[`~a`], g[`~b`]) = 2*Physics:-Tetrads:-eta_[`~a`, `~b`]}]

(24)

Note that the meaning of this rule is:

Matrix(2, proc (a, b) options operator, arrow; (%AntiCommutator = AntiCommutator)(g[a], g[b]) end proc)

Matrix(%id = 18446744078569396334)

(25)

That is: g[1]^2 = g[`~1`]^2 and g[`~1`]^2 = 1, and the same for g[2].

S_[`~a`, `~b`] = Physics:-`*`(Physics:-`^`(4, -1), Physics:-Commutator(g[`~a`], g[`~b`]))

S_[`~a`, `~b`] = (1/2)*Physics:-Tetrads:-eta_[`~a`, `~b`]-(1/2)*Physics:-`*`(g[`~b`], g[`~a`])

(26)

Christoffel[`~gamma`, mu, nu, nonzero]

Physics:-Christoffel[`~gamma`, mu, nu] = {(1, 1, 2) = 1/x, (1, 2, 1) = 1/x, (2, 1, 1) = a^2*x}

(27)

Define spin connection:

 

omega_[a, b, mu] = Physics:-`*`(e_[a, `~nu`], Physics:-d_[mu](e_[b, nu])-Physics:-`*`(Christoffel[`~gamma`, mu, nu], e_[b, gamma]))

omega_[a, b, mu] = Physics:-Tetrads:-e_[a, `~nu`]*(Physics:-d_[mu](Physics:-Tetrads:-e_[b, nu], [X])-Physics:-Christoffel[`~gamma`, mu, nu]*Physics:-Tetrads:-e_[b, gamma])

(28)

 

Physics:-Define(omega_[a, b, mu] = Physics:-Tetrads:-e_[a, `~nu`]*(Physics:-d_[mu](Physics:-Tetrads:-e_[b, nu], [X])-Physics:-Christoffel[`~gamma`, mu, nu]*Physics:-Tetrads:-e_[b, gamma]))

{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], eNew_[`~a`, mu], Physics:-Tetrads:-e_[a, mu], Physics:-Tetrads:-eta_[a, b], g[`~a`], Physics:-g_[mu, nu], Physics:-Tetrads:-gamma_[a, b, c], Physics:-Tetrads:-l_[mu], Physics:-Tetrads:-lambda_[a, b, c], Physics:-Tetrads:-m_[mu], Physics:-Tetrads:-mb_[mu], Physics:-Tetrads:-n_[mu], omega_[a, b, mu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[mu, nu], Physics:-SpaceTimeVector[mu](X)}

(29)

omega_[nonzero]

omega_[a, b, mu] = {(1, 2, 1) = -a, (2, 1, 1) = a}

(30)

(31)

Gamma_[mu] = Physics:-`*`(Physics:-`^`(4, -1), Physics:-`*`(Physics:-`*`(omega_[a, b, mu], g[`~a`]), g[`~b`]))

Gamma_[mu] = (1/4)*omega_[a, b, mu]*Physics:-`*`(g[`~a`], g[`~b`])

(32)

``

Physics:-Define(%, quiet):

Physics:-SumOverRepeatedIndices(Gamma_[mu, matrix])

Gamma_[mu] = (Matrix(1, 2, {(1, 1) = (1/2)*a*g[`~2`]*g[`~1`], (1, 2) = 0}))

(33)

"This last sum, should keep the gamma 1 on the LHS of the sum. Instead, Gamma_mu is calculated and Gamma 1 is on the right (leaving a difference in overall sign):"

 

Your sentence could be read ambigously: This result  (33) by SumOverRepeatedIndicdes is not wrong nor it is the case that the command is wrong swapping noncommutative tensor components.

 

In steps:

rhs(Gamma_[mu] = (1/4)*omega_[a, b, mu]*Physics:-`*`(g[`~a`], g[`~b`]))

(1/4)*omega_[a, b, mu]*Physics:-`*`(g[`~a`], g[`~b`])

(34)

Physics:-SumOverRepeatedIndices((1/4)*omega_[a, b, mu]*Physics:-`*`(g[`~a`], g[`~b`]))

(1/4)*omega_[1, 1, mu]*Physics:-`^`(g[`~1`], 2)+(1/4)*omega_[2, 1, mu]*Physics:-`*`(g[`~2`], g[`~1`])+(1/4)*omega_[1, 2, mu]*Physics:-`*`(g[`~1`], g[`~2`])+(1/4)*omega_[2, 2, mu]*Physics:-`^`(g[`~2`], 2)

(35)

You see SumOverRepeatedIndices is not swapping the noncommutative g[a].

 

Next,

omega_[a, b, 1, matrix]

omega_[a, b, 1] = Matrix(%id = 18446744078678529438)

(36)

From the above, you see that (35) at mu = 1 is indeed equal to

eval((1/4)*omega_[1, 1, mu]*Physics:-`^`(g[`~1`], 2)+(1/4)*omega_[2, 1, mu]*Physics:-`*`(g[`~2`], g[`~1`])+(1/4)*omega_[1, 2, mu]*Physics:-`*`(g[`~1`], g[`~2`])+(1/4)*omega_[2, 2, mu]*Physics:-`^`(g[`~2`], 2), mu = 1)

(1/4)*a*Physics:-`*`(g[`~2`], g[`~1`])-(1/4)*a*Physics:-`*`(g[`~1`], g[`~2`])

(37)

In turn, this can be simplified using Physics:-AntiCommutator(g[`~1`], g[`~2`]) = 0 (see (25)); so applyking this Anticommutor to the second term of (37) we have

Physics:-Simplify((1/4)*a*Physics:-`*`(g[`~2`], g[`~1`])-(1/4)*a*Physics:-`*`(g[`~1`], g[`~2`]))

(1/2)*a*Physics:-`*`(g[`~2`], g[`~1`])

(38)

Therefore, this following result is not wrong but actually correct:

Gamma_[]

Gamma_[mu] = Array(%id = 18446744078679920998)

(39)

Now, if you prefer to see g[`~1`] on the lhs of g[`~2`], you can always sort the operands in products accordingly, the way you prefer, for example (see the help section for SortProducts within the help page for  Physics:-Library ):

"Physics:-Library:-SortProducts(?,[g[~1],g[~2]],useanticommutator)"

Gamma_[mu] = Array(%id = 18446744078680654542)

(40)

Physics:-SumOverRepeatedIndices(Physics:-`*`(g[`~a`], Physics:-`*`(e_[a, `~mu`], Gamma_[mu])))

-(1/4)*(Physics:-`*`(g[`~1`], g[`~2`])-Physics:-`*`(g[`~2`], g[`~1`]))*g[`~1`]/x

(41)

simplify(-(1/4)*(Physics:-`*`(g[`~1`], g[`~2`])-Physics:-`*`(g[`~2`], g[`~1`]))*g[`~1`]/x)

(1/2)*g[`~2`]/x

(42)

I would expect g[1] g[2] g[1] / 2x = - g[2]/2x

 

I think however that (41) is actually correct. In steps:

expand(-(1/4)*(Physics:-`*`(g[`~1`], g[`~2`])-Physics:-`*`(g[`~2`], g[`~1`]))*g[`~1`]/x)

-(1/4)*Physics:-`*`(g[`~1`], g[`~2`], g[`~1`])/x+(1/4)*Physics:-`*`(g[`~2`], Physics:-`^`(g[`~1`], 2))/x

(43)

The expansion is OK by eye. Simplify now each operand separatedly

E := [op(-(1/4)*Physics:-`*`(g[`~1`], g[`~2`], g[`~1`])/x+(1/4)*Physics:-`*`(g[`~2`], Physics:-`^`(g[`~1`], 2))/x)]

[-(1/4)*Physics:-`*`(g[`~1`], g[`~2`], g[`~1`])/x, (1/4)*Physics:-`*`(g[`~2`], Physics:-`^`(g[`~1`], 2))/x]

(44)

The second one:

Physics:-Simplify(E[2])

(1/4)*g[`~2`]/x

(45)

This result is correct, because g[`~1`]^2 = 1.

Now the first one

Physics:-Simplify(E[1])

(1/4)*g[`~2`]/x

(46)

This result is also correct.

In steps, from (25),

(%AntiCommutator = Physics:-AntiCommutator)(g[`~1`], g[`~2`])

%AntiCommutator(g[`~1`], g[`~2`]) = 0

(47)

expand(%AntiCommutator(g[`~1`], g[`~2`]) = 0)

Physics:-`*`(g[`~1`], g[`~2`])+Physics:-`*`(g[`~2`], g[`~1`]) = 0

(48)

isolate(Physics:-`*`(g[`~1`], g[`~2`])+Physics:-`*`(g[`~2`], g[`~1`]) = 0, Physics:-`*`(g[`~1`], g[`~2`]))

Physics:-`*`(g[`~1`], g[`~2`]) = -Physics:-`*`(g[`~2`], g[`~1`])

(49)

Substitute now (49) in the second operand of (44) and you see you get (45). Alternatively, sort the operands of E altogether

Library:-SortProducts(E, [g[`~2`], g[`~1`]], useanticommutator)

[(1/4)*Physics:-`*`(g[`~2`], Physics:-`^`(g[`~1`], 2))/x, (1/4)*Physics:-`*`(g[`~2`], Physics:-`^`(g[`~1`], 2))/x]

(50)

And taking into account that g[`~1`]^2 = 1 you again arrive at (45)

 

In summary: in my view, unlike what you suggested (am I missing something?), everything actually works correctly and as expected, and SumOverRepeatedIndices handles noncommutative operands, unlike what you suggested might be the case in your post.

``

``

``

 

Download Correcting_-_Tetrads_(reviewed).mw

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

Hi Age

Yes, the Physics package is still being developed with the same intensity as before. I gave a look at your worksheet and have five comments:

  1. You use the letter 'a' as a symbolic constant within the metric but then also as a tetrad index, i.e two different meanings for the same symbol. That is prone to problems. What to do: in your metric, replace 'a' by alpha or whatever other symbol that is not a tetrad index, and your computation TensorArray(e_[a, `~mu`]*e_[b, `~nu`]*g_[mu, nu] = eta_[a, b]) will return as expected; i.e. e_[a,mu] is a correct tetrad.
  2. I need to tweak the code to catch these situations automatically, think carefully on ways to workaround the presence of symbolic constants in the metric that happen to coincide with tetrad or spacetime indices. This situation will always be prone to problems but the current status of things can nevertheless be improved to some point.
  3. I cannot fix Physics of Maple 18 furthermore, but I can fix the Physics library of Maple 2015 and, as usual, put the fix available for download in the Maplesoft R&D Physics webpage, i.e. using the current Maple you have access to the whole development (and fixes) of the Physics, DEs and MathematicalFunctions packages till the next release included. So, without wanting to appear like a "seller", if possible for you I'd suggest you to update your Maple.
  4. Indeed SumOverRepeatedIndices is not expecting noncommutative components. This is easy to adjust, I will include a related fix early this upcoming week.
  5. There is already a large number of improvements in the Tetrad package, post Maple 2015.1, really nice stuff ... that among other things allow for performing the same computations you are performing in the worksheet you posted but rather easier. As soon as I fix "4." I will post here again, this time with a worksheet showing that.

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

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

Hi Michael

The calculation looks correct to me. Here are some details, only about the relevant thing of your post, and for the whole thing please find the reviewed worksheet attached. 

By the way, when you found an issue like this one it is faster if you could please send me an email to physics@maplesoft.com. The Mapleprimes website has not automatic notifications per topic and I only see your posts if I open a browser and start scanning (as it happened now).

So, here is the relevant part and for the worksheet see the link at then end:

Question_about_Ricci_Rotation_Coefficients-2_(reviewed).mw

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

 

Hi Trace,

What you ask is explained in the documentation. Here is step by step, starting with the worksheet you posted and adding comments.

 

with(Physics):

 

Important: use mathematical notation, it improves the experience a lot

Physics:-Setup(math = true)

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

 

[mathematicalnotation = true]

(1)

Check the metric

g_[]

g[mu, nu] = (Matrix(4, 4, {(1, 1) = -A(r), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = B(r), (2, 3) = 0, (2, 4) = 0, (3, 3) = C(r)*r^2, (3, 4) = 0, (4, 4) = C(r)*r^2*sin(theta)^2}, storage = triangular[upper], shape = [symmetric]))

(2)

Next you Define(A). But, from your context (the metric you set), A is a scalar mapping (function), so it would then be incorrect to also define it as a tensor. I am disabling your input line:

 

The nonzero components of Christoffel:

Christoffel[nonzero]NULL

Physics:-Christoffel[mu, nu, alpha] = {(1, 1, 2) = -(1/2)*(diff(A(r), r)), (1, 2, 1) = -(1/2)*(diff(A(r), r)), (2, 1, 1) = (1/2)*(diff(A(r), r)), (2, 2, 2) = (1/2)*(diff(B(r), r)), (2, 3, 3) = -(1/2)*r*((diff(C(r), r))*r+2*C(r)), (2, 4, 4) = -(1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (3, 2, 3) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 3, 2) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 4, 4) = -C(r)*r^2*sin(theta)*cos(theta), (4, 2, 4) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 3, 4) = C(r)*r^2*sin(theta)*cos(theta), (4, 4, 2) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 4, 3) = C(r)*r^2*sin(theta)*cos(theta)}

(3)

In general, you can benefit of more compact notation using the declare  facility of the PDEtools  package

PDEtools:-declare(Physics:-Christoffel[mu, nu, alpha] = {(1, 1, 2) = -(1/2)*(diff(A(r), r)), (1, 2, 1) = -(1/2)*(diff(A(r), r)), (2, 1, 1) = (1/2)*(diff(A(r), r)), (2, 2, 2) = (1/2)*(diff(B(r), r)), (2, 3, 3) = -(1/2)*r*((diff(C(r), r))*r+2*C(r)), (2, 4, 4) = -(1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (3, 2, 3) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 3, 2) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 4, 4) = -C(r)*r^2*sin(theta)*cos(theta), (4, 2, 4) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 3, 4) = C(r)*r^2*sin(theta)*cos(theta), (4, 4, 2) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 4, 3) = C(r)*r^2*sin(theta)*cos(theta)})

A(r)*`will now be displayed as`*A

 

B(r)*`will now be displayed as`*B

 

C(r)*`will now be displayed as`*C

(4)

Compare how (3) is now displayed:

Physics:-Christoffel[mu, nu, alpha] = {(1, 1, 2) = -(1/2)*(diff(A(r), r)), (1, 2, 1) = -(1/2)*(diff(A(r), r)), (2, 1, 1) = (1/2)*(diff(A(r), r)), (2, 2, 2) = (1/2)*(diff(B(r), r)), (2, 3, 3) = -(1/2)*r*((diff(C(r), r))*r+2*C(r)), (2, 4, 4) = -(1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (3, 2, 3) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 3, 2) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 4, 4) = -C(r)*r^2*sin(theta)*cos(theta), (4, 2, 4) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 3, 4) = C(r)*r^2*sin(theta)*cos(theta), (4, 4, 2) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 4, 3) = C(r)*r^2*sin(theta)*cos(theta)}

Physics:-Christoffel[mu, alpha, nu] = {(1, 1, 2) = -(1/2)*(diff(A(r), r)), (1, 2, 1) = -(1/2)*(diff(A(r), r)), (2, 1, 1) = (1/2)*(diff(A(r), r)), (2, 2, 2) = (1/2)*(diff(B(r), r)), (2, 3, 3) = -(1/2)*r*((diff(C(r), r))*r+2*C(r)), (2, 4, 4) = -(1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (3, 2, 3) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 3, 2) = (1/2)*r*((diff(C(r), r))*r+2*C(r)), (3, 4, 4) = -C(r)*r^2*sin(theta)*cos(theta), (4, 2, 4) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 3, 4) = C(r)*r^2*sin(theta)*cos(theta), (4, 4, 2) = (1/2)*r*sin(theta)^2*((diff(C(r), r))*r+2*C(r)), (4, 4, 3) = C(r)*r^2*sin(theta)*cos(theta)}

(5)
  

Note that is just the display that changed, not the actual expressions being displayed, that remained of course entirely unchanged.

  

 

  

Now you ask:

  

In general i want to define N[1]=-A(r)^(1/(2))and N[2]=N[3]=N[4]=0 and define F[mu,nu]=2*(D_[mu] N[nu]-D_[nu]N[mu]) and define  Omega[mu,nu]=2*(D_[mu] N[nu]+D_[nu]N[mu]) and compute expression F_[alpha,beta]F_[~alpha,~beta] andN_[alpha] N_[~beta] F_[~alpha,~lambda] Omega_[beta,lambda]

 

The answers to your questions are found in the help pages for Define  and the covariant derivative D_  . I suggest you to give them a look, and here is how you do that in this particular example you posted.

 

1) You want to define a 4-vector with specified components: according to the help page indicated, you use an equation (so `=`, not `:=`), and you can directly use a list on the right-hand side, as in

N[mu] = [Physics:-`^`(A(r), Physics:-`^`(2, -1)), 0, 0, 0]

N[mu] = [A(r)^(1/2), 0, 0, 0]

(6)

Now call Define

Physics:-Define(N[mu] = [A(r)^(1/2), 0, 0, 0])

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], N[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], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(7)

Check it out:

N[1]

A(r)^(1/2)

(8)

Now the contravariant component

N[`~1`]

-1/A(r)^(1/2)

(9)

All the contravariant components

N[`~`]

N[`~mu`] = Array(%id = 18446744078420166886)

(10)

Next you want (again: use an equation, `=`, not `:=`, and also you apply instead of multiply the covariant derivative D_),

F[mu, nu] = Physics:-`*`(2, Physics:-D_[mu](N[nu])-Physics:-D_[nu](N[mu]))

F[mu, nu] = 2*Physics:-D_[mu](N[nu], [X])-2*Physics:-D_[nu](N[mu], [X])

(11)

Once you are sure this is what you want, call Define

Physics:-Define(F[mu, nu] = 2*Physics:-D_[mu](N[nu], [X])-2*Physics:-D_[nu](N[mu], [X]))

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], F[mu, nu], N[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], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(12)

Check it out

F[definition]

F[mu, nu] = 2*Physics:-D_[mu](N[nu], [X])-2*Physics:-D_[nu](N[mu], [X])

(13)

F[1, 2]

-(diff(A(r), r))/A(r)^(1/2)

(14)

All the contravariant components at once

F[`~`]

F[`~mu`, `~nu`] = Matrix(%id = 18446744078403631694)

(15)

The covariant components

F[]

F[mu, nu] = Matrix(%id = 18446744078420167966)

(16)

Next you want to define Omega; proceed in the same way

Omega[mu, nu] = Physics:-`*`(2, Physics:-D_[mu](N[nu])+Physics:-D_[nu](N[mu]))

Omega[mu, nu] = 2*Physics:-D_[mu](N[nu], [X])+2*Physics:-D_[nu](N[mu], [X])

(17)

Physics:-Define(Omega[mu, nu] = 2*Physics:-D_[mu](N[nu], [X])+2*Physics:-D_[nu](N[mu], [X]))

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], F[mu, nu], N[mu], Omega[mu, nu], 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], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(18)

Check

Omega[definition]

Omega[mu, nu] = 2*Physics:-D_[mu](N[nu], [X])+2*Physics:-D_[nu](N[mu], [X])

(19)

Omega[]

Omega[mu, nu] = Matrix(%id = 18446744078458956246)

(20)

Omega[`~`]

Omega[`~mu`, `~nu`] = Matrix(%id = 18446744078458943958)

(21)

Now you want the contraction of indices of F (i.e.: sum over the repeated indices), as well as the contraction of all the indices of a tensorial expression. First the contraction of F: just input it

Physics:-`^`(F[mu, nu], 2)

F[mu, nu]*F[`~mu`, `~nu`]

(22)

Physics:-SumOverRepeatedIndices(F[mu, nu]*F[`~mu`, `~nu`])

2*(diff(A(r), r))^2/(A(r)^2*B(r))

(23)

Next the tensorial expression. Note that you can specify which inidices are contravariant, but that is brainpower wasted, you do not need to do that, the computer does it for you:

Physics:-`*`(Physics:-`*`(Physics:-`*`(N[alpha], N[beta]), F[alpha, lambda]), Omega[beta, lambda])

Omega[beta, lambda]*F[alpha, `~lambda`]*N[`~alpha`]*N[`~beta`]

(24)

(Note as well that you defined N, F and Omega, not N_, F_ or Omega_ as you wrote in your worksheet.)

 

Check the indices, just to be sure that what indices are repeated and whether there are no free indices (you can check by eye in this case, but not so easily for bigger algebraic expressions):

Physics:-Check(Omega[beta, lambda]*F[alpha, `~lambda`]*N[`~alpha`]*N[`~beta`], all)

`The repeated indices per term are: `[{`...`}, {`...`}, `...`]*`; the free indices are: `*{`...`}

 

[{alpha, beta, lambda}], {}

(25)

OK, sum now over the repeated indices

Physics:-SumOverRepeatedIndices(Omega[beta, lambda]*F[alpha, `~lambda`]*N[`~alpha`]*N[`~beta`])

(diff(A(r), r))^2/(A(r)^2*B(r))

(26)

And that is all, hope it helps, these things are explained in the documentation. Sometimes people distinguish "using computer algebra" from "giving a look at the documentation". After years of working with this I feel different: when using computer algebra, consulting the documentation is a fundamental part of the activity, I consult it all the time. After a little while you learn how to get the information you want without reading the whole page (basically, give a look at the Examples sections).

``

 

NOTE: in order to get exactly the results shown above, remember to updated your Physics library with its latest version, available for download from the Maplesoft R&D Physics webpage.

Download Covariant_(reviewed).mw

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

Hi Trace,  

This is the metric from your worksheet (after correcting sin^2*theta with sin(theta)^2, noticed by Markiyan)

with(Physics):

Check the form of this metric

g_[]

g[mu, nu] = (Matrix(4, 4, {(1, 1) = -A(r), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 2) = B(r), (2, 3) = 0, (2, 4) = 0, (3, 3) = C(r)*r^2, (3, 4) = 0, (4, 4) = C(r)*r^2*sin(theta)^2}, storage = triangular[upper], shape = [symmetric]))

(1)

Work with a compact display, just for convenience

PDEtools:-declare(Physics:-g_[mu, nu] = Matrix(%id = 18446744078408204526), Phi(X), G(X))

A(r)*`will now be displayed as`*A

 

B(r)*`will now be displayed as`*B

 

C(r)*`will now be displayed as`*C

 

Phi(t, r, theta, phi)*`will now be displayed as`*Phi

 

G(t, r, theta, phi)*`will now be displayed as`*G

(2)

As mentioned by tomleslie, check the documentation, this is the dAlembertian

Physics:-dAlembertian(Phi(X))

Physics:-dAlembertian(Phi(X), [X])

(3)

Recalling that, when using PDEtools:-declare, derivatives are displayed as indexed (although they are still the usual diff  functions)

convert(Physics:-dAlembertian(Phi(X), [X]), diff)

-(diff(diff(Phi(X), t), t))/A(r)+(diff(diff(Phi(X), r), r))/B(r)+(diff(diff(Phi(X), theta), theta))/(C(r)*r^2)+(diff(diff(Phi(X), phi), phi))/(C(r)*r^2*sin(theta)^2)

(4)

If what you have in mind is not `&square;` = `&PartialD;`[`~mu`]*`&PartialD;`[mu] but actually  `&Dscr;`[`~mu`]`&Dscr;`[mu], that is, the composition of covariant derivatives, you can construct this operator as well

Lambda := proc (F) options operator, arrow; Physics:-D_[mu](Physics:-D_[`~mu`](F)) end proc

proc (F) options operator, arrow; Physics:-D_[mu](Physics:-D_[`~mu`](F)) end proc

(5)

When applied to a scalar, for which `&Dscr;`[`~mu`](Phi)" = `&PartialD;`[]^(mu)(Phi)", you have

Lambda(Phi(X))

Physics:-D_[mu](Physics:-d_[`~mu`](Phi(X), [X]), [X])

(6)

Physics:-SumOverRepeatedIndices(Physics:-D_[mu](Physics:-d_[`~mu`](Phi(X), [X]), [X]))

-(diff(B(r), r))*(diff(Phi(X), r))/B(r)^2+Physics:-dAlembertian(Phi(X), [X])+((1/2)*(diff(A(r), r))/A(r)+(1/2)*(diff(B(r), r))/B(r)+((diff(C(r), r))*r+2*C(r))/(r*C(r)))*(diff(Phi(X), r))/B(r)+cos(theta)*(diff(Phi(X), theta))/(sin(theta)*C(r)*r^2)

(7)

When applied to a tensor, say of 1 index:

Physics:-Define(G)

`Defined objects with tensor properties`

 

{G, 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], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(8)

Lambda(G[nu](X))

Physics:-D_[mu](Physics:-D_[`~mu`](G[nu](X), [X]), [X])

(9)

To manipulate the whole expression (9) as a tensor you can create another tensor with it, as follows

T[nu] = Physics:-D_[mu](Physics:-D_[`~mu`](G[nu](X), [X]), [X])

T[nu] = Physics:-D_[mu](Physics:-D_[`~mu`](G[nu](X), [X]), [X])

(10)

Physics:-Define(T[nu] = Physics:-D_[mu](Physics:-D_[`~mu`](G[nu](X), [X]), [X]))

`Defined objects with tensor properties`

 

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

(11)

Check the definition

T[definition]

T[nu] = Physics:-D_[mu](Physics:-D_[`~mu`](G[nu](X), [X]), [X])

(12)

Use automatic simplification to receive shorter expressions automatically

Physics:-Setup(auto = true)

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

 

[automaticsimplification = true]

(13)

T[1]

(1/4)*(4*sin(theta)^2*B(r)^2*A(r)^2*(diff(diff(G[1](X), theta), theta))+4*B(r)^2*A(r)^2*(diff(diff(G[1](X), phi), phi))+sin(theta)*(4*r^2*A(r)^2*B(r)*C(r)*sin(theta)*(diff(diff(G[1](X), r), r))-4*r^2*A(r)*B(r)^2*C(r)*sin(theta)*(diff(diff(G[1](X), t), t))-2*A(r)*r*((diff(A(r), r))*B(r)*r*C(r)+A(r)*(r*(diff(B(r), r))*C(r)-2*B(r)*((diff(C(r), r))*r+2*C(r))))*sin(theta)*(diff(G[1](X), r))+4*A(r)^2*B(r)^2*cos(theta)*(diff(G[1](X), theta))+r*(4*r*(diff(A(r), r))*A(r)*B(r)*C(r)*(diff(G[2](X), t))+(-2*r*A(r)*B(r)*C(r)*(diff(diff(A(r), r), r))+(diff(A(r), r))*((diff(A(r), r))*B(r)*r*C(r)+A(r)*(r*(diff(B(r), r))*C(r)-2*B(r)*((diff(C(r), r))*r+2*C(r)))))*G[1](X))*sin(theta)))/(B(r)^2*C(r)*r^2*sin(theta)^2*A(r)^2)

(14)

Or you can work with the expression iteself; this gives you all the tensor components of (9) as a list in one go (see also TensorArray )

Library:-TensorComponents(Physics:-D_[mu](Physics:-D_[`~mu`](G[nu](X), [X]), [X]))

[(1/4)*(4*sin(theta)^2*B(r)^2*A(r)^2*(diff(diff(G[1](X), theta), theta))+4*B(r)^2*A(r)^2*(diff(diff(G[1](X), phi), phi))+sin(theta)*(4*r^2*A(r)^2*B(r)*C(r)*sin(theta)*(diff(diff(G[1](X), r), r))-4*r^2*A(r)*B(r)^2*C(r)*sin(theta)*(diff(diff(G[1](X), t), t))-2*A(r)*r*((diff(A(r), r))*B(r)*r*C(r)+A(r)*(r*(diff(B(r), r))*C(r)-2*B(r)*((diff(C(r), r))*r+2*C(r))))*sin(theta)*(diff(G[1](X), r))+4*A(r)^2*B(r)^2*cos(theta)*(diff(G[1](X), theta))+r*(4*r*(diff(A(r), r))*A(r)*B(r)*C(r)*(diff(G[2](X), t))+(-2*r*A(r)*B(r)*C(r)*(diff(diff(A(r), r), r))+(diff(A(r), r))*((diff(A(r), r))*B(r)*r*C(r)+A(r)*(r*(diff(B(r), r))*C(r)-2*B(r)*((diff(C(r), r))*r+2*C(r)))))*G[1](X))*sin(theta)))/(B(r)^2*C(r)*r^2*sin(theta)^2*A(r)^2), (1/4)*(4*C(r)*sin(theta)^2*B(r)^3*A(r)^2*(diff(diff(G[2](X), theta), theta))*r+4*C(r)*B(r)^3*A(r)^2*(diff(diff(G[2](X), phi), phi))*r+4*C(r)^2*sin(theta)^2*B(r)^2*A(r)^2*(diff(diff(G[2](X), r), r))*r^3-4*C(r)^2*sin(theta)^2*B(r)^3*A(r)*(diff(diff(G[2](X), t), t))*r^3+2*A(r)*(2*r*A(r)*B(r)*(diff(C(r), r))+C(r)*(-3*r*A(r)*(diff(B(r), r))+B(r)*(r*(diff(A(r), r))+4*A(r))))*r^2*sin(theta)^2*B(r)*C(r)*(diff(G[2](X), r))-4*A(r)^2*B(r)^3*sin(theta)^2*((diff(C(r), r))*r+2*C(r))*(diff(G[3](X), theta))-4*A(r)^2*B(r)^3*((diff(C(r), r))*r+2*C(r))*(diff(G[4](X), phi))-(-4*r*A(r)^2*B(r)^3*C(r)*cos(theta)*(diff(G[2](X), theta))-4*r^3*(diff(A(r), r))*B(r)^3*C(r)^2*sin(theta)*(diff(G[1](X), t))+2*r^3*G[2](X)*A(r)^2*B(r)*C(r)^2*sin(theta)*(diff(diff(B(r), r), r))+(2*r^2*(diff(C(r), r))^2*A(r)^2*B(r)^2+2*r*A(r)^2*B(r)*C(r)*(r*(diff(B(r), r))+4*B(r))*(diff(C(r), r))+(-4*r^2*(diff(B(r), r))^2*A(r)^2+r*A(r)*B(r)*(r*(diff(A(r), r))+4*A(r))*(diff(B(r), r))+B(r)^2*(r^2*(diff(A(r), r))^2+8*A(r)^2))*C(r)^2)*r*sin(theta)*G[2](X)+4*G[3](X)*A(r)^2*B(r)^3*cos(theta)*((diff(C(r), r))*r+2*C(r)))*sin(theta))/(B(r)^3*A(r)^2*C(r)^2*r^3*sin(theta)^2), (1/4)*(4*sin(theta)^3*B(r)^2*A(r)*(diff(diff(G[3](X), theta), theta))+4*sin(theta)*B(r)^2*A(r)*(diff(diff(G[3](X), phi), phi))+4*C(r)*sin(theta)^3*B(r)*A(r)*(diff(diff(G[3](X), r), r))*r^2-4*(diff(diff(G[3](X), t), t))*B(r)^2*r^2*C(r)*sin(theta)^3+4*r*A(r)*B(r)*sin(theta)^3*((diff(C(r), r))*r+2*C(r))*(diff(G[2](X), theta))+2*r^2*C(r)*sin(theta)^3*((diff(A(r), r))*B(r)-(diff(B(r), r))*A(r))*(diff(G[3](X), r))+4*sin(theta)^2*B(r)^2*A(r)*(diff(G[3](X), theta))*cos(theta)-8*B(r)^2*A(r)*(diff(G[4](X), phi))*cos(theta)-sin(theta)*G[3](X)*(2*r^2*A(r)*B(r)*sin(theta)^2*(diff(diff(C(r), r), r))+r*(r*(diff(A(r), r))*B(r)-A(r)*(r*(diff(B(r), r))-8*B(r)))*sin(theta)^2*(diff(C(r), r))+2*r*(diff(A(r), r))*B(r)*C(r)*sin(theta)^2-2*A(r)*(r*(diff(B(r), r))*C(r)*sin(theta)^2-2*B(r)^2*cos(theta)^2-2*C(r)*B(r)*sin(theta)^2)))/(C(r)*B(r)^2*r^2*A(r)*sin(theta)^3), (1/4)*(4*sin(theta)^2*B(r)^2*A(r)*(diff(diff(G[4](X), theta), theta))+4*B(r)^2*A(r)*(diff(diff(G[4](X), phi), phi))-sin(theta)*(-4*r^2*A(r)*B(r)*C(r)*sin(theta)*(diff(diff(G[4](X), r), r))+4*r^2*B(r)^2*C(r)*sin(theta)*(diff(diff(G[4](X), t), t))-4*r*A(r)*B(r)*sin(theta)*((diff(C(r), r))*r+2*C(r))*(diff(G[2](X), phi))-2*r^2*C(r)*sin(theta)*((diff(A(r), r))*B(r)-(diff(B(r), r))*A(r))*(diff(G[4](X), r))+4*A(r)*B(r)^2*cos(theta)*(diff(G[4](X), theta))-8*B(r)^2*A(r)*(diff(G[3](X), phi))*cos(theta)+G[4](X)*(2*r^2*A(r)*B(r)*(diff(diff(C(r), r), r))+r*(r*(diff(A(r), r))*B(r)-A(r)*(r*(diff(B(r), r))-8*B(r)))*(diff(C(r), r))+2*(diff(A(r), r))*B(r)*r*C(r)-2*A(r)*(r*(diff(B(r), r))*C(r)+2*B(r)*(B(r)-C(r))))*sin(theta)))/(C(r)*B(r)^2*r^2*A(r)*sin(theta)^2)]

(15)

``


Download dAlembertian_(reviewed).mw

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

Hi Inacio,

Below is your worksheet with the answer to your two questions italized.

NULL

restart

with(Physics):

Physics:-Setup(math = true, coord = X, quiet):

Physics:-Parameters(k, alpha, beta, epsilon, m):

Physics:-Define(h, symmetric); -1; Physics:-Define(A); -1; Physics:-Define(F, antisymmetric)

`Defined objects with tensor properties`

 

`Defined objects with tensor properties`

 

`Defined objects with tensor properties`

 

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

(1)

hh := Physics:-`*`(g_[alpha, beta], h[alpha, beta])

h[alpha, beta]*Physics:-g_[`~alpha`, `~beta`]

(2)

P := Physics:-`*`(Physics:-`*`(k, Physics:-`^`(2, -1)), hh)

(1/2)*k*h[alpha, beta]*Physics:-g_[`~alpha`, `~beta`]

(3)

Q__1 := g_[mu, kappa]-Physics:-`*`(k, h[mu, kappa]);

-k*h[mu, kappa]+Physics:-g_[kappa, mu]

 

-k*h[nu, lambda]+Physics:-g_[lambda, nu]

 

-k*h[mu, nu]+Physics:-g_[mu, nu]

 

-k*h[kappa, lambda]+Physics:-g_[kappa, lambda]

(4)

L1 := -Physics:-`*`(Physics:-`*`(Physics:-`*`(Physics:-`*`(Physics:-`*`(Physics:-`^`(4, -1), 1+P), F[mu, nu]), F[kappa, lambda]), Q__1), Q__2)

-(1/4+(1/8)*k*h[alpha, beta]*Physics:-g_[`~alpha`, `~beta`])*(-k*h[nu, lambda]+Physics:-g_[lambda, nu])*(-k*h[mu, kappa]+Physics:-g_[kappa, mu])*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]

(5)

L1 := -Physics:-`*`(Physics:-`^`(4, -1), Physics:-`*`(Physics:-`*`(Physics:-`*`(Physics:-`*`(1+P, F[mu, nu]), F[kappa, lambda]), Q__1), Q__2));

-(1/4)*(1+(1/2)*k*h[alpha, beta]*Physics:-g_[`~alpha`, `~beta`])*(-k*h[nu, lambda]+Physics:-g_[lambda, nu])*(-k*h[mu, kappa]+Physics:-g_[kappa, mu])*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]

(6)

Physics:-Expand(%)

-(1/8)*(k*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]+2)*(k*h[nu, lambda]-Physics:-g_[lambda, nu])*(k*h[mu, kappa]-Physics:-g_[kappa, mu])*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]

(7)

expand(%)

-(1/8)*k^3*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]*h[mu, kappa]*h[nu, lambda]+(1/8)*k^2*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]*h[nu, lambda]+(1/8)*k^2*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[lambda, nu]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]*h[mu, kappa]-(1/8)*k*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*Physics:-g_[lambda, nu]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]-(1/4)*k^2*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*h[mu, kappa]*h[nu, lambda]+(1/4)*k*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*h[nu, lambda]+(1/4)*k*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[lambda, nu]*h[mu, kappa]-(1/4)*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*Physics:-g_[lambda, nu]

(8)

Physics:-Simplify(%)

-(1/8)*(k*h[beta, `~beta`]+2)*(k^2*F[kappa, `~chi`]*F[mu, `~lambda`]*h[chi, lambda]*h[`~kappa`, `~mu`]+2*k*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[chi, lambda]+F[alpha, nu]*F[`~alpha`, `~nu`])

(9)

expand(-(1/8)*(k*h[beta, `~beta`]+2)*(k^2*F[kappa, `~chi`]*F[mu, `~lambda`]*h[chi, lambda]*h[`~kappa`, `~mu`]+2*k*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[chi, lambda]+F[alpha, nu]*F[`~alpha`, `~nu`]))

-(1/8)*k^3*F[kappa, `~chi`]*F[mu, `~lambda`]*h[beta, `~beta`]*h[chi, lambda]*h[`~kappa`, `~mu`]-(1/4)*k^2*F[kappa, `~chi`]*F[mu, `~lambda`]*h[chi, lambda]*h[`~kappa`, `~mu`]-(1/4)*k^2*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[beta, `~beta`]*h[chi, lambda]-(1/8)*k*F[alpha, nu]*F[`~alpha`, `~nu`]*h[beta, `~beta`]-(1/2)*k*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[chi, lambda]-(1/4)*F[alpha, nu]*F[`~alpha`, `~nu`]

(10)

select(has, -(1/8)*k^3*F[kappa, `~chi`]*F[mu, `~lambda`]*h[beta, `~beta`]*h[chi, lambda]*h[`~kappa`, `~mu`]-(1/4)*k^2*F[kappa, `~chi`]*F[mu, `~lambda`]*h[chi, lambda]*h[`~kappa`, `~mu`]-(1/4)*k^2*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[beta, `~beta`]*h[chi, lambda]-(1/8)*k*F[alpha, nu]*F[`~alpha`, `~nu`]*h[beta, `~beta`]-(1/2)*k*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[chi, lambda]-(1/4)*F[alpha, nu]*F[`~alpha`, `~nu`], h)

-(1/8)*k^3*F[kappa, `~chi`]*F[mu, `~lambda`]*h[beta, `~beta`]*h[chi, lambda]*h[`~kappa`, `~mu`]-(1/4)*k^2*F[kappa, `~chi`]*F[mu, `~lambda`]*h[chi, lambda]*h[`~kappa`, `~mu`]-(1/4)*k^2*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[beta, `~beta`]*h[chi, lambda]-(1/8)*k*F[alpha, nu]*F[`~alpha`, `~nu`]*h[beta, `~beta`]-(1/2)*k*F[mu, `~lambda`]*F[`~chi`, `~mu`]*h[chi, lambda]

(11)

        Q: In the expression above can I extract only the terms with "k^(1)?"

 

You can use 'coeff' to extract the coefficient of k to the power 1, directly from L1, or any of the expressions (5), (6), (7), (9) or (10)

coeff(L1, k, 1)

-(1/4)*(-Physics:-g_[lambda, nu]*h[mu, kappa]+(-h[nu, lambda]+(1/2)*h[alpha, beta]*Physics:-g_[`~alpha`, `~beta`]*Physics:-g_[lambda, nu])*Physics:-g_[kappa, mu])*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]

(12)

coeff(-(1/8)*k^3*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]*h[mu, kappa]*h[nu, lambda]+(1/8)*k^2*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]*h[nu, lambda]+(1/8)*k^2*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[lambda, nu]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]*h[mu, kappa]-(1/8)*k*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*Physics:-g_[lambda, nu]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]-(1/4)*k^2*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*h[mu, kappa]*h[nu, lambda]+(1/4)*k*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*h[nu, lambda]+(1/4)*k*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[lambda, nu]*h[mu, kappa]-(1/4)*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*Physics:-g_[lambda, nu], k, 1)

-(1/8)*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*Physics:-g_[lambda, nu]*Physics:-g_[`~alpha`, `~beta`]*h[alpha, beta]+(1/4)*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[kappa, mu]*h[nu, lambda]+(1/4)*F[`~kappa`, `~lambda`]*F[`~mu`, `~nu`]*Physics:-g_[lambda, nu]*h[mu, kappa]

(13)

 

        Q: Other question: Can I rewrite `h__&mu;`^muagain like "`h__alpha,beta` g^(alpha beta)?"

 

You can use Library:-ToCovariant, Library:-ToContraVariant or SubstituteTensor

h[mu, mu]

h[mu, `~mu`]

(14)

Library:-ToCovariant(h[mu, `~mu`])

Physics:-g_[`~mu`, `~nu`]*h[mu, nu]

(15)

Library:-ToContravariant(h[mu, `~mu`])

Physics:-g_[mu, nu]*h[`~mu`, `~nu`]

(16)

Physics:-SubstituteTensor(h[alpha, alpha] = Physics:-`*`(g_[alpha, beta], h[alpha, beta]), h[mu, `~mu`])

h[mu, beta]*Physics:-g_[`~mu`, `~beta`]

(17)

``


Download TensorEnergiaMomento_(reviewed).mw

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

Hi Escorpsy

Within the Physics package, there is a command, Fundiff, to compute functional differentiation, and it does work with a tensor function as functional differentiation variable; check its help page ?Physics,Fundiff.

So the answer to your question is: yes, this can be done with existing functionality, you can derive "Einstein's equations" for any particular form of the Lagrangian density in the Action for the problem.

Having said that, you will need to be sufficiently explicit at the time of entering the Lagrangian density: Fundiff will differentiate F(x) with respect to F(y) returning a Dirac function (that dissapears upon integration, and Fundiff takes care of that automatically) only if it sees 'F'. It will not guess, for instance, that the Christoffel symbols can be rewritten in terms of derivatives of the metric, or for the case that the Riemann tensor can be written as a commutator involving covariant derivatives, etc.

I also don't discard having to do some adjustments here and there in order to have the computation performed, so if you have trouble please feel free to post the concrete Action for your problem (within a worksheet) and we move ahead from there.

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

First 37 38 39 40 41 42 43 Last Page 39 of 55