Python
- Python is a standard, interpreted computer language which can be downloaded and run on your PC. For this course, version 3.8 of Python available from Anaconda is recommended: https://www.anaconda.com/distribution/. The Anaconda distribution will automatically install all of the libraries necessary for mathematical operations (sin, cosh, definite integrals, etc.) as well as libraries for plotting graphs.
- The use of a Jupyter notebook for each assignement is recommended. These can be viewed and edited in your web brower and this system is also provided in the Anaconda distribution above. (For example, the Anaconda Navagator has a link which starts up a Jupyter notebook manager.)
- Once you have Python and Jupyter installed on your laptop, you can try out the example files which will listed below by
- Going to the Jupyter window in your browser which lists Jupyter notebooks to open.
- Clicking on the "upload" button on the right-hand side.
- Copying the web address given in the links below (or the pdf problem assignment)
- Uploading and opening the notebook
- References which may be useful include:
Jupyter notebooks for lecture and problem sets
Material from UN2801
Material for UN2802
- Sample Python code for the electrostatics problem of plotting equipotential lines for a pair of equal and opposite charges (can be used as a starting point for problem 118 from problem set #14: http://www.columbia.edu/~nhc1/UN2802/Python/dipole.ipynb.
- Sample Python code for the electrostatics problem of plotting equipotential lines for single charged wire inside a long conducting tube: http://www.columbia.edu/~nhc1/UN2802/Python/Potential-in-box.ipynb.
- First sample Python code for Fourier series: http://www.columbia.edu/~nhc1/UN2802/Python/FourierSeries.ipynb. This computes the Fourier coefficients for a square wave from a formula and then reconstructs the wave function showing the effects of leaving out the high m Fourier modes.
- Second sample Python code for Fourier series: http://www.columbia.edu/~nhc1/UN2802/Python/FourierSeries-2.ipynb. This is a fancier version of the first sample in which the Fourier coefficients are computed numerically using the Python "quad" routine. In addition, the reconstruction of the wave function is defined as a Python function so that it can be easily done many times and the results plotted under a for loop producing a series of curves that can be plotted at once and compared. (A hidden error where m-l instead of m appeared when constructing psi[n] from its Fourier transform has been fixed, 4/20/2022).