Computational Methods for Nonlinear Systems

Physics 7682 - Fall 2015


Instructor: Chris Myers

Mondays & Fridays 1:30-3:30, Rockefeller B3 (directions)

http://www.physics.cornell.edu/~myers/teaching/ComputationalMethods/

Prime Number Exercises

Background

We introduce several useful features of the Python language and associated libraries by writing a program to generate prime numbers. We also test mathematical predictions of the asymptotic density of primes.

Learning Goals

Science: There are no real science goals for this simple warmup exercise. If you're interested in the mathematics of prime numbers, feel free to work through the material on the asymptotic density of primes. Since this is really an exercise to get familiar with Python, however, the PrimesHints.py file already implements much of that.

Computation: This exercise will introduce you to modifying Hints files, writing Python functions, using the editor and the ipython interpreter, and simple plotting commands.

Procedure

Consult the instructions on the Getting Started with Python page. Broadly, the procedure involves: (1) downloading the Hints file linked to the left, (2) copying it to a new solution source file, (3) opening the source file in an editor, (4) starting up an ipython interpreter, (5) running the source file within the interpreter, (6) updating the source file and rerunning to implement and test missing functionality.