ecterrab

13431 Reputation

24 Badges

19 years, 362 days

MaplePrimes Activity


These are replies submitted by ecterrab

@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

@Alejandro Jakubi 

Regarding your question about this new Physics:-Library:-Add: "Specifically, does the same recommendation of always explicitly declare the index variable to be local inside procedures hold also for this new routine?" The answer is: no, not at all. no local variables, no declarations of them inside procedures. Nada. Just use it normally and it is free of the issues with evaluation of arguments or local variable declarations of both sum and add

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Alejandro Jakubi 

Physics:-Library:-Add is there in today's update of Physics. Now, of course the program, as any other Maple program, uses internal routines, and these are not meant for user-level use (which I see from your posts you apparently insist they should be documented as if they were user-level). They are then not documented the way you would like nor they will be. We know that. Partly for this reason is that I introduced the ?Physics:-Library, and ?PDEtools:-Library subpackages and related documentation - see also ?dsolve[setup], but these are exceptions.

On the other hand, one of the things that distinguishes Maple, fantastic thing, is that you can list all the not-user-level-documented library internal routines for inspection, tracing, and even rewriting them if you want. We all learned a lot in that way, and many of us actually switched to, or use Maple today, solely for that reason. Concretely, the routine you are curious about, at the root of this stripping of expressions in use in this new user level routine Physics:-Library:-Add, is `assuming/set_expression`.

I do not feel your question about the meaning of the second parameter in seq as quite within the scope of this post. You may prefer to ask this question in a new/separated post.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

In my reply yesterday (see above) I mentioned taking the coefficients "of a product". I also put an example showing that working. Have you tried today's Physics update? I understand Coefficients can do what you need, i.e. to grab all that A[alpha] from H

For example: take your z2 (shown as (22) in my reply yesterday - see above) and compute '> Coefficients(z2, ap[1].am[1], 1)' and you will receive, 'R + 3', which is the A[alpha] you are asking.

Additionally, besides Coefficients that can break into a noncommutative product, note that the output of Physics:-`*` as well as that of Physics:-`.` is of the form sorted_s1 * non_commutative_sorted_s2, where the * between them is the commutative standard Maple product, while non_commutative_sorted_s2 is a noncommutative product internally represented as a function. For this reason, you can always use the standard collect and coeff commands to collect (that is why it works colleting the function Physics:-`.`) and to get the coefficients of non_commutative_sorted_s2 (i.e. these A[alpha]; try it).

If today's update doesn't work the way you need, posting a concrete example as the other times will facilitate helping you filling the gaps or developing the functionality missing if any. Thanks.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

In my reply yesterday (see above) I mentioned taking the coefficients "of a product". I also put an example showing that working. Have you tried today's Physics update? I understand Coefficients can do what you need, i.e. to grab all that A[alpha] from H

For example: take your z2 (shown as (22) in my reply yesterday - see above) and compute '> Coefficients(z2, ap[1].am[1], 1)' and you will receive, 'R + 3', which is the A[alpha] you are asking.

Additionally, besides Coefficients that can break into a noncommutative product, note that the output of Physics:-`*` as well as that of Physics:-`.` is of the form sorted_s1 * non_commutative_sorted_s2, where the * between them is the commutative standard Maple product, while non_commutative_sorted_s2 is a noncommutative product internally represented as a function. For this reason, you can always use the standard collect and coeff commands to collect (that is why it works colleting the function Physics:-`.`) and to get the coefficients of non_commutative_sorted_s2 (i.e. these A[alpha]; try it).

If today's update doesn't work the way you need, posting a concrete example as the other times will facilitate helping you filling the gaps or developing the functionality missing if any. Thanks.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Alejandro Jakubi 

I guess I've been unclear. The hybrid approach I am suggesting does not introduce any local nor it does any conversion, nor it requires tools for that. It works around evaluation levels instead: if m := n; and n := r; then eval(m, 1) gives n, eval(m, 2) gives r.

