## Different types of 'functions' -

by: Maple 7

Lesson_on_functions.mws

As the title says, a lesson on functions:  eg the -> operator, f(2), eval, evalf etc

## Proof of Miquel's theorem with Maple

by:

This post is devoted to the rigorous proof of Miquel's five circles theorem, which I learned about from this question. The proof is essentially very simple and takes only 15 lines of code. The figure below, in which all the labels coincide with the corresponding names in the code, illustrates the basic ideas of the code. First, we symbolically define common points of intersection of blue circles with a red unit circle  (these parameters  s1 .. s5  are the polar coordinates of these points). All other parameters of this configuration can be expressed through them. Then we find the centers  M  and  N  of two circles. Then we find the coordinates of the point  K  from the condition that  CK  is perpendicular to  MN . Then we find the point  and using the result obtained, we easily find the coordinates  of all the points  A1 .. A5. Then we find the coordinates of the point   P  as the point of intersection of the lines  A1A2  and  A3A4 . Finally, we verify that the point  P  lies on a circle with center at the point  N , which completes the proof.

Below - the code of the proof. Note that the code does not use any special (in particular geometric) packages, only commands from the Maple kernel. I usually try any geometric problems to solve in this style, it is more reliable,  and often shorter.

restart;
t1:=s1/2+s2/2: t2:=s2/2+s3/2:
M:=[cos(t1),sin(t1)]: N:=[cos(t2),sin(t2)]:
C:=[cos(s2),sin(s2)]: K:=(1-t)*~M+t*~N:
CK:=K-C: MN:=M-N:
t0:=simplify(solve(CK[1]*MN[1]+CK[2]*MN[2]=0, t)):
E:=combine(simplify(C+2*eval(CK,t=t0))):
s0:=s5-2*Pi: s6:=s1+2*Pi:
assign(seq(A||i=eval(E,[s2=s||i,s1=s||(i-1),s3=s||(i+1)]), i=1..5)):
Dist:=(p,q)->sqrt((p[1]-q[1])^2+(p[2]-q[2])^2):
LineEq:=(P,Q)->(y-P[2])*(Q[1]-P[1])=(x-P[1])*(Q[2]-P[2]):
Line1:=LineEq(A1,A2):
Line2:=LineEq(A3,A4):
P:=combine(simplify(solve({Line1,Line2},[x,y])))[]:
Circle:=(x-N[1])^2+(y-N[2])^2-Dist(N,C)^2:
is(eval(Circle, P)=0);
# The final result

true

It may seem that this proof is easy to repeat manually. But this is not so. Maple brilliantly coped with very cumbersome trigonometric transformations. Look at the coordinates of point  , expressed through the initial parameters  s1 .. s5 :

simplify(eval([x,y], P));  # The coordinates of the point  P

ProofMiquel.mw

## Heronian triangles in 2D lattice

by:

A few days ago, I drew attention to the question in which OP talked about the generation of triangles in a plane, for which the lengths of all sides, the area and radius of the inscribed circle are integers. In addition, all vertices must have different integer coordinates (6 different integers), the lengths of all sides are different and the triangles should not be rectangular. I prepared the answer to this question, but the question disappeared somewhere, so I designed my answer as a separate post.

The triangles in the plane, for which the lengths of all sides and the area  are integers, are called as Heronian triangles. See this very interesting article in the wiki about such triangles
https://en.wikipedia.org/wiki/Integer_triangle#Heronian_triangles

The procedure finds all triangles (with the fulfillment of all conditions above), for which the lengths of the two sides are in the range  N1 .. N2 . The left side of the range is an optional parameter (by default  N1=5). It is not recommended to take the length of the range more than 100, otherwise the operating time of the procedure will greatly increase. The procedure returns the list in which each triangle is represented by a list of  [list of coordinates of the vertices, area, radius of the inscribed circle, list of lengths of the sides]. Without loss of generality, one vertex coincides with the origin (obviously, by a shift it is easy to place it at any point).

The procedure works as follows: one vertex at the origin, then the other two must lie on circles with integer and different radii  x^2+y^2=r^2. Using  isolve  command, we find all integer points on these circles, and then in the for loops we select the necessary triangles.

 >
 > restart; HeronianTriangles:=proc(N2::posint,N1::posint:=5) local k, r, S, L, Ch, Dist, IsOnline, c, P, p, A, B, C, a, b, s, ABC, cc, s1, T ; uses combinat, geometry; if N2=N1" fi; if N2<34 then return [] fi; k:=0: for r from max(N1,5) to N2 do S:=[isolve(x^2+y^2=r^2)]; if nops(S)>4 then k:=k+1; L[k]:=select(s->s[1]<>0 and s[2]<>0,map(t->rhs~(convert(t,list)), S)); fi; od: L:=convert(L, list): if type(L[1],symbol) then return [] fi; Ch:=combinat:-choose([\$1..nops(L)], 2): Dist:=(A::list,B::list)->simplify(sqrt((A[1]-B[1])^2+(A[2]-B[2])^2)); IsOnline:=(A::list,B::list)->`if`(A[1]*B[2]-A[2]*B[1]=0, true, false); k:=0: for c in Ch do for A in L[c[1]] do for B in L[c[2]] do if not IsOnline(A,B) and nops({A[],B[]})=4 then if type(Dist(A,B),posint) then  k:=k+1; P[k]:=[A,B] fi; fi; od: od: od: P:=convert(P, list): if type(P[1],symbol) then return [] fi; k:=0: for p in P do point('A',0,0), point('B',p[1]), point('C',p[2]); a:=simplify(distance('A','B')); b:=simplify(distance('A','C')); c:=simplify(distance('B','C')); s:=sort([a,b,c]); s1:={a,b,c}; triangle(ABC,['A','B','C']); incircle(cc,ABC); r:=radius(cc); if type(r,integer) and s[3]^2<>s[1]^2+s[2]^2 and nops(s1)=3 then k:=k+1; T[k]:=[[[0,0],p[]],area(ABC),r, [a,b,c]] fi; od: T:=convert(T,list); if type(T[1],symbol) then return [] fi; T; end proc:

