ecterrab

14540 Reputation

24 Badges

20 years, 21 days

MaplePrimes Activity


These are replies submitted by ecterrab

@guru kido 
In Define((6)), you need to use the equation label (6), not just the number (6). Give a look to the help pages on how to insert an equation label into an input line. On a Mac it is by pressing Command + L. In Windows I imagine it is by pressing Ctrl + L.

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

Hi,
Thanks for your post and comments, Samir. Physics for Maple 2019 comes with a myriad of enhancements. 

Regarding Tensor computations, to mention but one that is quite powerful, on top of the previous simplification capabilities for tensorial expressions, an additional, new, simplifier is in place, using group theory to simplify tensorial expressions taking tensor symmetries into account. Examples of this new simplifier handling expressions not handled in previous releases are in the help page for what is new in Physics in Maple 2019.

Besides tensor computations, a tremendous push happened in Quantum Mechanics, with the introduction of tensor products of quantum states and coherent states, a rewriting of the command for computing Taylor expansions with respect to anticommutative variables, and a new command for sorting the operands in noncommutative products in any desired way taking advantage of commutator and anticommutator rules that were set.

One of the most important things about what is new: there are three significant new documents in the help database of Maple 2019. One of them is this Complete Guide for Tensor Computations that you mentioned. The other two are the Mini-Course: Computer Algebra for Physicists, and another document on the Physics Updates. The latter has 77 descriptive links to the updates of Physics that happened for each release and the most relevant posts from Mapleprimes illustrating the package.

Last but not least, the number of changes under the hood is too large to itemize. One of them, not mentioned in the what's new pages, is that in Maple 2019 the impressive conversion network for mathematical functions of the system can now handle anticommutative and noncommutative variables, which are available when you load Physics. 

Maple 2019 is one of the most voluminous releases ever in what concerns developments in the Physics package, regarding code, documentation and diversity of areas covered.  

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

@guru kido 

Take a closer look ... In (6) you indicate a tensorial equation to be used in the definition of W, but in (7) you do not use it. Compare with my original reply. Your input leading to (7) should be Define((6)). Otherwise the system has no way to know about (6). There is a logic to that.

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

@guru kido 

The reason is in the error message. By default, spacetime indices are represented by greek letters. Check my previous reply: in the first line I Setup(spacetimeindices=lowercaselatin). You didn't do that, but then you used lowercaselatin letters as indices. Try setting the indices first, or use greek letters (the default, you do not need to set them).

Also: use CompacDisplay to avoid unreadable wallpaper expressions as the one you show in the reply above.

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

@  James Woodsnm
I'm surprised. I'm writing now to the people who take care of the MapleCloud and its access. Please feel free to write me directly at physics@maplesoft.com or here again updating on the status of things, thanks.

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

@rrbaldino 

Give a look at the help page for Dirac. There you see four approximations (equation numbers 2, 3, 4 and 5). Plotting any of them is enough for a beginner who just wants to see any plot of Dirac.

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

@struckmeier

Yes, I received your LaTeX and updated my previous reply, the issue is fixed in the latest Physics Updates.

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

@John Fredsted 

There is a new post, closer to the concept of e-book mentioned in the previous comments in this thread: A Complete Guide for Tensor computations using Physics. That Guide covers most (aims at covering all) of what is necessary to work in Special and General Relativity using Physics. There is also another documentation new page and post: Overview of the Physics Updates containing an organized presentation, also all in one place, of those elusive additional links to the what's new in Physics pages and Physics relevant posts in Mapleprimes.

I wouldn't claim the e-book on the use of the Physics package, mentioned comments above, now exists but these two pages certainly turn the light ON, significantly, on that matter. These two new pages are now linked in all the Physics help pages.

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

@SKhan97 

