{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter8-SIMPLE STRESSES AND STRAINS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example8.1 Page number243"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sectional area= 201.06 mm^2\n",
      "stress= 198.94 N/mm^2\n",
      "strain= 0.000994718394324 N/mm^2\n",
      "Elongation= 0.497 mm\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "P=float(40000)               #Load,N\n",
    "E=float(200000)              #Modulus of elasticity for steel,N/mm^2\n",
    "L=500              #length of circular rod,mm\n",
    "d=float(16)               #diameter of rod,mm\n",
    " \n",
    "A=(pi*(pow(d,2)))/4   #sectional area, mm^2\n",
    "p=P/A                 #stress, N/mm^2\n",
    "e=p/E                 #strain\n",
    "delta=(P*L)/(A*E)     #Elongation,mm\n",
    "\n",
    "print \"sectional area=\",round(A,2),\"mm^2\"\n",
    "print \"stress=\",round(p,2),\"N/mm^2\"\n",
    "print \"strain=\",e,\"N/mm^2\"\n",
    "print \"Elongation=\",round(delta,3),\"mm\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example8.2 Page number243"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "area= 11.25 mm^2\n",
      "Elongation= 1.6 mm\n",
      "Hence, if measured length is 30.0 m.\n",
      "Actual length is 30.0016 m\n",
      "Actual length of line AB= 150.008 m.\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "P=float(120)              # force applied during measurement,N\n",
    "E=float(200000)           #Modulus of elasticity for steel,N/mm^2\n",
    "L=float(30)            #length of  Surveyor’s steel tape,mm\n",
    "              \n",
    " \n",
    "A=15*0.75             #area, mm^2\n",
    "delta=((P*L*1000)/(A*E))     #Elongation,mm\n",
    "\n",
    "print \"area=\",round(A,2),\"mm^2\"\n",
    "print \"Elongation=\",round(delta,3),\"mm\"\n",
    "\n",
    "print \"Hence, if measured length is\", L,\"m.\"\n",
    "print \"Actual length is\" ,round((L+(delta/1000)),6),\"m\"\n",
    "\n",
    "print \"Actual length of line AB=\",round((150*(L+(delta/1000))/30),3),\"m.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.3 Page number 244\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Therefore, permissible stress\n",
      "p= 142.857 N/mm^2\n",
      "Load P= 160000.0 N\n",
      "A= 1120.0 mm^2\n",
      "d= 94.32 mm\n",
      "t= 3.64 mm\n",
      "Hence, use of light section is recommended.\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "Y=float(250)                 #Yield stress, N/mm^2\n",
    "FOS=float(1.75)              #Factor of safety\n",
    "P=float(160)                 #Load,KN\n",
    "\n",
    "p=Y/FOS\n",
    "\n",
    "print \"Therefore, permissible stress\"\n",
    "print \"p=\",round(p,3), \"N/mm^2\"\n",
    "print \"Load P=\",P*1000,\"N\"\n",
    "\n",
    "#p=P/A\n",
    "\n",
    "A=P*1000/p           #area,mm^2\n",
    "\n",
    "print \"A=\",round(A),\"mm^2\"\n",
    "\n",
    "#For hollow section of outer diameter ‘D’ and inner diameter ‘d’ A=pi*(D^2-d^2)/4\n",
    "D=float(101.6)        #outer diameter,mm\n",
    "\n",
    "d=sqrt(pow(D,2)-(4*A/pi))\n",
    "\n",
    "print \"d=\",round(d,2),\"mm\"\n",
    "\n",
    "t=(D-d)/2\n",
    "print \"t=\",round(t,2),\"mm\"\n",
    "\n",
    "print \"Hence, use of light section is recommended.\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.4 page number 245"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Area= 314.16 mm^2\n",
      "Stress at elastic limit= 324.68 N/mm^2\n",
      "Young's modulus E= 12732.4 N/mm^22\n",
      "Percentage elongation= 28.0 %\n",
      "Percentage reduction in area= 43.75 %\n",
      "Ultimate Tensile Stress= 0.41 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration \n",
    "\n",
    "d=float(20)                                       #Diameter ,mm\n",
    "Loadatelasticlimit=float(102)                  #Load at elastic limit,KN\n",
    "P=80                                              #Load for extension of o.25mm , KN\n",
    "delta=float(0.25)                                 #extension in specimen of steel,mm\n",
    "L=200                                             #gauge length of specimen of steel,mm\n",
    "Finalextension=float(56)                         #total extension at fracture,mm\n",
    "\n",
    "\n",
    "A=(pi*pow(d,2))/4                                 #Area,mm^2\n",
    "print \"Area=\", round(A,2),\"mm^2\"\n",
    "\n",
    "Stressatelasticlimit=Loadatelasticlimit*1000/A    #Stress at elastic limit,N/mm^2 \n",
    "print \"Stress at elastic limit=\",round(Stressatelasticlimit,2),\"N/mm^2\"\n",
    "\n",
    "E=(P*1000/A)*(delta*L)                            #Young’s modulus ,N/mm^2\n",
    "print \"Young's modulus E=\", round(E,2),\"N/mm^22\"\n",
    "\n",
    "Percentageelongation=Finalextension*100/L       #percentage elongation,%\n",
    "print \"Percentage elongation=\", round(Percentageelongation,2),\"%\"\n",
    "\n",
    "Initialarea=(pi*pow(d,2))/4\n",
    "Finalarea=(pi*pow(15,2))/4                     # total extension at fracture is 56 mm and diameter at neck is 15 mm.\n",
    "Percentagereductioninarea=(Initialarea-Finalarea)*100/Initialarea\n",
    "\n",
    "print \"Percentage reduction in area=\",round(Percentagereductioninarea,2),\"%\"\n",
    "\n",
    "UltimateLoad=130                               #Maximum Load=130,kN\n",
    "UltimateTensileStress=UltimateLoad/A\n",
    "\n",
    "print\"Ultimate Tensile Stress=\",round(UltimateTensileStress,2),\"N/mm^2\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example8.5 Page number247\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E= 56277.19 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "P=float(40)                     #Load,KN\n",
    "L1=150                          #length of 1st portion,mm\n",
    "A1=pi*pow(25,2)/4               #Area of 1st portion,mm^2\n",
    "L2=250                          #length of 2nd portion,mm\n",
    "A2=pi*pow(20,2)/4               #Area of 2nd portion,mm^2\n",
    "L3=150                          #length of 3rd portion,mm\n",
    "A3=pi*pow(25,2)/4               #Area of 3rd portion,mm^2\n",
    "\n",
    "#E,Young's modulus ,N/mm^2\n",
    "\n",
    "#Total extension= Extension of portion 1+Extension of portion 2+Extension of portion 3\n",
    "\n",
    "#Extension=(P*1000*L)/(A*E)\n",
    "\n",
    "E=(P*1000*L1/A1)+(P*1000*L2/A2)+(P*1000*L3/A3)\n",
    "\n",
    "print \"E=\",round(E,2),\"N/mm^2\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example8.6 Page number247"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total extension of the bar= 0.5125 mm\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "P=float(30)                     #Load,KN\n",
    "L1=600                          #length of 1st portion,mm\n",
    "A1=40*20                        #Area of 1st portion,mm^2\n",
    "\n",
    "E1=200000          # material 1  Young’s modulus,N/mm^2\n",
    "  \n",
    "E2=100000          # material 2  Young’s modulus,N/mm^2\n",
    " \n",
    "\n",
    "L2=800                          #length of 2nd portion,mm\n",
    "A2=30*20                        #Area of 2nd portion,mm^2\n",
    "\n",
    "Extensionofportion1=(P*1000*L1)/(A1*E1)  #mm\n",
    "Extensionofportion2=(P*1000*L2)/(A2*E2)  #mm\n",
    "\n",
    "Totalextensionofthebar= Extensionofportion1 + Extensionofportion2\n",
    "\n",
    "print\"Total extension of the bar=\",round(Totalextensionofthebar,4),\"mm\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example8.7 Page number248\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E= 200735.96 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "P=float(30)                                 #Load,KN\n",
    "L1=600                                      #length of 1st portion,mm\n",
    "A1=pi*pow(30,2)/4                           #Area of 1st portion,mm^2\n",
    "L2=400                                      #length of 2nd portion,mm\n",
    "A2=pi*(pow(30,2)-pow(10,2))/4               #Area of 2nd portion,mm^2\n",
    "\n",
    "#E,Young's modulus ,N/mm^2\n",
    "\n",
    "#Total extension= Extension of portion 1+Extension of portion 2\n",
    "\n",
    "#Extension=(P*1000*L)/(A*E)\n",
    "\n",
    "T=float(0.222)                              #Total extension of the bar,mm\n",
    "\n",
    "E=((P*1000*L1/A1)+(P*1000*L2/A2))/T \n",
    "\n",
    "print \"E=\",round(E,2),\"N/mm^2\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.10 Page number 251"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "delta1= 0.2113 mm\n",
      "there is calculation mistake in book\n",
      "delta2= 0.48 mm^2\n",
      "Percentage error= 55.977 %\n",
      "there is calculation mistake in book\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "#variable declaration\n",
    "\n",
    "t=10                    #steel flat thickness,mm\n",
    "b1=float(60)                   #tapering from b1 to b2\n",
    "b2=40\n",
    "L=600                   #steel flat length\n",
    "P=float(80)                    #Load,KN\n",
    "E=2*100000              #Young's Modulus,N/mm^2\n",
    "\n",
    "#Extension of the tapering bar of rectangular section\n",
    "\n",
    "delta1=(P*1000*L*math.log((b1/b2),10))/(t*E*(b1-b2))\n",
    "\n",
    "print \"delta1=\",round(delta1,4),\"mm\"\n",
    "print \"there is calculation mistake in book\"\n",
    "\n",
    "#If averages cross-section is considered instead of tapering cross-section, extension is given by \n",
    "\n",
    "Aav=(b1+b2)*t/2                    #mm^2\n",
    "\n",
    "delta2=(P*1000*L)/(Aav*E)                #mm\n",
    "print\"delta2=\",round(delta2,3),\"mm^2\"\n",
    "\n",
    "P= (delta2-delta1)*100/delta2\n",
    "\n",
    "print\"Percentage error=\",round(P,3),\"%\"\n",
    "\n",
    "print \"there is calculation mistake in book\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example8.11 page number251"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "delta1= 1.194 mm\n",
      "delta2= 0.265 mm\n",
      "Total extension 1.459 mm\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "P=float(200)                     #loading,KN\n",
    "E=200*1000\n",
    "d1=40                #Young's modulus,N/mm^2\n",
    "A= pi*pow(d1,2)/4         #Area of uniform portion,mm^2 \n",
    "L1=1500                    #length of uniform portion,mm \n",
    "d2=60                      #diameter of tapered section,mm\n",
    "L2=500                     #length of tapered section,mm\n",
    "#Extensions of uniform portion and tapering portion are worked out separately and then added to get extension of the given bar. \n",
    "\n",
    "#Extension of uniform portion\n",
    "\n",
    "delta1=(P*1000*L1)/(A*E)\n",
    "\n",
    "print \"delta1=\",round(delta1,3),\"mm\"\n",
    "\n",
    "delta2=(P*1000*4*L2)/(E*pi*d1*d2)\n",
    "\n",
    "print \"delta2=\",round(delta2,3),\"mm\"\n",
    "\n",
    "T=delta1 + delta2 \n",
    "print \"Total extension\",round(T,3),\"mm\"\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.13 page number259"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Poisson's ratio= 0.3\n",
      "E= 203718.33 N/mm^2\n",
      "G= 78353.2 N/mm^2\n",
      "K= 169765.27 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "P=float(60)               #load,KN\n",
    "d=float(25)               #diameter,mm\n",
    "A=pi*pow(d,2)/4    #Area,mm^2\n",
    "L=float(200)              #gauge length,mm\n",
    "\n",
    "delta=0.12         #extension,mm\n",
    "deltad=0.0045      #contraction in diameter,mm\n",
    "Linearstrain=delta/L\n",
    "Lateralstrain=deltad/d\n",
    "\n",
    "Pr=Lateralstrain/Linearstrain\n",
    "\n",
    "print \"Poisson's ratio=\",round(Pr,1)\n",
    "\n",
    "E=(P*1000*L)/(A*delta)\n",
    "\n",
    "print \"E=\",round(E,2),\"N/mm^2\"\n",
    "\n",
    "G=E/(2*(1+Pr))                      #Rigidity modulus\n",
    "\n",
    "print \"G=\",round(G,1),\"N/mm^2\"\n",
    "\n",
    "K=E/(3*(1-(2*Pr)))                 #bulk modulus\n",
    "\n",
    "print \"K=\",round(K,2),\"N/mm^2\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.14 page number 260"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "G= 76923.1 N/mm^2\n",
      "K= 166666.67 N/mm^2\n",
      "change in volume 60.0 mm^3\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "E=float(2*100000)               #Young's modulus,N/mm^2\n",
    "Pr=float(0.3)                   #poisson's ratio\n",
    "\n",
    "G=E/(2*(1+Pr))           #Rigidity modulus\n",
    "\n",
    "K=E/(3*(1-2*(Pr)))        #Bulk modulus\n",
    "\n",
    "print \"G=\", round(G,1),\"N/mm^2\"\n",
    "\n",
    "print \"K=\", round(K,2), \"N/mm^2\"\n",
    "\n",
    "P=60                           #Load,kN\n",
    "A=pi*pow(25,2)/4               #Area,mm^2\n",
    "\n",
    "Stress=P*1000/A                     #N/mm^2\n",
    "#Linear strain,ex\n",
    "\n",
    "ex=Stress/E\n",
    " \n",
    "#Lateralstrain,ey,ez\n",
    "\n",
    "ey=-1*Pr*ex\n",
    "ez=-1*Pr*ex\n",
    "\n",
    "#volumetric strain,ev=ex+ey+ez\n",
    "\n",
    "ev=ex+ey+ez\n",
    "\n",
    "v=pi*pow(25,2)*500/4\n",
    "Changeinvolume=ev*v\n",
    "\n",
    "print\"change in volume\",round(Changeinvolume,2),\"mm^3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.15 page number261"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Change in volume= 10.8 mm^3\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "# Let the x, y, z be the mutually perpendicular directions\n",
    "\n",
    "pr=float(0.3)\n",
    "PX=float(15)                        #Loading in x-direction,KN\n",
    "PY=float(80)                        #Loading in Y-direction(compressive),KN\n",
    "PZ=float(180)                       #Loading in Z-direction,KN\n",
    "\n",
    "#Area in X-,Y-,Z-Direction is AX,AY,AZ respectively,mm^2\n",
    "\n",
    "AX=float(10*30)\n",
    "AY=float(10*400)\n",
    "AZ=float(30*400)\n",
    "\n",
    "#stress devoloped in X-,Y-,Z- direction as px,py,pz respectively,N/mm^2\n",
    "\n",
    "px=PX*1000/AX\n",
    "py=PY*1000/AY\n",
    "pz=PZ*1000/AZ\n",
    "\n",
    "#Noting that a stress produces a strain of p/E in its own direction, the nature being same as that of stress and µ p E in lateral direction of opposite nature, and taking tensile stress as +ve, we can write expression for strains ex, ey, ez.\n",
    "E=2*100000                       #young's modulus,N/mm^2\n",
    "\n",
    "ex=(px/E)+(pr*py/E)-(pr*pz/E)\n",
    "ey=(-pr*px/E)-(py/E)-(pr*pz/E)\n",
    "ez=(-pr*px/E)+(pr*py/E)+(pz/E)\n",
    "\n",
    "ev=ex+ey+ez                 #Volumetric strain\n",
    "\n",
    "volume=10*30*400\n",
    "\n",
    "Changeinvolume=ev*volume\n",
    "\n",
    "print \"Change in volume=\",round(Changeinvolume,2),\"mm^3\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.17 page number 263"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "poisson's Ratio= 0.346\n",
      "Bulk modulus= 227500.0 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "E=float(2.1*100000)         #Young’s modulus of the material,N/mm^2\n",
    "G=float(0.78*100000)        #modulus of rigidity,N/mm^2\n",
    "\n",
    "pr=(E/(2*G))-1\n",
    "\n",
    "print \"poisson's Ratio=\",round(pr,3)\n",
    "\n",
    "K=E/(3*(1-2*pr))\n",
    "\n",
    "print \"Bulk modulus=\",round(K,3),\"N/mm^2\" "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.18 page number 263"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Young's modulus= 102857.143 N\n",
      "Poisson's Ratio 0.2857\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "G=float(0.4*100000)      #modulus of rigidity of material,N/mm^2\n",
    "K=float(0.8*100000)      #bulk modulus,N/mm^2\n",
    "\n",
    "E=(9*G*K)/(3*K+G)\n",
    "\n",
    "\n",
    "print \"Young's modulus=\",round(E,3),\"N\"\n",
    "\n",
    "pr=(E/(2*G))-1\n",
    "\n",
    "print \"Poisson's Ratio\",round(pr,4)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.19 page number 264"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Stress in aluminium strip= 23.08 N/mm^2\n",
      "Stress in steel strip= 46.15 N/mm^2\n",
      "Extension of the compound bar= 0.138 mm\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "L=float(600)                   #compound bar of length,mm\n",
    "P=float(60)                    #compound bar when axial tensile force ,KN\n",
    "\n",
    "Aa=float(40*20)                #area of aluminium strip,mm^2\n",
    "As=float(60*15)                #area of steel strip,mm^2\n",
    "\n",
    "Ea=1*100000             # elastic modulus of aluminium,N/mm^2\n",
    "Es=2*100000             # elastic modulus of steel,N/mm^2\n",
    "\n",
    "#load shared by aluminium strip be Pa and that shared by steel be Ps. Then from equilibrium condition Pa+Ps=P\n",
    "#From compatibility condition, deltaAL=deltaS\n",
    "Pa=(P*1000)/(1+((As*Es)/(Aa*Ea)))\n",
    "Ps=Pa*((As*Es)/(Aa*Ea))\n",
    "\n",
    "Sias=Pa/Aa\n",
    "print \"Stress in aluminium strip=\",round(Sias,2),\"N/mm^2\"\n",
    "Siss=Ps/As\n",
    "print \"Stress in steel strip=\",round(Siss,2),\"N/mm^2\"\n",
    "\n",
    "L=600\n",
    "#Extension of the compound bar \n",
    "deltal=(Pa*L)/(Aa*Ea)\n",
    "print\"Extension of the compound bar=\",round(deltal,3),\"mm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.20 page number 265"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "stress in Copper= 75.76 N/mm^2\n",
      "stress in Steel= 126.27 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "Es=float(2*100000)              #Young's modulus of steel rod ,N/mm^2\n",
    "Ec=float(1.2*100000)            #Young's modulus of copper tube,N/mm^2\n",
    "\n",
    "di=float(25)                           #internal diameter,mm\n",
    "de=float(40)                           #external diameter,mm\n",
    "\n",
    "As=pi*pow(di,2)/4               #Area of steel rod,mm^2\n",
    "Ac=pi*(pow(de,2)-pow(di,2))/4   #Area of copper tube,mm^2\n",
    "P=120                           #load, KN\n",
    "#From equation of equilibrium, Ps+Pc=P,where Ps is the load shared by steel rod and Pc is the load shared by the copper tube.\n",
    "#From compatibility condition,deltaS=deltaC\n",
    "\n",
    "Pc=(P*1000)/(1+((As*Es)/(Ac*Ec)))\n",
    "Ps=Pc*((As*Es)/(Ac*Ec))\n",
    "\n",
    "SIC=Pc/Ac            #stress in copper, N/mm^2\n",
    "SIS=Ps/As            #stress in steel,N/mm^2\n",
    "\n",
    "print \"stress in Copper=\",round(SIC,2),\"N/mm^2\"\n",
    "print \"stress in Steel=\",round(SIS,2),\"N/mm^2\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.21 page number 266"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "stress in Concrete= 4.51 N/mm^2\n",
      "stress in Steel= 81.2 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "#Es/Ec=18(given)\n",
    "Er=float(18)                #young modulus ratio Er=Es/Ec\n",
    "d=float(16)                           #steel bar diameter,mm\n",
    "#8 steel bars\n",
    "As=8*pi*pow(d,2)/4               #Area of steel bar,mm^2\n",
    "Ac=(300*500)-As                      #Area of concrete,mm^2\n",
    "\n",
    "P=800                           #Compressive force, KN\n",
    "#From equation of equilibrium, Ps+Pc=P,where Ps is the load shared by steel bar and Pc is the load shared by the Concrete\n",
    "#From compatibility condition,deltaS=deltaC\n",
    "\n",
    "Pc=(P*1000)/(1+((As*Er)/(Ac)))\n",
    "Ps=Pc*((As*Er)/(Ac))\n",
    "\n",
    "SIC=Pc/Ac            #stress in Concrete, N/mm^2\n",
    "SIS=Ps/As            #stress in steel,N/mm^2\n",
    "\n",
    "print \"stress in Concrete=\",round(SIC,2),\"N/mm^2\"\n",
    "print \"stress in Steel=\",round(SIS,2),\"N/mm^2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.22 page number 267"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "stress in Aluminium= 66.96 N/mm^2\n",
      "stress in Steel= 89.29 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "Es=float(2*100000)              #Young's modulus of steel  ,N/mm^2\n",
    "Ea=float(1*100000)            #Young's modulus of aluminium,N/mm^2\n",
    "Ls=240                        #length of steel,mm\n",
    "La=160                        #length of aluminium,mm\n",
    "Aa=1200               #Area of aluminium,mm^2\n",
    "As=1000               #Area of steel,mm^2\n",
    "P=250                           #load, KN\n",
    "#From equation of equilibrium, Ps+2Pa=P,et force shared by each aluminium pillar be Pa and that shared by steel pillar be Ps. \n",
    "#From compatibility condition,deltaS=deltaC\n",
    "\n",
    "Pa=(P*1000)/(2+((As*Es*La)/(Aa*Ea*Ls)))\n",
    "Ps=Pa*((As*Es*La)/(Aa*Ea*Ls))\n",
    "\n",
    "SIA=Pa/Aa            #stress in aluminium, N/mm^2\n",
    "SIS=Ps/As            #stress in steel,N/mm^2\n",
    "\n",
    "print \"stress in Aluminium=\",round(SIA,2),\"N/mm^2\"\n",
    "print \"stress in Steel=\",round(SIS,2),\"N/mm^2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.23 page number 268\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ps= 91.73 N/mm^2\n",
      "pc= 44.96 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "# Let the force shared by bolt be Ps and that by tube be Pc. Since there is no external force, static equilibrium condition gives Ps + Pc = 0 or Ps = – Pc i.e., the two forces are equal in magnitude but opposite in nature. Obviously bolt is in tension and tube is in compression.\n",
    "#Let the magnitude of force be P. Due to quarter turn of the nut\n",
    "\n",
    "#[Note. Pitch means advancement of nut in one full turn] \n",
    "\n",
    "Ls=float(600)                      #length of whole assembly,mm\n",
    "Lc=float(600)                      #length of whole assembly,mm\n",
    "delta=float(0.5)\n",
    "ds=float(20)                       #diameter,mm\n",
    "di=float(28)                       #internal diameter,mm\n",
    "de=float(40)                       #external diameter,mm\n",
    "Es=float(2*100000)                 #Young's modulus, N/mm^2\n",
    "Ec=float(1.2*100000)\n",
    "As=pi*pow(ds,2)/4                  #area of steel bolt,mm^2\n",
    "Ac=pi*(pow(de,2)-pow(di,2))/4      #area of copper tube,mm^2\n",
    "\n",
    "P= (delta*(1/Ls))/((1/(As*Es))+(1/(Ac*Ec))) #Load,N\n",
    "\n",
    "ps=P/As                          #stress,N/mm^2\n",
    "pc=P/Ac                          #copper,N/mm^2\n",
    "\n",
    "print \"ps=\",round(ps,2),\"N/mm^2\"\n",
    "print \"pc=\",round(pc,2),\"N/mm^2\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.24 page number 271"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(a) p= 52.8 \tN/mm^2\n",
      "(b) p= 27.8 \tN/mm^2\n",
      " (iii) delta= 1.968 mm\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "E=float(2*100000)               #Young's modulus,N/mm^2\n",
    "alpha=float(0.000012)       #expansion coeffecient,/°c\n",
    "L=float(12)                     #length,m\n",
    "t=float(40-18)                  #temperature difference,°c\n",
    "\n",
    "delta=alpha*t*L*1000          #free expansion of the rails,mm    \n",
    "# Provide a minimum gap of 3.168 mm between the rails, so that temperature stresses do not develop\n",
    "       \n",
    "# a) If no expansion joint is provided, free expansion prevented is equal to 3.168 mm.\n",
    "\n",
    "#delta=(P*L)/(A*E) & p=P/A where p is stress, P,A is load,area \n",
    "\n",
    "p1=(delta*E)/(L*1000)     #stress developed , N/mm^2\n",
    "\n",
    "print \"(a) p=\", round(p1,1),\"\tN/mm^2\"\n",
    "\n",
    "#(b) If a gap of 1.5 mm is provided, free expansion prevented delta2 = 3.168 – 1.5 = 1.668 mm.\n",
    "\n",
    "delta2=1.668       #mm\n",
    "#delta2=(P*L)/(A*E) & p=P/A where p is stress, P,A is load,area \n",
    "\n",
    "p2=(delta2*E)/(L*1000)     #stress developed , N/mm^2\n",
    "\n",
    "print \"(b) p=\", round(p2,1),\"\tN/mm^2\"\n",
    "\n",
    "# If the stress developed is 20 N/mm2, then p = P/ A\n",
    "p3=20                      #stress developed,N/mm^2\n",
    "delta3=delta-(p3*L*1000/E)\n",
    "\n",
    "print \" (iii) delta=\",round(delta3,3),\"mm\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.25 page number 272\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "stress p= 360.0 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "# Let D be the diameter of ring after heating and ‘d’ be its diameter before heating\n",
    "D=float(1.2*1000)                #mm\n",
    "\n",
    "#Circumference of ring after heating Ca= pi*D & Circumference of ring before heating Cb= pi*d\n",
    "\n",
    "Ca=pi*D\n",
    "Cb=pi*d\n",
    "alphas=float(0.000012)            #coefficient of expansion,/°C\n",
    "t=150                             #temperature change,°C\n",
    "Es=2*100000                        #young's modulus,N/mm^2\n",
    "d=(Ca-Cb)/(alphas*t*pi)\n",
    "\n",
    "#when it cools expansion prevented\n",
    "#delta=pi*(D-d)\n",
    "delta=alphas*t*pi*d\n",
    "\n",
    "p=(delta*Es)/(pi*d)              #stress,N/mm^2\n",
    "\n",
    "print \"stress p=\",round(p,2),\"N/mm^2\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.26 page number 272\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "P= 12907.3 N\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "Ea=70*1000              #Young's modulus of aluminium,N/mm^2\n",
    "Es=200*1000             #Young's modulus of steel,N/mm^2\n",
    "\n",
    "alphaa=float(0.000011)  #expansion coefficient,/°C\n",
    "alphas=float(0.000012)  #expansion coefficient,/°C\n",
    "\n",
    "Aa=600                  #Area of aluminium portion,mm^2\n",
    "As=400                  #Area of steel, mm^2\n",
    "La=float(1.5)                  #length of aluminium portion,m\n",
    "Ls=float(3.0)                  #length of steel portion,m\n",
    "t=18                           #temperature,°C\n",
    "\n",
    "delta=(alphaa*t*La*1000)+(alphas*t*Ls*1000)      #mm\n",
    "\n",
    "P=(delta)/(((La*1000)/(Aa*Ea))+((Ls*1000)/(As*Es)))\n",
    "\n",
    "print \"P=\" ,round(P,1),\"N\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example8.27 page number 273"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Corresponding maximum stress =  120.0 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "d1=float(25)                 # variation linearly in diameter from 25 mm to 50 mm \n",
    "d2=float(50)\n",
    "L=float(500)                 #length,mm\n",
    "alpha=float(0.000012)        #expansion coeffecient,/°C\n",
    "t=25                  #rise in temperture,°C\n",
    "E=2*100000            #Young's modulus,N/mm^2\n",
    "\n",
    "delta=alpha*t*L\n",
    "\n",
    "#If P is the force developed by supports, then it can cause a contraction of 4*P*L/(pi*d1*d2*E)\n",
    "\n",
    "P=(delta*pi*d1*d2*E)/(4*L)\n",
    "Am=pi*pow(d1,2)/4\n",
    "Ms=P/Am\n",
    "\n",
    "print \"Corresponding maximum stress = \",round(Ms,1),\"N/mm^2\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.28 page number 275"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "stress in steel= 12.17 N/mm^2\n",
      "Stress in brass= 36.51 N/mm^2\n",
      "Shear stress in pin 18.26 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "Db=float(20)                     #diameter of brass rod,mm\n",
    "Dse=float(40)                    #external diameter of steel tube,mm\n",
    "Dsi=float(20)                    #internal diameter of steel tube,mm\n",
    "Es=float(2*100000 )              #Young's modulus steel, N/mm^2\n",
    "Eb=float(1*100000 )              #Young's modulus brass, N/mm^2\n",
    "alphas=float(0.0000116)          #coeffcient of expansion of steel,/°C\n",
    "alphab=float(0.0000187)          #coeffcient of expansion of brass,/°C\n",
    "t=60                             #raise in temperature, °C\n",
    "As=pi*(pow(Dse,2)-pow(Dsi,2))/4  #Area of steel tube, mm^2\n",
    "Ab=pi*(pow(Db,2))/4                #Area of brass rod,mm^2\n",
    "L=1200                           #length,mm\n",
    "#Since free expansion of brass  is more than free expansion of steel , compressive force Pb develops in brass and tensile force Ps develops in steel to keep the final position at CC \n",
    "\n",
    "#Horizontal equilibrium condition gives Pb = Ps, say P. \n",
    "\n",
    "P=((alphab-alphas)*t*L)/((L/(As*Es))+(L/(Ab*Eb)))\n",
    "\n",
    "ps=P/As\n",
    "pb=P/Ab\n",
    "\n",
    "print \"stress in steel=\",round(ps,2),\"N/mm^2\"\n",
    "print \"Stress in brass=\",round(pb,2),\"N/mm^2\"\n",
    "\n",
    "#the pin resist the force P at the two cross- sections at junction of two bars.\n",
    "\n",
    "Shearstress=P/(2*Ab)\n",
    "print \"Shear stress in pin\",round(Shearstress,2),\"N/mm^2\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# example 8.29 page number 276"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Change in length= 1.07 mm\n",
      "Hoop stress f= 83.33 N/mm^2\n"
     ]
    }
   ],
   "source": [
    "#variable declaration\n",
    "\n",
    "L=float(1000)                     #length of the bar at normal temperature,mm\n",
    "As=float(50*10)                   #Area of steel,mm^2\n",
    "Ac=float(40*5)                    #Area of copper,mm^2\n",
    "#Ac = Free expansion of copper  is greater than free expansion of steel  . To bring them to the same position, tensile force Ps acts on steel plate and compressive force Pc acts on each copper plate. \n",
    "alphas=float(0.000012)                   #Expansion of coeffcient of steel,/°C\n",
    "alphac=float(0.000017 )                  #Expansion of coeffcient of copper,/°C\n",
    "t=80                              #raise by temperature, °C\n",
    "Es=2*100000                       #Young's modulus of steel,N/mm^2\n",
    "Ec=1*100000                       #Young's modulus of copper,N/mm^2\n",
    "Pc=((alphac-alphas)*t*L)/((2*L/(As*Es)) +(L/(Ac*Ec)))\n",
    "Ps=2*Pc\n",
    "\n",
    "pc=Pc/Ac                          #Stress in copper,N/mm^2\n",
    "ps=Ps/As                          #Stress in steel, N/mm^2\n",
    "\n",
    "Changeinlength=alphas*t*L+(Ps*L/(As*Es))\n",
    "\n",
    "\n",
    "print\"Change in length=\",round(Changeinlength,2),\"mm\"\n",
    "\n",
    "##example 8.30 page number 278\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "p=float(2)                   #internal pressure, N/mm^2\n",
    "t=12                   #thickness of thin cylinder,mm\n",
    "D=float(1000)                 #internal diameter,mm\n",
    "\n",
    "f=(p*D)/(2*t)          #Hoop stress,N/mm^2\n",
    "\n",
    "print \"Hoop stress f=\",round(f,2),\"N/mm^2\"\n",
    "\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "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.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}