Skip to content

Instantly share code, notes, and snippets.

@bradmkjr
Created January 31, 2018 03:32
Show Gist options
  • Save bradmkjr/1ea55c4dc94efb449c33c6509abe1ad1 to your computer and use it in GitHub Desktop.
Save bradmkjr/1ea55c4dc94efb449c33c6509abe1ad1 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Lab 1\n",
"## Bradford Knowlton Jr.\n",
"### January 26th, 2018"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from __future__ import division\n",
"from TreatmentOfData.rules import one, two, three, four"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"one(5,.5) # c,uA"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1400000.0"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"two(7,20,.25,5) # c,A,uA,m"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.0"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"three(3,4) # uA, uB"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"# four(5,.5,10,.1,3,4) # A,uA,m,B,uB,n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using what you learned while we created the iPython notebook today, create a notebook that you can use to analyze the following fabricated data from next week's Standing Waves Lab.\n",
"\n",
"For the Standing Waves Lab, you will be setting up standing waves on a string with various tension forces $F_T$, determining their wavelength, and using this data to calculate the frequency of the oscillator that is driving the string. You can determine f, the frequency of the oscillator as follows!\n",
"\n",
"$$f=\\frac{1}{\\lambda}\\sqrt{\\frac{F_T}{\\mu}}$$\n",
"\n",
"where $\\mu$ is the linear mass density of the string!\n",
"\n",
"$$\\mu=m/L$$\n",
"\n",
"Find $f \\pm \\delta f$, the frequency of the oscillator using the following data:\n",
"\n",
"$ \\lambda = 0.7814 m$\n",
"\n",
"$\\delta \\lambda = 1 mm$\n",
"\n",
"$F_T = 2.45 N$\n",
"\n",
"$\\delta F_T = 0.03 N$\n",
"\n",
"$m = 0.000435 kg$\n",
"\n",
"$\\delta m = 0.000002 kg$\n",
"\n",
"$L = 1.555 m$\n",
"\n",
"$\\delta L = 0.001 m$\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"Lambda = 0.7814 #m\n",
"ULambda = 1 # mm\n",
"Force = 2.45 # N\n",
"UForce = 0.03 # N\n",
"Mass = 0.000435 # kg\n",
"UMass = 0.000002 # Better University\n",
"Length = 1.555 # m\n",
"ULength = 0.001 # m"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$\\mu=m/L$$"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.000279742765273\n",
"0.00464245802493\n"
]
}
],
"source": [
"Mu = Mass/Length\n",
"\n",
"print Mu\n",
"\n",
"UMu = four(Mass,UMass,1,Length,ULength,1,1,1,0) # A,uA,m,B,uB,n\n",
"\n",
"print UMu"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$f=\\frac{1}{\\lambda}\\sqrt{\\frac{F_T}{\\mu}}$$"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"Force = (1)/(Lambda)*((Force)/(Mu))**(1/2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You will need to write a function for rule 4. Do all of your calculations in your iPython notebook. Print out the results in a sentence.\n",
"\n",
"$$\\frac{\\delta Q}{\\left|Q\\right|}=\\sqrt{\\left(m\\frac{\\delta A}{A}\\right)^2+\\left(n\\frac{\\delta B}{B}\\right)^2}$$"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"119.765078504 N ± 0.0985624059126 N\n"
]
}
],
"source": [
"UForce = four(Force,UForce,.5,Mu,UMu,.5,Lambda,ULambda,1) # A,uA,m,B,uB,n\n",
"\n",
"print Force,\"N ±\",UForce/abs(Force),\"N\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment