summaryrefslogtreecommitdiff
path: root/Principles_of_physics/chapter2.ipynb
blob: 74df1c9c48fda6cb6ad927824a23115e268ed181 (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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
{
 "metadata": {
  "name": "",
  "signature": "sha256:1378ee9b7b5e64639ff100ad2dca16b71e72eadb106daabd3ad20e87834e8b65"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 Work, Energy and Power"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1 Page no 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "F=(6,2)                                          #Constant force in vector form 6i+2j in N\n",
      "s=(3,5)                                          #Displacement in vector form 3i+5j in N\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "W=(F[0]*s[0])+(F[1]*s[1])\n",
      "q=math.acos(W/(math.sqrt(F[0]**2+F[1]**2)*math.sqrt(s[0]**2+s[1]**2)))*180/3.14\n",
      "\n",
      "#Output\n",
      "print\"Workdone by the force is \",W,\"J\" \n",
      "print\"Angle between Force and displacement is \",round(q,1),\"degrees\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Workdone by the force is  28 J\n",
        "Angle between Force and displacement is  40.6 degrees\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2 Page no 26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "m=10                                       #Mass of block in kg\n",
      "q=40                                       #Angle made by the force with horizontal in degrees\n",
      "s=5                                        #Horizontal displacement of the block in m\n",
      "u=0.3                                      #Coefficient of kinematic friction \n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "F=(u*m*9.8)/(math.cos(q*3.14/180.0)+(u*math.sin(q*3.14/180.0)))\n",
      "W=(F*math.cos(q*3.14/180.0))*s\n",
      "\n",
      "#Output\n",
      "print\"Workdone by the pulling force is \",round(W,1),\"J\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Workdone by the pulling force is  117.5 J\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3 Page no 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#plot\n",
      "import matplotlib.pyplot as plt\n",
      "fig = plt.figure()\n",
      "x=[0,1,2,3,4,5]\n",
      "F=[0,6,6,12,12,0]\n",
      "xlabel(\"x  (m)\") \n",
      "ylabel(\"F  (N)\") \n",
      "plt.xlim((0,5))\n",
      "plt.ylim((0,14))\n",
      "a=plot(x,F)\n",
      "show(a)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "metadata": {},
       "output_type": "display_data",
       "png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEPCAYAAACukxSbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAFnRJREFUeJzt3XuQXGWZx/FvyAQEE6WAKoMSHMFFQJSLGwtXLr0gLlBI\nqoBaGOSysZYCyl1ZUUTWRQbXFSTcLEGhhCAxIbIiK6ALYjQNJCgSTQKBoJiSbEKUuAS5lAuBZPaP\ntyfTmXRmuqf7nPc9fb6fqql0Znqmn+oKD2eec57zA0mSJEmSJEmSJEmSJEmSJBXYTOA54PEGX/sM\nsBHYKdeKJKnktsnwZ98CHN3g81OAo4CVGb62JCmCXrY80v8e8H7g93ikL0m5yvJIv5FpwGrgsZxf\nV5IE9OT4WjsA/0oY7Qwal+PrS1Lp5dn09ySMe5bW/r4b8Cvgg8DazZ64554DK1asyLE0SeoKK4B3\nj/SEPMc7jwNvA95V+1gNHMSwhg+wYsUKBgYG/BgY4JJLLoleQyofvhe+F74XI38QDq5HlGXTnws8\nDOwFrAKmD/v6QIavLUlqIMvxTt8oX98jw9eWJDWQ99U7alGlUoldQjJ8L4b4XgzxvWhNqlfPDNTm\nU5KkJo0bNw5G6ese6UtSidj0JalEbPqSVCI2fUkqEZu+JJWITV+SSsSmL0klYtOXpBKx6UtSidj0\nJalEbPqSVCI2fUkqEZu+JJWITV+SSsSmL0klYtOXpBKx6UtSidj0JalEbPqSVCI2fUkqEZu+JJVI\n1k1/JvAc8Hjd52YAy4GlwJ3AWzOuQZJUk3XTvwU4etjn7gfeC+wP/Ba4KOMaJEk1WTf9h4AXhn3u\nJ8DG2uNHgN0yrkGSVNMT+fU/AcyNXINUOG+8EbuCdIwfD+PGxa6iOGI2/S8A64HbG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II40lhF/nFzN0G4+yeR/wa8J7\n8Rhhpl12h+PVO+8i/JtYQrisucy9U5IkSZIkSZIkSZIkSZIkSVKxzGNoCaYZxwMXZ1SLJClDRwDX\nt/g94wgLMxM6X47UutTuvSPlZSqwFNiOsLa+DNh3lO85Fbir9riXEPZzC2GDfA5h7X0h8Nvaz4dw\nE8GfU6CVeEnqVv8OzACuo7mUtuUMhVT0EjIf3ks4ml8E3Fz72vGEG14Nmg58tf1yJUntmEA42v8F\nzd2e98W6x72EI/pBtwJ9tcd7EO4PNOjvgNvHXKXUQY53VGa7EEY7Ewl3rGzVa3WPNwLr6x731H1t\nG8yKUCJs+iqzG4F/A26jufHLGmDnMbzOrsDKMXyf1HE2fZXVGYQj9e8ClxNOvFZG+Z4FbB5YMvzo\nfWArjz9IuO+9JKlAKsA3W/yewTzbntGeKOXBI32peVXgr2htOes4Qq7vG1kUJEmSJEmSJEmSJEmS\nJEmSJCk5/w8BWpyAvuV2cgAAAABJRU5ErkJggg==\n",
       "text": [
        "<matplotlib.figure.Figure at 0x883ac30>"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4 Page no 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "m=0.05                                                 #Mass of the body in kg\n",
      "v=(3,5)                                                #Velocity in vector form 3i+4j in m/s\n",
      "\n",
      "#Calculations\n",
      "ke=(1/2.0)*m*(v[0]**2+v[1]**2)\n",
      "\n",
      "#Output\n",
      "print\"Kinetic energy is \",ke,\"J\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Kinetic energy is  0.85 J\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.5 Page no 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "k=50                                  #Spring force constant in N/m\n",
      "x=-0.02                               #Length of compression in m\n",
      "\n",
      "#Calculations\n",
      "W=(1/2.0)*k*(x)**2\n",
      "\n",
      "#Output\n",
      "print\"Work done by the spring when the block comes from the compressed position to the equilibrium position is \",W,\"J\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done by the spring when the block comes from the compressed position to the equilibrium position is  0.01 J\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.6 Page no 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "x=0.03                                                 #Length stretched by the spring in m\n",
      "m=0.25                                                 #Mass of the body in kg\n",
      "\n",
      "#Calculations\n",
      "k=(m*9.8)/x\n",
      "\n",
      "#Output\n",
      "print\"Force constant of the spring is \",round(k,3),\"N/m\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Force constant of the spring is  81.667 N/m\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.7 Page no 27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "m=5                                              #Mass of block in kg\n",
      "F=20                                             #Constant force in N\n",
      "x=6                                              #Distance moved by the block in m\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "W=(F*x)\n",
      "v=math.sqrt((2*W)/m)\n",
      "\n",
      "#Output\n",
      "print\"Speed of the block when it moves through a distance of \",x,\"m is\",round(v,2),\"m/s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of the block when it moves through a distance of  6 m is 6.93 m/s\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.8 Page no 28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "m=50                                     #Mass of the object in kg\n",
      "v=8                                      #Speed in m/s\n",
      "t=4                                      #Time taken in s\n",
      "\n",
      "#Calculations\n",
      "a=(v-0)/t\n",
      "s=(v**2/(2.0*a))\n",
      "W=(m*a*s)\n",
      "P=(W/t)\n",
      "\n",
      "#Output\n",
      "print\"Workdone on the object is \",W,\"J\" \n",
      "print\"The average power delivered by the force in the first \",t,\"s is \",P,\"watt\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Workdone on the object is  1600.0 J\n",
        "The average power delivered by the force in the first  4 s is  400.0 watt\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}