Taking this into account you can recursively strip (evaluate one level at a time each part of) an expression until a condition is reached, for example until the dummy is of type name - say then equal to j - and next you can recursively strip each part of the summand to the end or until you find j, and if you find it, stop evaluating that part. And in this way you never evaluate the summation index furthermore, while you perform a full evaluation of everything else in the summand. This is the way add works, a very nice model in my opinion, and is entirely different than the full evaluation performed by sum on all of its arguments - leading to some unexpected results as we frequently see posted. In brief, in this approach the match between the dummy index and its occurrences within the summand happens naturally, without introducing any local variables nor things of the like but through a careful manipulation of evaluation levels within the summand and summation variable.

To the side, a technicality but perhaps also a curiosity for whoever is reading this, it is true that add is a kernel command and does this stripping in a way that is not accessible from the library. But the Maple programming language is sophisticated enough to permit emulating this stripping very^very fast. I wrote a routine for that purpose when writing the assuming command, that strips expressions the same way until variables that are going to receive assumptions are found; think now of the summation to be performed and the dummy variable - the stripping requirement is basically the same, with the dummy being equivalent to the variables that are going to receive assumptions.

Yes, this approach, besides being simple and using a well tested routine at its core (the assuming routines have thousands^n hours of use), it also allows for a rapid prototyping: this first version shows 30 lines in showstat, and that includes interface, error messages, etc. The result: Physics:-Library:-Add, that is only a wrapping around sum, that handles the arguments such that the summation is performed free of the evaluation problems you have if you call sum directly. It works really nice.

Anyway I will welcome your suggestions or criticism around the concrete thing, next week, when you will have the opportunity to try it.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

The prototype is ready. It will be included in the next update of Physics distributed in the Maplesoft's Physics Updates page next week.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

The prototype is ready. It will be included in the next update of Physics distributed in the Maplesoft's Physics Updates page next week.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Alejandro Jakubi 

I do not understand precisely what you are saying. I wrote this post not suggesting a local dummy approach. There is no particular set of tools necessary to implement what I suggested. The evaluation model is the one of add, but without the restrictions of add, and using the summation code within sum while not suffering of the evaluation problems of sum (see recent posts about these problems here in Mapleprimes).

The prototype is ready. It will be included in the next update of Physics distributed in Maplesoft's Physics Updates webpage next week.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Carl Love 

Two problems get mixed in the example of this post, and one of them is indeed a bug.

 

Recalling, the example is

g := proc (i) if i = 1 then a else 0 end if end proc:

where

g(i), g(1)

0, a

(1)

the post asks about the rationale of this result

sum(g(i), i = 0 .. f)

0

(2)

There are reasons to think that the above is not a good design, but given the design, the result has its logic, as you Carl pointed out: g(i) is evaluated before the sum is performed, and so i = 'i' (has no value within the summation range) then g(i) returns 0, and so sum(0, i=0..f) is of course 0.

 

But then it somehow escaped the radar that, for this other input, where g(i) is not evaluated, sum also returns 0

 

sum('g(i)', i = 0 .. f)

0

(3)

Obviously this other result cannot be attributed to evaluating g(i) before performing the sum. The result above is actually due to a bug in RationalNormalForms:-IsHypergeometricTerm that concludes, that g(i) is a hypergeometric term - you see that debugging it and performing the sum again, to see the computational flow go through it, or directly via

debug(g)

g

(4)

RationalNormalForms:-IsHypergeometricTerm('g(i)', i)

{--> enter g, args = i+1

 

0

 

<-- exit g (now in SumTools:-Hypergeometric:-IsHypergeometricTerm) = 0}

 

true

(5)

and therefore, no matter how you handle the arguments in sum, this sum will always return zero. This problem in RationalNormalForms:-IsHypergeometricTerm is to be fixed.

 


Download IsHypergeometricTerm.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Carl Love 

Two problems get mixed in the example of this post, and one of them is indeed a bug.

 

Recalling, the example is

g := proc (i) if i = 1 then a else 0 end if end proc:

where

g(i), g(1)

0, a

(1)

the post asks about the rationale of this result

sum(g(i), i = 0 .. f)

0

(2)

