summaryrefslogtreecommitdiff
path: root/sample_notebooks/NityaL/Sample.ipynb
blob: c7730277686f3d7613e143eb39241e61bbc3aa2a (plain)
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 26:CHARGE AND MATTER"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "##Example 26.1 Magnitude of total charges in a copper penny"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Magnitude of the charges in coulombs is  133687.50000000003\n"
     ]
    }
   ],
   "source": [
    "#Example 1.1\n",
    "\n",
    "m =3.1 #mass of copper penny in grams\n",
    "e =4.6*10** -18 #charge in coulombs\n",
    "N0 =6*10**23 #avogadro’s number atoms / mole\n",
    "M =64  #molecular weight of copper in gm/ mole\n",
    "\n",
    "#Calculation\n",
    "N =( N0 * m ) / M  #No. of copper atoms in penny\n",
    "q = N * e  # magnitude of the charges in coulombs\n",
    "print (\" Magnitude of the charges in coulomb is \",q )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "##Example 26.2 Separation between total positive and negative charges"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Separation between total positive and negative charges in meters is  5813776741.499454\n"
     ]
    }
   ],
   "source": [
    "#Example 2\n",
    "\n",
    "import math\n",
    "\n",
    "F =4.5 #Force of attraction in nt\n",
    "q =1.3*10**5 #total charge in coulomb\n",
    "r = q * math.sqrt ((9*10**9) / F ) ;\n",
    "print(\" Separation between total positive and negative charges in meters is \",r )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "##Example 26.3 Force acting on charge q1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "X component of resultant force acting on q1 in nt is 2.0999999999999996\n",
      "Y component of resultant force acting on q1 in nt is -1.5588457268119893\n"
     ]
    }
   ],
   "source": [
    "#Example 3\n",
    "\n",
    "import math\n",
    "\n",
    "#given three charges q1,q2,q3\n",
    "q1=-1.0*10**-6 #charge in coul\n",
    "q2=+3.0*10**-6 #charge in coul\n",
    "q3=-2.0*10**-6 #charge in coul\n",
    "r12=15*10**-2 #separation between q1 and q2 in m\n",
    "r13=10*10**-2 # separation between q1 and q3 in m\n",
    "angle=math.pi/6 #in degrees\n",
    "F12=(9.0*10**9)*q1*q2/(r12**2) #in nt\n",
    "F13=(9.0*10**9)*q1*q3/(r13**2) #in nt\n",
    "F12x=-F12  #ignoring signs of charges\n",
    "F13x=F13*math.sin(angle);\n",
    "F1x=F12x+F13x\n",
    "F12y=0 #from fig.263\n",
    "F13y=-F13*math.cos(angle);\n",
    "F1y=F12y+F13y #in nt\n",
    "print(\"X component of resultant force acting on q1 in nt is\",F1x)\n",
    "print(\"Y component of resultant force acting on q1 in nt is\",F1y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "##Example 26.4 Electrical and Gravitational force between two particles"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Coulomb force in nt is 8.202207191171238e-08\n",
      "Gravitational force in nt is 3.689889640441438e-47\n"
     ]
    }
   ],
   "source": [
    "#Example 4\n",
    "\n",
    "r=5.3*10**-11 #distance between electron and proton in the hydrogen atom in meter\n",
    "e=1.6*10**-19 #charge in coul\n",
    "G=6.7*10**-11 #gravitatinal constant in nt-m2/kg2\n",
    "m1=9.1*10**-31 #mass of electron in kg\n",
    "m2=1.7*10**-27 #mass of proton in kg\n",
    "F1=(9*10**9)*e*e/(r**2) #coulomb's law\n",
    "F2=G*m1*m2/(r**2) #gravitational force\n",
    "print(\"Coulomb force in nt is\",F1)\n",
    "print(\"Gravitational force in nt is\",F2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "##Example 26.5 Repulsive force between two protons in a nucleus of iron"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Repulsive coulomb force F  14.4 nt\n"
     ]
    }
   ],
   "source": [
    "#Example 5\n",
    "\n",
    "r=4*10**-15 #separation between proton annd nucleus in iron in meters\n",
    "q=1.6*10**-19 #charge in coul\n",
    "F=(9*10**9)*(q**2)/(r**2) #coulomb's law\n",
    "print(\"Repulsive coulomb force F \",F,'nt')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}