{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 9:Mechanical Properties of Materials"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.1,Page No:9.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Elongation = 0.435 mm\n",
      "Lateral contraction = 1.30  um\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "F   = 8482;                    # Tensile force in newtons\n",
    "lo  = 0.30;                    # length of steel wire in cm\n",
    "Y   = 207*10**9;               # Youngs modulus of steel Gpa\n",
    "r   = 3*10**-3;                # radius of steel wire  in m\n",
    "v   = 0.30;                    # poisson ratio\n",
    "\n",
    "# Calculations\n",
    "\n",
    "dl  = (F*lo)/float(Y*math.pi*r**2);       #elongation in mm\n",
    "e1  = dl/float(lo);                       #longitudanl strain \n",
    "e2  = v*e1                                # lateral strain \n",
    "dr  = e2*r;                               # lateral contraction in m\n",
    " \n",
    "# Result\n",
    "print'Elongation = %3.3f'%(dl*10**3),'mm';\n",
    "print'Lateral contraction = %3.2f '%(dr*10**6),'um';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.3,Page No:9.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Engineering stress = 14.15  MPa\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "P   = 400;                      # tensile force in newtons \n",
    "d   = 6*10**-3;                 # diameter of steel rod m\n",
    "\n",
    "# Calculations\n",
    "r   =d/float(2);\n",
    "E_stress = (P)/float((math.pi/float(4))*d*d);         #e_stress in N/m**2\n",
    "\n",
    "#Result\n",
    "\n",
    "print'Engineering stress = %3.2f '%(E_stress*10**-6),'MPa';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.4,Page No:9.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Percentage of elongation = 5.75  %\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Lf  = 42.3;         #guage length after strain mm\n",
    "Lo  = 40;           # guage length in mm\n",
    "\n",
    "# Calculations\n",
    "e   = ((Lf - Lo)/float(Lo))*100      #Engineering Strain in %\n",
    "\n",
    "#Result\n",
    "print'Percentage of elongation = %3.2f '%e,'%';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.5,Page No:9.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Percent reduction in area = 30.1 %\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "dr  = 12.8;      # original diameter of steel wire in mm\n",
    "df  = 10.7;     # diameter at fracture in mm\n",
    "\n",
    "# Calculations\n",
    "percent_red = (((math.pi*dr*dr) - (math.pi*df*df))/float(math.pi*dr*dr))*100;  #Percent reduction in area  in %\n",
    "\n",
    "\n",
    "# Result\n",
    "print'Percent reduction in area = %3.1f'%percent_red,'%';"
   ]
  }
 ],
 "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.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}