# coding: utf-8 from __future__ import division from lab import * import numpy as np # helpers length = lambda x: x/100 mass = lambda x: x/1000 # constants m = mass(260.04) # cart mass (kg) g = 9.80665 # acceleration due to gravity ## ## Collisions ## # 3xmagnet, 2xrubber bumper, 2xputty I = [0.23, 0.28, 0.36, 0.21, 0.27, 0.11, 0.15] # force impulse # cart velocity before-after colliding v = [ (0.46,-0.44), (0.55,-0.54), (0.70,-0.71) # elastic , (0.52,-0.29), (0.68,-0.35) # partially anelastic , (0.41, 0.00), (0.59, 0.00) # anelastic ] for i,_ in enumerate(I): K0, K1 = 1/2*m*v[i][0]**2, 1/2*m*v[i][1] # kinetic energy p0, p1 = m*v[i][0], m*v[i][1] # momentuum dp = round(p1-p0, 3) dk = round(K1-K0, 3) print ''' urto {}: Δp={:.3f}, I={}, ΔK={:.2f} {:.2f}% '''.format(i+1, dp, I[i], dk, abs((dp+I[i])/dp*100)) ## ## Springs ## x0 = 0.8675 # spring at rest offset # force impulse I = [ 0.32, 0.26, 0.35, 0.21, 0.34 # spring A , 0.42, 0.47, 0.50, 0.45, 0.68 # spring B ] # cart velocity before-after colliding v = [ (0.61,-0.58), (0.51,-0.48), (0.66,-0.66), (0.41,-0.38), (0.67,-0.63) # spring A , (0.81,-0.77), (0.89,-0.87), (0.94,-0.93), (0.85,-0.83), (1.32,-1.26) # spring B ] # maximum position reached (spring compressed) x = [ 0.888, 0.885, 0.890, 0.882, 0.887 # spring A , 0.881, 0.884, 0.885, 0.885, 0.888 # spring B ] # maximum force F = [ 5.55, 4.58, 6.29, 3.66, 6.10 # spring A , 18.61, 20.97, 22.25, 19.17, 31.25 # spring B ] ka = [] kb = [] for i,_ in enumerate(I): k = F[i]/(x[i]-x0) # spring elastic constant Ep = 1/2*k*(x[i] -x0)**2 # theoretical value (assuming ΔEm=0) K0, K1 = 1/2*m*v[i][0]**2, 1/2*m*v[i][1] # kinetic energy p0, p1 = m*v[i][0], m*v[i][1] # momentuum dp = round(p1-p0, 3) dk = round(K1-K0, 3) dEm = round(K0-Ep, 3) if i<5: ka.append(k) else: kb.append(k) print ''' urto {}: Δp={:.3f}, I={:.2f}, ΔK={:.2f} {:.2f}% k_{}={:.3f}, ΔΕm={:.3f} '''.format(i+1, dp, I[i], dk, abs((dp+I[i])/dp*100),('a' if i<5 else 'b'), k, dEm) ## ## Attrito ## ## cart # a=0 => μ=tanθ=h/l mu_s = length(11.5)/length(128.7) # a=g(sinθ-μcosθ) a = sample(1.54,1.54,1.50,1.48,1.54,1.53) h, l = length(52.0), length(117.1) mu_d = (h/l) - (a.mean/g)*np.sqrt(1+(h/l)**2) print 'μs={:.2f} μd={:.2f}'.format(mu_s, mu_d) ## teflon block # a=0 => μ=tanθ=h/l mu_s = length(19.8)/length(127.0) # a=g(sinθ-μcosθ) a = sample(0.67,0.79,0.76,0.75,0.78,0.73) h, l = length(34.1), length(125.5) mu_d = (h/l) - (a.mean/g)*np.sqrt(1+(h/l)**2) print 'μs={:.2f} μd={:.2f}'.format(mu_s, mu_d)