## Graph Theory and Pokémon Application

by: Maple 2019 Maple Toolboxes

Hi there!

One of my favorite videogames is pokémon as you can probably guess from the title. As a player I always wanted to optimize my chances of obtaining the rarest and best pokémon in the game. I have been working on an application that aims to use graph theory to analyze the game Pokémon Blue. The application explores the following questions:

Which is the rarest pokémon in the game?
Where can I find an specific pokémon and with what probabilities?
What is the place with most different species of wild pokémon?

I also included algorithms for the following: Given a certain desired team

• Find the minimum amount of places to visit to catch them and return the list of the places the player will need to visit.
• What are the routes with best probabilities to catch each pokémon from my desired team?

Check out my application at: https://www.maplesoft.com/applications/view.aspx?SID=154565.

The following are some of the results obtained in the app:

What is the most common pokémon?

I did not only considered the amount of places a pokémon can appear in but also the probabilities of it appearing in each place.

What are the connections between pokémon and places?

In my graph, I connected a pokémon and a place if such pokémon could be caught in that place. The following is an example for the pokémon Pidgey. The weights of the edges are the probabilities of finding Pidgey in each route.

Viceversa, I did the same for how a route is connected to the pokémons in it:

Map of the Game
I also generated a colour coded version for the map of the game: where blue means that the place is a water route, brown means it's a cave and green means it's a tall-grass route.
It's amazing what Maple's graph theory toolbox can do.

We are currently in the process of updating the support FAQs at https://faq.maplesoft.com. We’ve been working on updating the existing content for clarity, and have added several new articles already.

The majority of our FAQs are from questions people ask us in Technical Support at support@maplesoft.com, but we’d also like to like to add content from other sources.

Since we have such a great community here at MaplePrimes, we wanted to reach out and ask if there are any articles or questions that you'd like to see added to our FAQ.

We look forward to hearing your feedback!

## How to solve system of PDEs in maple?...

I want to solve the following system using PDE Solve command but finding an error. Please help me in this regard. Thanks!

restart; d1 := 1; d2 := 1; AA := 0.2e-2; BB := 0.79e-1; L := 1;
with(PDEtools, casesplit, declare);
PDE1 := diff(u(x, t), t) = d1*(diff(u(x, t), x, x))-u(x, t)*v(x, t)^2+AA*(1-u(x, t)); PDE2 := diff(v(x, t), t) = d1*(diff(v(x, t), x, x))+u(x, t)*v(x, t)^2-BB*v(x, t);
/  2         \
d            | d          |                  2
PDE1 := --- u(x, t) = |---- u(x, t)| - u(x, t) v(x, t)  + 0.002
dt           |   2        |
\ dx         /

- 0.002 u(x, t)
/  2         \
d            | d          |                  2
PDE2 := --- v(x, t) = |---- v(x, t)| + u(x, t) v(x, t)
dt           |   2        |
\ dx         /

- 0.079 v(x, t)
IBC1 := {u(0, t) = 1, u(1, t) = 1, u(x, 0) = 1-(1/2)*sin(Pi*(x-L)/(2*L))^100}; IBC2 := {v(0, t) = 0, v(1, t) = 0, v(x, 0) = (1/4)*sin(Pi*(x-L)/(2*L))^100}; dys1 := {IBC1, IBC2, PDE1, PDE2};
/              /  2         \
| d            | d          |                  2
dys1 := < --- u(x, t) = |---- u(x, t)| - u(x, t) v(x, t)  + 0.002
| dt           |   2        |
\              \ dx         /

- 0.002 u(x, t),

/  2         \
d            | d          |                  2
--- v(x, t) = |---- v(x, t)| + u(x, t) v(x, t)  - 0.079 v(x, t),
dt           |   2        |
\ dx         /

/                                                           100
|                                        1    /1           \
< u(0, t) = 1, u(1, t) = 1, u(x, 0) = 1 - - sin|- Pi (x - 1)|
|                                        2    \2           /
\

\
|
>,
|
/

