{
 "metadata": {
  "name": "",
  "signature": "sha256:4ffa24abd34ea1d807c13e9c49ee68a5b2044c03e6300e8fc08c3e8ef3625eac"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter2-Water and its Treatment"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2_18_1-pg no 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##water and its treatment##\n",
      "##example 2.18.1##\n",
      "import math\n",
      "W1=12.5;##CaCO3 in water in mg/lit##\n",
      "W2=8.4;##MgCO3 in water in mg/lit##\n",
      "W3=22.2;##CaCl2 in water in mg/lit##\n",
      "W4=9.5;##MgCl2 in water in mg/lit##\n",
      "W5=33.;##CO2 in water in mg/lit##\n",
      "W6=6.68;##NaHCO3 in water in mg/lit##\n",
      "M1=100./100.;##multiplication factor of CaCO3##\n",
      "M2=100./84.;##multiplication factor of MgCO3##\n",
      "M3=100./111.;##multiplication factor of CaCl2##\n",
      "M4=100./95.;##multiplication factor of MgCl2##\n",
      "M6=100./84.;##multiplication factor of NaHCO3##\n",
      "P1=W1*M1;##CaCO3 in terms of CaCO3##\n",
      "P2=W2*M2;##MgCO3 in terms of CaCO3##\n",
      "P3=W3*M3;##CaCl2  in terms of CaCO3##\n",
      "P4=W4*M4;##MgCl2 in terms of CaCO3##\n",
      "P6=W6*M6;##NaHCO3 in terms of CaCO3##\n",
      "print (\"We do not take CO2 since it does not contribute to hardness \");\n",
      "C=P1+P2+P6;\n",
      "print'%s %.2f %s'%(\"\\nCarbonate hardness is \",C,\" mg/l or ppm\");\n",
      "NC=P3+P4;\n",
      "print'%s %.2f %s'%(\"\\nNon Carbonate hardness is \",NC,\" mg/l or ppm\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We do not take CO2 since it does not contribute to hardness \n",
        "\n",
        "Carbonate hardness is  30.45  mg/l or ppm\n",
        "\n",
        "Non Carbonate hardness is  30.00  mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2_18_2-pg no 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##water and its treatment##\n",
      "##example 2.18.2##\n",
      "import math\n",
      "W1=40.5;##Ca(HCO3)2 in water in mg/lit##\n",
      "W2=33.3;##CaCl2 in water in mg/lit##\n",
      "W3=41.;##Ca(NO3)2 in water in mg/lit##\n",
      "W4=101.;##KNO3 in water in mg/lit##\n",
      "W5=33.6;##MgCO3 in water in mg/lit##\n",
      "M1=100./162.;##multiplication factor of Ca(HCO3)2##\n",
      "M2=100./111.;##multiplication factor of CaCl2##\n",
      "M3=100./164.;##multiplication factor of Ca(NO3)2##\n",
      "M5=100./84.;##multiplication factor of MgCO3##\n",
      "P1=W1*M1;##Ca(HCO3)2 in terms of CaCO3##\n",
      "P2=W2*M2;##CaCl2 in terms of CaCO3##\n",
      "P3=W3*M3;##Ca(NO3)2  in terms of CaCO3##\n",
      "P5=W5*M5;##MgCO3 in terms of CaCO3##\n",
      "print (\"We do not take KNO3 since it does not contribute to hardness \");\n",
      "C=P1+P5;\n",
      "print'%s %.2f %s'%(\"\\nCarbonate hardness is \",C,\" mg/l or ppm\");\n",
      "NC=P2+P3;\n",
      "print'%s %.2f %s'%(\"\\nNon Carbonate hardness is \",NC,\" mg/l or ppm\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We do not take KNO3 since it does not contribute to hardness \n",
        "\n",
        "Carbonate hardness is  65.00  mg/l or ppm\n",
        "\n",
        "Non Carbonate hardness is  55.00  mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2_18_3-pg no 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##water and its treatment##\n",
      "##example 2.18.3##\n",
      "import math\n",
      "W1=29.1;##Mg(HCO3)2 in water in mg/lit##\n",
      "W2=40.5;##Ca(HCO3)2 in water in mg/lit##\n",
      "W3=11.1;##CaCl2 in water in mg/lit##\n",
      "W4=15.82;##MgCl2 in water in mg/lit##\n",
      "W5=28.5;##NaCl in water in mg/lit##\n",
      "W6=22.0;##CO2 in water in mg/lit##\n",
      "M1=100./146.007;##multiplication factor of Mg(HCO3)2##\n",
      "M2=100./162.;##multiplication factor of Ca(HCO3)2##\n",
      "M3=100./111.;##multiplication factor of CaCl2##\n",
      "M4=100./95.005;##multiplication factor of MgCl2##\n",
      "P1=W1*M1;##Mg(HCO3)2 in terms of CaCO3##\n",
      "P2=W2*M2;##Ca(HCO3)2 in terms of CaCO3##\n",
      "P3=W3*M3;##CaCl2  in terms of CaCO3##\n",
      "P4=W4*M4;##MgCl2 in terms of CaCO3##\n",
      "print(\"We do not take NaCl and CO2 since they do not contribute to hardness \");\n",
      "C=P1+P2;\n",
      "print'%s %.2f %s'%(\"\\nCarbonate hardness is \",C,\" mg/l or ppm\");\n",
      "NC=P3+P4;\n",
      "print'%s %.2f %s'%(\"\\nNon Carbonate hardness is \",NC,\" mg/l or ppm\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We do not take NaCl and CO2 since they do not contribute to hardness \n",
        "\n",
        "Carbonate hardness is  44.93  mg/l or ppm\n",
        "\n",
        "Non Carbonate hardness is  26.65  mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2_18_4-pg no 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##water and its treatment##\n",
      "##example 2.18.4##\n",
      "import math\n",
      "W1=16.2;##Ca(HCO3)2 in water in mg/lit##\n",
      "W2=14.6;##Mg(HCO3)2 in water in mg/lit##\n",
      "W3=9.5;##MgCl2 in water in mg/lit##\n",
      "W4=48.;##MgSO4 in water in mg/lit##\n",
      "W5=12.;##KCl in water in mg/lit##\n",
      "M1=100./162.;##multiplication factor of Ca(HCO3)2##\n",
      "M2=100./146.;##multiplication factor of Mg(HCO3)2 ##\n",
      "M3=100./95.;##multiplication factor of MgCl2##\n",
      "M4=100./120.;##multiplication factor of MgSO4##\n",
      "P1=W1*M1;##Ca(HCO3)2 in terms of CaCO3##\n",
      "P2=W2*M2;##Mg(HCO3)2  in terms of CaCO3##\n",
      "P3=W3*M3;##MgCl2  in terms of CaCO3##\n",
      "P4=W4*M4;##MgSO4 in terms of CaCO3##\n",
      "print (\"We do not take KCl since it does not contribute to hardness \");\n",
      "C=P1+P2;\n",
      "print'%s %.2f %s'%(\"\\nCarbonate hardness is \",C,\" mg/l or ppm\");\n",
      "NC=P3+P4;\n",
      "print'%s %.2f %s'%(\"\\nNon Carbonate hardness is \",NC,\" mg/l or ppm\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We do not take KCl since it does not contribute to hardness \n",
        "\n",
        "Carbonate hardness is  20.00  mg/l or ppm\n",
        "\n",
        "Non Carbonate hardness is  50.00  mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2_18_5-pg no30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##water and its treatment##\n",
      "##example 2.18.5##\n",
      "import math\n",
      "W1=81;##Ca(HCO3)2 in water in mg/lit##\n",
      "W2=84;##MgCO3 in water in mg/lit##\n",
      "W3=22.2;##CaCl2 in water in mg/lit##\n",
      "W4=60;##MgSO4 in water in mg/lit##\n",
      "W5=30;##KCl in water in mg/lit##\n",
      "M1=100/162;##multiplication factor of Ca(HCO3)2##\n",
      "M2=100/84;##multiplication factor of MgCO3##\n",
      "M3=100/111;##multiplication factor of CaCl2##\n",
      "M4=100/120;##multiplication factor of MgSO4##\n",
      "P1=W1*M1;##Ca(HCO3)2 in terms of CaCO3##\n",
      "P2=W2*M2;##MgCO3 in terms of CaCO3##\n",
      "P3=W3*M3;##CaCl2  in terms of CaCO3##\n",
      "P4=W4*M4;##MgSO4 in terms of CaCO3##\n",
      "print (\"We do not take KCl since it does not contribute to hardness \");\n",
      "T=P1+P2;\n",
      "print'%s %.2f %s'%(\"\\nTemporary hardness is \",T,\" mg/l or ppm\");\n",
      "P=P3+P4;\n",
      "print'%s %.f %s'%(\"\\nPermanant hardness is \",P,\" mg/l or ppm\");\n",
      "To=T+P;\n",
      "print'%s %.2f %s'%(\"\\nTotal hardness is \",To,\" mg/l or ppm\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "We do not take KCl since it does not contribute to hardness \n",
        "\n",
        "Temporary hardness is  84.00  mg/l or ppm\n",
        "\n",
        "Permanant hardness is  0  mg/l or ppm\n",
        "\n",
        "Total hardness is  84.00  mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2_18_6-pg no 33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##water and its treatment##\n",
      "##example 2.18.6##\n",
      "import math\n",
      "W1=29.2;##MgCO3 in water in mg/lit##\n",
      "W2=36.;##MgSO4 in water in mg/lit##\n",
      "W3=22.2;##CaCl2 in water in mg/lit##\n",
      "W4=142.5;##MgCl2 in water in mg/lit##\n",
      "M1=100./84.;##multiplication factor of MgCO3##\n",
      "M2=100./120.;##multiplication factor of MgSO4##\n",
      "M3=100./111.;##multiplication factor of CaCl2##\n",
      "M4=100./95.;##multiplication factor of MgCl2##\n",
      "P1=W1*M1;##MgCO3 in terms of CaCO3##\n",
      "P2=W2*M2;##MgSO4 in terms of CaCO3##\n",
      "P3=W3*M3;##CaCl2  in terms of CaCO3##\n",
      "P4=W4*M4;##MgCl2 in terms of CaCO3##\n",
      "T=P1;\n",
      "print'%s %.2f %s'%(\"\\nCarbonate hardness is \",T,\" mg/l or ppm\");\n",
      "P=P2+P3+P4;\n",
      "print'%s %.2f %s'%(\"\\nNon Carbonate hardness is \",P,\" mg/l or ppm\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Carbonate hardness is  34.76  mg/l or ppm\n",
        "\n",
        "Non Carbonate hardness is  200.00  mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2_18_7-pg no 34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "##water and its treatment##\n",
      "##example 2.18.7##\n",
      "import math\n",
      "Hardness_ppm=304.##ppm in terms of CaCO3##\n",
      "Cl=0.07*Hardness_ppm##0.07 Clarke =1 ppm##\n",
      "Fr=0.1*Hardness_ppm##0.1 French =1 ppm##\n",
      "mgperlit=Hardness_ppm\n",
      "print'%s %.2f %s'%(\"Hardness in terms of Clarke \",Cl,\" Cl\");\n",
      "print'%s %.2f %s'%(\"\\nHardness in terms of French \",Fr,\" Fr\");\n",
      "print'%s %.2f %s'%(\"\\nHardness in terms of mg/lit \",mgperlit,\" mg/l\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hardness in terms of Clarke  21.28  Cl\n",
        "\n",
        "Hardness in terms of French  30.40  Fr\n",
        "\n",
        "Hardness in terms of mg/lit  304.00  mg/l\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}