It is mentioned in the post,  "This guide, shown below with Sections closed, is linked at the end of this post as a pdf file with all the sections open, and also as a Maple worksheet that allows for reproducing its contents". So you can give a look with the sections open clicking the pdf link at the end of the post, or downloading the Maple worksheet, opening sections and executing their contentes if you prefer. Incidentially, I didn't put a section on Killing vectors, also not about geodesics - the help pages of the corresponding commands explain how to use them  (enter ?KillingVectors or ?Geodesics).

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

@John Fredsted 

Coming back to this issue. I revised now Landau's book and, indeed, the implementation in Physics is not wrong, at all, but you are correct regarding the display of g[a, ~b] as kd_[a,~b], and in the "not use" of kd_[a, b], where kd_ = KroneckerDelta. On page 17, Landau's book defines kd_ as a tensor with one index covariant the other contravariant, as in kd_[a, ~b], not saying whether kd_[a, b] is a tensor, but saying "by raising or lowering one index in kd_[a, ~b] we respectively obtain the contravariant and covariant tensor g_[~a, ~b], g_[a, b] ", which in turn is a tensor, and of course we know that raising and lowering the indices of a tensor the tensor remains a tensor ... but,the resulting kd_[a, b] is not used as such, and g_[a, b] is used instead.

Anyway, I suppose my memory got blurred by the years about this notation detail. Landau's paragraph is also not that good for a computer implementation, where tensors are identified by their name, not by the covariant/contravariant character of their indices. The implementation of what the book says regarding notation also requires some gymnastics, with computations flowing with "kd_ is a tensor only if its indices are one covariant the other contravariant, not otherwise", and g_[a, ~b] is always displayed as kd_[a, ~b],.

On the other hand, following Landau's book also regarding notation proved to be appropriate. I'll spend a day tomorrow verifying to what point such a design can be implemented in a robust way.

Independent of that, kd_[a,b] with both indices covariant will not be a tensor anymore already in the next Physics Updates (i.e. v.282 or higher). That will end, once and for all, the potential problem of using kd_[a, b] (with a, b being space or spacetime indices) in quantum mechanics to represent not a tensor but the standard Kronecker delta symbol (1 if a=b, or if a <> b, and unevaluated when equality cannot be resolved).

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

@Carl Love 

...hmm I'm afraid I find K's post is not clear enough. In the lines of what you say, both acer and dharr answered the question in a complete manner, then why K's next comment saying "Apparently there is no simple solution" ... Anyway, what I do see tricky is a general representation of the multinomial theorem, and the like, using computer algebra, that is something both computable and as simple as what you see in for instance Wikipedia. -I thought that is K was asking. I didn't understand his question. Anyway ...

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

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

@mistel 
 

Issue 1. is now fixed, and the fix available to everybody within the Maplesoft Physics Updates version 277 or higher. What follows is your worksheet with some comments intercalated.

 

restart; with(Physics); Physics:-Version()[2]

`2019, January 7, 16:59 hours, version in the MapleCloud: 277, version installed in this computer: 277`

(1)

Setup(hilbertspaces = {{A, alpha}, {B, beta}}, quantumbasisdimension = {A = 1 .. N[a], B = 1 .. N[b]}, quantumdiscretebasis = {A, B, alpha, beta}, bracketrules = {%Bracket(Bra(A, i), Ket(Psi)) = Ket(beta, i), %Bracket(Bra(A, i), Ket(alpha, j)) = C[i, j], %Bracket(Bra(B, i), Ket(Psi)) = Ket(alpha, i), %Bracket(Bra(B, j), Ket(beta, i)) = C[i, j]})

[bracketrules = {%Bracket(%Bra(A, i), %Ket(Psi)) = Physics:-Ket(beta, i), %Bracket(%Bra(A, i), %Ket(alpha, j)) = C[i, j], %Bracket(%Bra(B, i), %Ket(Psi)) = Physics:-Ket(alpha, i), %Bracket(%Bra(B, j), %Ket(beta, i)) = C[i, j]}, disjointedspaces = {{A, alpha}, {B, beta}}, quantumbasisdimension = {A = 1 .. N[a], B = 1 .. N[b]}, quantumdiscretebasis = {A, B, alpha, beta}]

