1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 1: Bonding in Solids"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example number 1, Page number 1.21"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-2*a/r**3 + 90*b/r**11\n"
]
}
],
"source": [
"#importing modules\n",
"import math\n",
"from __future__ import division\n",
"from sympy import diff,Symbol\n",
"import numpy as np\n",
"\n",
"#Variable declaration\n",
"n=1;\n",
"m=9;\n",
"a=Symbol('a')\n",
"b=Symbol('b')\n",
"r=Symbol('r')\n",
"\n",
"#Calculation\n",
"y=(-a/(r**n))+(b/(r**m));\n",
"y=diff(y,r);\n",
"y=diff(y,r);\n",
"\n",
"#Result\n",
"print y"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"young's modulus is 157 GPa\n"
]
}
],
"source": [
"#since the values of a,b,r are declared as symbols in the above cell, it cannot be solved there. hence it is being solved here with the given variable declaration\n",
"#importing modules\n",
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"a=7.68*10**-29; \n",
"r0=2.5*10**-10; #radius(m)\n",
"\n",
"#Calculation\n",
"b=a*(r0**8)/9;\n",
"y=((-2*a*r0**8)+(90*b))/r0**11; \n",
"E=y/r0; #young's modulus(Pa)\n",
"\n",
"#Result\n",
"print \"young's modulus is\",int(E/10**9),\"GPa\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example number 2, Page number 1.22"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"effective charge is 0.72 *10**-19 coulomb\n",
"answer given in the book is wrong\n"
]
}
],
"source": [
"#importing modules\n",
"import math\n",
"from __future__ import division\n",
"\n",
"#Variable declaration\n",
"dm=1.98*10**-29/3; #dipole moment\n",
"l=0.92*10**-10; #bond length(m)\n",
"\n",
"#Calculation\n",
"ec=dm/l; #effective charge(coulomb)\n",
"\n",
"#Result\n",
"print \"effective charge is\",round(ec*10**19,2),\"*10**-19 coulomb\"\n",
"print \"answer given in the book is wrong\""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.11"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|