## 24 Badges

18 years, 151 days

## Yes it is following its design principle...

Note that in the same page ?assuming[details] you are quoting, after these three items you quote, you also read:

Notes: The assuming command does not place assumptions on integration or summation dummy variables in definite integrals and sums, nor in limit or product dummy variables, because all these variables already have their domain restricted by the integration, summation or product range or by the method used to compute a limit. To obtain the simplification of the expression being summed, integrated or subject to a product taking into account the restriction on the values of the dummy variable implicit in the integration/summation/product range, use the simplify command -- see the Examples section of this help page.

The assuming command does not scan Maple programs regarding the potential presence of assumed variables. To compute taking into account assumptions on variables found in the bodies of programs, use assume -- see the Examples section.

These two paragraphs complete the description. Taking them into account, assuming does work according to its design.

Regarding the question by Sergio, the second paragraph quoted above is the answer. There are various reasons for this design, mainly that if you scan procedures, they typically call other procedures that call other ones etc. and you cannot go scanning all the tree, and "I only scan this many levels" would be of no use in various cases one could imagine, and you have the functionality anyway if you use assume alone or in combination with assuming (with or without its option additionally). There is one example in the Examples section illustrating this aspect of the design explicitly.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Physics:-Library:-Add...

A new Physics:-Library:-Add command is included in today's update of Physics, implementing the ideas discussed in this post, so working around the model of evaluation of arguments of sum that sometimes generates unexpected results as discussed for instance in the Mapleprimes posts of August  annihilation/creation operators , Problem-With-A-Function-Within-Sum, and Sum-In-For-Loop. The next upated by the end of the week will include a `print/Add` to have the expected capital Sigma display an related copy & paste.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## AntiCommutator and Coefficients improved...

You posted 3 replies. Let me go through them in sequence in a single reply here, and in what follows I am using the next update of Physics, to be posted tomorrow:

 >
 (1)

____________________________________

In your 'Great but not perfect', the problem is not in SortProducts but in AntiCommutator. You know, for Commutators you can always expand them when one of the operands is a product, say as in,

 >
 >
 (2)

But this formula does not exist for anticommutators, so anticommutators of products are not expanded

 >
 (3)

On the other hand - say in this example - if the anticommutator between B and C and also between A and C are known, then one can always compute this anticommutator as an expansion.

Example:

 >
 (4)

The following anticommutator returns uncomputed with the version of Physics you have, but from the knowlege of the anticommutatores (rules) above it can always be computed:

 >
 (5)

In steps:

 >
 (6)

Take the first term on the right-hand side and move C to the left in two steps: first anticommuting with C with B then with A.

Step 1

 >
 (7)
 >
 (8)
 >
 (9)
 >
 (10)
 >
 (11)

Step 2

 >
 (12)
 >
 (13)
 >
 (14)
 >
 (15)
 >
 (16)

This mechanism to compute the anticommutator of products when the anticommutator for each of the operands of the product is known was not implemented, and so SortProducts was returning with an AntiCommutator uncomputed. After implementing this, for the example you posted in "Great but not perfect" we now have

 >
 (17)
 >
 >
 (18)
 >
 (19)

No uncomputed anticommutators:

 >
 (20)

In your next reply "Another issue appeared", you point out that simplify/size does not collect the terms the way you want and is expected.

 >
 (21)
 >
 (22)
 >
 (23)

Note three things.

1) This result is not collected as we expect, but it is not wrong as you say.

2) The problem is not related to Physics.

For example, remove all Physics objects

 >
 (24)

Try again and you see the same situation, the expression is not reduced in size

 >
 (25)

3) You can achieve what you want with the expression z2 directly using collect, as in

 >
 (26)

In your third and last reply, "The coefficients of operator expression", you show that Coefficients is not working as expected. Indeed it takes coefficients in noncommutative products expressed using Physics:-`*`, not Physics:-`.`. This is explained in the help page.

On the other hand I agree with you, Coefficients should work with both Physics:-`*` and Physics:-`.` in equal footing. This is implemented now (to appear tomorrow), so that we get

 >
 (27)
 >
 (28)

It works also with a product as second argument, as in:

 >
 (29)
 >
 (30)
 >
 (31)

The key here was adapting Library:-Degree to work withPhysics:-`*` and Physics:-`.` in equal footing, and with that we got Coefficients working as expected:

 >
 (32)
 >
 (33)
 >
 (34)

In summary for your three replies: 1) AntiCommutator got improved (that resolved your issue with SortProducts), 2) use collect (simplify/size works very well but in this example requires a tweak and I am short of time to fix that); 3) Library:-Degree, and through it also Coefficients now work with Physics:-`.` the same way they do with Physics:-`*`.

