Education

Teaching and learning about math, Maple and MapleSim


 

For Maple 2018.1, there are improvements in pdsolve's ability to solve PDE with boundary and initial conditions. This is work done together with E.S. Cheb-Terrab. The improvements include an extended ability to solve problems involving non-homogeneous PDE and/or non-homogeneous boundary and initial conditions, as well as improved simplification of solutions and better handling of functions such as piecewise in the arguments and in the processing of solutions. This is also an ongoing project, with updates being distributed regularly within the Physics Updates.

Solving more problems involving non-homogeneous PDE and/or non-homogeneous boundary and initial conditions

 

 

Example 1: Pinchover and Rubinstein's exercise 6.17: we have a non-homogenous PDE and boundary and initial conditions that are also non-homogeneous:

pde__1 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = 1+x*cos(t)
iv__1 := (D[1](u))(0, t) = sin(t), (D[1](u))(1, t) = sin(t), u(x, 0) = 1+cos(2*Pi*x)

pdsolve([pde__1, iv__1])

u(x, t) = 1+cos(2*Pi*x)*exp(-4*Pi^2*t)+t+x*sin(t)

(1)

How we solve the problem, step by step:

   

 

Example 2: the PDE is homogeneous but the boundary conditions are not. We solve the problem through the same process, which means we end up solving a nonhomogeneous pde with homogeneous BC as an intermediate step:

pde__2 := diff(u(x, t), t) = 13*(diff(u(x, t), x, x))
iv__2 := (D[1](u))(0, t) = 0, (D[1](u))(1, t) = 1, u(x, 0) = (1/2)*x^2+x

pdsolve([pde__2, iv__2])

u(x, t) = 1/2+Sum(2*(-1+(-1)^n)*cos(n*Pi*x)*exp(-13*Pi^2*n^2*t)/(Pi^2*n^2), n = 1 .. infinity)+13*t+(1/2)*x^2

(12)

How we solve the problem, step by step:

   

 

Example 3: a wave PDE with a source that does not depend on time:

pde__3 := (diff(u(x, t), x, x))*a^2+1 = diff(u(x, t), t, t)
iv__3 := u(0, t) = 0, u(L, t) = 0, u(x, 0) = f(x), (D[2](u))(x, 0) = g(x)

`assuming`([pdsolve([pde__3, iv__3])], [L > 0])

u(x, t) = (1/2)*(2*(Sum(sin(n*Pi*x/L)*(2*L*(Int(sin(n*Pi*x/L)*g(x), x = 0 .. L))*sin(a*Pi*t*n/L)*a-Pi*(Int(sin(n*Pi*x/L)*(-2*f(x)*a^2+L*x-x^2), x = 0 .. L))*cos(a*Pi*t*n/L)*n)/(Pi*n*a^2*L), n = 1 .. infinity))*a^2+L*x-x^2)/a^2

(23)

How we solve the problem, step by step:

   

 

Example 4: Pinchover and Rubinstein's exercise 6.23 - we have a non-homogenous PDE and initial condition:

pde__4 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = g(x, t)
iv__4 := (D[1](u))(0, t) = 0, (D[1](u))(1, t) = 0, u(x, 0) = f(x)

pdsolve([pde__4, iv__4], u(x, t))

u(x, t) = Int(f(tau1), tau1 = 0 .. 1)+Sum(2*(Int(f(tau1)*cos(n*Pi*tau1), tau1 = 0 .. 1))*cos(n*Pi*x)*exp(-Pi^2*n^2*t), n = 1 .. infinity)+Int(Int(g(x, tau1), x = 0 .. 1)+Sum(2*(Int(g(x, tau1)*cos(n1*Pi*x), x = 0 .. 1))*cos(n1*Pi*x)*exp(-Pi^2*n1^2*(t-tau1)), n1 = 1 .. infinity), tau1 = 0 .. t)

(30)

If we now make the functions f and g into specific mappings, we can compare pdsolve's solutions to the general and specific problems:

f := proc (x) options operator, arrow; 3*cos(42*x*Pi) end proc
g := proc (x, t) options operator, arrow; exp(3*t)*cos(17*x*Pi) end proc

 

Here is what pdsolve's solution to the general problem looks like when taking into account the new values of f(x) and g(x,t):

value(simplify(evalindets(u(x, t) = Int(f(tau1), tau1 = 0 .. 1)+Sum(2*(Int(f(tau1)*cos(n*Pi*tau1), tau1 = 0 .. 1))*cos(n*Pi*x)*exp(-Pi^2*n^2*t), n = 1 .. infinity)+Int(Int(g(x, tau1), x = 0 .. 1)+Sum(2*(Int(g(x, tau1)*cos(n1*Pi*x), x = 0 .. 1))*cos(n1*Pi*x)*exp(-Pi^2*n1^2*(t-tau1)), n1 = 1 .. infinity), tau1 = 0 .. t), specfunc(Int), proc (u) options operator, arrow; `PDEtools/int`(op(u), AllSolutions) end proc)))

u(x, t) = 3*cos(42*Pi*x)*exp(-1764*Pi^2*t)+cos(Pi*x)*(65536*cos(Pi*x)^16-278528*cos(Pi*x)^14+487424*cos(Pi*x)^12-452608*cos(Pi*x)^10+239360*cos(Pi*x)^8-71808*cos(Pi*x)^6+11424*cos(Pi*x)^4-816*cos(Pi*x)^2+17)*(exp(289*Pi^2*t+3*t)-1)*exp(-289*Pi^2*t)/(289*Pi^2+3)

(31)

 

Here is pdsolve's solution to the specific problem:

pdsolve([pde__4, iv__4], u(x, t))

u(x, t) = ((867*Pi^2+9)*cos(42*Pi*x)*exp(-1764*Pi^2*t)+cos(17*Pi*x)*(exp(3*t)-exp(-289*Pi^2*t)))/(289*Pi^2+3)

(32)

 

And the two solutions are equal:

simplify(combine((u(x, t) = 3*cos(42*x*Pi)*exp(-1764*Pi^2*t)+cos(x*Pi)*(65536*cos(x*Pi)^16-278528*cos(x*Pi)^14+487424*cos(x*Pi)^12-452608*cos(x*Pi)^10+239360*cos(x*Pi)^8-71808*cos(x*Pi)^6+11424*cos(x*Pi)^4-816*cos(x*Pi)^2+17)*(exp(289*Pi^2*t+3*t)-1)*exp(-289*Pi^2*t)/(289*Pi^2+3))-(u(x, t) = ((867*Pi^2+9)*cos(42*x*Pi)*exp(-1764*Pi^2*t)+cos(17*x*Pi)*(exp(3*t)-exp(-289*Pi^2*t)))/(289*Pi^2+3)), trig))

0 = 0

(33)

f := 'f'; g := 'g'

 

Improved simplification in integrals, piecewise functions, and sums in the solutions returned by pdsolve

 

 

Example 1: exercise 6.21 from Pinchover and Rubinstein is a non-homogeneous heat problem. Its solution used to include unevaluated integrals and sums, but is now returned in a significantly simpler format.

pde__5 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = t*cos(2001*x)
iv__5 := (D[1](u))(0, t) = 0, (D[1](u))(Pi, t) = 0, u(x, 0) = Pi*cos(2*x)

pdsolve([pde__5, iv__5])

u(x, t) = (1/16032024008001)*(4004001*t+exp(-4004001*t)-1)*cos(2001*x)+Pi*cos(2*x)*exp(-4*t)

(34)

pdetest(%, [pde__5, iv__5])

[0, 0, 0, 0]

(35)

 

Example 2: example 6.46 from Pinchover and Rubinstein is a non-homogeneous heat equation with non-homogeneous boundary and initial conditions. Its solution used to involve two separate sums with unevaluated integrals, but is now returned with only one sum and unevaluated integral.

pde__6 := diff(u(x, t), t)-(diff(u(x, t), x, x)) = exp(-t)*sin(3*x)
iv__6 := u(0, t) = 0, u(Pi, t) = 1, u(x, 0) = phi(x)

pdsolve([pde__6, iv__6], u(x, t))

u(x, t) = (1/8)*(8*(Sum(2*(Int(-(-phi(x)*Pi+x)*sin(n*x), x = 0 .. Pi))*sin(n*x)*exp(-n^2*t)/Pi^2, n = 1 .. infinity))*Pi-Pi*(exp(-9*t)-exp(-t))*sin(3*x)+8*x)/Pi

(36)

pdetest(%, [pde__6, iv__6])

[0, 0, 0, (-phi(x)*Pi^2+Pi*x+2*(Sum((Int(-(-phi(x)*Pi+x)*sin(n*x), x = 0 .. Pi))*sin(n*x), n = 1 .. infinity)))/Pi^2]

(37)

 

More accuracy when returning series solutions that have exceptions for certain values of the summation index or a parameter

 

 

Example 1: the answer to this problem was previously given with n = 0 .. infinity instead of n = 1 .. infinity as it should be:

pde__7 := diff(v(x, t), t, t)-(diff(v(x, t), x, x))

iv__7 := v(0, t) = 0, v(x, 0) = -(exp(2)*x-exp(x+1)-x+exp(1-x))/(exp(2)-1), (D[2](v))(x, 0) = 1+(exp(2)*x-exp(x+1)-x+exp(1-x))/(exp(2)-1), v(1, t) = 0

pdsolve([pde__7, iv__7])

v(x, t) = Sum(-2*sin(n*Pi*x)*((Pi^2*(-1)^n*n^2-Pi^2*n^2+2*(-1)^n-1)*sin(Pi*t*n)-(-1)^n*cos(Pi*t*n)*Pi*n)/(Pi^2*n^2*(Pi^2*n^2+1)), n = 1 .. infinity)

(38)

 

Example 2: the answer to exercise 6.25 from Pinchover and Rubinstein is now given in a much simpler format, with the special limit case for w = 0 calculated separately:

pde__8 := diff(u(x, t), t) = k*(diff(u(x, t), x, x))+cos(w*t)
iv__8 := (D[1](u))(L, t) = 0, (D[1](u))(0, t) = 0, u(x, 0) = x

`assuming`([pdsolve([pde__8, iv__8], u(x, t))], [L > 0])

u(x, t) = piecewise(w = 0, (1/2)*L+Sum(2*L*(-1+(-1)^n)*cos(n*Pi*x/L)*exp(-Pi^2*n^2*k*t/L^2)/(n^2*Pi^2), n = 1 .. infinity)+t, (1/2)*(L*w+2*(Sum(2*L*(-1+(-1)^n)*cos(n*Pi*x/L)*exp(-Pi^2*n^2*k*t/L^2)/(n^2*Pi^2), n = 1 .. infinity))*w+2*sin(w*t))/w)

(39)

 

Improved handling of piecewise, eval/diff in the given problem

 

 

Example 1: this problem, which contains a piecewise function in the initial condition, can now be solved:

