Sinp Python
Sinp Python
Dasgupta
Outline
Outline
1
Simulation in the Physics Classroom Why teach simulations? The Python programming language Why use Python? Simulations - an example Simulating the oscillator Results The story so far Plotting elds Charged particle motion Some useful links
Dasgupta Simulation in the Undergraduate Physics Classroom
Outline
Outline
1
Simulation in the Physics Classroom Why teach simulations? The Python programming language Why use Python? Simulations - an example Simulating the oscillator Results The story so far Plotting elds Charged particle motion Some useful links
Dasgupta Simulation in the Undergraduate Physics Classroom
Outline
Outline
1
Simulation in the Physics Classroom Why teach simulations? The Python programming language Why use Python? Simulations - an example Simulating the oscillator Results The story so far Plotting elds Charged particle motion Some useful links
Dasgupta Simulation in the Undergraduate Physics Classroom
Outline
Outline
1
Simulation in the Physics Classroom Why teach simulations? The Python programming language Why use Python? Simulations - an example Simulating the oscillator Results The story so far Plotting elds Charged particle motion Some useful links
Dasgupta Simulation in the Undergraduate Physics Classroom
Outline
Outline
1
Simulation in the Physics Classroom Why teach simulations? The Python programming language Why use Python? Simulations - an example Simulating the oscillator Results The story so far Plotting elds Charged particle motion Some useful links
Dasgupta Simulation in the Undergraduate Physics Classroom
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
The implementation
The philosophy No Advanced numerical methods Advanced programming Yet Advanced Physics
The OS issue MS - Windows Linux The language issue FORTRAN C Java Python
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
The implementation
The philosophy No Advanced numerical methods Advanced programming Yet Advanced Physics
The OS issue MS - Windows Linux The language issue FORTRAN C Java Python
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
The implementation
The philosophy No Advanced numerical methods Advanced programming Yet Advanced Physics
The OS issue MS - Windows Linux The language issue FORTRAN C Java Python
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
The implementation
The philosophy No Advanced numerical methods Advanced programming Yet Advanced Physics
The OS issue MS - Windows Linux The language issue FORTRAN C Java Python
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
The implementation
The philosophy No Advanced numerical methods Advanced programming Yet Advanced Physics
The OS issue MS - Windows Linux The language issue FORTRAN C Java Python
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
The implementation
The philosophy No Advanced numerical methods Advanced programming Yet Advanced Physics
The OS issue MS - Windows Linux The language issue FORTRAN C Java Python
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Simple Easy to learn Powerful Extensible Platform independent Open Source Free
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Simple Easy to learn Powerful Extensible Platform independent Open Source Free
Python evolved as a language for teaching computer science concepts so the language overhead is deliberately kept at a minimum. An interpreted language - allows one to use the interpreter in the interactive mode to help understand concepts
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Simple Easy to learn Powerful Extensible Platform independent Open Source Free
A general purpose language Supports structural, functional and object oriented programming Powerful modules available
numeric gnuplot visual (aka vPython)
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Simple Easy to learn Powerful Extensible Platform independent Open Source Free Glue language C extensions for added speed
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Simple Easy to learn Powerful Extensible Platform independent Open Source Free Interpreters are available (for free) for both Linux and MS-Windows
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Simple Easy to learn Powerful Extensible Platform independent Open Source Free
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Simple Easy to learn Powerful Extensible Platform independent Open Source Free
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Unconventional Slow
No longer! The google search engine uses python extensively - so does Linux!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Unconventional Slow
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Calculate new velocity : vnew = vold + v = vold + a t Calculate new position : xnew = xold + Update the time tnew = told + t Keep on repeating until nal time is reached. Change the force law for other motions!! t
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
... while (t <= tf) : F = -k * x a= F/m vn = v + a * deltat x = x + (v+vn)*deltat /2 v = vn t = t + deltat print t,v,x
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
SHO - with kinetic friction - what does the envelope look like?
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Both batches did reasonably well. The major problem that we faced is the lack of a good book using python in physuics simulations. So - we wrote one!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Both batches did reasonably well. The major problem that we faced is the lack of a good book using python in physuics simulations. So - we wrote one!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Both batches did reasonably well. The major problem that we faced is the lack of a good book using python in physuics simulations. So - we wrote one!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Both batches did reasonably well. The major problem that we faced is the lack of a good book using python in physuics simulations. So - we wrote one!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Both batches did reasonably well. The major problem that we faced is the lack of a good book using python in physuics simulations. So - we wrote one!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Both batches did reasonably well. The major problem that we faced is the lack of a good book using python in physuics simulations. So - we wrote one!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Both batches did reasonably well. The major problem that we faced is the lack of a good book using python in physuics simulations. So - we wrote one!
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
To solve :
2V 2V + =0 x 2 y 2 V (i + 1, j) + V (i 1, j) + V (i, j + 1) + V (i, j 1) 4
Start from any initial set of V (i, j) and iterate until the eld does not change appreciably.
Dasgupta Simulation in the Undergraduate Physics Classroom
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
The ocial Python site www.python.org www.enthought.com visual.org www.thinkpython.com diveintopython.org starship.skyport.net/crew/hinsen downloads documentation links forum jobs ...
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
www.python.org www.enthought.com visual.org www.thinkpython.com diveintopython.org starship.skyport.net/crew/hinsen For MS-Windows - a nicely packaged python suite with a good collection of useful modules.
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
www.python.org www.enthought.com visual.org www.thinkpython.com diveintopython.org starship.skyport.net/crew/hinsen Home of the Visual module aka vPython - a nice module for generating 3D animations.
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
www.python.org www.enthought.com visual.org www.thinkpython.com diveintopython.org starship.skyport.net/crew/hinsen Home of the book How to think like a computer scientist - in Python - nice book, especially for beginning programmers.
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
www.python.org www.enthought.com visual.org www.thinkpython.com diveintopython.org starship.skyport.net/crew/hinsen Home of the book Dive into Python - for more advanced programmers.
Dasgupta
Simulation in the Physics Classroom The Python programming language Simulations - an example Results Some useful links
www.python.org www.enthought.com visual.org www.thinkpython.com diveintopython.org starship.skyport.net/crew/hinsen Homepage of the scientic python module
Dasgupta