ecterrab

13431 Reputation

24 Badges

19 years, 362 days

MaplePrimes Activity


These are replies submitted by ecterrab

This tweak in the new (rewritten) simplify/conjugate resulted easier than expected. The change is in place and available for download in the usual  the "Maple Physics: Research & Development" webpage.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

I'm glad to see that, both, you got this working the way you need and we got these commands enhanced in different ways. Looking at your coefficients.mw it also springs to my mind that some of your requirements could be options to Coefficients, as in Coefficients(expression, PhysicsType:-xxx) to select all the coefficients of objects of type PhysicsType:-xxx, further allowing to indicate the degree(s), as in Coefficients(expression, PhysicsType:-xxx, N), where N is explained in the Calling Sequence in ?Physics[Coefficients]. That would have saved the need for coding the coeffxxx functions you show in the mw. I will implement this as soon as I find some free time.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

I'm glad to see that, both, you got this working the way you need and we got these commands enhanced in different ways. Looking at your coefficients.mw it also springs to my mind that some of your requirements could be options to Coefficients, as in Coefficients(expression, PhysicsType:-xxx) to select all the coefficients of objects of type PhysicsType:-xxx, further allowing to indicate the degree(s), as in Coefficients(expression, PhysicsType:-xxx, N), where N is explained in the Calling Sequence in ?Physics[Coefficients]. That would have saved the need for coding the coeffxxx functions you show in the mw. I will implement this as soon as I find some free time.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Carl Love and Alejandro

Thanks for the info, so this macro suggested fixed the problem - I think I then know what is causing it. I'll fix it at its root in the first Physics update this week.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

I use a macintosh, perhaps you do not and this is why I am unable to reproduce it. Could you please enter, at the maple prompt, the following: macro(``=``, ` ` = ` `) and let me know whether it fixes the problem. 

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi

Maple 17.02 is available for download.  Just to note that 17.02 includes various improvements in 'Physics', basically all the work done in the package till August 20, though none of the posterior improvements mentioned here in Mapleprimes, available for download at the Maple Physics: Research & Development updates page (latest update: today). These posterior improvements are described in the PhysicsUpdates.mw distributed within the zip file together with the update.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

In the help page you read "The select(e, f) selects the operands of the expression e which satisfy the Boolean-valued procedure f". The key observations are that you select "the operands" and you do not change the container - ie the type of the e containing the operands (but for some special cases of automatic simplification: e.g. the product of a single operand `*`(a)  becomes the operand itself and so it is not a product anymore).

Now in your last reply, phi = Ket(psi, 1, 1, 0). So select(phi, commutative) will return Ket(1, 1, 0) (because only psi is not commutative), then select(type, phi, PhysicsType:-Ket) will return Ket() because none of psi, 1, or 0 are of type PhysicsType:-Ket. Understanding those you also understand how the other results you show are formed.

In brief, that is how select works, give a look please at the help page ?select and its examples.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 

 

 
 

@Andriy 

In the help page you read "The select(e, f) selects the operands of the expression e which satisfy the Boolean-valued procedure f". The key observations are that you select "the operands" and you do not change the container - ie the type of the e containing the operands (but for some special cases of automatic simplification: e.g. the product of a single operand `*`(a)  becomes the operand itself and so it is not a product anymore).

Now in your last reply, phi = Ket(psi, 1, 1, 0). So select(phi, commutative) will return Ket(1, 1, 0) (because only psi is not commutative), then select(type, phi, PhysicsType:-Ket) will return Ket() because none of psi, 1, or 0 are of type PhysicsType:-Ket. Understanding those you also understand how the other results you show are formed.

In brief, that is how select works, give a look please at the help page ?select and its examples.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 

 

 
 

@Andriy 

Just to point out that a new Physics:-Library:-Add command, free of these subtleties regarding the evaluation of arguments of sum or the use of local variables inside procedures related to add, is ready and included in today's Physics update.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

Just to point out that a new Physics:-Library:-Add command, free of these subtleties regarding the evaluation of arguments of sum or the use of local variables inside procedures related to add, is ready and included in today's Physics update.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

The typesetting of Physics:-Library:-Add as a sum is finished and included in today's update of Physics.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

The typesetting of Physics:-Library:-Add as a sum is finished and included in today's update of Physics.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

Regarding these other two questions you do in "Key issue": SortProducts has an option, evaluateexpression, so that after sorting the expression is evaluated. The difference when you use this option is that, when you evaluateexpression, a product `.`(A, B, C, D) becomes `.`(A, `.`(B, `.`(C, D))). At some point (years ago) it was relevant to keep `.` as a function of two arguments. I'd need to revise this to tell you exactly why was that ... or even if it is necessary today. Actually, if it is not necessary anymore, just remove it and keep the syntax as in `.`(A, B, C, D), the same way we do with Physics:-`*`.

Regarding your other question, given an expression that involves N products, say P[j] with j from 1 to N, and where each of these P[j] has a commutative factor that you called A[j], mutliplicating a noncommutative factor - say NC[j]. So say your expression is of the form ee := Sum(A[j] * NC[j], j=1..N), and let's suppose that the NC[j] involve both Physics:-`*` and Physics:-`.`. You want to get all the A[j]. There are simple ways of doing this systematically, but we would need another Library routine to unnest products in expressions - I will prepare it, include it in the next update of Physics this week and reply here again showing you how to do this.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

Regarding these other two questions you do in "Key issue": SortProducts has an option, evaluateexpression, so that after sorting the expression is evaluated. The difference when you use this option is that, when you evaluateexpression, a product `.`(A, B, C, D) becomes `.`(A, `.`(B, `.`(C, D))). At some point (years ago) it was relevant to keep `.` as a function of two arguments. I'd need to revise this to tell you exactly why was that ... or even if it is necessary today. Actually, if it is not necessary anymore, just remove it and keep the syntax as in `.`(A, B, C, D), the same way we do with Physics:-`*`.

Regarding your other question, given an expression that involves N products, say P[j] with j from 1 to N, and where each of these P[j] has a commutative factor that you called A[j], mutliplicating a noncommutative factor - say NC[j]. So say your expression is of the form ee := Sum(A[j] * NC[j], j=1..N), and let's suppose that the NC[j] involve both Physics:-`*` and Physics:-`.`. You want to get all the A[j]. There are simple ways of doing this systematically, but we would need another Library routine to unnest products in expressions - I will prepare it, include it in the next update of Physics this week and reply here again showing you how to do this.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

First: the issue of extracting the A[alpha] from an operator H, where the A[alpha] is a commutative factor, this is the issue you have been discussing in this thread, is resolved: you can use coeff or Physics:-Coefficients with a product as second argument.

Today you introduced a different thing: getting the coefficient of a noncommutative variable within a noncommutative product. Physics:-Coefficients can do that for anticommutative variables, and also for noncommutative variables provided that the meaning is not ambiguous: suppose A, B and C are noncommutative then what is the coefficient of A in ABC, BAC and BCA?

I see three possible answers:
1) it is BC in all the cases. But then we have a problem: you cannot reconstruct the input given the coefficient BC and the variable A.

2) it is BC in the first case and interrupt with an with an error in the second and third cases. This is the current design. I see however that I forgot to mention this exception that it works when the variable is in the first position of a noncommutative product - I need to fix the help page regarding this.

3) It interrupts with an error in the three cases.

So, what is what you were expecting from Coefficients that is not this error interruption, or what is what you would suggest?

Edgardo S. Cheb-Terrab
Physics, Maplesoft

First 48 49 50 51 52 53 54 Last Page 50 of 60