pde__9 := diff(f(x, t), t) = diff(f(x, t), x, x)
iv__9 := f(0, t) = 0, f(1, t) = 1, f(x, 0) = piecewise(x = 0, 0, 1)

pdsolve([pde__9, iv__9])

f(x, t) = Sum(2*sin(n*Pi*x)*exp(-Pi^2*n^2*t)/(n*Pi), n = 1 .. infinity)+x

(40)

 

Example 2: this problem, which contains a derivative written using eval/diff, can now be solved:

pde__10 := -(diff(u(x, t), t, t))-(diff(u(x, t), x, x))+u(x, t) = 2*exp(-t)*(x-(1/2)*x^2+(1/2)*t-1)

iv__10 := u(x, 0) = x^2-2*x, u(x, 1) = u(x, 1/2)+((1/2)*x^2-x)*exp(-1)-((3/4)*x^2-(3/2)*x)*exp(-1/2), u(0, t) = 0, eval(diff(u(x, t), x), {x = 1}) = 0

pdsolve([pde__10, iv__10], u(x, t))

u(x, t) = -(1/2)*exp(-t)*x*(x-2)*(t-2)

(41)

 

References:

 

Pinchover, Y. and Rubinstein, J.. An Introduction to Partial Differential Equations. Cambridge UP, 2005.


 

Download What_is_New_after_Maple_2018.mw

Katherina von Bülow

I just feel that if at least one person less experienced than me reads this it will be a worth while post, because it will help them avoid things that eluded me when I was younger.


 

The omitted function definitions are not relevant to the reason for which I decided to post about this. I would like the maple user to simply observe how many variables are involved in the relation's (R) three equalities in the consideration of the output.

 

The reason I believe this is important, is that it is sometimes very easy to believe induction is sufficient proof of the truth value of a relation over the superset of a subset that has been enumerated, much like the example of the coefficients of the
"105^(th) cyclotomic polynomial if one were to inductively reason statements about the coeffiecents of the previous 104 polynomials."

 

 

A[n, k, M] = abs(C[0](n, k, M))/abs(C[1](n, k, M)); B[n, k, M] = abs(C[0](n, k, M))/abs(C[2](n, k, M)); E[n, k, M] = abs(C[1](n, k, M))/abs(C[2](n, k, M))

R

"`𝓃`(A[n,k,M])=`𝓃`(B[n,k,M]), `𝓃`(E[n,k,M])=`𝒹`(A[n,k,M]),`𝒹`(B[n,k,M])=`𝒹`(E[n,k,M])]"

for t to 7 do R(t, 2, 30) end do

[1 = 1, 1 = 1, 1 = 1]

 

[1 = 1, 1 = 1, 1 = 1]

 

[1 = 1, 1 = 1, 1 = 1]

 

[1 = 1, 1 = 1, 1 = 1]

 

[1 = 1, 1 = 1, 1 = 1]

 

[1 = 1, 1 = 1, 1 = 1]

 

[1 = 11^(1/2)*7^(1/2), 11^(1/2)*7^(1/2) = 1, 7 = 7]

(1)


 

Download INDUCTION_IS_NOT_YOUR_FREN.mw

Up to swMATH   Maple is referenced in 4183 articles   in zbMATH   and

up to swMATH Mathematica is referenced in 4654 articles  in zbMATH.

These numbers are sure unexpected to me. I think the ratio of the prices of academic editions MMA/Maple (which approximately equals 2 ) truly reflects their capabilities.

It post can be called a continuation of the theme “Determination of the angles of the manipulator with the help of its mathematical model. Inverse  problem”.
Consider  the use of manipulators as multi-axis CNC machines.
Three-link manipulator with 5 degrees of freedom. In these examples  one of the restrictions on the movement of the manipulator links is that the position of the last link coincides with the normal to the surface along the entire trajectory of the working point movement.
That is, we, as it were, mathematically transform a system with many degrees of freedom to an analog of a lever mechanism with one degree of freedom, so that we can do the necessary work in a convenient to us way.
It seems that this approach is fully applicable directly to multi-axis CNC machines.

(In the texts of the programs, the normalization is carried out with respect to the coordinates of the last point, in order that the lengths of the integration interval coincide with the path length.)
MAN_3_5_for_MP.mw

MAN_3_5_for_MP_TR.mw

Due to the mechanistic process of our students and little creativity in analysis in schools and universities to be professionally trained is that STEM education appears (science, technology, engineering and mathematics) is a new model that is being considered in other countries and with very slow step in our city. In this work the methods with STEM will be visualized but using computational tools provided by Maplesoft which is a company that leads online education for adolescents and adults in the current market. In Spanish.

ECI_UNT_2018.pdf

ECI_UNT_2018.mw

Lenin Araujo Castillo

Ambassador of Maple

Using Maple's native syntax, we can calculate the components of acceleration. That is, the tangent and normal scalar component with its respective units of measure. Now the difficult calculations were in the past because with Maple we solved it and we concentrated on the interpretation of the results for engineering. In spanish.

Calculo_Componentes_Aceleracion_Curvilínea.mw

Uso_de_comandos_y_operadores_para_calculos_de_componentes_de_la_aceleración.mw

Lenin Araujo Castillo

Ambassador of Maple

 

 

Last week, my colleague Erik Postma and I had the pleasure of spending a few hours with a group of bright and motivated high school students at the Math for Real: High School Math Solves Real Problems workshop held at the Fields Institute for Research in Mathematical Sciences in Toronto, and sponsored by the Fields Institute and NSERC PromoScience. The purpose of this three-day workshop was to train students for the International Mathematical Modeling Challenge, also known as IM2C.

