#! /usr/bin/env python """ exchangeBoson.py is a program which generates a 3D animation two spheres exchanging another smaller sphere Paul Eugenio PHZ4151C Feb 1, 2019 """ from __future__ import division, print_function import vpython as vp fermionSize = 0.5 bosonSize=0.1 vp.canvas(width=800, height=800) # create the spheres fermi1 = vp.sphere(pos=vp.vector(-2.5,0,0), radius=fermionSize ,color=vp.color.green) fermi2 = vp.sphere(pos=vp.vector(2.5,0,0), radius=fermionSize ,color=vp.color.yellow) boson = vp.sphere(pos=vp.vector(0,0,0), radius=bosonSize, color=vp.color.blue) # initialize time and position of exchange particle t, dt = 0.0, 0.1 x, v = 0.0, 5 y,z = 0,0 # exchange the smaller sphere forever while True: vp.rate(10) t += dt if x <-2 or x > 2: v = -v x = x + v*dt boson.pos.x = x