All these changes and some others as a new Library:-Add and Library:-TensorCoefficients are already included in the update being prepared for tomorrow. Regarding Library:-Collect, yes it is part of the plan, but other things are a bit higher in the priority list (e.g. Hausorff's formula, relevant in basic QM). Anyway, at some point soon enough Collect will be in place together with a new Factor handling noncommutative products.

 >

Download MaplePrimesSortProducts.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## working as expected (update 22) and chan...

Today's update got posted in the usual Maplesoft Physics Updates webpage the problem you noticed got fixed, some other things got improved and new stuff added in connection with feedback by other people. Altogether, we now have:

 >
 (1)
 >
 (2)
 >

Consider the expression z and the ordering ApAm1

 >
 (3)
 >
 (4)

Compare the behavior with and without the evaluateexpression optional argument

 >
 (5)
 >
 (6)

Sorting using commutator leads to the same result

 >
 (7)
 >
 (8)

Regarding another question you made, to factor out common factors, this output by SortProducts as well as all the output of Physics commands can be handled via simplify/size

 >
 (9)

Regarding your question about the algebra satisfied by annihilation/creation operators for fermionic or bosonic particles, the definitions used are the standard ones, see for instance the annihilation/creatioin operators in the wikipedia . Now, if you call Setup to display this algebra, you see

 >
 (10)

and you asked what about the commutators for : their rules are automatically derived behind the scene, but you can check these derived rules directly, either using the Commutator and AntiCommutator commands, or the Library commands Commute and AntiCommute. For example:

 >
 (11)
 >
 (12)

Therefore

 >
 (13)
 >
 (14)

Not directly related to SortProducts but related to the topic, there are now rules for changing variables in in Bras, Kets and Brackets

 >
 (15)
 >
 (16)
 >
 (17)

For some wrong reason Kets appear displayed in the contents above as question marks "?". In the output labeled (17) that "?" represents Ket(A, k) after changing variables.

Next in connection with these topics is Annihilation/Creation accepting symbolic occupation numbers and a new Library:-sum command that handles its arguments the same way as add does, but with the summation capabilities of sum - see sum with 'safe' dummy parameter design.

Download Update22.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## unclear .. new Physics update...

Hi

It is not clear what you meant passing [am, ap] as the ordering (second argument) to Library:-SortProducts. Note that you defined your annihilation/creation operators as am[i], ap[j], so am and ap are tables, only the table elements are the operators you want. For example, try has(z, am) and has(z, ap) and you see 'false'. Here are two possible interpretations that pass through my mind of what you tried to do and how you accomplish that using the current update of the Physics package (number 21, it is being posted in our website in the Physics updates page today): [worksheet ommited - corrected worksheet appears below in the next answer]

Regarding your question about collecting terms: if the factors you want collected are commutative, then the products involving them are so, hence you can use the Maple standard collect command (see ?collect). Otherwise you can use Physics:-Coefficients to manipulate the expression; a Physics:-Library:-Collect is not ready. You can always also use simplify/size (see ?simplify/size)

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## more of the same...

I just saw another post - same kind of problem, the same solution proposed here would cure it. I will prepare this prototype of sum command that handles the arguments the way add does while at the same time works with symbolic summation ranges and all the current summation knowledge of sum.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## same problem. same solution...

This is the same type of problem discussed in recent posts about the dummy index of sum and the evaluation rules of the Maple standard 'sum' command,  see yesterday's post "Sum with safer dummy parameter design"

And these are among the most frequent unexpected problems in Maple. See also the comment by Michael Croucher further below - as you Andriy, and many others along the years, he also finds this result by sum surprising. Please note that it doesn't matter here "why" is sum returning 0 - of course there is a logic, as explained by Carl below. In my opinion, however, the issue here is not that but the fact that this result is not what we want nor what we would expect.

Supporting the view of this result as 'unexpected' from a user perspective, check it out with add: to do the experiment you need to make the summation limits be integers, replace f by 1:

`g := proc (i) if i = 1 then a else 0 fiend proc:h := add(g(i), i = 1 .. 1);`
`                                       a`

Nice! So why is sum not returning alike? Because add and sum have different models for handling the arguments. I gave some details about this in "Sum with safer dummy parameter design". From my experience with add and sum I am convinced that 'add' has the correct model for handling of arguments, not sum. By 'correct' I mean: results by add are what I would expect right away, without using artificial tricks as delayed evaluation etc. On the other hand, sum has real and powerful summation knowledge, and handles symbolic summation ranges, and more, while add only handles integer ranges and only performs rudimentary addition one term at a time.

I will see to prepare a prototype for a sum command that uses the summation power of the current sum command but handles the arguments the way add does, so free of these problems.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## The hypergeometric pFq function...

Hi
I believe you are referring to the [] entering as first argument in the hypergeom function - these arguments are explained in ?hypergeom.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Algebra for Pauli matrices...

Hi Peterm,

 >
 >
 (1)

Set the algebra the way you did

 >
 >
 (2)

With the today's update of Physics, downloadable from  "Maple Physics: Research & Development", it works as expected

 >
 (3)
 >
 (4)
 >
 (5)
 >
 (6)
 >
 (7)

The advantage of this with respect to what you can do without the updated Physics library is that in the above the algebra works right away, naturally, without having to define functions f and g as shown in the previous answer poseted.

Download PauliSigmaII.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Library:-PhysicsType package...

Hi Mac Dude

PhysicsType is a package of specialized types distributed within the Physics,Library  and explained in that help page. Recalling, that I am working with the updated Physics library, downloadable from  "Maple Physics: Research & Development",

 >
 (1)

the PhysicsVectors type you asked is included in the PhysicsType package:

 >
 >
 (2)

 >
 (3)

Download PhysicsType.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## PhysicsType...

Hi Mac Dude

PhysicsType is a package of specialized types distributed within the Physics,Library  and explained in that help page. Recalling that I am working with the updated Physics library, downloadable from  "Maple Physics: Research & Development".

 >
 (1)

The PhysicsVectors type you asked is included in the PhysicsType package.

 >
 >
 (2)

 >
 (3)

Download PhysicsType.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## new: am^2 = 0 ap^2 = 0 for fermionic am ...

Hi Andriy

In the first reply it is shown how to perform to the end the computation you wanted to perform. In the second one I mentioned the implementation, in the downloadable update of Physics, of the simplification N^k = N, where N = ap . am and ap, am respectively represent criation, annihilation fermionic operators. Besides that, in the update of Physics posted today (dowloadable from the Maple Physics: Research & Development updates page) the simplification am^2 = 0 and ap^2 = 0 is also implemented, completing what has been discussed in this thread. Recalling, in connection with one of your questions, Andriy, these new simplifications are performed not using simplify but using Simplify, the command of the Physics package (see ?Physics,Simplify).

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Change variables...

 >
 >
 (1)

The transformation you posted:

 >
 (2)

Rewrite your transformation with x, y and  on the left-hand sides

 >
 (3)

Change variables

 >
 (4)

In the above you already see the answer to your question, so isolating

 >
 (5)

Download PartialDerivative.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## Yes by setting an algebra for powers of ...

Hi Peterm,

 >
 >
 (1)

Set your algebra as an algebra for powers of noncommutative operators, only two rules: one for Commutators, the other one for AntiCommutators, both rules respectively mapping into two functions f and g

 >
 (2)

Check it

 >
 (3)
 >
 (4)

That is the most important part. You can now write f and g to accomplish the task in different ways.

Here is one way, starting with g

 >

For f you need also to take care of cyclic permutations of  to get the correct sign; express first f  in terms of a procedure s, then concentrate on s

 >

This is one possible way to code s

 >

Check it out

 >
 (5)
 >
 (6)
 >
 (7)

All is in place. So now:

 >
 (8)
 >
 (9)
 >
 (10)
 >
 (11)
 >
 (12)
 >
 (13)
 >
 (14)
 >
 (15)

All this is reproducible in Maple 17, but anyway it is a good idea to update your Physics library - you can download it from the Maplesoft "Maple Physics: Research & Development" updates page. I will see next week to have things in place so that you can achieve the same results without having to write these f and g functions - say tackling this problem succesfully in a more natural way, similar to the one you tried.

Download PauliSigmaAlgebraRu.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

## How to do it with current or previous Ph...

I just saw your post ... answering two years after is probably irrelevant, but anyway: things have changed since 2011. Using the Physics library up-to-date (you can download it from the the "Maple Physics: Research & Development" updates page), current version:

 >
 (1)

Set some commutation rules to see how it works

 >
 >
 (2)

The first commutator has a constant in the rhs: in these cases you can now index the operators A and B or give functionality to them as desired and the result will always be the right-hand side of type constant  :

 >
 (3)
 >
 (4)
 >
 (5)

In the second commutator, the right-hand side is not constant, so this one works as in previous releases:

 >
 (6)
 >
 (7)
 >
 (8)

The third commutator has functionality in the left-hand and right-hand sides, the same one, so in this case you have more flexibility

 >
 (9)
 >
 (10)

You can also transform f into a procedure

 >
 (11)
 >
 (12)
 >
 (13)
 >
 (14)

The Physics update is developed assuming the Maple 17 library, but the last approach, with  in the right-hand side of the commutator followed by defining f as a procedure, will also work in previous Maples.

Download MaplePrimesCommutato.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 First 48 49 50 51 52 53 54 Page 50 of 55
﻿