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
|
{
"metadata": {
"name": "",
"signature": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 3, Forced harmonic oscillator & resonance"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1, page 135"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from __future__ import division\n",
"from math import sqrt, degrees, atan, pi\n",
"# Phase shift\n",
"#given data :\n",
"F0=25 # in N\n",
"m=1 \n",
"f0=F0/m \n",
"K=1*10**3 # in N/m\n",
"w0=sqrt(K/m) \n",
"b=0.05 # in N-s/m\n",
"r=b/(2*m) # in s**-1\n",
"A=f0*10**3/sqrt(9*w0**4+(16*r**2*(w0)**2)) \n",
"print \"The amplitude, A = %0.2f mm \" %A\n",
"p=2*w0 \n",
"fi=atan(2*r*p/(w0**2-p**2)) # radian \n",
"fi = degrees(fi) # degree\n",
"print \"Phase shift is\",round(fi,2),\"degree or\",round(fi*(pi/180),3),\"radian.\"\n",
"#phase shift is converted wrong into radians"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The amplitude, A = 8.33 mm \n",
"Phase shift is -0.06 degree or -0.001 radian.\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2, page 136"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from numpy import array\n",
"# A/Amax\n",
"x1=array([0.99,0.98,0.97]) #\n",
"wt=50 #\n",
"wo=1 #assume\n",
"fo=1 #assume\n",
"for x in x1:\n",
" a=((fo/((wo**2)*((1-x**2)**2+((1/wt**2)*x**2))**(1/2)))) #\n",
" am=fo/((wo**2)*(1/wt**2)**(1/2)) #\n",
" z=a/am #\n",
" print \"For p/wo\",x,\", value of A/Amax is\",round(z,2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"For p/wo 0.99 , value of A/Amax is 0.71\n",
"For p/wo 0.98 , value of A/Amax is 0.45\n",
"For p/wo 0.97 , value of A/Amax is 0.32\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3, page 154"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import pi, sqrt\n",
"# Reactance and impedence\n",
"#given data :\n",
"n=50 # in cycles\n",
"w=2*pi*n # in rad/sec\n",
"L=1/pi # in H\n",
"XL=w*L \n",
"print \"The reactance, XL = %0.0f ohm \" %XL\n",
"R=100 # in ohm\n",
"Z=sqrt(R**2+XL**2) \n",
"print \"The impedence, Z = %0.1f ohm \" %Z"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The reactance, XL = 100 ohm \n",
"The impedence, Z = 141.4 ohm \n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4, page 155"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import sqrt, pi\n",
"# Current and Capacity\n",
"#given data :\n",
"E=110 # in V\n",
"R=10 # in ohm\n",
"L=1*10**-3 # in H\n",
"C=1*10**-6 # in F\n",
"n=10000 # in Hz\n",
"w=2*pi*n \n",
"I=E/sqrt(R**2+((w*L)-(1/(w*C)))**2) \n",
"print \"The current, I = %0.2f A \" %I\n",
"L1=1/(w**2*C) \n",
"print \"The value of capacity, L1 = %0.2e F \" %L1\n",
"#Capacitance is calculated wrong in the textbook"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The current, I = 2.29 A \n",
"The value of capacity, L1 = 2.53e-04 F \n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5, page 155"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import sqrt\n",
"# Resonent frequency and Separation\n",
"#given data :\n",
"L=1*10**-3 # in H\n",
"C=0.1*10**-6 # in F\n",
"w0=1/sqrt(L*C) \n",
"print \"Resonant frequency, w0 = %0.e rad/s \" %w0\n",
"R=10 # in ohm\n",
"w2_w1=R/L \n",
"print \"The separation = %0.e rad/s \" %w2_w1\n",
"S=w0/w2_w1 \n",
"print \"The sharpness = %0.f \" %S"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Resonant frequency, w0 = 1e+05 rad/s \n",
"The separation = 1e+04 rad/s \n",
"The sharpness = 10 \n"
]
}
],
"prompt_number": 16
}
],
"metadata": {}
}
]
}
|