Examples of use of the procedure  HeronianTriangles

 > T:=HeronianTriangles(100): # All the Geronian triangles, whose lengths of two sides do not exceed 100 nops(T);
 (1)
 > Tp:=select(p->p[1,2,1]>0 and p[1,2,2]>0 and p[1,3,1]>0 and p[1,3,2]>0, T);
 (2)
 > Tr:=map(p->p+[2,1],Tp[1,1]); with(geometry): point(A,Tr[1]), point(B,Tr[2]), point(C,Tr[3]): triangle(ABC,[A,B,C]): simplify(distance(A,B)), simplify(distance(A,C)), simplify(distance(B,C)); local O: incircle(c,ABC, centername=O): draw([A,B,C, ABC, c(color=blue)], color=red, thickness=2, symbol=solidcircle, tickmarks = [spacing(1)\$2], gridlines, scaling=constrained, view=[0..31,0..33], size=[800,550], printtext=true, font=[times, 18], axesfont=[times, 10]);

Examples of triangles with longer sides

 > T:=HeronianTriangles(1000,980):  # All the Geronian triangles, whose lengths of two sides lie in the range  980..1000 nops(T);
 (3)
 > Tp:=select(p->p[1,2,1]>0 and p[1,2,2]>0 and p[1,3,1]>0 and p[1,3,2]>0, T);  # Triangles lying in the first quarter x>0, y>0 nops(%);
 (4)
 >

Edit.

## The Saga of the Subscript

by: Maple

In the beginning, Maple had indexed names, entered as x[abc]; as early as Maple V Release 4 (mid 1990s), this would display as xabc. So, x[1] could be used as x1, a subscripted variable; but assigning a value to x1 created a table whose name was x. This had, and still has, undesirable side effects. See Table 0 for an illustration in which an indexed variable is assigned a value, and then the name of the concomitant table is also assigned a value. The original indexed name is destroyed by these steps.

At one time this quirk could break commands such as dsolve. I don't know if it still does, but it's a usage that those "in the know" avoid. For other users, this was a problem that cried out for a solution. And Maplesoft did provide such a solution by going nuclear - it invented the Atomic Variable, which subsumed the subscript issue by solving a larger problem.

The larger problem is this: Arbitrary collections of symbols are not necessarily valid Maple names. For example, the expression  is not a valid name, and cannot appear on the left of an assignment operator. Values cannot be assigned to it. The Atomic solution locks such symbols together into a valid name originally called an Atomic Identifier but now called an Atomic Variable. Ah, so then xcan be either an indexed name (table entry) or a non-indexed literal name (Atomic Variable). By solving the bigger problem of creating assignable names, Maplesoft solved the smaller problem of subscripts by allowing literal subscripts to be Atomic Variables.

It is only in Maple 2017 that all vestiges of "Identifier" have disappeared, replaced by "Variable" throughout. The earliest appearance I can trace for the Atomic Identifier is in Maple 11, but it might have existed in Maple 10. Since Maple 11, help for the Atomic Identifier is found on the page

In Maple 17 this help could be obtained by executing help("AtomicIdentifier"). In Maple 2017, a help page for AtomicVariables exists.

In Maple 17, construction of these Atomic things changed, and a setting was introduced to make writing literal subscripts "simpler." With two settings and two outcomes for a "subscripted variable" (either indexed or non-indexed), it might be useful to see the meaning of "simpler," as detailed in the worksheet AfterMath.mw.

## Quantum Mechanics using Maple's Physics package

by: Maple

It passed through my mind it would be interesting to collect the links to the most relevant Mapleprimes posts about Quantum Mechanics using the Physics package of the last couple of years, to have them all accessible from one place. These posts give an idea of what kind of computation is already doable in quantum mechanics, how close is the worksheet input to what we write with paper and pencil, and how close is the typesetting of the output to what we see in textbooks.

At the end of each page linked below, you will see another link to download the corresponding worksheet, that you can open using Maple (say the current version or the version 1 or 2 years ago).

This other set of three consecutive posts develops one problem split into three parts:

This other link is interesting as a quick and compact entry point to the use of the Physics package:

There is an equivalent set of Mapleprimes posts illustrating the Physics package tackling problems in General Relativity, collecting them is for one other time.

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

## The hidden SO(4) symmetry of the Hydrogen Atom

by: Maple

December 2017: This is, perhaps, one of the most complicated computations done in this area using the Physics package. To the best of my knowledge never before performed on a computer algebra worksheet. It is exciting to present a computation like this one. At the end the corresponding worksheet is linked so that it can be downloaded and the sections be opened, the computation be reproduced. There is also a link to a pdf with everything open.  Special thanks to Pascal Szriftgiser for bringing this problem. To reproduce the computations below, please update the Physics library with the one distributed from the Maplesoft R&D Physics webpage.

