- 1Departament de Física Quàntica i Astrofísica, Facultat de Física, Universitat de Barcelona, Barcelona, Spain
- 2Institut de Ciències del Cosmos, Universitat de Barcelona, ICCUB, Barcelona, Spain
- 3Departament de Física de la Matèria Condensada, Universitat de Barcelona, Barcelona, Spain
- 4Institut de Nanociència i Nanotecnologia, Universitat de Barcelona, Barcelona, Spain
We report on a quantum mechanics popularisation software, Eigengame, developed to get general audiences to play with key concepts in quantum mechanics, i.e., the wave function, the quantization of energy, the probability density and, to some extent, the measurement problem. The software is developed in python and is available online at github.
1 Introduction
Quantum Technologies are nowadays a reality, with major advances being reported on a regular basis on all fronts: communications, computation, materials, sensing and simulation, see for instance the European Quantum Technologies roadmap Acín et al. (2018). These science and technology efforts need to be complemented with high quality educational and popularisation materials to ensure that our societies understand the main novel and revolutionary concepts that are behind these technologies, an European example is the QTEDU project (www.qtedu.eu).
One of the key concepts in Quantum Mechanics is that of the wave function,
Our goal with Eigengame is to bring general audiences in contact with such quantum mechanical description of a system. To do so, we have developed a computer program with a visually appealing user interface based on the problem of a confined electron in one dimension. The program consists of a guided game in which the user designs a confining potential and chooses one of the corresponding eigenfunctions of the electron with the aim of finding the electron in a region randomly defined by the program when a measurement is made. By playing the game the user develops an intuition on different key concepts of Quantum Mechanics, namely, the spread-out nature of the wave function, the effect of the confining potentials on its structure, the existence of different eigenfunctions associated with different energy levels, the measuring process, etc. A more detailed examination permits a deeper discussion on the meaning and structure of the wave function, from interpretation issues about its meaning to technical features such as the number of nodes of the different eigenfunctions.
The full code can be found in Sabater (2022). A built in version for windows can be downloaded1.
There are several other quantum programs or games that serve as tools to bring quantum science and technologies closer to the general public. An exhaustive analysis of the most outstanding tools in this field can be found in Seskir et al. (2022). In this review, quantum games such as Hello Quantum, Particle in a Box Anupam et al. (2018), QPlayLearn, Virtual Lab by Quantum Flytrap Migdał et al. (2022), Quantum Odyssey Nita et al. (2021), ScienceAtHome and Virtual Quantum Optics Laboratory La Cour et al. (2022) are discussed. All these games deal with different technical aspects of quantum physics such as quantum gates, quantum circuits, ultracold atoms or photons among others. In this project, instead of focusing on a specific phenomenon or application, we try to create a tool to grasp the most fundamental aspects of quantum mechanics that one must understand as a basis for exploring the many applications of quantum theory. Even though there exists a variety of tools to bring quantum science and technologies to the public, their didactic objectives are often not explicit or clear. In this article we focus not only on the functioning and characteristics of the game but we also specify and explain the concepts that should be acquired by playing the game.
Even given the great variety of tools to bring quantum science and technologies to the public, there is no criterion to discern if these tools really fulfil their didactic objective, that is why in this article we not only comment on the functioning and characteristics of the game but also on those concepts that must be acquired by the player after playing the game.
2 Game flow
The goal of the game is to measure an electron inside a random region of space assigned by the program. To achieve this, the player must set up the conditions for the electron such that the modulus of its wave function squared is large in the target zone. This ensures a high probability of finding the particle in the target region.
First, the player has to set up an adequate confining external potential. Then, the energy level has to be chosen among five possible ones: the ground, i.e., lowest energy, state and four excited ones. At this point, the game displays the external potential and the chosen energy level in a plot on the screen. If the player is convinced with this set up, the next step is to calculate the squared modulus of the wave function that is also displayed on the screen. The player can calculate up to three wave functions before being asked to perform a measurement. Once the player is either satisfied with the wave function or has exhausted all three attempts, it is time to measure the position of the electron.
Upon performing a measurement, the electron appears at the bottom of the screen in a randomly selected position, with probability density ρ(x) = |ψ(x)|2. If the electron is within the target region, the player earns one point, and another smaller target appears in a new position. However, if the electron is outside the target the player loses one of his/her initial five lives. Lives can be regained during the game when a heart appears inside a target. If the player hits this target, not only do they earn one point but they also recover a life. The size of the target decreases each time a point is scored until the player has made it to the next level.
Levels are characterised by the number of targets the player must hit with the use of a specific configuration of the external potential and energy level, i.e., with the use of the same wave function. For example, in the second level, there are two targets, and the player performs three different and independent measurements of the position of the electron. To score, each target must be hit by the electron at least in one of the measurements. This design compels the player to use excited levels–with multiple peaks–to maximise the probability density function over the different targets since different targets in different positions must be hit with the use of the same probability density function in various measurements.
The player is guided through all these steps with an initial tutorial that should be overcome before playing the game. The main screen of the game and the different buttons are displayed in Figure 1.
The different functionalities of the buttons numbered in Figure 1 are explained below:
1 Free case. Sets V(x) = 0 inside the box.
2 Harmonic potential well. Set
3 Potential wall. Adds an energy potential wall to V(x). The center, width, and height of the wall can be modeled by the sliders.
4 Potential well. Adds a potential well to V(x). The left and right corners and height of the well can be modified with their respective sliders.
5 Lives indicator. Displays the number of remaining lives the player has. In Figure 1, the player still has all five lives available.
6 Level indicator.
7 Score indicator. Shows how many points the player has scored.
8 Maximum score indicator. Shows the current maximum punctuation achieved in the game.
9 Energy level. For choosing the excited state. E0 corresponds to the ground state, E1 to the first excited state, etc.
10 Wave function. Plots the squared modulus of the wave function on the screen. The white number tells how many attempts are left before measurement is enforced.
11 Eraser. Erases any defined external potentials or energy selected.
12 Target. The electron can appear in the black zone in the lower part. The goal of the game is to make it appear inside the blue zone.
13 Measure. Performs measurement of the position of the electron when pressed, i.e., the electron appears on the bottom of the screen.
14 Menu. Goes back to the initial menu where one can select the language (English, Spanish or Catalan) and access the tutorial if needed.
3 Key learning concepts
This project serves an educational purpose, aiming to help players learn new concepts in physics while also reinforcing their understanding of familiar ones. The game is designed to be accessible to the general public, including individuals without prior knowledge of quantum physics. However, it can also be valuable for bachelor students who are beginning to study quantum physics and wish to solidify their understanding through a practical and enjoyable experience.
There are various key concepts to learn and practice not only while playing the game but also throughout the overall experience, including the introduction, playtime, and potential discussions that may arise. Some concepts are fundamental, while others are more advanced. The importance given to these concepts during a workshop depends on the type of audience. For example, when the audience consists of high school students, the objective should be to ensure their understanding of concepts like probability density function, external potentials, and energy. The quantum nature of the game can serve as a motivating factor for them. On the other hand, if the audience comprises university students or individuals with a background in physics who are already familiar with these concepts, the focus should shift towards explanations and discussions centered on quantum mechanics and its distinctions from classical mechanics.
3.1 Probability density function
The concept of probability is fundamental to the game. Even before understanding what a wave function is, the player must grasp the idea that there exists a probability density function that provides information about the likelihood of the electron collapsing within a specific region. Since position is a continuous variable, its associated probability is described by a continuous function.
Given a probability density f(x) that describes the electron’s position, the probability to find the electron between positions a and b is given by:
This can be easily explained by relating the area below the curve, f(x), between a and b to the probability of finding the electron within that region. Throughout the various stages of the game, the player encounters multiple examples of probability density functions and gains firsthand experience of their meaning and consequences by making several measurements and observing where the electron ultimately collapses or appears.
3.2 The electron
The very concept of the electron is also addressed in the game. The electron serves as the central character since it is the particle described by the wave function, measured by the player, and the target of the game. Therefore, it is advisable to explain the concept of the electron to the participants before they start playing.
Several key questions should be answered or at least raised for the participants to consider. What is an electron? Does it exhibit a similar behaviour to that of classical objects like balls? Where can electrons be found? Can they be observed, and is it possible to track their trajectory? How are electrons described in the context of quantum mechanics?
3.3 Potential energy
Another intrinsic notion of the game is the potential energy. The potential energy is defined as the stored energy possessed by an object due to its position or condition. It is a form of energy that an object possesses by virtue of its relative position, composition, or state. In classical systems, the potential energy is a function of the position of the object, and, in absence of movement, the lowest energy state of the system corresponds to one that minimizes the potential energy. In quantum mechanics, the position is probabilistic and the situation is more intricate.
Figure 2 showcases an example of a confining potential landscape created by combining a harmonic potential with a central barrier, along with the corresponding ground state energy and probability density. While in the classical case, the particle would be found in one of the two minima of the potential well, in the quantum mechanical description the probability extends way into the harmonic confinement and also inside the central barrier. Through the process of constructing suitable confining potentials, the player gains insight into the relation between forces and potential energies. The player also learns how changes in the confining potentials affect the probability distribution function of the electron’s position. This direct feedback reinforces the understanding of the impact of the confining potential on the behavior of the electron’s wave function.
FIGURE 2. Example with a confining potential which is the sum of a harmonic potential and a central barrier. Its ground state energy and squared ground state wave function are also plotted. The confining potential V(x) is depicted in blue, the energy of the eigenstate is plotted with a green line and the squared modulus of the wave function is shown in purple.
The player has access to various pre-defined basic confining potentials, such as the harmonic potential, which can be adjusted by modifying parameters such as the elastic constant k and the center position x0. Additionally, the player has the ability to create custom potential barriers and wells with varying attributes, including height, width, and position. These elements can be combined to create a wide range of confining potential landscapes V(x).
3.4 Energy quantization
So far, the concepts discussed have not been intrinsically related to quantum phenomena. However, the essence of the game revolves around the quantum states of the electron. One of the fundamental quantum concepts that players can learn from the game is energy quantization. Once the player defines a confining potential, they have the option to select the energy level of the electron. However, not all energy values are available for selection. The program calculates the ground state energy of the system (determined by the potential landscape created by the player) and the first four excited state energies using the methods described in Section 5. The player can then choose from these available energy levels.
This moment marks the player’s initial encounter with the concept of energy quantization: energy is not continuous but rather exists in discrete levels. When the player selects an energy level, it is represented by a green horizontal line, as depicted in Figure 2. The player has the freedom to explore different energy levels and observe how the energy values vary, which may not necessarily be uniformly spaced. This showcases the non-continuous nature of energy in quantum systems.
3.5 The wave function
The essence of the game lies in creating different wave functions and its primary objective is to familiarize the player with the concept of wave functions and how they vary for different confining potential configurations and energy levels. At times, the behavior of the wave function for a given confining potential may seem counterintuitive. The game displays the squared modulus of the wave function, with the shaded area underneath representing the physical interpretation of the wave function as a probability density function, among other things. It is important to note that all wave functions appearing in the game are computed rigorously by solving the Schrödinger equation, as is explained in Section 5.
The game provides the opportunity to explore various wave functions by manipulating the parameters that define the confining potentials. This allows the player to observe different wave function patterns, including some that exhibit intriguing phenomena such as the tunnel effect, as illustrated in Figure 3. The figure shows that despite the barrier having higher energy than the electron, there is still a small but nonzero probability of finding the electron on the left side of the barrier. This observation challenges the intuition derived from classical mechanics, where a particle would never be able to cross a barrier with higher energy than its own. If a player constructs a wave function that exhibits the tunnel effect, it is advisable for the workshop coordinator to intervene and explain the concept of the tunnel effect, emphasizing why it cannot be observed within the framework of classical mechanics.
FIGURE 3. Example of a computed wave function that exhibits tunnel effect. The confining potential V(x) is shown in blue, the energy of the eigenstate is plotted with a green line and the squared modulus of the wave function is shown in purple.
3.6 The measurement
The game incorporates the concept of measuring an observable, specifically the position of the electron. After pressing the measurement button, the electron randomly appears at a specific position sampled from the density probability of the eigenstate selected by the user. This measurement process highlights two fundamental concepts in quantum mechanics:
• First, the position of the electron is not predetermined or defined until a measurement is performed. Unlike in classical mechanics, in which the particles’ positions can be known even when not observed, the position of the electron is only determined at the moment of measurement. Without measurement, all our knowledge about the position of the electron is its probability density. The game incorporates this concept by revealing the position to the player only when they perform a measurement.
• Second, the game intends to convey the physical interpretation of the squared modulus of the wave function as a probability density. When a measurement is made, the program randomly selects the electron’s position based on the probability density function dictated by the squared modulus of the wave function. The random selection process is done by the following method: The space is discretized into a finite number of points, each assigned a weight corresponding to the squared modulus of the wave function at that point. These weights are used to construct a cumulative distribution, which assigns a range to each choice based on its probability. This range is determined by the cumulative sum of the probabilities up to that point. For example, if there are three choices with normalized probabilities of 0.2, 0.3, and 0.5, the cumulative distribution would be 0.2, 0.5, and 1.0. A random value between 0 and 1 is then generated, and this value is used to select the corresponding choice based on the cumulative distribution. For instance, if the random value is 0.25, it falls within the range of the second choice (0.2–0.5), so the second choice is selected. Throughout the game, the player can make multiple measurements to experience the direct relationship between the wave function they have created and the actual position of the electron.
4 Specific teaching experience
The game starts with a tutorial that guides the player through the different steps described in Section 2. In principle, the player should be able to play the game and make progress with the explanation and examples of the tutorial. However, the tutorial does not include explanations of the physical phenomena and learning concepts of the game. If one is already familiar with some of the concepts covered in the game, they can play the game individually and get to experience the consequences of the various quantum phenomena. However, if the player is not familiar with quantum physics, playing the game is not enough to learn the concepts presented in Section 3, and the intervention of an instructor or teacher is essential. In this Section we give an example of how a teaching workshop using the game can be organized.
We recommend starting the session with a brief presentation to the participants. In this presentation, the need for a quantum mechanical description of the world should be motivated. A possible way to do it is by exposing the quantum technological revolution we are experiencing today. Then, the instructor should introduce some–all if possible–of the key concepts presented in Section 3 that the player needs to understand in order to succeed in the game. We recommend doing so using examples and screenshots of the game in order to already familiarize the public with the game. Finally, the presentation should include a demonstration or explanation of the steps that must be followed during the game.
Once the presentation is finished the participants should start trying and exploring the game, always beginning with the tutorial. Having one computer per participant is ideal, but if this is not possible, participants can be split into groups of two or three people. While the participants play, the instructor or instructors should be checking that no one is having any problems with the game. As the participants advance through the game technical and quantum-related questions will emerge. The instructor should be able to answer these questions and share them with the rest of the group if considered. Some of these questions can be debated or left open for further investigation by the participant. We recommend having one or two assistant instructors for every 5 to 10 participants since when the participants start playing there are many questions that arise. The game includes a feature that keeps track of the highest score achieved on each computer. This serves as a form of challenge among the participants, providing motivation. A suggested activity could be to encourage players to strive for the highest score.
5 Methods
The main problem to be solved in the course of the game is to solve the time-independent Schrödinger equation in one dimension,
where ϕi(x) are the Hamiltonian eigenstates and Ei their corresponding eigenvalues. We obtain the Hamiltonian eigenstates and eigenvalues by solving the 1D time-independent Schrödinger equation. The Hamiltonian consists of a kinetic term and an external potential term,
the problem is solved for an electron, thus m = me. The external potential is formed by two terms: a potential that can be modulated by the player V(x) and a fixed infinite wall-type potential Vwall(x) so that the electron is confined in a segment of a given size d,
beyond the infinite walls, all eigenstates are exactly zero. Therefore, we are only interested in solving Eq 2 within the region where Vwall(x) = 0 and Vext(x) = V(x). The interval is discretized in n subintervals, n + 1 points, of width δx, such that xk = x0 + k δx, and we note, ϕk ≡ ϕ(xk), Vk ≡ V (xk). The discrete version of Schrödinger equation reads,
where the second derivative of the eigenstate at point xk has been approximated using the values of ϕ at three points: ϕk+1, ϕk, ϕk−1. The boundary conditions beyond the endpoints of the interval are given by
Eq 5 can be expressed in matrix form,
To obtain the eigenstates and self energies, we diagonalize the tridiagonal matrix obtained from the discretized Schrödinger equation. To do that efficiently we use the method from the SciPy library ”linalg.eigh_tridiagonal”, specifically designed to handle tridiagonal matrices Virtanen et al. (2020). In Eigengame, Schrödinger’s equation is solved in an interval d = 10 Å, with x going from -5 Å to 5 Å. The interval is then discretized in 250 steps of width δx = 0.04 Å.
6 Accuracy of the method
The case V(x) = 0 is used as a reference to discuss the accuracy of the methods presented in Section 5. This case corresponds to a trapped electron in a 1D interval and is well-studied. The Hamiltonian eigenstates are known analytically for any x inside the one-dimensional box,
And ψ(x) = 0 for any i when x is outside the box. The correspondent self-energies are,
In Figure 4, we show a comparison between the five lowest energy eigenstates obtained and the analytical ones. The calculated results follow accurately the expected results. When playing the game, only the five lowest energy eigenstates are relevant since the higher energy states are not available to the player. This choice aims to simplify the playing experience by excluding the higher energy states.
FIGURE 4. Computed eigenstates, ϕ(x), symbols, compared to the analytically known eigenstates, ψ(x), continuous lines, for an electron trapped in a 1D box. We only plot half of the computed points for clarity.
Regarding the energy of the states, in Figure 5, we illustrate the relative error in percentage by comparing the calculated energy with the analytical one for each analytic state i using 250 and 500 space steps. When employing 500 steps, a significantly lower error is achieved; however, the computation time increases. Considering the gaming experience, it is crucial to minimize computation time to ensure a fluent and uninterrupted interaction between the player and the game, without any waiting times. Consequently, despite a larger error, the discretization of 250 steps is utilized. It can be seen that the relative error increases with the excitation level. When using 250 steps, we obtain a sizeable relative error of approximately 12% for the excited state i = 100. Nonetheless, it is important to note that during the game, only the ground state and the first four excited states are implemented. For these initial five states, using 250 steps yields a relative error smaller than 0.04%, as depicted in Figure 5B. Based on these observations, we conclude that the employed method with 250 steps provides sufficient accuracy for the purposes of the game.
FIGURE 5. Relative error in percentage between the computed energy and the analytical one as a function of the state number i for an electron trapped in a 1D box using 250 and 500 steps in the discretisation of x. In (A) we show the relative error corresponding to the first one hundred eigenstates. In (B) only the relative error of the first five is shown.
Data availability statement
The original contributions presented in the study are included in the article/Supplementary material, further inquiries can be directed to the corresponding authors.
Author contributions
FS, CC, and BJ-D discussed the main lines of the game and its practical implementation. All programming aspects have been done entirely by FS. All authors contributed to the article and approved the submitted version.
Funding
This work has been financially supported by the Ministry of Economic Affairs and Digital Transformation of the Spanish Government through the QUANTUM ENIA project call – Quantum Spain project, and by the European Union through the Recovery, Transformation and Resilience Plan – NextGenerationEU within the framework of the Digital Spain 2026 Agenda.
Acknowledgments
We thank Anna Moreso, Abel Rojo, and Marti de Ferrer for their feedback during the completion of this work.
Conflict of interest
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
Publisher’s note
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.
Footnotes
1https://serviparticules.ub.edu/materials/aplicacions/act-1-eigengame-introduccio-a-la-fisica-quantica
References
Acín, A., Bloch, I., Buhrman, H., Calarco, T., Eichler, C., Eisert, J., et al. (2018). The quantum technologies roadmap: a european community view. New J. Phys. 20, 080201. doi:10.1088/1367-2630/aad1ea
Anupam, A., Gupta, R., Naeemi, A., and JafariNaimi, N. (2018). Particle in a box: an experiential environment for learning introductory quantum mechanics. IEEE Trans. Educ. 61, 29–37. doi:10.1109/TE.2017.2727442
La Cour, B. R., Maynard, M., Shroff, P., Ko, G., and Ellis, E. (2022). “The virtual quantum optics laboratory,” in 2022 IEEE International Conference on Quantum Computing and Engineering (QCE) (IEEE), 677–687.
Messiah, A. (2014). Quantum mechanics. Newburyport, United States: Dover Publications: Dover Books on Physics.
Migdał, P., Jankiewicz, K., Grabarz, P., Decaroli, C., and Cochin, P. (2022). Visualizing quantum mechanics in an interactive simulation – virtual Lab by quantum Flytrap. Opt. Eng. 61, 081808. doi:10.1117/1.OE.61.8.081808
Nita, L., Chancellor, N., Smith, L. M., Cramman, H., and Dost, G. (2021). Inclusive learning for quantum computing: supporting the aims of quantum literacy using the puzzle game quantum odyssey. arXiv preprint arXiv:2106.07077.
Sabater, F. (2022). Eigengame. Available at: https://github.com/brunojulia/quantumlabUB/tree/master/eigengame.
Seskir, Z. C., Migdał, P., Weidner, C., Anupam, A., Case, N., Davis, N., et al. (2022). Quantum games and interactive tools for quantum technologies outreach and education. Opt. Eng. 61, 081809. doi:10.1117/1.OE.61.8.081809
Keywords: quantum mechanics, wave function, probability, measurement, game
Citation: Sabater F, Calero C and Juliá-Díaz B (2023) Eigengame: a primer to introduce wave functions and probabilities. Front. Quantum Sci. Technol. 2:1249325. doi: 10.3389/frqst.2023.1249325
Received: 28 June 2023; Accepted: 13 October 2023;
Published: 26 October 2023.
Edited by:
Marisa Michelini, University of Udine, ItalyReviewed by:
Jorge Yago Malo, University of Pisa, ItalyMarcin Wieśniak, University of Gdansk, Poland
Salvatore Lorenzo, University of Palermo, Italy
Copyright © 2023 Sabater, Calero and Juliá-Díaz. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.
*Correspondence: Francesc Sabater, ZnJzYWJhdGc3QGFsdW1uZXMudWIuZWR1; Bruno Juliá-Díaz, YnJ1bm9qdWxpYUB1Yi5lZHU=