{ "metadata": { "name": "", "signature": "sha256:2d2c58ce752ea004ea6f79edf5332f8f357b96a3e81270455c238eb5e0794fa8" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 1 - matter and its atomic nature" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 1 - pg 3" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the Angle required\n", "#Initialization of variables\n", "import math\n", "l=0.71 *10**-8 #cm\n", "n=200. #lines/cm\n", "v=0.00145 #radian\n", "#calculations\n", "d=1/n\n", "phi2=2*l/d +v**2\n", "phi=math.sqrt(phi2)\n", "#results\n", "print '%s %.2e %s' %('Angle required =',phi,'radian')\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Angle required = 2.22e-03 radian\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2 - pg 6" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the Interplanar distance\n", "#Initialization of variables\n", "import math\n", "angle=37.25 #degrees\n", "l=1.539 #A\n", "n=1. #order\n", "#calculations\n", "d=n*l/(2*math.sin(angle/180.*math.pi))\n", "#results\n", "print '%s %.3f %s' %(\"Interplanar distance =\",d,\"A\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Interplanar distance = 1.271 A\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 5 - pg 18" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the ratio of radii\n", "#Initialization of variables\n", "import math\n", "r1=math.sqrt(3.)\n", "r2=1\n", "#calculations\n", "ratio=r1-r2\n", "#results\n", "print '%s %.3f' %('Ratio of radii =',ratio)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Ratio of radii = 0.732\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 6 - pg 21" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the Avagadro number\n", "#Initialization of variables\n", "d=2.64 #g/cc\n", "l=4.016*10**-8 #cm\n", "n=4\n", "M=25.94 #g/mol\n", "#calculations\n", "m=d*l**3 /n\n", "N0=M/m\n", "#results\n", "print '%s %.3e %s' %(\"Avagadro number =\",N0,\" molecule/mol\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Avagadro number = 6.068e+23 molecule/mol\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 10 - pg 28" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#calculate the angle required\n", "#Initialization of variables\n", "import math\n", "import numpy\n", "A=numpy.array([-1, -1, -1 ])\n", "B=numpy.array([1, 1, -1])\n", "#calculations\n", "Ad=math.sqrt(1+1+1)\n", "Bd=math.sqrt(1+1+1)\n", "dot=numpy.dot(A,B) /(Ad*Bd) \n", "theta=math.acos(dot) *180./math.pi\n", "#results\n", "print '%s %.2f %s' %(\"Angle =\",theta,\" degrees\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Angle = 109.47 degrees\n" ] } ], "prompt_number": 5 } ], "metadata": {} } ] }