(2)

proj := Sum(Sum(Ket(A, i).Bra(A, i).Ket(B, j).Bra(B, j), i = 1 .. N[a]), j = 1 .. N[b])

Sum(Sum(Physics:-`*`(Physics:-Ket(A, i), Physics:-Ket(B, j), Physics:-Bra(A, i), Physics:-Bra(B, j)), i = 1 .. N[a]), j = 1 .. N[b])

(3)

proj2 := Projector(Ket(A, i)).Projector(Ket(B, i))

Physics:-`*`(Sum(Physics:-`*`(Physics:-Ket(A, i), Physics:-Bra(A, i)), i = 1 .. N[a]), Sum(Physics:-`*`(Physics:-Ket(B, i), Physics:-Bra(B, i)), i = 1 .. N[b]))

(4)

proj.Ket(Psi)

Sum(Sum(C[i, j]*Physics:-`*`(Physics:-Ket(A, i), Physics:-Ket(B, j)), i = 1 .. N[a]), j = 1 .. N[b])

(5)

NULL

This weakness in the output before v.277, requiring one extra step, is now fixed:

proj2.Ket(Psi)

Sum(Sum(C[i__1, i]*Physics:-`*`(Physics:-Ket(A, i__1), Physics:-Ket(B, i)), i = 1 .. N[b]), i__1 = 1 .. N[a])

(6)

proj-proj2

Sum(Sum(Physics:-`*`(Physics:-Ket(A, i), Physics:-Ket(B, j), Physics:-Bra(A, i), Physics:-Bra(B, j)), i = 1 .. N[a]), j = 1 .. N[b])-Physics:-`*`(Sum(Physics:-`*`(Physics:-Ket(A, i), Physics:-Bra(A, i)), i = 1 .. N[a]), Sum(Physics:-`*`(Physics:-Ket(B, i), Physics:-Bra(B, i)), i = 1 .. N[b]))

(7)

To answer your question, the issue is not about Physics but about computer algebra design. Consider

Sum(f[j], j = 1 .. n)-(Sum(f[k], k = 1 .. n))

Sum(f[j], j = 1 .. n)-(Sum(f[k], k = 1 .. n))

(8)

You see, not zero. This is an intentional design in all computer algebra systems I am aware of. For good or for bad, it allows for further manipulations.

Here is another example, more specific to the Maple system

exp(-x)-1/exp(x)

exp(-x)-1/exp(x)

(9)

Again, not zero unless you ask for the exponentials to be combined or simplified

combine(exp(-x)-1/exp(x))

0

(10)

A different, however similar problem, is this one about the indices, consider

(Sum(f[j], j = 1 .. n))*(Sum(g[j], j = 1 .. m))

(Sum(f[j], j = 1 .. n))*(Sum(g[j], j = 1 .. m))

(11)

combine((Sum(f[j], j = 1 .. n))*(Sum(g[j], j = 1 .. m)))

(Sum(f[j], j = 1 .. n))*(Sum(g[j], j = 1 .. m))

(12)

So, nada. Reason: if the summation index is the same, you cannot make the product of both summands be the new summand of a double sum (as you expected when asking for (4) to automatically become (3)). Change the second summation index

(Sum(f[j], j = 1 .. n))*(Sum(g[k], k = 1 .. m))

(Sum(f[j], j = 1 .. n))*(Sum(g[k], k = 1 .. m))

(13)

Now the transformation of the product of two sums into a single double sum is possible

combine((Sum(f[j], j = 1 .. n))*(Sum(g[k], k = 1 .. m)))

Sum(Sum(f[j]*g[k], k = 1 .. m), j = 1 .. n)

(14)

lprint(%)

Sum(Sum(f[j]*g[k], k = 1 .. m), j = 1 .. n)

 

 

