{
 "metadata": {
  "celltoolbar": "Raw Cell Format",
  "name": "",
  "signature": "sha256:8ade9358728d8873e3787f09037539bd355e8453094fed25ae256529fe52d8d4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 17: Water Treatment"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 1,Page number 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import  math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "m1 = 146    #mass of Mg(HCO3)2\n",
      "\n",
      "m2 = 162    #mass of Ca(HCO3)2\n",
      "\n",
      "m3 = 95    #mass of MgCl2\n",
      "\n",
      "m4 = 136    #mass of CaSO4\n",
      "\n",
      "amnt_1 = 7.5     #amount of Mg(HCO3)2 in mg/l\n",
      "\n",
      "amnt_2 = 16     #amount of Ca(HCO3)2 in mg/l\n",
      "\n",
      "amnt_3 = 9     #amount of MgCl2 in mg/l\n",
      "\n",
      "amnt_4 = 13.6     #amount of CaSO4 in mg/l\n",
      "\n",
      "temp_hard= (amnt_1*100./m1)+(amnt_2*100./m2)\n",
      "\n",
      "perm_hard= (amnt_3*100./m3)+(amnt_4*100./m4)\n",
      "\n",
      "total= temp_hard +perm_hard\n",
      "\n",
      "print\"the temporary hardness is =\",temp_hard,\"mg/l\"\n",
      "\n",
      "print\"the total  hardness is =\",total,\"mg/l\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the temporary hardness is = 15.0135295112 mg/l\n",
        "the total  hardness is = 34.4872137218 mg/l\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 2,Page number 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "m1= 136   # mass of FeSO4\n",
      "\n",
      "m2 = 100  #mass of CaCO3\n",
      "\n",
      "#for 100 ppm hardness FeSO4 required per 10**6 parts of water is 136 parts\n",
      "#for 200 ppm hardness\n",
      "\n",
      "amt= m1*200./m2\n",
      "\n",
      "print\"the amount of FeSO4 required is =\",amt,\"mg/l\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the amount of FeSO4 required is = 272 mg/l\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 3,Page number 369"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "conc = 15.6 *10**-6    #concentration of (CO3)-2\n",
      "\n",
      "m = 60                 #mass of CO3\n",
      "\n",
      "Molarity= conc*100./m\n",
      "\n",
      "print\"the molarity of (CO3)-2  is =\",Molarity,\"M\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the molarity of (CO3)-2  is = 2.6e-05 M\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 4,Page number 370"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "m1 = 146    #mass of Mg(HCO3)2\n",
      "\n",
      "m2 = 162    #mass of Ca(HCO3)2\n",
      "\n",
      "m3 = 111    #mass of CaCl2\n",
      "\n",
      "m4 = 120    #mass of MgSO4\n",
      "\n",
      "m5 = 136    #mass of CaSO4\n",
      "\n",
      "amnt_1 = 12.5     #amount of Mg(HCO3)2 in ppm\n",
      "\n",
      "amnt_2 = 10.5     #amount of Ca(HCO3)2 in ppm\n",
      "\n",
      "amnt_3 = 8.2     #amount of CaCl2 in ppm \n",
      "\n",
      "amnt_4 = 2.6     #amount of MgSO4 in ppm\n",
      "\n",
      "amnt_5 = 7.5     #amount of CaSO4 in ppm\n",
      "\n",
      "temp_hard= (amnt_1*100./m1)+(amnt_2*100./m2)\n",
      "\n",
      "perm_hard= (amnt_3*100./m3)+(amnt_4*100./m4)+(amnt_5*100./m5)\n",
      "\n",
      "total= temp_hard +perm_hard\n",
      "\n",
      "print\"the temporary hardness is =\",temp_hard,\"mg/l\"\n",
      "\n",
      "print\"the permanent hardness is =\",perm_hard,\"mg/l\"\n",
      "\n",
      "print\"the total  hardness is =\",total,\"mg/l\"\n",
      "\n",
      "v= 100    #volume of sample\n",
      "\n",
      "v_EDTA = total*v/1000   #volume of EDTA \n",
      "\n",
      "print\"the volume of M/100 EDTA required is =\",v_EDTA,\"ml\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the temporary hardness is = 15.0431253171 mg/l\n",
        " the permanent hardness is = 15.0687599364 mg/l\n",
        " the total  hardness is = 30.1118852535 mg/l\n",
        " the volume of M/100 EDTA required is = 3.01118852535 ml\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 5,Page number 370"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "v= 50000  #volume of water\n",
      "\n",
      "m1 = 84    #mass of MgCO3\n",
      "\n",
      "m2 = 100    #mass of CaCO3\n",
      "\n",
      "m3 = 95    #mass of MgCl2\n",
      "\n",
      "m4 = 111    #mass of CaCl2\n",
      "\n",
      "amnt_1 = 144     #amount of MgCO3 in ppm\n",
      "\n",
      "amnt_2 = 25     #amount of CaCO3 in ppm\n",
      "\n",
      "amnt_3 = 95     #amount of MgCl2 in ppm \n",
      "\n",
      "amnt_4 = 111     #amount of CaCl2 in ppm\n",
      "\n",
      "lime = (74./100)*(2*(amnt_1*100./m1)+(amnt_2*100./m2)+(amnt_3*100./m3))*v\n",
      "\n",
      "print\"the lime required is =\",lime,\"mg\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the lime required is = 17310714.2857 mg\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 6,Page number 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "v= 10**6  #volume of water\n",
      "\n",
      "m1 = 40.0  #mass of Ca+2\n",
      "\n",
      "m2 = 24.0    #mass of Mg+2\n",
      "\n",
      "m3 = 44.0    #mass of CO2\n",
      "\n",
      "m4 = 122.0    #mass of HCO3-\n",
      "\n",
      "amnt_1 = 20.0     #amount of Ca+2 in ppm\n",
      "\n",
      "amnt_2 = 25.0     #amount of Mg+2 in ppm\n",
      "\n",
      "amnt_3 = 30.0     #amount of CO2 in ppm \n",
      "\n",
      "amnt_4 = 150.0     #amount of HCO3- in ppm\n",
      "\n",
      "lime_1 = (74./100)*((amnt_2*100./m2)+(amnt_3*100./m3)+(amnt_4*100./m4))*v\n",
      "\n",
      "soda = (106./100)*((amnt_1*100./m1)+(amnt_2*100./m2)-(amnt_4*100./m4))*v\n",
      "\n",
      "print\"the lime required is =\",lime_1,\"mg\"\n",
      "\n",
      "print\"the soda required is =\",soda,\"mg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the lime required is = 218521485.345 mg\n",
        "the soda required is = 33088797.8142 mg\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 7,Page number 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "v= 150        #volume of NaCl \n",
      "\n",
      "conc = 150.   #concentration of NaCl\n",
      "\n",
      "amnt =v*conc *100./117    #amnt of NaCl\n",
      "\n",
      "hard = 600.   #hardness of water\n",
      "\n",
      "vol= amnt*1000./hard\n",
      "\n",
      "print\"the volume of water is =\",round(vol,4),\"litres\"\n",
      "\n",
      "#calculation mistake in textbook\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the volume of water is = 32051.2821 litres\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 8,Page number 371"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "strength = 10*0.85/9    #strength of EDTA\n",
      "\n",
      "#1000 ml EDTA solution == 1 g CaCO3\n",
      "\n",
      "#for 20 ml EDTA solution\n",
      "\n",
      "amnt= 20.*strength/1000\n",
      "\n",
      "#50 ml smple of water contains amnt CaCO3\n",
      "\n",
      "hard= amnt*10**6/50    #hardness of water \n",
      "\n",
      "print\"the hardness of water is =\",round(hard,3),\"ppm\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the hardness of water is = 377.778 ppm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Problem 9,Page number 372"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Given Data\n",
      "\n",
      "m1 = 146    #mass of Mg(HCO3)2\n",
      "\n",
      "m2 = 162    #mass of Ca(HCO3)2\n",
      "\n",
      "m3 = 111    #mass of CaCl2\n",
      "\n",
      "m4 = 120    #mass of MgSO4\n",
      "\n",
      "m5 = 136    #mass of CaSO4\n",
      "\n",
      "amnt_1 = 12.5     #amount of Mg(HCO3)2 in ppm\n",
      "\n",
      "amnt_2 = 10.5     #amount of Ca(HCO3)2 in ppm\n",
      "\n",
      "amnt_3 = 8.2     #amount of CaCl2 in ppm \n",
      "\n",
      "amnt_4 = 2.6     #amount of MgSO4 in ppm\n",
      "\n",
      "amnt_5 = 7.5     #amount of CaSO4 in ppm\n",
      "\n",
      "temp_hard= ((amnt_1*100./m1)+(amnt_2*100./m2))*0.1\n",
      "\n",
      "perm_hard= ((amnt_3*100./m3)+(amnt_4*100./m4)+(amnt_5*100./m5))*0.1\n",
      "\n",
      "print\"the temporary hardness is =\",round(temp_hard,3),\"degree Fr\"\n",
      "\n",
      "print\"the permanent hardness is =\",round(perm_hard,3),\"degree Fr\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the temporary hardness is = 1.504 degree Fr\n",
        "the permanent hardness is = 1.507 degree Fr\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}