{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 07 : Phase Diagrams"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.1, Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "c = 2.0     # number of components\n",
      "\n",
      "#Calculations\n",
      "for n in range(1,5):\n",
      "    p = (c-1) +2   # Total variables\n",
      "    f = c-n+2    # degree of freedom\n",
      "    print(\"Degree of freedom for two components when number of phases is %d is %d\" %(n, f))\n",
      "    \n",
      "#Results\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Degree of freedom for two components when number of phases is 1 is 3\n",
        "Degree of freedom for two components when number of phases is 2 is 2\n",
        "Degree of freedom for two components when number of phases is 3 is 1\n",
        "Degree of freedom for two components when number of phases is 4 is 0\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.2, Page No 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "p = 4.0\t\t# number of phases of system\n",
      "f = 0       # number of degree of system\n",
      "\n",
      "#Calculations\n",
      "C = f+p-1   # components number\n",
      "\n",
      "#Results\n",
      "print(\"Minimum number of components in system is %d\" %C)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum number of components in system is 3\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.3, Page No 160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "L = 23.3 \t\t# % composition of L\n",
      "a = 3.5         # concentration of Nacl in sea water\n",
      "ice = 0         # % composition of ice\n",
      "\n",
      "#Calculations\n",
      "f_ice = (L-a)/(L-ice)\n",
      "\n",
      "#Results\n",
      "print(\"Fractional amount of pure water that can be extracted from sea water is %0.2f\" %f_ice)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fractional amount of pure water that can be extracted from sea water is 0.85\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7.5 Page No 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "a = 0 \t\t# limiting value\n",
      "b = 0.8     # limiting value\n",
      "c = 0.6     # percentage composition of carbon\n",
      "f = 0.88    # fraction of ferrite in a eutectoid steel\n",
      "\n",
      "#Calculations\n",
      "f_pro_alpha = (b-c)/(b-a)\n",
      "f_perlite = 1 - f_pro_alpha\n",
      "f_eut = f*f_perlite\n",
      "\n",
      "#Results\n",
      "print(\"Composition of proeutectoid ferrite is %0.2f\" %f_pro_alpha)\n",
      "print(\"Composition of eutectoid ferrite is %0.2f\" %f_eut)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Composition of proeutectoid ferrite is 0.25\n",
        "Composition of eutectoid ferrite is 0.66\n"
       ]
      }
     ],
     "prompt_number": 17
    }
   ],
   "metadata": {}
  }
 ]
}