Physics261

Computational Physics                                              Spring 2018


Overview of this Course: 

This course uses computers as tools to manipulate and visualize data, and to simulate physical systems using the computing language Python (named after the British Comedy Troupe), along with many associated libraries that make scientific computing and visualization in Python much easier to implement than in languages such as C/C++, Fortran, and Java. The course will begin with an introduction to the LaTeX typesetting package (useful for writing scientific papers), then to the core foundation of Python, move onto using it as a tool to read, massage, and plot data, and then we will quickly progress to use Python to simulate physical systems that are not solvable by analytic means. The course emphasizes computation for the sake of increased understanding and insight into physical systems, and teaches programming/scripting as a means to this end. When you are done with this course, you will have experience with a toolset that will be extremely useful throughout your scientific or engineering career, and all the tools are freely available.  

Prerequisites: A passing grade in Physics 121, and at least one semester of Calculus; 

no prior programming experience assumed.  Cr 3


Textbook

Required:

*but FREE to usm students*

Introductory Computational Physics using Python, Paul A. Nakroshis

(handed out as we progress in class)

Optional:

A Primer on Scientific Programming with Python, 4th EditionHans Petter Langtangen

     


Computing Platform Recommendation and bias; three options for running Python.

If you’re in the nice position of being about to purchase a new computer, I strongly recommend  using either the Mac OS or Linux

That being said, computing (especially Python) is evolving quickly, and the Python programming language can now be utilized in wonderful new formats; most noteably the Jupiter Notebook and, for this course, an alternate version hosted by google: Colaboratory


Option 1: Google’s Colaboratory is a hosted Jupyter Notebook server that eliminates the need for you to install python and LaTeX on your own computer. I have also tested it on an iPad Pro using the google chrome browser and it seems to work fine. It is likely that it will work on an android tablet as well. There is nothing to install here. Just click on the link above, and it should be automatically available if you are logged into your maine.edu account. 


Option 2: For running python on your own computer, I recommend the Anaconda Python Distribution . This is an one click install with everything you need to get up and running on your own computer. (Pick the python 3.x version.)

Anaconda Download Links:       MacOS     Linux    Windows


Optional Application (beta): Another interesting option is the nteract application; this is a self-contained jupyter notebook application that opens just like any other app on your operating system. You can find out more about this project here; it is still not at v1.0, but seems to work well for most of what we need for class. 

nteract Download Links       MacOS    Linux     Windows    

(the links above are for version v. 0.5.5, see the releases page for the most recent version)


Class Resources

Syllabus: Download pdf file


Google Classroom Link: Coming soon …if needed


Assignment Notebooks

Assignment_01          Assignment_02          Assignment_03          Assignment 04         Assignment_05         Assignmane_06      Assignment_07          

                             

In-Class Notebooks by Day

 Day1_PossiblyUsefulNotebook.ipynb

Intro to Python.ipynb

01Feb_2018-Projectile.ipynb


Planetary Simulation files for you to hack:  planet.py   solarSystem.py    runSolarSystem.py




https://pythonmatplotlibtips.blogspot.com/2017/12/draw-electric-field-lines-with-changing-color.html

Matplotlib: 

Python/Jupyter Notebooks

Integrated Development Environments:


Downloads:  

USM/Baxter Pre-Test Scores (i.e. how to make a histogram)  view as Jupyter Notebook

Intro to Bokeh Plotting  

Julia Installation Guide (super fast new language from MIT)


Videos:

Colormaps for visualizing data


VirtualBox Tips:

Sharing a folder: 

a) With the virtual machine powered off, goto the settings and add a shared folder. Make sure to check the “automount” box.

b) boot the Linux virtual machine (make sure the guest additions are installed) 

c) in a terminal type: sudo usermod -aG vboxsf $USER

d) then shutdown virtual machine and restart.



Random Tips:

Popup tips in Jupyter Notebook: When typing the argulment of a python function in the notebook, 

SHIFT-TAB will cause a pop-up tip to appear 

Convert .mov file to .avi in Python:  see the PIMS package at github: https://github.com/soft-matter/pims

Awesome Jupyter notebook customization:  Jupyter Notebook Themes and install. My current favorite theme:

open a terminal and type:

jt -t grade3 -tf georgiaserif -nf ebserif -cursc r -cursw 5



Great Links about Jupyter Notebooks: 

https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/

http://blog.juliusschulz.de/blog/ultimate-ipython-notebook

http://nbviewer.jupyter.org/github/bokeh/bokeh-notebooks/blob/master/gallery/correlation.ipynb

https://github.com/dunovank/jupyter-themes     # Jupyter custom themes; haven’t tried yet. Let me know if you do and it works!


Stand-alone app to open/edit  Jupyter Notebooks: 

https://github.com/nteract/nteract/releases