What Interactive Quantum Learning Looks Like by@ocean
1,431 reads

What Interactive Quantum Learning Looks Like

October 4th 2022
5 min
by @ocean 1,431 reads
tldt arrow
EN
Read on Terminal Reader

Too Long; Didn't Read

Quantum mechanics (and probably most of the other things ) can be learned in a fun interactive manner using Jupyter Notebooks hosted on Google Colab. This is a story of how to do it.

Company Mentioned

Mention Thumbnail
featured image - What Interactive Quantum Learning Looks Like
Faheel Hashmi HackerNoon profile picture

@ocean

Faheel Hashmi

I teach physics.

About @ocean
LEARN MORE ABOUT @OCEAN'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

Quantum mechanics can be learned interactively using Jupyter Notebooks hosted on Google Colab. This is a story on how to do it. If you are the person who plugs in the new device first and reads instructions later (if ever), then you can directly jump to the introduction to quantum mechanics. Else read on.

Why Quantum Mechanics?

Quantum mechanics is about to give rise to the next technological revolution. It already led to the one in the lifetime of many of us with the rise of electronic gadgets and computing devices. Everybody reading this post is highly likely to be holding and surrounded by a host of devices making use of quantum principles in one way or another.

Quantum mechanics is a beautiful theory. It is often regarded as the greatest achievement of mankind. It has helped us crack the code of nature and program it for our own purpose. And it is about to give rise to more magic. Quantum teleportation has already been realized. It is now just a matter of time to scale the teleportation to more interesting things.

Quantum information processing, quantum computers, and quantum cryptography are on their way. It is again highly likely that a few people reading this post will witness the new quantum revolution in their lifetimes.

The theory also has a philosophical dimension. It addresses the problems like the nature of reality, the possibility of free will, and the explanation for consciousness. So whether you wish to learn the secrets of nature, be part of the next technological revolution, or ponder the meaning of existence, quantum mechanics has something to teach you.

Is it too hard?

The basic theory is really simple. Everyone familiar with high school algebra can follow the quantum description of a few simple systems. This is the idea behind the introduction to quantum mechanics. Things required to follow the quantum discussion in the link are.

  1. Vectors (quantities with a magnitude and a direction).
  2. Column matrices (just a representation of a vector).
  3. Complex numbers (square root of -1).
  4. Graphs of functions.

With this much arsenal, one becomes ready to learn the most profound theory that man has ever built.

Why interactive learning?

Covid has brought to the limelight a host of platforms and resources for online learning. The top resource is the video lectures that are available for every topic you can think of. The con of this resource is excessive time consumption. And if you wish to refer back to a point that was discussed in some video at some point, then good luck with finding it.

The next resource consists of lecture notes, blog posts, books, etc. This is fine on its own. But what if we spice it up with interactive learning?

A blog post lecture accompanied with an interface for the student to interact with the material presented in the lecture.

Example 1: Quantum mechanics of a free particle

In quantum mechanics, we learn that the position information of a particle is extracted from a function called wavefunction in the following manner.

The modulus square of the wavefunction at some point is the probability of finding the particle in a narrow strip at that point.

Compare it with the following.

image

An interface is provided where one can select a point along the x-axis by sliding a circle on the bar, and a graph is shown of the modulus square of the wavefunction with a narrow strip shown in a different color. When a new point is selected, a code runs in the background and the probability of finding the particle at the new position (in the green strip actually) is updated.

This can be the new interactive way of learning things online.

The above interface and the functionality are created using the code below.

import ipywidgets as wids
import numpy as np
import scipy.integrate as integrate
import matplotlib.pyplot as plt
def gaus(x,x0,epsilon):
  return (np.exp(-(x-x0)**2/(epsilon)))
def psi(x):
  return ((-gaus(x,-2.5,2)+2.5*gaus(x,0,2))*np.sin(x))
print("Choose a point along x asis.")
NormConst=integrate.quad(lambda x: psi(x)**2,-10,10)
def f(x0=0):
 # print(x0)
 # print (NormConst[0])
  x=np.linspace(-5,5,10000)
  plt.xlabel("Distance $x$ (arb. units)")
  plt.ylabel ("Normalized probability density")
  plt.yticks([])
  y= psi(x)**2
  y0= psi(x0)**2
  plt.plot(x,y)
  plt.bar(x0,y0,.2,color="green")
  probx= 0.2*y0/NormConst[0]
  print("The probability of finding the particle")
  print("\nin the neighbourhood of x=%.2f"%x0)
  print("\nis approximately %.3f"%probx)
wids.interact(f,x0=wids.FloatSlider(value=1.0,min=-5.0,max=5.0,step=0.05))  

Example 2: Quantum mechanics of a bound particle.

Here is another example. If we restrict the motion of a quantum particle to a given region, then we have some special wavefunctions labeled by an integer. The interface to learn about these new wavefunctions and the associated position probabilities is shown below.

image

The interface provides two sliders for two inputs. The integer input selects the special wavefunction, and its square is plotted. The second input selects the point along the x-axis and gives the probability as in the previous example.

The introduction to quantum mechanics also has a third example where the probabilities are calculated in a more simple way.

How does it work?

Now that we have seen interactive learning in action, it is time to see how it works.

It works thanks to a platform called Jupyter Notebook. Luckily we do not have to install this software on our laptops or tablets to use it. Thanks to Google Colab, the software is freely available (through a web browser) to anybody who has a Gmail account. And if you are not planning on preparing your own interactive lectures, you do not have to learn Jupyter notebook or Python. The content created on the platform can be easily navigated.

The Jupyter notebook has a simple interface. It has got text and code blocks called cells. The text block/cell is where the lecture content is presented. It has got support for things like Markdown, HTML, LaTeX, etc. Support for LaTeX is a big plus for math lovers.

The code cells run Python code (probably others as well). This is where interactive learning takes place. The idea presented in the lecture (text cell) is exemplified using a model, and the learner is encouraged to change the parameters of the model and examine the behavior. This interaction is provided by making use of the last ingredient.

The last ingredient is the IPyWidgets package of Python. It provides the widgets like text boxes, sliders, etc., for input from the learner. It also provides the functions that bind the input from the widgets to the code so that the output of the program can be modified with the newly provided values.

This is how interactive quantum learning can happen. If you have not yet visited the introduction to quantum mechanics, please do so now. Read about the theory, experiment with the interactive interface, and share your feedback below.

We don’t know when the next pandemic will hit, but we will be ready with interactive online lessons for our students.

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa