aboutsummaryrefslogtreecommitdiff
path: root/jarrio/week9practice.bc
blob: 611dc8ed5489d4de10aff11e8c5c40dcc5375c13 (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
########################################################################
print "Weekly Homework 9\n"
pi = 4*a(1)
epsilon = 8.85 * 10^(-12)
epercoul = 6.24 * 10^18
# Conductivity constants ( resistitvity = 1/sigma)
sigmairon = 1*10^7
sigmacopper = 6*10^7
sigmasilver = 6.2*10^7
sigmagold = 4.1*10^7
sigmaaluminum = 3.5*10^7
sigmatungsten = 1.8*10^7
sigmanichrome = 6.7*10^5
sigmacarbon = 2.9*10^4

print "Question 1\n"
#params
i = 1.9/1000 # A
diam = 5/1000 # m

r = diam/2
"Protons Per Second "
i*epercoul
# i = \int_0^R J_edge (r/R) 2\pi r dr
#   = J_edge/R [ 2\pi r^3 / 3 ]_0^R
#   = 2\pi J_edge R^2/3
jedge = 3*i/(2*pi*r^2)
"J_edge (A/m^2) "
jedge

print "Question 2\n"
# Equilibrium: eta/2epsilon + EF_I2 = EF_I1
# EF_I = V/L = IR/L = I(L/sigma/A)/L = I/(sigma*A)
# eta = 2epsilon * ( I/(sigma1*A)-I/(sigma2*A) )
# Corrections from pearson: apparently it should be eta/epsilon, and the
# sign was opposite, so correct is
print "eta = epsilon * ( I/(sigma2*A)-I/(sigma1*A))\n"
#params
diam = 1/1000 # m
i = 3 # A

a = pi*r^2 # m^2
r = diam/2 # m
"Charge on the boundary "
# eta * a
epsilon * i * (1/(sigmairon*a) - 1/(sigmacopper*a)) * a

print "Question 3\n"
#params
diam = .5 # mm
i = 20 # mA

diam = diam/1000 # m
r = diam/2 # m
i = i/1000 # A

a = pi*r^2
j = i/a
# j = ef*sigma
ef = j/sigmasilver
"Electric Field (V/m) "
ef

"Electron drift speed (m/s) " # idk lol
ve = 5.8 * 10^28 # number/m^3
ie = i*epercoul # number/s
ie/a/ve

print "Question 4\n"
diam = 1 # mm
diam = diam/1000 # m
r = diam/2
a = pi*r^2
# efnichrome = efaluminum
# jnichrome/sigmanichrome = jaluminum/sigmaaluminum
# i/pi*(diam_nichrome/2)^2/sigmanichrome = i/a/sigmaaluminum
# pi*(diam_nichrome/2)^2*sigmanichrome = a*sigmaaluminum
"Diameter of nichrome (m) "
2*sqrt(a*sigmaaluminum/sigmanichrome/pi)

print "Question 5\n"
#params
l = 10 # cm
innerdiam = 2.8 # mm
outerdiam = 3   # mm
v = 3 # V

l = l/100 # m
innerdiam = innerdiam/1000 # m
innerr = innerdiam/2
outerdiam = outerdiam/1000 # m
outerr = outerdiam/2
a = pi*outerr^2 - pi*innerr^2
ef = v/l
j = ef*sigmanichrome
i = j*a
"Current (A) "
i

print "Question 6\n"
print "60W means higher resistance, so it has a higher voltage drop\n"
print "and takes more energy\n"

v = 120 # V
w1 = 60 # W (wattage of lightbulb 1 @ 120V)
# w1 = i*v = v*v/r1
r1 = v^2/w1
r1
w2 = 100 # W
r2 = v^2/w2
i = v/(r1+r2)
print "Power by the first bulb (W) "
i^2*r1
print "Power by the second bulb (W) "
i^2*r2

print "Question 7\n"
#params
r = 70 # Ohm

v = 9 # V
i = v/r

"Magnitude of Current (A) "
i

print "Direction is left to right (positive to negative)\n"

print "Question 8\n"
#params
w = 1100 # W

v = 120 # V
"Resistance (Ohm) "
r = v^2/w
r

"Current (A) "
v/r

print "Question 9\n"
#params
m = 1 # g aluminum
p = 8 # W
v = 1.5 # V

m = m/1000 # kg
r = v^2/p # Ohm
densityaluminum = 2.7 # g/cm^3
densityaluminum = densityaluminum*1000 #kg/m^3
vol = m/densityaluminum # m^3
rhoaluminum = 1/sigmaaluminum # Ohm*m
# R = rhoaluminum * l / A = rhoaluminum * l / (vol/l) =
# rhoaluminum*l^2 / vol
l = sqrt(r/rhoaluminum*vol) # m
# Cross-sectional area
a = vol/l # m^2
"Diameter (mm) "
2*sqrt(a/pi) * 1000

"Length (m) "
l