ecterrab

14605 Reputation

24 Badges

20 years, 98 days

MaplePrimes Activity


These are answers submitted by ecterrab

 

Hi shzan,

Besides Carl's suggestion of a loop, you can also enter your problem directly as you suggested, so as a double sum, where one of the summation index is j+k = m-1. For that purpose you need to redefinesum through the Physics  package (it just extends the syntax to what you want plus a few other enhancements). So,

Physics:-Setup(redefinesum = true)

[redefinesum = true]

(1)

Now go ahead as you intended, in one go, for instance,

Sum(Sum(2^m*(D@@k)(f)*(D@@j)(f), j+k = m-1), m = 1 .. 5)

Sum(Sum(2^m*(D@@k)(f)*(D@@j)(f), j+k = m-1), m = 1 .. 5)

(2)

value(Sum(Sum(2^m*(D@@k)(f)*(D@@j)(f), j+k = m-1), m = 1 .. 5))

2*f^2+8*D(f)*f+16*(D@@2)(f)*f+8*D(f)^2+32*(D@@3)(f)*f+32*(D@@2)(f)*D(f)+64*(D@@4)(f)*f+64*(D@@3)(f)*D(f)+32*(D@@2)(f)^2

(3)

You see this is the same result as you get using Carl's loop, or his suggested rewriting of your problem in terms of a single index j (possible in this example, but not always possible)

add(add(2^m*(D@@j)(f)*(D@@(m-1-j))(f), j = 0 .. m-1), m = 1 .. 5);

2*f^2+8*D(f)*f+16*(D@@2)(f)*f+8*D(f)^2+32*(D@@3)(f)*f+32*(D@@2)(f)*D(f)+64*(D@@4)(f)*f+64*(D@@3)(f)*D(f)+32*(D@@2)(f)^2

(4)

To know more about redefinesum, check the help page of what's new in Physics in Maple 18

 

Download Multi-Index_summation.mw

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

Hi

The results you get in your worksheet look correct to me. I corrected anyway one or two things in your input lines, added comments, and verifications. I note that you also do not say that something is wrong anywhere, you just ask whether the results are correct. Anyway, I imagine you got in doubt due to a subtletly motivating this answer below: when you compute a covariant derivaive passing a tensor component as argument, if that tensor component gets evaluated into a scalar before arriving at D_, the command receives a scalar, so the output does not contain a Christoffel symbol. It is different when the tensor component e.g. 'N[1]' arrives at D_. The details are as follows (and I suggest you to update to the latest version of Physics in order to reproduce what you see next):


restart

Physics:-Version()[2]

`2015, September 11, 0:4 hours`

(1)

with(Physics):

Physics:-Setup(math = true)

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

 

[mathematicalnotation = true]

(2)

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

(3)

PDEtools:-declare(Physics:-g_[mu, nu] = Matrix(%id = 18446744078341407198), Phi(r), N(r))

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(r)*`will now be displayed as`*Phi

 

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

(4)

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

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

(5)

Physics:-Define(%)

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], N[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)}

(6)

You have already defined N, no need to define it again (changes nothing)

 

This definition of Lambda could be problematic if F contains mu because the index would appear repeated more than once - just have in mind this.

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

(7)

Here there is a mistake: you defined N[nu] in a way that depends on (r). But then you add again that functionality, so depending on the operation you do you will have N[1](r) = (-A(r)^(1/2))(r) = (A(r)(r))^(1/2). I correct here that mistake

Lambda(N[nu])

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

(8)

T[nu] = %

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

(9)

Physics:-Define(%)

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], N[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)}

(10)

T[definition]

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

(11)

In addition, for testing purposes I will define a H[mu,nu] tensor:

H[mu, nu] = Physics:-D_[mu](N[nu])

H[mu, nu] = Physics:-D_[mu](N[nu], [X])

(12)

Physics:-Define(H[mu, nu] = Physics:-D_[mu](N[nu], [X]))

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], H[mu, nu], N[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)}

(13)

Physics:-Setup(auto = true)

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

 

[automaticsimplification = true]

(14)

T[1]

(1/4)*(diff(A(r), r))^2/(B(r)*A(r)^(3/2))

(15)

NULL

 

So your first question is about correctness of this result (15) But, is there something that makes you think is wrong?

 

In any case what follows below is what I would do to verify this result for correctness, but first let's agree on the meaning of this expression:

 

`𝒟`[mu](N[1]) = eval(`𝒟`[mu](N[nu]), nu = 1)NULL

The relevant thing here is that the computation of the covariant derivative having a tensor component for argument will include a Christoffel term. So the operation is performed in two steps: first compute with nu, then replace nu by the number 1. Because Lambda = `𝒟`[mu]*`𝒟`[`~mu`], what I am saying is also that this is the meaning of the expression you are asking:

 

Lambda(N[1]) = eval(Lambda(N[nu]), nu = 1)

 

I will check now that the result (15) for T[1] is correct, through four different ways.

 

1) Expand the covariant derivatives in  T[nu] = `𝒟`[mu](`𝒟`[`~mu`](N[nu](r))) which is the same as rewriting it in terms of Christoffel symbols and noncovariant derivatives, then make nu = 1. This is the general approach, and the important thing is that you remove all covariant derivatives D_ before introducing any tensor component.

expand(D_[mu](D_[`~mu`](N[nu], [X]), [X]))

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

(16)

ee := eval(Physics[g_][`~beta`, `~mu`]*(Physics[d_][mu](Physics[d_][beta](N[nu], [X]), [X])-Physics[Christoffel][`~sigma`, beta, mu]*Physics[d_][sigma](N[nu], [X])-Physics[Christoffel][`~sigma`, mu, nu]*Physics[d_][beta](N[sigma], [X])-N[alpha]*Physics[d_][mu](Physics[Christoffel][`~alpha`, beta, nu], [X])+N[alpha]*Physics[Christoffel][`~lambda`, beta, mu]*Physics[Christoffel][`~alpha`, lambda, nu]+N[alpha]*Physics[Christoffel][`~lambda`, mu, nu]*Physics[Christoffel][`~alpha`, beta, lambda]-N[alpha]*Physics[Christoffel][`~alpha`, lambda, mu]*Physics[Christoffel][`~lambda`, beta, nu]-Physics[Christoffel][`~alpha`, beta, nu]*Physics[d_][mu](N[alpha], [X])+Physics[Christoffel][`~alpha`, beta, nu]*Physics[Christoffel][`~kappa`, alpha, mu]*N[kappa]), nu = 1)

