# Jupyter Lab books

Jan 14, 2022

For the whole time I have been teaching physics I have been an advocate of the lab-book. Working in a formal way and keeping a record of the many practical things is great practice - With the right approach it also trains the students to be breif, precise and to the point - a skill that really pays off in examinations.

Over the last 20 years the paper lab book has repeatedly won-out over all attempts to replace it with an electronic alternative - that is, until now. With the proliferation of elementary python courses at year 8 and 9 a new tool is available to us I would actually argue that the ammount of python that needs to be taught to use jupyter is minimal in the extreme and that it’s a great context in which to learn a new language. - Jupyter.

Disclaimers:

1. There is still a place for hand-drawn graphs & it’s a skill that students need for examinations
3. This may not be suitable for some students.

How it works: Jupyter gives you several cells into which you can write markdown or python code, these cells can be individually executed to run the code within them.

To give you an example

In practice this means that you can mix python code, text, and images all in one document.

When rendered this looks as follows;

# Estimation of Absolute Zero by use of the Gas Laws

## Theory:

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.

## Apparatus:

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
import prettytable

from prettytable import SINGLE_BORDER
# Preparing the data to be computed and plotted
results = np.array([

[13, 16.4],
[17, 16.5],
[21, 16.6],
[25, 16.7],
[29, 16.8],
[33, 16.9],
[35, 17.0],
[39, 17.1],
[43, 17.2],
[45, 17.3],
[49, 17.4]
])

# Preparing X and y data from the given data
x= results[:, 0]

y= results[:,1]

r = 0.0019 #mm
vol = 3.14 * r * r * y

#find line of best fit
a, b = np.polyfit(x, y, 1)

plt.scatter(x,y, color='black', marker='x')

#add line of best fit to plot
plt.plot(x, a*x+b, color='red', linestyle='--', linewidth=2)

#add fitted regression equation to plot
plt.text(5, .1, 'y = ' +'  {:.2f}'.format(a) + 'x' + ' + {:.2f}'.format(b), size=14)
plt.title('Best fit line using regression method')
plt.xlabel('Temp / Deg')
plt.ylabel('Volume/ $m^3$')

table = PrettyTable()
table.add_column("Volume /$m^3$", y)
table.set_style(SINGLE_BORDER)

print(table)

print(a , b)

y=0
zer =(-b)/a
zer = round(zer,0)
print('x-intercept of the line:',zer)

Z= -273.15

off = ((zer - Z)/Z) *100
print(off)

┌──────────────────┬────────────────┐
│ Temperature /Deg │ Volume /$m^3$ │
├──────────────────┼────────────────┤
│       13.0       │      16.4      │
│       17.0       │      16.5      │
│       21.0       │      16.6      │
│       25.0       │      16.7      │
│       29.0       │      16.8      │
│       33.0       │      16.9      │
│       35.0       │      17.0      │
│       39.0       │      17.1      │
│       43.0       │      17.2      │
│       45.0       │      17.3      │
│       49.0       │      17.4      │
└──────────────────┴────────────────┘
0.027956431535269784 16.013018672199163
x-intercept of the line: -573.0
109.77484898407471


!

## Conclusion

Absolute zero is -273.15 degrees celcius, Our result was -573 degrees, therefore our results have an uncertainty of approx 110%

Given the constraints of our measuring instrumentation (+/- One degree)

https://www.britannica.com/science/absolute-zero




← Back to all articles