{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 14:Sound"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex14.1:pg-623"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The speed of the sound in neon is v= 432.0  meters/sec\n"
     ]
    }
   ],
   "source": [
    "  #Example 14_1\n",
    "import math  \n",
    "  #To find the speed of sound in neon\n",
    "gama=1.66         #units in Constant\n",
    "r=8314        #Units in J/Kmol\n",
    "t=273         #Units in K\n",
    "m=20.18    #Units in Kg/Kmol\n",
    "v=math.sqrt((gama*r*t)/m)        #Units in meters/sec\n",
    "print \"The speed of the sound in neon is v=\",round(v),\" meters/sec\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex14.2:pg-625"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The sound level of the sound wave is= 70.0  dB\n"
     ]
    }
   ],
   "source": [
    "  #Example 14_2\n",
    "import math  \n",
    "  #To find the sound level of a sound wave\n",
    "i1=10**-5      #Units in W/meter**2\n",
    "i2=10**-12       #Units in W/meter**2\n",
    "level=10*math.log10(i1/i2)      #units in dB\n",
    "print \"The sound level of the sound wave is=\",round(level),\" dB\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex14.3:pg-625"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The intensity of sound is I=\n",
      "3.16227766017e-09\n",
      "W/meter**2\n"
     ]
    }
   ],
   "source": [
    "  #Example 14_3\n",
    "import math \n",
    "  #To find the intensity of sound\n",
    "level=3.5   #Units in dB\n",
    "i2=10**-12    #Units in W/meter**2\n",
    "i=10**(level+math.log10(i2))     #Units in W/meter**2\n",
    "print \"The intensity of sound is I=\"\n",
    "print i\n",
    "print \"W/meter**2\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex14.4:pg-626"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The distance it has to be moved is= 70.0  cm\n"
     ]
    }
   ],
   "source": [
    "  #Example 14_4\n",
    " \n",
    "  \n",
    "  #To find how far it has to be moved before the sound becomes weak\n",
    "lamda=70   #units in cm\n",
    "lamda1=0.5*lamda     #Units in cm\n",
    "print \"The distance it has to be moved is=\",round(lamda),\" cm\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex14.5:pg-627"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The frequency we hear is f= 531.0  Hz\n",
      "\n",
      "The frequency of the receding is f= 472.0  Hz\n",
      "\n"
     ]
    }
   ],
   "source": [
    "  #Example 14_5\n",
    " \n",
    "  \n",
    "  #To find the frequency heard and the receding\n",
    "f=500    #Units in Hz\n",
    "vw=340.0       #Units in meters/sec\n",
    "dist=20      #Units in meters/sec\n",
    "f1=f*(vw/(vw-dist))    #Units in Hz\n",
    "print \"The frequency we hear is f=\",round(f1),\" Hz\\n\"\n",
    "f1=f*(vw/(vw+dist))    #Units in Hz\n",
    "print \"The frequency of the receding is f=\",round(f1),\" Hz\\n\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex14.6:pg-628"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The difference between the both frequencies is= 1667.0  Hz\n"
     ]
    }
   ],
   "source": [
    "  #Example 14_6\n",
    " \n",
    "  \n",
    "  #To find the difference between the frequency of wave reaching the officer and the car\n",
    "fo=10**10       #Units in Hz\n",
    "vw=3*10.0**8        #Units in meters/sec\n",
    "vc=25     #Units in meters/sec\n",
    "f1=fo*((vw+vc)/(vw-vc))         #Units in Hz\n",
    "f1=f1-10**10         #Units in Hertz\n",
    "print \"The difference between the both frequencies is=\",round(f1),\" Hz\"\n",
    "  #In text book answer printed wrong as 1670 Hz correct answer is 1666 Hz\n"
   ]
  }
 ],
 "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}