ecterrab

13431 Reputation

24 Badges

19 years, 363 days

MaplePrimes Activity


These are answers submitted by ecterrab

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

Hi

I like Andriy's answer, not because of perfection, I really do not find value in perfection, but because it has the perspective of a spontaneous and skilled user. Independent of that, though I'm currently pretty busy with new material, I will see if next week I find time to suggest some shortcuts to what Andriy presented.

Here I would only like to add two comments.

  1. Within the Physics package, special care has been taken with not repeating code already existing in the Maple library. For example, there is already code for computing eigenvalues and eigenvectors outside the Physics package, and this code is fully compatible with Physics.
  2. There is a large number of examples about QM using Maple Physics, already posted here in Mapleprimes, as well as in the Physics[examples] help page (section on Quantum Mechanics, close to the end of the page) of the distributed Maple software. Either you didn't notice this Examples help page and Mapleprimes posts, or they are insufficient in some way that you didn't tell (if so, please post here and the page will probably get improved taking your feedback into account).

So please give a look at the section on Quantum Mechanics of the help page ?Physics,examples, as well as to these other Mapleprimes posts:

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

Hi nm

Give a look at the LibraryTools package. With those commands you can list the libraries and analize their content; it is then possible to select by type `module` and table, and for all of them list the exports and indices, and that is - I'd say - 95% of what you want; then refine the approach a little bit and you get what you mentioned in your post.

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

@Andriy 

No, Physics:-`.` and Physics:-`*` are not equivalent. You use `.` when you apply an operator to a Ket or extended Ket structure (see related types in the Physics:-Library:-PhysicsType package). You can represent the `.` product using `*` if you wish, but the operator doesn't get applied. Example: Setup(op=A) then try A . Ket(A, n) and compare with A * Ket(A, n). So, no, it is not related com backwards compatibility either.

Now: when you multiply two operators, as in A . B or A*B, for us physicists this distinction `.` versus `*` is, frankly, only a notation issue related exclusively to 'computers'. We expect both to represent the same thing. What happened for Maple 18 is that I normalized both products into one single form in order to avoid having A . B - A * B not recognized as 0. Naturally, the change includes that (A . B) . Ket works the same way as (A * B) . Ket. In fact this change was done in connection with a Mapleprimes exchange with you about sorting products etc.

Regarding your other question in this same thread: type(f(a, b, c), 'f(anything, anything)') is false because f(a, b, c) has three operands not two; use f(anything, anything, anything) as second argument to type to see it matching, or you can also check this other answer to get some more details on how it works.

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

First 39 40 41 42 43 44 45 Last Page 41 of 55