ecterrab

13431 Reputation

24 Badges

19 years, 357 days

MaplePrimes Activity


These are Posts that have been published by ecterrab

Hi,
Relevant developments in Physics happened during the last month and a 1/2, some of them of interest beyond the use of this package. Among the most exciting things I can mention:

  1. The redefinition of the derivative rule for the complex components (abs, argument, conjugate, Im, Re, signum) together with the introduction of Wirtinger calculus, as an user-option to work with complex variables. In other words: it is now possible to compute taking z and its conjugate as independent variables and in equal footing.
  2. Introduction of textbook mathematical display for all the inert functions of the mathematical language, also for unknown functions f(x).
  3. New options in Physics:-Setup to indicate that some mathematical objects are real (different from assume(x, real), while integrated with `is` and `coulditbe`).
  4. A rather large number of micro developments advancing the integration of Physics with simplify, expand and combine.
  5. Another large number of micro developments for quantum mechanics.
  6. New options in Physics:-Setup to redefine sum as Physics:-Library:-Add, and with that have access to multiindex summation directly from sum, for instance as in sum(f(i, j), i + j <= n), including related typesetting copy & paste.

As usual the latest version of the package is available for download in the Maplesoft Physics: Research & Development webpage  and in the zip there is a worksheet illustrating all these developments. Below I'm copying the section related to the new redefinesum option of Physics:-Setup and multiindex summation.

Thanks to everyone who provided feedback, it has been of great value and at the root of this new round of developments.

December 4

 
• 

New option in Setup: redefinesum, so that the sum command is redefined in such a way that
    a) the sum arguments are processed in a way avoiding premature evaluation and related unexpected results or error interruptions
    b) the sum command includes new functionality present in Physics:-Library:-Add to perform sum over integer values of many indices, as in

"(&sum;)S(i,j)"     or  "(&sum;)S(i,j)" 

restart; with(Physics); Setup(notation = true)

`* Partial match of  'notation' against keyword 'mathematicalnotation'`

 

[mathematicalnotation = true]

(1.1)

New option: redefine sum so that its arguments are processed by the more modern Physics:-Library:-Add and so that it can perform multiindice summation.

 

Example:

By default, the sum command is not redefined, so the value of redefinesum is

Setup(redefinesum)

[redefinesum = false]

(1.2)

Consider this multiindex summation functionality of the Physics:-Library:-Add command

Library:-Add(f[i, j], 1 <= i+j and i+j <= n)

Physics:-Library:-Add(f[i, j], i+j <= n, lowerbound = 1)

(1.3)

For instance, for n = 2,

eval(Physics[Library]:-Add(f[i, j], i+j <= n, lowerbound = 1), n = 2)

f[0, 1]+f[1, 0]+f[0, 2]+f[1, 1]+f[2, 0]

(1.4)

This functionality can be plugged directly into the sum command. For that purpose, set redefinesum to true

Setup(redefinesum = true)

[redefinesum = true]

(1.5)

You can now compute directly with sum. The left-hand side is inert while the right-hand side is computed

(%sum = sum)(f[i, j], i+j <= 2)

%sum(f[i, j], i+j <= 2) = f[0, 0]+f[0, 1]+f[1, 0]+f[0, 2]+f[1, 1]+f[2, 0]

(1.6)

(%sum = sum)(f[i, j], 1 <= i+j and i+j <= 2)

%sum(f[i, j], 1 <= i+j and i+j <= 2) = f[0, 1]+f[1, 0]+f[0, 2]+f[1, 1]+f[2, 0]

(1.7)

value(%sum(f[i, j], 1 <= i+j and i+j <= 2) = f[0, 1]+f[1, 0]+f[0, 2]+f[1, 1]+f[2, 0])

f[0, 1]+f[1, 0]+f[0, 2]+f[1, 1]+f[2, 0] = f[0, 1]+f[1, 0]+f[0, 2]+f[1, 1]+f[2, 0]

(1.8)

The formula for the integer power of a sum

(a+b+c)^n = sum(factorial(n)*a^p*b^q*c^r/(factorial(p)*factorial(q)*factorial(r)), p+q+r = n)

(a+b+c)^n = sum(Physics:-`*`(Physics:-`*`(Physics:-`*`(Physics:-`*`(factorial(n), Physics:-`*`(1, Physics:-`^`(Physics:-`*`(Physics:-`*`(factorial(p), factorial(q)), factorial(r)), -1))), Physics:-`^`(a, p)), Physics:-`^`(b, q)), Physics:-`^`(c, r)), p+q+r = n)

(1.9)

