{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 10: Vibrations in Bars"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1, Page number 348"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fundamental frequency of longitudinal vibrations is 1780.0 Hz\n",
      "fundamental frequency of transverse vibrations is 31.691 Hz\n",
      "answer in the book varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "l=1;     #bar length(m)\n",
    "R=0.01/2;    #radius(m)\n",
    "V=3560;     #wave velocity(m/sec)\n",
    "x=3.0112; \n",
    "\n",
    "#Calculation\n",
    "k=R/2;    #geometric radius(m)\n",
    "fL=V/(2*l);    #fundamental frequency of longitudinal vibrations(Hz)\n",
    "fT=math.pi*V*k*x**2/(8*(l**2));         #fundamental frequency of transverse vibrations(Hz)\n",
    "\n",
    "#Result\n",
    "print \"fundamental frequency of longitudinal vibrations is\",fL,\"Hz\"\n",
    "print \"fundamental frequency of transverse vibrations is\",round(fT,3),\"Hz\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2, Page number 348"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "youngs modulus is 1.96 *10**11 N/m**2\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "C=5050;     #sound velocity(m/sec)\n",
    "rho=7700;     #steel density(kg/m**3)\n",
    "\n",
    "#Calculation\n",
    "Y=C**2*rho;        #youngs modulus(N/m**2)\n",
    "\n",
    "#Result\n",
    "print \"youngs modulus is\",round(Y/10**11,2),\"*10**11 N/m**2\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3, Page number 349"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fundamental frequency of transverse vibrations is 25.35 Hz\n",
      "first overtone of transverse vibrations is 69.9 Hz\n",
      "answer for first overtone in the book varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "l=1;     #bar length(m)\n",
    "R=0.004;    #radius(m)\n",
    "C=3560;     #wave velocity(m/sec)\n",
    "x=3.0112; \n",
    "\n",
    "#Calculation\n",
    "k=R/2;    #geometric radius(m)\n",
    "f1=math.pi*C*k*x**2/(8*(l**2));     #fundamental frequency of transverse mode of vibration(Hz)\n",
    "f2=math.pi*C*k*5**2/(8*(l**2));     #first overtone of transverse mode of vibration(Hz)\n",
    "\n",
    "#Result\n",
    "print \"fundamental frequency of transverse vibrations is\",round(f1,2),\"Hz\"\n",
    "print \"first overtone of transverse vibrations is\",round(f2,1),\"Hz\"\n",
    "print \"answer for first overtone in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4, Page number 349"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "value of a is 0.00195 m\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "l=0.2;     #bar length(m)\n",
    "C=4990;    #wave velocity(m/sec)\n",
    "x=3.0112; \n",
    "f1=250;     #frequency(Hz)\n",
    "\n",
    "#Calculation\n",
    "a=f1*8*(l**2)*math.sqrt(12)/(math.pi*C*(x**2));     #value of a(m)\n",
    "\n",
    "#Result\n",
    "print \"value of a is\",round(a,5),\"m\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5, Page number 350"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "frequency is 0.155 MHz\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Y=21*10**10;          #youngs modulus(N/m**2) \n",
    "rho=8800;             #nickel density(kg/m**3)\n",
    "R=0.01;               #radius(m)\n",
    "\n",
    "#Calculation\n",
    "k=R/2;                     #geometric radius(m)\n",
    "C=math.sqrt(Y/rho);        #sound velocity(m/sec)\n",
    "f=C/(2*math.pi*k);         #frequency(Hz)\n",
    "\n",
    "#Result\n",
    "print \"frequency is\",round(f/10**6,3),\"MHz\""
   ]
  }
 ],
 "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
}
