{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7:Water Chemistry"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:1,Page no:152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "MgSO4=60.0          #[mg]\n",
      "M_MgSO4=64.0        #Molecular weight of MgSO4\n",
      "M_CaCO3=48.0        #Molecular wt of CaCO3\n",
      "m_mgso4=120.0       #Weight of MgSO4 eq to CaCO3\n",
      "m_caco3=100.0       #Weight of CaCO3 eq to MgSO4\n",
      "\n",
      "#Calculation\n",
      "hard=(m_caco3/m_mgso4)*MgSO4      #Hardness of water in mg\n",
      "\n",
      "#Result\n",
      "print\"Hardness of water is \",hard,\"ppm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hardness of water is  50.0 ppm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.1,Page no:172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=16.2 #Ca(HCO3)2 in water in mg/lit#\n",
      "W2=7.3 #MgHCO3 in water in mg/lit#\n",
      "W3=13.6 #CaSO4 in water in mg/lit#\n",
      "W4=9.5 #MgCl2 in water in mg/lit#\n",
      "M1=100/162.0 #multiplication factor of Ca(HCO3)2#\n",
      "M2=100/146.0 #multiplication factor of MgHCO3#\n",
      "M3=100/136.0 #multiplication factor of CaSO4#\n",
      "M4=100/95.0 #multiplication factor of MgCl2#\n",
      "\n",
      "#Calculation\n",
      "P1=W1*M1 #Ca(HCO3)2 in terms of CaCO3 or #\n",
      "P2=W2*M2 #MgHCO3 in terms of CaCO3 or #\n",
      "P3=W3*M3 #CaSO4  in terms of CaCO3 or #\n",
      "P4=W4*M4 #MgCl2 in terms of CaCO3 or #\n",
      "T=P1+P2    #Temporary hardness\n",
      "P=P3+P4     #Permanent hardness\n",
      "To=T+P     #Total hardness\n",
      "\n",
      "#Result\n",
      "print\"Temporary hardness is\",T,\"mg/l or ppm\"\n",
      "print\"\\nPermanant hardness is \",P,\"mg/l or ppm\"\n",
      "print\"\\nTotal hardness is \",To,\"mg/l or ppm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temporary hardness is 15.0 mg/l or ppm\n",
        "\n",
        "Permanant hardness is  20.0 mg/l or ppm\n",
        "\n",
        "Total hardness is  35.0 mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.2,Page no:172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "F=56.0 #atomic weight of ferrus#\n",
      "S=32.0 #atomic weight of sulphur#\n",
      "O=16.0 #atomic weight of oxygen#\n",
      "Ca=40.0 #atomic weight of calsium#\n",
      "C=12.0 #atomic weight of carbon#\n",
      "\n",
      "#Calculation\n",
      "W1=136\n",
      "P=210.5 #required ppm of hardness#\n",
      "B=(W1/100.0)*P \n",
      "\n",
      "#Result\n",
      "print\"Required FeSO4 for 100ppm of hardness is\",W1,\"ppm pf FeSO4\"\n",
      "print\"\\nRequired FeSO4 for 210.5ppm of hardness is \",round(B,1),\"ppm of FeSO4\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Required FeSO4 for 100ppm of hardness is 136 ppm pf FeSO4\n",
        "\n",
        "Required FeSO4 for 210.5ppm of hardness is  286.3 ppm of FeSO4\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.3,Page no:173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=162.0 #Ca(HCO3)2 in water in mg/lit#\n",
      "W2=73.0 #MgHCO3 in water in mg/lit#\n",
      "W3=136.0 #CaSO4 in water in mg/lit#\n",
      "W4=95.0 #MgCl2 in water in mg/lit#\n",
      "W5=111.0 #CaCl2 in water in mg/lit#\n",
      "W6=100.0 #NaCl in water in mg/lit#\n",
      "M1=100/162.0 #multiplication factor of Ca(HCO3)2#\n",
      "M2=100/146.0 #multiplication factor of MgHCO3#\n",
      "M3=100/136.0 #multiplication factor of CaSO4#\n",
      "M4=100/95.0 #multiplication factor of MgCl2#\n",
      "M5=100/111.0 #multiplication factor of CaCl2#\n",
      "M6=100/100.0 #multiplication factor of NaCl#\n",
      "\n",
      "#Calculation\n",
      "P1=W1*M1 #Ca(HCO3)2 in terms of CaCO3 or #\n",
      "P2=W2*M2 #MgHCO3 in terms of CaCO3 or #\n",
      "P3=W3*M3 #CaSO4  in terms of CaCO3 or #\n",
      "P4=W4*M4 #MgCl2 in terms of CaCO3 or #\n",
      "P5=W5*M5 #CaCl2 in terms of CaCO3 or #\n",
      "T=P1+P2 \n",
      "P=P3+P4+P5 \n",
      "\n",
      "#Result\n",
      "print\"\\nTemporary hardness is\",T,\"mg/l or ppm\" \n",
      "print\"\\nPermanant hardness is\",P,\"mg/l or ppm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Temporary hardness is 150.0 mg/l or ppm\n",
        "\n",
        "Permanant hardness is 300.0 mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.4,Page no:173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N=0.08 #normality of MgSO4#\n",
      "V1=12.5 #volume of MgSO4 in ml#\n",
      "V2=100 #volume of water sample#\n",
      "\n",
      "#Calculation\n",
      "M=N/2 #molarity of MgSO4#\n",
      "N1=(M*12.5)/1000 #no of moles of MgSO4 in 100 ml water#\n",
      "N2=(N1*1000)/100 #no of moles of MgSO4 in one litre water#\n",
      "W=100 #molecular weight of CaCO3\n",
      "W1=N2*W*1000 #MgSO4 in terms of CaCO3 in mg/lit#\n",
      "\n",
      "#Result\n",
      "print\"\\nThe hardness due to MgSO4 is \",W1,\"mg/l CaCO3 or ppm of CaCO3\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The hardness due to MgSO4 is  500.0 mg/l CaCO3 or ppm of CaCO3\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.5,Page no:173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=144.0 #MgCO3 in water in mg/lit#\n",
      "W2=25.0 #CaCO3 in water in mg/lit#\n",
      "W3=111.0 #CaCl2 in water in mg/lit#\n",
      "W4=95.0 #MgCl2 in water in mg/lit#\n",
      "M1=100/84.0 #multiplication factor of MgCO3#\n",
      "M2=100/100.0 #multiplication factor of CaCO3#\n",
      "M3=100/111.0 #multiplication factor of CaCl2#\n",
      "M4=100/95.0 #multiplication factor of MgCl2#\n",
      "\n",
      "#Calculation\n",
      "P1=W1*M1 #MgCO3 in terms of CaCO3 or ppm#\n",
      "P2=W2*M2 #CaCO3 in terms of CaCO3 or ppm#\n",
      "P3=W3*M3 #CaCl2  in terms of CaCO3 or ppm#\n",
      "P4=W4*M4 #MgCl2 in terms of CaCO3 or ppm#\n",
      "V=50000 #volume of water in lit#\n",
      "L=0.74*(2*P1+P2+P4)*V \n",
      "S=1.06*(P1+P3+P4)*V \n",
      "\n",
      "#Result\n",
      "print\"Requirement of lime is \",L,\"mg=\",round(L/1000000,1),\"kg\" \n",
      "print\"\\nRequirement of soda is \",S,\"mg=\",round(S/1000000,1),\"kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Requirement of lime is  17310714.2857 mg= 17.3 kg\n",
        "\n",
        "Requirement of soda is  19685714.2857 mg= 19.7 kg\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.6,Page no:174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=12.0 #Mg2+ in water in ppm or mg/l#\n",
      "W2=40.0 #Ca2+ in water in ppm or mg/l#\n",
      "W3=164.7 #HCO3- in water in ppm or mg/l#\n",
      "W4=30.8 #CO2 in water in ppm or mg/l#\n",
      "M1=100.0/24.0 #multiplication factor of Mg2+#\n",
      "M2=100.0/40.0 #multiplication factor of Mg2+#\n",
      "M3=100.0/61.0 #multiplication factor of Mg2+#\n",
      "M4=100.0/44.0 #multiplication factor of Mg2+#\n",
      "\n",
      "#Calculation\n",
      "P1=W1*M1 # in terms of CaCO3#\n",
      "P2=W2*M2 # in terms of CaCO3#\n",
      "P3=W3*M3/2 # in terms of CaCO3#\n",
      "P4=W4*M4 # in terms of CaCO3#\n",
      "V=50000.0#volume of water in lit#\n",
      "L=0.74*(P1+P3+P4)*V \n",
      "\n",
      "#Result\n",
      "print\"Lime required is %fmg\",round(L/10**6,1),\"kg\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lime required is %fmg 9.4 kg\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.7,Page no:174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=160.0 #Ca2+ in water in mg/l or ppm#\n",
      "W2=72.0 #Mg2+ in water in mg/l or ppm#\n",
      "W3=732.0 #HCO3- in water in mg/l or ppm#\n",
      "W4=44.0 #CO2 in water in mg/l or ppm#\n",
      "W5=16.4 #NaAlO2 in water in mg/l or ppm#\n",
      "W6=30.0 #(CO3)2- in water in mg/l or ppm#\n",
      "W7=17.0 #OH- in water in mg/l or ppm#\n",
      "\n",
      "#Calculation\n",
      "M1=100/40.0 #multiplication factor of Ca2+#\n",
      "M2=100/24.0 #multiplication factor of Ca2+#\n",
      "M3=100/(61.0*2.0) #multiplication factor of Ca2+#\n",
      "M4=100/44.0 #multiplication factor of Ca2+#\n",
      "M5=100/(82.0*2.0) #multiplication factor of Ca2+#\n",
      "M6=100/60.0 #multiplication factor of Ca2+#\n",
      "M7=100/(17.0*2.0) #multiplication factor of Ca2+#\n",
      "P1=W1*M1 #in terms of CaCO3#\n",
      "P2=W2*M2 #in terms of CaCO3#\n",
      "P3=W3*M3 #in terms of CaCO3#\n",
      "P4=W4*M4 #in terms of CaCO3#\n",
      "P5=W5*M5 #in terms of CaCO3#\n",
      "P6=W6*M6 #in terms of CaCO3#\n",
      "P7=W7*M7 #in terms of CaCO3#\n",
      "V=200000.0 #volume of water in lit#\n",
      "L=0.74*(P2+P3+P4-P5+P7)*V \n",
      "L=L/10.0**6.0 #in kgs#\n",
      "S=1.06*(P1+P2-P3-P5-P6+P7)*V \n",
      "S=S/10.0**6 #in kgs#\n",
      "\n",
      "#Result\n",
      "print\"Lime required is \",L,\"kg\"\n",
      "print\"\\nSoda required is \",S,\"kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lime required is  153.92 kg\n",
        "\n",
        "Soda required is  19.08 kg\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.8,Page no:175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N=150.0 #amount of NaCl in solution in g/l#\n",
      "V=8.0 #volume of NaCl solution#\n",
      "\n",
      "#Calculation\n",
      "M=N*V \n",
      "V=10000.0 #volume of hard water#\n",
      "W=58.5 #molecular weight of NaCl#\n",
      "K=(M*100.0/(W*2))/V \n",
      "J=K*1000.0 \n",
      "\n",
      "#Result\n",
      "\n",
      "print\"\\nHardness of water is \",round(J,1),\"mg/l or ppm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Hardness of water is  102.6 mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.9,Page no:176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=219.0 #amount of Mg(HCO3)2 in water in ppm#\n",
      "W2=36.0 #amount of Mg2+ in water in ppm#\n",
      "W3=18.3 #amount of (HCO3)- in water in ppm#\n",
      "W4=1.5 #amount of H+_in water in ppm#\n",
      "M1=100/146.0 #multiplication factor of Mg(HCO3)2#\n",
      "M2=100/24.0 #multiplication factor of Mg(HCO3)2#\n",
      "M3=100/122.0 #multiplication factor of Mg(HCO3)2#\n",
      "M4=100/2.0 #multiplication factor of Mg(HCO3)2#\n",
      "\n",
      "#Calculation\n",
      "P1=W1*M1 #in terms of CaCO3#\n",
      "P2=W2*M2 #in terms of CaCO3#\n",
      "P3=W3*M3 #in terms of CaCO3#\n",
      "P4=W4*M4 #in terms of CaCO3#\n",
      "L=0.74*((2*P1)+P2+P3+P4) \n",
      "\n",
      "R=1.0 #water supply rate in m**3/s#\n",
      "D=R*60.0*60.0*24.0*L \n",
      "K=D*1000.0 #in lit/day#\n",
      "T=K/10.0**9 #in tonnes#\n",
      "S=1.06*(P2+P4-P3) \n",
      "D2=R*60*60*24*S \n",
      "A=D2*1000 #in lit/day#\n",
      "B=A/10.0**9 #in tonnes#\n",
      "J1=90/100.0 #purity of lime#\n",
      "J2=95/100.0 #purity of soda#\n",
      "C1=500.0 #cost of one tonne lime#\n",
      "C2=7000.0 #cost of one tonne soda#\n",
      "CL=round(T,1)*C1/J1 \n",
      "print\"\\ncost of lime is\",CL,\"Rs\"\n",
      "CS=round(B,1)*C2/J2 \n",
      "print\"\\ncost of soda is \",CS,\"Rs\"\n",
      "C=CL+CS \n",
      "\n",
      "#Result\n",
      "print\"\\ntotal cost is \",round(C) ,\"Rs\"\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "cost of lime is 19166.6666667 Rs\n",
        "\n",
        "cost of soda is  141473.684211 Rs\n",
        "\n",
        "total cost is  160640.0 Rs\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.10,Page no:176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=40.0 #amount of Ca2+ in water in mg/l#\n",
      "W2=24.0 #amount of Mg2+ in water in mg/l#\n",
      "W3=8.05 #amount of Na+ in water in mg/l#\n",
      "W4=183.0 #amount of (HCO3)- in water in mg/l#\n",
      "W5=55.68 #amount of (SO4)2- in water in mg/l#\n",
      "W6=6.74 #amount of Cl- in water in mg/l#\n",
      "M1=100/40.0 #multiplication factor of Ca2+#\n",
      "M2=100/24.0 #multiplication factor of Mg2+#\n",
      "M3=100/(23.0*2) #multiplication factor of Na+#\n",
      "M4=100/(61.0*2) #multiplication factor of (HCO3)-#\n",
      "M5=100/96.0 #multiplication factor of (SO4)2-#\n",
      "M6=100/(35.5*2) #multiplication factor of Cl-#\n",
      "\n",
      "#Calculation\n",
      "P1=W1*M1 #in terms of CaCO3#\n",
      "P2=W2*M2 #in terms of CaCO3#\n",
      "P3=W3*M3 #in terms of CaCO3#\n",
      "P4=W4*M4 #in terms of CaCO3#\n",
      "P5=W5*M5 #in terms of CaCO3#\n",
      "P6=W6*M6 #in terms of CaCO3#\n",
      "\n",
      "\n",
      "#Result\n",
      "print\"\\nCalcium alkalinity =\",P1,\"ppm\" \n",
      "print\"\\nMagnesium alkalinity =\",P4-P1,\"ppm\"\n",
      "print\"\\n  total alkalinity = \",P1+P4-P1,\"ppm\"\n",
      "print\"\\n  total hardness = \",P1+P2,\"ppm\"\n",
      "print\"\\nCa temporary hardness = \",P1,\"ppm\"\n",
      "print\"\\nMg temporary hardness = \",P4-P1,\"ppm\"\n",
      "print\"\\nMg permanant hardness = \",P2-(P4-P1),\"ppm\"\n",
      "print\"\\nSalts are:\"\n",
      "print\"\\nCa(HCO3)2 salt = \",P1,\"ppm\"\n",
      "print\"\\nMg(HCO3)2 salt = \",P4-P1,\"ppm\"\n",
      "print\"\\nMgSO4 salt = \",P2-(P4-P1),\"ppm\"\n",
      "print\"\\nNaCl salt = \",P6,\"ppm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Calcium alkalinity = 100.0 ppm\n",
        "\n",
        "Magnesium alkalinity = 50.0 ppm\n",
        "\n",
        "  total alkalinity =  150.0 ppm\n",
        "\n",
        "  total hardness =  200.0 ppm\n",
        "\n",
        "Ca temporary hardness =  100.0 ppm\n",
        "\n",
        "Mg temporary hardness =  50.0 ppm\n",
        "\n",
        "Mg permanant hardness =  50.0 ppm\n",
        "\n",
        "Salts are:\n",
        "\n",
        "Ca(HCO3)2 salt =  100.0 ppm\n",
        "\n",
        "Mg(HCO3)2 salt =  50.0 ppm\n",
        "\n",
        "MgSO4 salt =  50.0 ppm\n",
        "\n",
        "NaCl salt =  9.49295774648 ppm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.11,Page no:177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P=0.0 #phenolplthalein alkalinity in water sample#\n",
      "V=16.9 #required HCl in ml for 100 ml water sample#\n",
      "N=0.02 #normality of HCl#\n",
      "print\"Since P=0 the alkalinity is due to HCO3- ions\" \n",
      "C=50.0 #equivalent of CaCO3 in mg for 1 ml 1N of HCl#\n",
      "\n",
      "#Calculation\n",
      "A=C*V*N \n",
      "print\"\\nIn 100ml water sample the alkalinity is\",A,\"mg/s\"\n",
      "B=A*1000.0/100.0\n",
      "\n",
      "#Result\n",
      "print\"\\nFor 1 litre of water the alkalinity is \",B,\"mg/l\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Since P=0 the alkalinity is due to HCO3- ions\n",
        "\n",
        "In 100ml water sample the alkalinity is 16.9 mg/s\n",
        "\n",
        "For 1 litre of water the alkalinity is  169.0 mg/l\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.12,Page no:178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P=4.7 #required HCl in ml using HpH indicator #\n",
      "H=10.5 #required HCl im ml using MeOH indicator#\n",
      "M=P+H \n",
      "N=0.02 #normality of HCl#\n",
      "\n",
      "print\"\\nSince P<0.5*M sample contain (CO3)2- and (HCO3)- alkalinity\"\n",
      "C=50 #equivalent of CaCO3 in mg for 1ml 1N HCl#\n",
      "\n",
      "#Calculation\n",
      "A=C*(2*P)*N #amount of (CO3)2- alkalinity in mg in 100 ml of water#\n",
      "B=A*1000/100 \n",
      "D=C*(M-2*P)*N #the amount of (HCO3)- alkalinity in mg in 100 ml of water#\n",
      "E=D*1000/100 \n",
      "T=B+E \n",
      "\n",
      "#Result\n",
      "print\"\\nTotal alkalinity is \",T,\"mg/l or ppm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Since P<0.5*M sample contain (CO3)2- and (HCO3)- alkalinity\n",
        "\n",
        "Total alkalinity is  152.0 mg/l or ppm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.13,Page no:178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=160.0 #amount of Ca2+ in ppm#\n",
      "W2=88.0 #amount of Mg2+ in ppm#\n",
      "W3=72.0 #amount of CO2 in ppm#\n",
      "W4=488.0 #amount of (HCO3)- in ppm#\n",
      "W5=139.0 #amount of (FeSO4).7H2O in ppm#\n",
      "M1=100/40.0 #multiplication factor of Ca2+#\n",
      "M2=100/24.0 #multiplication factor of Mg2+#\n",
      "M3=100/44.0 #multiplication factor of CO2#\n",
      "M4=100/(61.0*2.0) #multiplication factor of (HCO3)-#\n",
      "M5=100/278.0 #multiplication factor of (FeSO4).7H2O#\n",
      "\n",
      "P1=400 #in terms of CaCO3#\n",
      "P2=300 #in terms of CaCO3#\n",
      "P3=200 #in terms of CaCO3#\n",
      "P4=400 #in terms of CaCO3#\n",
      "P5=50 #in terms of CaCO3#\n",
      "V=100000.0 #volume of water in litres#\n",
      "\n",
      "\n",
      "#Calculation\n",
      "L=0.74*(P2+P3+P4+P5)*V #lime required in mg#\n",
      "L=L/10.0**6 \n",
      "S=1.06*(P1+P2+P5-P4)*V #soda required in mg#\n",
      "S=S/10.0**6 \n",
      "\n",
      "#Result\n",
      "print\"Lime required is \",L,\"kg\"\n",
      "print\"\\nSoda required is \",S,\"kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lime required is  70.3 kg\n",
        "\n",
        "Soda required is  37.1 kg\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.14,Page no:179"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W=50 #amount of NaCl in g/l in NaCl solution#\n",
      "V=200 #volume of NaCl solution in litres#\n",
      "\n",
      "#Calculation\n",
      "A=W*V \n",
      "V=10000 #volume of hard water passed through Zeolite softener#\n",
      "M=100/(58.5*2) #multiplication factor of NaCl#\n",
      "P=M*A \n",
      "B=P*1000/V \n",
      "\n",
      "#Result\n",
      "print\"\\nIn terms of CaCO3=\",round(P),\"g CaCO3\"\n",
      "print\"\\nFor 1 litre of hard water=\",round(B,1),\"mg/l or ppm\"\n",
      "print\"NOTE:In book answer wrongly written as 845.7\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "In terms of CaCO3= 8547.0 g CaCO3\n",
        "\n",
        "For 1 litre of hard water= 854.7 mg/l or ppm\n",
        "NOTE:In book answer wrongly written as 845.7\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:7.15,Page no:179"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "W1=0.28 #amount of CaCO3 in grams dissolved in 1 litre of water#\n",
      "V1=28 #required EDTA in ml on titration of 100ml of CaCO3 solution#\n",
      "V2=33 #required EDTA in ml for 100ml of unknown hard water sample#\n",
      "V3=10 #required EDTA in ml for 100 ml of unknown sample after boiling and cooling#\n",
      "M1=100/100 #multiplication factor of CaCO3#\n",
      "\n",
      "#Calculation\n",
      "C=W1*M1 \n",
      "A=C*100#for 100 ml of sample equivalent to 28 ml of EDTA#\n",
      "B=A/V1 \n",
      "D=V2*B #for 100 ml#\n",
      "D=D*1000/100 \n",
      "E=V3*B #for 100 ml#\n",
      "E=E*1000/100 \n",
      "T=D-E \n",
      "\n",
      "#Result\n",
      "print\"Total hardness is \",D,\"mg CaCO3 eq\"\n",
      "print\"\\nPermanant hardness is \",E,\"mg CaCO3 eq\"\n",
      "print\"\\nTemporary hardness is \",T,\"mg CaCO3\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total hardness is  330.0 mg CaCO3 eq\n",
        "\n",
        "Permanant hardness is  100.0 mg CaCO3 eq\n",
        "\n",
        "Temporary hardness is  230.0 mg CaCO3\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}