{
 "metadata": {
  "name": "",
  "signature": "sha256:055c326b63bc3f150b8a5e433c724771cc1733887ec2b1e223ccf712fcd80848"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 01:Stress"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1.1, Page No:9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#NOTE:The notation has been changed to simplify the coding process\n",
      "\n",
      "#Variable Decleration\n",
      "P_AB=4000 #Axial Force at section 1 in lb\n",
      "P_BC=5000 #Axial Force at section 2 in lb\n",
      "P_CD=7000 #Axial Force at section 3 in lb\n",
      "A_1=1.2 #Area at section 1 in in^2\n",
      "A_2=1.8 #Area at section 2 in in^2\n",
      "A_3=1.6 #Area at section 3 in in^2\n",
      "\n",
      "#Calculation\n",
      "#S indicates sigma here\n",
      "S_AB=P_AB/A_1 #Stress at section 1 in psi (T)\n",
      "S_BC=P_BC/A_2 #Stress at section 2 in psi (C)\n",
      "S_CD=P_CD/A_3 #Stress at section 3 in psi (C)\n",
      "\n",
      "#Result\n",
      "print \"The stress at the three sections is given as\"\n",
      "print \"Stress at section 1=\",round(S_AB),\"section 2=\",round(S_BC),\"section 3=\",S_CD\n",
      "\n",
      "#NOTE:The answer for the following example for section 1 and section 2\n",
      "#are incorrect due to rounding in the textbook\n",
      "#Computed values are correct"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The stress at the three sections is given as\n",
        "Stress at section 1= 3333.0 section 2= 2778.0 section 3= 4375.0\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1.2, Page No:10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "Ay=40 #Vertical Reaction at A in kN\n",
      "Hy=60 #Vertical Reaction at H in kN\n",
      "Hx=0 #Horizontal Reaction at H in kN\n",
      "y=3 #Height in m\n",
      "x=5 #Distance in m\n",
      "p=4 #Panel distance in m\n",
      "A=900 #Area of the member in mm^2\n",
      "P_C=30 #Force at point C in kN\n",
      "\n",
      "#Calculation\n",
      "#Part 1\n",
      "#Applying summation of forces in the x and y direction and equating to zero\n",
      "P_AB=(-Ay)*(x*y**-1) #Force in member AB in kN\n",
      "P_AC=-(p*x**-1*P_AB) #Force in member AC in kN\n",
      "#Using stress=force/area\n",
      "S_AC=(P_AC/A)*10**3 #Stress in member AC in MPa (T)\n",
      "\n",
      "#Part 2\n",
      "#Sum of moments about point E to zero\n",
      "P_BD=(Ay*p*2-(P_C*p))*y**-1 #Force in memeber AB in kN (C)\n",
      "S_BD=(P_BD/A)*10**3 #Stress in member in MPa (C)\n",
      "\n",
      "#Result\n",
      "print \"The Stress in member AC is\",round(S_AC,1),\"MPa (T)\"\n",
      "print \"The Stress in member BD is\",round(S_BD,1),\"MPa (C)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Stress in member AC is 59.3 MPa (T)\n",
        "The Stress in member BD is 74.1 MPa (C)\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1.3, Page No:11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "import numpy as num\n",
      "\n",
      "#Variable Decleration\n",
      "A_AB=800 #Area of member AB in m^2\n",
      "A_AC=400 #Area of member AC in m^2\n",
      "W_AB=110 #Safe value of stress in Pa for AB\n",
      "W_AC=120 #Safe value of stress in Pa for AC\n",
      "theta1=60*3.14*180**-1 #Angle in radians\n",
      "theta2=40*3.14*180**-1 #Angle in radians \n",
      "\n",
      "#Calculations\n",
      "#Applying sum of forces \n",
      "#Solving by matrix method putting W as 1\n",
      "A=num.array([[-cos(theta1),cos(theta2)],[sin(theta1),sin(theta2)]])\n",
      "B=num.array([[1],[1]])\n",
      "C=inv(A)\n",
      "D=C*B\n",
      "\n",
      "#Using newtons third law\n",
      "#Two values of W hence the change in the notation\n",
      "W1=(W_AB*A_AB)*(D[1,1])**-1 #Weight W in N\n",
      "W2=(W_AC*A_AC)*(D[0,1])**-1 #Weight W in N\n",
      "\n",
      "#Result\n",
      "print \"The maximum value of W allowable is\",round(W2*1000**-1,1),\"kN\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum value of W allowable is 61.7 kN\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1.4, Page No:19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable Decleration\n",
      "d=3*4**-1 #Rivet diameter in inches\n",
      "t=7*8**-1 #Thickness of the plate in inches\n",
      "tau=14000 #Shear stress limit in psi\n",
      "sigma_b=18000 #Normal stress limit in psi\n",
      "\n",
      "#Calculations\n",
      "#Design Shear Stress in Rivets\n",
      "V=tau*(d**2*(pi/4))*4 #Shear force maximum allowable in lb\n",
      "#Design for bearing stress in plate\n",
      "Pb=sigma_b*t*d*4 #lb\n",
      "\n",
      "#Result\n",
      "print \"The maximum load that the joint can carry is\",round(V),\"lb\"\n",
      "\n",
      "#NOTE:The answer in the textbook is off by 40lb"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum load that the joint can carry is 24740.0 lb\n"
       ]
      }
     ],
     "prompt_number": 55
    }
   ],
   "metadata": {}
  }
 ]
}