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
|
{
"metadata": {
"name": "",
"signature": "sha256:70a6c85604d1bf040682390393f1b3040cc3d95dac3089997f6535e7c7e77e35"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 01: Vectors and their use"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.1:pg-25"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" #Example 1_1\n",
" \n",
"import math \n",
" #To add the given Displacements Graphically\n",
"d1=25 #units in cm\n",
"d2=10 #units in cm\n",
"d3=30 #units in cm\n",
"R=math.sqrt(d1**2+d2**2+d3**2) #units in cm\n",
"theta1=30 #units in degrees\n",
"theta2=90 #units in degrees\n",
"theta3=120 #units in degrees\n",
"theta=360-(theta1+theta2+theta3) #units in degrees\n",
"print \"The Resultant R=\",round(R,2),\" cm\\n\"\n",
"print \"Theta=\",round(theta),\" degrees\"\n",
" #In text book the answer is printed wrong as R=49cm and theta=82 degrees but the correct answer is R=40.31cm and theta=120 degrees\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The Resultant R= 40.31 cm\n",
"\n",
"Theta= 120.0 degrees\n"
]
}
],
"prompt_number": 21
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.2:pg-25"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" #Example 1_2\n",
"\n",
"import math\n",
" \n",
" # To add the given vector displacements\n",
"a=1 #units in meters\n",
"b=3 #units in meters\n",
"c=5 #units in meters\n",
"d=6 #units in meters\n",
"theta1=90 #units in degrees\n",
"Rx_a=a*math.sin(theta1*math.pi/180) #units in meters\n",
"Rx_b=round(b*math.cos(theta1*math.pi/180)) #units in meters\n",
"theta2=37 #units in degrees\n",
"Rx_c=-round(c*math.cos(theta2*math.pi/180)) #units in meters\n",
"theta3=53 #units in degrees\n",
"Rx_d=-d*math.cos(theta3*math.pi/180)\n",
"Ry_a=round(a*math.cos(theta1*math.pi/180)) #units in meters\n",
"Ry_b=round(c*math.sin(theta2*math.pi/180)) #units in meters\n",
"Ry_c=round(c*math.sin(theta2*math.pi/180)) #units in meters\n",
"Ry_d=-(d*math.sin(theta3*math.pi/180)) #units in meters\n",
"Rx=Rx_a+Rx_b+Rx_c+Rx_d #units in meters\n",
"Ry=Ry_a+Ry_b+Ry_c+Ry_d #units in meters\n",
"R=sqrt(Rx**2+Ry**2) #units in meters\n",
"phi=round(math.atan(Ry/-(Rx))*180/math.pi) #units in degrees\n",
"phi=180-phi #units in degrees\n",
"print \"The Resultant R=\",round(R,2),\" Meters\\n\"\n",
"print \"The Angle theta=\",round(phi),\" degrees\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The Resultant R= 6.72 Meters\n",
"\n",
"The Angle theta= 170.0 degrees\n"
]
}
],
"prompt_number": 20
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.3:pg-26"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" #Example 1_3\n",
"\n",
"import math\n",
" #To subtract vector B from Vector A\n",
"Ax=8.7 #units in meters\n",
"Ay=5 #units in meters\n",
"Bx=-6 #units in meters\n",
"By=0 #units in meters\n",
"Rx=Ax-Bx #units in meters\n",
"Ry=Ay-By #units in meters\n",
"R=sqrt(Rx**2+Ry**2) #units in meters\n",
"theta=round(math.atan(Ry/(Rx))*180/math.pi) #units in degrees\n",
"print \"Resultant R=\",round(R,1),\" Meters\\n\"\n",
"print \"Angle Theta=\",round(theta),\" Degrees\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Resultant R= 15.5 Meters\n",
"\n",
"Angle Theta= 19.0 Degrees\n"
]
}
],
"prompt_number": 18
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.4:pg-30"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" #Example 1_4\n",
"\n",
"\n",
" #To calculate the Volume\n",
"r=3*10**-5 #units in meters\n",
"L=0.20 #units in meters\n",
"V=math.pi*r**2*L #Units in meter**3\n",
"print \"Volume V=\",round(V,12),\"Meter**3\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Volume V= 5.65e-10 Meter**3\n"
]
}
],
"prompt_number": 17
}
],
"metadata": {}
}
]
}
|