/                                                       100\
|                                    1    /1           \   |
< v(0, t) = 0, v(1, t) = 0, v(x, 0) = - sin|- Pi (x - 1)|    >
|                                    4    \2           /   |
\                                                          /

\
|
>
|
/
pds := pdsolve(dys1, numeric, time = t, range = 0 .. 1);
Error, (in pdsolve) invalid input: `pdsolve/numeric` expects its 2nd argument, IBCs, to be of type {list, set}, but received time = t
p1 := pds:-plot(t = 0, numpoints = 50);

p2 := pds:-plot(t = 1/8, numpoints = 50, color = blue);

p3 := pds:-plot(t = 1/4, numpoints = 50, color = green);

plots[display]({p1, p2, p3});
Error, `pds` does not evaluate to a module
Error, `pds` does not evaluate to a module
Error, `pds` does not evaluate to a module
Error, (in plots:-display) expecting plot structures but received: {p1, p2, p3}

## Problem with the GlobalOptimization Toolbox...

Hi,

I have some trouble using the GlobalOprimization Toolbox (GoT)
When used with some options GoT returns an error message indicating the option is not valid.
For instance options (just a few among some others) "numexperiments", "nugget", "optsearch", "goal", ... are not recognized.

I'm using Maple 2018.0 (I don't know how to recover the number of the GlobalOptimization Toolbox).

Is it an installation problem (GotT has been bought legally) or a problem with this Toolbox ?

TIA

## Maple Conference – New Deadline for Submissions

by: Maple Maple Toolboxes

I just wanted to let everyone know that the Call for Papers and Extended Abstracts deadline for the Maple Conference has been extended to June 14.

The papers and extended abstracts presented at the 2019 Maple Conference will be published in the Communications in Computer and Information Science Series from Springer. We welcome topics that fall into the following broad categories:

• Maple in Education
• Algorithms and Software
• Applications of Maple

https://www.maplesoft.com/mapleconference/Papers-and-Presentations.aspx

Hope to hear from you soon!

## Introducing the Maple Quantum Chemistry Toolbox

Quantum Chemistry Toolbox from RDMChem

Maple 2019 has a new add-on package Maple Quantum Chemistry Toolbox from RDMChem for computing the energies and properties of molecules.  As a member of the team at RDMChem that developed the package, I would like to tell the story of its origins and provide a brief demonstration of the package.

Thinking about Quantum Chemistry at Harvard

The story of the Maple Quantum Chemistry Toolbox begins with my graduate studies in Chemical Physics at Harvard University in the late 1990s.  Even in 1998 programs for computing the energies and properties of molecules were extremely complicated and nonintuitive.  Many of the existing programs had begun in the 1970s on computers whose programs would be recorded on punchcards.

Fig. 1: Used Punchcard by Pete Birkinshaw from Manchester, UK CC BY 2.0

Even today some of these programs have remnants of their early versions such as input files that must start on the second column to account for the margin of the now non-existent punchcards.  As a student, I made a bound copy of one of these manuals at a local Kinkos photocopy shop and later found myself in Harvard Yard, thinking that there must be a better way to present quantum chemistry computations.  The idea for a Maple-like package for quantum chemistry was born in that moment.

At the same time I was learning about something called the two-electron reduced density matrix (2-RDM).  The basic variable in quantum chemistry is the wave function which is the probability amplitude for finding each of the electrons in a molecule.  Because electrons are indistinguishable with pairwise interactions, the wave function contains much more information than is needed for computing the energies and electronic properties of molecules.  The energies and properties of any molecule with any number of electrons can be expressed as a function of a 2 electron matrix, the 2-RDM [1-3].  A quantum chemistry based on the 2-RDM, it was known, would have potentially significant advantages over wave function calculations in terms of accuracy and computational cost, especially for molecules far from the mean-field limit.  A 2-RDM approach to quantum chemistry became the focus of my Ph.D. thesis.

Representing Many Electrons with Only Two Electrons

