Thursday, October 20, 2011

VPython Code

To get some practice in class with programing and specificallyVPython, Brian and I had to do exercise number 5 of the second handout.
So here is the code and the result:


from math import *


A=zeros(100,float)
B=zeros(100,float)
C=zeros(100,float)
Sum=0
D=float


for i in range(0,100):
    A[i]= sin(2*pi*i/100)
    B[i]= cos(2*pi*i/100)
    C[i]=A[i]*B[i]
for i in range(0,100):
    D=Sum+C[i]
    Sum=D
    
        
print A
print B
print C
print "sum of all values is", Sum 





[  0.00000000e+00   6.27905195e-02   1.25333234e-01   1.87381315e-01
   2.48689887e-01   3.09016994e-01   3.68124553e-01   4.25779292e-01
   4.81753674e-01   5.35826795e-01   5.87785252e-01   6.37423990e-01
   6.84547106e-01   7.28968627e-01   7.70513243e-01   8.09016994e-01
   8.44327926e-01   8.76306680e-01   9.04827052e-01   9.29776486e-01
   9.51056516e-01   9.68583161e-01   9.82287251e-01   9.92114701e-01
   9.98026728e-01   1.00000000e+00   9.98026728e-01   9.92114701e-01
   9.82287251e-01   9.68583161e-01   9.51056516e-01   9.29776486e-01
   9.04827052e-01   8.76306680e-01   8.44327926e-01   8.09016994e-01
   7.70513243e-01   7.28968627e-01   6.84547106e-01   6.37423990e-01
   5.87785252e-01   5.35826795e-01   4.81753674e-01   4.25779292e-01
   3.68124553e-01   3.09016994e-01   2.48689887e-01   1.87381315e-01
   1.25333234e-01   6.27905195e-02   1.22464680e-16  -6.27905195e-02
  -1.25333234e-01  -1.87381315e-01  -2.48689887e-01  -3.09016994e-01
  -3.68124553e-01  -4.25779292e-01  -4.81753674e-01  -5.35826795e-01
  -5.87785252e-01  -6.37423990e-01  -6.84547106e-01  -7.28968627e-01
  -7.70513243e-01  -8.09016994e-01  -8.44327926e-01  -8.76306680e-01
  -9.04827052e-01  -9.29776486e-01  -9.51056516e-01  -9.68583161e-01
  -9.82287251e-01  -9.92114701e-01  -9.98026728e-01  -1.00000000e+00
  -9.98026728e-01  -9.92114701e-01  -9.82287251e-01  -9.68583161e-01
  -9.51056516e-01  -9.29776486e-01  -9.04827052e-01  -8.76306680e-01
  -8.44327926e-01  -8.09016994e-01  -7.70513243e-01  -7.28968627e-01
  -6.84547106e-01  -6.37423990e-01  -5.87785252e-01  -5.35826795e-01
  -4.81753674e-01  -4.25779292e-01  -3.68124553e-01  -3.09016994e-01
  -2.48689887e-01  -1.87381315e-01  -1.25333234e-01  -6.27905195e-02]
[  1.00000000e+00   9.98026728e-01   9.92114701e-01   9.82287251e-01
   9.68583161e-01   9.51056516e-01   9.29776486e-01   9.04827052e-01
   8.76306680e-01   8.44327926e-01   8.09016994e-01   7.70513243e-01
   7.28968627e-01   6.84547106e-01   6.37423990e-01   5.87785252e-01
   5.35826795e-01   4.81753674e-01   4.25779292e-01   3.68124553e-01
   3.09016994e-01   2.48689887e-01   1.87381315e-01   1.25333234e-01
   6.27905195e-02   6.12323400e-17  -6.27905195e-02  -1.25333234e-01
  -1.87381315e-01  -2.48689887e-01  -3.09016994e-01  -3.68124553e-01
  -4.25779292e-01  -4.81753674e-01  -5.35826795e-01  -5.87785252e-01
  -6.37423990e-01  -6.84547106e-01  -7.28968627e-01  -7.70513243e-01
  -8.09016994e-01  -8.44327926e-01  -8.76306680e-01  -9.04827052e-01
  -9.29776486e-01  -9.51056516e-01  -9.68583161e-01  -9.82287251e-01
  -9.92114701e-01  -9.98026728e-01  -1.00000000e+00  -9.98026728e-01
  -9.92114701e-01  -9.82287251e-01  -9.68583161e-01  -9.51056516e-01
  -9.29776486e-01  -9.04827052e-01  -8.76306680e-01  -8.44327926e-01
  -8.09016994e-01  -7.70513243e-01  -7.28968627e-01  -6.84547106e-01
  -6.37423990e-01  -5.87785252e-01  -5.35826795e-01  -4.81753674e-01
  -4.25779292e-01  -3.68124553e-01  -3.09016994e-01  -2.48689887e-01
  -1.87381315e-01  -1.25333234e-01  -6.27905195e-02  -1.83697020e-16
   6.27905195e-02   1.25333234e-01   1.87381315e-01   2.48689887e-01
   3.09016994e-01   3.68124553e-01   4.25779292e-01   4.81753674e-01
   5.35826795e-01   5.87785252e-01   6.37423990e-01   6.84547106e-01
   7.28968627e-01   7.70513243e-01   8.09016994e-01   8.44327926e-01
   8.76306680e-01   9.04827052e-01   9.29776486e-01   9.51056516e-01
   9.68583161e-01   9.82287251e-01   9.92114701e-01   9.98026728e-01]