With regards to Physics, it is not different. If you define proj2 with a different summation index

proj2 := Projector(Ket(A, i)).Projector(Ket(B, j))

Physics:-`*`(Sum(Physics:-`*`(Physics:-Ket(A, i), Physics:-Bra(A, i)), i = 1 .. N[a]), Sum(Physics:-`*`(Physics:-Ket(B, j), Physics:-Bra(B, j)), j = 1 .. N[b]))

(15)

You do not receive 0 when taking the difference, as it happens in all computer algebra systems

proj-proj2

Sum(Sum(Physics:-`*`(Physics:-Ket(A, i), Physics:-Ket(B, j), Physics:-Bra(A, i), Physics:-Bra(B, j)), i = 1 .. N[a]), j = 1 .. N[b])-Physics:-`*`(Sum(Physics:-`*`(Physics:-Ket(A, i), Physics:-Bra(A, i)), i = 1 .. N[a]), Sum(Physics:-`*`(Physics:-Ket(B, j), Physics:-Bra(B, j)), j = 1 .. N[b]))

(16)

And if you combine, you get 0 as it happens in Maple in general, independent of its Physics package.

combine(Sum(Sum(Physics[`*`](Physics[Ket](A, i), Physics[Ket](B, j), Physics[Bra](A, i), Physics[Bra](B, j)), i = 1 .. N[a]), j = 1 .. N[b])-Physics[`*`](Sum(Physics[`*`](Physics[Ket](A, i), Physics[Bra](A, i)), i = 1 .. N[a]), Sum(Physics[`*`](Physics[Ket](B, j), Physics[Bra](B, j)), j = 1 .. N[b])))

0

(17)

A comment to the side: you are using Maple's default Document mode. I prefer the Worksheet mode, where the input lines are identified by a prompt and, mainly, whatever you write in an input line is - by default - active math, while whatever you write in a text region is - by default - text, not active math. This is the most common situation, I think, and so with Worksheet you can work faster and cleaner. For those reasons I recommend working using a Worksheet instead of a Document. You can set this in the Preferences of your Maple: Interface -> Default format for new worksheets -> Worksheet then click on Apply Globally. For presentation purposes, like in the above, I additionally go to the menu View -> Show/Hide Contents and uncheck both Section Boundaries Execution and Group Boundaries. The result is as you see above.


 

Download projector_2d_space_(reviewed).mw

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

My vote is the same as yours, answers to technical questions take time and share skills with the community. Having these answer deleted by whoever posted the question is, just, not OK at all.

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

@mistel 
 

How is that you cannot type over thing on this worksheet. Anyway, below I typed it for you, the changes I suggested you according to what you say you wanted. I don't discard you may want to change the definition of H further, but I leave the continuation of this for you. By giving a look at the help pages, indicated or not, I imagine you will have no problem, and in any case I need to move to other things. Hopefully alltogether these 4 answers are sufficient for you to take off with your computation.

 

Physics:-Version()[2]

`2018, December 30, 7:35 hours, version in the MapleCloud: 272, version installed in this computer: 272`

(1)

with(Physics)

Setup(hermitianoperators = {H}, hilbertspaces = {{A, C, H}, {B, C, H}}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C[1] = 1 .. Na, C[2] = 1 .. Nb}, quantumdiscretebasis = {A, B, C}, bracketrules = {%Bracket(Bra(A, i), Ket(C, j, k)) = delta[i, j]*Ket(B, k), %Bracket(Bra(B, i), Ket(C, j, k)) = delta[i, k]*Ket(A, j), %Bracket(Bra(C, i, j), H, Ket(C, k, l)) = H[i, j, k, l]})

