ecterrab

14540 Reputation

24 Badges

20 years, 21 days

MaplePrimes Activity


These are replies submitted by ecterrab

@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 :)

@Carl Love 

There are two main differences between add and sum. First, for symbolic a and b,

> add(f(j, k), j = a .. b);
Error, unable to execute add

sum does not return this error (and for that reason the case of symbolic a, b is not mentioned in the post - that is not the problem). Note also that in the original thread annihilation/creation operators, add got mentioned as a possibility for performing the desired computation and discarded because of this error "unable to execute" the operation.

Second, sum has summation knowledge that goes far beyond adding one term at a time, both regarding definite and indefinite sums, not to mention the handling of formal sums; I skip here the details of all what sum can do and add cannot, presented in ?sum and ?sum,details.

So, no, add is not what we need here.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

First of all, thank you for all your feedback. What you pointed at now is indeed a bug in the new implementation ofthese simplifications. A new updated (number 20) has just been posted in the Maple Physics: Research & Development updates page fixing the problem - with the fix we have:

with(Physics)

Physics:-Version()

(1)

Setup(anticommutativeprefix = psi)

[anticommutativeprefix = {_lambda, psi}]

(2)

The problem was in the use of  notation = explicit

 

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

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

(3)

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

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

(4)

So these new simplifications work fine now also with notation = explicit

Simplify(am^2)

0

(5)

Simplify(ap^2)

0

(6)

The occupation number operator

N := ap.am

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

(7)

This other simplification also works fine now with notation = explicit

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]])))))

(8)

Simplify(%)

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

(9)

Seeing the way you use these operators it also passes through my mind an adjustment, directly in Annihilation and Creation, so that they accept non-numerical quantum-number-positions (the i, j, sigma of your post) returning unevaluated, removing the need of this cumbersome line we added to your nn(i, j, sigma) operators checking that [i, j, sigma] is a list of numbers. Perhaps we have this in place by the end of this week.

Note that today's update also contains severl fixes/improvements all related to quantum mechanics, some of them also related to annihilation/creation operators, described in the PhysicsUpdates.mw distributed within the zip.

 

Download am2_ap2_Nk.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 

@Andriy 

First of all, thank you for all your feedback. What you pointed at now is indeed a bug in the new implementation ofthese simplifications. A new updated (number 20) has just been posted in the Maple Physics: Research & Development updates page fixing the problem - with the fix we have:

with(Physics)

Physics:-Version()

(1)

Setup(anticommutativeprefix = psi)

[anticommutativeprefix = {_lambda, psi}]

(2)

The problem was in the use of  notation = explicit

 

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

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

(3)

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

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

(4)

So these new simplifications work fine now also with notation = explicit

Simplify(am^2)

0

(5)

Simplify(ap^2)

0

(6)

The occupation number operator

N := ap.am

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

(7)

This other simplification also works fine now with notation = explicit

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]])))))

(8)

Simplify(%)

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

(9)

Seeing the way you use these operators it also passes through my mind an adjustment, directly in Annihilation and Creation, so that they accept non-numerical quantum-number-positions (the i, j, sigma of your post) returning unevaluated, removing the need of this cumbersome line we added to your nn(i, j, sigma) operators checking that [i, j, sigma] is a list of numbers. Perhaps we have this in place by the end of this week.

Note that today's update also contains severl fixes/improvements all related to quantum mechanics, some of them also related to annihilation/creation operators, described in the PhysicsUpdates.mw distributed within the zip.

 

Download am2_ap2_Nk.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 

Hi

Just revising the Mapleprimes posts regarding the Physics package of the last 12 months. Besides some new interesting developments in connection with feedback by people using the package, the updated Physics downloadable from the Maplesoft "Maple Physics: Research & Development" webpage addresses the issues mentioned in the following Mapleprimes posts:

http://www.mapleprimes.com/questions/151320-Creation-And-Annihilation-Operators

http://www.mapleprimes.com/questions/151305-Evaluationsimplification-Of-Vector

http://www.mapleprimes.com/questions/149929-Types-In-The-Physics-Package


http://www.mapleprimes.com/questions/149012-Orthonormality-Issue-With-Bras-And-Kets


http://www.mapleprimes.com/questions/150378-Can-Maple-Handle-Dummy-Indices-Of-Tensors


http://www.mapleprimes.com/questions/148068-Getting-An-Error-With-A-Commutatoralgebra-Rule


http://www.mapleprimes.com/questions/142132-Is-There-A-Way-To-Get-The-Correct-Solution


http://www.mapleprimes.com/questions/129549-Fundiff-With-Anticommuting-Functions


http://www.mapleprimes.com/questions/120244-How-Do-I-Define-Commutators-Of-Operators

 

This novelty of distributing Physics updates around the clock is thus resulting in a very interesting twist, with Physics now partly developed directly around user's feedback with echo in a couple of days instead of the next release, when a fix one-year-after is frequently of no direct use.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

Regarding your question 1): The workaround you suggest is not really a workaround: the step from (17) to (18) from the worksheet attached in my first reply won't work anymore, as you noticed, because the i within nn_operands is now a local variable (you declared it that way in your workaround) while the in i = 1..2 in seq(nn_operands, i = 1..2) is a global variable. For the seq to proceed logically, these two i need to be the same.

Now, there are good reasons for not allowing assigning the summation dummy. Do you have a motivation for assigning it? Or is it only curiosity about how things work?

Regarding your question 2) on am2: enter, at the maple prompt, 

> am2;
                      am2

So, you see am2, not its contents. Now, am2 has not been declared as a quantum operator, then type(am2, Library:-PhysicsType:-ExtendedQuantumOperator); returns false. This is expected, the type doesn't scan the body of a procedure.

In connection you also quoted a sentence from the worksheet I posted: that sentence I wrote refers to am2 applied to arguments i, j, sigma, as in am2(i, j, sigma), and not to an unapplied am2 as you show.

Recalling: when the arguments passed, i, j, sigma, are numbers, the annihilation/creation operators are visible in the output of am2(i, j, sigma), and so the PhysicsType will recognized the construction as a quantum operator. If you do not apply am2, the annihilation/creation operators are not visible in the output of unapplied am2, so in order to have am2 recognized as an operator you need to set it as such using Setup. This same answer is the answer to your other question about N.

The logic of all this is understandable: a sum or product of quantum operators is a quantum operator. Enter the object at the Maple prompt, see what comes out: if the output shows quantum operators or a sum or product of them, PhysicsType will recognize the object as an operator. Otherwise, set the object as an operator using Setup (say as in Setup(op = {am, N, ..})) and that will suffice.

Regarding your question 3) to simplify N^k = N in these cases of fermionic occupation number operators, note that in my reply to you I used Simplify, from the Physics package (check ?Physics,Simplify), not simplify. Try Simplify - it works fine. Also, the simplification implemented  N^k = N applies to N = ap . am, and not to am^2 as you show - that would be another simplification to implement: am^2 = 0, likely: ap^2 = 0; I will see if we can have these other two in place as well in the next update this week.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

First 54 55 56 57 58 59 60 Last Page 56 of 64