Assignment: Normalizing Wavefunctions with Jupyter and Colab#

🎯 Objective¶#

To practice Jupyter and Colab.

📜 Instructions#

  1. Presuming you already have a GitHub account, connect to GitHub Classroom. You’ll see p1

  2. Click Accept the assignment and then update the page p2. You will see a new repository with the task p3

  3. To complete the assignment you need to complete the Jupyter notebook Normalizing_eigenfunctions.ipynb.

Editing a Jupyter Notebook from GitHub#

As described in the notes, there are several ways to edit .ipynb files.

Using Google Colab (direct download and upload)#

In this tutorial we will show how to work with Jupyter notebooks through Google Colab.

  1. Download the .zip archive of the GitHub repo. In order to download it click code and Download Zip p4

  2. When the repo is downloaded, go to Google Colab and add the .ipynb file from the repo: File \(\rightarrow\) Upload notebook p5 You will see this window p6

  3. Upload the .ipynb file

Voila! p7

Extension for Chromium Browsers.#

If you use a browser like Google Chrome or Microsoft Edge, then you can use the Open in Colab browser extension. Then,

  1. View the target Jupyter Notebook on Github

  2. Click the extension to open the notebook in Colab.

  3. When you do this, you may need to grant Google/Microsoft (Colab/GitHub) permission to interchange information.

Understanding the assignment#

There is an instruction written in the notebook. All you need to do is to fill the code between



The purpose of this assignment is to compute the normalization constant for the particle-in-a-box. The particle-in-a-box is perhaps the simplest (bound) quantum system. You do not need to know much about the particle-in-a-box to complete this assignment however: referring to the relevant section of the notes, one sees that one can choose \(A_n = \sqrt{\frac{2}{a}}\).

Once the code is completed, you can click the play button to evaluate the cell. When you are satisfied with a code just click File \(\rightarrow\) Save and then Download \(\rightarrow\) Download .ipynb p9

Submitting an assignment#

Submitting the assignment is breeze! When you downloaded the final version of the file just go to your repo and click Add file \(\rightarrow\) Upload files; then upload your newly created file p10 Now commit your changes and click Commit changes p11

Check the result#

In order to check whether your code passed tests all you need to do is go to Actions\(\rightarrow\) Your commit \(\rightarrow\) Test with pytest. p12 p13 In most cases the tests will run automatically, and you do not need to explicitly invoke Pytest.

If you see a green check mark: CONGRATULATIONS! you passed the assignment

If there is a bug, then the following may occur: p14 p15

Try to find your mistake but if you get stuck, contact me @RichRick1 p16 p17

Grading Scheme#

Completing the assignment earns you an S. To earn an S+, explore whether there are other choices for the normalization constant that also pass the tests. Can you find a (correct) choice for the normalization constant that nonetheless fails the tests? How is this possible!