June 17, 2020: updated taking advantage of new features of Maple 2020.1 and Physics Updates v.705. Submitted to arxiv.org

January 25, 2021: updated in the arXiv and submitted for publication in Computer Physics Communications

Quantum Runge-Lenz Vector and the Hydrogen Atom,

the hidden SO(4) symmetry using Computer Algebra

Pascal Szriftgiser1 and Edgardo S. Cheb-Terrab2

(1) University of Lille, CNRS, UMR 8523 - PhLAM - Physique des Lasers, Atomes et Molécules, F-59000 Lille, France

(2) Maplesoft

Abstract

Pauli first noticed the hidden SO(4) symmetry for the Hydrogen atom in the early stages of quantum mechanics [1]. Departing from that symmetry, one can recover the spectrum of a spinless hydrogen atom and the degeneracy of its states without explicitly solving Schrödinger's equation [2]. In this paper, we derive that SO(4) symmetry and spectrum using a computer algebra system (CAS). While this problem is well known [3, 4], its solution involves several steps of manipulating expressions with tensorial quantum operators, simplifying them by taking into account a combination of commutator rules and Einstein's sum rule for repeated indices. Therefore, it is an excellent model to test the current status of CAS concerning this kind of quantum-and-tensor-algebra computations. Generally speaking, when capable, CAS can significantly help with manipulations that, like non-commutative tensor calculus subject to algebra rules, are tedious, time-consuming and error-prone. The presentation also shows a pattern of computer algebra operations that can be useful for systematically tackling more complicated symbolic problems of this kind.

Introduction

The primary purpose of this work is to derive, step-by-step, the SO(4) symmetry of the Hydrogen atom and its spectrum using a computer algebra system (CAS). To the best of our knowledge, such a derivation using symbolic computation has not been shown before. Part of the goal was also to see whether this computation can be performed entering only the main definition formulas, followed by only simplification commands, and without using previous knowledge of the result. The intricacy of this problem is in the symbolic manipulation and simplification of expressions involving noncommutative quantum tensor operators. The simplifications need to take into account commutator rules, symmetries under permutation of indices of tensorial subexpressions, and use Einstein's sum rule for repeated indices.

We performed the derivation using the Maple 2020 system with the Maplesoft Physics Updates v.705. Generally speaking, the default computational domain of CAS doesn't include tensors, noncommutative operators nor related simplifications. On the other hand, the Maple system is distributed with a Physics package that extends that default domain to include those objects and related operations. Physics includes a Simplify command that takes into account custom algebra rules and the sum rule for repeated indices, and uses tensor-simplification algorithms [5] extended to the noncommutative domain.

A note about notation: when working with a CAS, besides the expectation of achieving a correct result for a complicated symbolic calculation, readability is also an issue. It is desired that one be able to enter the definition formulas and computational steps to be performed (the input, preceded by a prompt >, displayed in black) in a way that resembles as closely as possible their paper and pencil representation, and that the results (the output, computed by Maple, displayed in blue) use textbook mathematical-physics notation. The Physics package implements such dedicated typesetting. In what follows, within text and in the output, noncommutative objects are displayed using a different color, e.g. , vectors and tensor indices are displayed the standard way, as in , and , and commutators are displayed with a minus subscript, e.g. . Although the Maple system allows for providing dedicated typesetting also for the input, we preferred to keep visible the Maple input syntax, allowing for comparison with paper and pencil notation. We collected the names of the commands used and a one line description for them in an Appendix at the end. Maple also implements the concept of inert representations of computations, which are activated only when desired. We use this feature in several places. Inert computations are entered by preceding the command with % and are displayed in grey. Finally, as is usual in CAS, every output has an equation label, which we use throughout the presentation to refer to previous intermediate results.

In Sec.1, we recall the standard formulation of the problem and present the computational goal, which is the derivation of the formulas representing the SO(4) symmetry and related spectrum.

In Sec.2, we set tensorial non-commutative operators representing position and linear and angular momentum, respectively ,  and , their commutation rules used as departure point, and the form of the quantum Hamiltonian . We also derive a few related identities used in the sections that follow.

In Sec.3, we derive the conservation of both angular momentum and the Runge-Lenz quantum operator, respectively  and . Taking advantage of the differentialoperators functionality in the Physics package, we perform the derivation exploring two equivalent approaches; first using only a symbolic tensor representation  of the momentum operator, then using an explicit differential operator representation for it in configuration space, .  With the first approach, expressions are simplified only using the departing commutation rules and Einstein's sum rule for repeated indices. Using the second approach, the problem is additionally transformed into one where the differentiation operators are applied explicitly to a test function . Presenting both approaches is of potential interest as it offers two partly independent methods for performing the same computation, which is helpful to provide confidence on in the results when unknown, a relevant issue when using computer algebra.

In Sec. 4, we derive  and show that the classical relation between angular momentum and the Runge-Lenz vectors,   = 0, due to the orbital momentum being perpendicular to the elliptic plane of motion while the Runge-Lenz vector lies in that plane, still holds in quantum mechanics, where the components of these quantum vector operators do not commute but  =

