ecterrab

14225 Reputation

24 Badges

19 years, 222 days

MaplePrimes Activity


These are answers submitted by ecterrab

As said in a previous comment, using the 'methods' option was not implemented when tackling ODE + IC/BC. It is implemented now, and with that the problem is resolved. To install the adjustment, as usual, input Physics:-Version(latest);

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

(Please remember to post a worksheet instead of text and screen shots.)

 

There is no bug. This is the answer to your question, and at the end two suggestions to avoid these subtleties.

 

with(Physics)

Setup(spacetimeindices = greek, spaceindices = lowercaselatin_ah, signature = `-++ +`, coordinates = spherical)

[coordinatesystems = {X}, signature = `- + + +`, spaceindices = lowercaselatin_ah, spacetimeindices = greek]

(1)

From your signature, you are choosing position 1 to be timelike, and 2, 3 and 4 to represent the three spacelike components. With that in mind, take a look at the components of sigma[mu]

TensorArray(Psigma[mu])

Array(%id = 36893488152415651468)

(2)

So the Pauli matrices are sigma[2], sigma[3] and sigma[4], as you can also see in this output

TensorArray(Psigma[mu], rewriteinmatrixform)

Array(%id = 36893488152391441452)

(3)

So what you do expect for the components of sigma[a] where Psigma is indexed with a space index a?

TensorArray(Psigma[a])

Array(%id = 36893488152391429764)

(4)

TensorArray(Psigma[a], rewriteinmatrixform)

Array(%id = 36893488152391420252)

(5)

The above turns on the lights regarding the shifted value of the space index a : the tensor you are indexing, sigma is a 4-dimensional tensor, and being that the 1st component is timelike (not Physics's default but your choice of signature), the space components are given by shifting the 4-dimensional index by one.

 

How about a true space tensor? Let's define one of them, another mixed, and one all spacetime for experimentation

Define(S[a], A[mu, a], B[mu, nu])

{A[mu, a], B[mu, nu], Physics:-Dgamma[mu], Physics:-Psigma[mu], S[a], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[a, b], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(6)

For S[a], a space tensor, the components are given by

TensorArray(S[a])

Array(%id = 36893488152391393996)

(7)

You see they are not shifted. The index a runs from 1 to 3, not from 1 to 4 such that you are only interested in the components from 2 to 4.

How about the mixed tensor A[mu, a]?

TensorArray(A[mu, a])

Matrix(%id = 36893488152391382188)

(8)

Again OK, and you see: there are 4 lines indexed from 1 to 4, and 3 colums indexed from 1 to 3, because a is a space index. How about B[mu, a], where in B[mu, nu] we want only the space part of the spactime index nu?

TensorArray(B[mu, a])

Matrix(%id = 36893488151936346220)

(9)

This is again correct, but the 3 columns are indexed from 2 to 4, not from 1 to 3 as in (8) for A[mu, a]. I hope it is clear now: when you set a signature with timelike component in position 1, the space part of a spacetime index is given by shifting the value by 1 to skip the timelike component in position 1.

 

With these things in mind lets give a closer look at your example where you define a covariant derivative operator as D[mu] = `∂`[mu]+(1/2)*ig*sigma[a]*A[mu, a]. The first problem is that you use the letter D, which is a Maple command representing differentiation. If you proceed as you did, you effectively not have the D command anymore, which is bad. Instead, I suggest you first input

_local(D)

D

(10)

Now you can use D without cancelling the Maple differentiation command D

Define(D[mu] = d_[mu]+(1/2)*ig*Psigma[a]*A[mu, a])

{A[mu, a], B[mu, nu], D[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], S[a], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[a, b], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(11)

Check

D[definition]

D[mu] = Physics:-d_[mu]+(1/2)*ig*A[mu, a]*Physics:-Psigma[a]

(12)

Let's sum over the repeated index a. In view of the comments lines above, what do we expect? In A[mu, a], the index a is a space index, running from 1 to 3. In sigma[a], the index a represents the space part of a spacetime index so it runs from 2 to 4. Then

SumOverRepeatedIndices(D[mu] = Physics[d_][mu]+(1/2)*ig*A[mu, a]*Physics[Psigma][a], a)

D[mu] = Physics:-d_[mu]+(1/2)*ig*A[mu, 1]*Physics:-Psigma[2]+(1/2)*ig*A[mu, 2]*Physics:-Psigma[3]+(1/2)*ig*A[mu, 3]*Physics:-Psigma[4]

(13)

That is the result you are getting when entering TensorArray(D[mu])and that motivated your question: the index a in A[mu, a] runs from 1 to 3 but the index a in sigma[a] runs from 2 to 4.

A[mu, a]

(14)

 

Of course you could have all this in mind, and the computations will run correctly, you don't need to worry. Or the details are not in your mind and get in doubt (your post). I have some suggestions to avoid falling in these subtleties

1. 

Do not use a signature with the timelike component in position 1. Instead, use either "+++-" or "- - -+"the latter is Physics's default.

2. 

Or, use the signature "-+++" but define your tensor A with two spacetime indices, as is the case of sigma[mu], then use A with a space index,as you are doing when entering sigma[a]

Compare. These are the current components for your A defined as a mixed components tensor

TensorArray(A[mu, a])

Matrix(%id = 36893488152415701820)

(15)

with these other ones after redefining A with two spacetime indices

Define(redo, A[mu, nu], quiet)

{A[mu, nu], B[mu, nu], D[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], S[a], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[a, b], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(16)

TensorArray(A[mu, a])

Matrix(%id = 36893488152415657244)

(17)

I believe the above is what you wanted. So now you have

D[definition]

D[mu] = Physics:-d_[mu]+(1/2)*ig*A[mu, a]*Physics:-Psigma[a]

(18)

 

SumOverRepeatedIndices(D[definition], a)

D[mu] = Physics:-d_[mu]+(1/2)*ig*A[mu, 2]*Physics:-Psigma[2]+(1/2)*ig*A[mu, 3]*Physics:-Psigma[3]+(1/2)*ig*A[mu, 4]*Physics:-Psigma[4]

(19)

and you get what you where expecting  for TensorArray(D[mu]).``


Download signatures_and_mixed_type_of_tensors.mw

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

Yes. See the help page?Physics,Tensors, section 2.b and 2.c; those pages also illustrate the Library:-RedefineTensorComponent, useful for changing the value of a component after you have defined the tensor's components using Define. You have as well more details in the help page of the command you are using, ?Physics,Define.

Regarding your question, "What exactly am I doing wrong?", you are not defining tensor components the way indicated in the help page. It is not correct to "assign" a component, e.g., via A[a, 1]:= 0; in Maple, that actually reassigns all of A, creating a table and undoing the tensor definition previously done using Define.

Overall, I suggest you invest more time in the related help pages. It pays off, the functionality available is enormous, and it saves you time despite the time invested.

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

This first part is your worksheet:
restart; with(Physics)

NULLg_[euclid]

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

(1)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(2)

NULL
Define(A[mu] = [1, 2, 3, 4])

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

(3)

A[]

A[mu] = Array(%id = 36893488153354570796)

(4)

"A[~]"

A[`~mu`] = Array(%id = 36893488153354567540)

(5)

SumOverRepeatedIndices(A[`~mu`]*A[mu], mu)

30

(6)

NULL  Simplify(A[`~mu`]*A[mu])

A[mu]^2

(7)

Simplify(A[mu]^2)

A[mu]^2

(8)

NULL

Simplify(g_[nu, mu]^2)

4

(9)

"#  g Simplifies to a number, why doesn't A"?" thanks"

====================================================
Answer: that simplification only works for the metric. What you see in

g_[nu, mu]^2

Physics:-g_[mu, nu]^2

(10)

Simplify(%)

4

(11)

is the trace, as in

g_[trace]

4

(12)

For A[mu]^2  there is no trace, and if you want the sum over repeated indices, you already have that command, as you show in (6). This other example, of a tensor with two indices, may help see the difference

Define(B[mu, nu] = Matrix(4, proc (i, j) options operator, arrow; i+j end proc))

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

(13)

B[definition]

B[mu, nu] = Matrix(%id = 36893488153328980684)

(14)

B[trace]

20

(15)

Also

B[mu, mu]

B[mu, mu]

(16)

SumOverRepeatedIndices(B[mu, mu])

20

(17)

But not Simplify

Simplify(B[mu, mu])

B[mu, mu]``

(18)

The case of the metric is indeed special. In computations with paper and pencil in Physics, we (more often than otherwise) want the trace to be explicitly computed, but not for all other tensors. For them SumOverRepeatedIndices does the job and with several options (check its help page). And what if you want the trace of the metric to not be computed? Use the inert form

%g_[nu, mu]^2

%g_[nu, mu]^2

(19)

Simplify(%)

%g_[mu, nu]^2

(20)

NULL

 

Download simp_(reviewed).mw

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

 

Download Differentiate_the_solution_you_get_the_ODE.mw
 

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

Download SumOverRepeatedIndices_works_fine.mw
 

PS: Next time, please upload a worksheet with your input - see the green arrow in the post menu for that purpose; to copy and paste is not convenient.

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

Good catch, this weakness is fixed in v.1752 of the Maplesoft Physics Updates. As usual, to install, open Maple and input Physics:-Version(latest);

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

Hi

It is difficult to help without a worksheet where you show, e.g. what makes you say "I caught aome serious errors with Maple 22 calculating the Ricci tensor". Regarding "How do I tell Maple to contract thae alpha and beta indices in above expression", maybe you mean multiplying by the metric to contract? If so, you can use * or . that includes simplification - all these things are explained in detail and with examples on the help page ?Physics,Tensors.

Anyway, if you post your worksheet (see the green arrow to upload it), it becomes possible to understand what you are saying and, from there, provide more specific feedback.

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



Download Total_differential.mw

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

In short: what you are saying is not correct. The solution y(x) = 3 is a particular solution, you get it taking c__1 = infinity.

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

This is your ODE and dsolve's solution, all tests OK

ode := diff(y(x), x)-cot(x)*(y(x)^(1/2)-y(x)) = 0

sol := dsolve(ode)

y(x)^(1/2)-(Int((1/2)*sin(x)^(1/2)*cot(x), x)+c__1)/sin(x)^(1/2) = 0

(1)

odetest(sol, ode)

0

(2)

dsolve's solution computing the integral also tests OK

sol := dsolve(ode, useint)

y(x)^(1/2)-1-c__1/sin(x)^(1/2) = 0

(3)

odetest(sol, ode)

0

(4)

dsolve's solution in explicit form requires RootOf and also tests OK

sol := dsolve(ode, useint, explicit)

y(x) = RootOf(-_Z^(1/2)*sin(x)^(1/2)+sin(x)^(1/2)+c__1)

(5)

odetest(sol, ode)

0

(6)

Now, this is your solution, nm,

sol_NM := y(x) = (exp(RootOf(-sin(x)*tanh((1/2)*_Z+(1/2)*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x)

y(x) = (exp(RootOf(-sin(x)*tanh((1/2)*_Z+(1/2)*c__1)^2+sin(x)+exp(_Z)))+sin(x))/sin(x)

(7)

I don't know from where you got this expression, but to my eyes it is not a solution to ODE. Remove the RootOf to test the actual expression behind

DEtools:-remove_RootOf(sol_NM)

-sin(x)*tanh((1/2)*ln(y(x)*sin(x)-sin(x))+(1/2)*c__1)^2+y(x)*sin(x) = 0

(8)

odetest(-sin(x)*tanh((1/2)*ln(y(x)*sin(x)-sin(x))+(1/2)*c__1)^2+y(x)*sin(x) = 0, ode)

`odetest/PIECEWISE`([0, -ln(y(x)*sin(x)-sin(x))+2*arctanh(y(x)^(1/2)) = c__1], [2*(sin(x)*exp(c__1)*(exp(-c__1)*(exp(c__1)-csc(x)+2*exp((1/2)*c__1)*(-sin(x))^(1/2)*csc(x)))^(1/2)-exp(c__1)*sin(x)-2*exp((1/2)*c__1)*(-sin(x))^(1/2)+1)*exp(-c__1)*cot(x)*csc(x)/((exp(-c__1)*(exp(c__1)-csc(x)+2*exp((1/2)*c__1)*(-sin(x))^(1/2)*csc(x)))^(1/2)-1), -ln(y(x)*sin(x)-sin(x))-2*arctanh(y(x)^(1/2)) = c__1])

(9)

Regarding testing your expression (not a solution) explicitly as if it were a solution, you hit a bug, but not in odetest; it is in radnormal, this is the expression, resulting from your not-a-solution, that goes into an infinite loop within radnormal

NULL

ee := (((2*I)*RootOf(_Z^3*_a^(2*c__1)+2*_Z^2*_a^c__1+((2*I)*_a^(c__1-I*x)-(2*I)*_a^(c__1+I*x)+1)*_Z)*_a^(I*x)+_a^((2*I)*x)-1)/(_a^((2*I)*x)-1))^(1/2)

radnormal(ee);radnormal(ee)

Error, (in anonymous procedure called from depends) too many levels of recursion |lib/depends/src/depends.mpl:80|

 

NULL


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

Download ode_solved_and_tested_OK.mw

This is resolved; the integration constants shown by ODESteps are now the new ones (nicer), as the ones returned by default by dsolve. For this change to be active, as usual, install the latest update by opening Maple 2024 and entering Physics:-Version(latest)

Regarding your question in the worksheet, as explained in ?dsolve,details, by default, dsolve and pdsolve return integration constants and functions as c__n and f__n(...), where n is an integer and is displayed as a subscript (and the `__` is not visible, it just produces the subscript), but you can set these commands to work as in the past (2 releases ago), i.e. using _Cn and _Fn.

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

Thanks for the report, @nm. This one is fixed in the Updates v.1724 or newer. As usual, to install, open Maple and input Physics:-Version(latest);

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

Hi @nm, good catch. It's was a subtle issue. It is fixed in the Udpates v.1723 for Maple 2024. As usual, to install, open Maple 2024 and input Physics:-Version(latest).

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

So maybe I do not understand your question.

You define R[a, b] = P, where P is a tensorial expression with a and b as free indices. OK.

Next, you compute the Taylor expansion of R[1, 1] and equate that to 0. But nowhere in your worksheet do I see why R[1,1] would be equal to 0. Anyway, that implies an ODE for f(r).

Next, you compute the Taylor expansion of R[~1, 1] and equate that to 0.  Naturally, R[1, 1] <> R[~1, 1] because R[~1, 1] = g_[~1, ~a]*R[a, 1] (including there the sum over the repeated index a) and g_[~1, ~a] <> 1. So, naturally, the ODE you get for f(r) from the Taylor expansion of R[~1, 1] is different from the one you got from the expansion of R[1, 1].

Why are you equating two different things to 0, and then expecting them to result in the same equation for f(r)? Or even why are you suggesting that R[1, 1] = R[~1, 1]?

Guessing a bit, if you want to determine the value of f(r) such that R[1, 1] = R[~1, 1], then do this:
dsolve(Gtaylor(R[~1, 1] - R[1, 1] = 0, b, 2), f(r));
                                    f(r) = -1


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

1 2 3 4 5 6 7 Last Page 3 of 59