Charles’ law states that for a constant amount of gas, the volume is proportional to the absolute temperature if the pressure remains constant. V α T for constant P A plot of volume versus Centigrade temperature intercepts the x-axis at -273 oC which suggests that the gas would occupy no volume at this temperature. This theoretical value is known as absolute zero, and is also known as 0 Kelvin.
Heat the water using a Bunsen burner and stir regularly. Measure the length of the trapped air every 10 oC up to 80 oC. Plot a graph of the length of trapped air (y-axis) against temperature (x-axis).
Extrapolating from the gradient should give a value for the x-axis intercept
# Importing the necessary libraries
from matplotlib import pyplot as plt
import numpy as np
#from prettytable import PrettyTable
# Preparing the data to be computed and plotted
dt = np.array([
[1.0, 0.15],
[2.0, 0.29],
[3.0, 0.38],
[4.0, 0.50],
[5.0, 0.60],
[6.0, 0.81],
[7.0, 0.90],
[8.0, 1.13]
])
# Preparing X and y data from the given data
x = dt[:, 0].reshape(dt.shape[0], 1)
X = np.append(x, np.ones((dt.shape[0], 1)), axis=1)
y = dt[:, 1].reshape(dt.shape[0], 1)
# Calculating the parameters using the least square method
theta = np.linalg.inv(X.T.dot(X)).dot(X.T).dot(y)
print(f'The parameters of the line: {theta}')
# Now, calculating the y-axis values against x-values according to
# the parameters theta0 and theta1
y_line = X.dot(theta)
# Plotting the data points and the best fit line
plt.scatter(x, y)
plt.plot(x, y_line, 'r')
plt.title('Best fit line using regression method')
plt.xlabel('Length in cm')
plt.ylabel('Resistance')
plt.show()
#def makePrettyTable(table_col1, table_col2):
# table = PrettyTable()
# table.add_column("Column-1", x)
# table.add_column("Column-2", Y)
#return table
The parameters of the line: [[ 0.13452381] [-0.01035714]]
In comparison, our calculated resistivity is 0.13 Ohm/m vs a databook value of 0.105 Ohm/m This is well within the expected variance of an A-level practical.