In Sec. 5, we derive  using the two alternative approaches described for Sec.3.

In Sec. 6, we derive the well-known formula for the square of the Runge-Lenz vector, .

Finally, in Sec. 7, we use the SO(4) algebra derived in the previous sections to obtain the spectrum of the Hydrogen atom. Following the literature, this approach is limited to the bound states for which the energy is negative.

Some concluding remarks are presented at the end, and input syntax details are summarized in an Appendix.

1. The hidden SO(4) symmetry of the Hydrogen atom

Let's consider the Hydrogen atom and its Hamiltonian

,

where is the electron momentum,  its mass, κ a real positive constant,  the distance of the electron from the proton located at the origin, and  is its tensorial representation with components [. We assume that the proton's mass is infinite. The electron and nucleus spin are not taken into account. Classically, from the potential , one can derive a central force  that drives the electron's motion. Introducing the angular momentum

,

one can further define the Runge-Lenz vector

It is well known that  is a constant of the motion, i.e. . Switching to Quantum Mechanics, this condition reads

where, for hermiticity purpose, the expression of  must be symmetrized

.

In what follows, departing from the Hamiltonian H, the basic commutation rules between position, momentum  and angular momentum  in tensor notation, we derive the following commutation rules between the quantum Hamiltonian, angular momentum and Runge-Lenz vector

 = 0 = 0 = =

Since H commutes with both  and , defining

these commutation rules can be rewritten as

 = = =

 This set constitutes the Lie algebra of the SO(4) group.
 2. Setting the problem, commutation rules and useful identities
 3. Commutation rules between the Hamiltonian and each of the angular momentum and Runge-Lenz tensors
 4. Commutation rules between the angular momentum and the Runge-Lenz tensors
 5.  Commutation rules between the components of the Runge-Lenz tensor
 6. The square of the norm of the Runge-Lenz vector
 7. The atomic hydrogen spectrum
 Conclusions In this presentation, we derived, step-by-step, the SO(4) symmetry of the Hydrogen atom and its spectrum using the symbolic computer algebra Maple system. The derivation was performed without departing from the results, entering only the main definition formulas in eqs. (1), (2) and (5), followed by using a few simplification commands - mainly Simplify, SortProducts and SubstituteTensor - and a handful of Maple basic commands, subs, lhs, rhs and isolate. The computational path that was used to get the results of sections 2 to 7 is not unique. Instead of searching for the shortest path, we prioritized clarity and illustration of the techniques that can be used to crack problems like this one. This problem is mainly about simplifying expressions using two different techniques. First, expressions with noncommutative operands in products need reduction with respect to the commutator algebra rules that have been set. Second, products of tensorial operators require simplification using the sum rule for repeated indices and the symmetries of tensorial subexpressions. Those techniques, which are part of the Maple Physics simplifier, together with the SortProducts and SubstituteTensor commands for sorting the operands in products to apply tensorial identities, sufficed. The derivations were performed in a reasonably small number of steps. Two different computational strategies - with and without differential operators - were used in sections 3 and 5, showing an approach for verifying results, a relevant issue in general when performing complicated algebraic manipulations. The Maple Physics ability to handle differential operators as noncommutative operands in products (as frequently done in paper and pencil computations) facilitates readability and ease in entering the computations. The complexity of those operations is then handled by one Physics:-Library command, ApplyProductsOfDifferentialOperators (see eqs. (47) and (83)). Besides the Maple Physics ability to handle noncommutative tensor operators and simplify such operators using commutator algebra rules, it is interesting to note: a) the ability of the system to factorize expressions involving products of noncommutative operands (see eqs. (90) and (108)) and b) the extension of the algorithms for simplifying tensorial expressions [5] to the noncommutativity domain, used throughout this presentation. It is also worth mentioning how equation labels can reduce the whole computation to entering the main definitions, followed by applying a few commands to equation labels. That approach helps to reduce the chance of typographical errors to a very strict minimum. Likewise, the fact that commands and equations distribute over each other allows cumbersome manipulations to be performed in simple ways, as done, for instance, in eqs. (8), (9) and (13). Finally, it was significantly helpful for us to have the typesetting of results using standard mathematical physics notation, as shown in the presentation above.

Appendix

In this presentation, the input lines are preceded by a prompt > and the commands used are of three kinds: some basic Maple manipulation commands, the main Physics package commands to set things and simplify expressions, and two commands of the Physics:-Library to perform specialized, convenient, operations in expressions.

The basic Maple commands used

 • interface is used once at the beginning to set the letter used to represent the imaginary unit (default is I but we used i).
 • isolate is used in several places to isolate a variable in an expression, for example isolating x in  results in
 • lhs and rhs respectively get the left-hand side and right-hand side of an equation
 • subs substitutes the left-hand side of an equation by the righ-hand side in a given target, for example  results in
 • @ is used to compose commands. So is the same as . This command is useful to express an abstract combo of manipulations, for example as in (108) ≡ .