There are reasons to think that the above is not a good design, but given the design, the result has its logic, as you Carl pointed out: g(i) is evaluated before the sum is performed, and so i = 'i' (has no value within the summation range) then g(i) returns 0, and so sum(0, i=0..f) is of course 0.

 

But then it somehow escaped the radar that, for this other input, where g(i) is not evaluated, sum also returns 0

 

sum('g(i)', i = 0 .. f)

0

(3)

Obviously this other result cannot be attributed to evaluating g(i) before performing the sum. The result above is actually due to a bug in RationalNormalForms:-IsHypergeometricTerm that concludes, that g(i) is a hypergeometric term - you see that debugging it and performing the sum again, to see the computational flow go through it, or directly via

debug(g)

g

(4)

RationalNormalForms:-IsHypergeometricTerm('g(i)', i)

{--> enter g, args = i+1

 

0

 

<-- exit g (now in SumTools:-Hypergeometric:-IsHypergeometricTerm) = 0}

 

true

(5)

and therefore, no matter how you handle the arguments in sum, this sum will always return zero. This problem in RationalNormalForms:-IsHypergeometricTerm is to be fixed.

 


Download IsHypergeometricTerm.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

This has been a week with a number of very interesting developments in Physics regarding quantum mechanics. Among them:

  • The new command for sorting noncommutative products `*` and dot products `.` taking into account algebra (commutation and anticommutation rules set by the user or derived automatically) got enhanced rapidly in connection with people's feedback directly around the distributed updates.
  • New expansion and combination rules of noncommutative powers, products and application of symbolic powers of quantum operators on Kets, as well as combinations and expansions of sum and Sum involving these noncommutative objects and taking assumptions into account.
  • New rules for changing variables in Bras, Kets and Brackets, necessary when working with Projectors and doing manipulations with quantum states in Dirac notation.
  • The handling of annihilation/creation operators got improved in several ways.
  • New routines specialized in simplifying products of annihilation/creation operators.

Thanks to everybody that provided so valuable feedback here in Maplerimes and directly to physics@maplesoft.com.

Below is an exerpt of the changes that happened after Sep/9 as they appear illustrated in the PhysicsUpdates.mw distributed together with the update of Physics.

Edgardo S. Cheb-Terrab 
Physics, Maplesoft

Physics:-Version()

"/Users/ecterrab/Maple/lib/Physics.mla", `2013, September 13, 12:27 hours`

(1)

______________________________________________________

September 13

Fix reseting of track_sign variable in the new Library:-SortProducts

Fix behavior when passing and not passing the evaluateexpression optional argument of Library:-SortProducts

Implement change of variables rules for Bra, Ket and Bracket, so that PDEtools:-dchange can change variables on them.

 

restart; with(Physics); with(Library); Setup(mathematicalnotation = true, anticommutativeprefix = psi)

[anticommutativeprefix = {_lambda, psi}, mathematicalnotation = true]

(2)

for i to 4 do ap[i] := Creation(psi, i, notation = explicit); am[i] := Annihilation(psi, i, notation = explicit) end do

Consider the expression and the ordering ApAm1

z := A*ap[2].am[2].ap[1].am[1]+B*ap[1].am[1].ap[2].am[2]+C*ap[3].am[3].ap[4].am[4]

A*Physics:-`.`(`a+`[psi[2]], Physics:-`.`(`a-`[psi[2]], Physics:-`.`(`a+`[psi[1]], `a-`[psi[1]])))+B*Physics:-`.`(`a+`[psi[1]], Physics:-`.`(`a-`[psi[1]], Physics:-`.`(`a+`[psi[2]], `a-`[psi[2]])))+C*Physics:-`.`(`a+`[psi[3]], Physics:-`.`(`a-`[psi[3]], Physics:-`.`(`a+`[psi[4]], `a-`[psi[4]])))

(3)

ApAm1 := [seq(ap[j], j = 1 .. 4), seq(am[j], j = 1 .. 4)]

[`a+`[psi[1]], `a+`[psi[2]], `a+`[psi[3]], `a+`[psi[4]], `a-`[psi[1]], `a-`[psi[2]], `a-`[psi[3]], `a-`[psi[4]]]

(4)

Compare the behavior with and without the evaluateexpression optional argument

SortProducts(z, ApAm1, useanticommutator)

-A*Physics:-`.`(`a+`[psi[1]], `a+`[psi[2]], `a-`[psi[1]], `a-`[psi[2]])-B*Physics:-`.`(`a+`[psi[1]], `a+`[psi[2]], `a-`[psi[1]], `a-`[psi[2]])-C*Physics:-`.`(`a+`[psi[3]], `a+`[psi[4]], `a-`[psi[3]], `a-`[psi[4]])

(5)

SortProducts(z, ApAm1, useanticommutator, evaluateexpression)

-A*Physics:-`.`(`a+`[psi[1]], Physics:-`.`(`a+`[psi[2]], Physics:-`.`(`a-`[psi[1]], `a-`[psi[2]])))-B*Physics:-`.`(`a+`[psi[1]], Physics:-`.`(`a+`[psi[2]], Physics:-`.`(`a-`[psi[1]], `a-`[psi[2]])))-C*Physics:-`.`(`a+`[psi[3]], Physics:-`.`(`a+`[psi[4]], Physics:-`.`(`a-`[psi[3]], `a-`[psi[4]])))

(6)

Both can be handled via simplify/size

simplify(%, size)

(-A-B)*Physics:-`.`(`a+`[psi[1]], Physics:-`.`(`a+`[psi[2]], Physics:-`.`(`a-`[psi[1]], `a-`[psi[2]])))-C*Physics:-`.`(`a+`[psi[3]], Physics:-`.`(`a+`[psi[4]], Physics:-`.`(`a-`[psi[3]], `a-`[psi[4]])))

(7)

Sorting using commutator leads to the same result

SortProducts(z, ApAm1, usecommutator, evaluateexpression)

-A*Physics:-`.`(`a+`[psi[1]], Physics:-`.`(`a+`[psi[2]], Physics:-`.`(`a-`[psi[1]], `a-`[psi[2]])))-B*Physics:-`.`(`a+`[psi[1]], Physics:-`.`(`a+`[psi[2]], Physics:-`.`(`a-`[psi[1]], `a-`[psi[2]])))-C*Physics:-`.`(`a+`[psi[3]], Physics:-`.`(`a+`[psi[4]], Physics:-`.`(`a-`[psi[3]], `a-`[psi[4]])))

(8)

evalb(`%%%` = %)

true

(9)

Change of variables in Kets

Setup(quantumoperators = {A, B})

[quantumoperators = {A, B}]

(10)

Sum(f(n)*alpha^(n-1)*Ket(A, n-1)/sqrt(factorial(n-1)), n = 1 .. p+1)

Sum(f(n)*alpha^(n-1)*Physics:-Ket(A, n-1)/factorial(n-1)^(1/2), n = 1 .. p+1)

(11)

PDEtools:-dchange({n = k+1, f(n) = g(k)}, Sum(f(n)*alpha^(n-1)*Physics:-Ket(A, n-1)/factorial(n-1)^(1/2), n = 1 .. p+1))

Sum(g(k)*alpha^k*Physics:-Ket(A, k)/factorial(k)^(1/2), k = 0 .. p)

(12)

NULL

______________________________________________________

September 12

* Large number of adjustments in the new Library:-SortProducts to:
a) handle products `*` and `.` in equal footing
b) address the case where the introduction of a Commutator(A, B) ends executed and reintroduces products with the ordering A B that we want expressed as B A. Basically, in these cases return using %Commutator, unevaluated. Ditto for Anticommutator(A, B) situations. Also move constant factors in the output outside of noncommutative producs `*` or `.`

 

* Refinements in the new subroutine to simplify products of annihilation/creation operators so that constant factors are put outside of noncommutative products

 

______________________________________________________

September 11

 

* Implement, within Physics:-Expand, that the expansions of summands and integrands are performed automatically taking into account the assumptions implicit in the summation and integration ranges.

