{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2: Strain"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1 page no. 70"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "e_z= 4     #Constant\n",
      "ab = 0.200 #m, dimension\n",
      "from scipy import integrate\n",
      "#Calculations\n",
      "#Part a)\n",
      "import math\n",
      "def f(z):\n",
      "    return(1+(40*10**-3)*(math.sqrt(z)))\n",
      "z=integrate.quad(f,0,ab) #Strain formula for short line segment = delta(sdash) =(1+e_z)delta(s) \n",
      "deltaB= z[0]-ab\n",
      "deltaB_mm= deltaB*1000\n",
      "\n",
      "#Part b)\n",
      "\n",
      "e_avg = deltaB/ab#  Normal strain formula  e = (delta(sdash) -delta(s))/delta(s)\n",
      "\n",
      "#Display\n",
      "print\"The displacement at the end of the rod is =   \",round(deltaB_mm,2),\"mm\"\n",
      "print\"The average normal strain in the rod is   =\",round(e_avg,4),\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement at the end of the rod is =    2.39 mm\n",
        "The average normal strain in the rod is   = 0.0119 mm\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2 page no. 71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "theta = 0.05      #degree, angle\n",
      "L1=300.0          #mm, length\n",
      "L2 = 400.0        #mm\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "alpha=math.atan(L2/L1)*180/3.14\n",
      "phi=90-alpha+theta\n",
      "Lad=math.sqrt(L1**2+L2**2)\n",
      "Lbd=math.sqrt(Lad**2+L2**2-2*L2*Lad*math.cos(36.92*3.14/180.0))\n",
      "epsilonBD=(Lbd-L1)/(L1)\n",
      "dLbd=(theta*3.14/180.0)*L2\n",
      "\n",
      "#Display\n",
      "print\"The average normal strain =\",round(epsilonBD,3),\"mm/mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average normal strain = 0.001 mm/mm\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3 page no. 72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "#The given dimension are\n",
      "ab= 250.0        #mm\n",
      "bbdash_x = 3.0   #mm\n",
      "bbdash_y = 2.0   #mm\n",
      "ac = 300.0       #mm\n",
      "\n",
      "#calculations\n",
      "#Part(a)\n",
      "import math\n",
      "abdash = math.sqrt((ab - bbdash_y)**2 + (bbdash_x)**2)  #Pythagoras theorem\n",
      "avg_normal_strain = (abdash-ab)/ab\n",
      "\n",
      "#Part(b)\n",
      "gamma_xy = math.atan(bbdash_x/(ab - bbdash_y)) #shear strain formula\n",
      "\n",
      "#Display\n",
      "print\"The average normal strain along AB is    =\",round(avg_normal_strain,4),\"mm/mm\"\n",
      "print\"The average shear strain                 =\",round(gamma_xy,4),\"rad\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average normal strain along AB is    = -0.0079 mm/mm\n",
        "The average shear strain                 = 0.0121 rad\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4 page no. 73"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "ab = 150 #mm\n",
      "bc = 150 #mm\n",
      "disp_cd= 2 #mm\n",
      "ab_half = ab/2.0\n",
      "addash_half = (bc+disp_cd)/2.0 \n",
      "\n",
      "#Calculations\n",
      "#Part(a)\n",
      "import math\n",
      "ac = sqrt((ab)**2 + (bc)**2)  #Pythagoras theorem in mm\n",
      "ac_m = ac/1000.0 #in m\n",
      "acdash = sqrt((ab)**2 + (bc+disp_cd)**2)  #Pythagoras theorem in mm\n",
      "acdash_m = acdash/1000.0 #in m\n",
      "avg_strain_ac = (acdash_m - ac_m)/ac_m    #Normal strain formula\n",
      "\n",
      "#Part(b)\n",
      "theta_dash = 2* math.atan((addash_half)/(bc/2.0)) \n",
      "gamma_xy = (math.pi / 2.0)- theta_dash \n",
      "\n",
      "#Display\n",
      "print\"The average normal strain along the diagonal AC is   =\",round(avg_strain_ac,5),\"mm/mm\"\n",
      "print\"The shear strain at E relative to the x,y axes       =\",round(gamma_xy,4),\"rad\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average normal strain along the diagonal AC is   = 0.00669 mm/mm\n",
        "The shear strain at E relative to the x,y axes       = -0.0132 rad\n"
       ]
      }
     ],
     "prompt_number": 22
    }
   ],
   "metadata": {}
  }
 ]
}