The IM2C is hosted by York University and run by the IM2C-Canada committee, consisting of parents and high school teachers, as well as faculty and students in York’s Department of Mathematics and Statistics. In this competition, students working in small teams have five days to solve a mathematical modelling problem in diverse application areas. To support the “Real World” aspect of the contest, students are expected not just to showcase their mathematical creativity and problem-solving skills, but they are also asked to clearly communicate their analyses and conclusions through a written report and visualizations.

The contest allows students to use appropriate software tools to help them with their tasks. Of course I am biased but I can’t help thinking that Maple is the perfect tool for students wanting to do a combination of prototyping, modelling, visualization and document-preparation. The IM2C organizers also thought that the students could benefit from our software, so Erik gave an hour-long introduction to Maple. I was impressed by the students’ enthusiastic remarks and sometimes challenging questions, though admittedly they were partly motivated by the chance to receive as prizes our highly coveted limited-quantity “Math Matters” t-shirts.

The workshop also introduced the students to other software products, taught modelling and writing skills, and had them work on fun practice problems. Over the lunch break, I was struck by the sense of camaraderie at this event, which probably should not have surprised me, as unlike many other competitions involving mathematics, this one is a true team-based activity. Both Erik and I are eager to see what the students will be doing with Maple. Responding to the students’ enthusiasm and interest, Maplesoft has agreed to offer complimentary Maple licenses to all students participating in IM2C. 

As a Corporate Affiliate of the Fields Institute, Maplesoft is pleased to provide training and support to students and researchers that come to Fields for its many events. Developers like myself are encouraged to participate in the institute’s events when possible, and I’ve had the opportunity to attend a number of workshops in the past few years. I encourage you to look at their wide range of activities and to consider visiting the culturally diverse city of Toronto!


Minimum:
1. Maple Tour
2. Maple Quick Start
3. Quick Help
4. Quick Reference Card
5. Math Apps
6. Plotting Guide
...
https://drive.google.com/file/d/1ZAlFQ8_MbuKNsr2PDIyEHmIoogKInBmE/view?usp=sharing

Is that only for my students?

In worksheets:
https://drive.google.com/file/d/1cfA8WKPXSQQxJQR7KbyYHBY6g4OjHaSn/view?usp=sharing

The first update to the Maple 2018 Physics, Differential Equations and Mathematical Functions packages is available. As has been the case since 2013, this update contains fixes, enhancements to existing functionality, and new developments in the three areas. 

The webpage for these updates will continue being the Maplesoft R&D Physics webpage. Starting with Maple 2018, however, this update is also available from the MapleCloud.

To install the update: open Maple and click the Cloud icon (upper-right corner), select "Packages" and search for "Physics Updates". Then, in the corresponding "Actions" column, click the third icon (install pop-up).

NOTE May/1: the "Updates" icon of the MapleCloud toolbar (that opens when you click the upper-right icon within a Maple document / worksheet), now works fine, after having installed the Physics Updates version 32 or higher.

These first updates include:

  • New Physics functionality regarding Tensor Products of Quantum States; and Coherent States.
  • Updates to pdsolve regarding PDE & Boundary Conditions (exact solutions);
  • A change in notation: d_(x), the differential of a coordinate in the Physics package, is now displayed as shown in this Mapleprimes post.


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

This is about the recent implementation of tensor products of quantum state spaces in the Physics package, in connection with an exchange with the Physics of Information Lab of the University of Waterloo. As usual this development is available to everybody from the Maplesoft R&D Physics webpage. This is the last update for Maple 2017. The updates for Maple 2018, starting with this same material, will begin being distributed through the MapleCloud next week.

Tensor Product of Quantum State Spaces

 

Basic ideas and design

 

 

Suppose A and B are quantum operators and Ket(A, n), et(B, m) are, respectively, their eigenkets. The following works since the introduction of the Physics package in Maple

with(Physics)

Setup(op = {A, B})

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

 

[quantumoperators = {A, B}]

(1)

A*Ket(A, alpha) = A.Ket(A, alpha)

Physics:-`*`(A, Physics:-Ket(A, alpha)) = alpha*Physics:-Ket(A, alpha)

(2)

B*Ket(B, beta) = B.Ket(B, beta)

Physics:-`*`(B, Physics:-Ket(B, beta)) = beta*Physics:-Ket(B, beta)

(3)

where on the left-hand sides the product operator `*` is used as a sort of inert form (it has all the correct mathematical properties but does not perform the contraction) of the dot product operator `.`, used on the right-hand sides.

 

Suppose now that A and B act on different, disjointed, Hilbert spaces.

 

1) To represent that, a new keyword in Setup , is introduced, to indicate which spaces are disjointed, say as in disjointedhilbertspaces = {A, B}.  We want this notation to pop up at some point as {`ℋ`[A], `ℋ`[B]} where the indexation indicates all the operators acting on that Hilbert space. The disjointedspaces keyword has for synonyms disjointedhilbertspaces and hilbertspaces. The display `ℋ`[A] is not yet implemented.

 

NOTE: noncommutative quantum operators acting on disjointed spaces commute between themselves, so after setting  - for instance - disjointedspaces = {A, B}, automatically, A, B become quantum operators satisfying (see comment (ii) on page 156 of ref. [1])

 

"[A,B][-]=0"

 

2) Product of Kets and Bras (KK, BB, KB and BK) where K and B belong to disjointed spaces, are understood as tensor products satisfying, for instance with disjointed spaces A and B (see footnote on page 154 of ref. [1]),

 

`⊗`(Ket(A, alpha), Ket(B, beta)) = `⊗`(Ket(B, beta), Ket(A, alpha)) 

 

`⊗`(Bra(A, alpha), Ket(B, beta)) = `⊗`(Ket(B, beta), Bra(A, alpha)) 

 

while of course

Bra(A, alpha)*Ket(A, alpha) <> Bra(A, alpha)*Ket(A, alpha)

 

Details

   

 

3) All the operators of one disjointed space act transparently over operators, Bras and Kets of the other disjointed spaces, for example

 

A*Ket(B, n) = A*Ket(B, n)

and the same for the Dagger of this equation, that is

Bra(B, n)*Dagger(A) = Bra(B, n)*Dagger(A)

 

And this happens automatically. Hence, when we write the left-hand sides and press enter, they are automatically rewritten (returned) as the right-hand sides.

 

Note that for the product of an operator times a Bra or a Ket we are not using the notation that expresses the product with the symbol 5.

 

Regarding the display of Bras and Kets and their tensor products, two enhancements are happening:

 

• 

A new Setup option hideketlabel makes all the labels in Kets and Bras to be hidden when displaying Kets, Bras and Bracket(s), with the indices presented one level up, as if they were a sequence of labels, so that:

 "Ket(A,m,n,l"  

is displayed as

Ket(A, m, n, l)

 

  

This is the notation used more frequently when working in quantum information. This hideketlabel option is already implemented entering Setup(hideketlabel = true)

• 

Tensor products formed with operators, or Bras and Kets, that belong to disjointed spaces (set as such using Setup ), are displayed with the symbol 5 in between, as in Ket(A, n)*Ket(B, n) instead of Ket(A, n)*Ket(B, n), and `&otimes;`(A, B) instead of A*B.

Tensor product notation and the hideketlabel option

   

The implementation of tensor products using `*` and `.`

   

Basic exercising with the new functionality

   

Related functionality already in place before these changes

   

Reference

 

[1] Cohen-Tannoudji, Diue, Laloe, Quantum Mechanics, Chapter 2, section F.

[2] Griffiths Robert B., Hilbert Space Quantum Mechanics, Quantum Computation and Quantum Information Theory Course, Physics Department, Carnegie Mellon University, 2014.

See also

   

 


 

Download TensorProductDesign.mw
 

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

Carmichael's lambda(n) function (as it relates to Euler's Totient Function).....this is just one of 8 stages of animation. 

 

Here's the complete animation with supporting music by the mighty Stormtroopers Of Death....

https://youtu.be/QN-s3EpZICs

 

 

 

 

 

Automatic handling of collision of tensor indices in products

 

 

The design of products of tensorial expressions that have contracted indices got enhanced. The idea: repeated indices in certain subexpressions are actually dummies. So suppose T[a, b] and B[b] are tensors, then in T[trace] = T[a, `~a`], a is just a dummy, therefore T[a, `~a`]*B[a] = T[b, `~b`]*B[a] is a well defined object. The new design automatically maps input like T[a, `~a`]*B[a] into T[b, `~b`]*B[a]. This significantly simplifies the manipulation of indices when working with products of tensorial expressions: each tensorial expression being multiplied has its repeated indices automatically transformed into different ones when they would collide with the free or repeated indices of the other expressions being multiplied.

 

This functionality is available within the Physics update distributed at the Maplesoft R&D Physics webpage (but for what you see under Preview that makes use of a new kernel feature of the Maple version under development).

 

restart

with(Physics); Setup(spacetimeindices = lowercaselatin, quiet)

[spacetimeindices = lowercaselatin]

(1)

Define(T[a, b], B[b])

`Defined objects with tensor properties`

 

{B[b], Physics:-Dgamma[a], Physics:-Psigma[a], T[a, b], Physics:-d_[a], Physics:-g_[a, b], Physics:-KroneckerDelta[a, b], Physics:-LeviCivita[a, b, c, d]}

(2)

This shows the automatic handling of collision of indices

T[a, a]*B[a]

T[b, `~b`]*B[a]

(3)

T[a, a]^2

T[a, `~a`]*T[b, `~b`]

(4)

``

Preview only in the upcomming version under development

 

Consider now the case of three tensors

Define(A[a], C[a])

`Defined objects with tensor properties`

 

{A[a], B[b], C[a], Physics:-Dgamma[a], Physics:-Psigma[a], T[a, b], Physics:-d_[a], Physics:-g_[a, b], Physics:-KroneckerDelta[a, b], Physics:-LeviCivita[a, b, c, d]}

(5)

A[a]*B[a]*C[a]

A[a]*B[a]*C[a]

(6)

The product above has indeed the index a repeated more than once, therefore none of its occurrences got automatically transformed into contravariant in the output, and Check  detects the problem interrupting with an error  message

Check(A[a]*B[a]*C[a])

Error, (in Physics:-Check) wrong use of the summation rule for repeated indices: `a repeated 3 times`, in A[a]*B[a]*C[a]

 

 

However, it is now also possible to indicate, using parenthesis, that the product of two of these tensors actually form a subexpression, so that the following two tensorial expressions are well defined, and the colliding dummy is automatically replaced making that explicit

A[a]*B[a]*C[a]

A[b]*B[`~b`]*C[a]

(7)

A[a]*B[a]*C[a]

A[a]*B[b]*C[`~b`]