Physics:-g_[`~beta`, `~mu`]*(-(1/2)*Physics:-g_[beta, `~2`]*(-(1/2)*(diff(A(r), r))^2*Physics:-g_[mu, `~2`]/A(r)^(3/2)+(diff(diff(A(r), r), r))*Physics:-g_[mu, `~2`]/A(r)^(1/2))+(1/2)*Physics:-Christoffel[`~sigma`, beta, mu]*(diff(A(r), r))*Physics:-g_[sigma, `~2`]/A(r)^(1/2)-Physics:-Christoffel[`~sigma`, 1, mu]*Physics:-d_[beta](N[sigma], [X])-N[alpha]*Physics:-d_[mu](Physics:-Christoffel[`~alpha`, 1, beta], [X])+N[alpha]*Physics:-Christoffel[`~lambda`, beta, mu]*Physics:-Christoffel[`~alpha`, 1, lambda]+N[alpha]*Physics:-Christoffel[`~lambda`, 1, mu]*Physics:-Christoffel[`~alpha`, beta, lambda]-N[alpha]*Physics:-Christoffel[`~alpha`, lambda, mu]*Physics:-Christoffel[`~lambda`, 1, beta]-Physics:-Christoffel[`~alpha`, 1, beta]*Physics:-d_[mu](N[alpha], [X])+Physics:-Christoffel[`~alpha`, 1, beta]*Physics:-Christoffel[`~kappa`, alpha, mu]*N[kappa])

(17)

Sum over the repeated indices

SumOverRepeatedIndices(Physics[g_][`~beta`, `~mu`]*(-(1/2)*Physics[g_][beta, `~2`]*(-(1/2)*(diff(A(r), r))^2*Physics[g_][mu, `~2`]/A(r)^(3/2)+(diff(diff(A(r), r), r))*Physics[g_][mu, `~2`]/A(r)^(1/2))+(1/2)*Physics[Christoffel][`~sigma`, beta, mu]*(diff(A(r), r))*Physics[g_][sigma, `~2`]/A(r)^(1/2)-Physics[Christoffel][`~sigma`, 1, mu]*Physics[d_][beta](N[sigma], [X])-N[alpha]*Physics[d_][mu](Physics[Christoffel][`~alpha`, 1, beta], [X])+N[alpha]*Physics[Christoffel][`~lambda`, beta, mu]*Physics[Christoffel][`~alpha`, 1, lambda]+N[alpha]*Physics[Christoffel][`~lambda`, 1, mu]*Physics[Christoffel][`~alpha`, beta, lambda]-N[alpha]*Physics[Christoffel][`~alpha`, lambda, mu]*Physics[Christoffel][`~lambda`, 1, beta]-Physics[Christoffel][`~alpha`, 1, beta]*Physics[d_][mu](N[alpha], [X])+Physics[Christoffel][`~alpha`, 1, beta]*Physics[Christoffel][`~kappa`, alpha, mu]*N[kappa]))

(1/4)*(diff(A(r), r))^2/(B(r)*A(r)^(3/2))

(18)

That is the same you got in one go in (15) for T[1]. By the way note that you can also simplify (16), then evaluate

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

N[alpha]*Physics:-Christoffel[`~alpha`, beta, `~kappa`]*Physics:-Christoffel[`~beta`, kappa, nu]+N[alpha]*Physics:-Christoffel[`~alpha`, kappa, nu]*Physics:-Christoffel[`~kappa`, mu, `~mu`]-N[alpha]*Physics:-d_[`~beta`](Physics:-Christoffel[`~alpha`, beta, nu], [X])-2*Physics:-Christoffel[`~beta`, kappa, nu]*Physics:-d_[`~kappa`](N[beta], [X])-Physics:-Christoffel[sigma, mu, `~mu`]*Physics:-d_[`~sigma`](N[nu], [X])+Physics:-dAlembertian(N[nu], [X])

(19)

Physics:-SumOverRepeatedIndices(eval(N[alpha]*Physics:-Christoffel[`~alpha`, beta, `~kappa`]*Physics:-Christoffel[`~beta`, kappa, nu]+N[alpha]*Physics:-Christoffel[`~alpha`, kappa, nu]*Physics:-Christoffel[`~kappa`, mu, `~mu`]-N[alpha]*Physics:-d_[`~beta`](Physics:-Christoffel[`~alpha`, beta, nu], [X])-2*Physics:-Christoffel[`~beta`, kappa, nu]*Physics:-d_[`~kappa`](N[beta], [X])-Physics:-Christoffel[sigma, mu, `~mu`]*Physics:-d_[`~sigma`](N[nu], [X])+Physics:-dAlembertian(N[nu], [X]), nu = 1))

(1/4)*(diff(A(r), r))^2/(B(r)*A(r)^(3/2))

(20)

 

2) A different path: sum first, then make nu = 1

T[definition]

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

(21)

Physics:-SumOverRepeatedIndices(T[definition])

T[nu] = -(diff(B(r), r))*(Physics:-diff(N[nu], r)+Physics:-Christoffel[`~1`, 2, nu]*A(r)^(1/2))/B(r)^2+(Physics:-diff(Physics:-diff(N[nu], r), r)+Physics:-diff(Physics:-Christoffel[`~1`, 2, nu], r)*A(r)^(1/2)+(1/2)*Physics:-Christoffel[`~1`, 2, nu]*(diff(A(r), r))/A(r)^(1/2))/B(r)+Physics:-diff(Physics:-Christoffel[`~1`, 3, nu], theta)*A(r)^(1/2)/(C(r)*r^2)+(1/2)*Physics:-Christoffel[`~2`, 1, nu]*(diff(A(r), r))/A(r)^(3/2)+((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)))*(Physics:-diff(N[nu], r)+Physics:-Christoffel[`~1`, 2, nu]*A(r)^(1/2))/B(r)+cos(theta)*Physics:-Christoffel[`~1`, 3, nu]*A(r)^(1/2)/(sin(theta)*C(r)*r^2)

(22)

