PHY 3101 - Modern Physics - Fall 2018


Programming and PHY 3101
(Still to add: Jupyter notebooks for Python)


Programming tools in PHY 3101

We will introduce you to two free programming tools that are extensively used (and are similar to others that are heavily used) by physicists and engineers: python, a general purpose programming language, and one of several possible tools that can be used to manipulate and solve mathematical expressions in symbolic form. The tools are free and run on all popular operating systems (Windows, Mac, Linux).

  • Python: Python is a full-scale programming language (similar to C++ and Java) but has a much simpler syntax and runs directly without compiling (it's technically called a "scripting language"). Python is a powerful tool for solving problems where one has to use conditional logic, loops and external routines. It also has many libraries that extend its power. However, we will only use its most basic features in this course.
  • CAS software: You should also acquire a "computer algebra system" or CAS, capable of doing mathematics in symbolic form. A CAS allows you to manipulate mathematical expressions in symbolic form (trig functions, polynomials, special functions, etc), work with exact rational expressions like 2/5 + 1/3, differentiate and integrate complex expressions, compute Taylor series to arbitrarily high powers, solve equations and differential equations, and plot functions.

Substitutions: If you have MatLab or R you may use those instead of python.

CAS options: You have several choices.

  • Sage: One of us (Avery) has used Sage in previous classses and have tutorials for it below. It comes packaged for Windows and Mac OSX, though it is a large download. We have Sage tutorials below.
  • SageMathCloud/coCalc: SageMathCloud was operated previously under an NSF grant, but in May 2017 changed to CoCalc (https://cocalc.com/), a more complete web service that runs Sage programs as well as other languages (Sympy, wxMaxima, R, Python, etc.). CoCalc lets users run computing projects under free or paid accounts, where the paid accounts have better response times. We are not sure how much to recommend this site now that they have started to collect money (though the funds are used to support the site under github). We hope that some students try this out and let us know your experiences.
  • Sympy: Sympy is a pure Python CAS and can be used in any Python program through the standard import mechanism. It's not quite as powerful as Sage and runs somewhat slower but it is extremely easy to run with fairly good functionality. Sympy has become more easy to download and install with the availability of python distributions such as Anaconda, described below. We have Symmpy tutorials below.
  • Mathematica: Mathematica is an expensive commercial product, though it is available for free at UFApps as "Wolfram Mathematica".
  • Maple: One of us (Avery) used Maple years ago, but lost track of it over time. It is available for free at UFApps as "Maplesoft Maple 2018".

Python installation, tutorials and resources

Sage installation, tutorials and resources

Sympy installation, tutorials and resources