The idea of using the 2-RDM in quantum chemistry can be attributed to four scientists: two physicists Kodi Husimi and Joseph Mayer, a chemist Per-Olov Lowdin, and a mathematician John Coleman [1-3].  In the early 1940s Husimi first published the idea in a Japanese physics journal, but in the midst of World War II the paper was not widely disseminated in the West.  In the summer of 1951 John Coleman, which attending a physics conference at Chalk River, realized that the ground-state energy of any atom or molecule could be expressed as functional of the 2-RDM, and similar ideas later occurred to Per-Olov Lowdin and Joseph Mayer who published their ideas in Physical Review in 1955.  It was soon recognized that computing the ground-state energy of an atom or molecule with the 2-RDM was potentially difficult because not every two-electron density matrix corresponds to an N-electron density matrix or wave function.  The search for the appropriate constraints on the 2-RDM, known as N-representability conditions, became known as the N-representability problem [1-3].

Beginning in the late 1990s and early 2000s, Carmela Valdemoro and Diego Alcoba at the Consejo Superior de Investigaciones Científicas (Madrid, Spain), Hiroshi Nakatsuji, Koji Yasuda, and Maho Nakata at Kyoto University (Kyoto, Japan), Jerome Percus and Bastiaan Braams at the Courant Institute (New York, USA), John Coleman and Robert Erdahl at Queens University (Kingston, Canada), and my research group and I at The University of Chicago (Chicago, USA) began to make significant progress in the computation of the 2-RDM without computing the many-electron wave function [1-3].  Further contributions were made by Eric Cances and Claude Le Bris at CERMICS, Ecole Nationale des Ponts et Chaussées (Marne-la-Vallée, France), Paul Ayers at McMaster University (Hamilton, Canada), and Dimitri Van Neck at the University of Ghent (Ghent, Belgium) and their research groups.  By 2014 several powerful 2-RDM methods had emerged for the computation of molecules.  The Army Research Office (ARO) issued a proposal call for a company to develop a modern, built-from-scratch package for quantum chemistry that would contain two newly developed 2-RDM-based methods from our group: the parametric 2-RDM method [1] and the variational 2-RDM method with a fast algorithm for solving the semidefinite program [4,5,6].   The company RDMChem LLC was founded to work with the ARO to develop such a package built around RDMs, and hence, the name of the company RDMChem was selected as a hybrid of the RDM abbreviation for Reduced Density Matrices and the Chem colloquialism for Chemistry.  To achieve a really new design for an electronic structure package with access to numeric and symbolic computations as well as advanced visualizations, the team at RDMChem and I developed a partnership with Maplesoft to build something new that became the Maple Quantum Chemistry Package (or Toolbox), which was released with Maple 2019 on Pi Day.

Maple Quantum Chemistry Toolbox

The Maple Quantum Chemistry Toolbox provides a powerful, parallel platform for quantum chemistry calculations that is directly integrated into the Maple 2019 environment.  It is optimized for both cutting-edge research as well as chemistry education.  The Toolbox can be used from the worksheet, document, or command-line interfaces.  Plus there is a Maplet interface for rapid exploration of molecules and their properties.  Figure 2 shows the Maplet interface being applied to compute the ground-state energy of 1,3-dibromobenzene by density functional theory (DFT) in a 6-31g basis set.

Fig. 2: Maplet interface to the Quantum Chemistry Toolbox 2019, showing a density functional theory (DFT) calculation

After entering a name into the text box labeled Name, the user can click on: (1) the button Web to import the geometry from an online database containing more than 96 million molecules,  (2) the button File to read the geometry from a standard XYZ file, or (3) the button Input to enter the geometry.  As soon the geometry is entered, the Maplet displays a 3D picture of the molecule in the window on the right of the options.  Dropdown menus allow the user to select the basis set, the electronic structure method, and a boolean for geometry optimization.  The user can click on the Compute button to perform the computation.  When the quantum computation completes, the total energy appears in the box labeled Total Energy.  The dropdown menu Analyze contains a list of data tables, plots, and animations that can be selected and then displayed by clicking the Analyze button.  The Maplet interface contains nearly all of the options available in the worksheet interface.   The Help Pages of the Toolbox include extensive curricula and lessons that can be used in undergraduate, graduate, and even high school chemistry courses.  Next we look at some sample calculations in the worksheet interface.

