Python Help Page for PHY131

Jason Harlow

Dear PHY131 Students,

During the 6th Practicals session this semester you will be running a computer simulation of a mass on a spring, using the programming language Python.   This page is just meant to be a list of resources for you as you prepare for this Practical or if you decide to further explore Python in your life.

..Jason Harlow..

Material which may be useful for the 6th Practicals Session:

LoopDemo.py             08-Nov-2008 07:29     1k 

LoopDemo2.py            08-Nov-2008 07:29     1k 

LoopDemo3.py            08-Nov-2008 07:29     1k 

SHM.py                  08-Nov-2008 07:29     2k 

PDF print-out of SHM.py for use in Practicals

A 14 page Powerpoint Presentation introducing the Numerical Approximation Module

A shorter, 4-page Powerpoint Presentation with the basics of using Numerical Approximation to solve the mass on spring.

How to obtain Python on your own computer:

First, download and install Python-2.6.2

Second, download and install VPython-Win-Py2.6-5.1.exe

Start the program editor with the "VIDLE for Python" shortcut on the desktop

   or on the Start menu.

Open an example program -- for example, bounce2.py.

Press F5 to run (or use the Run menu).

Every time you run, your files are automatically saved (if you have changed them).

Choose Visual on the Help menu for documentation.

As a personal note, I have done a lot of programming in a few different languages and my favourite text-editor for this purpose is the Crimson Editor, available for free at http://www.crimsoneditor.com/ .  It colour-codes your Python programs so that comments are all in green, program statements are in black or blue for special statements like while or for loops.  And as you’re typing it keeps track of indents.