* Add a new Physics:-Library:-ApplyCommandUsingImplicitAssumptions command that applies a command to expressions involving sums and integrals such that the application of the command to the summands and integrands is performed taking into account the assumptions implicit in the summation and integration ranges.

* Implement in the `expand/^` that (A B C)^k is expanded into (A B)^k C^k whenever C commutes with A B, even if none of A, B and C are commutative (they may commute through user-defined algebra rules)

 

restart; with(Physics)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(13)

ap := Creation(A)

`a+`

(14)

Previous improvement:

`assuming`([Expand((alpha*ap)^k)], [k, nonnegint])

alpha^k*Physics:-`^`(`a+`, k)

(15)

Now, assuming will not place assumptions in summation or integration variables as explained in ? assuming . There is good reason for that: allowing to place assumptions could easily corrupt the result by sum, int, etc.

 

On the other hand, simplifying, expanding, or combining, the summand (integrand,etc) taking into account the assumptions implicit in the range  of the sum (int, product, etc) is a valid operation, desired in many situations. For this purpose, simplify takes automatic care of that, and the same does combine, but not expand which is a Maple kernel command ... and neither was Physics:-Expand.

 

So this got resolved by adding the functionality to Physics:-Expand , so that together with simplify and combine the three now automatically take into account assumptions implicit in the summation (integration, etc) range: in this example, k is a nonnegative integer, so the power within the sum can be expanded taking that information into account

Expand(sum((alpha*ap)^k/factorial(k), k = 0 .. infinity))

sum(alpha^k*Physics:-`^`(`a+`, k)/factorial(k), k = 0 .. infinity)

(16)

So,

Expand(sum(((alpha*ap)^k.Ket(A, 0))/factorial(k), k = 0 .. infinity))

sum(alpha^k*Physics:-Ket(A, k)/factorial(k)^(1/2), k = 0 .. infinity)

(17)

This operation is performed within Expand using the new Library:-ApplyCommandUsingImplicitAssumptions command, as in

Library:-ApplyCommandUsingImplicitAssumptions(expand, sum((alpha*ap)^k, k = 0 .. infinity))

sum(alpha^k*Physics:-`^`(`a+`, k), k = 0 .. infinity)

(18)

This new command Library:-ApplyCommandUsingImplicitAssumptions can be use with any Maple command as first argument, not just expand.

 

combine:

`assuming`([combine(alpha^k*ap^k)], [k, nonnegint])

Physics:-`^`(alpha*`a+`, k)

(19)

Recalling that assuming does not place assumptions on dummy variables, we have combine doing that by itself: in this example the powers can be combined because k is the summation variable, a nonnegative integer:

combine(sum(alpha^k*ap^k/factorial(k), k = 0 .. infinity))

sum(Physics:-`^`(alpha*`a+`, k)/factorial(k), k = 0 .. infinity)

(20)

Expansions of powers where the base involves noncommutative operands that however commute between themselves:

Setup(quantumoperators = {A, B}, %Commutator(A, B) = 0)

[algebrarules = {%Commutator(A, B) = 0}, quantumoperators = {A, B}]

(21)

`assuming`([expand((A*B)^k)], [k::nonnegint])

Physics:-`*`(Physics:-`^`(A, k), Physics:-`^`(B, k))

(22)

NULL

______________________________________________________

September 10

* Improvement: combine can now combine nested composite sums when the summation dummies are in reversed order

* Fix in Library:ToTensorInternalRepresentation

* Improvement in Simplify with regards to "algebra rules & sums" in the presence of nested composite sums

* Fix in simplification of products of annihilation/creation operators with 'notation = explicit'

* Implement abstract powers (ap or am)^k . K = formula when ap or am are creation/annihilation operators that act on several quantum numbers at the same time

 

restart; with(Physics)

Setup(mathematicalnotation = true, quantumoperators = {a}, algebrarules = {%Commutator(a[n], a[p]) = 0, %Commutator(a[n], %Dagger(a[p])) = KroneckerDelta[n, p]});