(8)

 

 

This change in design makes concretely simpler the use of indices in that it eliminates the need for manually replacing dummies. For example, consider the tensorial expression for the angular momentum in terms of the coordinates and momentum vectors, in 3 dimensions

 

Setup(coordinates = cartesian, dimension = 3, metric = euclidean, quiet)

[coordinatesystems = {X}, dimension = 3, metric = {(1, 1) = 1, (2, 2) = 1, (3, 3) = 1}]

(9)

Define L[j], p[k] respectively representing angular and linear momentum

Define(L[j], p[k])

`Defined objects with tensor properties`

 

{Physics:-Dgamma[a], L[j], Physics:-Psigma[a], Physics:-d_[a], Physics:-g_[a, b], p[k], Physics:-KroneckerDelta[a, b], Physics:-LeviCivita[a, b, c], Physics:-SpaceTimeVector[a](X)}

(10)

Introduce the tensorial expression for L[a]

L[a] = LeviCivita[a, b, c]*X[b]*p[c]

L[a] = Physics:-LeviCivita[a, b, c]*Physics:-SpaceTimeVector[b](X)*p[c]

(11)

The left-hand side has one free index, a, while the right-hand side has two dummy indices b and c

Check(L[a] = Physics[LeviCivita][a, b, c]*Physics[SpaceTimeVector][b](X)*p[c], all)

`The repeated indices per term are: `[{`...`}, {`...`}, `...`]*`; the free indices are: `*{`...`}

 

([{}], {a}) = ([{b, c}], {a})

(12)

If we want to compute`#mrow(msup(mfenced(mover(mi("L"),mo("&rarr;")),open = "&Vert;",close = "&Vert;"),mn("2")),mo("&equals;"),msubsup(mi("L"),mi("a"),mn("2")))`we can now take the square of (11) directly, and the dummy indices on the right-hand side are automatically handled, there is now no need to manually substitute the repeated indices to avoid their collision

(L[a] = Physics[LeviCivita][a, b, c]*Physics[SpaceTimeVector][b](X)*p[c])^2

L[a]^2 = Physics:-LeviCivita[a, b, c]*Physics:-SpaceTimeVector[b](X)*p[c]*Physics:-LeviCivita[a, d, e]*Physics:-SpaceTimeVector[d](X)*p[e]

(13)

The repeated indices on the right-hand side are now a, b, c, d, e

Check(L[a]^2 = Physics[LeviCivita][a, b, c]*Physics[SpaceTimeVector][b](X)*p[c]*Physics[LeviCivita][a, d, e]*Physics[SpaceTimeVector][d](X)*p[e], all)

`The repeated indices per term are: `[{`...`}, {`...`}, `...`]*`; the free indices are: `*{`...`}

 

([{a}], {}) = ([{a, b, c, d, e}], {})

(14)

NULL


 

Download AutomaticHandlingCollisionOfTensorIndices.mw

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

--- Prolog.ue ---

The best things in life come free of charge.

Happiness, love, and wisdom of expertise are first few that hit my mind.

As a business economist, I keep my eyes keenly open to opportunities for growth; such as Maple 2017 training session.

It was a Saturday afternoon in Waterloo, ON, this chilly Feburary which was blessed by snowstorm warning.

 

--- Encountering with Maple ---

I was aware of Maple for many years back when my academic career began.

In fact, Maple was available in the lab computers at university. 

But I did not know what to do with it.

Nor did I use any mathematics softwares until recently, but I had this thought : one day I could learn.

The motivation for this `learn how to use it' did not occur to me for a long time (14 years!!).

Things changed this year when I enrolled to an Electrical Engineering program at Lassonde.

Mind you, I have already been using various types of languages and tools such as: Python, C, Java, OpenOfficeSuites, Stata, SAS, Latex just to mention a few.

These stuffs also run on multiple platforms which I am sure you have heard of if you're reading this post; Windows, OSX and Linux. And Maple supports all these major operating systems.

 

--- Why do I like Maple ---

During the first week of school, Dr. Smith would ask us to purchase and practice using MATLAB because it had a relatively easy learning curve for beginners like python and we were going to use it for labs.

Furthermore, students get a huge discount (i.e. $1500 to $50) for these softwares.

Then, the professor also added; "Maple is also a great tool to use, but we won't use it for this class".

ME: ' Why not ? '

The curiosity inside me gave in and I decided to try both!

After all, my laziness in taking derivatives by hand or the possibility of making mistake would disappear if I can verify results using software.

That's it...!

Being able to check correct answer was already worth more than $50.

I can not emphasize this point enough; 

For people in the industry being paid for their time, or students like me who got a busy schedule can not afford to waste any time. (i.e. need to minimize homework effort & frustration, while maximizing the educational attainment & final grades)

Right? Time is money.

Don't we all just want more spare time for things we care?

Googling through many ambiguous Yahoo Answers or online forums like Stackoverflow replies are often misleading and time consuming. 

I have spent years (estimated 3000+ hours) going through those wildly inaccurate webpages hoping for some clearly written information with sub-optimal outcome.

Diverting many hours of study time is not something a first year S.T.E.M. students can afford.

 

--- Maple Training ---

Now you know about my relationships with Maple; Let me describe how the training session went.

I will begin with the sad news first, =(

First of all, there was no coffee available when I arrived. It arrived only after lunch.

Although it was a free event aside other best things in life, this was only a material factor I didn't enjoy at the site. 

Still a large portion of Canadians start their work with a zolt of caffeine in my defence.

Secondly, there was a kind of assumption which expected attendee were familiar with software behavior.

A handful of people were having trouble opening example file, perhaps because of their browser setting or link to preferred software by OS.

Not being able to follow the tutorials as the presenter demonstrated various facets of software substantially diminished the  efficacy of training session for those who could not be on the same page.

These minor annoyances were the only drawbacks I experinced from the event.

 

Here comes the happy side, =)

1. The staffs were considerate enough to provide vegetarion options for inclusive lunch as well as answering all my curious, at times orthogonal questions regarding Maplesoft company.

2. Highly respectable professionals were presenting themselves; 

That is, Prof. Illias Kotsireas, Dr. Erik Postma and Dr. Jürgen Gerhard.

I can not appreciate enough of their contribution for the training in an eloquent and humble manners.

To put it other way, leading of the presentation was well structured and planned out.

In the beginning, Prof. Kotsireas presented `Introduction to Maple' which included terminology and basic behaviors of Maple (i.e. commands and features) with simple examples you can quickly digest. Furthermore, Maple has internal function to interface with Latex! No more typing hours of $$s and many frac{}{}, \delta_{} to publish. In order for me to study all this would have been two-weeks kind of commitment in which he summarized in a couple of hours time. Short-cut keys that are often used by his project was pretty interesting, which will improve work efficiency.