The Physics commands used

 • Setup is used to set algebra rules as well as the dimension of space, type of metric, and conventions as the kind of letter used to represent indices.
 • Commutator computes the commutator between two objects using the algebra rules set using Setup. If no rules are known to the system, it outputs a representation for the commutator that the system understands.
 • CompactDisplay is used to avoid redundant display of the functionality of a function.
 • d_[n] represents the  tensorial differential operator.
 • Define is used to define tensors, with or without specifying its components.
 • Dagger  computes the Hermitian transpose of an expression.
 • Normal, Expand, Factor respectively normalizes, expands and factorizes expressions that involve products of noncommutative operands.
 • Simplify performs simplification of tensorial expressions involving products of noncommutative factors taking into account Einstein's sum rule for repeated indices, symmetries of the indices of tensorial subexpressions and custom commutator algebra rules.
 • SortProducts uses the commutation rules set using Setup to sort the non-commutative operands of a product in an indicated ordering.

The Physics:-Library commands used

 • Library:-ApplyProductsOfDifferentialOperators applies the differential operators found in a product to the product operands that appear to its right. For example, applying this command to   results in
 • equalizes the repeated indices in the terms of a sum, so for instance applying this command to  results in

 References [1] W. Pauli, "On the hydrogen spectrum from the standpoint of the new quantum mechanics,” Z. Phys. 36, 336–363 (1926) [2] S. Weinberg, "Lectures on Quantum Mechanics, second edition, Cambridge University Press," 2015. [3] Veronika Gáliková, Samuel Kováčik, and Peter Prešnajder, "Laplace-Runge-Lenz vector in quantum mechanics in noncommutative space", J. Math. Phys. 54, 122106 (2013) [4] Castro, P.G., Kullock, R. "Physics of the  hydrogen atom". Theor. Math. Phys. 185, 1678–1684 (2015). [5] L. R. U. Manssur, R. Portugal, and B. F. Svaiter, "Group-Theoretic Approach for Symbolic Tensor Manipulation," International Journal of Modern Physics C, Vol. 13, No. 07, pp. 859-879 (2002).

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

## Bug in dsolve

Maple 2017

Let us consider

```sol1 := dsolve({diff(y(x), x) = solve((1/2)*(diff(y(x), x))^2 = (1-ln(y(x)^2))*y(x)^2, diff(y(x), x))[1],
y(0) = 1}, numeric);
sol1 := proc(x_rkf45) ... end proc
```

The problem under consideration has the symbolic solution:

```sol2 := dsolve({diff(y(x), x) = solve((1/2)*(diff(y(x), x))^2 = (1-ln(y(x)^2))*y(x)^2, diff(y(x), x))[1],
y(0) = 1});

sol2 := y(x) = exp(x*sqrt(2)-x^2)```

Let us compare the plots of sol1 and sol2 (which should coincide):

```A := plots:-odeplot(sol1, x = 0 .. 1, color = navy, style = point):
B := plot(rhs(sol2), x = 0 .. 1, color = red):
plots:-display([A, B]);

```

The plots differ after approximately 0.707. Bug_in_dsolve_numeric.mw

Edit. The title and one of the tags.

## Simplification of products of Dirac matrices

by: Maple

The computation of traces of products of Dirac matrices was implemented years ago - see Physics,Trace .

The simplification of products of Dirac matrices, however, was not. Now it is, and illustrating this new feature is the matter of this post. To reproduce the results below please update the Physics library with the one distributed at the Maplesoft R&D Physics webpage.

 >

First of all, when loading Physics, a frequent question is about the signature, the default is (- - - +)

 >
 (1)

This is important because the convention for the Algebra of Dirac Matrices depends on the signature. With the signatures (- - - +) as well as (+ - - -), the sign of the timelike component is 1

 >
 (2)

With the signatures (+ + + -) as well as (- + + +), the sign of the timelike component is of course -1

 >
 (3)

The simplification of products of Dirac Matrices, illustrated below with the default signature, works fine with any of these signatures, and works without having to set a representation for the Dirac matrices -- all the results are representation-independent.

The examples below, however, also illustrate a new feature of Physics, for now implemented as a Library:-PerformMatrixOperations command (there is a related, also new, command, , to just present the underlying matrix operations, without performing them). To illustrate this other new functionality , set a representation for the Dirac matrices, say the standard one

 >
 (4)

The four Dirac matrices are

 >
 (5)

The definition of the Dirac matrices is implemented in Maple following the conventions of Landau books ([1] Quantum Electrodynamics, V4), and  does not depend on the signature, ie the form of these matrices is

 >
 (6)

With the default signature, the space part components of   change sign when compared with corresponding ones from  while the timelike component remains unchanged

 >
 (7)
 >
 (8)

For the default signature, the algebra of the Dirac Matrices, loaded by default when Physics is loaded, is (see page 80 of [1])

 >
 (9)

When the sign of the timelike component of the signature is -1, we have a -1 factor on the right-hand side of (9).

Note as well that in (9) the right-hand side has no matrix elements. This is standard in particle physics where the computations are performed algebraically, without performing the matrix operations. For the purpose of actually performing the underlying matrix operations, however, one may want to rewrite this algebra including a 4x4 identity matrix. For that purpose, see Algebra of Dirac Matrices with an identity matrix on the right-hand side. For the purpose of this illustration, below we proceed with the algebra as shown in (9), interpreting right-hand sides as if they involve an identity matrix.

Verify the algebra rule by performing all the involved matrix operations

 >
 (10)

Note that, regarding the spacetime indices, this is a 4x4 matrix, whose elements are in turn 4x4 matrices. Compute first the external 4x4 matrix related to  and

 >
 (11)

Perform now all the matrix operations involved in each of the elements of this 4x4 matrix

 >
 (12)

