ecterrab

13431 Reputation

24 Badges

19 years, 363 days

MaplePrimes Activity


These are replies submitted by ecterrab

@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

@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

@Andriy 

The summation variable cannot be assigned and this is not related to the Physics package but to how Maple works. For example, in a fresh session, try 

> G := sum(g(i), i = 1 .. f);

> i := 7;

> G; 

Error, (in sum) summation variable previously assigned, second argument evaluates to 7 = 1 .. f 

And there is no way around. Note that this is true for sum, int, limit, series, etc.

Independent of that, in your original post you also asked about a simplification N^k = N, where k is a positive integer, N = ap . am is the occupation number operator and am and ap are respectively annihilation and creation operators of fermionic particles. That simplification was missing. It is implemented now and available in the update of the Physics package just posted (today Aug/5) in the Maple Physics: Research & Development updates page. So with the updated library you have

Physics:-Version()

(1)
Note that Physics loads by default with one anticommutative prefix already defined

with(Physics):

Setup(anticommutativeprefix)

[anticommutativeprefix = {_lambda}]

(2)
Set ap, am and N

ap := Creation(_lambda):

Take a power of N

N^4

Physics:-`^`(Physics:-`.`(`a+`, `a-`), 4)

(3)

Simplify(%)

Physics:-`.`(`a+`, `a-`)

 

This simplification then also works with the nn operators of your post when i, j and sigma are numbers so that the am and ap behind nn are visible.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 

The summation variable cannot be assigned and this is not related to the Physics package but to how Maple works. For example, in a fresh session, try 

> G := sum(g(i), i = 1 .. f);

> i := 7;

> G; 

Error, (in sum) summation variable previously assigned, second argument evaluates to 7 = 1 .. f 

And there is no way around. Note that this is true for sum, int, limit, series, etc.

Independent of that, in your original post you also asked about a simplification N^k = N, where k is a positive integer, N = ap . am is the occupation number operator and am and ap are respectively annihilation and creation operators of fermionic particles. That simplification was missing. It is implemented now and available in the update of the Physics package just posted (today Aug/5) in the Maple Physics: Research & Development updates page. So with the updated library you have

Physics:-Version()

(1)
Note that Physics loads by default with one anticommutative prefix already defined

with(Physics):

Setup(anticommutativeprefix)

[anticommutativeprefix = {_lambda}]

(2)
Set ap, am and N

ap := Creation(_lambda):

Take a power of N

N^4

Physics:-`^`(Physics:-`.`(`a+`, `a-`), 4)

(3)

Simplify(%)

Physics:-`.`(`a+`, `a-`)

 

This simplification then also works with the nn operators of your post when i, j and sigma are numbers so that the am and ap behind nn are visible.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@itsme 

You are right - I made a mistake in the input. It is corrected now in the mw just updated.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Andriy 
This one got fixed June 19, that is after 17.01. The fix should appear in the next (dot or full) release.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

@Mac Dude 

4-vectors are tensors with 1 index. As with tensors in general, within the Physics package, you define them using the Define command (also Setup(tensors = {...}) works). So the place to look for this is ?Physics[Define].

Independent of that, a "SpaceTimeVector related to a coordinate system" is automatically set each time you define a coordinate system using the Coordinates command. So the details for this are found in ?Physics[Coordinates] and ?Physics[SpaceTimeVector]

You can see these things at work in the section for "Tensors in Special and General Relativity" of the ?Physics[examples] page. It is a short section that starts with spacetime 4-vectors and the basic manipulations in special relativity, followed by how you set a curved spacetime and work with the same 4-vectors and the general relativity tensors related to having non-zero Christoffel symbols and covariant derivatives. 

Some more for 4-vectors in flat and curved spacetimes is found in ?Physics[Geodesics].

If all this doesn't answer your question or the existing functionality is not sufficient for your purposes, if you could please tell what computations you have in mind we can help you in filling the gaps.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 

Indeed the bug was in `simplify/sqrt/fraction`. It is fixed now in the version under development. The fix should appear in the next (dot or full) release. 

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Indeed the bug was in `simplify/sqrt/fraction`. It is fixed now in the version under development. The fix should appear in the next (dot or full) release. 

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Maybe you are using the old GUI (so called 'classic' maple interface)? If you could attach a worksheet where you illustrate the problem you are having that could help. Meantime this is what I see in the standard GUI:


with(Physics):

Example with the Schwarzschild metric in spherical coordinates: instead of using Setup (you can, but you do not need to), set the spacetime metric directly from the the metric command g_

g_[sc]

`Systems of spacetime Coordinates are: `*{X = (r, theta, phi, t)}

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (r, theta, phi, t)}

 

`The Schwarzschild metric in coordinates `[r, theta, phi, t]

 

`Parameters: `[m]

 

g[mu, nu] = (Matrix(4, 4, {(1, 1) = r/(-r+2*m), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = -r^2, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -r^2*sin(theta)^2, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = (r-2*m)/r}))

(1)

The Kretschmann scalar is given by

K := Riemann[alpha, beta, gamma, delta]^2

Physics:-Riemann[alpha, beta, delta, gamma]*Physics:-Riemann[`~alpha`, `~beta`, `~delta`, `~gamma`]

(2)

Simplify(K);

48*m^2/r^6

(3)

Alternatively you can use . to perform multiplication and simplification in one go, as in

K := Typesetting:-delayDotProduct(Riemann[alpha, beta, gamma, delta], Riemann[alpha, beta, gamma, delta])

48*m^2/r^6

(4)

In the above you can also enter the indices of one of the Riemann tensors as contravariant, prefixing them with ~, but you do not need to.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Download KretschmannScalar.mw

Maybe you are using the old GUI (so called 'classic' maple interface)? If you could attach a worksheet where you illustrate the problem you are having that could help. Meantime this is what I see in the standard GUI:


with(Physics):

Example with the Schwarzschild metric in spherical coordinates: instead of using Setup (you can, but you do not need to), set the spacetime metric directly from the the metric command g_

g_[sc]

`Systems of spacetime Coordinates are: `*{X = (r, theta, phi, t)}

 

`Default differentiation variables for d_, D_ and dAlembertian are: `*{X = (r, theta, phi, t)}

 

`The Schwarzschild metric in coordinates `[r, theta, phi, t]

 

`Parameters: `[m]

 

g[mu, nu] = (Matrix(4, 4, {(1, 1) = r/(-r+2*m), (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = -r^2, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -r^2*sin(theta)^2, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = (r-2*m)/r}))

(1)

The Kretschmann scalar is given by

K := Riemann[alpha, beta, gamma, delta]^2

Physics:-Riemann[alpha, beta, delta, gamma]*Physics:-Riemann[`~alpha`, `~beta`, `~delta`, `~gamma`]

(2)

Simplify(K);

48*m^2/r^6

(3)

Alternatively you can use . to perform multiplication and simplification in one go, as in

K := Typesetting:-delayDotProduct(Riemann[alpha, beta, gamma, delta], Riemann[alpha, beta, gamma, delta])

48*m^2/r^6

(4)

In the above you can also enter the indices of one of the Riemann tensors as contravariant, prefixing them with ~, but you do not need to.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Download KretschmannScalar.mw

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