[  0.00000000e+00   6.26666168e-02   1.24344944e-01   1.84062276e-01
   2.40876837e-01   2.93892626e-01   3.42273553e-01   3.85256621e-01
   4.22163963e-01   4.52413526e-01   4.75528258e-01   4.91143625e-01
   4.99013364e-01   4.99013364e-01   4.91143625e-01   4.75528258e-01
   4.52413526e-01   4.22163963e-01   3.85256621e-01   3.42273553e-01
   2.93892626e-01   2.40876837e-01   1.84062276e-01   1.24344944e-01
   6.26666168e-02   6.12323400e-17  -6.26666168e-02  -1.24344944e-01
  -1.84062276e-01  -2.40876837e-01  -2.93892626e-01  -3.42273553e-01
  -3.85256621e-01  -4.22163963e-01  -4.52413526e-01  -4.75528258e-01
  -4.91143625e-01  -4.99013364e-01  -4.99013364e-01  -4.91143625e-01
  -4.75528258e-01  -4.52413526e-01  -4.22163963e-01  -3.85256621e-01
  -3.42273553e-01  -2.93892626e-01  -2.40876837e-01  -1.84062276e-01
  -1.24344944e-01  -6.26666168e-02  -1.22464680e-16   6.26666168e-02
   1.24344944e-01   1.84062276e-01   2.40876837e-01   2.93892626e-01
   3.42273553e-01   3.85256621e-01   4.22163963e-01   4.52413526e-01
   4.75528258e-01   4.91143625e-01   4.99013364e-01   4.99013364e-01
   4.91143625e-01   4.75528258e-01   4.52413526e-01   4.22163963e-01
   3.85256621e-01   3.42273553e-01   2.93892626e-01   2.40876837e-01
   1.84062276e-01   1.24344944e-01   6.26666168e-02   1.83697020e-16
  -6.26666168e-02  -1.24344944e-01  -1.84062276e-01  -2.40876837e-01
  -2.93892626e-01  -3.42273553e-01  -3.85256621e-01  -4.22163963e-01
  -4.52413526e-01  -4.75528258e-01  -4.91143625e-01  -4.99013364e-01
  -4.99013364e-01  -4.91143625e-01  -4.75528258e-01  -4.52413526e-01
  -4.22163963e-01  -3.85256621e-01  -3.42273553e-01  -2.93892626e-01
  -2.40876837e-01  -1.84062276e-01  -1.24344944e-01  -6.26666168e-02]
sum of all values is -4.56579218877e-15


the exercise asked to define two set of arrays and see if they are orthogonal to each other by getting the dot product of them. Since the final value is -4.56579218877e-15 which is very close to zero we can assume these two vectors are perpendicular to each other.

    

   

Tuesday, October 11, 2011

Harmonic Overtone

In this lab through following setup we tried to find the relationship between frequency and wavelength and get an overall understanding of the nature of standing waves.


the function generator produces a constant frequency while a certain amount of weight is hanging from the string.


Trial f Hz Nodes Distance
between nodes
λ m
1 15 2 1.45 2.9
2 30 3 0.725 1.45
3 45 4 0.483 0.967
4 62 5 0.363 0.725
5 77 6 0.29 0.58
6 108 8 0.207 0.414
7 125 9 0.181 0.363
uncertainty ±0.02 ±0.01


for this trial the length was 1.45±0.1 and the weight is 0.25±0.05 kg


if we plot a graph for frequency vs 1/lambda we get 







y = 45.558x - 1.3104


this value corresponds to the velocity in this medium and matches the calculated value by sqrt(T/μ)

Lenses

In this experiment we set out to find the relationship between the object distance and the image distance produced by a projected image of a slit through a lens.
First we found the focal point of our given lens. To do so we tried to focus the sunlight on a point and then we measured the distance from the center of the lens to that point. Our value was averaged to f = 25 ± 1 cm 
the error is so high since at that time we had to hold the lens at a very big angle relative to the normal of the ground which made measuring values harder. 

Then we used the same lens in the following setup to find the desired distances:




