{
 "metadata": {
  "name": "",
  "signature": "sha256:171e0b3a4cf03f805eede8793d6581f40f2c39676882042655e650cafb9466f8"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER16 : SOUND WAVES "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 : Pg 330"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.1\n",
      "#calculation of the audibility of a wave \n",
      "#given data\n",
      "v=300.#velocity(in m/s) of the wave\n",
      "lambd=.60*10.**-2.#wavelength(in m) of the wave\n",
      "\n",
      "#calculation\n",
      "nu=v/lambd#frequency of the wave\n",
      "nu= 50000.\n",
      "print \"nu=50000\",\"Hz\"\n",
      "print \"This is much above the audible range. It is an ultrasonic wave and  will not be audible\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "nu=50000 Hz\n",
        "This is much above the audible range. It is an ultrasonic wave and  will not be audible\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 : Pg 331"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.2\n",
      "#calculation of the amplitude of vibration of the particles of the medium\n",
      "#given data\n",
      "import math \n",
      "lambd=40.*10.**-2.#wavelength(in m) of the wave\n",
      "deltap=1.*10.**-3.#difference between the minimum and the maximum pressure(in N/m**2) \n",
      "B=1.4*10.**5.#Bulk modulus(in N/m**2)\n",
      "\n",
      "#calculation\n",
      "p0=deltap/2.#pressure amplitude\n",
      "s0=(p0*lambd)/(2.*math.pi*B)#from equation of Bulk modulus\n",
      "\n",
      "print '%s %.12f %s' %('the amplitude of vibration of the particles of the medium is',s0,'m\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the amplitude of vibration of the particles of the medium is 0.000000000227 m\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 : Pg 334"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.3\n",
      "#calculation of the intensity of the sound wave\n",
      "\n",
      "#given data\n",
      "p0=2.*10.**-2.#pressure amplitue(in N/m**2)\n",
      "p0dash=2.5*10.**-2.#new pressure amplitue(in N/m**2)\n",
      "I=5.0*10.**-7.#intensity(in W/m**2) of the wave \n",
      "\n",
      "#calculation\n",
      "#intensity of the wave is proportional to square of the pressure amplituide\n",
      "Idash=I*((p0dash/p0)**2.)\n",
      "\n",
      "print '%s %3.2f %s' %('the intensity of the sound wave is',Idash,'W/m**2')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the intensity of the sound wave is 0.00 W/m**2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 : Pg 334"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.4\n",
      "#calculation of the increase in the sound level in decibels\n",
      "import math\n",
      "#given data\n",
      "r=20.#intensity is increase by r factor\n",
      "\n",
      "#calculation\n",
      "#using the equation.....beta = 10*log(I/I0)...we get\n",
      "deltabeta=10.*math.log10(r)#increase in sound level\n",
      "\n",
      "print '%s %.2f %s' %('the increase in the sound level in decibels is',deltabeta,'dB')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the increase in the sound level in decibels is 13.01 dB\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 : Pg 336"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.5\n",
      "#calculation of the nature of interference\n",
      "import math\n",
      "#given data\n",
      "nu=1.*10**3#frequency(in Hz) of the source\n",
      "deltax=83.*10**-2#difference in the length(in m) of paths\n",
      "v=332.#speed(in m/s) of the sound in air\n",
      "#calculation\n",
      "lamba=v/nu#wavelength\n",
      "delta=(2*math.pi/lamba)*deltax\n",
      "n=delta/math.pi#phase difference is 'n' multiple of pi\n",
      "#results\n",
      "if(n%2==0):\n",
      "    print 'the waves will interfere constructively.'#for even values of 'n'\n",
      "else:\n",
      "    print 'the waves will interfere destructively.'#for odd values of 'n'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the waves will interfere destructively.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 : Pg 338"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.6\n",
      "#calculation of the distance of the piston from the open end,for tube to vibrate in its first overtone \n",
      "\n",
      "#given data\n",
      "nu=416.#frequency(in Hz) of the tunning fork\n",
      "v=333.#speed(in m/s) of the sound in air\n",
      "\n",
      "#calculation\n",
      "lambd=v/nu#wavelength\n",
      "L=3.*lambd/4.#length of the tube\n",
      "\n",
      "print '%s %.2f %s' %('the distance of the piston from the open end,for tube to vibrate in its first overtone is',L*10**2,'cm')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the distance of the piston from the open end,for tube to vibrate in its first overtone is 60.04 cm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 : Pg 342"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.7\n",
      "#calculation of the tunning frequency of fork B\n",
      "\n",
      "#given data\n",
      "nu1=384.#tunning frequency(in Hz) of fork A\n",
      "n=6.#number of beats\n",
      "t=2.#time(in s) taken by the beats\n",
      "\n",
      "#calculation\n",
      "deltanu=n/t#frequency of beats\n",
      "nu2=nu1+deltanu#frequency of fork B\n",
      "nu2dash=nu1-deltanu#another frequency of fork B\n",
      "\n",
      "print '%s %.2f %s %.2f %s' %('the tunning frequency of fork B is',nu2dash,'Hz or',nu2,'Hz')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the tunning frequency of fork B is 381.00 Hz or 387.00 Hz\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 : Pg 343"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.8\n",
      "#calculation of the most dominant frequency\n",
      "\n",
      "#given data\n",
      "us=36.*10.**3./(60.*60.)#speed(in m/s) of the train\n",
      "nudash=12.*10.**3.#frequency(in Hz) detected by the detector\n",
      "v=340.#velocity(in m/s) of the sound in air\n",
      "\n",
      "#calculation\n",
      "#frequency detected is ......nudash = (v*nu0)/(v-us)\n",
      "nu0=(1.-(us/v))*nudash#required frequency\n",
      "\n",
      "print '%s %.2f %s' %('the most dominant frequency is',nu0*10**-3,'kHz')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the most dominant frequency is 11.65 kHz\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "WORKED EXAMPLES"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1w : Pg 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.1w\n",
      "#calculation of the depth of the sea and wavelength of the signal in the water\n",
      "#given data\n",
      "nu=50.*10.**3.#frequency(in Hz) of the given signal\n",
      "t=0.8#time(in s)requires for reflected wave to return\n",
      "v=1500.#speed(in m/s) of the sound in water\n",
      "\n",
      "#calculation\n",
      "d=v*t/2#depth of the sea\n",
      "lambd=v/nu#wavelength in water\n",
      "\n",
      "print '%s %.2f %s' %('the depth of the sea is',d,'m\\n')\n",
      "print '%s %.2f %s' %('the wavelength of the signal in the water is',lambd*10**2,'cm\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the depth of the sea is 600.00 m\n",
        "\n",
        "the wavelength of the signal in the water is 3.00 cm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2w : Pg 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#developed in windows XP operating system 32bit\n",
      "#platform Scilab 5.4.1\n",
      "#example 16.2w\n",
      "#calculation of the location of the plane\n",
      "\n",
      "#given data\n",
      "v=510.*10.**3./(60.*60.)#speed(in m/s) of the plane\n",
      "h=2000.#height(in m) of the plane\n",
      "vs=340.#speed(in m.s) of the sound in air\n",
      "\n",
      "#calculation\n",
      "t=h/vs#time taken by the sound to reach the observer\n",
      "d=v*t#location of the plane\n",
      "\n",
      "print '%s %.2f %s' %('the plane will be',d,'m ahead of the observer on its line of motion')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the plane will be 833.33 m ahead of the observer on its line of motion\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3w : Pg 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.3w\n",
      "#calculation of the frequency,wavelength,speed,maximum and minimum pressures of the sound wave\n",
      "import math\n",
      "#given data\n",
      "#equation of the sound wave is\n",
      "#p = (0.01 N/m**2)*sin((1000 s**-1)*t - (3.0 m**-1)*x)............(1)\n",
      "peq=1.0*10.**5.#equilibrium pressure(in N/m**2) of the air\n",
      "\n",
      "#calculation\n",
      "#comparing equation (1) with standard equation p = p0*sin(w*(t-(x/v)))...we get\n",
      "w=1000.#value of w(in s**-1)\n",
      "nu=w/(2.*math.pi)#frequency\n",
      "v=w/3#velocity\n",
      "lambd=v/nu#wavelength\n",
      "p0=0.01#pressure amplitude(in N/m**2)\n",
      "\n",
      "print '%s %.2f %s' %('the frequency is',nu,'Hz')\n",
      "print '%s %.2f %s' %('\\nthe wavelength is',lambd,'m')\n",
      "print '%s %.2f %s' %('\\nthe speed of the sound wave is',v,'m/s')\n",
      "print '%s %.2f %s' %('\\nthe maximum pressure amplitude is (%3.2e + %3.2f) N/m**2',peq,p0)\n",
      "print '%s %.2f %s' %('\\nthe minimum pressure amplitude is (%3.2e - %3.2f) N/m**2',peq,p0)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the frequency is 159.15 Hz\n",
        "\n",
        "the wavelength is 2.09 m\n",
        "\n",
        "the speed of the sound wave is 333.33 m/s\n",
        "\n",
        "the maximum pressure amplitude is (%3.2e + %3.2f) N/m**2 100000.00 0.01\n",
        "\n",
        "the minimum pressure amplitude is (%3.2e - %3.2f) N/m**2 100000.00 0.01\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4w : Pg 346"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#developed in windows XP operating system 32bit\n",
      "#platform Scilab 5.4.1\n",
      "#example 16.4w\n",
      "#calculation of the minimum separation between the two points for a given phase difference \n",
      "import math\n",
      "#given data\n",
      "nu=10.*10.**3.#frequency(in Hz) of the sound wave\n",
      "v=340.#speed(in m/s) of the wave\n",
      "delta=60.#phase difference(in degree)\n",
      "\n",
      "#calculation\n",
      "lambd=v/nu#wavelength\n",
      "k=2.*math.pi/lambd#wave number\n",
      "d=(delta*math.pi/180.)/k\n",
      "\n",
      "print '%s %3.2f %s' %('the minimum separation between the two points for phase difference of 60 degree is',d*10.**2.,'cm')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the minimum separation between the two points for phase difference of 60 degree is 0.57 cm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5w : Pg 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#developed in windows XP operating system 32bit\n",
      "#platform Scilab 5.4.1\n",
      "#example 16.5w\n",
      "#calculation of the atmospheric temperature\n",
      "\n",
      "#given data\n",
      "v1=336.#speed(in m/s) travelled by the sound\n",
      "v0=332.#speed(in m/s) of the sound at O degreecelsius\n",
      "T0=0+273.#temperature(in kelvin)\n",
      "\n",
      "#calculation\n",
      "T=((v1/v0)**2.)*T0#temperature (in kelvin)\n",
      "t=T-273.#temperature(in degreecelsius)\n",
      "\n",
      "print '%s %.2f %s' %('the atmospheric temperature is',round(t),'degreecelsius')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the atmospheric temperature is 7.00 degreecelsius\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6w : Pg 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.6w\n",
      "#calculation of the speed of sound wave in hydrogen\n",
      "\n",
      "#given data\n",
      "gama=1.4#value of constant gama for hydrogen\n",
      "voxygen=470.#speed(in m/s) of the sound wave in oxygen\n",
      "import math \n",
      "#calculation\n",
      "#speed of sound wave in a gas is ........v = sqrt(gama*P/rho)\n",
      "#at STP ,density of oxygen is 16 times density of hydrogen\n",
      "vhydrogen=voxygen*math.sqrt(16.)#speed of sound in hydrogen\n",
      "\n",
      "print '%s %.2f %s' %('the speed of sound wave in hydrogen is',vhydrogen,'m/s')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the speed of sound wave in hydrogen is 1880.00 m/s\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7w : Pg 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.7w\n",
      "#calculation of the energy delivered to the microphone\n",
      "import math\n",
      "#given data\n",
      "A=.80*10.**-4.#area(in m**2) of the cross section\n",
      "U=3.#power(in W0 output of the speaker\n",
      "d=2.#distance(in m) between the microphone and the speaker\n",
      "t=5.#time(in s) taken\n",
      "\n",
      "#calculation\n",
      "U0=A*U/(4.*math.pi*d**2.)#energy falling on the microphone in 1 s\n",
      "Udash=U0*t#energy falling on the microphone in t s\n",
      "\n",
      "print '%s %.2f %s' %('the energy delivered to the microphone in t=5 s is',round(Udash*10**6),'microJ')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the energy delivered to the microphone in t=5 s is 24.00 microJ\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8w : Pg 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.8w\n",
      "#calculation of the amplitude of vibration of the particles of the air\n",
      "import math\n",
      "#given data\n",
      "I=2.*10.**-6.#intensity(in W/m**2) of the sound wave\n",
      "nu=1.*10.**3.#frequency(in Hz) of the sound wave\n",
      "rho0=1.2#density(in kg/m**3) of the air\n",
      "v=330.#speed(in m/s) of the sound in the air\n",
      "\n",
      "#calculation\n",
      "s0=math.sqrt(I/(2.*math.pi**2.*nu**2.*rho0*v))#equation of displacement amplitide\n",
      "\n",
      "print '%s %.5f %s' %('the amplitude of vibration of the particles of the air is',s0,'m')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the amplitude of vibration of the particles of the air is 0.00000 m\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9w : Pg 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.9w\n",
      "#calculation of the factor by which the pressure amplituide increases\n",
      "import math \n",
      "#given data\n",
      "n=30.#increase(in dB) of the sound level\n",
      "\n",
      "#calculation\n",
      "#m = I2/I1 = intensity ratio\n",
      "m=10.**(n/10.)\n",
      "#since p2/p1 = sqrt(I2/I1)\n",
      "f=math.sqrt(m)#require factor\n",
      "\n",
      "print '%s %.2f' %('the factor by which the pressure amplituide increases is',round(f))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the factor by which the pressure amplituide increases is 32.00\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10w : Pg 347"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.10w\n",
      "#calculation of the frequency at which the maxima of intensity are detected\n",
      "#given data\n",
      "import math\n",
      "r=20.*10.**-2.#radius(in m) of the semicircular part\n",
      "v=340.#speed(in m/s) of the sound in air\n",
      "\n",
      "#calculation\n",
      "l1=2.*r#straight distance\n",
      "l2=math.pi*r#curve distance\n",
      "deltal=l2-l1\n",
      "nu=v/deltal\n",
      "\n",
      "print '%s %.2f %s %.2f %s' %('the frequency at which the maxima of intensity are detected are',nu,'Hz and',2*nu,'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the frequency at which the maxima of intensity are detected are 1489.15 Hz and 2978.30 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E11w : Pg 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.11w\n",
      "#calculation of the minimum distance between the source and the detector for maximum sound detection\n",
      "#given data\n",
      "nu=180.#frequency(in Hz)\n",
      "d=2.#distance(in m)\n",
      "v=360.#speed(in m/s) of the sound wave in air\n",
      "\n",
      "#calculation\n",
      "#path difference.....delta = (2*((2**2) + (x**2/4))**(1/2)) - (x)\n",
      "lambd=v/nu#wavelength\n",
      "delta=lambd\n",
      "#solving the above equation,we get\n",
      "x=4.-1.\n",
      "\n",
      "print '%s %.2f %s' %('the minimum distance between the source and the detector for maximum sound detection is',x,'m\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the minimum distance between the source and the detector for maximum sound detection is 3.00 m\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E12w : Pg 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.12w\n",
      "#calculation of the length of the shortest closed organ pipe that will resonate with the tunning fork\n",
      "#given data\n",
      "nu=264.#frequency(in Hz)of the tunning fork\n",
      "v=350.#speed(in m/s) of the sound in air\n",
      "\n",
      "#calculation\n",
      "#from the equation of the resonate frequency of the closed organ pipe....l = (n*v)/(4*nu)\n",
      "n=1.#for l to be minimum\n",
      "lmin=(v)/(4.*nu)#equation of the resonate frequency of the closed organ pipe\n",
      "\n",
      "print '%s %.2f %s' %('the length of the shortest closed organ pipe that will resonate with the tunning fork is',lmin*10**2,'cm\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the length of the shortest closed organ pipe that will resonate with the tunning fork is 33.14 cm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E13w : Pg 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.13w\n",
      "#calculation of the length of the closed pipe\n",
      "#given data\n",
      "l0=60.*10.**-2.#length(in m) of the open pipe\n",
      "\n",
      "#calculation\n",
      "#from the equation of the resonate frequency of the closed organ pipe....l=(n*v)/(4*nu)\n",
      "l1=l0/4.\n",
      "\n",
      "print '%s %.2f %s' %('the length of the closed pipe is',l1*10**2,'cm\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the length of the closed pipe is 15.00 cm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E14w : Pg 348"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.14w\n",
      "#calculation of the speed of the sound in air\n",
      "#given data\n",
      "nu=800.#frequency(in Hz) of the tunning fork\n",
      "l1=9.75*10.**-2.#distance(in m) where resonance is observed\n",
      "l2=31.25*10.**-2.#distance(in m) where resonance is observed\n",
      "l3=52.75*10.**-2.#distance(in m) where resonance is observed\n",
      "\n",
      "#calculation\n",
      "#from the equation of the resonate frequency ....l = (n*v)/(4*nu)\n",
      "#(n*v)/(4*l1) = nu...................(1)\n",
      "#((n+2)*v)/(4*l2) = nu...............(2)\n",
      "#((n+4)*v)/(4*l3) = nu...............(3)\n",
      "#form above equations ,we get\n",
      "v=2.*nu*(l2-l1)\n",
      "\n",
      "print '%s %.2f %s' %('the speed of the sound in air is',v,'m/s\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the speed of the sound in air is 344.00 m/s\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E15w : Pg 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.15w\n",
      "#calculation of the fundamental frequency if the air is replaced by hydrogen\n",
      "#given data\n",
      "import math \n",
      "nu0=500.#fundamental frequency(in Hz)\n",
      "rhoa=1.20#density(in kg/m**3) of air\n",
      "rhoh=0.089#density(in kg/m**3) of hydrogen\n",
      "\n",
      "#calculation\n",
      "#fundamental frequency of an organ pipe is proportional to the speed of the sound\n",
      "nu=nu0*math.sqrt(rhoa/rhoh)\n",
      "\n",
      "print '%s %.2f %s' %('the fundamental frequency if the air is replaced by hydrogen is',nu,'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the fundamental frequency if the air is replaced by hydrogen is 1835.97 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E16w : Pg 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.16w\n",
      "#calculation of the speed,wavelength in the rod,frequency,wavelength in the air\n",
      "#given data\n",
      "import math \n",
      "l=90.*10.**-2.#length(in m) of the rod\n",
      "rho=2600.#density(in kg/m**3) of the aluminium\n",
      "Y=7.80*10.**10.#Young modulus(in N/m**2)\n",
      "vai=340.#speed(in m/s) of the sound in the air\n",
      "\n",
      "#calculation\n",
      "v=math.sqrt(Y/rho)#speed of the sound in aluminium\n",
      "lambd=2.*l#wavelength....since rod vibrates with fundamental frequency\n",
      "nu=v/lambd#frequency\n",
      "lambdaai=vai/nu#wavelength in the air\n",
      "\n",
      "print '%s %.2f %s' %('the speed of the sound in aluminium is',v,'m/s\\n')#Textbook Correction : correct answer is 5477 m/s\n",
      "print '%s %.2f %s' %('the wavelength of the sound in aluminium rod is',lambd*10.**2.,'cm\\n')\n",
      "print '%s %.2f %s' %('the frequency of the sound produced is',nu,'Hz\\n')#Textbook Correction : correct answer is 3042 Hz\n",
      "print '%s %.2f %s' %('the wavelength of the sound in air is',lambdaai*10**2,'cm\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the speed of the sound in aluminium is 5477.23 m/s\n",
        "\n",
        "the wavelength of the sound in aluminium rod is 180.00 cm\n",
        "\n",
        "the frequency of the sound produced is 3042.90 Hz\n",
        "\n",
        "the wavelength of the sound in air is 11.17 cm\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E17w : Pg 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.17w\n",
      "#calculation of the frequency of the note emitted by the taut string\n",
      "#given data\n",
      "nu1=440.#frequency(in Hz) of the string\n",
      "n=4.#number of beats per second\n",
      "nuf=440.#tunning frequency(in Hz) of the fork\n",
      "\n",
      "#calculation\n",
      "fre=nuf+n#required frequncy\n",
      "\n",
      "print '%s %.2f %s' %('the frequency of the note emitted by the taut string is',fre,'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the frequency of the note emitted by the taut string is 444.00 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E18w : Pg 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.18w\n",
      "#calculation of the apparent frequency\n",
      "#given data\n",
      "us=36.*10.**3./(60.*60.)#speed(in m/s)of the car\n",
      "v=340.#speed(in m/s) of the sound in the air\n",
      "nu=500.#frequency(in Hz)\n",
      "\n",
      "#calculation\n",
      "nudash=(v/(v+us))*nu#apparent frequency  heard by the observer\n",
      "nudashdash=(v/(v-us))*nu#frequency received by the wall\n",
      "\n",
      "print '%s %.2f %s' %('the apparent frequency heard by the ground observer is',round(nudash),'Hz\\n')\n",
      "print '%s %.2f %s' %('the frequency of the reflected wave as heard by the ground observer is',nudashdash,'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the apparent frequency heard by the ground observer is 486.00 Hz\n",
        "\n",
        "the frequency of the reflected wave as heard by the ground observer is 515.15 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E19w : Pg 349"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.19w\n",
      "#calculation of the frequency of the whistle of the train\n",
      "#given data\n",
      "us=72.*10.**3./(60.*60.)#speed(in m/s) of the train 1\n",
      "u0=54.*10.**3./(60.*60.)#speed(in m/s) of the train 2\n",
      "nu=600.#frequency(in Hz) of the whistle\n",
      "v=340.#speed(in m/s)of sound in the air\n",
      "\n",
      "#calculation\n",
      "nudash=((v+u0)/(v-us))*nu#frequency heard by the observer before the meeting of the trains\n",
      "nudashdash=((v-u0)/(v+us))*nu#frequency heard by the observer after the crossing of the trains\n",
      "\n",
      "print '%s %.2f %s' %('the frequency heard by the observer before the meeting of the trains is',round(nudash),'Hz\\n')\n",
      "print '%s %.2f %s' %('the frequency heard by the observer after the crossing of the trains is',round(nudashdash),'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the frequency heard by the observer before the meeting of the trains is 666.00 Hz\n",
        "\n",
        "the frequency heard by the observer after the crossing of the trains is 542.00 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E20w : Pg 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.20w\n",
      "#calculation of the main frequency heard by the person\n",
      "#given data\n",
      "us=36.*10.**3./(60.*60.)#speed(in m/s) of the person on the scooter\n",
      "v=340.#speed(in m/s) of sound in the air\n",
      "nu=600.#frequency(in Hz) of the siren\n",
      "\n",
      "#calculation\n",
      "nudash=(v/(v+us))*nu#main frequency\n",
      "\n",
      "print '%s %.2f %s' %('the main frequency heard by the person is',round(nudash),'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the main frequency heard by the person is 583.00 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E21w : Pg 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.21w\n",
      "#calculation of the original frequency of the source\n",
      "#given data\n",
      "u0=10.#speed(in m/s) of the observer going away from the source\n",
      "us=10.#speed(in m/s) of the source going away from observer\n",
      "nudash=1950.#frequency(in Hz) of the sound detected by the detector\n",
      "v=340.#speed(in m/s) of the sound in the air\n",
      "\n",
      "#calculation\n",
      "nu=((v+us)/(v-u0))*nudash#original frequency\n",
      "\n",
      "print '%s %.2f %s' %('the original frequency of the source is',round(nu),'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the original frequency of the source is 2068.00 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E22w : Pg 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.22w\n",
      "#calculation of the speed of the car\n",
      "#given data\n",
      "nudash=440.#frequency(in Hz) emitted by the wall\n",
      "nudashdash=480.#frequency(in Hz) heard by the car driver\n",
      "v=330.#speed(in m/s) of the sound in the air\n",
      "\n",
      "#calculation\n",
      "#frequency received by the wall..............nudash = (v/(v-u))*nu............(1)\n",
      "#frequency(in Hz) heard by the car driver....nudashdash = ((v+u)/v)*nudash....(2)\n",
      "#from above two equations,we get\n",
      "u=((nudashdash-nudash)/(nudashdash+nudash))*v#speed of the car\n",
      "\n",
      "print '%s %.2f %s %.2f %s' %('the speed of the car is',u,'m/s or',round(u*10**-3*60*60),'km/h\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the speed of the car is 14.35 m/s or 52.00 km/h\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E23w : Pg 350"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#example 16.23w\n",
      "#calculation of the frequency of train whistle heard by the person standing on the road perpendicular to the track\n",
      "#given data\n",
      "import math\n",
      "from math import acos,cos\n",
      "v=340.#speed(in m/s) of the sound in the air\n",
      "d1=300.#distance(in m) of the train from the crossing\n",
      "u=120.*10.**3./(60.*60.)#speed(in m/s) of the train\n",
      "nu=640.#frequency(in Hz) of the whistle\n",
      "d2=400.#distance(in m) of the person from the crossing ,perpendicular to the track\n",
      "\n",
      "#calculation\n",
      "theta=acos(d1/(d1**2.+d2**2.)*57.3)*5.#pythagoras theorem\n",
      "nudash=(v/(v-(u*cos(theta)))*57.3)*nu#frequency of the whistle heard\n",
      "\n",
      "print '%s %.2f %s' %('the frequency of train whistle heard by the person standing on the road perpendicular to the track is',nudash,'Hz\\n')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the frequency of train whistle heard by the person standing on the road perpendicular to the track is 37926.25 Hz\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 32
    }
   ],
   "metadata": {}
  }
 ]
}