{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3: Ultrasonics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1, Page 74"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "t=1.6*1e-3 #thickness in meter\n",
      "v=5760. #velocity in m/s\n",
      "\n",
      "#Calculations\n",
      "lemda=2*t#wavelength\n",
      "f=v/lemda#fundamental frequency \n",
      "\n",
      "#Result\n",
      "print 'fundamental frequency =',f/1e6,'MHz'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fundamental frequency = 1.8 MHz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2, Page 75"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "t=40*1e-2;\n",
      "#pulse covers 2x distance in arriving back\n",
      "#so,  30*1e-6=2*x/v\n",
      "#and, 2nd pulse will cover a distance of 2*40 cm in 80*1e-6 seconds\n",
      "#therfore,  80*1e-6=(2*40*1e-2)/v\n",
      "#compare both equation\n",
      "e1=30;\n",
      "e2=40*2\n",
      "\n",
      "#Calculation\n",
      "x=e1*t*2/(2*e2);\n",
      "\n",
      "#Result\n",
      "print 'distance of the flow from near end =',x/1e-2,'cm' \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "distance of the flow from near end = 15.0 cm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3, Page 76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "f_diff=50*1e3 #in Hz\n",
      "v=5000 #in m/s\n",
      "\n",
      "#Calculations\n",
      "#f1=v/2*t\n",
      "#f2=2v/2t\n",
      "#f2-f1=v/2t\n",
      "t=v/(2*f_diff)\n",
      "\n",
      "#Result\n",
      "print 'Thickness of steel plate =',t,'m'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thickness of steel plate = 0.05 m\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4, Page 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "\n",
      "#Variable Declaration\n",
      "f=1e6 #frequency in Hz\n",
      "L=1 #inductance in henry\n",
      "\n",
      "#Calculation\n",
      "#f=(1/2*pi)*(sqrt(1/(L*C)))\n",
      "c=1/(4*pi**2*f**2*L);#capacitance\n",
      "\n",
      "#Result\n",
      "print 'capacitance =',round(c/1e-12,3),'pF'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "capacitance = 0.025 pF\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}