{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 13: Creep and Stress Rupture"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "### Example 13.1, Engineering Creep, Page No. 461"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "-----------------------------------------------------------\n",
      "\n",
      "Temperature\tCreep Strength, psi\tWorking Stress, psi\n",
      "\n",
      "------------------------------------------------------------\n",
      "\n",
      "1100 F\t\t\t30000\t\t\t10000\n",
      "\n",
      "\n",
      "1500 F\t\t\t4000\t\t\t1333\n",
      "\n"
     ]
    }
   ],
   "source": [
    "\n",
    "#variable declaration\n",
    "sf=3;\n",
    "per=1/1000;\n",
    "T=[1100, 1500];\n",
    "C=[30000, 4000];              \n",
    "W=[0, 0];\n",
    "#calculation\n",
    "W[0]=C[0]/sf;\n",
    "W[1]=C[1]/sf;\n",
    "\n",
    "#result\n",
    "print('\\n-----------------------------------------------------------\\n');\n",
    "print('Temperature\\tCreep Strength, psi\\tWorking Stress, psi\\n');\n",
    "print('------------------------------------------------------------');\n",
    "print('\\n1100 F\\t\\t\\t%i\\t\\t\\t%i\\n')%(C[0],W[0]);\n",
    "print('\\n1500 F\\t\\t\\t%i\\t\\t\\t%i\\n')%(C[1],W[1]);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 13.2, Engineering Creep, Page No. 461"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Activation Energy = 157867 cal/mol\n",
      "\n",
      "\n",
      "\n",
      "Note: Calculation Errors in book\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "from math import log\n",
    "\n",
    "#variable declaration\n",
    "def C(f):\n",
    "    return (f-32)*5/9;\n",
    "R=1.987;\n",
    "T2=1300;\n",
    "T1=1500;\n",
    "\n",
    "#calculation\n",
    "T2=C(T2)+273.15;\n",
    "T1=C(T1)+273.15;\n",
    "e2=0.0001;\n",
    "e1=0.4;\n",
    "Q=R*log(e1/e2)/(1/T2-1/T1);\n",
    "\n",
    "#result\n",
    "print('\\nActivation Energy = %g cal/mol')%(Q)\n",
    "print('\\n\\n\\nNote: Calculation Errors in book');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 13.3, Prediction of long time properties, Page No. 464"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "At T = 1200 F, P = 41500\n",
      "At T = 1600 F, P = 51500\n",
      "And from the master ploy of Astroploy, corresponding stress required are sigma = 78000 psi and sigma = 11000 psi\n"
     ]
    }
   ],
   "source": [
    "\n",
    "from math import log10\n",
    "\n",
    "#variable declaration\n",
    "t=10**5;\n",
    "C1=20;\n",
    "T1=1200;\n",
    "T2=1600;\n",
    "\n",
    "#calculation\n",
    "P_1200=(T1+460)*(log10(t)+C1);\n",
    "P_1600=(T2+460)*(log10(t)+C1);\n",
    "\n",
    "#result\n",
    "print('\\nAt T = 1200 F, P = %g\\nAt T = 1600 F, P = %g\\nAnd from the master ploy of Astroploy, corresponding stress required are sigma = 78000 psi and sigma = 11000 psi')%(P_1200,P_1600);"
   ]
  }
 ],
 "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
}