{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 1: Bonding in Solids" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 1, Page number 1.21" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-2*a/r**3 + 90*b/r**11\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "from sympy import *\n", "import numpy as np\n", "\n", "#Variable declaration\n", "n=1;\n", "m=9;\n", "a=Symbol('a')\n", "b=Symbol('b')\n", "r=Symbol('r')\n", "\n", "#Calculation\n", "y=(-a/(r**n))+(b/(r**m));\n", "y=diff(y,r);\n", "y=diff(y,r);\n", "\n", "#Result\n", "print y" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "young's modulus is 157 GPa\n" ] } ], "source": [ "#since the values of a,b,r are declared as symbols in the above cell, it cannot be solved there. hence it is being solved here with the given variable declaration\n", "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "a=7.68*10**-29; \n", "r0=2.5*10**-10; #radius(m)\n", "\n", "#Calculation\n", "b=a*(r0**8)/9;\n", "y=((-2*a*r0**8)+(90*b))/r0**11; \n", "E=y/r0; #young's modulus(Pa)\n", "\n", "#Result\n", "print \"young's modulus is\",int(E/10**9),\"GPa\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example number 2, Page number 1.22" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "effective charge is 0.72 *10**-19 coulomb\n", "answer given in the book is wrong\n" ] } ], "source": [ "#importing modules\n", "import math\n", "from __future__ import division\n", "\n", "#Variable declaration\n", "dm=1.98*10**-29/3; #dipole moment\n", "l=0.92*10**-10; #bond length(m)\n", "\n", "#Calculation\n", "ec=dm/l; #effective charge(coulomb)\n", "\n", "#Result\n", "print \"effective charge is\",round(ec*10**19,2),\"*10**-19 coulomb\"\n", "print \"answer given in the book is wrong\"" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.11" } }, "nbformat": 4, "nbformat_minor": 0 }