ecterrab

14540 Reputation

24 Badges

20 years, 23 days

MaplePrimes Activity


These are answers submitted by ecterrab

Hi

In the post on "Computer Algebra for Theoretical Physics" you see how to define a tensor whose components are the partial derivatives of something else, or a matrix, or just defined by an algebraic tensorial expression. Check please the "Examples" in the sections for "Classical Field Theory" and "General Relativity". In another previous post, "Physics, one year of developments", in the section entitled "Tensors", within the examples, equation (48) shows what you ask, the definition of a tensor in terms of the partial derivatives of another tensor. The first section on Simplification, what concerns tensors, also contains material similar to what you ask. Finally in the help page ?Physics,Examples that comes with the Maple system, there is a section on "Tensors in Special and General Relativity" that contains answers to your question and more details on how to work with tensors in Maple in general.

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

There is an issue with Dirac and these equations that I'd need to give a look at the internals, not for today. Meantime, try as shown in this image and it resolves the problem; i.e. let dsolve tackle it without knowing who is 'delta'; use the option explicit to get the solution built (see ?dsolve,details where this is expllained):

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


Hi MathyMaple

This is again a combination of premature evaluation problems. The first one is in the power operation. In Maple, debatable or not, we have

0^0

1

(1)

But then,

0^m

0

(2)

Naturally, if in a second step m assume the value0, "it is too late". But this is resolved when you load Physics, that among other things also redefines the power operation to handle noncommutative operands. So,

with(Physics)

0^m

Physics:-`^`(0, m)

(3)

:) So that issue is not there anymore. The second premature evaluation problem happens in sum, but that is also addressed within the Physics package, that allows for redefining sum: just in order for it to be free of these evaluation issues.

Setup(redefinesum = true)

[redefinesum = true]

(4)

Try now your example:

X := [0, 1, 2, 3]

[0, 1, 2, 3]

(5)

n := 2

2

(6)

sum(sum(a[k]*X[i]^k, k = 0 .. n), i = 1 .. nops(X))

4*a[0]+6*a[1]+14*a[2]

(7)

sum(sum(a[k]*X[i]^k, i = 1 .. nops(X)), k = 0 .. n)

4*a[0]+6*a[1]+14*a[2]

(8)

To have the above working you need to update your Physics library with the one distributed in the Maplesoft R&D webpage.


Download DoubleSumAndPowerEvaluationProblem.mw

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

Hi H-R 100,

You talk of A as a 2nd order tensor (two indices) but then refer to a vector operation (curl(curl(A))) that would imply on A as a vector (or tensor with 1 index). So I guess I am missing something about your question. Could you be more specific on what you mean bu curl(curl(A)) where A is not a vector but a second order tensor instead?

Meanwhile, it could also be of help for you to give a look at this previous answer "Relating 3D vectors and tensors" given in a different context (covariant derivatives) but containing all the ingredients I could imagine behind your question, related Maple input/output illustrating, and also pointers to specific free online literature related to your question.

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

Hi rit,

In a previous post, on Computer Algebra for Theoretical Physics, section "Tackling examples with the Physics package", subsection Quantum Mechanics, in the first problem: "Quantization of the energy of a particle in a magnetic field", actually about second quantization, you have the guidelines (as a sort of template-example) for the second quantization of Maxwell equations. If you want to work this problem in tensorial form, probably the next problem in that worksheet, on the tensorial relationship between the components of the quantized angular momentum operator, would help. In fact this second problem can all be done in terms of the annihilation/creation operators as done in the first problem for the energy in a magnetic field.

Note: at the end of this post on Computer Algebra for Theoretical Physics you will see a link to download a worksheet containing all the material.

If you have any more concrete question on the steps to go, please post the question here (preferred) or email me at physics@maplesoft.com.

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


You need the following Physics commands; you can load them, as I do below, or you can use the long form; ie prefix them with the package's name, for example as in Physics:-Setup.

with(Physics, Setup, Define, LeviCivita, SumOverRepeatedIndices)

[Setup, Define, LeviCivita, SumOverRepeatedIndices]

(1)

Setup is to set the dimension of the space you are working, also to set it as Euclidean (default is Minkowski with signature - - - +).

Setup(spacetimeindices = lowercaselatin, dimension = [3, `+`], quiet)

[dimension = 3, signature = `+ + +`, spacetimeindices = lowercaselatin]

(2)

You can now use Matrix or matrix. With Matrix:

A := Matrix(3, symbol = a)

Matrix(%id = 18446744078399458710)

(3)

To use Einstein's sum rule for repeated indices with an object entering a product you first need to tell to the system that the object in question is a tensor; for that you use Define

Define(a[i, j])

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], Physics:-Psigma[mu], a[i, j], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, mu, nu]}

(4)

Enter now the formula for the determinant; you can use the LeviCivita command, or its abbreviation ep_

ep_[i, j, k]*a[1, i]*a[2, j]*a[3, k]

Physics:-LeviCivita[i, j, k]*a[1, i]*a[2, j]*a[3, k]

(5)

To perform the sum over the repeated indices, use SumOverRepeatedIndices

SumOverRepeatedIndices(Physics:-LeviCivita[i, j, k]*a[1, i]*a[2, j]*a[3, k])

a[1, 1]*a[2, 2]*a[3, 3]-a[1, 1]*a[2, 3]*a[3, 2]-a[1, 2]*a[2, 1]*a[3, 3]+a[1, 2]*a[2, 3]*a[3, 1]+a[1, 3]*a[2, 1]*a[3, 2]-a[1, 3]*a[2, 2]*a[3, 1]

(6)

Compare with the Determinant of A

LinearAlgebra:-Determinant(A)

a[1, 1]*a[2, 2]*a[3, 3]-a[1, 1]*a[2, 3]*a[3, 2]-a[1, 2]*a[2, 1]*a[3, 3]+a[1, 2]*a[2, 3]*a[3, 1]+a[1, 3]*a[2, 1]*a[3, 2]-a[1, 3]*a[2, 2]*a[3, 1]

(7)

evalb(a[1, 1]*a[2, 2]*a[3, 3]-a[1, 1]*a[2, 3]*a[3, 2]-a[1, 2]*a[2, 1]*a[3, 3]+a[1, 2]*a[2, 3]*a[3, 1]+a[1, 3]*a[2, 1]*a[3, 2]-a[1, 3]*a[2, 2]*a[3, 1] = a[1, 1]*a[2, 2]*a[3, 3]-a[1, 1]*a[2, 3]*a[3, 2]-a[1, 2]*a[2, 1]*a[3, 3]+a[1, 2]*a[2, 3]*a[3, 1]+a[1, 3]*a[2, 1]*a[3, 2]-a[1, 3]*a[2, 2]*a[3, 1])

true

(8)

If in (5) you want to use A, not a you need to use matrix since Matrix requires numerical indices. So, define A as the matrix

A := matrix(3, 3, proc (i, j) options operator, arrow; a[i, j] end proc)

array( 1 .. 3, 1 .. 3, [( 2, 1 ) = (a[2, 1]), ( 3, 2 ) = (a[3, 2]), ( 1, 2 ) = (a[1, 2]), ( 3, 1 ) = (a[3, 1]), ( 3, 3 ) = (a[3, 3]), ( 1, 1 ) = (a[1, 1]), ( 2, 2 ) = (a[2, 2]), ( 2, 3 ) = (a[2, 3]), ( 1, 3 ) = (a[1, 3])  ] )

(9)

The rest is the same: define A to be an object with tensorial properties (ie for which the Einstein sum rule for repeated indices is to be applied)

Define(A[i, j])

`Defined objects with tensor properties`

 

{A[i, j], Physics:-Dgamma[mu], Physics:-Psigma[mu], a[i, j], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, mu, nu]}

(10)

Enter the formula forthe determinant, now in terms of A

LeviCivita[i, j, k]*A[1, i]*A[2, j]*A[3, k]

Physics:-LeviCivita[i, j, k]*A[1, i]*A[2, j]*A[3, k]

(11)

SumOverRepeatedIndices(Physics:-LeviCivita[i, j, k]*A[1, i]*A[2, j]*A[3, k])

a[1, 1]*a[2, 2]*a[3, 3]-a[1, 1]*a[2, 3]*a[3, 2]-a[1, 2]*a[2, 1]*a[3, 3]+a[1, 2]*a[2, 3]*a[3, 1]+a[1, 3]*a[2, 1]*a[3, 2]-a[1, 3]*a[2, 2]*a[3, 1]

(12)

evalb(a[1, 1]*a[2, 2]*a[3, 3]-a[1, 1]*a[2, 3]*a[3, 2]-a[1, 2]*a[2, 1]*a[3, 3]+a[1, 2]*a[2, 3]*a[3, 1]+a[1, 3]*a[2, 1]*a[3, 2]-a[1, 3]*a[2, 2]*a[3, 1] = a[1, 1]*a[2, 2]*a[3, 3]-a[1, 1]*a[2, 3]*a[3, 2]-a[1, 2]*a[2, 1]*a[3, 3]+a[1, 2]*a[2, 3]*a[3, 1]+a[1, 3]*a[2, 1]*a[3, 2]-a[1, 3]*a[2, 2]*a[3, 1])

true

(13)

``


Download LeviCivitaDeterminant.mw

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

Hi nm

The update of Physics distributed on Maplesoft's R&D Physics webpage includes a version of IntegrationTools:-Combine that is free of this problem you mentioned and a couple of other ones. I.e. updating your Physics automatically fixes IntegrationTools:-Combine, as well as a number of other routines on which the Physics package relies. Theses fixes to other routines are also the ones already in place in the version of Maple under development where, for example, the problem you posted today does not exist since some time.

So answering your question, you do not need to patch anything, but instead - better - you can directly use the fix already in place for this problem.

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

The page to look regarding the Physics package is ?Physics,Vectors. The range for the angles is in the references, listead at the end of the main ?Physics help page; see for instance 'Coordinate Systems' at the end of Vol 1 C.T. Quantum Mechanics.  So, theta ranges from 0 to Pi and phi from 0 to 2 Pi.

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

Hi

dsolve returns a sequence of solutions, each of which is of type equation, if possible with the unknown isolated on the left-hand-side, otherwise the implicit solution is all on the left-hand and the right-hand side is always equal to 0.

The sequence of solutions could be null (i.e. no solution at all was found). So, when no solution got found, dsolve(...) returns NULL.

Finally, if the equation(s) passed or the unknows were indicated as a system, i.e. enclosed in {} or [], the ouptut is a sequence of solution sets (i.e. the solutions enclosed within a set, unless the system of equations is nonlinear; more is explained in ?dsolve,details).

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

Generally speaking, the answer to your question is: use simplify, as in:

 

If simplify doesn't do what you want, the please post the expression you want to rewrite in terms of Re(z) so that one could see what is the appropriate command or combination of them that would work.

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

Michael

Recalling, generally speaking, a tetrad is defined up to a (6-parameter) Lorentz transformation. Therefore, there are infinitely many possible choices. So it is not the case that e_[1,mu] d_[mu](F) should have any only one particular form. That value depends on the choice of the tetrad.

