# Cant get Vpython to work

1. May 9, 2010

### groom_03

Hi, I've got to model how a charge will move away from a stationary charge in python, i need the acceleration to be recalculated based on the force between the charges because the moving charge will decelerate, i've been up all night trying to get this to work but i just cannot figure out whats wrong

Code (Text):

#Problem 4a
from visual import*

#mass is assumed to be proton rest mass

k=8.987551787362e09 #coulomb constant

#particle data

#Stationary particle
qa=0.02
m=1.67262158e-27

#Moving particle
#particle seperations have been magnified by 1000
qb=0.02

#particle separation
dist=beta.pos-alpha.pos

a=f/m

#Lets make it move
while beta.pos.x>15e-03: #the moving particle will have moved 15mm
rate(20000)
dt=0.1
f=(k*qa*qb)/dist**2
beta.velocity=vector(1,0,0)
#beta.velocity=a*dt
print a
print f
print beta.velocity

any help greatly appreciated

p.s i know nothing about computer programming

2. May 9, 2010

### story645

What are some of the error messages that you're getting?
Also, use print statements at each stage to check that the values seem sane.

Also, far as I can tell you don't define f for
Code (Text):

a=f/m