eval((a+b+c)^n = sum(Physics[`*`](Physics[`*`](Physics[`*`](Physics[`*`](factorial(n), Physics[`*`](1, Physics[`^`](Physics[`*`](Physics[`*`](factorial(p), factorial(q)), factorial(r)), -1))), Physics[`^`](a, p)), Physics[`^`](b, q)), Physics[`^`](c, r)), p+q+r = n), n = 2)

(a+b+c)^2 = a^2+2*a*b+2*a*c+b^2+2*b*c+c^2

(1.10)

eval((a+b+c)^n = sum(Physics[`*`](Physics[`*`](Physics[`*`](Physics[`*`](factorial(n), Physics[`*`](1, Physics[`^`](Physics[`*`](Physics[`*`](factorial(p), factorial(q)), factorial(r)), -1))), Physics[`^`](a, p)), Physics[`^`](b, q)), Physics[`^`](c, r)), p+q+r = n), n = 3)

(a+b+c)^3 = a^3+3*a^2*b+3*a^2*c+3*a*b^2+6*a*b*c+3*a*c^2+b^3+3*b^2*c+3*b*c^2+c^3

(1.11)

Verify whether this equation is true

(`@`(evalb, expand))((a+b+c)^3 = a^3+3*a^2*b+3*a^2*c+3*a*b^2+6*a*b*c+3*a*c^2+b^3+3*b^2*c+3*b*c^2+c^3)

true

(1.12)

Besides this new functionality, the redefined sum does a more modern handling of its arguments, consider a typical problem posted in Maple primes

a := 1; b := 2; j := 3

1

 

2

 

3

(1.13)

In the following summation, j is a dummy summation index, so the value just assigned, j := 3, is not expected to interfer with the summation. This is the case with the redefined sum

sum(f(j), j = a .. b)

f(1)+f(2)

(1.14)

while without redefining sum the input above is interrupted with an error message. Likely, in this other case also reported in Mapleprimes

g := proc (j) options operator, arrow; if j::odd then G[j] else 0 end if end proc

proc (j) options operator, arrow; if j::odd then G[j] else 0 end if end proc

(1.15)

the following two summations can be performed after having redefining sum:

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

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

(1.16)

For the summation above, without redefining sum, it returns 0 instead of unevaluated, because of a premature evaluation of the function g(i) with an unassigned index i before performing the summation. Returning unevaluated as (1.16) permits evaluate the sum at a latter moment, for instance attributing a value to f

eval(sum(g(i), i = 1 .. f), f = 3)

G[1]+G[3]

(1.17)

And this other sum where f is given from the begining also returns 0 without redefining sum

sum(g(i), i = 1 .. 3)

G[1]+G[3]

(1.18)

Problems like this other one reported in Mapleprimes here also get resolved with this redefinition of sum.

 

 

Download sum_in_physics.mw

Edgardo S. Cheb-Terrab
Physics, Maplesoft

 

The attached presentation is the first one of a sequence of three that we wanted to do on Quantum Mechanics using Computer Algebra. The level is that of an advanced undergraduate QM course. Tackling this topic within a computer algebra worksheet in the way it's done below, however, is an entire novelty, and illustrates well the kind of computations that can be done today with Maple & Physics.

Ground state of a quantum system of identical boson particles
  

Pascal Szriftgiser1 and Edgardo S. Cheb-Terrab2 

(1) Laboratoire PhLAM, UMR CNRS 8523, Université Lille 1, F-59655, France

(2) Maplesoft

 

Departing from the Energy of a quantum system of identical boson particles, the field equation is derived. This is the Gross-Pitaevskii equation (GPE). A continuity equation for this system is also derived, showing that the velocity flow satisfies `&x`(VectorCalculus[Nabla], `#mover(mi("v"),mo("&rarr;"))`) = 0, i.e.: is irrotational.  

The Gross-Pitaevskii equation

 

NULL


Problem: derive the field equation describing the ground state of a quantum system of identical particles (bosons), that is, the Gross-Pitaevskii equation (GPE).

 

Background: The Gross-Pitaevskii equation is particularly useful to describe Bose Einstein condensates (BEC) of cold atomic gases [3, 4, 5], that is, an ensemble of identical quantum boson particles that interact with each other with an interaction constant G. The temperature of these cold atomic gases is typically in the w100 nano-Kelvin range. The atom-atom interactions are repulsive for G > 0 and attractive for G < 0  (which could lead to some instabilities). The GPE is also widely used in non-linear optics to model the propagation of light in optical fibers. In this area, GPE is known as "non-linear Schrödinger equation", and the non-linearity comes from the Kerr effect [6].

Solution

   