Recall as well that even specifying that the thetrad is orhonormal (this is Physics's default value), or null, still does not define the tetrad univocally. Formulas 3.14 and 3.15 of Stephani's book "Exact Solutions to Einstein's equations" show how to transform the tetrad in different ways. Those formulas can be used rigth away within Physics. The same formulas are displayed in the help page for DifferentialGeometry:-Tensor:-NullTetradTransformation.

Having said that, about the directional (tetrad) derivative: just write the d_ operator with a tetrad index. By default, lowercase latin is used for tetrad when you load Tetrads, so enter d_[a](F) and that will suffice; it is the same as e_[a,mu]*d_[mu](F). Yes you can then use SumOverRepeatedIndices, or to get the four values (one for each value of the index a) you can use TensorArray, which automatically uses SumOverRepeatedIndices (unless you ask not to do that with optional arguments; this is explained in ?TensorArray).

So all boils down to your choice of tetrad ... I wrote about this when replying to your previous post related to the same problem. Perhaps if you tell (worksheet) what is the tetrad that you have in mind to work with? As said in that previous reply, you can always indicate the tetrad directly to Physics, and all in the package will take that indication into account. You set the tetrad to be what you prefer via Setup(tetrad = ....) or Setup(e_ = ...) both work. Or, you can take the tetrad computed by the package by default (orthonormal or null), then use formulas 3.14 and 3.15 of Stephani's book to produce another tetrad, fix the parameters so that it is the more convenient one for you (e.g. it could be principal axis), then set it as said using Setup.

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

Hi Michael

As Carl pointed out, this is a GUI setting. In any case, large expressions happen frequently. Recently, a new mode of computation got added to Physicsautomaticsimplification. You could use it to resolve the issue, for that you need to update your Physics from the Maplesoft R&D Physics webpage. Alternatively, you could prefer to specify the simplifier yourself, explicitly, directly to TensorArray, for instance by passing to it and optional argument 'simplifier = (u -> simplify(u, size))'. The result wlil be the same as the one you get with automaticsimplification. This is an excerpt of your worksheet showing your input/output lines after turning ON automaticsimplification.The reviewed worksheet is linked at the end.

By the way, key in the computation you show is the form of the tetrad. Physics automatically computes an orthonormal tetrad (you could ask for a null tetrad) but if you have another one, of any kind that is more convenient, you can set it, so that all Physics work with it, via Setup(e_ = your_choice_of_tetrad).

Download Derive_Eq_4.4_(reviewed).mw

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

PoslavskySV

I am a bit surprised with the level of innacuracy of the title of your post, "Physics:-Simplify does not work with tensors". The help page of Physics:-Simplify, with varied simplification of tensorials expressions at the beginning of the Examples section, as well as many Mapleprimes posts, confirm the opposite of your title. Anyone can see that. In any case I am not in for debates.

Regarding the examples you posted explicitly:

Besides actually simplifying the 8 examples you posted, although there is - and will always be - room for improvements, recall that Physics is a Computer Algebra environment for Theoretical Physics not restricted to just algebraically simplifying tensorial expressions, as the other packages you mentioned. And having in mind that Physics already has good simplification of tensorial expressions covering the basics and more (e.g. handling of noncommutative tensor operators, or repeated spacetimetetrad and/or space indices in the same expression), I preferred to focus on other physics areas that appear to me as more important. To mention but two, the introduction of the tetrad formalism in general relativity and of parameterized algebra rules in quantum mechanices are new developments recently finished.

Anyway thanks for the examples, it is also true that improvements in the simplification of tensorial expressions happened for every one of the last 5 Maple releases, also in connection with user feedback like yours now.

Download SimplifyingTensorialExpressions.mw

Edit: just tried version 41.1 Dec/15 of the Physics updates from the Maplesoft webpage and, actually, Simplify with the tryhard option simplifies correctly: 

  1. all the 250+ examples of your file Maple18_failSimple.txt, as well as
  2. all of the 1000 examples of your other file Maple18_allSimple.txt, and
  3. all of the 100 examples of your other file Maple18_allMedium.txt

as seen in the three attached worksheets below. In summary, Simplify fails in simplifying none of these 1,350 examples of these three files you posted nor it fails in simplifying any of the 8 ones you posted explicitly. So much for your "Physics:-Simpify does not work with tensors".... At some point next year I will give a look at your other file with larger examples. Anyway things are not as your post title says and also were not before this single day of exchanges (or otherwise this is a very easy problem and I am very fast in coding the whole simplification of tensorial expressions in a couple of hours :).

I am moving the focus to other things. At some point during the week I will still see to have Simplify performing these simplifications without having to indicate tryhard.

Download Simplified250Examples.mw

Download Simplified1000Examples.mw

Download Simplified100MediumExamples.mw

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

Hi
Attached is your worsheet after a fix, such that it opens fine in Maple 18, 17 and 16. Could you please give it a look and confirm that everything is there?

By the way I noticed that it is all about general relativity using GRTensor. It is a fantastic package. And the first one of its kind. But what in current Maple you have Physics and DifferentialGeometry with more functionality, and for the tensor computations I see in the worksheet I'd say Physics would permit almost a direct translation with various advantages (simplicity more than anything else, and you do not need to do so many steps for what you want to accomplish). I'd suggest you give it a try.

FenixHPbien (fixed).mw

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

Hi

I suggest you to give a look at "this other answer in Mapleprimes", that discuss the issue and presents links to answers to the same question. Now, Maple 16 is a bit old with regards to Physics; so many things have changed in the package.

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

First 43 44 45 46 47 48 49 Last Page 45 of 59