Tutorial introduction to Python

Tutorial introduction to PythonShort Description
Tutorial introduction to Python. A simple program. Much of physics is concerned with the formulation and solution of differential. equations. …

Website: www.phy.uct.ac.za | Filesize: 106kb

Content
Tutorial introduction to Python
A simple program
Much of physics is concerned with the formulation and solution of di erential
equations.
Perhaps the simplest non-trivial di erential equation is the equation that
gives rise to the exponential decay law,
dy(t)
dt
= .. y(t)
where  is a decay constant. This equation might describe the decay of a
sample of a radioactive isotope as a function of time, or with appropriate
variables, the absorption of a light ray in a medium as a function of distance
travelled, etc.
The solution is well-known:
y(t) = y(0)e..t
In the following we will assume that we start with 100% of our nuclei at time
t = 0, and that the decay constant  = 1:0 s..1.
We can begin our programming in the simplest way, using the computer to
evaluate mathematical expressions.
Here is a simple program in Python to calculate the number of nuclei as a
function of time:
1 # decaya.py - rwf
2 # Simple python program
# straightforward evaluation of expressions
4
from math import *
6
# Constants
8 y0=100.0…

Get the file Download here

AddThis Social Bookmark Button
Related Books:
  • Python Tutorial
  • Python Tutorial Notes
  • A brief Python tutorial
  • A Quick, Painless Tutorial on the Python Language
  • Python Tutorial
  • Python Tutorial
  • Interfacing C/C++ and Python with SWIG
  • XML and Python Tutorial

  • Related Searches: , , , ,



    Comments

    Leave a Reply