eval(T[nu] = -(diff(B(r), r))*(Physics:-diff(N[nu], r)+Physics:-Christoffel[`~1`, 2, nu]*A(r)^(1/2))/B(r)^2+(Physics:-diff(Physics:-diff(N[nu], r), r)+Physics:-diff(Physics:-Christoffel[`~1`, 2, nu], r)*A(r)^(1/2)+(1/2)*Physics:-Christoffel[`~1`, 2, nu]*(diff(A(r), r))/A(r)^(1/2))/B(r)+Physics:-diff(Physics:-Christoffel[`~1`, 3, nu], theta)*A(r)^(1/2)/(C(r)*r^2)+(1/2)*Physics:-Christoffel[`~2`, 1, nu]*(diff(A(r), r))/A(r)^(3/2)+((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)))*(Physics:-diff(N[nu], r)+Physics:-Christoffel[`~1`, 2, nu]*A(r)^(1/2))/B(r)+cos(theta)*Physics:-Christoffel[`~1`, 3, nu]*A(r)^(1/2)/(sin(theta)*C(r)*r^2), nu = 1)

(1/4)*(diff(A(r), r))^2/(B(r)*A(r)^(3/2)) = (1/4)*(diff(A(r), r))^2/(B(r)*A(r)^(3/2))

(23)

3) This is a third way, one step at a time so that you can verify the results by eye. For that purposes use the first derivative represented by H

Physics:-D_[mu](H[mu, nu])

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

(24)

H[definition]

H[mu, nu] = Physics:-D_[mu](N[nu], [X])

(25)

Physics:-D_[mu](H[`~mu`, nu], [X]) = Physics:-SubstituteTensor(H[definition], Physics:-D_[mu](H[`~mu`, nu], [X]))

Physics:-D_[mu](H[`~mu`, nu], [X]) = Physics:-D_[mu](Physics:-D_[`~mu`](N[nu], [X]), [X])

(26)

So work with (24), start expanding

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

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

(27)

By eye this result is correct. Next:

Physics:-SubstituteTensor(H[definition], Physics:-d_[mu](H[`~mu`, nu], [X])-Physics:-Christoffel[`~alpha`, mu, nu]*H[`~mu`, alpha]+Physics:-Christoffel[`~mu`, alpha, mu]*H[`~alpha`, nu])

Physics:-d_[mu](Physics:-D_[`~mu`](N[nu], [X]), [X])-Physics:-Christoffel[`~alpha`, mu, nu]*Physics:-D_[`~mu`](N[alpha], [X])+Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-D_[`~alpha`](N[nu], [X])

(28)

expand(Physics:-d_[mu](Physics:-D_[`~mu`](N[nu], [X]), [X])-Physics:-Christoffel[`~alpha`, mu, nu]*Physics:-D_[`~mu`](N[alpha], [X])+Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-D_[`~alpha`](N[nu], [X]))

