Hooke's Spring Experiment — Measuring the Spring Constant k

Goal: By hanging different masses from a spring and measuring the extension, determine the spring constant k. Here the main method is linear fitting — one measurement is not enough; you must collect several points and fit the linear trend.
Theoretical background

Hooke's law says the restoring force of a spring (within the elastic range) is proportional to the extension:

F = k · x

When a mass m hangs from the spring, at equilibrium the spring force equals gravity:

k · x = m · g  ⇒  x = (g / k) · m

So if we plot x against m, we get a straight line with slope g/k. Or if we plot F = mg against x, the slope is k itself. We use the second method because it has a more direct meaning.

Errors:

1. Hanging weights

Spring unloaded

Weights


Ruler reading:
cm
Method: Click a weight, wait for the spring to settle. Read the value from the magnifier (that appears next to the spring) — reading precision is 1 mm. Then click "Record". At least 4 measurements with different masses are needed.

Note: Even without any weight you can see the ruler zero-point on the magnifier — if it doesn't read 0.0 cm without a load, the ruler isn't calibrated.

2. Measurement data

# Mass m (g) Force F = mg (N) Extension x (cm) k = F/x (N/m) Action
No measurements yet. Collect at least 4 points with different masses.

3. Automatic calculation

To compute, record at least 3 measurements with different masses.

4. Analysis with Python — proper linear fit

Proper method: linear fit F = k·x + b using scipy.optimize.curve_fit (or numpy.polyfit). If intercept b comes out nonzero, that reveals the ruler zero-point offset — and the value b = -k·δ tells us how much. This is the only way to identify the systematic error from data.

Data is in trials_data: list of dicts with keys m_g, x_cm. Use the constant g = 9.81 m/s².
Pyodide not loaded — the first "Run" downloads it
Python execution output appears here

5. Reveal the true value