After a brief lunch, which was supplied more than enough for all, Dr. Erik Postma delivered a critical component of simluation. That is, `Random Number Generation'. Again, he showed us some software-related tricks such as `Text mode' vs. `Math mode'.  The default RNG embedded in the software allows reproducible results unless we set seed and randomize further. Main part of the presentation was regarding `Optimization of solution through simulation'. He iteratively improved efficiency of test model, which I will not go in depth here. However, visually and quantitatively showing the output was engaging the attendees and Maple has modularized this process (method available for all the users!!).

Finally, we got some coffee break that allowed to me to push through all the way to the end. I believe if we had some coffee earlier less attendees would have left.

The last part of the training was presented by Dr. Jürgen Gerhard. In this part, we were using various applications of Maple in solving different types of problems. We tackled combinatorics of Fibonacci sequence by formula manipulation. In this particular example he showed us how to optimize logic of a function that made a huge impact in processing time and memory usage. Followed by graph theory example, damped harmonic oscillator, 2 DOF chaotic system, optimization and lastly proof of orthocentre by coding. I will save the examples for you to enjoy in future sessions. 

The way they went through examples were super easy to follow. This can only be done with profound understanding of the subject and a lot of prior effort in preparing the presentation.
 

I appreciate much efforts put together by whom organized this event, allocating their own precious weekend time and allowing many to gain opportunity to learn directly from the person in the house.

 

--- Epilogue ---

My hope for Maple usage lies in enhancing education outcome for first year students, especially in the field of Science and Economics. This is a free opportunity for economic empowerment which is uncaptured.

Engineering students are already pretty good at problem solving, and will figure things out as I witnessed my colleagues have.

However, students of natural sciences and B.A. programs tend to skimp on utilizing tools due to lack of exposure.

Furthermore, I am supporting their development of SaaS, software as service, which delivers modules like gRPC does.

Also, I hope the optimization package from prior version written by Dr. Postma will become available to public sometime.

Here's a BIG thank you to staffs once again, and forgive me for any grammatical errors from rushed writing. I tried to incorporate as much observation as possible gathered from the event.

To contact me, my email is hyonwoo.kee (at) gmail.com;

 

Minimize the number of tensor components according to its symmetries
(and relabel, redefine or count the number of independent tensor components)

 

 

The nice development described below is work in collaboration with Pascal Szriftgiser from Laboratoire PhLAM, Université Lille 1, France, used in the Mapleprimes post Magnetic traps in cold-atom physics

 

A new keyword in Define  and Setup : minimizetensorcomponents, allows for automatically minimizing the number of tensor components taking into account the tensor symmetries. For example, if a tensor with two indices in a 4D spacetime is defined as antisymmetric using Define with this new keyword, the number of different tensor components will be exactly 6, and the elements of the diagonal are automatically set equal to 0. After setting this keyword to true with Setup , all subsequent definitions of tensors automatically minimize the number of components while using this keyword with Define  makes this minimization only happen with the tensors being defined in the call to Define .

 

Related to this new functionality, 4 new Library routines were added: MinimizeTensorComponents, NumberOfIndependentTensorComponents, RelabelTensorComponents and RedefineTensorComponents

 

Example:

restart; with(Physics)

 

Define an antisymmetric tensor with two indices

Define(F[mu, nu], antisymmetric)

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], F[mu, nu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu]}

(1.1)

Although the system knows that F[mu, nu] is antisymmetric, you need to use Simplify to apply the (anti)symmetry

F[mu, nu]+F[nu, mu]

F[mu, nu]+F[nu, mu]

(1.2)

 

Simplify(F[mu, nu]+F[nu, mu])

0

(1.3)

so by default the components of F[mu, nu] do not automatically reflect the (anti)symmetry; likewise

F[1, 2]+F[2, 1]

F[1, 2]+F[2, 1]

(1.4)

Simplify(F[1, 2]+F[2, 1])

0

(1.5)

and computing the array form of F[mu, nu]we do not see the elements of the diagonal equal to zero nor the lower-left triangle equal to the upper-right triangle but for a different sign:

TensorArray(F[mu, nu])

Matrix(%id = 18446744078270093062)

(1.6)

 

On the other hand, this new functionality, here called minimizetensorcomponents, makes the symmetries of the tensor be explicitly reflected in its components.

 

There are three ways to use it. First, one can minimize the number of tensor components of a tensor previously defined. For example

 

Library:-MinimizeTensorComponents(F)

Matrix(%id = 18446744078270064630)

(1.7)

After this, both (1.2) and (1.3) are automatically equal to 0 without having to use Simplify

F[mu, nu]+F[nu, mu]

0

(1.8)

0

0

(1.9)

And the output of TensorArray  in (1.6) becomes equal to (1.7).

 

NOTE: in addition, after using minimizetensorcomponents in the definition of a tensor, say F, all the keywords implemented for Physics tensors are available for F:

 

F[]

F[mu, nu] = Matrix(%id = 18446744078247910206)

(1.10)

F[trace]

0

(1.11)

F[nonzero]

F[mu, nu] = {(1, 2) = F[1, 2], (1, 3) = F[1, 3], (1, 4) = F[1, 4], (2, 1) = -F[1, 2], (2, 3) = F[2, 3], (2, 4) = F[2, 4], (3, 1) = -F[1, 3], (3, 2) = -F[2, 3], (3, 4) = F[3, 4], (4, 1) = -F[1, 4], (4, 2) = -F[2, 4], (4, 3) = -F[3, 4]}

(1.12)

"F[~1,mu,matrix]"

F[`~1`, mu] = Vector[row](%id = 18446744078247885990)

(1.13)

Alternatively, one can define a tensor, specifying that the symmetries should be taken into account to minimize the number of its components passing the keyword minimizetensorcomponents to Define .

 

Example:

 

Define a tensor with the symmetries of the Riemann  tensor, that is, a tensor of 4 indices that is symmetric with respect to interchanging the positions of the 1st and 2nd pair of indices and antisymmetric with respect to interchanging the position of its 1st and 2nd indices, or 3rd and 4th indices, and define it minimizing the number of tensor components

 

Define(R[alpha, beta, mu, nu], symmetric = {[[1, 2], [3, 4]]}, antisymmetric = {[1, 2], [3, 4]}, minimizetensorcomponents)

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], F[mu, nu], Physics:-Psigma[mu], R[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu]}

(1.14)

We now have

R[1, 2, 3, 4]+R[2, 1, 3, 4]

0

(1.15)

R[alpha, beta, mu, nu]-R[mu, nu, alpha, beta]

0

(1.16)
• 

One can always retrieve the symmetry properties in the abstract notation used by the Define command using the new Library:-GetTensorSymmetryProperties, its output is ordered, first the symmetric then the antisymmetric properties

 

Library:-GetTensorSymmetryProperties(R)

{[[1, 2], [3, 4]]}, {[1, 2], [3, 4]}

(1.17)
• 

After making the symmetries explicit (and also before that), it is frequently useful to know the number of independent components of a given tensor. For this purpose you can use the new Library:-NumberOfIndependentTensorComponents

 

Library:-NumberOfIndependentTensorComponents(R)

21

(1.18)

and besides taking into account the symmetries, in the case of the Riemann  tensor, after taking into account the first Bianchi identity this number of components is further reduced to 20.

 

A third way of using the new minimizetensorcomponents functionality is using Setup , so that, automatically, every subsequent definition of tensors with symmetries is performed minimizing the number of its components using the indicated symmetries

 

Example:

Setup(minimizetensorcomponents = true)

[minimizetensorcomponents = true]

(1.19)

So from hereafter you can define tensors taking into account their symmetries explicitly and without having to include the keyword minimizetensorcomponents at each definition

 

Define(C[alpha, beta], antisymmetric)

`Defined objects with tensor properties`

 

{C[mu, nu], Physics:-Dgamma[mu], F[mu, nu], Physics:-Psigma[mu], R[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-KroneckerDelta[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu]}

(1.20)

 

C[]

C[mu, nu] = Matrix(%id = 18446744078408747598)

(1.21)
• 

Two new related functionalities are provided via Library:-RelabelTensorComponents and Library:-RedefineTensorComponent, the first one to have the number of tensor components directly reflected in the names of the components, the second one to redefine only one of these components

Library:-RelabelTensorComponents(C)

Matrix(%id = 18446744078408729774)

(1.22)

 

Suppose now we want to make one of these components equal to 1, say C__2

Library:-RedefineTensorComponent(C[1, 2] = 1)

C[mu, nu] = Matrix(%id = 18446744078270104390)

(1.23)

This nice development is work in collaboration with Pascal Szriftgiser from Laboratoire PhLAM, UMR CNRS 8523, Université Lille 1, F-59655, France.

``

 

Download MinimizeTensorComponents.mw

 

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

 

Hello, 

I study mainly subjects that fall under umbrella of number theory, but i have specified a little further in the worksheet. This is really a request for assistance, because in as much as i have met so many brilliant people online via social media etc,  I would always love to meet more, and especially ones who are more experienced in this field. 

 

Basically i am too cheap and old to think about going to a good university, so I am trying to get free advice from the people who have probably completed doctorates in the relevant field. Got to be honest I say.

 

Anyway my contact email is at the top of the attached worksheet.

 

First thing that stood out to me about the distributions produced in this worksheet is how sparse the number of points is for N=17 relative to all the other values of N.

EXAMPLE_FOR_MAPLE3.mw

 

Edit: Another example worksheet added.

MAPLE_EXAMPLE_13.mw

First 16 17 18 19 20 21 22 Last Page 18 of 56