By eye everything checks OK.

Consider now the following five products of Dirac matrices

 >
 (13)
 >
 (14)
 >
 (15)
 >
 (16)
 >
 (17)

New: the simplification of these products is now implemented

 >
 (18)

Verify this result performing the underlying matrix operations

 >
 (19)
 >
 (20)

The same with the other expressions

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

For e2

 >
 (25)
 >
 (26)
 >
 (27)
 >
 (28)

For e3 we have

 >
 (29)

Verify this result,

 >
 (30)

In this case, with three free spacetime indices lambda, nu, rho, the spacetime components form an array 4x4x4 of 64 components, each of which is a matrix equation

 >
 (31)

For instance, the first element is

 >
 (32)

and it checks OK:

 >
 (33)

How can you test the 64 components of T all at once?

1. Compute the matrices, without displaying the whole thing, take the elements of the array and remove the indices (ie take the right-hand side); call it M

 >

For instance,

 >
 (34)

Now verify all these matrix equations at once: take the elements of the arrays on each side of the equations and verify that the are the same: we expect for output just

 >
 (35)

The same for e4

 >
 (36)
 >
 (37)

Regarding the spacetime indices this is now an array 4x4x4x4

 >
 (38)

For instance the first of these 256 matrix equations

 >
 (39)

verifies OK:

 >
 (40)

Now all the 256 matrix equations verified at once as done for e3

 >
 >
 (41)

Finally, although there is more work to be done here, let's define some tensors and contract their product with these expressions involving products of Dirac matrices.

For example,

 >
 (42)

Contract with e1 and e2 and simplify

 >
 (43)
 >
 (44)

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

## Bug in MatrixInverse

Maple

I submit a bug through MaplePrimes because I can't do it as usually (Hope some people understand me.). Let us consider

```with(LinearAlgebra):
M := Matrix(5, 5,  (i, j) -> (10*i+j)*sin((1/180)*Pi*(10*i+j))):
MatrixInverse(M);
#One sees a long and wrong output instead of the warning "Matrix M is singular"
```

Indeed,

```Digits := 500; evalf(Determinant(M), 495);

1.3 10 ^(-488)
```

Bug_in_MatrixInverse.mw

## Bug in pdsolve

Maple 2017

I submit a bug through MaplePrimes because I can't do it as usually (Hope some people understand me.). Let us consider

```restart; pdsolve([diff(u(t, x), t, t) = diff(u(t, x), x, x), u(t, 0) = 0, u(t, Pi) = 0]);
pdsolve([diff(u(t, x), t, t) = diff(u(t, x), x, x), u(t, 0) = 0, u(t, Pi) = 0], generalsolution);
u(t, x) = Sum(sin(n*x)*(_C5(n)*cos(n*t)+_C1(n)*sin(n*t)), n = 1 .. infinity)
u(t, x) = Sum(sin(n*x)*(_C5(n)*cos(n*t)+_C1(n)*sin(n*t)), n = 1 .. infinity)
```

The question arises: what do these outputs mean? I don't see any explanation in ?pdsolve and ?examples,pdsolve_boundaryconditions. What are _C1(n) and _C5(n)? Under which conditions does the above series converge?

Moreover,

```pdetest(%, [diff(u(t, x), t, t) = diff(u(t, x), x, x), u(t, 0) = 0, u(t, Pi) = 0]);
[0, 0, 0]
```

I think the above is simply a fake: it is possible to differentiate  a series only under certain conditions.

Bug_in_pdsolve.mw

Please, don't convert my post to a question. This is not correct and fair. Hope some people understand me.

## Quantum Commutation Rules Basics

by: Maple

Quantum Commutation Rules Basics

Pascal Szriftgiser1 and Edgardo S. Cheb-Terrab2

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

(2) Maplesoft

In Quantum Mechanics, in the coordinates representation, the component of the momentum operator along the x axis is given by the differential operator

The purpose of the exercises below is thus to derive the commutation rules, in the coordinates representation, between an arbitrary function of the coordinates and the related momentum, departing from the differential representation

These two exercises illustrate how to have full control of the computational process by using different elements of the Maple language, including inert representations of abstract vectorial differential operators, Hermitian operators, algebra rules, etc.

These exercises also illustrate a new feature of the Physics package, introduced in Maple 2017, that is getting refined (the computation below requires the Maplesoft updates of the Physics package) which is the ability to perform computations algebraically, using the product operator, but with differential operators, and transform the products into the application of the operators only when we want that, as we do with paper and pencil.

 >

Start setting the problem:

 – all of are Hermitian operators
 – all of  commute between each other
 – tell the system only that the operators  are the differentiation variables of the corresponding (differential) operators  but do not tell what is the form of the operators

 >
 (1.1)

Assuming  is a smooth function, the idea is to apply the commutator  to an arbitrary ket of the Hilbert space , perform the operation explicitly after setting a differential operator representation for , and from there get the commutation rule between  and .

Start introducing the commutator, to proceed with full control of the operations we use the inert form %Commutator

 >
 >
 (1.2)
 >
 (1.3)

For illustration purposes only (not necessary), expand this commutator

 >
 (1.4)

Note that  ,  and the ket  are operands in the products above and that they do not commute: we indicated that the coordinates  are the differentiation variables of . This emulates what we do when computing with these operators with paper and pencil, where we represent the application of a differential operator as a product operation.

