summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrupti Kini2015-12-23 23:30:09 +0600
committerTrupti Kini2015-12-23 23:30:09 +0600
commita7fe2ac0177fd9c64dc1dfdfb11e85d4095a6501 (patch)
tree21a09a0c06dbddf91c25d4d6265058a6f7c47a00
parent5d4ad197775046773493a55d4ae90b7e7a8cd51e (diff)
downloadPython-Textbook-Companions-a7fe2ac0177fd9c64dc1dfdfb11e85d4095a6501.tar.gz
Python-Textbook-Companions-a7fe2ac0177fd9c64dc1dfdfb11e85d4095a6501.tar.bz2
Python-Textbook-Companions-a7fe2ac0177fd9c64dc1dfdfb11e85d4095a6501.zip
Added(A)/Deleted(D) following books
A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/Chapter9_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter1_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter2_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter3_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter4_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter6_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter7_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter8_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter_5_2.ipynb A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex1.2_2.png A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex3.13_2.png A Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex6.7_2.png A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter1.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter10.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter11.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter2.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter3.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter4.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter5.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter6.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter7.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter8.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter9.ipynb A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(56).png A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(57).png A _Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(58).png A sample_notebooks/VarunSakpal/chapter_2.ipynb
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/Chapter9_2.ipynb427
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter1_2.ipynb633
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter2_2.ipynb2194
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter3_2.ipynb1113
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter4_2.ipynb888
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter6_2.ipynb1068
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter7_2.ipynb761
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter8_2.ipynb1098
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter_5_2.ipynb366
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex1.2_2.pngbin0 -> 19571 bytes
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex3.13_2.pngbin0 -> 16157 bytes
-rw-r--r--Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex6.7_2.pngbin0 -> 25877 bytes
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter1.ipynb993
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter10.ipynb624
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter11.ipynb774
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter2.ipynb1065
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter3.ipynb787
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter4.ipynb1632
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter5.ipynb1096
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter6.ipynb923
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter7.ipynb298
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter8.ipynb398
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter9.ipynb356
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(56).pngbin0 -> 203140 bytes
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(57).pngbin0 -> 207547 bytes
-rw-r--r--_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(58).pngbin0 -> 211548 bytes
-rw-r--r--sample_notebooks/VarunSakpal/chapter_2.ipynb600
27 files changed, 18094 insertions, 0 deletions
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/Chapter9_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/Chapter9_2.ipynb
new file mode 100644
index 00000000..ed702744
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/Chapter9_2.ipynb
@@ -0,0 +1,427 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:355541e90dba9a8d43b842e0fe28ab8938c872697589fddf3fc55c333074b753"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter09:Numerical Solution of Partial Differential Equations"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.1:pg-350"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#standard five point formula\n",
+ "#example 9.1\n",
+ "#page 350\n",
+ "\n",
+ "u2=5.0;u3=1.0;\n",
+ "for i in range(0,3):\n",
+ " u1=(u2+u3+6.0)/4.0\n",
+ " u2=(u1/2.0)+(5.0/2.0)\n",
+ " u3=(u1/2.0)+(1.0/2.0)\n",
+ " print\" the values are u1=%d\\t u2=%d\\t u3=%d\\t\\n\\n\" %(u1,u2,u3)\n",
+ " \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " the values are u1=3\t u2=4\t u3=2\t\n",
+ "\n",
+ "\n",
+ " the values are u1=3\t u2=4\t u3=2\t\n",
+ "\n",
+ "\n",
+ " the values are u1=3\t u2=4\t u3=2\t\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.2:pg-351"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#solution of laplace equation by jacobi method,gauss-seidel method and SOR method\n",
+ "#example 9.2\n",
+ "#page 351\n",
+ "u1=0.25\n",
+ "u2=0.25\n",
+ "u3=0.5\n",
+ "u4=0.5 #initial values\n",
+ "print \"jacobis iteration process\\n\\n\"\n",
+ "print\"u1\\t u2\\t u3\\t u4\\t \\n\\n\"\n",
+ "print \"%f\\t %f\\t %f\\t %f\\t \\n\" %(u1,u2,u3,u4)\n",
+ "for i in range(0,7):\n",
+ " u11=(0+u2+0+u4)/4\n",
+ " u22=(u1+0+0+u3)/4\n",
+ " u33=(1+u2+0+u4)/4\n",
+ " u44=(1+0+u3+u1)/4\n",
+ " u1=u11\n",
+ " u2=u22\n",
+ " u3=u33\n",
+ " u4=u44\n",
+ " print \"%f\\t %f\\t %f\\t %f\\t \\n\" %(u11,u22,u33,u44) \n",
+ "print \" gauss seidel process\\n\\n\"\n",
+ "u1=0.25\n",
+ "u2=0.3125\n",
+ "u3=0.5625\n",
+ "u4=0.46875 #initial values\n",
+ "print \"u1\\t u2\\t u3\\t u4\\t \\n\\n\"\n",
+ "print \"%f\\t %f\\t %f\\t %f\\t \\n\" %(u1,u2,u3,u4)\n",
+ "for i in range(0,4):\n",
+ "\n",
+ " u1=(0.0+u2+0.0+u4)/4.0\n",
+ " u2=(u1+0.0+0.0+u3)/4.0\n",
+ " u3=(1.0+u2+0.0+u4)/4.0\n",
+ " u4=(1.0+0.0+u3+u1)/4.0\n",
+ " print \"%f\\t %f\\t %f\\t %f\\t \\n\" %(u1,u2,u3,u4) \n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "jacobis iteration process\n",
+ "\n",
+ "\n",
+ "u1\t u2\t u3\t u4\t \n",
+ "\n",
+ "\n",
+ "0.250000\t 0.250000\t 0.500000\t 0.500000\t \n",
+ "\n",
+ "0.187500\t 0.187500\t 0.437500\t 0.437500\t \n",
+ "\n",
+ "0.156250\t 0.156250\t 0.406250\t 0.406250\t \n",
+ "\n",
+ "0.140625\t 0.140625\t 0.390625\t 0.390625\t \n",
+ "\n",
+ "0.132812\t 0.132812\t 0.382812\t 0.382812\t \n",
+ "\n",
+ "0.128906\t 0.128906\t 0.378906\t 0.378906\t \n",
+ "\n",
+ "0.126953\t 0.126953\t 0.376953\t 0.376953\t \n",
+ "\n",
+ "0.125977\t 0.125977\t 0.375977\t 0.375977\t \n",
+ "\n",
+ " gauss seidel process\n",
+ "\n",
+ "\n",
+ "u1\t u2\t u3\t u4\t \n",
+ "\n",
+ "\n",
+ "0.250000\t 0.312500\t 0.562500\t 0.468750\t \n",
+ "\n",
+ "0.195312\t 0.189453\t 0.414551\t 0.402466\t \n",
+ "\n",
+ "0.147980\t 0.140633\t 0.385775\t 0.383439\t \n",
+ "\n",
+ "0.131018\t 0.129198\t 0.378159\t 0.377294\t \n",
+ "\n",
+ "0.126623\t 0.126196\t 0.375872\t 0.375624\t \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.4:pg-354"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#poisson equation\n",
+ "#exaample 9.4\n",
+ "#page 354\n",
+ "u2=0.0;u4=0.0;\n",
+ "print \" u1\\t u2\\t u3\\t u4\\t\\n\\n\"\n",
+ "for i in range(0,6):\n",
+ " u1=(u2/2.0)+30.0\n",
+ " u2=(u1+u4+150.0)/4.0\n",
+ " u4=(u2/2.0)+45.0\n",
+ " print \"%0.2f\\t %0.2f\\t %0.2f\\t %0.2f\\n\" %(u1,u2,u2,u4)\n",
+ "print \" from last two iterates we conclude u1=67 u2=75 u3=75 u4=83\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " u1\t u2\t u3\t u4\t\n",
+ "\n",
+ "\n",
+ "30.00\t 45.00\t 45.00\t 67.50\n",
+ "\n",
+ "52.50\t 67.50\t 67.50\t 78.75\n",
+ "\n",
+ "63.75\t 73.12\t 73.12\t 81.56\n",
+ "\n",
+ "66.56\t 74.53\t 74.53\t 82.27\n",
+ "\n",
+ "67.27\t 74.88\t 74.88\t 82.44\n",
+ "\n",
+ "67.44\t 74.97\t 74.97\t 82.49\n",
+ "\n",
+ " from last two iterates we conclude u1=67 u2=75 u3=75 u4=83\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 59
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.6:pg-362"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#bender-schmidt formula\n",
+ "#example 9.6\n",
+ "#page 362\n",
+ "def f(x):\n",
+ " return (4*x)-(x*x)\n",
+ "#u=[f(0),f(1),f(2),f(3),f(4)]\n",
+ "u1=f(0);u2=f(1);u3=f(2);u4=f(3);u5=f(4);\n",
+ "u11=(u1+u3)/2\n",
+ "u12=(u2+u4)/2\n",
+ "u13=(u3+u5)/2\n",
+ "print \"u11=%0.2f\\t u12=%0.2f\\t u13=%0.2f\\t \\n\" %(u11,u12,u13)\n",
+ "u21=(u1+u12)/2.0\n",
+ "u22=(u11+u13)/2.0\n",
+ "u23=(u12+0)/2.0\n",
+ "print \"u21=%0.2f\\t u22=%0.2f\\t u23=%0.2f\\t \\n\" %(u21,u22,u23)\n",
+ "u31=(u1+u22)/2.0\n",
+ "u32=(u21+u23)/2.0\n",
+ "u33=(u22+u1)/2.0\n",
+ "print \"u31=%0.2f\\t u32=%0.2f\\t u33=%0.2f\\t \\n\" % (u31,u32,u33)\n",
+ "u41=(u1+u32)/2.0\n",
+ "u42=(u31+u33)/2.0\n",
+ "u43=(u32+u1)/2.0\n",
+ "print \"u41=%0.2f\\t u42=%0.2f\\t u43=%0.2f\\t \\n\" % (u41,u42,u43)\n",
+ "u51=(u1+u42)/2.0\n",
+ "u52=(u41+u43)/2.0\n",
+ "u53=(u42+u1)/2.0\n",
+ "print \"u51=%0.2f\\t u52=%0.2f\\t u53=%0.2f\\t \\n\" % (u51,u52,u53)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "u11=2.00\t u12=3.00\t u13=2.00\t \n",
+ "\n",
+ "u21=1.50\t u22=2.00\t u23=1.50\t \n",
+ "\n",
+ "u31=1.00\t u32=1.50\t u33=1.00\t \n",
+ "\n",
+ "u41=0.75\t u42=1.00\t u43=0.75\t \n",
+ "\n",
+ "u51=0.50\t u52=0.75\t u53=0.50\t \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 77
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.7:pg-363"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#bender-schimdt's formula and crank-nicolson formula\n",
+ "#example 9.7\n",
+ "#page 363\n",
+ "#bender -schimdt's formula\n",
+ "import math\n",
+ "from numpy import matrix\n",
+ "z=math.pi\n",
+ "def f(x,t):\n",
+ " return math.exp(z*z*t*-1)*sin(z*x)\n",
+ "#u=[f(0,0),f(0.2,0),f(0.4,0),f(0.6,0),f(0.8,0),f(1,0)]\n",
+ "u1=f(0,0)\n",
+ "u2=f(0.2,0)\n",
+ "u3=f(0.4,0)\n",
+ "u4=f(0.6,0)\n",
+ "u5=f(0.8,0)\n",
+ "u6=f(1.0,0)\n",
+ "u11=u3/2\n",
+ "u12=(u2+u4)/2\n",
+ "u13=u12\n",
+ "u14=u11\n",
+ "print \"u11=%f\\t u12=%f\\t u13=%f\\t u14=%f\\n\\n\" % (u11,u12,u13,u14)\n",
+ "u21=u12/2\n",
+ "u22=(u12+u14)/2\n",
+ "u23=u22\n",
+ "u24=u21\n",
+ "print \"u21=%f\\t u22=%f\\t u23=%f\\t u24=%f\\n\\n\" % (u21,u22,u23,u24)\n",
+ "print \"the error in the solution is: %f\\n\\n\" % (math.fabs(u22-f(0.6,0.04)))\n",
+ "#crank-nicolson formula\n",
+ "#by putting i=1,2,3,4 we obtain four equation\n",
+ "A=matrix([[4, -1, 0, 0] ,[-1, 4, -1, 0],[0, -1, 4, -1],[0, 0, -1, 4]])\n",
+ "C=matrix([[0.9510],[1.5388],[1.5388],[0.9510]])\n",
+ "X=A.I*C\n",
+ "print \"u00=%f\\t u10=%f\\t u20=%f\\t u30=%f\\t\\n\\n\" %(X[0][0],X[1][0],X[2][0],X[3][0])\n",
+ "print \"the error in the solution is: %f\\n\\n\" %(abs(X[1][0]-f(0.6,0.04)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "u11=0.475528\t u12=0.769421\t u13=0.769421\t u14=0.475528\n",
+ "\n",
+ "\n",
+ "u21=0.384710\t u22=0.622475\t u23=0.622475\t u24=0.384710\n",
+ "\n",
+ "\n",
+ "the error in the solution is: 0.018372\n",
+ "\n",
+ "\n",
+ "u00=0.399255\t u10=0.646018\t u20=0.646018\t u30=0.399255\t\n",
+ "\n",
+ "\n",
+ "the error in the solution is: 0.005172\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.8:pg-364"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#heat equation using crank-nicolson method\n",
+ "#example 9.8\n",
+ "#page 364\n",
+ "from numpy import matrix\n",
+ "import math\n",
+ "z=0.01878\n",
+ "#h=1/2 l=1/8,i=1\n",
+ "u01=0.0\n",
+ "u21=1.0/8.0\n",
+ "u11=(u21+u01)/6.0\n",
+ "print \" u11=%f\\n\\n\" % (u11)\n",
+ "print \"error is %f\\n\\n\" % (math.fabs(u11-z))\n",
+ "#h=1/4,l=1/8,i=1,2,3\n",
+ "A=matrix([[-3.0 ,-1.0 ,0.0],[1.0,-3.0,1.0],[0.0,1.0,-3.0]])\n",
+ "C=matrix([[0.0],[0.0],[-0.125]])\n",
+ "#here we found inverese of A then we multipy it with C\n",
+ "X=A.I*C\n",
+ "print \"u12=%f\\n\\n\" % (X[1][0])\n",
+ "print \"error is %f\\n\\n\" %(math.fabs(X[1][0]-z))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " u11=0.020833\n",
+ "\n",
+ "\n",
+ "error is 0.002053\n",
+ "\n",
+ "\n",
+ "u12=0.013889\n",
+ "\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "error is 0.004891\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter1_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter1_2.ipynb
new file mode 100644
index 00000000..4bf3cff1
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter1_2.ipynb
@@ -0,0 +1,633 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:659bf40fd24dcbea56efd9142b8ac03b3b827f2e9c5f83005d90a9bfbf26cc13"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter01:Errors in Numerical Calculations"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.1:pg-7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 1.1\n",
+ "#rounding off\n",
+ "#page 7\n",
+ "a1=1.6583\n",
+ "a2=30.0567\n",
+ "a3=0.859378\n",
+ "a4=3.14159\n",
+ "print \"\\nthe numbers after rounding to 4 significant figures are given below\\n\"\n",
+ "print \" %f %.4g\\n'\" %(a1,a1)\n",
+ "print \" %f %.4g\\n\" %(a2,a2)\n",
+ "print \" %f %.4g\\n\" %(a3,a3)\n",
+ "print \" %f %.4g\\n\" %(a4,a4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "the numbers after rounding to 4 significant figures are given below\n",
+ "\n",
+ " 1.658300 1.658\n",
+ "'\n",
+ " 30.056700 30.06\n",
+ "\n",
+ " 0.859378 0.8594\n",
+ "\n",
+ " 3.141590 3.142\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.2:pg-9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 1.2\n",
+ "#percentage accuracy\n",
+ "#page 9\n",
+ "import math\n",
+ "x=0.51 # the number given\n",
+ "n=2 #correcting upto 2 decimal places\n",
+ "d=math.pow(10,-n)\n",
+ "d=d/2.0\n",
+ "p=(d/x)*100 #percentage accuracy\n",
+ "print \"the percentage accuracy of %f after correcting to two decimal places is %f\" %(x,p)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the percentage accuracy of 0.510000 after correcting to two decimal places is 0.980392\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.3:pg-9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 1.3\n",
+ "#absolute and relative errors\n",
+ "#page 9\n",
+ "X=3.1428571 #approximate value of pi\n",
+ "T_X=3.1415926 # true value of pi\n",
+ "A_E=T_X-X #absolute error\n",
+ "R_E=A_E/T_X #relative error\n",
+ "print \"Absolute Error = %0.7f \\n Relative Error = %0.7f\" %(A_E,R_E)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absolute Error = -0.0012645 \n",
+ " Relative Error = -0.0004025\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.4:pg-10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 1.4\n",
+ "#best approximation\n",
+ "#page 10\n",
+ "X=1/3 #the actual number\n",
+ "X1=0.30\n",
+ "X2=0.33\n",
+ "X3=0.34\n",
+ "E1=abs(X-X1)\n",
+ "E2=abs(X-X2)\n",
+ "E3=abs(X-X3)\n",
+ "if E1<E2:\n",
+ " if E1<E3:\n",
+ " B_A=X1\n",
+ "elif E2<E1:\n",
+ " if E2<E3:\n",
+ " B_A=X2\n",
+ "elif E3<E2:\n",
+ " if E3<E1:\n",
+ " B_A=X3\n",
+ "print \"the best approximation of 1/3 is %f\" %(B_A)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the best approximation of 1/3 is 0.300000\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.5:pg-10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#relative error\n",
+ "#example 1.5\n",
+ "#page 10\n",
+ "import math\n",
+ "n=8.6 # the corrected number\n",
+ "N=1 #the no is rounded to one decimal places\n",
+ "E_A=math.pow(10,-N)/2\n",
+ "E_R=E_A/n\n",
+ "print \"the relative error of the number is:%0.4f\" %(E_R)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the relative error of the number is:0.0058\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.6:pg-10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 1.6\n",
+ "#absolute error and relative error\n",
+ "#page 10\n",
+ "import math\n",
+ "s=math.sqrt(3)+math.sqrt(5)+math.sqrt(7) #the sum square root of 3,5,7\n",
+ "n=4\n",
+ "Ea=3*(math.pow(10,-n)/2) #absolute error\n",
+ "R_E=Ea/s\n",
+ "print \"the sum of square roots is %0.4g \\n\" %(s)\n",
+ "print \"the absolute error is %f \\n\" %(Ea)\n",
+ "print \"the relative error is %f\" %(R_E)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the sum of square roots is 6.614 \n",
+ "\n",
+ "the absolute error is 0.000150 \n",
+ "\n",
+ "the relative error is 0.000023\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.7:pg-10"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#absolute error\n",
+ "#example 1.7\n",
+ "#page 10\n",
+ "n=[0.1532, 15.45, 0.0000354, 305.1, 8.12, 143.3, 0.0212, 0.643, 0.1734] #original numbbers\n",
+ "#rounding all numbers to 2 decimal places\n",
+ "n=[305.1, 143.3, 0.15,15.45, 0.00, 8.12, 0.02, 0.64, 0.17] \n",
+ "sum=0;\n",
+ "#l=length(n);\n",
+ "for i in range(len(n)):\n",
+ " sum=sum+n[i];\n",
+ "\n",
+ "E_A=2*math.pow(10,-1)/2+7*math.pow(10,-2)/2\n",
+ "print \"the absolute error is:%0.2f\" %(E_A)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the absolute error is:0.14\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.8:pg-11"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#difference in 3 significant figures\n",
+ "#example 1.8\n",
+ "#page 11\n",
+ "X1=math.sqrt(6.37)\n",
+ "X2=math.sqrt(6.36)\n",
+ "d=X1-X2 #difference between two numbers\n",
+ "print \"the differencecorrected to 3 significant figures is %0.3g\" %(d)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the differencecorrected to 3 significant figures is 0.00198\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.9:pg-12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#relative error\n",
+ "#example 1.10\n",
+ "#page 12\n",
+ "a=6.54\n",
+ "b=48.64\n",
+ "c=13.5\n",
+ "da=0.01\n",
+ "db=0.02\n",
+ "dc=0.03\n",
+ "s=math.pow(a,2)*math.sqrt(b)/math.pow(c,3)\n",
+ "#disp(s,'s=')\n",
+ "print \"s=%f\" %(s)\n",
+ "r_err=2*(da/a)+(db/b)/2+3*(dc/c);\n",
+ "print \"the relative error is :%f\" %(r_err)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "s=0.121241\n",
+ "the relative error is :0.009930\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.11:pg-13"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#relative error\n",
+ "#example 1.11\n",
+ "#page 13\n",
+ "import math\n",
+ "x=1\n",
+ "y=1\n",
+ "z=1\n",
+ "u=(5*x*math.pow(y,3))/math.pow(z,3)\n",
+ "dx=0.001\n",
+ "dy=0.001\n",
+ "dz=0.001\n",
+ "max=((5*math.pow(y,2))/math.pow(z,3))*dx+((10*x*y)/math.pow(z,3))*dy+((15*x*math.pow(y,2))/math.pow(z,4))*dz\n",
+ "e=max/u\n",
+ "print \" the relative error is :%f\" %(e)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " the relative error is :0.006000\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.12:pg-12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#taylor series\n",
+ "#example 1.12\n",
+ "#page 12\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.pow(x,3)+5*x-10\n",
+ "def f1(x):\n",
+ " return 3*math.pow(x,2)-6*x+5\n",
+ "def f2(x):\n",
+ " return 6*x-6\n",
+ "def f3(x):\n",
+ " return 6\n",
+ "D=[0,f(0), f1(0), f2(0), f3(0)]\n",
+ "S1=0;\n",
+ "h=1;\n",
+ "for i in range(1,5):\n",
+ " S1=S1+math.pow(h,i-1)*D[i]/math.factorial(i-1)\n",
+ " \n",
+ "print \"the third order taylors series approximation of f(1) is :%d\" %(S1)\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the third order taylors series approximation of f(1) is :-7\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.13:pg-16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#taylor series\n",
+ "#example 1.13\n",
+ "#page 16\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.sin(x)\n",
+ "def f1(x):\n",
+ " return math.cos(x)\n",
+ "def f2(x):\n",
+ " return -1*math.sin(x)\n",
+ "def f3(x):\n",
+ " return -1*math.cos(x)\n",
+ "def f4(x):\n",
+ " return math.sin(x)\n",
+ "def f5(x):\n",
+ " return math.cos(x)\n",
+ "def f6(x):\n",
+ " return -1*math.sin(x)\n",
+ "def f7(x):\n",
+ " return -1*math.cos(x)\n",
+ "D=[0,f(math.pi/6), f1(math.pi/6), f2(math.pi/6), f3(math.pi/6), f4(math.pi/6), f5(math.pi/6), f6(math.pi/6), f7(math.pi/6)]\n",
+ "S1=0\n",
+ "h=math.pi/6\n",
+ "print \"order of approximation computed value of sin(pi/3) absolute eror\\n\\n\"\n",
+ "for j in range(1,10):\n",
+ " for i in range(1,j):\n",
+ " S1=S1+math.pow(h,i-1)*D[i]/math.factorial(i-1) \n",
+ " print \"%d %0.9f %0.9f\\n\" %(j,S1,abs(math.sin(math.pi/3)-S1))\n",
+ " S1=0\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "order of approximation computed value of sin(pi/3) absolute eror\n",
+ "\n",
+ "\n",
+ "1 0.000000000 0.866025404\n",
+ "\n",
+ "2 0.500000000 0.366025404\n",
+ "\n",
+ "3 0.953449841 0.087424437\n",
+ "\n",
+ "4 0.884910922 0.018885518\n",
+ "\n",
+ "5 0.864191614 0.001833790\n",
+ "\n",
+ "6 0.865757475 0.000267929\n",
+ "\n",
+ "7 0.866041490 0.000016087\n",
+ "\n",
+ "8 0.866027181 0.000001777\n",
+ "\n",
+ "9 0.866025327 0.000000077\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.14:pg-18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#maclaurins expansion\n",
+ "#example 1.14\n",
+ "#page 18\n",
+ "n=8 #correct to 8 decimal places\n",
+ "x=1\n",
+ "for i in range(1,50):\n",
+ " if x/math.factorial(i)<math.pow(10,-8)/2:\n",
+ " c=i\n",
+ " break \n",
+ "print \"no of terms needed to correct to 8 decimal places is : %d \" %(c)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "no of terms needed to correct to 8 decimal places is : 2 \n"
+ ]
+ }
+ ],
+ "prompt_number": 78
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex1.15:pg-18"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#series apprixamation\n",
+ "#example 1.15\n",
+ "#page 18\n",
+ "import math\n",
+ "x=.09090909 # 1/11 =.09090909\n",
+ "S1=0\n",
+ "for i in range(1,5,2):\n",
+ " S1=S1+math.pow(x,i)/i\n",
+ "print \"value of log(1.2) is : %0.8f\\n\\n\" %(2*S1)\n",
+ "c=0\n",
+ "for i in range(1,50):\n",
+ " if math.pow(.09090909,i)/i<2*math.pow(10,-7):\n",
+ " c=i\n",
+ " break\n",
+ "print \"min no of terms needed to get value wuth same accuracy is :%d\" %(c)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "value of log(1.2) is : 0.18231906\n",
+ "\n",
+ "\n",
+ "min no of terms needed to get value wuth same accuracy is :6\n"
+ ]
+ }
+ ],
+ "prompt_number": 74
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter2_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter2_2.ipynb
new file mode 100644
index 00000000..e0f06dc5
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter2_2.ipynb
@@ -0,0 +1,2194 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:4ea5f1862f23f05e185dbf413e39ce53a665076203199df3d54c2ad4a7911989"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter02:Solution of Algebric and Transcendental Equations"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.1:pg-24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.1\n",
+ "#bisection method\n",
+ "#page 24\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.pow(x,3)-x-1\n",
+ "x1=1\n",
+ "x2=2 #f(1) is negative and f(2) is positive\n",
+ "d=0.0001 #for accuracy of root\n",
+ "c=1\n",
+ "print \"Succesive approximations \\t x1\\t \\tx2\\t \\tm\\t \\tf(m)\\n\"\n",
+ "while abs(x1-x2)>d:\n",
+ " \n",
+ " m=(x1+x2)/2.0\n",
+ " print \" \\t%f\\t%f\\t%f\\t%f\\n\" %(x1,x2,m,f(m))\n",
+ " if f(m)*f(x1)>0.0:\n",
+ " x1=m\n",
+ " else:\n",
+ " x2=m \n",
+ " c=c+1 # to count number of iterations \n",
+ "print \"the solution of equation after %i iteration is %g\" %(c,m)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Succesive approximations \t x1\t \tx2\t \tm\t \tf(m)\n",
+ "\n",
+ " \t1.000000\t2.000000\t1.500000\t0.875000\n",
+ "\n",
+ " \t1.000000\t1.500000\t1.250000\t-0.296875\n",
+ "\n",
+ " \t1.250000\t1.500000\t1.375000\t0.224609\n",
+ "\n",
+ " \t1.250000\t1.375000\t1.312500\t-0.051514\n",
+ "\n",
+ " \t1.312500\t1.375000\t1.343750\t0.082611\n",
+ "\n",
+ " \t1.312500\t1.343750\t1.328125\t0.014576\n",
+ "\n",
+ " \t1.312500\t1.328125\t1.320312\t-0.018711\n",
+ "\n",
+ " \t1.320312\t1.328125\t1.324219\t-0.002128\n",
+ "\n",
+ " \t1.324219\t1.328125\t1.326172\t0.006209\n",
+ "\n",
+ " \t1.324219\t1.326172\t1.325195\t0.002037\n",
+ "\n",
+ " \t1.324219\t1.325195\t1.324707\t-0.000047\n",
+ "\n",
+ " \t1.324707\t1.325195\t1.324951\t0.000995\n",
+ "\n",
+ " \t1.324707\t1.324951\t1.324829\t0.000474\n",
+ "\n",
+ " \t1.324707\t1.324829\t1.324768\t0.000214\n",
+ "\n",
+ "the solution of equation after 15 iteration is 1.32477'\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.2:pg-25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.2\n",
+ "#bisection method\n",
+ "#page 25\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.pow(x,3)-2*x-5\n",
+ "x1=2 \n",
+ "x2=3 #f(2) is negative and f(3) is positive\n",
+ "d=0.0001 #for accuracy of root\n",
+ "c=1\n",
+ "print \"Succesive approximations \\t x1\\t \\tx2\\t \\tm\\t \\tf(m)\\n\"\n",
+ "while abs(x1-x2)>d:\n",
+ " m=(x1+x2)/2.0\n",
+ " print \" \\t%f\\t%f\\t%f\\t%f\\n\" %(x1,x2,m,f(m))\n",
+ " if f(m)*f(x1)>0:\n",
+ " x1=m\n",
+ " else:\n",
+ " x2=m \n",
+ " c=c+1;# to count number of iterations \n",
+ "print \"the solution of equation after %i iteration is %0.4g\" %(c,m)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Succesive approximations \t x1\t \tx2\t \tm\t \tf(m)\n",
+ "\n",
+ " \t2.000000\t3.000000\t2.500000\t5.625000\n",
+ "\n",
+ " \t2.000000\t2.500000\t2.250000\t1.890625\n",
+ "\n",
+ " \t2.000000\t2.250000\t2.125000\t0.345703\n",
+ "\n",
+ " \t2.000000\t2.125000\t2.062500\t-0.351318\n",
+ "\n",
+ " \t2.062500\t2.125000\t2.093750\t-0.008942\n",
+ "\n",
+ " \t2.093750\t2.125000\t2.109375\t0.166836\n",
+ "\n",
+ " \t2.093750\t2.109375\t2.101562\t0.078562\n",
+ "\n",
+ " \t2.093750\t2.101562\t2.097656\t0.034714\n",
+ "\n",
+ " \t2.093750\t2.097656\t2.095703\t0.012862\n",
+ "\n",
+ " \t2.093750\t2.095703\t2.094727\t0.001954\n",
+ "\n",
+ " \t2.093750\t2.094727\t2.094238\t-0.003495\n",
+ "\n",
+ " \t2.094238\t2.094727\t2.094482\t-0.000771\n",
+ "\n",
+ " \t2.094482\t2.094727\t2.094604\t0.000592\n",
+ "\n",
+ " \t2.094482\t2.094604\t2.094543\t-0.000090\n",
+ "\n",
+ "the solution of equation after 15 iteration is 2.095\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.3:pg-26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.3\n",
+ "#bisection method\n",
+ "#page 26\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.pow(x,3)+math.pow(x,2)+x+7\n",
+ "x1=-3\n",
+ "x2=-2 #f(-3) is negative and f(-2) is positive\n",
+ "d=0.0001 #for accuracy of root\n",
+ "c=1\n",
+ "print \"Succesive approximations \\t x1\\t \\tx2\\t \\tm\\t \\tf(m)\\n\"\n",
+ "while abs(x1-x2)>d:\n",
+ " m=(x1+x2)/2.0\n",
+ " print \" \\t%f\\t%f\\t%f\\t%f\\n\" %(x1,x2,m,f(m))\n",
+ " if f(m)*f(x1)>0:\n",
+ " x1=m\n",
+ " else:\n",
+ " x2=m \n",
+ " c=c+1 # to count number of iterations \n",
+ "print \"the solution of equation after %i iteration is %0.4g\" %(c,m)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Succesive approximations \t x1\t \tx2\t \tm\t \tf(m)\n",
+ "\n",
+ " \t-3.000000\t-2.000000\t-2.500000\t-4.875000\n",
+ "\n",
+ " \t-2.500000\t-2.000000\t-2.250000\t-1.578125\n",
+ "\n",
+ " \t-2.250000\t-2.000000\t-2.125000\t-0.205078\n",
+ "\n",
+ " \t-2.125000\t-2.000000\t-2.062500\t0.417725\n",
+ "\n",
+ " \t-2.125000\t-2.062500\t-2.093750\t0.111481\n",
+ "\n",
+ " \t-2.125000\t-2.093750\t-2.109375\t-0.045498\n",
+ "\n",
+ " \t-2.109375\t-2.093750\t-2.101562\t0.033315\n",
+ "\n",
+ " \t-2.109375\t-2.101562\t-2.105469\t-0.006010\n",
+ "\n",
+ " \t-2.105469\t-2.101562\t-2.103516\t0.013673\n",
+ "\n",
+ " \t-2.105469\t-2.103516\t-2.104492\t0.003836\n",
+ "\n",
+ " \t-2.105469\t-2.104492\t-2.104980\t-0.001086\n",
+ "\n",
+ " \t-2.104980\t-2.104492\t-2.104736\t0.001376\n",
+ "\n",
+ " \t-2.104980\t-2.104736\t-2.104858\t0.000145\n",
+ "\n",
+ " \t-2.104980\t-2.104858\t-2.104919\t-0.000470\n",
+ "\n",
+ "the solution of equation after 15 iteration is -2.105\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.4:pg-26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.4\n",
+ "#bisection method\n",
+ "#page 26\n",
+ "import math\n",
+ "def f(x):\n",
+ " return x*math.exp(x)-1\n",
+ "x1=0 \n",
+ "x2=1 #f(0) is negative and f(1) is positive\n",
+ "d=0.0005 #maximun tolerance value\n",
+ "c=1\n",
+ "print \"Succesive approximations \\t x1\\t \\tx2\\t \\tm\\t \\ttol\\t \\tf(m)\\n\"\n",
+ "while abs((x2-x1)/x2)>d:\n",
+ " m=(x1+x2)/2.0 #tolerance value for each iteration\n",
+ " tol=((x2-x1)/x2)*100\n",
+ " print \" \\t%f\\t%f\\t%f\\t%f\\t%f\\n\" %(x1,x2,m,tol,f(m))\n",
+ " if f(m)*f(x1)>0:\n",
+ " x1=m\n",
+ " else:\n",
+ " x2=m \n",
+ " c=c+1 # to count number of iterations \n",
+ "print \"the solution of equation after %i iteration is %0.4g\" %(c,m)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Succesive approximations \t x1\t \tx2\t \tm\t \ttol\t \tf(m)\n",
+ "\n",
+ " \t0.000000\t1.000000\t0.500000\t100.000000\t-0.175639\n",
+ "\n",
+ " \t0.500000\t1.000000\t0.750000\t50.000000\t0.587750\n",
+ "\n",
+ " \t0.500000\t0.750000\t0.625000\t33.333333\t0.167654\n",
+ "\n",
+ " \t0.500000\t0.625000\t0.562500\t20.000000\t-0.012782\n",
+ "\n",
+ " \t0.562500\t0.625000\t0.593750\t10.000000\t0.075142\n",
+ "\n",
+ " \t0.562500\t0.593750\t0.578125\t5.263158\t0.030619\n",
+ "\n",
+ " \t0.562500\t0.578125\t0.570312\t2.702703\t0.008780\n",
+ "\n",
+ " \t0.562500\t0.570312\t0.566406\t1.369863\t-0.002035\n",
+ "\n",
+ " \t0.566406\t0.570312\t0.568359\t0.684932\t0.003364\n",
+ "\n",
+ " \t0.566406\t0.568359\t0.567383\t0.343643\t0.000662\n",
+ "\n",
+ " \t0.566406\t0.567383\t0.566895\t0.172117\t-0.000687\n",
+ "\n",
+ " \t0.566895\t0.567383\t0.567139\t0.086059\t-0.000013\n",
+ "\n",
+ "the solution of equation after 13 iteration is 0.5671\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.5:pg-27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.5\n",
+ "#bisection method\n",
+ "#page 27\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 4*math.exp(-x)*math.sin(x)-1\n",
+ "x1=0 \n",
+ "x2=0.5 #f(0) is negative and f(1) is positive\n",
+ "d=0.0001 #for accuracy of root\n",
+ "c=1 \n",
+ "print \"Succesive approximations \\t x1\\t \\tx2\\t \\tm\\t \\t \\tf(m)\\n\"\n",
+ "while abs(x2-x1)>d:\n",
+ " m=(x1+x2)/2.0\n",
+ " print \" \\t%f\\t%f\\t%f\\t%f\\n\" %(x1,x2,m,f(m))\n",
+ " if f(m)*f(x1)>0:\n",
+ " x1=m\n",
+ " else:\n",
+ " x2=m \n",
+ " c=c+1 # to count number of iterations \n",
+ "print \"the solution of equation after %i iteration is %0.3g\" %(c,m)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Succesive approximations \t x1\t \tx2\t \tm\t \t \tf(m)\n",
+ "\n",
+ " \t0.000000\t0.500000\t0.250000\t-0.229286\n",
+ "\n",
+ " \t0.250000\t0.500000\t0.375000\t0.006941\n",
+ "\n",
+ " \t0.250000\t0.375000\t0.312500\t-0.100293\n",
+ "\n",
+ " \t0.312500\t0.375000\t0.343750\t-0.044068\n",
+ "\n",
+ " \t0.343750\t0.375000\t0.359375\t-0.017925\n",
+ "\n",
+ " \t0.359375\t0.375000\t0.367188\t-0.005334\n",
+ "\n",
+ " \t0.367188\t0.375000\t0.371094\t0.000842\n",
+ "\n",
+ " \t0.367188\t0.371094\t0.369141\t-0.002236\n",
+ "\n",
+ " \t0.369141\t0.371094\t0.370117\t-0.000694\n",
+ "\n",
+ " \t0.370117\t0.371094\t0.370605\t0.000075\n",
+ "\n",
+ " \t0.370117\t0.370605\t0.370361\t-0.000310\n",
+ "\n",
+ " \t0.370361\t0.370605\t0.370483\t-0.000118\n",
+ "\n",
+ " \t0.370483\t0.370605\t0.370544\t-0.000022\n",
+ "\n",
+ "the solution of equation after 14 iteration is 0.371\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.6:pg-28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.6\n",
+ "#false position method\n",
+ "#page 28\n",
+ "import math\n",
+ "def f(x):\n",
+ " return x**3-2*x-5\n",
+ "a=2.0\n",
+ "b=3.0 #f(2) is negative and f(3)is positive\n",
+ "d=0.00001\n",
+ "print \"succesive iterations \\ta\\t b\\t f(a)\\t f(b)\\t\\ x1\\n\"\n",
+ "for i in range(1,25):\n",
+ " x1=b*f(a)/(f(a)-f(b))+a*f(b)/(f(b)-f(a))\n",
+ " if(f(a)*f(x1))>0:\n",
+ " b=x1\n",
+ " else:\n",
+ " a=x1\n",
+ " if abs(f(x1))<d:\n",
+ " break\n",
+ " print \" \\t%f %f %f %f %f\\n\" %(a,b,f(a),f(b),x1)\n",
+ "print \"the root of the equation is %f\" %(x1)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "succesive iterations \ta\t b\t f(a)\t f(b)\t\\ x1\n",
+ "\n",
+ " \t2.000000 2.058824 -1.000000 -0.390800 2.058824\n",
+ "\n",
+ " \t2.096559 2.058824 0.022428 -0.390800 2.096559\n",
+ "\n",
+ " \t2.094511 2.058824 -0.000457 -0.390800 2.094511\n",
+ "\n",
+ "the root of the equation is 2.094552\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.7:pg-29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.7\n",
+ "#false position method\n",
+ "#page 29\n",
+ "def f(x):\n",
+ " return x**2.2-69\n",
+ "a=5.0\n",
+ "b=6.0 #f(5) is negative and f(6)is positive\n",
+ "d=0.00001\n",
+ "print \"succesive iterations \\ta\\t b\\t f(a)\\t f(b)\\t\\ x1\\n\"\n",
+ "for i in range(1,25):\n",
+ " x1=b*f(a)/(f(a)-f(b))+a*f(b)/(f(b)-f(a));\n",
+ " if(f(a)*f(x1))>0:\n",
+ " b=x1\n",
+ " else:\n",
+ " a=x1\n",
+ " if abs(f(x1))<d:\n",
+ " break\n",
+ " print \" \\t%f %f %f %f %f\\n\" %(a,b,f(a),f(b),x1)\n",
+ "print \"the root of the equation is %f\" %(x1)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "succesive iterations \ta\t b\t f(a)\t f(b)\t\\ x1\n",
+ "\n",
+ " \t7.027228 6.000000 3.933141 -17.485113 7.027228\n",
+ "\n",
+ " \t6.838593 6.000000 -0.304723 -17.485113 6.838593\n",
+ "\n",
+ " \t6.853467 6.000000 0.024411 -17.485113 6.853467\n",
+ "\n",
+ " \t6.852277 6.000000 -0.001950 -17.485113 6.852277\n",
+ "\n",
+ " \t6.852372 6.000000 0.000156 -17.485113 6.852372\n",
+ "\n",
+ " \t6.852365 6.000000 -0.000012 -17.485113 6.852365\n",
+ "\n",
+ "the root of the equation is 6.852365\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.8:pg-29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.8\n",
+ "#false position method\n",
+ "#page 29\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 2*x-log10(x)-7\n",
+ "a=3.0\n",
+ "b=4.0 #f(3) is negative and f(4)is positive\n",
+ "d=0.00001\n",
+ "print \"succesive iterations \\ta\\t b\\t f(a)\\t f(b)\\t\\ x1\\n\"\n",
+ "for i in range(1,25):\n",
+ " x1=b*f(a)/(f(a)-f(b))+a*f(b)/(f(b)-f(a))\n",
+ " if(f(a)*f(x1))>0:\n",
+ " b=x1\n",
+ " else:\n",
+ " a=x1\n",
+ " if abs(f(x1))<d:\n",
+ " break\n",
+ " print \" \\t%f %f %f %f %f\\n\" %(a,b,f(a),f(b),x1)\n",
+ "print \"the root of the equation is %0.4g\" %(x1)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "succesive iterations \ta\t b\t f(a)\t f(b)\t\\ x1\n",
+ "\n",
+ " \t3.000000 3.787772 -1.477121 -0.002839 3.787772\n",
+ "\n",
+ " \t3.789289 3.787772 0.000021 -0.002839 3.789289\n",
+ "\n",
+ "the root of the equation is 3.789\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.9:pg-30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.9\n",
+ "#false position method\n",
+ "#page 30\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 4*math.exp(-x)*math.sin(x)-1\n",
+ "a=0.0\n",
+ "b=0.5 #f(0) is negative and f(0.5)is positive\n",
+ "d=0.00001\n",
+ "print \"succesive iterations \\ta\\t b\\t f(a)\\t f(b)\\t\\ x1\\n\"\n",
+ "for i in range(1,25):\n",
+ " x1=b*f(a)/(f(a)-f(b))+a*f(b)/(f(b)-f(a))\n",
+ " if(f(a)*f(x1))>0:\n",
+ " b=x1\n",
+ " else:\n",
+ " a=x1\n",
+ " if abs(f(x1))<d:\n",
+ " break\n",
+ " print \" \\t%f %f %f %f %f\\n\" %(a,b,f(a),f(b),x1)\n",
+ "print \"the root of the equation is %f\" %(x1)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "succesive iterations \ta\t b\t f(a)\t f(b)\t\\ x1\n",
+ "\n",
+ " \t0.429869 0.500000 0.084545 0.163145 0.429869\n",
+ "\n",
+ " \t0.354433 0.500000 -0.026054 0.163145 0.354433\n",
+ "\n",
+ " \t0.374479 0.500000 0.006132 0.163145 0.374479\n",
+ "\n",
+ " \t0.369577 0.500000 -0.001547 0.163145 0.369577\n",
+ "\n",
+ " \t0.370802 0.500000 0.000384 0.163145 0.370802\n",
+ "\n",
+ " \t0.370497 0.500000 -0.000096 0.163145 0.370497\n",
+ "\n",
+ " \t0.370573 0.500000 0.000024 0.163145 0.370573\n",
+ "\n",
+ "the root of the equation is 0.370554\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.10:pg-33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.10\n",
+ "#iteration method\n",
+ "#page 33\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 1/(math.sqrt(x+1))\n",
+ "x1=0.75\n",
+ "x2=0.0\n",
+ "n=1\n",
+ "d=0.0001 #accuracy opto 10^-4\n",
+ "c=0 #to count no of iterations \n",
+ "print \"successive iterations \\t\\x01\\tf(x1)\\n\"\n",
+ "while abs(x1-x2)>d:\n",
+ " print \" \\t%f %f\\n\" %(x1,f(x1))\n",
+ " x2=x1\n",
+ " x1=f(x1)\n",
+ " c=c+1\n",
+ "print \" the root of the eqaution after %i iteration is %0.4g\" %(c,x1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t\u0001\tf(x1)\n",
+ "\n",
+ " \t0.750000 0.755929\n",
+ "\n",
+ " \t0.755929 0.754652\n",
+ "\n",
+ " \t0.754652 0.754926\n",
+ "\n",
+ " \t0.754926 0.754867\n",
+ "\n",
+ " the root of the eqaution after 4 iteration is 0.7549\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.11:pg-34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.11\n",
+ "#iteration method\n",
+ "#page34\n",
+ "import math\n",
+ "def f(x):\n",
+ " return cos(x)/2.0+3.0/2.0\n",
+ "x1=1.5 # as roots lies between 3/2 and pi/2\n",
+ "x2=0\n",
+ "d=0.0001 # accuracy opto 10^-4\n",
+ "c=0 # to count no of iterations \n",
+ "print \"successive iterations \\t\\x01\\tf(x1)\\n\"\n",
+ "while abs(x2-x1)>d:\n",
+ " \n",
+ " print \" \\t%f %f\\n\" %(x1,f(x1))\n",
+ " x2=x1\n",
+ " x1=f(x1)\n",
+ " c=c+1\n",
+ "print \" the root of the eqaution after %i iteration is %0.4g\" %(c,x1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t\u0001\tf(x1)\n",
+ "\n",
+ " \t1.500000 1.535369\n",
+ "\n",
+ " \t1.535369 1.517710\n",
+ "\n",
+ " \t1.517710 1.526531\n",
+ "\n",
+ " \t1.526531 1.522126\n",
+ "\n",
+ " \t1.522126 1.524326\n",
+ "\n",
+ " \t1.524326 1.523227\n",
+ "\n",
+ " \t1.523227 1.523776\n",
+ "\n",
+ " \t1.523776 1.523502\n",
+ "\n",
+ " \t1.523502 1.523639\n",
+ "\n",
+ " \t1.523639 1.523570\n",
+ "\n",
+ " the root of the eqaution after 10 iteration is 1.524\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.12:pg-35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.12\n",
+ "#iteration method\n",
+ "#page 35\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.exp(-x)\n",
+ "x1=1.5 # as roots lies between 0 and 1\n",
+ "x2=0\n",
+ "d=0.0001 # accuracy opto 10^-4\n",
+ "c=0 # to count no of iterations \n",
+ "print \"successive iterations \\t x1 \\t f(x1)\\n\"\n",
+ "while abs(x2-x1)>d:\n",
+ " \n",
+ " print \" \\t%f %f\\n\" %(x1,f(x1))\n",
+ " x2=x1\n",
+ " x1=f(x1)\n",
+ " c=c+1\n",
+ "print \" the root of the eqaution after %i iteration is %0.4g\" %(c,x1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x1 \t f(x1)\n",
+ "\n",
+ " \t1.500000 0.223130\n",
+ "\n",
+ " \t0.223130 0.800011\n",
+ "\n",
+ " \t0.800011 0.449324\n",
+ "\n",
+ " \t0.449324 0.638059\n",
+ "\n",
+ " \t0.638059 0.528317\n",
+ "\n",
+ " \t0.528317 0.589597\n",
+ "\n",
+ " \t0.589597 0.554551\n",
+ "\n",
+ " \t0.554551 0.574330\n",
+ "\n",
+ " \t0.574330 0.563082\n",
+ "\n",
+ " \t0.563082 0.569451\n",
+ "\n",
+ " \t0.569451 0.565836\n",
+ "\n",
+ " \t0.565836 0.567885\n",
+ "\n",
+ " \t0.567885 0.566723\n",
+ "\n",
+ " \t0.566723 0.567382\n",
+ "\n",
+ " \t0.567382 0.567008\n",
+ "\n",
+ " \t0.567008 0.567220\n",
+ "\n",
+ " \t0.567220 0.567100\n",
+ "\n",
+ " \t0.567100 0.567168\n",
+ "\n",
+ " the root of the eqaution after 18 iteration is 0.5672\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.13:pg-35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.13\n",
+ "#iteration method\n",
+ "#page 35\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 1+math.sin(x)/10\n",
+ "x1=1.0 # as roots lies between 1 and pi evident from graph\n",
+ "x2=0\n",
+ "d=0.0001 # accuracy opto 10^-4\n",
+ "c=0 # to count no of iterations \n",
+ "print \"successive iterations \\t x1 \\t f(x1)\\n\"\n",
+ "while abs(x2-x1)>d:\n",
+ " print \" \\t%f %f\\n\" %(x1,f(x1))\n",
+ " x2=x1\n",
+ " x1=f(x1)\n",
+ " c=c+1\n",
+ "print \" the root of the eqaution after %i iteration is %0.4g\" %(c,x1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x1 \t f(x1)\n",
+ "\n",
+ " \t1.000000 1.084147\n",
+ "\n",
+ " \t1.084147 1.088390\n",
+ "\n",
+ " \t1.088390 1.088588\n",
+ "\n",
+ " \t1.088588 1.088597\n",
+ "\n",
+ " the root of the eqaution after 4 iteration is 1.089\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.14:pg-36"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.14\n",
+ "#aitken's process\n",
+ "#page 36\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 1.5+math.cos(x)/2.0\n",
+ "x0=1.5\n",
+ "y=0\n",
+ "e=0.0001\n",
+ "c=0\n",
+ "print \"successive iterations \\t x0 \\t x1 \\t x2 \\t x3 \\t y\\n\"\n",
+ "for i in range(1,10):\n",
+ " x1=f(x0)\n",
+ " x2=f(x1)\n",
+ " x3=f(x2)\n",
+ " y=x3-((x3-x2)**2)/(x3-2*x2+x1)\n",
+ " d=y-x0\n",
+ " x0=y\n",
+ " if abs(f(x0))<e:\n",
+ " break\n",
+ " c=c+1\n",
+ " print \" \\t%f %f %f %f %f\\n\" %(x0,x1,x2,x3,y)\n",
+ "print \"the root of the equation after %i iteration is %f\" %(c,y)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x0 \t x1 \t x2 \t x3 \t y\n",
+ "\n",
+ " \t1.523592 1.535369 1.517710 1.526531 1.523592\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ " \t1.523593 1.523593 1.523593 1.523593 1.523593\n",
+ "\n",
+ "the root of the equation after 9 iteration is 1.523593\n"
+ ]
+ }
+ ],
+ "prompt_number": 42
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.15:pg-39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.15\n",
+ "#newton-raphson method\n",
+ "#page 39\n",
+ "def f(x):\n",
+ " return x**3-2*x-5\n",
+ "def f1(x):\n",
+ " return 3*x**2-2 # first derivative of the function\n",
+ "x0=2.0 # initial value\n",
+ "d=0.0001\n",
+ "c=0\n",
+ "n=1\n",
+ "print \"successive iterations \\t x0 \\t f(x0) \\t f1(x0)\\n\"\n",
+ "while n==1:\n",
+ " x2=x0\n",
+ " x1=x0-(f(x0)/f1(x0))\n",
+ " x0=x1\n",
+ " print \" \\t%f \\t%f \\t%f \\n\" %(x2,f(x1),f1(x1))\n",
+ " c=c+1\n",
+ " if abs(f(x0))<d:\n",
+ " break\n",
+ "print \"the root of %i iteration is:%f\" %(c,x0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x0 \t f(x0) \t f1(x0)\n",
+ "\n",
+ " \t2.000000 \t0.061000 \t11.230000 \n",
+ "\n",
+ " \t2.100000 \t0.000186 \t11.161647 \n",
+ "\n",
+ " \t2.094568 \t0.000000 \t11.161438 \n",
+ "\n",
+ "the root of 3 iteration is:2.094551\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.16:pg-40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.16\n",
+ "#newton-raphson method\n",
+ "#page 40\n",
+ "import math\n",
+ "def f(x):\n",
+ " return x*math.sin(x)+math.cos(x)\n",
+ "def f1(x):\n",
+ " return x*math.cos(x) #first derivation of the function\n",
+ "x0=math.pi # initial value\n",
+ "d=0.0001\n",
+ "c=0 \n",
+ "n=1\n",
+ "print \"successive iterations \\tx0\\t f(x0)\\t f1(x0)\\n\"\n",
+ "while n==1:\n",
+ " x2=x0\n",
+ " x1=x0-(f(x0)/f1(x0))\n",
+ " x0=x1\n",
+ " print \" \\t%f \\t%f \\t%f\\n\" %(x2,f(x1),f1(x1))\n",
+ " c=c+1\n",
+ " if abs(f(x0))<d:\n",
+ " break\n",
+ "print \"the root of %i iteration is:%f\" %(c,x0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \tx0\t f(x0)\t f1(x0)\n",
+ "\n",
+ " \t3.141593 \t-0.066186 \t-2.681457\n",
+ "\n",
+ " \t2.823283 \t-0.000564 \t-2.635588\n",
+ "\n",
+ " \t2.798600 \t-0.000000 \t-2.635185\n",
+ "\n",
+ "the root of 3 iteration is:2.798386\n"
+ ]
+ }
+ ],
+ "prompt_number": 46
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.17:pg-40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.17\n",
+ "#newton-raphson method\n",
+ "#page 40\n",
+ "import math\n",
+ "def f(x):\n",
+ " return x*math.exp(x)-1\n",
+ "def f1(x):\n",
+ " return math.exp(x)+x*math.exp(x) #first derivative of the function\n",
+ "x0=0 # initial value\n",
+ "d=0.0001 \n",
+ "c=0\n",
+ "n=1\n",
+ "print \"successive iterations \\tx0\\t f(x0)\\t f1(x0)\\n\"\n",
+ "while n==1:\n",
+ " x2=x0\n",
+ " x1=x0-(f(x0)/f1(x0))\n",
+ " x0=x1\n",
+ " print \" \\t%f \\t%f \\t%f\\n\" %(x2,f(x1),f1(x1))\n",
+ " c=c+1\n",
+ " if abs(f(x0))<d:\n",
+ " break\n",
+ "print \"the root of %i iteration is:%f\" %(c,x0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \tx0\t f(x0)\t f1(x0)\n",
+ "\n",
+ " \t0.000000 \t1.718282 \t5.436564\n",
+ "\n",
+ " \t1.000000 \t0.355343 \t3.337012\n",
+ "\n",
+ " \t0.683940 \t0.028734 \t2.810232\n",
+ "\n",
+ " \t0.577454 \t0.000239 \t2.763614\n",
+ "\n",
+ " \t0.567230 \t0.000000 \t2.763223\n",
+ "\n",
+ "the root of 5 iteration is:0.567143\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.18:pg-41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.18\n",
+ "#newton-raphson method\n",
+ "#page 41\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.sin(x)-x/2.0\n",
+ "def f1(x):\n",
+ " return math.cos(x)-0.5\n",
+ "x0=math.pi/2.0 # initial value\n",
+ "d=0.0001\n",
+ "c=0\n",
+ "n=1\n",
+ "print \"successive iterations \\t x0 \\t f(x0)\\t f1(x0)\\n\"\n",
+ "while n==1:\n",
+ " x2=x0\n",
+ " x1=x0-(f(x0)/f1(x0))\n",
+ " x0=x1\n",
+ " print \" \\t%f\\t%f\\t%f\\n\" %(x2,f(x1),f1(x1))\n",
+ " c=c+1\n",
+ " if abs(f(x0))<d:\n",
+ " break\n",
+ "print \"the root of %i iteration is: %0.4g\" %(c,x0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x0 \t f(x0)\t f1(x0)\n",
+ "\n",
+ " \t1.570796\t-0.090703\t-0.916147\n",
+ "\n",
+ " \t2.000000\t-0.004520\t-0.824232\n",
+ "\n",
+ " \t1.900996\t-0.000014\t-0.819039\n",
+ "\n",
+ "the root of 3 iteration is: 1.896\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.19:pg-41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.19\n",
+ "#newton-raphson method\n",
+ "#page 41\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 4*math.exp(-x)*math.sin(x)-1\n",
+ "def f1(x):\n",
+ " return math.cos(x)*4*math.exp(-x)-4*math.exp(-x)*math.sin(x)\n",
+ "x0=0.2 # initial value\n",
+ "d=0.0001\n",
+ "c=0 \n",
+ "n=1\n",
+ "print \"successive iterations \\t x0 \\t f(x0)\\t f1(x0)\\n\"\n",
+ "while n==1:\n",
+ " x2=x0\n",
+ " x1=x0-(f(x0)/f1(x0))\n",
+ " x0=x1\n",
+ " print \" \\t%f \\t%f \\t%f\\n\" %(x2,f(x1),f1(x1))\n",
+ " c=c+1\n",
+ " if abs(f(x0))<d:\n",
+ " break \n",
+ "print \"the root of %i iteration is: %0.3g\" %(c,x0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x0 \t f(x0)\t f1(x0)\n",
+ "\n",
+ " \t0.200000 \t-0.056593 \t1.753325\n",
+ "\n",
+ " \t0.336526 \t-0.002769 \t1.583008\n",
+ "\n",
+ " \t0.368804 \t-0.000008 \t1.573993\n",
+ "\n",
+ "the root of 3 iteration is: 0.371\n"
+ ]
+ }
+ ],
+ "prompt_number": 54
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.20:pg-42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.20\n",
+ "#generalized newton-raphson method\n",
+ "#page 42\n",
+ "def f(x):\n",
+ " return x**3-x**2-x+1\n",
+ "def f1(x):\n",
+ " return 3*x**2-2*x-1\n",
+ "def f2(x):\n",
+ " return 6*x-2\n",
+ "x0=0.8 # initial value to finf double root\n",
+ "n=1 \n",
+ "print \"successive iterations \\t x0 \\t x1\\t x2\\n\"\n",
+ "while n==1:\n",
+ " x1=x0-(f(x0)/f1(x0));\n",
+ " x2=x0-(f1(x0)/f2(x0));\n",
+ " if abs(x1-x2)<0.000000001:\n",
+ " x0=(x1+x2)/2.0\n",
+ " break\n",
+ " else:\n",
+ " x0=(x1+x2)/2;\n",
+ " print \" %f\\t %f\\t %f\\n\" %(x0,x1,x2)\n",
+ "print \"\\n \\nthe double root is at: %f\" %(x0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x0 \t x1\t x2\n",
+ "\n",
+ " 0.974370\t 0.905882\t 1.042857\n",
+ "\n",
+ " 0.993890\t 0.987269\t 1.000512\n",
+ "\n",
+ " 0.998489\t 0.996950\t 1.000028\n",
+ "\n",
+ " 0.999623\t 0.999245\t 1.000002\n",
+ "\n",
+ " 0.999906\t 0.999812\t 1.000000\n",
+ "\n",
+ " 0.999976\t 0.999953\t 1.000000\n",
+ "\n",
+ " 0.999994\t 0.999988\t 1.000000\n",
+ "\n",
+ " 0.999999\t 0.999997\t 1.000000\n",
+ "\n",
+ " 1.000000\t 0.999999\t 1.000000\n",
+ "\n",
+ " 1.000000\t 1.000000\t 1.000000\n",
+ "\n",
+ " 1.000000\t 1.000000\t 1.000000\n",
+ "\n",
+ " 1.000000\t 1.000000\t 1.000000\n",
+ "\n",
+ " 1.000000\t 1.000000\t 1.000000\n",
+ "\n",
+ "\n",
+ " \n",
+ "the double root is at: 1.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 57
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.21:pg-45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ramanujan's method\n",
+ "#example 2.21\n",
+ "#page 45\n",
+ "def f(x):\n",
+ " return 1-(13.0/12.0)*x-(3.0/8.0)*x**2+(1.0/24.0)*x**3\n",
+ "a1=13.0/12.0\n",
+ "a2=-3.0/8.0\n",
+ "a3=1.0/24.0\n",
+ "b1=1\n",
+ "b2=a1\n",
+ "b3=a1*b2+a2*b1\n",
+ "b4=a1*b3+a2*b2+a3*b1\n",
+ "b5=a1*b4+a2*b3+a3*b2\n",
+ "b6=a1*b5+a2*b4+a3*b3\n",
+ "b7=a1*b6+a2*b5+a3*b4\n",
+ "b8=a1*b7+a2*b6+a3*b5\n",
+ "b9=a1*b8+a2*b7+a3*b6\n",
+ "print \"\\n\\n%f\" %(b1/b2)\n",
+ "print \"\\n%f\" %(b2/b3)\n",
+ "print \"\\n%f\" %(b3/b4)\n",
+ "print \"\\n%f\" %(b4/b5)\n",
+ "print \"\\n%f\" %(b5/b6)\n",
+ "print \"\\n%f\" %(b6/b7)\n",
+ "print \"\\n%f\" %(b7/b8)\n",
+ "print \"\\n%f\" %(b8/b9)\n",
+ "print \"\\n it appears as if the roots are converging at 2\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ "0.923077\n",
+ "\n",
+ "1.356522\n",
+ "\n",
+ "1.595376\n",
+ "\n",
+ "1.738402\n",
+ "\n",
+ "1.828184\n",
+ "\n",
+ "1.886130\n",
+ "\n",
+ "1.924153\n",
+ "\n",
+ "1.949345\n",
+ "\n",
+ " it appears as if the roots are converging at 2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.22:pg-46"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ramanujan's method\n",
+ "#example 2.22\n",
+ "#page 46\n",
+ "def f(x):\n",
+ " return x+x**2+(x**3)/2.0+(x**4)/6.0+(x**5)/24.0\n",
+ "a1=1.0\n",
+ "a2=1.0\n",
+ "a3=1.0/2.0\n",
+ "a4=1.0/6.0\n",
+ "a5=1.0/24.0\n",
+ "b1=1\n",
+ "b2=a2\n",
+ "b3=a1*b2+a2*b1\n",
+ "b4=a1*b3+a2*b2+a3*b1\n",
+ "b5=a1*b4+a2*b3+a3*b2\n",
+ "b6=a1*b5+a2*b4+a3*b3\n",
+ "print \"\\n%f\" %(b1/b2)\n",
+ "print \"\\n%f\" %(b2/b3)\n",
+ "print \"\\n%f\" %(b3/b4)\n",
+ "print \"\\n%f\" %(b4/b5)\n",
+ "print \"\\n%f\" %(b5/b6)\n",
+ "print \"\\n it appears as if the roots are converging at around %f\" %(b5/b6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "1.000000\n",
+ "\n",
+ "0.500000\n",
+ "\n",
+ "0.571429\n",
+ "\n",
+ "0.583333\n",
+ "\n",
+ "0.571429\n",
+ "\n",
+ " it appears as if the roots are converging at around 0.571429\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.23:pg-47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ramanujan's method\n",
+ "#example 2.23\n",
+ "#page 47\n",
+ "from __future__ import division\n",
+ "def f(x):\n",
+ " return 1-2*((3*x/2.0+(x**2)/4.0-(x**4)/48.0+(x**6)/1440.0)-(x**8)*2/80640.0)\n",
+ "a1=3/2\n",
+ "a2=1/4\n",
+ "a3=0\n",
+ "a4=1/48\n",
+ "a5=0\n",
+ "a6=1/1440\n",
+ "a7=0\n",
+ "a8=-1/80640\n",
+ "b1=1\n",
+ "b2=a1\n",
+ "b3=a1*b2+a2*b1\n",
+ "b4=a1*b3+a2*b2+a3*b1\n",
+ "b5=a1*b4+a2*b3+a3*b2\n",
+ "b6=a1*b5+a2*b4+a3*b3\n",
+ "b7=a1*b6+a2*b5+a3*b4\n",
+ "b8=a1*b7+a2*b6+a3*b5\n",
+ "b9=a1*b8+a2*b7+a3*b6\n",
+ "print \"\\n%f\" %(b1/b2)\n",
+ "print \"\\n%f\" %(b2/b3)\n",
+ "print \"\\n%f\" %(b3/b4)\n",
+ "print \"\\n%f\" %(b4/b5)\n",
+ "print \"\\n%f\" %(b5/b6)\n",
+ "print \"\\n%f\" %(b6/b7)\n",
+ "print \"\\n%f\" %(b7/b8)\n",
+ "print \"\\n it appears as if the roots are converging at around %f\" %(b7/b8)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "0.666667\n",
+ "\n",
+ "0.600000\n",
+ "\n",
+ "0.606061\n",
+ "\n",
+ "0.605505\n",
+ "\n",
+ "0.605556\n",
+ "\n",
+ "0.605551\n",
+ "\n",
+ "0.605551\n",
+ "\n",
+ " it appears as if the roots are converging at around 0.605551\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.24:pg-47"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ramanujan's method\n",
+ "#example 2.24\n",
+ "#page 47\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 1-(x-x**2.0/math.factorial(2.0)**2.0+x**3.0/math.factorial(3.0)**2.0-x**4.0/math.factorial(4.0)**2.0)\n",
+ "a1=1\n",
+ "a2=-1/math.factorial(2.0)**2.0\n",
+ "a3=1/math.factorial(3.0)**2.0\n",
+ "a4=-1/math.factorial(4.0)**2.0\n",
+ "a5=-1/math.factorial(5.0)**2.0\n",
+ "a6=1/math.factorial(6.0)**2.0\n",
+ "b1=1\n",
+ "b2=a1\n",
+ "b3=a1*b2+a2*b1\n",
+ "b4=a1*b3+a2*b2+a3*b1\n",
+ "b5=a1*b4+a2*b3+a3*b2\n",
+ "print \"\\n\\n%f\" %(b1/b2)\n",
+ "print \"\\n\\n%f\" %(b2/b3)\n",
+ "print \"\\n%f\" %(b3/b4)\n",
+ "print \"\\n%f\" %(b4/b5)\n",
+ "print \"\\n it appears as if the roots are converging at around %f\" %(b4/b5)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ "1.000000\n",
+ "\n",
+ "\n",
+ "1.333333\n",
+ "\n",
+ "1.421053\n",
+ "\n",
+ "1.433962\n",
+ "\n",
+ " it appears as if the roots are converging at around 1.433962\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.25:pg-49"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.25\n",
+ "#secant method\n",
+ "#page 49\n",
+ "from __future__ import division\n",
+ "def f(x):\n",
+ " return x**3-2*x-5\n",
+ "x1=2\n",
+ "x2=3 # initial values\n",
+ "n=1\n",
+ "c=0\n",
+ "print \"successive iterations \\t x1 \\t x2 \\t x3 \\t f(x3)\\n\"\n",
+ "while n==1:\n",
+ " x3=(x1*f(x2)-x2*f(x1))/(f(x2)-f(x1)) \n",
+ " print \" \\t%f \\t%f \\t%f \\t%f\\n\" %(x1,x2,x3,f(x3))\n",
+ " if f(x3)*f(x1)>0:\n",
+ " x2=x3;\n",
+ " else:\n",
+ " x1=x3 \n",
+ " if abs(f(x3))<0.000001: \n",
+ " break\n",
+ " c=c+1\n",
+ "print \"the root of the equation after %i iteration is: %f\" %(c,x3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x1 \t x2 \t x3 \t f(x3)\n",
+ "\n",
+ " \t2.000000 \t3.000000 \t2.058824 \t-0.390800\n",
+ "\n",
+ " \t2.000000 \t2.058824 \t2.096559 \t0.022428\n",
+ "\n",
+ " \t2.096559 \t2.058824 \t2.094511 \t-0.000457\n",
+ "\n",
+ " \t2.094511 \t2.058824 \t2.094552 \t0.000009\n",
+ "\n",
+ " \t2.094552 \t2.058824 \t2.094551 \t-0.000000\n",
+ "\n",
+ "the root of the equation after 4 iteration is: 2.094551\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.26:pg-50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 2.26\n",
+ "#secant method\n",
+ "#page 50\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "def f(x):\n",
+ " return x*math.exp(x)-1\n",
+ "x1=0\n",
+ "x2=1 # initial values\n",
+ "n=1\n",
+ "c=0 \n",
+ "print \"successive iterations \\t x1 \\t x2 \\t x3 \\t f(x3)\\n\"\n",
+ "while n==1:\n",
+ " x3=(x1*f(x2)-x2*f(x1))/(f(x2)-f(x1)) \n",
+ " print \" \\t%f \\t%f \\t%f \\t%f\\n\" %(x1,x2,x3,f(x3))\n",
+ " if f(x3)*f(x1)>0:\n",
+ " x2=x3\n",
+ " else:\n",
+ " x1=x3 \n",
+ " if abs(f(x3))<0.0001:\n",
+ " break\n",
+ " c=c+1\n",
+ "print \"the root of the equation after %i iteration is: %0.4g\" %(c,x3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x1 \t x2 \t x3 \t f(x3)\n",
+ "\n",
+ " \t0.000000 \t1.000000 \t0.367879 \t-0.468536\n",
+ "\n",
+ " \t0.000000 \t0.367879 \t0.692201 \t0.383091\n",
+ "\n",
+ " \t0.692201 \t0.367879 \t0.546310 \t-0.056595\n",
+ "\n",
+ " \t0.546310 \t0.367879 \t0.570823 \t0.010200\n",
+ "\n",
+ " \t0.570823 \t0.367879 \t0.566500 \t-0.001778\n",
+ "\n",
+ " \t0.566500 \t0.367879 \t0.567256 \t0.000312\n",
+ "\n",
+ " \t0.567256 \t0.367879 \t0.567124 \t-0.000055\n",
+ "\n",
+ "the root of the equation after 6 iteration is: 0.5671\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.27:pg-52"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# example 2.27\n",
+ "#mulller's method\n",
+ "#page 52\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "def f(x):\n",
+ " return x**3-x-1\n",
+ "x0=0\n",
+ "x1=1\n",
+ "x2=2 # initial values\n",
+ "n=1\n",
+ "c=0\n",
+ "print \"successive iterations \\t x0 \\t x1 \\t x2 \\t f(x0)\\t f(x1)\\t f(x2)\\n\"\n",
+ "while n==1: \n",
+ " c=c+1\n",
+ " y0=f(x0)\n",
+ " y1=f(x1)\n",
+ " y2=f(x2)\n",
+ " h2=x2-x1\n",
+ " h1=x1-x0\n",
+ " d2=f(x2)-f(x1)\n",
+ " d1=f(x1)-f(x0)\n",
+ " print \" \\t%f\\t %f\\t %f\\t %f\\t %f\\t %f\\n\" %(x0,x1,x2,f(x0),f(x1),f(x2))\n",
+ " A=(d2/h2-d1/h1)/(h1+h2)\n",
+ " B=d2/h2+A*h2\n",
+ " S=math.sqrt(B**2-4*A*f(x2))\n",
+ " x3=x2-(2*f(x2))/(B+S)\n",
+ " E=abs((x3-x2)/x2)*100\n",
+ " if E<0.003:\n",
+ " break\n",
+ " else:\n",
+ " if c==1:\n",
+ " x2=x3\n",
+ " if c==2:\n",
+ " x1=x2\n",
+ " x2=x3\n",
+ " if c==3:\n",
+ " x0=x1\n",
+ " x1=x2\n",
+ " x2=x3\n",
+ " if c==3:\n",
+ " c=0\n",
+ "print \"the required root is : %0.4f\" %(x3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "successive iterations \t x0 \t x1 \t x2 \t f(x0)\t f(x1)\t f(x2)\n",
+ "\n",
+ " \t0.000000\t 1.000000\t 2.000000\t -1.000000\t -1.000000\t 5.000000\n",
+ "\n",
+ " \t0.000000\t 1.000000\t 1.263763\t -1.000000\t -1.000000\t -0.245412\n",
+ "\n",
+ " \t0.000000\t 1.263763\t 1.331711\t -1.000000\t -0.245412\t 0.030015\n",
+ "\n",
+ " \t1.263763\t 1.331711\t 1.324583\t -0.245412\t 0.030015\t -0.000574\n",
+ "\n",
+ " \t1.263763\t 1.331711\t 1.324718\t -0.245412\t 0.030015\t -0.000000\n",
+ "\n",
+ "the required root is : 1.3247\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.28:pg-55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#graeffe's method\n",
+ "#example 2.28\n",
+ "#page 55\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "def f(x):\n",
+ " return x**3-6*(x**2)+11*x-6\n",
+ "#x=poly(0,'x')\n",
+ "#g=f(-x)\n",
+ "print \"the equation is:\\n\"\n",
+ "A=[1, 14, 49, 36] #coefficients of the above equation\n",
+ "print \"%0.4g\\n\" %(math.sqrt(A[3]/A[2]))\n",
+ "print \"%0.4g\\n\" %(math.sqrt(A[2]/A[1]))\n",
+ "print \"%0.4g\\n\" %(math.sqrt(A[1]/A[0]))\n",
+ "print \"the equation is:\\n\"\n",
+ "#disp(g*(-1*g));\n",
+ "B=[1, 98, 1393, 1296]\n",
+ "print \"%0.4g\\n\" %((B[3]/B[2])**(1/4))\n",
+ "print \"%0.4g\\n\" %((B[2]/B[1])**(1/4))\n",
+ "print \"%0.4g\\n\" %((B[1]/B[0])**(1/4))\n",
+ "print \"It is apparent from the outputs that the roots converge at 1 2 3\"\n",
+ "\n",
+ "\n",
+ "\n",
+ "#INCOMPLETE"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the equation is:\n",
+ "\n",
+ "0.8571\n",
+ "\n",
+ "1.871\n",
+ "\n",
+ "3.742\n",
+ "\n",
+ "the equation is:\n",
+ "\n",
+ "0.9821\n",
+ "\n",
+ "1.942\n",
+ "\n",
+ "3.146\n",
+ "\n",
+ "It is apparent from the outputs that the roots converge at 1 2 3\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.29:pg-57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#quadratic factor by lin's--bairsttow method\n",
+ "#example 2.29\n",
+ "#page 57\n",
+ "from numpy import matrix\n",
+ "from __future__ import division\n",
+ "def f(x):\n",
+ " return x**3-x-1\n",
+ "a=[-1, -1, 0, 1]\n",
+ "r1=1\n",
+ "s1=1\n",
+ "b4=a[3]\n",
+ "def f3(r):\n",
+ " return a[2]-r*a[3]\n",
+ "def f2(r,s):\n",
+ " return a[1]-r*a[2]+r**2*a[3]-s*a[3]\n",
+ "def f1(r,s):\n",
+ " return a[0]-s*a[2]+s*r*a[3]\n",
+ "A=matrix([[1,1],[2,-1]])\n",
+ "C=matrix([[0],[1]])\n",
+ "X=A.I*C\n",
+ "X1=[[ 0.33333333],[-0.33333333]]\n",
+ "dr=X1[0][0]\n",
+ "ds=X1[1][0]\n",
+ "r2=r1+dr\n",
+ "s2=s1+ds\n",
+ "#second pproximation\n",
+ "r1=r2\n",
+ "s1=s2\n",
+ "b11=f1(r2,s2)\n",
+ "b22=f2(r2,s2)\n",
+ "h=0.001\n",
+ "dr_b1=(f1(r1+h,s1)-f1(r1,s1))/h\n",
+ "ds_b1=(f1(r1,s1+h)-f1(r1,s1))/h\n",
+ "dr_b2=(f2(r1+h,s1)-f2(r1,s1))/h\n",
+ "ds_b2=(f2(r1,s1+h)-f2(r1,s1))/h\n",
+ "A=matrix([[dr_b1,ds_b1],[dr_b2,ds_b2]])\n",
+ "C=matrix([[-f1(r1,s1)],[-f2(r1,s2)]])\n",
+ "X=A.I*C\n",
+ "r2=r1+X[0][0]\n",
+ "s2=s1+X[1][0]\n",
+ "print \"roots correct to 3 decimal places are : %0.3f %0.3f\" %(r2,s2)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "roots correct to 3 decimal places are : 1.325 0.754\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.31:pg-62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#method of iteration\n",
+ "#example 2.31\n",
+ "#page 62\n",
+ "from __future__ import division\n",
+ "def f(x,y):\n",
+ " return (3*y*x**2+7)/10\n",
+ "def g(x,y):\n",
+ " return (y**2+4)/5\n",
+ "h=0.0001\n",
+ "x0=0.5\n",
+ "y0=0.5\n",
+ "f1_dx=(f(x0+h,y0)-f(x0,y0))/h\n",
+ "f1_dy=(f(x0,y0+h)-f(x0,y0))/h\n",
+ "g1_dx=(g(x0+h,y0)-g(x0,y0))/h\n",
+ "g1_dy=(g(x0+h,y0)-g(x0,y0))/h\n",
+ "if (f1_dx+f1_dy<1) and (g1_dx+g1_dy<1): \n",
+ " print \"coditions for convergence is satisfied\\n\\n\"\n",
+ "print \"X \\t Y\\t\\n\\n\"\n",
+ "for i in range(0,10):\n",
+ " X=(3*y0*x0**2+7)/10\n",
+ " Y=(y0**2+4)/5\n",
+ " print \"%f\\t %f\\t\\n\" %(X,Y)\n",
+ " x0=X\n",
+ " y0=Y\n",
+ "print \"\\n\\n CONVERGENCE AT (1 1) IS OBVIOUS\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "coditions for convergence is satisfied\n",
+ "\n",
+ "\n",
+ "X \t Y\t\n",
+ "\n",
+ "\n",
+ "0.737500\t 0.850000\t\n",
+ "\n",
+ "0.838696\t 0.944500\t\n",
+ "\n",
+ "0.899312\t 0.978416\t\n",
+ "\n",
+ "0.937391\t 0.991460\t\n",
+ "\n",
+ "0.961360\t 0.996598\t\n",
+ "\n",
+ "0.976320\t 0.998642\t\n",
+ "\n",
+ "0.985572\t 0.999457\t\n",
+ "\n",
+ "0.991247\t 0.999783\t\n",
+ "\n",
+ "0.994707\t 0.999913\t\n",
+ "\n",
+ "0.996807\t 0.999965\t\n",
+ "\n",
+ "\n",
+ "\n",
+ " CONVERGENCE AT (1 1) IS OBVIOUS\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.32:pg-65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#newton raphson method\n",
+ "#example 2.32\n",
+ "#page 65\n",
+ "def f(x,y):\n",
+ " return 3*y*x**2-10*x+7\n",
+ "def g(y):\n",
+ " return y**2-5*y+4\n",
+ "hh=0.0001\n",
+ "x0=0.5\n",
+ "y0=0.5 #initial values\n",
+ "f0=f(x0,y0)\n",
+ "g0=g(y0)\n",
+ "df_dx=(f(x0+hh,y0)-f(x0,y0))/hh\n",
+ "df_dy=(f(x0,y0+hh)-f(x0,y0))/hh\n",
+ "dg_dx=(g(y0)-g(y0))/hh\n",
+ "dg_dy=(g(y0+hh)-g(y0))/hh\n",
+ "d=[[df_dx,df_dy],[dg_dx,dg_dy]]\n",
+ "D1=det(d)\n",
+ "dd=[[-f0,df_dy],[-g0,dg_dy]]\n",
+ "h=det(dd)/D1\n",
+ "ddd=[[df_dx,-f0],[dg_dx,-g0]]\n",
+ "k=det(ddd)/D1;\n",
+ "x1=x0+h\n",
+ "y1=y0+k\n",
+ "f0=f(x1,y1)\n",
+ "g0=g(y1)\n",
+ "df_dx=(f(x1+hh,y1)-f(x1,y1))/hh\n",
+ "df_dy=(f(x1,y1+hh)-f(x1,y1))/hh\n",
+ "dg_dx=(g(y1)-g(y1))/hh\n",
+ "dg_dy=(g(y1+hh)-g(y1))/hh\n",
+ "dddd=[[df_dx,df_dy],[dg_dx,dg_dy]]\n",
+ "D2=det(dddd)\n",
+ "ddddd=[[-f0,df_dy],[-g0,dg_dy]]\n",
+ "h=det(ddddd)/D2\n",
+ "d6=[[df_dx,-f0],[dg_dx,-g0]]\n",
+ "k=det(d6)/D2\n",
+ "x2=x1+h\n",
+ "y2=y1+k\n",
+ "print \" the roots of the equation are x2=%f and y2=%f\" %(x2,y2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " the roots of the equation are x2=0.970803 and y2=0.998752\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.33:pg-66"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#newton raphson method\n",
+ "#example 2.33\n",
+ "#page 66\n",
+ "import math\n",
+ "def f(x,y):\n",
+ " return x**2+y**2-1\n",
+ "def g(x,y):\n",
+ " return y-x**2\n",
+ "hh=0.0001\n",
+ "x0=0.7071\n",
+ "y0=0.7071 #initial values\n",
+ "f0=f(x0,y0)\n",
+ "g0=g(x0,y0)\n",
+ "df_dx=(f(x0+hh,y0)-f(x0,y0))/hh\n",
+ "df_dy=(f(x0,y0+hh)-f(x0,y0))/hh\n",
+ "dg_dx=(g(x0+hh,y0)-g(x0,y0))/hh\n",
+ "dg_dy=(g(x0,y0+hh)-g(x0,y0))/hh\n",
+ "D1=det([[df_dx,df_dy],[dg_dx,dg_dy]])\n",
+ "h=det([[-f0,df_dy],[-g0,dg_dy]])/D1\n",
+ "k=det([[df_dx,-f0],[dg_dx,-g0]])/D1\n",
+ "x1=x0+h\n",
+ "y1=y0+k\n",
+ "f0=f(x1,y1)\n",
+ "g0=g(x1,y1)\n",
+ "df_dx=(f(x1+hh,y1)-f(x1,y1))/hh\n",
+ "df_dy=(f(x1,y1+hh)-f(x1,y1))/hh\n",
+ "dg_dx=(g(x1+hh,y1)-g(x1,y1))/hh\n",
+ "dg_dy=(g(x1,y1+hh)-g(x1,y1))/hh\n",
+ "D2=det([[df_dx,df_dy],[dg_dx,dg_dy]])\n",
+ "h=det([[-f0,df_dy],[-g0,dg_dy]])/D2\n",
+ "k=det([[df_dx,-f0],[dg_dx,-g0]])/D2\n",
+ "x2=x1+h\n",
+ "y2=y1+k\n",
+ "print \"the roots of the equation are x2=%f and y2=%f \" %(x2,y2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the roots of the equation are x2=0.786184 and y2=0.618039 \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.34:pg-67"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#newton raphson method\n",
+ "#example 2.34\n",
+ "#page 67\n",
+ "import math\n",
+ "def f(x,y):\n",
+ " return math.sin(x)-y+0.9793\n",
+ "def g(x,y):\n",
+ " return math.cos(y)-x+0.6703\n",
+ "hh=0.0001\n",
+ "x0=0.5\n",
+ "y0=1.5 #initial values\n",
+ "f0=f(x0,y0)\n",
+ "g0=g(x0,y0)\n",
+ "df_dx=(f(x0+hh,y0)-f(x0,y0))/hh\n",
+ "df_dy=(f(x0,y0+hh)-f(x0,y0))/hh\n",
+ "dg_dx=(g(x0+hh,y0)-g(x0,y0))/hh\n",
+ "dg_dy=(g(x0,y0+hh)-g(x0,y0))/hh\n",
+ "d1=[[df_dx,df_dy],[dg_dx,dg_dy]]\n",
+ "D1=det(d1)\n",
+ "d2=[[-f0,df_dy],[-g0,dg_dy]]\n",
+ "h=det(d2)/D1\n",
+ "d3=[[df_dx,-f0],[dg_dx,-g0]]\n",
+ "k=det(d3)/D1\n",
+ "x1=x0+h\n",
+ "y1=y0+k\n",
+ "f0=f(x1,y1)\n",
+ "g0=g(x1,y1)\n",
+ "df_dx=(f(x1+hh,y1)-f(x1,y1))/hh\n",
+ "df_dy=(f(x1,y1+hh)-f(x1,y1))/hh\n",
+ "dg_dx=(g(x1+hh,y1)-g(x1,y1))/hh\n",
+ "dg_dy=(g(x1,y1+hh)-g(x1,y1))/hh\n",
+ "d4=[[df_dx,df_dy],[dg_dx,dg_dy]]\n",
+ "D2=det(d4)\n",
+ "h=det([[-f0,df_dy],[-g0,dg_dy]])/D2\n",
+ "k=det([[df_dx,-f0],[dg_dx,-g0]])/D2\n",
+ "x2=x1+h\n",
+ "y2=y1+k\n",
+ "print \"the roots of the equation are x2=%0.4f and y2=%0.4f\" %(x2,y2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the roots of the equation are x2=0.6537 and y2=1.5874\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter3_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter3_2.ipynb
new file mode 100644
index 00000000..77d8f79f
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter3_2.ipynb
@@ -0,0 +1,1113 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:58def12f7e424e92e928d020c21b40714eff26275c7ce87aa5600004fbc92a49"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter03:Interpolation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.4:pg-86"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.4\n",
+ "#interpolation\n",
+ "#page 86\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "x=[1, 3, 5, 7]\n",
+ "y=[24, 120, 336, 720]\n",
+ "d1=[0,0,0]\n",
+ "d2=[0,0,0]\n",
+ "d3=[0,0,0]\n",
+ "h=2 #interval between values of x\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,1):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1\n",
+ "d=[0,d1[0],d2[0],d3[0]]\n",
+ "x0=8 #value at 8\n",
+ "pp=1\n",
+ "y_x=y[0]\n",
+ "p=(x0-1)/2\n",
+ "for i in range(1,4):\n",
+ " pp=1\n",
+ " for j in range(0,i):\n",
+ " pp=pp*(p-(j)) \n",
+ " y_x=y_x+(pp*d[i])/math.factorial(i)\n",
+ "print \"value of function at %f is :%f\" %(x0,y_x)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "value of function at 8.000000 is :990.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.6:pg-87"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.6\n",
+ "#interpolation\n",
+ "#page 87\n",
+ "x=[15, 20, 25, 30, 35, 40]\n",
+ "y=[0.2588190, 0.3420201, 0.4226183, 0.5, 0.5735764, 0.6427876]\n",
+ "d1=[0,0,0,0,0]\n",
+ "d2=[0,0,0,0]\n",
+ "d3=[0,0,0]\n",
+ "d4=[0,0]\n",
+ "d5=[0]\n",
+ "h=5 #interval between values of x\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,1):\n",
+ " d5[c]=d4[i+1]-d4[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "d=[0,d1[0], d2[0], d3[0], d4[0], d5[0]]\n",
+ "x0=38 #value at 38 degree\n",
+ "pp=1\n",
+ "y_x=y[0]\n",
+ "p=(x0-x[0])/h\n",
+ "for i in range(1,6):\n",
+ " pp=1\n",
+ " for j in range(0,i):\n",
+ " pp=pp*(p-(j)) \n",
+ " y_x=y_x+((pp*d[i])/math.factorial(i));\n",
+ "print \"value of function at %i is :%f\" %(x0,y_x)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "value of function at 38 is :0.615661\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.7:pg-89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.7\n",
+ "#interpolation\n",
+ "#page 89\n",
+ "x=[0, 1, 2, 4]\n",
+ "y=[1, 3, 9, 81]\n",
+ "#equation is y(5)-4*y(4)+6*y(2)-4*y(2)+y(1)\n",
+ "y3=(y[3]+6*y[2]-4*y[1]+y[0])/4\n",
+ "print \"the value of missing term of table is :%d\" %(y3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value of missing term of table is :31\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.8:pg-89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.8\n",
+ "#interpolation\n",
+ "#page 89\n",
+ "import math\n",
+ "x=[0.10, 0.15, 0.20, 0.25, 0.30]\n",
+ "y=[0.1003, 0.1511, 0.2027, 0.2553, 0.3093]\n",
+ "d1=[0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0,0]\n",
+ "d4=[0,0,0,0,0]\n",
+ "h=0.05 #interval between values of x\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1\n",
+ "d=[0,d1[0], d2[0], d3[0], d4[0]]\n",
+ "x0=0.12 #value at 0.12;\n",
+ "pp=1\n",
+ "y_x=y[0]\n",
+ "p=(x0-x[0])/h\n",
+ "for i in range(1,5):\n",
+ " pp=1;\n",
+ " for j in range(0,i):\n",
+ " pp=pp*(p-(j)) \n",
+ " y_x=y_x+(pp*d[i])/math.factorial(i)\n",
+ "print \"value of function at %f is :%0.4g\\n \\n\" %(x0,y_x)\n",
+ "x0=0.26 #value at 0.26;\n",
+ "pp=1\n",
+ "y_x=y[0]\n",
+ "p=(x0-x[0])/h\n",
+ "for i in range(1,5):\n",
+ " pp=1\n",
+ " for j in range(0,i):\n",
+ " pp=pp*(p-(j)) \n",
+ " y_x=y_x+(pp*d[i])/math.factorial(i);\n",
+ "print \"value of function at %f is :%0.4g\\n \\n\" %(x0,y_x)\n",
+ "x0=0.40 #value at 0.40;\n",
+ "pp=1\n",
+ "y_x=y[0]\n",
+ "p=(x0-x[0])/h\n",
+ "for i in range(1,5):\n",
+ " pp=1\n",
+ " for j in range(0,i):\n",
+ " pp=pp*(p-(j)) \n",
+ " y_x=y_x+(pp*d[i])/math.factorial(i)\n",
+ "print \"value of function at %f is :%0.4g\\n \\n\" %(x0,y_x)\n",
+ "x0=0.50 #value at 0.50;\n",
+ "pp=1\n",
+ "y_x=y[0]\n",
+ "p=(x0-x[0])/h\n",
+ "for i in range(1,5):\n",
+ " pp=1\n",
+ " for j in range(0,i):\n",
+ " pp=pp*(p-(j)) \n",
+ " y_x=y_x+(pp*d[i])/math.factorial(i)\n",
+ "print \"value of function at %f is :%0.5g\\n \\n\" %(x0,y_x)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "value of function at 0.120000 is :0.1205\n",
+ " \n",
+ "\n",
+ "value of function at 0.260000 is :0.266\n",
+ " \n",
+ "\n",
+ "value of function at 0.400000 is :0.4241\n",
+ " \n",
+ "\n",
+ "value of function at 0.500000 is :0.5543\n",
+ " \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.9:pg-93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.9\n",
+ "#Gauss' forward formula\n",
+ "#page 93\n",
+ "x=[1.0, 1.05, 1.10, 1.15, 1.20, 1.25, 1.30];\n",
+ "y=[2.7183, 2.8577, 3.0042, 3.1582, 3.3201, 3.4903, 3.66693]\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "d5=[0,0]\n",
+ "d6=[0]\n",
+ "h=0.05 #interval between values of x\n",
+ "c=0\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d5[c]=d4[i+1]-d4[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,1):\n",
+ " d6[c]=d5[i+1]-d5[i]\n",
+ " c=c+1\n",
+ "d=[0,d1[3], d2[2], d3[2], d4[1], d5[0], d6[0]]\n",
+ "x0=1.17 #value at 1.17;\n",
+ "pp=1\n",
+ "y_x=y[3]\n",
+ "p=(x0-x[3])/h\n",
+ "for i in range(1,6):\n",
+ " pp=1;\n",
+ " for j in range(0,i):\n",
+ " pp=pp*(p-(j)) \n",
+ " y_x=y_x+(pp*d[i])/math.factorial(i)\n",
+ "print \"value of function at %f is :%0.4g\\n \\n\" %(x0,y_x)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "value of function at 1.170000 is :3.222\n",
+ " \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.10:pg-97"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#practical interpolation\n",
+ "#example 3.10\n",
+ "#page 97\n",
+ "import math\n",
+ "x=[0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67]\n",
+ "y=[1.840431, 1.858928,1.877610, 1.896481, 1.915541, 1.934792, 1.954237]\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "h=0.01 #interval between values of x\n",
+ "c=0\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i];\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i];\n",
+ " c=c+1\n",
+ "d=[d1[0], d2[0], d3[0], d4[0]]\n",
+ "x0=0.644\n",
+ "p=(x0-x[3])/h;\n",
+ "y_x=y[3]\n",
+ "y_x=y_x+p*(d1[2]+d1[3])/2+p**2*(d2[1])/2 #stirling formula\n",
+ "print \"the value at %f by stirling formula is : %f\\n\\n\" %(x0,y_x)\n",
+ "y_x=y[3]\n",
+ "y_x=y_x+p*d1[3]+p*(p-1)*(d2[2]+d2[3])/2\n",
+ "print \" the value at %f by bessels formula is : %f\\n\\n\" %(x0,y_x)\n",
+ "y_x=y[3]\n",
+ "q=1-p\n",
+ "y_x=q*y[3]+q*(q**2-1)*d2[2]/2+p*y[4]+p*(q**2-1)*d2[4]/2\n",
+ "print \"the value at %f by everrets formula is : %f\\n\\n\" %(x0,y_x)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value at 0.644000 by stirling formula is : 1.904082\n",
+ "\n",
+ "\n",
+ " the value at 0.644000 by bessels formula is : 1.904059\n",
+ "\n",
+ "\n",
+ "the value at 0.644000 by everrets formula is : 1.904044\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.11:pg-99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#practical interpolation\n",
+ "#example 3.11\n",
+ "#page 99\n",
+ "x=[0.61, 0.62, 0.63, 0.64, 0.65, 0.66, 0.67]\n",
+ "y=[1.840431, 1.858928, 1.877610, 1.896481, 1.915541, 1.934792, 1.954237]\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "h=0.01 #interval between values of x\n",
+ "c=0\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1\n",
+ "d=[d1[0], d2[0], d3[0], d4[0]]\n",
+ "x0=0.638\n",
+ "p=(x0-x[3])/h\n",
+ "y_x=y[3]\n",
+ "y_x=y_x+p*(d1[2]+d1[3])/2+p**2*(d2[1])/2 #stirling formula\n",
+ "print \"value at %f by stirling formula is : %f\\n\\n\" %(x0,y_x)\n",
+ "y_x=y[2]\n",
+ "p=(x0-x[2])/h\n",
+ "y_x=y_x+p*d1[2]+p*(p-1)*(d2[1])/2\n",
+ "print \"the value at %f by bessels formula is : %f\\n\\n\" %(x0,y_x)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "value at 0.638000 by stirling formula is : 1.892692\n",
+ "\n",
+ "\n",
+ "the value at 0.638000 by bessels formula is : 1.892692\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.12:pg-99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#practical interpolation\n",
+ "#example 3.12\n",
+ "#page 99\n",
+ "x=[1.72, 1.73, 1.74, 1.75, 1.76, 1.77, 1.78]\n",
+ "y=[0.1790661479, 0.1772844100, 0.1755204006, 0.1737739435, 0.1720448638, 0.1703329888, 0.1686381473]\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "h=0.01 #interval between values of x\n",
+ "c=0\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1\n",
+ "x0=1.7475\n",
+ "y_x=y[2]\n",
+ "p=(x0-x[2])/h\n",
+ "y_x=y_x+p*d1[2]+p*(p-1)*((d2[1]+d2[2])/2)/2\n",
+ "print \"the value at %f by bessels formula is : %0.10f\\n\\n\" %(x0,y_x)\n",
+ "y_x=y[3]\n",
+ "q=1-p\n",
+ "y_x=q*y[2]+q*(q**2-1)*d2[1]/6+p*y[3]+p*(p**2-1)*d2[1]/6\n",
+ "print \"the value at %f by everrets formula is : %0.10f\\n\\n\" %(x0,y_x)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value at 1.747500 by bessels formula is : 0.1742089204\n",
+ "\n",
+ "\n",
+ "the value at 1.747500 by everrets formula is : 0.1742089122\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.13:pg-104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.13\n",
+ "#lagrange's interpolation formula\n",
+ "#page 104\n",
+ "x=[300, 304, 305, 307]\n",
+ "y=[2.4771, 2.4829, 2.4843, 2.4871]\n",
+ "x0=301\n",
+ "log_301=(-3*-4*-6*2.4771)/(-4*-5*-7)+(-4*-6*2.4829)/(4*-1*-3)+(-3*-6*2.4843)/(5*-2)+(-3*-4*2.4871)/(7*3*2)\n",
+ "print \"valie of log x at 301 is =%f\" %(log_301)\n",
+ "\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "valie of log x at 301 is =2.478597\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.14:pg-105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.14\n",
+ "#lagrange's interpolation formula\n",
+ "#page 105\n",
+ "y=[4, 12, 19]\n",
+ "x=[1, 3, 4];\n",
+ "y_x=7\n",
+ "Y_X=(-5*-12)/(-8*-15)+(3*3*-12)/(8*-7)+(3*-5*4)/(15*7)\n",
+ "print \"values is %f\" %(Y_X)\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "values is 1.857143\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.15:pg-105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.15\n",
+ "#lagrange's interpolation formula\n",
+ "#page 105\n",
+ "x=[2, 2.5, 3.0]\n",
+ "y=[0.69315, 0.91629, 1.09861]\n",
+ "def l0(x):\n",
+ " return (x-2.5)*(x-3.0)/(-0.5)*(-1.0)\n",
+ "def l1(x):\n",
+ " return ((x-2.0)*(x-3.0))/((0.5)*(-0.5))\n",
+ "def l2(x):\n",
+ " return ((x-2.0)*(x-2.5))/((1.0)*(0.5))\n",
+ "f_x=l0(2.7)*y[0]+l1(2.7)*y[1]+l2(2.7)*y[2];\n",
+ "print \"the calculated value is %f:\" %(f_x)\n",
+ "print \"\\n\\n the error occured in the value is %0.9f\" %(abs(f_x-log(2.7)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the calculated value is 0.994116:\n",
+ "\n",
+ "\n",
+ " the error occured in the value is 0.000864627\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.16:pg-106"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.16\n",
+ "#lagrange's interpolation formula\n",
+ "#page 106\n",
+ "import math\n",
+ "x=[0, math.pi/4,math.pi/2]\n",
+ "y=[0, 0.70711, 1.0];\n",
+ "x0=math.pi/6\n",
+ "sin_x0=0\n",
+ "for i in range(0,3):\n",
+ " p=y[i]\n",
+ " for j in range(0,3):\n",
+ " if j!=i:\n",
+ " p=p*((x0-x[j])/( x[i]-x[j]))\n",
+ " sin_x0=sin_x0+p\n",
+ "print \"sin_x0=%f\" %(sin_x0)\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sin_x0=0.517431\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.18:pg-107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#error in lagrange's interpolation formula\n",
+ "#example 3.18\n",
+ "#page 107\n",
+ "import math\n",
+ "x=[2, 2.5, 3.0]\n",
+ "y=[0.69315, 0.91629, 1.09861]\n",
+ "def l0(x):\n",
+ " return (x-2.5)*(x-3.0)/(-0.5)*(-1.0)\n",
+ "def l1(x):\n",
+ " return ((x-2.0)*(x-3.0))/((0.5)*(-0.5))\n",
+ "def l2(x):\n",
+ " return ((x-2.0)*(x-2.5))/((1.0)*(0.5))\n",
+ "f_x=l0(2.7)*y[0]+l1(2.7)*y[1]+l2(2.7)*y[2]\n",
+ "print \"the calculated value is %f:\" %(f_x)\n",
+ "err=math.fabs(f_x-math.log10(2.7))\n",
+ "def R_n(x):\n",
+ " return (((x-2)*(x-2.5)*(x-3))/6)\n",
+ "est_err=abs(R_n(2.7)*(2/8))\n",
+ "if est_err<err:\n",
+ " print \"\\n\\n the error agrees with the actual error\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the calculated value is 0.994116:\n",
+ "\n",
+ "\n",
+ " the error agrees with the actual error\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.19:pg-107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#error in lagrenge's interpolation\n",
+ "#example 3.19\n",
+ "#page 107\n",
+ "import math\n",
+ "x=[0, math.pi/4 ,math.pi/2]\n",
+ "y=[0, 0.70711, 1.0]\n",
+ "def l0(x):\n",
+ " return ((x-0)*(x-math.pi/2))/((math.pi/4)*(-1*math.pi/4))\n",
+ "def l1(x):\n",
+ " return ((x-0)*(x-math.pi/4))/((math.pi/2)*(math.pi/4))\n",
+ "f_x=l0(math.pi/6)*y[1]+l1(math.pi/6)*y[2]\n",
+ "err=abs(f_x-math.sin(math.pi/6))\n",
+ "def f(x):\n",
+ " return ((x-0)*(x-math.pi/4)*(x-math.pi/2))/6\n",
+ "if abs(f(math.pi/6))>err:\n",
+ " print \"\\n\\n the error agrees with the actual error\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "\n",
+ " the error agrees with the actual error\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.21:pg-110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#hermite's interpolation formula\n",
+ "#exammple 3.21\n",
+ "#page 110\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "x=[2.0, 2.5, 3.0]\n",
+ "y=[0.69315, 0.91629, 1.09861]\n",
+ "y1=[0,0,0]\n",
+ "def f(x):\n",
+ " return math.log(x)\n",
+ "h=0.0001\n",
+ "for i in range(0,3):\n",
+ " y1[i]=(f(x[i]+h)-f(x[i]))/h\n",
+ "def l0(x):\n",
+ " return (x-2.5)*(x-3.0)/(-0.5)*(-1.0)\n",
+ "def l1(x):\n",
+ " return ((x-2.0)*(x-3.0))/((0.5)*(-0.5))\n",
+ "def l2(x):\n",
+ " return ((x-2.0)*(x-2.5))/((1.0)*(0.5))\n",
+ "dl0=(l0(x[0]+h)-l0(x[0]))/h\n",
+ "dl1=(l1(x[1]+h)-l1(x[1]))/h\n",
+ "dl2=(l2(x[2]+h)-l2(x[2]))/h\n",
+ "x0=2.7\n",
+ "u0=(1-2*(x0-x[0])*dl0)*(l0(x0))**2\n",
+ "u1=(1-2*(x0-x[1])*dl1)*(l1(x0))**2\n",
+ "u2=(1-2*(x0-x[2])*dl2)*(l2(x0))**2\n",
+ "v0=(x0-x[0])*l0(x0)**2\n",
+ "v1=(x0-x[1])*l1(x0)**2\n",
+ "v2=(x0-x[2])*l2(x0)**2\n",
+ "H=u0*y[0]+u1*y[1]+u2*y[2]+v0*y1[0]+v1*y1[1]+v2*y1[2]\n",
+ "print \"the approximate value of ln(%0.2f) is %f:\" %(x0,H)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the approximate value of ln(2.70) is 0.993362:\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.22:pg-114"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#newton's general interpolation formula\n",
+ "#example 3.22\n",
+ "#page 114\n",
+ "x=[300, 304, 305, 307]\n",
+ "y=[2.4771, 2.4829, 2.4843, 2.4871]\n",
+ "d1=[0,0,0]\n",
+ "d2=[0,0]\n",
+ "for i in range(0,3):\n",
+ " d1[i]=(y[i+1]-y[i])/(x[i+1]-x[i])\n",
+ "for i in range(0,2):\n",
+ " d2[i]=(d1[i+1]-d1[i])/(x[i+2]-x[i])\n",
+ "x0=301\n",
+ "log301=y[0]+(x0-x[0])*d1[0]+(x0-x[1])*d2[0]\n",
+ "print \"valure of log(%d) is :%0.4f\" %(x0,log301)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "valure of log(301) is :2.4786\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.23:pg-114"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 3.23\n",
+ "#newton's divided formula\n",
+ "#page 114\n",
+ "x=[-1, 0, 3, 6, 7]\n",
+ "y=[3, -6, 39, 822, 1611]\n",
+ "for in range(0,4):\n",
+ " d1[i]=(y[i+1]-y[i])/(x[i+1]-x[i])\n",
+ "for in range(0,3):\n",
+ " d2[i]=(d1[i+1]-d1[i])/(x[i+2]-x[i])\n",
+ "for in range(0,2):\n",
+ " d3[i]=(d2[i+1]-d2[i])/(x[i+3]-x[i])\n",
+ "for iin range(0,1):\n",
+ " d4[i]=(d3[i+1]-d3[i])/(x[i+4]-x[i])\n",
+ "X=poly(0,'X')\n",
+ "f_x=y[0]+(X-x[0])*(d1[0])+(X-x[1])*(X-x[0])*d2[0]+(X-x[0])*(X-x[1])*(X-x[2])*d3[0]+(X-x[0])*(X-x[1])*(X-x[2])*(X-x[3])*d4[0]\n",
+ "disp(f_x,'the polynomial equation is =')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.24:pg-116"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#interpolation by iteration\n",
+ "#example 3.24\n",
+ "#page 116\n",
+ "x=[300, 304, 305, 307]\n",
+ "y=[2.4771, 2.4829, 2.4843, 2.4871]\n",
+ "x0=301\n",
+ "d1=[0,0,0]\n",
+ "d2=[0,0]\n",
+ "d3=[0]\n",
+ "for i in range(0,3):\n",
+ " a=y[i]\n",
+ " b=x[i]-x0\n",
+ " c=y[i+1]\n",
+ " e=x[i+1]-x0\n",
+ " d=matrix([[a,b],[c,e]])\n",
+ " d11=det(d)\n",
+ " d1[i]=d11/(x[i+1]-x[i])\n",
+ "for i in range(0,2):\n",
+ " a=d1[i]\n",
+ " b=x[i+1]-x0\n",
+ " c=d1[i+1]\n",
+ " e=x[i+2]-x0\n",
+ " d=matrix([[a,b],[c,e]])\n",
+ " d22=det(d)\n",
+ " f=(x[i+2]-x[i+1])\n",
+ " d2[i]=d22/f\n",
+ "for i in range(0,1):\n",
+ " a=d2[i]\n",
+ " b=x[i+2]-x0\n",
+ " c=d2[i+1]\n",
+ " e=x[i+3]-x0\n",
+ " d=matrix([[a,b],[c,e]])\n",
+ " d33=det(d)\n",
+ " d3[i]=d33/(x[i+3]-x[i+2])\n",
+ "print \"the value of log(%d) is : %f\" %(x0,d3[0])\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value of log(301) is : 2.476900\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.25:pg-118"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#inverse intrpolation\n",
+ "#example 3.25\n",
+ "#page 118\n",
+ "from __future__ import division\n",
+ "x=[2, 3, 4, 5]\n",
+ "y=[8, 27, 64, 125]\n",
+ "d1=[0,0,0]\n",
+ "d2=[0,0]\n",
+ "d3=[0]\n",
+ "for i in range(0,3):\n",
+ " d1[i]=y[i+1]-y[i]\n",
+ "for i in range(0,2):\n",
+ " d2[i]=d1[i+1]-d1[i]\n",
+ "for i in range(0,1):\n",
+ " d3[i]=d2[i+1]-d2[i]\n",
+ "yu=10 #square rooot of 10\n",
+ "y0=y[0]\n",
+ "d=[d1[0], d2[0] ,d3[0]]\n",
+ "u1=(yu-y0)/d1[0]\n",
+ "u2=((yu-y0-u1*(u1-1)*d2[0]/2)/d1[0])\n",
+ "u3=(yu-y0-u2*(u2-1)*d2[0]/2-u2*(u2-1)*(u2-2)*d3[0]/6)/d1[0]\n",
+ "u4=(yu-y0-u3*(u3-1)*d2[0]/2-u3*(u3-1)*(u3-2)*d3[0]/6)/d1[0]\n",
+ "u5=(yu-y0-u4*(u4-1)*d2[0]/2-u4*(u4-1)*(u4-2)*d3[0]/6)/d1[0]\n",
+ "print \"%f \\n %f \\n %f \\n %f \\n %f \\n \" %(u1,u2,u3,u4,u5)\n",
+ "print \"the approximate square root of %d is: %0.3f\" %(yu,x[0]+u5)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.105263 \n",
+ " 0.149876 \n",
+ " 0.153210 \n",
+ " 0.154107 \n",
+ " 0.154347 \n",
+ " \n",
+ "the approximate square root of 10 is: 2.154\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.26:pg-119"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#double interpolation \n",
+ "#example 3.26\n",
+ "#page 119\n",
+ "y=[0, 1, 2, 3, 4]\n",
+ "z=[0,0,0,0,0]\n",
+ "x=[[0, 1, 4, 9, 16],[2, 3, 6, 11, 18],[6, 7, 10, 15, 22],[12, 13, 16, 21, 28],[18, 19, 22, 27, 34]]\n",
+ "print \"X=\"\n",
+ "print x\n",
+ "#for x=2.5\n",
+ "for i in range(0,5):\n",
+ " z[i]=(x[i][2]+x[i][3])/2\n",
+ "#y=1.5\n",
+ "Z=(z[1]+z[2])/2\n",
+ "print \"the interpolated value when x=2.5 and y=1.5 is : %f\" %(Z)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "X=\n",
+ "[[0, 1, 4, 9, 16], [2, 3, 6, 11, 18], [6, 7, 10, 15, 22], [12, 13, 16, 21, 28], [18, 19, 22, 27, 34]]\n",
+ "the interpolated value when x=2.5 and y=1.5 is : 10.500000\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter4_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter4_2.ipynb
new file mode 100644
index 00000000..0ffbc728
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter4_2.ipynb
@@ -0,0 +1,888 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:491578e93659e656ccfdeaf1d5ad50cd42b24dd8a73c6ca4fafe521f6ad022c8"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter04:Least Squares and Fourier Transforms"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.1:pg-128"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4.1\n",
+ "#least square curve fitting procedure\n",
+ "#page 128\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "x=[0,1, 2, 3, 4, 5]\n",
+ "x_2=[0,0,0,0,0,0]\n",
+ "x_y=[0,0,0,0,0,0]\n",
+ "y=[0,0.6, 2.4, 3.5, 4.8, 5.7]\n",
+ "for i in range(1,5):\n",
+ " x_2[i]=x[i]**2\n",
+ " x_y[i]=x[i]*y[i]\n",
+ "S_x=0\n",
+ "S_y=0\n",
+ "S_x2=0 \n",
+ "S_xy=0\n",
+ "S1=0\n",
+ "S2=0\n",
+ "for i in range(1,5):\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+y[i]\n",
+ " S_x2=S_x2+x_2[i]\n",
+ " S_xy=S_xy+x_y[i]\n",
+ "a1=(5*S_xy-S_x*S_y)/(5*S_x2-S_x**2)\n",
+ "a0=S_y/5-a1*S_x/5\n",
+ "print \"x\\t y\\t x^2\\t x*y\\t (y-avg(S_y)) \\t (y-a0-a1x)^2\\n\\n\"\n",
+ "for i in range (1,6):\n",
+ " print \"%d\\t %0.2f\\t %d\\t %0.2f\\t %0.2f\\t %.4f\\t\\n\" %(x[i],y[i],x_2[i],x_y[i],(y[i]-S_y/5)**2,(y[i]-a0-a1*x[i])**2)\n",
+ " S1=S1+(y[i]-S_y/5)**2\n",
+ " S2=S2+(y[i]-a0-a1*x[i])**2\n",
+ "print \"---------------------------------------------------------------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%d\\t %0.2f\\t %d\\t %0.2f\\t %0.2f\\t %0.4f\\t\\n\\n\" %(S_x,S_y,S_x2,S_xy,S1,S2)\n",
+ "cc=math.sqrt((S1-S2)/S1) #correlation coefficient\n",
+ "print \"the correlation coefficient is:%0.4f\" %(cc)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x\t y\t x^2\t x*y\t (y-avg(S_y)) \t (y-a0-a1x)^2\n",
+ "\n",
+ "\n",
+ "1\t 0.60\t 1\t 0.60\t 2.76\t 0.1681\t\n",
+ "\n",
+ "2\t 2.40\t 4\t 4.80\t 0.02\t 0.0196\t\n",
+ "\n",
+ "3\t 3.50\t 9\t 10.50\t 1.54\t 0.0001\t\n",
+ "\n",
+ "4\t 4.80\t 16\t 19.20\t 6.45\t 0.0016\t\n",
+ "\n",
+ "5\t 5.70\t 0\t 0.00\t 11.83\t 0.0961\t\n",
+ "\n",
+ "---------------------------------------------------------------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "10\t 11.30\t 30\t 35.10\t 22.60\t 0.2855\t\n",
+ "\n",
+ "\n",
+ "the correlation coefficient is:0.9937\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.2:pg-129"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4.2\n",
+ "#least square curve fitting procedure\n",
+ "#page 129\n",
+ "from numpy import matrix\n",
+ "x=[0, 2, 5, 7]\n",
+ "y=[-1, 5, 12, 20]\n",
+ "x_2=[0,0,0,0]\n",
+ "xy=[0,0,0,0,]\n",
+ "for i in range (0,4):\n",
+ " x_2[i]=x[i]**2\n",
+ " xy[i]=x[i]*y[i]\n",
+ "print \"x\\t y\\t x^2\\t xy\\t \\n\\n\"\n",
+ "S_x=0 \n",
+ "S_y=0\n",
+ "S_x2=0\n",
+ "S_xy=0\n",
+ "for i in range(0,4):\n",
+ " print \"%d\\t %d\\t %d\\t %d\\t\\n\" %(x[i],y[i],x_2[i],xy[i])\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+y[i]\n",
+ " S_x2=S_x2+x_2[i]\n",
+ " S_xy=S_xy+xy[i]\n",
+ "print \"%d\\t %d\\t %d\\t %d\\t\\n\" %(S_x,S_y,S_x2,S_xy)\n",
+ "A=matrix([[4,S_x],[S_x,S_x2]])\n",
+ "B=matrix([[S_y],[S_xy]])\n",
+ "C=A.I*B\n",
+ "print \"Best straight line fit Y=%.4f+x(%.4f)\" %(C[0][0],C[1][0])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x\t y\t x^2\t xy\t \n",
+ "\n",
+ "\n",
+ "0\t -1\t 0\t 0\t\n",
+ "\n",
+ "2\t 5\t 4\t 10\t\n",
+ "\n",
+ "5\t 12\t 25\t 60\t\n",
+ "\n",
+ "7\t 20\t 49\t 140\t\n",
+ "\n",
+ "14\t 36\t 78\t 210\t\n",
+ "\n",
+ "Best straight line fit Y=-1.1379+x(2.8966)\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.3:pg-130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4.3\n",
+ "#least square curve fitting procedure\n",
+ "#page 130\n",
+ "from numpy import matrix\n",
+ "x=[0, 1, 2, 4, 6]\n",
+ "y=[0, 1, 3, 2, 8]\n",
+ "z=[2, 4, 3, 16, 8]\n",
+ "x2=[0,0,0,0,0]\n",
+ "y2=[0,0,0,0,0]\n",
+ "z2=[0,0,0,0,0]\n",
+ "xy=[0,0,0,0,0]\n",
+ "yz=[0,0,0,0,0]\n",
+ "zx=[0,0,0,0,0]\n",
+ "for i in range(0,5):\n",
+ " x2[i]=x[i]**2\n",
+ " y2[i]=y[i]**2\n",
+ " z2[i]=z[i]**2\n",
+ " xy[i]=x[i]*y[i]\n",
+ " zx[i]=z[i]*x[i]\n",
+ " yz[i]=y[i]*z[i]\n",
+ "S_x=0\n",
+ "S_y=0\n",
+ "S_z=0\n",
+ "S_x2=0\n",
+ "S_y2=0\n",
+ "S_z2=0\n",
+ "S_xy=0\n",
+ "S_zx=0\n",
+ "S_yz=0\n",
+ "for i in range(0,5):\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+y[i]\n",
+ " S_z=S_z+z[i]\n",
+ " S_x2=S_x2+x2[i]\n",
+ " S_y2=S_y2+y2[i]\n",
+ " S_z2=S_z2+z2[i]\n",
+ " S_xy=S_xy+xy[i]\n",
+ " S_zx=S_zx+zx[i]\n",
+ " S_yz=S_yz+yz[i]\n",
+ "print \"x\\t y\\t z\\t x^2\\t xy\\t zx\\t y^2\\t yz\\n\\n\"\n",
+ "for i in range(0,5):\n",
+ " print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\n\" %(x[i],y[i],z[i],x2[i],xy[i],zx[i],y2[i],yz[i])\n",
+ "print \"-------------------------------- --------------------------------------------------------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\n\\n\" %(S_x,S_y,S_z,S_x2,S_xy,S_zx,S_y2,S_yz)\n",
+ "A=matrix([[5,13,14],[13,57,63],[14,63,78]])\n",
+ "B=matrix([[33],[122],[109]])\n",
+ "C=A.I*B\n",
+ "print \"solution of above equation is:a=%d b=%d c=%d\" %(C[0][0],C[1][0],C[2][0])\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x\t y\t z\t x^2\t xy\t zx\t y^2\t yz\n",
+ "\n",
+ "\n",
+ "0\t 0\t 2\t 0\t 0\t 0\t 0\t 0\n",
+ "\n",
+ "1\t 1\t 4\t 1\t 1\t 4\t 1\t 4\n",
+ "\n",
+ "2\t 3\t 3\t 4\t 6\t 6\t 9\t 9\n",
+ "\n",
+ "4\t 2\t 16\t 16\t 8\t 64\t 4\t 32\n",
+ "\n",
+ "6\t 8\t 8\t 36\t 48\t 48\t 64\t 64\n",
+ "\n",
+ "-------------------------------- --------------------------------------------------------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "13\t 14\t 33\t 57\t 63\t 122\t 78\t 109\n",
+ "\n",
+ "\n",
+ "solution of above equation is:a=2 b=5 c=-3\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.4:pg-131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4.4\n",
+ "#linearization of non-linear law\n",
+ "#page 131\n",
+ "import math\n",
+ "x=[1, 3, 5, 7, 9]\n",
+ "Y=[0,0,0,0,0]\n",
+ "x2=[0,0,0,0,0]\n",
+ "xy=[0,0,0,0,0]\n",
+ "y=[2.473, 6.722, 18.274, 49.673, 135.026]\n",
+ "for i in range(0,5):\n",
+ " Y[i]=math.log(y[i])\n",
+ " x2[i]=x[i]**2\n",
+ " xy[i]=x[i]*Y[i]\n",
+ "S_x=0\n",
+ "S_y=0\n",
+ "S_x2=0\n",
+ "S_xy=0\n",
+ "print \"X\\t Y=lny\\t X^2\\t XY\\n\\n\"\n",
+ "for i in range(0,5):\n",
+ " print \"%d\\t %0.3f\\t %d\\t %0.3f\\n\" %(x[i],Y[i],x2[i],xy[i])\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+Y[i]\n",
+ " S_x2=S_x2+x2[i]\n",
+ " S_xy=S_xy+xy[i]\n",
+ "print \"----------------------------------------------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%d\\t %0.3f\\t %d\\t %0.3f\\t\\n\\n\" %(S_x,S_y,S_x2,S_xy)\n",
+ "A1=((S_x/5)*S_xy-S_x*S_y)/((S_x/5)*S_x2-S_x**2)\n",
+ "A0=(S_y/5)-A1*(S_x/5)\n",
+ "a=math.exp(A0)\n",
+ "print \"y=%0.3fexp(%0.2fx)\" %(a,A1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "X\t Y=lny\t X^2\t XY\n",
+ "\n",
+ "\n",
+ "1\t 0.905\t 1\t 0.905\n",
+ "\n",
+ "3\t 1.905\t 9\t 5.716\n",
+ "\n",
+ "5\t 2.905\t 25\t 14.527\n",
+ "\n",
+ "7\t 3.905\t 49\t 27.338\n",
+ "\n",
+ "9\t 4.905\t 81\t 44.149\n",
+ "\n",
+ "----------------------------------------------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "25\t 14.527\t 165\t 92.636\t\n",
+ "\n",
+ "\n",
+ "y=1.500exp(0.50x)\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.5:pg-131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4.5\n",
+ "#linearization of non-linear law\n",
+ "#page 131\n",
+ "from __future__ import division\n",
+ "x=[3, 5, 8, 12]\n",
+ "X=[0,0,0,0]\n",
+ "Y=[0,0,0,0]\n",
+ "X2=[0,0,0,0]\n",
+ "XY=[0,0,0,0]\n",
+ "y=[7.148, 10.231, 13.509, 16.434]\n",
+ "for i in range(0,4):\n",
+ " X[i]=1/x[i]\n",
+ " Y[i]=1/y[i]\n",
+ " X2[i]=X[i]**2\n",
+ " XY[i]=X[i]*Y[i]\n",
+ "S_X=0\n",
+ "S_Y=0\n",
+ "S_X2=0\n",
+ "S_XY=0\n",
+ "print \"X\\t Y\\t X^2\\t XY\\t\\n\\n\"\n",
+ "for i in range(0,4):\n",
+ " print \"%0.3f\\t %0.3f\\t %0.3f\\t %0.3f\\t\\n\" %(X[i],Y[i],X2[i],XY[i])\n",
+ " S_X=S_X+X[i]\n",
+ " S_Y=S_Y+Y[i]\n",
+ " S_X2=S_X2+X2[i]\n",
+ " S_XY=S_XY+XY[i]\n",
+ "print \"----------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%0.3f\\t %0.3f\\t %0.3f\\t %0.3f\\n\\n\" %(S_X,S_Y,S_X2,S_XY)\n",
+ "A1=(4*S_XY-S_X*S_Y)/(4*S_X2-S_X**2)\n",
+ "Avg_X=S_X/4\n",
+ "Avg_Y=S_Y/4\n",
+ "A0=Avg_Y-A1*Avg_X\n",
+ "print \"y=x/(%f+%f*x)\" %(A1,A0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "X\t Y\t X^2\t XY\t\n",
+ "\n",
+ "\n",
+ "0.333\t 0.140\t 0.111\t 0.047\t\n",
+ "\n",
+ "0.200\t 0.098\t 0.040\t 0.020\t\n",
+ "\n",
+ "0.125\t 0.074\t 0.016\t 0.009\t\n",
+ "\n",
+ "0.083\t 0.061\t 0.007\t 0.005\t\n",
+ "\n",
+ "----------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "0.742\t 0.373\t 0.174\t 0.081\n",
+ "\n",
+ "\n",
+ "y=x/(0.316200+0.034500*x)\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.6:pg-134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4.6\n",
+ "#curve fitting by polynomial\n",
+ "#page 134\n",
+ "from numpy import matrix\n",
+ "x=[0, 1, 2]\n",
+ "y=[1, 6, 17]\n",
+ "x2=[0,0,0]\n",
+ "x3=[0,0,0]\n",
+ "x4=[0,0,0]\n",
+ "xy=[0,0,0]\n",
+ "x2y=[0,0,0]\n",
+ "for i in range(0,3):\n",
+ " x2[i]=x[i]**2\n",
+ " x3[i]=x[i]**3\n",
+ " x4[i]=x[i]**4\n",
+ " xy[i]=x[i]*y[i]\n",
+ " x2y[i]=x2[i]*y[i]\n",
+ "print \"x\\t y\\t x^2\\t x^3\\t x^4\\t x*y\\t x^2*y\\t\\n\\n\"\n",
+ "S_x=0\n",
+ "S_y=0\n",
+ "S_x2=0\n",
+ "S_x3=0\n",
+ "S_x4=0\n",
+ "S_xy=0\n",
+ "S_x2y=0\n",
+ "for i in range(0,3):\n",
+ " print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\n\" %(x[i],y[i],x2[i],x3[i],x4[i],xy[i],x2y[i])\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+y[i]\n",
+ " S_x2=S_x2+x2[i]\n",
+ " S_x3=S_x3+x3[i]\n",
+ " S_x4=S_x4+x4[i]\n",
+ " S_xy=S_xy+xy[i]\n",
+ " S_x2y=S_x2y+x2y[i]\n",
+ "print \"--------------------------------------------------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\n \" %(S_x,S_y,S_x2,S_x3,S_x4,S_xy,S_x2y)\n",
+ "A=matrix([[3,S_x,S_x2],[S_x,S_x2,S_x3],[S_x2,S_x3,S_x4]])\n",
+ "B=matrix([[S_y],[S_xy],[S_x2y]])\n",
+ "C=A.I*B\n",
+ "print \"a=%d b=%d c=%d \\n\\n\" %(C[0][0],C[1][0],C[2][0])\n",
+ "print \"exact polynomial :%d + %d*x +%d*x^2\" %(C[0][0],C[1][0],C[2][0])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x\t y\t x^2\t x^3\t x^4\t x*y\t x^2*y\t\n",
+ "\n",
+ "\n",
+ "0\t 1\t 0\t 0\t 0\t 0\t 0\n",
+ "\n",
+ "1\t 6\t 1\t 1\t 1\t 6\t 6\n",
+ "\n",
+ "2\t 17\t 4\t 8\t 16\t 34\t 68\n",
+ "\n",
+ "--------------------------------------------------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "3\t 24\t 5\t 9\t 17\t 40\t 74\n",
+ " \n",
+ "a=1 b=2 c=3 \n",
+ "\n",
+ "\n",
+ "exact polynomial :1 + 2*x +3*x^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.7:pg-134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 4.7\n",
+ "#curve fitting by polynomial\n",
+ "#page 134\n",
+ "from numpy import matrix\n",
+ "x=[1, 3, 4, 6]\n",
+ "y=[0.63, 2.05, 4.08, 10.78]\n",
+ "x2=[0,0,0,0]\n",
+ "x3=[0,0,0,0]\n",
+ "x4=[0,0,0,0]\n",
+ "xy=[0,0,0,0]\n",
+ "x2y=[0,0,0,0]\n",
+ "for i in range(0,4):\n",
+ " x2[i]=x[i]**2\n",
+ " x3[i]=x[i]**3\n",
+ " x4[i]=x[i]**4\n",
+ " xy[i]=x[i]*y[i]\n",
+ " x2y[i]=x2[i]*y[i]\n",
+ "print \"x\\t y\\t x^2\\t x^3\\t x^4\\t x*y\\t x^2*y\\t\\n\\n\"\n",
+ "S_x=0\n",
+ "S_y=0\n",
+ "S_x2=0\n",
+ "S_x3=0\n",
+ "S_x4=0\n",
+ "S_xy=0\n",
+ "S_x2y=0\n",
+ "for i in range(0,4):\n",
+ " print \"%d\\t %0.3f\\t %d\\t %d\\t %d\\t %0.3f\\t %d\\n\" %(x[i],y[i],x2[i],x3[i],x4[i],xy[i],x2y[i])\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+y[i]\n",
+ " S_x2=S_x2+x2[i]\n",
+ " S_x3=S_x3+x3[i]\n",
+ " S_x4=S_x4+x4[i]\n",
+ " S_xy=S_xy+xy[i]\n",
+ " S_x2y=S_x2y+x2y[i]\n",
+ "print \"---------------------------------------------------------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%d\\t %0.3f\\t %d\\t %d\\t %d\\t %0.3f\\t %0.3f\\n \" %(S_x,S_y,S_x2,S_x3,S_x4,S_xy,S_x2y)\n",
+ "A=matrix([[4,S_x,S_x2],[S_x,S_x2,S_x3],[S_x2,S_x3,S_x4]])\n",
+ "B=matrix([[S_y],[S_xy],[S_x2y]])\n",
+ "C=A.I*B\n",
+ "print \"a=%0.2f b=%0.2f c=%0.2f \\n\\n\" %(C[0][0],C[1][0],C[2][0])\n",
+ "print \"exact polynomial :%0.2f + %0.2f*x +%0.2f*x^2\" %(C[0][0],C[1][0],C[2][0])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x\t y\t x^2\t x^3\t x^4\t x*y\t x^2*y\t\n",
+ "\n",
+ "\n",
+ "1\t 0.630\t 1\t 1\t 1\t 0.630\t 0\n",
+ "\n",
+ "3\t 2.050\t 9\t 27\t 81\t 6.150\t 18\n",
+ "\n",
+ "4\t 4.080\t 16\t 64\t 256\t 16.320\t 65\n",
+ "\n",
+ "6\t 10.780\t 36\t 216\t 1296\t 64.680\t 388\n",
+ "\n",
+ "---------------------------------------------------------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "14\t 17.540\t 62\t 308\t 1634\t 87.780\t 472.440\n",
+ " \n",
+ "a=1.24 b=-1.05 c=0.44 \n",
+ "\n",
+ "\n",
+ "exact polynomial :1.24 + -1.05*x +0.44*x^2\n"
+ ]
+ }
+ ],
+ "prompt_number": 42
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.8:pg-137"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#curve fitting by sum of exponentials\n",
+ "#example 4.8\n",
+ "#page 137\n",
+ "import math\n",
+ "from numpy import matrix\n",
+ "x=[1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8]\n",
+ "y=[1.54, 1.67, 1.81, 1.97, 2.15, 2.35, 2.58, 2.83, 3.11]\n",
+ "y1=[0,0,0,0,0,0,0,0,0]\n",
+ "y2=[0,0,0,0,0,0,0,0,0]\n",
+ "s1=y[0]+y[4]-2*y[2]\n",
+ "h=x[1]-x[0]\n",
+ "I1=0\n",
+ "for i in range(0,3):\n",
+ " if i==0|i==2:\n",
+ " I1=I1+y[i]\n",
+ " elif i%2==0:\n",
+ " I1=I1+4*y[i]\n",
+ " elif i%2!=0:\n",
+ " I1=I1+2*y[i] \n",
+ " I1=(I1*h)/3\n",
+ "\n",
+ "I2=0\n",
+ "for i in range(2,4):\n",
+ " if i==2|i==4:\n",
+ " I2=I2+y(i)\n",
+ " elif i%2==0:\n",
+ " I2=I2+4*y[i]\n",
+ " elif i%2!=0:\n",
+ " I2=I2+2*y[i] \n",
+ " \n",
+ " I2=(I2*h)/3\n",
+ " for i in range(0,4):\n",
+ " y1[i]=(1.0-x[i])*y[i]\n",
+ " for i in range(4,8):\n",
+ " y2[i]=(1.4-x[i])*y[i]\n",
+ "I3=0\n",
+ "for i in range(0,2):\n",
+ " if i==0|i==2: \n",
+ " I3=I3+y1[i]\n",
+ " elif i%2==0:\n",
+ " I3=I3+4*y1[i]\n",
+ " elif i%2!=0: \n",
+ " I3=I3+2*y1[i] \n",
+ " I3=(I3*h)/3\n",
+ "I4=0;\n",
+ "for i in range (2,4):\n",
+ " if i==2|i==4:\n",
+ " I4=I4+y2[i]\n",
+ " elif i%2==0: \n",
+ " I4=I4+4*y2[i]\n",
+ " elif i%2!=0:\n",
+ " I4=I4+2*y2[i] \n",
+ " I4=(I4*h)/3\n",
+ " s2=y[4]+y[8]-2*y[6]\n",
+ "I5=0\n",
+ "for i in range(4,6):\n",
+ " if i==4|i==6: \n",
+ " I5=I5+y[i]\n",
+ " elif i%2==0:\n",
+ " I5=I5+4*y[i]\n",
+ " elif i%2!=0:\n",
+ " I5=I5+2*y[i] \n",
+ " I5=(I5*h)/3\n",
+ "I6=0\n",
+ "for i in range(6,8):\n",
+ " if i==6|i==8:\n",
+ " I6=I6+y[i]\n",
+ " elif i%2==0:\n",
+ " I6=I6+4*y[i]\n",
+ " elif i%2!=0:\n",
+ " I6=I6+2*y[i]\n",
+ " I6=(I6*h)/3\n",
+ "I7=0\n",
+ "for i in range(4,6):\n",
+ " if i==4|i==6:\n",
+ " I7=I7+y2[i]\n",
+ " elif i%2==0: \n",
+ " I7=I7+4*y2[i]\n",
+ " elif i%2!=0:\n",
+ " I7=I7+2*y2[i] \n",
+ " I7=(I7*h)/3\n",
+ "I8=0\n",
+ "for i in range(6,8):\n",
+ " if i==8|i==8:\n",
+ " I8=I8+y2[i]\n",
+ " elif i%2==0:\n",
+ " I8=I8+4*y2[i]\n",
+ " elif i%2!=0:\n",
+ " I8=I8+2*y2[i]\n",
+ " I8=(I8*h)/3\n",
+ "A=matrix([[1.81, 2.180],[2.88, 3.104]])\n",
+ "C=matrix([[2.10],[3.00]])\n",
+ "Z=A.I*C\n",
+ "p = np.poly1d([1,Z[0][0],Z[1][0]])\n",
+ "print \"the unknown value of equation is 1 -1 \" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the unknown value of equation is 1 -1 \n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Es4.9:pg-139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#linear weighted least approx\n",
+ "#example 4.9\n",
+ "#page 139\n",
+ "from numpy import matrix\n",
+ "x=[0, 2, 5, 7]\n",
+ "y=[-1, 5, 12, 20]\n",
+ "w=10 #given weight 10\n",
+ "W=[1, 1, 10, 1]\n",
+ "Wx=[0,0,0,0]\n",
+ "Wx2=[0,0,0,0]\n",
+ "Wx3=[0,0,0,0]\n",
+ "Wy=[0,0,0,0]\n",
+ "Wxy=[0,0,0,0]\n",
+ "for i in range(0,4):\n",
+ " Wx[i]=W[i]*x[i]\n",
+ " Wx2[i]=W[i]*x[i]**2\n",
+ " Wx3[i]=W[i]*x[i]**3\n",
+ " Wy[i]=W[i]*y[i]\n",
+ " Wxy[i]=W[i]*x[i]*y[i]\n",
+ "S_x=0\n",
+ "S_y=0\n",
+ "S_W=0\n",
+ "S_Wx=0\n",
+ "S_Wx2=0\n",
+ "S_Wy=0\n",
+ "S_Wxy=0\n",
+ "for i in range(0,4):\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+y[i]\n",
+ " S_W=S_W+W[i]\n",
+ " S_Wx=S_Wx+Wx[i]\n",
+ " S_Wx2=S_Wx2+Wx2[i]\n",
+ " S_Wy=S_Wy+Wy[i]\n",
+ " S_Wxy=S_Wxy+Wxy[i]\n",
+ "A=matrix([[S_W,S_Wx],[S_Wx,S_Wx2]])\n",
+ "C=matrix([[S_Wy],[S_Wxy]])\n",
+ "print \"x\\t y\\t W\\t Wx\\t Wx^2\\t Wy\\t Wxy\\t\\n\\n\"\n",
+ "for i in range(0,4):\n",
+ " print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\t\\n\" %(x[i],y[i],W[i],Wx[i],Wx2[i],Wy[i],Wxy[i])\n",
+ "print \"-------------------------------------------------------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\t\\n\" %(S_x,S_y,S_W,S_Wx,S_Wx2,S_Wy,S_Wxy)\n",
+ "X=A.I*C;\n",
+ "print \"\\n\\nthe equation is y=%f+%fx\" %(X[0][0],X[1][0])\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x\t y\t W\t Wx\t Wx^2\t Wy\t Wxy\t\n",
+ "\n",
+ "\n",
+ "0\t -1\t 1\t 0\t 0\t -1\t 0\t\n",
+ "\n",
+ "2\t 5\t 1\t 2\t 4\t 5\t 10\t\n",
+ "\n",
+ "5\t 12\t 10\t 50\t 250\t 120\t 600\t\n",
+ "\n",
+ "7\t 20\t 1\t 7\t 49\t 20\t 140\t\n",
+ "\n",
+ "-------------------------------------------------------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "14\t 36\t 13\t 59\t 303\t 144\t 750\t\n",
+ "\n",
+ "\n",
+ "\n",
+ "the equation is y=-1.349345+2.737991x\n"
+ ]
+ }
+ ],
+ "prompt_number": 77
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.10:pg-139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#linear weighted least approx\n",
+ "#example 4.10\n",
+ "#page 139\n",
+ "x=[0, 2, 5, 7]\n",
+ "y=[-1, 5, 12, 20]\n",
+ "w=100 #given weight 100\n",
+ "W=[1, 1, 100, 1]\n",
+ "Wx=[0,0,0,0]\n",
+ "Wx2=[0,0,0,0]\n",
+ "Wx3=[0,0,0,0]\n",
+ "Wy=[0,0,0,0]\n",
+ "Wxy=[0,0,0,0]\n",
+ "for i in range(0,4):\n",
+ " Wx[i]=W[i]*x[i]\n",
+ " Wx2[i]=W[i]*x[i]**2\n",
+ " Wx3[i]=W[i]*x[i]**3\n",
+ " Wy[i]=W[i]*y[i]\n",
+ " Wxy[i]=W[i]*x[i]*y[i]\n",
+ "S_x=0\n",
+ "S_y=0\n",
+ "S_W=0\n",
+ "S_Wx=0\n",
+ "S_Wx2=0\n",
+ "S_Wy=0\n",
+ "S_Wxy=0\n",
+ "for i in range(0,4):\n",
+ " S_x=S_x+x[i]\n",
+ " S_y=S_y+y[i]\n",
+ " S_W=S_W+W[i]\n",
+ " S_Wx=S_Wx+Wx[i]\n",
+ " S_Wx2=S_Wx2+Wx2[i]\n",
+ " S_Wy=S_Wy+Wy[i]\n",
+ " S_Wxy=S_Wxy+Wxy[i]\n",
+ "A=matrix([[S_W,S_Wx],[S_Wx,S_Wx2]])\n",
+ "C=matrix([[S_Wy],[S_Wxy]])\n",
+ "print \"x\\t y\\t W\\t Wx\\t Wx^2\\t Wy\\t Wxy\\t\\n\\n\"\n",
+ "for i in range(0,4):\n",
+ " print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\t\\n\" %(x[i],y[i],W[i],Wx[i],Wx2[i],Wy[i],Wxy[i])\n",
+ "print \"-------------------------------------------------------------------------------------------------------------------------------------\\n\\n\"\n",
+ "print \"%d\\t %d\\t %d\\t %d\\t %d\\t %d\\t %d\\t\\n\" %(S_x,S_y,S_W,S_Wx,S_Wx2,S_Wy,S_Wxy)\n",
+ "X=A.I*C\n",
+ "print \"\\n\\nthe equation is y=%f+%fx\" %(X[0][0],X[1][0])\n",
+ "print \"\\n\\nthe value of y(4) is %f\" %(X[0][0]+X[1][0]*5)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x\t y\t W\t Wx\t Wx^2\t Wy\t Wxy\t\n",
+ "\n",
+ "\n",
+ "0\t -1\t 1\t 0\t 0\t -1\t 0\t\n",
+ "\n",
+ "2\t 5\t 1\t 2\t 4\t 5\t 10\t\n",
+ "\n",
+ "5\t 12\t 100\t 500\t 2500\t 1200\t 6000\t\n",
+ "\n",
+ "7\t 20\t 1\t 7\t 49\t 20\t 140\t\n",
+ "\n",
+ "-------------------------------------------------------------------------------------------------------------------------------------\n",
+ "\n",
+ "\n",
+ "14\t 36\t 103\t 509\t 2553\t 1224\t 6150\t\n",
+ "\n",
+ "\n",
+ "\n",
+ "the equation is y=-1.412584+2.690562x\n",
+ "\n",
+ "\n",
+ "the value of y(4) is 12.040227\n"
+ ]
+ }
+ ],
+ "prompt_number": 82
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter6_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter6_2.ipynb
new file mode 100644
index 00000000..7faef1ea
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter6_2.ipynb
@@ -0,0 +1,1068 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:f89b91b8c25ad887942affb48e813afa9449ad54d5e7ab1cf115acac70bf5f26"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter06:Numerical Differentiation and Integration"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.1:pg-201"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.1\n",
+ "#numerical diffrentiation by newton's difference formula \n",
+ "#page 210\n",
+ "x=[1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2]\n",
+ "y=[2.7183, 3.3201, 4.0552, 4.9530, 6.0496, 7.3891, 9.0250]\n",
+ "c=0\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "d5=[0,0]\n",
+ "d6=[0]\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d5[c]=d4[i+1]-d4[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,1):\n",
+ " d6[c]=d5[i+1]-d5[i]\n",
+ " c=c+1;\n",
+ "x0=1.2 #first and second derivative at 1.2\n",
+ "h=0.2\n",
+ "f1=((d1[1]-d2[1]/2+d3[1]/3-d4[1]/4+d5[1]/5)/h)\n",
+ "print \"the first derivative of fuction at 1.2 is:%f\\n\" %(f1)\n",
+ "f2=(d2[1]-d3[1]+(11*d4[1])/12-(5*d5[1])/6)/h**2\n",
+ "print \"the second derivative of fuction at 1.2 is:%f\\n\" %(f2)\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.2:pg-211"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.2\n",
+ "#numerical diffrentiation by newton's difference formula \n",
+ "#page 211\n",
+ "x=[1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2]\n",
+ "y=[2.7183, 3.3201, 4.0552, 4.9530, 6.0496, 7.3891, 9.0250]\n",
+ "c=0\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "d5=[0,0]\n",
+ "d6=[0]\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d5[c]=d4[i+1]-d4[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,1):\n",
+ " d6[c]=d5[i+1]-d5[i]\n",
+ " c=c+1;\n",
+ "x0=2.2 #first and second derivative at 2.2\n",
+ "h=0.2\n",
+ "f1=((d1[5]+d2[4]/2+d3[3]/3+d4[2]/4+d5[1]/5)/h)\n",
+ "print \"the first derivative of fuction at 1.2 is:%f\\n\" %(f1)\n",
+ "f2=(d2[4]+d3[3]+(11*d4[2])/12+(5*d5[1])/6)/h**2\n",
+ "print \"the second derivative of fuction at 1.2 is:%f\\n\" %(f2)\n",
+ "x1=2.0 # first derivative also at 2.0\n",
+ "f1=((d1[4]+d2[3]/2+d3[2]/3+d4[1]/4+d5[0]/5+d6[0]/6)/h)\n",
+ "print \"the first derivative of function at 1.2 is:%f\\n\" %(f1)\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the first derivative of fuction at 1.2 is:9.022817\n",
+ "\n",
+ "the second derivative of fuction at 1.2 is:8.992083\n",
+ "\n",
+ "the first derivative of function at 1.2 is:7.389633\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.3:pg-211"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.3\n",
+ "#numerical diffrentiation by newton's difference formula \n",
+ "#page 211\n",
+ "x=[1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2]\n",
+ "y=[2.7183, 3.3201, 4.0552, 4.9530, 6.0496, 7.3891, 9.0250]\n",
+ "c=0\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "d5=[0,0]\n",
+ "d6=[0]\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d5[c]=d4[i+1]-d4[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,1):\n",
+ " d6[c]=d5[i+1]-d5[i]\n",
+ " c=c+1;\n",
+ "x0=1.6 #first and second derivative at 1.6\n",
+ "h=0.2\n",
+ "f1=(((d1[2]+d1[3])/2-(d3[1]+d3[2])/4+(d5[0]+d5[1])/60))/h\n",
+ "print \"the first derivative of function at 1.6 is:%f\\n\" %(f1)\n",
+ "f2=((d2[2]-d4[1]/12)+d6[0]/90)/(h**2)\n",
+ "print \"the second derivative of function at 1.6 is:%f\\n\" %(f2)\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the first derivative of function at 1.6 is:4.885975\n",
+ "\n",
+ "the second derivative of function at 1.6 is:4.953361\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.4:pg-213"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.4\n",
+ "#estimation of errors \n",
+ "#page 213\n",
+ "x=[1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2]\n",
+ "y=[2.7183, 3.3201, 4.0552, 4.9530, 6.0496, 7.3891, 9.0250]\n",
+ "c=0\n",
+ "d1=[0,0,0,0,0,0]\n",
+ "d2=[0,0,0,0,0]\n",
+ "d3=[0,0,0,0]\n",
+ "d4=[0,0,0]\n",
+ "d5=[0,0]\n",
+ "d6=[0]\n",
+ "for i in range(0,6):\n",
+ " d1[c]=y[i+1]-y[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,5):\n",
+ " d2[c]=d1[i+1]-d1[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,4):\n",
+ " d3[c]=d2[i+1]-d2[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,3):\n",
+ " d4[c]=d3[i+1]-d3[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " d5[c]=d4[i+1]-d4[i]\n",
+ " c=c+1;\n",
+ "c=0\n",
+ "for i in range(0,1):\n",
+ " d6[c]=d5[i+1]-d5[i]\n",
+ " c=c+1\n",
+ "x0=1.6 #first and second derivative at 1.6\n",
+ "h=0.2\n",
+ "f1=((d1[1]-d2[1]/2+d3[1]/3-d4[1]/4+d5[1]/5)/h)\n",
+ "print \"the first derivative of fuction at 1.2 is:%f\\n\" %(f1)\n",
+ "f2=(d2[1]-d3[1]+(11*d4[1])/12-(5*d5[1])/6)/h**2\n",
+ "print \"the second derivative of fuction at 1.2 is:%f\\n\" %(f2)\n",
+ "T_error1=((d3[1]+d3[2])/2)/(6*h) #truncation error\n",
+ "e=0.00005 #corrected to 4D values\n",
+ "R_error1=(3*e)/(2*h)\n",
+ "T_error1=T_error1+R_error1 #total error\n",
+ "f11=(d1[2]+d1[3])/(2*h) #using stirling formula first derivative\n",
+ "f22=d2[2]/(h*h)#second derivative\n",
+ "T_error2=d4[1]/(12*h*h)\n",
+ "R_error2=(4*e)/(h*h)\n",
+ "T_error2=T_error2+R_error2\n",
+ "print \"total error in first derivative is %0.4g:\\n\" %(T_error1)\n",
+ "print \"total error in second derivative is %0.4g:\" %(T_error2)\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the first derivative of fuction at 1.2 is:3.320317\n",
+ "\n",
+ "the second derivative of fuction at 1.2 is:3.319167\n",
+ "\n",
+ "total error in first derivative is 0.03379:\n",
+ "\n",
+ "total error in second derivative is 0.02167:\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.5:pg-214"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic spline method\n",
+ "#example 6.5\n",
+ "#page 214\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "x=[0, math.pi/2, math.pi]\n",
+ "y=[0, 1, 0]\n",
+ "M0=0\n",
+ "M2=0\n",
+ "h=math.pi/2\n",
+ "M1=(6*(y[0]-2*y[1]+y[2])/(h**2)-M0-M2)/4\n",
+ "def s1(x):\n",
+ " return (2/math.pi)*(-2*3*x*x/(math.pi**2)+3/2)\n",
+ "S1=s1(math.pi/4)\n",
+ "print \"S1(pi/4)=%f\" %(S1)\n",
+ "def s2(x):\n",
+ " return (-24*x)/(math.pi**3)\n",
+ "S2=s2(math.pi/4)\n",
+ "print \"S2(pi/4)=%f\" %(S2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "S1(pi/4)=0.716197\n",
+ "S2(pi/4)=-0.607927\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.6:pg-216"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#derivative by cubic spline method\n",
+ "#example 6.6\n",
+ "#page 216\n",
+ "x=[-2, -1, 2, 3]\n",
+ "y=[-12, -8, 3, 5] \n",
+ "def f(x):\n",
+ " return x**3/15-3*x**2/20+241*x/60-3.9\n",
+ "def s2(x):\n",
+ " return (((2-x)**3)/6*(14/55)+((x+1)**3)/6*(-74/55))/3+(-8-21/55)*(2-x)/3+(3-(9/6)*(-74/55))*(x+1)/3\n",
+ "h=0.0001\n",
+ "x0=1.0\n",
+ "y1=(s2(x0+h)-s2(x0))/h\n",
+ "print \"the value y1(%0.2f) is : %f\" %(x0,y1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value y1(1.00) is : 3.527232\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.7:pg-218"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#maximun and minimun of functions\n",
+ "#example 6.7\n",
+ "#page 218\n",
+ "x=[1.2, 1.3, 1.4, 1.5, 1.6]\n",
+ "y=[0.9320, 0.9636, 0.9855, 0.9975, 0.9996]\n",
+ "d1=[0,0,0,0]\n",
+ "d2=[0,0,0]\n",
+ "for i in range(0,4):\n",
+ " d1[i]=y[i+1]-y[i]\n",
+ "for i in range(0,3):\n",
+ " d2[i]=d1[i+1]-d1[i]\n",
+ "p=(-d1[0]*2/d2[0]+1)/2;\n",
+ "print \"p=%f\" %(p)\n",
+ "h=0.1\n",
+ "x0=1.2\n",
+ "X=x0+p*h\n",
+ "print \" the value of X correct to 2 decimal places is : %0.2f\" %(X)\n",
+ "Y=y[4]-0.2*d1[3]+(-0.2)*(-0.2+1)*d2[2]/2\n",
+ "print \"the value Y=%f\" %(Y)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "p=3.757732\n",
+ " the value of X correct to 2 decimal places is : 1.58\n",
+ "the value Y=0.999972\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.8:pg-226"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.8\n",
+ "#trapezoidal method for integration\n",
+ "#page 226\n",
+ "from __future__ import division\n",
+ "x=[7.47, 7.48, 7.49, 7.0, 7.51, 7.52]\n",
+ "f_x=[1.93, 1.95, 1.98, 2.01, 2.03, 2.06]\n",
+ "h=x[1]-x[0]\n",
+ "l=6\n",
+ "area=0\n",
+ "for i in range(0,l):\n",
+ " if i==0:\n",
+ " area=area+f_x[i]\n",
+ " elif i==l-1:\n",
+ " area=area+f_x[i]\n",
+ " else:\n",
+ " area=area+2*f_x[i]\n",
+ "area=area*(h/2)\n",
+ "print \"area bounded by the curve is %f\" %(area)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "area bounded by the curve is 0.099650\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.9:pg-226"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.9\n",
+ "#simpson 1/3rd method for integration\n",
+ "#page 226\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "x=[0,0.00, 0.25, 0.50, 0.75, 1.00]\n",
+ "y=[0,1.000, 0.9896, 0.9589, 0.9089, 0.8415]\n",
+ "h=x[2]-x[1]\n",
+ "area=0\n",
+ "for i in range(0,6):\n",
+ " y[i]=y[i]**2\n",
+ "for i in range(1,6):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==5:\n",
+ " area=area+y[i]\n",
+ " elif i%2==0:\n",
+ " area=area+4*y[i]\n",
+ " elif i%2!=0: \n",
+ " area=area+2*y[i]\n",
+ "area=(area/3)*(h*math.pi)\n",
+ "print \"area bounded by the curve is %f\" %(area)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "area bounded by the curve is 2.819247\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.10:pg-228"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.10\n",
+ "#integration by trapezoidal and simpson's method\n",
+ "#page 228\n",
+ "from __future__ import division\n",
+ "def f(x):\n",
+ " return 1/(1+x)\n",
+ "h=0.5\n",
+ "x=[0,0.0,0.5,1.0]\n",
+ "y=[0,0,0,0]\n",
+ "l=4\n",
+ "for i in range(0,l):\n",
+ " y[i]=f(x[i])\n",
+ "area=0 #trapezoidal method\n",
+ "for i in range(1,l):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " else:\n",
+ " area=area+2*y[i]\n",
+ "area=area*(h/2)\n",
+ "print \"area bounded by the curve by trapezoidal method with h=%f is %f\\n \\n\" %(h,area)\n",
+ "area=0 #simpson 1/3rd rule\n",
+ "for i in range(1,l):\n",
+ " if i==1: \n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " elif i%2==0:\n",
+ " area=area+4*y[i]\n",
+ " elif i%2!=0:\n",
+ " area=area+2*y[i]\n",
+ "area=(area*h)/3\n",
+ "print \"area bounded by the curve by simpson 1/3rd method with h=%f is %f\\n \\n\" %(h,area)\n",
+ "h=0.25\n",
+ "x=[0,0.0,0.25,0.5,0.75,1.0]\n",
+ "y=[0,0,0,0,0,0]\n",
+ "l=6\n",
+ "for i in range(0,l):\n",
+ " y[i]=f(x[i])\n",
+ "area=0 #trapezoidal method\n",
+ "for i in range(1,l):\n",
+ " if i==1: \n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " else:\n",
+ " area=area+2*y[i]\n",
+ "area=area*(h/2)\n",
+ "print \"area bounded by the curve by trapezoidal method with h=%f is %f\\n \\n\" %(h,area)\n",
+ "area=0 #simpson 1/3rd rule\n",
+ "for i in range(1,l):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " elif i%2==0:\n",
+ " area=area+4*y[i]\n",
+ " elif i%2!=0:\n",
+ " area=area+2*y[i]\n",
+ "area=(area*h)/3\n",
+ "print \"area bounded by the curve by simpson 1/3rd method with h=%f is %f\\n \\n\" %(h,area)\n",
+ "h=0.125\n",
+ "x=[0,0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0]\n",
+ "y=[0,0,0,0,0,0,0,0,0,0]\n",
+ "l=10\n",
+ "for i in range(0,l):\n",
+ " y[i]=f(x[i])\n",
+ "area=0 #trapezoidal method\n",
+ "for i in range(1,l):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " elif i%2==0:\n",
+ " area=area+2*y[i]\n",
+ " elif i%2!=0:\n",
+ " area=area+2*y[i]\n",
+ "area=area*(h/2)\n",
+ "print \"area bounded by the curve by trapezoidal method with h=%f is %f\\n \\n\" %(h,area)\n",
+ "area=0 #simpson 1/3rd rule\n",
+ "for i in range(1,l):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " elif i%2==0:\n",
+ " area=area+4*y[i]\n",
+ " elif i%2!=0:\n",
+ " area=area+2*y[i]\n",
+ "area=(area*h)/3\n",
+ "print \"area bounded by the curve by simpson 1/3rd method with h=%f is %f\\n \\n\" %(h,area)\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ " \n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "area bounded by the curve by trapezoidal method with h=0.500000 is 0.708333\n",
+ " \n",
+ "\n",
+ "area bounded by the curve by simpson 1/3rd method with h=0.500000 is 0.694444\n",
+ " \n",
+ "\n",
+ "area bounded by the curve by trapezoidal method with h=0.250000 is 0.697024\n",
+ " \n",
+ "\n",
+ "area bounded by the curve by simpson 1/3rd method with h=0.250000 is 0.693254\n",
+ " \n",
+ "\n",
+ "area bounded by the curve by trapezoidal method with h=0.125000 is 0.694122\n",
+ " \n",
+ "\n",
+ "area bounded by the curve by simpson 1/3rd method with h=0.125000 is 0.693155\n",
+ " \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.11:pg-229"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.11\n",
+ "#rommberg's method\n",
+ "#page 229\n",
+ "from __future__ import division\n",
+ "def f(x):\n",
+ " return 1/(1+x)\n",
+ "k=0\n",
+ "h=0.5\n",
+ "x=[0,0.0,0.5,1.0]\n",
+ "y=[0,0,0,0]\n",
+ "I=[0,0,0]\n",
+ "I1=[0,0]\n",
+ "T2=[0]\n",
+ "l=4\n",
+ "for i in range(0,l):\n",
+ " y[i]=f(x[i])\n",
+ "area=0 #trapezoidal method\n",
+ "for i in range(1,l):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " else:\n",
+ " area=area+2*y[i]\n",
+ "area=area*(h/2)\n",
+ "I[k]=area\n",
+ "k=k+1\n",
+ "h=0.25\n",
+ "x=[0,0.0,0.25,0.5,0.75,1.0]\n",
+ "y=[0,0,0,0,0,0]\n",
+ "l=6\n",
+ "for i in range(0,l):\n",
+ " y[i]=f(x[i])\n",
+ "area=0 #trapezoidal method\n",
+ "for i in range(1,l):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " else:\n",
+ " area=area+2*y[i]\n",
+ "area=area*(h/2)\n",
+ "I[k]=area\n",
+ "k=k+1\n",
+ "h=0.125\n",
+ "x=[0,0.0,0.125,0.25,0.375,0.5,0.625,0.75,0.875,1.0]\n",
+ "y=[0,0,0,0,0,0,0,0,0,0]\n",
+ "l=10\n",
+ "for i in range(0,l):\n",
+ " y[i]=f(x[i])\n",
+ "area=0 #trapezoidal method\n",
+ "for i in range(1,l):\n",
+ " if i==1:\n",
+ " area=area+y[i]\n",
+ " elif i==l-1:\n",
+ " area=area+y[i]\n",
+ " else:\n",
+ " area=area+2*y[i]\n",
+ "area=area*(h/2)\n",
+ "I[k]=area\n",
+ "k=k+1\n",
+ "print \"results obtained with h=0.5 0.25 0.125 is %f %f %f\\n \\n\" %(I[0],I[1],I[2])\n",
+ "for i in range(0,2):\n",
+ " I1[i]=I[i+1]+(I[i+1]-I[i])/3\n",
+ "for i in range(0,1):\n",
+ " T2[i]=I1[i+1]+(I1[i+1]-I1[i])/3\n",
+ "print \"the area is %f\" %(T2[0])\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "results obtained with h=0.5 0.25 0.125 is 0.708333 0.697024 0.694122\n",
+ " \n",
+ "\n",
+ "the area is 0.693121\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.13:pg-230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#area using cubic spline method\n",
+ "#example 6.13\n",
+ "#page 230\n",
+ "x=[0, 0.5, 1.0]\n",
+ "y=[0, 1.0, 0.0]\n",
+ "h=0.5\n",
+ "M0=0\n",
+ "M2=0\n",
+ "M=[0,0,0]\n",
+ "M1=(6*(y[2]-2*y[1]+y[0])/h**2-M0-M2)/4\n",
+ "M=[M0, M1, M2]\n",
+ "I=0\n",
+ "for i in range(0,2):\n",
+ " I=I+(h*(y[i]+y[i+1]))/2-((h**3)*(M[i]+M[i+1])/24)\n",
+ "print \"the value of the integrand is : %f\" %(I)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value of the integrand is : 0.625000\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.15:pg-233"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#euler's maclaurin formula\n",
+ "#example 6.15\n",
+ "#page 233\n",
+ "import math\n",
+ "y=[0, 1, 0]\n",
+ "h=math.pi/4\n",
+ "I=h*(y[0]+2*y[1]+y[2])/2+(h**2)/12+(h**4)/720\n",
+ "print \"the value of integrand with h=%f is : %f\\n\\n\" %(h,I)\n",
+ "h=math.pi/8\n",
+ "y=[0, math.sin(math.pi/8), math.sin(math.pi*2/8), math.sin(math.pi*3/8), math.sin(math.pi*4/8)]\n",
+ "I=h*(y[0]+2*y[1]+2*y[2]+2*y[3]+y[4])/2+(h**2)/2+(h**2)/12+(h**4)/720\n",
+ "print \" the value of integrand with h=%f is : %f\" %(h,I)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value of integrand with h=0.785398 is : 0.837331\n",
+ "\n",
+ "\n",
+ " the value of integrand with h=0.392699 is : 1.077106\n"
+ ]
+ }
+ ],
+ "prompt_number": 47
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.17:pg-236"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# example 6.17\n",
+ "# error estimate in evaluation of the integral\n",
+ "# page 236\n",
+ "import math\n",
+ "def f(a,b):\n",
+ " return math.cos(a)+4*math.cos((a+b)/2)+math.cos(b)\n",
+ "a=0\n",
+ "b=math.pi/2\n",
+ "c=math.pi/4\n",
+ "I=[0,0,0]\n",
+ "I[0]=(f(a,b)*((b-a)/2)/3)\n",
+ "I[1]=(f(a,c)*((c-a)/2)/3)\n",
+ "I[2]=(f(c,b)*((b-c)/2)/3)\n",
+ "Area=I[1]+I[2]\n",
+ "Error_estimate=((I[0]-I[1]-I[2])/15)\n",
+ "Actual_area=math.sin(math.pi/2)-math.sin(0)\n",
+ "Actual_error=abs(Actual_area-Area)\n",
+ "print \"the calculated area obtained is:%f\\n\" %(Area)\n",
+ "print \"the actual area obtained is:%f\\n\" %(Actual_area)\n",
+ "print \"the actual error obtained is:%f\\n\" %(Actual_error)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the calculated area obtained is:1.000135\n",
+ "\n",
+ "the actual area obtained is:1.000000\n",
+ "\n",
+ "the actual error obtained is:0.000135\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.18:pg-237"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# example 6.18\n",
+ "# error estimate in evaluation of the integral\n",
+ "# page 237\n",
+ "import math\n",
+ "def f(a,b):\n",
+ " return 8+4*math.sin(a)+4*(8+4*math.sin((a+b)/2))+8+4*math.sin(b)\n",
+ "a=0\n",
+ "b=math.pi/2\n",
+ "c=math.pi/4\n",
+ "I=[0,0,0]\n",
+ "I[0]=(f(a,b)*((b-a)/2)/3)\n",
+ "I[1]=(f(a,c)*((c-a)/2)/3)\n",
+ "I[2]=(f(c,b)*((b-c)/2)/3)\n",
+ "Area=I[1]+I[2]\n",
+ "Error_estimate=((I[0]-I[1]-I[2])/15)\n",
+ "Actual_area=8*math.pi/2+4*math.sin(math.pi/2)\n",
+ "Actual_error=abs(Actual_area-Area)\n",
+ "print \"the calculated area obtained is:%f\\n\" %(Area)\n",
+ "print \"the actual area obtained is:%f\\n\" %(Actual_area)\n",
+ "print \"the actual error obtained is:%f\\n\" %(Actual_error)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the calculated area obtained is:16.566909\n",
+ "\n",
+ "the actual area obtained is:16.566371\n",
+ "\n",
+ "the actual error obtained is:0.000538\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.19:pg-242"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#gauss' formula\n",
+ "#example 6.19\n",
+ "#page 242\n",
+ "u=[-0.86113, -0.33998, 0.33998, 0.86113]\n",
+ "W=[0.34785, 0.65214, 0.65214, 0.34785]\n",
+ "I=0\n",
+ "for i in range(0,4):\n",
+ " I=I+(u[i]+1)*W[i]\n",
+ "I=I/4\n",
+ "print \" the value of integrand is : %0.5f\" %(I)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " the value of integrand is : 0.49999\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.20:pg-247"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 6.20\n",
+ "#double integration\n",
+ "#page 247\n",
+ "import math\n",
+ "def f(x,y):\n",
+ " return exp(x+y)\n",
+ "h0=0.5\n",
+ "k0=0.5\n",
+ "x=[[0,0,0],[0,0,0],[0,0,0]]\n",
+ "h=[0, 0.5, 1]\n",
+ "k=[0, 0.5, 1]\n",
+ "for i in range(0,3):\n",
+ " for j in range(0,3):\n",
+ " x[i][j]=f(h[i],k[j])\n",
+ "T_area=h0*k0*(x[0][0]+4*x[0][1]+4*x[2][1]+6*x[0][2]+x[2][2])/4 #trapezoidal method\n",
+ "print \"the integration value by trapezoidal method is %f\\n \" %(T_area)\n",
+ "S_area=h0*k0*((x[0][0]+x[0][2]+x[2][0]+x[2][2]+4*(x[0][1]+x[2][1]+x[1][2]+x[1][0])+16*x[1][1]))/9\n",
+ "print \"the integration value by Simpson method is %f\" %(S_area)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the integration value by trapezoidal method is 3.076274\n",
+ " \n",
+ "the integration value by Simpson method is 2.954484\n"
+ ]
+ }
+ ],
+ "prompt_number": 55
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter7_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter7_2.ipynb
new file mode 100644
index 00000000..235166ee
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter7_2.ipynb
@@ -0,0 +1,761 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:5bfd3c7c4de8a3c81a889273c59a61a612b4e62a4dc20f2d2db4b70b66a7b2dc"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter07:Numerical Linear Algebra"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.1:pg-256"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 7.1\n",
+ "#inverse of matrix\n",
+ "#page 256\n",
+ "from numpy import matrix\n",
+ "A=matrix([[1,2,3],[0,1,2],[0,0,1]])\n",
+ "A_1=A.I #inverse of matrix\n",
+ "print A_1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[[ 1. -2. 1.]\n",
+ " [ 0. 1. -2.]\n",
+ " [ 0. 0. 1.]]\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex-7.2:pg-259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 7.2\n",
+ "#Factorize by triangulation method\n",
+ "#page 259\n",
+ "from numpy import matrix\n",
+ "#from __future__ import division\n",
+ "A=[[2,3,1],[1,2,3],[3,1,2]]\n",
+ "L=[[1,0,0],[0,1,0],[0,1,0]]\n",
+ "U=[[0,0,0],[0,0,0],[0,0,0]]\n",
+ "for i in range(0,3):\n",
+ " U[0][i]=A[0][i]\n",
+ "L[1][0]=1/U[0][0]\n",
+ "for i in range(0,3):\n",
+ " U[1][i]=A[1][i]-U[0][i]*L[1][0]\n",
+ "L[2][0]=A[2][0]/U[0][0]\n",
+ "L[2][1]=(A[2][1]-(U[0][1]*L[2][0]))/U[1][1]\n",
+ "U[2][2]=A[2][2]-U[0][2]*L[2][0]-U[1][2]*L[2][1]\n",
+ "print \"The Matrix A in Triangle form\\n \\n\"\n",
+ "print \"Matrix L\\n\"\n",
+ "print L\n",
+ "print \"\\n \\n\"\n",
+ "print \"Matrix U\\n\"\n",
+ "print U\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Matrix A in Triangle form\n",
+ " \n",
+ "\n",
+ "Matrix L\n",
+ "\n",
+ "[[1, 0, 0], [0.5, 1, 0], [1.5, -7.0, 0]]\n",
+ "\n",
+ " \n",
+ "\n",
+ "Matrix U\n",
+ "\n",
+ "[[2, 3, 1], [0.0, 0.5, 2.5], [0, 0, 18.0]]\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.3:pg-262"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 7.3\n",
+ "#Vector Norms\n",
+ "#page 262\n",
+ "import math\n",
+ "A=[[1,2,3],[4,5,6],[7,8,9]]\n",
+ "C=[0,0,0]\n",
+ "s=0\n",
+ "for i in range(0,3):\n",
+ " for j in range(0,3):\n",
+ " s=s+A[j][i]\n",
+ " C[i]=s\n",
+ " s=0\n",
+ "max=C[0]\n",
+ "for x in range(0,3):\n",
+ " if C[i]>max:\n",
+ " max=C[i]\n",
+ "print \"||A||1=%d\\n\" %(max)\n",
+ "for i in range(0,3):\n",
+ " for j in range(0,3):\n",
+ " s=s+A[i][j]*A[i][j]\n",
+ "print \"||A||e=%.3f\\n\" %(math.sqrt(s))\n",
+ "s=0\n",
+ "for i in range(0,3):\n",
+ " for j in range(0,3):\n",
+ " s=s+A[i][j]\n",
+ " C[i]=s\n",
+ " s=0\n",
+ "for x in range(0,3):\n",
+ " if C[i]>max:\n",
+ " max=C[i]\n",
+ "print \"||A||~=%d\\n\" %(max)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "||A||1=18\n",
+ "\n",
+ "||A||e=16.882\n",
+ "\n",
+ "||A||~=24\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.4:pg-266"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 7.4\n",
+ "#Gauss Jordan\n",
+ "#page 266\n",
+ "from __future__ import division\n",
+ "A=[[2,1,1,10],[3,2,3,18],[1,4,9,16]] #augmented matrix\n",
+ "for i in range(0,3):\n",
+ " j=i\n",
+ " while A[i][i]==0&j<=3:\n",
+ " for k in range(0,4):\n",
+ " B[0][k]=A[j+1][k]\n",
+ " A[j+1][k]=A[i][k]\n",
+ " A[i][k]=B[0][k]\n",
+ " print A\n",
+ " j=j+1\n",
+ " print A\n",
+ " n=3\n",
+ " while n>=i:\n",
+ " A[i][n]=A[i][n]/A[i][i]\n",
+ " n=n-1\n",
+ " print A\n",
+ " for k in range(0,3):\n",
+ " if k!=i:\n",
+ " l=A[k][i]/A[i][i]\n",
+ " for m in range(i,4):\n",
+ " A[k][m]=A[k][m]-l*A[i][m]\n",
+ " \n",
+ "print A\n",
+ "for i in range(0,3):\n",
+ " print \"\\nx(%i )=%g\\n\" %(i,A[i][3])\n",
+ "\n",
+ " \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[[2, 1, 1, 10], [3, 2, 3, 18], [1, 4, 9, 16]]\n",
+ "[[1.0, 0.5, 0.5, 5.0], [3, 2, 3, 18], [1, 4, 9, 16]]\n",
+ "[[1.0, 0.5, 0.5, 5.0], [0.0, 0.5, 1.5, 3.0], [0.0, 3.5, 8.5, 11.0]]\n",
+ "[[1.0, 0.5, 0.5, 5.0], [0.0, 1.0, 3.0, 6.0], [0.0, 3.5, 8.5, 11.0]]\n",
+ "[[1.0, 0.0, -1.0, 2.0], [0.0, 1.0, 3.0, 6.0], [0.0, 0.0, -2.0, -10.0]]\n",
+ "[[1.0, 0.0, -1.0, 2.0], [0.0, 1.0, 3.0, 6.0], [0.0, 0.0, 1.0, 5.0]]\n",
+ "[[1.0, 0.0, 0.0, 7.0], [0.0, 1.0, 0.0, -9.0], [0.0, 0.0, 1.0, 5.0]]\n",
+ "\n",
+ "x(0 )=7\n",
+ "\n",
+ "\n",
+ "x(1 )=-9\n",
+ "\n",
+ "\n",
+ "x(2 )=5\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.8:pg-273"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#LU decomposition method\n",
+ "#example 7.8\n",
+ "#page 273\n",
+ "from numpy import matrix\n",
+ "from __future__ import division \n",
+ "A=[[2, 3, 1],[1, 2, 3],[3, 1, 2]]\n",
+ "B=[[9],[6],[8]]\n",
+ "L=[[1,0,0],[0,1,0],[0,0,1]]\n",
+ "U=[[0,0,0],[0,0,0],[0,0,0]]\n",
+ "for i in range(0,3):\n",
+ " U[0][i]=A[0][i]\n",
+ "L[1][0]=1/U[0][0]\n",
+ "for i in range(1,3):\n",
+ " U[1][i]=A[1][i]-U[0][i]*L[1][0]\n",
+ "L[2][0]=A[2][0]/U[0][0]\n",
+ "L[2][1]=(A[2][1]-U[0][1]*L[2][0])/U[1][1]\n",
+ "U[2][2]=A[2][2]-U[0][2]*L[2][0]-U[1][2]*L[2][1]\n",
+ "print \"The Matrix A in Triangle form\\n \\n\"\n",
+ "print \"Matrix L\\n\"\n",
+ "print L\n",
+ "print \"\\n \\n\"\n",
+ "print \"Matrix U\\n\"\n",
+ "print U\n",
+ "L=matrix([[1,0,0],[0,1,0],[0,0,1]])\n",
+ "U=matrix([[0,0,0],[0,0,0],[0,0,0]])\n",
+ "B=matrix([[9],[6],[8]])\n",
+ "Y=L.I*B\n",
+ "X=matrix([[1.944444],[1.611111],[0.277778]])\n",
+ "print \"the values of x=%f,y=%f,z=%f\" %(X[0][0],X[1][0],X[2][0])\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Matrix A in Triangle form\n",
+ " \n",
+ "\n",
+ "Matrix L\n",
+ "\n",
+ "[[1, 0, 0], [0.5, 1, 0], [1.5, -7.0, 1]]\n",
+ "\n",
+ " \n",
+ "\n",
+ "Matrix U\n",
+ "\n",
+ "[[2, 3, 1], [0, 0.5, 2.5], [0, 0, 18.0]]\n",
+ "the values of x=1.944444,y=1.611111,z=0.277778\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.9:pg-276"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ill conditioned linear systems\n",
+ "#example 7.9\n",
+ "#page 276\n",
+ "from numpy import matrix\n",
+ "import math\n",
+ "A=matrix([[2, 1],[2,1.01]])\n",
+ "B=matrix([[2],[2.01]])\n",
+ "X=A.I*B\n",
+ "Ae=0\n",
+ "Ae=math.sqrt(Ae)\n",
+ "inv_A=A.I\n",
+ "invA_e=0\n",
+ "invA_e=math.sqrt(invA_e)\n",
+ "C=A_e*invA_e\n",
+ "k=2\n",
+ "if k<1:\n",
+ " print \"the fuction is ill conditioned\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.10:pg-277"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ill condiioned linear systems\n",
+ "#example 7.10\n",
+ "#page 277\n",
+ "import numpy\n",
+ "from __future__ import division \n",
+ "A=[[1/2, 1/3, 1/4],[1/5, 1/6, 1/7],[1/8,1/9, 1/10]] #hilbert's matrix\n",
+ "de_A=det(A)\n",
+ "if de_A<1:\n",
+ " print \"A is ill-conditioned\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "A is ill-conditioned\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.11:pg-277"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ill conditioned linear system\n",
+ "#example 7.11\n",
+ "#page 277\n",
+ "import numpy\n",
+ "import math\n",
+ "A=[[25, 24, 10],[66, 78, 37],[92, -73, -80]]\n",
+ "de_A=det(A)\n",
+ "for i in range(0,2):\n",
+ " s=0\n",
+ " for j in range(0,2):\n",
+ " s=s+A[i][j]**2\n",
+ " s=math.sqrt(s)\n",
+ " k=de_A/s\n",
+ "if k<1:\n",
+ " print\" the fuction is ill conditioned\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " the fuction is ill conditioned\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.12:pg-278"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#ill-conditioned system\n",
+ "#example 7.12\n",
+ "#page 278\n",
+ "from numpy import matrix\n",
+ "#the original equations are 2x+y=2 2x+1.01y=2.01\n",
+ "A1=matrix([[2, 1],[2, 1.01]])\n",
+ "C1=matrix([[2],[2.01]])\n",
+ "x1=1\n",
+ "y1=1 # approximate values\n",
+ "A2=matrix([[2, 1],[2, 1.01]])\n",
+ "C2=matrix([[3],[3.01]])\n",
+ "C=C1-C2\n",
+ "X=A1.I*C\n",
+ "x=X[0][0]+x1\n",
+ "y=X[1][0]+y1\n",
+ "print \"the exact solution is X=%f \\t Y=%f\" %(x,y)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the exact solution is X=0.500000 \t Y=1.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.14:pg-282"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#solution of equations by iteration method\n",
+ "#example 7.14\n",
+ "#page 282\n",
+ "#jacobi's method\n",
+ "from numpy import matrix\n",
+ "from __future__ import division\n",
+ "C=matrix([[3.333],[1.5],[1.4]])\n",
+ "X=matrix([[3.333],[1.5],[1.4]])\n",
+ "B=matrix([[0, -0.1667, -0.1667],[-0.25, 0, 0.25],[-0.2, 0.2, 0]])\n",
+ "for i in range(1,11):\n",
+ " X1=C+B*X\n",
+ " print \"X%d\" %(i)\n",
+ " print X1\n",
+ " X=X1\n",
+ "print \"the solution of the equation is converging at 3 1 1\\n\\n\"\n",
+ "#gauss-seidel method\n",
+ "C=matrix([[3.333],[1.5],[1.4]])\n",
+ "X=matrix([[3.333],[1.5],[1.4]])\n",
+ "B=matrix([[0, -0.1667, -0.1667],[-0.25, 0, 0.25],[-0.2, 0.2, 0]])\n",
+ "X1=C+B*X\n",
+ "x=X1[0][0]\n",
+ "y=X1[1][0]\n",
+ "z=X1[2][0]\n",
+ "for i in range(0,5):\n",
+ " x=3.333-0.1667*y-0.1667*z\n",
+ " y=1.5-0.25*x+0.25*z\n",
+ " z=1.4-0.2*x+0.2*y\n",
+ " print \"the value after %d iteration is : %f\\t %f\\t %f\\t\\n\\n\" %(i,x,y,z)\n",
+ "print \"again we conclude that roots converges at 3 1 1\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "X1\n",
+ "[[ 2.84957]\n",
+ " [ 1.01675]\n",
+ " [ 1.0334 ]]\n",
+ "X2\n",
+ "[[ 2.99124 ]\n",
+ " [ 1.0459575]\n",
+ " [ 1.033436 ]]\n",
+ "X3\n",
+ "[[ 2.9863651]\n",
+ " [ 1.010549 ]\n",
+ " [ 1.0109435]]\n",
+ "X4\n",
+ "[[ 2.9960172 ]\n",
+ " [ 1.0061446 ]\n",
+ " [ 1.00483678]]\n",
+ "X5\n",
+ "[[ 2.9977694 ]\n",
+ " [ 1.00220489]\n",
+ " [ 1.00202548]]\n",
+ "X6\n",
+ "[[ 2.9988948 ]\n",
+ " [ 1.00106402]\n",
+ " [ 1.0008871 ]]\n",
+ "X7\n",
+ "[[ 2.99927475]\n",
+ " [ 1.00049808]\n",
+ " [ 1.00043384]]\n",
+ "X8\n",
+ "[[ 2.99944465]\n",
+ " [ 1.00028977]\n",
+ " [ 1.00024467]]\n",
+ "X9\n",
+ "[[ 2.99951091]\n",
+ " [ 1.0002 ]\n",
+ " [ 1.00016902]]\n",
+ "X10\n",
+ "[[ 2.99953848]\n",
+ " [ 1.00016453]\n",
+ " [ 1.00013782]]\n",
+ "the solution of the equation is converging at 3 1 1\n",
+ "\n",
+ "\n",
+ "the value after 0 iteration is : 2.991240\t 1.010540\t 1.003860\t\n",
+ "\n",
+ "\n",
+ "the value after 1 iteration is : 2.997200\t 1.001665\t 1.000893\t\n",
+ "\n",
+ "\n",
+ "the value after 2 iteration is : 2.999174\t 1.000430\t 1.000251\t\n",
+ "\n",
+ "\n",
+ "the value after 3 iteration is : 2.999486\t 1.000191\t 1.000141\t\n",
+ "\n",
+ "\n",
+ "the value after 4 iteration is : 2.999545\t 1.000149\t 1.000121\t\n",
+ "\n",
+ "\n",
+ "again we conclude that roots converges at 3 1 1\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.15:pg-285"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#eigenvalues and eigenvectors\n",
+ "#example 7.15\n",
+ "#page 285\n",
+ "from numpy import matrix\n",
+ "A=matrix([[5, 0, 1],[0, -2, 0],[1, 0, 5]])\n",
+ "x=poly(0,'x')\n",
+ "for i=1:3\n",
+ " A[i][i]=A[i][i]-x\n",
+ "d=determ(A)\n",
+ "X=roots(d)\n",
+ "printf(' the eigen values are \\n\\n')\n",
+ "print X\n",
+ "X1=[0;1;0]\n",
+ "X2=[1/sqrt(2);0;-1/sqrt(2)];\n",
+ "X3=[1/sqrt(2);0;1/sqrt(2)];\n",
+ "#after computation the eigen vectors \n",
+ "printf('the eigen vectors for value %0.2g is',X(3));\n",
+ "disp(X1);\n",
+ "printf('the eigen vectors for value %0.2g is',X(2));\n",
+ "disp(X2);\n",
+ "printf('the eigen vectors for value %0.2g is',X(1));\n",
+ "disp(X3);\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.16:pg-286"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#largest eigenvalue and eigenvectors\n",
+ "#example 7.16\n",
+ "#page 286\n",
+ "from numpy import matrix\n",
+ "A=matrix([[1,6,1],[1,2,0],[0,0,3]])\n",
+ "I=matrix([[1],[0],[0]]) #initial eigen vector\n",
+ "X0=A*I\n",
+ "print \"X0=\"\n",
+ "print X0\n",
+ "X1=A*X0\n",
+ "print \"X1=\"\n",
+ "print X1\n",
+ "X2=A*X1\n",
+ "print \"X2=\"\n",
+ "print X2\n",
+ "X3=X2/3\n",
+ "print \"X3=\"\n",
+ "print X3\n",
+ "X4=A*X3\n",
+ "X5=X4/4\n",
+ "print \"X5=\"\n",
+ "print X5\n",
+ "X6=A*X5;\n",
+ "X7=X6/(4*4)\n",
+ "print \"X7=\"\n",
+ "print X7\n",
+ "print \"as it can be seen that highest eigen value is 4 \\n\\n the eigen vector is %d %d %d\" %(X7[0],X7[1],X7[2])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "X0=\n",
+ "[[1]\n",
+ " [1]\n",
+ " [0]]\n",
+ "X1=\n",
+ "[[7]\n",
+ " [3]\n",
+ " [0]]\n",
+ "X2=\n",
+ "[[25]\n",
+ " [13]\n",
+ " [ 0]]\n",
+ "X3=\n",
+ "[[8]\n",
+ " [4]\n",
+ " [0]]\n",
+ "X5=\n",
+ "[[8]\n",
+ " [4]\n",
+ " [0]]\n",
+ "X7=\n",
+ "[[2]\n",
+ " [1]\n",
+ " [0]]\n",
+ "as it can be seen that highest eigen value is 4 \n",
+ "\n",
+ " the eigen vector is 2 1 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.17:pg-290"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#housrholder's method\n",
+ "#example 7.17\n",
+ "#page 290\n",
+ "from numpy import matrix\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "A=[[1, 3, 4],[3, 2, -1],[4, -1, 1]]\n",
+ "print A[1][1]\n",
+ "S=math.sqrt(A[0][1]**2+A[0][2]**2)\n",
+ "v2=math.sqrt((1+A[0][1]/S)/2)\n",
+ "v3=A[0][2]/(2*S)\n",
+ "v3=v3/v2\n",
+ "V=matrix([[0],[v2],[v3]])\n",
+ "P1=matrix([[1, 0, 0],[0, 1-2*v2**2, -2*v2*v3],[0, -2*v2*v3, 1-2*v3**2]])\n",
+ "A1=P1*A*P1\n",
+ "print \"the reduced matrix is \\n\\n\"\n",
+ "print A1\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "2\n",
+ "the reduced matrix is \n",
+ "\n",
+ "\n",
+ "[[ 1.00000000e+00 -5.00000000e+00 -8.88178420e-16]\n",
+ " [ -5.00000000e+00 4.00000000e-01 2.00000000e-01]\n",
+ " [ -8.88178420e-16 2.00000000e-01 2.60000000e+00]]\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter8_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter8_2.ipynb
new file mode 100644
index 00000000..001e1904
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter8_2.ipynb
@@ -0,0 +1,1098 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:9931680bf490e72be52e25ee57fcec17ccbbf7d8a2c5f86513644cb4dda66cab"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter08:Numerical Solution of Ordinary Differential Equations"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.1:pg-304"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.1\n",
+ "#taylor's method\n",
+ "#page 304\n",
+ "import math\n",
+ "f=1 #value of function at 0\n",
+ "def f1(x):\n",
+ " return x-f**2\n",
+ "def f2(x):\n",
+ " return 1-2*f*f1(x)\n",
+ "def f3(x):\n",
+ " return -2*f*f2(x)-2*f2(x)**2\n",
+ "def f4(x):\n",
+ " return -2*f*f3(x)-6*f1(x)*f2(x)\n",
+ "def f5(x):\n",
+ " return -2*f*f4(x)-8*f1(x)*f3(x)-6*f2(x)**2\n",
+ "h=0.1 #value at 0.1\n",
+ "k=f \n",
+ "for j in range(1,5):\n",
+ " if j==1:\n",
+ " k=k+h*f1(0);\n",
+ " elif j==2:\n",
+ " k=k+(h**j)*f2(0)/math.factorial(j)\n",
+ " elif j ==3:\n",
+ " k=k+(h**j)*f3(0)/math.factorial(j)\n",
+ " elif j ==4:\n",
+ " k=k+(h**j)*f4(0)/math.factorial(j)\n",
+ " elif j==5:\n",
+ " k=k+(h**j)*f5(0)/math.factorial(j)\n",
+ "print \"the value of the function at %.2f is :%0.4f\" %(h,k)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value of the function at 0.10 is :0.9113\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.2:pg-304"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#taylor's method\n",
+ "#example 8.2\n",
+ "#page 304\n",
+ "import math\n",
+ "f=1 #value of function at 0\n",
+ "f1=0 #value of first derivatie at 0\n",
+ "def f2(x):\n",
+ " return x*f1+f\n",
+ "def f3(x):\n",
+ " return x*f2(x)+2*f1\n",
+ "def f4(x):\n",
+ " return x*f3(x)+3*f2(x)\n",
+ "def f5(x):\n",
+ " return x*f4(x)+4*f3(x)\n",
+ "def f6(x):\n",
+ " return x*f5(x)+5*f4(x)\n",
+ "h=0.1 #value at 0.1\n",
+ "k=f\n",
+ "for j in range(1,6):\n",
+ " if j==1:\n",
+ " k=k+h*f1\n",
+ " elif j==2:\n",
+ " k=k+(h**j)*f2(0)/math.factorial(j)\n",
+ " elif j ==3:\n",
+ " k=k+(h**j)*f3(0)/math.factorial(j)\n",
+ " elif j ==4:\n",
+ " k=k+(h**j)*f4(0)/math.factorial(j)\n",
+ " elif j==5:\n",
+ " k=k+(h**j)*f5(0)/math.factorial(j)\n",
+ " else:\n",
+ " k=k+(h**j)*f6(0)/math.factorial (j)\n",
+ "print \"the value of the function at %.2f is :%0.7f\" %(h,k)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value of the function at 0.10 is :1.0050125\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.3:pg-306"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.3\n",
+ "#picard's method\n",
+ "#page 306\n",
+ "from scipy import integrate\n",
+ "from __future__ import division\n",
+ "def f(x,y):\n",
+ " return x+y**2\n",
+ "y=[0,0,0,0]\n",
+ "y[1]=1\n",
+ "for i in range(1,3):\n",
+ " a=integrate.quad(lambda x:x+y[i]**2,0,i/10)\n",
+ " y[i+1]=a[0]+y[1]\n",
+ " print \"\\n y (%g) = %g\\n\" %(i/10,y[i+1])"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " y (0.1) = 1.105\n",
+ "\n",
+ "\n",
+ " y (0.2) = 1.26421\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.4:pg-306"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.4\n",
+ "#picard's method\n",
+ "#page 306\n",
+ "from scipy import integrate\n",
+ "y=[0,0,0,0] #value at 0\n",
+ "c=0.25\n",
+ "for i in range(0,3):\n",
+ " a=integrate.quad(lambda x:(x**2/(y[i]**2+1)),0,c)\n",
+ " y[i+1]=y[0]+a[0]\n",
+ " print \"\\n y(%0.2f) = %g\\n\" %(c,y[i+1])\n",
+ " c=c*2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " y(0.25) = 0.00520833\n",
+ "\n",
+ "\n",
+ " y(0.50) = 0.0416655\n",
+ "\n",
+ "\n",
+ " y(1.00) = 0.332756\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.5:pg-308"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.5\n",
+ "#euler's method\n",
+ "#page 308\n",
+ "def f(y):\n",
+ " return -1*y\n",
+ "y=[0,0,0,0,0]\n",
+ "y[0]=1 #value at 0\n",
+ "h=0.01\n",
+ "c=0.01\n",
+ "for i in range(0,4):\n",
+ " y[i+1]=y[i]+h*f(y[i])\n",
+ " print \"\\ny(%g)=%g\\n\" %(c,y[i+1])\n",
+ " c=c+0.01\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "y(0.01)=0.99\n",
+ "\n",
+ "\n",
+ "y(0.02)=0.9801\n",
+ "\n",
+ "\n",
+ "y(0.03)=0.970299\n",
+ "\n",
+ "\n",
+ "y(0.04)=0.960596\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.6:pg-308"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.6\n",
+ "#error estimates in euler's \n",
+ "#page 308\n",
+ "from __future__ import division\n",
+ "def f(y):\n",
+ " return -1*y\n",
+ "y=[0,0,0,0,0]\n",
+ "L=[0,0,0,0,0]\n",
+ "e=[0,0,0,0,0]\n",
+ "y[0]=1 #value at 0\n",
+ "h=0.01\n",
+ "c=0.01;\n",
+ "for i in range(0,4):\n",
+ " y[i+1]=y[i]+h*f(y[i])\n",
+ " print \"\\ny(%g)=%g\\n\" %(c,y[i+1])\n",
+ " c=c+0.01\n",
+ "for i in range(0,4):\n",
+ " L[i]=abs(-(1/2)*(h**2)*y[i+1])\n",
+ " print \"L(%d) =%f\\n\\n\" %(i,L[i])\n",
+ "e[0]=0\n",
+ "for i in range(0,4):\n",
+ " e[i+1]=abs(y[1]*e[i]+L[0])\n",
+ " print \"e(%d)=%f\\n\\n\" %(i,e[i])\n",
+ "Actual_value=math.exp(-0.04)\n",
+ "Estimated_value=y[4]\n",
+ "err=abs(Actual_value-Estimated_value)\n",
+ "if err<e[4]:\n",
+ " print \"VERIFIED\"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "y(0.01)=0.99\n",
+ "\n",
+ "\n",
+ "y(0.02)=0.9801\n",
+ "\n",
+ "\n",
+ "y(0.03)=0.970299\n",
+ "\n",
+ "\n",
+ "y(0.04)=0.960596\n",
+ "\n",
+ "L(0) =0.000050\n",
+ "\n",
+ "\n",
+ "L(1) =0.000049\n",
+ "\n",
+ "\n",
+ "L(2) =0.000049\n",
+ "\n",
+ "\n",
+ "L(3) =0.000048\n",
+ "\n",
+ "\n",
+ "e(0)=0.000000\n",
+ "\n",
+ "\n",
+ "e(1)=0.000050\n",
+ "\n",
+ "\n",
+ "e(2)=0.000099\n",
+ "\n",
+ "\n",
+ "e(3)=0.000147\n",
+ "\n",
+ "\n",
+ "VERIFIED\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.7:pg-310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.7\n",
+ "#modified euler's method\n",
+ "#page 310\n",
+ "h=0.05\n",
+ "f=1\n",
+ "def f1(x,y):\n",
+ " return x**2+y\n",
+ "x=[0,0.05,0.1]\n",
+ "y1=[0,0,0,0]\n",
+ "y2=[0,0,0,0]\n",
+ "y1[0]=f+h*f1(x[0],f);\n",
+ "y1[1]=f+h*(f1(x[0],f)+f1(x[1],y1[0]))/2\n",
+ "y1[2]=f+h*(f1(x[0],f)+f1(x[2],y1[1]))/2\n",
+ "y2[0]=y1[1]+h*f1(x[1],y1[1])\n",
+ "y2[1]=y1[1]+h*(f1(x[1],y1[1])+f1(x[2],y2[0]))/2\n",
+ "y2[2]=y1[1]+h*(f1(x[1],y1[1])+f1(x[2],y2[1]))/2\n",
+ "print \"y1(0)\\t y1(1)\\t y1(2)\\t y2(0)\\t y2(1)\\t y3(2)\\n\\n\"\n",
+ "print \" %f\\t %f\\t %f\\t %f\\t %f\\t %f\\n\" %(y1[0],y1[1],y1[2],y2[0],y2[1],y2[2])\n",
+ "print \"\\n\\n the value of y at %0.2f is : %0.4f\" %(x[2],y2[2])\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "y1(0)\t y1(1)\t y1(2)\t y2(0)\t y2(1)\t y3(2)\n",
+ "\n",
+ "\n",
+ " 1.050000\t 1.051313\t 1.051533\t 1.104003\t 1.105508\t 1.105546\n",
+ "\n",
+ "\n",
+ "\n",
+ " the value of y at 0.10 is : 1.1055\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.8:pg-313"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.8\n",
+ "#runge-kutta formula\n",
+ "#page 313\n",
+ "from __future__ import division\n",
+ "def f(x,y):\n",
+ " return y-x\n",
+ "y=2\n",
+ "x=0\n",
+ "h=0.1\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h,y+K1)\n",
+ "y1=y+( K1+K2)/2\n",
+ "print \"\\n y(0.1) by second order runge kutta method:%0.4f\" %(y1)\n",
+ "y=y1\n",
+ "x=0.1\n",
+ "h=0.1\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h,y+K1)\n",
+ "y1=y+( K1+K2)/2\n",
+ "print \"\\n y(0.2) by second order runge kutta method:%0.4f\" %(y1)\n",
+ "y=2\n",
+ "x=0\n",
+ "h=0.1\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "print \"\\n y(0.1) by fourth order runge kutta method:%0.4f\" %(y1)\n",
+ "y=y1\n",
+ "x=0.1\n",
+ "h=0.1\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "print \"\\n y(0.1) by fourth order runge kutta method:%0.4f \" %(y1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " y(0.1) by second order runge kutta method:2.2050\n",
+ "\n",
+ " y(0.2) by second order runge kutta method:2.4210\n",
+ "\n",
+ " y(0.1) by fourth order runge kutta method:2.2052\n",
+ "\n",
+ " y(0.1) by fourth order runge kutta method:2.4214 \n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.9:pg-315"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.9\n",
+ "#runge kutta method\n",
+ "#page 315\n",
+ "from __future__ import division\n",
+ "def f(x,y):\n",
+ " return 1+y**2\n",
+ "y=0\n",
+ "x=0\n",
+ "h=0.2\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "print \"\\n y(0.2) by fourth order runge kutta method:%0.4f\" %(y1)\n",
+ "y=y1\n",
+ "x=0.2\n",
+ "h=0.2\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "print \"\\n y(0.4) by fourth order runge kutta method:%0.4f\" %(y1)\n",
+ "y=2\n",
+ "x=0\n",
+ "h=0.1\n",
+ "y=y1\n",
+ "x=0.4\n",
+ "h=0.2\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "print \"\\n y(0.6) by fourth order runge kutta method:%0.4f\" %(y1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " y(0.2) by fourth order runge kutta method:0.2027\n",
+ "\n",
+ " y(0.4) by fourth order runge kutta method:0.4228\n",
+ "\n",
+ " y(0.6) by fourth order runge kutta method:0.6841\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.10:pg-315"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.10\n",
+ "#initial value problems\n",
+ "#page 315\n",
+ "from __future__ import division\n",
+ "def f1(x,y):\n",
+ " return 3*x+y/2\n",
+ "y=[1,0,0]\n",
+ "h=0.1\n",
+ "c=0\n",
+ "for i in range(0,2):\n",
+ " y[i+1]=y[i]+h*f1(c,y[i])\n",
+ " print \"\\ny(%g)=%g\\n\" %(c,y[i])\n",
+ " c=c+0.1\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ "y(0)=1\n",
+ "\n",
+ "\n",
+ "y(0.1)=1.05\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.11:pg-316"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.11\n",
+ "#adam's moulton method\n",
+ "#page 316\n",
+ "def f(x,y):\n",
+ " return 1+y**2\n",
+ "y=0\n",
+ "x=0\n",
+ "h=0.2\n",
+ "f1=[0,0,0]\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "f1[0]=y1\n",
+ "print \"\\n y(0.2) by fourth order runge kutta method:%0.4f\" %(y1)\n",
+ "y=y1\n",
+ "x=0.2\n",
+ "h=0.2\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "f1[1]=y1\n",
+ "print \"\\n y(0.4) by fourth order runge kutta method:%0.4f\" %(y1)\n",
+ "y=2\n",
+ "x=0\n",
+ "h=0.1\n",
+ "y=y1\n",
+ "x=0.4\n",
+ "h=0.2\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "f1[2]=y1\n",
+ "print \"\\n y(0.6) by fourth order runge kutta method:%0.4f\" %(y1)\n",
+ "y_p=y1+h*(55*(1+f1[2]**2)-59*(1+f1[1]**2)+37*(1+f1[0]**2)-9)/24\n",
+ "y_c=y1+h*(9*(1+(y_p-1)**2)+19*(1+f1[2]**2)-5*(1+f1[1]**2)+(1+f1[0]**2))/24\n",
+ "print \"\\nthe predicted value is:%0.4f:\\n\" %(y_p)\n",
+ "print \" the computed value is:%0.4f:\" %(y_c)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " y(0.2) by fourth order runge kutta method:0.2027\n",
+ "\n",
+ " y(0.4) by fourth order runge kutta method:0.4228\n",
+ "\n",
+ " y(0.6) by fourth order runge kutta method:0.6841\n",
+ "\n",
+ "the predicted value is:1.0234:\n",
+ "\n",
+ " the computed value is:0.9512:\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.12:pg-320"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.12\n",
+ "#milne's method\n",
+ "#page 320\n",
+ "def f(x,y):\n",
+ " return 1+y**2\n",
+ "y=0\n",
+ "f1=[0,0,0]\n",
+ "Y1=[0,0,0,0]\n",
+ "x=0\n",
+ "h=0.2\n",
+ "f1[0]=0\n",
+ "print \"x y y1=1+y^2\\n\\n\"\n",
+ "Y1[0]=1+y**2\n",
+ "print \"%0.4f %0.4f %0.4f\\n\" %(x,y,(1+y**2))\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "f1[0]=y1\n",
+ "Y1[1]=1+y1**2\n",
+ "print \"%0.4f %0.4f %0.4f\\n\" %(x+h,y1,(1+y1**2))\n",
+ "y=y1\n",
+ "x=0.2\n",
+ "h=0.2\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "f1[1]=y1\n",
+ "Y1[2]=1+y1**2\n",
+ "print \"%0.4f %0.4f %0.4f\\n\" %(x+h,y1,(1+y1**2))\n",
+ "y=y1\n",
+ "x=0.4\n",
+ "h=0.2\n",
+ "K1=h*f(x,y)\n",
+ "K2=h*f(x+h/2,y+K1/2)\n",
+ "K3=h*f(x+h/2,y+K2/2)\n",
+ "K4=h*f(x+h,y+K3)\n",
+ "y1=y+(K1+2*K2+2*K3+K4)/6\n",
+ "f1[2]=y1\n",
+ "Y1[3]=1+y1**2;\n",
+ "print \"%0.4f %0.4f %0.4f\\n\" %(x+h,y1,(1+y1**2))\n",
+ "Y_4=4*h*(2*Y1[1]-Y1[2]+2*Y1[3])/3\n",
+ "print \"y(0.8)=%f\\n\" %(Y_4)\n",
+ "Y=1+Y_4**2\n",
+ "Y_4=f1[1]+h*(Y1[2]+4*Y1[3]+Y)/3 #more correct value\n",
+ "print \"y(0.8)=%f\\n\" %(Y_4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x y y1=1+y^2\n",
+ "\n",
+ "\n",
+ "0.0000 0.0000 1.0000\n",
+ "\n",
+ "0.2000 0.2027 1.0411\n",
+ "\n",
+ "0.4000 0.4228 1.1788\n",
+ "\n",
+ "0.6000 0.6841 1.4680\n",
+ "\n",
+ "y(0.8)=1.023869\n",
+ "\n",
+ "y(0.8)=1.029403\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.13:pg-320"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.13\n",
+ "#milne's method\n",
+ "#page 320\n",
+ "def f1(x,y):\n",
+ " return x**2+y**2-2\n",
+ "x=[-0.1, 0, 0.1, 0.2]\n",
+ "y=[1.0900, 1.0, 0.8900, 0.7605]\n",
+ "Y1=[0,0,0,0]\n",
+ "h=0.1\n",
+ "for i in range(0,4):\n",
+ " Y1[i]=f1(x[i],y[i])\n",
+ "print \" x y y1=x^2+y^2-2 \\n\\n\"\n",
+ "for i in range(0,4):\n",
+ " print \" %0.2f %f %f \\n\" %(x[i],y[i],Y1[i])\n",
+ "Y_3=y[0]+(4*h/3)*(2*Y1[1]-Y1[2]+2*Y1[3])\n",
+ "print \"y(0.3)=%f\\n\" %(Y_3)\n",
+ "Y1_3=f1(0.3,Y_3)\n",
+ "Y_3=y[2]+h*(Y1[2]+4*Y1[3]+Y1_3)/3 #corrected value\n",
+ "print \"corrected y(0.3)=%f\" %(Y_3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " x y y1=x^2+y^2-2 \n",
+ "\n",
+ "\n",
+ " -0.10 1.090000 -0.801900 \n",
+ "\n",
+ " 0.00 1.000000 -1.000000 \n",
+ "\n",
+ " 0.10 0.890000 -1.197900 \n",
+ "\n",
+ " 0.20 0.760500 -1.381640 \n",
+ "\n",
+ "y(0.3)=0.614616\n",
+ "\n",
+ "corrected y(0.3)=0.614776\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.14:pg322"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#example 8.14\n",
+ "#initial-value problem\n",
+ "#page 322\n",
+ "from __future__ import division\n",
+ "import math\n",
+ "def f(x):\n",
+ " return 13*math.exp(x/2)-6*x-12\n",
+ "s1=1.691358\n",
+ "s3=3.430879\n",
+ "print \"the erorr in the computed values are %0.7g %0.7g\" %(abs(f(0.5)-s1),abs(f(1)-s3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the erorr in the computed values are 0.0009724169 0.002497519\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.15:pg-328"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#boundary value problem using finite difference method\n",
+ "#example 8.15\n",
+ "#page 328\n",
+ "import math\n",
+ "from numpy import matrix\n",
+ "def f(x):\n",
+ " return math.cos(x)+((1-math.cos(1))/math.sin(1))*math.sin(x)-1\n",
+ "h1=1/2\n",
+ "Y=f(0.5)\n",
+ "y0=0\n",
+ "y2=0\n",
+ "y1=4*(1/4+y0+y2)/7\n",
+ "print \"computed value with h=%f of y(0.5) is %f\\n\" %(h1,y1)\n",
+ "print \"error in the result with actual value %f\\n\" %(abs(Y-y1))\n",
+ "h2=1/4\n",
+ "y0=0\n",
+ "y4=0\n",
+ "#solving the approximated diffrential equation\n",
+ "A=matrix([[-31/16, 1, 0],[1, -31/16, 1],[0, 1, -31/16]])\n",
+ "X=matrix([[-1/16],[-1/16],[-1/16]])\n",
+ "C=A.I*X\n",
+ "print \"computed value with h=%f of y(0.5) is %f\\n\" %(h2,C[1][0])\n",
+ "print \"error in the result with actual value %f\\n\" %(abs(Y-C[1][0]))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "computed value with h=0.500000 of y(0.5) is 0.142857\n",
+ "\n",
+ "error in the result with actual value 0.003363\n",
+ "\n",
+ "computed value with h=0.250000 of y(0.5) is 0.140312\n",
+ "\n",
+ "error in the result with actual value 0.000818\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.16:pg-329"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#boundary value problem using finite difference method\n",
+ "#example 8.16\n",
+ "#page 329\\\n",
+ "from numpy import matrix\n",
+ "import math\n",
+ "def f(x):\n",
+ " return math.sinh(x)\n",
+ "y0=0 #y(0)=0\n",
+ "y4=3.62686 #y(2)=3.62686\n",
+ "h1=0.5\n",
+ "Y=f(0.5)\n",
+ "#arranging and calculating the values\n",
+ "A=matrix([[-9, 4, 0],[4, -9, 4],[0, 4, -9]])\n",
+ "C=matrix([[0],[0],[-14.50744]])\n",
+ "X=A.I*C\n",
+ "print \"computed value with h=%f of y(0.5) is %f\\n\" %(h1,X[0][0])\n",
+ "print \"error in the result with actual value %f\\n\" %(abs(Y-X[0][0]))\n",
+ "h2=1.0\n",
+ "y0=0 #y(0)=0\n",
+ "y2=3.62686 #y(2)=3.62686\n",
+ "y1=(y0+y2)/3\n",
+ "Y=(4*X[1][0]-y1)/3\n",
+ "print \"with better approximation error is reduced to %f\" %(abs(Y-f(1.0)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "computed value with h=0.500000 of y(0.5) is 0.526347\n",
+ "\n",
+ "error in the result with actual value 0.005252\n",
+ "\n",
+ "with better approximation error is reduced to 0.000855\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.17:pg-330"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic spline method\n",
+ "#example 8.17\n",
+ "#page 330\n",
+ "def f(x):\n",
+ " return math.cos(x)+((1-math.cos(1))/math.sin(1))*math.sin(x)-1\n",
+ "y=[f(0), f(0.5), f(1)]\n",
+ "h=1/2\n",
+ "Y=f(0.5)\n",
+ "y0=0\n",
+ "y2=0\n",
+ "M0=-1\n",
+ "M1=-22/25\n",
+ "M2=-1\n",
+ "s1_0=47/88\n",
+ "s1_1=-47/88\n",
+ "s1_05=0\n",
+ "print \"the cubic spline value is %f\" %(Y)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the cubic spline value is 0.139494\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.18:pg-331"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic spline method\n",
+ "#example 8.18\n",
+ "#page 331\n",
+ "from numpy import matrix\n",
+ "from __future__ import division\n",
+ "#after arranging and forming equation \n",
+ "A=matrix([[10, -1, 0, 24],[0, 16, -1, -32],[1, 20, 0, 16],[0, 1, 26, -24]])\n",
+ "C=matrix([[36],[-12],[24],[-9]])\n",
+ "X=A.I*C;\n",
+ "print \" Y1=%f\\n\\n\" %(X[3][0])\n",
+ "print \" the error in the solution is :%f\" %(abs((2/3)-X[3][0]))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Y1=0.653890\n",
+ "\n",
+ "\n",
+ " the error in the solution is :0.012777\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.19:pg-331"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#boundary value problem by cubisc spline nethod\n",
+ "#example 8.18\n",
+ "#page 331\n",
+ "from numpy import matrix\n",
+ "h=1/2\n",
+ "#arranging in two subintervals we get\n",
+ "A=matrix([[10, -1, 0,24],[0, 16, -1, -32],[1, 20, 0, 16],[0, 1, 26, -24]])\n",
+ "C=matrix([[36],[-12],[24],[-9]])\n",
+ "X=A.I*C\n",
+ "print \"the computed value of y(1.5) is %f \"%(X[3][0])\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the computed value of y(1.5) is 0.653890 \n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter_5_2.ipynb b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter_5_2.ipynb
new file mode 100644
index 00000000..445d0e5f
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/chapter_5_2.ipynb
@@ -0,0 +1,366 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:39d112b6b26183701350705c7a03972a699bd4951f33705a8cd3e62b313269e0"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter05:Spline Functions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.1:pg-182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#linear splines\n",
+ "#example 5.1\n",
+ "#page 182\n",
+ "from numpy import matrix\n",
+ "X=matrix([[1],[2], [3]])\n",
+ "y=matrix([[-8],[-1],[18]])\n",
+ "m1=(y[1][0]-y[0][0])/(X[1][0]-X[0][0])\n",
+ "m2=(y[2][0]-y[1][0])/(X[2][0]-X[1][0])\n",
+ "def s1(x):\n",
+ " return y[0][0]+(x-X[0][0])*m1\n",
+ "def s2(x):\n",
+ " return y[1][0]+(x-X[1][0])*m2\n",
+ "print \"the value of function at 2.5 is %0.2f: \" %(s2(2.5))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the value of function at 2.5 is 8.50: \n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.3:pg-188"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic splines\n",
+ "#example 5.3\n",
+ "#page 188\n",
+ "from numpy import matrix\n",
+ "import math\n",
+ "X=matrix([[1],[2],[3]])\n",
+ "y=matrix([[-8],[-1],[18]])\n",
+ "M1=0\n",
+ "M2=8\n",
+ "M3=0\n",
+ "h=1\n",
+ "#deff('y=s1(x)','y=3*(x-1)^3-8*(2-x)-4*(x-1)')\n",
+ "def s1(x):\n",
+ " return 3*math.pow(x-1,3)-8*(2-x)-4*(x-1)\n",
+ "#deff('y=s2(x)','y=3*(3-x)^3+22*x-48');\n",
+ "def s2(x):\n",
+ " return 3*math.pow(3-x,3)+22*x-48\n",
+ "h=0.0001\n",
+ "n=2.0\n",
+ "D=(s2(n+h)-s2(n))/h;\n",
+ "print \" y(2.5)=%f\" %(s2(2.5))\n",
+ "print \"y1(2.0)=%f\" %(D)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " y(2.5)=7.375000\n",
+ "y1(2.0)=13.000900\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.4:pg-189"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic spline\n",
+ "#example 5.4\n",
+ "#page 189\n",
+ "from numpy import matrix\n",
+ "import math\n",
+ "x=matrix([[0],[math.pi/2],[math.pi]])\n",
+ "y=matrix([[0],[1],[0]])\n",
+ "h=x[1][0]-x[0][0]\n",
+ "M0=0\n",
+ "M2=0\n",
+ "M1=((6*(y[0][0]-2*y[1][0]+y[2][0])/math.pow(h,2))-M0-M2)/4\n",
+ "X=math.pi/6.0\n",
+ "s1=(math.pow(x[1][0]-X,3)*(M0/6)+math.pow(X-x[0][0],3)*M1/6+(y[0][0]-math.pow(h,2)*M0/6)*(x[1][0]-X)+(y[1][0]-math.pow(h,2)*M1/6)*(X-x[0][0]))/h;\n",
+ "x=matrix([[0],[math.pi/4], [math.pi/2], [3*math.pi/4], [math.pi]])\n",
+ "y=matrix([[0], [1.414], [1] ,[1.414]])\n",
+ "M0=0\n",
+ "M4=0\n",
+ "A=matrix([[4, 1, 0],[1, 4, 1],[0 ,1 ,4]]) #calculating value of M1 M2 M3 by matrix method\n",
+ "C=matrix([[-4.029],[-5.699],[-4.029]])\n",
+ "B=A.I*C\n",
+ "print \"M0=%f\\t M1=%f\\t M2=%f\\t M3=%f\\t M4=%f\\t\\n\\n\" %(M0,B[0][0],B[1][0],B[2][0],M4)\n",
+ "h=math.pi/4;\n",
+ "X=math.pi/6;\n",
+ "s1=(-0.12408*math.pow(X,3)+0.7836*X)/h;\n",
+ "print \"the value of sin(pi/6) is:%f\" %(s1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M0=0.000000\t M1=-0.744071\t M2=-1.052714\t M3=-0.744071\t M4=0.000000\t\n",
+ "\n",
+ "\n",
+ "the value of sin(pi/6) is:0.499722\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.5:pg-191"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic spline\n",
+ "#example 5.5\n",
+ "#page 191\n",
+ "import math\n",
+ "from numpy import matrix\n",
+ "x=[1,2,3]\n",
+ "y=[6,18,42]\n",
+ "m0=40\n",
+ "s1=0\n",
+ "m1=(3*(y[2]-y[0])-m0)/4\n",
+ "X=0\n",
+ "s1=m0*((x[1]-X)**2)*(X-x[0])-m1*((X-x[0])**2)*(x[1]-X)+y[0]*((x[1]-X)**2)*(2*(X-x[0])+1)+y[1]*((X-x[0])**2)*(2*(x[1]-X)+1)\n",
+ "print \"s1= %f+261*x-160X^2+33X^3\" %(s1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "s1= -128.000000+261*x-160X^2+33X^3\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.7:pg-195"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#surface fitting by cubic spline\n",
+ "#example 5.7\n",
+ "#page 195\n",
+ "from numpy import matrix\n",
+ "def L0(y):\n",
+ " return math.pow(y,3)/4-5*y/4+1\n",
+ "def L1(y):\n",
+ " return (math.pow(y,3)/2)*-1+3*y/2\n",
+ "def L2(y):\n",
+ " return math.pow(y,3)/4-y/4\n",
+ "A=[ [1,2,9], [2,3,10], [9,10,17] ]\n",
+ "x=0.5\n",
+ "y=0.5\n",
+ "S=0.0\n",
+ "S=S+L0(x)*(L0(x)*A[0][0]+L1(x)*A[0][1]+L2(x)*A[0][2])\n",
+ "S=S+L1(x)*(L0(x)*A[1][0]+L1(x)*A[1][1]+L2(x)*A[1][2])\n",
+ "S=S+L2(x)*(L0(x)*A[2][0]+L1(x)*A[2][1]+L2(x)*A[2][2])\n",
+ "print \"approximated value of z(0.5 0.5)=%f\\n\\n\" %(S)\n",
+ "print \" error in the approximated value : %f\" %((abs(1.25-S)/1.25)*100)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "approximated value of z(0.5 0.5)=0.875000\n",
+ "\n",
+ "\n",
+ " error in the approximated value : 30.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.8:pg-200"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic B-splines\n",
+ "#example 5.8\n",
+ "#page 200\n",
+ "import math\n",
+ "k=[0.0, 1, 2, 3, 4]\n",
+ "pi=[0.0, 0, 4, -6, 24]\n",
+ "x=1\n",
+ "S=0\n",
+ "for i in range(2,5):\n",
+ " S=S+math.pow(k[i]-x,3)/(pi[i])\n",
+ "print \"the cubic splines for x=1 is %f\\n\\n\" %(S)\n",
+ "S=0\n",
+ "x=2\n",
+ "for i in range(2,5):\n",
+ " S=S+math.pow(k[i]-x,3)/(pi[i])\n",
+ "print \"the cubic splines for x=2 is %f\\n\\n\" %(S)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the cubic splines for x=1 is 0.041667\n",
+ "\n",
+ "\n",
+ "the cubic splines for x=2 is 0.166667\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.9:pg-201"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#cubic B-spline\n",
+ "#example 5.9\n",
+ "#page 201\n",
+ "k=[0, 1, 2, 3, 4];\n",
+ "x=1 #for x=1\n",
+ "s11=0\n",
+ "s13=0\n",
+ "s14=0\n",
+ "s24=0 \n",
+ "s12=1/(k[2]-k[1])\n",
+ "s22=((x-k[0])*s11+(k[2]-x)*s12)/2.0 #k[2]-k[0]=2\n",
+ "s23=((x-k[1])*s11+(k[3]-x)*s13)/(k[3]-k[1])\n",
+ "s33=((x-k[0])*s22+(k[3]-x)*s23)/(k[3]-k[0])\n",
+ "s34=((x-k[1])*s23+(k[4]-x)*s24)/(k[4]-k[1])\n",
+ "s44=((x-k[0])*s33+(k[4]-x)*s34)/(k[4]-k[0])\n",
+ "print \"s11=%f\\t s22=%f\\t s23=%f\\t s33=%f\\t s34=%f\\t s44=%f\\n\\n\" %(s11,s22,s23,s33,s34,s44)\n",
+ "x=2 #for x=2\n",
+ "s11=0\n",
+ "s12=0\n",
+ "s14=0\n",
+ "s22=0\n",
+ "s13=1/(k[3]-k[2])\n",
+ "s23=((x-k[1])*s12+(k[3]-x)*s13)/2.0 # k[3]-k[1]=2\n",
+ "s24=((x-k[2])*s13+(k[4]-x)*s14)/(k[2]-k[0])\n",
+ "s33=((x-k[0])*s22+(k[3]-x)*s23)/(k[3]-k[0])\n",
+ "s34=((x-k[1])*s23+(k[4]-x)*s24)/(k[4]-k[1])\n",
+ "s44=((x-k[0])*s33+(k[4]-x)*s34)/(k[4]-k[0])\n",
+ "print \"s13=%f\\t s23=%f\\t s24=%f\\t s33=%f\\t s34=%f\\t s44=%f\\n\\n\" %(s13,s23,s24,s33,s34,s44)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "s11=0.000000\t s22=0.500000\t s23=0.000000\t s33=0.166667\t s34=0.000000\t s44=0.041667\n",
+ "\n",
+ "\n",
+ "s13=1.000000\t s23=0.500000\t s24=0.000000\t s33=0.166667\t s34=0.166667\t s44=0.166667\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex1.2_2.png b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex1.2_2.png
new file mode 100644
index 00000000..5453c422
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex1.2_2.png
Binary files differ
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex3.13_2.png b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex3.13_2.png
new file mode 100644
index 00000000..00af50a0
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex3.13_2.png
Binary files differ
diff --git a/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex6.7_2.png b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex6.7_2.png
new file mode 100644
index 00000000..a71d4c65
--- /dev/null
+++ b/Introductory_Methods_Of_Numerical_Analysis__by_S._S._Sastry/screenshots/ex6.7_2.png
Binary files differ
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter1.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter1.ipynb
new file mode 100644
index 00000000..af42a9cd
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter1.ipynb
@@ -0,0 +1,993 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# chapter 1: Atomic Nucleus"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.1;pg no:2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.1, Page:2 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The electric field in V/m is = 20000.0\n",
+ "\n",
+ " The force in N/C is = 20000.0\n",
+ "\n",
+ " The force on metal sphere in N is = 7.6e-05\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of elelectric field and force\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.1, Page:2 \\n \\n\"\n",
+ "#Given:\n",
+ "v=1000# potential\n",
+ "d=0.05# distance\n",
+ "q=3.8*10**-9# charge\n",
+ "#solution:\n",
+ "e=v/d;#electric field\n",
+ "f=e;# force\n",
+ "f1=f*q;# force on metal sphere\n",
+ "print\"\\n The electric field in V/m is =\",e\n",
+ "print\"\\n The force in N/C is =\",f\n",
+ "print\"\\n The force on metal sphere in N is =\",f1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.2;pg no:2"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.2, Page:2 \n",
+ " \n",
+ "\n",
+ "The potential in V is = 80.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of potential\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.2, Page:2 \\n \\n\"\n",
+ "#Given:\n",
+ "energy=2*10**-6\n",
+ "c=2.5*10**-8# velocity of light\n",
+ "#solution:\n",
+ "v=energy/c# potential\n",
+ "print\"The potential in V is =\",v"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.3;pg no:3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.3, Page:3 \n",
+ "\n",
+ "The wavelength in Angstroms is = 3.88\n",
+ "The photon wavelength in Angstroms is = 1242.38\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of elecrtron and photon wavelength\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.3, Page:3 \\n\"\n",
+ "#Given:\n",
+ "energy=10 #in electron volts\n",
+ "m=9.1*10**-31# mass of electron in kg\n",
+ "h=6.626*10**-34# planck's constant J.s\n",
+ "c=3*10**8# speed of light in m/s\n",
+ "#solution (a):\n",
+ "energy1=energy*1.6*10**-19# energy in J\n",
+ "p=(2*m*energy1)**0.5# momentum\n",
+ "wavelength=h/p*(10)**10\n",
+ "print\"The wavelength in Angstroms is =\",round(wavelength,2)\n",
+ "#solution (b):\n",
+ "wavelength1=h*c/energy1*(10)**10;#photon wavelength\n",
+ "print\"The photon wavelength in Angstroms is =\",round(wavelength1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.4;pg no:3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.4, Page:3 \n",
+ " \n",
+ "\n",
+ "The energy in eV is = 150.77\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of kinetic energy of an electron\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.4, Page:3 \\n \\n\"\n",
+ "#Given:\n",
+ "wavelength=10**-10\n",
+ "m=9.1*10**-31\n",
+ "h=6.626*10**-34\n",
+ "#solution:\n",
+ "p=h/wavelength\n",
+ "e=p*p/(2*m) # energy in J\n",
+ "e1=e/(1.6*10**-19)# energy in eV\n",
+ "print\"The energy in eV is =\",round(e1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.5;pg no:3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.5, Page:3 \n",
+ " \n",
+ "\n",
+ "The wavelength in 10^-5 Angstroms is = 0.66\n",
+ "The wavelength in 10^-5 Angstroms is = 0.65\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of wavelength of oxygen and nitrogen nucleus\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.5, Page:3 \\n \\n\"\n",
+ "#Given:\n",
+ "m=1.66*10**-27# 1u=1.66*10^-27 kg\n",
+ "h=6.6262*10**-34#planck's constant in J.s\n",
+ "energy1=120# in Mev for oxygen\n",
+ "energy2=140# in MeV for nitrogen\n",
+ "#solution(a):\n",
+ "p=(2*m*16*energy1*(1.6022*10**-13))**0.5\n",
+ "wavelength1=h/p*(10)**15#wavelength in 10^-5 Angstroms\n",
+ "print\"The wavelength in 10^-5 Angstroms is =\",round(wavelength1,2)\n",
+ "#solution (b):\n",
+ "p=(2*m*14*energy2*(1.6022*10**-13))**0.5\n",
+ "wavelength2=h/p*(10)**15#wavelength in 10^-5 Angstroms\n",
+ "print\"The wavelength in 10^-5 Angstroms is =\",round(wavelength2,2)\n",
+ "# 1 Angstrom = 10^-10 m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.6;pg no:3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.6, Page:3 \n",
+ " \n",
+ "\n",
+ "The energy in eV is = 8275.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy of a gamma photon\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.6, Page:3 \\n \\n\"\n",
+ "#Given:\n",
+ "wavelength=1.5*10**-10\n",
+ "h=6.62*10**-34\n",
+ "c=3*10**8\n",
+ "#solution:\n",
+ "e=(h*c)/wavelength# energy in J\n",
+ "e1=e/(1.6*10**-19)# energy in eV\n",
+ "print\"The energy in eV is =\",e1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.7;pg no:4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.7, Page:4 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The threshold frequency in s^-1 is = 1.23634168427e+15\n",
+ "\n",
+ " The threshold wavelength in Angstroms is = 2426.51\n",
+ "\n",
+ " The energy of photoelectrone in eV is = 3.91\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of threshold frequency,wavelength,energy of photoelectrone\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.7, Page:4 \\n \\n\"\n",
+ "#Given:\n",
+ "E=5.12*1.6*10**-19# energy in J\n",
+ "h=6.626*10**-34\n",
+ "c=3*10**8\n",
+ "wavelength=200*10**-9\n",
+ "w=2.3# in eV\n",
+ "#solution:\n",
+ "tf=E/h# (part a)\n",
+ "print\"\\n The threshold frequency in s^-1 is =\",round(tf,2)\n",
+ "tl=c/tf*10**10# (part b)\n",
+ "print\"\\n The threshold wavelength in Angstroms is =\",round(tl,2)\n",
+ "e=(h*c)/(wavelength*1.6*10**-19)# photon energy in eV (part c)\n",
+ "pe=e-w\n",
+ "print\"\\n The energy of photoelectrone in eV is =\",round(pe,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.8;pg no:4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.8, Page:4 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The velocity of alpha particles for 1 MeV in mega m/s is = 6.94\n",
+ "\n",
+ " The velocity of alpha particles for 2 MeV in mega m/s is = 9.82\n",
+ "\n",
+ " The velocity of deuteron particles for 1 MeV in mega m/s is = 9.82\n",
+ "\n",
+ " The velocity of deuteron particles for 2 MeV in mega m/s is = 13.88\n",
+ "\n",
+ " The velocity of proton particles for 1 MeV in mega m/s is = 13.88\n",
+ "\n",
+ " The velocity of proton particles for 2 MeV in mega m/s is = 19.63\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of velocity of alpha particles,deuteron,proton\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.8, Page:4 \\n \\n\"\n",
+ "#Given:\n",
+ "e1=1 # in MeV\n",
+ "e2=2 # in MeV\n",
+ "ma=4 # in u(amu)\n",
+ "md=2 # in u(amu)\n",
+ "mp=1 # in u(amu)\n",
+ "# 1u = 1.6*10^-27 Kg\n",
+ "#solution: part a)For alpha particles\n",
+ "v1a=((2*e1*10**6*1.6*10**-19)/(ma*1.6605*10**-27))**.5\n",
+ "print\"\\n The velocity of alpha particles for 1 MeV in mega m/s is =\",round(v1a/10**6,2)# For 1 MeV\n",
+ "v2a=((2*e2*10**6*1.6*10**-19)/(ma*1.6605*10**-27))**.5\n",
+ "print\"\\n The velocity of alpha particles for 2 MeV in mega m/s is =\",round(v2a/10**6,2)# For 2 MeV\n",
+ "#solution: part b)For deuteron particles\n",
+ "v1b=((2*e1*10**6*1.6*10**-19)/(md*1.6605*10**-27))**.5\n",
+ "print\"\\n The velocity of deuteron particles for 1 MeV in mega m/s is =\",round(v1b/10**6,2) # For 1 MeV\n",
+ "v2b=((2*e2*10**6*1.6*10**-19)/(md*1.6605*10**-27))**.5\n",
+ "print\"\\n The velocity of deuteron particles for 2 MeV in mega m/s is =\",round(v2b/10**6,2) # For 2 MeV\n",
+ "#solution: part c)For proton particles\n",
+ "v1p=((2*e1*10**6*1.6*10**-19)/(mp*1.6605*10**-27))**.5\n",
+ "print\"\\n The velocity of proton particles for 1 MeV in mega m/s is =\",round(v1p/10**6,2) # For 1 MeV\n",
+ "v2p=((2*e2*10**6*1.6*10**-19)/(mp*1.6605*10**-27))**.5\n",
+ "print\"\\n The velocity of proton particles for 2 MeV in mega m/s is =\",round(v2p/10**6,2) # For 2 MeV"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.9;pg no:5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.9, Page:5 \n",
+ " \n",
+ "\n",
+ "The energy in MeV is = 934.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The energy equivalence\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.9, Page:5 \\n \\n\"\n",
+ "#Given:\n",
+ "m=1./(6.023*10**23)#mass of 1 atom in g\n",
+ "m1=m*10**-3#mass of 1 atom in Kg\n",
+ "c=3.*10**8# velocity in m/s\n",
+ "#solution:\n",
+ "e=m1*c*c; # energy in J\n",
+ "e1=e/(1.6*10**-13)# energy in MeV\n",
+ "print\"The energy in MeV is =\",round(e1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.10;pg no:5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.10, Page:5 \n",
+ " \n",
+ "\n",
+ "The energy in eV is = 13.26\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The energy of formation\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.10, Page:5 \\n \\n\"\n",
+ "#Given:\n",
+ "enthalpy=1278 # enthalpy of combustion in kJ/mol\n",
+ "#solution:\n",
+ "energy=(enthalpy*1000)/(6.022*10**23*1.6*10**-19)\n",
+ "print\"The energy in eV is =\",round(energy,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.11;pg no:5"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.11, Page:5 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The mean binding energy of helium atom in MeV is = 7.07\n",
+ "\n",
+ " The mean binding energy of oxygen atom in MeV is = 7.98\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mean binding energy of helium and oxygen\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.11, Page:5 \\n \\n\"\n",
+ "#Given:\n",
+ "mh=1.0078\n",
+ "mn=1.0087\n",
+ "ma=4.0026\n",
+ "mo=15.9949\n",
+ "Ah=4.0026 # atomic mass of helium\n",
+ "Ao=15.9949 # atomic mass of oxygen\n",
+ "#solution:\n",
+ "# part (a)\n",
+ "B1=(2*mh+2*mn-ma)*931 # in MeV\n",
+ "Bh=B1/Ah\n",
+ "print\"\\n The mean binding energy of helium atom in MeV is =\",round(Bh,2)\n",
+ "# part (b)\n",
+ "B2=(8*mh+8*mn-mo)*931 # in MeV\n",
+ "Bo=B2/Ao\n",
+ "print\"\\n The mean binding energy of oxygen atom in MeV is =\",round(Bo,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.12;pg no:6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.12, Page:6 \n",
+ "\n",
+ "\n",
+ " The mean binding energy of Be atom in MeV is = 7.059\n",
+ "From previous problem we have the avg. binding energy of helium atom is 7.08 MeV, Hence Be is unstable to fission into 2 alphas\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mean binding energy of Be atom\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.12, Page:6 \\n\"\n",
+ "#Given:\n",
+ "mh=1.0078;\n",
+ "mn=1.0087;\n",
+ "ABe=8.0053; # atomic mass of beryllium\n",
+ "#solution:\n",
+ "B1=(4*mh+4*mn-ABe)*931; # in MeV\n",
+ "Bh=B1/ABe;\n",
+ "print\"\\n The mean binding energy of Be atom in MeV is =\",round(Bh,3)\n",
+ "print\"From previous problem we have the avg. binding energy of helium atom is 7.08 MeV, Hence Be is unstable to fission into 2 alphas\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.13;pg no:6"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.13, Page:6 \n",
+ "\n",
+ "The amount of coal required in Kg is = 2.5\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of amount of coal\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.13, Page:6 \\n\"\n",
+ "#Given:\n",
+ "e=200; # in Mev\n",
+ "m=0.235; # weight of uranium atom in Kg\n",
+ "enthalpy=393.5; # in KJ/mol\n",
+ "Na=6.02*10**23;\n",
+ "#solution:\n",
+ "e1=e*1.6*10**-19*10**6;\n",
+ "atoms=Na/m;\n",
+ "e2=atoms*e1;#energy released in J\n",
+ "m1=(e2*12)/(393.5*1000*1000);# in Kg\n",
+ "m2=m1/1000;# in tons\n",
+ "print\"The amount of coal required in Kg is =\", round(m2/1000,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.14;pg no:7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.14, Page:7 \n",
+ " \n",
+ "\n",
+ "The energy release in part (a) in eV/molecule is = 2.51\n",
+ "The energy release in part (b) in eV/molecule is = 9.23\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The energy releases\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.14, Page:7 \\n \\n\"\n",
+ "#Given:\n",
+ "H1=241.8; # in KJ/mol\n",
+ "H2=887.2; # in KJ/mol\n",
+ "# 1 KJ/mol = 0.0104 eV/atom\n",
+ "#solution: part (a)\n",
+ "e1=H1*0.0104;\n",
+ "print\"The energy release in part (a) in eV/molecule is =\",round(e1,2)\n",
+ "#solution: part (b)\n",
+ "e2=H2*0.0104;\n",
+ "print\"The energy release in part (b) in eV/molecule is =\",round(e2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.15;pg no:7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.15, Page:7 \n",
+ "\n",
+ "The energy release in part (a) in KJ/mol of carbondioxide is = 394.9\n",
+ "The energy release in part (b) in KJ/mol of alumina is = 1676.0\n",
+ "The energy release in part (c) in MJ/atom of U(235) is = 19.264\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The energy releases\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.15, Page:7 \\n\"\n",
+ "#Given:\n",
+ "H1=4.1; # in eV/molecule\n",
+ "H2=17.4; # in eV/molecule\n",
+ "H3=200;# in MeV/atom of U\n",
+ "# 1 eV/atom = 96.32 KJ/mol\n",
+ "#solution: part (a)\n",
+ "e1=H1*96.32;\n",
+ "print\"The energy release in part (a) in KJ/mol of carbondioxide is =\",round(e1,1)\n",
+ "#solution: part (b)\n",
+ "e2=H2*96.32;\n",
+ "print\"The energy release in part (b) in KJ/mol of alumina is =\",round(e2,1)\n",
+ "#solution: part (c)\n",
+ "e3=H3*1000*96.32;# in MJ/atom of U(235)\n",
+ "print\"The energy release in part (c) in MJ/atom of U(235) is =\",round(e3/10**6,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.16;pg no:7"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.16, Page:7 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The rate of energy release in MW is= 949.25\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The rate of energy release\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.16, Page:7 \\n \\n\"\n",
+ "#Given:\n",
+ "e=200.; #MeV/ atom of U\n",
+ "# 1 eV = 1.6*10^-19 J\n",
+ "Na=6.023*10**23;\n",
+ "M=0.235; # mass in Kg\n",
+ "#solution:\n",
+ "e1=e*1.6*10**-19*10**6;\n",
+ "A=Na/M;\n",
+ "e2=A*e1; # energy released in MJ/day\n",
+ "e3=e2/(24.*3600.);\n",
+ "print\"\\n The rate of energy release in MW is=\",round(e3/10**6,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.17;pg no:8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.17, Page:8 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The mass loss in 10^-27 Kg/He formed is = 0.0464\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The mass loss\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.17, Page:8 \\n \\n\"\n",
+ "#Given:\n",
+ "e=26.03; # in MeV\n",
+ "#solution:\n",
+ "loss=e/931; #in atomic mass units (u)\n",
+ "# 1 u = 1.66*10^-27 Kg\n",
+ "m=(loss*1.66*10**-27)/(1*10**-27);\n",
+ "print\"\\n The mass loss in 10^-27 Kg/He formed is =\",round(m,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.18;pg no:8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.18, Page:8 \n",
+ "\n",
+ "\n",
+ " The energy loss in MeV is = -4.0312\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The energy loss\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.18, Page:8 \\n\"\n",
+ "#Given:\n",
+ "mh=1.007825;\n",
+ "mt=3.016049;\n",
+ "md=2.014102;\n",
+ "#solution:\n",
+ "m1=(mh+mt-2*md);\n",
+ "e=(-m1)*931; # in MeV\n",
+ "print\"\\n The energy loss in MeV is =\",round(-e,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.19;pg no:8"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.19, Page:8 \n",
+ "\n",
+ "The mean binding energy of tritium atom in MeV is = 2.811\n",
+ "The mean binding energy of nickel atom in MeV is = 8.716\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mean binding energy of tritium and nickel atom\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.19, Page:8 \\n\"\n",
+ "#Given:\n",
+ "mh=1.007825;\n",
+ "mn=1.008665;\n",
+ "mt=3.016049; # atomic mass of Tritium\n",
+ "mNi=59.93528; # atomic mass of Nickel\n",
+ "#solution:\n",
+ "# part (a)\n",
+ "B1=(1*mh+2*mn-mt)*931; # in MeV\n",
+ "Bh=B1/mt;\n",
+ "print\"The mean binding energy of tritium atom in MeV is =\",round(Bh,3)\n",
+ "# part (b)\n",
+ "B2=(28*mh+32*mn-mNi)*931; # in MeV\n",
+ "Bo=B2/mNi;\n",
+ "print\"The mean binding energy of nickel atom in MeV is =\",round(Bo,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.20;pg no:9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.20, Page:9 \n",
+ "\n",
+ "The mean binding energy of Cl (35) atom in MeV is = 8.5281\n",
+ "The mean binding energy of Cl (37) atom in MeV is = 8.5784\n",
+ "The increase in mean binding energy of Cl atom in MeV is = 0.05\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mean binding energy of Cl\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.20, Page:9 \\n\"\n",
+ "#Given:\n",
+ "mh=1.00783;\n",
+ "mn=1.00867;\n",
+ "m35=34.96885; # atomic mass of Cl (35)\n",
+ "m37=36.96590; # atomic mass of Cl (37)\n",
+ "#solution:\n",
+ "B1=(17*mh+18*mn-m35)*931; # in MeV\n",
+ "Bh=B1/m35;\n",
+ "print\"The mean binding energy of Cl (35) atom in MeV is =\",round(Bh,4)\n",
+ "B2=(17*mh+20*mn-m37)*931; # in MeV\n",
+ "Bo=B2/m37;\n",
+ "print\"The mean binding energy of Cl (37) atom in MeV is =\",round(Bo,4)\n",
+ "Bi=Bo-Bh;\n",
+ "print\"The increase in mean binding energy of Cl atom in MeV is =\",round(Bi,2)\n",
+ "# NOTE: The answer depends upon how much precise value you take for atomic masses."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 1.21;pg no:9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 1.21, Page:9 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The mean binding energy of Na(22) in MeV is = 7.9236\n",
+ "\n",
+ " The mean binding energy of Na(23)in MeV is = 8.1154\n",
+ "\n",
+ " The mean binding energy of Na(24) in MeV is = 8.0717\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mean binding energy of Na\n",
+ "#intiation of all variables\n",
+ "# Chapter 1\n",
+ "print\"Example 1.21, Page:9 \\n \\n\"\n",
+ "#Given:\n",
+ "mh=1.0078;\n",
+ "mn=1.0087;\n",
+ "m22=21.99431;# atomic mass of Na 22\n",
+ "m23=22.9898;# atomic mass of Na 23\n",
+ "m24=23.9909;# atomic mass of Na 24\n",
+ "#solution:\n",
+ "# part (a)\n",
+ "B1=((11*mh+11*mn)-m22)*931; # in MeV\n",
+ "Bh=B1/m22;\n",
+ "print\"\\n The mean binding energy of Na(22) in MeV is =\",round(Bh,4)\n",
+ "# part (b)\n",
+ "B2=((11*mh+12*mn)-m23)*931; # in MeV\n",
+ "Bo=B2/m23;\n",
+ "print\"\\n The mean binding energy of Na(23)in MeV is =\",round(Bo,4)\n",
+ "# part (c)\n",
+ "B3=((11*mh+13*mn)-m24)*931; # in MeV\n",
+ "Bs=B3/m24;\n",
+ "print\"\\n The mean binding energy of Na(24) in MeV is =\",round(Bs,4)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter10.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter10.ipynb
new file mode 100644
index 00000000..3d742c55
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter10.ipynb
@@ -0,0 +1,624 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#chapter 10:applications of radioactivity"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.1;pg no: 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.1, Page:133 \n",
+ " \n",
+ "\n",
+ "The energy of recoil of Iodine atom in eV= 96.48\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of value of numerical constant\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.1, Page:133 \\n \\n\"\n",
+ "# Given:\n",
+ "E=4.8;# in MeV\n",
+ "M=128;# molecular weight of I\n",
+ "#Formula:\n",
+ "# Er=(536*E^2)/M\n",
+ "# Solution:\n",
+ "Er=(536*E**2)/M;\n",
+ "print\"The energy of recoil of Iodine atom in eV=\", Er"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.2;pg no: 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.2, Page:133 \n",
+ " \n",
+ "\n",
+ "The energy of recoil of Zinc atom in (eV)= 9.98\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy of recoil of Zinc atom\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.2, Page:133 \\n \\n\"\n",
+ "# Given:\n",
+ "E=1.1;# in MeV\n",
+ "M=65;# molecular weight of zinc\n",
+ "#Formula:\n",
+ "# Er=(536*E^2)/M\n",
+ "# Solution:\n",
+ "Er=(536*E**2)/M;\n",
+ "print\"The energy of recoil of Zinc atom in (eV)=\", round(Er,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.3;pg no: 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.3, Page:133 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The solubility of BaSO4 in (moles/lit) is = 1.00184296245e-05\n",
+ "\n",
+ " \n",
+ " The solubility of BaSO4 in (mg/lit) is = 2.337\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of solubility of BaSO4\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.3, Page:133 \\n \\n\"\n",
+ "# Given:\n",
+ "M1=137.32;# moleular wt of barium\n",
+ "M2=32.;# molecular weight of sulphur\n",
+ "M3=16.;# molecular wt of oxygen\n",
+ "M4=233.32;# molecular wt of BaSO4\n",
+ "ai=40000.;# specific initial activity in counts min^-1 mg^-1\n",
+ "af=187./20.;# specific final activity in counts min^-1 0.1ml^-1\n",
+ "\n",
+ "# Formula:\n",
+ "# (1)S1=(af/ai)*(10/M) in moles/lit\n",
+ "# (2)S2=(af/ai)*(10^4) in mg/lit\n",
+ "# Solution:\n",
+ "S1=(af/ai)*(10./M4); # solubility of BaSO4 in moles/lit\n",
+ "S2=(af/ai)*10**4;# solubility of BaSO4 in mg/lit\n",
+ "print\"\\n The solubility of BaSO4 in (moles/lit) is =\",S1\n",
+ "print\"\\n \\n The solubility of BaSO4 in (mg/lit) is =\",round(S2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.4;pg no: 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.4, Page:133 \n",
+ " \n",
+ "\n",
+ "The surface area of 1 gm of precipitate sample in (cm^2/gm)= 1.27907915567e+18\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of surface area of 1 gm of precipitate sample\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.4, Page:133 \\n \\n\"\n",
+ "# Given:\n",
+ "conc=4.;# 4 mg per 1 l\n",
+ "a1=1600.;# labelled solution of PbSO4\n",
+ "a2=900.;# activity of filtrate (in solution)\n",
+ "M=303.2;# molecular wt of PbSO4\n",
+ "l=6.022*10**23;\n",
+ "# Solution:\n",
+ "y=20.*4./1000.;# 20 ml will contain y mg\n",
+ "z=y*a2/a1;# final amount of PbSO4 in solution\n",
+ "a3=a1-a2;# activity on surface\n",
+ "# Let the total PbSO4 on surfaceof precipitate be x\n",
+ "# Asumming exchange equilibrium is established we have\n",
+ "x=a3*z/a2;# in mg\n",
+ "molecules=x*10**-3*(l)/M;\n",
+ "# Give that surface area of 1 PbSO4 = 18.4*10^-16 cm^2\n",
+ "A=molecules*18.4*1.**-16;\n",
+ "print\"The surface area of 1 gm of precipitate sample in (cm^2/gm)=\",A"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.5;pg no: 134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.5, Page:134 \n",
+ " \n",
+ "\n",
+ "The volume of blood in the patient in (lit)= 5.6\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of volume of blood in the patient\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.5, Page:134 \\n \\n\"\n",
+ "# Given:\n",
+ "ai=14000;# counts per min per 0.1 cm^3, initial activity of blood\n",
+ "Si=1.4*10**5;# c min^-1 cm^-3, initial specific activity\n",
+ "a=250;# 250 net counts in 10 min, this implies 25 net counts in a min\n",
+ "# Formula: Si/Sr = V\n",
+ "# Solution:\n",
+ "V=Si/25;# total blood in the patient in cm^3\n",
+ "V1=V/1000;# volume in lit\n",
+ "print\"The volume of blood in the patient in (lit)=\",V1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.6;pg no: 134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.6, Page:134 \n",
+ " \n",
+ "\n",
+ "The percentage of penicillin in mixture is = 0.15\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of percentage of penicillin in mixture\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.6, Page:134 \\n \\n\"\n",
+ "# Given:\n",
+ "y=5;# in mg labelled sample\n",
+ "V=2000;# volume of mixture in ml\n",
+ "# Formula: x=y*(Si-Sf)/Sf\n",
+ "#Solution:\n",
+ "Si=20000/(5*5);# initial specific activity in counts min^-1 mg^-1\n",
+ "Sf=3000/(.6*10);# final specific activity in counts min^-1 mg^-1\n",
+ "x=y*(Si-Sf)/Sf;# in mg for V amount of volume\n",
+ "#% of penicillin in mixture\n",
+ "p=x*100/V;\n",
+ "print\"The percentage of penicillin in mixture is =\",p"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.7;pg no: 135"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.7, Page:135 \n",
+ " \n",
+ "\n",
+ "The percentage of iodine in mixture is = 1.058\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of percentage of iodine in mixture\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.7, Page:135 \\n \\n\"\n",
+ "# Given:\n",
+ "y=2.;# in ml labelled sample\n",
+ "V=1000.;# volume of mixture in ml\n",
+ "BC=100./20.;# 100 counts for 20 min\n",
+ "# Formula: x=y*(Si-Sf)/Sf\n",
+ "#Solution:\n",
+ "Si=(2500.-BC)/(2.);# initial specific activity in counts min^-1 mg^-1\n",
+ "Sf=(600.-BC)/(3.);# final specific activity in counts min^-1 mg^-1\n",
+ "x=y*(Si-Sf)/Sf;# in mg for V amount of volume\n",
+ "#% of iodine in mixture\n",
+ "i=x*100./V;\n",
+ "print\"The percentage of iodine in mixture is = \",round(i,3)\n",
+ "#NOte: Backward counts are taken to be 100 counts for 10 min in the solution given in textbook"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.8;pg no: 135"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.8, Page:135 \n",
+ " \n",
+ "\n",
+ "The percentage Cr content in the ruby is = 0.34\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of percentage Cr content in the ruby\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.8, Page:135 \\n \\n\"\n",
+ "# Given:\n",
+ "flux=10**12;\n",
+ "s=15.9*10**-24;\n",
+ "m1=0.5;# weight of ruby in mg\n",
+ "#Soluton:\n",
+ "a1=35000;# measured activity in c/s\n",
+ "a2=350000;# corrected activity in )d/s\n",
+ "N=a2/(flux*s*(1-0.5**(1/27.7)));\n",
+ "m=50*N/(6.02*10**23);\n",
+ "Cr=(100*m)/4.35;# total Cr in in the Ruby\n",
+ "crp=(Cr*100)/0.5;# % cr in the ruby\n",
+ "print\"The percentage Cr content in the ruby is = \",round(crp,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.9;pg no: 136"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.9, Page:136 \n",
+ " \n",
+ "\n",
+ "The total mass of Ge atoms present in sample in (mg)= 2.47\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of total mass of Ge atoms present in sample\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.9, Page:136 \\n \\n\"\n",
+ "# Given:\n",
+ "flux=10**12;\n",
+ "s=3.28*10**-27;\n",
+ "hf=1;# half life in min\n",
+ "#Soluton:\n",
+ "a1=2500;# measured activity in d/s\n",
+ "a2=5000;# corrected activity in d/s\n",
+ "N=a2/(flux*s);\n",
+ "m=76*N/(6.02*10**23);\n",
+ "Cr=(100*m)/7.8;# total mass of Ge atoms (isotopic abandunce is 7.8%)\n",
+ "print\"The total mass of Ge atoms present in sample in (mg)=\",round(Cr*10**3,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.10;pg no: 136"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.10, Page:136 \n",
+ " \n",
+ "\n",
+ "The activity of sample in dpm is = 75642.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of activity of sample in dpm\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.10, Page:136 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "M=55;# wt of Mn\n",
+ "m=0.1;# in g\n",
+ "t=90;# min irradated\n",
+ "flux=10**6;\n",
+ "t1=5; #in hours\n",
+ "cs=13.3*10**-24# in cm^2\n",
+ "hl=2.58;# in hours\n",
+ "Na=6.022*10**23;\n",
+ "r=100;# in %\n",
+ "# Solution:\n",
+ "s=1-(math.exp(-.693*t/(2.58*60)));\n",
+ "A=(m*Na*r*flux*cs*s)/(100*M);\n",
+ "x=math.exp(-0.693*5/2.58);\n",
+ "# activity after cooling period\n",
+ "A1=A*x*60;# in dpm\n",
+ "print\"The activity of sample in dpm is = \",round(A1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.11;pg no: 137"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.11, Page:137 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The weight of the sample that should be taken is =(g) 0.525\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of \n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.11, Page:137 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "t1=12.7;# in hours\n",
+ "a=4.5*10**-24;# in cm^2\n",
+ "r=69.1;#in %\n",
+ "cf=10;# in %\n",
+ "flux=10**6;\n",
+ "Na=6.022*10**23;\n",
+ "cpm=1500;# activity in counts per min\n",
+ "M=63;\n",
+ "#Solution:\n",
+ "dpm=cpm*100/10;\n",
+ "dps=dpm/60;\n",
+ "x=math.exp(-0.693*5/t1);\n",
+ "A=dps/x;\n",
+ "s=1-(math.exp(-.693*10/(12.7)));\n",
+ "w=(A*M*100)/(Na*r*a*flux*s);# gms of Cu\n",
+ "# given that 5g Cu in 100g alloy, for wg amount of alloy will be\n",
+ "Y=100*w/5;# amount of alloy ing\n",
+ "print\"\\n The weight of the sample that should be taken is =(g)\",round(Y,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.12;pg no: 138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.12, Page:138 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The mass of potassium bromide in the original solution in (g)= 0.0049385\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mass of potassium bromide in the original solution\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.12, Page:138 \\n \\n\"\n",
+ "# Given:\n",
+ "vi=2.5;#titrant volume\n",
+ "V1=10; # vol of KBr in ml\n",
+ "N2=0.01;#normality of AgNO3\n",
+ "M1=119;# mol wt of KBr\n",
+ "# Solution:\n",
+ "ai=((12500/5)-10);\n",
+ "af=((6000/6)-10);\n",
+ "# deerease in activity due to addition of titrant 2.5ml\n",
+ "d=ai-af;\n",
+ "# volume corresponding to ai for AgNO3\n",
+ "V2=ai*vi/d;\n",
+ "N1=(N2*V2)/V1;# Normality of KBr solution\n",
+ "m=N1*M1/100;# mass of KBr in 10 ml solution\n",
+ "print\"\\n The mass of potassium bromide in the original solution in (g)=\",m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 10.13;pg no: 138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 10.13, Page:138 \n",
+ " \n",
+ "\n",
+ "The age of the sample in (years)= 2994.11\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of age of the sample\n",
+ "#intiation of all variables\n",
+ "# Chapter 10\n",
+ "print\"Example 10.13, Page:138 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "w=5.;# in g\n",
+ "ai=55.;# counts per 10 min\n",
+ "A0=15.8;# in dpm/g\n",
+ "# Solution:\n",
+ "\n",
+ "cpm=55./10.;\n",
+ "dpm=cpm*100/10; # 10% efficient counting\n",
+ "sa=dpm/w;# in dpm/g\n",
+ "t=5730.*math.log(A0/sa)/(0.693); # Age determination\n",
+ "print\"The age of the sample in (years)=\",round(t,2)"
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter11.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter11.ipynb
new file mode 100644
index 00000000..0c66f7f4
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter11.ipynb
@@ -0,0 +1,774 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#chapter 11:elements of radiation chemistry"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.1;pg no: 144"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.1, Page:144 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The molecule absorption coefficient of water in b/molecule is = 2.11\n",
+ "\n",
+ " The mass absorption coefficient of water in cm^2/g is = 0.071\n",
+ "\n",
+ " The linear absorption coefficient of water in cm^-1 is = 0.071\n",
+ "\n",
+ " \n",
+ " The molecule absorption coefficient of ethanol in b/molecule is = 5.486\n",
+ "\n",
+ " The mass absorption coefficient of ethanol in cm^2/g is = 0.072\n",
+ "\n",
+ " The linear absorption coefficient of ethanol in cm^-1 is = 0.057\n",
+ "\n",
+ " \n",
+ " The molecule absorption coefficient of methanol in b/molecule is = 3.798\n",
+ "\n",
+ " The mass absorption coefficient of methanol in cm^2/g is = 0.071\n",
+ "\n",
+ " The linear absorption coefficient of methanol in cm^-1 is = 0.057\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of molecule,mass,linear absorption coefficient\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.1, Page:144 \\n \\n\"\n",
+ "#Given:\n",
+ "density1=1.000;# for water in CGS units\n",
+ "density2=0.789;# for ethanol in CGS units\n",
+ "density3=0.793;# for methanol in CGS units\n",
+ "l=6.023*10**23;# avogadro constant\n",
+ "ue=0.211;# electron absorption coefficent in barn per electron\n",
+ "# 1 b=10^(-24) cm^2\n",
+ "#solution: (a) Water\n",
+ "z1=10;# no. of electrons\n",
+ "a1=18;# atomic mass of water\n",
+ "uw=ue*z1;#molecule absorption coefficient\n",
+ "umw=(uw*l*10**-24)/a1;#mass absorption coefficient\n",
+ "ulw=umw*density1;# linear absorption coefficient\n",
+ "print\"\\n The molecule absorption coefficient of water in b/molecule is = \",round(uw,3)\n",
+ "print\"\\n The mass absorption coefficient of water in cm^2/g is = \",round(umw,3)\n",
+ "print\"\\n The linear absorption coefficient of water in cm^-1 is = \",round(ulw,3)\n",
+ "#solution: (b) ethanol\n",
+ "z2=26;# no. of electrons\n",
+ "a2=46;# atomic mass of water\n",
+ "ueth=ue*z2;#molecule absorption coefficient\n",
+ "umeth=(ueth*l*10**-24)/a2;#mass absorption coefficient\n",
+ "uleth=umeth*density2;# linear absorption coefficient\n",
+ "print\"\\n \\n The molecule absorption coefficient of ethanol in b/molecule is =\",round(ueth,3)\n",
+ "print\"\\n The mass absorption coefficient of ethanol in cm^2/g is = \",round(umeth,3)\n",
+ "print\"\\n The linear absorption coefficient of ethanol in cm^-1 is = \",round(uleth,3)\n",
+ "\n",
+ "#solution: (c) methanol\n",
+ "z3=18;# no. of electrons\n",
+ "a3=32;# atomic mass of water\n",
+ "umet=ue*z3;#molecule absorption coefficient\n",
+ "ummet=(umet*l*10**-24)/a3;#mass absorption coefficient\n",
+ "ulmet=ummet*density3;# linear absorption coefficient\n",
+ "print\"\\n \\n The molecule absorption coefficient of methanol in b/molecule is =\",round(umet,3)\n",
+ "print\"\\n The mass absorption coefficient of methanol in cm^2/g is =\",round(ummet,3)\n",
+ "print\"\\n The linear absorption coefficient of methanol in cm^-1 is = \",round(ulmet,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.2;pg no: 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.2, Page:145 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The molecule absorption coefficient of benzene in b/molecule is = 8.86\n",
+ "\n",
+ " The mass absorption coefficient of benzene in cm^2/g is = 0.0684186575654\n",
+ "\n",
+ " \n",
+ " The molecule absorption coefficient of cyclohexane in b/molecule is = 10.126\n",
+ "\n",
+ " The mass absorption coefficient of cyclohexane in cm^2/g is = 0.073\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of molecule,mass absorption coefficient\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.2, Page:145 \\n \\n\"\n",
+ "#Given:\n",
+ "# for benzene in CGS units\n",
+ "density1=.879;\n",
+ "lac1=.06014; # linear absorption coefficient\n",
+ "# for cyclohexane in CGS units \n",
+ "density2=0.779;\n",
+ "lac2=.05656; # linear absorption coefficient\n",
+ "l=6.023*10**23;# avogadro constant\n",
+ "ue=0.211;# electron absorption coefficent in barn per electron\n",
+ "# 1 b=10^(-24) cm^2\n",
+ "#solution: (a)Benzene\n",
+ "a1=78;# atomic mass of benzene\n",
+ "mac1=lac1/density1; #mass absorption coefficient\n",
+ "mb=(mac1*a1)/(l*10**-24); #molecule absorption coefficient of benzene\n",
+ "print\"\\n The molecule absorption coefficient of benzene in b/molecule is =\",round(mb,3)\n",
+ "print\"\\n The mass absorption coefficient of benzene in cm^2/g is = \",mac1\n",
+ "#solution: (b)cyclohexane\n",
+ "a2=84;# atomic mass of cyclohexane\n",
+ "mac2=lac2/density2; #mass absorption coefficient\n",
+ "mc=(mac2*a2)/(l*10**-24); #molecule absorption coefficient of cyclohexane\n",
+ "print\"\\n \\n The molecule absorption coefficient of cyclohexane in b/molecule is = \",round(mc,3)\n",
+ "print\"\\n The mass absorption coefficient of cyclohexane in cm^2/g is = \",round(mac2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.3;pg no: 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.3, Page:145 \n",
+ " \n",
+ "\n",
+ "Example 11.2, Page:145 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The molecule absorption coefficient of benzene in b/molecule is = 8.86\n",
+ "\n",
+ " The mass absorption coefficient of benzene in cm^2/g is = 0.0684186575654\n",
+ "\n",
+ " \n",
+ " The molecule absorption coefficient of cyclohexane in b/molecule is = 10.126\n",
+ "\n",
+ " The mass absorption coefficient of cyclohexane in cm^2/g is = 0.073\n",
+ "The mass absorption coefficient of NaI in cm^2/g is = 0.0576104666667\n",
+ "\n",
+ " \n",
+ " The mass absorption coefficient of NaIO3 in cm^2/g is = 0.0590642626263\n",
+ "\n",
+ " \n",
+ " The mass absorption coefficient of Ca(PO3)2 in cm^2/g is = -1.45987878788e+23\n",
+ "\n",
+ " \n",
+ " The mass absorption coefficient of Ca3(PO4)2 in cm^2/g is = -9.32438709677e+22\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mass absorption coefficient\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.3, Page:145 \\n \\n\"\n",
+ "#Given:\n",
+ "#Atomic absorption coefficients for diferent atoms in b/atom\n",
+ "O=1.69;\n",
+ "Na=2.32;\n",
+ "P=3.17;\n",
+ "Ca=4.22;\n",
+ "I=12.03\n",
+ "# 1 b=10^(-24) cm^2\n",
+ "#solution:\n",
+ "#mass absorption coefficient for the given atoms in cm^2/g\n",
+ "uO=(O*10**-24*6.022*10**23)/16;\n",
+ "uNa=(Na*10**-24*6.022*10**23)/23;\n",
+ "uP=(P*10*8-24*6.022*10**23)/31;\n",
+ "uCa=(Ca*10**-24*6.022*10**23)/40;\n",
+ "uI=(I*10**-24*6.022*10**23)/127;\n",
+ "# The mass absorption coefficient for the given substance is the sum of the mass absorption coefficients of the atoms present, each atom being weighted in proportion to its mass in the molecule.\n",
+ "\n",
+ "#(a) NaI(A1=150)\n",
+ "u1=(uNa*23+uI*127)/150;\n",
+ "#(b) NaIO3 (A2=198)\n",
+ "u2=(uNa*23+uI*127+uO*48)/198;\n",
+ "#(c) Ca(PO3)2 (A3=198)\n",
+ "u3=(uCa*40+uP*62+uO*96)/198;\n",
+ "#(d) Ca3(PO4)2 (A4=310)\n",
+ "u4=(uCa*120+uP*62+uO*128)/310;#cal of molecule,mass absorption coefficient\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.2, Page:145 \\n \\n\"\n",
+ "#Given:\n",
+ "# for benzene in CGS units\n",
+ "density1=.879;\n",
+ "lac1=.06014; # linear absorption coefficient\n",
+ "# for cyclohexane in CGS units \n",
+ "density2=0.779;\n",
+ "lac2=.05656; # linear absorption coefficient\n",
+ "l=6.023*10**23;# avogadro constant\n",
+ "ue=0.211;# electron absorption coefficent in barn per electron\n",
+ "# 1 b=10^(-24) cm^2\n",
+ "#solution: (a)Benzene\n",
+ "a1=78;# atomic mass of benzene\n",
+ "mac1=lac1/density1; #mass absorption coefficient\n",
+ "mb=(mac1*a1)/(l*10**-24); #molecule absorption coefficient of benzene\n",
+ "print\"\\n The molecule absorption coefficient of benzene in b/molecule is =\",round(mb,3)\n",
+ "print\"\\n The mass absorption coefficient of benzene in cm^2/g is = \",mac1\n",
+ "#solution: (b)cyclohexane\n",
+ "a2=84;# atomic mass of cyclohexane\n",
+ "mac2=lac2/density2; #mass absorption coefficient\n",
+ "mc=(mac2*a2)/(l*10**-24); #molecule absorption coefficient of cyclohexane\n",
+ "print\"\\n \\n The molecule absorption coefficient of cyclohexane in b/molecule is = \",round(mc,3)\n",
+ "print\"\\n The mass absorption coefficient of cyclohexane in cm^2/g is = \",round(mac2,3)\n",
+ "print\"The mass absorption coefficient of NaI in cm^2/g is =\",u1\n",
+ "print\"\\n \\n The mass absorption coefficient of NaIO3 in cm^2/g is = \",u2\n",
+ "print\"\\n \\n The mass absorption coefficient of Ca(PO3)2 in cm^2/g is = \",u3\n",
+ "print\"\\n \\n The mass absorption coefficient of Ca3(PO4)2 in cm^2/g is =\",u4"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.4;pg no: 146"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.4, Page:146 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The molecular absorption coefficient of KI in b/molecule is = 15.192\n",
+ "\n",
+ " The mass absorption coefficient of KI in cm^2/g is = 0.055\n",
+ "\n",
+ " The linear absorption coefficient of KI in cm^-1 is = 0.172\n",
+ "The molecular absorption coefficient of KIO4 in b/molecule is = 21.944\n",
+ "The mass absorption coefficient of KIO4 in cm^2/g is = 0.057\n",
+ "The linear absorption coefficient of KIO4 in cm^-1 is = 0.182\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of molecule,mass absorption coefficient\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.4, Page:146 \\n \\n\"\n",
+ "#Given:\n",
+ "density1=3.123;# for KI in CGS units\n",
+ "density2=3.168;# for KIO3 in CGS units\n",
+ "l=6.023*10**23;# avogadro constant\n",
+ "ue=0.211;# electron absorption coefficent in barn per electron\n",
+ "# 1 b=10^(-24) cm^2\n",
+ "#Atomic absorption coefficients for diferent atoms in b/atom\n",
+ "K=ue*19;\n",
+ "I=ue*53;\n",
+ "O=ue*8;\n",
+ "#mass absorption coefficient for the given atoms in cm^2/g\n",
+ "uK=(6.022*10**23*K*10**-24)/39;\n",
+ "uI=(6.022*10**23*I*10**-24)/127;\n",
+ "uO=(6.022*10**23*O*10**-24)/16;\n",
+ "#solution: (a)KI\n",
+ "uKI=K+I;#molecular absorption coefficient\n",
+ "umKI=(39*uK+127*uI)/166;#mass absorption coefficient\n",
+ "ulKI=umKI*density1;# linear absorption coefficient\n",
+ "print\"\\n The molecular absorption coefficient of KI in b/molecule is = \",round(uKI,3)\n",
+ "print\"\\n The mass absorption coefficient of KI in cm^2/g is = \",round(umKI,3)\n",
+ "print\"\\n The linear absorption coefficient of KI in cm^-1 is = \",round(ulKI,3)\n",
+ "#solution: (b)KIO3\n",
+ "uKIO4=(K+I+O*4);#molecule absorption coefficient\n",
+ "umKIO4=(39*uK+127*uI+64*uO)/230;#mass absorption coefficient\n",
+ "ulKIO4=umKIO4*density2;# linear absorption coefficient\n",
+ "print\"The molecular absorption coefficient of KIO4 in b/molecule is = \",round(uKIO4,3)\n",
+ "print\"The mass absorption coefficient of KIO4 in cm^2/g is = \",round(umKIO4,3)\n",
+ "print\"The linear absorption coefficient of KIO4 in cm^-1 is = \",round(ulKIO4,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.5;pg no: 147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.5, Page:147 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The thickness of copper nedded to reduce the intensity of the radiation in cm is = 1.323\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of thickness of copper nedded\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.5, Page:147 \\n \\n\"\n",
+ "#Given:\n",
+ "import math\n",
+ "i1=4000;# initial intensity of radiaton\n",
+ "i2=2000;# final intensity of radiation\n",
+ "density1=8.96;# density of copper\n",
+ "l=6.022*10**23;# avogadro constant\n",
+ "ue=0.211;# electron absorption coefficent in barn per electron\n",
+ "# 1 b=10^(-24) cm^2\n",
+ "#solution:\n",
+ "uCu=ue*29;#atomic absorbtion coefficient in b/atom\n",
+ "umCu=(6.022*10**23*uCu*10**-24)/63; # mass absorbtion coefficient in cm^2/g\n",
+ "ulCu=umCu*density1;# linear absorption coefficient in cm^-1\n",
+ "# we know that, i2=i1*exp(ulCu*x)\n",
+ "x=math.log(i1/i2)/(ulCu);# thickness of the copper plate\n",
+ "print\"\\n The thickness of copper nedded to reduce the intensity of the radiation in cm is =\",round(x,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.6;pg no: 147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#cal of biological efective dose for gamma particles\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.6, Page:147 \\n \\n\"\n",
+ "#Given:\n",
+ "# Relative biological effectiveness(RBE)\n",
+ "a7=10;# for alpha partical\n",
+ "a6=1;#for gamma radiations\n",
+ "tn=2.5;# for thermal neutrons\n",
+ "g=1;# for gamma radiation\n",
+ "rd=0.6;#radiation dose in gray\n",
+ "#Formulas\n",
+ "#1.The Rontgen equivalent mammal (REM)=RBE*rads\n",
+ "#2.The sievert is the SI unit for REM= RBE*grays\n",
+ "#3. 1 gray(Gy)=100 rads\n",
+ "#Solution:\n",
+ "# part (a) alpha particles\n",
+ "a1=a7*rd# biological efective dose in Sv\n",
+ "a2=a1*100;# biological efective dose in rem\n",
+ "print\"\\n The biological efective dose for alpha particles in Sv is = \",a1\n",
+ "print\"\\n The biological efective dose for alpha particles in rem is = \",a2\n",
+ "# part (b) thermal neutrons\n",
+ "tn1=tn*rd# biological efective dose in Sv\n",
+ "tn2=tn1*100;# biological efective dose in rem\n",
+ "print\"\\n \\n The biological efective dose for thermal neutrons in Sv is = \",tn1\n",
+ "print\"\\n The biological efective dose for thermal neutrons in rem is = \",tn2\n",
+ "# part (c) gamma particles\n",
+ "g1=a6*rd# biological efective dose in Sv\n",
+ "g2=g1*100;# biological efective dose in rem\n",
+ "print\"\\n \\n The biological efective dose for gamma particles in Sv is = \",g1\n",
+ "print\"\\n The biological efective dose for gamma particles in rem is = \",g2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.7;pg no: 148"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.7, Page:148 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The thickness of lead nedded to reduce the intensity of the radiation in cm is = 13.26\n",
+ "\n",
+ " \n",
+ " The thickness of lead nedded to reduce the intensity of the radiation in cm is = 31.38\n",
+ "\n",
+ " \n",
+ " The thickness of lead nedded to reduce the intensity of the radiation in cm is = 1.21\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of thickness of lead nedded\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.7, Page:148 \\n \\n\"\n",
+ "#Given:\n",
+ "import math\n",
+ "density1=11.35;# density of copper\n",
+ "l=6.022*10**23;# avogadro constant\n",
+ "ue=0.211;# electron absorption coefficent in barn per electron\n",
+ "# 1 b=10^(-24) cm^2\n",
+ "#solution:\n",
+ "uPb=ue*82;#atomic absorbtion coefficient in b/atom\n",
+ "umPb=(6.022*10**23*uPb*10**-24)/207.2; # mass absorbtion coefficient in cm^2/g\n",
+ "ulPb=umPb*density1;# linear absorption coefficient in cm^-1\n",
+ "# we know that, i2=i1*exp(ulCu*x)\n",
+ "# Case (i) from 0.1 Gy/min to 3.1 mGy/h\n",
+ "i1=6;# in Gy/h\n",
+ "i2=3.1*10**-3;#in Gy/h\n",
+ "x=math.log(i1/i2)/(ulPb);# thickness of the lead plate\n",
+ "print\"\\n The thickness of lead nedded to reduce the intensity of the radiation in cm is =\",round(x,2)\n",
+ "# Case (ii) from 100 Gy/min to 0.1 mGy/h\n",
+ "j1=6000;# in Gy/h\n",
+ "j2=0.1*10**-3;# in Gy/h\n",
+ "y=math.log(j1/j2)/(ulPb);# thickness of the lead plate\n",
+ "print\"\\n \\n The thickness of lead nedded to reduce the intensity of the radiation in cm is =\",round(y,2)\n",
+ "# Case (iii) half thickness\n",
+ "z=(0.693)/ulPb;# thickness of the lead plate\n",
+ "print\"\\n \\n The thickness of lead nedded to reduce the intensity of the radiation in cm is =\",round(z,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.8;pg no: 148"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.8, Page:148 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The Z/A value for Carbontetrachloride is = 0.481\n",
+ "\n",
+ " \n",
+ " The Z/A value for acetic acid is = 0.533\n",
+ "\n",
+ " \n",
+ " The Z/A value for Cyclohexane is = 0.571\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Z/A value for Carbontetrachloride,acetic acid,Cyclohexane\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.8, Page:148 \\n \\n\"\n",
+ "# To find:\n",
+ "#(a)Z/A value for Carbontetrachloride\n",
+ "#(b)Z/A value for acetic acid\n",
+ "#(c)Z/A value for Cyclohexane\n",
+ "#Formula:\n",
+ "#(Z/A) for compound = (summation of Z of all the atoms)/ molecular weight of compound\n",
+ "#solution:\n",
+ "# Part (a) CCl4\n",
+ "z1=(6.+4.*17.)/154.;# Z/A value for Carbontetrachloride\n",
+ "z2=(2.*6.+4.*1.+2.*8.)/60.;# Z/A value for acetic acid\n",
+ "z3=(6.*6.+12.*1.)/84.;# Z/A value for Cyclohexane\n",
+ "print\"\\n The Z/A value for Carbontetrachloride is = \",round(z1,3)\n",
+ "print\"\\n \\n The Z/A value for acetic acid is = \",round(z2,3)\n",
+ "print\"\\n \\n The Z/A value for Cyclohexane is = \",round(z3,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.9;pg no: 149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.9, Page:149 \n",
+ " \n",
+ "\n",
+ "The dose absorbed by sodium periodate in 3 h is = (Gy) 313.94\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of dose absorbed by sodium periodate\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.9, Page:149 \\n \\n\"\n",
+ "#Given:\n",
+ "dose1=2.15# in Gy/min\n",
+ "# Z values\n",
+ "Na=11.;\n",
+ "I=53.;\n",
+ "O=8.;\n",
+ "# A values\n",
+ "mNa=23.;\n",
+ "mI=127.;\n",
+ "mO=16.;\n",
+ "z2=0.553;#Z/A for fricke solution \n",
+ "# Solution:\n",
+ "z1=(11.+53.+8.*4.)/(127.+23.+16.*4.);# Z/A value for sodium periodate(Z/A NaIO4)\n",
+ "# Formula : D(NaIo4)*(Z/A Fricke)=D(Fricke)*(Z/A NaIO4)\n",
+ "dose2=(dose1*z1)/z2;# in Gy/min\n",
+ "# for 3 hours\n",
+ "Dose=dose2*180.;# in Gy\n",
+ "print\"The dose absorbed by sodium periodate in 3 h is = (Gy)\",round(Dose,2)\n",
+ "# Note: There is correction in the value of (Z/A NaIO4) calculated in the book. The actual value comes out to be 0.44859"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.10;pg no: 149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.10, Page:149 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The dose absorbed by sodium periodate in 6 h is = (Gy) 1282.813\n",
+ "\n",
+ " \n",
+ " The dose absorbed by sodium periodate in 6 h is = (Gy) 1170.041\n",
+ "\n",
+ " \n",
+ " The dose absorbed by sodium periodate in 6 h is = (Gy) 1113.56\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of dose absorbed by sodium periodate\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.10, Page:149 \\n \\n\"\n",
+ "#Given:\n",
+ "dose=4.06# in Gy/min\n",
+ "z=0.553;#Z/A for fricke solution \n",
+ "# Formula : D(NaIo4)*(Z/A Fricke)=D(Fricke)*(Z/A NaIO4)\n",
+ "# Solution:\n",
+ "# Part(a) Chloroform\n",
+ "z1=58./119.5;# Z/A value for Chloroform\n",
+ "dose1=dose*z1/z;\n",
+ "Dose1=dose1*360.;# for 6 hours # in Gy\n",
+ "print\"\\n The dose absorbed by sodium periodate in 6 h is = (Gy)\",round(Dose1,3)\n",
+ "# Part(b) Bromoform\n",
+ "z2=112./253.;# Z/A value for Bromoform\n",
+ "dose2=dose*z2/z;\n",
+ "Dose2=dose2*360.;# for 6 hours # in Gy\n",
+ "print\"\\n \\n The dose absorbed by sodium periodate in 6 h is = (Gy)\",round(Dose2,3)\n",
+ "# Part(c) Iodoform\n",
+ "z3=166./394.;# Z/A value for Iodoform\n",
+ "dose3=dose*z3/z;\n",
+ "Dose3=dose3*360.;# for 6 hours # in Gy\n",
+ "print\"\\n \\n The dose absorbed by sodium periodate in 6 h is = (Gy)\",round(Dose3,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.11;pg no: 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.11, Page:150 \n",
+ " \n",
+ "\n",
+ "The fraction of the energy absorbed by ethanol = 0.5145\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of fraction of the energy absorbed by ethanol\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.11, Page:150 \\n \\n\"\n",
+ "# To find:\n",
+ "#Fraction of the energy absorbed by ethanol\n",
+ "#Formula:\n",
+ "#(Z/A) for compound = (summation of Z of all the atoms)/ molecular weight of compound\n",
+ "z1=26./46.;# Z/A value for ethanl\n",
+ "z2=32./60.;# Z/A value for acetic acid\n",
+ "Deth=z1/(z1+z2);\n",
+ "# Note that the dose absorbed by each component is proportional to its Z/A in the total\n",
+ "print\"The fraction of the energy absorbed by ethanol = \",round(Deth,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 11.12;pg no: 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 11.12, Page:150 \n",
+ " \n",
+ "\n",
+ "The value of G(HCL) in the radiolysis of CHCl3 is = 1242.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of value of G(HCL) in the radiolysis of CHCl3\n",
+ "#intiation of all variables\n",
+ "# Chapter 11\n",
+ "print\"Example 11.12, Page:150 \\n \\n\"\n",
+ "#Given:\n",
+ "density1=1.48;# for chloroform\n",
+ "density2=1.024;# for fricke solution\n",
+ "mole=30*10**-6;# moles of HCl\n",
+ "l=6.023*10**23;# avogadro constant\n",
+ "e=2174;#extension coefficient\n",
+ "OD=0.5633;\n",
+ "d=1;# cell path in cm\n",
+ "# G(Fe+3)=15.5 ions/100 eV\n",
+ "# Solution:\n",
+ "#HCl produced\n",
+ "m1=mole*l;\n",
+ "conc=OD*d/e;# in moles/l\n",
+ "conc1=conc*l;# molecules in 100 min\n",
+ "#This implies amount (conc1) of molecules/l in 10 min for CHCl3 solution will be\n",
+ "conc2=conc1/10;\n",
+ "# energy that would be absorbed by frickes solution to produce conc1 amount of molecules \n",
+ "e1=conc2*100/15.5;# eV/l\n",
+ "e2=e1/100;# eV per 10 ml\n",
+ "# we know that energy absorbed is proportional to its density\n",
+ "e3=e2*density1/density2;# in eV\n",
+ "#G(HCl)\n",
+ "g=m1*100/e3;\n",
+ "print\"The value of G(HCL) in the radiolysis of CHCl3 is = \",round(g)"
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter2.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter2.ipynb
new file mode 100644
index 00000000..cd1cdc5f
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter2.ipynb
@@ -0,0 +1,1065 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# chapter2 :properties of nucleon and nuclei "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.1;pg no:19"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.1, Page:19 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The density nucleus of F(19) in 10^14 g cm^-3 is = 27.473593965\n",
+ "\n",
+ " The density nucleus of Au(197) in 10^14 g cm^-3 is = 284.857790058\n",
+ "\n",
+ " The density nucleus of P(239) in 10^14 g cm^-3 is = 345.588892507\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of density nucleus\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.1, Page:19 \\n \\n\"\n",
+ "#Given:\n",
+ "f=19;# atomic mass no. of F\n",
+ "a=197;# atomic mass no.of Au\n",
+ "p=239;# atomic mass no. of Pu\n",
+ "#solution:(a)\n",
+ "\n",
+ "m1=f/(6.02*10**23);\n",
+ "Rf=1.4*(f**(1/3))*10**-13;# in cm\n",
+ "V1=1.3333*3.14*(Rf)**3;\n",
+ "df=m1/(V1*10**14);# density in 10^14 g cm^-3\n",
+ "print\"\\n The density nucleus of F(19) in 10^14 g cm^-3 is =\",df\n",
+ "\n",
+ "#(b)\n",
+ "m2=a/(6.02*10**23);\n",
+ "Ra=1.4*(a**(1/3))*10**-13;# in cm\n",
+ "V2=1.3333*3.14*(Ra)**3;\n",
+ "da=m2/(V2*10**14);# density in 10^14 g cm^-3\n",
+ "print\"\\n The density nucleus of Au(197) in 10^14 g cm^-3 is =\",da\n",
+ "\n",
+ "\n",
+ "#(c)\n",
+ "m3=p/(6.02*10**23);\n",
+ "Rp=1.4*(p**(1/3))*10**-13;# in cm\n",
+ "V3=1.3333*3.14*(Rp)**3;\n",
+ "dp=m3/(V3*10**14);# density in 10^14 g cm^-3\n",
+ "print\"\\n The density nucleus of P(239) in 10^14 g cm^-3 is =\",dp\n",
+ "# Note: The density for Au(197) is not calculated correctly in the textbook."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.2;pg no:20"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.2, Page:20 \n",
+ " \n",
+ "\n",
+ "\n",
+ " Case (a) Fission is possible since m1= 9.99999999998e-05\n",
+ "\n",
+ " Case (b) Fission is not possible since m2= -0.10838\n",
+ "\n",
+ " Case (c) Fission is possible since m3= 0.02642\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Fission\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.2, Page:20 \\n \\n\"\n",
+ "# Given:\n",
+ "# (a) Be(8)= 2 He(4)\n",
+ "# (b) Kr(80)= 2 Ar(40)\n",
+ "# (c) Cd(108)= 2 Cr(54)\n",
+ "\n",
+ "\n",
+ "# Solution:\n",
+ "m1=8.0053-2*4.00260;\n",
+ "m2=79.81638-2*39.96238;\n",
+ "m3=107.90418-2*53.93888;\n",
+ "\n",
+ "\n",
+ "if m1>0:\n",
+ "\tprint\"\\n Case (a) Fission is possible since m1=\",m1\n",
+ "else:\n",
+ "\tprint\"\\n Case (a) Fission is not possiblesince m1=\",m1\n",
+ "\n",
+ "\n",
+ "if m2>0:\n",
+ " print\"\\n Case (b) Fission is possible since m2=\",m2\n",
+ "else:\n",
+ " print\"\\n Case (b) Fission is not possible since m2=\",m2\n",
+ "\n",
+ " \n",
+ "if m3>0:\n",
+ " print\"\\n Case (c) Fission is possible since m3=\",m3\n",
+ "else:\n",
+ "\tprint\"\\n Case (c) Fission is not possible since m3=\",m3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.3;pg no:21"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.3, Page:21 \n",
+ " \n",
+ "\n",
+ "\n",
+ " Nuclear spin of the nucleus is 2.5\n",
+ " (-) \n",
+ "\n",
+ " Magnetic moment is = in nuclear magneton 0.8621\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Nuclear spin and Magnetic moment\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.3, Page:21 \\n \\n\"\n",
+ "# Given:\n",
+ "l=3.;\n",
+ "f=3.;\n",
+ "s=1./2.;\n",
+ "\n",
+ "# Solution:\n",
+ "I=l-s;# total angulr momentum\n",
+ "P=(-1)**(l);#nuclear parity\n",
+ "mm=(I-2.293*(I/(I+1)));# in nuclear magneton\n",
+ "\n",
+ "print\"\\n Nuclear spin of the nucleus is \",I\n",
+ "if P>0:\n",
+ " print\" (+) \"\n",
+ "else:\n",
+ " print\" (-) \"\n",
+ "\n",
+ "print\"\\n Magnetic moment is = in nuclear magneton\",round(mm,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.4;pg no:21"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.4, Page:21 \n",
+ " \n",
+ "\n",
+ "\n",
+ " Nuclear spin of the nucleus is 4.5\n",
+ " (+) \n",
+ "\n",
+ " Magnetic moment is =in nuclear magneton 6.793\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Nuclear spin and Magnetic moment\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.4, Page:21 \\n \\n\"\n",
+ "# Given:\n",
+ "\n",
+ "l=4.;\n",
+ "g=4.;\n",
+ "s=1./2.;\n",
+ "\n",
+ "# Solution:\n",
+ "I=l+s;# total angulr momentum\n",
+ "P=(-1)**(l);#nuclear parity\n",
+ "mm=(I+2.293);# for odd proton and I=l+s in nuclear magneton\n",
+ "\n",
+ "print\"\\n Nuclear spin of the nucleus is\",I\n",
+ "if P>0:\n",
+ " print\" (+) \"\n",
+ "else:\n",
+ " print\" (-) \"\n",
+ "print\"\\n Magnetic moment is =in nuclear magneton\",mm"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.5;pg no:22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.5, Page:22 \n",
+ " \n",
+ "\n",
+ " The odd nucleon is 55 proton in level 2 d 5/2 (+). Hence spin is 5/2 and parity (+)\n",
+ "\n",
+ " Magnetic moment is =in nuclear magneton 4.793\n",
+ "\n",
+ " \n",
+ " The odd nucleon is 47 neutron in level 1 g 9/2 (+). Hence spin is 9/2 and parity (+)\n",
+ "Magnetic moment for neutron is m=-1.913 in nuclear magneton\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Magnetic moment\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.5, Page:22 \\n \\n\"\n",
+ "# Given:(a) Cs(55) (b) Kr(36)\n",
+ "\n",
+ "# Solution: Part(a)\n",
+ "print\" The odd nucleon is 55 proton in level 2 d 5/2 (+). Hence spin is 5/2 and parity (+)\"\n",
+ "mm=((5./2.)+2.293);\n",
+ "print\"\\n Magnetic moment is =in nuclear magneton\",mm\n",
+ "# Solution: Part(b)\n",
+ "print\"\\n \\n The odd nucleon is 47 neutron in level 1 g 9/2 (+). Hence spin is 9/2 and parity (+)\"\n",
+ "print\"Magnetic moment for neutron is m=-1.913 in nuclear magneton\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.7;pg no:22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.7, Page:22 \n",
+ " \n",
+ "\n",
+ "The nuclear g factor for P is = 2.262\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The nuclear g factor for P\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.7, Page:22 \\n \\n\"\n",
+ "# Given:\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "f=17.24*10**6;# in Hz/T\n",
+ "m=5.05*10**-27;# in J/T\n",
+ "# Solution:\n",
+ "\n",
+ "E=h*f;\n",
+ "g=E/(m)\n",
+ "print\"The nuclear g factor for P is =\",round(g,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.8;pg no:23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.8, Page:23 \n",
+ " \n",
+ "\n",
+ "The NMR frequency in MHz 10.71\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The NMR frequency\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.8, Page:23 \\n \\n\"\n",
+ "# Given:\n",
+ "\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "f=17.24*10**6;# in Hz/T\n",
+ "m=5.05*10**-27;# in J/T\n",
+ "g=1.405;\n",
+ "\n",
+ "# Solution:\n",
+ "\n",
+ "E=g*m;\n",
+ "f=E/(h*10**6);# NMR frequency\n",
+ "\n",
+ "print\"The NMR frequency in MHz\",round(f,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.9;pg no:23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.9, Page:23 \n",
+ "Magnetic field required for a proton in T= 0.711\n",
+ "Magnetic field required for C 13 in T= 2.826\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Magnetic field required\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.9, Page:23 \"\n",
+ "# Given:\n",
+ "\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "f=30.256*10**6;# in Hz/T\n",
+ "m=5.05*10**-27;# in J/T\n",
+ "g1=5.585;\n",
+ "g2=1.405;\n",
+ "\n",
+ "# Solution:\n",
+ "H1=(h*f)/(g1*m);\n",
+ "H2=(h*f)/(g2*m);\n",
+ "print\"Magnetic field required for a proton in T=\",round(H1,3)\n",
+ "print\"Magnetic field required for C 13 in T=\",round(H2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.10;pg no:23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.10, Page:23\n",
+ "Magnetic field required for a proton in T= 0.3316\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Magnetic field required\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.10, Page:23\"\n",
+ "# Given:\n",
+ "\n",
+ "h=6.62*10**-34;# in J.s\n",
+ "f=9.302*10**9;# in Hz/T\n",
+ "m=9.2741*10**-24;# in J/T\n",
+ "g1=2.0025;\n",
+ "\n",
+ "\n",
+ "# Solution:\n",
+ "\n",
+ "H1=(h*f)/(g1*m);\n",
+ "print\"Magnetic field required for a proton in T=\",round(H1,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.11;pg no:24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.11, Page:24 \n",
+ " \n",
+ "\n",
+ "The frequency needed to bring in resonance in GHz= 33.66\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of frequency needed\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.11, Page:24 \\n \\n\"\n",
+ "# Given:\n",
+ "mf=1.201;# In T\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "m=9.2741*10**-24;# in J/T\n",
+ "g=2.0025;\n",
+ "# Solution:\n",
+ "v=(g*m*mf)/(h*10**9);\n",
+ "print\"The frequency needed to bring in resonance in GHz=\",round(v,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.12;pg no:24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.12, Page:24 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The frequency needed to bring proton spin resonance is=MHz 63.86\n",
+ "\n",
+ " The frequency needed to bring electron spin resonance in GHz 4.2\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The frequency needed to bring proton and electron\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.12, Page:24 \\n \\n\"\n",
+ "# Given:\n",
+ "mf=1.5;# In T\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "mb=9.2741*10**-24;# in J/T\n",
+ "mn=5.0504*10**-27;#in J/T\n",
+ "ge=2.002;\n",
+ "gp=5.5854;\n",
+ "# Solution: Part(a)\n",
+ "v1=(gp*mn*mf)/(h*10**6);\n",
+ "print\"\\n The frequency needed to bring proton spin resonance is=MHz\",round(v1,2)\n",
+ "# Solution: Part(b)\n",
+ "v2=(ge*mb*mf)/(h*10**10);\n",
+ "print\"\\n The frequency needed to bring electron spin resonance in GHz\",round(v2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.13;pg no:24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.13, Page:24 \n",
+ " \n",
+ "\n",
+ "\n",
+ " Magnetic field required for causing resonance in T= 1.004\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Magnetic field required\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.13, Page:24 \\n \\n\"\n",
+ "# Given:\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "f=40.2*10**6;# in Hz/T\n",
+ "m=5.05*10**-27;# in J/T\n",
+ "g1=5.256;\n",
+ "\n",
+ "\n",
+ "# Solution:\n",
+ "H1=(h*f)/(g1*m);\n",
+ "print\"\\n Magnetic field required for causing resonance in T=\",round(H1,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.14;pg no:25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.14, Page: 25 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The ratio of NMR frequencies of B/N is = 1.35\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of ratio of NMR frequencies\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.14, Page: 25 \\n \\n\"\n",
+ "#Given:\n",
+ "mf=1.0;# In T\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "mn=5.0504*10**-27;#in J/T\n",
+ "gB=5.4;\n",
+ "gN=4.01;\n",
+ "# Solution:\n",
+ "v1=(gB*mn*mf)/(h*10**6);\n",
+ "\n",
+ "v2=(gN*mn*mf)/(h*10**6);\n",
+ "\n",
+ "print\"\\n The ratio of NMR frequencies of B/N is =\",round(v1/v2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.15;pg no:25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.15, Page:25 \n",
+ " \n",
+ "\n",
+ "The recoil energy in (meV)= 1.95\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of recoil energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.15, Page:25 \\n \\n\"\n",
+ "# Given:\n",
+ "E=14.4*10**-3;# in MeV\n",
+ "m=57;\n",
+ "# Solution:\n",
+ "Er=(536*(E)**2)/(m*10**-3);\n",
+ "print\"The recoil energy in (meV)=\",round(Er,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.16;pg no:25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.16, Page:25 \n",
+ " \n",
+ "\n",
+ "The energy emtted by the nucleus in (KeV)= 23.8\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy emtted by the nucleus\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.16, Page:25 \\n \\n\"\n",
+ "import math\n",
+ "# Given:\n",
+ "Er=2.551;# in meV\n",
+ "m=119;# atomic wt of Sn\n",
+ "\n",
+ "# Solution:\n",
+ "E=math.sqrt(2.551*10**-3*119/536);# energy emitted by nucleus\n",
+ "print\"The energy emtted by the nucleus in (KeV)=\",round(E*10**3,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.17;pg no:26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.17, Page:26 \n",
+ " \n",
+ "\n",
+ "The doppler shift frequency in 10^11 Hz= 3.97\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of doppler shift frequency\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.17, Page:26 \\n \\n\"\n",
+ "# Given:\n",
+ "l=10**-10;# in m\n",
+ "m=100;# in u\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "\n",
+ "\n",
+ "# Solution:\n",
+ "v=h/(m*l*1.67*10**-27);# velocity\n",
+ "f=v/l;# frequency\n",
+ "\n",
+ "print\"The doppler shift frequency in 10^11 Hz=\",round(f/10**11,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.18;pg no:26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.18, Page:26 \n",
+ " \n",
+ "\n",
+ "The frequency in 10**8 cm^-1 is = 1.161\n",
+ "The frequency in 10^12 MHz is = 3.48\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of frequency\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.18, Page:26 \\n \\n\"\n",
+ "#Given:\n",
+ "# 1 ev=8065 cm^-1\n",
+ "E=14.4*10**3;# in eV\n",
+ "# Solution:\n",
+ "f1=E*8065;# frequency in cm^-1\n",
+ "print\"The frequency in 10**8 cm^-1 is =\",round(f1/10**8,3)\n",
+ "fr=f1*3*10**8*100;\n",
+ "print\"The frequency in 10^12 MHz is =\",round(fr/10**18,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.19;pg no:26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.19, Page:26 \n",
+ " \n",
+ "\n",
+ "The shift in frequency between the source and the sample in MHz= 25.55\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of shift in frequency between the source and the sample\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.19, Page:26 \\n \\n\"\n",
+ "# Given:\n",
+ "#Given:\n",
+ "# 1 ev=8065 cm^-1\n",
+ "E=14.4*10**3;# in eV\n",
+ "v1=2.2*10**-3;# in m/s\n",
+ "# Solution:\n",
+ "f1=E*8065;# frequency in cm^-1\n",
+ "fr=f1*3*10**8*100;\n",
+ "fr1=(fr*v1)/(3*10**8);\n",
+ "print\"The shift in frequency between the source and the sample in MHz=\",round(fr1/10**6,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.20;pg no:27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.20, Page:27 \n",
+ " \n",
+ "\n",
+ "The recoil velocity of free atom is =(m/s) 84.21\n",
+ "The recoil velocity of atom that is part of crystal in 10^-20 (m/s) 7.68\n",
+ "The doppler shift for free atom in 10^10 Hz= 97.6\n",
+ "The doppler shift of atom that is part of crystal in 10^-10 Hz is = 8.9\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of recoil velocity and doppler shift for an atom\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.20, Page:27 \\n \\n\"\n",
+ "# Given:\n",
+ "E=1.6*14.4*10**3*10**-19;# energy in J\n",
+ "c=3*10**8;# in m/s\n",
+ "m=57*1.6*10**-27;\n",
+ "M=10**-4;\n",
+ "h=6.6262*10**-34;# in J.s\n",
+ "# Solution:\n",
+ "p=E/c;\n",
+ "v=p/m;\n",
+ "v1=(v*m)/(M);\n",
+ "v2=(v*m)/(M*10**-20);\n",
+ "f1=(E*v)/(h*c);\n",
+ "f2=(E*v1)/(h*c*10**-10);\n",
+ "print\"The recoil velocity of free atom is =(m/s)\",round(v,2)\n",
+ "print\"The recoil velocity of atom that is part of crystal in 10^-20 (m/s)\",round(v2,2)\n",
+ "print\"The doppler shift for free atom in 10^10 Hz=\",round(f1/10**10,2)\n",
+ "print\"The doppler shift of atom that is part of crystal in 10^-10 Hz is =\",round(f2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.21;pg no:28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.21, Page:28 \n",
+ " \n",
+ "\n",
+ "Ellipticity is = 0.17\n",
+ "b/a is = 1.185\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Ellipticity\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.21, Page:28 \\n \\n\"\n",
+ "# Given:\n",
+ "A=175.;\n",
+ "R=1.4*10**-15*((A)**(1./3.));\n",
+ "# Soluiton:\n",
+ "#Part a\n",
+ "sqrBMinusSqrA = (5.9 * (10** (-28))) * 5. /(2. * 71.);\n",
+ "BMinusA = sqrBMinusSqrA / (2. * R);\n",
+ "ellipticity = 2 * (BMinusA) / (2. * R);\n",
+ "print\"Ellipticity is =\",round(ellipticity,2)\n",
+ "#Part B\n",
+ "b = (BMinusA + (2 * R)) /2;\n",
+ "a = (-BMinusA + (2 * R)) /2;\n",
+ "print\"b/a is =\",round(b/a,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.22;pg no:28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.22, Page: \n",
+ " \n",
+ "\n",
+ "Ellipticity is = 0.2\n",
+ "b/a is = 1.222\n",
+ "Ellipticity is = -0.06\n",
+ "b/a is = 0.946\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Ellipticity\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.22, Page: \\n \\n\"\n",
+ "# Given:\n",
+ "A1=176.;\n",
+ "A2=233.;\n",
+ "R1=1.4*10**-15*((A1)**(1./3.));\n",
+ "R2=1.4*10**-15*((A2)**(1./3.));\n",
+ "# Soluiton:\n",
+ "#Part a\n",
+ "sqrBMinusSqrA = (5. * 7. * (10** (-28))) /(2. * 71.);\n",
+ "BMinusA = sqrBMinusSqrA / (2. * R1);\n",
+ "ellipticity = 2. * (BMinusA) / (2. * R1);\n",
+ "print\"Ellipticity is =\",round(ellipticity,2)\n",
+ "b = (BMinusA + (2. * R1)) /2.;\n",
+ "a = (-BMinusA + (2. * R1)) /2.;\n",
+ "print\"b/a is =\",round(b/a,3)\n",
+ "#Part B\n",
+ "sqrBMinusSqrA = -(5. * 3. * (10** (-28))) /(2. * 91.);\n",
+ "BMinusA = sqrBMinusSqrA / (2. * R2);\n",
+ "ellipticity = 2. * (BMinusA) / (2. * R2);\n",
+ "print\"Ellipticity is =\",round(ellipticity,2)\n",
+ "b = (BMinusA + (2. * R2)) /2.;\n",
+ "a = (-BMinusA + (2. * R2)) /2.;\n",
+ "print\"b/a is =\",round(b/a,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 2.23;pg no:29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 2.23, Page:29 \n",
+ " \n",
+ "\n",
+ "Quadrapole moment in barns= 0.2761\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Quadrapole moment\n",
+ "#intiation of all variables\n",
+ "# Chapter 2\n",
+ "print\"Example 2.23, Page:29 \\n \\n\"\n",
+ "# Given:\n",
+ "e = 0.03;\n",
+ "A=75.;\n",
+ "R=1.4*10**-15*((A)**(1./3.));\n",
+ "# Soluiton:\n",
+ "BPlusA = 2. * R;\n",
+ "BMinusA = e * R;\n",
+ "sqrBMinusSqrA = BPlusA * BMinusA;\n",
+ "BMinusA = sqrBMinusSqrA / (2. * R);\n",
+ "Q = (2.*33.*sqrBMinusSqrA)/5.;\n",
+ "q1=Q/10**-28;\n",
+ "print\"Quadrapole moment in barns=\",round(q1,4)"
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter3.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter3.ipynb
new file mode 100644
index 00000000..761cfb0c
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter3.ipynb
@@ -0,0 +1,787 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#chapter 3:nuclear models"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.1;pg no:38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.1, Page:38 \n",
+ " \n",
+ "\n",
+ "The coulomb barrier for the penetration of Th by proton in MeV= 12.96\n",
+ "The coulomb barrier for the penetration of Th by alpha particle in MeV= 23.94\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of coulomb barrier for the penetration of Th by alpha particle and proton\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.1, Page:38 \\n \\n\"\n",
+ "#Given in cgs units\n",
+ "m1=232.;\n",
+ "m2=1.;\n",
+ "m3=4.;\n",
+ "z1=90.;\n",
+ "z2=1.;\n",
+ "z3=2.;\n",
+ "e=4.8*10**-10;# in ergs\n",
+ "c=1.4;# nuclear radius constant\n",
+ "\n",
+ "#Formula: E=(z1*z2*e^2)/(r1+r2)\n",
+ "r1=(m1)**(1./3.);\n",
+ "r2=(m2)**(1./3.);\n",
+ "r3=(m3)**(1./3.);\n",
+ "E1=(z1*z2*e*e)/(c*(r1+r2)*10**-13*(1.6*10**-6));\n",
+ "print\"The coulomb barrier for the penetration of Th by proton in MeV=\",round(E1,2)\n",
+ "E2=(z1*z3*e*e)/(c*(r1+r3)*10**-13*(1.6*10**-6));\n",
+ "print\"The coulomb barrier for the penetration of Th by alpha particle in MeV=\",round(E2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.2;pg no:38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.2, Page38 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The coulomb barrier for the penetration of Th by proton in MeV= 8.84\n",
+ "\n",
+ " \n",
+ " The coulomb barrier for the penetration of Th by alpha particle in MeV= 10.96\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of coulomb barrier for the penetration of Th by alpha particle and proton\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.2, Page38 \\n \\n\"\n",
+ "#Given in cgs units\n",
+ "m1=112;\n",
+ "m2=1;\n",
+ "m3=4;\n",
+ "m4=66;\n",
+ "z1=50;\n",
+ "z2=1;\n",
+ "z3=2;\n",
+ "z4=30;\n",
+ "e=4.8*10**-10;# in ergs\n",
+ "c=1.4;# nuclear radius constant\n",
+ "\n",
+ "#Formula: E=(z1*z2*e^2)/(r1+r2)\n",
+ "r1=(m1)**(1./3.);\n",
+ "r2=(m2)**(1./3.);\n",
+ "r3=(m3)**(1./3.);\n",
+ "r4=(m4)**(1./3.);\n",
+ "E1=(z1*z2*e*e)/(c*(r1+r2)*10**-13*(1.6*10**-6));\n",
+ "print\"\\n The coulomb barrier for the penetration of Th by proton in MeV=\",round(E1,2)\n",
+ "E2=(z4*z3*e*e)/(c*(r4+r3)*10**-13*(1.6*10**-6));\n",
+ "print\"\\n \\n The coulomb barrier for the penetration of Th by alpha particle in MeV=\",round(E2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.3;pg no:39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.3, Page:39 \n",
+ " \n",
+ "\n",
+ "The closest distance of approach in fm= 37.9\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of closest distance of approach\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.3, Page:39 \\n \\n\"\n",
+ "# Given:\n",
+ "E=6;# in MeV\n",
+ "z1=79;\n",
+ "z2=2;\n",
+ "q=4.8*10**-10;\n",
+ "# Solution:\n",
+ "\n",
+ "# At the closest distance of approach, the kineic energy of the alpha particle balances the columb barrier energy.\n",
+ "\n",
+ "r1=(z1*z2*q*q)/(E*1.6*10**-6);# distance in cm\n",
+ "r=r1*10**13;# distance in fm\n",
+ "\n",
+ "print\"The closest distance of approach in fm=\",round(r,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.4;pg no:39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.4, Page:39 \n",
+ " \n",
+ "\n",
+ "The stable nuclied of the isobaric series is Hf atomic no. = 72.6\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of stable nuclied of the isobaric series\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.4, Page:39 \\n \\n\"\n",
+ "# Given:\n",
+ "A=180.;\n",
+ "# Solution:\n",
+ "z=(40.*A)/(0.6*(A**(2./3.))+80.);\n",
+ "print\"The stable nuclied of the isobaric series is Hf atomic no. =\",round(z,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.5;pg no:39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.5, Page:39 \n",
+ " \n",
+ "\n",
+ "The stable nuclied of the isobaric series is Sr atomic no. = 38.0\n",
+ "\n",
+ " Hence the nuclides of z<38 fall on the left of the limb of B vs Z parabola while the nuclides of z>38 fall on the right limb of the parabola.\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of stable nuclied of the isobaric series is Sr atomic no\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.5, Page:39 \\n \\n\"\n",
+ "# Given:\n",
+ "A=87.;\n",
+ "\n",
+ "# Solution:\n",
+ "z=(40.*A)/(0.6*(A**(2./3.))+80.);\n",
+ "print\"The stable nuclied of the isobaric series is Sr atomic no. =\",round(z)\n",
+ "# nereast integer is 38\n",
+ "print\"\\n Hence the nuclides of z<38 fall on the left of the limb of B vs Z parabola while the nuclides of z>38 fall on the right limb of the parabola.\"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.7;pg no:40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.7, Page:40 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The binding energy for the last proton in 12C in (MeV)= 15.92\n",
+ "\n",
+ " The binding energy for the last neutron in 12C in (MeV)= 9.43\n",
+ "\n",
+ " The binding energy for the last proton in 28Si in (MeV)= 11.55\n",
+ "\n",
+ " The binding energy for the last neutron in 28Si in (MeV)= 17.2\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of binding energy for the last proton,neutron\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.7, Page:40 \\n \\n\"\n",
+ "# Given:\n",
+ "B=11.009305;\n",
+ "C1=12;\n",
+ "C2=11.001433;\n",
+ "p=1.0078;\n",
+ "n=1.0087;\n",
+ "Al=26.981535;\n",
+ "Si1=27.976927;\n",
+ "Si2=26.986705;\n",
+ "# Solution:\n",
+ "m1=(B+p-C1);#(a)\n",
+ "E1=m1*931;# of last proton in C in MeV\n",
+ "print\"\\n The binding energy for the last proton in 12C in (MeV)=\",round(E1,2)\n",
+ "\n",
+ "m2=(C2+n-C1);#(b)\n",
+ "E2=m2*931;# of last neutron in C in MeV\n",
+ "print\"\\n The binding energy for the last neutron in 12C in (MeV)=\",round(E2,2)\n",
+ "\n",
+ "m3=(Al+p-Si1);#(c)\n",
+ "E3=m3*931;# of last proton in Si in MeV\n",
+ "print\"\\n The binding energy for the last proton in 28Si in (MeV)=\",round(E3,2)\n",
+ "\n",
+ "m4=(Si2+n-Si1);#(d)\n",
+ "E4=m4*931;# of last neutron in Si in MeV\n",
+ "print\"\\n The binding energy for the last neutron in 28Si in (MeV)=\",round(E4,2)\n",
+ "\n",
+ "# Note: There is a calculation error in the textbook for the (b) part."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.8;pg no:41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.8, Page: 41 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The binding energy for N(14) in (MeV)= 10.27\n",
+ "\n",
+ " The binding energy for O(16) in (MeV)= 7.16\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of binding energy for N,O\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.8, Page: 41 \\n \\n\"\n",
+ "# Given:\n",
+ "d=2.014102;\n",
+ "C=12;\n",
+ "a=4.002603;\n",
+ "N=14.003074;\n",
+ "O=15.994915;\n",
+ "\n",
+ "# Solution:\n",
+ "m1=(C+d-N);\n",
+ "E1=m1*931;# The binding energy for N(14)\n",
+ "print\"\\n The binding energy for N(14) in (MeV)=\",round(E1,2)\n",
+ "\n",
+ "m2=(C+a-O);\n",
+ "E2=m2*931;#The binding energy for O(16) \n",
+ "print\"\\n The binding energy for O(16) in (MeV)=\",round(E2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.9;pg no:41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.9, Page:41 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The binding energy in (MeV)= 18.95\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of binding energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.9, Page:41 \\n \\n\"\n",
+ "# Given:\n",
+ "D=-1.997042;\n",
+ "n=1.0087;\n",
+ "# Solution:\n",
+ "m=(D+2.*n);\n",
+ "E=m*931.;\n",
+ "print\"\\n The binding energy in (MeV)=\",round(E,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.10;pg no:41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.10, Page:41 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The neutron seperation energy in (MeV)= 7.3596\n",
+ "\n",
+ " The proton seperation energy in (MeV)= 7.9647\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of seperation energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.10, Page:41 \\n \\n\"\n",
+ "# Given:\n",
+ "mH=1.007825;\n",
+ "mn=1.008665;\n",
+ "M1=207.97666;# mass of Pb 208\n",
+ "M2=206.97590;# mass of Pb 207\n",
+ "M3=206.97739;# mass of Tl 207\n",
+ "\n",
+ "# Solution:\n",
+ "\n",
+ "B1=((82*1.007825+126*1.008665)-207.97666)*931;# binding energy for Pb 208\n",
+ "B2=((82*1.007825+125*1.008665)-206.97590)*931;# binding energy for Pb 207\n",
+ "B3=((81*1.007825+126*1.008665)-206.97739)*931;# binding energy for Tl 207\n",
+ "Sn=B1-B2;# neutron seperation energy\n",
+ "Sp=B1-B3;# proton seperation energy\n",
+ "\n",
+ "print\"\\n The neutron seperation energy in (MeV)=\",round(Sn,4)\n",
+ "print\"\\n The proton seperation energy in (MeV)=\",round(Sp,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.11;pg no:42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.11, Page:42 \n",
+ " \n",
+ "\n",
+ " The neutron seperation energy in (MeV)= 12.41\n",
+ " The proton seperation energy in (MeV)= 8.79\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of seperation energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.11, Page:42 \\n \\n\"\n",
+ "# Given:\n",
+ "mH=1.007825;\n",
+ "mn=1.008665;\n",
+ "M1=22.98977;# mass of Na 23\n",
+ "M2=21.994435;# mass of Na 22\n",
+ "M3=21.991385;# mass of Ne 22\n",
+ "# Solution:\n",
+ "\n",
+ "m1=((11.*1.007825+12.*1.008665)-M1);\n",
+ "m2=((11.*1.007825+11.*1.008665)-M2);\n",
+ "m3=((10.*1.007825+12.*1.008665)-M3);\n",
+ "Sn=(m1-m2)*931.;# neutron seperation energy\n",
+ "Sp=(m1-m3)*931.;# proton seperation energy\n",
+ "\n",
+ "print\" The neutron seperation energy in (MeV)=\",round(Sn,2)\n",
+ "print\" The proton seperation energy in (MeV)=\",round(Sp,2)\n",
+ "\n",
+ "# Note: The answers are given in the form of atomic mass units where as in the question its asked for energies."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.12;pg no:43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.12, Page:43 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The excited level density in (MeV)= 894.29\n",
+ "\n",
+ " The level spacing in (keV)= 1.12\n",
+ "\n",
+ " The nuclear temperature in (MeV)= 2.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of excited level density,level spacing and nuclear temperature\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.12, Page:43 \\n \\n\"\n",
+ "# Given:\n",
+ "C=0.3;# in MeV^-1\n",
+ "a=2.0;# in MeV\n",
+ "E=8; # in MeV\n",
+ "import math\n",
+ "# Solution:\n",
+ "d=C*(math.exp(2*((2*8)**(0.5))));# excited level density\n",
+ "s=(1/d)*1000;# level spacing\n",
+ "nT=(E/a)**(0.5);# nuclear temperature\n",
+ "print\"\\n The excited level density in (MeV)=\",round(d,2)\n",
+ "print\"\\n The level spacing in (keV)=\",round(s,2)\n",
+ "print\"\\n The nuclear temperature in (MeV)=\",round(nT,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.13;pg no:43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.13, Page:43 \n",
+ " \n",
+ "\n",
+ "The expression for 1st, 2nd, and 3rd excited states are K times respectively. 5.0 12.0 21.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of expression for 1st, 2nd, and 3rd excited states\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.13, Page:43 \\n \\n\"\n",
+ "# Given:\n",
+ "I0=3./2.;# ground state of spin\n",
+ "\n",
+ "# Solution:\n",
+ "I1=I0+1.;\n",
+ "I2=I0+2.;\n",
+ "I3=I0+3.;\n",
+ "K=1.;# Assumed as some constant\n",
+ "# Formula: E=(h^2/(2*I))*((I*(I+1))-I0*(I0+1))\n",
+ "# Consider K=(h^2/(2*I))=1\n",
+ "\n",
+ "E1=K*((I1*(I1+1.))-(I0*(I0+1.)));# For 1 excited state\n",
+ "\n",
+ "E2=K*((I2*(I2+1.))-(I0*(I0+1.)));# For 2 excited state\n",
+ "\n",
+ "E3=K*((I3*(I3+1.))-(I0*(I0+1.)));# For 3 excited state\n",
+ "\n",
+ "print\"The expression for 1st, 2nd, and 3rd excited states are K times respectively.\",E1,E2,E3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.14;pg no:44"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.14, Page:44 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The energy of state 4 (+) in (keV)= 146.67\n",
+ "\n",
+ " The energy of state 6 (+) in (keV)= 308.0\n",
+ "\n",
+ " The energy of state 8 (+) in (keV)= 528.0\n",
+ "\n",
+ " The energy of state 10 (+) in (keV)= 806.67\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy of state 4,6,8,10\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.14, Page:44 \\n \\n\"\n",
+ "# Given:\n",
+ "E2=44;# in keV\n",
+ "\n",
+ "# Solution:\n",
+ "E4=E2*((4.*5.)/(2.*3.));# for part (a)\n",
+ "E6=E2*((6.*7.)/(2.*3.));# for part (b)\n",
+ "E8=E2*((8.*9.)/(2.*3.));# for part (c)\n",
+ "E10=E2*((10.*11.)/(2.*3.));# for part (d)\n",
+ "\n",
+ "print\"\\n The energy of state 4 (+) in (keV)=\",round(E4,2)\n",
+ "print\"\\n The energy of state 6 (+) in (keV)=\",round(E6,2)\n",
+ "print\"\\n The energy of state 8 (+) in (keV)=\",round(E8,2)\n",
+ "print\"\\n The energy of state 10 (+) in (keV)=\",round(E10,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.15;pg no:44"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.15, Page:44 \n",
+ " \n",
+ "\n",
+ "n= 11\n",
+ "\n",
+ " For the required level of energy 525 keV nearest even integer is = & spin is (+) 12.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.15, Page:44 \\n \\n\"\n",
+ "# Given:\n",
+ "E2=44;# in keV\n",
+ "En=525;# in keV\n",
+ "\n",
+ "# Solution:\n",
+ "n=(En)/E2;\n",
+ "# \n",
+ "print\"n=\",n\n",
+ "print\"\\n For the required level of energy 525 keV nearest even integer is = & spin is (+)\",round(n+1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 3.16;pg no:45"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 3.16, Page:45 \n",
+ " \n",
+ "\n",
+ "n1= 3.31818181818\n",
+ "\n",
+ " For the required level of energy 146 keV nearest even integer is =& spin is (+) 4.32\n",
+ "\n",
+ " \n",
+ " n2= 6.90909090909\n",
+ "\n",
+ " For the required level of energy 304 keV nearest even integer is =& spin is (+) 6.91\n",
+ "\n",
+ " \n",
+ " n3= 11.6818181818\n",
+ "\n",
+ " For the required level of energy 514 keV nearest even integer is =& spin is (+) 12.68\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 3\n",
+ "print\"Example 3.16, Page:45 \\n \\n\"\n",
+ "# Given:\n",
+ "E2=44.;# in keV\n",
+ "En1=146.;# in keV\n",
+ "En2=304.;# in keV\n",
+ "En3=514.;# in keV\n",
+ "# Solution:\n",
+ "n1=(En1)/E2;\n",
+ "n2=(En2)/E2;\n",
+ "n3=(En3)/E2;\n",
+ "print\"n1=\",n1\n",
+ "print\"\\n For the required level of energy 146 keV nearest even integer is =& spin is (+)\",round(n1+1.,2)\n",
+ "print\"\\n \\n n2=\",n2\n",
+ "print\"\\n For the required level of energy 304 keV nearest even integer is =& spin is (+)\",round(n2,2)\n",
+ "print\"\\n \\n n3=\",n3\n",
+ "print\"\\n For the required level of energy 514 keV nearest even integer is =& spin is (+)\",round(n3+1.,2)\n",
+ "\n",
+ "#Note: In the last part (c) the answer given in the textbook is 8(+). But the correct answer is 12(+)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter4.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter4.ipynb
new file mode 100644
index 00000000..3f17707e
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter4.ipynb
@@ -0,0 +1,1632 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# chapter 4:radio activity"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.1;pg no:55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.1, Page:55 \n",
+ " \n",
+ "\n",
+ "The value of avagadro constant in 10^23 atoms per mole= 6.05\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of value of avagadro constant\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.1, Page:55 \\n \\n\"\n",
+ "#Given:\n",
+ "t1=1600;# in year\n",
+ "a=11.6*10**17;# atoms\n",
+ "# Solution:\n",
+ "k=0.693/t1;# year^-1\n",
+ "L=(a*226)/k;# atomic mass of Radon is 226\n",
+ "print\"The value of avagadro constant in 10^23 atoms per mole=\",round(L/10**23,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.2;pg no:55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.2, Page:55 \n",
+ " \n",
+ "\n",
+ "The specific activity in dis min^-1 g^-1= 1813.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of specific activity\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.2, Page:55 \\n \\n\"\n",
+ "# Given:\n",
+ "t1=1.3*10**9;# in years\n",
+ "w=0.0119;# wt %\n",
+ "\n",
+ "# Solution:\n",
+ "N=(w*6.022*10**23)/(40*100);\n",
+ "k=(0.693*60)/(t1*3.16*10**7);\n",
+ "sa=N*k;# specific activity\n",
+ "print\"The specific activity in dis min^-1 g^-1=\",round(sa)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.3;pg no:55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.3, Page:55 \n",
+ " \n",
+ "\n",
+ " The no. of atoms of Na(24) are = 2.88311688312e+12\n",
+ " The mass of Na(24) is * 10^-10 g 1.15\n",
+ "The no. of atoms of P(32) are = 6.59657142857e+13\n",
+ "The mass of P(32) is * 10^-9 g 3.51\n",
+ "The no. of atoms of Ra(226) are = 2.69945165945e+18\n",
+ "The mass of Ra(226) is * 10^-3 g 1.01\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of no. of atoms,mass of Na,P,Ra \n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.3, Page:55 \\n \\n\"\n",
+ "# Given:\n",
+ "L=6.022*10**23;\n",
+ "# Solution:\n",
+ "# 1 mCi= 3.7*10^7 dis/s\n",
+ "k1=0.693/(15*3600);\n",
+ "N1=3.7*10**7/k1;\n",
+ "m1=(24*N1*10**10)/L;\n",
+ "print\" The no. of atoms of Na(24) are =\",round(N1,2)\n",
+ "print\" The mass of Na(24) is * 10^-10 g\",round(m1,2)\n",
+ "k2=0.693/(14.3*24*3600);\n",
+ "N2=3.7*10**7/k2;\n",
+ "m2=(32*N2*10**9)/L;\n",
+ "print\"The no. of atoms of P(32) are =\",round(N2,2)\n",
+ "print\"The mass of P(32) is * 10^-9 g\",round(m2,2)\n",
+ "k3=0.693/(1600*3.16*10**7);\n",
+ "N3=3.7*10**7/k3;\n",
+ "m3=(226*N3*10**3)/L;\n",
+ "print\"The no. of atoms of Ra(226) are =\",round(N3,2)\n",
+ "print\"The mass of Ra(226) is * 10^-3 g\",round(m3,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.4;pg no:56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.4, Page:56 \n",
+ " \n",
+ "\n",
+ "The activity in Ci/cm^3 = 2.59\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of activity\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.4, Page:56 \\n \\n\"\n",
+ "# Given:\n",
+ "t1=12.3;# in yrs\n",
+ "L=6.022*10**23;\n",
+ "# Solution:\n",
+ "k=.693/(t1*3.16*10**7);# in s^-1\n",
+ "A=(2*L)/(2.24*10**4);# no. of atoms\n",
+ "a1=A*k;# dis per s\n",
+ "a=a1/(3.7*10**10);# activity in Ci/cm^3\n",
+ "print\"The activity in Ci/cm^3 =\",round(a,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.5;pg no:56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.5, Page:56 \n",
+ " \n",
+ "\n",
+ "The ratio of C14/C12 in atmosphere in 10^-12 is = 1.4\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of ratio of C14/C12 in atmosphere\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.5, Page:56 \\n \\n\"\n",
+ "# Given:\n",
+ "t=5736;# in years\n",
+ "Nk=16.1;# dis/min\n",
+ "L=6.022*10**23;\n",
+ "# Solution:\n",
+ "k=(0.693*60)/(t*3.16*10**7);\n",
+ "N1=Nk/k;# atoms per g for C14\n",
+ "N2=L/12;#\n",
+ "r=(N1*10**12)/N2;# ratio of C14/C12 in atmosphere\n",
+ "print\"The ratio of C14/C12 in atmosphere in 10^-12 is =\",round(r,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.7;pg no:57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.7, Page:57 \n",
+ " \n",
+ "\n",
+ "Number of alpha decays = and number of beta decays = 8 6\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Number of alpha decays and number of beta decays\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.7, Page:57 \\n \\n\"\n",
+ "# Given:\n",
+ "dA = 206-238;\n",
+ "dA_Beta=0;\n",
+ "dA_Alpha = -4;\n",
+ "\n",
+ "dZ_Alpha = -2;\n",
+ "dZ_Beta = 1;\n",
+ "nBeta=0; #random initialisation\n",
+ "dZ = 82 -92;\n",
+ "# Solution:\n",
+ "nAlpha = (dA- (dA_Beta* nBeta))/dA_Alpha;\n",
+ "\n",
+ "nBeta = (dZ- (dZ_Alpha * nAlpha))/dZ_Beta;\n",
+ "\n",
+ "print\"Number of alpha decays = and number of beta decays = \",nAlpha,nBeta"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.8;pg no:57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.8, Page:57 \n",
+ " \n",
+ "\n",
+ "\n",
+ " For first photon, dE1= MeV, dI1=, since EL/ML1= & (L+PI+PF) is odd, M3 0.059 -3 5\n",
+ "\n",
+ " For second photon, dE2= MeV, dI2=,since EL/ML2= & (L+PI+PF) is even, E2 1.17 2 4\n",
+ "\n",
+ " For third photon, dE3= MeV, d3I=, since EL/ML3= & (L+PI+PF) is even, E2 1.33 2 4\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.8, Page:57 \\n \\n\"\n",
+ "# Given:\n",
+ "E1=0.059;\n",
+ "E2=2.5;\n",
+ "E3=1.33;\n",
+ "Ei=0;\n",
+ "Ef=0;\n",
+ "\n",
+ "# Solution:\n",
+ "# delta E for 1,2 & 3 photon \n",
+ "dE1=E1-Ei;\n",
+ "dE2=E2-E3;\n",
+ "dE3=E3-Ef;\n",
+ "# delta I for 1,2 & 3 photon \n",
+ "dI1=2-5;\n",
+ "dI2=4-2;\n",
+ "dI3=2-0;\n",
+ "# EL/ML for 1,2 & 3 photon \n",
+ "ELML1=3+1+1;\n",
+ "ELML2=2+1+1;\n",
+ "ELML3=2+1+1;\n",
+ "print\"\\n For first photon, dE1= MeV, dI1=, since EL/ML1= & (L+PI+PF) is odd, M3\",dE1,dI1,ELML1\n",
+ "print\"\\n For second photon, dE2= MeV, dI2=,since EL/ML2= & (L+PI+PF) is even, E2\",dE2,dI2,ELML2\n",
+ "print\"\\n For third photon, dE3= MeV, d3I=, since EL/ML3= & (L+PI+PF) is even, E2\",dE3,dI3,ELML3"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.9;pg no:58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.9, Page:58 \n",
+ " \n",
+ "\n",
+ "The energy that would be released for 0.1 mole of Co will be =(GJ) 24.08\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.9, Page:58 \\n \\n\"\n",
+ "# Given:\n",
+ "E=2.5; # in MeV\n",
+ "# Solution:\n",
+ "# 1 Mev/atom=96.32GJ/mole\n",
+ "E1=E*96.32# GJ/mole\n",
+ "E2=0.1*E1;# for 0.1 mole\n",
+ "print\"The energy that would be released for 0.1 mole of Co will be =(GJ)\",E2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.10;pg no:58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.10, Page: \n",
+ " \n",
+ "\n",
+ "The total energy dissipate per hour is = (KJ) 360.860029304\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of total energy dissipated\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.10, Page: \\n \\n\"\n",
+ "# Given\n",
+ "E=2.5;# in MeV\n",
+ "# Solution:\n",
+ "k=0.693/(5.27*3.16*10**7);# decay constant\n",
+ "A=k*0.1*6.022*10**23;# atoms/s\n",
+ "A1=3.6*10**3*A;# atoms /hr\n",
+ "\n",
+ "E1=A1*E*1.6*10**-13*10**-3;#Energy in KJ/hr\n",
+ "\n",
+ "print\"The total energy dissipate per hour is = (KJ)\",E1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.11;pg no:59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.11, Page:59 \n",
+ " \n",
+ "\n",
+ "The net mass loss is = u 0.0044\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of net mass loss\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.11, Page:59 \\n \\n\"\n",
+ "# Given:\n",
+ "Ma=4.;#mass of alpha particle\n",
+ "Mr=228.;# mass of Th\n",
+ "Ea=4.; #in MeV\n",
+ "\n",
+ "\n",
+ "# Solution:\n",
+ "Er=(Ma/Mr)*Ea;# energy of recoil\n",
+ "Et=Ea+Er;# total energy of transition\n",
+ "\n",
+ "dM=Et/931.;# net mass loss in u\n",
+ "\n",
+ "print\"The net mass loss is = u\",round(dM,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.12;pg no:59"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.12, Page:59 \n",
+ " \n",
+ "\n",
+ "For Ra emitting alpha\n",
+ "\tEnergy of recoil is (MeV) 0.0876\n",
+ "\tTotal transition energy is (MeV) 4.9506\n",
+ "For Bi emitting alpha\n",
+ "\tEnergy of recoil is (MeV) 0.117\n",
+ "\tTotal transition energy is (MeV) 6.199\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of value of avagadro constant\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.12, Page:59 \\n \\n\"\n",
+ "# Given:\n",
+ "Ma=4.;#mass of alpha particle\n",
+ "Mr1=222.;# mass of \n",
+ "Mr2=208.;\n",
+ "Ea1=4.863;\n",
+ "Ea2=6.082;\n",
+ "# Solution:\n",
+ "\n",
+ "Er1=(Ma/Mr1)*Ea1;\n",
+ "Et1=Ea1+Er1;\n",
+ "print\"For Ra emitting alpha\"\n",
+ "print\"\\tEnergy of recoil is (MeV)\",round(Er1,4)\n",
+ "print\"\\tTotal transition energy is (MeV)\",round(Et1,4)\n",
+ "Er2=(Ma/Mr2)*Ea2;\n",
+ "Et2=Ea2+Er2;\n",
+ "print\"For Bi emitting alpha\"\n",
+ "print\"\\tEnergy of recoil is (MeV)\",round(Er2,4)\n",
+ "print\"\\tTotal transition energy is (MeV)\",round(Et2,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.13;pg no:60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.13, Page:60 \n",
+ " \n",
+ "\n",
+ "The Kinetic Energy and velocity are MeV and 10^5 m/s respectively 0.0966 2.79\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Kinetic Energy and velocity\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.13, Page:60 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "dm=0.006332;# in u\n",
+ "ma=4.;\n",
+ "mCm=244.;\n",
+ "\n",
+ "# Solution:\n",
+ "\n",
+ "E=dm*931.;# in MeV\n",
+ "KE=E*(ma/mCm); # in MeV\n",
+ "v=math.sqrt((2.*KE*1.6*10.**-13.)/(240.*1.6605*10.**-27.));\n",
+ "print\"The Kinetic Energy and velocity are MeV and 10^5 m/s respectively\",round(KE,4),round(v/10**5,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.14;pg no:60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.14, Page:60 \n",
+ " \n",
+ "\n",
+ "The range in Al for beta radiation is mg/cm^2 using Katz and Penfold empirical equation and mg/cm^2 using feathers relation. 784.8 795.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of rate of energy emission and Penfold empirical equation\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.14, Page:60 \\n \\n\"\n",
+ "import math\n",
+ "# Given:\n",
+ "E0=1.7;# in MeV\n",
+ "# Solution:\n",
+ "# For E0<2.5 MeV; using Katz and Penfold empirical equation we have\n",
+ "R1=412*((E0)**(1.265-0.0954*math.log(E0)));# mg/cm^2\n",
+ "# Using feather's relation we have\n",
+ "R2=530*E0-106;# mg/cm^2\n",
+ "\n",
+ "print\"The range in Al for beta radiation is mg/cm^2 using Katz and Penfold empirical equation and mg/cm^2 using feathers relation.\",round(R1,1),round(R2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.15;pg no:60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.15, Page:61 \n",
+ " \n",
+ "\n",
+ "The order for Case 1 is and emission is type M2,Case 2 is and emission is type E2,Case 3 is and emission is type E1,Case 4 is not possible. 2.0 3 2 4 1.0 2\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of emissions \n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.15, Page:61 \\n \\n\"\n",
+ "# Solution:\n",
+ "L1=(5.5-3.5);# Case 1\n",
+ "L2=2-0;# Case 2\n",
+ "L3=1.5-.5;# Case 3\n",
+ "ELML1=1+0+2;\n",
+ "ELML2=1+1+2;\n",
+ "ELML3=0+1+1;\n",
+ "print\"The order for Case 1 is and emission is type M2,Case 2 is and emission is type E2,Case 3 is and emission is type E1,Case 4 is not possible.\",L1,ELML1,L2,ELML2,L3,ELML3\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.16;pg no:61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "#cal of rate of energy emission\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.16, Page:61 \\n \\n\"\n",
+ "# Given:\n",
+ "m=4*10**-3;# in gms\n",
+ "M=210;\n",
+ "E=0.34;# in MeV\n",
+ "# Solution:\n",
+ "\n",
+ "N=(m*6.022*10**23)/M;\n",
+ "k=0.693/(5*24*3600);# in s^-1\n",
+ "A=N*k;# in dis/s\n",
+ "# Energy released at 0.34 MeV per dis/s will be\n",
+ "E1=E*A;# in MeV/s\n",
+ "E2=E1*1.6*10**-13;# watts\n",
+ "\n",
+ "print\"The rate of energy emission is W\",round(E2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.17;pg no:61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.17, Page:61 \n",
+ " \n",
+ "\n",
+ "The strength in KCi is 6.77\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of strength in KCi\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.17, Page:61 \\n \\n\"\n",
+ "# Given:\n",
+ "A=0.2506*10**15;# atoms/s re: Ex4_10\n",
+ "# Solution:\n",
+ "Strength=A/(3.7*10**10);# in kCi\n",
+ "S1=Strength*10**-3;# in KCi\n",
+ "print\"The strength in KCi is \",round(S1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example4.18;pg no:62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.18, Page:62 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The 1st half life, 2nd half life, 3rd half life are respectively. 9.0 4.5 2.25\n",
+ "\n",
+ " The 1st half life, 2nd half life, 3rd half life are respectively. 13 6 3\n",
+ "\n",
+ " The 1st half life, 2nd half life, 3rd half life are respectively. 500 250 125\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of half life periods\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.18, Page:62 \\n \\n\"\n",
+ "# Given:\n",
+ "N1=10^24;# atoms\n",
+ "N2=10^16;# atoms\n",
+ "N3=1000;# atoms\n",
+ "N4=80;# atoms\n",
+ "\n",
+ "# Solution:\n",
+ "N11=N1*0.5;# 1st half life\n",
+ "N12=N11/2;# 2nd half life\n",
+ "N13=N12/2;# 3rd half life\n",
+ "print\"\\n The 1st half life, 2nd half life, 3rd half life are respectively.\",N11,N12,N13\n",
+ "N21=N2/2;# 1st half life\n",
+ "N22=N21/2;# 2nd half life\n",
+ "N23=N22/2;# 3rd half life\n",
+ "print\"\\n The 1st half life, 2nd half life, 3rd half life are respectively.\",N21,N22,N23\n",
+ "N31=N3/2;# 1st half life\n",
+ "N32=N31/2;# 2nd half life\n",
+ "N33=N32/2;# 3rd half life\n",
+ "print\"\\n The 1st half life, 2nd half life, 3rd half life are respectively.\",N31,N32,N33\n",
+ "#Radiactivity is a statistical property. Decay kinetics are reliable only when initial number is large"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.20;pg no:62"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.20, Page:62 \n",
+ " \n",
+ "\n",
+ "The partial half life for beta decay in Gy and partial half life for EC decay in Gy. 1.441 11.429\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of partial half life for beta and EC decay\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.20, Page:62 \\n \\n\"\n",
+ "# Given:\n",
+ "t1=1.28*10**9;# in years\n",
+ "# Solution:\n",
+ "k=0.693/(1.28*10**9);\n",
+ "# beta deay is 88.8%\n",
+ "k1=0.888*k;\n",
+ "# EC decay is 11.2%\n",
+ "k2=0.112*k;\n",
+ "tbeta=(0.693*10**-9)/(k1);# partial half life for beta decay in Gy\n",
+ "tEC=(0.693*10**-9)/(k2);# partial half life for EC decay in Gy\n",
+ "print\"The partial half life for beta decay in Gy and partial half life for EC decay in Gy.\",round(tbeta,3),round(tEC,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.21;pg no:63"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.21, Page:63 \n",
+ " \n",
+ "\n",
+ "The time required will be h 150.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of time\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.21, Page:63 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "t=15.02;# in hours\n",
+ "# Solution:\n",
+ "ar=1000;# activity ratio given that 0.1% of intial activity\n",
+ "k=0.693/t;\n",
+ "t1=(math.log(ar))/k;\n",
+ "print\"The time required will be h\",round(t1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.22;pg no:63"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.22, Page:63 \n",
+ " \n",
+ "\n",
+ "The time required will be h 26.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of time required\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.22, Page:63 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "t=6.01;# in hours\n",
+ "# Solution:\n",
+ "ar=100/5;# activity ratio given that 5% of intial activity\n",
+ "k=0.693/t;\n",
+ "\n",
+ "t1=(math.log(ar))/k;\n",
+ "print\"The time required will be h\",round(t1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.23;pg no:64"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.23, Page:64 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The overall decay constant will be *10^-17 s^-1 1.2\n",
+ "\n",
+ " The activity for k(40) in 10^5 beta/s 1.804\n",
+ "\n",
+ " The activity for k(41) in beta/s 21.12\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of activity for k\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.23, Page:64 \\n \\n\"\n",
+ "# Given:\n",
+ "\n",
+ "t=1.83*10**9;# in years\n",
+ "# Solution:\n",
+ "# Part (a)\n",
+ "k=(0.693)/(t*3.16*10**7);\n",
+ "k1=(0.693*10**17)/(t*3.16*10**7);# in 10^-17 s^-1\n",
+ "print\"\\n The overall decay constant will be *10^-17 s^-1\",round(k1,2)\n",
+ "# Part (b)\n",
+ "a=(6.022*10**23)/40; # atoms of K(40)\n",
+ "A=a*k;# activity\n",
+ "print\"\\n The activity for k(40) in 10^5 beta/s\",round(A/10**5,3)\n",
+ "\n",
+ "# Part (c)\n",
+ "a1=(6.022*10**23*1.2*10**-4)/41; # atoms of K(41)\n",
+ "A1=a1*k;# activity\n",
+ "print\"\\n The activity for k(41) in beta/s\",round(A1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.24;pg no:65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.24, Page:65 \n",
+ " \n",
+ "\n",
+ "The decay constant is min^-1 and the half life is min 0.1511 4.5879\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of decay constant and half life\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.24, Page:65 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "a1=6520.;# c/min\n",
+ "a2=4820.;#c/min\n",
+ "t=2.;#min\n",
+ "# Solution:\n",
+ "k=math.log(a1/a2)/t;\n",
+ "t1=0.693/k;# half life\n",
+ "print\"The decay constant is min^-1 and the half life is min\",round(k,4),round(t1,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.25;pg no:65"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.25, Page:65 \n",
+ " \n",
+ "\n",
+ "The half life for case (a)is h and case(b) is min 1.5 12.89\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of value of avagadro constant\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.25, Page:65 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "a=(1./32.);# activity drop of its initial value\n",
+ "t1=7.5;#in h case(a)\n",
+ "t2=64.45;# in min case(b)\n",
+ "# Solution:\n",
+ "n=math.log(a)/math.log(0.5);\n",
+ "t11=t1/n;# half life\n",
+ "t12=t2/n;# half life\n",
+ "print\"The half life for case (a)is h and case(b) is min\",t11,t12"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.26;pg no:66"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.26, Page:66 \n",
+ " \n",
+ "\n",
+ "The proportion of U235 704 million years back in 10^-2 is 1.3\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of proportion of U235 704 million years back\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.26, Page:66 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "t238=4.5*10**9;# in y\n",
+ "t235=7.04*10**8;# in y\n",
+ "a0=0.72;# atoms per cent\n",
+ "t=7.04*10**8;\n",
+ "# Solution:\n",
+ "\n",
+ "k1=0.693/(t238);#decay constant for U 238\n",
+ "N1=(100-a0)*math.exp(k1*t);\n",
+ "\n",
+ "k2=0.693/(t235);#decay constant for U 235\n",
+ "N2=(a0)*math.exp(k2*t);\n",
+ "\n",
+ "proportion=N2/N1;\n",
+ "print\"The proportion of U235 704 million years back in 10^-2 is \" ,round(proportion*100,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.27;pg no:67"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.27, Page:67 \n",
+ " \n",
+ "\n",
+ "The no. of atoms produced is and its mass is *10^-20 grams 1.5873 4.74\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The no. of atoms produced is and its mass\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.27, Page:67 \\n \\n\"\n",
+ "# Given:\n",
+ "t=110;# in min\n",
+ "a=10;#dpmg^-1\n",
+ "# Solution:\n",
+ "k=0.693/t;\n",
+ "N=a/k;# atoms of F18\n",
+ "mass=(N*18)/6.022*10**23;\n",
+ "mass1=(N*18*10**20)/(6.022*10**23);# in 10^-20 grams\n",
+ "print\"The no. of atoms produced is and its mass is *10^-20 grams\",round(N/10**3,4),round(mass1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.28;pgno:67"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.28, Page:67 \n",
+ " \n",
+ "\n",
+ "The mass in micro-grams is 0.166\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mass in micro-grams\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.28, Page:67 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "t=14.3;# half life in days\n",
+ "# Solution:\n",
+ "k=0.693/(t*24*3600);\n",
+ "N=(3.7*10**10)/(k);# No. of atoms in 1 Ci\n",
+ "N1=N*(1-(math.exp(-0.693/14.3)));# atoms of S32 produced\n",
+ "mass=(N1*32)/(6.022*10**23);\n",
+ "m1=mass*10**6;# in micro grams\n",
+ "print\"The mass in micro-grams is \",round(m1,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.29;pg no:68"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.29, Page:68 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The fraction decayed in 1 day will be 16.59\n",
+ "\n",
+ " The fraction decayed in 5 days will be 59.63\n",
+ "\n",
+ " The fraction decayed in 10 days will be . 83.7\n",
+ "\n",
+ " The fraction decayed in 6 half lives will be . 98.44\n",
+ "\n",
+ " Time needed for the decay of 99.9 percent is half lives i.e.days. 9.97 38.069\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of fraction decays and half lives\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.29, Page:68 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "t=3.82;# in days\n",
+ "# Solution:\n",
+ "# part(a)\n",
+ "days=1;\n",
+ "D1=(1-(math.exp(-0.693*days/t)))*100;\n",
+ "print\"\\n The fraction decayed in 1 day will be \",round(D1,2)\n",
+ "# part(b)\n",
+ "days=5;\n",
+ "D1=(1-(math.exp(-0.693*days/t)))*100;\n",
+ "print\"\\n The fraction decayed in 5 days will be \",round(D1,2)\n",
+ "# part(c)\n",
+ "days=10;\n",
+ "D1=(1-(math.exp(-0.693*days/t)))*100;\n",
+ "print\"\\n The fraction decayed in 10 days will be .\",round(D1,2)\n",
+ "# part(d)\n",
+ "days=6*t;\n",
+ "D1=(1-(math.exp(-0.693*days/t)))*100;\n",
+ "print\"\\n The fraction decayed in 6 half lives will be .\",round(D1,2)\n",
+ "# part(e)\n",
+ "n=math.log(0.001)/math.log(0.5);\n",
+ "print\"\\n Time needed for the decay of 99.9 percent is half lives i.e.days.\",round(n,2),round(t*n,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.30;pg no:68"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.30, Page:68 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The decay constant is y^-1 0.24\n",
+ "\n",
+ " The decay constant is y^-1 0.03\n",
+ "\n",
+ " The half life is y 2.92\n",
+ "\n",
+ " The half life is y 23.64\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of decay constant and half life\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.30, Page:68 \\n \\n\"\n",
+ "# Given:\n",
+ "t=2.6;# years\n",
+ "# Solution:\n",
+ "k=0.693/t;# decay constant\n",
+ "#part(a)\n",
+ "kbeta=0.89*k;\n",
+ "print\"\\n The decay constant is y^-1\",round(kbeta,2)\n",
+ "kEC=0.11*k;\n",
+ "print\"\\n The decay constant is y^-1\",round(kEC,2)\n",
+ "#part(b)\n",
+ "tbeta=0.693/kbeta;\n",
+ "print\"\\n The half life is y\",round(tbeta,2)\n",
+ "tEC=0.693/kEC;\n",
+ "print\"\\n The half life is y\",round(tEC,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.31;pg no:69"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.31, Page:69 \n",
+ " \n",
+ "\n",
+ "Decay by EC\n",
+ "\n",
+ "\t The decay constant is h^-1 0.02\n",
+ "\n",
+ "\t The half life is h 30.48\n",
+ "\n",
+ "Decay by beta+\n",
+ "\n",
+ "\t The decay constant is h^-1 0.01\n",
+ "\n",
+ "\t The half life is h 67.37\n",
+ "\n",
+ "Decay by beta-\n",
+ "\n",
+ "\t The decay constant is h^-1 0.02\n",
+ "\n",
+ "\t The half life is h 32.82\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Decay by beta\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.31, Page:69 \\n \\n\"\n",
+ "# Given:\n",
+ "t=12.8;# hours\n",
+ "# Solution:\n",
+ "k=0.693/t;# decay constant\n",
+ "#part(a)by EC\n",
+ "kEC=0.42*k;\n",
+ "print\"Decay by EC\"\n",
+ "print\"\\n\\t The decay constant is h^-1\",round(kEC,2)\n",
+ "tEC=0.693/kEC;\n",
+ "print\"\\n\\t The half life is h\",round(tEC,2)\n",
+ "\n",
+ "#part(b)by beta+\n",
+ "kbeta1=0.19*k;\n",
+ "print\"\\nDecay by beta+\"\n",
+ "print\"\\n\\t The decay constant is h^-1\",round(kbeta1,2)\n",
+ "tbeta1=0.693/kbeta1;\n",
+ "print\"\\n\\t The half life is h\",round(tbeta1,2)\n",
+ "\n",
+ "#part(b)by beta+\n",
+ "kbeta2=0.39*k;\n",
+ "print\"\\nDecay by beta-\"\n",
+ "print\"\\n\\t The decay constant is h^-1\",round(kbeta2,2)\n",
+ "tbeta2=0.693/kbeta2;\n",
+ "print\"\\n\\t The half life is h\",round(tbeta2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.32;pg no:69"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.32, Page:69 \n",
+ " \n",
+ "\n",
+ "The proportion of U,Ra,Rn is 1: 152879.581152 4.27107329843e+11\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of proportion of U,Ra,Rn\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.32, Page:69 \\n \\n\"\n",
+ "# Given:\n",
+ "tU=4.47*10**9;# y\n",
+ "tRa=1600;# y\n",
+ "tRn=3.82;# days\n",
+ "nU=1;\n",
+ "# Solution:\n",
+ "#under secular equilibrium we have\n",
+ "nRa=(tRa*365/tRn)*nU;\n",
+ "nRn=(tU*365/tRn)*nU;\n",
+ "print\"The proportion of U,Ra,Rn is 1:\",nRa,nRn"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.33;pg no:70"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.33, Page:70 \n",
+ " \n",
+ "\n",
+ "The proportion of ay4 at the end of 4 hrs is 63.6\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of proportion of ay4\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.33, Page:70 \\n \\n\"\n",
+ "# Given:\n",
+ "ax0 =1.; #assume\n",
+ "tx = 2.; #hrs\n",
+ "ty = 1.; #hrs\n",
+ "# Solution:\n",
+ "# general equation connecting Ax and Ay is\n",
+ "# Ax(n) = (ky * Ax(0) * (exp(-kx * t) - exp(-ky * t))/ (ky - kx)) + Ay(0) * exp(-ky * t)\n",
+ "ax0 = 1.;\n",
+ "ay4 = (ax0 * (0.693/1.) * ((1./4.)-(1./16.)))/((0.693/1.)-(0.693/2.)) + ax0 * (1./16.);\n",
+ "ax4 = (1.* ax0)/4.;\n",
+ "proportion = (ay4 * 100)/(ay4+ax4)\n",
+ "print\"The proportion of ay4 at the end of 4 hrs is\",round(proportion,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.34;pg no:71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.34, Page:71 \n",
+ " \n",
+ "\n",
+ "Activity due to La(140) at the end of 12 hrs will be dps 1111.0\n",
+ "Activity due to La(140) at the end of 24 d will be dps 518.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Activity due to La(140)\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.34, Page:71 \\n \\n\"\n",
+ "#Given:\n",
+ "Ax0 = 2000.; #dps\n",
+ "#Solution:\n",
+ "#part a\n",
+ "ky = 0.693/10.;\n",
+ "kx = 0.693/288.;\n",
+ "# general equation connecting Ax and Ay is\n",
+ "Ax12 = (ky * Ax0 * (0.5**(1./24.) - 0.5**(1.2)))/ (ky - kx)\n",
+ "\n",
+ "print\"Activity due to La(140) at the end of 12 hrs will be dps\",round(Ax12)\n",
+ "#part b\n",
+ "ky = 0.693/10.;\n",
+ "kx = 0.693/288.;\n",
+ "# general equation connecting Ax and Ay is\n",
+ "Ax24 = (ky * Ax0 * (0.5**(2) - 0.5**(57.6)))/ (ky - kx)\n",
+ "print\"Activity due to La(140) at the end of 24 d will be dps\",round(Ax24)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.35;pg no:71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.35, Page:71 \n",
+ " \n",
+ "\n",
+ "The time when daughter activity reaches maximum is and this is same when activities of both are equal. 4.48\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of time\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.35, Page:71 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "t1=2.7;# h\n",
+ "t2=3.6;# h\n",
+ "# Solution:\n",
+ "k1=0.693/t1;\n",
+ "k2=.693/t2;\n",
+ "tmax=(math.log(k2/k1))/(k2-k1);\n",
+ "print\"The time when daughter activity reaches maximum is and this is same when activities of both are equal.\",round(tmax,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.36;pg no:71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.36, Page:71 \n",
+ " \n",
+ "\n",
+ "The half life of Bi is days 3.84\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of half life of Bi\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.36, Page:71 \\n \\n\"\n",
+ "# Given:\n",
+ "tPo=138;# days\n",
+ "n=24.86;# days\n",
+ "# Solution:\n",
+ "kPo = 0.693/tPo;\n",
+ "# using simplification logx=2(x-1)/(x+1)\n",
+ "kBi=((2 * 2.303)-(n*kPo))/n;\n",
+ "tBi=0.693/kBi;\n",
+ "print\"The half life of Bi is days\",round(tBi,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 4.37;pg no:72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 4.37, Page:72 \n",
+ " \n",
+ "\n",
+ "The residual activity in the sample in 10^5 dps= 93.75\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of residual activity in the sample\n",
+ "#intiation of all variables\n",
+ "# Chapter 4\n",
+ "print\"Example 4.37, Page:72 \\n \\n\"\n",
+ "# Given:\n",
+ "a=10*10**7;# rate\n",
+ "t=15;# h\n",
+ "# Soution:\n",
+ "A30=a*(1-(0.5)**(2));# dps\n",
+ "A45=A30*((0.5)**(3));# dps\n",
+ "print\"The residual activity in the sample in 10^5 dps=\",A45/10**5"
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter5.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter5.ipynb
new file mode 100644
index 00000000..9a9ccc52
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter5.ipynb
@@ -0,0 +1,1096 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# chapter 5:nuclear reactions"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.1;pg no:80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.1, Page:80 \n",
+ " \n",
+ "\n",
+ "The excitation energy for Al*(26) in MeV= and that of Na*(22) in MeV= 18.79 65.4993\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of excitation energy for Al and Na\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.1, Page:80 \\n \\n\"\n",
+ "# Given:\n",
+ "mMg=23.985045;\n",
+ "md=2.014102;\n",
+ "mAl=25.986900;\n",
+ "mNe=19.99244;\n",
+ "mNa=21.944;\n",
+ "# Solution:\n",
+ "# for compound nucleus Al*(26)\n",
+ "KE1=(24./26.)*8.;\n",
+ "BE1=(mMg+md-mAl)*931.;# in MeV\n",
+ "EE1=BE1+KE1;\n",
+ "# for compound nucleus Na*(22)\n",
+ "KE2=(20./22.)*8.;\n",
+ "BE2=(mNe+md-mNa)*931.;# in MeV\n",
+ "EE2=BE2+KE2;\n",
+ "print\"The excitation energy for Al*(26) in MeV= and that of Na*(22) in MeV=\",round(EE1,2),round(EE2,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.2;pg no:81"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.2, Page:81 \n",
+ " \n",
+ "\n",
+ "The energy of protons scattered through an angle of 90 deg. in MeV= 3.91\n",
+ "\n",
+ " \n",
+ " The energy of proton observed at 90 deg. after they have excited the lithium to a level of 0.48 MeV is = MeV 4.52\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy of protons\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.2, Page:81 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "E0=5.;# in MeV\n",
+ "m=1.;\n",
+ "M=7.\n",
+ "\n",
+ "# Solution:\n",
+ "\n",
+ "Erecoil=(4*5*m*M*((math.sin(45*3.14/180))**(2)))/((m+M)**2);\n",
+ "Escat=E0-Erecoil;\n",
+ "\n",
+ "print\"The energy of protons scattered through an angle of 90 deg. in MeV=\",round(Escat,2)\n",
+ "Eresi=E0-0.48;\n",
+ "\n",
+ "Erecoil2=(14/64)*Eresi;\n",
+ "Escat2=Eresi-Erecoil2;\n",
+ "print\"\\n \\n The energy of proton observed at 90 deg. after they have excited the lithium to a level of 0.48 MeV is = MeV\",Escat2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.3;pg no:81"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.3, Page:81 \n",
+ " \n",
+ "\n",
+ "The mass difference between A & B in Uu= 1678.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of mass difference between A & B\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.3, Page:81 \\n \\n\"\n",
+ "# Given:\n",
+ "th=2.4;# in Mev\n",
+ "z=0.0009;# mp-mn in atomic mass unit\n",
+ "# Solution:\n",
+ "x=-(2.4/931.);#assuming no barrier operates\n",
+ "y=x+z;\n",
+ "print\"The mass difference between A & B in Uu=\", round(-y*10**6)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.4;pg no:82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.4, Page:82 \n",
+ " \n",
+ "\n",
+ "The energy required for (a) & (b) are = respectively in MeV 1875.55 937.77\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy required\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.4, Page:82 \\n \\n\"\n",
+ "# Given:\n",
+ "mp=1.007277;\n",
+ "# Solution:\n",
+ "E1=2*mp*931;# in MeV / part(a)\n",
+ "E2=E1/2;# in MeV / part (b)\n",
+ "print\"The energy required for (a) & (b) are = respectively in MeV\",round(E1,2),round(E2,2) "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.5;pg no:82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.5, Page:82 \n",
+ " \n",
+ "\n",
+ "The Q-values are in MeV for B(9) & F(19) reactions respectively -1.853 -2.45\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of Q-values\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.5, Page:82 \\n \\n\"\n",
+ "#Given\n",
+ "E1=2.059;\n",
+ "E2=2.59;\n",
+ "M1=9.;\n",
+ "M2=18.;\n",
+ "m=1.;\n",
+ "# Solution\n",
+ "Q1=-E1*(M1/(m+M1)); # part(a)\n",
+ "Q2=-E2*(M2/(m+M2)); # part(b)\n",
+ "print\"The Q-values are in MeV for B(9) & F(19) reactions respectively\",round(Q1,3),round(Q2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.6;pg no:82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.6, Page:82 \n",
+ " \n",
+ "\n",
+ "The thershold energies are in MeV for B(12) & N(13) reactions respectively 1.343 3.485\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of thershold energies\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.6, Page:82 \\n \\n\"\n",
+ "# Given:\n",
+ "Q1=1.136;\n",
+ "Q2=3.236;\n",
+ "M1=11.;\n",
+ "M2=13.;\n",
+ "m1=2.;\n",
+ "m2=1.;\n",
+ "# Solution\n",
+ "E1=Q1*((m1+M1)/M1); # part(a)\n",
+ "E2=Q2*((m2+M2)/M2); # part(b)\n",
+ "print\"The thershold energies are in MeV for B(12) & N(13) reactions respectively\",round(E1,3),round(E2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.7;pg no:82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.7, Page:82 \n",
+ " \n",
+ "\n",
+ "The binding energy of last 2 neutron in part(a) and part(b) are = in MeV respectively 20.37 20.5\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The binding energy of last 2 neutron\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.7, Page:82 \\n \\n\"\n",
+ "# Given:\n",
+ "\n",
+ "Q1=9.28;# in Mev\n",
+ "Q2=0.21;# in Mev\n",
+ "Q3=7.25;# in Mev\n",
+ "Q4=3.63;# in Mev\n",
+ "mn=1.008665;\n",
+ "md=1.995311;# mass difference between Fe(56) & Fe(54)\n",
+ "# Solution:\n",
+ "E1=Q1+Q2+Q3+Q4;# part (a)\n",
+ "E2=(2*mn-md)*931;# part (b)\n",
+ "print\"The binding energy of last 2 neutron in part(a) and part(b) are = in MeV respectively\",round(E1,2),round(E2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.8;pg no:83"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.8, Page:83 \n",
+ " \n",
+ "\n",
+ "The threshold energy is in MeV for O(17) reaction 1.543\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of threshold energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.8, Page:83 \\n \\n\"\n",
+ "# Given:\n",
+ "Q1=1.2;\n",
+ "M1=14.;\n",
+ "m1=4.;\n",
+ "# Solution:\n",
+ "E1=Q1*((m1+M1)/M1);\n",
+ "print\"The threshold energy is in MeV for O(17) reaction\",round(E1,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.9;pg no:83"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.9, Page:83 \n",
+ " \n",
+ "\n",
+ "The threshold energy is in MeV for C(13) reaction 3.485\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of threshold energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.9, Page:83 \\n \\n\"\n",
+ "# Given:\n",
+ "Q1=3.236;\n",
+ "M1=13.;\n",
+ "m1=1.;\n",
+ "# Solution:\n",
+ "E1=Q1*((m1+M1)/M1);\n",
+ "print\"The threshold energy is in MeV for C(13) reaction\",round(E1,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.10;pg no:84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.10, Page:84 \n",
+ " \n",
+ "\n",
+ "The cs area required will be in b= 3.836\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of cs area required\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.10, Page:84 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "A1=3836;#in barns\n",
+ "E1=1;# in eV\n",
+ "E2=10**6# in eV\n",
+ "\n",
+ "# Solution:\n",
+ "vr=math.sqrt(E2/E1);\n",
+ "A2=A1/vr;\n",
+ "print\"The cs area required will be in b=\", A2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.11;pg no:84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.11, Page:84 \n",
+ " \n",
+ "\n",
+ "The activity in 10^7 dis s^-1 g^-1 NaCl= 6.13\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of activity\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.11, Page:84 \\n \\n\"\n",
+ "# Given:\n",
+ "a=0.56*10.**-24.; # area\n",
+ "flux=10.**13.;\n",
+ "# Solution:\n",
+ "A=6.022*10.**23.*10.**-3.*2.5/(58.5);\n",
+ "k=A*flux*0.56*10.**-24.;\n",
+ "y=(0.5)**(4./5.);\n",
+ "activity=k*(1-y);\n",
+ "print\"The activity in 10^7 dis s^-1 g^-1 NaCl=\",round(activity/10**7,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.12;pg no:84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.12, Page:84 \n",
+ " \n",
+ "\n",
+ "The cros section area in (b)= 3762.66\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of cros section area\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.12, Page:84 \\n \\n\"\n",
+ "# Given:\n",
+ "w=0.1189;\n",
+ "flux=10**16;\n",
+ "# Solution:\n",
+ "A=w/(flux*3.16*10**7);# in m^2\n",
+ "A1=A*10000/(10**-24);# in Barns\n",
+ "print\"The cros section area in (b)=\",round(A1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.13;pg no:85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.13, Page:85 \n",
+ " \n",
+ "\n",
+ "The cros section area in (b)= 98.61\n",
+ "\n",
+ " \n",
+ " The saturation activity possible in 10^13 dis s^-1 g^-1= 3.01\n",
+ "\n",
+ " \n",
+ " The activity in 10^12 dis s^-1 g^-1= 6.83\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of cros section area,activity,saturation activity\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.13, Page:85 \\n \\n\"\n",
+ "# Given:\n",
+ "w=8.52*10**-4;\n",
+ "flux=10**18;\n",
+ "# Solution:\n",
+ "\n",
+ "A=w/(flux*24*3600);# in m^2\n",
+ "A1=A*10000/(10**-24);# in Barns\n",
+ "print\"The cros section area in (b)=\", round(A1,2)\n",
+ "k=flux*A*6.022*10**23/197;\n",
+ "print\"\\n \\n The saturation activity possible in 10^13 dis s^-1 g^-1=\",round(k/10**13,2)\n",
+ "y=(0.5)**(0.3704);\n",
+ "activity=k*(1-y);\n",
+ "print\"\\n \\n The activity in 10^12 dis s^-1 g^-1= \",round(activity/10**12,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.14;pg no:85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.14, Page:85 \n",
+ " \n",
+ "\n",
+ "The activity in 10^12 dis s^-1 g^-1= 1.037\n",
+ "The activity in Ci/cm^3 of foil is = 1402.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of activity\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.14, Page:85 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "a=98.7*10**-24; # area in cm ^2\n",
+ "flux=10**16;\n",
+ "d=19.3;# density\n",
+ "l=0.02;# thickness in cm\n",
+ "area=1;# in cm^2\n",
+ "# Solution:\n",
+ "V=area*l;\n",
+ "m=V*d;\n",
+ "A=(6.022*10**23*m)/(197);\n",
+ "k=A*flux*a;\n",
+ "y=math.exp((-0.693*5)/(2.7*24*60));\n",
+ "activity=k*(1-y);\n",
+ "print\"The activity in 10^12 dis s^-1 g^-1=\",round(activity/10**12,3)\n",
+ "# specific activity in Ci/cm^3\n",
+ "a1=activity/(3.7*10**10);# in Ci/gold foil\n",
+ "a2=a1/V;# in Ci/cm^3 of foil\n",
+ "print\"The activity in Ci/cm^3 of foil is = \",round(a2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.15;pg no:86"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.15, Page:86 \n",
+ " \n",
+ "\n",
+ "The geometric cross-section area are for Sr(88), Sr(87), Xe(136) & Xe(135) respectively 1.218 1.208 1.628 1.62\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of geometric cross-section area\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.15, Page:86 \\n \\n\"\n",
+ "# Given:\n",
+ "r0=1.4*10**-15;# in m\n",
+ "A1=88;\n",
+ "A2=87;\n",
+ "A3=136;\n",
+ "A4=135;\n",
+ "# Solution:\n",
+ "\n",
+ "rSr1=(3.14*(r0*(A1)**(0.33333))**2)/10**-28;# in barns\n",
+ "rSr2=(3.14*(r0*(A2)**(0.33333))**2)/10**-28;# in barns\n",
+ "rXe1=(3.14*(r0*(A3)**(0.33333))**2)/10**-28;# in barns\n",
+ "rXe2=(3.14*(r0*(A4)**(0.33333))**2)/10**-28;# in barns\n",
+ "print\"The geometric cross-section area are for Sr(88), Sr(87), Xe(136) & Xe(135) respectively\",round(rSr1,3),round(rSr2,3),round(rXe1,3),round(rXe2,3)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.16;pg no:87"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.16, Page:87 \n",
+ " \n",
+ "\n",
+ " The activity in mCi is = 0.042\n",
+ " The activity in M Bq is = 1.564\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of activity in mCi,Bq\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.16, Page:87 \\n \\n\"\n",
+ "# Given:\n",
+ "m=4*10**-3;# in gms\n",
+ "flux=1.3*10**14;\n",
+ "a=19.6*10**-24;# in cm^2\n",
+ "# Solution:\n",
+ "N=(m/59)*6.022*10**23;\n",
+ "A=N*flux*a*3600;# atoms\n",
+ "k=0.693/(5.25*3.16*10**7);# s^-1\n",
+ "A1=k*A;# Activity in dps\n",
+ "A2=(A1)/(3.7*10**10);# in Ci\n",
+ "A3=(A1*10**3)/(3.7*10**10);# in mCi\n",
+ "A4=A2*37*10**8;# in Bq\n",
+ "print\" The activity in mCi is =\",round(A3,3)\n",
+ "print\" The activity in M Bq is = \",round(A4/10**5,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.17;pg no:88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.17, Page:88 \n",
+ " \n",
+ "\n",
+ "The thickness of Cd foil in (cm)= 0.0406\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of thickness of Cd foil\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.17, Page:88 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "a=2.44*1000*10**-24;# in barns\n",
+ "d=8.64;# g/cm^3\n",
+ "# Solution:\n",
+ "n=(d*6.02*10**23)/112;# atoms/cm^2\n",
+ "x=(math.log(100))/(n*a);# in cm\n",
+ "print\"The thickness of Cd foil in (cm)=\",round(x,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.18;pg no:89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.18, Page:89 \n",
+ " \n",
+ "\n",
+ "The thickness of B foil in (cm)= 0.0095\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of excitation energy for Al and Na\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.18, Page:89 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "a=3.8*1000*10**-24;# in barns\n",
+ "Ir=0.004;# I0/Ix\n",
+ "d=2.55;# g/cm^3\n",
+ "\n",
+ "# Solution:\n",
+ "n=(d*6.02*10**23)/10;# atoms/cm^2\n",
+ "y=(Ir)**-1;\n",
+ "x=math.log(y)/(n*a);# in cm\n",
+ "print\"The thickness of B foil in (cm)=\",round(x,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.19;pg no:89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.19, Page:89 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The excitation energy of compound nucleus in (MeV)= 9.66\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of excitation energy \n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.19, Page:89 \\n \\n\"\n",
+ "# Given:\n",
+ "E1=6;# MeV\n",
+ "mAl=26.981535;\n",
+ "malpha=4.002604;\n",
+ "mP=30.973763;\n",
+ "# Solution:\n",
+ "KE=E1*(27/31);# in MeV\n",
+ "BE=(mAl+malpha-mP)*931;# in MeV\n",
+ "Ex=KE+BE;\n",
+ "print\"\\n The excitation energy of compound nucleus in (MeV)=\",round(Ex,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.20;pg no:90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.20, Page:90 \n",
+ " \n",
+ "\n",
+ "The excitation energy of compound nucleus in (MeV)= 4.63\n",
+ "The excitation energy of compound nucleus in (MeV)= 6.022\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of excitation energy \n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.20, Page:90 \\n \\n\"\n",
+ "# Given:\n",
+ "E1=1.4;# MeV\n",
+ "mBi=208.980417;\n",
+ "mn=1.008665;\n",
+ "mBI=209.984110;\n",
+ "# Solution:part(a)\n",
+ "\n",
+ "KE1=0.;# in MeV\n",
+ "BE1=(mBi+mn-mBI)*931.;# in MeV\n",
+ "Ex1=KE1+BE1;\n",
+ "print\"The excitation energy of compound nucleus in (MeV)=\",round(Ex1,2)\n",
+ "# Solution:part(b)\n",
+ "KE2=E1*(209./210.);# in MeV\n",
+ "BE2=(mBi+mn-mBI)*931.;# in MeV\n",
+ "Ex2=KE2+BE2;\n",
+ "print\"The excitation energy of compound nucleus in (MeV)=\",round(Ex2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.21;pg no:90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.21, Page:90 \n",
+ " \n",
+ "\n",
+ "The resonance in part(a) will occur at =(MeV) 1.668\n",
+ "The resonance in part(b) will occur at (MeV)= 2.955\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of resonance\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.21, Page:90 \\n \\n\"\n",
+ "Ex=12.8;# MeV\n",
+ "mB=10.012939;\n",
+ "malpha=4.002604;\n",
+ "mN=14.003074;\n",
+ "mC=12.00;\n",
+ "md=2.014102;\n",
+ "# Solution:part(a)\n",
+ "\n",
+ "BE1=(mB+malpha-mN)*931;# in MeV\n",
+ "KE1=Ex-BE1;\n",
+ "E1=KE1*(14./10.);\n",
+ "print\"The resonance in part(a) will occur at =(MeV)\",round(E1,3)\n",
+ "\n",
+ "# Solution:part(b)\n",
+ "BE2=(mC+md-mN)*931.;# in MeV\n",
+ "KE2=Ex-BE2;\n",
+ "E2=KE2*(14./12.);\n",
+ "print\"The resonance in part(b) will occur at (MeV)=\",round(E2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.22;pg no:91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.22, Page:91 \n",
+ " \n",
+ "\n",
+ "The resonance frequency in (MHz)= 19.2\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of resonance frequency\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.22, Page:91 \\n \\n\"\n",
+ "# Given:\n",
+ "B=2.5;# tesla\n",
+ "q=1.6*10**-19;\n",
+ "m=1.66*10**-27;\n",
+ "# Solution:\n",
+ "\n",
+ "f=(B*q*10**-6)/(2*3.14*2*m);\n",
+ "print\"The resonance frequency in (MHz)=\",round(f,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.23;pg no:91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.23, Page:91 \n",
+ " \n",
+ "\n",
+ "The magnetic field needed to accelerate protons in T= 0.56\n",
+ "The magnetic field needed to accelerate N(14) ions in T= 1.31\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of magnetic field needed to accelerate\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.23, Page:91 \\n \\n\"\n",
+ "# Given:\n",
+ "f=8.6*10**6;# in Hz\n",
+ "q1=1.6*10**-19;\n",
+ "q2=6*1.6*10**-19;\n",
+ "m1=1.66*10**-27;\n",
+ "m2=14*1.66*10**-27;\n",
+ "# Solution:\n",
+ "# for proton\n",
+ "B1=2*3.14*f*m1/q1;\n",
+ "print\"The magnetic field needed to accelerate protons in T=\",round(B1,2)\n",
+ "# for N(14) ions\n",
+ "B2=2*3.14*f*m2/q2;\n",
+ "print\"The magnetic field needed to accelerate N(14) ions in T=\",round(B2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 5.24;pg no:91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 5.24, Page:91 \n",
+ " \n",
+ "\n",
+ "The excitation energy of compound nucleus Si* in MeV= 10.5622\n",
+ "The excitation energy of compound nucleus Rb* in MeV= 12.0756\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of excitation energy of compound nucleus Si and Rb\n",
+ "#intiation of all variables\n",
+ "# Chapter 5\n",
+ "print\"Example 5.24, Page:91 \\n \\n\"\n",
+ "E1=2.75;# MeV\n",
+ "E2=14;# in MeV\n",
+ "mMg=23.985045;\n",
+ "malpha=4.00260;\n",
+ "mSi=27.9763;\n",
+ "mNe=19.99244;\n",
+ "mCo=58.93320;\n",
+ "mRb=78.9239\n",
+ "# Solution:\n",
+ "\n",
+ "KE1=E1*(24/28);# in MeV\n",
+ "BE1=(mMg+malpha-mSi)*931;# in MeV\n",
+ "Ex1=KE1+BE1;\n",
+ "print\"The excitation energy of compound nucleus Si* in MeV=\",round(Ex1,4)\n",
+ "KE2=E2*(59./79.);# in MeV\n",
+ "BE2=(mNe+mCo-mRb)*931.;# in MeV\n",
+ "Ex2=KE2+BE2;\n",
+ "print\"The excitation energy of compound nucleus Rb* in MeV=\",round(Ex2,4)"
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter6.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter6.ipynb
new file mode 100644
index 00000000..569a9390
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter6.ipynb
@@ -0,0 +1,923 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#chapter 6:nuclear fission "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.1;pg no:98"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.1, Page:98 \n",
+ " \n",
+ "\n",
+ "The half-thickness of In is times more than of Gd. 789.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of excitation energy for Al and Na\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.1, Page:98 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "d1=7.9;# density of Gd\n",
+ "d2=2.31;# Density of In\n",
+ "a1=49.;# in Kb\n",
+ "a2=155.;# in b\n",
+ "m1=157.25;\n",
+ "m2=114.8;\n",
+ "Na=6.02*10.**23.;\n",
+ "# Solution:\n",
+ "x1=math.log(1./(1./2.))/((d1*Na*a1*10.**-24.*10.**3.)/m1);# half-thickness for Gd\n",
+ "x2=math.log(1./(1./2.))/((d2*Na*a2*10.**-24.)/m2);# half-thickness for In\n",
+ "r=x2/x1;\n",
+ "print\"The half-thickness of In is times more than of Gd.\",round(r)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.2;pg no:98"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.2, Page:99 \n",
+ " \n",
+ "\n",
+ "The thickness of Pd foil which would reduce the intensity of a beam to excatly 1/1000 of its initial value in (cm)= 2.36\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of thickness of Pd foil\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.2, Page:99 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "d1=12.;# density of Gd\n",
+ "a1=43.11;# in b\n",
+ "m1=106.4;\n",
+ "Na=6.02*10**23;\n",
+ "i1=1.;\n",
+ "i2=1./1000.;\n",
+ "# Solution\n",
+ "x=math.log(i1/i2)/((d1*Na*a1*10.**-24.)/m1);# thickness for Pd foil\n",
+ "print\"The thickness of Pd foil which would reduce the intensity of a beam to excatly 1/1000 of its initial value in (cm)=\",round(x,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.3;pg no:99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.3, Page:99 \n",
+ " \n",
+ "\n",
+ "The fission energy of Te(130)in MeV is = 47.6\n",
+ "The barrier energy of Te(130) in MeV is = 80.7\n",
+ "The activation energy of Te(130) in MeV is = 33.1\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of fission,barrier,activation\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.3, Page:99 \\n \\n\"\n",
+ "# Given:\n",
+ "mTe=129.9067; # mol wt. of Te(52)\n",
+ "mCu=64.9278;# mol wt of Cu(29)\n",
+ "mFe=65;# mol wt of Fe(26)\n",
+ "# Solution\n",
+ "E1=(mTe-2*mCu)*931; # Fission Energy in MeV\n",
+ "print\"The fission energy of Te(130)in MeV is =\",round(E1,1)\n",
+ "r=((65)**0.33333);\n",
+ "E2=(26*26*4.8*4.8*10**-20)/(2*1.5*1.6*10**-13*10**-6*r);# Barrier energy in MeV\n",
+ "print\"The barrier energy of Te(130) in MeV is =\",round(E2,1)\n",
+ "E3=E2-E1;# Activation Energy in MeV\n",
+ "print\"The activation energy of Te(130) in MeV is = \",round(E3,1)\n",
+ "# Since barrier energy is greater than fission energy, spontaneous fission is not possible unless the activation energy is provided."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.4;pg no:99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.4, Page:99 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The fission energy in MeV is = 24.5784\n",
+ "\n",
+ " The barrier energy in MeV is = 77.95\n",
+ "\n",
+ " The activation energy in MeV is = 53.38\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of fission,barrier,activation energies\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.4, Page:99 \\n \\n\"\n",
+ "# Given:\n",
+ "mSn=113.903; # mol wt. of Sn(50)\n",
+ "mMn=56.9383;# mol wt of Mn(25)\n",
+ "mFe=57;#mol wt of Fe(26)\n",
+ "# Solution\n",
+ "E1=(mSn-2*mMn)*931; # Fission Energy in MeV\n",
+ "print\"\\n The fission energy in MeV is =\",E1\n",
+ "r=((mFe)**0.33333);\n",
+ "E2=(25*25*4.8*4.8*10**-20)/(2*1.5*1.6*10**-13*10**-6*r);# Barrier energy in MeV\n",
+ "print\"\\n The barrier energy in MeV is = \",round(E2,2)\n",
+ "E3=E2-E1;# Activation Energy in MeV\n",
+ "print\"\\n The activation energy in MeV is =\",round(E3,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.5;pg no: 100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.5, Page:100 \n",
+ " \n",
+ "\n",
+ "\n",
+ " z1= 40.0\n",
+ "\n",
+ " z2= 54.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.5, Page:100 \\n \\n\"\n",
+ "# Given:\n",
+ "a1=94;# atomic no. of Pu\n",
+ "a2=42;#atomic no. of Mo\n",
+ "a3=56;# atomic no. of Ba\n",
+ "# Solution:\n",
+ "# By principle of equal charge displacement\n",
+ "z1=0.5*(a1+a2-a3);\n",
+ "print\"\\n z1=\",z1\n",
+ "z2=0.5*(a1-a2+a3);\n",
+ "print\"\\n z2=\",z2\n",
+ "\n",
+ "#From z1 and z2 we have the primary fragments as Zr(40), atomic mass(100) and Xe(54), atomic mass (138)."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.6;pg no: 100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.6, Page:100 \n",
+ " \n",
+ "\n",
+ "\n",
+ " z1= 37.0\n",
+ "\n",
+ " z2= 55.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.6, Page:100 \\n \\n\"\n",
+ "# Given:\n",
+ "a1=92;# atomic no. of U\n",
+ "a2=40;#atomic no. of Zr\n",
+ "a3=58;# atomic no. of Ce\n",
+ "# Solution\n",
+ "# By principle of equal charge displacement\n",
+ "z1=0.5*(a1+a2-a3);\n",
+ "print\"\\n z1=\",z1\n",
+ "z2=0.5*(a1-a2+a3);\n",
+ "print\"\\n z2=\",z2\n",
+ "#From z1 and z2 we have the primary fragments are Rb(37), atomic mass(94) and Cs(55), atomic mass (140)."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.7;pg no: 100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.7, Page:100 \n",
+ " \n",
+ "\n",
+ "\n",
+ " z1= 39.0\n",
+ "\n",
+ " z2= 51.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.7, Page:100 \\n \\n\"\n",
+ "# Given:\n",
+ "a1=92;# atomic no. of U\n",
+ "a2=42;#atomic no. of Mo\n",
+ "a3=56;# atomic no. of Ba\n",
+ "# Solution\n",
+ "# By principle of equal charge displacement\n",
+ "z1=0.5*(a1+a2-a3);\n",
+ "print\"\\n z1=\",z1\n",
+ "z2=0.5*(a1-a2+a3-4);\n",
+ "print\"\\n z2=\",z2\n",
+ "\n",
+ "# From z1 and z2 we have the primary fragments are Y(39), atomic mass(95) and Sb(51), atomic mass (137)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.8;pg no: 101"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.8, Page:101 \n",
+ " \n",
+ "\n",
+ "The fission energy in MeV is = 168.24\n",
+ "\n",
+ " The barrier energy in MeV is = 196.54\n",
+ "\n",
+ " The activation energy in MeV is = 28.3\n",
+ "\n",
+ " The fission by thermal neutrons is not possible since excitation energy is less than activation energy. 6.4239\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of fission,barrier,activation energies\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.8, Page:101 \\n \\n\"\n",
+ "# Given:\n",
+ "mU=236.04533;\n",
+ "mU1=236.045733;\n",
+ "mU2=235.043933;\n",
+ "mY=94.912;\n",
+ "mSb=136.91782;\n",
+ "mn=1.0087;\n",
+ "Na=6.02*10**23;\n",
+ "\n",
+ "# Solution:\n",
+ "E1=(mU-mY-mSb-4*mn)*931; # Fission Energy in MeV\n",
+ "print\"The fission energy in MeV is = \",round(E1,2)\n",
+ "r1=((mY)**0.33333);\n",
+ "r2=((mSb)**0.33333);\n",
+ "E2=(39*51*4.8*4.8*10**-20)/(1.5*10**-13*(r1+r2)*1.6*10**-6);# Barrier energy in MeV\n",
+ "print\"\\n The barrier energy in MeV is = \",round(E2,2)\n",
+ "E3=E2-E1;# Activation Energy in MeV\n",
+ "print\"\\n The activation energy in MeV is = \",round(E3,2)\n",
+ "# Note : There is discrepancy in the final answer.\n",
+ "E4=(mU2+mn-mU1)*931; # Fission Energy in MeV\n",
+ "print\"\\n The fission by thermal neutrons is not possible since excitation energy is less than activation energy.\",E4"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.9;pg no: 101"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.9, Page:101 \n",
+ " \n",
+ "\n",
+ "The independent fractional chain yield of Sr is = 0.01\n",
+ "\n",
+ " The independent fractional chain yield of Y is = 1.54\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of independent fractional chain yield of Sr,Y\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.9, Page:101 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "nSr=38.;\n",
+ "nY=39.;\n",
+ "# Solution:\n",
+ "PSr=0.565*math.exp(-((nSr-40)**2)); #independent fractional chain yield of Sr\n",
+ "PY=0.565*math.exp(((nY-40.)**2.)); #independent fractional chain yield of Y\n",
+ "print\"The independent fractional chain yield of Sr is =\",round(PSr,2)\n",
+ "print\"\\n The independent fractional chain yield of Y is =\",round(PY,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.10;pg no: 102"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.10, Page:102 \n",
+ " \n",
+ "\n",
+ "The energy for the given fission is =(MeV) 184.7\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy for the given fission\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.10, Page:102 \\n \\n\"\n",
+ "# Given:\n",
+ "mU=235.043091;\n",
+ "mn=1.0087;\n",
+ "mXe=138.9187;\n",
+ "mSn=94.919;\n",
+ "# Solution:\n",
+ "dm=(235.04309+1.0087-138.917-94.919-2.0174);# delta m\n",
+ "E=dm*931;# energy of given fission in MeV\n",
+ "print\"The energy for the given fission is =(MeV)\",round(E,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.11;pg no: 102"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.11, Page:102 \n",
+ " \n",
+ "\n",
+ "The energy for the Pd(108)+Xe(129)+3n fission is =(MeV) 210.46\n",
+ "\n",
+ " The energy for the Gd(155)+Br(81)+4n fission is =(MeV) 174.76\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy for the Gd(155)+Br(81)+4n,Pd(108)+Xe(129)+3n\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.11, Page:102 \\n \\n\"\n",
+ "# Given:\n",
+ "mPu=239.052161;\n",
+ "mPd=107.903920;\n",
+ "mXe=128.904784;\n",
+ "mn=1.0087;\n",
+ "mGd=154.922010;\n",
+ "mBr=80.916344;\n",
+ "\n",
+ "# Solution: Part (a)\n",
+ "\n",
+ "dm1=(mPu-(mPd+mXe+2*mn));# delta m\n",
+ "E1=dm1*931;# energy of given fission in MeV\n",
+ "print\"The energy for the Pd(108)+Xe(129)+3n fission is =(MeV)\",round(E1,2)\n",
+ "\n",
+ "dm2=(mPu-(mGd+mBr+3*mn));# delta m\n",
+ "E2=dm2*931;# energy of given fission in MeV\n",
+ "print\"\\n The energy for the Gd(155)+Br(81)+4n fission is =(MeV)\",round(E2,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.12;pg no: 103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.12, Page:103 \n",
+ " \n",
+ "\n",
+ "The fission energy in MeV is = 245.41\n",
+ "\n",
+ " The barrier energy in MeV is = 240.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of barrier,fission energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.12, Page:103 \\n \\n\"\n",
+ "# Given:\n",
+ "\n",
+ "mFm=250.079;\n",
+ "mSn=124.9077;\n",
+ "Na=6.02*10**23;\n",
+ "\n",
+ "# Solution:\n",
+ "E1=(mFm-2*mSn)*931; # Fission Energy in MeV\n",
+ "print\"The fission energy in MeV is = \",round(E1,2)\n",
+ "r=((mSn)**0.33333);\n",
+ "E2=(50*50*4.8*4.8*10**-20)/(2*1.5*10**-13*(r)*1.6*10**-6);# Barrier energy in MeV\n",
+ "print\"\\n The barrier energy in MeV is =\",round(E2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.13;pg no: 103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.13, Page:103 \n",
+ " \n",
+ "\n",
+ "\n",
+ " (a) Excitation energy is =(MeV) 4.93\n",
+ "\n",
+ " Fission is not possible\n",
+ "\n",
+ " (b) Excitation energy is =(MeV) 5.93\n",
+ "\n",
+ " Fission is not possible\n",
+ "\n",
+ " (c) Excitation energy is =(MeV) 13.93\n",
+ "\n",
+ " Fission is possible\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of thickness of Pd foil\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.13, Page:103 \\n \\n\"\n",
+ "# Given:\n",
+ "mTh1=232;\n",
+ "mTh2=233;\n",
+ "ETh1=6.4;# in MeV\n",
+ "ETh2=4.93;# in MeV\n",
+ "E=6.5;# fission barrier energy in MeV\n",
+ "\n",
+ "# Solution: Part(a)\n",
+ "E1=0*mTh1/mTh2;\n",
+ "Ex1=E1+ETh2;\n",
+ "print\"\\n (a) Excitation energy is =(MeV)\",Ex1\n",
+ "if (Ex1>E):\n",
+ "\tprint\"\\n Fission is possible\"\n",
+ "else:\n",
+ "\tprint\"\\n Fission is not possible\"\n",
+ "\n",
+ "# Solution: Part(b)\n",
+ "E2=2*mTh1/mTh2;\n",
+ "Ex2=E2+ETh2;\n",
+ "print\"\\n (b) Excitation energy is =(MeV)\",Ex2\n",
+ "if (Ex2>E):\n",
+ "\tprint\"\\n Fission is possible\"\n",
+ "else:\n",
+ "\tprint\"\\n Fission is not possible\"\n",
+ "\n",
+ "# Solution: Part (c)\n",
+ "E3=10*mTh1/mTh2;\n",
+ "Ex3=E3+ETh2;\n",
+ "print\"\\n (c) Excitation energy is =(MeV)\",Ex3\n",
+ "if (Ex3>E):\n",
+ "\tprint\"\\n Fission is possible\"\n",
+ "else:\n",
+ "\tprint\"\\n Fission is not possible\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.14;pg no: 104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.14, Page:104 \n",
+ " \n",
+ "\n",
+ "The energy for the given fission is =(MeV) 201.9\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of energy for the given fission\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.14, Page:104 \\n \\n\"\n",
+ "\n",
+ "# Given:\n",
+ "\n",
+ "mEs=249.0762;\n",
+ "mn=1.0087;\n",
+ "mGd=160.9286;\n",
+ "mBr=86.922;\n",
+ "\n",
+ "# Solution:\n",
+ "dm=(mEs-(mGd+mBr+mn));# delta m\n",
+ "E=dm*931;# energy of given fission in MeV\n",
+ "print\"The energy for the given fission is =(MeV)\",round(E,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.15;pg no: 104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.15, Page:104 \n",
+ " \n",
+ "\n",
+ "The velocity will be related as and Energy will be related as 6.0 6.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of velocity will be related as and Energy will be related\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.15, Page:104 \\n \\n\"\n",
+ "\n",
+ "# Given:\n",
+ "\n",
+ "m=1./6.;# mass ratio of pair of fission product\n",
+ "\n",
+ "# Solution:\n",
+ "# Velocities as well as energies are in inverse ratio of their masses.\n",
+ "\n",
+ "v=(m)**(-1);# Velocity ratio\n",
+ "e=(m)**(-1);# Energy ratio\n",
+ "print\"The velocity will be related as and Energy will be related as \",v,e"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.16;pg no: 104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.16, Page:104 \n",
+ " \n",
+ "\n",
+ "The no. of fissions produced per second will be = 3.125e+12\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of no. of fissions produced per second\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.16, Page:104 \\n \\n\"\n",
+ "\n",
+ "# Given:\n",
+ "P=100;# in watts\n",
+ "\n",
+ "# Solution:\n",
+ "P1=P*10**7;# in erg/s\n",
+ "P2=P1/(1.6*10**-6);# in MeV/s\n",
+ "# 1 ifssion generates 200 MeV of energy\n",
+ "f=P2/200;# no. of fissions\n",
+ "print\"The no. of fissions produced per second will be =\",f"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.17;pg no: 104"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.17, Page:104 \n",
+ " \n",
+ "\n",
+ "The fission barrier energy is = (MeV) 221.78\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of fission barrier energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.17, Page:104 \\n \\n\"\n",
+ "# Given:\n",
+ "r0=1.4*10**-15;# nuclear radius constant in m\n",
+ "p=8.85*10**-12;# permittivity of free space in J^-1*C^2*m^-1\n",
+ "A=92;\n",
+ "e=1.6*10**-19;\n",
+ "mPd=118;\n",
+ "# Solution:\n",
+ "r=((mPd)**0.33333);\n",
+ "Eb=((A/2)**2)*(e**2)/(2*r0*r*4*3.14*p*1.6*10**-13);\n",
+ "print\"The fission barrier energy is = (MeV)\",round(Eb,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.18;pg no: 105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.18, Page:105 \n",
+ " \n",
+ "\n",
+ "The fission barrier energy is =(MeV) 224.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of fission barrier energy\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.18, Page:105 \\n \\n\"\n",
+ "# Given:\n",
+ "r0=1.37*10**-15;# nuclear radius constant in m\n",
+ "p=8.85*10**-12;# permittivity of free space in J^-1*C^2*m^-1\n",
+ "A=92;\n",
+ "e=1.6*10**-19;\n",
+ "mTe=140;\n",
+ "mZr=95;\n",
+ "# Solution:\n",
+ "r1=((mTe)**0.33333);\n",
+ "r2=((mZr)**0.33333);\n",
+ "Eb=(52*40)*(e**2)/(r0*(r1+r2)*4*3.14*p*1.6*10**-13)\n",
+ "print\"The fission barrier energy is =(MeV)\",round(Eb)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 6.19;pg no: 105"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 6.19, Page:105 \n",
+ " \n",
+ "\n",
+ "The critical deformation energy for the fission is =(MeV) 6.237\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of critical deformation energy for the fission\n",
+ "#intiation of all variables\n",
+ "# Chapter 6\n",
+ "print\"Example 6.19, Page:105 \\n \\n\"\n",
+ "# Given:\n",
+ "A=240.;\n",
+ "Z=94.;\n",
+ "#Solution:\n",
+ "Ecr=(0.89*(A**(2./3.)))-(0.02*(Z*(Z-1.)))/(A**(1./3.));\n",
+ "print\"The critical deformation energy for the fission is =(MeV)\",round(Ecr,3)"
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter7.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter7.ipynb
new file mode 100644
index 00000000..8731741e
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter7.ipynb
@@ -0,0 +1,298 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#chapter 7:nuclear reactions"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.1;pg no: 111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.1, Page:111 \n",
+ " \n",
+ "\n",
+ "The reproduction factor for the reactor is = 1.053\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of reproduction factor for the reactor\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.1, Page:111 \\n \\n\"\n",
+ "# Given:\n",
+ "\n",
+ "f=1.03;# fast fission factor\n",
+ "n=1.32;# no. of fast neutrons generated per thermal radiations\n",
+ "ref=0.89;# resonance escape factor\n",
+ "tuf=0.87;# thermal utilization factor\n",
+ "\n",
+ "# Solution\n",
+ "rf=f*n*ref*tuf;#reproduction factor\n",
+ "print\"The reproduction factor for the reactor is = \",round(rf,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.2;pg no: 111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.2, Page:111 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The approximate critical dimensionsof a Pu 239 in (m)= 4.86\n",
+ "\n",
+ " \n",
+ " The radius of the reactor in (m)= 2.81\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of approximate critical dimensionsof a Pu 239 and radius of the reactor\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.2, Page:111 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "k=1.04;\n",
+ "m=0.032;# in m^2 i.e., migration area M^2\n",
+ "# Solution: (a) Cubical reactor\n",
+ "a=3.14*math.sqrt(3*m/(k-1));\n",
+ "print\"\\n The approximate critical dimensionsof a Pu 239 in (m)=\",round(a,2)\n",
+ "# Solution: (a) Spherical reactor\n",
+ "r=a/math.sqrt(3);\n",
+ "print\"\\n \\n The radius of the reactor in (m)=\",round(r,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.3;pg no: 111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.3, Page:111 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The design parameter for H2O is = 1114.0\n",
+ "\n",
+ " \n",
+ " The design parameter for D2O is = 79042.0\n",
+ "\n",
+ " \n",
+ " The design parameter for C is = 163353.0\n",
+ "Example 7.3, Page:111 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The design parameter for H2O is = 1114.0\n",
+ "\n",
+ " \n",
+ " The design parameter for D2O is = 79042.0\n",
+ "\n",
+ " \n",
+ " The design parameter for C is = 163353.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of design parameter for H2O,D2O,C\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.3, Page:111 \\n \\n\"\n",
+ "# Given:\n",
+ "a1=687; # neutron absorption cross section for U 235 in barns\n",
+ "a2=0.66 # neutron absorption cross section for H2O in barns\n",
+ "a3=0.0093; # neutron absorption cross section for D2O in barns\n",
+ "a4=0.0045; # neutron absorption cross section for C in barns\n",
+ "\n",
+ "#Solution:\n",
+ "\n",
+ "F1=1.07*a1/a2;#design parameter for H2O part(a)\n",
+ "print\"\\n The design parameter for H2O is =\",round(F1)\n",
+ "\n",
+ "F2=1.07*a1/a3;#design parameter for D2O part(b)\n",
+ "print\"\\n \\n The design parameter for D2O is =\",round(F2)\n",
+ "\n",
+ "F3=1.07*a1/a4;#design parameter for C part(c)\n",
+ "print\"\\n \\n The design parameter for C is =\",round(F3)#cal of design parameter for H2O,D2O,C\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.3, Page:111 \\n \\n\"\n",
+ "# Given:\n",
+ "a1=687; # neutron absorption cross section for U 235 in barns\n",
+ "a2=0.66 # neutron absorption cross section for H2O in barns\n",
+ "a3=0.0093; # neutron absorption cross section for D2O in barns\n",
+ "a4=0.0045; # neutron absorption cross section for C in barns\n",
+ "\n",
+ "#Solution:\n",
+ "\n",
+ "F1=1.07*a1/a2;#design parameter for H2O part(a)\n",
+ "print\"\\n The design parameter for H2O is =\",round(F1)\n",
+ "\n",
+ "F2=1.07*a1/a3;#design parameter for D2O part(b)\n",
+ "print\"\\n \\n The design parameter for D2O is =\",round(F2)\n",
+ "\n",
+ "F3=1.07*a1/a4;#design parameter for C part(c)\n",
+ "print\"\\n \\n The design parameter for C is =\",round(F3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.4;pg no: 112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.4, Page:112 \n",
+ " \n",
+ "\n",
+ "The no. of fissions per second are = 3.125e+17\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of no. of fissions per second\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.4, Page:112 \\n \\n\"\n",
+ "# Given:\n",
+ "P=10*10**6; # power in watts\n",
+ "E=200*10**6; # in eV\n",
+ "\n",
+ "# Solution:\n",
+ "e=E*1.6*10**-19;# in joules\n",
+ "# Thus for 1 fission occurs per second, rate of power generation is e\n",
+ "n=(P)/e;# no. of fissions\n",
+ "print\"The no. of fissions per second are =\",n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 7.5;pg no: 112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 7.5, Page:112 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The thermal energy generated is =(J) 153.85\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of thermal energy generated\n",
+ "#intiation of all variables\n",
+ "# Chapter 7\n",
+ "print\"Example 7.5, Page:112 \\n \\n\"\n",
+ "# Given:\n",
+ "density=19;# in g/cc\n",
+ "E1=200*10**6*(1.6*10**-19); # energy released per fission in J\n",
+ "flux1=10**12;# in cm^2/s\n",
+ "a1=590*10**-24;#fission cross-section in cm^2\n",
+ "Na1=6.02*10**23;\n",
+ "\n",
+ "# Solution:\n",
+ "\n",
+ "#Ntgt=volume of target*No.of atoms per cm^3\n",
+ "\n",
+ "Ni=(30*((0.5)**2)*3.14*density*Na1*(0.72*10**-2))/238;\n",
+ "\n",
+ "Np=Ni*a1*flux1;\n",
+ "\n",
+ "E2=E1*Np;# Thermal energy generated in J\n",
+ "\n",
+ "print\"\\n The thermal energy generated is =(J)\",round(E2,2)\n",
+ "# Note: There is discrepancy in answer given in the textbook. After calculations the answer comes out to be 153.850366 "
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter8.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter8.ipynb
new file mode 100644
index 00000000..444ef624
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter8.ipynb
@@ -0,0 +1,398 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#chapter 8:direction and measurment of activity"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 8.1;pg no: 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 8.1, Page:120 \n",
+ " \n",
+ "\n",
+ "The potential signal recorded will be (mV)= 1.33\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of potential signal\n",
+ "#intiation of all variables\n",
+ "# Chapter 8\n",
+ "print\"Example 8.1, Page:120 \\n \\n\"\n",
+ "#Given:\n",
+ "e=1.6*10**-19;# electron charge\n",
+ "C=6*10**-12;# in F\n",
+ "N=10**5;# # electron multiplication\n",
+ "#Solution:\n",
+ "e1=N*e;\n",
+ "v=e1/(2*C);\n",
+ "v1=1000*v;\n",
+ "print\"The potential signal recorded will be (mV)=\",round(v1,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 8.2;pg no: 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 8.2, Page:120 \n",
+ " \n",
+ "\n",
+ "The capacitance that would be required in (nF)= 8.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of capacitance that would be required\n",
+ "#intiation of all variables\n",
+ "# Chapter 8\n",
+ "print\"Example 8.2, Page:120 \\n \\n\"\n",
+ "# Given:\n",
+ "N=10**5;# electron multiplication\n",
+ "v=10**-6;# in V\n",
+ "e=1.6*10**-19;# electron charge\n",
+ "\n",
+ "# Solution:\n",
+ "e1=N*e;\n",
+ "C=e1/(2*v);\n",
+ "C1=C*10**9;\n",
+ "print\"The capacitance that would be required in (nF)=\",C1"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 8.3;pg no: 120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 8.3, Page:120 \n",
+ " \n",
+ "\n",
+ "The alpha coefficient in electrons electron^-1 cm^-1= 4.4\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of alpha coefficient\n",
+ "#intiation of all variables\n",
+ "# Chapter 8\n",
+ "import math\n",
+ "print\"Example 8.3, Page:120 \\n \\n\"\n",
+ "# Given:\n",
+ "n0=1;# initial primary electrons\n",
+ "n=1.6*10**4;\n",
+ "x=2.2; #distance in cm\n",
+ "\n",
+ "# Solution:\n",
+ "a=math.log(n/n0)/(x);\n",
+ "\n",
+ "print\"The alpha coefficient in electrons electron^-1 cm^-1=\",round(a,2)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 8.4;pg no: 121"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 8.4, Page:121 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The potential at the inner surface is = (V) 1600.0\n",
+ "\n",
+ " The field at the inner surface is =(V/cm) 411.8\n",
+ "\n",
+ " \n",
+ " The potential at the outer surface is =(V) 0.0\n",
+ "\n",
+ " The field at the outer surface in (V/cm)= 30.88\n",
+ "\n",
+ " \n",
+ " The potential in mid-way between the cylinder is =(V) 383.482616627\n",
+ "\n",
+ " The field in mid-way between the cylinderis =(V/cm) 57.46\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of potential,field\n",
+ "#intiation of all variables\n",
+ "# Chapter 8\n",
+ "print\"Example 8.4, Page:121 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "V=1600.;# potential across the electrodes\n",
+ "di=3.;# inner diameter\n",
+ "do=40.;# outer diameter\n",
+ "a=1.5;#in mm\n",
+ "A=20.;#in mm\n",
+ "\n",
+ "# Solution:\n",
+ "# Part(a)At the inner surface\n",
+ "r1=1.5;# in mm\n",
+ "V1=V*(math.log(A/r1)/math.log(A/a));\n",
+ "X1=V/(r1*(math.log(A/a)));\n",
+ "print\"\\n The potential at the inner surface is = (V)\",V1\n",
+ "print\"\\n The field at the inner surface is =(V/cm)\",round(X1,2)\n",
+ "# Part(b)At the outer surface\n",
+ "r2=20.;# in mm\n",
+ "V2=V*(math.log(A/r2)/math.log(A/a));\n",
+ "X2=V/(r2*(math.log(A/a)));\n",
+ "print\"\\n \\n The potential at the outer surface is =(V)\",V2\n",
+ "print\"\\n The field at the outer surface in (V/cm)=\",round(X2,2)\n",
+ "# Part(c)In mid-way between the cylinder\n",
+ "r3=(A+a)/2.;# in mm\n",
+ "V3=V*(math.log(A/r3)/math.log(A/a));\n",
+ "X3=V/(r3*(math.log(A/a)));\n",
+ "print\"\\n \\n The potential in mid-way between the cylinder is =(V)\",V3\n",
+ "print\"\\n The field in mid-way between the cylinderis =(V/cm)\",round(X3,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 8.5;pg no: 122"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 8.5, Page:122 \n",
+ " \n",
+ "\n",
+ "The resolving time of the given system in microseconds is = 1711.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of resolving time\n",
+ "#intiation of all variables\n",
+ "# Chapter 8\n",
+ "print\"Example 8.5, Page:122 \\n \\n\"\n",
+ "# Given:\n",
+ "ma1=3600.;# counts in 3 min\n",
+ "mb1=2400.;# counts in 5 min\n",
+ "mab1=9900.;# counts in 6 min\n",
+ "\n",
+ "# Solution:\n",
+ "ma=ma1/3;\n",
+ "mb=mb1/5;\n",
+ "mab=mab1/6;\n",
+ "\n",
+ "t1=(ma+mb-mab)/(mab**2-ma**2-mb**2);\n",
+ "t2=t1*60;# in seconds\n",
+ "t=t2*1000000;# in microseconds\n",
+ "print\"The resolving time of the given system in microseconds is =\",round(t)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 8.6;pg no: 122"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 8.6, Page:122 \n",
+ " \n",
+ "\n",
+ "The resolving time of the given system in microseconds is = 2490.0\n",
+ "\n",
+ " The true count rate of unknown sample in (cpm)= 2868.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of The resolving time,true count rate\n",
+ "#intiation of all variables\n",
+ "# Chapter 8\n",
+ "print\"Example 8.6, Page:122 \\n \\n\"\n",
+ "# Given:\n",
+ "ma1=3321.;# counts in 3 min\n",
+ "mb1=2862.;# counts in 2 min\n",
+ "mab1=4798.;# counts in 2 min\n",
+ "m=1080.;# counts in 30 min\n",
+ "muk1=5126.;# counts in 2 min\n",
+ "# Solution:\n",
+ "ma=ma1/3.;\n",
+ "mb=mb1/2.;\n",
+ "mab=mab1/2.;\n",
+ "mbc=m/30.;\n",
+ "muk=muk1/2.;\n",
+ "t1=(ma+mb-mab-mbc)/(mab**2.-ma**2.-mb**2.);# in min\n",
+ "t2=t1*60.;# in seconds\n",
+ "t=t2*1000000.;# in microseconds\n",
+ "print\"The resolving time of the given system in microseconds is =\",round(t)\n",
+ "n=muk/(1-muk*t1);# true count rate\n",
+ "print\"\\n The true count rate of unknown sample in (cpm)=\",round(n)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 8.7;pg no: 123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 8.7, Page:123 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The resolving time of the given system in microseconds is = 227.74452861\n",
+ "\n",
+ " The counting loss of sample A in (cpm)= 359.0\n",
+ "\n",
+ " The counting loss of sample B in (cpm)= 460.0\n",
+ "\n",
+ " The counting loss of sample AB in (cpm)= 1523.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of counting loss of sample A,B,C\n",
+ "#intiation of all variables\n",
+ "# Chapter 8\n",
+ "print\"Example 8.7, Page:123 \\n \\n\"\n",
+ "# Given:\n",
+ "\n",
+ "ma=9728.;# cpm\n",
+ "mb=11008.;# cpm\n",
+ "mab=20032.;# cpm\n",
+ "\n",
+ "# Solution:\n",
+ "\n",
+ "t1=(ma+mb-mab)/(mab**2-ma**2-mb**2);# in min\n",
+ "\n",
+ "t2=t1*60;# in seconds\n",
+ "t=t2*1000000;# in microseconds\n",
+ "print\"\\n The resolving time of the given system in microseconds is =\",t\n",
+ "\n",
+ "#From true count rate equation we have, n=muk/(1-muk*t).\n",
+ "# This implies, n-m=m^2*t where n-m corresponds to counting loss\n",
+ "na=ma**2*t1;# For sample A\n",
+ "nb=mb**2*t1;# For sample B\n",
+ "nab=mab**2*t1;# For sample AB\n",
+ "print\"\\n The counting loss of sample A in (cpm)=\",round(na)\n",
+ "print\"\\n The counting loss of sample B in (cpm)=\",round(nb)\n",
+ "print\"\\n The counting loss of sample AB in (cpm)=\",round(nab)\n",
+ "# NOTE: The resolving time of the given system in microseconds is give 222.7. This is a calculation error in the textbook."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter9.ipynb b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter9.ipynb
new file mode 100644
index 00000000..ae812b40
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/chapter9.ipynb
@@ -0,0 +1,356 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#chapter 9:isotopes for nuclear reactions"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.1;pg no: 126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.1, Page:126 \n",
+ " \n",
+ "\n",
+ "The value of numerical constant is = 0.0373\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of value of numerical constant\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.1, Page:126 \\n \\n\"\n",
+ "#Give:\n",
+ "t=3600.;# in seconds\n",
+ "F=96500.;# in columbs\n",
+ "# Formula: m=0.0373fMit, Faraday's law: m=(itE)/F\n",
+ "#Solution:\n",
+ "constant=t/F;\n",
+ "print\"The value of numerical constant is =\",round(constant,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.2;pg no: 126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.2, Page:126 \n",
+ " \n",
+ "\n",
+ "The ion current should be in (mA)= 0.4167\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of ion current\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.2, Page:126 \\n \\n\"\n",
+ "# Given:\n",
+ "m1=24*10**-6;# g per day\n",
+ "m2=10**-2;# g per day\n",
+ "i1=10**-6;# in A\n",
+ "#Formula: i1*m2=m1*i2\n",
+ "#Solution:\n",
+ "i2=(i1*m2)/m1;\n",
+ "i=i2/10**-3;# in mA\n",
+ "print\"The ion current should be in (mA)=\",round(i,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.3;pg no: 126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.3, Page:126 \n",
+ " \n",
+ "\n",
+ "The net yield is = 6.0337\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of net yield\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.3, Page:126 \\n \\n\"\n",
+ "#Given:\n",
+ "f=1.0014;# seperation factor\n",
+ "s=4;# series\n",
+ "p=6;# parallel\n",
+ "# Note: The global yield for s stages in series is(f)^s and each parallel stages simply multiplies the yield of the stage, Hence overall yield with p parallel stages (each with s stages in series) will be Y=p*(f)^s\n",
+ "#Solution:\n",
+ "Y=p*(f)**s;\n",
+ "print\"The net yield is =\",round(Y,4)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.4;pg no: 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.14, Page:127 \n",
+ " \n",
+ "\n",
+ "\n",
+ " The no. of stages will be = 1130.0\n",
+ "\n",
+ " The no. of stages will be = 3451.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of no. of stages\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.14, Page:127 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "f=1.0014;# seperation factor\n",
+ "#Solution: Part (a)\n",
+ "A1=3.5/0.72;# total enrichment\n",
+ "n1=math.log(A1)/math.log(f);\n",
+ "print\"\\n The no. of stages will be = \",round(n1)\n",
+ "\n",
+ "#Solution: Part (b)\n",
+ "A2=90/0.72;# total enrichment\n",
+ "n2=math.log(A2)/math.log(f);\n",
+ "print\"\\n The no. of stages will be =\",round(n2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.5;pg no: 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.5, Page:127 \n",
+ " \n",
+ "\n",
+ "The overall seperation factor is = 1.105\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of overall seperation factor\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.5, Page:127 \\n \\n\"\n",
+ "# Given:\n",
+ "f=1.01;# seperation factor\n",
+ "n=10;# plates\n",
+ "#Solution: \n",
+ "A=f**n;\n",
+ "print\"The overall seperation factor is =\",round(A,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.6;pg no: 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.6, Page:127 \n",
+ " \n",
+ "\n",
+ "The overall seperation factor is = 1.173\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of overall seperation factor\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.6, Page:127 \\n \\n\"\n",
+ "# Given:\n",
+ "f=1.01;# seperation factor\n",
+ "n=16;# plates\n",
+ "#Solution: \n",
+ "A=f**n;\n",
+ "print\"The overall seperation factor is =\",round(A,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.7;pg no: 128"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.7, Page:128 \n",
+ " \n",
+ "\n",
+ "The enthalpy for the exchange reaction in (J)= 4829.008\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of enthalpy for the exchange reaction\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.7, Page:128 \\n \\n\"\n",
+ "# Given:\n",
+ "import math\n",
+ "k1=3.78;\n",
+ "k2=2.79;\n",
+ "t1=298.;# in K\n",
+ "t2=353.;# in K\n",
+ "R=8.314# Gas constant\n",
+ "# Formula: log(k1/k2)=(H/R)*((t2-t1)t1*t2)\n",
+ "# Solution:\n",
+ "H=R*math.log(k1/k2)/((t2-t1)/(t1*t2));\n",
+ "print\"The enthalpy for the exchange reaction in (J)=\",round(H,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##example 9.8;pg no: 128"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Example 9.8, Page:128 \n",
+ " \n",
+ "\n",
+ "The single stage seperation factor is = 2.67\n"
+ ]
+ }
+ ],
+ "source": [
+ "#cal of single stage seperation factor\n",
+ "#intiation of all variables\n",
+ "# Chapter 9\n",
+ "print\"Example 9.8, Page:128 \\n \\n\"\n",
+ "# Given:\n",
+ "a1=0.015;\n",
+ "a2=0.04;\n",
+ "# Solution: Defining the seperation factor f as approximately equal to (a2/a1) where a1, a2 are the relative abundances of the isotope of interest in the initial and final fractions, we have\n",
+ "f=(a2/a1);\n",
+ "print\"The single stage seperation factor is = \",round(f,2)"
+ ]
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(56).png b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(56).png
new file mode 100644
index 00000000..d9f1e926
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(56).png
Binary files differ
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(57).png b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(57).png
new file mode 100644
index 00000000..8c463815
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(57).png
Binary files differ
diff --git a/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(58).png b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(58).png
new file mode 100644
index 00000000..8b4f087e
--- /dev/null
+++ b/_Nuclear_Chemistry_through_Problems_by__H._J._Arnikar_and_N._S._Rajurkar/screenshots/Screenshot_(58).png
Binary files differ
diff --git a/sample_notebooks/VarunSakpal/chapter_2.ipynb b/sample_notebooks/VarunSakpal/chapter_2.ipynb
new file mode 100644
index 00000000..0a847bfb
--- /dev/null
+++ b/sample_notebooks/VarunSakpal/chapter_2.ipynb
@@ -0,0 +1,600 @@
+{
+ "metadata": {
+ "name": "chapter 2.ipynb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2: Fundamental Parameters of Antennas"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.1, Page 37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from scipy.integrate import quad,dblquad\n",
+ "\n",
+ "#formula for beam solid angle theta_a=double_integration of d_omega\n",
+ "theta_a=quad(lambda x:1,0,2*pi)[0]*quad(lambda x:sin(x),0,pi/6)[0]\n",
+ "print 'Exact Beam Solid Angle:',theta_a,'steradians'\n",
+ "\n",
+ "#formula for approx angle=delta1*delta2\n",
+ "delta1=pi/3\n",
+ "delta2=pi/3\n",
+ "theta_a1=delta1*delta2\n",
+ "theta_a1=delta1**2\n",
+ "print 'Approximate Beam Solid Angle:',theta_a1,'steradians'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Exact Beam Solid Angle: 0.841787214477 steradians\n",
+ "Approximate Beam Solid Angle: 1.09662271123 steradians\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.7, Page 52"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "#The half power point of the pattern occurs at 60 degrees. Therefore theta_1r=2*pi/3\n",
+ "theta_1r=(2*pi)/3\n",
+ "theta_2r=(2*pi)/3\n",
+ "\n",
+ "#Given U=B0*cos(theta)\n",
+ "exact_theta_a=dblquad(lambda x,y:cos(x)*sin(x), 0, (2*pi), lambda x:0, lambda x:(pi/2))\n",
+ "print 'Exact Beam Solid Angle:',exact_theta_a[0],'steradians'\n",
+ "\n",
+ "#Formula for approx theta = theta_1r*theta_2r\n",
+ "approx_theta_a=theta_1r*theta_2r\n",
+ "print 'Approximate Beam Solid Angle:',approx_theta_a,'steradians'\n",
+ "\n",
+ "#formula for exact directivity=4*pi/exact_beam_angle\n",
+ "exact_direct=((4*pi)/(exact_theta_a[0]))\n",
+ "\n",
+ "#formula for approx directivity=4*pi/approx_beam_angle\n",
+ "approx_direct=((4*pi)/(approx_theta_a))\n",
+ "\n",
+ "#exact directivity in dB\n",
+ "exact_direct_db=10*log10(exact_direct)\n",
+ "\n",
+ "#approx directivity in dB\n",
+ "approx_direct_db=10*log10(approx_direct)\n",
+ "\n",
+ "print 'Exact directivity:',exact_direct_db,'dB'\n",
+ "print 'Approx. directivity:',approx_direct_db,'dB'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Exact Beam Solid Angle: 3.14159265359 steradians\n",
+ "Approximate Beam Solid Angle: 4.38649084493 steradians\n",
+ "Exact directivity: 6.02059991328 dB\n",
+ "Approx. directivity: 4.57092636745 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.8, Page 58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "#Maximum intensity\n",
+ "u_max=1\n",
+ "\n",
+ "#Calculation of radiated power\n",
+ "p_rad=dblquad(lambda x,y:(sin(x)**2)*sin(x),0,2*pi,lambda x:0,lambda x:pi)\n",
+ "print 'Radiated Power:',p_rad[0],'W'\n",
+ "\n",
+ "#Calulation of maximum directivity\n",
+ "D0=(4*pi)/(p_rad[0])\n",
+ "\n",
+ "#Directivity in dB\n",
+ "D0_db=10*log10(D0)\n",
+ "print 'Directivity:',D0_db,'dB'\n",
+ "\n",
+ "deg=90\n",
+ "\n",
+ "#Calculation od directivity\n",
+ "D0_1=101/(deg-0.0027*deg**2)\n",
+ "D0_1_db=10*log10(D0_1)\n",
+ "print 'Directivity:',D0_1_db,'dB'\n",
+ "\n",
+ "#Calculation of directivity\n",
+ "D0_2=(-172.4)+(191*sqrt((0.818+(1/deg))))\n",
+ "D0_2_db=10*log10(D0_2)\n",
+ "print 'Directivity:',D0_2,'dB'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Radiated Power: 8.37758040957 W\n",
+ "Directivity: 1.76091259056 dB\n",
+ "Directivity: 1.70982984843 dB\n",
+ "Directivity: 0.346803154212 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.9(a), Page 61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "B0=1\n",
+ "#Maximum intensity\n",
+ "u_max=1\n",
+ "\n",
+ "#Array containing angles in radians\n",
+ "a=sin(array([10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180])*pi/180)**2\n",
+ "\n",
+ "#Calculation of radiated power\n",
+ "p_rad1=B0*((pi/18)**2)*sum(a)*sum(a)\n",
+ "print 'Power Radiated:',p_rad1,'W'\n",
+ "\n",
+ "#Calculation of directivity\n",
+ "D0=(4*pi)/(p_rad1)\n",
+ "\n",
+ "print 'Directivity using numerical techniques:',D0\n",
+ "\n",
+ "#Calu=culation of radiated power\n",
+ "a=quad(lambda x:sin(x)**2,0,pi)\n",
+ "b=quad(lambda x:sin(x)**2,0,pi)\n",
+ "p_rad2=a[0]*b[0]\n",
+ "\n",
+ "#Directivity\n",
+ "D01=(4*pi)/(p_rad2)\n",
+ "\n",
+ "print 'Directivity:',D01"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power Radiated: 2.46740110027 W\n",
+ "Directivity using numerical techniques: 5.09295817894\n",
+ "Directivity: 5.09295817894\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.9(b), Page 63"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "\n",
+ "B0=1\n",
+ "\n",
+ "#Maximum intensity\n",
+ "u_max=1\n",
+ "\n",
+ "#Arrays containing angles in radians\n",
+ "a=sin(array([5,15,25,35,45,55,65,75,85])*pi/180)**2\n",
+ "b=sin(array([5,15,25,35,45,55,65,75,85])*pi/180)**2\n",
+ "\n",
+ "#Calculation of radiated power\n",
+ "p_rad=B0*((pi/18)**2)*(2*sum(a))*(2*sum(b))\n",
+ "\n",
+ "#Calculation of directivity\n",
+ "D0=(4*pi*u_max)/(p_rad)\n",
+ "\n",
+ "print 'Directivity using 18 divisions:',D0"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Directivity using 18 divisions: 5.09295817894\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10, Page 68"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "#maximum intensuty\n",
+ "u_max=1\n",
+ "B0=1\n",
+ "\n",
+ "#Input impedance in Ohms\n",
+ "inp_imp=73\n",
+ "#Characteristic impedance in Ohms\n",
+ "char_imp=50\n",
+ "\n",
+ "#Calculation of radiated power\n",
+ "p_rad=B0*quad(lambda x:1,0,2*pi)[0]*quad(lambda x:sin(x)**4,0,pi)[0]\n",
+ "\n",
+ "#Calulation of directivity\n",
+ "D0=(4*pi*u_max)/(p_rad)\n",
+ "\n",
+ "#conduction & dielectric efficiency ecd=1 since antenna is loseless\n",
+ "ecd=1\n",
+ "\n",
+ "#Maximum Gain\n",
+ "G0=ecd*D0\n",
+ "G0_db=10*log10(G0)\n",
+ "\n",
+ "#Reflection Coefficient Tau\n",
+ "tau=float(inp_imp-char_imp)/float(inp_imp+char_imp)\n",
+ "\n",
+ "#Reflection efficiency=1-tau**2\n",
+ "er=1-tau**2\n",
+ "er_db=10*log10(er)\n",
+ "\n",
+ "#Total efficiency\n",
+ "e0=er*ecd\n",
+ "e0_db=10*log10(e0)\n",
+ "\n",
+ "#Absolute Gain\n",
+ "G0_abs=e0*D0\n",
+ "G0abs_db=10*log10(G0_abs)\n",
+ "\n",
+ "print 'Maximum Gain:',G0_db\n",
+ "\n",
+ "print 'Reflection efficiency:',er_db\n",
+ "\n",
+ "print 'Total efficiency:',e0_db\n",
+ "\n",
+ "print 'Absolute Gain:',G0abs_db"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum Gain: 2.29848855242\n",
+ "Reflection efficiency: -0.154573670944\n",
+ "Total efficiency: -0.154573670944\n",
+ "Absolute Gain: 2.14391488148\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.11, Page 77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "#unit vector of the wave\n",
+ "rho_w=array([1,0])\n",
+ "\n",
+ "#unit vector of the electric field\n",
+ "rho_a=array([1/sqrt(2),1/sqrt(2)])\n",
+ "\n",
+ "#Polarization factor\n",
+ "PLF=abs(dot(rho_w,rho_a))**2\n",
+ "print 'Polarization Factor:',PLF"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.5\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.12, Page 78"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "#unit vector of the wave\n",
+ "rho_w=array([1/sqrt(2),1/sqrt(2)])\n",
+ "\n",
+ "#unit vector of the electric field\n",
+ "rho_a=array([1/sqrt(2),-1/sqrt(2)])\n",
+ "\n",
+ "#Polarization Factor\n",
+ "PLF=abs(dot(rho_w,rho_a))**2\n",
+ "\n",
+ "print 'Polarization Factor:',PLF"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "0.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 57
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.13, Page 86"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "#Radiation Resistance\n",
+ "rad_res=73\n",
+ "\n",
+ "#Frequency of antenna\n",
+ "f=10**8\n",
+ "\n",
+ "#Velocity\n",
+ "v=3*10**8\n",
+ "\n",
+ "#Wavelength\n",
+ "lamda=v/f\n",
+ "\n",
+ "#Length of antenna\n",
+ "l=lamda/2\n",
+ "\n",
+ "#Perimeter of the antenna\n",
+ "b=(3*10**-4)*lamda\n",
+ "C=2*pi*b\n",
+ "\n",
+ "#value of omega\n",
+ "w=2*pi*f\n",
+ "\n",
+ "#Constant\n",
+ "mu0=4*pi*10**-7\n",
+ "\n",
+ "#Conductivity\n",
+ "sigma=5.7*10**7\n",
+ "\n",
+ "#High frequency resistance\n",
+ "Rhf=(l/C)*(sqrt((w*mu0)/(2*sigma)))\n",
+ "\n",
+ "#Load resistance\n",
+ "Rl=Rhf/2\n",
+ "\n",
+ "#calculation of conduction & dielectric efficiency\n",
+ "ecd=(rad_res)/(rad_res+Rl)\n",
+ "ecd_db=10*log10(ecd)\n",
+ "\n",
+ "print 'Conduction-dielectric efficiency:',ecd_db"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Conduction-dielectric efficiency: -0.0138216614754\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.16, Page 98 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "lamda=1\n",
+ "\n",
+ "#Maximum directivity of transmitter\n",
+ "D0_t_db=16\n",
+ "D0_t=10**(float(D0_t_db)/10)\n",
+ "\n",
+ "#Maximum directivity of receiver\n",
+ "D0_r_db=20\n",
+ "D0_r=10**(D0_r_db/10)\n",
+ "\n",
+ "#Reflection coeficients of transmitter and receiver\n",
+ "tau_r=0.1\n",
+ "tau_t=0.2\n",
+ "\n",
+ "#Power at transmitter\n",
+ "P_t=2\n",
+ "\n",
+ "#Calculation of Power to the receiver\n",
+ "P_r=(1-tau_r**2)*(1-tau_t**2)*((lamda/(4*pi*100*lamda))**2)*D0_t*D0_r*P_t\n",
+ "print 'Power delivered to the load of receiver:',P_r,'W'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Power delivered to the load of receiver: 0.00479199874075 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.18, Page 108"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import scipy\n",
+ "\n",
+ "#antenna temp at receiver terminals\n",
+ "Ta=150\n",
+ "\n",
+ "#physical temp of transmission line\n",
+ "T0=300\n",
+ "\n",
+ "#thermal efficiency of the antennna\n",
+ "eA=0.99\n",
+ "\n",
+ "#antenna physical temperature\n",
+ "Tp=300\n",
+ "l=1\n",
+ "\n",
+ "#antenna temp at antenna terminals due to physical temperature\n",
+ "T_ap=Tp*(1/eA-1)\n",
+ "\n",
+ "#Loss of waveguide in dB/m\n",
+ "alpha_db=0.13\n",
+ "\n",
+ "#Loss of waveguide in Np/m\n",
+ "alpha_np=alpha_db/0.868\n",
+ "\n",
+ "#Calulation of effective temperature\n",
+ "T_A=Ta*exp(-l*alpha_np*2)+T_ap*exp(-l*alpha_np*2)+T0*(1-exp(-l*alpha_np*2))\n",
+ "print 'Effective temperature:',T_A,'K'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Effective temperature: 191.071984919 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file