• API
• FAQ
• Tools
• Archive
SHARE
TWEET Untitled a guest Feb 13th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. # coding: utf-8
2.
3. # Lab 1
4. # Haley Partlow
5.
6. # In:
7.
8. get_ipython().magic(u'matplotlib inline')
9. import numpy as np
10. from __future__ import division
11. import matplotlib.pyplot as plt
12.
13.
14. # First, determine the frequency of the oscillator using the equation for frequency ${f = (\frac{1}{\lambda})*(\sqrt(\frac{F_{T}}{\mu}))}$
15.
16. # In:
17.
18. def Frequency(l,F,m,L):
19.     f = (1/l)*(F/(m/L))**0.5
20.     return f
21.
22.
23. # In:
24.
25. Wavelength=0.7814 #m
26. Uncertainty_wavelength=1 #mm
27. Force=2.45 #N
28. Uncertainty_Force=0.03 #N
29. Mass=0.000435 #kg
30. Uncertainty_Mass=0.000002 #kg
31. Length=1.555 #m
32. Uncertainty_Length=0.001 #m
33.
34. frequency = Frequency(Wavelength, Force, Mass, Length)
35. print "Frequency = ", frequency, "Hz"
36.
37.
38. # Second, determine the uncertainty of the frequency using Rule 4 error propagation ${\delta f = f \sqrt{(- \frac{\delta \lambda}{\lambda})^2 + (\frac{1}{2}* \frac{\delta F_{T}}{F_{T}})^2 + (\frac{-1}{2}*\frac{\delta m}{m})^2 + (\frac{1}{2}*\frac{\delta L}{L})^2}}$
39. #
40.
41. # In:
42.
43. def Uncertainty(el,l,eF,F,em,m,eL,L):
44.     Part1=(-el/l)**2
45.     Part2=(0.5*(eF/F))**2
46.     Part3=(-0.5*(em/m))**2
47.     Part4=(0.5*(eL/L))**2
48.     ef=(Part1 + Part2 + Part3 + Part4)**0.5
49.     return ef
50.
51.
52. # In:
53.
54. Uncertainty_frequency = Uncertainty(Uncertainty_wavelength,Wavelength,Uncertainty_Force,Force,Uncertainty_Mass,Mass,Uncertainty_Length,Length)
55. print "deltaf = ", Uncertainty_frequency, "Hz"
56.
57.
58. # The frequency of the oscillator is 119.77 ${\pm}$ 1.28 Hz.
59.
60. # In[ ]:
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top