[bracketrules = {%Bracket(%Bra(A, i), %Ket(C, j, k)) = Physics:-KroneckerDelta[i, j]*Physics:-Ket(B, k), %Bracket(%Bra(B, i), %Ket(C, j, k)) = Physics:-KroneckerDelta[i, k]*Physics:-Ket(A, j), %Bracket(%Bra(C, i, j), H, %Ket(C, k, l)) = H[i, j, k, l]}, disjointedspaces = {{A, C, H}, {B, C, H}}, hermitianoperators = {H}, quantumbasisdimension = {A = 1 .. Na, B = 1 .. Nb, C[1] = 1 .. Na, C[2] = 1 .. Nb}, quantumdiscretebasis = {A, B, C}]

(2)

Ket(C, k, l) = Ket(A, k).Ket(B, l)

Physics:-Ket(C, k, l) = Physics:-`*`(Physics:-Ket(A, k), Physics:-Ket(B, l))

(3)

Bra(C, i, j) = Bra(A, i).Bra(B, j)

Physics:-Bra(C, i, j) = Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j))

(4)

This works

Bra(C, i, j).H.Ket(C, k, l)

H[i, j, k, l]

(5)

Bra(A, i).Bra(B, j).Ket(A, k).Ket(B, l)

Physics:-KroneckerDelta[i, k]*Physics:-KroneckerDelta[j, l]

(6)

What I want

Bra(A, i)*Bra(B, j)*H*Ket(A, k)*Ket(B, l) = Bra(C, i, j)*H*Ket(C, k, l)

Physics:-`*`(Physics:-Bra(A, i), Physics:-Bra(B, j), H, Physics:-Ket(A, k), Physics:-Ket(B, l)) = Physics:-`*`(Physics:-Bra(C, i, j), H, Physics:-Ket(C, k, l))

(7)

Bra(C, i, j)*H*Ket(C, k, l) = Bra(C, i, j).H.Ket(C, k, l)

Physics:-`*`(Physics:-Bra(C, i, j), H, Physics:-Ket(C, k, l)) = H[i, j, k, l]

(8)

 

(Did you really mean you were unable to type over things in this procedure to adapt it to your needs?)

 

 
"H := K ->   if (procname::Not(indexed) or nops(procname) < 4) and K::Ket and op(1,K)::identical(A,B) then      if procname::'indexed' then         H[op(procname), op(2..-1, K)]     else          H[op(2..-1, K)]     fi  else      'procname . K'  fi:"

 

Let's see it in action. Start erasing all Physics performance remember tables, that remember results like (7) computed before the definition of H

Library:-Forget()

 

Then you have

H.Ket(A, k)

H[k]

(9)

Bra(B, j).H

H[j]

(10)

Bra(B, j).H.Ket(A, k)

H[j, k]

(11)

and this is already what you wanted to compute:

Bra(A, i).Bra(B, j).H.Ket(A, k).Ket(B, l)

H[i, j, k, l]

(12)

Bracket(Bra(A, i).Bra(B, j), H, Ket(A, k).Ket(B, l))

H[i, j, k, l]

(13)

Bra(A, m).H[i, j, k, l]

Physics:-`.`(Physics:-Bra(A, m), H[i, j, k, l])

(14)

Bra(C, i, j).H.Ket(C, k, l)

H[i, j, k, l]

(15)

Bra(C, i, j)*H*Ket(C, k, l) = Bra(C, i, j).H.Ket(C, k, l)

Physics:-`*`(Physics:-Bra(C, i, j), H, Physics:-Ket(C, k, l)) = H[i, j, k, l]

(16)

Setup(op = X)

`* Partial match of  '`*op*`' against keyword '`*quantumoperators*`' `

 

_______________________________________________________

 

[quantumoperators = {A, B, C, H, X}]

(17)

Bra(X, i, j, k).H.Ket(X, m, n, s)

Physics:-Bracket(Physics:-Bra(X, i, j, k), H, Physics:-Ket(X, m, n, s))

(18)

NULL


 

Download algebra_rules_(reviewed_III).mw

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

First 27 28 29 30 31 32 33 Last Page 29 of 64