Physics:-d_[mu](Physics:-g_[`~kappa`, `~mu`]*(Physics:-d_[kappa](N[nu], [X])-Physics:-Christoffel[`~beta`, kappa, nu]*N[beta]), [X])-Physics:-Christoffel[`~alpha`, mu, nu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-d_[upsilon](N[alpha], [X])+Physics:-Christoffel[`~alpha`, mu, nu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-Christoffel[`~tau`, alpha, upsilon]*N[tau]+Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*Physics:-d_[sigma](N[nu], [X])-Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*Physics:-Christoffel[`~lambda`, nu, sigma]*N[lambda]

(29)

This result above is also correct by eye, you can check all the signs in the Christoffel symbols. Next:

eval(Physics:-d_[mu](Physics:-g_[`~kappa`, `~mu`]*(Physics:-d_[kappa](N[nu], [X])-Physics:-Christoffel[`~beta`, kappa, nu]*N[beta]), [X])-Physics:-Christoffel[`~alpha`, mu, nu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-d_[upsilon](N[alpha], [X])+Physics:-Christoffel[`~alpha`, mu, nu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-Christoffel[`~tau`, alpha, upsilon]*N[tau]+Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*Physics:-d_[sigma](N[nu], [X])-Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*Physics:-Christoffel[`~lambda`, nu, sigma]*N[lambda], nu = 1)

-Physics:-d_[mu](Physics:-g_[`~kappa`, `~mu`], [X])*((1/2)*(diff(A(r), r))*Physics:-g_[kappa, `~2`]/A(r)^(1/2)+Physics:-Christoffel[`~beta`, 1, kappa]*N[beta])-(-(1/4)*Physics:-g_[kappa, `~2`]*(diff(A(r), r))^2*Physics:-g_[mu, `~2`]/A(r)^(3/2)+(1/2)*Physics:-g_[kappa, `~2`]*(diff(diff(A(r), r), r))*Physics:-g_[mu, `~2`]/A(r)^(1/2)+Physics:-d_[mu](Physics:-Christoffel[`~beta`, 1, kappa], [X])*N[beta]+Physics:-Christoffel[`~beta`, 1, kappa]*Physics:-d_[mu](N[beta], [X]))*Physics:-g_[`~kappa`, `~mu`]-Physics:-Christoffel[`~alpha`, 1, mu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-d_[upsilon](N[alpha], [X])+Physics:-Christoffel[`~alpha`, 1, mu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-Christoffel[`~tau`, alpha, upsilon]*N[tau]-(1/2)*Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*(diff(A(r), r))*Physics:-g_[sigma, `~2`]/A(r)^(1/2)-Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*Physics:-Christoffel[`~lambda`, 1, sigma]*N[lambda]

(30)

Physics:-SumOverRepeatedIndices(-Physics:-d_[mu](Physics:-g_[`~kappa`, `~mu`], [X])*((1/2)*(diff(A(r), r))*Physics:-g_[kappa, `~2`]/A(r)^(1/2)+Physics:-Christoffel[`~beta`, 1, kappa]*N[beta])-(-(1/4)*Physics:-g_[kappa, `~2`]*(diff(A(r), r))^2*Physics:-g_[mu, `~2`]/A(r)^(3/2)+(1/2)*Physics:-g_[kappa, `~2`]*(diff(diff(A(r), r), r))*Physics:-g_[mu, `~2`]/A(r)^(1/2)+Physics:-d_[mu](Physics:-Christoffel[`~beta`, 1, kappa], [X])*N[beta]+Physics:-Christoffel[`~beta`, 1, kappa]*Physics:-d_[mu](N[beta], [X]))*Physics:-g_[`~kappa`, `~mu`]-Physics:-Christoffel[`~alpha`, 1, mu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-d_[upsilon](N[alpha], [X])+Physics:-Christoffel[`~alpha`, 1, mu]*Physics:-g_[`~mu`, `~upsilon`]*Physics:-Christoffel[`~tau`, alpha, upsilon]*N[tau]-(1/2)*Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*(diff(A(r), r))*Physics:-g_[sigma, `~2`]/A(r)^(1/2)-Physics:-Christoffel[`~mu`, alpha, mu]*Physics:-g_[`~alpha`, `~sigma`]*Physics:-Christoffel[`~lambda`, 1, sigma]*N[lambda])

(1/4)*(diff(A(r), r))^2/(B(r)*A(r)^(3/2))

(31)

Again the same result.

 

4) Try computing directly a TensorArray for this definition

T[definition]

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

(32)

TensorArray(T[nu] = D_[mu](D_[`~mu`](N[nu], [X]), [X]))

Array(%id = 18446744078362242094)

(33)

So we have arrived to the same result going through four different paths.  Is there something concrete making you think this result would be incorrect?

 

Next you ask

NULL

 

To answer this other question, again, it is key here that the covariant derivative operator knows whether its argument is or not a tensor. So Let's first agree on the meaning:

 

Lambda(Phi(r)*N[1]*N[1]) = eval(Lambda(Phi(r)*N[alpha]*N[beta]), {alpha = 1, beta = 1})

Then start with

Lambda(Physics:-`*`(Physics:-`*`(Phi(r), N[alpha]), N[beta]))

Physics:-g_[`~kappa`, `~mu`]*(Phi(r)*Physics:-D_[mu](Physics:-d_[kappa](N[alpha], [X]), [X])*N[beta]+Phi(r)*N[alpha]*Physics:-D_[mu](Physics:-d_[kappa](N[beta], [X]), [X])+(Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[beta]-Physics:-Christoffel[`~nu`, beta, kappa]*N[nu]*Phi(r)+Phi(r)*Physics:-d_[kappa](N[beta], [X]))*Physics:-D_[mu](N[alpha], [X])+(Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[alpha]-Physics:-Christoffel[`~nu`, alpha, kappa]*N[nu]*Phi(r)+Phi(r)*Physics:-d_[kappa](N[alpha], [X]))*Physics:-D_[mu](N[beta], [X])+(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*Physics:-d_[kappa](N[alpha], [X])*N[beta]+(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*N[alpha]*Physics:-d_[kappa](N[beta], [X])-Phi(r)*(N[alpha]*Physics:-Christoffel[`~nu`, beta, kappa]+N[beta]*Physics:-Christoffel[`~nu`, alpha, kappa])*Physics:-D_[mu](N[nu], [X])-Physics:-D_[mu](Physics:-Christoffel[`~nu`, alpha, kappa], [X])*Phi(r)*N[nu]*N[beta]-Physics:-D_[mu](Physics:-Christoffel[`~nu`, beta, kappa], [X])*Phi(r)*N[alpha]*N[nu]+Physics:-g_[mu, `~2`]*(Physics:-g_[kappa, `~2`]*(diff(diff(Phi(r), r), r))*N[beta]*N[alpha]-(diff(Phi(r), r))*N[nu]*(N[alpha]*Physics:-Christoffel[`~nu`, beta, kappa]+N[beta]*Physics:-Christoffel[`~nu`, alpha, kappa])))

(34)

expand(Physics:-g_[`~kappa`, `~mu`]*(Phi(r)*Physics:-D_[mu](Physics:-d_[kappa](N[alpha], [X]), [X])*N[beta]+Phi(r)*N[alpha]*Physics:-D_[mu](Physics:-d_[kappa](N[beta], [X]), [X])+(Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[beta]-Physics:-Christoffel[`~nu`, beta, kappa]*N[nu]*Phi(r)+Phi(r)*Physics:-d_[kappa](N[beta], [X]))*Physics:-D_[mu](N[alpha], [X])+(Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[alpha]-Physics:-Christoffel[`~nu`, alpha, kappa]*N[nu]*Phi(r)+Phi(r)*Physics:-d_[kappa](N[alpha], [X]))*Physics:-D_[mu](N[beta], [X])+(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*Physics:-d_[kappa](N[alpha], [X])*N[beta]+(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*N[alpha]*Physics:-d_[kappa](N[beta], [X])-Phi(r)*(N[alpha]*Physics:-Christoffel[`~nu`, beta, kappa]+N[beta]*Physics:-Christoffel[`~nu`, alpha, kappa])*Physics:-D_[mu](N[nu], [X])-Physics:-D_[mu](Physics:-Christoffel[`~nu`, alpha, kappa], [X])*Phi(r)*N[nu]*N[beta]-Physics:-D_[mu](Physics:-Christoffel[`~nu`, beta, kappa], [X])*Phi(r)*N[alpha]*N[nu]+Physics:-g_[mu, `~2`]*(Physics:-g_[kappa, `~2`]*(diff(diff(Phi(r), r), r))*N[beta]*N[alpha]-(diff(Phi(r), r))*N[nu]*(N[alpha]*Physics:-Christoffel[`~nu`, beta, kappa]+N[beta]*Physics:-Christoffel[`~nu`, alpha, kappa]))))

-(-Phi(r)*N[beta]*Physics:-d_[mu](Physics:-d_[kappa](N[alpha], [X]), [X])-Phi(r)*N[alpha]*Physics:-d_[mu](Physics:-d_[kappa](N[beta], [X]), [X])+(Phi(r)*Physics:-Christoffel[`~sigma`, beta, mu]*N[sigma]-(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*N[beta]-Phi(r)*Physics:-d_[mu](N[beta], [X]))*Physics:-d_[kappa](N[alpha], [X])+(-(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*N[alpha]+Phi(r)*Physics:-Christoffel[`~tau`, alpha, mu]*N[tau]-Phi(r)*Physics:-d_[mu](N[alpha], [X]))*Physics:-d_[kappa](N[beta], [X])+(-Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[beta]+Physics:-Christoffel[`~nu`, beta, kappa]*N[nu]*Phi(r))*Physics:-d_[mu](N[alpha], [X])+(-Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[alpha]+Physics:-Christoffel[`~nu`, alpha, kappa]*N[nu]*Phi(r))*Physics:-d_[mu](N[beta], [X])+Phi(r)*(N[alpha]*Physics:-Christoffel[`~nu`, beta, kappa]+N[beta]*Physics:-Christoffel[`~nu`, alpha, kappa])*Physics:-d_[mu](N[nu], [X])+Phi(r)*N[nu]*N[beta]*Physics:-d_[mu](Physics:-Christoffel[`~nu`, alpha, kappa], [X])+Phi(r)*N[alpha]*N[nu]*Physics:-d_[mu](Physics:-Christoffel[`~nu`, beta, kappa], [X])+Phi(r)*N[beta]*Physics:-Christoffel[`~omega`, alpha, mu]*Physics:-d_[kappa](N[omega], [X])+Phi(r)*N[beta]*Physics:-Christoffel[`~omega`, kappa, mu]*Physics:-d_[omega](N[alpha], [X])+Phi(r)*N[alpha]*Physics:-Christoffel[`~psi`, beta, mu]*Physics:-d_[kappa](N[psi], [X])+Phi(r)*N[alpha]*Physics:-Christoffel[`~psi`, kappa, mu]*Physics:-d_[psi](N[beta], [X])-(diff(diff(Phi(r), r), r))*Physics:-g_[mu, `~2`]*Physics:-g_[kappa, `~2`]*N[alpha]*N[beta]+((N[nu]*Physics:-g_[mu, `~2`]*Physics:-Christoffel[`~nu`, beta, kappa]+N[sigma]*Physics:-g_[kappa, `~2`]*Physics:-Christoffel[`~sigma`, beta, mu])*N[alpha]+N[beta]*(N[nu]*Physics:-g_[mu, `~2`]*Physics:-Christoffel[`~nu`, alpha, kappa]+N[tau]*Physics:-g_[kappa, `~2`]*Physics:-Christoffel[`~tau`, alpha, mu]))*(diff(Phi(r), r))-Phi(r)*(((Physics:-Christoffel[`~nu`, beta, upsilon]*Physics:-Christoffel[`~upsilon`, kappa, mu]+Physics:-Christoffel[`~nu`, kappa, upsilon]*Physics:-Christoffel[`~upsilon`, beta, mu]-Physics:-Christoffel[`~nu`, mu, upsilon]*Physics:-Christoffel[`~upsilon`, beta, kappa])*N[nu]+N[lambda]*Physics:-Christoffel[`~lambda`, mu, nu]*Physics:-Christoffel[`~nu`, beta, kappa])*N[alpha]+((-Physics:-Christoffel[`~chi`, alpha, kappa]*Physics:-Christoffel[`~nu`, chi, mu]+Physics:-Christoffel[`~chi`, alpha, mu]*Physics:-Christoffel[`~nu`, chi, kappa]+Physics:-Christoffel[`~chi`, kappa, mu]*Physics:-Christoffel[`~nu`, alpha, chi])*N[nu]+N[lambda]*Physics:-Christoffel[`~lambda`, mu, nu]*Physics:-Christoffel[`~nu`, alpha, kappa])*N[beta]+N[nu]*(N[sigma]*Physics:-Christoffel[`~nu`, alpha, kappa]*Physics:-Christoffel[`~sigma`, beta, mu]+N[tau]*Physics:-Christoffel[`~nu`, beta, kappa]*Physics:-Christoffel[`~tau`, alpha, mu])))*Physics:-g_[`~kappa`, `~mu`]

(35)

eval(-(-Phi(r)*N[beta]*Physics:-d_[mu](Physics:-d_[kappa](N[alpha], [X]), [X])-Phi(r)*N[alpha]*Physics:-d_[mu](Physics:-d_[kappa](N[beta], [X]), [X])+(Phi(r)*Physics:-Christoffel[`~sigma`, beta, mu]*N[sigma]-(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*N[beta]-Phi(r)*Physics:-d_[mu](N[beta], [X]))*Physics:-d_[kappa](N[alpha], [X])+(-(diff(Phi(r), r))*Physics:-g_[mu, `~2`]*N[alpha]+Phi(r)*Physics:-Christoffel[`~tau`, alpha, mu]*N[tau]-Phi(r)*Physics:-d_[mu](N[alpha], [X]))*Physics:-d_[kappa](N[beta], [X])+(-Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[beta]+Physics:-Christoffel[`~nu`, beta, kappa]*N[nu]*Phi(r))*Physics:-d_[mu](N[alpha], [X])+(-Physics:-g_[kappa, `~2`]*(diff(Phi(r), r))*N[alpha]+Physics:-Christoffel[`~nu`, alpha, kappa]*N[nu]*Phi(r))*Physics:-d_[mu](N[beta], [X])+Phi(r)*(N[alpha]*Physics:-Christoffel[`~nu`, beta, kappa]+N[beta]*Physics:-Christoffel[`~nu`, alpha, kappa])*Physics:-d_[mu](N[nu], [X])+Phi(r)*N[nu]*N[beta]*Physics:-d_[mu](Physics:-Christoffel[`~nu`, alpha, kappa], [X])+Phi(r)*N[alpha]*N[nu]*Physics:-d_[mu](Physics:-Christoffel[`~nu`, beta, kappa], [X])+Phi(r)*N[beta]*Physics:-Christoffel[`~omega`, alpha, mu]*Physics:-d_[kappa](N[omega], [X])+Phi(r)*N[beta]*Physics:-Christoffel[`~omega`, kappa, mu]*Physics:-d_[omega](N[alpha], [X])+Phi(r)*N[alpha]*Physics:-Christoffel[`~psi`, beta, mu]*Physics:-d_[kappa](N[psi], [X])+Phi(r)*N[alpha]*Physics:-Christoffel[`~psi`, kappa, mu]*Physics:-d_[psi](N[beta], [X])-(diff(diff(Phi(r), r), r))*Physics:-g_[mu, `~2`]*Physics:-g_[kappa, `~2`]*N[alpha]*N[beta]+((N[nu]*Physics:-g_[mu, `~2`]*Physics:-Christoffel[`~nu`, beta, kappa]+N[sigma]*Physics:-g_[kappa, `~2`]*Physics:-Christoffel[`~sigma`, beta, mu])*N[alpha]+N[beta]*(N[nu]*Physics:-g_[mu, `~2`]*Physics:-Christoffel[`~nu`, alpha, kappa]+N[tau]*Physics:-g_[kappa, `~2`]*Physics:-Christoffel[`~tau`, alpha, mu]))*(diff(Phi(r), r))-Phi(r)*(((Physics:-Christoffel[`~nu`, beta, upsilon]*Physics:-Christoffel[`~upsilon`, kappa, mu]+Physics:-Christoffel[`~nu`, kappa, upsilon]*Physics:-Christoffel[`~upsilon`, beta, mu]-Physics:-Christoffel[`~nu`, mu, upsilon]*Physics:-Christoffel[`~upsilon`, beta, kappa])*N[nu]+N[lambda]*Physics:-Christoffel[`~lambda`, mu, nu]*Physics:-Christoffel[`~nu`, beta, kappa])*N[alpha]+((-Physics:-Christoffel[`~chi`, alpha, kappa]*Physics:-Christoffel[`~nu`, chi, mu]+Physics:-Christoffel[`~chi`, alpha, mu]*Physics:-Christoffel[`~nu`, chi, kappa]+Physics:-Christoffel[`~chi`, kappa, mu]*Physics:-Christoffel[`~nu`, alpha, chi])*N[nu]+N[lambda]*Physics:-Christoffel[`~lambda`, mu, nu]*Physics:-Christoffel[`~nu`, alpha, kappa])*N[beta]+N[nu]*(N[sigma]*Physics:-Christoffel[`~nu`, alpha, kappa]*Physics:-Christoffel[`~sigma`, beta, mu]+N[tau]*Physics:-Christoffel[`~nu`, beta, kappa]*Physics:-Christoffel[`~tau`, alpha, mu])))*Physics:-g_[`~kappa`, `~mu`], [alpha = 1, beta = 1])

Physics:-g_[`~kappa`, `~mu`]*(2*Phi(r)*N[nu]*A(r)*Physics:-d_[mu](Physics:-Christoffel[`~nu`, 1, kappa], [X])+Phi(r)*A(r)*Physics:-Christoffel[`~omega`, 1, mu]*Physics:-d_[kappa](N[omega], [X])+Phi(r)*A(r)*Physics:-Christoffel[`~psi`, 1, mu]*Physics:-d_[kappa](N[psi], [X])+2*Phi(r)*A(r)*Physics:-Christoffel[`~nu`, 1, kappa]*Physics:-d_[mu](N[nu], [X])+(diff(diff(Phi(r), r), r))*Physics:-g_[mu, `~2`]*Physics:-g_[kappa, `~2`]*A(r)^(3/2)+Phi(r)*(diff(diff(A(r), r), r))*A(r)^(1/2)*Physics:-g_[kappa, `~2`]*Physics:-g_[mu, `~2`]+((2*(diff(Phi(r), r))*Physics:-g_[kappa, `~2`]*Physics:-g_[mu, `~2`]-(1/2)*Phi(r)*(Physics:-g_[omega, `~2`]*Physics:-Christoffel[`~omega`, kappa, mu]+Physics:-g_[psi, `~2`]*Physics:-Christoffel[`~psi`, kappa, mu]))*(diff(A(r), r))+Physics:-Christoffel[`~nu`, 1, kappa]*N[nu]*Phi(r)*(N[sigma]*Physics:-Christoffel[`~sigma`, 1, mu]+N[tau]*Physics:-Christoffel[`~tau`, 1, mu]))*A(r)^(1/2)+(1/2)*(2*N[nu]*Physics:-g_[mu, `~2`]*Physics:-Christoffel[`~nu`, 1, kappa]+Physics:-g_[kappa, `~2`]*(N[sigma]*Physics:-Christoffel[`~sigma`, 1, mu]+N[tau]*Physics:-Christoffel[`~tau`, 1, mu]))*Phi(r)*(diff(A(r), r))+A(r)*((2*N[nu]*Physics:-g_[mu, `~2`]*Physics:-Christoffel[`~nu`, 1, kappa]+Physics:-g_[kappa, `~2`]*(N[sigma]*Physics:-Christoffel[`~sigma`, 1, mu]+N[tau]*Physics:-Christoffel[`~tau`, 1, mu]))*(diff(Phi(r), r))-2*(((1/2)*Physics:-Christoffel[`~chi`, 1, mu]*Physics:-Christoffel[`~nu`, chi, kappa]+(1/2)*Physics:-Christoffel[`~chi`, kappa, mu]*Physics:-Christoffel[`~nu`, 1, chi]-(1/2)*Physics:-Christoffel[`~chi`, 1, kappa]*Physics:-Christoffel[`~nu`, chi, mu]+(1/2)*Physics:-Christoffel[`~nu`, 1, upsilon]*Physics:-Christoffel[`~upsilon`, kappa, mu]+(1/2)*Physics:-Christoffel[`~nu`, kappa, upsilon]*Physics:-Christoffel[`~upsilon`, 1, mu]-(1/2)*Physics:-Christoffel[`~nu`, mu, upsilon]*Physics:-Christoffel[`~upsilon`, 1, kappa])*N[nu]+N[lambda]*Physics:-Christoffel[`~lambda`, mu, nu]*Physics:-Christoffel[`~nu`, 1, kappa])*Phi(r)))/A(r)^(1/2)

(36)

Physics:-SumOverRepeatedIndices(%)

(1/2)*(-Phi(r)*(diff(A(r), r))^2+2*A(r)^2*(diff(diff(Phi(r), r), r)))/(B(r)*A(r))

(37)

Now, you will not get the same result if you enter

Lambda(Phi(r)*N[1]*N[1])

(B(r)*((diff(A(r), r))*Phi(r)+A(r)*(diff(Phi(r), r)))*Physics:-d_[mu](Physics:-g_[`~2`, `~mu`], [X])+(diff(diff(Phi(r), r), r))*A(r)+(diff(diff(A(r), r), r))*Phi(r)+(Physics:-Christoffel[`~mu`, mu, nu]*A(r)*B(r)*Physics:-g_[`~2`, `~nu`]+2*(diff(A(r), r)))*(diff(Phi(r), r))+Physics:-Christoffel[`~mu`, mu, nu]*Phi(r)*(diff(A(r), r))*Physics:-g_[`~2`, `~nu`]*B(r))/B(r)

(38)

Physics:-SumOverRepeatedIndices((B(r)*((diff(A(r), r))*Phi(r)+A(r)*(diff(Phi(r), r)))*Physics:-d_[mu](Physics:-g_[`~2`, `~mu`], [X])+(diff(diff(Phi(r), r), r))*A(r)+(diff(diff(A(r), r), r))*Phi(r)+(Physics:-Christoffel[`~mu`, mu, nu]*A(r)*B(r)*Physics:-g_[`~2`, `~nu`]+2*(diff(A(r), r)))*(diff(Phi(r), r))+Physics:-Christoffel[`~mu`, mu, nu]*Phi(r)*(diff(A(r), r))*Physics:-g_[`~2`, `~nu`]*B(r))/B(r))

(1/2)*(2*(diff(diff(Phi(r), r), r))*A(r)^2*B(r)*r*C(r)+2*(diff(diff(A(r), r), r))*Phi(r)*A(r)*B(r)*r*C(r)+(diff(A(r), r))^2*C(r)*B(r)*Phi(r)*r+5*A(r)*(r*B(r)*C(r)*(diff(Phi(r), r))+(2/5)*(-(1/2)*r*C(r)*(diff(B(r), r))+B(r)*((diff(C(r), r))*r+2*C(r)))*Phi(r))*(diff(A(r), r))+2*A(r)^2*(-(1/2)*r*C(r)*(diff(B(r), r))+B(r)*((diff(C(r), r))*r+2*C(r)))*(diff(Phi(r), r)))/(A(r)*B(r)^2*r*C(r))

(39)

And why is that? Because when you input Lambda(Phi(r)*N[1]*N[1]), N[1] gets evaluated into a scalar function before D_[mu] could perceive it is a tensor:

N[1]

-A(r)^(1/2)

(40)

You can check this with a simpler example:

Upsilon := proc (F) options operator, arrow; D_[mu](F) end proc

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

(41)

debug(D_)

Physics:-D_

(42)

Upsilon(N[1])

{--> enter Physics:-D_[mu], args = -A(r)^(1/2)

<-- exit Physics:-D_[mu] (now in Upsilon) = -(1/2)*(diff(A(r), r))*Physics:-g_[mu, ~2]/A(r)^(1/2)}

 

You see: a scalar function entered D_, and so the result has no Christoffel symbols. N[1] gets evaluated into a scalar function before D_[mu] can touch it. Compare with passing N[1] to D_[mu]

D_[mu](N[1])

{--> enter Physics:-D_[mu], args = N[1]

<-- exit Physics:-D_[mu] (now at top level) = -(1/2)*(diff(A(r), r))*Physics:-g_[mu, ~2]/A(r)^(1/2)-Physics:-Christoffel[~alpha, 1, mu]*N[alpha]}

 

Now you see N[1] arrives at D_[mu], allowing for perceiving that it is the first component of a tensor, so that there is a Christoffel symbol in the output, and in this way we have the correct meaning, as said lines above, repeating here:

 

 `&Dscr;`[mu](N[1]) = eval(`&Dscr;`[mu](N[nu]), nu = 1)

Summarizing: all the results you get look correct to me, and you need to remember, when passing tensor components to procedures that then call D_: those procedures (e.g. your Lambda) will evaluate the tensor component (e.g you N[1]) before forwarding it to D_, so that D_ will receive a scalar instead of the component of a tensor and you will miss the Christoffel symbol.


Download tensor_correct_(reviewed).mw

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

Hi Rouben

Try please simplify(your_expression, size) and you get what you want.

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

Check the help page of PDEtools:-dcoeffs, it does what you are looking for, just enter 

PDEtools:-dcoeffs(PDE, u(x,y)).

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


Hi

The issue: in a tensorial expression, there is no way to tell which free index comes first. The TransformCoordinates command was using Maple's sort command, and sort([~a, b]) returns [b, ~a]. Therfore, the result you obtained coincides with the transpose of what you expected. This doesn't mean you are wrong in what you were expecting but rather that TransformCoordiantes was in need of a new optional argument, to indicate the ordering of the freeindices, as in freeindices = [~a, b]. It is also true that when you are transforming a tensor, not a tensorial expression, one can assume that the ordering of the indices is exactly the one found in the tensor, so for a case like the one you posted, it should not  be necessary to indicate the ordering of the free indices: transforming A[~a, b] should automatically take [~a, b] as the ordering of the free indices.

 

All this is now implemented, see my comments below, italized, with input in 2D format to distinguish from yours that is in 1D format. As usual, the improvement is available for download at the Maplesoft R&D Physics webpage.

 

restart

with(Physics):

Setup(mathematicalnotation = true):

ds := dx[1]^2+dx[2]^2+dx[3]^2:

Setup(coordinates = (X = [x[1], x[2], x[3]]), dimension = 3, metric = ds, spacetimeindices = lowercaselatin, quiet):

g_[]

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

(1)

A[a, b] = Matrix(3, 3, {(1, 1) = 2, (1, 2) = 1, (1, 3) = 3, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (3, 1) = 1, (3, 2) = 2, (3, 3) = 1})

A[a, b] = (Matrix(3, 3, {(1, 1) = 2, (1, 2) = 1, (1, 3) = 3, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (3, 1) = 1, (3, 2) = 2, (3, 3) = 1}))

(2)

Define(%):

`Defined objects with tensor properties`

(3)

A[]

A[a, b] = (Matrix(3, 3, {(1, 1) = 2, (1, 2) = 1, (1, 3) = 3, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (3, 1) = 1, (3, 2) = 2, (3, 3) = 1}))

(4)

A[`~`]

A[`~a`, `~b`] = (Matrix(3, 3, {(1, 1) = 2, (1, 2) = 1, (1, 3) = 3, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (3, 1) = 1, (3, 2) = 2, (3, 3) = 1}))

(5)

A[`~a`,b,matrix]

A[`~a`, b] = (Matrix(3, 3, {(1, 1) = 2, (1, 2) = 1, (1, 3) = 3, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (3, 1) = 1, (3, 2) = 2, (3, 3) = 1}))

(6)

A[`a`,~b,matrix]

A[a, `~b`] = (Matrix(3, 3, {(1, 1) = 2, (1, 2) = 1, (1, 3) = 3, (2, 1) = 2, (2, 2) = 3, (2, 3) = 4, (3, 1) = 1, (3, 2) = 2, (3, 3) = 1}))

(7)

[y[1] = x[1]-x[2], y[2] = x[2]-x[3], y[3] = x[3]]

[y[1] = x[1]-x[2], y[2] = x[2]-x[3], y[3] = x[3]]

(8)

solve((8), {x[1], x[2], x[3]})

{x[1] = y[1]+y[2]+y[3], x[2] = y[2]+y[3], x[3] = y[3]}

(9)

OK;   #  note however that you only need to pass these fewer arguments to perform the computation

B[a, b] = TransformCoordinates({x[1] = y[1]+y[2]+y[3], x[2] = y[2]+y[3], x[3] = y[3]}, A[a, b], [y[1], y[2], y[3]])

B[a, b] = Matrix(%id = 18446744078235230446)

(10)

I comment here your 1D input

# B[a,b] = TransformCoordinates((9), A[a, b], [y[1], y[2], y[3]], [x[1], x[2], x[3]], simplifier = `@`(`simplify/size`, simplify))

OK

B[`~a`, `~b`] = TransformCoordinates({x[1] = y[1]+y[2]+y[3], x[2] = y[2]+y[3], x[3] = y[3]}, A[`~a`, `~b`], [y[1], y[2], y[3]])

B[`~a`, `~b`] = Matrix(%id = 18446744078235279598)

(11)

# C[a,b] = TransformCoordinates((9), A[~a,~b], [y[1], y[2], y[3]], [x[1], x[2], x[3]], simplifier = `@`(`simplify/size`, simplify))

OK

B[a, `~b`] = TransformCoordinates({x[1] = y[1]+y[2]+y[3], x[2] = y[2]+y[3], x[3] = y[3]}, A[a, `~b`], [y[1], y[2], y[3]])

B[a, `~b`] = Matrix(%id = 18446744078235269590)

(12)

# D[a,b] = TransformCoordinates((9), A[a,~b], [y[1], y[2], y[3]], [x[1], x[2], x[3]], simplifier = `@`(`simplify/size`, simplify))``

Was "unable to decide the ordering of the free indices", now it is deterministic when the object being transformed it is a tensor - itself- i.e. not a tensorial expression and there is a new optional argument, freeindices of type list, so that you can not only specify the ordering of the new indices but also indicate less of them, to only transform a restricted number of them, perhaps one at a time, a useful new feature.

B[`~a`, b] = TransformCoordinates({x[1] = y[1]+y[2]+y[3], x[2] = y[2]+y[3], x[3] = y[3]}, A[`~a`, b], [y[1], y[2], y[3]])

B[`~a`, b] = Matrix(%id = 18446744078235257782)

(13)

# E[a, b] = TransformCoordinates((9), A[~a,b], [y[1], y[2], y[3]], [x[1], x[2], x[3]], simplifier = `@`(`simplify/size`, simplify))NULL``

should be
> LinearAlgebra:-Transpose(rhs())

Matrix(3, 3, {(1, 1) = 0, (1, 2) = -2, (1, 3) = -3, (2, 1) = 1, (2, 2) = 2, (2, 3) = 5, (3, 1) = 1, (3, 2) = 3, (3, 3) = 4})

Check the new functionality, transform only one index at a time

TransformCoordinates({x[1] = y[1]+y[2]+y[3], x[2] = y[2]+y[3], x[3] = y[3]}, A[`~a`, b], [y[1], y[2], y[3]], freeindices = [a])

Vector[column](%id = 18446744078272589566)

(14)

TransformCoordinates({x[1] = y[1]+y[2]+y[3], x[2] = y[2]+y[3], x[3] = y[3]}, A[`~a`, b], [y[1], y[2], y[3]], freeindices = [b])

Vector[column](%id = 18446744078272580414)

(15)

 

``


Download Transformation_tensor_components_(reviewed).mw

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

In my opinion, the best visualization you can have of a complex function, or for the case an arbitrary complex expression, is the one that you get using plotcompare; check its help page, use the option 'expression_plot'. In brief, you will see two 3D plots side by side: the first one shows the real part of the function on the vertical axis versus the real (x) and imaginary (y) parts of the complex variable (z) on the horizontal (complex) plane, while the second 3D plot shows you the imaginary part of the function on the vertical axis against x and y.

I find these two 3D plots much easier to rapidly decipher with my brain than the corresponding plots you can get using conformal3d, complexplot3d.

The options provided by plotcompare to zoom, shift or scale ranges, manipulate each plot and automatic assignment to a variable _P for further manipulations without having to recompute things are also valuable extra features. The way this command interacts with assuming (real or imaginary) is also very handy. Finally, the possibilty to in addition compare complex expressions visually (in which case you receive four 3D plots instead of two) is for me fantastic.

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

Hi Jschulzb

Defining tensors as arrays is equivalent to defining them as algebraic expressions that, in turn, frequently involve other tensors, as in the example you posted. There was however a bug, subtle, not less of a bug though. This bug is fixed, and the fix is available for download for everybody in the usual place, the Maplesoft R&D Physics webpage.

Details: the Lie derivative of h[a, b], involving three covariant derivatives with all of their indices covariant, is defined as LKh. Then your expression rho (the one within the worksheet you posted) involves some of the derivatives with contravariant indices in the derivand. All that is OK. But then to compute the actual value of these expressions you need to expand these covariant derivatives into the corresponding non-covariant derivatives d_[mu](...) plus Christoffel terms, you know. These Christoffel terms, in turn, have a sign that depends on the character of the indices (covariant or contravariant) of the derivand. The bug: there was one place where these covariant derivatives (in LKh) were first expanded, so that the terms involving christoffel symbols were appearing with a sign corresponding to the covariant character found in the definition of LKh, and then they were evaluate at contravariant values of some of these indices (those of the derivand), but at that point the sign of the Christoffel terms were the ones corresponding to covariant instead of contravariant indices of the derivand.

Not so easy to cross with this bug. Nicely spotted, thanks for posting about the problem. As said the fix is available for download for everybody in the usual place, the Maplesoft R&D Physics webpage.

Regarding the actual difference betrween the two ways of defining tensors, using algebraic expressions:

  • the defintion of tensors is more natural (similar to paper and pencil computations)
  • you can define tensors in terms of tensorial expressions that involve other tensors, possibly defined in terms of other algebraic tensorial expressions involving yet other tensors and so on. This is a very flexible way of defining tensors.
  • if you change the definition of a tensor entering any of these nested levels of definitions, the change is taken into account everywhere.
  • You can compute with the algebraic definitions, including simpification taking Einstein's sum rule into account, in ways you cannot do with Array definitions.

Depending on what you are working on, these features of the definition of tensors in terms of algebraic tensorial expressions can be relevant and simplify your work in significant ways.

By the way: I see you introduced a Killing Vector. Maybe you already know, maybe not: within Physics there is already a command very easy to use to compute Killing vectors, also with a number of features; if you were not aware, it is worth giving a look at the corresponding help page. (Physics:-KillingVectors).

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

 

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

First 41 42 43 44 45 46 47 Last Page 43 of 60