This representation can be transformed into the (traditional in computer algebra) application of the differential operator when desired, as follows:

 >
 (1.5)

Note that, in , the application of  is not expanded: at this point nothing is known about   , it is not necessarily a linear operator. In the Quantum Mechanics problem at hands, however, it is. So give now the operator   an explicit representation as a linear vectorial differential operator (we use the inert form %Nabla, , to be able to proceed with full control one step at a time)

 >
 (1.6)

The expression (1.5) becomes

 >
 (1.7)

Activate now the inert operator  and simplify taking into account the algebra rules for the coordinate operators

 >
 (1.8)

To make explicit the gradient in disguise on the right-hand side, factor out the arbitrary ket

 >
 (1.9)

Combine now the expanded gradient into its inert (not-expanded) form

 >
 (1.10)

Since (1.10) is true for all, this ket can be removed from both sides of the equation. One can do that either taking coefficients (see Coefficients ) or multiplying by the "formal inverse" of this ket, arriving at the (expected) form of the commutation rule between  and

 >
 (1.11)

Tensor notation,

The computation rule for position and momentum, this time in tensor notation, is performed in the same way, just that, additionally, specify that the space indices to be used are lowercase latin letters, and set the relationship between the differential operators and the coordinates directly using tensor notation.

You can also specify that the metric is Euclidean, but that is not necessary: the default metric of the Physics package, a Minkowski spacetime, includes a 3D subspace that is Euclidean, and the default signature, (- - - +), is not a problem regarding this computation.

 >
 >
 (2.1)

Define now the tensor

 >
 (2.2)

Introduce now the Commutator, this time in active form, to show how to reobtain the non-expanded form at the end by resorting the operands in products

 >
 (2.3)

Expand first (not necessary) to see how the operator  is going to be applied

 >
 (2.4)

Now expand and directly apply in one ago the differential operator

 >
 (2.5)

Introducing the explicit differential operator representation for , here again using the inert  to keep control of the computations step by step

 >
 (2.6)

The expanded and applied commutator (2.5) becomes

 >
 (2.7)

Activate now the inert operators  and simplify taking into account Einstein's rule for repeated indices

 >
 (2.8)

Since the ket  is arbitrary, we can take coefficients (or multiply by the formal Inverse  of this ket as done in the previous section). For illustration purposes, we use   Coefficients  and note hwo it automatically expands the commutator

 >
 (2.9)

One can undo this (frequently undesired) expansion of the commutator by sorting the products on the left-hand side using the commutator between  and

 >
 (2.10)

And that is the result we wanted to compute.

Additionally, to see this rule in matrix form,

 >
 (2.11)

In the above, we use equation (2.10) multiplied by -1 to avoid a minus sign in all the elements of (2.11), due to having worked with the default signature (- - - +); this minus sign is not necessary if in the Setup at the beginning one also sets

For display purposes, to see this matrix expressed in terms of the geometrical components of the momentum  , redefine the tensor  explicitly indicating its Cartesian components

 >
 (2.12)
 >
 (2.13)

Finally, in a typical situation, these commutation rules are to be taken into account in further computations, and for that purpose they can be added to the setup via

 >
 (2.14)

For example, from herein computations are performed taking into account that

 >
 (2.15)
 >

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

## starting with maple for engineering

Maple 18

Good book to start studying maple for engineering.

http://www.gatewaycoalition.org/includes/display_project.aspx?ID=279&maincatid=105&subcatid=1019&thirdcatid=0

Lenin Araujo Castillo

## Carpet of Baron Munchausen

by: Maple

I accidentally stumbled on this problem in the list of tasks for mathematical olympiads. I quote its text in Russian-English translation:

"The floor in the drawing room of Baron Munchausen is paved with the identical square stone plates.
Baron claims that his new carpet (made of one piece of a material ) covers exactly 24 plates and
at the same time each vertical and each horizontal row of plates in the living room contains
exactly 4 plates covered with carpet. Is not the Baron deceiving?"

At first glance this seems impossible, but in fact the Baron is right. Several examples can be obtained simply by hand, for example

or

The problem is to find all solutions. This post is dedicated to this problem.

We put in correspondence to each such carpet a matrix of zeros and ones, such that in each row and in each column there are exactly 2 zeros and 4 ones. The problem to generate all such the matrices was already discussed here and Carl found a very effective solution. I propose another solution (based on the method of branches and boundaries), it is less effective, but more universal. I've used this method several times, for example here and here.
There will be a lot of such matrices (total 67950), so we will impose natural limitations. We require that the carpet be a simply connected set that has as its boundary a simple polygon (non-self-intersecting).

Below we give a complete solution to the problem.

restart;
R:=combinat:-permute([0,0,1,1,1,1]);
# All lists of two zeros and four units

# In the procedure OneStep, the matrices are presented as lists of lists. The procedure adds one row to each matrix so that in each column there are no more than 2 zeros and not more than 4 ones

OneStep:=proc(L::listlist)
local m, k, l, r, a, L1;
m:=nops(L[1]); k:=0;
for l in L do
for r in R do
a:=[op(l),r];
od; od;
convert(L1, list);
end proc:

# M is a list of all matrices, each of which has exactly 2 zeros and 4 units in each row and column

L:=map(t->[t], R):
M:=(OneStep@@5)(L):
nops(M);

67950

M1:=map(Matrix, M):