[algebrarules = {%Commutator(a[n], a[p]) = 0, %Commutator(a[n], %Dagger(a[p])) = Physics:-KroneckerDelta[n, p]}, mathematicalnotation = true, quantumoperators = {a}]

(23)

C := sum(sum(-Physics:-`*`(Physics:-`*`(conjugate(phi[p](s)), phi[n](r)), Physics:-`*`(a[n], Dagger(a[p]))-KroneckerDelta[n, p]), p = -infinity .. infinity), n = -infinity .. infinity)+sum(sum(Physics:-`*`(Physics:-`*`(Physics:-`*`(phi[n](r), conjugate(phi[p](s))), a[n]), Dagger(a[p])), p = -infinity .. infinity), n = -infinity .. infinity)

sum(sum(-conjugate(phi[p](s))*phi[n](r)*(Physics:-`*`(a[n], Physics:-Dagger(a[p]))-Physics:-KroneckerDelta[n, p]), p = -infinity .. infinity), n = -infinity .. infinity)+sum(sum(conjugate(phi[p](s))*phi[n](r)*Physics:-`*`(a[n], Physics:-Dagger(a[p])), p = -infinity .. infinity), n = -infinity .. infinity)

(24)

As before these changes, combine can combine these nested composite sums when the summation dummies spontaneously appear in the same order

combine(C)

sum(sum(-conjugate(phi[p](s))*phi[n](r)*(Physics:-`*`(a[n], Physics:-Dagger(a[p]))-Physics:-KroneckerDelta[n, p])+conjugate(phi[p](s))*phi[n](r)*Physics:-`*`(a[n], Physics:-Dagger(a[p])), p = -infinity .. infinity), n = -infinity .. infinity)

(25)

The Physics:-Simplify, and through it also Maple's simplify,  can now simplify this sum including the KroneckerDelta in it

Simplify(C)

sum(phi[n](r)*conjugate(phi[n](s)), n = -infinity .. infinity)

(26)

simplify(C)

sum(phi[n](r)*conjugate(phi[n](s)), n = -infinity .. infinity)

(27)

Reverse now the summation dummies

C2 := sum(sum(-Physics:-`*`(Physics:-`*`(conjugate(phi[p](s)), phi[n](r)), Physics:-`*`(a[n], Dagger(a[p]))-KroneckerDelta[n, p]), n = -infinity .. infinity), p = -infinity .. infinity)+sum(sum(Physics:-`*`(Physics:-`*`(Physics:-`*`(phi[n](r), conjugate(phi[p](s))), a[n]), Dagger(a[p])), p = -infinity .. infinity), n = -infinity .. infinity)

sum(sum(-conjugate(phi[p](s))*phi[n](r)*(Physics:-`*`(a[n], Physics:-Dagger(a[p]))-Physics:-KroneckerDelta[n, p]), n = -infinity .. infinity), p = -infinity .. infinity)+sum(sum(conjugate(phi[p](s))*phi[n](r)*Physics:-`*`(a[n], Physics:-Dagger(a[p])), p = -infinity .. infinity), n = -infinity .. infinity)

(28)

New: combine now handles well the problem of different ordering in the summation dummies

combine(C2)

sum(sum(-conjugate(phi[p](s))*phi[n](r)*(Physics:-`*`(a[n], Physics:-Dagger(a[p]))-Physics:-KroneckerDelta[n, p])+conjugate(phi[p](s))*phi[n](r)*Physics:-`*`(a[n], Physics:-Dagger(a[p])), n = -infinity .. infinity), p = -infinity .. infinity)

(29)

Physics:-Simplify also handles well the apparent obstacle

Simplify(C2)

sum(conjugate(phi[p](s))*phi[p](r), p = -infinity .. infinity)

(30)

Note that in this case the standard Maple simplify has an issue (not related to the Physics package) and still fails simplifying the expression.

simplify(C2)

