{
 "metadata": {
  "name": "",
  "signature": "sha256:abce654f2dcdd836a8080165fb072744ef2446714ffd5c0acdbf346c961eccf3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1 :Simple Stresses and Strains"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.1,page no.9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Given\n",
      "#Variable declaration\n",
      "L=150           #Length of the rod in cm\n",
      "D=20            #Diameter of the rod in mm\n",
      "P=20*10**3      #Axial pull in N\n",
      "E=2.0e5         #Modulus of elasticity in N/sq.mm\n",
      "\n",
      "#Calculation\n",
      "A=(math.pi/4)*(D**2)    #Area in sq.mm\n",
      " #case (i):stress\n",
      "sigma=P/A               #Stress in N/sq.mm\n",
      " #case (ii):strain\n",
      "e=sigma/E               #Strain\n",
      " #case (iii):elongation of the rod\n",
      "dL=e*L                  #Elongation of the rod in cm\n",
      "\n",
      "#Result\n",
      "print \"Stress =\",round(sigma,3),\"N/mm^2\"\n",
      "print \"Strain =\",round(e,6)\n",
      "print \"Elongation =\",round(dL,4),\"cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stress = 63.662 N/mm^2\n",
        "Strain = 0.000318\n",
        "Elongation = 0.0477 cm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.2,page no.10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#variable declaration\n",
      "P=4000         #Load in N\n",
      "sigma=95       #Stress in N/sq.mm\n",
      "\n",
      "#Calculation\n",
      "D=round(math.sqrt(P/((math.pi/4)*(sigma))),2)  #Diameter of steel wire in mm\n",
      "\n",
      "#Result\n",
      "print \"Diameter of a steel wire =\",D,\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diameter of a steel wire = 7.32 mm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.3,page no.10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "D=25        #Diameter of brass rod in mm\n",
      "P=50*10**3  #Tensile load in N\n",
      "L=250       #Length of rod in mm\n",
      "dL=0.3      #Extension of rod in mm\n",
      "\n",
      "#Calculation\n",
      "A=(math.pi/4)*(D**2)    #Area of rod in sq.mm\n",
      "sigma=round(P/A,2)      #Stress in N/sq.mm\n",
      "e=dL/L                  #Strain\n",
      "E=(sigma/e)             #Young's Modulus in N/sq.m\n",
      "\n",
      "#Result\n",
      "print \"Young's Modulus of a rod,E =\",round(E*(10**-3),3),\"GN/m^2\"    #Young's Modulus in GN/sq.m\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Young's Modulus of a rod,E = 84.883 GN/m^2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.4,page no.11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable Declaration\n",
      "D=3          #Diameter of the steel bar in cm    \n",
      "L=20         #Gauge length of the bar in cm\n",
      "P=250        #Load at elastic limit in kN \n",
      "dL=0.21      #Extension at a load of 150kN in mm\n",
      "Tot_ext=60   #Total extension in mm\n",
      "Df=2.25      #Diameter of the rod at the failure in cm\n",
      "\n",
      "#Calculation\n",
      "A=round((math.pi/4)*(D**2),5)    #Area of the rod in sq.m\n",
      "\n",
      "#case (i):Young's modulus\n",
      "e=round((150*1000)/(7.0685),1)   #stress in N/sq.m\n",
      "sigma=dL/(L*10)                  #strain \n",
      "E=round((e/sigma)*(10**-5),3)    #Young's modulus in GN/sq.m\n",
      "\n",
      "#case (ii):stress at elastic limit\n",
      "stress=int(round((P*1000)/A,0))*1e-2   #stress at elastic limit in MN/sq.m\n",
      "\n",
      "#case (iii):percentage elongation\n",
      "Pe=(Tot_ext*1e2)/(L*10)\n",
      "\n",
      "#case (iv):percentage decrease in area\n",
      "Pd=(D**2-Df**2)/D**2*1e2\n",
      "\n",
      "\n",
      "#Result\n",
      "print \"NOTE:The Young's Modulus found in the book is incorrect.The correct answer is,\"\n",
      "print \"Young's modulus,E =\",E,\"GN/m^2\"\n",
      "print \"Stress at the elastic limit,Stress =\",stress,\"MN/m^2\"\n",
      "print \"Percentage elongation = %d%%\"%Pe\n",
      "print \"Percentage decrease in area = %.2f%%\"%Pd\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "NOTE:The Young's Modulus found in the book is incorrect.The correct answer is,\n",
        "Young's modulus,E = 202.104 GN/m^2\n",
        "Stress at the elastic limit,Stress = 353.68 MN/m^2\n",
        "Percentage elongation = 30%\n",
        "Percentage decrease in area = 43.75%\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.5,page no.12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "sigma=125*10**6    #Safe stress in N/sq.m\n",
      "P=2.1*10**6        #Axial load in N\n",
      "D=0.30             #External diameter in m\n",
      "\n",
      "#Calculation\n",
      "    \n",
      "d=round(math.sqrt((D**2)-P*4/(math.pi*sigma)),4)*1e2  #internal diameter in cm\n",
      "\n",
      "#Result\n",
      "print \"internal diameter =\",d,\"cm\"      \n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "internal diameter = 26.19 cm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.6,page no.13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "stress=480      #ultimate stress in N/sq.mm\n",
      "P=1.9*10**6     #Axial load in N\n",
      "D=200           #External diameter in mm\n",
      "f=4             #Factor of safety\n",
      "\n",
      "#Calculation\n",
      "sigma=stress/f                                        #Working stress or Permissable stress in N/sq.mm\n",
      "d=str(math.sqrt((D**2)-((P*4)/(math.pi*sigma))))[:6]  #internal diameter in mm\n",
      "\n",
      "#Result\n",
      "print \"internal diameter =\",d,\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "internal diameter = 140.85 mm\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.15,page no.26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "D1=40      #Larger diameter in mm\n",
      "D2=20      #Smaller diameter in mm\n",
      "L=400      #Length of rod in mm\n",
      "P=5000     #Axial load in N\n",
      "E=2.1e5    #Young's modulus in N/sq.mm\n",
      "\n",
      "#Calculation\n",
      "dL=float(str((4*P*L)/(math.pi*E*D1*D2))[:7])   #extension of rod in mm\n",
      "\n",
      "#Result\n",
      "print \"Extension of the rod =\",dL,\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Extension of the rod = 0.01515 mm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.16,page no.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "D1=30          #Larger diameter in mm\n",
      "D2=15          #Smaller diameter in mm\n",
      "L=350          #Length of rod in mm\n",
      "P=5.5*10**3    #Axial load in N\n",
      "dL=0.025       #Extension in mm\n",
      "\n",
      "#Calculation\n",
      "E=int((4*P*L)/(math.pi*D1*D2*dL))   #Modulus of elasticity in N/sq.mm\n",
      "\n",
      "#Result\n",
      "print \"Modulus of elasticity,E = %.5e\"%E,\"N/mm^2\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Modulus of elasticity,E = 2.17865e+05 N/mm^2\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.17,page no.29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "L=2.8*10**3      #Length in mm\n",
      "t=15             #Thickness in mm\n",
      "P=40*10**3       #Axial load in N\n",
      "a=75             #Width at bigger end in mm\n",
      "b=30             #Width at smaller end in mm\n",
      "E=2e5            #Young's Modulus in N/sq.mm\n",
      "\n",
      "#Calculation\n",
      "dL=round((round((P*L)/(E*t*(a-b)),4)*(round(math.log(a)-math.log(b),4))),2)    #extension of rod in mm\n",
      "\n",
      "#Result\n",
      "print \"Extension of the rod,dL =\",dL,\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Extension of the rod,dL = 0.76 mm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.18,page no.29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "dL=0.21          #Extension in mm\n",
      "L=400            #Length in mm\n",
      "t=10             #Thickness in mm\n",
      "a=100            #Width at bigger end in mm\n",
      "b=50             #Width at smaller end in mm\n",
      "E=2e5            #Young's Modulus in N/sq.mm\n",
      "\n",
      "#Calculation\n",
      "P=int(dL/(round((L)/(E*t*(a-b)),6)*(round(math.log(a)-math.log(b),4))))*1e-3    #Axial load in kN\n",
      "\n",
      "#Result\n",
      "print \"Axial load =\",P,\"kN\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Axial load = 75.746 kN\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.20,page no.32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "Di_s=140     #Internal diameter of steel tube in mm \n",
      "De_s=160     #External diameter of steel tube in mm\n",
      "Di_b=160     #Internal diameter of brass tube in mm    \n",
      "De_b=180     #External diameter of brass tube in mm\n",
      "P=900e3      #Axial load in N\n",
      "L=140        #Length of each tube in mm\n",
      "Es=2e5       #Young's modulus for steel in N/sq.mm\n",
      "Eb=1e5       #Young's modulus for brass in N/sq.mm\n",
      "\n",
      "#Calculation\n",
      "As=round(math.pi/4*(De_s**2-Di_s**2),1)     #Area of steel tube in sq.mm\n",
      "Ab=round(math.pi/4*(De_b**2-Di_b**2),1)     #Area of brass tube in sq.mm\n",
      "sigmab=round(P/(2*As+Ab),2)                 #Stress in steel in N/sq.mm\n",
      "sigmas=2*sigmab                             #Stress in brass in N/sq.mm\n",
      "Pb=int(sigmab*Ab)*1e-3                      #Load carried by brass tube in kN\n",
      "Ps=(P*1e-3)-(Pb)                            #Load carried by steel tube in kN\n",
      "dL=round(sigmab/Eb*(L),4)                   #Decrease in length in mm\n",
      "\n",
      "#Result\n",
      "print \"Stress in brass =\",sigmab,\"N/mm^2\"\n",
      "print \"Stress in steel =\",sigmas,\"N/mm^2\"\n",
      "print \"Load carried by brass tube =\",Pb,\"kN\"\n",
      "print \"Load carried by stress tube =\",Ps,\"kN\"\n",
      "print \"Decrease in the length of the compound tube=\",dL,\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stress in brass = 60.95 N/mm^2\n",
        "Stress in steel = 121.9 N/mm^2\n",
        "Load carried by brass tube = 325.515 kN\n",
        "Load carried by stress tube = 574.485 kN\n",
        "Decrease in the length of the compound tube= 0.0853 mm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.28,page no.43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "#Variable declaration\n",
      "L=2*10**2        #Length of rod in cm\n",
      "T1=10            #Initial temperature in degree celsius\n",
      "T2=80            #Final temperature in degree celsius\n",
      "E=1e5*10**6      #Young's Modulus in N/sq.m\n",
      "alpha=0.000012   #Co-efficient of linear expansion \n",
      "\n",
      "#Calculation\n",
      "T=T2-T1                          #Rise in temperature in degree celsius\n",
      "dL=alpha*T*L                     #Expansion of the rod in cm\n",
      "sigma=int((alpha*T*E)*1e-6)      #Thermal stress in N/sq.mm\n",
      "\n",
      "#Result\n",
      "print \"Expansion of the rod =\",dL,\"cm\"\n",
      "print \"Thermal stress =\",sigma,\"N/mm^2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Expansion of the rod = 0.168 cm\n",
        "Thermal stress = 84 N/mm^2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.29,page no.43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "d=3*10           #Diameter of the rod in mm\n",
      "L=5*10**3        #Area of the rod in sq.mm\n",
      "T1=95            #Initial temperature in degree celsius\n",
      "T2=30            #Final temperature in degree celsius\n",
      "E=2e5*10**6      #Young's Modulus in N/sq.m\n",
      "alpha=12e-6      #Co-efficient of linear expansion in per degree celsius\n",
      "\n",
      "#Calculation\n",
      "A=math.pi/4*(d**2)        #Area of the rod\n",
      "T=T1-T2                   #Fall in temperature in degree celsius\n",
      "\n",
      "#case(i) When the ends do not yield \n",
      "stress1=int(alpha*T*E*1e-6)     #Stress in N/sq.mm\n",
      "Pull1=round(stress1*A,1)        #Pull in the rod in N\n",
      "\n",
      "#case(ii) When the ends yield by 0.12cm\n",
      "delL=0.12*10\n",
      "stress2=int((alpha*T*L-delL)*E/L*1e-6)      #Stress in N/sq.mm\n",
      "Pull2=round(stress2*A,1)                    #Pull in the rod in N\n",
      "\n",
      "#Result\n",
      "print \"Stress when the ends do not yield =\",stress1,\"N/mm^2\"\n",
      "print \"Pull in the rod when the ends do not yield =\",Pull1,\"N\"\n",
      "print \"Stress when the ends yield =\",stress2,\"N/mm^2\"\n",
      "print \"Pull in the rod when the ends yield =\",Pull2,\"N\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stress when the ends do not yield = 156 N/mm^2\n",
        "Pull in the rod when the ends do not yield = 110269.9 N\n",
        "Stress when the ends yield = 108 N/mm^2\n",
        "Pull in the rod when the ends yield = 76340.7 N\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.30,page no.45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "import math\n",
      "#Given\n",
      "#Variable declaration\n",
      "Ds=20               #Diameter of steel rod in mm\n",
      "Di_c=40             #Internal diameter of copper tube in mm\n",
      "De_c=50             #External diameter of copper tube in mm\n",
      "Es=200*10**3        #Young's modulus of steel in N/sq.mm\n",
      "Ec=100*10**3        #Young's modulus of copper in N/sq.mm\n",
      "alpha_s=12e-6       #Co-efficient of linear expansion of steel in per degree celsius\n",
      "alpha_c=18e-6       #Co-efficient of linear expansion of copper in per degree celsius\n",
      "T=50                #Rise of temperature in degree celsius\n",
      "\n",
      "#Calculation\n",
      "As=(math.pi/4)*(Ds**2)                                             #Area of steel rod in sq.mm\n",
      "Ac=(math.pi/4)*(De_c**2-Di_c**2)                                   #Area of copper tube in sq.mm\n",
      "sigmac=float(str(((alpha_c-alpha_s)*T)/(((Ac/As)/Es)+(1/Ec)))[:6]) #Compressive stress in copper  \n",
      "sigmas=round(sigmac*(Ac/As),2)                                     #Tensile stress in steel \n",
      "\n",
      "#Result\n",
      "print \"Stress in copper =\",sigmac,\"N/mm^2\"\n",
      "print \"Stress in steel =\",sigmas,\"N/mm^2\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stress in copper = 14.117 N/mm^2\n",
        "Stress in steel = 31.76 N/mm^2\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.31,page no.47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "Dc=15             #Diameter of copper rod in mm\n",
      "Di_s=20           #Internal diameter of steel in mm\n",
      "De_s=30           #External diameter of steel in mm\n",
      "T1=10             #Initial temperature in degree celsius\n",
      "T2=200            #Raised temperature in degree celsius\n",
      "Es=2.1e5          #Young's modulus of steel in N/sq.mm\n",
      "Ec=1e5            #Young's modulus of copper in N/sq.mm\n",
      "alpha_s=11e-6     #Co-efficient of linear expansion of steel in per degree celsius\n",
      "alpha_c=18e-6     #Co-efficient of linear expansion of copper in per degree celsius\n",
      "\n",
      "#Calculation\n",
      "Ac=(math.pi/4)*Dc**2                #Area of copper tube in sq.mm\n",
      "As=(math.pi/4)*(De_s**2-Di_s**2)    #Area of steel rod in sq.mm\n",
      "T=T2-T1                             #Rise of temperature in degree celsius\n",
      "sigmas=round(((alpha_c-alpha_s)*T)/((round(As/Ac,2)/Ec)+(1/Es)),3)\n",
      "sigmac=round(sigmas*round(As/Ac,2),2)\n",
      "\n",
      "#Result\n",
      "print \"NOTE: The answers in the book for stresses are wrong.The correct answers are,\"\n",
      "print \"Stress in steel =\",sigmas,\"N/mm^2\"\n",
      "print \"Stress in copper =\",sigmac,\"N/mm^2\"\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "NOTE: The answers in the book for stresses are wrong.The correct answers are,\n",
        "Stress in steel = 49.329 N/mm^2\n",
        "Stress in copper = 109.51 N/mm^2\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.32,page no.48"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Given\n",
      "#Variable declaration\n",
      "Dg=20           #Diameter of gun metal rod in mm\n",
      "Di_s=25         #Internal diameter of steel in mm\n",
      "De_s=30         #External diameter of steel in mm\n",
      "T1=30           #Temperature in degree celsius\n",
      "T2=140          #Temperature in degree celsius\n",
      "Es=2.1e5        #Young's modulus of steel in N/sq.mm\n",
      "Eg=1e5          #Young's modulus of gun metal in N/sq.mm\n",
      "alpha_s=12e-6   #Co-efficient of linear expansion of steel in per degree celsius\n",
      "alpha_g=20e-6   #Co-efficient of linear expansion of gun metal in per degree celsius\n",
      "\n",
      "#Calculation\n",
      "Ag=(math.pi/4)*Dg**2              #Area of gun metal in sq.mm\n",
      "As=(math.pi/4)*(De_s**2-Di_s**2)  #Area of steel in sq.mm\n",
      "T=T2-T1                           #Fall in temperature in degree celsius\n",
      "sigmag=round(((alpha_g-alpha_s)*T)/(((Ag/As)/Es)+(1/Eg)),2)\n",
      "sigmas=round(sigmag*(Ag/As),2)\n",
      "\n",
      "#Result\n",
      "print \"Stress in gun metal rod =\",sigmag,\"N/mm^2\"\n",
      "print \"Stress in steel =\",sigmas,\"N/mm^2\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Stress in gun metal rod = 51.99 N/mm^2\n",
        "Stress in steel = 75.62 N/mm^2\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1.33,page no.52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given\n",
      "#Variable declaration\n",
      "P=600e3         #Axial load in N\n",
      "L=20e3          #Length in mm\n",
      "w=0.00008       #Weight per unit volume in N/sq.mm\n",
      "A2=400          #Area of bar at lower end in sq.mm\n",
      "\n",
      "#Calculation\n",
      "sigma=int(P/A2)           #Uniform stress on the bar in N/sq.mm\n",
      "A1=round(A2*round(math.exp(round(w*L/sigma,7)),5),3)\n",
      "\n",
      "#Result\n",
      "print \"Area of the bar at the upper end =\",A1,\"mm^2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Area of the bar at the upper end = 400.428 mm^2\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}