{
 "metadata": {
  "name": "",
  "signature": "sha256:d8a1a6f05cd4df2c46b4f5147d4f831726de5041386c1f65ed2892779a5fb0fb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12:Special Topics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12.1, Page No:422"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "W=24*10**3 #Load in kips\n",
      "E=29*10**6 #Youngs Modulus in psi\n",
      "L=72 #length in inches\n",
      "theta=30 #Angle in degrees\n",
      "\n",
      "#Calculations\n",
      "L_ab=L/np.sin(theta*pi*180**-1) #Length of AB in inches\n",
      "L_ac=L/np.sin((90-theta)*pi*180**-1) #Length of AC in inches\n",
      "\n",
      "#Applying the forces in x and y sum to zero\n",
      "#Applying the Starin energy formula\n",
      "#Applying Castiglinos theorem \n",
      "delta_A=91.16*W*E**-1 #Displacement in inches\n",
      "\n",
      "#Result\n",
      "print \"The displacement of point A is\",round(delta_A,4),\"in\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The displacement of point A is 0.0754 in\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12.3, Page No:423"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from scipy.integrate import quad\n",
      "\n",
      "\n",
      "\n",
      "#We will directly compute the integral as function cannot be declared\n",
      "#Calculations\n",
      "#Part 1\n",
      "def integrand(x):\n",
      "    return (800*x-400*x**2)*(4-0.5*x)\n",
      "I = quad(integrand, 0, 2)\n",
      "delta=I[0] #Deflection in horizontal direction in N.m^3\n",
      "\n",
      "#Part 2\n",
      "def inte1(x):\n",
      "    return x**2\n",
      "I1=quad(inte1,0,4)\n",
      "I2=quad(inte1,0,3)\n",
      "def inte2(x):\n",
      "    return (4-0.5*x)*(4-0.5*x)\n",
      "I3=quad(inte2,0,2)\n",
      "\n",
      "Q=-delta/(I1[0]+I2[0]+I3[0]) #Horizontal reaction in N\n",
      "\n",
      "\n",
      "#Result\n",
      "print \"The Horizontal deflection is\",round(delta),\"N.m^3\"\n",
      "print \"The Horizontal reaction is\",round(Q,1),\"N\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Horizontal deflection is 1867.0 N.m^3\n",
        "The Horizontal reaction is -33.9 N\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12.4, Page No:433"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as np\n",
      "\n",
      "#NOTE:The figure mentions the unit of length as ft which is incorrect\n",
      "#Variable Decleration\n",
      "L=30 #Length in m\n",
      "m=2000 #Mass in kg\n",
      "v=2 #Velocity in m/s\n",
      "E=10**5 #Youngs Modulus in MPa\n",
      "A=600 #Area in mm^2\n",
      "g=9.81 #Acceleration due to gravity in m/s^2\n",
      "\n",
      "#Calculations\n",
      "k=E*A*L**-1 #Stifness of the cable in N/m\n",
      "\n",
      "#Applying the Work-Energy principle \n",
      "delta_max=np.sqrt((0.5*m*v**2)*(0.5*k)**-1) #Maximum Displacement in m\n",
      "\n",
      "P_max=k*delta_max+m*g #Maximum force in N\n",
      "\n",
      "#Result\n",
      "print \"The maximum force is\",round(P_max*10**-3,1),\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum force is 146.1 kN\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12.5, Page No:434"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "b=0.060 #Breadth of the section in mm\n",
      "d=0.03 #Depth of the section in mm\n",
      "L=1.2 #Length in m\n",
      "m=80 #Mass in kg\n",
      "g=9.81 #Acceleration due to gravity in m/s^2\n",
      "E=200*10**9 #Youngs Modulus in Pa\n",
      "e=0.015 \n",
      "h=0.01 #height in m\n",
      "\n",
      "#Calculations\n",
      "#Part 1\n",
      "I=b*d**3*12**-1 #Moment of Inertia in m^4\n",
      "delta_st=m*g*L**3/(48*E*I) #Mid-span Displacement  in m\n",
      "n=1+np.sqrt(1+(2*h/delta_st)) #Impact Factor\n",
      "\n",
      "#Part 2\n",
      "P_max=n*m*g #Maximum dynamic load in N at midspan\n",
      "M_max=P_max*0.5*L*0.5 #Maximum moment in N.m\n",
      "sigma_max=M_max*e/I #Maximum dynamic Bending Stress in Pa\n",
      "\n",
      "#Result\n",
      "print \"The impact factor is\",round(n,3)\n",
      "print \"The maximum dynamic Bending Moment is\",round(sigma_max*10**-6,1),\"MPa\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The impact factor is 5.485\n",
        "The maximum dynamic Bending Moment is 143.5 MPa\n"
       ]
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12.7, Page No:440"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable decleration\n",
      "M=2.21 #Applied moment in kip.ft\n",
      "d=3 #Diameter of the bar in inches\n",
      "sigma_y=40 #Yield strength of the of steel in ksi\n",
      "\n",
      "#Calculations\n",
      "#Part 1\n",
      "sigma=32*M*12*(pi*d**3)**-1 #Maximum Bending Stress in ksi\n",
      "T1=np.sqrt((sigma_y*0.5)**2-5**2)/(12*0.18863) #Maximum Allowable torque in kip.ft\n",
      "\n",
      "#Part 2\n",
      "R=np.sqrt((sigma_y**2-5**2)*3**-1) #Maximum shear stress in ksi\n",
      "T2=np.sqrt(R**2-5**2)/(12*0.18863) #Maximum safe torque in kpi.ft\n",
      "\n",
      "#Result\n",
      "print \"Using the maximum shear stress theory T=\",round(T1,2),\"kip.ft\"\n",
      "print \"Using the maximum sitrotion energy theory T=\",round(T2,2),\"kip.ft\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Using the maximum shear stress theory T= 8.56 kip.ft\n",
        "Using the maximum sitrotion energy theory T= 9.88 kip.ft\n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.12.8, Page No:448"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "D=250 #Wideness in mm\n",
      "b=20 #Thickness of the plate in mm\n",
      "r=50 #Radius  of the hole in mm\n",
      "e=50 #Eccentricity in mm\n",
      "sigma_max=150 #Maximum normal stress at the hole in MPa\n",
      "kb=2 #Stress Concentraion factor \n",
      "\n",
      "#Calculations\n",
      "A=b*(D-2*r)*10**-6 #Area in m^2\n",
      "I=10**-12*(b*D**3*12**-1-(b*2**3*r**3*12**-1)) #Moment of inertia in m^4\n",
      "#Simplfying computation\n",
      "a=2*r*D**-1\n",
      "kt=3-3.13*a+3.66*a**2-1.53*a**3 #Stress Concentration factor\n",
      "#Simplfying computation\n",
      "b=kt*A**-1\n",
      "c=kb*r*r*10**-6*I**-1\n",
      "P=10**3*sigma_max*(b+c)**-1 #Maximum Load in N\n",
      "\n",
      "#Result\n",
      "print \"The maximum value of P is\",round(P,1),\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum value of P is 157.8 kN\n"
       ]
      }
     ],
     "prompt_number": 106
    }
   ],
   "metadata": {}
  }
 ]
}