Continuity equation for a quantum system of identical particles

   

References

``

[1] Gross-Pitaevskii equation (wiki)

[2] Continuity equation (wiki)
[3] Bose–Einstein condensate (wiki)

[4] Bose-Einstein Condensation in Dilute Gases, C. J. Pethick and H. Smith, Second Edition, Cambridge (2008), ISBN-13: 978-0521846516.

[5] Advances In Atomic Physics: An Overview, Claude Cohen-Tannoudji and David Guery-Odelin, World Scientific (2011), ISBN-10: 9812774963.

[6] Nonlinear Fiber Optics, Fifth Edition (Optics and Photonics), Govind Agrawal, Academic Press (2012), ISBN-13: 978-0123970237.

 


Downlioad: QuantumMechanics1.mw,    QuantumMechanics1.pdf

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Hi
In connection with recent developments in the Physics package, we now have mathematical typesetting for all the inert functions of the mathematical language. Hey! This is within the Physics update available on the Maplesoft Physics: Research & Development webpage

I think this is an interesting development that will concretely change the computational experience with these functions: it is not the same to compute with something you see displayed as %exp(x) instead of the same computation but flowing with it nicely displayed as an exponential function with the e in grey, reflecting that Maple understands this object as the exponential inert function, with known properties (all those of the active exp function), and so Maple can compute with the inert one taking these properties into account while not executing the function itself - and this is the essence of the inert function behaviour.

Introducing mathematical display, copy and paste for all these inert functions of the mathematical language concretely increases the mathematical expressiveness of the system, for teaching, working and also for presenting ideas.

Attached is a brief illustration.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

InertMathematicalFun.mw  InertMathematicalFun.pdf

Hi
Just finished updating the comparison between Maple 17.02 and Mathematica 9.01 in solving the 1390 Ordinary Differential Equations (ODEs) of Kamke's book:

  • Mathematica solved 80% in 7 hours and 8 minutes
     
  • Maple solved 97.5% in 43 minutes

While trying to solve the whole set, Mathematica hanged with 90 of these ODEs while Maple hanged with 6 ODEs. A pdf with a summarizing table and all the details is linked below

It is also relevant here that Maple's dsolve has close to half of its code implementing more modern methods, not found in Kamke, illustrated in the Maple 'what's new in DEs' help pages of the last 10 releases; for these other kinds of equations the difference is more impressive. I'll see to prepare another post about that.

Edgardo S. Cheb-Terrab
Physics, Maplesoft

Comparison_Kamke.pdf

Hi

It's been 1 and 1/2 months since updates for the Maple Physics package have been distributed in the Maplesoft webpage "Maple Physics: Research & Development".  The number of Mapleprimes Physics posts that got rapidly addressed in this way is already large, some of them are listed here.

The experience has been great. Suggestions are implemented and problems are fixed in a couple of days since they were posted here, and the changes are made available to everybody right away. This is moving the focus of developments into the topics people are actually working on, with feedback and related downloadable updates happening every week.

The recent Physics updates are mostly related to quantum mechanics, an advanced topic, but part of the resulting functionality is interesting for algebraic computations in general. To mention but one: the "automatic combination of products of powers of same base" is now optional.

Recalling, by default, in Maple, if you enter xn xm, in order to receive x(n+m). you need to use the combine command (the same happens with products of exponentials). The idea behind the Maple approach is to give you more control over the steps. On the other hand, depending on your problem, the automatic combination of powers of the same base is a desired automatic simplification - this is for instance the Mathematica approach.

In today's update of Physics, a new Setup option, 'combinepowersofsamebase', is implemented, so that this automatic simplification is now optional. If set to true (> Setup(combine = true))you enter xn xm or exp(A) exp(B) and you respectively receive x(n+m) and exp(A+B). Being able to turn this automatic simplification ON and OFF comes in handy in varied situations.

Those more familiar with noncommutative objects (e.g. Matrices), also know that the combination of exp(A) exp(B) is not valid when the exponents A and B do not commute, unless A and B commute with their commutator AB - BA, in which case the combination can be done using Glauber's formula (also related to Hausdorff's formula). All of these cases have been implemented too.

In summary, in the latest update of Physics the combination and expansion of powers and exponentials using combine and expand now takes into account the noncommutative character of the exponents and the value of their commutator, and there is the option of having this combination happening automatically, for both noncommutative and commutative algebraic objects in general.

Other relevant changes more related to Physics are described in the PhysicsUpdates.mw distributed inside the zip that contains the updated Physics.mla linked in the "Maple Physics: Research & Development" webpage.

First 14 15 16 17 Page 16 of 17