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
|
{
"metadata": {
"name": "",
"signature": "sha256:25d377db4166fc7d1439fb19889672d7cd5de596e5478e8198d3671878cf5493"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h1>Chapter 9: Maxwells Equations<h1>"
]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 9.1, Page number: 375"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"import scipy\n",
"import scipy.integrate\n",
"\n",
"#Variable Declaration\n",
"\n",
"u2=20\n",
"B2=4\n",
"l=0.06\n",
"#Calculations\n",
"\n",
"def ansa(x,y): \n",
" return 4*10**3\n",
"Va, erra = scipy.integrate.dblquad(lambda y , x: ansa(x,y), #in V \n",
" 0, 0.06, lambda y: 0, lambda y: 0.08)\n",
"\n",
"Vb=-u2*B2*l #in mV\n",
"\n",
"def ansc(x,y): \n",
" return 4\n",
"psic, errc = scipy.integrate.dblquad(lambda y , x: ansc(x,y), #in mWb \n",
" 0, 0.06, lambda y: 0, lambda y: 1)\n",
"\n",
"#Results\n",
"\n",
"print 'Va =',Va,'sin(10^6t) V'\n",
"print 'Vb =',Vb,'mV'\n",
"print 'Vc= ',psic*10**3,'cos(10^6t-y) -',psic*10**3,'cos(10^6t) V'\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Va = 19.2 sin(10^6t) V\n",
"Vb = -4.8 mV\n",
"Vc= 240.0 cos(10^6t-y) - 240.0 cos(10^6t) V\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
"source": [
"Example 9.3, Page number: 379"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"import scipy\n",
"\n",
"#Variable Declaration\n",
"\n",
"n1=200\n",
"n2=100 \n",
"S=10**-3 #cross section in m^2\n",
"muo=4*scipy.pi*10**-7 #permeabiility of free space\n",
"mur=500 #relative permeability\n",
"r=10*10**-3 #radius in m\n",
"\n",
"#Calculations\n",
"\n",
"psiI=n1*muo*mur*S/(2*scipy.pi*r)\n",
"\n",
"#Result\n",
"\n",
"print 'V2 =',psiI*n2*300*scipy.pi,'cos(100pi t) V'\n",
"print '= 6Pi cos(100pi t) V'\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"V2 = 188.495559215 cos(100pi t) V\n",
"= 6Pi cos(100pi t) V\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<h3>Example 9.5, Page number: 393<h3>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
" \n",
"import scipy\n",
"import cmath\n",
"from numpy import *\n",
"\n",
"\n",
"#Variable Declaration\n",
"\n",
"z3=1j\n",
"z4=3+4j \n",
"z5=-1+6j \n",
"z6=3+4j\n",
"z7=1+1j\n",
"z8=4-8j\n",
"\n",
"#Calculations\n",
"\n",
"z1=(z3*z4/(z5*z6))\n",
"z2=scipy.sqrt(z7/z8)\n",
"z1r=round(z1.real,4) #real part of z1 rounded to 4 decimal places\n",
"z1i=round(z1.imag,4) #imaginary part of z1 rounded to 4 decimal places\n",
"z2r=round(z2.real,4) #real part of z2 rounded to 4 decimal places\n",
"z2i=round(z2.imag,4) #imaginary part of z2 rounded to 4 decimal places\n",
"\n",
"absz2=round(abs(z2),4) #absolute value of z2 rounded to 4 decimal places\n",
"\n",
"ang=scipy.arctan(z2i/z2r)*180/scipy.pi #in degrees\n",
"\n",
"#Results\n",
"\n",
"print 'z1 =',z1r,'+',z1i,'j'\n",
"print 'z2 ='\n",
"print 'mod =',absz2,'and angle=',round(ang,1),'degrees'"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"z1 = 0.1622 + -0.027 j\n",
"z2 =\n",
"mod = 0.3976 and angle= 54.2 degrees\n"
]
}
],
"prompt_number": 1
}
],
"metadata": {}
}
]
}
|