Reproducing an Early 2-RDM Calculation

One of the earliest variational calculations of the 2-RDM was performed in 1975 by Garrod, Mihailović,  and  Rosina [1-3].  They minimized the electronic ground state of the 4-electron atom beryllium as a functional of only two electrons, the 2-RDM.  They imposed semidefinite constraints on the particle-particle (D), hole-hole (Q), and particle-hole (G) metric matrices.  They solved the resulting optimization problem of minimizing the energy as a linear function of the 2-RDM subject to the semidefinite constraints, known as a semidefinite program, by a cutting-plane algorithm.  Due to limitations of the cutting-plane algorithm and computers circa 1975, the calculation was a difficult one, likely taking a significant amount of computer time and memory.

With the Quantum Chemistry Toolbox we can use the command Variational2RDM to reproduce the calculation on a Windows laptop.  First, in a Maple 2019 worksheet we load the commands of the Add-on Quantum Chemistry Toolbox:

 > with(QuantumChemistry);
 (1.1)

Then we define the atom (or molecule) using a Maple list of lists that we assign to the variable atom:

 > atom := [["Be",0,0,0]];
 (1.2)

We can then perform the variational 2-RDM method with the Variational2RDM command to compute the ground-state energy and properties of beryllium in a minimal basis set like the one used by Rosina and his collaborators.  By default the method uses the D, Q, and G N-representability conditions and the minimal "sto-3g" basis set.  The calculation, which completes in seconds, contains a wealth of information in the form of a convenient Maple table that we assign to the variable data.

 > data := Variational2RDM(atom);
 (1.3)

The table contains the total ground-state energy of the beryllium atom in the atomic unit of energy (hartrees)

 > data[e_tot];
 (1.4)

We also have the atomic orbitals (AOs) employed in the calculation

 > data[aolabels];
 (1.5)

as well as the Mulliken populations of these orbitals

 > data[populations];
 (1.6)

We see that 2 electrons are located in the 1s orbital, 1.8 electrons in the 2s orbital, and about 0.2 electrons in the 2p orbitals.  By default the calculation also returns the 1-RDM

 > data[rdm1];
 (1.7)

The eigenvalues of the 1-RDM are the natural orbital occupations

 > LinearAlgebra:-Eigenvalues(data[rdm1]);
 (1.8)

We can display the density of the 2s-like 2nd natural orbital using the DensityPlot3D command providing the atom, the data, and the orbitalindex keyword

 > DensityPlot3D(atom,data,orbitalindex=2);

Similarly,  using the DensityPlot3D command, we can readily display the 2p-like 3rd natural orbital

 > DensityPlot3D(atom,data,orbitalindex=3);

By using Maple keyword arguments in the Variational2RDM command, we can readily change the basis set, use point-group symmetry, add active orbitals with or without self-consistent-field, change the N-representability conditions, as well as explore many other options.  Having reenacted one of the first variational 2-RDM calculations ever, let's examine a more complicated molecule.

Explosive TNT

We consider the molecule TNT that is used as an explosive. Using the command MolecularGeometry, we can import the experimental geometry of TNT from the online PubChem database.

 > mol := MolecularGeometry("TNT");
 (1.9)

The command PlotMolecule generates a 3D ball-and-stick plot of the molecule

 > PlotMolecule(mol);

We perform a variational calculation of the 2-RDM of TNT in an active space of 10 electrons and 10 orbitals by setting the keyword active to the list [10,10].  The keyword casscf is set to true to optimize the active orbitals during the calculation.  The keyword basis is used to set the basis set to a minimal basis set sto-3g for illustration.

 > data := Variational2RDM(mol, active=[10,10], casscf=true, basis="sto-3g");
 (1.10)

The ground-state energy of TNT in hartrees is

 > data[e_tot];
 (1.11)

