



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This revision sheet provides an overview of the key concepts in python programming, lists, arrays, algorithms, and physics that will be covered in the phy300 course. It includes instructions on how to assign variables, create lists and arrays, access list elements, loop through lists, create spheres, and use functions. Additionally, it covers important physics concepts such as newton's laws, euler method, and monte carlo algorithm.
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




You should look over carefully all posted lecture notes. Additionally I would recommend looking at your lab writeups including a brief review of the main elements in your final lab codes. The questions will be mostly short reponse questions - write out your answer in the format requested (eg. up to 4 lines of code, a few short sentences or a single name). They will be designed to test basic understanding of both programing and physics issues – there will be no long calculations or difficult code to interpret. To try and clarify the kinds of things I will expect you to be able to handle please study the examples below
x=1. y=2. z=x/y print z
for i in range(0,4): x[i]=x[i]+3.
Again, notice that range(0,4) produces the list (0,1,3)
for i in range (0,100): for j in range (0,100): y[i][j]=y[i][j]+1.
while(1): t=t+dt update(y) if(t>10.0): finishup()
def update(y): for i in range (0,100): for j in range (0,100): y[i][j]=y[i][j]+1.
y[n+1]=y[n]+dt*f(y[n],t)
Notice this uses a Python array/list to hold the values of y at different discrete times t=ndt.
x[n+1]=x[n]+p[n]dt+a[n]dtdt0. p[n+1]=p[n]+dt0.5(a[n]+a[n+1])
a
f (x)dx ∼
b − a N
∑^ N
i=
f (xi)
where xi are independent random numbers uniformly distributed in range a < x < b. Error goes as (< x^2 i > − < xi >^2 )/
v^2 = ka^2 /m
∫ dxΨ∗Ψ = finite.