# From the list of M1 we delete those matrices that contain <1,0;0,1> and <0,1;1,0> submatrices. This means that the boundaries of the corresponding carpets will be simple non-self-intersecting curves

k:=0:
for m in M1 do
s:=1;
for i from 2 to 6 do
for j from 2 to 6 do
if (m[i,j]=0 and m[i-1,j-1]=0 and m[i,j-1]=1 and m[i-1,j]=1) or (m[i,j]=1 and m[i-1,j-1]=1 and m[i,j-1]=0 and m[i-1,j]=0) then s:=0; break fi;
od: if s=0 then break fi; od:
if s=1 then k:=k+1; M2[k]:=m fi;
od:
M2:=convert(M2, list):
nops(M2);

394

# We find the list T of all segments from which the boundary consists

T:='T':
n:=0:
for m in M2 do
k:=0: S:='S':
for i from 1 to 6 do
for j from 1 to 6 do
if m[i,j]=1 then
if j=1 or (j>1 and m[i,j-1]=0) then k:=k+1; S[k]:={[j-1/2,7-i-1/2],[j-1/2,7-i+1/2]} fi;
if i=1 or (i>1 and m[i-1,j]=0) then k:=k+1; S[k]:={[j-1/2,7-i+1/2],[j+1/2,7-i+1/2]} fi;
if j=6 or (j<6 and m[i,j+1]=0) then k:=k+1; S[k]:={[j+1/2,7-i+1/2],[j+1/2,7-i-1/2]} fi;
if i=6 or (i<6 and m[i+1,j]=0) then k:=k+1; S[k]:={[j+1/2,7-i-1/2],[j-1/2,7-i-1/2]} fi;
fi;
od: od:
n:=n+1; T[n]:=[m,convert(S,set)];
od:
T:=convert(T, list):

# Choose carpets with a connected border

C:='C': k:=0:
for t in T do
a:=t[2]; v:=op~(a);
G:=GraphTheory:-Graph([\$1..nops(v)], subs([seq(v[i]=i,i=1..nops(v))],a));
if GraphTheory:-IsConnected(G) then k:=k+1; C[k]:=t fi;
od:
C:=convert(C,list):
nops(C);

208

# Sort the list of border segments so that they go one by one and form a polygon

k:=0: P:='P':
for c in C do
a:=c[2]: v:=op~(a);
G1:=GraphTheory:-Graph([\$1..nops(v)], subs([seq(v[i]=i,i=1..nops(v))],a));
GraphTheory:-IsEulerian(G1,'U');
U; s:=[op(U)];
k:=k+1; P[k]:=[seq(v[i],i=s[1..-2])];
od:
P:=convert(P, list):

# We apply AreIsometric procedure from here to remove solutions that coincide under a rotation or reflection

P1:=[ListTools:-Categorize( AreIsometric, P)]:
nops(P1);

28

We get 28 unique solutions to this problem.

Visualization of all these solutions:

interface(rtablesize=100):
E1:=seq(plottools:-line([1/2,i],[13/2,i], color=red),i=1/2..13/2,1):
E2:=seq(plottools:-line([i,1/2],[i,13/2], color=red),i=1/2..13/2,1):
F:=plottools:-polygon([[1/2,1/2],[1/2,13/2],[13/2,13/2],[13/2,1/2]], color=yellow):
plots:-display(Matrix(4,7,[seq(plots:-display(plottools:-polygon(p,color=red),F, E1,E2), p=[seq(i[1],i=P1)])]), scaling=constrained, axes=none, size=[800,700]);

Carpet1.mw

The code was edited.

## Introducing #MapleOfficeHours!

Maple

We’re so excited to bring you guys #MapleOfficeHours! This is a program we’ve designed for students (but open to everyone) to connect via social media for help with Maple. Maple can play a really important part in your courses and can sometimes be intimidating for new users. We get it, there’s a lot of ground to cover. With #MapleOfficeHours, we will use social media as a live Q&A platform to help you figure out how to use Maple for your homework, assignments and more. Having trouble with a command or function? #MapleOfficeHours. Need help finding a specific resource or app? #MapleOfficeHours. You get the idea…

Just like the office hours your professors hold, #MapleOfficeHours is going to be available on a regular basis for support. More events will be scheduled soon, but look out for Twitter chats, mini-webinars, Facebook live events and more. Once we get going, we’d love to hear your feedback on what other types of events we can offer and what topics you’d like to see covered.

Our first #MapleOfficeHours event will be a live Twitter chat. On October 16th at 2PM EDT, I will be joined with Maple Product Manager, @DanielSkoog and Tech Support Team Lead, Dr. Matt Calder to answer as many questions about Maple that we can possibly fit into an hour’s time.

To join the Twitter chat, use the hashtag #MapleOfficeHours when posting your questions and/or mention us with @maplesoft.

Looking forward to seeing everyone at our first #MapleOfficeHours event on October 16th, 2PM EDT!

## Maple 2017.3 update

by: Maple 2017

We have released a small maintenance update to Maple. Maple 2017.3 provides enhancements in several areas, including mathematical typesetting, pdsolve, and the Physics package. It also provides improvements to the MapleCloud, including a fix for a problem that prevented some Mac users from logging on with their Google credentials.

This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2017.3 download page.

 5 6 7 8 9 10 11 Last Page 7 of 57
﻿