back to PHY 112 PHY 310 PHY 341 PHY 390

VPython projects at Dillard University

Rob Salgado


Last modified: Sat Mar 19 09:37:15 2005
(install) (handouts)

(Dillard U. - Spring 2005)
I suggest we meet Tuesdays 3:45-5:00 and Thursdays 1:00-2:30. If you can make at least of the one meetings each week, then that would be good.
Look for me in my office. Then check the learning Center.


It seems the "block pulled by a rope" program is almost done. We should really finish that off as soon as possible.

Forthcoming program ideas [which can be done in a month or less if you are willing and really put in the time for them]:

  Electric Circuit
       Mr. Lush is thinking about a simple resistive circuit.
       He's working on drawing basic circuit elements.
       The underlying physics is Kirchhoff's Laws.
       The underlying math is solving a linear system of equations
           with Cramer's Rule.
       (See Serway-5th, Ch 28 "Direct Current Circuits".)
	
	Here is what we presented at the 2005 Scholarship Day
		
	

  Center of Mass
       This should be a quick one to do.  (Maybe a day or less!)
       Use the mouse to drop new point masses or drag around existing ones.
       Dynamically calculate and mark the center of mass.
       Look at physics.syr.edu/~salgado/software/vpython/EFieldBuilder-09990.py
       for an example of using the mouse to drop or drag objects.
       (See Serway-5th, 9.6 "The Center of Mass", Beer-Johnston, Ch 5.)

  Polygon Triangulation
       This is essentially the conversion of a simple C++ program into Python.
       The big goal: to draw 3D objects in the PHY 112 class
       by specifying the vertices of the planes of an object.
       The problem: VPython can only render triangles using its
       faces command. http://vpython.org/webdoc/visual/faces.html
       A solution: translate a relatively simple program
       which breaks up not-so-complicated polygons into non-overlapping
       triangles:
       http://www.flipcode.org/cgi-bin/fcarticles.cgi?show=63943

  Distributing Charges on an Electric Conductor
       Yesterday, I was thinking about how to draw electric field line
       diagrams.  Along the way, I thought about how charges would
       distribute themselves on a sphere.  So, I wrote a program
       (90% done) which creates a random sprinkling of charges on
       a sphere, then lets the electric "Coulomb's Law" forces
       [and the forces keeping the charges on the sphere] push the
       charges around until the system settles down to static equilibrium.
       (It looks really cool... 
       
       [The strands trail how the charges move from their initial positions
       to their final positions.  The arrow represents an external Electric Field,
       the blue charges are positive, and the red charges are negative.]
       )
       

       Look at this:
       webphysics.davidson.edu/physlet_resources/bu_semester2/c04_conductor_field2.html
       Move the charges around arbitrarily. (This would be our
       starting state.) Click on Charge in a Circle. (This is our final
       state.)  Imagine dynamically reaching that final state.

       With a tweak, I believe we can easily do this with several charged
       conducting spheres... which would be cooler. With a little more
       effort, possibly with the help of the triangulation program above,
       it would be extremely cool to do this on a non-spherical
       closed surface. (See Serway-5th, 25.6 "Electric Potential due to
       a Charged Conductor".)

    [Just added: 3/20/05]
    Electric Field Line Diagrams
    
    
    

  Anyone else have suggestions?



(Dillard U. - Fall 2004)
Wednesdays 3pm in the Learning Center (Stern 301)
(10/27/04)
I bought some new Python books for anyone who want to borrow them.
Here's a registration-file for Windows 2000 and Windows XP that will fix that problem with the IDLE editor closing completely when terminating an animation you are working on.
Python-File-new.reg
It assumes that you installed Python in the C:\ drive. If so, you may just "Open" it.
Otherwise, you must "Save" it, then edit it if you installed it elsewhere. Then, "Merge" it by double-clicking on it.

It looks like the "block being pulled on a table" is coming along. We're about to "put the physics" into the visualization.
We wrote some code today (10/7/2004 12:22AM).

from visual import *  #load the VPython library

scene.autoscale=0     #disable the automatic scaling (seen in the bouncing ball example)

#draw the default arrow, and refer to it as "p"
p=arrow()               

#draw a second arrow with different parameters, and refer to it as "v"
v=arrow(color=color.red, pos=vector(0,1,0), axis=vector(1,0,1))

for t in arange(0, 5, 0.01):
    rate(30)
    #print t

    #modify some parameters of arrow v
    v.axis.x=cos(pi*t)                        
    v.axis.y=sin(pi*t)
    v.color=( t - floor(t), .3, .9)   # t - floor(t) gets the fractional part of t
    



"assignment"

write a python program to draw
the x-axis as a red arrow
the y-axis as a green arrow
the z-axis as a blue arrow
and
a yellow vector with tail at (1,2,3) and tip at the origin


10/3/2004 Open Serway and look around for a project (based on an important textbook example) that you would like to work on. It may be best if projects are done in groups of at least two. Some examples suggested at our last Wednesday meeting. (Links are to Java applets that try to illustrate the idea.) "a block on an incline" (suggested by Mr. Lush) "free body diagrams" (example: Block on an Inclined Plane Simple Inclined Plane) "analysis of a simple structure" (example: Bridge Designer) "roller coaster" (example: Funderstanding Roller Coaster) "thermal expansion of metals" "an electric circuit" (example: RLC circuit) "motion of an electric charge" (example: charge moving in an electric field) "electric field of a moving charge" (example: electric field of a moving charge) "optics" [image formation] (example: thick lens) "the rainbow" (example: the rainbow) (collection of physics applets)


VPython installation files

VPython handouts

VPython Guides Python guides list (U. Maryland)

Rob's page of VPython applications for Teaching Physics (new window)