{
 "metadata": {
  "name": "",
  "signature": "sha256:76379bde89e3a33a0904d639103a0d51711eca282502a3d06dfa062f7d30798f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter1-Analysis of stress"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-page13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Mohr's circle\n",
      "#calculate centre of circle and max and min stress and principal stress and maxi shearing stress\n",
      "import numpy\n",
      "from numpy.linalg import inv\n",
      "import math\n",
      "sigma=((40+80)/2.)\n",
      "print'%s %.2f %s'%(\"center of the circle in MPa = \",sigma,\"\")\n",
      "\n",
      "##solution a\n",
      "x=((80-40)**2.);\n",
      "y=30**2.;\n",
      "sigma1=60.+math.sqrt((.25*x)+y)\n",
      "print'%s %.2f %s'%(\"maxi pricipal stress in MPa = \",sigma1,\"\");## print'%s %.2f %s'%laying result\n",
      "sigma2=60.-math.sqrt((.25*x)+y)\n",
      "print'%s %.2f %s'%(\"mini pricipal stress in MPa = \",sigma2,\"\");## print'%s %.2f %s'%laying result\n",
      "theta1=((math.atan((30./20.))/2)*57.3)\n",
      "print'%s %.2f %s'%(\"pricipal stresses in degree\",theta1,\"\");## print'%s %.2f %s'%laying result\n",
      "theta2=(((math.atan(30/20.))+180.)/2.)*57.3\n",
      "print'%s %.2f %s'%(\"pricipal stresses in degree\",theta2,\"\");## print'%s %.2f %s'%laying result\n",
      "\n",
      "##solution b\n",
      "tau=math.sqrt((.25*x)+y)\n",
      "print'%s %.2f %s'%(\"maxi shearing stress in MPa = \",tau,\"\");## print'%s %.2f %s'%laying result\n",
      "theta3=theta1+45.\n",
      "print'%s %.2f %s'%(\"stress in MPa = \",theta3,\"\");## print'%s %.2f %s'%laying result\n",
      "theta4=theta2+45\n",
      "print'%s %.2f %s'%(\"stress in MPa = \",theta4,\"\");## print'%s %.2f %s'%laying result\n",
      "\n",
      "##final solution in matrix form\n",
      "p=([80 ,30, 30 ,40])\n",
      "print(p) \n",
      "q=([sigma1, 0 ,0 ,sigma2])\n",
      "print(q)\n",
      "r=([sigma, -tau, -tau, sigma])\n",
      "print(r)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "center of the circle in MPa =  60.00 \n",
        "maxi pricipal stress in MPa =  96.06 \n",
        "mini pricipal stress in MPa =  23.94 \n",
        "pricipal stresses in degree 28.16 \n",
        "pricipal stresses in degree 5185.16 \n",
        "maxi shearing stress in MPa =  36.06 \n",
        "stress in MPa =  73.16 \n",
        "stress in MPa =  5230.16 \n",
        "[80, 30, 30, 40]\n",
        "[96.05551275463989, 0, 0, 23.944487245360108]\n",
        "[60.0, -36.05551275463989, -36.05551275463989, 60.0]\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Mohr's circle\n",
      "#calculate circle and radius of circle and oriention of the stresses in MPA\n",
      "import math\n",
      "radius=((14+28)/2.)\n",
      "print'%s %.2f %s'%(\"radius of the circle in degree = \",radius,\"\")\n",
      "sigma1=(7+radius *math.cos(60/57.3))\n",
      "print'%s %.2f %s'%(\" the circle in MPa = \",sigma1,\"\")\n",
      "sigma2=(7-radius *math.cos(60/57.3))\n",
      "print'%s %.2f %s'%(\" the circle in MPa = \",sigma2,\"\")\n",
      "tau1=radius*math.sin(60./57.3)\n",
      "print'%s %.2f %s'%(\" orientation of the stresses in MPa = \",tau1,\"\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "radius of the circle in degree =  21.00 \n",
        " the circle in MPa =  17.50 \n",
        " the circle in MPa =  -3.50 \n",
        " orientation of the stresses in MPa =  18.19 \n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}