diff options
author | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
---|---|---|
committer | Thomas Stephen Lee | 2015-08-28 16:53:23 +0530 |
commit | db0855dbeb41ecb8a51dde8587d43e5d7e83620f (patch) | |
tree | b95975d958cba9af36cb1680e3f77205354f6512 /Oscillations_and_Waves_by_S._Prakash/chapter1.ipynb | |
parent | 5a86a20b9de487553d4ef88719fb0fd76a5dd6a7 (diff) | |
download | Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.gz Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.bz2 Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.zip |
add books
Diffstat (limited to 'Oscillations_and_Waves_by_S._Prakash/chapter1.ipynb')
-rwxr-xr-x | Oscillations_and_Waves_by_S._Prakash/chapter1.ipynb | 849 |
1 files changed, 849 insertions, 0 deletions
diff --git a/Oscillations_and_Waves_by_S._Prakash/chapter1.ipynb b/Oscillations_and_Waves_by_S._Prakash/chapter1.ipynb new file mode 100755 index 00000000..9c8321a9 --- /dev/null +++ b/Oscillations_and_Waves_by_S._Prakash/chapter1.ipynb @@ -0,0 +1,849 @@ +{ + "metadata": { + "name": "", + "signature": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter1 - Free oscillations in one-dimension : Simple harmonic Oscillator" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 1, page 9" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from math import sqrt, pi\n", + "# FREQUENCY AND TIME PERIOD\n", + "#format('v',6)\n", + "#ph=50*x**2+100 in joule/kg\n", + "m=10 #mass in kg\n", + "f=10**3/m #joule/kg\n", + "w=sqrt(f) #oscillations\n", + "fr=w/(2*pi) #oscillations/sec\n", + "tp=1/fr #seconds\n", + "print \"Frequency of oscillation = %0.1f oscillations/seconds \"%fr\n", + "print \"Time period = %0.3f seconds \" %tp" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency of oscillation = 1.6 oscillations/seconds \n", + "Time period = 0.628 seconds \n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 3, page 11" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# ENERGY\n", + "ke=5 #joule\n", + "pe=5 #joule\n", + "rep=10 #joule\n", + "eo=rep+ke+pe #joule\n", + "print \"Energy of the oscillator = %0.f J\" %eo" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy of the oscillator = 20 J\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 4, page 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#peroid ,maximum velocity and acceleration\n", + "a=3 #cm\n", + "b=4 #cm\n", + "A=sqrt(a**2+b**2) #cm\n", + "w=2 #sec**-1\n", + "T=(2*pi)/w #seconds\n", + "um=w*A #cm/s\n", + "am=w**2*A #cm/s**2\n", + "print \"Time period = %0.f seconds\" %T\n", + "print \"Maximum velocity = %0.f cm/s\" %um\n", + "print \"Maximum acceleration = %0.f cm/s2 \" %am" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time period = 3 seconds\n", + "Maximum velocity = 10 cm/s\n", + "Maximum acceleration = 20 cm/s2 \n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 5, page 12" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import pi\n", + "# maximum velocity and acceleration\n", + "A=5 #cm\n", + "T=31.4#seconds\n", + "w=(2*pi)/T #sec**-1\n", + "um=w*A #cm/s\n", + "am=w**2*A #cm/s**2\n", + "print \"Maximum velocity = %0.f cm/s\" %um\n", + "print \"Maximum acceleration = %0.1f cm/s2 \" %am" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Maximum velocity = 1 cm/s\n", + "Maximum acceleration = 0.2 cm/s2 \n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 6, page 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import pi, sqrt\n", + "# Period \n", + "#given data :\n", + "g=9.8 # constant\n", + "l=1 # in m\n", + "theta_m1=60 # in degree\n", + "theta_m=pi/3 # in radians\n", + "T0=round(2*pi*sqrt(l/g)) \n", + "print \"(a) Time period for small displacement, T0 = %0.f seconds \" %T0\n", + "T=T0*(1+(theta_m**2/16)) \n", + "print \"(b) Time period, T = %0.1f seconds \" %T" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) Time period for small displacement, T0 = 2 seconds \n", + "(b) Time period, T = 2.1 seconds \n" + ] + } + ], + "prompt_number": 14 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 7, page 20" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# ENERGY\n", + "es=1 #joule\n", + "l=2 #metre\n", + "am=3 #cm\n", + "am1=5 #cm\n", + "e1=(am1**2/am**2)*es #joules\n", + "l2=1 #meter\n", + "e2=(l/l2)*es #joules\n", + "print \"Energy in first case = %0.3f J\" %e1\n", + "print \"Energy in second case = %0.1f J\" %e2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Energy in first case = 2.778 J\n", + "Energy in second case = 2.0 J\n" + ] + } + ], + "prompt_number": 16 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 8, page 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt, pi\n", + "# Period of motion\n", + "#given data :\n", + "x=0.16 # in m\n", + "m1=4 # in kg\n", + "g=9.8 \n", + "K=m1*g/x \n", + "m=0.50 # in kg\n", + "T=2*pi*sqrt(m/K) # \n", + "print \"The period of motion, T = %0.2f seconds \" %T\n", + "# answer is wrong in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The period of motion, T = 0.28 seconds \n" + ] + } + ], + "prompt_number": 18 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 9, page 28" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "#foce constant,displacement , acceleration and energy\n", + "#given data :\n", + "x1=.10 # in m\n", + "F1=4 # in N\n", + "K=F1/x1 \n", + "x2=0.12 # in m\n", + "print \"(a) The force constant, K = %0.2f N/m\" %K\n", + "F=-K*x2 \n", + "print \"(b) The force, F = %0.2f N\" %F\n", + "m=1.6 # in kg\n", + "T=2*pi*sqrt(m/K) \n", + "print \"(c) Period of oscillation, T = %0.3f s \" %T\n", + "A=x2 \n", + "print \"(d) Amplitude of motion, A = %0.2f m \" %A\n", + "alfa=A*K/m \n", + "print \"(e) Maximum acceleration, alfa = %0.2f m/s2 \" %alfa\n", + "x=A/2 # in m\n", + "w=sqrt(K/m) \n", + "v=w*sqrt(A**2-x**2) \n", + "a=w**2*x # in m/s**2\n", + "KE=(1/2)*m*v**2 # in J\n", + "PE=(1/2)*K*x**2 # in J\n", + "TE=KE+PE \n", + "print \"(f) Velocity = %0.2f m/s \" %v\n", + "print \"(f) Acceleration = %0.2f m/s2 \" %a\n", + "print \"(f) Kinetic energy = %0.2f J \" %KE\n", + "print \"(f) Potential energy = %0.2f J\" %PE\n", + "print \"(g) Total energy of the oscillating system, TE = %0.2f J\" %TE\n", + "# In textbook part f is inculded in the part e so their is the numbeing error in parts" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(a) The force constant, K = 40.00 N/m\n", + "(b) The force, F = -4.80 N\n", + "(c) Period of oscillation, T = 1.257 s \n", + "(d) Amplitude of motion, A = 0.12 m \n", + "(e) Maximum acceleration, alfa = 3.00 m/s2 \n", + "(f) Velocity = 0.52 m/s \n", + "(f) Acceleration = 1.50 m/s2 \n", + "(f) Kinetic energy = 0.22 J \n", + "(f) Potential energy = 0.07 J\n", + "(g) Total energy of the oscillating system, TE = 0.29 J\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 10, page 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sin\n", + "from sympy import symbols, pi\n", + "# ENERGY\n", + "t=8/3 #seconds\n", + "v=-10*pi*sin((35*pi)/6)#cm/s\n", + "print \"Velocity =\",v,\"cm\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Velocity = 5.0*pi cm\n" + ] + } + ], + "prompt_number": 31 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 11, page 30" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt, pi\n", + "#given data :\n", + "K1=3 # in N/m\n", + "K2=2 # in N/m\n", + "m=0.050 # in kg\n", + "w=sqrt((K1+K2)/m) \n", + "n=w/(2*pi) \n", + "print \"(i) The frequency, n = %0.2f oscillations/sec \" %n\n", + "A=0.004 # in m\n", + "E=(1/2)*A**2*(K1+K2) \n", + "print \"(ii) The energy, E = %0.e J \" %E\n", + "v=sqrt(2*E/m) \n", + "print \"(iii) The velocity, v = %0.2f m/s\" %v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) The frequency, n = 1.59 oscillations/sec \n", + "(ii) The energy, E = 4e-05 J \n", + "(iii) The velocity, v = 0.04 m/s\n" + ] + } + ], + "prompt_number": 35 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 12, page 33" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Rotational inertia\n", + "#given data :\n", + "M=0.1 # in m\n", + "l=0.1 # in m\n", + "I1=M*l**2/12 # in kg-m**2\n", + "T1=2 # in s\n", + "T2=6 # in s\n", + "I2=(I1*T2**2)/T1**2 \n", + "print \"Rotational inertia, I2 = %0.1e kg-m2 \" %I2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Rotational inertia, I2 = 7.5e-04 kg-m2 \n" + ] + } + ], + "prompt_number": 38 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 13, page 34" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "# Time period\n", + "#given data :\n", + "M=4 # in kg\n", + "R=0.10 # in m\n", + "I=(2/5)*M*R**2 # in kg.m**2\n", + "C=4*10**-3 # in Nm/radian\n", + "T=2*pi*sqrt(I/C) \n", + "print \"Time period, T = %0.2f s \" %T\n", + "# answer is wrong in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Time period, T = 12.57 s \n" + ] + } + ], + "prompt_number": 39 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 15, page 41" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt, pi\n", + "# Energy\n", + "#given data :\n", + "L=10*10**-3 # in H\n", + "C=20*10**-6 # in F\n", + "n=1/(2*pi*sqrt(L*C)) \n", + "V=10 #in V\n", + "U=(1/2)*C*V**2 \n", + "print \"Frequency, n = %0.2f cycles/s \" %n\n", + "print \"Energy of oscillations,U = %0.1e J \" %U\n", + "#answer of frequency is calculated wrong in textbook" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency, n = 355.88 cycles/s \n", + "Energy of oscillations,U = 1.0e-03 J \n" + ] + } + ], + "prompt_number": 41 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 16, page 47" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# distance,binding energy and force constant\n", + "print \"Equilibrium inter-nuclear distance correspondes to lowest potential enegy is ro= 2*\u00c5\"\n", + "pet=0 #eV\n", + "peb=-4 #eV\n", + "be=pet-peb #eV\n", + "x1=-2 #eV\n", + "x2=-4 #eV\n", + "V=x1-x2 #eV\n", + "e=1.6*10**-19 #electronic charge\n", + "x=0.5 #armstrong\n", + "K=((2*V)/x**2) #eV/\u00c5**2\n", + "k1=(K*e)/(10**-10)**2 #joule/m**2\n", + "print \"Binding energy = %0.2f eV \" %be\n", + "print \"Force constant = %0.2f N/m \" %k1" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Equilibrium inter-nuclear distance correspondes to lowest potential enegy is ro= 2*\u00c5\n", + "Binding energy = 4.00 eV \n", + "Force constant = 256.00 N/m \n" + ] + } + ], + "prompt_number": 42 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 17, page 48" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# possible values and energy\n", + "r1=2 #from graph\n", + "r2=4.5 #units from graph\n", + "print \"Possible values of r are\",r1,\"units and\",r2,\"units.\"\n", + "osc=1-(-2.5) #units\n", + "print \"Maximum energy of oscillations for r=2 units is\",osc,\"units.\"\n", + "osc1=0.5-(-1) #units\n", + "print \"Maximum energy of oscillations for r=4.5 units is\",osc1,\"units.\"\n", + "t=1 #from graph\n", + "v=0 #from graph\n", + "e=t+v #\n", + "print \"Total energy = %0.2f unit \" %e\n", + "print \"At infinity V =\",v,\"therefore T =\",t,\"unit.\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Possible values of r are 2 units and 4.5 units.\n", + "Maximum energy of oscillations for r=2 units is 3.5 units.\n", + "Maximum energy of oscillations for r=4.5 units is 1.5 units.\n", + "Total energy = 1.00 unit \n", + "At infinity V = 0 therefore T = 1 unit.\n" + ] + } + ], + "prompt_number": 43 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 19, page 67" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt, pi\n", + "# Frequency\n", + "#given data :\n", + "m1=10 # in g\n", + "m2=90 # in g\n", + "K=10**3 # in N/m\n", + "mu=m1*m2*10**-3/(m1+m2) \n", + "n=round(sqrt(K/mu)/(2*pi)) \n", + "print \"The frequency, n = %0.2f oscillations/sec \" %n\n", + "x1=0 #\n", + "x2=10 #cm\n", + "xb=((m1*x1+m2*x2)/(m1+m2)) #cm\n", + "mo=(m1*10**-3)*(xb*10**-2)**2+(m2*10**-3)*(1*10**-2)**2 #\n", + "print \"Moment of inertia = %0.1e kg-m2 \" %mo" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The frequency, n = 53.00 oscillations/sec \n", + "Moment of inertia = 9.0e-05 kg-m2 \n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 20, page 68" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt, pi\n", + "# frequency and amplitude\n", + "c=10**-4 #N-m\n", + "m1=9 #gm\n", + "m2=1 #gm\n", + "mu=((m1*m2)/(m1+m2))*10**-3 #kg\n", + "r=20 #cm\n", + "I=mu*(r*10**-2)**2 #kg-m**2\n", + "fr=((1/(2*pi))*sqrt(c/I)) #vibrations/sec\n", + "print \"Frequency of vibration = %0.2f vibrations/s \" %fr\n", + "e=10**-2 #joule\n", + "thmax=sqrt((2*e)/c) #radians\n", + "print \"Amplitude = %0.2f radians \" %thmax" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency of vibration = 0.27 vibrations/s \n", + "Amplitude = 14.14 radians \n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 21, page 69" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "# frequency ,energy and maximum velocity\n", + "c=1 #N-m \n", + "m1=6 #gm\n", + "m2=2 #gm\n", + "mu=((m1*m2)/(m1+m2))*10**-3 #kg\n", + "fr=((1/(2*pi))*sqrt(c/mu)) #vibrations/sec\n", + "print \"Frequency of oscillations = %0.1f vibrations/s \" %fr\n", + "td= 1+(1/3) #cm\n", + "e=((1/2)*c*(td*10**-2)**2) #joule\n", + "print \"Energy = %0.1e J \" %e\n", + "y=((1/2)*m2*10**-3)+((1/2)*(1/3)**2*m1*10**-3) #\n", + "v1=sqrt((e/y)) #m/sec\n", + "print \"Maximum velocity of smaller mass = %0.2f m/s\" %v1\n", + "#velocity is calculated wrong in the book" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequency of oscillations = 4.1 vibrations/s \n", + "Energy = 8.9e-05 J \n", + "Maximum velocity of smaller mass = 0.26 m/s\n" + ] + } + ], + "prompt_number": 48 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 22, page 70" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt, pi\n", + "# frequency\n", + "k=100 #N/m\n", + "m=100 #gm\n", + "n1=((1/(2*pi))*sqrt(k/(m*10**-3))) #sec**-1\n", + "m1=100 #gm\n", + "m2=200 #gm\n", + "mu=((m1*m2)/(m1+m2))*10**-3 #kg\n", + "fr=((1/(2*pi))*sqrt(k/mu)) #sec**-1\n", + "print \"In first case frequency = %0.f sec^-1 \"%n1\n", + "print \"In second case frequency = %0.1f sec^-1 \"%fr" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "In first case frequency = 5 sec^-1 \n", + "In second case frequency = 6.2 sec^-1 \n" + ] + } + ], + "prompt_number": 50 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 23, page 73" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# force constant and work done\n", + "m1=1 #assume\n", + "m2=19 #assume\n", + "mh=1.66*10**-27 #kg\n", + "mu=((m1*m2)/(m1+m2))*mh #kg\n", + "w=7.55*10**14 #radians/sec\n", + "k=mu*(w)**2 #N/m\n", + "print \"Force constant = %0.1f N/m \" %k\n", + "x=0.5 #arngstrom\n", + "wh=((1/2)*k*(x*10**-10)**2) #joule\n", + "print \"Work done = %0.3e J\" %wh" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Force constant = 898.9 N/m \n", + "Work done = 1.124e-18 J\n" + ] + } + ], + "prompt_number": 52 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Example 24, page 74" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from math import sqrt\n", + "# frequency\n", + "m1=1 #a.m.u\n", + "m2=35 #a.m.u\n", + "mu1=((m1*m2)/(m1+m2)) #a.m.u\n", + "m3=2 #\n", + "mu2=((m3*m2)/(m3+m2)) #a.m.u\n", + "n1=8.99*10**13 #cycle/sec\n", + "n2=(sqrt(mu1/mu2))*n1 #c/s\n", + "print \"Frequecy of vibrations = %0.2e c/s \" %n2" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Frequecy of vibrations = 6.44e+13 c/s \n" + ] + } + ], + "prompt_number": 53 + } + ], + "metadata": {} + } + ] +} |