{
 "metadata": {
  "name": "",
  "signature": "sha256:c5f8065703fbeb58a71f73144f936d51092395de25fe2bd4b3e4c9b6e159ad53"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter1-Mohrs circle"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Mohr's circle\n",
      "#calculate center of the circle and maxi principal stress and pricipal stress and maxi shearing stresss\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": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##Mohr's circle\n",
      "#calculate radius of the circle in and orientation of the stress\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": 2
    }
   ],
   "metadata": {}
  }
 ]
}