Skip to content

Instantly share code, notes, and snippets.

@rhettallain
rhettallain / two_drunk_lost_woods.py
Created September 5, 2013 14:06
A random walk with two drunks in the woods looking for each other.
from pylab import *
from random import *
n=0
x1p=[0]
y1p=[0]
x1=0
y1=0
@rhettallain
rhettallain / space_agency_model.py
Created May 21, 2013 14:31
Orbital Motion to model the orbit (with thrust) in the iPhone app Space Agency
from visual import *
Earth=sphere(pos=vector(0,0,0), radius =1, material=materials.earth)
R=2.75 #orbita radius in terms of radius of the planet
GM=1.47 #GM as determined from the game
v=sqrt(GM/R) #starting speed for a circular orbit
rt=0.0338 #this is the acceleration due to the rocket
#sc is the spacecraft
@rhettallain
rhettallain / fluker_collision.py
Created April 8, 2013 21:25
Here is a vpython model that looks at a collision between two objects.
from visual import *
from visual.graph import *
gra=gcurve(color=color.cyan)
dj=sphere(pos=(-2,0,0), radius=0.15, color=color.red)
dude=sphere(pos=(0,0,0), radius=0.1, color=color.cyan)
dj.m=100
dude.m=65