{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3: Elements of the Theory of Plasticity"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 3.1, True Stress and True Strain, Page No. 76"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Engineering Stress at maximum load = 99852.1 psi\n",
      "True Fracture Stress = 112785 psi\n",
      "True Strain at fracture = 0.344939\n",
      "Engineering strain at fracture = 0.411903\n"
     ]
    }
   ],
   "source": [
    "from math import pi\n",
    "from math import log\n",
    "from math import exp\n",
    "\n",
    "#variable declaration\n",
    "D_i=0.505;\n",
    "L=2;\n",
    "P_max=20000;\n",
    "P_f=16000;\n",
    "D_f=0.425;\n",
    "\n",
    "#calculation\n",
    "E_St= P_max*4/(pi*D_i**2);\n",
    "T_fr_St= P_f*4/(pi*D_f**2);\n",
    "e_f=log(D_i**2/D_f**2);\n",
    "e=exp(e_f)-1;\n",
    "\n",
    "#result\n",
    "print('\\nEngineering Stress at maximum load = %g psi\\nTrue Fracture Stress = %g psi\\nTrue Strain at fracture = %g\\nEngineering strain at fracture = %g')%(E_St,T_fr_St,e_f,e);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 3.2, Yielding Criteria for Ductile Metals, Page No. 78"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Since the calculated value of sigma0 = 224.054 MPa, which is less than the yield strength of the aluminium alloy\n",
      "Thus safety factor is = 2.23161\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from math import sqrt\n",
    "\n",
    "#variable declaration\n",
    "sigma00=500;\n",
    "sigma_z=-50;\n",
    "sigma_y=100;\n",
    "sigma_x=200;\n",
    "T_xy=30;\n",
    "T_yz=0;\n",
    "T_xz=0;\n",
    "\n",
    "#calculation\n",
    "sigma0=sqrt((sigma_x-sigma_y)**2+(sigma_y-sigma_z)**2+(sigma_z-sigma_x)**2+6*(T_xy**2+T_yz**2+T_xz**2))/sqrt(2);\n",
    "s=sigma00/sigma0;\n",
    "\n",
    "#result\n",
    "print('\\nSince the calculated value of sigma0 = %g MPa, which is less than the yield strength of the aluminium alloy\\nThus safety factor is = %g')%(sigma0,s);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 3.3, Tresca Criterion, Page No. 81"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Since the calculated value of sigma0 = 250 MPa, which is less than the yield strength of the aluminium alloy\n",
      "Thus safety factor is = 2\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "#variable declaration\n",
    "sigma00=500;\n",
    "sigma_z=-50;\n",
    "sigma_y=100;\n",
    "sigma_x=200;\n",
    "T_xy=30;\n",
    "T_yz=0;\n",
    "T_xz=0;\n",
    "\n",
    "#calculation\n",
    "sigma0=sigma_x-sigma_z;\n",
    "s=sigma00/sigma0;\n",
    "\n",
    "#result\n",
    "print('\\nSince the calculated value of sigma0 = %g MPa, which is less than the yield strength of the aluminium alloy\\nThus safety factor is = %g')%(sigma0,s);\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### Example 3.4, Levy-Mises Equation, Page No. 91"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Plastic Strain = 0.199532\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "\n",
    "#variable declaration\n",
    "r_t=20;\n",
    "p=1000;\n",
    "\n",
    "#calculation\n",
    "sigma1=p*r_t;\n",
    "sigma1=sigma1/1000;                     #conversion to ksi\n",
    "sigma=sqrt(3)*sigma1/2;\n",
    "e=(sigma/25)**(1/0.25);\n",
    "e1=sqrt(3)*e/2;\n",
    "\n",
    "#result\n",
    "print('\\nPlastic Strain = %g')%(e1);\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}