Unlike beryllium, the electric dipole moment of TNT in debyes is nonzero

 > data[dipole];
 (1.12)

We can easily visualize the dipole moment relative to the molecule's ball-and-stick model with the DipolePlot command

 > DipolePlot(mol,method=Variational2RDM, active=[10,10], casscf=true, basis="sto-3g");

The 1-RDM is returned by default

 > data[rdm1];
 (1.13)

The natural molecular-orbital (MO) occupations are the eigenvalues of the 1-RDM

 > data[mo_occ];
 (1.14)

All of the occupations can be viewed at once by converting the Vector to a list

 > convert(data[mo_occ], list);
 (1.15)

We can visualize these occupations with the MOOccupationsPlot command

 > MOOccupationsPlot(mol,method=Variational2RDM, active=[10,10], casscf=true, basis="sto-3g");

The occupations, we observe, show significant deviations from 0 and 2, indicating that the electrons have substantial correlation beyond the mean-field (Hartree-Fock) limit.  The blue lines indicate the first N/2 spatial orbitals where N is the total number of electrons while the red lines indicate the remaining spatial orbitals.  We can visualize the highest "occupied" molecular orbital (58) with the DensityPlot3D command

 > DensityPlot3D(mol,data, orbitalindex=58);

Similarly, we can visualize the lowest "unoccupied" molecular orbital (59) with the DensityPlot3D command

 > DensityPlot3D(mol,data, orbitalindex=59);
 >

Comparison of orbitals 58 and 59 reveals an increase in the number of nodes (changes in the phase of the orbitals denoted by green and purple), which reflects an increase in the energy of the orbital.

The Maple Quantum Chemistry Toolbox 2019, an new Add-on for Maple 2019 from RDMChem, provides a easy-to-use, research-grade environment for the computation of the energies and properties of atoms and molecules.  In this blog we discussed its origins in graduate research at Harvard, its reproduction of an early 2-RDM calculation of beryllium, and its application to the explosive molecule TNT.  We have illustrated only some of the many features and electronic structure methods of the Maple Quantum Chemistry package.  There is much more chemistry and physics to explore.  Enjoy!

Selected References

[1] D. A. Mazziotti, Chem. Rev. 112, 244 (2012). "Two-electron Reduced Density Matrix as the Basic Variable in Many-Electron Quantum Chemistry and Physics"

[2]  Reduced-Density-Matrix Mechanics: With Application to Many-Electron Atoms and Molecules (Adv. Chem. Phys.) ; D. A. Mazziotti, Ed.; Wiley: New York, 2007; Vol. 134.

[3] A. J. Coleman and V. I. Yukalov, Reduced Density Matrices: Coulson’s Challenge (Springer-Verlag,  New York, 2000).

[4] D. A. Mazziotti, Phys. Rev. Lett. 106, 083001 (2011). "Large-scale Semidefinite Programming for Many-electron Quantum Mechanics"

[5] A. W. Schlimgen, C. W. Heaps, and D. A. Mazziotti, J. Phys. Chem. Lett. 7, 627-631 (2016). "Entangled Electrons Foil Synthesis of Elusive Low-Valent Vanadium Oxo Complex"

[6] J. M. Montgomery and D. A. Mazziotti, J. Phys. Chem. A 122, 4988-4996 (2018). "Strong Electron Correlation in Nitrogenase Cofactor, FeMoco"

## The Maple Conference is Back!

by: Maple Maple Toolboxes

It is my pleasure to announce the return of the Maple Conference! On October 15-17th, in Waterloo, Ontario, Canada, we will gather a group of Maple enthusiasts, product experts, and customers, to explore and celebrate the different aspects of Maple.

Specifically, this conference will be dedicated to exploring Maple’s impact on education, new symbolic computation algorithms and techniques, and the wide range of Maple applications. Attendees will have the opportunity to learn about the latest research, share experiences, and interact with Maple developers.

