100 lines
1.7 KiB
Python
100 lines
1.7 KiB
Python
# coding: utf-8
|
||
from __future__ import print_function
|
||
from lab import *
|
||
import matplotlib.pyplot as plt
|
||
import numpy as np
|
||
|
||
##
|
||
## Part 1
|
||
## equivalent mass
|
||
|
||
mt = 353.36
|
||
mi = np.array([592.67, 576.99, 512.66, 479.75, 498.35])
|
||
mf = np.array([682.53, 678.08, 634.87, 626.51, 626.81])
|
||
T1 = np.array([20.2, 35.1, 21.1, 38.9, 22.5])
|
||
T2 = np.array([83.1, 87.0, 89.9, 87.2, 95.0])
|
||
Te = np.array([38.0, 51.0, 48.9, 61.9, 53.9])
|
||
|
||
m1 = mi-mt
|
||
m2 = mf-mi
|
||
me = m2*(T2-Te)/(Te-T1) - m1
|
||
me = me[2:].mean()
|
||
|
||
print('m_e: ', me)
|
||
|
||
|
||
##
|
||
## Part 2
|
||
## specific heat
|
||
|
||
mt = 359.67
|
||
mi = np.array([713.98, 717.14, 693.60])
|
||
ms = np.array([130.02, 121.85, 38.95])
|
||
m1 = mi-mt
|
||
Ts = 100
|
||
T1 = np.array([21.2, 23.2, 21.2])
|
||
Te = np.array([23.6, 25.3, 23.0])
|
||
|
||
cs = (Te-T1)*(m1+me)/((Ts-Te)*ms)
|
||
|
||
print('''
|
||
rame: {:.1f}
|
||
ottone: {:.1f}
|
||
alluminio: {:.1f}
|
||
'''.format(*cs*4186))
|
||
|
||
|
||
##
|
||
## Part 3
|
||
## Joule constant
|
||
|
||
mt = 354.71
|
||
m = 760.53 - mt
|
||
V = 14
|
||
I = 3
|
||
T = sample(22.0, 23.4, 24.8, 26.4, 27.6, 29.0, 30.4)
|
||
t = sample(0, 1, 2, 3, 4, 5, 6)*60
|
||
|
||
# linear interpolation
|
||
x = np.linspace(0,370)
|
||
a,b = linear(t, T, 0.1)
|
||
f = lambda x: a.n+b.n*x
|
||
|
||
# plot T - t
|
||
plt.xlabel('tempo (s)')
|
||
plt.ylabel('temperatura (s)')
|
||
plt.xlim(0,400)
|
||
plt.scatter(t, T, color='#135964')
|
||
plt.plot(t, f(t), '#317883')
|
||
plt.show()
|
||
|
||
# χ² test
|
||
alpha = chi_squared_fit(t, T, f, 0.1)
|
||
print('χ²: α={:.3f}, α>ε: {}'.format(alpha, alpha>epsilon))
|
||
|
||
# find J from b
|
||
J = I*V/(b*(m+me))
|
||
|
||
print('J={}'.format(J))
|
||
|
||
|
||
##
|
||
## Part 4
|
||
## latent heat
|
||
|
||
mt = 355.12 # calorimeter tare
|
||
mi = 386.61 # calorimeter + ice
|
||
mf = 561.62 # calorimeter + ice + water
|
||
m1 = mf-mi # water
|
||
m2 = mi-mt # ice
|
||
|
||
t1 = 91.1
|
||
t2 = -17
|
||
te = 66.8
|
||
|
||
ca = 4.2045 # water specific heat at 91°C
|
||
cg = 2.0461 # ice specific heat at -17°C
|
||
|
||
l = ca*(m1+me)/m2*(t1-te) + cg*t2 - ca*te
|
||
print(l)
|