diff options
author | Holden Rohrer <hr@hrhr.dev> | 2021-10-20 11:43:33 -0400 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2021-10-20 11:43:33 -0400 |
commit | 4cd17b41af04de301f84e953d7a5ebc0c97d1353 (patch) | |
tree | c06ba9682d10c7e0161c8eb1195691b495c2e40b | |
parent | 6d18ebaa31ed960b051826a2c44c1b770324da2a (diff) |
wrote a calculation for week 9 practice physics
-rw-r--r-- | jarrio/week9practice.bc | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/jarrio/week9practice.bc b/jarrio/week9practice.bc new file mode 100644 index 0000000..611dc8e --- /dev/null +++ b/jarrio/week9practice.bc @@ -0,0 +1,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 |