In preparation for the conference we are welcoming paper and extended abstract submissions. We are looking for presentations which fall into the broad categories of “Maple in Education”, “Algorithms and Software”, and “Applications of Maple” (a more extensive list of topics can be found here).

## How to install MapleToolbox2018.0LinuxX64?...

Hello,

I try to install MapleToolbox2018.0LinuxX64Installer.run I run it as root or with sudo command, but everytime I finish with below message:

Choose Maple 2018 Folder

[/opt/maple2018]:  /opt/exp_soft/local/generic/maple/2018

----------------------------------------------------------------------------
Choose MATLAB Folder

[]: /opt/exp_soft/local/generic/matlab/R2016b

Warning: The installer has detected a previous version of the Maple Toolbox in
Press [Enter] to continue:
Warning: The directory
/opt/exp_soft/local/generic/matlab/R2016b
is not writable by the current user

I'm not sure what to do with it.

---
Regards,

Bartek

## Maple ToolBox 2017.0 and MATLAB R2017a...

I've got Maple 2017 linked to MATLAB R2017a but I can't get MATLAB R2017a linked to Maple 2017.

I've got MATLAB R2016b linked to Maple 2017.

Any ideas? (Or do I just need to wait for an update?)

## Maple symbolic toolbox for matlab...

I have an important question regarding the symbolic toolbox from maple for matlab

I have declared three symbolic variables:

syms t;

x = sym('x(t)', 'real');

y = sym('y(t)', 'real');

z = sym('z(t)', 'real');

f = x + y + z;

Now i want to  calculate the derivation of f regarding the variable t:

df = diff (f, t);

The result should be

df = dx(t) / dt + dy(t) / dt + dz(t) / dt

but  instead i get the result df = 0. If i use the command diff (f) i get the result

df = dx(t) / dt

Does anyone know how to fix this problem?

## Is there a routine for the Clarke and Wright Savin...

I was looking to see if anyone has come across a Maple routine for a savings algorithm - specifically, Clarke and Wright. In fact, any classical savings heuristic would also be interesting.

Any guidance would be truly appreciated.

## StackExchange site for maple

 I have proposed a SE site for maple. This will help to put maple on SE. Please follow this site. http://area51.stackexchange.com/proposals/107315/maple

Update

We have moved to the next phase Commitment. Come and join us.

## Global Optimization, issues with getCompiledProc ?...

Hi,

Ive been trying to use the global optimization toolbox to optimize a model I extract from the maplesim environment.
It works fine with the regular Optimization toolbox. but when I run the optimization on the Global toolbox I get this error:

Warning, Error at t=0.0000000000000000e+000: index-1 and derivative evaluation failure

to explain a little,
I use the getCompiledProc command to turn the maplesim model into a module to be used in maple.

pjf

## How to achieve its numerical solution？...

I  encountered a non-integrable integral in the process of solving the following process, . How to achieve its numerical solution? Such as in a looping   code：

#######
pa[i] := pa[i-1]-(Int(subs(t = tau, Lpa[i-1]+Na1[i-1]-Na2[i-1]), tau = 0 .. t));

pw[i] := pw[i-1]-(Int(subs(t = tau, Lpw[i-1]+Nw1[i-1]-Nw2[i-1]), tau = 0 .. t)); u[i] := u[i-1]-(Int(subs(t = tau, Lu[i-1]+Nu1[i-1]+Nu2[i-1]), tau = 0 .. t))；

######
Detailed code see annexBC2.mw

## How to use the Grid Computing Toolbox with Groebn...

Hello

I have a procedure that builds an ideal from a specific set of polynomials and then calls the Groebner basis package to eliminate some of the variables.  Even though the procedure is running on a machine with 2 processors, 24 cores and 72 GB of ram, only one core has been used (and is always on a 100% usage).  Would the Grid Computing Toolbox be of some hope in this case?  If so,  how to insert the Grid commands so that Maple sends the calculations to the other cores (I find the document rather confusing)?   If I am talking non sense,  please let me know.

Many thanks

Ed

 1 2 3 4 5 6 7 Page 1 of 8
﻿