{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#Chapter 2:POLARIZATION AND ULTRASONICS "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.1, Page number 2.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "theta= 45.0 degrees\n",
      "theta= 135.0 degrees\n",
      "#The value of theta can be +(or)- 45 degrees and +(or)-135 degrees.\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "I=1/2\n",
    "\n",
    "#Calculation\n",
    "theta1=math.acos(1/math.sqrt(2))*(180/math.pi)\n",
    "theta2=math.acos(-1/math.sqrt(2))*(180/math.pi)\n",
    "#Result\n",
    "print\"theta=\",theta1,\"degrees\"\n",
    "print\"theta=\",theta2,\"degrees\"\n",
    "print\"#The value of theta can be +(or)- 45 degrees and +(or)-135 degrees.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.2, Page number 2.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ip= 60.0 degrees\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Calculation\n",
    "ip=math.atan(1.732)*(180/math.pi)\n",
    "\n",
    "#Result\n",
    "print\"ip=\",round(ip),\"degrees\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.3, Page number 2.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "phi= 104.7 rad.\n",
      "Since the phase difference should be with in 2pi radius, we get phi=4.169 rad.\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "d=1*10**-3\n",
    "lamda=6000*10**-10\n",
    "nd=0.01                  #difference between the refractive indices(n1 - n2)\n",
    "\n",
    "#Calculation\n",
    "phi=(2*math.pi*d*nd)/lamda\n",
    "\n",
    "#Result\n",
    "print\"phi=\",round(phi,1),\"rad.\"\n",
    "print\"Since the phase difference should be with in 2pi radius, we get phi=4.169 rad.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.4, Page number 2.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Thickness,t= 27.47 micro m.\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5000*10**-10\n",
    "mu_0=1.5533\n",
    "mu_1=1.5442\n",
    "\n",
    "#Calculations\n",
    "t=lamda/(2*(mu_0 - mu_1))\n",
    "         \n",
    "#Result\n",
    "print\"Thickness,t=\",round(t*10**6,2),\"micro m.\" "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.5, Page number 2.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Birefringence of the crystal delta/mu= 0.005\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=6000*10**-10\n",
    "t=0.003*10**-2\n",
    "\n",
    "#Calculations\n",
    "delta_mu=lamda/(4*t)\n",
    "\n",
    "#Result\n",
    "print\"Birefringence of the crystal delta/mu=\",delta_mu\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.6, Page number 2.34ΒΆ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Refractive index of medium= 1.732\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "theta=60*(math.pi/180)        #When the angle of refraction is 30degrees, angle of reflection will be 60degrees\n",
    "\n",
    "#Calculation\n",
    "mu=math.tan(theta)\n",
    "\n",
    "#Result\n",
    "print\"Refractive index of medium=\",round(mu,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.7, Page number 2.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ultrasonic wavelength,lamda s = 7.47 *10**-4 m\n",
      "Velocity of ultrasonic waves in liquid = 1495.0 ms**-1\n",
      "#Answer varies due to rounding of numbers\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=1\n",
    "lamda_l=6000*10**-10\n",
    "theta=0.046*(math.pi/180)\n",
    "n=2*10**6\n",
    "\n",
    "#Calculation\n",
    "lamda_s=(m*lamda_l)/(math.sin(theta))\n",
    "v=n*lamda_s\n",
    "\n",
    "#Result\n",
    "print\"Ultrasonic wavelength,lamda s =\",round(lamda_s*10**4,2),\"*10**-4 m\"\n",
    "print\"Velocity of ultrasonic waves in liquid =\",round(v),\"ms**-1\"\n",
    "print\"#Answer varies due to rounding of numbers\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "##Example number 2.8, Page number 2.35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Velocity of blood flow = 0.1001 m s**-1\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "C=1500\n",
    "Df=267\n",
    "f=2*10**6\n",
    "theta=0*math.pi/180          #degrees\n",
    "\n",
    "#Calculation\n",
    "V=(C*Df)/(2*f*math.cos(theta))\n",
    "\n",
    "#Result\n",
    "print\"Velocity of blood flow =\",round(V,4),\"m s**-1\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.9, Page number 2.35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fundamental frequency,f = 4.0 *10**6 Hz.\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "t=0.7*10**-3\n",
    "E=8.8*10**10\n",
    "rho=2800\n",
    "\n",
    "#Calculation\n",
    "f=(1/(2*t))*math.sqrt(E/rho)       #Fundamental frequency\n",
    "\n",
    "#Result\n",
    "print\"Fundamental frequency,f =\",round(f*10**-6),\"*10**6 Hz.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 2.10, Page number 2.35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The depth of the sea = 997.5 m.\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "v=1500\n",
    "t=1.33\n",
    "\n",
    "#Calculation\n",
    "d=(v*t)/2\n",
    "\n",
    "#Result\n",
    "print\"The depth of the sea =\",d,\"m.\""
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}