# Student Projects

## Independent-learning super-curriculum projects: reading, research and ideas shared by Perse students # Hooke’s Law Computer Simulation: Equations for Spring Extension

By Alexandru M 7T

Below are the equations for spring extension under the action of a weight:

i = initial length (cm). The initial length is the original length of a spring with no weight applied on it.

e = extension per Newton (cm/N). The extension per Newton is how much a spring extends for every Newton added.

m = mass (g). Mass is the amount of grams applied to a spring that makes it extend.

G = weight (N). Weight is the force of gravity corresponding to a mass. On Earth:

G = m * 10

X = extension (cm). Extension is how much a spring extends from its initial or previous length.

X = G * e

L = total length (cm). The total length is the length of the spring when it has been extended.

L = i + X

Flowchart for calculating spring extension

Based on the equations shown previously, I created the flowchart that calculates spring extension:

 Start
 i = initial length (cm) e = extension per N (cm/N)
 m = mass (g)
 G = m * 10
 X = G * e
 L = i + X
 L > 5 * i
 print “Snap”
 Stop
 print L
 Yes
 No

Spring extension computer simulation

In this part I programmed a simulation of spring extension on Scratch. Below is the link to my spring simulation on Scratch: https://scratch.mit.edu/projects/91592845/

Instructions:

Input the initial length, extension per Newton and the mass. The program will calculate the ‘weight’, ‘extension’ and ‘total length’ and the spring will be redrawn. Press the “+” button to increase the mass by 100g to extend the spring and the “-” button to decrease the mass by 100g to compress it. When the length is 5 times bigger than the initial length the spring will snap. The length is drawn to scale.

 Spring oscillation computer simulation Using additional equations for movement, I created the Flowchart on the left that shows spring oscillation. F = spring reaction force. The spring reaction force is the force of the spring trying to balance the weight applied to it. G = weight. Weight is the force of gravity corresponding to a mass. R = resultant force. The resultant force is the sum of all the forces acting on the bottom-end of the spring. a = acceleration. Acceleration shows how the extension and compression of a spring speeds up or slows down at every simulation interval (t). v = velocity. The velocity is the speed at which a spring extends, but it is always changing due to the acceleration. d = movement distance during simulation interval. It is the distance a spring extends and is calculated at every “t” seconds. t = simulation interval. The simulation interval is an amount time after which the extension of the spring is re-calculated. “t” must be small enough so the acceleration and speed are nearly constant. Here is the link to my scratch project that shows spring oscillation: https://scratch.mit.edu/projects/92445999/ Instructions: Firstly, input the initial length in cm (for example 10), then the extension per Newton in cm/N (for example 2) and the mass in g (for example 100). The program will calculate the weight, spring reaction force, resultant force, acceleration, velocity, movement distance, extension and length. The length is recalculated every “t” seconds and the spring is redrawn. This process makes the spring oscillate. The length is drawn to scale.
 Start
 e = extension per Newton
 i = initial length
 t = time = 0.1
 m = mass
 G = m * 10
 F = X / e
 R = G – F
 a = R / m
 v = v + a * t
 d = v * t
 X = X + d
 L = i + X
 Wait t

Featured image:

Janaka Dharmasena

Published 17/06/12