sum(-conjugate(phi[_a](s))*(sum(phi[n](r)*Physics:-`*`(a[n], Physics:-Dagger(a[_a])), n = -infinity .. infinity))+conjugate(phi[_a](s))*phi[_a](r)+phi[_a](r)*(sum(conjugate(phi[p](s))*Physics:-`*`(a[_a], Physics:-Dagger(a[p])), p = -infinity .. infinity)), _a = -infinity .. infinity)

(31)

Regarding annihilation/creation operators for fermionic particles when using 'notation = explicit'

Setup(anticommutativeprefix = psi)

[anticommutativeprefix = {_lambda, psi}]

(32)

am := Annihilation(psi, 1, 2, notation = explicit)

`a-`[psi[1, 2]]

(33)

ap := Creation(psi, 1, 2, notation = explicit)

`a+`[psi[1, 2]]

(34)

N := Typesetting:-delayDotProduct(ap, am)

Physics:-`.`(`a+`[psi[1, 2]], `a-`[psi[1, 2]])

(35)

Simplify(am^2)

0

(36)

Simplify(ap^2)

0

(37)

N.N.N

Physics:-`.`(`a+`[psi[1, 2]], Physics:-`.`(`a-`[psi[1, 2]], Physics:-`.`(`a+`[psi[1, 2]], Physics:-`.`(`a-`[psi[1, 2]], Physics:-`.`(`a+`[psi[1, 2]], `a-`[psi[1, 2]])))))

(38)

Simplify(%)

Physics:-`.`(`a+`[psi[1, 2]], `a-`[psi[1, 2]])

(39)

Abstract powers of annihilation/creation operators acting on several quantum numbers at the same time

Setup(redo, op = A)

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

 

[quantumoperators = {A}]

(40)

am, ap, K := Annihilation(A, 1, 2, notation = explicit), Creation(A, 1, 2, notation = explicit), Ket(A, m, n);

`a-`[A[1, 2]], `a+`[A[1, 2]], Physics:-Ket(A, m, n)

(41)

am.K

m^(1/2)*n^(1/2)*Physics:-Ket(A, m-1, n-1)

(42)

ap.K

(1+m)^(1/2)*(n+1)^(1/2)*Physics:-Ket(A, 1+m, n+1)

(43)

Parse:-ConvertTo1D, "invalid input %1", am^k.K

(factorial(m)/factorial(m-k))^(1/2)*(factorial(n)/factorial(n-k))^(1/2)*Physics:-Ket(A, m-k, n-k)

(44)

Parse:-ConvertTo1D, "invalid input %1", ap^k.K

(factorial(m+k)/factorial(m))^(1/2)*(factorial(n+k)/factorial(n))^(1/2)*Physics:-Ket(A, m+k, n+k)

(45)


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

Download UpdateWeekSep13.mw

@Andriy 

Hi, no embarrasement at all, we all make mistakes, and in fact you are correct, there is a bug in the last extension of the SortProducts code introduced yesterday (a variable that keeps track of sign gets incorrectly resetted), the expected for the second term of z starts with minus as you say. I'll be posting another update tomorrow fixing this problem together with some other changes.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

Hi, no embarrasement at all, we all make mistakes, and in fact you are correct, there is a bug in the last extension of the SortProducts code introduced yesterday (a variable that keeps track of sign gets incorrectly resetted), the expected for the second term of z starts with minus as you say. I'll be posting another update tomorrow fixing this problem together with some other changes.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Alejandro Jakubi 

You have ee :=f(j); then you want sum(ee, j=1..3). That is one of the most frequent computations/scenarios.It wouldn't work with what you suggeest, with the summation index being a local. If you revise the original post where this problem was presented, a summation with a local dummy was also attempted - it was of no use for this same reason just mentioned.

What you see in seq and add, on the other hand, is actually a hybrid: the summand ee has a global j, and add, seq, mul, matches it to the summation index which in turn is not a global. What I am suggesting (original post) is precisely that hybrid model (so neither a global as sum uses, nor a local as you suggest), and with the summation knowledge of sum including accepting symbolic summation ranges, instead of the rudimentary knowledge of add and its error interruptions with symbolic ranges.

Edgardo S. Cheb-Terrab
Physics, Maplesoft.
Ps: very happy :)

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