Object Distance
d0, cm
Image Distance
di, cm
Object Height
h0, cm
Image Height
hi, cm
M type of Image
74.85±0.1 23.5±0.1 3±0.1 1.3±0.1 0.43±0.05 inverted
inverse
59.88±0.1 24.5±0.1 3±0.1 1.75±0.1 1.75±0.05 inverted
inverse
44.91±0.1 28.7±0.1 3±0.1 1.95±0.1 1.95±0.05 inverted
inverse
29.94±0.1 44.5±0.1 3±0.1 5.2±0.1 5.2±0.05 inverted
inverse
22.46±0.1 332.5±0.1 3±0.1 53.6±0.1 53.6±0.05 inverted
inverse




the graph clearly shows that d_0 and d_i have an inverse relationship of some sort. So if we graph the 1/d_0 vs 1/d_i we obtain the following graph:



this graph fits to the linear equation y = -1.2654x + 0.0617
the absolute value of -1.2654 is 1.2654 which is close to index of refraction of air however the value has a huge error due to big uncertainties in focal point and the fact that the fitted line is only using 5 points which is not clearly enough.

Measuring a human hair

In this experiment the goal was to measure the thickness of 's hair 


(the picture is used under his permission :D)


We used his hair as a double slit card in the following setup to observe the wave characteristics of light and from them and the formula y = λLm/d measure his hair thickness.



the y value was obtained from the distance between two continuos node
Measured values were:
y = 12 ± 0.5 mm
λ = 670 ± 20 nm (this value was calculated for the same laser previously in class)
m = 2
L = 1 ± 0.005 m
rearranging the formula we get d = λLm / y = 112 ± 8.5 μm

this number makes sense since the thickness for human hair is between 70 to 190 μm

Concave and Convex Mirrors

The goal for this experiment was to observe the characteristics of these two types of mirrors
first for convex mirrors through observation we deduced that the images are smaller and will get bigger as we get closer to the mirror. also as we get further from surface of the mirror images become smaller fast (depending on the radius of curvature of the mirror) until they pass the focal point which means they are at infiniti relative to the mirror. Images are also upright.


As for the concave mirrors images depending on the position of the object they are reflecting, vary. For close distances we see upright and virtual. But as we get further we lose the image and we dont see the image in the mirror which means the image is now real and forming in front of the mirror.


and the rule 1/p + 1/q = 1/f applies to both mirrors where p is the object distance and q is the image distance and f is the focal point.

Monday, October 10, 2011

Reflection and Refraction

In this experiment the goal was to find the relationship between the two angles of incident and refraction.  For the experiment using the following setup:
we shined a beam of light first through the flat surface of the semicircular plastic prism and we measured the mentioned angles. Then we turned the prism and repeated the same experiment.
Here are the result

Flat surface first
Trial θIncident θrefraction sin(θIncident) sin(θrefraction)
1 0±0.5 0±0.5 0.000±0.009 0.000±0.009
2 5±0.5 4±0.5 0.087±0.009 0.070±0.009
3 10±0.5 7±0.5 0.174±0.009 0.122±0.009
4 15±0.5 10±0.5 0.259±0.009 0.174±0.009
5 20±0.5 13±0.5 0.342±0.009 0.225±0.009
6 25±0.5 16±0.5 0.423±0.009 0.276±0.009
7 30±0.5 19±0.5 0.500±0.009 0.326±0.009
8 35±0.5 22±0.5 0.574±0.009 0.375±0.009
9 40±0.5 26.5±0.5 0.643±0.009 0.446±0.009
10 50±0.5 31±0.5 0.766±0.009 0.515±0.009
11 60±0.5 35±0.5 0.866±0.009 0.574±0.009
12 70±0.5 39±0.5 0.940±0.009 0.629±0.009

and this is the graph of sin(incident) vs sin(refraction)

y = 0.6641x + 0.0024


Curved surface first

trial θincident θrefraction sinincident ) Sin(θrefraction)
1 0±0.5 0±0.5 0.000±0.009 0.000±0.009
2 5±0.5 7.5±0.5 0.087±0.009 0.131±0.009
3 10±0.5 16±0.5 0.174±0.009 0.276±0.009
4 15±0.5 23±0.5 0.259±0.009 0.391±0.009
5 20±0.5 32±0.5 0.342±0.009 0.530±0.009
6 25±0.5 39±0.5 0.423±0.009 0.629±0.009
7 30±0.5 48.5±0.5 0.500±0.009 0.749±0.009
8 35±0.5 63±0.5 0.574±0.009 0.891±0.009
9 40±0.5 75±0.5 0.643±0.009 0.966±0.009
10 45±0.5 no refraction 0.707±0.009


and the graph is as follow

y = 1.5125x + 0.0026


in both cases the angle of refraction is on the y axis and angle of incident on the x axis 

n1Sin(θincident) = n2Sin(θrefraction)
=> n1 / n2 = Sin(θrefraction) / Sin(θincident) = m slope of the graph

however for the first graph n1 is air and n2 is the prism so the slope is reciprocal of nso since the slope is 0.6641 the reciprocal is 1.506±0.01  which is close to 1.5125±0.01 of the second graph's slope
both these values represent the index of refraction of the prism.