diff options
author | Prashant S | 2020-04-14 10:25:32 +0530 |
---|---|---|
committer | GitHub | 2020-04-14 10:25:32 +0530 |
commit | 06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch) | |
tree | 2b1df110e24ff0174830d7f825f43ff1c134d1af /Chemistry_by_R_Chang/15-Acids_and_Bases.ipynb | |
parent | abb52650288b08a680335531742a7126ad0fb846 (diff) | |
parent | 476705d693c7122d34f9b049fa79b935405c9b49 (diff) | |
download | all-scilab-tbc-books-ipynb-master.tar.gz all-scilab-tbc-books-ipynb-master.tar.bz2 all-scilab-tbc-books-ipynb-master.zip |
Initial commit
Diffstat (limited to 'Chemistry_by_R_Chang/15-Acids_and_Bases.ipynb')
-rw-r--r-- | Chemistry_by_R_Chang/15-Acids_and_Bases.ipynb | 486 |
1 files changed, 486 insertions, 0 deletions
diff --git a/Chemistry_by_R_Chang/15-Acids_and_Bases.ipynb b/Chemistry_by_R_Chang/15-Acids_and_Bases.ipynb new file mode 100644 index 0000000..42c11d1 --- /dev/null +++ b/Chemistry_by_R_Chang/15-Acids_and_Bases.ipynb @@ -0,0 +1,486 @@ +{ +"cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 15: Acids and Bases" + ] + }, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.10: Computation_of_pH_for_weak_base_of_given_molarity.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of pH for weak base of given molarity\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.10\n');\n", +"\n", +"InitNH3=0.4;//Initial concentration of NH3 solution, M\n", +"\n", +"//Let 'x' be the equilibrium concentration of the [OH-] and [NH4+] ions, M\n", +"\n", +"Kb=1.8*10^-5;//ionisation constant of NH3, M\n", +"x=sqrt(Kb*InitNH3);//from the definition of ionisation constant Kb=[OH-]*[NH4+]/[NH3]=x*x/(InitNH3-x), which reduces to x*x/InitNH3, as x<<InitNH3 (approximation)\n", +"\n", +"approx=x/InitNH3*100;//this is the percentage of approximation taken. if it is more than 5%, we will be having higher deviation from correct value\n", +"\n", +"if(approx>5)\n", +" x1=(-Kb+sqrt((Kb^2)-(-4*1*Kb*InitNH3)))/(2*1);\n", +" x2=(-Kb-sqrt((Kb^2)-(-4*1*Kb*InitNH3)))/(2*1);\n", +"\n", +" if(x1>0)//as only one root is positive\n", +" x=x1;\n", +" else \n", +" x=x2;\n", +" end\n", +"end;\n", +"\n", +"pOH=-log10(x);//since x is the conc. of [H+] ions\n", +"\n", +"pH=14-pOH;\n", +"\n", +"printf('\t the pH of the NH3 solution is : %4.2f \n',pH);\n", +"\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.11: Computation_of_concentration_of_all_the_species_in_solution_of_Oxalic_acid.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of concentration of all the species in solution of Oxalic acid\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.11\n');\n", +"\n", +"InitC2H2O4=0.1;//Initial concentration of C2H2O4 solution, M\n", +"\n", +"//Let 'x1' be the equilibrium concentration of the [H+] and [C2HO4-] ions, M\n", +"\n", +"//First stage of ionisation\n", +"\n", +"Kw=10^-14;//ionic product of water, M^2\n", +"Ka1=6.5*10^-2;//ionisation constant of C2H2O4, M\n", +"x=sqrt(Ka1*InitC2H2O4);//from the definition of ionisation constant Ka1=[H+]*[C2HO4-]/[C2H2O4]=x*x/(InitC2H2O4-x), which reduces to x*x/InitC2H2O4, as x<<InitC2H2O4 (approximation)\n", +"\n", +"approx=x/InitC2H2O4*100;//this is the percentage of approximation taken. if it is more than 5%, we will be having higher deviation from correct value\n", +"\n", +"if(approx>5)\n", +" x1=(-Ka1+sqrt((Ka1^2)-(-4*1*Ka1*InitC2H2O4)))/(2*1);\n", +" x2=(-Ka1-sqrt((Ka1^2)-(-4*1*Ka1*InitC2H2O4)))/(2*1);\n", +"\n", +" if(x1>0)//as only one root is positive\n", +" x=x1;\n", +" else \n", +" x=x2;\n", +" end\n", +"end;\n", +"C2H2O4=InitC2H2O4-x;//equilibrium value\n", +"printf('\t the concentration of the C2H2O4 in the solution is : %4.3f M\n',C2H2O4);\n", +"\n", +"\n", +"//Second stage of ionisation\n", +"\n", +"InitC2HO4=x;//concentration of C2HO4 from first stage of ionisation\n", +"\n", +"Ka2=6.1*10^-5;//ionisation constant of C2HO4-, M\n", +"\n", +"//Let 'y' be the concentration of the [C2HO4-] dissociated to form [H+] and [C2HO4-] ions, M\n", +"y=Ka2;//from the definition of ionisation constant Ka2=[H+]*[C2O4-2]/[C2HO4-]=(0.054+y)*y/(0.054-y), which reduces to y, as y<<InitC2HO4 (approximation)\n", +"\n", +"approx=y/InitC2HO4*100;//this is the percentage of approximation taken. if it is more than 5%, we will be having higher deviation from correct value\n", +"\n", +"if(approx>5)\n", +" x1=(-Ka2+sqrt((Ka2^2)-(-4*1*Ka2*InitC2HO4)))/(2*1);\n", +" x2=(-Ka2-sqrt((Ka2^2)-(-4*1*Ka2*InitC2HO4)))/(2*1);\n", +"\n", +" if(x1>0)//as only one root is positive\n", +" y=x1;\n", +" else \n", +" y=x2;\n", +" end\n", +"end;\n", +"\n", +"C2HO4=InitC2HO4-y;//from first and second stages of ionisation\n", +"H=x+y;//from first and second stages of ionisation\n", +"C2O4=y;//from the assumption\n", +"OH=Kw/H;// From the formula (ionic product)Kw=[H+]*[OH-]\n", +"\n", +"printf('\t the concentration of the [C2HO4-] ion in the solution is : %4.3f M\n',C2HO4);\n", +"printf('\t the concentration of the [H+] ion in the solution is : %4.3f M\n',H);\n", +"printf('\t the concentration of the [C2O4-2] ion in the solution is : %4.1f*10^-5 M\n',C2O4*10^5);\n", +"printf('\t the concentration of the [OH-] ion in the solution is : %f*10^-13 M\n',OH*10^13);\n", +"\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.13: Computation_of_pH_for_a_solution_of_salt_of_weak_acid_and_strong_base.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of pH for a solution of salt of weak acid and strong base\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.13\n');\n", +"\n", +"InitCH3COONa=0.15;//Initial concentration of CH3COONa solution, M\n", +"\n", +"InitCH3COO=InitCH3COONa;//concentration of [CH3COO-] ion after dissociation of CH3COONa solution, M\n", +"//Let 'x' be the equilibrium concentration of the [OH-] and [CH3COOH] ions after hydrolysis of [CH3COO-], M\n", +"\n", +"Kb=5.6*10^-10;//equilibrium constant of hydrolysis, M\n", +"\n", +"x=sqrt(Kb*InitCH3COO);//from the definition of ionisation constant Kb=[OH-]*[CH3COOH]/[CH3COO-]=x*x/(0.15-x), which reduces to x*x/0.15, as x<<0.15 (approximation)\n", +"\n", +"approx=x/InitCH3COO*100;//this is the percentage of approximation taken. if it is more than 5%, we will be having higher deviation from correct value\n", +"\n", +"if(approx>5)\n", +" x1=(-Kb+sqrt((Kb^2)-(-4*1*Kb*InitCH3COO)))/(2*1);\n", +" x2=(-Kb-sqrt((Kb^2)-(-4*1*Kb*InitCH3COO)))/(2*1);\n", +"\n", +" if(x1>0)//as only one root is positive\n", +" x=x1;\n", +" else \n", +" x=x2;\n", +" end\n", +"end;\n", +"\n", +"pOH=-log10(x);//since x is the conc. of [OH-] ions\n", +"pH=14-pOH;\n", +"\n", +"printf('\t the pH of the salt solution is : %4.2f \n',pH);\n", +"\n", +"percenthydrolysis=x/InitCH3COO*100;\n", +"printf('\t the percentage of hydrolysis of the salt solution is : %5.4f percent\n',percenthydrolysis);\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.2: computation_of_hydronium_ion_concentration_from_hydroxide_ion_concentration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// computation of [H+] ion concentration from [OH-] ion concentration\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.2\n');\n", +"\n", +"OH=0.0025 ;// [OH-] ion concentration, M\n", +"Kw=1*10^-14 ;// ionic product of water, M^2\n", +"\n", +"H=Kw/OH; // From the formula (ionic product)Kw=[H+]*[OH-]\n", +"printf('\t The [H+] ion concentration of the solution is : %3.1f*10^-12 M\n',H*10^12);\n", +"\n", +"//end" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.3: Computation_of_pH_of_a_solution_from_hydonium_ion_concentration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of pH of a solution from [H+] ion concentration\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.3\n');\n", +"\n", +"H1=3.2*10^-4; //Concentration of [H+] ion on first occasion, M\n", +"\n", +"pH1=-log10(H1);//from the definition of pH\n", +"printf('\t pH of the solution on first occasion is: %4.2f \n',pH1);\n", +"\n", +"H2=1*10^-3; //Concentration of [H+] ion on second occasion, M\n", +"\n", +"pH2=-log10(H2);//from the definition of pH\n", +"printf('\t pH of the solution on second occasion is : %4.2f \n',pH2);\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.4: Computation_of_hydronium_ion_concentration_from_pH.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of [H+] ion concentration from pH\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.4\n');\n", +"\n", +"pH=4.82;//Given\n", +"H=10^(-pH);//Concentration of [H+] ion, M, formula from the definition of pH\n", +"\n", +"printf('\t The [H+] ion concentration of the solution is : %3.1f*10^-5 M\n',H*10^5);\n", +"\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.5: Computation_of_pH_of_a_solution_from_hydroxide_ion_concentration.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of pH of a solution from [OH-] ion concentration\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.5\n');\n", +"\n", +"OH=2.9*10^-4;//Concentration of [OH-] ion, M\n", +"\n", +"pOH=-log10(OH);//by definition of p(OH)\n", +"\n", +"pH=14-pOH;\n", +"\n", +"printf('\t the pH of the solution is : %4.2f \n',pH);\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.6: Computation_of_pH_of_solutions_for_solutions_of_given_concentrations.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of pH of solutions for solutions of given concentrations\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.6\n');\n", +"\n", +"//for HCL solution\n", +"\n", +"ConcHCl=1*10^-3;//Concentration of HCl solution, M\n", +"H=ConcHCl;//Concentration of [H+] ion after ionisation of HCl\n", +"pH=-log10(H);\n", +"printf('\t the pH of the HCl solution is : %4.2f \n',pH);\n", +"\n", +"//for Ba(OH)2 solution\n", +"\n", +"ConcBaOH2=0.02;//Concentration of Ba(OH)2 solution, M\n", +"OH=ConcBaOH2*2;//Concentration of [OH-] ion after ionisation of Ba(OH)2 as two ions are generated per one molecule of Ba(OH)2\n", +"pOH=-log10(OH);\n", +"pH2=14-pOH;\n", +"printf('\t the pH of the Ba(OH)2 solution is : %4.2f \n',pH2);\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.8: Computation_of_pH_for_weak_acid.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of pH for weak acid\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.8\n');\n", +"\n", +"InitHNO2=0.036;//Initial concentration of HNO2 solution, M\n", +"\n", +"//Let 'x' be the equilibrium concentration of the [H+] and [NO2-] ions, M\n", +"\n", +"Ka=4.5*10^-4;//ionisation constant of HNO2, M\n", +"x=sqrt(Ka*InitHNO2);//from the definition of ionisation constant Ka=[H+]*[NO2-]/[HNO2]=x*x/(0.036-x), which reduces to x*x/0.036, as x<<InitHNO2 (approximation)\n", +"\n", +"approx=x/InitHNO2*100;//this is the percentage of approximation taken. if it is more than 5%, we will be having higher deviation from correct value\n", +"\n", +"if(approx>5)\n", +" x1=(-Ka+sqrt((Ka^2)-(-4*1*Ka*InitHNO2)))/(2*1);\n", +" x2=(-Ka-sqrt((Ka^2)-(-4*1*Ka*InitHNO2)))/(2*1);\n", +"\n", +" if(x1>0)//as only one root is positive\n", +" x=x1;\n", +" else \n", +" x=x2;\n", +" end\n", +"end;\n", +"\n", +"pH=-log10(x);//since x is the conc. of [H+] ions\n", +"\n", +"printf('\t the pH of the HNO2 solution is : %4.2f \n',pH);\n", +"\n", +"\n", +"//End" + ] + } +, +{ + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 15.9: Computation_of_ionisation_constant_from_pH_of_a_weak_acid.sce" + ] + }, + { +"cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], +"source": [ +"// Computation of ionisation constant from pH of a weak acid\n", +"\n", +"clear;\n", +"clc;\n", +"\n", +"printf('\t Example 15.9\n');\n", +"\n", +"pH=2.39;// pH of the HCOOH acid solution\n", +"\n", +"InitHCOOH=0.1;//initial concentration of the solution\n", +"H=10^(-pH);//[H+] ion concentration from the definition of pH, M\n", +"\n", +"Ka=(H^2)/(InitHCOOH-H);//ionisation constant of the acid, M, Ka=[H+]*[HCOO-]/[HCOOH]\n", +"\n", +"printf('\t the ionisation constant of the given solution is : %4.2f*10^-4 M \n',10^4*Ka);\n", +"\n", +"//End" + ] + } +], +"metadata": { + "kernelspec": { + "display_name": "Scilab", + "language": "scilab", + "name": "scilab" + }, + "language_info": { + "file_extension": ".sce", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "scilab", + "version": "0.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |